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
c17950a8fd430add449dda65bfc4cb583fa13d08
diff --git a/salt/utils/thin.py b/salt/utils/thin.py index <HASH>..<HASH> 100644 --- a/salt/utils/thin.py +++ b/salt/utils/thin.py @@ -236,8 +236,10 @@ def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods='', if overwrite: try: os.remove(thintar) - except OSError: - pass + except OSError as exc: + log.error('Error while removing %s file: %s', thintar, exc) + if os.path.exists(thintar): + raise salt.exceptions.SaltSystemExit('Unable to remove %s file. See logs for details.', thintar) else: return thintar if _six.PY3:
Add logging on remove failure on thin.tgz archive
saltstack_salt
train
py
c0dae1da6e7b1c1a1bebe7023ce25042098a47b8
diff --git a/sdk/examples/xo_python/sawtooth_xo/xo_client.py b/sdk/examples/xo_python/sawtooth_xo/xo_client.py index <HASH>..<HASH> 100644 --- a/sdk/examples/xo_python/sawtooth_xo/xo_client.py +++ b/sdk/examples/xo_python/sawtooth_xo/xo_client.py @@ -44,8 +44,12 @@ class XoClient: with open(keyfile) as fd: self._private_key = fd.read().strip() fd.close() - except: - raise IOError("Failed to read keys.") + except FileNotFoundError: + raise XoException( + 'Could not find private key file {}; ' + 'try running `xo init`'.format(keyfile)) + except OSError: + raise XoException("Failed to read keys.") self._public_key = signing.generate_pubkey(self._private_key)
Make xo give nice error message for missing key This addresses STL-<I>.
hyperledger_sawtooth-core
train
py
51b6ec598e9ce5eb86f83a5a90a1ef2382dc7f98
diff --git a/aredis/pool.py b/aredis/pool.py index <HASH>..<HASH> 100644 --- a/aredis/pool.py +++ b/aredis/pool.py @@ -219,6 +219,7 @@ class ConnectionPool(object): # discard connection with unread response if connection.awaiting_response: connection.disconnect() + self._created_connections -= 1 else: self._available_connections.append(connection) @@ -228,6 +229,7 @@ class ConnectionPool(object): self._in_use_connections) for connection in all_conns: connection.disconnect() + self._created_connections -= 1 class ClusterConnectionPool(ConnectionPool):
decrement count on disconnect (#<I>)
NoneGG_aredis
train
py
bebbf2af6885367bf85ba2f45db17f7979e3c8c3
diff --git a/karma.conf.js b/karma.conf.js index <HASH>..<HASH> 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -208,7 +208,7 @@ module.exports = function (config) { captureTimeout: 4 * 60 * 1000, browserNoActivityTimeout: 4 * 60 * 1000, browserDisconnectTimeout: 10 * 1000, - concurrency: 3, + concurrency: 2, browserDisconnectTolerance: 3, reporters, browsers, diff --git a/tests/ResizeObserver.spec.js b/tests/ResizeObserver.spec.js index <HASH>..<HASH> 100644 --- a/tests/ResizeObserver.spec.js +++ b/tests/ResizeObserver.spec.js @@ -237,14 +237,17 @@ describe('ResizeObserver', () => { observer.observe(elements.target1); observer2.observe(elements.target1); - wait(timeout).then(() => { + spy.nextCall().then(async () => { + await wait(10); + expect(spy).toHaveBeenCalledTimes(1); expect(spy2).toHaveBeenCalledTimes(1); - + }).then(async () => { elements.target1.style.width = '220px'; - return wait(timeout * 2); - }).then(() => { + await spy.nextCall().then(spy.nextCall); + await wait(10); + expect(spy).toHaveBeenCalledTimes(3); expect(spy2).toHaveBeenCalledTimes(3); }).then(done).catch(done.fail);
Avoid using timeouts in tests * Set "concurrency" back to 2
que-etc_resize-observer-polyfill
train
js,js
1cf46b8b4b01f93b1c0ba6d0c019066df557d4bc
diff --git a/src/ScrollController.js b/src/ScrollController.js index <HASH>..<HASH> 100644 --- a/src/ScrollController.js +++ b/src/ScrollController.js @@ -1745,6 +1745,9 @@ define(function(require, exports, module) { // Calculate scroll offset var scrollOffset = _calcScrollOffset.call(this, true, true); + if (this._scrollOffsetCache === undefined) { + this._scrollOffsetCache = scrollOffset; + } // When the size or layout function has changed, reflow the layout var emitEndScrollingEvent = false;
#<I>: Fix, don't emit unintentional scroll events on the very first time the view is shown
IjzerenHein_famous-flex
train
js
38e17a9c5619f3f03a463ceb6c5cf7f6389a3bff
diff --git a/runtime/errors.go b/runtime/errors.go index <HASH>..<HASH> 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -35,7 +35,7 @@ func HTTPStatusFromCode(code codes.Code) int { case codes.Unauthenticated: return http.StatusUnauthorized case codes.ResourceExhausted: - return http.StatusForbidden + return http.StatusServiceUnavailable case codes.FailedPrecondition: return http.StatusPreconditionFailed case codes.Aborted:
runtime: return <I> vs <I> with ResourceExhausted.
grpc-ecosystem_grpc-gateway
train
go
7761406b1e0524b60f532ae35adea73394531f7e
diff --git a/test/fulfillment_service_test.rb b/test/fulfillment_service_test.rb index <HASH>..<HASH> 100644 --- a/test/fulfillment_service_test.rb +++ b/test/fulfillment_service_test.rb @@ -4,6 +4,7 @@ class FulFillmentServiceTest < Test::Unit::TestCase test 'new should create fulfillment service' do fake "fulfillment_service", :method => :post fulfillment_service = ShopifyAPI::FulfillmentService.new(:name => "SomeService") + fulfillment_service.save assert_equal "SomeService" , fulfillment_service.name end
Fixing lack of .save after .new
Shopify_shopify_api
train
rb
559fe1f306867fdca6cbfdae6ef2eca2ba258a13
diff --git a/src/CRUDlex/CRUDEntity.php b/src/CRUDlex/CRUDEntity.php index <HASH>..<HASH> 100644 --- a/src/CRUDlex/CRUDEntity.php +++ b/src/CRUDlex/CRUDEntity.php @@ -289,7 +289,7 @@ class CRUDEntity { public function validate(CRUDData $data) { $fields = $this->definition->getEditableFieldNames(); - $errors = array(); + $fieldErrors = array(); $valid = true; foreach ($fields as $field) { $fieldErrors[$field] = array('required' => false, 'unique' => false, 'input' => false);
fixed not yet renamed variable
philiplb_CRUDlex
train
php
1c8f36c40b1696ee2fe62cd2d088e4de97e65b14
diff --git a/src/python/src/grpc/framework/face/_calls.py b/src/python/src/grpc/framework/face/_calls.py index <HASH>..<HASH> 100644 --- a/src/python/src/grpc/framework/face/_calls.py +++ b/src/python/src/grpc/framework/face/_calls.py @@ -248,7 +248,7 @@ class _OperationFuture(future.Future): """See future.Future.add_done_callback for specification.""" with self._condition: if self._callbacks is not None: - self._callbacks.add(fn) + self._callbacks.append(fn) return callable_util.call_logging_exceptions(fn, _DONE_CALLBACK_LOG_MESSAGE, self)
Fix mistaken method name: "append", not "add" This defect was originally introduced in Google-internal source control on <I> August <I>. Wow. Clearly unit test coverage is needed for this feature.
grpc_grpc
train
py
11d2e3aa5b7cdf9adcb33c4d34d189d02f619a69
diff --git a/core/src/main/java/cucumber/classpath/Classpath.java b/core/src/main/java/cucumber/classpath/Classpath.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/cucumber/classpath/Classpath.java +++ b/core/src/main/java/cucumber/classpath/Classpath.java @@ -152,7 +152,9 @@ public class Classpath { private static void scanFilesystem(File rootDir, File file, String suffix, Consumer consumer) { if (file.isDirectory()) { - for (File child : file.listFiles()) { + File[] children = file.listFiles(); + Arrays.sort(children); + for (File child : children) { scanFilesystem(rootDir, child, suffix, consumer); } } else {
Deterministic file ordering. Closes #<I>.
cucumber_cucumber-jvm
train
java
e0410c13849e72056561147239efe757f8b9c67d
diff --git a/test/spec/spec_helper.rb b/test/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/test/spec/spec_helper.rb +++ b/test/spec/spec_helper.rb @@ -32,10 +32,7 @@ module Hatchet # end override # begin override: copy in env too, so we get e.g. the correct HEROKU_PHP_PLATFORM_REPOSITORIES - puts 'app_json["environments"]["test"]["env"]', app_json["environments"]["test"]["env"] - puts "app.app_config", @app.app_config app_json["environments"]["test"]["env"] = @app.app_config.merge(app_json["environments"]["test"]["env"]) # so we get HEROKU_PHP_PLATFORM_REPOSITORIES in there - puts 'app_json["environments"]["test"]["env"]', app_json["environments"]["test"]["env"] # end override File.open("app.json", "w") {|f| f.write(JSON.generate(app_json)) }
remove debug puts calls from spec_helper
heroku_heroku-buildpack-php
train
rb
5116f09bdb847c54c16574250abc1db30452b882
diff --git a/src/runtime.js b/src/runtime.js index <HASH>..<HASH> 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -287,12 +287,13 @@ function variable_compute(variable) { function variable_generate(variable, version, generator) { const runtime = variable._module._runtime; + let currentValue; // so that yield resolves to the yielded value // Retrieve the next value from the generator; if successful, invoke the // specified callback. The returned promise resolves to the yielded value, or // to undefined if the generator is done. function compute(onfulfilled) { - return new Promise(resolve => resolve(generator.next())).then(({done, value}) => { + return new Promise(resolve => resolve(generator.next(currentValue))).then(({done, value}) => { return done ? undefined : Promise.resolve(value).then(onfulfilled); }); } @@ -304,6 +305,7 @@ function variable_generate(variable, version, generator) { function recompute() { const promise = compute((value) => { if (variable._version !== version) return; + currentValue = value; postcompute(value, promise).then(() => runtime._precompute(recompute)); variable._fulfilled(value); return value; @@ -328,6 +330,7 @@ function variable_generate(variable, version, generator) { // already established, so we only need to queue the next pull. return compute((value) => { if (variable._version !== version) return; + currentValue = value; runtime._precompute(recompute); return value; });
yield resolves to yielded value (#<I>)
observablehq_runtime
train
js
d5c54b776aec603e930705159ff8d6314ab8062b
diff --git a/parsl/providers/torque/torque.py b/parsl/providers/torque/torque.py index <HASH>..<HASH> 100644 --- a/parsl/providers/torque/torque.py +++ b/parsl/providers/torque/torque.py @@ -111,6 +111,7 @@ class TorqueProvider(ClusterProvider, RepresentationMixin): [status...] : Status list of all jobs ''' + job_ids = list(self.resources.keys()) job_id_list = ' '.join(self.resources.keys()) jobs_missing = list(self.resources.keys()) @@ -120,7 +121,12 @@ class TorqueProvider(ClusterProvider, RepresentationMixin): parts = line.split() if not parts or parts[0].upper().startswith('JOB') or parts[0].startswith('---'): continue - job_id = parts[0] + job_id = parts[0] # likely truncated + for long_job_id in job_ids: + if long_job_id.startswith(job_id): + logger.debug('coerced job_id %s -> %s', job_id, long_job_id) + job_id = long_job_id + break state = translate_table.get(parts[4], JobState.UNKNOWN) self.resources[job_id]['status'] = JobStatus(state) jobs_missing.remove(job_id)
Fix Torque job_id truncation (#<I>) The call to qstat by the Torque provider returns job_id values that are truncated as compared to the output of qsub. This is a crude fix that seems relatively safe.
Parsl_parsl
train
py
9643ff722903ee596f8267f5e740234234b6b27f
diff --git a/dvc/version.py b/dvc/version.py index <HASH>..<HASH> 100644 --- a/dvc/version.py +++ b/dvc/version.py @@ -6,7 +6,7 @@ import os import subprocess -_BASE_VERSION = "1.7.8" +_BASE_VERSION = "1.7.9" def _generate_version(base_version):
dvc: bump to <I>
iterative_dvc
train
py
d2a31b1e19244cd0b8a249c824d88a6d94a591cc
diff --git a/closure/goog/fx/dragger.js b/closure/goog/fx/dragger.js index <HASH>..<HASH> 100644 --- a/closure/goog/fx/dragger.js +++ b/closure/goog/fx/dragger.js @@ -216,6 +216,7 @@ goog.tagUnsealableClass(goog.fx.Dragger); * @private */ goog.fx.Dragger.HAS_SET_CAPTURE_ = + goog.global.document && goog.global.document.documentElement.setCapture != null;
Check for existence of document before setCapture feature detection. Turns out there are deps on this lib from headless tests. ------------- Created by MOE: <URL>
google_closure-library
train
js
fcee0786dc0d64f489439b9ddb71d22394ec429a
diff --git a/structr-core/src/main/java/org/structr/schema/SchemaService.java b/structr-core/src/main/java/org/structr/schema/SchemaService.java index <HASH>..<HASH> 100644 --- a/structr-core/src/main/java/org/structr/schema/SchemaService.java +++ b/structr-core/src/main/java/org/structr/schema/SchemaService.java @@ -335,6 +335,8 @@ public class SchemaService implements Service { if (!success) { + FlushCachesCommand.flushAll(); + logger.error("Errors encountered during compilation:"); for (ErrorToken token : errorBuffer.getErrorTokens()) { logger.error(" - {}", token.toString());
Bugfix: Flush caches after failed schema compilation to prevent erroneous cache entries
structr_structr
train
java
f43cd011edcf3ed4b2a88f69c092abd5d262e9d8
diff --git a/lib/rspec/instafail.rb b/lib/rspec/instafail.rb index <HASH>..<HASH> 100755 --- a/lib/rspec/instafail.rb +++ b/lib/rspec/instafail.rb @@ -1,4 +1,4 @@ module RSpec - version = Gem.loaded_specs["rspec"].version + version = Gem.loaded_specs["rspec-core"].version require "rspec/instafail/rspec_#{[3, version.segments.first].min}" end
Fix issue loading with newer rspec
grosser_rspec-instafail
train
rb
19a098cccc68c25c19805f47b2d39f648c44444d
diff --git a/bin/console.php b/bin/console.php index <HASH>..<HASH> 100644 --- a/bin/console.php +++ b/bin/console.php @@ -21,7 +21,18 @@ use Drupal\AppConsole\Command\Helper\DrupalAutoload; set_time_limit(0); $consoleRoot = __DIR__ . '/../'; -require $consoleRoot . '/vendor/autoload.php'; + +if (file_exists($consoleRoot . '/vendor/autoload.php')) { + require_once $consoleRoot . '/vendor/autoload.php'; +} +else if (file_exists( $consoleRoot . '/../../vendor/autoload.php')) { + require_once $consoleRoot . '/../../vendor/autoload.php'; +} +else { + echo 'Something goes wrong with your archive'.PHP_EOL. + 'Try downloading again'.PHP_EOL; + exit(1); +} $consoleConfig = new Config(new Parser(), $consoleRoot); $config = $consoleConfig->getConfig();
revert condition to find autoload
hechoendrupal_drupal-console
train
php
bc9bc9300afd10921209e9ccf5f462e08d834715
diff --git a/lib/discordrb/bot.rb b/lib/discordrb/bot.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/bot.rb +++ b/lib/discordrb/bot.rb @@ -86,6 +86,11 @@ module Discordrb @private_channels[id] = channel end + def join(invite) + invite = invite[invite.rindex('/')+1..-1] if invite.start_with?('http') || invite.start_with?('discord.gg') + API.join_server(@token, invite) + end + def user(id) @users[id] end
Add a method to join a server using an invite, fixes #<I>
meew0_discordrb
train
rb
a1f7b3c62ab4c6064104e67f4c00f850b4dba8e4
diff --git a/pyquil/api/job.py b/pyquil/api/job.py index <HASH>..<HASH> 100644 --- a/pyquil/api/job.py +++ b/pyquil/api/job.py @@ -118,6 +118,34 @@ class Job(object): if self.is_queued(): return ROUND_TRIP_JOB_TIME * self.position_in_queue() + def running_time(self): + """ + For how long was the job running? + :return: Running time, seconds + :rtype: Optional[float] + """ + if not self.is_done(): + raise ValueError("Cannot get running time for a program that isn't completed.") + try: + running_time = float(self._raw['running_time'].split()[0]) + except (ValueError, KeyError, IndexError): + raise UnknownApiError(str(self._raw)) + return running_time + + def time_in_queue(self): + """ + For how long was the job in the Forest queue? + :return: Time in queue, seconds + :rtype: Optional[float] + """ + if not self.is_done(): + raise ValueError("Cannot get time in queue for a program that isn't completed.") + try: + time_in_queue = float(self._raw['time_in_queue'].split()[0]) + except (ValueError, KeyError, IndexError): + raise UnknownApiError(str(self._raw)) + return time_in_queue + def get(self): warnings.warn(""" Running get() on a Job is now a no-op.
Fixed issue #<I>: nice API for job running time and time in queue (#<I>) * added convenience functions for job running time and time in queue * added cast to float with some exception handling
rigetti_pyquil
train
py
1d4f45bcf8da736b6b3557e49a6f33779c27553b
diff --git a/src/Providers/Service.php b/src/Providers/Service.php index <HASH>..<HASH> 100644 --- a/src/Providers/Service.php +++ b/src/Providers/Service.php @@ -85,7 +85,9 @@ class Service extends ServiceProvider { return (! request()->ajax() && ! $this->shouldRegisterRouteMiddleware() - && (php_sapi_name() === 'fpm-fcgi' || app('env') === 'testing')); + && (php_sapi_name() === 'fpm-fcgi' + || php_sapi_name() === 'apache2handler' + || app('env') === 'testing')); } protected function shouldRegisterRouteMiddleware() : bool
Fix middleware registration detection to work with Apache
GeneaLabs_laravel-caffeine
train
php
45dd407560d8eaf343be0c756b4ee1face65662e
diff --git a/saucelabs.karma.conf.js b/saucelabs.karma.conf.js index <HASH>..<HASH> 100644 --- a/saucelabs.karma.conf.js +++ b/saucelabs.karma.conf.js @@ -98,7 +98,7 @@ module.exports = (config) => { // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_DEBUG, + logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes autoWatch: false,
Update saucelabs.karma.conf.js
MrRio_jsPDF
train
js
20df1bdf9a9c1eb3fe1eb7109a4fc8887e07d42e
diff --git a/gos/executable_containers.py b/gos/executable_containers.py index <HASH>..<HASH> 100644 --- a/gos/executable_containers.py +++ b/gos/executable_containers.py @@ -9,6 +9,7 @@ from gos.utils.load import Loader class ExecutableContainer(object): name = "executable_container" + type_name = "executable_container" DEFAULT_SELF_LOOP = False DEFAULT_ENTRIES_TYPE_NAME = None diff --git a/tests/test_executable_containers.py b/tests/test_executable_containers.py index <HASH>..<HASH> 100644 --- a/tests/test_executable_containers.py +++ b/tests/test_executable_containers.py @@ -21,6 +21,9 @@ class ExecutableContainerTestCase(unittest.TestCase): def test_entries_type_name_attribute(self): self.assertTrue(hasattr(self.ec, "entries_type_name")) + def test_type_name_attribute(self): + self.assertTrue(hasattr(self.ec, "type_name")) + def test_entries_info_attribute(self): self.assertTrue(hasattr(self.ec, "entries_names"))
GOS-<I> added default `type_name` field for Executable container
aganezov_gos
train
py,py
a5b5bb68af438b22de79cdbf62f31761bbc656e6
diff --git a/txmongo/collection.py b/txmongo/collection.py index <HASH>..<HASH> 100644 --- a/txmongo/collection.py +++ b/txmongo/collection.py @@ -454,10 +454,10 @@ class Collection(object): .addCallback(lambda result: result[0] if result else None) @timeout - def count(self, spec=None, **kwargs): + def count(self, filter=None, **kwargs): """Get the number of documents in this collection. - :param spec: + :param filter: argument is a query document that selects which documents to count in the collection. @@ -467,8 +467,11 @@ class Collection(object): :returns: a :class:`Deferred` that called back with a number of documents matching the criteria. """ + if "spec" in kwargs: + filter = kwargs["spec"] + return self._database.command("count", self._collection_name, - query=spec or SON(), **kwargs)\ + query=filter or SON(), **kwargs)\ .addCallback(lambda result: int(result['n'])) @timeout
spec->filter in count() signature (with backwards compatibility)
twisted_txmongo
train
py
86ecae471a9ad772e5e15d12407e465b3be7cdc6
diff --git a/src/tad/WPBrowser/StubProphecy/FunctionProphecy.php b/src/tad/WPBrowser/StubProphecy/FunctionProphecy.php index <HASH>..<HASH> 100644 --- a/src/tad/WPBrowser/StubProphecy/FunctionProphecy.php +++ b/src/tad/WPBrowser/StubProphecy/FunctionProphecy.php @@ -81,6 +81,9 @@ class FunctionProphecy return $prophecy->reveal()->{$safeName}(...$args); }; + // Pre-load the dependency tree if the replaced function is about files. + class_exists(MethodProphecy::class, true); + if (function_exists('uopz_set_return')) { uopz_set_return($name, $closure, true); static::$replacedFunction[] = $name;
fix(FunctionProphecy) pre-load dependency tree to avoid file_exists issues
lucatume_wp-browser
train
php
9dbef9a5a9dea72a7ba9cb1e1c45bc829a5a89a7
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name="ChromeController", # Version number (initial): - version="0.1.8", + version="0.1.9", # Application author details: author="Connor Wolf ",
Whoops, I made a release without pushing to git. Increment the rev again.
fake-name_ChromeController
train
py
1caf8f6fef292a3f2961a26af94e24a86f76ef50
diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/message_verifier.rb +++ b/activesupport/lib/active_support/message_verifier.rb @@ -24,6 +24,12 @@ module ActiveSupport # hash upon initialization: # # @verifier = ActiveSupport::MessageVerifier.new('s3Krit', serializer: YAML) + # + # +MessageVerifier+ creates HMAC signatures using SHA1 hash algorithm by default. + # If you want to use a different hash algorithm, you can change it by providing + # `:digest` key as an option while initializing the verifier: + # + # @verifier = ActiveSupport::MessageVerifier.new('s3Krit', digest: 'SHA256') class MessageVerifier class InvalidSignature < StandardError; end
Missing documentation about hash algorithm option for MessageVerifier [ci skip]
rails_rails
train
rb
5f51cc3e004bfd981c891a4c67f08ecfc724aa2a
diff --git a/webview/winforms.py b/webview/winforms.py index <HASH>..<HASH> 100644 --- a/webview/winforms.py +++ b/webview/winforms.py @@ -35,6 +35,10 @@ class BrowserView: self.ClientSize = Size(width, height); self.MinimumSize = Size(min_size[0], min_size[1]) + if not resizable: + self.FormBorderStyle = WinForms.FormBorderStyle.FixedSingle + self.MaximizeBox = False + # Application icon try: # Try loading an icon embedded in the exe file. This will crash when frozen with PyInstaller handler = windll.kernel32.GetModuleHandleW(None)
Implement non-resizable window in WinForms
r0x0r_pywebview
train
py
3aabac5b0d6ebf3647b6150803219d6acb5c33a6
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -12,11 +12,11 @@ module ActionDispatch self.tld_length = 1 class << self - def extract_domain(host, tld_length = @@tld_length) + def extract_domain(host, tld_length) host.split('.').last(1 + tld_length).join('.') if named_host?(host) end - def extract_subdomains(host, tld_length = @@tld_length) + def extract_subdomains(host, tld_length) if named_host?(host) parts = host.split('.') parts[0..-(tld_length + 2)] @@ -25,7 +25,7 @@ module ActionDispatch end end - def extract_subdomain(host, tld_length = @@tld_length) + def extract_subdomain(host, tld_length) extract_subdomains(host, tld_length).join('.') end
these methods are always called with a tld_parameter remove the default parameter since the methods are always called with a parameter
rails_rails
train
rb
efd786834b766ed7c528c40355fddf7c2dbc4340
diff --git a/blueprints/ember-cli-qunit/index.js b/blueprints/ember-cli-qunit/index.js index <HASH>..<HASH> 100644 --- a/blueprints/ember-cli-qunit/index.js +++ b/blueprints/ember-cli-qunit/index.js @@ -8,7 +8,7 @@ module.exports = { afterInstall: function() { return this.addBowerPackagesToProject([ { name: 'qunit', target: '~1.17.0' }, - { name: 'ember-cli/ember-cli-test-loader', target: '0.1.0' }, + { name: 'ember-cli/ember-cli-test-loader', target: '0.1.1' }, { name: 'ember-qunit-notifications', target: '0.0.5' }, { name: 'ember-qunit', target: '0.2.6' } ]);
Prevents module load errors from stopping test run.
ember-cli_ember-cli-jshint
train
js
914d6edc08133ca9546818e9366b497b610ccbaf
diff --git a/tests/tests.js b/tests/tests.js index <HASH>..<HASH> 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -372,8 +372,9 @@ exports.defineAutoTests = function () { flag = false; setTimeout(function () { media1.getCurrentPosition(function (position) { - //in four seconds expect position to be two times greater with some degree (1 sec) of accuracy - expect(position).toBeGreaterThan(7); + //in four seconds expect position to be between 4 & 10. Here, the values are chosen to give + //a large enough buffer range for the position to fall in and are not based on any calculation. + expect(position >= 4 && position < 10).toBeTruthy(); media1.stop(); media1.release(); done();
CB-<I>: Modify expected position to be in a proper range.This closes #<I>
apache_cordova-plugin-media
train
js
d2e308b0b4928ebb7571eb2009b1bd9986b1db07
diff --git a/xtuml/__init__.py b/xtuml/__init__.py index <HASH>..<HASH> 100644 --- a/xtuml/__init__.py +++ b/xtuml/__init__.py @@ -9,6 +9,10 @@ from .load import ParsingException from .load import ModelLoader from .persist import persist_instances +from .persist import persist_schema + +from .persist import serialize_schema +from .persist import serialize_class from .persist import serialize_instances from .persist import serialize_instance
xtuml: expose schema serialization to xtuml package
xtuml_pyxtuml
train
py
dd78ba0368986bcb74901df5deb6a5b0dd7c696e
diff --git a/karma.conf.js b/karma.conf.js index <HASH>..<HASH> 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -10,7 +10,7 @@ module.exports = function(karma) { .option('verbose', {default: false}) .argv; - const grep = args.grep === true ? '' : args.grep; + const grep = (args.grep === true || args.grep === undefined) ? '' : args.grep; const specPattern = 'test/specs/**/*' + grep + '*.js'; // Use the same rollup config as our dist files: when debugging (npm run dev),
Don't require --grep to be given on the command line (#<I>) This makes it easier to use the `karma` CLI directly, if desired, and makes it easier to use WebStorm's integrated debugger (which makes up `karma` command-line invocations itself). Prior to this change, if `--grep` isn't given, Karma looks for `*undefined*.js` and finds no tests to run.
chartjs_Chart.js
train
js
83e80f6d0bf3e178b5be394d182c9d0e2e104671
diff --git a/tsdb/config.go b/tsdb/config.go index <HASH>..<HASH> 100644 --- a/tsdb/config.go +++ b/tsdb/config.go @@ -13,7 +13,7 @@ const ( DefaultEngine = "tsm1" // DefaultIndex is the default index for new shards - DefaultIndex = "tsi1" // "inmem" + DefaultIndex = "inmem" // tsdb/engine/wal configuration options diff --git a/tsdb/index/inmem/inmem.go b/tsdb/index/inmem/inmem.go index <HASH>..<HASH> 100644 --- a/tsdb/index/inmem/inmem.go +++ b/tsdb/index/inmem/inmem.go @@ -256,6 +256,17 @@ func (i *Index) TagsForSeries(key string) (models.Tags, error) { func (i *Index) MeasurementNamesByExpr(expr influxql.Expr) ([][]byte, error) { i.mu.RLock() defer i.mu.RUnlock() + + // Return all measurement names if no expression is provided. + if expr == nil { + a := make([][]byte, 0, len(i.measurements)) + for name := range i.measurements { + a = append(a, []byte(name)) + } + bytesutil.Sort(a) + return a, nil + } + return i.measurementNamesByExpr(expr) }
Fix in-mem index integration tests.
influxdata_influxdb
train
go,go
daf46755f844ee93b7a91b9da2d830ae4b906e0c
diff --git a/lib/moped/query.rb b/lib/moped/query.rb index <HASH>..<HASH> 100644 --- a/lib/moped/query.rb +++ b/lib/moped/query.rb @@ -142,14 +142,14 @@ module Moped result["values"] end - # @return [Numeric] the number of documents that match the selector. + # @return [Integer] the number of documents that match the selector. def count result = collection.database.command( count: collection.name, query: selector ) - result["n"] + result["n"].to_i end # Update a single document matching the query's selector. diff --git a/spec/moped/query_spec.rb b/spec/moped/query_spec.rb index <HASH>..<HASH> 100644 --- a/spec/moped/query_spec.rb +++ b/spec/moped/query_spec.rb @@ -228,7 +228,11 @@ describe Moped::Query do end it "returns the number of matching document" do - users.find(scope: scope).count.should eq 2 + users.find(scope: scope).count.should eq(2) + end + + it "returns a fixnum" do + users.find(scope: scope).count.should be_a(Integer) end end
Count should return an integer, not a float
mongoid_moped
train
rb,rb
82a607588458c961329924c08a134718b262440a
diff --git a/resource_aws_route_table.go b/resource_aws_route_table.go index <HASH>..<HASH> 100644 --- a/resource_aws_route_table.go +++ b/resource_aws_route_table.go @@ -110,12 +110,18 @@ func resource_aws_route_table_update( break } - // Append to the routes what we've done so far - resultRoutes = append(resultRoutes, map[string]string{ - "cidr_block": op.Route.DestinationCidrBlock, - "gateway_id": op.Route.GatewayId, - "instance_id": op.Route.InstanceId, - }) + // If we didn't delete the route, append it to the list of routes + // we have. + if op.Op != routeTableOpDelete { + resultMap := map[string]string{"cidr_block": op.Route.DestinationCidrBlock} + if op.Route.GatewayId != "" { + resultMap["gateway_id"] = op.Route.GatewayId + } else if op.Route.InstanceId != "" { + resultMap["instance_id"] = op.Route.InstanceId + } + + resultRoutes = append(resultRoutes, resultMap) + } } // Update our state with the settings
providers/aws: fix issue where default route was being added
terraform-providers_terraform-provider-aws
train
go
1ce96c28f05ae16d243acd4f2824971e54795c91
diff --git a/lib/temporaries/adapters/mini_test.rb b/lib/temporaries/adapters/mini_test.rb index <HASH>..<HASH> 100644 --- a/lib/temporaries/adapters/mini_test.rb +++ b/lib/temporaries/adapters/mini_test.rb @@ -10,7 +10,7 @@ module Temporaries end def before(&hook) - context.include Module.new { + context.__send__ :include, Module.new { define_method(:setup) do |*args, &block| super(*args, &block) instance_eval(&hook) @@ -19,7 +19,7 @@ module Temporaries end def after(&hook) - context.include Module.new { + context.__send__ :include, Module.new { define_method(:teardown) do |*args, &block| instance_eval(&hook) super(*args, &block)
Module#include is private on ruby < <I>.
oggy_temporaries
train
rb
dadad2bdb2a713748df0717eddd54495150cfb58
diff --git a/v2/internal/template_test.go b/v2/internal/template_test.go index <HASH>..<HASH> 100644 --- a/v2/internal/template_test.go +++ b/v2/internal/template_test.go @@ -1,6 +1,7 @@ package internal import ( + "strings" "testing" "text/template" ) @@ -45,7 +46,7 @@ func TestExecute(t *testing.T) { template: &Template{ Src: "hello {{", }, - err: "template: :1: unexpected unclosed action in command", + err: "unclosed action", noallocs: true, }, } @@ -53,8 +54,8 @@ func TestExecute(t *testing.T) { for _, test := range tests { t.Run(test.template.Src, func(t *testing.T) { result, err := test.template.Execute(test.funcs, test.data) - if actual := str(err); actual != test.err { - t.Errorf("expected err %q; got %q", test.err, actual) + if actual := str(err); !strings.Contains(str(err), test.err) { + t.Errorf("expected err %q to contain %q", actual, test.err) } if result != test.result { t.Errorf("expected result %q; got %q", test.result, result)
Update test to new error message in go <I> (#<I>)
nicksnyder_go-i18n
train
go
717db267372741c7a4b49498e31f6dc7d13b3dec
diff --git a/lib/runner.js b/lib/runner.js index <HASH>..<HASH> 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -19,7 +19,7 @@ GruntBrowserifyRunner.prototype = _.create(GruntBrowserifyRunner.prototype, { //set constructor options and instantiate var bOpts = options.browserifyOptions || {}; - bOpts.entries = options.browserifyOptions.entries || files; + bOpts.entries = bOpts.entries || files; // Watchify requires specific arguments if(options.watch) {
- Corrected previous commmit adding support for `entries` option.
jmreidy_grunt-browserify
train
js
693c3ba3c3cfff51d9eb9039f0acc80e5b1b37ae
diff --git a/src/Verification.php b/src/Verification.php index <HASH>..<HASH> 100644 --- a/src/Verification.php +++ b/src/Verification.php @@ -16,7 +16,8 @@ class Verification public function isValid() { - return $this->expectedSignatureBase64() === $this->providedSignatureBase64(); + return $this->hasHeader('Signature') && + $this->expectedSignatureBase64() === $this->providedSignatureBase64(); } private function expectedSignatureBase64() @@ -83,4 +84,9 @@ class Verification throw new Exception("HTTP message has no '$name' header"); } } + + private function hasHeader($name) + { + return $this->message->headers->has($name); + } } diff --git a/tests/VerifierTest.php b/tests/VerifierTest.php index <HASH>..<HASH> 100644 --- a/tests/VerifierTest.php +++ b/tests/VerifierTest.php @@ -68,4 +68,10 @@ class VerifierTest extends \PHPUnit_Framework_TestCase ); $this->assertFalse($this->verifier->isValid($this->message)); } + + public function testRejectMessageWithoutSignatureHeader() + { + $this->message->headers->remove('Signature'); + $this->assertFalse($this->verifier->isValid($this->message)); + } }
Cleanly reject message with no Signature header.
99designs_http-signatures-php
train
php,php
4d4f8fb9e00ec452f3dde1c2fe1126819a9d5ef3
diff --git a/mbuild/tests/test_compound.py b/mbuild/tests/test_compound.py index <HASH>..<HASH> 100755 --- a/mbuild/tests/test_compound.py +++ b/mbuild/tests/test_compound.py @@ -1088,7 +1088,6 @@ class TestCompound(BaseTest): def test_sdf(self, methane): methane.save('methane.sdf') sdf_string = mb.load('methane.sdf') - assert np.allclose(methane.xyz, sdf_string.xyz, atol=1e-5) def test_load_multiple_sdf(self, methane): @@ -1100,5 +1099,4 @@ class TestCompound(BaseTest): filled = mb.fill_box(methane, n_compounds=10, box=[0, 0, 0, 4, 4, 4]) filled.save('methane.sdf') sdf_string = mb.load('methane.sdf') - assert np.allclose(filled.xyz, sdf_string.xyz, atol=1e-5)
Remove blank lines in test_compound
mosdef-hub_mbuild
train
py
7fb31de9b0531c67b9a2bab9ec4219f38513bc57
diff --git a/context_processors.py b/context_processors.py index <HASH>..<HASH> 100644 --- a/context_processors.py +++ b/context_processors.py @@ -1,7 +1,24 @@ from django.conf import settings as django_settings +from django.core.urlresolvers import resolve, reverse +from django.utils.translation import activate, get_language def settings(request): - # dict_settings = dict() - # for key in django_settings._explicit_settings: - # dict_settings[key] = getattr(settings,key) return {'settings': django_settings} + + + +def alternate_seo_url(request): + alternate_url = dict() + path = request.path + url_parts = resolve( path ) + url = path + cur_language = get_language() + for lang_code, lang_name in django_settings.LANGUAGES : + try: + activate(lang_code) + url = reverse( url_parts.view_name, kwargs=url_parts.kwargs ) + alternate_url[lang_code] = django_settings.SITE_URL+url + finally: + activate(cur_language) + + return {'alternate':alternate_url}
Implemented new context_processor Now you can access to alternate url for your current page with
lotrekagency_djlotrek
train
py
1b6a77bdd548a34e4fcd8989d700293b516aea46
diff --git a/lib/yml.js b/lib/yml.js index <HASH>..<HASH> 100644 --- a/lib/yml.js +++ b/lib/yml.js @@ -1,8 +1,8 @@ -const debug = require('debug')('metalsmith-metadata-directory'); -const yaml = require('js-yaml'); +var debug = require('debug')('metalsmith-metadata-directory'); +var yaml = require('js-yaml'); function parseYml(text, filename) { - let yml = ''; + var yml = ''; try { // Try to safe load YAML file, will parse to JSON on success; yml = yaml.safeLoad(text, { @@ -18,6 +18,6 @@ function parseYml(text, filename) { debug(e.message || e); throw new Error(`Malformed YAML in: ${filename}`); } -} +} -module.exports = parseYml; \ No newline at end of file +module.exports = parseYml;
refactor(yml): change file to use var/pre es5 code
fephil_metalsmith-metadata-directory
train
js
b424360713356eeb0ecea0a3d73c5bbcfdc61e4a
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -1,6 +1,7 @@ class ProfilesController < ApplicationController before_action :redirect_to_root, unless: :signed_in?, except: :show before_action :verify_password, only: %i[update destroy] + before_action :set_cache_headers, only: :edit helper_method :mfa_enabled? def edit @@ -52,4 +53,10 @@ class ProfilesController < ApplicationController flash[:notice] = t('profiles.request_denied') redirect_to edit_profile_path end + + def set_cache_headers + response.headers["Cache-Control"] = "no-cache, no-store" + response.headers["Pragma"] = "no-cache" + response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" + end end
Add no-store to cache-control header for profile edit it will redirect user to home page instead of showing stale edit profile page. Fixes long-standing hackerone report(s).
rubygems_rubygems.org
train
rb
550b38beb64671306b1243a8f3289128822f2b9c
diff --git a/address/models.py b/address/models.py index <HASH>..<HASH> 100644 --- a/address/models.py +++ b/address/models.py @@ -234,16 +234,17 @@ class AddressField(models.ForeignKey): description = 'An address' def __init__(self, **kwargs): - super(AddressField, self).__init__(Address, **kwargs) + kwargs['to'] = Address + super(AddressField, self).__init__(**kwargs) def contribute_to_class(self, cls, name, virtual_only=False): super(ForeignObject, self).contribute_to_class(cls, name, virtual_only=virtual_only) setattr(cls, self.name, AddressDescriptor(self)) - def deconstruct(self): - name, path, args, kwargs = super(AddressField, self).deconstruct() - del kwargs['to'] - return name, path, args, kwargs + # def deconstruct(self): + # name, path, args, kwargs = super(AddressField, self).deconstruct() + # del kwargs['to'] + # return name, path, args, kwargs def formfield(self, **kwargs): from forms import AddressField as AddressFormField
Still wrapping my head around the migrations code. An error was reported about failing migrations, the issue is to do with my automatically setting the "to" relation of `AddressField` to the `Address` model. This is a workaround.
furious-luke_django-address
train
py
ac40d671b880eae58160f3031d09c4335dec4ffd
diff --git a/sinatra-contrib/spec/cookies_spec.rb b/sinatra-contrib/spec/cookies_spec.rb index <HASH>..<HASH> 100644 --- a/sinatra-contrib/spec/cookies_spec.rb +++ b/sinatra-contrib/spec/cookies_spec.rb @@ -515,11 +515,6 @@ describe Sinatra::Cookies do end end - describe :hash do - it { cookies.hash.should be == {}.hash } - it { cookies('foo=bar').hash.should be == {'foo' => 'bar'}.hash } - end - describe :include? do it 'checks request cookies' do cookies('foo=bar').should include('foo')
remove hash spec, this is way too inconsisten between rubies
sinatra_sinatra
train
rb
2b9bc03f2ccd5a29b97663afcd817873e15505ef
diff --git a/src/Document.php b/src/Document.php index <HASH>..<HASH> 100644 --- a/src/Document.php +++ b/src/Document.php @@ -138,7 +138,7 @@ class Document extends Structure * @return \Sokil\Mongo\Collection */ public function getCollection() - { + { return $this->_collection; } @@ -218,11 +218,18 @@ class Document extends Structure public function belongsToCollection(Collection $collection) { - if ($collection->getDatabase()->getName() !== $this->getCollection()->getDatabase()->getName()) { + // check connection + if($collection->getDatabase()->getClient()->getDsn() !== $this->_collection->getDatabase()->getClient()->getDsn()) { + return false; + } + + // check database + if ($collection->getDatabase()->getName() !== $this->_collection->getDatabase()->getName()) { return false; } - return $collection->getName() == $this->getCollection()->getName(); + // check collection + return $collection->getName() == $this->_collection->getName(); } /**
improve belongsToCollection to check connection dsn
sokil_php-mongo
train
php
f0d72851b5420c96b9e6fc3dbf69c0d717792e66
diff --git a/modules/activiti-spring/src/main/java/org/activiti/spring/SpringTransactionInterceptor.java b/modules/activiti-spring/src/main/java/org/activiti/spring/SpringTransactionInterceptor.java index <HASH>..<HASH> 100644 --- a/modules/activiti-spring/src/main/java/org/activiti/spring/SpringTransactionInterceptor.java +++ b/modules/activiti-spring/src/main/java/org/activiti/spring/SpringTransactionInterceptor.java @@ -32,9 +32,11 @@ public class SpringTransactionInterceptor implements CommandInterceptor { this.transactionManager = transactionManager; } + @SuppressWarnings("unchecked") public <T> T invoke(final CommandExecutor next, final Command<T> command) { - @SuppressWarnings("unchecked") - T result = (T) new TransactionTemplate(transactionManager).execute(new TransactionCallback() { + TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); + transactionTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); + T result = (T) transactionTemplate.execute(new TransactionCallback() { public Object doInTransaction(TransactionStatus status) { return next.execute(command); }
ACT-<I> explicitely set the spring transaction propagation to requires new
Activiti_Activiti
train
java
be0d891d9270cd8bd409386a2a53307bea87a40a
diff --git a/src/App.php b/src/App.php index <HASH>..<HASH> 100644 --- a/src/App.php +++ b/src/App.php @@ -565,6 +565,23 @@ class App { } /** + * Returns the URL of the current request with a query parameter indicating the current locale (if any) + * + * @return string the URL with a query parameter indicating the current locale (if any) + */ + public function currentUrlWithLang() { + if (isset($this->i18n)) { + $locale = $this->i18n->getLocale(); + + if (!empty($locale)) { + return $this->currentUrlWithParams([ 'lang' => $locale ]); + } + } + + return $this->currentUrl(); + } + + /** * Returns the URL of the current request with the supplied parameters in the query * * @return string the URL with the supplied parameters in the query
Implement method 'currentUrlWithLang' in class 'App'
delight-im_PHP-Foundation-Core
train
php
283128aeab39bfb2932b1bc538add02bea6cf1e3
diff --git a/service/debugger/debugger.go b/service/debugger/debugger.go index <HASH>..<HASH> 100644 --- a/service/debugger/debugger.go +++ b/service/debugger/debugger.go @@ -538,7 +538,7 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er } if err != nil { - if exitedErr, exited := err.(proc.ProcessExitedError); withBreakpointInfo && exited { + if exitedErr, exited := err.(proc.ProcessExitedError); (command.Name == api.Continue || command.Name == api.Rewind) && exited { state := &api.DebuggerState{} state.Exited = true state.ExitStatus = exitedErr.Status
service/debugger: revert Next/StepOut/Step behavior on exit When the process exits during we used to return an error, but after commit 8bbcc<I>f<I>e7bb2b6d9c<I>fa<I>d<I>e<I>f we move the error into state.Err. Revert this behavior change.
go-delve_delve
train
go
68b72138c1b64391140fc7f611f6bd193a775abb
diff --git a/src/DataStore/src/DataStore/Traits/MappingFieldsTrait.php b/src/DataStore/src/DataStore/Traits/MappingFieldsTrait.php index <HASH>..<HASH> 100644 --- a/src/DataStore/src/DataStore/Traits/MappingFieldsTrait.php +++ b/src/DataStore/src/DataStore/Traits/MappingFieldsTrait.php @@ -108,6 +108,28 @@ trait MappingFieldsTrait } /** + * @param $fields + */ + public function setFields($fields) + { + if (property_exists($this, 'fields')) { + $this->fields = $fields; + } + } + + /** + * @param $key + * + * @param $value + */ + public function addField($key, $value) + { + if (property_exists($this, 'fields')) { + $this->fields[$key] = $value; + } + } + + /** * Преобразовывает данные в нужный тип * * @param $type
added setFields and addField methods to MappingFielsTrait
rollun-com_rollun-datastore
train
php
8cde063f82eabfd655ad05df8149721124193a4a
diff --git a/upup/pkg/fi/cloudup/awstasks/block_device_mappings.go b/upup/pkg/fi/cloudup/awstasks/block_device_mappings.go index <HASH>..<HASH> 100644 --- a/upup/pkg/fi/cloudup/awstasks/block_device_mappings.go +++ b/upup/pkg/fi/cloudup/awstasks/block_device_mappings.go @@ -112,7 +112,6 @@ func (i *BlockDeviceMapping) ToAutoscaling(deviceName string) *autoscaling.Block Encrypted: i.EbsEncrypted, VolumeSize: i.EbsVolumeSize, VolumeType: i.EbsVolumeType, - Iops: i.EbsVolumeIops, } if fi.StringValue(o.Ebs.VolumeType) == ec2.VolumeTypeIo1 { o.Ebs.Iops = i.EbsVolumeIops
- removing the unrequired line
kubernetes_kops
train
go
0a76c4d6a92aecf7912bd0865db2c74a46cfd3c5
diff --git a/clients/java/src/test/java/com/thoughtworks/selenium/ClientDriverSuite.java b/clients/java/src/test/java/com/thoughtworks/selenium/ClientDriverSuite.java index <HASH>..<HASH> 100644 --- a/clients/java/src/test/java/com/thoughtworks/selenium/ClientDriverSuite.java +++ b/clients/java/src/test/java/com/thoughtworks/selenium/ClientDriverSuite.java @@ -59,6 +59,11 @@ public class ClientDriverSuite extends TestCase { TestSuite supersuite = new TestSuite(ClientDriverSuite.class .getName()); TestSuite suite = new TestSuite(ClientDriverSuite.class.getName()); + + + if (!isProxyInjectionMode) { + + if (isProxyInjectionMode && "*piiexplore".equals(forcedBrowserMode)) { // once frames support is added to the main trunk, we will be // able to run the following in non-proxy injection mode: @@ -108,6 +113,11 @@ public class ClientDriverSuite extends TestCase { suite.addTestSuite(TestWaitInPopupWindow.class); suite.addTestSuite(TestWaitFor.class); suite.addTestSuite(TestWaitForNot.class); + + + } + + ClientDriverTestSetup setup = new ClientDriverTestSetup(suite); supersuite.addTest(setup); return supersuite;
stop PI tests, for the hundredth time r<I>
SeleniumHQ_selenium
train
java
d742df5616f263b118b96009f00a212b61051a0a
diff --git a/core/server/master/src/main/java/alluxio/master/file/FileSystemMasterClientRestServiceHandler.java b/core/server/master/src/main/java/alluxio/master/file/FileSystemMasterClientRestServiceHandler.java index <HASH>..<HASH> 100644 --- a/core/server/master/src/main/java/alluxio/master/file/FileSystemMasterClientRestServiceHandler.java +++ b/core/server/master/src/main/java/alluxio/master/file/FileSystemMasterClientRestServiceHandler.java @@ -226,12 +226,9 @@ public final class FileSystemMasterClientRestServiceHandler { @Path(GET_NEW_BLOCK_ID_FOR_FILE) @ReturnType("java.lang.Long") public Response getNewBlockIdForFile(@QueryParam("path") final String path) { - return RestUtils.call(new RestUtils.RestCallable<Long>() { - @Override - public Long call() throws Exception { - Preconditions.checkNotNull(path, "required 'path' parameter is missing"); - return mFileSystemMaster.getNewBlockIdForFile(new AlluxioURI(path)); - } + return RestUtils.call(() -> { + Preconditions.checkNotNull(path, "required 'path' parameter is missing"); + return mFileSystemMaster.getNewBlockIdForFile(new AlluxioURI(path)); }); } /**
[SMALLFIX] replace anonymous type with lambda (#<I>)
Alluxio_alluxio
train
java
0b118b71143c660ba7ce4cd2e05ec67383ea9964
diff --git a/domain.go b/domain.go index <HASH>..<HASH> 100644 --- a/domain.go +++ b/domain.go @@ -1903,7 +1903,8 @@ type DomainFeatureHyperV struct { } type DomainFeatureKVM struct { - Hidden *DomainFeatureState `xml:"hidden"` + Hidden *DomainFeatureState `xml:"hidden"` + HintDedicated *DomainFeatureState `xml:"hint-dedicated"` } type DomainFeatureGIC struct {
Add support for domain KVM dedicated hint
libvirt_libvirt-go-xml
train
go
dc7c266f1f188a92379efd676edb72210338fee1
diff --git a/lib/OpenLayers/Layer/MapServer.js b/lib/OpenLayers/Layer/MapServer.js index <HASH>..<HASH> 100644 --- a/lib/OpenLayers/Layer/MapServer.js +++ b/lib/OpenLayers/Layer/MapServer.js @@ -1,7 +1,7 @@ /* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full * text of the license. */ -// @require: OpenLayers/Layer/Grid.js +// @requires OpenLayers/Layer/Grid.js /** * @class */
Fix requires statement. Single file build of OpenLayers broken prior to this. (Thx jrf) git-svn-id: <URL>
openlayers_openlayers
train
js
f0599ceb7de54b2585bb0d93999e37a8be249fb6
diff --git a/calendarium/models.py b/calendarium/models.py index <HASH>..<HASH> 100644 --- a/calendarium/models.py +++ b/calendarium/models.py @@ -46,9 +46,8 @@ class EventModelManager(models.Manager): # get all occurrences for those events that don't already have a # persistent match and that lie in this period. - all_occurrences = [] - for event in relevant_events: - all_occurrences.extend(event.get_occurrences(start, end)) + all_occurrences = [ + event.get_occurrences(start, end) for event in relevant_events] # sort and return return sorted(all_occurrences, key=lambda x: x.start) @@ -163,8 +162,7 @@ class Event(EventModelMixin): # check if event is in the period if self.start < end and self.end >= start: return [self._create_occurrence(self.start, self.end)] - else: - return [] + return [] def get_occurrences(self, start, end): """Returns all occurrences from start to end."""
codereview suggestions for ef<I>
bitlabstudio_django-calendarium
train
py
95f915808b9dfa7b2a61a5468bcc4f14a4e19b45
diff --git a/src/main/java/graphql/execution/ExecutionStrategy.java b/src/main/java/graphql/execution/ExecutionStrategy.java index <HASH>..<HASH> 100644 --- a/src/main/java/graphql/execution/ExecutionStrategy.java +++ b/src/main/java/graphql/execution/ExecutionStrategy.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; +import java.util.concurrent.CompletionStage; import static graphql.execution.ExecutionTypeInfo.newTypeInfo; import static graphql.execution.FieldCollectorParameters.newParameters; @@ -208,8 +209,8 @@ public abstract class ExecutionStrategy { dataFetcher = instrumentation.instrumentDataFetcher(dataFetcher, instrumentationFieldFetchParams); try { Object fetchedValueRaw = dataFetcher.get(environment); - if (fetchedValueRaw instanceof CompletableFuture) { - fetchedValue = (CompletableFuture<?>) fetchedValueRaw; + if (fetchedValueRaw instanceof CompletionStage) { + fetchedValue = ((CompletionStage) fetchedValueRaw).toCompletableFuture(); } else { fetchedValue = CompletableFuture.completedFuture(fetchedValueRaw); }
accept `CompletionStage` to be returned from `DataFetcher`, not only `CompletableFuture`
graphql-java_graphql-java
train
java
ebf33a333e9f7ad46f37233eee843e31028a1d62
diff --git a/python/pyspark/ml/fpm.py b/python/pyspark/ml/fpm.py index <HASH>..<HASH> 100644 --- a/python/pyspark/ml/fpm.py +++ b/python/pyspark/ml/fpm.py @@ -21,7 +21,7 @@ from pyspark.ml.util import * from pyspark.ml.wrapper import JavaEstimator, JavaModel, JavaParams, _jvm from pyspark.ml.param.shared import * -__all__ = ["FPGrowth", "FPGrowthModel"] +__all__ = ["FPGrowth", "FPGrowthModel", "PrefixSpan"] class HasMinSupport(Params): @@ -313,14 +313,15 @@ class PrefixSpan(JavaParams): def findFrequentSequentialPatterns(self, dataset): """ .. note:: Experimental + Finds the complete set of frequent sequential patterns in the input sequences of itemsets. :param dataset: A dataframe containing a sequence column which is `ArrayType(ArrayType(T))` type, T is the item type for the input dataset. :return: A `DataFrame` that contains columns of sequence and corresponding frequency. The schema of it will be: - - `sequence: ArrayType(ArrayType(T))` (T is the item type) - - `freq: Long` + - `sequence: ArrayType(ArrayType(T))` (T is the item type) + - `freq: Long` >>> from pyspark.ml.fpm import PrefixSpan >>> from pyspark.sql import Row
[SAPRK-<I>][ML] add prefix to __all__ in fpm.py ## What changes were proposed in this pull request? jira: <URL>
apache_spark
train
py
d6cf797c1deb4eb93541e6494ff4b7ab2d049d9d
diff --git a/Lib/fontmake/font_project.py b/Lib/fontmake/font_project.py index <HASH>..<HASH> 100644 --- a/Lib/fontmake/font_project.py +++ b/Lib/fontmake/font_project.py @@ -438,9 +438,19 @@ class FontProject(object): ufo_order = [glyph_name for glyph_name in ufo.lib[PUBLIC_PREFIX + 'glyphOrder'] if glyph_name in ufo] - for old_name, new_name in zip( - ufo_order, - TTFont(otf_path).getGlyphOrder()): + ot_order = TTFont(otf_path).getGlyphOrder() + + # An OpenType binary usually has the .notdef glyph as the first glyph, + # which might or might not be present in the UFO, and not necessarily as + # the first glyph. Manipulate the order to make glyph names match up in + # the loop below. + if ".notdef" in ufo: + ufo_order.pop(ufo_order.index(".notdef")) + ufo_order.insert(0, ".notdef") + else: + ot_order = ot_order[1:] # Strip out ".notdef" + + for old_name, new_name in zip(ufo_order, ot_order): glyph = ufo[old_name] if ((keep_glyphs and old_name not in keep_glyphs) or not glyph.lib.get(GLYPHS_PREFIX + 'Glyphs.Export', True)):
subset_otf_from_ufo: Handle .notdef glyph The glyph names of UFO anf OT binary need to match up for the export flag testing to work. The .notdef glyph must be handled specially because it is usually the first glyph in the OT, but might not be present or in the first glyph slot in the UFO.
googlefonts_fontmake
train
py
bbbbb01264afff515c7839b0bbd08124c6bd8a50
diff --git a/molgenis-data/src/main/java/org/molgenis/data/meta/system/SystemEntityMetaDataRegistry.java b/molgenis-data/src/main/java/org/molgenis/data/meta/system/SystemEntityMetaDataRegistry.java index <HASH>..<HASH> 100644 --- a/molgenis-data/src/main/java/org/molgenis/data/meta/system/SystemEntityMetaDataRegistry.java +++ b/molgenis-data/src/main/java/org/molgenis/data/meta/system/SystemEntityMetaDataRegistry.java @@ -59,11 +59,6 @@ public class SystemEntityMetaDataRegistry { for (AttributeMetaData attr : attrs) { - if (attr.getIdentifier() == null) - { - continue; // FIXME this happens for EntityMetaDataMetaData i18n attrs - } - if (attr.getIdentifier().equals(attrIdentifier)) { return attr;
Remove workaround for attribute identifier being null
molgenis_molgenis
train
java
09b022e9263f8bab28928986656839ec9477b77e
diff --git a/common/src/main/java/io/netty/util/ResourceLeakDetector.java b/common/src/main/java/io/netty/util/ResourceLeakDetector.java index <HASH>..<HASH> 100644 --- a/common/src/main/java/io/netty/util/ResourceLeakDetector.java +++ b/common/src/main/java/io/netty/util/ResourceLeakDetector.java @@ -20,8 +20,8 @@ import io.netty.logging.InternalLogger; import io.netty.logging.InternalLoggerFactory; import io.netty.util.internal.SystemPropertyUtil; +import java.lang.ref.PhantomReference; import java.lang.ref.ReferenceQueue; -import java.lang.ref.WeakReference; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; @@ -131,6 +131,8 @@ public final class ResourceLeakDetector<T> { break; } + ref.clear(); + if (!ref.close()) { continue; } @@ -141,7 +143,7 @@ public final class ResourceLeakDetector<T> { } } - private final class DefaultResourceLeak extends WeakReference<Object> implements ResourceLeak { + private final class DefaultResourceLeak extends PhantomReference<Object> implements ResourceLeak { private final ResourceLeakException exception; private final AtomicBoolean freed;
Use PhantomReference insteadof WeakReference for resource leak detection
netty_netty
train
java
36f0d6f553c02c5937af94541463d30656537615
diff --git a/natsort/natsort.py b/natsort/natsort.py index <HASH>..<HASH> 100644 --- a/natsort/natsort.py +++ b/natsort/natsort.py @@ -9,11 +9,16 @@ The majority of the "work" is defined in utils.py. import platform from functools import partial from operator import itemgetter +from typing import Callable, Iterable, TypeVar + +from _typeshed import SupportsLessThan import natsort.compat.locale from natsort import utils from natsort.ns_enum import NS_DUMB, ns +_T = TypeVar("_T") + def decoder(encoding): """ @@ -212,7 +217,7 @@ natsort_keygen """ -def natsorted(seq, key=None, reverse=False, alg=ns.DEFAULT): +def natsorted(seq: Iterable[_T], key: Callable[[_T], SupportsLessThan]=None, reverse=False, alg=ns.DEFAULT): """ Sorts an iterable naturally.
Support Type Hinting Added support for type hinting for consistency with `sorted` from builtints. This allows Iterables of Custom Objects to be typed.
SethMMorton_natsort
train
py
72d0843cc6a9c0889d03e6684870818d9736c16a
diff --git a/SoftLayer/CLI/routes.py b/SoftLayer/CLI/routes.py index <HASH>..<HASH> 100644 --- a/SoftLayer/CLI/routes.py +++ b/SoftLayer/CLI/routes.py @@ -38,7 +38,7 @@ ALL_ROUTES = [ ('dedicatedhost:create-options', 'SoftLayer.CLI.dedicatedhost.create_options:cli'), ('dedicatedhost:detail', 'SoftLayer.CLI.dedicatedhost.detail:cli'), ('dedicatedhost:cancel', 'SoftLayer.CLI.dedicatedhost.cancel:cli'), - ('dedicatedhost:cancel-all-guests', 'SoftLayer.CLI.dedicatedhost.cancel_guests:cli'), + ('dedicatedhost:cancel-guests', 'SoftLayer.CLI.dedicatedhost.cancel_guests:cli'), ('dedicatedhost:list-guests', 'SoftLayer.CLI.dedicatedhost.list_guests:cli'), ('cdn', 'SoftLayer.CLI.cdn'),
rename cancel-all-guest by cancel-guests
softlayer_softlayer-python
train
py
a1843cedaa9a154eedb362af576edcafaba378d1
diff --git a/src/main/java/gov/adlnet/xapi/client/BaseClient.java b/src/main/java/gov/adlnet/xapi/client/BaseClient.java index <HASH>..<HASH> 100644 --- a/src/main/java/gov/adlnet/xapi/client/BaseClient.java +++ b/src/main/java/gov/adlnet/xapi/client/BaseClient.java @@ -258,7 +258,7 @@ public class BaseClient { // When retrieving 'more' statements, LRS will return full path..the client will have part in the URI already so cut that off protected String checkPath(String path){ - if (path.toLowerCase().contains(this._host.getPath().toLowerCase())){ + if (path.toLowerCase().contains("statements") && path.toLowerCase().contains("more")){ int pathLength = this._host.getPath().length(); return path.substring(pathLength, path.length()); }
made sure it fixes on only the statements more url in baseclient
adlnet_jxapi
train
java
7476022c64c54263f4f347984063d083a9b165c2
diff --git a/host/cli/inspect.go b/host/cli/inspect.go index <HASH>..<HASH> 100644 --- a/host/cli/inspect.go +++ b/host/cli/inspect.go @@ -26,6 +26,7 @@ func runInspect(args *docopt.Args, client cluster.Host) error { fmt.Fprintln(w, "StartedAt\t", job.StartedAt) fmt.Fprintln(w, "EndedAt\t", job.EndedAt) fmt.Fprintln(w, "ExitStatus\t", job.ExitStatus) + fmt.Fprintln(w, "IP Address\t", job.InternalIP) for k, v := range job.Job.Metadata { fmt.Fprintln(w, k, "\t", v) }
host: Include IP Address in flynn-host inspect output
flynn_flynn
train
go
5d6c043a39a218ad05e1e251ecdd6feaf0082c04
diff --git a/lib/weblib.php b/lib/weblib.php index <HASH>..<HASH> 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1665,10 +1665,11 @@ function notice_yesno ($message, $linkyes, $linkno) { } function redirect($url, $message="", $delay="0") { -// Uses META tags to redirect the user, after printing a notice +// Redirects the user to another page, after printing a notice if (empty($message)) { - echo "<html><head><meta http-equiv=\"refresh\" content=\"$delay; url=$url\" /></head></html>"; + sleep($delay); + header("Location: $url"); } else { if (empty($delay)) { $delay = 3; // There's no point having a message with no delay
Using Location header is not subject to the meta-refresh bug in Mozilla
moodle_moodle
train
php
079632d70278605893e7c6c156c6c1c49d1e2d76
diff --git a/lib/affine/cipher.rb b/lib/affine/cipher.rb index <HASH>..<HASH> 100644 --- a/lib/affine/cipher.rb +++ b/lib/affine/cipher.rb @@ -16,6 +16,8 @@ module Affine (@a_inv * (ciphertext - @b_key)) % @modulus end + alias_method :encrypt, :encipher + alias_method :decrypt, :decipher private # from http://snippets.dzone.com/posts/show/6074 def extended_gcd(b,m,_recursion_depth=0)
encrypt and decrypt method/aliases
bkerley_affine
train
rb
e9886807eff4a8bbf097d034f9c117cb12942a01
diff --git a/common/src/test/java/org/cloudfoundry/identity/uaa/test/IntegrationTestContextLoader.java b/common/src/test/java/org/cloudfoundry/identity/uaa/test/IntegrationTestContextLoader.java index <HASH>..<HASH> 100644 --- a/common/src/test/java/org/cloudfoundry/identity/uaa/test/IntegrationTestContextLoader.java +++ b/common/src/test/java/org/cloudfoundry/identity/uaa/test/IntegrationTestContextLoader.java @@ -58,9 +58,9 @@ public class IntegrationTestContextLoader implements SmartContextLoader { servletConfig.addInitParameter("environmentConfigDefaults", environmentConfigDefaults()); context.setServletContext(servletContext); context.setServletConfig(servletConfig); + new YamlServletProfileInitializer().initialize(context); context.setConfigLocations(mergedConfig.getLocations()); context.register(mergedConfig.getClasses()); - new YamlServletProfileInitializer().initialize(context); context.refresh(); context.registerShutdownHook(); return context;
Initialize context before loading bean definitions during tests This more closely resembles production behavior [#<I>] <URL>
cloudfoundry_uaa
train
java
f8ba86b334b40fd02d0d886908c4b1f00116e060
diff --git a/xenserver/vm_vdi_cleaner.py b/xenserver/vm_vdi_cleaner.py index <HASH>..<HASH> 100755 --- a/xenserver/vm_vdi_cleaner.py +++ b/xenserver/vm_vdi_cleaner.py @@ -27,17 +27,17 @@ if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) +from nova import config from nova import context from nova import db from nova import exception from nova import flags -from nova.openstack.common import cfg from nova.openstack.common import timeutils from nova.virt.xenapi import driver as xenapi_driver -CONF = cfg.CONF -flags.DECLARE("resize_confirm_window", "nova.compute.manager") +CONF = config.CONF +CONF.import_opt("resize_confirm_window", "nova.compute.manager") ALLOWED_COMMANDS = ["list-vdis", "clean-vdis", "list-instances",
Remove flags.DECLARE The cfg.ConfigOpts class has an equivalent method, so lets use that. Change-Id: I<I>d<I>d<I>a0ffd<I>c<I>ff<I>
openstack_hacking
train
py
bc8aea4fe96d7c044d28c8e7b292705d1cdaac96
diff --git a/hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java b/hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java +++ b/hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java @@ -514,7 +514,7 @@ class MapServiceContextImpl implements MapServiceContext { @Override public Object toObject(Object data) { - return nodeEngine.toObject(data); + return serializationService.toObject(data); } @Override @@ -524,7 +524,7 @@ class MapServiceContextImpl implements MapServiceContext { @Override public Data toData(Object object) { - return nodeEngine.toData(object); + return serializationService.toData(object); } @Override
MapServiceContextImpl making use of SerializationService directly No point on going through Node and then to SerializationService.
hazelcast_hazelcast
train
java
49074d12e778d682bbfd6f88e066000890da35e7
diff --git a/dallinger/data.py b/dallinger/data.py index <HASH>..<HASH> 100644 --- a/dallinger/data.py +++ b/dallinger/data.py @@ -223,7 +223,9 @@ def archive_data(id, src, dst): with ZipFile(dst, 'w', ZIP_DEFLATED, allowZip64=True) as zf: for root, dirs, files in os.walk(src): for file in files: - zf.write(os.path.join(root, file)) + filename = os.path.join(root, file) + arcname = filename.replace(src, '').lstrip('/') + zf.write(filename, arcname) shutil.rmtree(src) print("Done. Data available in {}-data.zip".format(id))
Write export zip file to format expected by Data clas
Dallinger_Dallinger
train
py
5595ea875d78aa921c4b0fbd714f9383f114a246
diff --git a/models/classes/user/GenerisUserService.php b/models/classes/user/GenerisUserService.php index <HASH>..<HASH> 100644 --- a/models/classes/user/GenerisUserService.php +++ b/models/classes/user/GenerisUserService.php @@ -38,7 +38,8 @@ class GenerisUserService extends ConfigurableService implements UserService { $searchService = $this->getServiceLocator()->get(Search::SERVICE_ID); $result = $searchService->query($searchString, TaoOntology::CLASS_URI_TAO_USER); - return $this->getUsers($result); + $users = array_column(iterator_to_array($result), 'id'); + return $this->getUsers($users); } /**
fix: restored compatibility with changed return stuctures
oat-sa_tao-core
train
php
e29c32e5765524a743752fe1a036e0561a74bd25
diff --git a/xhtml2pdf/w3c/css.py b/xhtml2pdf/w3c/css.py index <HASH>..<HASH> 100644 --- a/xhtml2pdf/w3c/css.py +++ b/xhtml2pdf/w3c/css.py @@ -689,6 +689,14 @@ class CSSTerminalOperator(tuple): class CSSDeclarations(dict): pass + def __eq__(self, other): + """Python 3""" + return False + + def __lt__(self, other): + """Python 3""" + return False + class CSSRuleset(dict): def findCSSRulesFor(self, element, attrName):
more comparability for CSS stuff py3k
xhtml2pdf_xhtml2pdf
train
py
9fd96e5a1aaff29a75e398d1f3a435891667b197
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb index <HASH>..<HASH> 100644 --- a/lib/chef/resource/registry_key.rb +++ b/lib/chef/resource/registry_key.rb @@ -127,14 +127,15 @@ class Chef property :values, [Hash, Array], default: [], coerce: proc { |v| - case v - when Hash - @unscrubbed_values = [ Mash.new(v).symbolize_keys ] - when Array - @unscrubbed_values = v.map { |value| Mash.new(value).symbolize_keys } - else - @unscrubbed_values = [] - end + @unscrubbed_values = + case v + when Hash + [ Mash.new(v).symbolize_keys ] + when Array + v.map { |value| Mash.new(value).symbolize_keys } + else + raise ArgumentError, "Bad type for RegistryKey resource, use Hash or Array" + end scrub_values(@unscrubbed_values) }, callbacks: {
raise in coerce block if type is incorrect
chef_chef
train
rb
8691867fd66e26d61899a97769a3223ba99e3911
diff --git a/symphony/lib/lang/transliterations.php b/symphony/lib/lang/transliterations.php index <HASH>..<HASH> 100755 --- a/symphony/lib/lang/transliterations.php +++ b/symphony/lib/lang/transliterations.php @@ -53,6 +53,7 @@ '¿' => null, '‽' => null, '¡' => null, '©' => 'c', '«' => '"', '»' => '"', '™' => 'TM', '®' => 'r', '|' => '-', + '.' => '-', // Special characters 'Nº' => 'number',
Transliterate dots to dashed Closes #<I>
symphonycms_symphony-2
train
php
a789b1f6225c685f98804f9bd0bf9ba82187c060
diff --git a/src/MountManager.php b/src/MountManager.php index <HASH>..<HASH> 100644 --- a/src/MountManager.php +++ b/src/MountManager.php @@ -223,7 +223,7 @@ class MountManager implements FilesystemOperator $destinationPath, $source, $destination - ) : $this->moveAcrossFilesystems($source, $destination); + ) : $this->moveAcrossFilesystems($source, $destination, $config); } public function copy(string $source, string $destination, array $config = []): void @@ -348,10 +348,10 @@ class MountManager implements FilesystemOperator } } - private function moveAcrossFilesystems(string $source, string $destination): void + private function moveAcrossFilesystems(string $source, string $destination, array $config = []): void { try { - $this->copy($source, $destination); + $this->copy($source, $destination, $config); $this->delete($source); } catch (UnableToCopyFile | UnableToDeleteFile $exception) { throw UnableToMoveFile::fromLocationTo($source, $destination, $exception);
Enable use of $config option in MergeManager::move() Updated MergeManager::move() to use the $config parameter, by passing it through to moveAcrossFilesystems() Added $config parameter to MergeManager::moveAcrossFilesystems() and pass it through to MergeManager::copy()
thephpleague_flysystem
train
php
0102b8733d0c5fd8fd0bc857f2407d99261f9c01
diff --git a/thymeleaf-testing/src/main/java/org/thymeleaf/testing/templateengine/context/web/JavaxServletTestWebExchangeBuilder.java b/thymeleaf-testing/src/main/java/org/thymeleaf/testing/templateengine/context/web/JavaxServletTestWebExchangeBuilder.java index <HASH>..<HASH> 100755 --- a/thymeleaf-testing/src/main/java/org/thymeleaf/testing/templateengine/context/web/JavaxServletTestWebExchangeBuilder.java +++ b/thymeleaf-testing/src/main/java/org/thymeleaf/testing/templateengine/context/web/JavaxServletTestWebExchangeBuilder.java @@ -128,11 +128,9 @@ public class JavaxServletTestWebExchangeBuilder implements ITestWebExchangeBuild .build(); final HttpSession httpSession = - (sessionAttributes != null && !sessionAttributes.isEmpty())? - JavaxServletMockUtils.buildSession(servletContext) - .attributeMap(sessionAttributes) - .build() - : null; + JavaxServletMockUtils.buildSession(servletContext) + .attributeMap(sessionAttributes) + .build(); final HttpServletResponse httpServletResponse = JavaxServletMockUtils.buildResponse()
Test mock servlet artifacts should always have a session (javax)
thymeleaf_thymeleaf
train
java
95c58269b998a1544697b1464fca749e5d318296
diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_subscription_filter_test.go b/builtin/providers/aws/resource_aws_cloudwatch_log_subscription_filter_test.go index <HASH>..<HASH> 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_log_subscription_filter_test.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_log_subscription_filter_test.go @@ -103,7 +103,7 @@ func testAccAWSCloudwatchLogSubscriptionFilterConfig(rstring string) string { return fmt.Sprintf(` resource "aws_cloudwatch_log_subscription_filter" "test_lambdafunction_logfilter" { name = "test_lambdafunction_logfilter_%s" - log_group_name = "example_lambda_name" + log_group_name = "${aws_cloudwatch_log_group.logs.name}" filter_pattern = "logtype test" destination_arn = "${aws_lambda_function.test_lambdafunction.arn}" }
provider/aws: fix TestAccAWSCloudwatchLogSubscriptionFilter_basic by linking the name
hashicorp_terraform
train
go
58bf4101666edabd66778dfd9d09f2e8169ff95b
diff --git a/code/MemberProfilePage.php b/code/MemberProfilePage.php index <HASH>..<HASH> 100644 --- a/code/MemberProfilePage.php +++ b/code/MemberProfilePage.php @@ -481,7 +481,7 @@ class MemberProfilePage_Controller extends Page_Controller { if(class_exists('SpamProtectorManager')) { SpamProtectorManager::update_form($form); } - + $this->extend('updateRegisterForm', $form); return $form; } @@ -532,7 +532,7 @@ class MemberProfilePage_Controller extends Page_Controller { * @return Form */ public function ProfileForm() { - return new Form ( + $form = new Form ( $this, 'ProfileForm', $this->getProfileFields('Profile'), @@ -541,6 +541,8 @@ class MemberProfilePage_Controller extends Page_Controller { ), new MemberProfileValidator($this->Fields(), Member::currentUser()) ); + $this->extend('updateProfileForm', $form); + return $form; } /**
added extend hooks to Register and ProfileForm
symbiote_silverstripe-memberprofiles
train
php
d1769588174c0dcd0fbbb3cebb769c27a117eb7e
diff --git a/lib/weblib.php b/lib/weblib.php index <HASH>..<HASH> 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -5009,7 +5009,7 @@ function redirect($url, $message='', $delay=-1, $adminroot = '') { /// At developer debug level. Don't redirect if errors have been printed on screen. $errorprinted = false; - if (debugging('', DEBUG_DEVELOPER) && $CFG->debugdisplay && error_get_last()) { + if (debugging('', DEBUG_DEVELOPER) && $CFG->debugdisplay /* && error_get_last()*/) { $errorprinted = true; $message = "<strong>Error output, so disabling automatic redirect.</strong></p><p>" . $message; }
error_get_last() ? What's that?
moodle_moodle
train
php
f1c7902012f235962fd2c7542f07090bf66cf261
diff --git a/pngcanvas.py b/pngcanvas.py index <HASH>..<HASH> 100644 --- a/pngcanvas.py +++ b/pngcanvas.py @@ -275,8 +275,8 @@ class PNGCanvas(object): old_row = None cursor = 0 for cursor in range(0, height * row_size, row_size): - unpacked = struct.unpack(row_fmt, reader.read(step_size)) - old_row = self.defilter(unpacked[1:], old_row, filter_type) + unpacked = list(struct.unpack(row_fmt, reader.read(step_size))) + old_row = self.defilter(unpacked[1:], old_row, unpacked[0]) self.canvas[cursor:cursor + row_size] = old_row @staticmethod
Fix call to defilter in image loading. The current loading code uses the image header filter type, however it should really use the filter type at the start of the scan line. Additionally, the defilter code updates the row in-place, which means it must be passed a list, not a tuple.
rcarmo_pngcanvas
train
py
d0f476349ac96faf6cf5a054e3494e8a8b1d2fe0
diff --git a/utils/configv3/color.go b/utils/configv3/color.go index <HASH>..<HASH> 100644 --- a/utils/configv3/color.go +++ b/utils/configv3/color.go @@ -3,7 +3,7 @@ package configv3 import "strconv" const ( - DefaultColorEnabled = "true" + DefaultColorEnabled = "" // ColorDisabled means that no colors/bolding will be displayed ColorDisabled ColorSetting = iota // ColorEnabled means colors/bolding will be displayed
change default to empty [Finished #<I>]
cloudfoundry_cli
train
go
f81d06b366d32a00a36ef145e53c543c0307dcd4
diff --git a/internetarchive/cli/ia.py b/internetarchive/cli/ia.py index <HASH>..<HASH> 100755 --- a/internetarchive/cli/ia.py +++ b/internetarchive/cli/ia.py @@ -120,7 +120,7 @@ def main(): config['logging'] = {'level': 'DEBUG'} if args['--insecure']: - config['secure'] = False + config['general'] = dict(secure=False) session = get_session(config_file=args['--config-file'], config=config,
Fixed --insecure bug. --insecure was not making requests HTTP due to a bad config setting.
jjjake_internetarchive
train
py
0e282cde6359aea0fe1987120dfa4b18d1df8764
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -142,9 +142,15 @@ Engines.prototype.decorate = function(engine) { * @return {Object} Options object with merged helpers */ - function mergeHelpers(engine, opts) { + function mergeHelpers(engine, options) { /*jshint validthis:true */ + if (typeof options !== 'object') { + var msg = expected('mergeHelpers', 'options').toBe('object'); + throw new TypeError(msg); + } + try { + var opts = utils.merge({}, options); var helpers = utils.merge({}, engine.helpers, opts.helpers); if (typeof helpers === 'object') { for (var key in helpers) { @@ -262,9 +268,15 @@ Engines.prototype.decorate = function(engine) { } if (typeof str === 'string') { + var tmp = opts.async; opts.async = true; fn = this.compile(str, opts); - return fn(opts, cb); + + return fn(opts, function(err, content) { + opts.async = tmp; + if (err) return cb(err); + cb(null, content); + }); } msg = expected('render', 'str').toBe(['string', 'compiled function']);
handle multiple calls to compile/render with some being sync and some being async
jonschlinkert_engine-cache
train
js
8a4328626dcf7378fff056941893970f25633fda
diff --git a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py index <HASH>..<HASH> 100644 --- a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py +++ b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py @@ -18,6 +18,7 @@ import shutil import sys import tempfile from textwrap import dedent +import sys try: from unittest.mock import Mock except ImportError: @@ -45,6 +46,12 @@ from spyder.plugins.ipythonconsole.utils.style import create_style_class from spyder.utils.programs import get_temp_dir +# Global skip +if sys.platform == 'darwin' and PY2: + pytest.skip("These tests are segfaulting too much in macOS and Python 2", + allow_module_level=True) + + # ============================================================================= # Constants # =============================================================================
Testing: Skip IPython console tests in macOS and Python 2
spyder-ide_spyder
train
py
02eb16f0eb2cdc0015972ce963357aaa1cd0b84b
diff --git a/test_path.py b/test_path.py index <HASH>..<HASH> 100644 --- a/test_path.py +++ b/test_path.py @@ -1097,7 +1097,7 @@ class TestInPlace: with doc.in_place() as (reader, writer): writer.write(self.alternate_content) raise RuntimeError("some error") - assert "some error" in str(exc) + assert "some error" in str(exc.value) with doc.open() as stream: data = stream.read() assert 'Lorem' not in data
Correct usage of exception resolution from exception info context. Fixes #<I>.
jaraco_path.py
train
py
c50cad526929862e89dd1f68d325ee08b3523cb8
diff --git a/src/main/java/org/jdbdt/Row.java b/src/main/java/org/jdbdt/Row.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jdbdt/Row.java +++ b/src/main/java/org/jdbdt/Row.java @@ -35,7 +35,7 @@ final class Row { * Get data for this row. * @return The data representing the columns of this row. */ - public Object[] data() { + Object[] data() { return data; } @@ -43,7 +43,7 @@ final class Row { * Get row length. * @return the number of columns in the database row. */ - public int length() { + int length() { return data.length; }
Row: some methods were public without need
JDBDT_jdbdt
train
java
918b8889134e8f1a5a2644eef8a9e699768fbebd
diff --git a/src/Exscript/Interpreter/Code.py b/src/Exscript/Interpreter/Code.py index <HASH>..<HASH> 100644 --- a/src/Exscript/Interpreter/Code.py +++ b/src/Exscript/Interpreter/Code.py @@ -90,7 +90,7 @@ class Code(Scope): if lexer.next_if('close_curly_bracket'): if isinstance(parent, Template.Template): break - self.add(Exscript.Exscript(lexer, parser, self)) + self.add(Template.Template(lexer, parser, self)) elif lexer.current_is('keyword', 'append'): self.add(Append(lexer, parser, self)) elif lexer.current_is('keyword', 'extract'):
fix: the exscript cli app broke due to a broken name in the parser.
knipknap_exscript
train
py
9a4ae02b40e82236c6aaad6e3e2fee3978839be1
diff --git a/service/runner_builder.go b/service/runner_builder.go index <HASH>..<HASH> 100644 --- a/service/runner_builder.go +++ b/service/runner_builder.go @@ -7,6 +7,8 @@ import ( "strings" ) +var ServiceFlag = flag.String("service", "", "Control the system service.") + func NewServiceRunnerBuilder(serviceName string, runHandler RunHandler) ServiceRunnerBuilder { if strings.TrimSpace(serviceName) == "" { panic("The service name cannot be blank in NewServiceRunnerBuilder") @@ -78,8 +80,9 @@ func (b *builder) WithOnStopHandler(h OnStopHandler) ServiceRunnerBuilder { } func (b *builder) Run() { - svcFlag := flag.String("service", "", "Control the system service.") - flag.Parse() + if !flag.Parsed() { + flag.Parse() + } svcConfig := &service.Config{ Name: b.ServiceName, @@ -113,8 +116,8 @@ func (b *builder) Run() { } }() - if len(*svcFlag) != 0 { - err := service.Control(s, *svcFlag) + if len(*ServiceFlag) != 0 { + err := service.Control(s, *ServiceFlag) if err != nil { log.Printf("Valid actions: %q\n", service.ControlAction) log.Fatal(err)
Exposed the `ServiceFlag` publicly and also check to not parse a second time if already called `flag.Parse()`.
zero-boilerplate_go-api-helpers
train
go
34f737c47bd1764b81be4ebda5d93a7ee5ee1070
diff --git a/test/integration/font-optimization/test/index.test.js b/test/integration/font-optimization/test/index.test.js index <HASH>..<HASH> 100644 --- a/test/integration/font-optimization/test/index.test.js +++ b/test/integration/font-optimization/test/index.test.js @@ -11,7 +11,7 @@ import { } from 'next-test-utils' import fs from 'fs-extra' -jest.setTimeout(1000 * 30) +jest.setTimeout(1000 * 60 * 2) const appDir = join(__dirname, '../') const nextConfig = join(appDir, 'next.config.js')
Increase font test timeout for Windows (#<I>)
zeit_next.js
train
js
165511cabd2fdb5efc37c0f89ef70ae992da0fdb
diff --git a/lspreader/flds.py b/lspreader/flds.py index <HASH>..<HASH> 100644 --- a/lspreader/flds.py +++ b/lspreader/flds.py @@ -2,9 +2,8 @@ Functions for flds and sclr files. ''' import numpy as np; -from . import read; import flds as fldsm; -from lspreader import get_header; +from lspreader.lspreader import get_header,read import numpy as np; import numpy.linalg as lin; import os; diff --git a/lspreader/pext.py b/lspreader/pext.py index <HASH>..<HASH> 100644 --- a/lspreader/pext.py +++ b/lspreader/pext.py @@ -1,7 +1,6 @@ ''' Useful functions for pext files. ''' -import lspreader as rd; import numpy as np; import itertools as itools; import numpy.lib.recfunctions as rfn;
let's try to get rid of relative imports...
noobermin_lspreader
train
py,py
59c67e27297e54e3c2a342f267b60a2f904fe20a
diff --git a/src/runtime/InlineLoaderCompiler.js b/src/runtime/InlineLoaderCompiler.js index <HASH>..<HASH> 100644 --- a/src/runtime/InlineLoaderCompiler.js +++ b/src/runtime/InlineLoaderCompiler.js @@ -22,6 +22,11 @@ export class InlineLoaderCompiler extends LoaderCompiler { this.elements = elements; } + write() { + // no-op. The tree will be concatentated by evaluate and + // written by the caller of toTree(); + } + evaluateCodeUnit(codeUnit) { // Don't eval. Instead append the trees to the output. var tree = codeUnit.metadata.transformedTree;
Skip extraneous rending of the AST to transcoded source. When bundling multiple modules we concatentate the tree then write it all out to a file. Writing the individual modules from tree to transcoded source is just wasted. Review URL: <URL>
google_traceur-compiler
train
js
c3ef22304d3a70231cd11c1840fbff1cf36e024a
diff --git a/test/integration/generated_regress_test.rb b/test/integration/generated_regress_test.rb index <HASH>..<HASH> 100644 --- a/test/integration/generated_regress_test.rb +++ b/test/integration/generated_regress_test.rb @@ -129,6 +129,7 @@ class GeneratedRegressTest < MiniTest::Spec assert_instance_of Regress::TestObj, o end + # TODO: Test that callback is called should "create an instance using #new_callback" do o = Regress::TestObj.new_callback Proc.new { }, nil, nil assert_instance_of Regress::TestObj, o @@ -212,7 +213,21 @@ class GeneratedRegressTest < MiniTest::Spec should "not respond to #static_method" do assert_raises(NoMethodError) { @o.static_method 1 } end + # TODO: Test instance's fields and properies. end + + describe "its 'test' signal" do + it "properly passes its arguments" do + a = b = nil + o = Regress::TestSubObj.new + GObject.signal_connect(o, "test", 2) { |i, d| a = d; b = i } + GObject.signal_emit o, "test" + # TODO: store o's identity somewhere so we can make o == b. + assert_equal [2, o.to_ptr], [a, b.to_ptr] + end + end + + # TODO: Test other signals. end context "the Regress::TestSimpleBoxedA class" do
Remove superfluous surrounding test class.
mvz_gir_ffi
train
rb
e49ee54f4769a0d16a85a7950eaad8e0ba178ec5
diff --git a/lib/RMagick.rb b/lib/RMagick.rb index <HASH>..<HASH> 100644 --- a/lib/RMagick.rb +++ b/lib/RMagick.rb @@ -1,4 +1,4 @@ -# $Id: RMagick.rb,v 1.21 2004/09/01 22:49:49 rmagick Exp $ +# $Id: RMagick.rb,v 1.22 2004/10/06 22:23:49 rmagick Exp $ #============================================================================== # Copyright (C) 2004 by Timothy P. Hunter # Name: RMagick.rb @@ -92,7 +92,8 @@ class Geometry def to_s str = '' str << sprintf("%g", @width) if @width > 0 - str << sprintf("x%g", @height) if @height > 0 + str << 'x' if (@width > 0 || @height > 0) + str << sprintf("%g", @height) if @height > 0 str << sprintf("%+d%+d", @x, @y) if (@x != 0 || @y != 0) str << FLAGS[@flag.to_i] end
Fix Geometry#to_s to generate "Wx" when only the width argument is specified.
rmagick_rmagick
train
rb
54205be08522ff349db58dec244c2d4c9d5da396
diff --git a/lib/chore/consumers/sqs_consumer.rb b/lib/chore/consumers/sqs_consumer.rb index <HASH>..<HASH> 100644 --- a/lib/chore/consumers/sqs_consumer.rb +++ b/lib/chore/consumers/sqs_consumer.rb @@ -2,6 +2,7 @@ require 'aws/sqs' module Chore class SQSConsumer < Consumer + Chore::CLI.register_option 'dedupe_servers', '--dedupe-servers', 'List of mememcache compatible server(s) to use for storing SQS Message Dedupe cache' def initialize(queue_name, opts={}) super(queue_name, opts)
Expose configuration for dedupe server list.
Tapjoy_chore
train
rb
8718004066827d219d71fee71cdc8d21113059e9
diff --git a/src/main/java/uk/ac/ebi/embl/template/CSVReader.java b/src/main/java/uk/ac/ebi/embl/template/CSVReader.java index <HASH>..<HASH> 100644 --- a/src/main/java/uk/ac/ebi/embl/template/CSVReader.java +++ b/src/main/java/uk/ac/ebi/embl/template/CSVReader.java @@ -11,6 +11,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import static uk.ac.ebi.embl.template.TemplateProcessorConstants.ORGANISM_NAME_TOKEN; +import static uk.ac.ebi.embl.template.TemplateProcessorConstants.ORGANISM_TOKEN; + public class CSVReader { private String currentLine; private final BufferedReader lineReader; @@ -113,6 +116,10 @@ public class CSVReader { if (header == null) { throw new TemplateUserError("Template file has no data"); } + if (!header.contains(ORGANISM_NAME_TOKEN) && + !header.contains(ORGANISM_TOKEN)) { + throw new TemplateUserError("Template file has no header line"); + } header = header.replaceAll("\"", "");//remove all speech marks - open office puts these in final String[] headerTokens = header.split(CSVWriter.UPLOAD_DELIMITER); final List<String> recognizedKeys = new ArrayList<>();
Added check based on organism name fields that header line exists.
enasequence_sequencetools
train
java
d2a2ca7e0c1e43a45dde4656b64a2bcfaecc6caa
diff --git a/src/Event/Decorator/SubjectFilterDecorator.php b/src/Event/Decorator/SubjectFilterDecorator.php index <HASH>..<HASH> 100644 --- a/src/Event/Decorator/SubjectFilterDecorator.php +++ b/src/Event/Decorator/SubjectFilterDecorator.php @@ -16,6 +16,7 @@ declare(strict_types=1); */ namespace Cake\Event\Decorator; +use Cake\Core\Exception\Exception; use Cake\Event\EventInterface; use RuntimeException; @@ -58,8 +59,9 @@ class SubjectFilterDecorator extends AbstractDecorator $this->_options['allowedSubject'] = [$this->_options['allowedSubject']]; } - $subject = $event->getSubject(); - if ($subject === null) { + try { + $subject = $event->getSubject(); + } catch (Exception $e) { return false; }
Fix error reported by psalm
cakephp_cakephp
train
php
a4ab0c18a4c7f56296d84961a269d1fa8aa5c664
diff --git a/src/Qiniu/Auth.php b/src/Qiniu/Auth.php index <HASH>..<HASH> 100644 --- a/src/Qiniu/Auth.php +++ b/src/Qiniu/Auth.php @@ -106,7 +106,6 @@ final class Auth 'persistentOps', 'persistentNotifyUrl', 'persistentPipeline', - 'checksum', ); private static $deprecatedPolicyFields = array( diff --git a/src/Qiniu/Http/Response.php b/src/Qiniu/Http/Response.php index <HASH>..<HASH> 100644 --- a/src/Qiniu/Http/Response.php +++ b/src/Qiniu/Http/Response.php @@ -115,6 +115,7 @@ final class Response } elseif ($code >=400) { $this->error = $body; } + return; } public function json()
rm checksum in put policy
qiniu_php-sdk
train
php,php
b9e03b59d4ce3b2556f19ea6c6c98875d0a97f2b
diff --git a/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java b/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java index <HASH>..<HASH> 100644 --- a/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java +++ b/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java @@ -218,7 +218,7 @@ public class DBCleanerTool } catch (SQLException e) { - LOG.error("Query execution \"" + sql + "\" failed"); + LOG.error("Query execution \"" + sql + "\" failed: " + JDBCUtils.getFullMessage(e), e); throw e; } }
JCR-<I>: Provide more information when DBCleanerTool failed on query execution
exoplatform_jcr
train
java