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
ca7863596bd2b6494c6db0218f51c4de429890e9
diff --git a/lib/credentials.js b/lib/credentials.js index <HASH>..<HASH> 100644 --- a/lib/credentials.js +++ b/lib/credentials.js @@ -81,8 +81,12 @@ Credentials.prototype.upgrade = function (options) { let opsToUpgrade = options.upgrade let stsParams = { DurationSeconds: opsToUpgrade.durationSeconds | 900, // 15 minute default - SerialNumber: opsToUpgrade.serialNumber, - TokenCode: opsToUpgrade.tokenCode + SerialNumber: opsToUpgrade.serialNumber + } + + // allow if no TokenCode (SMS enabled MFA account) + if (opsToUpgrade.tokenCode) { + stsParams.TokenCode = opsToUpgrade.tokenCode } let stsConfigOps = Object.assign({}, options.keys)
Anticipating new SMS MFA will allow omitted TokenCode at first call
glennschler_spotspec
train
js
937c836b32b594404fcdc259dfc06d00d3af2bdb
diff --git a/src/Processor/ExtensionSettingsSerializer.php b/src/Processor/ExtensionSettingsSerializer.php index <HASH>..<HASH> 100644 --- a/src/Processor/ExtensionSettingsSerializer.php +++ b/src/Processor/ExtensionSettingsSerializer.php @@ -36,7 +36,7 @@ class ExtensionSettingsSerializer implements ConfigProcessorInterface public function processConfig(array $config): array { try { - $extensionsSettings = Config::getValue($config, 'EXT.extConf'); + $extensionsSettings = Config::getValue($config, 'EXTENSIONS'); if (!is_array($extensionsSettings)) { return $config; }
Fix ExtensionSettingsSerializer to work with TYPO3 9
helhum_typo3-config-handling
train
php
94564189d405796ba215853ba5c20cc8dce7950a
diff --git a/vrpc/VrpcRemote.js b/vrpc/VrpcRemote.js index <HASH>..<HASH> 100644 --- a/vrpc/VrpcRemote.js +++ b/vrpc/VrpcRemote.js @@ -424,11 +424,27 @@ class VrpcRemote extends EventEmitter { this._domains[domain].agents[agent].hostname = hostname this.emit('agent', { domain, agent, status, hostname }) } else { // ClassInfo message - // Json properties: { class, instances, memberFunctions, staticFunctions } + // Json properties: { className, instances, memberFunctions, staticFunctions } const json = JSON.parse(message.toString()) this._createIfNotExist(domain, agent) this._domains[domain].agents[agent].classes[klass] = json - this.emit('class', { domain, agent, ...json }) + const { + className, + instances, + memberFunctions, + staticFunctions + } = json + this.emit( + 'class', + { + domain, + agent, + className, + instances, + memberFunctions, + staticFunctions + } + ) } } else { // RPC message const { id, data } = JSON.parse(message.toString())
Not using object destructuring to please react
bheisen_vrpc
train
js
ff3b0ee80b414a4bfec257a4b80b0343a05d3a21
diff --git a/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/AspectHandler.java b/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/AspectHandler.java index <HASH>..<HASH> 100644 --- a/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/AspectHandler.java +++ b/vraptor-core/src/main/java/br/com/caelum/vraptor4/interceptor/AspectHandler.java @@ -31,7 +31,7 @@ public class AspectHandler { public void handle(InterceptorStack stack,ControllerMethod controllerMethod,ControllerInstance controllerInstance) { InterceptorStackDecorator interceptorStackDecorator = new InterceptorStackDecorator(stack); - InterceptorContainerDecorator interceptorContainer = new InterceptorContainerDecorator(container,interceptorStackDecorator,controllerMethod,controllerInstance,new DefaultSimplerInterceptorStack(stack, controllerMethod, controllerInstance)); + InterceptorContainerDecorator interceptorContainer = new InterceptorContainerDecorator(container,interceptorStackDecorator,controllerMethod,controllerInstance,new DefaultSimplerInterceptorStack(interceptorStackDecorator, controllerMethod, controllerInstance)); Object returnObject = stepInvoker.tryToInvoke(interceptor,Accepts.class,parametersFor(Accepts.class,interceptor,interceptorContainer)); boolean accepts = true;
passing decorator for the simplerinterceptor
caelum_vraptor4
train
java
6d290ba254d2924d8ceeb2598ff4c4b104c8328a
diff --git a/go/vt/tabletmanager/gorpctmserver/gorpc_server_test.go b/go/vt/tabletmanager/gorpctmserver/gorpc_server_test.go index <HASH>..<HASH> 100644 --- a/go/vt/tabletmanager/gorpctmserver/gorpc_server_test.go +++ b/go/vt/tabletmanager/gorpctmserver/gorpc_server_test.go @@ -18,7 +18,7 @@ import ( // the test here creates a fake server implementation, a fake client // implementation, and runs the test suite against the setup. -func TestGoRpcTMServer(t *testing.T) { +func TestGoRPCTMServer(t *testing.T) { // Listen on a random port listener, err := net.Listen("tcp", ":0") if err != nil { @@ -52,5 +52,5 @@ func TestGoRpcTMServer(t *testing.T) { }, 0) // and run the test suite - agentrpctest.AgentRpcTestSuite(t, client, ti) + agentrpctest.Run(t, client, ti) }
Fix function that was renamed for Golint.
vitessio_vitess
train
go
4054c029752f4da405672675748e6cd7130eec1e
diff --git a/src/main/java/org/zendesk/client/v2/Zendesk.java b/src/main/java/org/zendesk/client/v2/Zendesk.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/zendesk/client/v2/Zendesk.java +++ b/src/main/java/org/zendesk/client/v2/Zendesk.java @@ -1616,6 +1616,12 @@ public class Zendesk implements Closeable { // Action methods for Help Center ////////////////////////////////////////////////////////////////////// + public List<String> getHelpCenterLocales() { + return complete(submit( + req("GET", cnst("/help_center/locales.json")), + handle(List.class, "tags"))); + } + /** * Get all articles from help center. *
Added helper method to view Help Center locales that are enabled
cloudbees_zendesk-java-client
train
java
1f66fd943f738eb1f98c317ec6ac4109c757301f
diff --git a/rollbar/test/test_rollbar.py b/rollbar/test/test_rollbar.py index <HASH>..<HASH> 100644 --- a/rollbar/test/test_rollbar.py +++ b/rollbar/test/test_rollbar.py @@ -396,6 +396,8 @@ class RollbarTest(BaseTest): # Inject annotations and decorate endpoint dynamically # to avoid SyntaxError for older Python # + # This is the code we'd use if we had not loaded the test file on Python 2. + # # @app.get('/{param}') # def root(param, fastapi_request: Request): # current_request = rollbar.get_request() @@ -431,6 +433,8 @@ class RollbarTest(BaseTest): # Inject annotations and decorate endpoint dynamically # to avoid SyntaxError for older Python # + # This is the code we'd use if we had not loaded the test file on Python 2. + # # @app.get('/{param}') # def root(fastapi_request: Request): # current_request = rollbar.get_request() @@ -470,6 +474,8 @@ class RollbarTest(BaseTest): # Inject annotations and decorate endpoint dynamically # to avoid SyntaxError for older Python # + # This is the code we'd use if we had not loaded the test file on Python 2. + # # @app.get('/{param}') # def root(fastapi_request: Request): # current_request = rollbar.get_request()
Add comment to workaround Python2 SyntaxError Commented out code is the proper scenario but cannot be used as the test file is run under Python2
rollbar_pyrollbar
train
py
fa445f31204615b218981f5b4fea46fedf55a46d
diff --git a/flask_oidc/__init__.py b/flask_oidc/__init__.py index <HASH>..<HASH> 100644 --- a/flask_oidc/__init__.py +++ b/flask_oidc/__init__.py @@ -178,9 +178,9 @@ class OpenIDConnect(object): # create signers using the Flask secret key self.extra_data_serializer = JSONWebSignatureSerializer( - app.config['SECRET_KEY']) + app.config['SECRET_KEY'], salt='flask-oidc-extra-data') self.cookie_serializer = TimedJSONWebSignatureSerializer( - app.config['SECRET_KEY']) + app.config['SECRET_KEY'], salt='flask-oidc-cookie') try: self.credentials_store = app.config['OIDC_CREDENTIALS_STORE']
Fixes #<I> -- added salts to the signers
puiterwijk_flask-oidc
train
py
f6f9d6a6354e3a4d0ec78b00a6d3dc653bf4d03a
diff --git a/lib/right_api_client/resource.rb b/lib/right_api_client/resource.rb index <HASH>..<HASH> 100644 --- a/lib/right_api_client/resource.rb +++ b/lib/right_api_client/resource.rb @@ -3,7 +3,7 @@ module RightApi # This class dynamically adds methods and properties to instances depending on what type of resource they are. class Resource include Helper - attr_reader :client, :href + attr_reader :client, :href, :resource_type # Will create a (or an array of) new Resource object(s) # All parameters are treated as read only
acu<I> added missing Resource#resource_type accessor
rightscale_right_api_client
train
rb
750257a4df4766877086433137296e0197545e27
diff --git a/upload/extension/opencart/catalog/controller/payment/bank_transfer.php b/upload/extension/opencart/catalog/controller/payment/bank_transfer.php index <HASH>..<HASH> 100644 --- a/upload/extension/opencart/catalog/controller/payment/bank_transfer.php +++ b/upload/extension/opencart/catalog/controller/payment/bank_transfer.php @@ -23,7 +23,7 @@ class BankTransfer extends \Opencart\System\Engine\Controller { $this->model_checkout_order->addHistory($this->session->data['order_id'], $this->config->get('payment_bank_transfer_order_status_id'), $comment, true); - $json['redirect'] = $this->url->link('checkout/success', 'language=' . $this->config->get('config_language')); + $json['redirect'] = str_replace('&amp;', '&', $this->url->link('checkout/success', 'language=' . $this->config->get('config_language'))); } $this->response->addHeader('Content-Type: application/json');
Added str_replace to JSON redirect
opencart_opencart
train
php
553107a667ed809e1e0026896b8aa3e5f272ab40
diff --git a/logical/framework/backend.go b/logical/framework/backend.go index <HASH>..<HASH> 100644 --- a/logical/framework/backend.go +++ b/logical/framework/backend.go @@ -129,8 +129,11 @@ func (b *Backend) Secret(k string) *Secret { func (b *Backend) init() { b.pathsRe = make([]*regexp.Regexp, len(b.Paths)) for i, p := range b.Paths { + if len(p.Pattern) == 0 { + panic(fmt.Sprintf("Routing pattern cannot be blank")) + } // Automatically anchor the pattern - if len(p.Pattern) > 0 && p.Pattern[0] != '^' { + if p.Pattern[0] != '^' { p.Pattern = "^" + p.Pattern } if p.Pattern[len(p.Pattern)-1] != '$' {
logical/framework: Panic if routing pattern is blank
hashicorp_vault
train
go
0691453bef2e433582b5510b6f498af8155b3b3b
diff --git a/pghoard/transfer.py b/pghoard/transfer.py index <HASH>..<HASH> 100644 --- a/pghoard/transfer.py +++ b/pghoard/transfer.py @@ -251,8 +251,13 @@ class TransferAgent(Thread): self.stats.unexpected_exception(ex, where="handle_upload_unlink") return {"success": True, "opaque": file_to_transfer.get("opaque")} except Exception as ex: # pylint: disable=broad-except - self.log.exception("Problem in moving file: %r, need to retry", file_to_transfer["local_path"]) - self.stats.unexpected_exception(ex, where="handle_upload") + if file_to_transfer.get("retries", 0) > 0: + self.log.exception("Problem in moving file: %r, need to retry", file_to_transfer["local_path"]) + # Ignore the exception the first time round as some object stores have frequent Internal Errors + # and the upload usually goes through without any issues the second time round + self.stats.unexpected_exception(ex, where="handle_upload") + else: + self.log.warning("Problem in moving file: %r need to retry", file_to_transfer["local_path"]) # Sleep for a bit to avoid busy looping time.sleep(0.5)
transfer: Ignore upload errors for statistics purposes on first try Some object storages have frequent internal errors once in a while, no point in logging those because of this ignore upload failures on the first try.
aiven_pghoard
train
py
7cd35f43e9aed65549c44456cd3262fd98fa5e45
diff --git a/reloader/reloader_test.go b/reloader/reloader_test.go index <HASH>..<HASH> 100644 --- a/reloader/reloader_test.go +++ b/reloader/reloader_test.go @@ -41,8 +41,8 @@ func TestNoRead(t *testing.T) { } _, err := New(f.Name(), noop, testErrCb(t)) if err == nil { - t.Fatalf("Expected New to return error when permission denied.") readFile = oldReadFile + t.Fatalf("Expected New to return error when permission denied.") } readFile = oldReadFile }
fix minor unreachable code caused by t.Fatal (#<I>)
letsencrypt_boulder
train
go
3136a9d5a9f6c2ab96f53aa3e82ef0d2dbe6b7d8
diff --git a/docs/client/components/pages/Mention/gettingStarted.js b/docs/client/components/pages/Mention/gettingStarted.js index <HASH>..<HASH> 100644 --- a/docs/client/components/pages/Mention/gettingStarted.js +++ b/docs/client/components/pages/Mention/gettingStarted.js @@ -2,6 +2,7 @@ import Editor from 'draft-js-plugins-editor'; import createMentionPlugin from 'draft-js-mention-plugin'; import React from 'react'; +import { fromJS } from 'immutable'; // Creates an Instance. Passing a list of mentions as argument. const mentions = fromJS([ diff --git a/docs/client/components/pages/Sticker/gettingStarted.js b/docs/client/components/pages/Sticker/gettingStarted.js index <HASH>..<HASH> 100644 --- a/docs/client/components/pages/Sticker/gettingStarted.js +++ b/docs/client/components/pages/Sticker/gettingStarted.js @@ -2,6 +2,7 @@ import Editor from 'draft-js-plugins-editor'; import createStickerPlugin from 'draft-js-sticker-plugin'; import React from 'react'; +import { fromJS } from 'immutable'; // Creates an Instance. Passing a list of stickers as argument. const stickers = fromJS({
docs(Mention, Sticker): adding immutablejs import to getting started files
draft-js-plugins_draft-js-plugins
train
js,js
bc178527bc36b772f0369a3f7628801fa6364f20
diff --git a/lib/discordrb/api.rb b/lib/discordrb/api.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/api.rb +++ b/lib/discordrb/api.rb @@ -71,10 +71,10 @@ module Discordrb::API end response = raw_request(type, attributes) - rescue RestClient::TooManyRequests + rescue RestClient::TooManyRequests => e raise "Got an HTTP 429 for an untracked API call! Please report this bug together with the following information: #{type} #{attributes}" unless key - wait_seconds = response[:retry_after].to_i / 1000.0 + wait_seconds = e.response[:retry_after].to_i / 1000.0 LOGGER.warn("Locking RL mutex (key: #{key}) for #{wait_seconds} seconds due to Discord rate limiting") # Wait the required time synchronized by the mutex (so other incoming requests have to wait) but only do it if @@ -386,7 +386,8 @@ module Discordrb::API rescue RestClient::InternalServerError raise Discordrb::Errors::MessageTooLong, "Message over the character limit (#{message.length} > 2000)" rescue RestClient::BadGateway - raise Discordrb::Errors::CloudflareError, "Discord's Cloudflare system encountered an error! Usually you can ignore this error and retry the request." + LOGGER.warn('Got a 502 while sending a message! Not a big deal, retrying the request') + retry end # Delete a message
Automatically retry a request on <I> instead of raising an error
meew0_discordrb
train
rb
c8bcee48b979d56757b458ef6c84629aa8ba3f3a
diff --git a/src/main/java/org/workdocx/cryptolite/Password.java b/src/main/java/org/workdocx/cryptolite/Password.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/workdocx/cryptolite/Password.java +++ b/src/main/java/org/workdocx/cryptolite/Password.java @@ -10,6 +10,9 @@ import java.util.Arrays; * password hash, prepended with a random salt value. In order to verify a password, the plaintext * password should be passed to {@link #verify(String, String)} along with the stored value * originally produced by {@link #hash(String)}. + * <p> + * This password hashing and verification is done in the same way as Jasypt, but uses + * {@value #ALGORITHM}, rather than MD5. * * @author David Carboni *
Added note about Jasypt inspiration for Password hashing.
davidcarboni_cryptolite-java
train
java
ff8777d9fd6ec7accd410a71db03bf0d7a6e2609
diff --git a/mapping/core/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/TurtleSyntaxParserTest.java b/mapping/core/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/TurtleSyntaxParserTest.java index <HASH>..<HASH> 100644 --- a/mapping/core/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/TurtleSyntaxParserTest.java +++ b/mapping/core/src/test/java/it/unibz/inf/ontop/spec/mapping/parser/TurtleSyntaxParserTest.java @@ -321,6 +321,13 @@ public class TurtleSyntaxParserTest { TestCase.assertTrue(result); } + // Reproduces Issue #319 + @Test + public void test_BNODE_function(){ + final boolean result = parse("<http://esricanada.com/gfx_ontology_prototype/{feature_hash}> a <http://ontology.eil.utoronto.ca/icity/LandUse/Parcel> ; <http://ontology.eil.utoronto.ca/icity/LandUse/hasLandUse> _:landuse{feature_hash} ."); + TestCase.assertTrue(result); + } + private boolean compareCQIE(String input, int countBody) { ImmutableList<TargetAtom> mapping;
Unit test for BNODE parser
ontop_ontop
train
java
db6ae376f888093a961cec1324875c062705d158
diff --git a/worker/uniter/modes.go b/worker/uniter/modes.go index <HASH>..<HASH> 100644 --- a/worker/uniter/modes.go +++ b/worker/uniter/modes.go @@ -188,10 +188,25 @@ func ModeTerminating(u *Uniter) (next Mode, err error) { if err = u.unit.SetStatus(state.UnitStopped, ""); err != nil { return nil, err } - if err = u.unit.EnsureDead(); err != nil { - return nil, err + w := u.unit.Watch() + defer watcher.Stop(w, &u.tomb) + for { + select { + case <-u.tomb.Dying(): + return nil, tomb.ErrDying + case _, ok := <-w.Changes(): + if !ok { + return nil, watcher.MustErr(w) + } + if err := u.unit.EnsureDead(); err == state.ErrHasSubordinates { + continue + } else if err != nil { + return nil, err + } + return nil, worker.ErrDead + } } - return nil, worker.ErrDead + panic("unreachable") } // ModeAbide is the Uniter's usual steady state. It watches for and responds to:
subordinate-handling uniter death sketch
juju_juju
train
go
8d7925bfa6a28f7385680e575500e71cd338bba4
diff --git a/src/main/java/com/ibm/disni/nvmef/spdk/IOCompletion.java b/src/main/java/com/ibm/disni/nvmef/spdk/IOCompletion.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/ibm/disni/nvmef/spdk/IOCompletion.java +++ b/src/main/java/com/ibm/disni/nvmef/spdk/IOCompletion.java @@ -44,6 +44,7 @@ public class IOCompletion { buffer.order(ByteOrder.nativeOrder()); position = buffer.position(); buffer.putInt(INVALID_STATUS_CODE_TYPE); + update(); } private void update() {
nvmef: fix completion done immediately because of missing update
zrlio_disni
train
java
c7b5063616bb33770b8c2da665389a7ef76ab773
diff --git a/lib/generator.js b/lib/generator.js index <HASH>..<HASH> 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -807,7 +807,8 @@ } else if (message.type === "pixmap") { pixmapDeferred.resolve(message.value); } else { - _logger.warn("Unexpected response to getPixmap:", message); + _logger.warn("Unexpected response from Photoshop:", message); + executionDeferred.reject("Unexpected response from Photoshop"); } });
Reject promise returned by getPixmap upon receiving an unexpected response from Photoshop
adobe-photoshop_generator-core
train
js
f583a5b85841e5223ecb1ef1261c37f80d60218c
diff --git a/vyper/parser/events.py b/vyper/parser/events.py index <HASH>..<HASH> 100644 --- a/vyper/parser/events.py +++ b/vyper/parser/events.py @@ -1,5 +1,5 @@ from vyper import ast as vy_ast -from vyper.exceptions import TypeMismatch +from vyper.exceptions import StructureException, TypeMismatch from vyper.parser.expr import Expr from vyper.parser.lll_node import LLLnode from vyper.parser.parser_utils import ( @@ -301,6 +301,11 @@ def pack_logging_data(expected_data, args, context, pos): for i, (arg, data) in enumerate(zip(args, expected_data)): typ = data.typ if isinstance(typ, ByteArrayLike): + if isinstance(arg, vy_ast.Call) and arg.func.get("id") == "empty": + # TODO add support for this + raise StructureException( + "Cannot use `empty` on Bytes or String types within an event log", arg + ) pack_args_by_32( holder=holder, maxlen=maxlen,
fix: explicitly disallow empty on bytes-array types in event logging
ethereum_vyper
train
py
8559dbd0179a0a0a2e03b2ce236d6a9488cbc8ce
diff --git a/src/lib/flatten.js b/src/lib/flatten.js index <HASH>..<HASH> 100644 --- a/src/lib/flatten.js +++ b/src/lib/flatten.js @@ -50,10 +50,10 @@ module.exports = { if (isPlural) { ctxKey = ctxKey.substring(0, pluralIndex); if (ctxKey.indexOf(ctxSeparator) > -1) { - context = ctxKey.substring(ctxKey.lastIndexOf(ctxSeparator) + 1, ctxKey.length); + context = ctxKey.substring(ctxKey.lastIndexOf(ctxSeparator) + ctxSeparator.length, ctxKey.length); } } else if (key.indexOf(ctxSeparator) > -1) { - context = ctxKey.substring(ctxKey.lastIndexOf(ctxSeparator) + 1, ctxKey.length); + context = ctxKey.substring(ctxKey.lastIndexOf(ctxSeparator) + ctxSeparator.length, ctxKey.length); } else { context = ''; }
If the ctxSeparator is a string with more than one char, it didn't work
i18next_i18next-gettext-converter
train
js
a8dc2436d4c73f016cc38f4a71a3cefe18886685
diff --git a/metal/mmtl/aws/grid_search_mmtl.py b/metal/mmtl/aws/grid_search_mmtl.py index <HASH>..<HASH> 100644 --- a/metal/mmtl/aws/grid_search_mmtl.py +++ b/metal/mmtl/aws/grid_search_mmtl.py @@ -54,7 +54,7 @@ def create_command_dict(config_path, launch_args): "rm -rf metal;" "git clone -b mmtl https://github.com/HazyResearch/metal.git;" "cd metal; source add_to_path.sh; pip install -r metal/mmtl/requirements-mmtl.txt;" - "git fetch --all; git checkout e66b239a9414c1adeedf10aa344ce67f061e3111;" + "git fetch --all; git checkout 0b73323252e3d4d0a6fdf0c839c8b524b00e44a9;" "mkdir logs;" " ( screen -dm tensorboard --logdir logs );" )
updated pinned hash for grid_search_mmtl.py
HazyResearch_metal
train
py
1eb3925440d66901621c174ef0bca22ce37cd09e
diff --git a/photutils/segmentation/tests/test_detect.py b/photutils/segmentation/tests/test_detect.py index <HASH>..<HASH> 100644 --- a/photutils/segmentation/tests/test_detect.py +++ b/photutils/segmentation/tests/test_detect.py @@ -135,6 +135,10 @@ class TestDetectSources(object): segm2 = detect_sources(data, 1., 1., mask=mask) assert segm2.areas[1] == segm1.areas[1] - mask.sum() + def test_mask_shape(self): + with pytest.raises(ValueError): + detect_sources(self.data, 1., 1., mask=np.ones((5, 5))) + @pytest.mark.skipif('not HAS_SCIPY') class TestMakeSourceMask(object):
Add another mask test for detect_sources
astropy_photutils
train
py
d98f54593ec19bf1523f36692df45c490a890fd1
diff --git a/examples/v2/order/OrderNotify.php b/examples/v2/order/OrderNotify.php index <HASH>..<HASH> 100644 --- a/examples/v2/order/OrderNotify.php +++ b/examples/v2/order/OrderNotify.php @@ -29,7 +29,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { $order = OpenPayU_Order::retrieve($result->getResponse()->order->orderId); if($order->getStatus() == 'SUCCESS'){ //the response should be status 200 - http_response_code(200); + header("HTTP/1.1 200 OK"); } } } catch (OpenPayU_Exception $e) {
http_response_code(<I>); changed to header in order to be compatible with older PHP versions
PayU_openpayu_php
train
php
1a8d893fb19454e7a1937b6a8408e8d3edec9c6d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,18 @@ from setuptools import setup, Extension +from os.path import dirname, abspath + +DIR = dirname(abspath(__file__)) yahdlc = Extension( 'yahdlc', - sources = ['src/python4yahdlc.c', 'lib/fcs16.c', 'lib/yahdlc.c'], - include_dirs = ['include/'], + sources = [ + DIR + '/src/python4yahdlc.c', + DIR + '/lib/fcs16.c', + DIR + '/lib/yahdlc.c' + ], + include_dirs = [ + DIR + '/include/' + ], ) setup(
fix relative path problem in 'setup.py' file
SkypLabs_python4yahdlc
train
py
6556eba9b75b627a2fef028fc22686172eaddb62
diff --git a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java index <HASH>..<HASH> 100644 --- a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java +++ b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java @@ -979,7 +979,7 @@ public class OConsoleDatabaseApp extends OrientConsole implements OCommandOutput for (String colName : iColumns) { if (col++ > 0) out.printf("|"); - out.printf("%-20s", colName.toUpperCase()); + out.printf("%-20s", colName); } out.printf("\n"); printHeaderLine(iColumns);
Contribution by Luca Molino. Fixed issue <I>
orientechnologies_orientdb
train
java
149095bd812e9dc4fb825990d89cb3824968711c
diff --git a/lib/cloudshaper/provider.rb b/lib/cloudshaper/provider.rb index <HASH>..<HASH> 100644 --- a/lib/cloudshaper/provider.rb +++ b/lib/cloudshaper/provider.rb @@ -6,7 +6,9 @@ module Cloudshaper class Provider < StackElement def load_secrets(name) @secrets ||= {} - @secrets[name.to_sym] = SECRETS[name.to_sym] + if SECRETS.has_key? name.to_sym + @secrets[name.to_sym] = SECRETS[name.to_sym] + end @secrets end end
Prevent a nil error by only adding secrets that exist.
dalehamel_cloudshaper
train
rb
7de0142cce4df603dcc0868002e57f21f3fbdb02
diff --git a/lib/ProMotion/table/table.rb b/lib/ProMotion/table/table.rb index <HASH>..<HASH> 100644 --- a/lib/ProMotion/table/table.rb +++ b/lib/ProMotion/table/table.rb @@ -38,6 +38,11 @@ module ProMotion table_view end + def is_searching? + return true if self.class.respond_to?(:get_searchable) && @promotion_table_data.filtered == true + false + end + def update_table_view_data(data) @promotion_table_data.data = data table_view.reloadData
Allow the parent VC to tell if the current data is being filtered or not.
infinitered_ProMotion
train
rb
875dacc00ad398cde2d600a72487355a255b49b3
diff --git a/packages/schema/src/socket.js b/packages/schema/src/socket.js index <HASH>..<HASH> 100644 --- a/packages/schema/src/socket.js +++ b/packages/schema/src/socket.js @@ -30,7 +30,7 @@ export default { uniqueItems: true, items: { type: 'string', - maxLength: 12 + maxLength: 32 } }, runtime: {
chore(): keywords has <I> chars limit
Syncano_syncano-node
train
js
4578fc4e0b6d6355cdd8accea160f28cc448e2c9
diff --git a/spec/pcore/_pat_arr_spec.rb b/spec/pcore/_pat_arr_spec.rb index <HASH>..<HASH> 100644 --- a/spec/pcore/_pat_arr_spec.rb +++ b/spec/pcore/_pat_arr_spec.rb @@ -149,6 +149,35 @@ describe 'Flor procedures' do }) end + # Commenting that out. + # This should be done using two _pat_arr + # The _pat_or would become too complicated should it have to handle + # that case + # +# it 'accepts a nested _pat_or of guards' do +# +# r = @executor.launch( +# %q{ +# _pat_arr +# a +# _pat_or +# _pat_guard +# b___ (b.0 == 2) +# _pat_guard +# c___ +# d +# }, +# payload: { 'ret' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ] }) +# +# expect(r['point']).to eq('terminated') +# +# expect( +# r['payload']['_pat_binding'] +# ).to eq({ +# 'a' => 0 +# }) +# end + it 'accepts a nested _pat_guard' do r = @executor.launch(
Add commented out spec _pat _arr / _or / _guard _or stand in the way of _arr when selecting what to pass to _guard...
floraison_flor
train
rb
4adc7fd22b6600a75832354fa61b2c3d9629ce70
diff --git a/lib/pgsync/table_sync.rb b/lib/pgsync/table_sync.rb index <HASH>..<HASH> 100644 --- a/lib/pgsync/table_sync.rb +++ b/lib/pgsync/table_sync.rb @@ -129,8 +129,8 @@ module PgSync end end ensure - file.close - file.unlink + file.close + file.unlink end else destination.truncate(table)
Fixed indentation [skip ci]
ankane_pgsync
train
rb
6e793a1d7ca813567c14cb09c5850e3490120d12
diff --git a/devices.js b/devices.js index <HASH>..<HASH> 100644 --- a/devices.js +++ b/devices.js @@ -1977,7 +1977,7 @@ const devices = [ }, }, { - zigbeeModel: ['GL-D-003Z'], + zigbeeModel: ['GL-D-003Z', 'GL-D-005Z'], model: 'GL-D-003Z', vendor: 'Gledopto', description: 'LED RGB + CCT downlight ',
Update devices.js (#<I>)
Koenkk_zigbee-shepherd-converters
train
js
ff13d8d9fd7f902c8451bd4e241ab69169fff4fc
diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -55,6 +55,10 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do Launchd_Overrides = "/var/db/launchd.db/com.apple.launchd/overrides.plist" + # Launchd implemented plist overrides in version 10.6. + # This method checks the major_version of OS X and returns true if + # it is 10.6 or greater. This allows us to implement different plist + # behavior for versions >= 10.6 def has_macosx_plist_overrides? product_version = sw_vers "-productVersion" return true unless /^10\.[0-5]/.match(product_version)
Add comment explaining helper method This commit adds a comment explaining when plist overrides were enabled and why we added the has_macosx_plist_overrides? method.
puppetlabs_puppet
train
rb
059b50f3997ac88cdb9d31ddc9de45f644de5a86
diff --git a/routes/tokens.go b/routes/tokens.go index <HASH>..<HASH> 100644 --- a/routes/tokens.go +++ b/routes/tokens.go @@ -107,6 +107,15 @@ func TokensCreate(w http.ResponseWriter, r *http.Request) { return } + // "registered" accounts can't log in + if user.Status == "registered" { + utils.JSONResponse(w, 403, &TokensCreateResponse{ + Success: false, + Message: "Your account is not confirmed", + }) + return + } + // Verify the password valid, updated, err := user.VerifyPassword(input.Password) if err != nil || !valid {
don't let in users whose status is registered
lavab_api
train
go
7a02c35e8ee2cf8beea80a492d5f867007d7962c
diff --git a/spec/sandbox/sandbox_spec.rb b/spec/sandbox/sandbox_spec.rb index <HASH>..<HASH> 100644 --- a/spec/sandbox/sandbox_spec.rb +++ b/spec/sandbox/sandbox_spec.rb @@ -39,7 +39,7 @@ describe Sandbox, "Shikashi sandbox" do end - module A + module ::A module B module C @@ -51,12 +51,12 @@ describe Sandbox, "Shikashi sandbox" do priv = Privileges.new priv.allow_method :new Sandbox.new.run(" - class TestInsideClass + class ::TestInsideClass def foo end end - TestInsideClass.new.foo + ::TestInsideClass.new.foo ", priv) end
<I> test pass for ruby<I>: fixed constant creation
tario_shikashi
train
rb
6c5fc0322f678821bc7d601a36252966e179a617
diff --git a/test/test-forked-actor.js b/test/test-forked-actor.js index <HASH>..<HASH> 100644 --- a/test/test-forked-actor.js +++ b/test/test-forked-actor.js @@ -281,6 +281,16 @@ describe('ForkedActor', function() { expect(result).to.be.equal('Hello ' + process.pid); })); + + it('should support variable arguments', P.coroutine(function*() { + var child = yield rootActor.createChild({ + hello: (from, to) => `Hello from ${from} to ${to}.` + }, { mode: 'forked' }); + + var result = yield child.sendAndReceive('hello', 'Bob', 'Alice'); + + expect(result).to.be.equal('Hello from Bob to Alice.'); + })); }); describe('createChild()', function() {
(saymon) fix-bulk-operations: Added test that reproduces the issue.
untu_comedy
train
js
32753c3d241c9238b2a34f61fd44399453d7b455
diff --git a/container.go b/container.go index <HASH>..<HASH> 100644 --- a/container.go +++ b/container.go @@ -1365,9 +1365,9 @@ func (container *Container) Unmount() error { mounts = append(mounts, path.Join(root, r)) } - for _, m := range mounts { - if lastError := mount.Unmount(m); lastError != nil { - err = lastError + for i := len(mounts) - 1; i >= 0; i-- { + if lastError := mount.Unmount(mounts[i]); lastError != nil { + err = fmt.Errorf("Failed to umount %v: %v", mounts[i], lastError) } } if err != nil {
Fix for issue #<I> This is a fix for the case that one mount is inside another mount and docker can't then delete the resulting container. Docker-DCO-<I>-
moby_moby
train
go
50b9ac6a6dc1ba61dba8e8f8e82962831ccb3e81
diff --git a/salt/modules/status.py b/salt/modules/status.py index <HASH>..<HASH> 100644 --- a/salt/modules/status.py +++ b/salt/modules/status.py @@ -1127,6 +1127,10 @@ def proxy_reconnect(proxy_name, opts=None): opts: None Opts dictionary. + + CLI Example: + + salt '*' status.proxy_reconnect rest_sample ''' if not opts: diff --git a/tests/integration/modules/sysmod.py b/tests/integration/modules/sysmod.py index <HASH>..<HASH> 100644 --- a/tests/integration/modules/sysmod.py +++ b/tests/integration/modules/sysmod.py @@ -36,6 +36,12 @@ class SysModuleTest(integration.ModuleCase): 'glance.warn_until', 'ipset.long_range', 'libcloud_dns.get_driver', + 'log.critical', + 'log.debug', + 'log.error', + 'log.exception', + 'log.info', + 'log.warning', 'lowpkg.bin_pkg_info', 'lxc.run_cmd', 'nspawn.restart',
Fixup docs that don't have a CLI Example - log functions shouldn't be used at the CLI level: added to allow_failure in test - Added example for status.proxy_reconnect
saltstack_salt
train
py,py
038c6afadf827981e30a8472e5ddd654ccbcab56
diff --git a/src/main/java/org/sakaiproject/nakamura/lite/content/ContentManagerImpl.java b/src/main/java/org/sakaiproject/nakamura/lite/content/ContentManagerImpl.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/sakaiproject/nakamura/lite/content/ContentManagerImpl.java +++ b/src/main/java/org/sakaiproject/nakamura/lite/content/ContentManagerImpl.java @@ -517,6 +517,10 @@ public class ContentManagerImpl extends CachingManager implements ContentManager if (f == null) { throw new StorageClientException(" Source content " + from + " does not exist"); } + if ( f.getProperty(UUID_FIELD) == null ) { + LOGGER.warn("Bad Content item with no ID cant be copied {} ",f); + throw new StorageClientException(" Source content " + from + " Has no "+UUID_FIELD); + } Content t = get(to); if (t != null) { LOGGER.debug("Deleting {} ",to);
Added some protection against copying from invalid content objects, should alow admins to fix the problem or at least know there is one.
ieb_sparsemapcontent
train
java
5e26c382048fd7af30b5caa57f12e7e6d82407ef
diff --git a/src/Command/RoutesCommand.php b/src/Command/RoutesCommand.php index <HASH>..<HASH> 100644 --- a/src/Command/RoutesCommand.php +++ b/src/Command/RoutesCommand.php @@ -43,10 +43,7 @@ class RoutesCommand extends Command $output = []; foreach (Router::routes() as $route) { - $methods = ''; - if (isset($route->defaults['_method']) && is_array($route->defaults['_method'])) { - $methods = implode(', ', $route->defaults['_method']); - } + $methods = $route->defaults['_method'] ?? ''; $item = [ $route->options['_name'] ?? $route->getName(), @@ -55,7 +52,7 @@ class RoutesCommand extends Command $route->defaults['prefix'] ?? '', $route->defaults['controller'] ?? '', $route->defaults['action'] ?? '', - $methods, + is_string($methods) ? $methods : implode(', ', $route->defaults['_method']), ]; if ($args->getOption('verbose')) {
Fix bug, was not showing _method when type string
cakephp_cakephp
train
php
dfaa8f8796e7bed2ec68e96eee318a57846a94e5
diff --git a/sqlparse/sqlparse.go b/sqlparse/sqlparse.go index <HASH>..<HASH> 100644 --- a/sqlparse/sqlparse.go +++ b/sqlparse/sqlparse.go @@ -10,12 +10,16 @@ import ( ) const ( - sqlCmdPrefix = "-- +migrate " + sqlCmdPrefix = "-- +migrate " + optionNoTransaction = "notransaction" ) type ParsedMigration struct { UpStatements []string DownStatements []string + + DisableTransactionUp bool + DisableTransactionDown bool } // Checks the line to see if the line has a statement-ending semicolon @@ -116,10 +120,16 @@ func ParseMigration(r io.ReadSeeker) (*ParsedMigration, error) { switch cmd.Command { case "Up": currentDirection = directionUp + if cmd.HasOption(optionNoTransaction) { + p.DisableTransactionUp = true + } break case "Down": currentDirection = directionDown + if cmd.HasOption(optionNoTransaction) { + p.DisableTransactionDown = true + } break case "StatementBegin":
Add parser support for "notransaction" option
rubenv_sql-migrate
train
go
8bf46d4e32fb7ef44895c451b5cd2548e3badf30
diff --git a/torchvision/transforms/functional_pil.py b/torchvision/transforms/functional_pil.py index <HASH>..<HASH> 100644 --- a/torchvision/transforms/functional_pil.py +++ b/torchvision/transforms/functional_pil.py @@ -119,7 +119,7 @@ def adjust_gamma( input_mode = img.mode img = img.convert("RGB") - gamma_map = [(255 + 1 - 1e-3) * gain * pow(ele / 255.0, gamma) for ele in range(256)] * 3 + gamma_map = [int((255 + 1 - 1e-3) * gain * pow(ele / 255.0, gamma)) for ele in range(256)] * 3 img = img.point(gamma_map) # use PIL's point-function to accelerate this part img = img.convert(input_mode)
Fix functional.adjust_gamma (#<I>)
pytorch_vision
train
py
8b22919c44b8d0461816c204f234a0bbfc525c4d
diff --git a/nephele/nephele-common/src/main/java/eu/stratosphere/nephele/template/AbstractInvokable.java b/nephele/nephele-common/src/main/java/eu/stratosphere/nephele/template/AbstractInvokable.java index <HASH>..<HASH> 100644 --- a/nephele/nephele-common/src/main/java/eu/stratosphere/nephele/template/AbstractInvokable.java +++ b/nephele/nephele-common/src/main/java/eu/stratosphere/nephele/template/AbstractInvokable.java @@ -59,7 +59,8 @@ public abstract class AbstractInvokable { * * @return the environment of this task or <code>null</code> if the environment has not yet been set */ - public final Environment getEnvironment() { + //TODO: This method should be final + public Environment getEnvironment() { return this.environment; }
Removed final modifier for the sake of the PACT tests
apache_flink
train
java
718102572a13d7e70d1f2c0b48b6b60a766b76b2
diff --git a/lib/watcher.js b/lib/watcher.js index <HASH>..<HASH> 100644 --- a/lib/watcher.js +++ b/lib/watcher.js @@ -73,7 +73,7 @@ var getWatchedPatterns = function(patternObjects) { }); }; -exports.watch = function(patterns, excludes, fileList, usePolling) { +exports.watch = function(patterns, excludes, fileList, usePolling, emitter) { var watchedPatterns = getWatchedPatterns(patterns); var options = { usePolling: usePolling, @@ -101,7 +101,13 @@ exports.watch = function(patterns, excludes, fileList, usePolling) { log.debug(e); }); + emitter.on('exit', function(done) { + chokidarWatcher.close(); + done(); + }); + return chokidarWatcher; }; -exports.watch.$inject = ['config.files', 'config.exclude', 'fileList', 'config.usePolling']; +exports.watch.$inject = ['config.files', 'config.exclude', 'fileList', 'config.usePolling', + 'emitter'];
fix(watcher): Close file watchers on exit event
karma-runner_karma
train
js
46a530273e4d321ca1e0accbb3029a40908fb298
diff --git a/libraries/joomla/cache/storage/file.php b/libraries/joomla/cache/storage/file.php index <HASH>..<HASH> 100644 --- a/libraries/joomla/cache/storage/file.php +++ b/libraries/joomla/cache/storage/file.php @@ -197,6 +197,10 @@ class JCacheStorageFile extends JCacheStorage // files older than lifeTime get deleted from cache $files = $this->_filesInFolder($this->_root, '', true, true); foreach($files As $file) { + if('index.html' == JFile::getName($file)) { + // Don't delete index.html files + continue; + } $time = @filemtime($file); if (($time + $this->_lifetime) < $this->_now || empty($time)) { $result |= @unlink($file);
Fixed problem with Purge Expired Cache removing administrator/cache/index.html file Credit: Peter Chovancak, Nikolai Plath <URL>
joomla_joomla-framework
train
php
37641c3932da3f0d4bf6e59ce6087a8cac8b84ec
diff --git a/src/de/invation/code/toval/misc/Allocation.java b/src/de/invation/code/toval/misc/Allocation.java index <HASH>..<HASH> 100755 --- a/src/de/invation/code/toval/misc/Allocation.java +++ b/src/de/invation/code/toval/misc/Allocation.java @@ -11,7 +11,7 @@ import java.util.Set; public class Allocation { private final Map<Object, Set<Object>> exclusions = new HashMap<>(); - private final Map<Object, ArrayList<Object>> mapping = new HashMap<>(); + private final Map<Object, List<Object>> mapping = new HashMap<>(); private final Map<Object, Integer> insertStat = new HashMap<>(); private final Object[] subjects; private final Object[] objects; @@ -42,7 +42,7 @@ public class Allocation { return result; } - public Map<Object, ArrayList<Object>> getMapping(){ + public Map<Object, List<Object>> getMapping(){ mapping.clear(); insertStat.clear(); Object nextObject; @@ -59,7 +59,7 @@ public class Allocation { boolean inserted = false; for(Object nextKey: possibleObjects) if(!inserted) { - ArrayList<Object> valueList = mapping.get(nextKey); + List<Object> valueList = mapping.get(nextKey); if(valueList==null) { valueList = new ArrayList<>(); mapping.put(nextKey, valueList);
Removed unnecessary restriction to ArrayList in return value of method getMapping()
GerdHolz_TOVAL
train
java
35b1fc0194bfd018b3b7ec2371652c08e0c67693
diff --git a/keanu-python/tests/test_random.py b/keanu-python/tests/test_random.py index <HASH>..<HASH> 100644 --- a/keanu-python/tests/test_random.py +++ b/keanu-python/tests/test_random.py @@ -6,9 +6,11 @@ def test_default_keanu_random(): random = keanu_random.next_double() assert type(random) == float + assert 0 <= random < 1 def test_seeded_keanu_random(): keanu_random = kn.KeanuRandom(1) random = keanu_random.next_double() assert type(random) == float + assert random == 0.1129943035738381
Add more assertions to keanu random tests
improbable-research_keanu
train
py
984951a6032897395798cce8371d2d726ea85603
diff --git a/lib/createsend.rb b/lib/createsend.rb index <HASH>..<HASH> 100644 --- a/lib/createsend.rb +++ b/lib/createsend.rb @@ -26,7 +26,8 @@ class CreateSendError < StandardError attr_reader :data def initialize(data) @data = data - extra = self.data.ResultData ? "\nExtra result data: #{self.data.ResultData}" : "" + # @data should contain Code, Message and optionally ResultData + extra = @data.ResultData ? "\nExtra result data: #{@data.ResultData}" : "" super "The CreateSend API responded with the following error - #{@data.Code}: #{@data.Message}#{extra}" end end
Fixed CreateSendError so that extra result data is populated correctly.
campaignmonitor_createsend-ruby
train
rb
b901f04e33575baca3c6c289dbb6c238bc25b0e9
diff --git a/dev/test/cypress/plugins/index.js b/dev/test/cypress/plugins/index.js index <HASH>..<HASH> 100644 --- a/dev/test/cypress/plugins/index.js +++ b/dev/test/cypress/plugins/index.js @@ -180,10 +180,6 @@ module.exports = (on, config) => { } return defaultCustomer; }, - log: logObject => { - console.log('LOG', logObject); - return true; - }, setDefaultCustomerProperty: customerData => { defaultCustomer = Object.assign({}, defaultCustomer, customerData); return defaultCustomer; diff --git a/dev/test/cypress/support/commands.js b/dev/test/cypress/support/commands.js index <HASH>..<HASH> 100644 --- a/dev/test/cypress/support/commands.js +++ b/dev/test/cypress/support/commands.js @@ -43,10 +43,6 @@ Cypress.Commands.add('shouldNotShowErrorMessage', excludeErrorMessage => { } }); -Cypress.Commands.add('clog', logObject => { - cy.task('log', logObject); -}); - Cypress.Commands.add('isSubscribed', (email, doubleOptin) => { const expectedStatus = doubleOptin ? 2 : 1; cy.task('getSubscription', email).then(subscription => {
feat(cypress-tests): remove clog CDPIP-OPS
emartech_magento2-extension
train
js,js
7a77a1ea02bb037bc2134ea8309c298374facb94
diff --git a/lewis/core/simulation.py b/lewis/core/simulation.py index <HASH>..<HASH> 100644 --- a/lewis/core/simulation.py +++ b/lewis/core/simulation.py @@ -223,8 +223,8 @@ class Simulation(object): with self._adapters.device_lock: self._device.process(delta_simulation) - if self._control_server: - self._control_server.process() + if self._control_server: + self._control_server.process() self._cycles += 1 self._runtime += delta_simulation @@ -307,8 +307,9 @@ class Simulation(object): 'The following parameters do not exist in the device or are methods: {}.' 'Parameters not updated.'.format(invalid_parameters)) - for name, value in parameters.items(): - setattr(self._device, name, value) + with self._adapters.device_lock: + for name, value in parameters.items(): + setattr(self._device, name, value) self.log.debug('Updated device parameters: %s', parameters)
Fix problems with ControlServer deadlock
DMSC-Instrument-Data_lewis
train
py
98f3bdd52b6086c4d41c52a5cf0b55736d329c3c
diff --git a/tests/test_pick.py b/tests/test_pick.py index <HASH>..<HASH> 100644 --- a/tests/test_pick.py +++ b/tests/test_pick.py @@ -36,6 +36,17 @@ class TestPick(unittest.TestCase): lines, current_line = picker.get_lines() assert current_line == 1 + def test_multi_select(self): + title = 'Please choose an option: ' + options = ['option1', 'option2', 'option3'] + picker = Picker(options, title, multi_select=True) + assert picker.get_selected() == [] + picker.mark_index() + assert picker.get_selected() == [('option1', 0)] + picker.move_down() + picker.mark_index() + assert picker.get_selected() == [('option1', 0), ('option2', 1)] + if __name__ == '__main__': unittest.main()
* Added unit test for multiselect \n* Example output for multi_select in readme \n* simplifying some code
wong2_pick
train
py
6014fff1d28284d56d768514737885de47cf17a5
diff --git a/webservices/server-integration/src/main/java/org/jboss/as/webservices/util/SubjectUtil.java b/webservices/server-integration/src/main/java/org/jboss/as/webservices/util/SubjectUtil.java index <HASH>..<HASH> 100644 --- a/webservices/server-integration/src/main/java/org/jboss/as/webservices/util/SubjectUtil.java +++ b/webservices/server-integration/src/main/java/org/jboss/as/webservices/util/SubjectUtil.java @@ -142,7 +142,6 @@ public final class SubjectUtil { } } } - identity.withRoleMapper(roleCategory, (rolesToMap) -> Roles.fromSet(roles)); // convert public credentials IdentityCredentials publicCredentials = IdentityCredentials.NONE; for (Object credential : subject.getPublicCredentials()) { @@ -174,6 +173,10 @@ public final class SubjectUtil { } } identity.withPrivateCredentials(privateCredentials); + if (!roles.isEmpty()) { + // identity.withRoleMapper will create NEW identity instance instead of set this roleMapper to identity + return identity.withRoleMapper(roleCategory, (rolesToMap) -> Roles.fromSet(roles)); + } return identity; }
[WFLY-<I>]:Fix roleMapper is lost in SecurityIndentity
wildfly_wildfly
train
java
7b3e48b2572bba9dcc9cfa0b05ebf0d704ada71a
diff --git a/packages/perspective-viewer-d3fc/src/js/tooltip/generateHTML.js b/packages/perspective-viewer-d3fc/src/js/tooltip/generateHTML.js index <HASH>..<HASH> 100644 --- a/packages/perspective-viewer-d3fc/src/js/tooltip/generateHTML.js +++ b/packages/perspective-viewer-d3fc/src/js/tooltip/generateHTML.js @@ -17,7 +17,7 @@ export function generateHtml(tooltipDiv, data, settings) { function getGroupValues(data, settings) { if (settings.crossValues.length === 0) return []; - const groupValues = data.crossValue.split ? data.crossValue.split("|") : [data.crossValue]; + const groupValues = (data.crossValue.split ? data.crossValue.split("|") : [data.crossValue]) || [data.key]; return settings.crossValues.map((cross, i) => ({name: cross.name, value: groupValues[i]})); } @@ -57,4 +57,4 @@ function addDataValues(tooltipDiv, values) { }); } -const formatNumber = value => value.toLocaleString(undefined, {style: "decimal"}); +const formatNumber = value => (typeof value === "number" ? value.toLocaleString(undefined, {style: "decimal"}) : value);
Fixed tooltip for xy with split
finos_perspective
train
js
554fd04147ea41d7b497ccda503ea4c938d27a75
diff --git a/lib/smart_que.rb b/lib/smart_que.rb index <HASH>..<HASH> 100644 --- a/lib/smart_que.rb +++ b/lib/smart_que.rb @@ -16,4 +16,18 @@ module SmartQue yield(config) if block_given? config end + + # Establish bunny connection + def self.establish_connection + return @conn if @conn + + @conn ||= Bunny.new( + host: config.host, + port: config.port, + username: config.username, + password: config.password) + + @conn.start + @conn + end end
Establish bunny connection with credentials.
ashiksp_smart_que
train
rb
27824b367851a1be26d26be7bb30a7891f1e84f3
diff --git a/lib/gemnasium/options.rb b/lib/gemnasium/options.rb index <HASH>..<HASH> 100644 --- a/lib/gemnasium/options.rb +++ b/lib/gemnasium/options.rb @@ -60,7 +60,7 @@ See `gemnasium COMMAND --help` for more information on a specific command. 'push' => OptionParser.new do |opts| opts.banner = 'Usage: gemnasium push' - opts.on '--ignore-branch', 'Ignore untracked branches' do + opts.on '-i', '--ignore-branch', 'Push to gemnasium regardless of branch' do options[:ignore_branch] = true end
Clearer doc for the ignore-branch option
gemnasium_gemnasium-gem
train
rb
8f930a8effbd5644adb2fa6619d86b8bc05420aa
diff --git a/lib/mysql2_model.rb b/lib/mysql2_model.rb index <HASH>..<HASH> 100755 --- a/lib/mysql2_model.rb +++ b/lib/mysql2_model.rb @@ -1,7 +1,5 @@ require 'rubygems' -require 'active_support/core_ext/object/blank' -require 'active_support/core_ext/time' -require 'active_support/core_ext/date_time' +require 'active_support/core_ext' require 'mysql2' require 'forwardable' require 'logging'
fix acts_like? issue when using mysql2_model with newrelic_rpm
donnoman_mysql2_model
train
rb
213c70d12d7344633fa56a6c0ca27abb15d80325
diff --git a/src/containers/typeaheadContainer.js b/src/containers/typeaheadContainer.js index <HASH>..<HASH> 100644 --- a/src/containers/typeaheadContainer.js +++ b/src/containers/typeaheadContainer.js @@ -403,7 +403,19 @@ function typeaheadContainer(Component) { } _handleRootClose = (e) => { - this.state.showMenu && this._hideMenu(); + // Don't register clicks on the menu when it is appended to + // `document.body`. + const isBodyMenuClick = + (this.props.bodyContainer || this.props.positionFixed) && + e.path.some(({className}) => ( + className && className.indexOf('rbt-menu') > -1 + )); + + if (isBodyMenuClick || !this.state.showMenu) { + return; + } + + this._hideMenu(); } _hideMenu = () => {
Fix positionFixed + pagination behavior (#<I>)
ericgio_react-bootstrap-typeahead
train
js
e2ccf88bf81c748aa7770ef826c6122745953e4f
diff --git a/go/vt/orchestrator/logic/tablet_discovery.go b/go/vt/orchestrator/logic/tablet_discovery.go index <HASH>..<HASH> 100644 --- a/go/vt/orchestrator/logic/tablet_discovery.go +++ b/go/vt/orchestrator/logic/tablet_discovery.go @@ -59,7 +59,7 @@ func OpenTabletDiscovery() <-chan time.Time { // RefreshTablets reloads the tablets from topo. func RefreshTablets() { refreshTabletsUsing(func(instanceKey *inst.InstanceKey) { - _, _ = inst.ReadTopologyInstance(instanceKey) + DiscoverInstance(*instanceKey) }) }
orc: ReadTopologyInstance->DiscoverInstance
vitessio_vitess
train
go
faea2af90ac6c3afbd31cd721fa426e118ae15c5
diff --git a/lib/util/Components.js b/lib/util/Components.js index <HASH>..<HASH> 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -319,13 +319,18 @@ function componentRule(rule, context) { * @param {ASTNode} ASTnode The AST node being checked */ findReturnStatement: function(node) { - if (!node.value || !node.value.body || !node.value.body.body) { + if ( + (!node.value || !node.value.body || !node.value.body.body) && + (!node.body || !node.body.body) + ) { return false; } - let i = node.value.body.body.length - 1; + + const bodyNodes = (node.value ? node.value.body.body : node.body.body); + const i = bodyNodes.length - 1; for (; i >= 0; i--) { - if (node.value.body.body[i].type === 'ReturnStatement') { - return node.value.body.body[i]; + if (bodyNodes[i].type === 'ReturnStatement') { + return bodyNodes[i]; } } return false;
Add suport for FunctionDeclaration to findReturnStatement findReturnStatement expect "node.value.body.body" to exist, but for FunctionDeclarations the correct path to the ReturnStatement is "node.body.body"
ytanruengsri_eslint-plugin-react-ssr
train
js
6980373f522668029bf54a2a4d337520259bc149
diff --git a/windows/lib/WixSDK.js b/windows/lib/WixSDK.js index <HASH>..<HASH> 100644 --- a/windows/lib/WixSDK.js +++ b/windows/lib/WixSDK.js @@ -174,6 +174,9 @@ function(app_path, xwalk_path, meta_data, callback) { AddFileComponent(app_root_folder, xwalk_path, 'icudtl.dat'); AddFileComponent(app_root_folder, xwalk_path, 'natives_blob.bin'); AddFileComponent(app_root_folder, xwalk_path, 'snapshot_blob.bin'); + AddFileComponent(app_root_folder, xwalk_path, 'libEGL.dll'); + AddFileComponent(app_root_folder, xwalk_path, 'libGLESv2.dll'); + AddFileComponent(app_root_folder, xwalk_path, 'osmesa.dll'); var subfolder_map = {};
Make sure to pack OpenGL dll files with the application. Starting with build <I> we're shipping few extra DLLs which are needed for WebGL support. This patch make sure we pack them in the final .msi. BUG=XWALK-<I>, XWALK-<I>
crosswalk-project_crosswalk-app-tools
train
js
0c25a6d3a572dce144aa79aefa8d6115060c7ece
diff --git a/pyOCD/target/target_MKL28Z512xxx7.py b/pyOCD/target/target_MKL28Z512xxx7.py index <HASH>..<HASH> 100644 --- a/pyOCD/target/target_MKL28Z512xxx7.py +++ b/pyOCD/target/target_MKL28Z512xxx7.py @@ -182,8 +182,9 @@ class KL28x(Kinetis): logging.debug("KEYATTR=0x%x SDID=0x%08x", keyattr, sdid) self.is_dual_core = (keyattr == KEYATTR_DUAL_CORE) if self.is_dual_core: - self.memory_map = self.dualMap logging.info("KL28 is dual core") + self.memory_map = self.dualMap + self.cores[0].memory_map = self.dualMap # Add second core's AHB-AP. core1_ap = ap.AHB_AP(self.dp, 2)
KL<I>x target resets the core0 memory map for dual core devices.
mbedmicro_pyOCD
train
py
364ca95d3f74e9cd42799a71920b2e65252b7b5a
diff --git a/src/features/reference-line.js b/src/features/reference-line.js index <HASH>..<HASH> 100644 --- a/src/features/reference-line.js +++ b/src/features/reference-line.js @@ -11,19 +11,19 @@ return { accessors: { x1: function() { - return this.x(0); + return this.x(this.x.domain()[0]); }, x2: function() { - return this.x(this.width); + return this.x(this.x.domain()[1]); }, y1: function() { - return this.y(0); + return this.y(this.y.domain()[1]); }, y2: function() { - return this.y(this.height); + return this.y(this.y.domain()[0]); }, classes: function() { return 'line';
Correctly draw the default position of the reference-line (which should be a diagonal line across the entire chart).
heavysixer_d4
train
js
4ac06a342b48e25cf79773a7d9d1cf57f0f6c564
diff --git a/plugin/proxy/dns.go b/plugin/proxy/dns.go index <HASH>..<HASH> 100644 --- a/plugin/proxy/dns.go +++ b/plugin/proxy/dns.go @@ -89,15 +89,12 @@ func exchange(m *dns.Msg, co net.Conn) (*dns.Msg, error) { writeDeadline := time.Now().Add(defaultTimeout) dnsco.SetWriteDeadline(writeDeadline) - dnsco.WriteMsg(m) + if err := dnsco.WriteMsg(m); err != nil { + log.Debugf("Failed to send message: %v", err) + return nil, err + } readDeadline := time.Now().Add(defaultTimeout) co.SetReadDeadline(readDeadline) - r, err := dnsco.ReadMsg() - - dnsco.Close() - if r == nil { - return nil, err - } - return r, err + return dnsco.ReadMsg() }
[plugin/proxy]: Return on WriteMsg err. (#<I>) * [plugin/proxy]: Return on WriteMsg err. Followup PR on the heels of #<I>. Short-circut and log on error from `WriteMsg`. This will prevent code getting stuck on `ReadMsg` and allow for easier debugging. Also simply the `ReadMsg` calling code a little - remove double `Close` (already called above).
coredns_coredns
train
go
363360571d0d60a936bbd56a6802caec48195fe3
diff --git a/lib/active_scaffold/helpers/pagination_helpers.rb b/lib/active_scaffold/helpers/pagination_helpers.rb index <HASH>..<HASH> 100644 --- a/lib/active_scaffold/helpers/pagination_helpers.rb +++ b/lib/active_scaffold/helpers/pagination_helpers.rb @@ -42,7 +42,7 @@ module ActiveScaffold start_number.upto(end_number) do |num| if current_page.number == num - html << num + html << content_tag(:span, num) else html << pagination_ajax_link(num, params) end diff --git a/test/helpers/pagination_helpers_test.rb b/test/helpers/pagination_helpers_test.rb index <HASH>..<HASH> 100644 --- a/test/helpers/pagination_helpers_test.rb +++ b/test/helpers/pagination_helpers_test.rb @@ -52,4 +52,8 @@ class PaginationHelpersTest < Test::Unit::TestCase current_page = stub(:number => current, :pager => paginator) pagination_ajax_links(current_page, {}, window_size) end + + def content_tag(tag, text) + text + end end
Set current page inside a span tag so it's possible to style it
activescaffold_active_scaffold
train
rb,rb
fc35839c793dfe2e3294c0f526dcc4cb5741533b
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index <HASH>..<HASH> 100644 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -382,6 +382,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> { Argument arg = (Argument) param.get(); bfd.rawName = arg.name; bfd.name = arg.name; + bfd.annotations = arg.annotations; bfd.type = arg.type; bfd.singularData = getSingularData(param, ast); bfd.originalFieldNode = param;
Copy annotations in Eclipse HandleBuilder.
rzwitserloot_lombok
train
java
15f6d0eebd1bb1111a38bffe70a0d03237984cbf
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -21,16 +21,19 @@ while (!TZDIR && possibleTzdirs.length > 0) { TZDIR = d; } catch(e) {} } +possibleTzdirs = null; if (!TZDIR) throw new Error("FATAL: Couldn't determine the location of your timezone directory!"); // Older versions of node-time would require the user to have the TZ // environment variable set, otherwise undesirable results would happen. Now // node-time tries to automatically determine the current timezone for you. if (!process.env.TZ) { - var currentTimezonePath = require('fs').readlinkSync('/etc/localtime'); - if (currentTimezonePath.substring(0, TZDIR.length) === TZDIR) - // Got It! - process.env.TZ = currentTimezonePath.substring(TZDIR.length + 1); + try { + var currentTimezonePath = require('fs').readlinkSync('/etc/localtime'); + if (currentTimezonePath.substring(0, TZDIR.length) === TZDIR) + // Got It! + process.env.TZ = currentTimezonePath.substring(TZDIR.length + 1); + } catch(e) {} } var MILLIS_PER_SECOND = 1000;
Cleanup and do the TZ stuff in a try/catch.
TooTallNate_node-time
train
js
6ba7a89283886f23f56e0397e01a3ba4568efa4f
diff --git a/src/main/java/mobi/designmyapp/common/instance/provider/InstanceProvider.java b/src/main/java/mobi/designmyapp/common/instance/provider/InstanceProvider.java index <HASH>..<HASH> 100644 --- a/src/main/java/mobi/designmyapp/common/instance/provider/InstanceProvider.java +++ b/src/main/java/mobi/designmyapp/common/instance/provider/InstanceProvider.java @@ -26,6 +26,7 @@ public abstract class InstanceProvider implements Comparable<InstanceProvider> { protected List<Instance> instances; protected Integer poolSize; + protected Integer ttl; protected Integer priority; /** @@ -98,6 +99,14 @@ public abstract class InstanceProvider implements Comparable<InstanceProvider> { public abstract int getActiveCount(); /** + * Return the provider-level time-to-live for default instances + * @return + */ + public Integer getTtl() { + return ttl; + } + + /** * Default implementation of compareTo for the InstanceManager. * @param instanceProvider * @return
Implemented InstanceProvider level TTL
e-biz_designmyapp-common-api
train
java
93d967c901e27c63aa17fccd3d056ead98ecb168
diff --git a/isvcs/isvc.go b/isvcs/isvc.go index <HASH>..<HASH> 100644 --- a/isvcs/isvc.go +++ b/isvcs/isvc.go @@ -29,9 +29,9 @@ var ( const ( IMAGE_REPO = "zenoss/serviced-isvcs" - IMAGE_TAG = "v45" + IMAGE_TAG = "v46" ZK_IMAGE_REPO = "zenoss/isvcs-zookeeper" - ZK_IMAGE_TAG = "v6" + ZK_IMAGE_TAG = "v7" ) func Init(esStartupTimeoutInSeconds int, dockerLogDriver string, dockerLogConfig map[string]string, dockerAPI docker.Docker) {
Use isvcs images containing Java 8 versions of query and consumer
control-center_serviced
train
go
c729d72fc6d31af4d6a2567cc705c78d42bdb54e
diff --git a/examples/training/train_new_entity_type.py b/examples/training/train_new_entity_type.py index <HASH>..<HASH> 100644 --- a/examples/training/train_new_entity_type.py +++ b/examples/training/train_new_entity_type.py @@ -29,8 +29,8 @@ def train_ner(nlp, train_data, output_dir): doc = nlp.make_doc(raw_text) nlp.tagger(doc) loss = nlp.entity.update(doc, gold) + nlp.end_training() nlp.save_to_directory(output_dir) - #nlp.end_training(output_dir) def main(model_name, output_directory=None):
Add new example for training new entity types
explosion_spaCy
train
py
3fa0e226060e6973a87856ee744a82a0819af255
diff --git a/lib/rapgenius/scraper.rb b/lib/rapgenius/scraper.rb index <HASH>..<HASH> 100644 --- a/lib/rapgenius/scraper.rb +++ b/lib/rapgenius/scraper.rb @@ -9,8 +9,8 @@ module RapGenius def url=(url) - if !(url =~ /^https?:\/\//) - @url = "#{BASE_URL}#{url}" + unless url =~ /^https?:\/\// + @url = BASE_URL + url else @url = url end
Refactor Scraper#url= a bit
timrogers_rapgenius
train
rb
443af589952f88a72074e3256688a23ef901ae89
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index <HASH>..<HASH> 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -64,6 +64,6 @@ module <%= app_const_base %> <% end -%> # Enable the asset pipeline - config.assets.enable = true + config.assets.enabled = true end end
Its assets.enabled, not assets.enable
rails_rails
train
rb
d89ac6a2c7fa85f018cdf47570ccd408fc1fd393
diff --git a/lib/childprocess/jruby/process.rb b/lib/childprocess/jruby/process.rb index <HASH>..<HASH> 100755 --- a/lib/childprocess/jruby/process.rb +++ b/lib/childprocess/jruby/process.rb @@ -80,8 +80,8 @@ module ChildProcess def setup_io if @io - @pumps << redirect(@process.getErrorStream, @io.stderr) - @pumps << redirect(@process.getInputStream, @io.stdout) + redirect(@process.getErrorStream, @io.stderr) + redirect(@process.getInputStream, @io.stdout) else @process.getErrorStream.close @process.getInputStream.close @@ -103,7 +103,7 @@ module ChildProcess return end - Pump.new(input, output.to_outputstream).run + @pumps << Pump.new(input, output.to_outputstream).run end def stop_pumps
Fix #stop on JRuby when only one IO stream is redirected.
enkessler_childprocess
train
rb
2b9ab5f118af81ba7586ec256e944c09d3f0919f
diff --git a/rows.go b/rows.go index <HASH>..<HASH> 100644 --- a/rows.go +++ b/rows.go @@ -14,15 +14,15 @@ import ( ) type mysqlField struct { - name string fieldType byte flags fieldFlag + name string } type mysqlRows struct { mc *mysqlConn - binary bool columns []mysqlField + binary bool eof bool }
rows: reorder struct fields
go-sql-driver_mysql
train
go
0724e2dad7fe93a9756d0b0f4f5c1b6e8f9485e8
diff --git a/bind.go b/bind.go index <HASH>..<HASH> 100644 --- a/bind.go +++ b/bind.go @@ -29,7 +29,7 @@ func BindType(driverName string) int { return QUESTION case "sqlite3": return QUESTION - case "oci8", "ora", "goracle": + case "oci8", "ora", "goracle", "godror": return NAMED case "sqlserver": return AT
Added support for Godror's oracle driver
jmoiron_sqlx
train
go
bc139a202c2738caef110132a98e3fb8f7cdb1e5
diff --git a/manifest.go b/manifest.go index <HASH>..<HASH> 100644 --- a/manifest.go +++ b/manifest.go @@ -39,7 +39,7 @@ type RootManifest interface { // them can harm the ecosystem as a whole. Overrides() ProjectConstraints - // IngoredPackages returns a set of import paths to ignore. These import + // IgnoredPackages returns a set of import paths to ignore. These import // paths can be within the root project, or part of other projects. Ignoring // a package means that both it and its (unique) imports will be disregarded // by all relevant solver operations.
Fix typo in manifest.go docstring :)
sdboyer_gps
train
go
87914881cc76c8d0ab729e732294448931816957
diff --git a/tangelo/plugins/vtkweb/web/vtkweb.py b/tangelo/plugins/vtkweb/web/vtkweb.py index <HASH>..<HASH> 100644 --- a/tangelo/plugins/vtkweb/web/vtkweb.py +++ b/tangelo/plugins/vtkweb/web/vtkweb.py @@ -2,6 +2,8 @@ import cherrypy import os import tangelo import tangelo.util +from tangelo.server import analyze_url +from tangelo.server import Content import autobahn.websocket as ab_websocket import autobahn.wamp as wamp import twisted.internet.reactor @@ -108,12 +110,12 @@ def post(*pargs, **query): program_url = "/" + "/".join(pargs) - directive = tangelo.tool.analyze_url(program_url) - if directive["target"].get("type") != "restricted": + content = analyze_url(program_url).content + if content is None or content.type != Content.File: tangelo.http_status(404, "Not Found") return {"error": "Could not find a script at %s" % (program_url)} - program = directive["target"]["path"] + program = content.path # Check the user arguments. userargs = args.split()
Fixing usage of analyze_url() in vtkweb service
Kitware_tangelo
train
py
c4c37cca027f3ca86c80cd0d4462a244cf9beaac
diff --git a/lib/pdf_forms/pdftk_wrapper.rb b/lib/pdf_forms/pdftk_wrapper.rb index <HASH>..<HASH> 100644 --- a/lib/pdf_forms/pdftk_wrapper.rb +++ b/lib/pdf_forms/pdftk_wrapper.rb @@ -23,6 +23,9 @@ module PdfForms # # The pdftk binary may also be explecitly specified: # PdftkWrapper.new('/usr/bin/pdftk', :flatten => true, :encrypt => true, :encrypt_options => 'allow Printing') + # + # Besides the options shown above, the drop_xfa or drop_xmp options are + # also supported. def initialize(*args) pdftk, options = normalize_args *args @pdftk = Cliver.detect! pdftk @@ -136,8 +139,10 @@ module PdfForms def append_options(args, local_options = {}) return args if options.empty? && local_options.empty? args = args.dup - if option_or_global(:flatten, local_options) - args << 'flatten' + %i(flatten drop_xfa drop_xmp).each do |option| + if option_or_global(option, local_options) + args << option.to_s + end end if option_or_global(:encrypt, local_options) encrypt_pass = option_or_global(:encrypt_password, local_options)
adds support for drop_xfa and drop_xmp options. fixes #<I>
jkraemer_pdf-forms
train
rb
adbe23aa1ea8f2da3878a37d369609ea19c40cd3
diff --git a/mod/jodd/src/jodd/servlet/tag/IteratorStatus.java b/mod/jodd/src/jodd/servlet/tag/IteratorStatus.java index <HASH>..<HASH> 100644 --- a/mod/jodd/src/jodd/servlet/tag/IteratorStatus.java +++ b/mod/jodd/src/jodd/servlet/tag/IteratorStatus.java @@ -3,6 +3,7 @@ package jodd.servlet.tag; /** + * Status of iteration of some looping tag. * The {@link LoopTag iterator tag} can export an IteratorStatus object so that * one can get information about the status of the iteration, such as: * <ul>
javadoc 1st line.
oblac_jodd
train
java
7b13cf2ed8be5bddca892a4e29ced80db11be27d
diff --git a/lib/searchkick/index.rb b/lib/searchkick/index.rb index <HASH>..<HASH> 100644 --- a/lib/searchkick/index.rb +++ b/lib/searchkick/index.rb @@ -7,6 +7,7 @@ module Searchkick def initialize(name, options = {}) @name = name @options = options + @klass_document_type = {} # cache end def create(body = {}) @@ -270,10 +271,12 @@ module Searchkick end def klass_document_type(klass) - if klass.respond_to?(:document_type) - klass.document_type - else - klass.model_name.to_s.underscore + @klass_document_type[klass] ||= begin + if klass.respond_to?(:document_type) + klass.document_type + else + klass.model_name.to_s.underscore + end end end
Prevent extra string allocations to speed up indexing - #<I>
ankane_searchkick
train
rb
cea7989276ce55a461aeb276715eb7738958ed6c
diff --git a/lib/udongo/search/frontend.rb b/lib/udongo/search/frontend.rb index <HASH>..<HASH> 100644 --- a/lib/udongo/search/frontend.rb +++ b/lib/udongo/search/frontend.rb @@ -16,7 +16,9 @@ module Udongo::Search # If you return nil in the #url method of a result object, the item # will get filtered out of the search results. def search - ::SearchTerm.create!(locale: controller.locale, term: term.value) if term + return [] unless term.valid? + + ::SearchTerm.create!(locale: controller.locale, term: term.value) indices.map do |index| result = result_object(index)
always return an empty result set for Udongo::Search::Frontend#search when the given search term is invalid
udongo_udongo
train
rb
368208d328b00e53a4b80aac0c6ccf61f4ab9380
diff --git a/source/tools/debug.js b/source/tools/debug.js index <HASH>..<HASH> 100644 --- a/source/tools/debug.js +++ b/source/tools/debug.js @@ -1,3 +1,5 @@ +"use strict"; + const debug = require("debug"); module.exports = function __createDebug(name) {
Add "use strict" for debug
buttercup_buttercup-core
train
js
e7cb90b5d88ad94dcc72df251b3d1ef40991db4c
diff --git a/lib/summary.js b/lib/summary.js index <HASH>..<HASH> 100644 --- a/lib/summary.js +++ b/lib/summary.js @@ -1,11 +1,12 @@ var _ = require('lodash'), SerialiseError = require('serialised-error'), + RunSummary; /** * @constructor * @param {EventEmitter} emitter - * + * @param {Object} options * @note * The summary object looks somewhat like the following: * ( @@ -19,7 +20,7 @@ var _ = require('lodash'), * failures: [{ source: 'DigestAuth Request', error: [Object] }] * } */ -RunSummary = function RunSummary (emitter) { +RunSummary = function RunSummary (emitter, options) { // keep a copy of this instance since, we need to refer to this from various events var summary = this, // execute `trackEvent` function to attach listeners and update the pass, fail and pending count of each event @@ -31,7 +32,9 @@ RunSummary = function RunSummary (emitter) { // store the trackers and failures in the summary object itself _.assign(summary, trackers.counters, { - failures: failures + failures: failures, + collectionId: options.collection.id, + collectionName: options.collection.name }); // mark the point when the run started
Shifted collection name and id to RunSummary constructor
postmanlabs_newman
train
js
be5ed9eec83eade32b3b326f54e2e36db51969fc
diff --git a/lib/main.js b/lib/main.js index <HASH>..<HASH> 100644 --- a/lib/main.js +++ b/lib/main.js @@ -201,10 +201,8 @@ class AtomMocha{ if( args.headless && data.headless) grabOptions(data.headless); } } - catch(e){ - console.error(e); - break; - } + catch(e){ console.error(e) } + break; } basePath = path.dirname(basePath); }
Fix package.json search not stopping after result
Alhadis_Atom-Mocha
train
js
2f33d57db1e72d03929b76b9481ddf31aed3d762
diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index <HASH>..<HASH> 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -2828,7 +2828,10 @@ func (b *PlanBuilder) buildSelect(ctx context.Context, sel *ast.SelectStmt) (p L } hasWindowFuncField := b.detectSelectWindow(sel) - if hasWindowFuncField { + // Some SQL statements define WINDOW but do not use them. But we also need to check the window specification list. + // For example: select id from t group by id WINDOW w AS (ORDER BY uids DESC) ORDER BY id; + // We don't use the WINDOW w, but if the 'uids' column is not in the table t, we still need to report an error. + if hasWindowFuncField || sel.WindowSpecs != nil { windowAggMap, err = b.resolveWindowFunction(sel, p) if err != nil { return nil, err
planner: detect unknown column in window clause (#<I>)
pingcap_tidb
train
go
741f6e09de72b8b4cc733a7a30210e2bc0acab4e
diff --git a/pub/pub.py b/pub/pub.py index <HASH>..<HASH> 100644 --- a/pub/pub.py +++ b/pub/pub.py @@ -64,15 +64,24 @@ def get_tasks(do_tasks, dep_graph): def needed(f1, f2): return not isfile(f2) or newer(f1, f2) +#return a function which closes over a filelist and a function to construct the +#name of a new file, which: +# returns a function which closes over the function used to generate a new file, +# which: +# returns an argument-less function that actually applies the file rule def file_rule(filelist, name_func): - def _(build_file): - for fname in glob(filelist): - if needed(fname, name_func(fname)): - build_file(fname) - - return build_file - - return _ + def f(build_file): + def g(): + for fname in glob(filelist): + if needed(fname, name_func(fname)): + build_file(fname) + + g.__pub_task__ = True + g.__pub_dependencies__ = () + g.__pub_options__ = {"private": True} + + return g + return f #XXX accept kwargs and add private kwarg def task(*args, **kwargs):
a file_rule that actually works
llimllib_pub
train
py
ddf762d6c2ed65451db7a8df08225266b2355f81
diff --git a/bayes_opt/bayesian_optimization.py b/bayes_opt/bayesian_optimization.py index <HASH>..<HASH> 100644 --- a/bayes_opt/bayesian_optimization.py +++ b/bayes_opt/bayesian_optimization.py @@ -319,8 +319,8 @@ class BayesianOptimization(object): """ points = np.hstack((self.space.X, np.expand_dims(self.space.Y, axis=1))) - header = ', '.join(self.space.keys + ['target']) - np.savetxt(file_name, points, header=header, delimiter=',') + header = ','.join(self.space.keys + ['target']) + np.savetxt(file_name, points, header=header, delimiter=',', comments='') # --- API compatibility ---
Fix csv issue in the points_to_csv method
fmfn_BayesianOptimization
train
py
b1fb8e74df8a44953a3bb846918f15177f244527
diff --git a/src/tools/annotation/EllipticalRoiTool.js b/src/tools/annotation/EllipticalRoiTool.js index <HASH>..<HASH> 100644 --- a/src/tools/annotation/EllipticalRoiTool.js +++ b/src/tools/annotation/EllipticalRoiTool.js @@ -455,7 +455,7 @@ function _calculateStats(image, element, handles, modality, pixelSpacing) { ellipseCoordinates.height ); - // Calculate the mean & standard deviation from the pixels and the ellipse details + // Calculate the mean & standard deviation from the pixels and the ellipse details. const ellipseMeanStdDev = calculateEllipseStatistics( pixels, ellipseCoordinates
fix(EllipticalRoiTool RectangleRoiTool): Correctly rotate ellipse/rect on free rotate. The rectanglur and elliptical ROI tools now correctly rotate with the image. #<I>
cornerstonejs_cornerstoneTools
train
js
f10e350595e2099c302651aa6f9f5d77b23041e5
diff --git a/test/engine.tests.js b/test/engine.tests.js index <HASH>..<HASH> 100644 --- a/test/engine.tests.js +++ b/test/engine.tests.js @@ -213,6 +213,20 @@ module.exports = function(idProperty, getEngine, beforeCallback, afterCallback) }) }) + it('should error if there an id property that is null/undefined', function(done) { + getEngine(function(error, engine) { + engine.update({ _id: null, a: 1 }, function(error) { + error.message.should.eql('Object has no \'' + idProperty + '\' property') + getEngine(function(error, engine) { + engine.update({ _id: undefined, a: 1 }, function(error) { + error.message.should.eql('Object has no \'' + idProperty + '\' property') + done() + }) + }) + }) + }) + }) + it('should error if there are no objects in the store with given id', function(done) { getEngine(function(error, engine) { var object = { a: 1 }
Add test for present, but invalid _id property
serby_save
train
js
35636637f9267d909c5bef8f09d5e7508e3d8d03
diff --git a/sevenbridges/models/file.py b/sevenbridges/models/file.py index <HASH>..<HASH> 100644 --- a/sevenbridges/models/file.py +++ b/sevenbridges/models/file.py @@ -71,9 +71,7 @@ class File(Resource): tags = BasicListField() def __str__(self): - return six.text_type( - '<File: id={id} type="{type}"'.format(id=self.id, type=self.type) - ) + return six.text_type('<File: id={id}>'.format(id=self.id)) def __eq__(self, other): if not hasattr(other, '__class__'): @@ -86,7 +84,7 @@ class File(Resource): return not self.__eq__(other) def is_folder(self): - return self.type == self.FOLDER_TYPE + return self.type.lower() == self.FOLDER_TYPE @classmethod def query(cls, project=None, names=None, metadata=None, origin=None,
Use only id in file string representation
sbg_sevenbridges-python
train
py
64d87532667cee35438a1e13fdccaed4da3724fa
diff --git a/js/track-adder.js b/js/track-adder.js index <HASH>..<HASH> 100644 --- a/js/track-adder.js +++ b/js/track-adder.js @@ -520,7 +520,7 @@ Browser.prototype.showTrackAdder = function(ev) { mbody.appendChild(row); } matrix.appendChild(mbody); - ttab.appendChild(makeTreeTableSection(group.shortLabel, matrix, gi==0)); + ttab.appendChild(makeTreeTableSection(group.shortLabel, matrix, thisB.noDefaultHubGroupShow ? false : gi==0 )); } else { var stabBody = makeElement('tbody', null, {className: 'table table-striped table-condensed'}); var stab = makeElement('table', stabBody, {className: 'table table-striped table-condensed'}, {width: '100%', tableLayout: 'fixed'});
Add option to not show a custom hub group by default Currently custom hubs always show the first group -- as in have it visible and open. This change adds noDefaultHubGroupShow as a browser option (default behaviour is the old behaviour) that allows the caller to always have the hub groups collapsed.
dasmoth_dalliance
train
js
3a4f62031829afc3fdc82dd00d4e39be17ca703d
diff --git a/src/virtual-machine.js b/src/virtual-machine.js index <HASH>..<HASH> 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -182,8 +182,13 @@ class VirtualMachine extends EventEmitter { * @return {!Promise} Promise that resolves after targets are installed. */ loadProject (input) { - if (typeof input === 'object' && !(input instanceof ArrayBuffer)) { + if (typeof input === 'object' && !ArrayBuffer.isView(input)) { + // If the input is an object and not any ArrayBuffer view + // (this includes all typed arrays and DataViews) + // turn the object into a JSON string, because we suspect + // this is a project.json as an object // validate expects a string or buffer as input + // TODO not sure if we need to check that it also isn't a data view input = JSON.stringify(input); }
Check if loadProject input is any typed array using ArrayBuffer.isView. This allows us to pass a project's asset.data (from storage) directly instead of calling toString on it first.
LLK_scratch-vm
train
js
c71f82a1fbf6a1ff5aa0a062d5e9dab06f260bee
diff --git a/test/Image2.rb b/test/Image2.rb index <HASH>..<HASH> 100644 --- a/test/Image2.rb +++ b/test/Image2.rb @@ -143,14 +143,14 @@ class Image2_UT < Test::Unit::TestCase assert_equal(@img.rows, changed.rows) assert_not_same(changed, @img) end - + def test_crop_resized_1 @img = Magick::Image.new(200, 250) @img.crop_resized!(100,100) assert_equal(100, @img.columns) assert_equal(100, @img.rows) end - + def test_crop_resized_2 @img = Magick::Image.new(200, 250) changed = @img.crop_resized(300,100) @@ -751,7 +751,13 @@ class Image2_UT < Test::Unit::TestCase assert_nothing_raised do res = @img.ordered_dither assert_instance_of(Magick::Image, res) + assert_not_same(@img. res) end + assert_nothing_raised { @img.ordered_dither(2) } + assert_nothing_raised { @img.ordered_dither(3) } + assert_nothing_raised { @img.ordered_dither(4) } + assert_raise(ArgumentError) { @img.ordered_dither(5) } + assert_raise(ArgumentError) { @img.ordered_dither(2, 1) } end def test_palette?
Add new tests for ordered_dither
rmagick_rmagick
train
rb
cdc5b3731ff0825685940fd16be720c24f2171e6
diff --git a/src/you_get/util/log.py b/src/you_get/util/log.py index <HASH>..<HASH> 100644 --- a/src/you_get/util/log.py +++ b/src/you_get/util/log.py @@ -90,7 +90,7 @@ def e(message, exit_code=None): if exit_code is not None: exit(exit_code) -def wtf(message, exit_code=-1): +def wtf(message, exit_code=1): """What a Terrible Failure!""" print_log(message, RED, BOLD) if exit_code is not None:
log.wtf(): exit code defaults to 1
soimort_you-get
train
py
2fa370e0c9e52bf2b9a151be044830120ac599f4
diff --git a/commands/command_fetch.go b/commands/command_fetch.go index <HASH>..<HASH> 100644 --- a/commands/command_fetch.go +++ b/commands/command_fetch.go @@ -174,8 +174,15 @@ func fetchAndReportToChan(pointers []*lfs.WrappedPointer, include, exclude []str // which would only be skipped by PointerSmudgeObject later passFilter := lfs.FilenamePassesIncludeExcludeFilter(p.Name, include, exclude) if !lfs.ObjectExistsOfSize(p.Oid, p.Size) && passFilter { + tracerx.Printf("fetch %v [%v]", p.Name, p.Oid) q.Add(lfs.NewDownloadable(p)) } else { + if !passFilter { + tracerx.Printf("Skipping %v [%v], include/exclude filters applied", p.Name, p.Oid) + } else { + tracerx.Printf("Skipping %v [%v], already exists", p.Name, p.Oid) + } + // If we already have it, or it won't be fetched // report it to chan immediately to support pull/checkout if out != nil {
Slightly more tracing in fetch
git-lfs_git-lfs
train
go
0fe14d785a8c9a4b22ab5e937736aea60ac9e2c0
diff --git a/lib/fs.js b/lib/fs.js index <HASH>..<HASH> 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -57,7 +57,7 @@ mkdirSync_p(path, mode, position + 1); } catch (e) { if (e.errno != 17) { - throw err; + throw e; } mkdirSync_p(path, mode, position + 1); }
Fix for uncaught: ReferenceError: err is not defined at mkdirSync_p (fs.js:<I>:<I>)
bpedro_node-fs
train
js
d39a85b08e17f3c740a2d0a0db4b0b4ddb904dfe
diff --git a/plenum/test/cli/helper.py b/plenum/test/cli/helper.py index <HASH>..<HASH> 100644 --- a/plenum/test/cli/helper.py +++ b/plenum/test/cli/helper.py @@ -39,7 +39,7 @@ class TestCliCore: @property def lastCmdOutput(self): - return '\n'.join([x['msg'] for x in + return ''.join([x['msg'] for x in list(reversed(self.printeds))[self.lastPrintIndex:]]) # noinspection PyAttributeOutsideInit @@ -203,7 +203,7 @@ def newKeyPair(cli: TestCli, alias: str=None): # Using `in` rather than `=` so as to take care of the fact that this might # be the first time wallet is accessed so wallet would be created and some # output corresponding to that would be printed. - assert "\n".join(expected) in cli.lastCmdOutput + assert "".join(expected) in cli.lastCmdOutput # the public key and alias are listed cli.enterCmd("list ids")
[#<I>] removed extra new line in lastCmdOutput function
hyperledger_indy-plenum
train
py
5dbcb7aaddbde1dc1d0384ea99220137f4160370
diff --git a/assets/js/components/Navigation/Search.js b/assets/js/components/Navigation/Search.js index <HASH>..<HASH> 100644 --- a/assets/js/components/Navigation/Search.js +++ b/assets/js/components/Navigation/Search.js @@ -155,7 +155,7 @@ class Search { * @returns {string} */ normaliseSearchString(searchString) { - return searchString.replace(/[^a-zA-Z0-9]/g, ''); + return searchString.replace(/[^a-zA-Z0-9]/g, '').toLowerCase(); }; // --------------------------------------------------------------------------
Include lwoer-casing in the search term normilisation
nails_module-admin
train
js
de5e188a5abc8455decf567d5eb22fe937f37129
diff --git a/tests/seta/test_analyze_failures.py b/tests/seta/test_analyze_failures.py index <HASH>..<HASH> 100644 --- a/tests/seta/test_analyze_failures.py +++ b/tests/seta/test_analyze_failures.py @@ -3,6 +3,7 @@ import pytest from treeherder.seta.analyze_failures import get_failures_fixed_by_commit +@pytest.mark.skip("Failing now that taskcluster jobs being ingested: bug 1342451") @pytest.mark.django_db() def test_analyze_failures(fifteen_jobs_with_notes, failures_fixed_by_commit): ret = get_failures_fixed_by_commit()
Bug <I> - Skip SETA test that started failing after ingestion logic fixed
mozilla_treeherder
train
py
0c3a754e1de7bab53b777d6681b1483c4d71162b
diff --git a/pygeoip/__init__.py b/pygeoip/__init__.py index <HASH>..<HASH> 100644 --- a/pygeoip/__init__.py +++ b/pygeoip/__init__.py @@ -98,6 +98,7 @@ class GeoIP(object): @type cache: bool """ self._flags = flags + self._netmask = None if self._flags & const.MMAP_CACHE and mmap is None: # pragma: no cover import warnings @@ -253,10 +254,12 @@ class GeoIP(object): x[i] += ord(byte) << (j * 8) if ipnum & (1 << depth): if x[1] >= self._databaseSegments: + self._netmask = seek_depth - depth + 1 return x[1] offset = x[1] else: if x[0] >= self._databaseSegments: + self._netmask = seek_depth - depth + 1 return x[0] offset = x[0] except (IndexError, UnicodeDecodeError):
Add internal `_netmask` property for future features Related to issue #<I>
appliedsec_pygeoip
train
py