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
a5d1b68653cd49a609b9103a4aa2557d15de236d
diff --git a/environment/src/main/java/jetbrains/exodus/log/Log.java b/environment/src/main/java/jetbrains/exodus/log/Log.java index <HASH>..<HASH> 100644 --- a/environment/src/main/java/jetbrains/exodus/log/Log.java +++ b/environment/src/main/java/jetbrains/exodus/log/Log.java @@ -721,7 +721,7 @@ public final class Log implements Closeable { } } - int getIdentity() { + public int getIdentity() { return logIdentity; }
Log.getIdentity() is public
JetBrains_xodus
train
java
a8adab02266cc588ae9adf0cbbe4563f2430a46b
diff --git a/cmd/taxi.go b/cmd/taxi.go index <HASH>..<HASH> 100644 --- a/cmd/taxi.go +++ b/cmd/taxi.go @@ -33,6 +33,7 @@ package cmd import ( + "fmt" "io" "log" "time" @@ -56,8 +57,10 @@ func NewTaxiCommand(stdin io.Reader, stdout, stderr io.Writer) *cobra.Command { if err != nil { return err } - log.Println("Done: ", time.Since(start)) - select {} + dt := time.Since(start) + log.Println("Done: ", dt) + fmt.Printf("{\"taxi-import\": %f}\n", dt.Seconds()) + return nil }, } flags := taxiCommand.Flags()
Minor changes to work well with benchmark framework
pilosa_pdk
train
go
a7bc29241be52498c76433ebc4fbdcb046966325
diff --git a/src/main/java/com/asual/lesscss/LessEngine.java b/src/main/java/com/asual/lesscss/LessEngine.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/asual/lesscss/LessEngine.java +++ b/src/main/java/com/asual/lesscss/LessEngine.java @@ -193,9 +193,9 @@ public class LessEngine { LessEngine engine = new LessEngine(); if (args.length == 1) { - System.out.println(engine.compile(args[0])); + System.out.println(engine.compile(new File(args[0]))); } else if (args.length == 2) { - engine.compile(new File(args[0]),new File(args[1])); + engine.compile(new File(args[0]), new File(args[1])); } else { System.err.println("Usage: java -jar lesscss-engine.jar <input_file> [<output_file>]"); }
Fixes related to issue <I>.
asual_lesscss-engine
train
java
69385519d70214765797cf4a33c436d03ce50b9e
diff --git a/application/Espo/Core/Utils/Metadata.php b/application/Espo/Core/Utils/Metadata.php index <HASH>..<HASH> 100644 --- a/application/Espo/Core/Utils/Metadata.php +++ b/application/Espo/Core/Utils/Metadata.php @@ -326,6 +326,26 @@ class Metadata $unsets = (array) $unsets; } + switch ($key1) { + case 'entityDefs': + //unset related additional fields, e.g. a field with "address" type + $unsetList = $unsets; + foreach ($unsetList as $unsetItem) { + if (preg_match('/fields\.([^\.]+)/', $unsetItem, $matches) && isset($matches[1])) { + $fieldName = $matches[1]; + $fieldPath = [$key1, $key2, 'fields', $fieldName]; + + $additionalFields = $this->getMetadataHelper()->getAdditionalFieldList($fieldName, $this->get($fieldPath)); + if (is_array($additionalFields)) { + foreach ($additionalFields as $additionalFieldName => $additionalFieldParams) { + $unsets[] = 'fields.' . $additionalFieldName; + } + } + } + } + break; + } + $normalizedData = array( '__APPEND__', );
Metadata: delete related additional fields in entitiDefs
espocrm_espocrm
train
php
6b0d30b8df6ae207fd483545da7c7633d8107c09
diff --git a/umi_tools/whitelist.py b/umi_tools/whitelist.py index <HASH>..<HASH> 100644 --- a/umi_tools/whitelist.py +++ b/umi_tools/whitelist.py @@ -176,7 +176,7 @@ whitelist-specific options Detect CBs above the threshold which may be sequence errors: - "discard" - Discard all putative error CBs + Discard all putative error CBs. - "correct" Correct putative substituion errors in CBs above the threshold. Discard putative insertions/deletions. Note that @@ -296,7 +296,7 @@ def main(argv=None): choices=["discard", "correct"], help=("Detect CBs above the threshold which may be " "sequence errors from another CB and either " - "'discard' or 'correct'. Default=discard")) + "'discard' or 'correct'. Default=None (No correction)")) parser.add_option_group(group) parser.set_defaults(method="reads",
Update whitelist.py Change to help text for `ed-above-threshold` to note that the default is to do no correction.
CGATOxford_UMI-tools
train
py
363b21fd9bc0725f441d07df2e321e6d2d383204
diff --git a/salt/fileserver/__init__.py b/salt/fileserver/__init__.py index <HASH>..<HASH> 100644 --- a/salt/fileserver/__init__.py +++ b/salt/fileserver/__init__.py @@ -323,10 +323,11 @@ class Fileserver(object): if not back: back = self.opts['fileserver_backend'] else: - try: - back = back.split(',') - except AttributeError: - back = six.text_type(back).split(',') + if not isinstance(back, list): + try: + back = back.split(',') + except AttributeError: + back = six.text_type(back).split(',') ret = [] if not isinstance(back, list):
salt.fileserver.Fileserver: Don't try to split a list in _gen_back This fixes a bug which causes backends passed as a python list to be converted to a ``str`` (specifically a ``unicode`` type in PY2) and then split, resulting in a backend that will never match anything. This only affects runner and Salt Python API usage in which the "backend" param to fileserver runner funcs is passed as a Python list.
saltstack_salt
train
py
14b8cc4486d6c018426f60f1bf1801f8c8c420da
diff --git a/system_tests/bigquery.py b/system_tests/bigquery.py index <HASH>..<HASH> 100644 --- a/system_tests/bigquery.py +++ b/system_tests/bigquery.py @@ -464,4 +464,8 @@ class TestBigQuery(unittest.TestCase): retry = RetryInstanceState(_job_done, max_tries=8) retry(job.reload)() - self.assertEqual(job.state.lower(), 'done') + # The `cancel` API doesn't leave any reliable traces on + # the status of the job resource, so we can't really assert for + # them here. The best we can do is not that the API call didn't + # raise an error, and that the job completed (in the `retry()` + # above).
Replace redundant 'job done' assertion with a note. Explain why we can't make any real assertions about the status of the cancelled job. Addresses: <URL>
googleapis_google-cloud-python
train
py
f93635a596f232a395a59c644d67601ace21f273
diff --git a/addon/components/sl-chart.js b/addon/components/sl-chart.js index <HASH>..<HASH> 100755 --- a/addon/components/sl-chart.js +++ b/addon/components/sl-chart.js @@ -23,7 +23,8 @@ export default Ember.Component.extend({ 'panel', 'panel-default', 'sl-chart', - 'sl-panel' + 'sl-panel', + 'sl-ember-components' ], /** @type {Object} */
Add "sl-ember-components" class to sl-chart for loading state to be properly supported
softlayer_sl-ember-components
train
js
5bfedaae3e62bb23c43908542195cb88107a0196
diff --git a/src/Illuminate/Queue/Console/WorkCommand.php b/src/Illuminate/Queue/Console/WorkCommand.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Queue/Console/WorkCommand.php +++ b/src/Illuminate/Queue/Console/WorkCommand.php @@ -168,8 +168,9 @@ class WorkCommand extends Command protected function writeStatus(Job $job, $status, $type) { $this->output->writeln(sprintf( - "<{$type}>[%s] %s</{$type}> %s", + "<{$type}>[%s][%s] %s</{$type}> %s", Carbon::now()->format('Y-m-d H:i:s'), + $job->getJobId(), str_pad("{$status}:", 11), $job->resolveName() )); }
Include job ID in the output of the queue:work Artisan command (#<I>)
laravel_framework
train
php
489cef41aeebe76040a3d05fcf89002c7648fa8e
diff --git a/datajoint/diagram.py b/datajoint/diagram.py index <HASH>..<HASH> 100644 --- a/datajoint/diagram.py +++ b/datajoint/diagram.py @@ -230,7 +230,8 @@ else: # mark "distinguished" tables, i.e. those that introduce new primary key attributes for name in self.nodes_to_show: foreign_attributes = set(attr for p in self.in_edges(name, data=True) for attr in p[2]['attr_map']) - self.node[name]['distinguished'] = foreign_attributes < self.node[name]['primary_key'] + self.node[name]['distinguished'] = (foreign_attributes < self.node[name]['primary_key'] + if ('primary_key' in self.node[name].keys()) else False) # include aliased nodes that are sandwiched between two displayed nodes gaps = set(nx.algorithms.boundary.node_boundary(self, self.nodes_to_show)).intersection( nx.algorithms.boundary.node_boundary(nx.DiGraph(self).reverse(), self.nodes_to_show))
Fix diagram issue when node has no primary keys.
datajoint_datajoint-python
train
py
e1f445816cc47c8c2601f9f57f81a83aedffc0ba
diff --git a/treeherder/model/derived/jobs.py b/treeherder/model/derived/jobs.py index <HASH>..<HASH> 100644 --- a/treeherder/model/derived/jobs.py +++ b/treeherder/model/derived/jobs.py @@ -195,7 +195,7 @@ class JobsModel(TreeherderModelBase): if not project: project = self.project build_systems = cache.get("build_system_by_repo", None) - if not build_systems: + if not build_systems or project not in build_systems: build_systems = dict((repo, build_system_type) for repo, build_system_type in ReferenceDataSignatures.objects.order_by("repository" ).values_list("repository", "build_system_type").distinct()
Bug <I> - Delete build system cached list when project is not found
mozilla_treeherder
train
py
06b4533d7fe45abdcca74487baf042953a5b9a49
diff --git a/lib/trestle/resource/controller.rb b/lib/trestle/resource/controller.rb index <HASH>..<HASH> 100644 --- a/lib/trestle/resource/controller.rb +++ b/lib/trestle/resource/controller.rb @@ -44,10 +44,18 @@ module Trestle end def show - respond_to do |format| - format.html - format.json { render json: instance } - format.js + if admin.singular? && instance.nil? + respond_to do |format| + format.html { redirect_to action: :new } + format.json { head :not_found } + format.js + end + else + respond_to do |format| + format.html + format.json { render json: instance } + format.js + end end end
Redirect to new action if singular instance not found
TrestleAdmin_trestle
train
rb
0f5a2f0c059c42c0428e5549aa4c05822cfc1955
diff --git a/client_test.go b/client_test.go index <HASH>..<HASH> 100644 --- a/client_test.go +++ b/client_test.go @@ -35,6 +35,7 @@ func TestingConfig() *ClientConfig { cfg.DataDir = tempDir() cfg.DisableTrackers = true cfg.NoDefaultPortForwarding = true + cfg.DisableAcceptRateLimiting = true return cfg }
Disable accept rate limiting by default in tests
anacrolix_torrent
train
go
24f9bd48f528b3ea7ace1d95dece01d26b8882e3
diff --git a/pymc/tests/test_distributions_random.py b/pymc/tests/test_distributions_random.py index <HASH>..<HASH> 100644 --- a/pymc/tests/test_distributions_random.py +++ b/pymc/tests/test_distributions_random.py @@ -360,10 +360,10 @@ class BaseTestDistributionRandom(SeededTest): ) def check_pymc_params_match_rv_op(self): - aesera_dist_inputs = self.pymc_rv.get_parents()[0].inputs[3:] - assert len(self.expected_rv_op_params) == len(aesera_dist_inputs) + aesara_dist_inputs = self.pymc_rv.get_parents()[0].inputs[3:] + assert len(self.expected_rv_op_params) == len(aesara_dist_inputs) for (expected_name, expected_value), actual_variable in zip( - self.expected_rv_op_params.items(), aesera_dist_inputs + self.expected_rv_op_params.items(), aesara_dist_inputs ): assert_almost_equal(expected_value, actual_variable.eval(), decimal=self.decimal)
Fix aesara name (#<I>)
pymc-devs_pymc
train
py
fa08e89f316900dcd6549b014fe6f00bf0f7564d
diff --git a/remote.go b/remote.go index <HASH>..<HASH> 100644 --- a/remote.go +++ b/remote.go @@ -22,6 +22,11 @@ type PluginDecl struct { Formats []Format `json:"formats"` } +type formatResponse struct { + Error Error `json:"error,omitempty"` + Format `json:"format"` +} + type Format string var ( @@ -57,18 +62,30 @@ func NewRemotePlugin(r io.ReadCloser, w io.WriteCloser) (pl *RemotePlugin, err e //Pack reader in JSON decoder and decode a PluginDecl dec := json.NewDecoder(r) + enc := json.NewEncoder(w) + err = dec.Decode(&pl.PluginDecl) if err != nil { return } var best FormatFactory = FormatFactory{-1, nil} + var bestFormat Format = "" for _, format := range pl.PluginDecl.Formats { if factory, ok := SupportedFormats[format]; ok && factory.Weight > best.Weight { best = factory + bestFormat = format } } + if bestFormat == "" { + enc.Encode(formatResponse{Error: NoSupportedFormat}) + err = NoSupportedFormat + return + } + + enc.Encode(formatResponse{Format: bestFormat}) + pl.enc, pl.dec = best.Construct(r, w) return }
Added to a answer to the protocol where server responds with the chosen format.
zephyyrr_plugins
train
go
96142f7b4545870b48c3f3a3450094c1539fa03a
diff --git a/lib/zeevex_threadsafe/rails/request_globals.rb b/lib/zeevex_threadsafe/rails/request_globals.rb index <HASH>..<HASH> 100644 --- a/lib/zeevex_threadsafe/rails/request_globals.rb +++ b/lib/zeevex_threadsafe/rails/request_globals.rb @@ -1,5 +1,11 @@ require_dependency "weakref" +begin + require 'active_support/core_ext' +rescue LoadError + require 'zeevex_threadsafe/aliasing' +end + module ZeevexThreadsafe module Rails class RequestGlobals
include aliasing in request_globals
zeevex_zeevex_threadsafe
train
rb
c7ff26fd4dc18c60b5ffc877a997836b838a795d
diff --git a/thinc/tests/shims/test_pytorch_grad_scaler.py b/thinc/tests/shims/test_pytorch_grad_scaler.py index <HASH>..<HASH> 100644 --- a/thinc/tests/shims/test_pytorch_grad_scaler.py +++ b/thinc/tests/shims/test_pytorch_grad_scaler.py @@ -1,6 +1,6 @@ import pytest -from hypothesis import given +from hypothesis import given, settings from hypothesis.strategies import lists, one_of, tuples from thinc.util import has_torch, has_torch_gpu, is_torch_array from thinc.api import PyTorchGradScaler @@ -23,6 +23,7 @@ def tensors(): @pytest.mark.skipif(not has_torch, reason="needs PyTorch") @pytest.mark.skipif(not has_torch_gpu, reason="needs a GPU") @given(X=one_of(tensors(), lists(tensors()), tuples(tensors()))) +@settings(deadline=None) def test_scale_random_inputs(X): import torch
Remove deadline of test_scale_random_inputs (#<I>) By default the hypothesis deadline is <I>ms. The test_scale_random_inputs test would frequently fail because on the first run the deadline was exceeded because GPU initialization takes some time.
explosion_thinc
train
py
1d8b6b32e10639c209a9053f4c3535dc6d8f85a5
diff --git a/hpcbench/driver.py b/hpcbench/driver.py index <HASH>..<HASH> 100644 --- a/hpcbench/driver.py +++ b/hpcbench/driver.py @@ -65,6 +65,7 @@ def write_yaml_report(func): class Enumerator(six.with_metaclass(ABCMeta, object)): """Common class for every campaign node""" def __init__(self, parent, name=None, logger=None): + self.parent = parent self.campaign = parent.campaign self.node = parent.node self.name = name
Can now got upward in driver class hierarchy
BlueBrain_hpcbench
train
py
045c95df3d214f5a3843a56b93d2065afd9808a1
diff --git a/src/scrollfire/scrollfire-patch.js b/src/scrollfire/scrollfire-patch.js index <HASH>..<HASH> 100644 --- a/src/scrollfire/scrollfire-patch.js +++ b/src/scrollfire/scrollfire-patch.js @@ -1,3 +1,4 @@ +/* eslint no-new-func:0 */ export class ScrollfirePatch { patched = false;
chore(lint): disable no-new-func in scrollfire-patch
aurelia-ui-toolkits_aurelia-materialize-bridge
train
js
31155b577cd67f1a502f9c5bf00c67c3861439c3
diff --git a/test/wlang_test.rb b/test/wlang_test.rb index <HASH>..<HASH> 100644 --- a/test/wlang_test.rb +++ b/test/wlang_test.rb @@ -1,4 +1,6 @@ require File.expand_path('../helper', __FILE__) + +begin require 'wlang' class WLangTest < Test::Unit::TestCase @@ -61,4 +63,8 @@ class WLangTest < Test::Unit::TestCase assert_body "WLang Layout!\nHello World" end -end \ No newline at end of file +end + +rescue LoadError + warn "#{$!.to_s}: skipping wlang tests" +end
Wrap wlang test in a rescue clause.
sinatra_sinatra
train
rb
e9e47dd8800a5e80174ad9351feb58634dfc1c95
diff --git a/lib/discordrb/voice/encoder.rb b/lib/discordrb/voice/encoder.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/voice/encoder.rb +++ b/lib/discordrb/voice/encoder.rb @@ -49,6 +49,9 @@ module Discordrb::Voice @opus.encode(buffer, 1920) end + # One frame of complete silence Opus encoded + OPUS_SILENCE = [0xF8, 0xFF, 0xFE].freeze + # Adjusts the volume of a given buffer of s16le PCM data. # @param buf [String] An unencoded PCM (s16le) buffer. # @param mult [Float] The volume multiplier, 1 for same volume.
Define a constant to represent opus encoded silence
meew0_discordrb
train
rb
19da5e78aabf9a5d074a6da644423db1f927f3cb
diff --git a/src/java/main/org/jsmpp/util/StringParameter.java b/src/java/main/org/jsmpp/util/StringParameter.java index <HASH>..<HASH> 100644 --- a/src/java/main/org/jsmpp/util/StringParameter.java +++ b/src/java/main/org/jsmpp/util/StringParameter.java @@ -59,7 +59,7 @@ public enum StringParameter { * STAT_ESME_RINVDFTMSGID, means that predefined message are not exist. */ FINAL_DATE(StringType.C_OCTEC_STRING, 0, 17, false, SMPPConstant.STAT_ESME_RINVDFTMSGID), - SHORT_MESSAGE(StringType.OCTET_STRING, 0, 255, true, SMPPConstant.STAT_ESME_RINVMSGLEN), // the SMPP v3.4 max is 254 + SHORT_MESSAGE(StringType.OCTET_STRING, 0, 254, true, SMPPConstant.STAT_ESME_RINVMSGLEN), MESSAGE_ID(StringType.C_OCTEC_STRING, 0, 65, true, SMPPConstant.STAT_ESME_RINVMSGID), DEL_MESSAGE_ID(StringType.C_OCTEC_STRING, 0, 0, true, SMPPConstant.STAT_ESME_RINVMSGID), /**
Change the maximum length of short message to <I> (SMPP spec v <I>)
opentelecoms-org_jsmpp
train
java
5097b33c6072dba5c0e5519769b0a12e5dbce020
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,10 +7,10 @@ setup_requires = [ 'setuptools>=54.2.0', ] install_requires = [ - 'aiohttp~=3.7.4', + 'aiohttp~=3.8.0', 'aiotusclient~=0.1.4', 'appdirs~=1.4.4', - 'async_timeout>=3.0', + 'async_timeout>=4.0', 'attrs>=21.2', 'click>=8.0.1', 'colorama>=0.4.4', @@ -31,7 +31,7 @@ build_requires = [ 'towncrier>=21.3.0', ] test_requires = [ - 'pytest~=6.2.4', + 'pytest~=6.2.5', 'pytest-cov', 'pytest-mock', 'pytest-asyncio>=0.15.1', @@ -39,7 +39,7 @@ test_requires = [ 'codecov', ] lint_requires = [ - 'flake8>=3.9.2', + 'flake8>=4.0.1', 'flake8-commas>=2.1', ] typecheck_requires = [
setup: Upgrade aiohttp to <I> series and other deps
lablup_backend.ai-client-py
train
py
c21df6bca730c7e72e493549bca1b8a92d95040b
diff --git a/actions/update.js b/actions/update.js index <HASH>..<HASH> 100644 --- a/actions/update.js +++ b/actions/update.js @@ -58,7 +58,7 @@ module.exports = function updateOneRecord (req, res) { req._sails.log.warn(util.format('Unexpected output from `%s.update`.', Model.globalId)); } - var updatedRecord = records[0]; + var updatedRecord = pk; // If we have the pubsub hook, use the Model's publish method // to notify all subscribers about the update.
Fixed return on update Sequelize returns the number of affect rows on update, it was returning always [1], instead of the PK id
cesardeazevedo_sails-hook-sequelize-blueprints
train
js
350f1abfeab040bdbc93aacc5c7a340fa8514575
diff --git a/spec/webdav_server.rb b/spec/webdav_server.rb index <HASH>..<HASH> 100644 --- a/spec/webdav_server.rb +++ b/spec/webdav_server.rb @@ -4,7 +4,11 @@ require 'rubygems' require 'webrick' require 'webrick/httpservlet/webdavhandler' -# Webdav server based on: +# Web server with WebDAV extensions +# +# Usage: ruby webdav_server.rb + +# Code based on: # http://github.com/aslakhellesoy/webdavjs/blob/master/spec/webdav_server.rb @@ -66,7 +70,7 @@ def webdav_server(*options) log.level = WEBrick::Log::DEBUG if $DEBUG serv = WEBrick::HTTPServer.new({:Port => port, :Logger => log}) - dir = Dir.pwd + '/spec/fixtures' + dir = File.expand_path(File.dirname(__FILE__)) + '/fixtures' if(options and options[0][:authentication]) serv.mount("/", WEBrick::HTTPServlet::WebDAVHandlerVersion3, dir) else @@ -78,5 +82,6 @@ def webdav_server(*options) end if($0 == __FILE__) + webdav_server(:port => 10080,:authentication => false) end
changed webdav servers shared directory
devrandom_net_dav
train
rb
96280e850d2b27417ed2a2b337141145b82a70f1
diff --git a/views/js/qtiCreator/model/Math.js b/views/js/qtiCreator/model/Math.js index <HASH>..<HASH> 100755 --- a/views/js/qtiCreator/model/Math.js +++ b/views/js/qtiCreator/model/Math.js @@ -2,7 +2,7 @@ define([ 'lodash', 'taoQtiItem/qtiCreator/model/mixin/editable', 'taoQtiItem/qtiItem/core/Math' -], function(_, editable, Math){ +], function(_, editable, mathModel){ "use strict"; var methods = {}; _.extend(methods, editable); @@ -14,5 +14,5 @@ define([ this.getNamespace(); } }); - return Math.extend(methods); + return mathModel.extend(methods); }); \ No newline at end of file
Rename Math to mathModel to avoid conflict with keyword
oat-sa_extension-tao-itemqti
train
js
1a654e9e1c797cba04cc20e4b7c441a6c5186860
diff --git a/configs/configupgrade/upgrade_test.go b/configs/configupgrade/upgrade_test.go index <HASH>..<HASH> 100644 --- a/configs/configupgrade/upgrade_test.go +++ b/configs/configupgrade/upgrade_test.go @@ -14,6 +14,8 @@ import ( ) func TestUpgradeValid(t *testing.T) { + t.Skip("configupgrade is not yet complete enough to run tests against") + // This test uses the contents of the test-fixtures/valid directory as // a table of tests. Every directory there must have both "input" and // "want" subdirectories, where "input" is the configuration to be
configs/configupgrade: Disable the tests for now The tests in here are illustrating that this package is not yet finished, but we plan to run a release before we finish this and so we'll skip those tests for now with the intent of reinstating this again once we return to finish this up.
hashicorp_terraform
train
go
19756915d3eb3aadc3e577d14d06379c4799bdcb
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 @@ -247,7 +247,6 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { */ finalize: function(cancel) { var key = cancel ? "cancel" : "done"; - this.drawing = false; this.mouseDown = false; this.lastDown = null; this.lastUp = null;
Handler.Point has no "drawing" property anymore, trivial change (references #<I>) git-svn-id: <URL>
openlayers_openlayers
train
js
426fef56e29d39ef94339041ccebd10a96e71033
diff --git a/lib/duse/client/entity.rb b/lib/duse/client/entity.rb index <HASH>..<HASH> 100644 --- a/lib/duse/client/entity.rb +++ b/lib/duse/client/entity.rb @@ -101,7 +101,7 @@ module Duse # encryption will fail. Might improve with: http://stackoverflow.com/questions/11505547/how-calculate-size-of-rsa-cipher-text-using-key-size-clear-text-length secret_text_in_slices_of(18).map do |secret_part| # the selected users + current user + server - threshold = @users.length+2 + threshold = 2 shares = SecretSharing.split_secret(secret_part, 2, threshold) server_share, server_sign = Duse::Encryption.encrypt(@private_key, @server_user.public_key, shares[0]) user_share, user_sign = Duse::Encryption.encrypt(@private_key, @current_user.public_key, shares[1])
always have a threshold of 2 if giving permissions should become necessary this can be changed to a users input
duse-io_duse.rb
train
rb
757188836723d990141d8911e320c80f082bf9ee
diff --git a/lib/imgManip.js b/lib/imgManip.js index <HASH>..<HASH> 100644 --- a/lib/imgManip.js +++ b/lib/imgManip.js @@ -54,7 +54,7 @@ exports.effect = function (query, subject, dimensions, out) { if (opts.verbose.val) { console.log('query', query) } - if (!query.outType && query.url.slice(-4).toLowerCase() === '.png' && ['mask', 'blur', 'overlayBlur'].indexOf(effect) === -1) { + if (!query.outType && query.url && query.url.slice(-4).toLowerCase() === '.png' && ['mask', 'blur', 'overlayBlur'].indexOf(effect) === -1) { query.outType = 'png' } var format = (query.outType)
Update imgManip.js Check for query.url before slicing
vigour-io_shutter
train
js
7f198356efffba3d815aa00edaeea4ad18108237
diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index <HASH>..<HASH> 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -100,6 +100,8 @@ class courselib_testcase extends advanced_testcase { $moduleinfo->requireallteammemberssubmit = true; $moduleinfo->teamsubmissiongroupingid = true; $moduleinfo->blindmarking = true; + $moduleinfo->markingworkflow = true; + $moduleinfo->markingallocation = true; $moduleinfo->assignsubmission_onlinetext_enabled = true; $moduleinfo->assignsubmission_file_enabled = true; $moduleinfo->assignsubmission_file_maxfiles = 1; @@ -134,6 +136,8 @@ class courselib_testcase extends advanced_testcase { $this->assertEquals($moduleinfo->requireallteammemberssubmit, $dbmodinstance->requireallteammemberssubmit); $this->assertEquals($moduleinfo->teamsubmissiongroupingid, $dbmodinstance->teamsubmissiongroupingid); $this->assertEquals($moduleinfo->blindmarking, $dbmodinstance->blindmarking); + $this->assertEquals($moduleinfo->markingworkflow, $dbmodinstance->markingworkflow); + $this->assertEquals($moduleinfo->markingallocation, $dbmodinstance->markingallocation); // The goal not being to fully test assign_add_instance() we'll stop here for the assign tests - to avoid too many DB queries. // Advanced grading.
MDL-<I> courselib: Fix unit tests The courselib tests have hardcoded test data sets for forum and assign modules that need to be updated every time we add a new feature.
moodle_moodle
train
php
126e44bf36da04852d99e0c6efca311aa57116ad
diff --git a/ddl/ddl_api.go b/ddl/ddl_api.go index <HASH>..<HASH> 100644 --- a/ddl/ddl_api.go +++ b/ddl/ddl_api.go @@ -2035,6 +2035,16 @@ func (d *ddl) CreateIndex(ctx sessionctx.Context, ti ast.Ident, unique bool, ind return errors.Trace(err) } + // Check before put the job is put to the queue. + // This check is redudant, but useful. If DDL check fail before the job is put + // to job queue, the fail path logic is super fast. + // After DDL job is put to the queue, and if the check fail, TiDB will run the DDL cancel logic. + // The recover step causes DDL wait a few seconds, makes the unit test painfully slow. + _, err = buildIndexColumns(t.Meta().Columns, idxColNames) + if err != nil { + return errors.Trace(err) + } + if indexOption != nil { // May be truncate comment here, when index comment too long and sql_mode is't strict. indexOption.Comment, err = validateCommentLength(ctx.GetSessionVars(),
ddl: fast fail check for create index to accelerate CI (#<I>) ➜ session git:(master) ✗ GO<I>MODULE=on go test -check.f TestIndexMaxLength before: ok github.com/pingcap/tidb/session <I>s after: ok github.com/pingcap/tidb/session <I>s
pingcap_tidb
train
go
e09afbe5d7ffa3426e8e41010c040f0889017919
diff --git a/volman/volman_executor_test.go b/volman/volman_executor_test.go index <HASH>..<HASH> 100644 --- a/volman/volman_executor_test.go +++ b/volman/volman_executor_test.go @@ -227,6 +227,9 @@ var _ = Describe("Executor/Garden/Volman", func() { err := executorClient.DeleteContainer(logger, guid) Expect(err).NotTo(HaveOccurred()) + err = os.RemoveAll(path.Join(componentMaker.VolmanDriverConfigDir, "_volumes", volumeId)) + Expect(err).ToNot(HaveOccurred()) + files, err := filepath.Glob(path.Join(componentMaker.VolmanDriverConfigDir, "_volumes", volumeId, fileName)) Expect(err).ToNot(HaveOccurred()) Expect(len(files)).To(Equal(0))
modify inigo tests to clean up mounted test volumes after unmount [#<I>](<URL>)
cloudfoundry_inigo
train
go
7bc0a61131c1a10ae1ac70c7cdd024b494f8ba7f
diff --git a/filterpy/kalman/square_root.py b/filterpy/kalman/square_root.py index <HASH>..<HASH> 100644 --- a/filterpy/kalman/square_root.py +++ b/filterpy/kalman/square_root.py @@ -334,6 +334,11 @@ class SquareRootKalmanFilter(object): """ system uncertainty (P projected to measurement space) """ return dot(self.S1_2, self.S1_2.T) + @property + def SI(self): + """ inverse system uncertainty (P projected to measurement space) """ + return dot(self.SI1_2.T, self.SI1_2) + def __repr__(self): return '\n'.join([ 'SquareRootKalmanFilter object', @@ -349,6 +354,7 @@ class SquareRootKalmanFilter(object): pretty_str('K', self.K), pretty_str('y', self.y), pretty_str('S', self.S), + pretty_str('SI', self.SI), pretty_str('M', self.M), pretty_str('B', self.B), ])
Added SI to SquareRootKalmanFilter.
rlabbe_filterpy
train
py
5bfffc2ca825983c48ddc503b4b2209bb534cc60
diff --git a/scour/scour.py b/scour/scour.py index <HASH>..<HASH> 100644 --- a/scour/scour.py +++ b/scour/scour.py @@ -3328,7 +3328,7 @@ def scourString(in_string, options=None): if options.error_on_flowtext: raise Exception(errmsg) else: - print("WARNING: {}".format(errmsg), file=options.ensure_value("stdout", sys.stdout)) + print("WARNING: {}".format(errmsg), file=sys.stderr) # remove descriptive elements removeDescriptiveElements(doc, options)
Hardcode printing of "flowtext" warning to stderr Third-party applications obviously can not handle additional output on stdout nor can they be expected to do any weird stdout/sterr redirection as we do via `options.stdout` We probably shouldn't print anything in `scourString()` to start with unless we offer an option to disable all non-SVG output for third-party libraries to use.
scour-project_scour
train
py
54d4434900b0763b1508b1ae3e080ceb13ca5edd
diff --git a/src/ol/animation.js b/src/ol/animation.js index <HASH>..<HASH> 100644 --- a/src/ol/animation.js +++ b/src/ol/animation.js @@ -115,7 +115,7 @@ ol.animation.rotate = function(options) { (sourceRotation - frameState.viewState.rotation) * delta; frameState.animate = true; frameState.viewState.rotation += deltaRotation; - if (!goog.isNull(anchor)) { + if (anchor) { var center = frameState.viewState.center; ol.coordinate.sub(center, anchor); ol.coordinate.rotate(center, deltaRotation);
Remove goog.isNull in animation class
openlayers_openlayers
train
js
a3f245b514c1528f6d975a2293a9071d395815d5
diff --git a/lib/cucumber/cli/options.rb b/lib/cucumber/cli/options.rb index <HASH>..<HASH> 100644 --- a/lib/cucumber/cli/options.rb +++ b/lib/cucumber/cli/options.rb @@ -118,6 +118,7 @@ module Cucumber "This option can be specified multiple times.") do |v| @options[:require] << v if(Cucumber::JRUBY && File.directory?(v)) + require 'java' $CLASSPATH << v end end
Must require 'java' before using $CLASSPATH in JRuby <I>. [#<I> state:resolved]
cucumber_cucumber-ruby
train
rb
57f8844b469d154e8c7f9be357dc1e96e982343d
diff --git a/lib/database_cleaner/data_mapper/truncation.rb b/lib/database_cleaner/data_mapper/truncation.rb index <HASH>..<HASH> 100644 --- a/lib/database_cleaner/data_mapper/truncation.rb +++ b/lib/database_cleaner/data_mapper/truncation.rb @@ -53,7 +53,7 @@ module DataMapper def truncate_table(table_name) execute("DELETE FROM #{quote_name(table_name)};") - if uses_sequence + if uses_sequence? execute("DELETE FROM sqlite_sequence where name = '#{table_name}';") end end @@ -65,6 +65,16 @@ module DataMapper yield end + private + + def uses_sequence? + sql = <<-SQL + SELECT name FROM sqlite_master + WHERE type='table' AND name='sqlite_sequence' + SQL + select(sql).first + end + end class SqliteAdapter < DataObjectsAdapter @@ -82,7 +92,7 @@ module DataMapper def truncate_table(table_name) execute("DELETE FROM #{quote_name(table_name)};") - if uses_sequence + if uses_sequence? execute("DELETE FROM sqlite_sequence where name = '#{table_name}';") end end @@ -94,6 +104,16 @@ module DataMapper yield end + private + + def uses_sequence? + sql = <<-SQL + SELECT name FROM sqlite_master + WHERE type='table' AND name='sqlite_sequence' + SQL + select(sql).first + end + end # FIXME
Fixes missing #uses_sequence invokation in adapter classes for sqlite and sqlite3
DatabaseCleaner_database_cleaner
train
rb
aeca353a02cdf6d0a764d7f175b90920b425b0e1
diff --git a/tests/Integration/ReactMqttClientTest.php b/tests/Integration/ReactMqttClientTest.php index <HASH>..<HASH> 100644 --- a/tests/Integration/ReactMqttClientTest.php +++ b/tests/Integration/ReactMqttClientTest.php @@ -335,6 +335,29 @@ class ReactMqttClientTest extends \PHPUnit_Framework_TestCase } /** + * Test that client's is-connected state is updated correctly + * + * @depends test_connect_success + */ + public function test_is_connected_when_connect_event_emitted() + { + $client = $this->buildClient(); + + $client->on('connect', function(Connection $connection) use($client){ + $this->assertTrue($client->isConnected(), 'Client is should be connected'); + $this->stopLoop(); + }); + + $client->connect(self::HOSTNAME, self::PORT, null, 1) + ->then(function () use ($client) { + $this->assertTrue($client->isConnected()); + $this->stopLoop(); + }); + + $this->startLoop(); + } + + /** * Tests that messages can be send and received successfully. * * @depends test_connect_success
Add is connected on 'connect' event test Proves that a client is connected once the "connect" event is dispatched.
binsoul_net-mqtt-client-react
train
php
715bc558b368ad3e2c871ffd2e178129ee5cc970
diff --git a/app/models/ldap_authentication.rb b/app/models/ldap_authentication.rb index <HASH>..<HASH> 100644 --- a/app/models/ldap_authentication.rb +++ b/app/models/ldap_authentication.rb @@ -27,19 +27,21 @@ class LdapAuthentication encryption: get_encryption) if ::Configuration.ldap_user_dn_pattern - session.search( + result = session.search( base: get_user_dn_from_pattern, attributes: get_attributes, return_result: true - ).try(:first) + ) + result ? result.try(:first) : nil elsif ::Configuration.ldap_search_base_dn && ::Configuration.ldap_search_filter - session.bind_as( + result = session.bind_as( base: ::Configuration.ldap_search_base_dn, filter: get_search_filter_bind_as, password: @password, attributes: get_attributes, return_result: true - ).try(:first) + ) + result ? result.try(:first) : nil else raise ArgumentError, 'LDAP authentication requires either a user_dn_pattern, or a search_base_dn and a search_filter' end
Fix for failed authentication - Net::LDAP returns False, which does not expose a "first" method.
Graylog2_graylog2-server
train
rb
1a7eee74b8bc1cf981b9c63c6e024b593684b762
diff --git a/bdates/__init__.py b/bdates/__init__.py index <HASH>..<HASH> 100644 --- a/bdates/__init__.py +++ b/bdates/__init__.py @@ -85,7 +85,7 @@ def get_date_from_match_group(match): if month.isdigit(): month = int(month) else: - month = month_to_number[month] + month = month_to_number[month.title()] try: day = int(match.group("day_of_the_month"))
fixed month_to_number lookup where month isn't capitalized/titled for some reason
BKTO_bdates
train
py
dcab3593d7b0458f164f4c56fb60ec36e3ec091d
diff --git a/.babelrc.js b/.babelrc.js index <HASH>..<HASH> 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -29,11 +29,4 @@ module.exports = { ], ignore: [/\/node_modules\/(?!@interactjs\/)/], - - extensions: [ - '.ts', - '.tsx', - '.js', - '.jsx', - ] } diff --git a/scripts/bundler.js b/scripts/bundler.js index <HASH>..<HASH> 100644 --- a/scripts/bundler.js +++ b/scripts/bundler.js @@ -44,6 +44,12 @@ module.exports = function (options) { sourceType: 'module', global: true, ...babelrc, + extensions: [ + '.ts', + '.tsx', + '.js', + '.jsx', + ], }], ],
chore: move babelify extensions config to bundler
taye_interact.js
train
js,js
5a87dc960e6fe00eba0a1c5f798a9143f3b0a516
diff --git a/src/getstream.js b/src/getstream.js index <HASH>..<HASH> 100644 --- a/src/getstream.js +++ b/src/getstream.js @@ -26,7 +26,7 @@ function connect(apiKey, apiSecret, appId, options) { * @example <caption>where streamURL looks like</caption> * "https://thierry:pass@gestream.io/?app=1" */ - if (typeof process !== 'undefined' && process.env.STREAM_URL && !apiKey) { + if (process && process.env && process.env.STREAM_URL && !apiKey) { const parts = /https:\/\/(\w+):(\w+)@([\w-]*).*\?app_id=(\d+)/.exec(process.env.STREAM_URL); apiKey = parts[1]; apiSecret = parts[2];
fixes #<I> with undefined process.env
GetStream_stream-js
train
js
b5648aaa6a6498df8e44f815d88a4d65a8e90ff4
diff --git a/Test/Asserters/Crawler.php b/Test/Asserters/Crawler.php index <HASH>..<HASH> 100644 --- a/Test/Asserters/Crawler.php +++ b/Test/Asserters/Crawler.php @@ -8,9 +8,9 @@ use mageekguy\atoum\asserters; class Crawler extends asserters\object { - public function setWith($value) + public function setWith($value, $checkType = false) { - parent::setWith($value, false); + parent::setWith($value, $checkType); if (self::isCrawler($this->value) === false) { $this->fail(sprintf($this->getLocale()->_('%s is not a crawler'), $this));
Update crawler assert to fix #<I> issue
atoum_AtoumBundle
train
php
d7b23fefd616c4d00954ef27808d0fdef9611f75
diff --git a/km3pipe/__version__.py b/km3pipe/__version__.py index <HASH>..<HASH> 100644 --- a/km3pipe/__version__.py +++ b/km3pipe/__version__.py @@ -9,7 +9,7 @@ Pep 386 compliant version info. (1, 2, 0, 'beta', 2) => "1.2b2" """ -version_info = (0, 6, 1, 'final', 0) +version_info = (0, 6, 2, 'final', 0) def _get_version(version_info): """Return a PEP 386-compliant version number."""
Changes version to <I>
tamasgal_km3pipe
train
py
b4f7eec5db2506f53ceccc52f01f61f3b66dbb03
diff --git a/axiom/attributes.py b/axiom/attributes.py index <HASH>..<HASH> 100644 --- a/axiom/attributes.py +++ b/axiom/attributes.py @@ -101,7 +101,7 @@ class Comparable: _likeOperators = ('LIKE', 'NOT LIKE') def _like(self, op, *others): if op.upper() not in self._likeOperators: - raise ValueError, 'LIKE-style operators are: %s' % self._likeOperators + raise ValueError, 'LIKE-style operators are: %r' % self._likeOperators if not others: raise ValueError, 'Must pass at least one expression to _like'
use %r instead of %s when formatting the tuple of acceptable LIKE expressions
twisted_axiom
train
py
a28d7c0160c0c24319f767facdb82b3dcf81a268
diff --git a/js/jquery.cloudinary.js b/js/jquery.cloudinary.js index <HASH>..<HASH> 100644 --- a/js/jquery.cloudinary.js +++ b/js/jquery.cloudinary.js @@ -166,13 +166,13 @@ }; $.fn.cloudinary = function(options) { this.filter('img').each(function() { - options = $.extend({width: $(this).attr('width'), height: $(this).attr('height'), + var img_options = $.extend({width: $(this).attr('width'), height: $(this).attr('height'), src: $(this).attr('src')}, $.extend($(this).data(), options)); - var public_id = option_consume(options, 'source', option_consume(options, 'src')); - var url = cloudinary_url(public_id, options); - html_only_attributes(options); - $(this).attr({src: url, width: options['width'], height: options['height']}); + var public_id = option_consume(img_options, 'source', option_consume(img_options, 'src')); + var url = cloudinary_url(public_id, img_options); + html_only_attributes(img_options); + $(this).attr({src: url, width: img_options['width'], height: img_options['height']}); }); return this; };
Options were shared between iterations of $.fn.cloudinary
cloudinary_cloudinary_js
train
js
bd060ba9b5c60a70c182e55412533be6c51506d8
diff --git a/lib/ftp.js b/lib/ftp.js index <HASH>..<HASH> 100644 --- a/lib/ftp.js +++ b/lib/ftp.js @@ -11,7 +11,7 @@ var RE_XLISTUNIX = XRegExp.cache('^(?<type>[\\-ld])(?<permission>([\\-r][\\-w][\ RE_XTIMEVAL = XRegExp.cache('^(?<year>\\d{4})(?<month>\\d{2})(?<date>\\d{2})(?<hour>\\d{2})(?<minute>\\d{2})(?<second>\\d+)$'), RE_PASV = /([\d]+),([\d]+),([\d]+),([\d]+),([-\d]+),([-\d]+)/, RE_EOL = /\r?\n/g, - RE_RESEND = /(?:^|\r?\n)(\d{3}) [^\r\n]*\r?\n$/; + RE_RESEND = /(?:^|\r?\n)(\d{3}) [^\r\n]*\r?\n/; var MONTHS = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6,
fix missed change to response end regexp
mscdex_node-ftp
train
js
d55a040ba56a2b44f0e991e5c671a62879f80dfb
diff --git a/lib/overcommit/plugins/pre_commit/coffee_lint.rb b/lib/overcommit/plugins/pre_commit/coffee_lint.rb index <HASH>..<HASH> 100644 --- a/lib/overcommit/plugins/pre_commit/coffee_lint.rb +++ b/lib/overcommit/plugins/pre_commit/coffee_lint.rb @@ -8,7 +8,8 @@ module Overcommit::GitHook return :warn, 'Run `npm install -g coffeelint`' end - output = `coffeelint --quiet #{(staged.join(' '))}`.split("\n") + paths = staged.collect(&:path).join(' ') + output = `coffeelint --quiet #{paths}`.split("\n") return ($?.success? ? :good : :bad), output end end
Fix CoffeeScript linter path processing The path was not being created properly for coffee_lint. This commit emulates the other plug-ins by creating a paths variable. Submitted as a pull request here: <URL>
sds_overcommit
train
rb
51f89001cf8a0a22524a32bdd38feb6c0b7a308a
diff --git a/code/libraries/koowa/controller/resource.php b/code/libraries/koowa/controller/resource.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/controller/resource.php +++ b/code/libraries/koowa/controller/resource.php @@ -331,6 +331,11 @@ abstract class KControllerResource extends KControllerAbstract if(isset($state->$method) || in_array($method, array('layout', 'view', 'format'))) { $this->$method = $args[0]; + + if($method == 'view') { + $this->setView($args[0]); + } + return $this; } }
re #<I> : Fluent interface doesn't set view properly in controllers
joomlatools_joomlatools-framework
train
php
4b70d36b5f071f0193465c589196b2b94df549ee
diff --git a/rackup.php b/rackup.php index <HASH>..<HASH> 100755 --- a/rackup.php +++ b/rackup.php @@ -1,7 +1,6 @@ #!/usr/bin/env php <?php -require "lib/Rack.php"; -require "lib/RubyRack.php"; +require "autoload.php"; class App { diff --git a/test/app.php b/test/app.php index <HASH>..<HASH> 100644 --- a/test/app.php +++ b/test/app.php @@ -1,6 +1,6 @@ <?php -require __DIR__."/../lib/Rack.php"; +require __DIR__."/../autoload.php"; $app = function($env) { return array(200, array('Content-Type' => 'text/html'), array('Hello World!'));
scripts use autoloader now.
tamagokun_rackem
train
php,php
9e877a562113f13e2b0de813a75e1b61c75df76a
diff --git a/src/scroller.js b/src/scroller.js index <HASH>..<HASH> 100644 --- a/src/scroller.js +++ b/src/scroller.js @@ -76,8 +76,11 @@ var Scroller = React.createClass({displayName: "Scroller", // Set styles if (item._node) { for(var prop in styleObject) { - item._node.style[prop] = styleObject[prop]; + if (!item._prevStyles || item._prevStyles[prop] !== styleObject[prop]) { + item._node.style[prop] = styleObject[prop]; + } } + item._prevStyles = styleObject; } else { item._pendingStyles = styleObject; } @@ -191,6 +194,7 @@ var Scroller = React.createClass({displayName: "Scroller", scrollingY: self.props.scrollingY, }); + // Because of React batch operations and optimizations, we need to wait // for next tick in order to all ScrollableItems initialize and have proper // RectCache before updating containerSizer for the first time.
Skip setting same styles are previous frames for better performance
yahoo_scrollable
train
js
45ee097d5c3c727ad541bb6456a63b6e02496f81
diff --git a/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractResponseHandler.java b/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractResponseHandler.java index <HASH>..<HASH> 100644 --- a/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractResponseHandler.java +++ b/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractResponseHandler.java @@ -4,7 +4,7 @@ import com.github.dreamhead.moco.MocoConfig; import com.github.dreamhead.moco.ResponseHandler; public abstract class AbstractResponseHandler implements ResponseHandler { - protected ResponseHandler doApply(final MocoConfig config) { + protected final ResponseHandler doApply(final MocoConfig config) { return this; }
added missing final to abstract response handler
dreamhead_moco
train
java
57192ab92bdf7209da069d0635bf77cf16491005
diff --git a/lib/knex.js b/lib/knex.js index <HASH>..<HASH> 100644 --- a/lib/knex.js +++ b/lib/knex.js @@ -200,10 +200,12 @@ function explainAfterQuery (app, knex) { knex.on('query-response', (_response, { sql, bindings }) => { sql = knex.client._formatQuery(sql, bindings).trim(); if (haveQueryPlan(sql)) { - knex.raw(`explain ${sql}`).then(result => { - const explains = helper.rawResult(knex.dialect, result); - app.knexLogger.info('[egg-knex] explains of %s\n=====> result: %j', sql, explains); - }); + knex.raw(`explain ${sql}`) + .then(result => { + const explains = helper.rawResult(knex.dialect, result); + app.knexLogger.info('[egg-knex] explains of %s\n=====> result: %j', sql, explains); + }) + .catch(() => app.knexLogger.info('[egg-knex] Whoops! Explain does\'n work with:', sql)); } }); }
fix: raise explain exception * Mysql <I> only support SELECT statement
sunfuze_egg-knex
train
js
7d7399f846e7982511a1dd02f8ae772ff4e880be
diff --git a/GPy/plotting/gpy_plot/gp_plots.py b/GPy/plotting/gpy_plot/gp_plots.py index <HASH>..<HASH> 100644 --- a/GPy/plotting/gpy_plot/gp_plots.py +++ b/GPy/plotting/gpy_plot/gp_plots.py @@ -91,7 +91,7 @@ def _plot_mean(self, canvas, helper_data, helper_prediction, if projection == '2d': update_not_existing_kwargs(kwargs, pl().defaults.meanplot_2d) # @UndefinedVariable plots = dict(gpmean=[pl().contour(canvas, x[:,0], y[0,:], - mu.reshape(resolution, resolution), + mu.reshape(resolution, resolution).T, levels=levels, label=label, **kwargs)]) elif projection == '3d': update_not_existing_kwargs(kwargs, pl().defaults.meanplot_3d) # @UndefinedVariable
[gp_plots] transposed plotting of 2d contours
SheffieldML_GPy
train
py
b890da27f53704456d389546c75796136115b1c3
diff --git a/src/adapters/S3.js b/src/adapters/S3.js index <HASH>..<HASH> 100644 --- a/src/adapters/S3.js +++ b/src/adapters/S3.js @@ -1,5 +1,12 @@ +var util = require('util'); +var BaseAdapter = require(__dirname + '/../base_adapter'); + +var S3Adapter = function(fs) { + this.fs = fs; +} + +util.inherits(S3Adapter, BaseAdapter); + module.exports = function() { - return function() { - console.log('S3 adapter not implemented yet.'); - }; + return new S3Adapter(); };
Update S3 adapter to inherit the base adapter.
bitbinio_bitbin
train
js
e56a14be786df3c3bdc032be69a7249b00363cff
diff --git a/ddl/partition.go b/ddl/partition.go index <HASH>..<HASH> 100644 --- a/ddl/partition.go +++ b/ddl/partition.go @@ -50,8 +50,19 @@ func buildTablePartitionInfo(ctx sessionctx.Context, d *ddl, s *ast.CreateTableS enable = false default: // When tidb_enable_table_partition = 'auto', - // Partition by range expression is enabled by default. - if s.Partition.Tp == model.PartitionTypeRange && s.Partition.ColumnNames == nil { + if s.Partition.Tp == model.PartitionTypeRange { + // Partition by range expression is enabled by default. + if s.Partition.ColumnNames == nil { + enable = true + } + // Partition by range columns and just one column. + if len(s.Partition.ColumnNames) == 1 { + enable = true + } + } + // Partition by hash is enabled by default. + // Note that linear hash is not enabled. + if s.Partition.Tp == model.PartitionTypeHash { enable = true } }
ddl: enable hash partition and range columns partition by default (#<I>)
pingcap_tidb
train
go
d7b7a1124f7776f0caae4bc68ddb9a208f0c3f1c
diff --git a/spec/unit/veritas/comparator/compare_spec.rb b/spec/unit/veritas/comparator/compare_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/veritas/comparator/compare_spec.rb +++ b/spec/unit/veritas/comparator/compare_spec.rb @@ -28,6 +28,12 @@ describe Comparator, '#compare' do instance.hash.should eql(object.hash ^ instance.object_id.hash ^ instance.to_s.hash) end + # XXX: find out which instance is not a Fixnum + it { instance.hash.should be_instance_of(Fixnum) } + it { object.hash.should be_instance_of(Fixnum) } + it { instance.object_id.hash.should be_instance_of(Fixnum) } + it { instance.to_s.hash.should be_instance_of(Fixnum) } + it 'memoizes #hash' do subject instance.hash
Temporary commit to see which #hash method is returning a non-Fixnum
dkubb_axiom
train
rb
2deba6aab8abbad2ff184d8a8632ce7865f64906
diff --git a/mdata/cache/ccache_metric.go b/mdata/cache/ccache_metric.go index <HASH>..<HASH> 100644 --- a/mdata/cache/ccache_metric.go +++ b/mdata/cache/ccache_metric.go @@ -244,12 +244,11 @@ func (mc *CCacheMetric) Search(res *CCSearchResult, from, until uint32) { if !res.Complete && res.From > res.Until { log.Debug("CCacheMetric Search: Found from > until (%d/%d), printing chunks\n", res.From, res.Until) - mc.debugMetric() + mc.debugMetric(keys) } } -func (mc *CCacheMetric) debugMetric() { - keys := mc.sortedTs() +func (mc *CCacheMetric) debugMetric(keys []uint32) { log.Debug("CCacheMetric debugMetric: --- debugging metric ---\n") log.Debug("CCacheMetric debugMetric: oldest %d; newest %d\n", mc.oldest, mc.newest) for _, key := range keys {
no need to rebuild the keys slice when we already have it
grafana_metrictank
train
go
4a011f1e94ccdf3c659f2c6eda101b307c0c5faf
diff --git a/javacord-api/src/main/java/org/javacord/api/entity/server/BoostLevel.java b/javacord-api/src/main/java/org/javacord/api/entity/server/BoostLevel.java index <HASH>..<HASH> 100644 --- a/javacord-api/src/main/java/org/javacord/api/entity/server/BoostLevel.java +++ b/javacord-api/src/main/java/org/javacord/api/entity/server/BoostLevel.java @@ -21,7 +21,7 @@ public enum BoostLevel { /** * Server Boost level 3. */ - TIER_3(2), + TIER_3(3), /** * An unknown boost level, most likely due to new added boost levels.
Id Bugfix Tier 3 ID was set to "2" when it should be "3"
Javacord_Javacord
train
java
482ac64f51335e3048f00797545b9cb5b6a27900
diff --git a/src/vis/image.js b/src/vis/image.js index <HASH>..<HASH> 100644 --- a/src/vis/image.js +++ b/src/vis/image.js @@ -166,16 +166,18 @@ var vizjson = this.imageOptions.vizjson; - var isHTTPS = vizjson.indexOf("https") !== -1 ? true : false; - this.options.tiler_domain = domain; + this.options.tiler_protocol = protocol; + this.options.tiler_port = port; + + if (vizjson.indexOf("http") === 0) { + var isHTTPS = vizjson.indexOf("https") !== -1 ? true : false; + + if (isHTTPS) { + this.options.tiler_protocol = "https"; + this.options.tiler_port = 443; + } - if (isHTTPS) { - this.options.tiler_protocol = "https"; - this.options.tiler_port = 443; - } else { - this.options.tiler_protocol = protocol; - this.options.tiler_port = port; } },
if we serve the vizjson without the protocol, trust the info we got from the layer
CartoDB_carto.js
train
js
07e8a0d03858ee3a7f5060465d6ea7c384801b8a
diff --git a/appender.go b/appender.go index <HASH>..<HASH> 100644 --- a/appender.go +++ b/appender.go @@ -2,6 +2,7 @@ package golog import ( "fmt" + color "github.com/ivpusic/go-clicolor/clicolor" ) @@ -19,7 +20,7 @@ type Appender interface { // Representing stdout appender. type Stdout struct { - dateformat string + DateFormat string } var ( @@ -30,7 +31,7 @@ var ( func (s *Stdout) Append(log Log) { msg := fmt.Sprintf(" {cyan}%s {default}%s {%s}%s[%s] ▶ %s", log.Logger.Name, - log.Time.Format(s.dateformat), + log.Time.Format(s.DateFormat), log.Level.color, log.Level.icon, log.Level.Name[:4], @@ -50,7 +51,7 @@ func StdoutAppender() *Stdout { if instance == nil { instance = &Stdout{ - dateformat: "15:04:05", + DateFormat: "15:04:05", } }
exposed date format for stdout logger
ivpusic_golog
train
go
890011813148ed11951a28fd6cbacd61d267de5d
diff --git a/lib/discordrb/data.rb b/lib/discordrb/data.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/data.rb +++ b/lib/discordrb/data.rb @@ -852,7 +852,7 @@ module Discordrb process_channels(data['channels']) process_voice_states(data['voice_states']) - @owner = self.member(@owner_id) + @owner = member(@owner_id) end # @return [Channel] The default channel on this server (usually called #general)
Remove a redundant self reference when obtaining the owner
meew0_discordrb
train
rb
bafa7e9809f49dc035d4ced6c2a53830b909c03c
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -106,10 +106,6 @@ return $v; }) ->end() ->end() ->arrayNode('serializer') - ->validate() - ->ifTrue(function ($v) { return !empty($v['version']) && !empty($v['groups']); }) - ->thenInvalid('Only either a version or a groups exclusion strategy can be set') - ->end() ->addDefaultsIfNotSet() ->children() ->scalarNode('version')->defaultNull()->end()
Removing conflicting validation rule. While PR #<I> added support for using both serialization groups and versions, the configuration validation was not updated to reflect these changes. This commit simply removes the specific validation rule that is affected.
FriendsOfSymfony_FOSRestBundle
train
php
03685488b2aa512079e3d99c5b712b7a19b9667e
diff --git a/batchSystems/gridengine.py b/batchSystems/gridengine.py index <HASH>..<HASH> 100644 --- a/batchSystems/gridengine.py +++ b/batchSystems/gridengine.py @@ -65,13 +65,13 @@ class MemoryString: return cmp(self.bytes, other.bytes) def prepareQsub(cpu, mem): - qsubline = ["qsub","-b","y","-terse","-j" ,"y", "-cwd", "-o", "/dev/null", "-e", "/dev/null", "-v", - "LD_LIBRARY_PATH=%s" % os.environ["LD_LIBRARY_PATH"]] + qsubline = ["qsub","-b","y","-terse","-j" ,"y", "-cwd", "-o", "/dev/null", "-e", "/dev/null", "-V"] reqline = list() if cpu is not None: reqline.append("p="+str(cpu)) if mem is not None: reqline.append("vf="+str(mem/ 1024)+"K") + reqline.append("h_vmem="+str(mem/ 1024)+"K") if len(reqline) > 0: qsubline.extend(["-hard","-l", ",".join(reqline)]) return qsubline
Corrected bugs in command line to SGE
DataBiosphere_toil
train
py
54177fca38cf41050ae24726ab2e79078425e25e
diff --git a/app/models/cms/layout.rb b/app/models/cms/layout.rb index <HASH>..<HASH> 100644 --- a/app/models/cms/layout.rb +++ b/app/models/cms/layout.rb @@ -81,7 +81,7 @@ protected # Forcing page content reload def clear_cached_page_content - self.pages.each{ |page| page.clear_cached_content! } + Cms::Page.where(:id => self.pages.pluck(:id)).update_all(:content => nil) self.children.each{ |child_layout| child_layout.clear_cached_page_content } end
same idea for layout cached content busting
comfy_comfortable-mexican-sofa
train
rb
5e72b600b7a541c2dced68a0c250227fa8b4f276
diff --git a/pug/miner/views.py b/pug/miner/views.py index <HASH>..<HASH> 100644 --- a/pug/miner/views.py +++ b/pug/miner/views.py @@ -247,7 +247,7 @@ def context_from_request(request, context=None, Form=GetLagForm, delim=',', verb 'max_lag': str(max_lag), 'min_date': ', '.join(context['filter']['min_dates']), 'max_date': ', '.join(context['filter']['max_dates']), - 'regex': ', '.context['regex'], + 'regex': context['regex'], } if verbosity > 1:
fix bug in get of regex from context
hobson_pug
train
py
ea23342ab3c7d7503a241df319d1aca3ea0500bc
diff --git a/sc2common/__version__.py b/sc2common/__version__.py index <HASH>..<HASH> 100644 --- a/sc2common/__version__.py +++ b/sc2common/__version__.py @@ -17,6 +17,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -VERSION = (1, 0, 13) +VERSION = (1, 1, 0) __version__ = '.'.join(map(str, VERSION))
- significant version bump owing to logic changes within RestrictedType class
ttinies_sc2common
train
py
981e0b235e74dc9d23ab2f54170bca08abf46da9
diff --git a/iapws/iapws97.py b/iapws/iapws97.py index <HASH>..<HASH> 100644 --- a/iapws/iapws97.py +++ b/iapws/iapws97.py @@ -4021,7 +4021,7 @@ def _Bound_hs(h, s): """ region = None s13 = _Region1(623.15, 100)["s"] - s13s = _Region1(623.15, Ps_623)["s"] + s13s = _Region1(623.15, Ps_623)["s"] sTPmax = _Region2(1073.15, 100)["s"] s2ab = _Region2(1073.15, 4)["s"]
Correct flake8 E<I> complaint. E<I> multiple spaces after ','
jjgomera_iapws
train
py
9574b11446d416f762c2928f2c56b9531a76f53d
diff --git a/springloaded/src/main/java/org/springsource/loaded/MethodInvokerRewriter.java b/springloaded/src/main/java/org/springsource/loaded/MethodInvokerRewriter.java index <HASH>..<HASH> 100644 --- a/springloaded/src/main/java/org/springsource/loaded/MethodInvokerRewriter.java +++ b/springloaded/src/main/java/org/springsource/loaded/MethodInvokerRewriter.java @@ -992,10 +992,11 @@ public class MethodInvokerRewriter { @Override public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) { // TODO *shudder* what about invoke dynamic calls that target reflective APIs - int classId = typeRegistry.getTypeIdFor(slashedclassname, false); + int classId = typeRegistry.getTypeIdFor(slashedclassname, true); if (classId==-1) { - throw new IllegalStateException(); + throw new IllegalStateException("Unable to find classId for "+slashedclassname+" referenced from invokedynamic in "+this.methodname+"()"); } + // Initially only rewriting use of INVOKEDYNAMIC to support Lambda execution // TODO support the more general invokedynamic usage
Allow for class not yet loaded when rewriting invokedynamic
spring-projects_spring-loaded
train
java
779e4bb72d07200e659668f5046a52f6f2882014
diff --git a/tests/test_substrate.py b/tests/test_substrate.py index <HASH>..<HASH> 100644 --- a/tests/test_substrate.py +++ b/tests/test_substrate.py @@ -828,7 +828,7 @@ class TestMAASAccountFromConfig(TestCase): config = get_maas_env().config with patch('subprocess.check_call', autospec=True) as cc_mock: with maas_account_from_config(config) as maas: - self.assertIsInstance(maas, MAASAccount) + self.assertIs(type(maas), MAASAccount) self.assertEqual(maas.profile, 'mas') self.assertEqual(maas.url, 'http://10.0.10.10/MAAS/api/2.0/') self.assertEqual(maas.oauth, 'a:password:string') @@ -846,7 +846,7 @@ class TestMAASAccountFromConfig(TestCase): with patch('subprocess.check_call', autospec=True, side_effect=[login_error, None, None]) as cc_mock: with maas_account_from_config(config) as maas: - self.assertIsInstance(maas, MAASAccount) + self.assertIs(type(maas), MAAS1Account) self.assertEqual(maas.profile, 'mas') self.assertEqual(maas.url, 'http://10.0.10.10/MAAS/api/1.0/') self.assertEqual(maas.oauth, 'a:password:string')
Correct check on MAASAccount types in test
juju_juju
train
py
9c9ca22ecb488fce09dfb3fc168621002ffb1022
diff --git a/src/main/java/com/cloudera/data/filesystem/FileSystemMetadataProvider.java b/src/main/java/com/cloudera/data/filesystem/FileSystemMetadataProvider.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/cloudera/data/filesystem/FileSystemMetadataProvider.java +++ b/src/main/java/com/cloudera/data/filesystem/FileSystemMetadataProvider.java @@ -38,6 +38,21 @@ import com.google.common.base.Preconditions; import com.google.common.io.Closeables; import com.google.common.io.Resources; +/** + * <p> + * A {@link MetadataProvider} that stores dataset metadata in a Hadoop + * {@link FileSystem}. + * </p> + * <p> + * When configured with a root directory, this implementation serializes the + * information within a {@link DatasetDescriptor} on the provided + * {@link FileSystem}. The descriptor is serialized as an Avro object and stored + * in a directory named after the dataset name. For example, if the dataset name + * is {@code logs}, the directory {@code rootDirectory/logs/} will be created, + * if it doesn't exist, and the serialized descriptor will be stored in the file + * {@code descriptor.avro}. + * </p> + */ public class FileSystemMetadataProvider implements MetadataProvider { private static final Logger logger = LoggerFactory
Added class-level javadoc to FileSystemMetadataProvider.
kite-sdk_kite
train
java
b578438b3952886a005d700242c685bfa8cbe541
diff --git a/health/statuscheck/plugin_impl_statuscheck.go b/health/statuscheck/plugin_impl_statuscheck.go index <HASH>..<HASH> 100644 --- a/health/statuscheck/plugin_impl_statuscheck.go +++ b/health/statuscheck/plugin_impl_statuscheck.go @@ -303,6 +303,7 @@ func (p *Plugin) GetPluginStatus(pluginName string) status.PluginStatus { return *(p.pluginStat[string(pluginName)]) } +// GetAllPluginStatus returns a map containing status of each plugin func (p *Plugin) GetAllPluginStatus() map[string]status.PluginStatus { p.access.Lock() defer p.access.Unlock()
SPOPT-<I> - Prometheus Telemetry/Health for all plugins
ligato_cn-infra
train
go
f2c309af738690c3e5cb2794f3e7a0c4ea77165b
diff --git a/salt/utils/s3.py b/salt/utils/s3.py index <HASH>..<HASH> 100644 --- a/salt/utils/s3.py +++ b/salt/utils/s3.py @@ -106,6 +106,9 @@ def query(key, keyid, method='GET', params=None, headers=None, if local_file: payload_hash = salt.utils.get_hash(local_file, form='sha256') + if path is None: + path = '' + if not requesturl: requesturl = 'https://{0}/{1}'.format(endpoint, path) headers, requesturl = salt.utils.aws.sig4( @@ -132,13 +135,13 @@ def query(key, keyid, method='GET', params=None, headers=None, if method == 'PUT': if local_file: - with salt.utils.fopen(local_file, 'r') as data: - result = requests.request(method, - requesturl, - headers=headers, - data=data, - verify=verify_ssl, - stream=True) + data = salt.utils.fopen(local_file, 'r') + result = requests.request(method, + requesturl, + headers=headers, + data=data, + verify=verify_ssl, + stream=True) response = result.content elif method == 'GET' and local_file and not return_bin: result = requests.request(method,
Back-port #<I> to <I> (#<I>) * Fix: local variable result referenced before assignment * Fix: if 'path' variable is None convert it into an empty string
saltstack_salt
train
py
0c4c62f631c03cbc930a243d0657dbbec755811b
diff --git a/phoxy.js b/phoxy.js index <HASH>..<HASH> 100755 --- a/phoxy.js +++ b/phoxy.js @@ -1,5 +1,8 @@ if (typeof phoxy == 'undefined') phoxy = {}; +if (typeof phoxy.state !== 'undefined') + if (phoxy.state.loaded == true) + throw "Phoxy already loaded. Dont mess with this"; var phoxy = @@ -218,6 +221,10 @@ phoxy._RenderSubsystem = if (result != undefined && result != '') $("#" + result).replaceWith(html); + + if (typeof phoxy == 'undefined' || typeof phoxy.state == 'undefined') + throw "EJS render failed. Phoxy is missing. Is .ejs file exsists? Is your .htacess right? Check last AJAX request."; + return obj; } ,
Cathing unexpected phoxy rewrite When you rendering something like <script>phoxy= an so on #<I>
phoxy_phoxy
train
js
c017102dfe9da68ceb901a022bb979b662100f52
diff --git a/cmd/test.go b/cmd/test.go index <HASH>..<HASH> 100644 --- a/cmd/test.go +++ b/cmd/test.go @@ -62,6 +62,12 @@ func testPackage(targets map[string]gb.PkgTarget, pkg *gb.Package) gb.Target { TestGoFiles: pkg.TestGoFiles, // passed directly to buildTestMain XTestGoFiles: pkg.XTestGoFiles, // passed directly to buildTestMain + CgoCFLAGS: pkg.CgoCFLAGS, + CgoCPPFLAGS: pkg.CgoCPPFLAGS, + CgoCXXFLAGS: pkg.CgoCXXFLAGS, + CgoLDFLAGS: pkg.CgoLDFLAGS, + CgoPkgConfig: pkg.CgoPkgConfig, + Imports: imports, })
cmd/test: build test binaries with cgo* flags
constabulary_gb
train
go
7f028c2d3e3e81b8a12557bb785aabb5fd72b48a
diff --git a/playem-audiofile.js b/playem-audiofile.js index <HASH>..<HASH> 100644 --- a/playem-audiofile.js +++ b/playem-audiofile.js @@ -107,7 +107,7 @@ function AudioFilePlayer(){ }; Player.prototype.setTrackPosition = function(pos) { - this.widget && this.widget.setPosition(pos * 1000); + this.widget && this.widget.setPosition(Math.floor(Math.min(this.widget.duration, pos * 1000) - 2000)); }; Player.prototype.embed = function(vars) {
in order to avoid receiving onEnd event too early: can only seek 2 seconds before end of loaded stream
adrienjoly_playemjs
train
js
e3a9216c652670ae32de9bcb1aa499e152704edc
diff --git a/modelx/core/model.py b/modelx/core/model.py index <HASH>..<HASH> 100644 --- a/modelx/core/model.py +++ b/modelx/core/model.py @@ -116,8 +116,8 @@ class Model(SpaceContainer): def __getitem__(self, space): return self._impl.space[space] - def __repr__(self): - return self._impl.repr_ + # def __repr__(self): + # return self._impl.repr_ @property def spaces(self):
removed Model.__repr__ to revert to a default repr
fumitoh_modelx
train
py
86eeded06787c755f9e7b12c1391bd7aab8ec134
diff --git a/error.go b/error.go index <HASH>..<HASH> 100644 --- a/error.go +++ b/error.go @@ -129,7 +129,7 @@ type ActiveEndpointsError struct { } func (aee *ActiveEndpointsError) Error() string { - return fmt.Sprintf("network %s has active endpoints", aee.name) + return fmt.Sprintf("network %s id %s has active endpoints", aee.name, aee.id) } // Forbidden denotes the type of this error
print name and id infomation when has active endpoints
docker_libnetwork
train
go
84aac553322943db7e93ef9651ccfe076bde6635
diff --git a/salt/modules/ps.py b/salt/modules/ps.py index <HASH>..<HASH> 100644 --- a/salt/modules/ps.py +++ b/salt/modules/ps.py @@ -4,8 +4,23 @@ See http://code.google.com/p/psutil. ''' import time -import psutil - +try: + import psutil + has_psutil = True +except ImportError: + has_psutil = False + +def __virtual__(): + if not has_psutil: + return False + + # The python 2.6 version of psutil lacks several functions + # used in this salt module so instead of spaghetti string + # code to try to bring sanity to everything, disable it. + if sys.version_info[0] == 2 and sys.version_info[1] < 7: + return False + + return "ps" def top(num_processes=5, interval=3): '''
Disable the ps salt module on python <I> There are too many issues with it. Fixes #<I>
saltstack_salt
train
py
5daa4a750d562ef95a3bca842cd489163831961a
diff --git a/nipap-cli/nipap_cli/nipap_cli.py b/nipap-cli/nipap_cli/nipap_cli.py index <HASH>..<HASH> 100755 --- a/nipap-cli/nipap_cli/nipap_cli.py +++ b/nipap-cli/nipap_cli/nipap_cli.py @@ -467,6 +467,7 @@ def view_prefix(arg, opts): print " %-15s : %s" % ("VRF", vrf) print " %-15s : %s" % ("Description", p.description) print " %-15s : %s" % ("Node", p.node) + print " %-15s : %s" % ("Country", p.country) print " %-15s : %s" % ("Order", p.order_id) print " %-15s : %s" % ("Alarm priority", p.alarm_priority) print " %-15s : %s" % ("Monitor", p.monitor)
Show country in address view function The nipap CLI command now also displays the 'country' attribute of a prefix.
SpriteLink_NIPAP
train
py
e0716639c92a96096b5a5fbea876451873c94c35
diff --git a/lib/devices/gateway.js b/lib/devices/gateway.js index <HASH>..<HASH> 100644 --- a/lib/devices/gateway.js +++ b/lib/devices/gateway.js @@ -164,7 +164,7 @@ const Gateway = Thing.type(Parent => class Gateway extends Parent.with(MiioApi, }); } - this.syncer.update(defs); + return this.syncer.update(defs); }); }
Return promise of child syncer to wait for sync
aholstenson_miio
train
js
ec797ed708d89e76e430252472b8fe398faa64a0
diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index <HASH>..<HASH> 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Minicron::CLI do it 'should run a simple command and print the output to stdout' do output = capture_stdout do - Minicron::CLI.new(['run', 'echo hello']).run + Minicron::CLI.new(['run', 'echo hello', '--trace']).run end output.clean == 'hello' @@ -11,7 +11,7 @@ describe Minicron::CLI do it 'should run a simple multi-line command and print the output to stdout' do output = capture_stdout do - Minicron::CLI.new(['run', 'ls -l']).run + Minicron::CLI.new(['run', 'ls -l', '--trace']).run end output.clean == `ls -l`.clean
Not sure this will work but it's worth a shot
jamesrwhite_minicron
train
rb
fad5f5e5ab3714c0c9ee531d300c473e9deb0aa9
diff --git a/tests/Sniffs/ControlStructures/data/earlyExitNoErrors.php b/tests/Sniffs/ControlStructures/data/earlyExitNoErrors.php index <HASH>..<HASH> 100644 --- a/tests/Sniffs/ControlStructures/data/earlyExitNoErrors.php +++ b/tests/Sniffs/ControlStructures/data/earlyExitNoErrors.php @@ -63,3 +63,11 @@ function () { // Something }; + +function () { + if (true) { + $variable = 'a'; + } else { + $variable = 'b'; + } +};
More tests for EarlyExitSniff
slevomat_coding-standard
train
php
abe18f83be82872e8641a7f4d6e810ecb13ebce3
diff --git a/app/src/Bolt/Content.php b/app/src/Bolt/Content.php index <HASH>..<HASH> 100644 --- a/app/src/Bolt/Content.php +++ b/app/src/Bolt/Content.php @@ -6,7 +6,7 @@ use Silex; class Content implements \ArrayAccess { - private $app; + protected $app; public $id; public $values; public $taxonomy;
Setting $app variable to protected, which may be useful for 0c<I>c
bolt_bolt
train
php
f0d4e7008fe87cb73eeffecaaa502d22615bc6bb
diff --git a/src/components/IntlTelInput.js b/src/components/IntlTelInput.js index <HASH>..<HASH> 100644 --- a/src/components/IntlTelInput.js +++ b/src/components/IntlTelInput.js @@ -375,8 +375,6 @@ export default React.createClass({ outerHeight: this.state.telInput.outerHeight } }); - - this.notifyPhoneNumberChange(formatted); }, // replace any existing dial code with the new one (if not in nationalMode) @@ -596,6 +594,9 @@ export default React.createClass({ document.removeEventListener('keydown', this.handleDocumentKeyDown); document.querySelector('html').removeEventListener('click', this.handleDocumentClick); } + if (this.state.telInput.value !== nextState.telInput.value) { + this.notifyPhoneNumberChange(nextState.telInput.value); + } }, // prepare all of the country data, including onlyCountries and preferredCountries options @@ -959,8 +960,6 @@ export default React.createClass({ // if no autoFormat, just update flag this.updateFlagFromNumber(React.findDOMNode(this.refs.telInput).value); } - - this.notifyPhoneNumberChange(e.target.value); }, handleInputChange (e) {
Prevent infinite loop when phone number has changed
patw0929_react-intl-tel-input
train
js
7def116d1b89ba86705054c0a32f0f718ca6060a
diff --git a/samples/automl/automlVisionPredict.js b/samples/automl/automlVisionPredict.js index <HASH>..<HASH> 100755 --- a/samples/automl/automlVisionPredict.js +++ b/samples/automl/automlVisionPredict.js @@ -55,7 +55,7 @@ async function predict( const params = {}; if (scoreThreshold) { - params.scoreThreshold = scoreThreshold; + params.score_threshold = scoreThreshold; } // Set the payload by giving the content and type of the file.
fix: Param "scoreThreshold" should be "score_threshold" (#<I>) Sine <I> Oct <I>, I found that the scoreThreshold param won't work and encounter "Error: 3 INVALID_ARGUMENT: Request contains an invalid argument." during prediction call. I compared the doc below and the params should be score_threshold instead of scoreThreshold. <URL>
googleapis_nodejs-vision
train
js
1cc0afc2e970d733f5da3abb9666c2b7679ba23d
diff --git a/openquake/calculators/event_based.py b/openquake/calculators/event_based.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/event_based.py +++ b/openquake/calculators/event_based.py @@ -229,6 +229,7 @@ class EventBasedCalculator(base.HazardCalculator): fake = logictree.FullLogicTree.fake(gsim_lt) self.realizations = fake.get_realizations() self.datastore['full_lt'] = fake + self.store_rlz_info({}) # store weights self.save_params() calc.RuptureImporter(self.datastore).import_array(rup_array) mesh = surface_to_array(self.rup.surface).transpose(1, 2, 0).flatten() @@ -253,7 +254,6 @@ class EventBasedCalculator(base.HazardCalculator): return {} else: # scenario self._read_scenario_ruptures() - self.store_rlz_info({}) # store full_lt, weights if not oq.imtls: raise InvalidFile('There are no intensity measure types in %s' % oq.inputs['job_ini'])
Small cleanup [skip CI]
gem_oq-engine
train
py
e1e3f0b551f43259b17c51d5e1caa04d4fd7b692
diff --git a/src/Propel/Generator/Model/Table.php b/src/Propel/Generator/Model/Table.php index <HASH>..<HASH> 100644 --- a/src/Propel/Generator/Model/Table.php +++ b/src/Propel/Generator/Model/Table.php @@ -12,6 +12,7 @@ namespace Propel\Generator\Model; use DOMNode; use DOMDocument; +use Propel\Generator\Exception\BuildException; use Propel\Generator\Exception\EngineException; use Propel\Generator\Platform\MysqlPlatform; @@ -547,7 +548,7 @@ class Table extends ScopedElement implements IdMethod * Names composing objects which haven't yet been named. This * currently consists of foreign-key and index entities. */ - public function doNaming() + public function doNaming() { // Assure names are unique across all databases. try { @@ -1900,7 +1901,7 @@ class Table extends ScopedElement implements IdMethod * @return A CSV list. * @deprecated Use the Platform::getColumnListDDL() method. */ - private function printList($list) + private function printList($list) { $result = ""; $comma = 0;
[Generator] Added missing use statement
propelorm_Propel2
train
php
e3e4cb4c1b27d7efbe51b1acecedf92b26d5558c
diff --git a/Model/ExtendedFieldModel.php b/Model/ExtendedFieldModel.php index <HASH>..<HASH> 100644 --- a/Model/ExtendedFieldModel.php +++ b/Model/ExtendedFieldModel.php @@ -357,9 +357,9 @@ class ExtendedFieldModel extends FieldModel public function deleteEntity($entity) { if ($this->isExtendedField($entity)) { - $secure = 'extendedFieldSecure' === $entity->getType() ? '_secure' : ''; $dataType = $this->getSchemaDefinition($entity->getName(), $entity->getType()); $dataType = $dataType['type']; + $secure = 'extendedFieldSecure' === $entity->getObject() ? '_secure' : ''; $extendedTable = MAUTIC_TABLE_PREFIX.'lead_fields_leads_'.$dataType.$secure.'_xref'; $column = [ 'lead_field_id' => $entity->getId(),
Resolve a bug that prevented the deletion of secure fields.
TheDMSGroup_mautic-extended-field
train
php
0187a440ec223b6a43b4bd372d5e8e6b53c05944
diff --git a/lib/acts_as_having_string_id/railtie.rb b/lib/acts_as_having_string_id/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/acts_as_having_string_id/railtie.rb +++ b/lib/acts_as_having_string_id/railtie.rb @@ -1,13 +1,13 @@ module ActsAsHavingStringId class Railtie < Rails::Railtie initializer "railtie.include_in_application_record" do + ApplicationRecord.include(ActsAsHavingStringId) + if defined?(Spring) Spring.after_fork do # This needs to happen every time Spring reloads ApplicationRecord.include(ActsAsHavingStringId) end - else - ApplicationRecord.include(ActsAsHavingStringId) end end end
Include module direclty even if spring is present
hult_acts_as_having_string_id
train
rb
244c08bb4dc1548a1c3d1330026b3a5c37fa80d6
diff --git a/controller.go b/controller.go index <HASH>..<HASH> 100644 --- a/controller.go +++ b/controller.go @@ -440,11 +440,13 @@ func (c *Controller) getRelatedResources(w http.ResponseWriter, ctx *Context) { }, } - if len(models) > 0 { + // add if model is found + if len(models) > 1 { + stack.Abort(fmt.Errorf("has one relationship returned more than one result")) + } else if len(models) == 1 { newCtx.Response.Data.One = relatedController.resourceForModel(newCtx, models[0]) } - // run notifiers c.runCallbacks(c.Notifiers, newCtx, http.StatusInternalServerError) @@ -932,7 +934,9 @@ func (c *Controller) resourceForModel(ctx *Context, model coal.Model) *jsonapi.R var reference *jsonapi.Resource // set all references - if len(ids) > 0 { + if len(ids) > 1 { + stack.Abort(fmt.Errorf("has one relationship returned more than one result")) + } else if len(ids) == 1 { reference = &jsonapi.Resource{ Type: relatedController.Model.Meta().PluralName, ID: ids[0].Hex(),
return error if relationship is ambiguous
256dpi_fire
train
go
4110e7d1e55471d34de4aa98a2533a9484109e26
diff --git a/src/main/java/com/github/noraui/selenium/NoraUiExpectedConditions.java b/src/main/java/com/github/noraui/selenium/NoraUiExpectedConditions.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/github/noraui/selenium/NoraUiExpectedConditions.java +++ b/src/main/java/com/github/noraui/selenium/NoraUiExpectedConditions.java @@ -84,8 +84,12 @@ public class NoraUiExpectedConditions { */ public static ExpectedCondition<List<WebElement>> presenceOfNbElementsLocatedBy(final By locator, final int nb) { return (WebDriver driver) -> { - final List<WebElement> elements = driver.findElements(locator); - return elements.size() == nb ? elements : null; + try { + final List<WebElement> elements = driver.findElements(locator); + return elements.size() == nb ? elements : null; + } catch (final Exception e) { + return null; + } }; }
add catch on presenceOfNbElementsLocatedBy expected condition
NoraUi_NoraUi
train
java
2edd2486ddf6168de007ebb1725d40c001f8f0fc
diff --git a/amqp_client.js b/amqp_client.js index <HASH>..<HASH> 100644 --- a/amqp_client.js +++ b/amqp_client.js @@ -150,7 +150,8 @@ AMQPClient.prototype.send = function(msg, target, annotations, cb) { target: { address: target } } }, this.policy.senderLinkPolicy); this._session.on(Session.LinkAttached, function (l) { - if (l.name === linkName && l.isSender()) { + if (l.name === linkName) { + debug('Sender link ' + linkName + ' attached'); self._sendLinks[target] = l; if (l.canSend()) { sender(l); @@ -195,6 +196,7 @@ AMQPClient.prototype.receive = function(source, filter, cb) { } }, this.policy.receiverLinkPolicy); this._session.on(Session.LinkAttached, function (l) { if (l.name === linkName) { + debug('Receiver link ' + linkName + ' attached'); self._receiveLinks[source] = l; l.on(Link.MessageReceived, function (m) { var payload = m.body[0];
Add some debugging for when send/receive links are attached. Modify EH example to receive against all partitions (send still commented out, but it works).
noodlefrenzy_node-amqp10
train
js
397171a1ba8ca570cc10c50e5c19d92195eb8910
diff --git a/shutit.py b/shutit.py index <HASH>..<HASH> 100755 --- a/shutit.py +++ b/shutit.py @@ -63,8 +63,8 @@ def main(): """ # Create base shutit object. shutit = shutit_global.shutit_global_object.shutit_objects[0] - if sys.version_info.major == 2: - if sys.version_info.minor < 7: + if sys.version_info[0] == 2: + if sys.version_info[1] < 7: shutit.fail('Python version must be 2.7+') # pragma: no cover shutit.setup_shutit_obj()
Moved from using sys.version_info.major and minor to use [0] and [1]
ianmiell_shutit
train
py
bef382e72f5d08f341e9f3f1fdc134c9d838ac8b
diff --git a/interpreter/main.go b/interpreter/main.go index <HASH>..<HASH> 100644 --- a/interpreter/main.go +++ b/interpreter/main.go @@ -21,6 +21,7 @@ import ( "os" "runtime" "strings" + "time" "github.com/juju/errors" "github.com/ngaut/log" @@ -54,6 +55,7 @@ func saveHistory() { } func executeLine(tx *sql.Tx, txnLine string) error { + start := time.Now() if tidb.IsQuery(txnLine) { rows, err := tx.Query(txnLine) if err != nil { @@ -95,6 +97,17 @@ func executeLine(tx *sql.Tx, txnLine string) error { result, _ := printer.GetPrintResult(cols, datas) fmt.Printf("%s", result) + // report elapsed time and rows in set + elapsed := time.Since(start).Seconds() + switch len(datas) { + case 0: + fmt.Printf("Empty set (%.2f sec)\n", elapsed) + case 1: + fmt.Printf("1 row in set (%.2f sec)\n", elapsed) + default: + fmt.Printf("%v rows in set (%.2f sec)\n", len(datas), elapsed) + } + if err := rows.Err(); err != nil { return errors.Trace(err) }
report time and rows in set for query
pingcap_tidb
train
go
e389f49247093a0e3d35d3e681734e5722149aeb
diff --git a/model/execution/DeliveryExecutionList.php b/model/execution/DeliveryExecutionList.php index <HASH>..<HASH> 100644 --- a/model/execution/DeliveryExecutionList.php +++ b/model/execution/DeliveryExecutionList.php @@ -295,12 +295,10 @@ class DeliveryExecutionList extends ConfigurableService private function getLastActivity(array $cachedData, ?bool $online) { if ($online && isset($cachedData[DeliveryMonitoringService::LAST_TEST_TAKER_ACTIVITY])) { - $lastActivity = $cachedData[DeliveryMonitoringService::LAST_TEST_TAKER_ACTIVITY]; - } else { - $lastActivity = null; + return $cachedData[DeliveryMonitoringService::LAST_TEST_TAKER_ACTIVITY]; } - return $lastActivity; + return null; } /**
refactor getLastActivity
oat-sa_extension-tao-proctoring
train
php
2fe580642e4790e014289333d2b3418e1caef65e
diff --git a/src/a_attributes.js b/src/a_attributes.js index <HASH>..<HASH> 100644 --- a/src/a_attributes.js +++ b/src/a_attributes.js @@ -10,6 +10,8 @@ _gpfErrorDeclare("a_attributes", { OnlyForAttributeClass: "The attribute {attributeName} can be used only on an Attribute class", + OnlyOnClassForAttributeClass: + "The attribute {attributeName} must be used on Class", ClassOnlyAttribute: "The attribute {attributeName} can be used only for Class", MemberOnlyAttribute: @@ -41,6 +43,12 @@ var .name() }); } + if (this._member !== "Class") { + throw gpf.Error.OnlyOnClassForAttributeClass({ + attributeName: _gpfGetClassDefinition(this.constructor) + .name() + }); + } } }
Added control on [Class] for AttributeClass
ArnaudBuchholz_gpf-js
train
js
c1c04c3d659612e62d2f8a1ee1adcc169adfe9ad
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,10 +13,11 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os -import shlex +import sys + import sphinx_rtd_theme +from enumchoicefield.version import version as module_version # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -52,17 +53,12 @@ master_doc = 'index' # General information about the project. project = 'Django EnumChoiceField' -copyright = '2015, Tim Heap' +copyright = '2016, Tim Heap' author = 'Tim Heap' -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '0.1.0' +version = '.'.join(module_version.split('.')[:2]) # The full version, including alpha/beta/rc tags. -release = '0.1.0' +release = module_version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.
Pull version for docs from package
timheap_django-enumchoicefield
train
py
5a9d1aada71fe5b62da002f44cf330388a524857
diff --git a/lib/mongo_mapper/document.rb b/lib/mongo_mapper/document.rb index <HASH>..<HASH> 100644 --- a/lib/mongo_mapper/document.rb +++ b/lib/mongo_mapper/document.rb @@ -90,6 +90,10 @@ module MongoMapper collection.find(FinderOptions.to_mongo_criteria(conditions)).count end + def exist?(conditions={}) + !count(conditions).zero? + end + def create(*docs) instances = [] docs = [{}] if docs.blank? diff --git a/test/functional/test_document.rb b/test/functional/test_document.rb index <HASH>..<HASH> 100644 --- a/test/functional/test_document.rb +++ b/test/functional/test_document.rb @@ -961,4 +961,27 @@ class DocumentTest < Test::Unit::TestCase from_db.updated_at.to_i.should_not == old_updated_at.to_i end end + + context "#exist?" do + setup do + @doc = @document.create(:first_name => "James", :age => 27) + end + + should "be true when at least one document exists" do + @document.exist?.should == true + end + + should "be false when no documents exist" do + @doc.destroy + @document.exist?.should == false + end + + should "be true when at least one document exists that matches the conditions" do + @document.exist?(:first_name => "James").should == true + end + + should "be false when no documents exist with the provided conditions" do + @document.exist?(:first_name => "Jean").should == false + end + end end
Add the ability to check for the existence of a record. A sometimes handy method that only returns a boolean.
mongomapper_mongomapper
train
rb,rb