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 |
|---|---|---|---|---|---|
ff5801ad0ccbc11deadeb37fa20922ebab878f5f | diff --git a/cmd/kubeadm/app/cmd/token.go b/cmd/kubeadm/app/cmd/token.go
index <HASH>..<HASH> 100644
--- a/cmd/kubeadm/app/cmd/token.go
+++ b/cmd/kubeadm/app/cmd/token.go
@@ -92,6 +92,9 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
Use: "delete",
Short: "Delete bootstrap tokens on the server.",
Run: func(tokenCmd *cobra.Command, args []string) {
+ if len(args) < 1 {
+ kubeadmutil.CheckErr(fmt.Errorf("missing subcommand; 'token delete' is missing token of form [\"^([a-z0-9]{6})$\"]"))
+ }
err := RunDeleteToken(out, tokenCmd, args[0])
kubeadmutil.CheckErr(err)
}, | kubeadm: fix to avoid panic if token not provided
Prior to this, kubeadm would panic if no token was provided. This does a
check and prints out a more reasonable message. | kubernetes_kubernetes | train | go |
d486f6ab9b6885ac7468db8b9d5741197a2d7e42 | diff --git a/server/reload.go b/server/reload.go
index <HASH>..<HASH> 100644
--- a/server/reload.go
+++ b/server/reload.go
@@ -1106,8 +1106,17 @@ func (s *Server) reloadAuthorization() {
for _, route := range s.routes {
routes = append(routes, route)
}
+ var resetCh chan struct{}
+ if s.sys != nil {
+ // can't hold the lock as go routine reading it may be waiting for lock as well
+ resetCh = s.sys.resetCh
+ }
s.mu.Unlock()
+ if resetCh != nil {
+ resetCh <- struct{}{}
+ }
+
// Close clients that have moved accounts
for _, client := range cclients {
client.closeConnection(ClientClosed)
diff --git a/server/server.go b/server/server.go
index <HASH>..<HASH> 100644
--- a/server/server.go
+++ b/server/server.go
@@ -515,8 +515,6 @@ func (s *Server) configureAccounts() error {
s.mu.Unlock()
// acquires server lock separately
s.addSystemAccountExports(acc)
- // can't hold the lock as go routine reading it may be waiting for lock as well
- s.sys.resetCh <- struct{}{}
s.mu.Lock()
}
if err != nil { | Move reset of internal client to after the account sublist was moved.
This does not avoid the race condition, but makes it less likely to
trigger in unit tests. | nats-io_gnatsd | train | go,go |
6312a41e037954850867f29d329e5007df1424a5 | diff --git a/src/saml2/authn.py b/src/saml2/authn.py
index <HASH>..<HASH> 100644
--- a/src/saml2/authn.py
+++ b/src/saml2/authn.py
@@ -146,7 +146,8 @@ class UsernamePasswordMako(UserAuthnMethod):
return resp
def _verify(self, pwd, user):
- assert is_equal(pwd, self.passwd[user])
+ if not is_equal(pwd, self.passwd[user]):
+ raise ValueError("Wrong password")
def verify(self, request, **kwargs):
"""
@@ -176,7 +177,7 @@ class UsernamePasswordMako(UserAuthnMethod):
return_to = create_return_url(self.return_to, _dict["query"][0],
**{self.query_param: "true"})
resp = Redirect(return_to, headers=[cookie])
- except (AssertionError, KeyError):
+ except (ValueError, KeyError):
resp = Unauthorized("Unknown user or wrong password")
return resp | Quick fix for the authentication bypass due to optimizations #<I> | IdentityPython_pysaml2 | train | py |
c218df87d7fa0aa13ead7080fed84b5c9a3ac3ef | diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py
index <HASH>..<HASH> 100644
--- a/telethon/telegram_bare_client.py
+++ b/telethon/telegram_bare_client.py
@@ -86,7 +86,7 @@ class TelegramBareClient:
if not api_id or not api_hash:
raise PermissionError(
"Your API ID or Hash cannot be empty or None. "
- "Refer to Telethon's README.rst for more information.")
+ "Refer to Telethon's wiki for more information.")
self._use_ipv6 = use_ipv6 | Remove reference to README.rst (#<I>) | LonamiWebs_Telethon | train | py |
93fd045488565879bc40a6d942e165a9148351ca | diff --git a/core/src/main/java/com/google/bitcoin/core/Peer.java b/core/src/main/java/com/google/bitcoin/core/Peer.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/com/google/bitcoin/core/Peer.java
+++ b/core/src/main/java/com/google/bitcoin/core/Peer.java
@@ -818,7 +818,7 @@ public class Peer {
* Returns the elapsed time of the last ping/pong cycle. If {@link com.google.bitcoin.core.Peer#ping()} has never
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}.
*/
- public long getLastPingTime() {
+ public synchronized long getLastPingTime() {
if (lastPingTimes == null)
return Long.MAX_VALUE;
return lastPingTimes[lastPingTimes.length - 1];
@@ -829,7 +829,7 @@ public class Peer {
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}. The moving average
* window is 5 buckets.
*/
- public long getPingTime() {
+ public synchronized long getPingTime() {
if (lastPingTimes == null)
return Long.MAX_VALUE;
long sum = 0; | Lock the ping time accessors correctly. | bitcoinj_bitcoinj | train | java |
a905420a7d350f4fe753ae1e3dcb78be39e97875 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -69,8 +69,12 @@ module.exports = function(schema) {
function defaultOptions(pathname, v) {
const ret = { path: pathname, options: { maxDepth: 10 } };
- if (v.ref) {
+ if (v.ref != null) {
ret.model = v.ref;
+ ret.ref = v.ref;
+ }
+ if (v.refPath != null) {
+ ret.refPath = v.refPath;
}
return ret;
}
@@ -107,7 +111,7 @@ function handleObject(value, optionsToUse) {
}
function handleFunction(fn, options) {
- const val = fn.call(this);
+ const val = fn.call(this, options);
processOption.call(this, val, options);
} | fix: call function with options and include refPath in options
Fix #<I> | mongodb-js_mongoose-autopopulate | train | js |
11a42a06bed69974111a5c126bbf7411fbc103ae | diff --git a/icomoon/__init__.py b/icomoon/__init__.py
index <HASH>..<HASH> 100644
--- a/icomoon/__init__.py
+++ b/icomoon/__init__.py
@@ -1,4 +1,4 @@
"""
A Django app to deploy wefonts from Icomoon and display them
"""
-__version__ = '0.4.0'
+__version__ = '1.0.0-pre.1' | Bump to <I> pre release 1 | sveetch_django-icomoon | train | py |
f15019a28b01bb58f36ee4bc99154cf6578ce490 | diff --git a/compiler/src/Composer/ComposerJsonManipulator.php b/compiler/src/Composer/ComposerJsonManipulator.php
index <HASH>..<HASH> 100644
--- a/compiler/src/Composer/ComposerJsonManipulator.php
+++ b/compiler/src/Composer/ComposerJsonManipulator.php
@@ -103,6 +103,9 @@ final class ComposerJsonManipulator
}
$phpstanVersion = $json[self::REQUIRE][self::PHPSTAN_PHPSTAN];
+ // use exact version
+ $phpstanVersion = ltrim($phpstanVersion, '^');
+
$json[self::REQUIRE]['phpstan/phpstan-src'] = $phpstanVersion;
unset($json[self::REQUIRE][self::PHPSTAN_PHPSTAN]); | use extact version in phpstan compiler to rector.phar | rectorphp_rector | train | php |
bc322f162e7f549e365b0735370ccb67e13da75b | diff --git a/Eloquent/Collection.php b/Eloquent/Collection.php
index <HASH>..<HASH> 100755
--- a/Eloquent/Collection.php
+++ b/Eloquent/Collection.php
@@ -6,7 +6,7 @@ use LogicException;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Contracts\Support\Arrayable;
-use Illuminate\Database\Eloquent\Relations\Pivot;
+use Illuminate\Contracts\Queue\QueueableEntity;
use Illuminate\Contracts\Queue\QueueableCollection;
use Illuminate\Support\Collection as BaseCollection;
@@ -541,7 +541,7 @@ class Collection extends BaseCollection implements QueueableCollection
return [];
}
- return $this->first() instanceof Pivot
+ return $this->first() instanceof QueueableEntity
? $this->map->getQueueableId()->all()
: $this->modelKeys();
} | Fix QueueableCollection relying on Pivot->getQueueableId() instead of QueueableEntity->getQueueableId()
Found this issue during development where we have a model that uses binary UUIDs.
While the single model serialization works fine, the collection serialization +
JSON encoding breaks. | illuminate_database | train | php |
ab91ed06067411fbfb7221f27689db812fc1d86a | diff --git a/pypeerassets/kutil.py b/pypeerassets/kutil.py
index <HASH>..<HASH> 100644
--- a/pypeerassets/kutil.py
+++ b/pypeerassets/kutil.py
@@ -69,9 +69,11 @@ class Kutil:
).hexdigest()[0:8]
return b58encode(step1 + unhexlify(checksum))
-
+
@staticmethod
def check_wif(wif):
+ '''check if WIF is properly formated.'''
+
b58_wif = b58decode(wif)
check = b58_wif[-4:]
checksum = sha256(sha256(b58_wif[:-4]).digest()).digest()[0:4] | added docstring to check_wif method. | PeerAssets_pypeerassets | train | py |
b2baa2c76f688dce2961b51a7684c1128c291c58 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -49,7 +49,7 @@ var googleapis = require('googleapis'),
return callback(err);
}
}
-
+
// Cache the response, if caching is on
if(cache ) {
var fileName = getCacheFileName(args);
@@ -159,6 +159,7 @@ module.exports = function(args, callback, settings){
"filters": args.filters,
'dimensions': args.dimensions,
"max-results": args.maxResults,
+ "start-index": args.startIndex,
sort: args.sort,
auth: oauth2Client
});
@@ -182,4 +183,4 @@ module.exports = function(args, callback, settings){
}
}
});
-};
\ No newline at end of file
+}; | Added startIndex to gaArgs to allow paging. | jsguy_ga-api | train | js |
50debf85ff295f4d0b8691dfc814f7cbf39dd844 | diff --git a/primefaces/src/main/resources/META-INF/resources/primefaces/timeline/1-timeline.js b/primefaces/src/main/resources/META-INF/resources/primefaces/timeline/1-timeline.js
index <HASH>..<HASH> 100644
--- a/primefaces/src/main/resources/META-INF/resources/primefaces/timeline/1-timeline.js
+++ b/primefaces/src/main/resources/META-INF/resources/primefaces/timeline/1-timeline.js
@@ -438,8 +438,8 @@ PrimeFaces.widget.Timeline = PrimeFaces.widget.DeferredWidget.extend({
var snap = inst.itemSet.options.snap || null;
var scale = inst.body.util.getScale();
var step = inst.body.util.getStep();
- var snappedStart = snap ? snap(xstart, scale, step).toDate() : xstart;
- var snappedEnd = snap ? snap(xend, scale, step).toDate() : xend;
+ var snappedStart = snap ? new Date(snap(xstart, scale, step)) : xstart;
+ var snappedEnd = snap ? new Date(snap(xend, scale, step)) : xend;
var params = [];
params.push({ | Fix #<I>: Timeline no longer assume moment date from snap (#<I>) | primefaces_primefaces | train | js |
8b8d94e01ca06e0884f103bca907276a13b50ae0 | diff --git a/src/python/twitter/pants/targets/internal.py b/src/python/twitter/pants/targets/internal.py
index <HASH>..<HASH> 100644
--- a/src/python/twitter/pants/targets/internal.py
+++ b/src/python/twitter/pants/targets/internal.py
@@ -195,12 +195,6 @@ class InternalTarget(Target):
"""Subclasses can over-ride to reject invalid dependencies."""
return True
- def replace_dependency(self, dependency, replacement):
- self.dependencies.discard(dependency)
- self.internal_dependencies.discard(dependency)
- self.jar_dependencies.discard(dependency)
- self.update_dependencies([replacement])
-
def _walk(self, walked, work, predicate = None):
Target._walk(self, walked, work, predicate)
for dep in self.dependencies:
@@ -229,5 +223,3 @@ class InternalTarget(Target):
self.add_to_exclusives(t.exclusives)
elif hasattr(t, "declared_exclusives"):
self.add_to_exclusives(t.declared_exclusives)
-
- | Get rid of unused replace_dependency method.
(sapling split of e<I>cd<I>d<I>f0f3c<I>df1bccf0eefde<I>d<I>) | pantsbuild_pants | train | py |
e8616b982c0e1e5ff03aa87e4d1b71934592c65e | diff --git a/test/publish.spec.js b/test/publish.spec.js
index <HASH>..<HASH> 100644
--- a/test/publish.spec.js
+++ b/test/publish.spec.js
@@ -22,6 +22,6 @@ describe('publish.js', () => {
return stream.once('data');
})
.finally(stream.close);
- });
+ }).timeout(10000);
});
});
\ No newline at end of file
diff --git a/test/readme.spec.js b/test/readme.spec.js
index <HASH>..<HASH> 100644
--- a/test/readme.spec.js
+++ b/test/readme.spec.js
@@ -15,6 +15,6 @@ describe('readme.js', () => {
expect(output).to.match(/Error: Cannot read property 'title'/);
})
.finally(stream.close);
- });
+ }).timeout(10000);
});
}); | Increase timeout to avoid breaking build (again) | rung-tools_rung-cli | train | js,js |
47cb93c250f0267c678489bf994e5b4dded41fb9 | diff --git a/src/API/QueryBuilder.php b/src/API/QueryBuilder.php
index <HASH>..<HASH> 100755
--- a/src/API/QueryBuilder.php
+++ b/src/API/QueryBuilder.php
@@ -208,6 +208,7 @@ class QueryBuilder extends Injectable
}
}
+ $count = 1;
foreach ($processedSearchFields as $processedSearchField) {
switch ($processedSearchField['queryType']) {
case 'and':
@@ -251,7 +252,6 @@ class QueryBuilder extends Injectable
// update to bind params instead of using string concatination
$queryArr = [];
$valueArr = [];
- $count = 1;
foreach ($fieldNameArray as $fieldName) {
$fieldName = $this->prependFieldNameNamespace($fieldName);
foreach ($fieldValueArray as $fieldValue) { | fix a bug when you pass 2 query params one with field=v1||v2||v3 and another query like f1||f2||f3=*a* | gte451f_phalcon-json-api-package | train | php |
d971e2024c5e34db7468663ea4b98e9398975ee9 | diff --git a/src/main/java/org/altbeacon/beacon/powersave/BackgroundPowerSaver.java b/src/main/java/org/altbeacon/beacon/powersave/BackgroundPowerSaver.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/altbeacon/beacon/powersave/BackgroundPowerSaver.java
+++ b/src/main/java/org/altbeacon/beacon/powersave/BackgroundPowerSaver.java
@@ -44,8 +44,8 @@ public class BackgroundPowerSaver implements Application.ActivityLifecycleCallba
LogManager.w(TAG, "BackgroundPowerSaver requires API 18 or higher.");
return;
}
- ((Application)context.getApplicationContext()).registerActivityLifecycleCallbacks(this);
beaconManager = BeaconManager.getInstanceForApplication(context);
+ ((Application)context.getApplicationContext()).registerActivityLifecycleCallbacks(this);
}
@Override | Prevent crash due to null beaconManager by getting instance before starting power save callbacks | AltBeacon_android-beacon-library | train | java |
a6d83dfae18aad74dcd45be1b809de8080ccc63a | diff --git a/src/rez/utils/colorize.py b/src/rez/utils/colorize.py
index <HASH>..<HASH> 100644
--- a/src/rez/utils/colorize.py
+++ b/src/rez/utils/colorize.py
@@ -193,12 +193,7 @@ def _color(str_, fore_color=None, back_color=None, styles=None):
.. _Colorama:
https://pypi.python.org/pypi/colorama
"""
- # TODO: Colorama is documented to work on Windows and trivial test case
- # proves this to be the case, but it doesn't work in Rez. If the initialise
- # is called in sec/rez/__init__.py then it does work, however as discussed
- # in the following comment this is not always desirable. So until we can
- # work out why we forcibly turn it off.
- if not config.get("color_enabled", False) or platform_.name == "windows":
+ if not config.get("color_enabled", False):
return str_
# lazily init colorama. This is important - we don't want to init at startup, | Remove windows exception from colorize.py | nerdvegas_rez | train | py |
375cc8dc22d907017e30e13a6d68c040bdeadae8 | diff --git a/src/Convert/Converters/Gmagick.php b/src/Convert/Converters/Gmagick.php
index <HASH>..<HASH> 100644
--- a/src/Convert/Converters/Gmagick.php
+++ b/src/Convert/Converters/Gmagick.php
@@ -107,7 +107,7 @@ class Gmagick extends AbstractConverter
$im->setimageformat('WEBP');
- // Not completely sure if setimageoption() has always been there, so lets check first. #169
+ // setimageoption() has not always been there, so check first. #169
if (method_exists($im, 'setimageoption')) {
// Finally cracked setting webp options.
// See #167 | Changed a comment. Closes #<I> | rosell-dk_webp-convert | train | php |
0a4c3ceed3dc7cc505c10a6a80a3276868c6fa8e | diff --git a/mopidy_musicbox_webclient/static/js/functionsvars.js b/mopidy_musicbox_webclient/static/js/functionsvars.js
index <HASH>..<HASH> 100644
--- a/mopidy_musicbox_webclient/static/js/functionsvars.js
+++ b/mopidy_musicbox_webclient/static/js/functionsvars.js
@@ -238,7 +238,7 @@ function resultsToTables(results, target, uri) {
for (i = 0; i < length; i++) {
//create album if none extists
if (!results[i].album) {
- results[i].album = {};
+ results[i].album = {"__model__": "Album"};
}
//create album uri if there is none
if (!results[i].album.uri) { | Better fake up Album model for stricter mopidy validation. (Fixes #<I>).
This is a bit of a hack. The better solution is to only send URIs rather than full Track models. | pimusicbox_mopidy-musicbox-webclient | train | js |
67458d0dd88c60f60bddb4835e6f5a6f38376d45 | diff --git a/src/Illuminate/Foundation/Console/AppNameCommand.php b/src/Illuminate/Foundation/Console/AppNameCommand.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Foundation/Console/AppNameCommand.php
+++ b/src/Illuminate/Foundation/Console/AppNameCommand.php
@@ -59,6 +59,8 @@ class AppNameCommand extends Command {
$this->setAuthConfigNamespace();
$this->info('Application namespace set!');
+
+ $this->call('dump-autoload');
}
/** | Dump auto loads after app:name set. | laravel_framework | train | php |
af6683546d77001ed9db685f023071c69cd81376 | diff --git a/lib/merb-core/logger.rb b/lib/merb-core/logger.rb
index <HASH>..<HASH> 100755
--- a/lib/merb-core/logger.rb
+++ b/lib/merb-core/logger.rb
@@ -161,7 +161,7 @@ module Merb
# Close and remove the current log object.
def close
flush
- @log.close if @log.respond_to?(:close)
+ @log.close if @log.respond_to?(:close) && !@log.tty?
@log = nil
end
@@ -227,4 +227,4 @@ module Merb
end
-end
\ No newline at end of file
+end
diff --git a/spec/public/logger/logger_spec.rb b/spec/public/logger/logger_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/public/logger/logger_spec.rb
+++ b/spec/public/logger/logger_spec.rb
@@ -102,6 +102,12 @@ describe Merb::Logger do
@logger.close
end
+ it "shouldn't call the close method if the log is a terminal" do
+ @logger.log.should_receive(:tty?).and_return(true)
+ @logger.log.should_not_receive(:close)
+ @logger.close
+ end
+
it "should set the stored log attribute to nil" do
@logger.close
@logger.log.should eql(nil)
@@ -172,4 +178,4 @@ describe Merb::Logger do
end
-end
\ No newline at end of file
+end | Ensure that Merb::Logger doesn't try to close terminal streams. | wycats_merb | train | rb,rb |
79f329fb4f3763df85da97c8a50e9ec61e63adeb | diff --git a/mapping/sql/all/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/ParserFileTest.java b/mapping/sql/all/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/ParserFileTest.java
index <HASH>..<HASH> 100644
--- a/mapping/sql/all/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/ParserFileTest.java
+++ b/mapping/sql/all/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/ParserFileTest.java
@@ -52,7 +52,7 @@ public class ParserFileTest extends TestCase {
public ParserFileTest() {
OntopMappingSQLAllConfiguration configuration = OntopMappingSQLAllConfiguration.defaultBuilder()
- .jdbcUrl("fake_url")
+ .jdbcUrl("jdbc:h2:mem:fake")
.jdbcUser("fake_user")
.jdbcPassword("fake_password")
.build(); | More realistic JDBC url given to ParserFileTest. | ontop_ontop | train | java |
ac8d190a440c525fa946c789c9883e1e1f1debe7 | diff --git a/lib/mongo/background_thread.rb b/lib/mongo/background_thread.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo/background_thread.rb
+++ b/lib/mongo/background_thread.rb
@@ -129,7 +129,16 @@ module Mongo
# Some driver objects can be reconnected, for backwards compatibiilty
# reasons. Clear the thread instance variable to support this cleanly.
if @thread.alive?
- log_warn("Failed to stop background thread in #{self} in #{(Time.now - start_time).to_i} seconds")
+ log_warn("Failed to stop the background thread in #{self} in #{(Time.now - start_time).to_i} seconds: #{@thread.inspect} (thread status: #{@thread.status})")
+ # On JRuby the thread may be stuck in aborting state
+ # seemingly indefinitely. If the thread is aborting, consider it dead
+ # for our purposes (we will create a new thread if needed, and
+ # the background thread monitor will not detect the aborting thread
+ # as being alive).
+ if @thread.status == 'aborting'
+ @thread = nil
+ @stop_requested = false
+ end
false
else
@thread = nil
diff --git a/lib/mongo/server/monitor.rb b/lib/mongo/server/monitor.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo/server/monitor.rb
+++ b/lib/mongo/server/monitor.rb
@@ -136,7 +136,7 @@ module Mongo
# Forward super's return value
super.tap do
# Important: disconnect should happen after the background thread
- # terminated.
+ # terminates.
connection.disconnect!
end
end | RUBY-<I> Consider threads in aborting state dead (#<I>) | mongodb_mongo-ruby-driver | train | rb,rb |
335b045325c1d488aae79db1726baeeeeb4fc573 | diff --git a/packages/ui-text-area/src/TextArea/styles.js b/packages/ui-text-area/src/TextArea/styles.js
index <HASH>..<HASH> 100644
--- a/packages/ui-text-area/src/TextArea/styles.js
+++ b/packages/ui-text-area/src/TextArea/styles.js
@@ -77,14 +77,11 @@ const generateStyle = (theme, themeOverride, props, state) => {
wordWrap: 'break-word',
textAlign: 'start',
...fontSizeVariants[size],
- '&:focus + span': {
+ '&:focus + [class$=-textArea__outline]': {
transform: 'scale(1)',
opacity: 1
},
- '&[aria-invalid]': {
- borderColor: componentTheme.errorBorderColor
- },
- '&[aria-invalid]:focus, &[aria-invalid]:focus + span': {
+ '&[aria-invalid], &[aria-invalid]:focus, &[aria-invalid]:focus + [class$=-textArea__outline]': {
borderColor: componentTheme.errorBorderColor
},
'&::placeholder': { | refactor: make CSS selectors more specific | instructure_instructure-ui | train | js |
1de299c0dc0b5359a419297e5ac8f54dbd54d95c | diff --git a/src/RuleSet/RuleSetDescriptionInterface.php b/src/RuleSet/RuleSetDescriptionInterface.php
index <HASH>..<HASH> 100644
--- a/src/RuleSet/RuleSetDescriptionInterface.php
+++ b/src/RuleSet/RuleSetDescriptionInterface.php
@@ -19,8 +19,6 @@ namespace PhpCsFixer\RuleSet;
*/
interface RuleSetDescriptionInterface
{
- public function __construct();
-
public function getDescription(): string;
public function getName(): string; | Remove __constructor() from RuleSetDescriptionInterface
Constructor should be defined by the implementation, not by the interface. | FriendsOfPHP_PHP-CS-Fixer | train | php |
007a64a8258b7c0346e93985b42f8d71e15b4bcc | diff --git a/synapse/lib/storm.py b/synapse/lib/storm.py
index <HASH>..<HASH> 100644
--- a/synapse/lib/storm.py
+++ b/synapse/lib/storm.py
@@ -1464,7 +1464,7 @@ class Runtime(Configable):
limt = self.getLiftLimitHelp(opts.get('limit'))
if isinstance(limt.limit, int) and limt.limit < 0:
- raise s_common.BadOperArg(oper='pivottags', name='limit', mesg='limit must be >= 0')
+ raise s_common.BadOperArg(oper=oper[0], name='limit', mesg='limit must be >= 0')
if take:
nodes = query.take() | Use correct oper name in raising BadOperArg | vertexproject_synapse | train | py |
63a2ff7029815e3b41a69e83430b9b58ea0bef59 | diff --git a/evcache-client/src/main/java/com/netflix/evcache/pool/EVCacheClient.java b/evcache-client/src/main/java/com/netflix/evcache/pool/EVCacheClient.java
index <HASH>..<HASH> 100644
--- a/evcache-client/src/main/java/com/netflix/evcache/pool/EVCacheClient.java
+++ b/evcache-client/src/main/java/com/netflix/evcache/pool/EVCacheClient.java
@@ -1121,7 +1121,12 @@ public class EVCacheClient {
public boolean shutdown(long timeout, TimeUnit unit) {
shutdown = true;
- return evcacheMemcachedClient.shutdown(timeout, unit);
+ try {
+ return evcacheMemcachedClient.shutdown(timeout, unit);
+ } catch(Throwable t) {
+ log.warn("Exception while sutting down", t);
+ return true;
+ }
}
public EVCacheConnectionObserver getConnectionObserver() { | if there is any exception while shutting down we will not propagate it | Netflix_EVCache | train | java |
fbdc28b2e68ac52eb194ceda04572218c9c9d582 | diff --git a/src/Layers/BasemapLayer.js b/src/Layers/BasemapLayer.js
index <HASH>..<HASH> 100644
--- a/src/Layers/BasemapLayer.js
+++ b/src/Layers/BasemapLayer.js
@@ -204,7 +204,7 @@ export var BasemapLayer = TileLayer.extend({
Util.setOptions(this, tileOptions);
- if (this.options.token) {
+ if (this.options.token && !config.urlTemplate.includes('token=')) {
config.urlTemplate += ('?token=' + this.options.token);
} | Prevent token repeating in url
Fix for #<I> | Esri_esri-leaflet | train | js |
58f5c2cb6faa9a516ead4594c8ea4dcc5f75a182 | diff --git a/lib/dm-core/collection.rb b/lib/dm-core/collection.rb
index <HASH>..<HASH> 100644
--- a/lib/dm-core/collection.rb
+++ b/lib/dm-core/collection.rb
@@ -1142,10 +1142,7 @@ module DataMapper
# TODO: spec what should happen when none of the resources in self are saved
query = relationship.query_for(self)
-
- if other_query
- query.update(other_query)
- end
+ query.update(other_query) if other_query
query.model.all(query)
end | Cosmetics: use postfix condition in Collection#delegate_to_relationship | datamapper_dm-core | train | rb |
3f6e372b925b3b6ff28b8f4a33a64d2e835f2e58 | diff --git a/lib/flor/unit/storage.rb b/lib/flor/unit/storage.rb
index <HASH>..<HASH> 100644
--- a/lib/flor/unit/storage.rb
+++ b/lib/flor/unit/storage.rb
@@ -191,17 +191,14 @@ module Flor
n = Time.now
- @db.transaction do
-
- @db[:flor_messages]
- .import(
- [ :domain, :exid, :point, :content,
- :status, :ctime, :mtime ],
- ms.map { |m|
- [ Flor.domain(m['exid']), m['exid'], m['point'], to_blob(m),
- 'created', n, n ]
- })
- end
+ @db[:flor_messages]
+ .import(
+ [ :domain, :exid, :point, :content,
+ :status, :ctime, :mtime ],
+ ms.map { |m|
+ [ Flor.domain(m['exid']), m['exid'], m['point'], to_blob(m),
+ 'created', n, n ]
+ })
@unit.wake_executions(ms.collect { |m| m['exid'] }.uniq)
end | revert "use transaction in Storage#put_messages"
This reverts commit ea2fbfa<I>cb<I>a<I>dc<I>a1c<I>f<I>a8e7. | floraison_flor | train | rb |
304f3d4f959a297207204b08695b8d349305d31a | diff --git a/test/integration/test_runner.py b/test/integration/test_runner.py
index <HASH>..<HASH> 100644
--- a/test/integration/test_runner.py
+++ b/test/integration/test_runner.py
@@ -42,6 +42,7 @@ def test_run_command_with_unicode(rc):
if six.PY2:
expected = expected.decode('utf-8')
rc.command = ['echo', '"utf-8-䉪ቒ칸ⱷ?噂폄蔆㪗輥"']
+ rc.env = {"䉪ቒ칸": "蔆㪗輥"}
status, exitcode = Runner(config=rc).run()
assert status == 'successful'
assert exitcode == 0 | Adding test for unicode environment | ansible_ansible-runner | train | py |
6444a4eefbff70ba571ec29e3ea6bbdda4344b55 | diff --git a/simplesqlite/core.py b/simplesqlite/core.py
index <HASH>..<HASH> 100644
--- a/simplesqlite/core.py
+++ b/simplesqlite/core.py
@@ -1492,7 +1492,7 @@ class SimpleSQLite(object):
return [record[0] for record in result]
- def __extract_attr_desc_list_from_tabledata(self, table_data, primary_key):
+ def __extract_attr_descs_from_tabledata(self, table_data, primary_key):
if primary_key and primary_key not in table_data.headers:
raise ValueError("primary key must be one of the values of attributes")
@@ -1545,8 +1545,7 @@ class SimpleSQLite(object):
).normalize()
self.create_table(
- table_data.table_name,
- self.__extract_attr_desc_list_from_tabledata(table_data, primary_key),
+ table_data.table_name, self.__extract_attr_descs_from_tabledata(table_data, primary_key)
)
self.insert_many(table_data.table_name, table_data.value_matrix)
if typepy.is_not_empty_sequence(index_attrs): | Refactor: rename a private method | thombashi_SimpleSQLite | train | py |
06f857f4e6236406449a1f21812616d9dc5f3d57 | diff --git a/spec/lib/redis_analytics/dashboard_spec.rb b/spec/lib/redis_analytics/dashboard_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/redis_analytics/dashboard_spec.rb
+++ b/spec/lib/redis_analytics/dashboard_spec.rb
@@ -6,24 +6,24 @@ describe Rack::RedisAnalytics::Dashboard do
context 'the pretty dashboard' do
- before do
- Rack::RedisAnalytics.configure do |c|
- c.dashboard_endpoint = '/analytics/dashboard'
- end
+ it 'should redirect to visits' do
+ get '/'
+ last_response.should be_redirect
+ # how do we check the redirect location?
end
it 'should be mapped to configured endpoint' do
- get Rack::RedisAnalytics.dashboard_endpoint
+ get '/'
last_response.ok?
end
it 'should be content-type html' do
- get Rack::RedisAnalytics.dashboard_endpoint
+ get '/'
last_response.headers['Content-Type'] == "text/html"
end
it 'should contain the word Visits' do
- get Rack::RedisAnalytics.dashboard_endpoint
+ get '/'
last_response.body.include? "Visits"
end | dashboard endpoint is not mandatory, dashboard app should test against '/' | d0z0_redis_analytics | train | rb |
e21279071704abe7406d745778cdb4243fa26644 | diff --git a/lib/ipc.js b/lib/ipc.js
index <HASH>..<HASH> 100644
--- a/lib/ipc.js
+++ b/lib/ipc.js
@@ -920,14 +920,14 @@ Ipc.prototype.subscribeQueue = function(options, callback)
// It keeps a count how many subscribe/unsubscribe calls been made and stops any internal listeners once nobody is
// subscribed. This is specific to a queue which relies on polling.
//
-Ipc.prototype.subscribeQueue = function(options, callback)
+Ipc.prototype.unsubscribeQueue = function(options, callback)
{
if (typeof options == "function") callback = options, options = null;
- logger.dev("ipc.subscribeQueue:", options);
+ logger.dev("ipc.unsubscribeQueue:", options);
try {
- this.getClient(options).subscribeQueue(options || lib.empty, typeof callback == "function" ? callback : undefined);
+ this.getClient(options).unsubscribeQueue(options || lib.empty, typeof callback == "function" ? callback : undefined);
} catch (e) {
- logger.error('ipc.subscribeQueue:', options, e.stack);
+ logger.error('ipc.unsubscribeQueue:', options, e.stack);
}
return this;
} | fixed unsubscribedQueue | vseryakov_backendjs | train | js |
07927bfea802025b434b6af1fca72b230f5a5d4f | diff --git a/nodeconductor/structure/serializers.py b/nodeconductor/structure/serializers.py
index <HASH>..<HASH> 100644
--- a/nodeconductor/structure/serializers.py
+++ b/nodeconductor/structure/serializers.py
@@ -233,6 +233,14 @@ class ProjectSerializer(core_serializers.RestrictedSerializerMixin,
return queryset.select_related('customer').only(*related_fields)\
.prefetch_related('quotas', 'certifications')
+ def get_fields(self):
+ fields = super(ProjectSerializer, self).get_fields()
+
+ if self.instance:
+ fields['certifications'].read_only = True
+
+ return fields
+
def create(self, validated_data):
certifications = validated_data.pop('certifications', [])
project = super(ProjectSerializer, self).create(validated_data) | Mark certifications as readonly on project update
It is not allowed to update certifications on direct project update
through PUT or POST request. /update_certifications method is used for
that purpose. | opennode_waldur-core | train | py |
c37220e08f1915411e4eeffd078562a837c49324 | diff --git a/libraries/lithium/tests/cases/util/StringTest.php b/libraries/lithium/tests/cases/util/StringTest.php
index <HASH>..<HASH> 100644
--- a/libraries/lithium/tests/cases/util/StringTest.php
+++ b/libraries/lithium/tests/cases/util/StringTest.php
@@ -366,6 +366,14 @@ class StringTest extends \lithium\test\Unit {
$result = String::tokenize('tagA "single tag" tagB', ' ', '"', '"');
$expected = array('tagA', '"single tag"', 'tagB');
$this->assertEqual($expected, $result);
+
+ $result = String::tokenize(array());
+ $expected = array();
+ $this->assertEqual($expected, $result);
+
+ $result = String::tokenize(null);
+ $expected = null;
+ $this->assertEqual($expected, $result);
}
/** | Adding test coverage for `util\String::tokenize()` | UnionOfRAD_framework | train | php |
83b160fc7af0c3dffe78bf4e18ccbedffe0ee1f4 | diff --git a/dantil.js b/dantil.js
index <HASH>..<HASH> 100644
--- a/dantil.js
+++ b/dantil.js
@@ -250,7 +250,7 @@ exports.getModuleCallerPathAndLineNumber = function () {
* @private
* @static
* @param {Function} getFrameFunc The function passed the structured stack trace and returns a single stack frame.
- * @returns {String} Returns the file path and line number of the frame returned by `getFrameFunc` in the format `filePath:lineNumber`.
+ * @returns {string} Returns the file path and line number of the frame returned by `getFrameFunc` in the format `filePath:lineNumber`.
*/
function getFormattedStackFrame(getFrameFunc) {
var origStackTraceLimit = Error.stackTraceLimit | Tweak JSDoc to use lowercase for primitive types | DannyNemer_dantil | train | js |
3b13545d3847f75c78becc8d56e6b524ed9d6a5b | diff --git a/lib/jazzy/doc_builder.rb b/lib/jazzy/doc_builder.rb
index <HASH>..<HASH> 100644
--- a/lib/jazzy/doc_builder.rb
+++ b/lib/jazzy/doc_builder.rb
@@ -43,6 +43,7 @@ module Jazzy
stdout = SourceKitten.run_sourcekitten(options.xcodebuild_arguments)
exitstatus = $?.exitstatus
if exitstatus == 0
+ warn 'building site'
build_docs_for_sourcekitten_output(stdout, options)
else
warn 'Please pass in xcodebuild arguments using -x' | added 'building site' status message | realm_jazzy | train | rb |
db64f5c74e9075349bab1e92fb64390d2960cca4 | diff --git a/e2e/visual/webpack.config.js b/e2e/visual/webpack.config.js
index <HASH>..<HASH> 100644
--- a/e2e/visual/webpack.config.js
+++ b/e2e/visual/webpack.config.js
@@ -26,6 +26,12 @@ module.exports = {
content: 'mini-html-webpack-template',
},
],
+ scripts: [
+ {
+ src:
+ '//polyfill.io/v3/polyfill.min.js?features=Set%2CArray.prototype.%40%40iterator%2CArray.prototype.find',
+ },
+ ],
},
body: {
raw: '<div id="app"></div>', | chore(e2e): add polyfills to Cartesian application | telus_tds-core | train | js |
19a124700fd9941ae090973a37afc529a5c2db61 | diff --git a/core.js b/core.js
index <HASH>..<HASH> 100644
--- a/core.js
+++ b/core.js
@@ -3621,14 +3621,13 @@ const _makeWindow = (options = {}, parent = null, top = null) => {
},
},
getVRDisplaysSync() {
- const result = [];
+ const result = fakeVrDisplays.slice();
if (nativeMl && nativeMl.IsPresent()) {
result.push(_getMlDisplay(window));
}
if (nativeVr.VR_IsHmdPresent()) {
result.push(_getVrDisplay(window));
}
- result.push.apply(result, fakeVrDisplays);
return result;
},
getVRDisplays() { | Make fake vr dispalys come first in getVRDisplaysSync | exokitxr_exokit | train | js |
ceeaf8967543e0da66abd116136570665b5bc320 | diff --git a/tasks/typescript.js b/tasks/typescript.js
index <HASH>..<HASH> 100644
--- a/tasks/typescript.js
+++ b/tasks/typescript.js
@@ -20,12 +20,11 @@ module.exports = function (grunt) {
resolvePath:path.resolve,
readFile:function (file){
- var content = grunt.file.read(file);
+ var content = fs.readFileSync(file, 'utf8');
// strip UTF BOM
if(content.charCodeAt(0) === 0xFEFF){
content = content.slice(1);
}
-
return content;
},
dirName:path.dirname, | fix task failure when typescript looks for files that may be missing
typescript seems to look for files by trying to read them, this causes
problems as if the grunt.file.read fails it will fail the task. | k-maru_grunt-typescript | train | js |
62696b0622dce58f93dec9e70d16c999f348a3d5 | diff --git a/src/Router/RouterRequest.php b/src/Router/RouterRequest.php
index <HASH>..<HASH> 100644
--- a/src/Router/RouterRequest.php
+++ b/src/Router/RouterRequest.php
@@ -47,9 +47,9 @@ class RouterRequest
protected static function checkMethods($value, $method)
{
$valid = false;
- if ($value === 'AJAX' && self::isAjax && $value === $method) {
+ if ($value === 'AJAX' && self::isAjax() && $value === $method) {
$valid = true;
- } elseif ($value === 'AJAXP' && self::isAjax && $method === 'POST') {
+ } elseif ($value === 'AJAXP' && self::isAjax() && $method === 'POST') {
$valid = true;
} elseif (in_array($value, explode('|', self::$validMethods)) && ($value === $method || $value === 'ANY')) {
$valid = true; | Bug fixed on isAjax method. | izniburak_php-router | train | php |
7f3aca62c4178649fe271cf31fc4652a3ef7e4b4 | diff --git a/storage/remote/queue_manager.go b/storage/remote/queue_manager.go
index <HASH>..<HASH> 100644
--- a/storage/remote/queue_manager.go
+++ b/storage/remote/queue_manager.go
@@ -526,7 +526,8 @@ func (t *QueueManager) calculateDesiredShards() int {
samplesPendingRate = samplesInRate*samplesKeptRatio - samplesOutRate
highestSent = t.highestSentTimestampMetric.Get()
highestRecv = highestTimestamp.Get()
- samplesPending = (highestRecv - highestSent) * samplesInRate * samplesKeptRatio
+ delay = highestRecv - highestSent
+ samplesPending = delay * samplesInRate * samplesKeptRatio
)
if samplesOutRate <= 0 {
@@ -577,6 +578,12 @@ func (t *QueueManager) calculateDesiredShards() int {
}
numShards := int(math.Ceil(desiredShards))
+ // Do not downshard if we are more than ten seconds back.
+ if numShards < t.numShards && delay > 10.0 {
+ level.Debug(t.logger).Log("msg", "Not downsharding due to being too far behind")
+ return t.numShards
+ }
+
if numShards > t.cfg.MaxShards {
numShards = t.cfg.MaxShards
} else if numShards < t.cfg.MinShards { | Only reduce the number of shards when caught up. | prometheus_prometheus | train | go |
0dff6a9030d8f2ff7a03654258f3b02f01d9d57e | diff --git a/caravel/db_engine_specs.py b/caravel/db_engine_specs.py
index <HASH>..<HASH> 100644
--- a/caravel/db_engine_specs.py
+++ b/caravel/db_engine_specs.py
@@ -56,6 +56,7 @@ class PostgresEngineSpec(BaseEngineSpec):
Grain("day", _('day'), "DATE_TRUNC('day', {col})"),
Grain("week", _('week'), "DATE_TRUNC('week', {col})"),
Grain("month", _('month'), "DATE_TRUNC('month', {col})"),
+ Grain("quarter", _('quarter'), "DATE_TRUNC('quarter', {col})"),
Grain("year", _('year'), "DATE_TRUNC('year', {col})"),
) | Add quarter time grain to postgresql (#<I>)
The timestamp returned is the start date of the period.
Reference:
<URL> | apache_incubator-superset | train | py |
11bef5cb940163d7d9e490a9413b8495fc8d13e2 | diff --git a/lib/SlackBot.js b/lib/SlackBot.js
index <HASH>..<HASH> 100755
--- a/lib/SlackBot.js
+++ b/lib/SlackBot.js
@@ -396,10 +396,11 @@ function Slackbot(configuration) {
if (slack_botkit.config.redirectUri) {
var redirect_query = '';
- if (redirect_params)
+ var redirect_uri = slack_botkit.config.redirectUri;
+ if (redirect_params) {
redirect_query += encodeURIComponent(querystring.stringify(redirect_params));
-
- var redirect_uri = slack_botkit.config.redirectUri + '?' + redirect_query;
+ redirect_uri = redirect_uri + '?' + redirect_query;
+ }
url += '&redirect_uri=' + redirect_uri;
} | Fix issue with creation of redirectUri when parameters were not included | howdyai_botkit | train | js |
14c135dceeb4dd9f1ad8d15a6e2dec7678abe7f8 | diff --git a/stream-lib.js b/stream-lib.js
index <HASH>..<HASH> 100644
--- a/stream-lib.js
+++ b/stream-lib.js
@@ -13,7 +13,6 @@
/**
* Associative array of lib classes.
* @type {{}}
- * @property {streamLib.Beat} Beat
* @property {streamLib.BufferStream} Buffer
* @property {streamLib.Concat} Concat
* @property {streamLib.EventStream} Event
@@ -25,14 +24,17 @@
* @property {streamLib.Random} Random
* @property {streamLib.Sequencer} Sequencer
* @property {streamLib.Spawn} Spawn
- * @property {streamLib.Sluice} Sluice
* @property {streamLib.Unit} Unit
* @property {streamLib.UpperCase} UpperCase
*/
+/*
+ * @property {streamLib.Beat} Beat private at this time
+ * @property {streamLib.Sluice} Sluice private at this time
+ */
var streamLib = {
- Beat: require('./lib/beat'), // jsdoc-methods
- Buffer: require('./lib/buffer'), // OK
- Concat: require('./lib/concat'), // OK
+ Beat: require('./lib/beat'),
+ Buffer: require('./lib/buffer'),
+ Concat: require('./lib/concat'),
Event: require('./lib/event'),
hex: require('./lib/hex'),
LowerCase: require('./lib/lower-case'), | fix required libraries in doc for private ones | atd-schubert_node-stream-lib | train | js |
49d57b190385ac67965e8e80a659bfc5c63d20e5 | diff --git a/python/mxnet/metric.py b/python/mxnet/metric.py
index <HASH>..<HASH> 100644
--- a/python/mxnet/metric.py
+++ b/python/mxnet/metric.py
@@ -3,7 +3,7 @@
"""Online evaluation metric module."""
from __future__ import absolute_import
-
+import math
import numpy
from . import ndarray
@@ -261,9 +261,11 @@ class Perplexity(EvalMetric):
pred = pred*(1-ignore) + ignore
loss -= ndarray.sum(ndarray.log(ndarray.maximum(1e-10, pred))).asscalar()
num += pred.size
- self.sum_metric += math.exp(loss/num)
- self.num_inst += 1
+ self.sum_metric += loss
+ self.num_inst += num
+ def get(self):
+ return (self.name, math.exp(self.sum_metric/self.num_inst))
####################
# REGRESSION METRICS | Compute perplexity by averaging over the document (#<I>)
* Compute perplexity by averaging over the document
solve the problem that the perplexity is related to the batch size
* Update metric.py
* Update metric.py | apache_incubator-mxnet | train | py |
045ca303947e7e9209cee4b3fdede05f6dbb02c4 | diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -463,7 +463,7 @@ module ActiveRecord #:nodoc:
#
# # You can use the same string replacement techniques as you can with ActiveRecord#find
# Post.find_by_sql ["SELECT title FROM posts WHERE author = ? AND created > ?", author_id, start_date]
- # > [#<Post:0x36bff9c @attributes={"first_name"=>"The Cheap Man Buys Twice"}>, ...]
+ # > [#<Post:0x36bff9c @attributes={"title"=>"The Cheap Man Buys Twice"}>, ...]
def find_by_sql(sql, binds = [])
connection.select_all(sanitize_sql(sql), "#{name} Load", binds).collect! { |record| instantiate(record) }
end | fixes a missmatched column in example | rails_rails | train | rb |
5a1bb2b7f6f63acd4c3db8fd1c34a43d44fc0152 | diff --git a/tests/test-rest-posts-controller.php b/tests/test-rest-posts-controller.php
index <HASH>..<HASH> 100644
--- a/tests/test-rest-posts-controller.php
+++ b/tests/test-rest-posts-controller.php
@@ -181,10 +181,10 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
$this->assertNotEmpty( $tag_link );
$this->assertNotEmpty( $cat_link );
- $tags_url = rest_url( '/wp/v2/post/' . $this->post_id . '/terms/tag' );
+ $tags_url = rest_url( '/wp/v2/posts/' . $this->post_id . '/terms/tag' );
$this->assertEquals( $tags_url, $tag_link['href'] );
- $category_url = rest_url( '/wp/v2/post/' . $this->post_id . '/terms/category' );
+ $category_url = rest_url( '/wp/v2/posts/' . $this->post_id . '/terms/category' );
$this->assertEquals( $category_url, $cat_link['href'] );
} | Fix typo in post terms url test | WP-API_WP-API | train | php |
423ece86ed4efa957e10edc0cc416ffe9a333b5c | diff --git a/api/util_test.go b/api/util_test.go
index <HASH>..<HASH> 100644
--- a/api/util_test.go
+++ b/api/util_test.go
@@ -10,6 +10,10 @@ import (
. "launchpad.net/gocheck"
)
+type UtilSuite struct{}
+
+var _ = Suite(&UtilSuite{})
+
func (s *S) TestFileSystem(c *C) {
fsystem = &testing.RecordingFs{}
c.Assert(filesystem(), DeepEquals, fsystem) | Creating a suite for util test. | tsuru_tsuru | train | go |
5db4e1804284d40e6d78caaf472579f66e6b17f5 | diff --git a/src/core/resolve.js b/src/core/resolve.js
index <HASH>..<HASH> 100644
--- a/src/core/resolve.js
+++ b/src/core/resolve.js
@@ -147,8 +147,8 @@ function resolverReducer(resolvers, map) {
function requireResolver(name, modulePath) {
try {
// Try to resolve package with absolute path (/Volumes/....)
- if (path.isAbsolute(name)) {
- return require(path.resolve(name));
+ if (isAbsolute(name)) {
+ return require(name)
}
try { | Require module with absolute path without resolving | benmosher_eslint-plugin-import | train | js |
d0d8b9e9815c1f837ef8149889f03c75fd92f82e | diff --git a/src/android/BackgroundMode.java b/src/android/BackgroundMode.java
index <HASH>..<HASH> 100644
--- a/src/android/BackgroundMode.java
+++ b/src/android/BackgroundMode.java
@@ -44,7 +44,7 @@ public class BackgroundMode extends CordovaPlugin {
private boolean isDisabled = false;
// Settings for the notification
- static JSONObject settings;
+ static JSONObject settings = new JSONObject();
// Used to (un)bind the service to with the activity
private ServiceConnection connection = new ServiceConnection() { | Fix null pointer exception for settings | katzer_cordova-plugin-background-mode | train | java |
0a167c16ec7901245aaaaddc56391c7deddecf5b | diff --git a/spec/mail/encodings_spec.rb b/spec/mail/encodings_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/mail/encodings_spec.rb
+++ b/spec/mail/encodings_spec.rb
@@ -246,8 +246,9 @@ describe Mail::Encodings do
mail[:subject].charset = 'koi8-r'
wrapped = mail[:subject].wrapped_value
unwrapped = Mail::Encodings.value_decode(wrapped)
+ orginial = original.force_encoding('koi8-r') if RUBY_VERSION >= "1.9"
- unwrapped.gsub("Subject: ", "").should == original.force_encoding('koi8-r')
+ unwrapped.gsub("Subject: ", "").should == original
end
end | Yeah yeah, I fixed for ruby <I>, but neglected to test with older rubies. I'm a dud! (<URL>) | mikel_mail | train | rb |
5d347c41bf9940f3a86770b87f07cf0fb8541d08 | diff --git a/resolver.go b/resolver.go
index <HASH>..<HASH> 100644
--- a/resolver.go
+++ b/resolver.go
@@ -30,12 +30,8 @@ type Resolver struct {
// New initializes a Resolver with the specified cache size.
func New(capacity int) *Resolver {
r := &Resolver{
- cache: newCache(capacity),
- client: &dns.Client{
- DialTimeout: Timeout,
- ReadTimeout: Timeout,
- WriteTimeout: Timeout,
- },
+ cache: newCache(capacity),
+ client: &dns.Client{Timeout: Timeout},
}
return r
} | Create new resolvers with the default timeout.
Previously, the default timeout was used for each operation, which extended the effective
timeout to 3x the intended value. | domainr_dnsr | train | go |
ca26ba58d9558ee1ac372536a816cb0abb186105 | diff --git a/src/main/java/org/xbill/DNS/Zone.java b/src/main/java/org/xbill/DNS/Zone.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/xbill/DNS/Zone.java
+++ b/src/main/java/org/xbill/DNS/Zone.java
@@ -539,11 +539,9 @@ public class Zone implements Serializable {
/** Returns the contents of the Zone in master file format. */
public synchronized String toMasterFile() {
- Iterator zentries = data.entrySet().iterator();
StringBuffer sb = new StringBuffer();
nodeToString(sb, originNode);
- while (zentries.hasNext()) {
- Map.Entry entry = (Map.Entry) zentries.next();
+ for (Map.Entry<Name, Object> entry : data.entrySet()) {
if (!origin.equals(entry.getKey())) {
nodeToString(sb, entry.getValue());
} | Migrate iterator to foreach | dnsjava_dnsjava | train | java |
68403ec93d51d2d8a1e6c2bfb2822db5b6930cb4 | diff --git a/minivents.js b/minivents.js
index <HASH>..<HASH> 100644
--- a/minivents.js
+++ b/minivents.js
@@ -1,5 +1,5 @@
function Events(target){
- var events = {}, i, A = Array;
+ var events = {};
target = target || this
/**
* On: listen to events
@@ -20,7 +20,7 @@ function Events(target){
* Emit: send event, callbacks will be triggered
*/
target.emit = function(){
- var args = A.apply([], arguments),
+ var args = Array.apply([], arguments),
list = events[args.shift()] || [],
i = list.length, j
for(j=0;j<i;j++) list[j].f.apply(list[j].c, args) | simplifications
- `A` is only used once, so I'd suggest to use the native `Array` instead.
- `i` is defined in each method separately, no need to define it on constructor | allouis_minivents | train | js |
e207959717538836d1dc99076de1d779013fb376 | diff --git a/matrix_client/client.py b/matrix_client/client.py
index <HASH>..<HASH> 100644
--- a/matrix_client/client.py
+++ b/matrix_client/client.py
@@ -393,7 +393,7 @@ class Room(object):
self.events.pop(0)
for listener in self.listeners:
- listener(event)
+ listener(self, event)
def get_events(self):
""" Get the most recent events for this room. | client: Pass room as arguement to event callbacks.
When we get an event, the room part is striped away before the event
callback on the room gets the event. So inside the callback there
is no easy way to find in which room the event has happened. | matrix-org_matrix-python-sdk | train | py |
490e0f6ae7568cd4ba867a98836e13933b2af74c | diff --git a/lib/phusion_passenger/platform_info/apache.rb b/lib/phusion_passenger/platform_info/apache.rb
index <HASH>..<HASH> 100644
--- a/lib/phusion_passenger/platform_info/apache.rb
+++ b/lib/phusion_passenger/platform_info/apache.rb
@@ -170,7 +170,7 @@ module PlatformInfo
end
# The Apache config file supports environment variable
# substitution. Ubuntu uses this extensively.
- filename.gsub!(/\${(.+?)}/) do |varname|
+ filename.gsub!(/\$\{(.+?)\}/) do |varname|
if value = httpd_infer_envvar($1, options)
log "Substituted \"#{varname}\" -> \"#{value}\""
value | Fix regex compatibiliy problem with Ruby <I> | phusion_passenger | train | rb |
d0d7781798f466e20e68aa463f3ce3777b381db7 | diff --git a/resolwe/flow/managers/workload_connectors/kubernetes.py b/resolwe/flow/managers/workload_connectors/kubernetes.py
index <HASH>..<HASH> 100644
--- a/resolwe/flow/managers/workload_connectors/kubernetes.py
+++ b/resolwe/flow/managers/workload_connectors/kubernetes.py
@@ -498,9 +498,9 @@ class Connector(BaseConnector):
# Create kubernetes API every time otherwise it will time out
# eventually and raise API exception.
try:
- kubernetes.config.load_incluster_config()
- except kubernetes.config.config_exception.ConfigException:
kubernetes.config.load_kube_config()
+ except kubernetes.config.config_exception.ConfigException:
+ kubernetes.config.load_incluster_config()
batch_api = kubernetes.client.BatchV1Api()
core_api = kubernetes.client.CoreV1Api() | Change credentials loading order
First try to load credentials from file and then from incluster config. | genialis_resolwe | train | py |
0cc0b80a2b0d734eb9a9a40e4eb6fae2b00c3762 | diff --git a/lib/sup/index.rb b/lib/sup/index.rb
index <HASH>..<HASH> 100644
--- a/lib/sup/index.rb
+++ b/lib/sup/index.rb
@@ -6,7 +6,7 @@ begin
require 'chronic'
$have_chronic = true
rescue LoadError => e
- debug "optional 'chronic' library not found; date-time query restrictions disabled"
+ debug "No 'chronic' gem detected. Install it for date/time query restrictions."
$have_chronic = false
end | change chronic missing message to be similar to that of ncursesw | sup-heliotrope_sup | train | rb |
22fa61ac5c71515d397942557f6ec6605c8aa729 | diff --git a/benchexec/model.py b/benchexec/model.py
index <HASH>..<HASH> 100644
--- a/benchexec/model.py
+++ b/benchexec/model.py
@@ -91,7 +91,7 @@ def load_task_definition_file(task_def_file):
raise BenchExecException("Invalid task definition: " + str(e))
if not task_def:
- raise BenchExecException(f"Invalid task definition: empty file {task_def_file}")
+ raise BenchExecException("Invalid task definition: empty file " + task_def_file)
if str(task_def.get("format_version")) not in ["0.1", "1.0"]:
raise BenchExecException( | Fix syntax error from <I>a1a<I>a1da1c<I>e5a<I>d<I>e | sosy-lab_benchexec | train | py |
4d721b5d11ecf05e35d08c7972f4244b9b5e3582 | diff --git a/app/models/agents/email_digest_agent.rb b/app/models/agents/email_digest_agent.rb
index <HASH>..<HASH> 100644
--- a/app/models/agents/email_digest_agent.rb
+++ b/app/models/agents/email_digest_agent.rb
@@ -11,7 +11,7 @@ module Agents
used events also relies on the `Keep events` option of the emitting Agent, meaning that if events expire before
this agent is scheduled to run, they will not appear in the email.
- By default, the will have a `subject` and an optional `headline` before listing the Events. If the Events'
+ By default, the email will have a `subject` and an optional `headline` before listing the Events. If the Events'
payloads contain a `message`, that will be highlighted, otherwise everything in
their payloads will be shown. | Add missing word in description of an agent | huginn_huginn | train | rb |
d1920a3b4612b86da4f3e735540a3c7cf19c8dd0 | diff --git a/tests/scripts/test_phy_spikesort.py b/tests/scripts/test_phy_spikesort.py
index <HASH>..<HASH> 100644
--- a/tests/scripts/test_phy_spikesort.py
+++ b/tests/scripts/test_phy_spikesort.py
@@ -21,4 +21,4 @@ def test_quick_start(chdir_tempdir):
main('download hybrid_10sec.dat')
main('download hybrid_10sec.prm')
main('spikesort hybrid_10sec.prm')
- main('cluster-manual hybrid_10sec.kwik')
+ # main('cluster-manual hybrid_10sec.kwik') | Don't open the GUI by default in integration test. | kwikteam_phy | train | py |
d6d6fac1ab19d261be3986fe27c5d8e04650ae8c | diff --git a/generators/generator-constants.js b/generators/generator-constants.js
index <HASH>..<HASH> 100644
--- a/generators/generator-constants.js
+++ b/generators/generator-constants.js
@@ -8,7 +8,7 @@ const DOCKER_MARIADB = 'mariadb:10.1.16';
const DOCKER_POSTGRESQL = 'postgres:9.5.3';
const DOCKER_MONGODB = 'mongo:3.3.9';
const DOCKER_CASSANDRA = 'cassandra:2.2.7';
-const DOCKER_ELASTICSEARCH = 'elasticsearch:1.7.5';
+const DOCKER_ELASTICSEARCH = 'elasticsearch:2.3.5';
const DOCKER_SONAR = 'sonarqube:5.6-alpine';
const DOCKER_JHIPSTER_CONSOLE = 'jhipster/jhipster-console:v1.3.0';
const DOCKER_JHIPSTER_ELASTICSEARCH = 'jhipster/jhipster-elasticsearch:v1.3.0'; | upgrade elasticsearch to <I> (#<I>)
Fix #<I> | jhipster_generator-jhipster | train | js |
e83dd9bf9ef63881a9aab91373ea0c855d1634ff | diff --git a/lib/veewee/definitions.rb b/lib/veewee/definitions.rb
index <HASH>..<HASH> 100644
--- a/lib/veewee/definitions.rb
+++ b/lib/veewee/definitions.rb
@@ -67,7 +67,7 @@ module Veewee
git_template = false
# Check if the template is a git repo
- if template_name.start_with?("git://")
+ if template_name.start_with?("git://", "git+ssh://", "git+http://")
git_template = true
end | Support git via SSH and HTTP
Simple and obvious patch who workforus® in production | jedi4ever_veewee | train | rb |
0f9fa8c08cb055d031dcd435e1488172395e707c | diff --git a/pymatgen/analysis/local_env.py b/pymatgen/analysis/local_env.py
index <HASH>..<HASH> 100644
--- a/pymatgen/analysis/local_env.py
+++ b/pymatgen/analysis/local_env.py
@@ -2489,8 +2489,8 @@ class CrystalNN(NearNeighbors):
NNData = namedtuple("nn_data", ["all_nninfo", "cn_weights", "cn_nninfo"])
def __init__(self, weighted_cn=False, cation_anion=False,
- distance_cutoffs=(1.25, 2), x_diff_weight=True,
- search_cutoff=6, fingerprint_length=None):
+ distance_cutoffs=(1.25, 2), x_diff_weight=1.0,
+ search_cutoff=6.0, fingerprint_length=None):
"""
Initialize CrystalNN with desired paramters. | fix bug in default val (should be float, not bool) | materialsproject_pymatgen | train | py |
fd77883a3fc0a68ca1701a5bfb12ec9b4934ef06 | diff --git a/desugarer.go b/desugarer.go
index <HASH>..<HASH> 100644
--- a/desugarer.go
+++ b/desugarer.go
@@ -302,8 +302,8 @@ func desugar(astPtr *astNode, objLevel int) (err error) {
return unimplErr
case *astLocal:
- for _, bind := range ast.binds {
- err = desugar(&bind.body, objLevel)
+ for i := range ast.binds {
+ err = desugar(&ast.binds[i].body, objLevel)
if err != nil {
return
} | Fix local bind body not being desugared
In Go `for i, val := range arr` creates a *copy*
so it was changing some temporary value. | google_go-jsonnet | train | go |
e222a5bd9da4ee34405e3a3870e5e4b220076bfc | diff --git a/grimoire_elk/panels.py b/grimoire_elk/panels.py
index <HASH>..<HASH> 100755
--- a/grimoire_elk/panels.py
+++ b/grimoire_elk/panels.py
@@ -63,7 +63,8 @@ def find_item_json(elastic, type_, item_id):
item_json_url = elastic.index_url+"/doc/"+item_id
res = requests_ses.get(item_json_url, verify=False)
- res.raise_for_status()
+ if res.status_code == 200 and res.status_code == 404:
+ res.raise_for_status()
item_json = res.json() | [panels] If an item is not found in .kibana don't raise an exception
It is normal than in an empty Kibana a dashboard for example does not
exists yet. Just raise a requests exception if not found is not the case. | chaoss_grimoirelab-elk | train | py |
e355bf5bb43c47b11cec470e83505cb157b2f00a | diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py
index <HASH>..<HASH> 100644
--- a/parsimonious/expressions.py
+++ b/parsimonious/expressions.py
@@ -32,18 +32,18 @@ class Expression(object):
# http://stackoverflow.com/questions/1336791/dictionary-vs-object-which-is-more-efficient-and-why
__slots__ = []
- def parse(self, text):
+ def parse(self, text, pos=0):
"""Return a parse tree of ``text``.
Initialize the packrat cache and kick off the first ``match()`` call.
"""
- # The packrat cache. {expr: [length matched at text index 0,
- # length matched at text index 1, ...],
+ # The packrat cache. {(oid, pos): [length matched at text index 0,
+ # length matched at text index 1, ...],
# ...}
cache = {}
- return self.match(text, 0, cache)
+ return self.match(text, pos, cache)
# TODO: Freak out if the text didn't parse completely: if we didn't get
# all the way to the end.
@@ -74,7 +74,11 @@ class Expression(object):
class Literal(Expression):
- """A string literal"""
+ """A string literal
+
+ Use these if you can; they're the fastest.
+
+ """
__slots__ = ['literal']
def __init__(self, literal): | Support parsing from not-the-beginning of a string. | erikrose_parsimonious | train | py |
f959eede2135d6dbc5592aee125c5cce24c90ae0 | diff --git a/lib/mongoid/document.rb b/lib/mongoid/document.rb
index <HASH>..<HASH> 100644
--- a/lib/mongoid/document.rb
+++ b/lib/mongoid/document.rb
@@ -266,10 +266,10 @@ module Mongoid #:nodoc:
def instantiate(attrs = nil)
attributes = attrs || {}
if attributes["_id"]
- document = allocate
- document.instance_variable_set(:@attributes, attributes)
- document.setup_modifications
- document
+ allocate.tap do |doc|
+ doc.instance_variable_set(:@attributes, attributes)
+ doc.setup_modifications
+ end
else
new(attrs)
end | Slight refactoring of Document.instantiate | mongodb_mongoid | train | rb |
9766c25f0d629ebea177a14fe5d2ec18c209003a | diff --git a/app/helpers/contextual_link_helpers.rb b/app/helpers/contextual_link_helpers.rb
index <HASH>..<HASH> 100644
--- a/app/helpers/contextual_link_helpers.rb
+++ b/app/helpers/contextual_link_helpers.rb
@@ -22,7 +22,12 @@ module ContextualLinkHelpers
end
def icon_link_to(action, url = nil, options = {})
- classes = ["btn"]
+ classes = []
+ if class_options = options.delete(:class)
+ classes << class_options.split(' ')
+ end
+
+ classes << "btn"
url ||= {:action => action} | Support passing in a :class param as option in icon_link_to. | huerlisi_i18n_rails_helpers | train | rb |
31189472d241e7e4901e0db597a3a29babfc70e0 | diff --git a/make/config.js b/make/config.js
index <HASH>..<HASH> 100644
--- a/make/config.js
+++ b/make/config.js
@@ -126,9 +126,7 @@ Promise.resolve(new ConfigFile())
config.content.host.java = javaInstalled;
return askForQualityMetrics(config);
})
+ .then(() => config.save()) // Save before checking Selenium (which updates the configuration file)
.then(() => askForSelenium(config))
- .then(() => fs.mkdirAsync("tmp"))
- .then(undefined, () => {}) // ignore mkdir error
- .then(() => config.save())
)["catch"](reason => console.error(reason.message)); | Tmp folder exists, save before detecting selenium | ArnaudBuchholz_gpf-js | train | js |
8396c075c1f9555a571befc31474ee8897cc7a7b | diff --git a/redis_shard/shard.py b/redis_shard/shard.py
index <HASH>..<HASH> 100644
--- a/redis_shard/shard.py
+++ b/redis_shard/shard.py
@@ -54,7 +54,7 @@ class RedisShardAPI(object):
"lindex", "pop", "lset",
"lrem", "sadd", "srem",
"sismember", "smembers",
- "zadd", "zrem", "zincr",
+ "zadd", "zrem", "zincr","zrank",
"zrange", "zrevrange", "zrangebyscore","zremrangebyrank",
"zremrangebyscore", "zcard", "zscore",
"hget", "hset", "hdel", "hincrby", "hlen", | support zrank in redis shard | zhihu_redis-shard | train | py |
b07168b5ecbad5883912f865018dc95d4597a7ca | diff --git a/eval.go b/eval.go
index <HASH>..<HASH> 100644
--- a/eval.go
+++ b/eval.go
@@ -1084,9 +1084,7 @@ func (st *Runtime) evalBaseExpressionGroup(node Node) reflect.Value {
}
// limit the number of pointers to follow
- dereferenceLimit := 2
- for resolved.Kind() == reflect.Ptr && dereferenceLimit >= 0 {
- dereferenceLimit--
+ for dereferenceLimit := 2; resolved.Kind() == reflect.Ptr && dereferenceLimit >= 0; dereferenceLimit-- {
if resolved.IsNil() {
return reflect.ValueOf("")
}
@@ -1452,6 +1450,14 @@ func getFieldOrMethodValue(key string, v reflect.Value) reflect.Value {
if value.Kind() == reflect.Interface && !value.IsNil() {
value = value.Elem()
}
+
+ for dereferenceLimit := 2; value.Kind() == reflect.Ptr && dereferenceLimit >= 0; dereferenceLimit-- {
+ if value.IsNil() {
+ return reflect.ValueOf("")
+ }
+ value = reflect.Indirect(value)
+ }
+
return value
} | Add support for pointer fields on structs | CloudyKit_jet | train | go |
27c6a2a42edd0fdbae1b8c3bdf9e1374e7715d7b | diff --git a/packages/date/src/DateRange.js b/packages/date/src/DateRange.js
index <HASH>..<HASH> 100644
--- a/packages/date/src/DateRange.js
+++ b/packages/date/src/DateRange.js
@@ -67,7 +67,6 @@ const DateRange = ({
const [focusedInput, setFocusedInput] = useState(null);
const calendarIconRef = useRef();
-
const startId = `${(id || name).replace(/[^a-zA-Z0-9]/gi, '')}-start`;
const endId = `${(id || name).replace(/[^a-zA-Z0-9]/gi, '')}-end`;
@@ -159,7 +158,7 @@ const DateRange = ({
const onFocusChange = async input => {
if (!input) await setFieldTouched(name, true);
- if (autoSync) await syncDates();
+ if (autoSync && !endValue) await syncDates();
setFocusedInput(input);
if (onPickerFocusChange) onPickerFocusChange({ focusedInput: input });
}; | fix(date): autosync infinite loop | Availity_availity-react | train | js |
ea198a02ac76959d573ab3c9182c7ae62bf8a930 | diff --git a/acstools/utils_calib.py b/acstools/utils_calib.py
index <HASH>..<HASH> 100644
--- a/acstools/utils_calib.py
+++ b/acstools/utils_calib.py
@@ -22,7 +22,7 @@ __all__ = ['extract_dark', 'extract_flash', 'extract_flatfield',
'check_overscan', 'SM4_MJD']
# The MJD date of the EVA during SM4 to restore ACS/WFC and ACS/HRC.
-# This value is also defined in header file, acs.h, for us by calacs.e in hstcal
+# This value is also defined in header file, acs.h, for use by calacs.e in hstcal
SM4_MJD = 54967.0 | Update acstools/utils_calib.py
Resolve minor typo in code comment | spacetelescope_acstools | train | py |
3d64a8573401c1d9ba42b9296aa81b7131c0e82f | diff --git a/lib/marked.js b/lib/marked.js
index <HASH>..<HASH> 100644
--- a/lib/marked.js
+++ b/lib/marked.js
@@ -17,7 +17,7 @@ var block = {
hr: /^( *[-*_]){3,} *(?:\n+|$)/,
heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
nptable: noop,
- lheading: /^([^\n]+)\n *(=|-){2,} *\n*/,
+ lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/,
list: /^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/, | fix new lheading rule (2 chars) for markdown guide test. | remarkjs_remark | train | js |
063c1ca6df57b69892486f53abace3b59cd9df10 | diff --git a/Content/Filter/Connect.php b/Content/Filter/Connect.php
index <HASH>..<HASH> 100644
--- a/Content/Filter/Connect.php
+++ b/Content/Filter/Connect.php
@@ -31,7 +31,7 @@ class Connect implements FilterInterface
->doRequest(
$params->getMandatoryParam('method'),
$params->getMandatoryParam('uri'),
- $params->getOptionalParam('payload')
+ $params->getOptionalParam('payload', null)
);
return $this->twig->render( | No POST payload in case the payload is not set | Atlantic18_CoralSiteBundle | train | php |
54b9c55af39529065cfba757bf78695ea1b28261 | diff --git a/etcdserver/server_test.go b/etcdserver/server_test.go
index <HASH>..<HASH> 100644
--- a/etcdserver/server_test.go
+++ b/etcdserver/server_test.go
@@ -53,11 +53,6 @@ func testServer(t *testing.T, ns int64) {
ss[i] = srv
}
- // TODO: find fast way to trigger leader election
- // TODO: introduce the way to know that the leader has been elected
- // then remove this sleep.
- time.Sleep(110 * time.Millisecond)
-
for i := 1; i <= 10; i++ {
r := pb.Request{
Method: "PUT", | etcdserver: remove useless sleep
etcdserver.Do will block until there exists leader | etcd-io_etcd | train | go |
cdbbbcde8d355474a38d2a3268422dc588e05056 | diff --git a/src/urh/ui/views/SimulatorGraphicsView.py b/src/urh/ui/views/SimulatorGraphicsView.py
index <HASH>..<HASH> 100644
--- a/src/urh/ui/views/SimulatorGraphicsView.py
+++ b/src/urh/ui/views/SimulatorGraphicsView.py
@@ -374,5 +374,6 @@ class SimulatorGraphicsView(QGraphicsView):
for item in self.copied_items:
assert isinstance(item, GraphicsItem)
parent = item.model_item.parent()
- self.scene().simulator_config.add_items([copy.deepcopy(item.model_item)], parent.child_count(), parent)
+ pos = parent.child_count() if parent is not None else 0
+ self.scene().simulator_config.add_items([copy.deepcopy(item.model_item)], pos, parent) | fix crash when pasting to empty simulator scene | jopohl_urh | train | py |
119da3e5922b01cdd69f9e46563c1e0f0c852df1 | diff --git a/src/Aws/S3/S3SignatureV4.php b/src/Aws/S3/S3SignatureV4.php
index <HASH>..<HASH> 100644
--- a/src/Aws/S3/S3SignatureV4.php
+++ b/src/Aws/S3/S3SignatureV4.php
@@ -31,14 +31,8 @@ class S3SignatureV4 extends SignatureV4 implements S3SignatureInterface
*/
public function signRequest(RequestInterface $request, CredentialsInterface $credentials)
{
- if ($request instanceof EntityEnclosingRequestInterface &&
- $request->getBody() &&
- !$request->hasHeader('x-amz-content-sha256')
- ) {
- $request->setHeader(
- 'X-Amz-Content-Sha256',
- $this->getPresignedPayload($request)
- );
+ if (!$request->hasHeader('x-amz-content-sha256')) {
+ $request->setHeader('x-amz-content-sha256', $this->getPresignedPayload($request));
}
parent::signRequest($request, $credentials);
@@ -54,7 +48,7 @@ class S3SignatureV4 extends SignatureV4 implements S3SignatureInterface
// If the body is empty, then sign with 'UNSIGNED-PAYLOAD'
if ($result === self::DEFAULT_PAYLOAD) {
- $result = 'UNSIGNED-PAYLOAD';
+ $result = hash('sha256', 'UNSIGNED-PAYLOAD');
}
return $result; | Fixed an issue with the SignatureV4 implementation when used with Amazon S3. | aws_aws-sdk-php | train | php |
f43dd686f37bfbc33d65ce28095c0326d5ba4417 | diff --git a/packages/core/is-v2-ready-yet/src/Footer.js b/packages/core/is-v2-ready-yet/src/Footer.js
index <HASH>..<HASH> 100644
--- a/packages/core/is-v2-ready-yet/src/Footer.js
+++ b/packages/core/is-v2-ready-yet/src/Footer.js
@@ -31,7 +31,7 @@ class Footer extends React.Component {
Project Board
</FooterLink>
·
- <FooterLink href="parcel-bundler/parcel/tree/v2/packages/core/is-v2-ready-yet">
+ <FooterLink href="parcel-bundler/parcel/tree/v2-work-so-far/packages/core/is-v2-ready-yet">
Page Source
</FooterLink>
</div> | is-v2-ready-yet page source url correction (#<I>) | parcel-bundler_parcel | train | js |
b537f16effec3d74df3db324b90504a01dc55968 | diff --git a/client/driver/rkt.go b/client/driver/rkt.go
index <HASH>..<HASH> 100644
--- a/client/driver/rkt.go
+++ b/client/driver/rkt.go
@@ -599,6 +599,7 @@ networkLoop:
if status, err := rktGetStatus(uuid); err == nil {
for _, net := range status.Networks {
if !net.IP.IsGlobalUnicast() {
+ d.logger.Printf("[DEBUG] driver.rkt: network %s for pod %q (UUID %s) for task %q ignored", net.IP.String(), img, uuid, d.taskName)
continue
}
@@ -625,6 +626,12 @@ networkLoop:
}
break networkLoop
}
+
+ if len(status.Networks) == 0 {
+ lastErr = fmt.Errorf("no networks found")
+ } else {
+ lastErr = fmt.Errorf("no good driver networks out of %d returned", len(status.Networks))
+ }
} else {
lastErr = err
} | Improve rkt driver network status poll loop
The network status poll loop will now report any networks it ignored, as
well as a no-networks situations. | hashicorp_nomad | train | go |
0e5426b649c0895221e9078d217c93c8d882dfdb | diff --git a/src/toil/worker.py b/src/toil/worker.py
index <HASH>..<HASH> 100644
--- a/src/toil/worker.py
+++ b/src/toil/worker.py
@@ -252,14 +252,18 @@ def main():
# The job is a checkpoint, and is being restarted after previously completing
if jobGraph.checkpoint != None:
logger.debug("Job is a checkpoint")
+ # If the checkpoint still has extant jobs in its
+ # (flattened) stack and services, its subtree didn't
+ # complete properly. We handle the restart of the
+ # checkpoint here, removing its previous subtree.
if len([i for l in jobGraph.stack for i in l]) > 0 or len(jobGraph.services) > 0:
logger.debug("Checkpoint has failed.")
# Reduce the retry count
assert jobGraph.remainingRetryCount >= 0
jobGraph.remainingRetryCount = max(0, jobGraph.remainingRetryCount - 1)
jobGraph.restartCheckpoint(jobStore)
- # Otherwise, the job and successors are done, and we can cleanup stuff we couldn't clean
- # because of the job being a checkpoint
+ # Otherwise, the job and successors are done, and we can cleanup stuff we couldn't clean
+ # because of the job being a checkpoint
else:
logger.debug("The checkpoint jobs seems to have completed okay, removing any checkpoint files to delete.")
#Delete any remnant files | Add comment about checkpoint restart (and comment indentation fixes) | DataBiosphere_toil | train | py |
d582e58b6c3e446ffeefa1e41f4238e280971652 | diff --git a/salt/modules/chocolatey.py b/salt/modules/chocolatey.py
index <HASH>..<HASH> 100644
--- a/salt/modules/chocolatey.py
+++ b/salt/modules/chocolatey.py
@@ -298,7 +298,7 @@ def list_windowsfeatures():
return result['stdout']
-def install(name, version=None, source=None, force=False):
+def install(name, version=None, source=None, force=False, install_args=None):
'''
Instructs Chocolatey to install a package.
@@ -315,6 +315,10 @@ def install(name, version=None, source=None, force=False):
force
Reinstall the current version of an existing package.
+ install_args
+ A list of install arguments you want to pass to the installation process
+ i.e product key or feature list
+
CLI Example:
.. code-block:: bash
@@ -330,7 +334,9 @@ def install(name, version=None, source=None, force=False):
if source:
cmd.extend(['-Source', source])
if salt.utils.is_true(force):
- cmd.append('-Force')
+ cmd.extend(['-Force'])
+ if install_args:
+ cmd.extend(['-InstallArguments', install_args])
result = __salt__['cmd.run_all'](cmd, python_shell=False)
if result['retcode'] != 0: | Added the ability to pass install arguments to chocolatey packages | saltstack_salt | train | py |
72ba5c2bd78da8bae5d0d8dcaf17454e0830b9ac | diff --git a/src/emir/recipes/image/shared.py b/src/emir/recipes/image/shared.py
index <HASH>..<HASH> 100644
--- a/src/emir/recipes/image/shared.py
+++ b/src/emir/recipes/image/shared.py
@@ -189,8 +189,8 @@ class DirectImageCommon(object):
# Basic processing
# FIXME: add this
- bpm = pyfits.getdata(self.parameters['master_bpm'])
- bpm_corrector = BadPixelCorrector(bpm)
+ #bpm = pyfits.getdata(self.parameters['master_bpm'])
+ #bpm_corrector = BadPixelCorrector(bpm)
if self.parameters['master_bias']:
mbias = pyfits.getdata(self.parameters['master_bias'])
@@ -205,7 +205,7 @@ class DirectImageCommon(object):
mflat = pyfits.getdata(self.parameters['master_intensity_ff'])
ff_corrector = FlatFieldCorrector(mflat)
- basicflow = SerialFlow([bpm_corrector,
+ basicflow = SerialFlow([#bpm_corrector,
bias_corrector,
dark_corrector,
nl_corrector, | Removing BPM line, is not working | guaix-ucm_pyemir | train | py |
fa5840c1f45ff541948f586bc6a10d33ce708baa | diff --git a/src/Omniphx/Forrest/Providers/Laravel/ForrestServiceProvider.php b/src/Omniphx/Forrest/Providers/Laravel/ForrestServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/Omniphx/Forrest/Providers/Laravel/ForrestServiceProvider.php
+++ b/src/Omniphx/Forrest/Providers/Laravel/ForrestServiceProvider.php
@@ -23,7 +23,7 @@ class ForrestServiceProvider extends ServiceProvider {
$authentication = Config::get('forrest::authentication');
- include __DIR__ . "/routes/$authentication.php";
+ include __DIR__ . "/Routes/$authentication.php";
}
/** | Fixed routes path for case-sensitive systems. | omniphx_forrest | train | php |
6c2d9e4961c81231c390d42f06bdbc6b6929fc1c | diff --git a/ceph_deploy/__init__.py b/ceph_deploy/__init__.py
index <HASH>..<HASH> 100644
--- a/ceph_deploy/__init__.py
+++ b/ceph_deploy/__init__.py
@@ -1,3 +1,3 @@
-__version__ = '1.5.37'
+__version__ = '1.5.38' | [RM-<I>] bump to <I> | ceph_ceph-deploy | train | py |
2cdcc5a00102de4f9126406b0751add42983cff3 | diff --git a/lib/get-webpack-config.js b/lib/get-webpack-config.js
index <HASH>..<HASH> 100644
--- a/lib/get-webpack-config.js
+++ b/lib/get-webpack-config.js
@@ -105,8 +105,13 @@ module.exports = function (options) {
output: {
ascii_only: true
},
+ beautify: false, // 最紧凑的输出
+ comments: false, // 删除所有的注释
compress: {
- warnings: false
+ warnings: false, // 在UglifyJs删除没有用到的代码时不输出警告
+ drop_console: true, // 删除所有的 `console` 语句, 还可以兼容ie浏览器
+ collapse_vars: true, // 内嵌定义了但是只用到一次的变量
+ reduce_vars: true // 提取出出现多次但是没有定义成变量去引用的静态值
}
}));
} | refactor: improve webpack UglifyJsPlugin config | zuzucheFE_guido | train | js |
df83cf798f28585a77e489bda5565a66ee741089 | diff --git a/src/Testability.php b/src/Testability.php
index <HASH>..<HASH> 100644
--- a/src/Testability.php
+++ b/src/Testability.php
@@ -30,10 +30,12 @@ class Testability
$this->excludeDirs = $exclude;
}
+ /*
public function setCloverReport ($file)
{
$this->cloverXML = $file;
}
+ */
public function setCSV ($value)
{ | Commented out unused method (for now) | edsonmedina_php_testability | train | php |
fc5d68ed94f849852f11089aef701a4148b0a4c7 | diff --git a/juju/model.py b/juju/model.py
index <HASH>..<HASH> 100644
--- a/juju/model.py
+++ b/juju/model.py
@@ -1521,7 +1521,7 @@ class Model:
if raw:
return result_status
-
+
result_str = self._print_status_model(result_status)
result_str += '\n'
result_str += self._print_status_apps(result_status)
@@ -1560,7 +1560,7 @@ class Model:
apps = result_status.applications
if apps is None or len(apps) == 0:
return ''
-
+
limits = '{:<25} {:<10} {:<10} {:<5} {:<20} {:<8}'
# print header
result_str = limits.format(
@@ -1597,12 +1597,12 @@ class Model:
addr = unit.public_address
if addr is None:
addr = ''
-
+
if unit.opened_ports is None:
opened_ports = ''
else:
opened_ports = ','.join(unit.opened_ports)
-
+
info = unit.workload_status.info
if info is None:
info = '' | Changes for lint. | juju_python-libjuju | train | py |
7757b9472c6ce0d945413d179b2d32f1b4a2ec98 | diff --git a/lib/yard/templates/helpers/base_helper.rb b/lib/yard/templates/helpers/base_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/yard/templates/helpers/base_helper.rb
+++ b/lib/yard/templates/helpers/base_helper.rb
@@ -39,12 +39,8 @@ module YARD::Templates::Helpers
url
end
- def format_object_name_list(objects)
- objects.sort_by {|o| o.name.to_s.downcase }.join(", ")
- end
-
def format_types(list, brackets = true)
- list.empty? ? "" : (brackets ? "(#{list.join(", ")})" : list.join(", "))
+ list.nil? || list.empty? ? "" : (brackets ? "(#{list.join(", ")})" : list.join(", "))
end
def format_object_type(object) | Remove unused methods from BaseHelper | lsegal_yard | train | rb |
9444f242244c3fb3ccf83c23ec6cb87d0319d6bf | diff --git a/flake8_docstrings.py b/flake8_docstrings.py
index <HASH>..<HASH> 100644
--- a/flake8_docstrings.py
+++ b/flake8_docstrings.py
@@ -6,6 +6,7 @@ included as module into flake8
"""
import sys
+from flake8_polyfill import stdin
import pycodestyle
try:
import pydocstyle as pep257
@@ -15,7 +16,9 @@ except ImportError:
module_name = 'pep257'
__version__ = '1.0.2'
-__all__ = ['pep257Checker']
+__all__ = ('pep257Checker',)
+
+stdin.monkey_patch('pycodestyle')
class EnvironError(pep257.Error):
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ setup(
'D = flake8_docstrings:pep257Checker',
],
},
- install_requires=['flake8', 'pydocstyle'],
+ install_requires=['flake8', 'pydocstyle', 'flake8-polyfill'],
provides=['flake8_docstrings'],
py_modules=['flake8_docstrings'],
) | Use flake8-polyfill to monkey-patch stdin
In order to support flake8 2.x and 3.x, we need to rely on
flake8-polyfill to provide a compatibility shim here. Once we release
flake8-docstrings that only relies on Flake8 3.x we can drop this shim. | tylertrussell_flake8-docstrings-catnado | train | py,py |
3d58672770c22d277ec674d9dc2a210d9762b545 | diff --git a/lib/port.rb b/lib/port.rb
index <HASH>..<HASH> 100644
--- a/lib/port.rb
+++ b/lib/port.rb
@@ -16,7 +16,7 @@ module Dataflow
include Enumerable
def each
s = self
- while 1
+ loop do
yield s.head
s = s.tail
end | Changed "while 1" to "loop do" | larrytheliquid_dataflow | train | rb |
67ec981b873d7a83cc6a606bbd95b983af40416e | diff --git a/spyderlib/widgets/externalshell/pythonshell.py b/spyderlib/widgets/externalshell/pythonshell.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/externalshell/pythonshell.py
+++ b/spyderlib/widgets/externalshell/pythonshell.py
@@ -387,10 +387,13 @@ The process may not exit as a result of clicking this button
#-------------------------Python specific-------------------------------
# Python arguments
- p_args = ['-u'] + get_python_args(self.fname, self.python_args,
- self.interact_action.isChecked(),
- self.debug_action.isChecked(),
- self.arguments)
+ p_args = ['-u']
+ if DEBUG:
+ p_args += ['-v']
+ p_args += get_python_args(self.fname, self.python_args,
+ self.interact_action.isChecked(),
+ self.debug_action.isChecked(),
+ self.arguments)
env = [unicode(_path) for _path in self.process.systemEnvironment()] | Spyder's remote console: in debug mode (SPYDER_DEBUG=True), Python interpreters
are in verbose mode (-v command line option).
Update Issue <I>
Status: Fixed
@Steve: this is the changeset I was referring to in my previous comment. | spyder-ide_spyder | train | py |
9d08d245be143c417a9cd8803fb4b7d39d199ffc | diff --git a/salt/modules/ps.py b/salt/modules/ps.py
index <HASH>..<HASH> 100755
--- a/salt/modules/ps.py
+++ b/salt/modules/ps.py
@@ -76,6 +76,8 @@ def top(num_processes=5, interval=3):
else:
cmdline = process.cmdline
info = {'cmd': cmdline,
+ 'user': process.username,
+ 'status': process.status,
'pid': process.pid,
'create_time': process.create_time}
for key, value in process.get_cpu_times()._asdict().items(): | Add process username and status fields to top output | saltstack_salt | train | py |
1e1c54d1756f1d16740f58fe8e778dac408b0406 | diff --git a/app/controllers/clickfunnels_auth/user_sessions_controller.rb b/app/controllers/clickfunnels_auth/user_sessions_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/clickfunnels_auth/user_sessions_controller.rb
+++ b/app/controllers/clickfunnels_auth/user_sessions_controller.rb
@@ -24,7 +24,7 @@ class ClickfunnelsAuth::UserSessionsController < ClickfunnelsAuth::ApplicationCo
user.access_tokens.create!({
token: omniauth['credentials']['token'],
refresh_token: omniauth['credentials']['refresh_token'],
- expires_at: Time.at(omniauth['credentials']['expires_at'])
+ expires_at: omniauth['credentials']['expires_at'] ? Time.at(omniauth['credentials']['expires_at']) : omniauth['credentials']['expires_at']
})
session[:user_id] = user.id | Allow for non-expiring tokens. Ugh. | Etison_clickfunnels_auth | train | rb |
0ac9e854db9c1a6d50c45fc753823fa8015beeef | diff --git a/lib/addressable/idna/pure.rb b/lib/addressable/idna/pure.rb
index <HASH>..<HASH> 100644
--- a/lib/addressable/idna/pure.rb
+++ b/lib/addressable/idna/pure.rb
@@ -301,7 +301,7 @@ module Addressable
(class <<self; private :lookup_unicode_lowercase; end)
def self.lookup_unicode_composition(unpacked)
- return COMPOSITION_TABLE[unpacked.pack("C*")]
+ return COMPOSITION_TABLE[unpacked]
end
(class <<self; private :lookup_unicode_composition; end)
@@ -4567,7 +4567,7 @@ module Addressable
exclusion = data[UNICODE_DATA_EXCLUSION]
if canonical && exclusion == 0
- COMPOSITION_TABLE[canonical] = codepoint
+ COMPOSITION_TABLE[canonical.unpack("C*")] = codepoint
end
end | Fixed a bug with Ruby <I>.x unicode composition lookups. | sporkmonger_addressable | train | rb |
b3146683f24b7e9b2dcc19483857848f27ed1798 | diff --git a/src/tilesource.js b/src/tilesource.js
index <HASH>..<HASH> 100644
--- a/src/tilesource.js
+++ b/src/tilesource.js
@@ -65,7 +65,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
height: args[1],
tileSize: args[2],
tileOverlap: args[3],
- minlevel: args[4],
+ minLevel: args[4],
maxLevel: args[5]
};
} | applying patch provided by eikeon for position parameter constructor of TileSource. At some point I hope to deprecate most of these constructors that have more than two positional parameters. | openseadragon_openseadragon | train | js |
5a471d0dda7630460d2ced114a19adbd6a1bab1c | diff --git a/src/Drupal/Driver/Fields/Drupal8/EntityReferenceHandler.php b/src/Drupal/Driver/Fields/Drupal8/EntityReferenceHandler.php
index <HASH>..<HASH> 100644
--- a/src/Drupal/Driver/Fields/Drupal8/EntityReferenceHandler.php
+++ b/src/Drupal/Driver/Fields/Drupal8/EntityReferenceHandler.php
@@ -26,7 +26,7 @@ class EntityReferenceHandler extends AbstractHandler {
// Determine target bundle restrictions.
$target_bundle_key = NULL;
- if (!$target_bundles = $this->getTargetBundles()) {
+ if ($target_bundles = $this->getTargetBundles()) {
$target_bundle_key = $entity_definition->getKey('bundle');
} | Fix condition to get the target bundle key when there are target bundles | jhedstrom_DrupalDriver | train | php |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.