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
d23fcf3beb327c1ef77898e9dcd39979d49511a0
diff --git a/tensorflow_datasets/image_classification/so2sat.py b/tensorflow_datasets/image_classification/so2sat.py index <HASH>..<HASH> 100644 --- a/tensorflow_datasets/image_classification/so2sat.py +++ b/tensorflow_datasets/image_classification/so2sat.py @@ -61,10 +61,13 @@ class So2satConfig(tfds.core.BuilderConfig): if selection not in _DATA_OPTIONS: raise ValueError('selection must be one of %s' % _DATA_OPTIONS) - v2 = tfds.core.Version( - '2.0.0', 'New split API (https://tensorflow.org/datasets/splits)') - v2_1 = tfds.core.Version( - '2.1.0', 'Using updated optical channels calibration factor.') + v2 = tfds.core.Version('2.0.0') + v2_1 = tfds.core.Version('2.1.0') + + RELEASE_NOTES = { + '2.0.0': 'New split API (https://tensorflow.org/datasets/splits)', + '2.1.0': 'Using updated optical channels calibration factor.', + } super(So2satConfig, self).__init__(version=v2_1, supported_versions=[v2], **kwargs)
Add release notes for so2sat
tensorflow_datasets
train
py
abd4027e1046ad5777b734c60f040afc6025b1ea
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -675,10 +675,32 @@ module ActiveSupport # <tt>:unless</tt> options may be passed in order to control when the # callback is skipped. # - # class Writer < Person - # skip_callback :validate, :before, :check_membership, if: -> { age > 18 } + # class Writer < PersonRecord + # attr_accessor :age + # skip_callback :save, :before, :saving_message, if: -> { age > 18 } # end # + # When if option returns true, callback is skipped. + # + # writer = Writer.new + # writer.age = 20 + # writer.save + # + # Output: + # - save + # saved + # + # When if option returns false, callback is NOT skipped. + # + # young_writer = Writer.new + # young_writer.age = 17 + # young_writer.save + # + # Output: + # saving... + # - save + # saved + # # An <tt>ArgumentError</tt> will be raised if the callback has not # already been set (unless the <tt>:raise</tt> option is set to <tt>false</tt>). def skip_callback(name, *filter_list, &block)
[ci-skip] Improve doc for ActiveSupport::Callbacks.skip_callback Reuse class previously defined in the same file to make it easy to see the change of the output. Also add the example not to skip callback with if option.
rails_rails
train
rb
95907675e2830b65fe21cd905f9a7faa0b1e29e5
diff --git a/librosa/output.py b/librosa/output.py index <HASH>..<HASH> 100644 --- a/librosa/output.py +++ b/librosa/output.py @@ -194,7 +194,7 @@ def write_wav(path, y, sr, norm=True): # normalize if norm: - wav = y / np.max(np.abs(y)) + wav = util.normalize(y, norm=np.inf, axis=None) else: wav = y diff --git a/librosa/util.py b/librosa/util.py index <HASH>..<HASH> 100644 --- a/librosa/util.py +++ b/librosa/util.py @@ -316,6 +316,7 @@ def normalize(S, norm=np.inf, axis=0): - axis : int [scalar] Axis along which to compute the norm. ``axis=0`` will normalize columns, ``axis=1`` will normalize rows. + ''axis=None'' will normalize according to the entire matrix. :returns: - S_norm : np.ndarray [shape=S.shape]
refactored write_wav normalization to use util.normalize
librosa_librosa
train
py,py
de367971aa8e02a0c84952358365b2b07c58c70f
diff --git a/spec/endpoints/sentences_spec.rb b/spec/endpoints/sentences_spec.rb index <HASH>..<HASH> 100644 --- a/spec/endpoints/sentences_spec.rb +++ b/spec/endpoints/sentences_spec.rb @@ -40,7 +40,8 @@ RSpec.describe OxfordDictionary::Endpoints::Sentences do # response = subject # expect(response).to be_an(OpenStruct) # expect(response.results.first.id).to eq(word) - # expect(response.results.first.lexicalEntries).to all(be_an(OpenStruct)) + # expect(response.results.first.lexicalEntries). + # to all(be_an(OpenStruct)) # end end end
Fix sentences spec RuboCop offenses RuboCop is always right.
swcraig_oxford-dictionary
train
rb
21a294b416cd8d319f539737dfe3dcc9846565fe
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ setup( "Intended Audience :: Developers", "Topic :: Software Development :: Libraries" ], - install_requires=["javalang>=0.10.0", "lxml", "beautifulsoup4"], + install_requires=["javalang>=0.10.0", "lxml", "beautifulsoup4", "future"], entry_points={ 'console_scripts': [ 'javasphinx-apidoc = javasphinx.apidoc:main'
Setup.py: ``future`` added to requirements.
bronto_javasphinx
train
py
930f30ce03ff8e2adf4da50859859e5d369b11c4
diff --git a/components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Front_End.php b/components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Front_End.php index <HASH>..<HASH> 100644 --- a/components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Front_End.php +++ b/components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Front_End.php @@ -291,7 +291,7 @@ class Pods_Templates_Auto_Template_Front_End { $filter = $this->get_pod_filter( $current_post_type, $possible_pods ); - if ( current_filter() !== $filter && current_action() !== $filter ) { + if ( current_filter() !== $filter ) { return $content; }
current_action() is just an alias..
pods-framework_pods
train
php
631df4c96b23cc82ca181600bf4120aed1f0b0ea
diff --git a/lib/managed_source.rb b/lib/managed_source.rb index <HASH>..<HASH> 100755 --- a/lib/managed_source.rb +++ b/lib/managed_source.rb @@ -4,12 +4,13 @@ module DataSift ## # Creates a new managed source #+source_type+:: can be facebook_page, googleplus, instagram or yammer - def create(source_type, name, parameters = {}, resources = [], auth = []) + def create(source_type, name, parameters = {}, resources = [], auth = [], options = {}) raise BadParametersError.new('source_type and name are required') if source_type.nil? || name.nil? params = { :source_type => source_type, :name => name } + params.merge!(options) unless options.empty? params.merge!({:auth => auth.is_a?(String) ? auth : MultiJson.dump(auth)}) unless auth.empty? params.merge!({:parameters => parameters.is_a?(String) ? parameters : MultiJson.dump(parameters)}) unless parameters.empty? params.merge!({:resources => resources.is_a?(String) ? resources : MultiJson.dump(resources)}) if resources.length > 0
Adding options to managed source create method to allow passing through of parameters like the validate flag
datasift_datasift-ruby
train
rb
850c3c1e1f66e024bd9ea5199be670c6df2e54d8
diff --git a/src/Seeds/RolesSeeder.php b/src/Seeds/RolesSeeder.php index <HASH>..<HASH> 100644 --- a/src/Seeds/RolesSeeder.php +++ b/src/Seeds/RolesSeeder.php @@ -50,9 +50,9 @@ abstract class RolesSeeder extends Seeder $now = Carbon::now(); foreach ($roles as $key => $role) { - $roles[$key]['slug'] = $this->slugify($role['name']); - $roles[$key]['is_active'] = isset($role['is_active']) ? $role['is_active'] : true; - $roles[$key]['is_locked'] = isset($role['is_locked']) ? $role['is_locked'] : true; + $roles[$key]['slug'] = $role['slug'] ?? $this->slugify($role['name']); + $roles[$key]['is_active'] = $role['is_active'] ?? true; + $roles[$key]['is_locked'] = $role['is_locked'] ?? true; $roles[$key]['created_at'] = $now; $roles[$key]['updated_at'] = $now; }
Updating the base RolesSeeder class
ARCANESOFT_Auth
train
php
150698b523cca1600431521f16647da006d900e6
diff --git a/args4j/test/org/kohsuke/args4j/CustomExceptionTest.java b/args4j/test/org/kohsuke/args4j/CustomExceptionTest.java index <HASH>..<HASH> 100644 --- a/args4j/test/org/kohsuke/args4j/CustomExceptionTest.java +++ b/args4j/test/org/kohsuke/args4j/CustomExceptionTest.java @@ -27,7 +27,7 @@ public class CustomExceptionTest extends Args4JTestBase<CustomExceptionTest> { } - protected void tryThis(String expected, Class expectedExceptionClass, String... parserArgs) { + protected void assertException(String expected, Class expectedExceptionClass, String... parserArgs) { String expMsg = expectedExceptionClass.getName() + ": " + expected; try { parser.parseArgument(parserArgs); @@ -45,11 +45,11 @@ public class CustomExceptionTest extends Args4JTestBase<CustomExceptionTest> { } public void testRuntimeException() throws Exception { - tryThis(errMsgX, IllegalArgumentException.class, "-x", "value"); + assertException(errMsgX, IllegalArgumentException.class, "-x", "value"); } public void testCustomException() throws Exception { - tryThis(errMsgX, InvalidAttributeValueException.class, "-y", "value"); + assertException(errMsgX, InvalidAttributeValueException.class, "-y", "value"); } } \ No newline at end of file
It's a kind of assert-method, so name it assert*
kohsuke_args4j
train
java
858c167a6487e4a9d9cca3653b8e260f085dba02
diff --git a/paramiko/ssh_exception.py b/paramiko/ssh_exception.py index <HASH>..<HASH> 100644 --- a/paramiko/ssh_exception.py +++ b/paramiko/ssh_exception.py @@ -164,7 +164,7 @@ class NoValidConnectionsError(socket.error): :param dict errors: The errors dict to store, as described by class docstring. """ - addrs = errors.keys() + addrs = list(errors.keys()) body = ', '.join([x[0] for x in addrs[:-1]]) tail = addrs[-1][0] msg = "Unable to connect to port {0} on {1} or {2}"
Fix tests on Python 3.x (This also fixes #<I>.)
paramiko_paramiko
train
py
646a49039e1223e36883a5c17674c39b992f8f19
diff --git a/core/frontend/services/themes/ThemeStorage.js b/core/frontend/services/themes/ThemeStorage.js index <HASH>..<HASH> 100644 --- a/core/frontend/services/themes/ThemeStorage.js +++ b/core/frontend/services/themes/ThemeStorage.js @@ -3,7 +3,7 @@ var fs = require('fs-extra'), path = require('path'), config = require('../../../server/config'), security = require('../../../server/lib/security'), - {zipFolder} = require('@tryghost/zip'), + {compress} = require('@tryghost/zip'), LocalFileStorage = require('../../../server/adapters/storage/LocalFileStorage'); /** @@ -34,13 +34,13 @@ class ThemeStorage extends LocalFileStorage { fs.ensureDir(zipBasePath) .then(function () { - return zipFolder(themePath, zipPath); + return compress(themePath, zipPath); }) - .then(function (length) { + .then(function (result) { res.set({ 'Content-disposition': 'attachment; filename={themeName}.zip'.replace('{themeName}', themeName), 'Content-Type': 'application/zip', - 'Content-Length': length + 'Content-Length': result.size }); stream = fs.createReadStream(zipPath);
Updated method call syntax for @tryghost/zip@<I> - @tryghost/zip <I> has a totally different API, but it works the same - This updates to use the new API
TryGhost_Ghost
train
js
f1127124e831f55824b59618cc8153c755ba265e
diff --git a/icekit/management/commands/publishing_migrate_from_publisher.py b/icekit/management/commands/publishing_migrate_from_publisher.py index <HASH>..<HASH> 100644 --- a/icekit/management/commands/publishing_migrate_from_publisher.py +++ b/icekit/management/commands/publishing_migrate_from_publisher.py @@ -99,3 +99,16 @@ class Command(NoArgsCommand): item.status = UrlNode.PUBLISHED item.save() + + # Finally, set `UrlNode.status` field to appropriate value for all + # nodes that implement ICEKit publishing, or at least have the DB field + for n in UrlNode.objects.all(): + # Skip nodes that don't have ICEKit Publishing DB fields + if not hasattr(n, 'publishing_is_draft'): + continue + if n.publishing_is_draft and n.status != UrlNode.DRAFT: + UrlNode.objects.filter(pk=n.pk).update( + status=UrlNode.DRAFT) + if not n.publishing_is_draft and n.status != UrlNode.PUBLISHED: + UrlNode.objects.filter(pk=n.pk).update( + status=UrlNode.PUBLISHED)
Make publishing implementation migration script always sets UrlNode.status The `publishing_migrate_from_publisher` script for migrating existing data from legacy "publisher" DB fields to ICEKit's "publishing" DB fields now updates all UrlNode items in the DB to set the Fluent draft/published status correctly, whereas previously it only did so for items that could not be migrated with bulk SQL queries.
ic-labs_django-icekit
train
py
e58c6e6a67c63727672be75a00b1ff20bd792457
diff --git a/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/XbaseJavaValidator.java b/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/XbaseJavaValidator.java index <HASH>..<HASH> 100644 --- a/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/XbaseJavaValidator.java +++ b/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/validation/XbaseJavaValidator.java @@ -721,7 +721,13 @@ public class XbaseJavaValidator extends AbstractXbaseJavaValidator { @Check public void checkInstantiationOfAbstractClass(XConstructorCall constructorCall) { - if (constructorCall.getConstructor().getDeclaringType().isAbstract()) { + JvmConstructor constructor = constructorCall.getConstructor(); + if (constructor == null || constructor.eIsProxy()) + return; + JvmDeclaredType declaringType = constructor.getDeclaringType(); + if (declaringType == null || declaringType.eIsProxy()) + return; + if (declaringType.isAbstract()) { error("Cannot instantiate abstract class", null, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, ABSTRACT_CLASS_INSTANTIATION); }
[xbase][validation] Some guard to avoid NPE which don't help while debugging
eclipse_xtext-extras
train
java
73fc522e5751252d7faa0e1e410790da48586c48
diff --git a/go/client/cmd_simplefs_sync_disable.go b/go/client/cmd_simplefs_sync_disable.go index <HASH>..<HASH> 100644 --- a/go/client/cmd_simplefs_sync_disable.go +++ b/go/client/cmd_simplefs_sync_disable.go @@ -5,6 +5,7 @@ package client import ( "fmt" + "strings" "github.com/keybase/cli" "github.com/keybase/client/go/libcmdline" @@ -68,14 +69,28 @@ func (c *CmdSimpleFSSyncDisable) Run() error { } found := false + parentFound := "" for _, p := range res.Config.Paths { if p == subpath { found = true } else { + toCheck := p + if !strings.HasSuffix(p, "/") { + toCheck = p + "/" + } + if strings.HasPrefix(subpath, toCheck) { + parentFound = p + } arg.Config.Paths = append(arg.Config.Paths, p) } } + if parentFound != "" { + ui := c.G().UI.GetTerminalUI() + ui.Printf("%s will remain synced because its parent path (%s) "+ + "is still synced\n", subpath, parentFound) + } + if !found { return nil }
client: warn on `fs sync disable` if parent is still synced Suggested by songgao. Issue: #<I>
keybase_client
train
go
f19cc1f1c176a7696992b9901ec91bfd76cff286
diff --git a/test/shared_tests.rb b/test/shared_tests.rb index <HASH>..<HASH> 100644 --- a/test/shared_tests.rb +++ b/test/shared_tests.rb @@ -70,6 +70,11 @@ module SharedTests assert_equal 'world', @cache.fetch('hello') { 'world' } end + def test_fetch_with_false_boolean + assert_equal nil, @cache.fetch('hello') + assert_equal false, @cache.fetch('hello') { false } + end + def test_fetch_with_expires_in assert_equal 'world', @cache.fetch('hello', :expires_in => 5) { 'world' } end
sanity-check handling of booleans
seamusabshere_cache
train
rb
5fde54e8e391f25c02f4a7ef64c2168842042417
diff --git a/src/com/google/bitcoin/utils/BriefLogFormatter.java b/src/com/google/bitcoin/utils/BriefLogFormatter.java index <HASH>..<HASH> 100644 --- a/src/com/google/bitcoin/utils/BriefLogFormatter.java +++ b/src/com/google/bitcoin/utils/BriefLogFormatter.java @@ -21,9 +21,7 @@ import java.io.StringWriter; import java.io.Writer; import java.text.MessageFormat; import java.util.Date; -import java.util.logging.Formatter; -import java.util.logging.LogManager; -import java.util.logging.LogRecord; +import java.util.logging.*; /** * A Java logging formatter that writes more compact output than the default. @@ -36,6 +34,13 @@ public class BriefLogFormatter extends Formatter { LogManager.getLogManager().getLogger("").getHandlers()[0].setFormatter(new BriefLogFormatter()); } + public static void initVerbose() { + Logger logger = LogManager.getLogManager().getLogger(""); + logger.getHandlers()[0].setFormatter(new BriefLogFormatter()); + logger.setLevel(Level.FINEST); + logger.log(Level.FINE, "test"); + } + @Override public String format(LogRecord logRecord) { Object[] arguments = new Object[6];
Add an initVerbose() method to BriefLogFormatter. Note: this does not actually appear to work :(
bitcoinj_bitcoinj
train
java
6d4181191f06043e4972cc9c3b4589436a4b1b3d
diff --git a/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorSpec.java b/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorSpec.java index <HASH>..<HASH> 100644 --- a/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorSpec.java +++ b/server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorSpec.java @@ -21,7 +21,6 @@ package org.apache.druid.indexing.overlord.supervisor; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; import java.util.List; @@ -45,12 +44,12 @@ public interface SupervisorSpec default SupervisorSpec createSuspendedSpec() { - throw new NotImplementedException(); + throw new UnsupportedOperationException(); } default SupervisorSpec createRunningSpec() { - throw new NotImplementedException(); + throw new UnsupportedOperationException(); } default boolean isSuspended()
replace jdk internal exceptions with closest publicly available one
apache_incubator-druid
train
java
dfd85be732cc227166b4f89b3d7e3792ef7adf97
diff --git a/src/org/zaproxy/zap/extension/spider/SpiderAPI.java b/src/org/zaproxy/zap/extension/spider/SpiderAPI.java index <HASH>..<HASH> 100644 --- a/src/org/zaproxy/zap/extension/spider/SpiderAPI.java +++ b/src/org/zaproxy/zap/extension/spider/SpiderAPI.java @@ -315,11 +315,8 @@ public class SpiderAPI extends ApiImplementor { StructuralNode node = null; try { node = SessionStructure.find(Model.getSingleton().getSession().getSessionId(), new URI(url, false), "GET", ""); - if (node == null) { - throw new ApiException(ApiException.Type.URL_NOT_FOUND); - } } catch (Exception e) { - throw new ApiException(ApiException.Type.URL_NOT_FOUND); + throw new ApiException(ApiException.Type.INTERNAL_ERROR); } Target target = new Target(node); target.setRecurse(true);
SpiderAPI: Do not require an existing node to start the spider Spider is able to start/run with just the URL.
zaproxy_zaproxy
train
java
09c372f72b1d0b88fa1a0e9458cdf5991c2a9899
diff --git a/lib/i18n_rails_helpers.rb b/lib/i18n_rails_helpers.rb index <HASH>..<HASH> 100644 --- a/lib/i18n_rails_helpers.rb +++ b/lib/i18n_rails_helpers.rb @@ -69,7 +69,7 @@ module I18nRailsHelpers # t_confirm_delete(@account) => 'Konto Kasse wirklich löschen' # def t_confirm_delete(record) - I18n::translate('messages.confirm_delete', :record => "#{t_model(record.class)} #{record.to_s}") + I18n::translate('messages.confirm_delete', :model => t_model(record), :record => record.to_s) end end
Pass both model and record to confirm_delete translation.
huerlisi_i18n_rails_helpers
train
rb
a3a1b61b031deb1513d35ab2230090c67ddd9fd6
diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index <HASH>..<HASH> 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -2539,7 +2539,7 @@ class assign { // Only ever send a max of one days worth of updates. $yesterday = time() - (24 * 3600); $timenow = time(); - $lastcron = $DB->get_field('modules', 'lastcron', array('name' => 'assign')); + $lastruntime = $DB->get_field('task_scheduled', 'lastruntime', array('component' => 'mod_assign')); // Collect all submissions that require mailing. // Submissions are included if all are true: @@ -2711,10 +2711,10 @@ class assign { $sql = 'SELECT id FROM {assign} WHERE - allowsubmissionsfromdate >= :lastcron AND + allowsubmissionsfromdate >= :lastruntime AND allowsubmissionsfromdate <= :timenow AND alwaysshowdescription = 0'; - $params = array('lastcron' => $lastcron, 'timenow' => $timenow); + $params = array('lastruntime' => $lastruntime, 'timenow' => $timenow); $newlyavailable = $DB->get_records_sql($sql, $params); foreach ($newlyavailable as $record) { $cm = get_coursemodule_from_instance('assign', $record->id, 0, false, MUST_EXIST);
MDL-<I> assign task: Use lastruntime from task_scheduled
moodle_moodle
train
php
e5dd8fbdd8c97f884e406b3666ae5e76d55ddc5c
diff --git a/Eloquent/Concerns/GuardsAttributes.php b/Eloquent/Concerns/GuardsAttributes.php index <HASH>..<HASH> 100644 --- a/Eloquent/Concerns/GuardsAttributes.php +++ b/Eloquent/Concerns/GuardsAttributes.php @@ -233,8 +233,7 @@ trait GuardsAttributes { if (! empty($this->getGuarded()) && $this->getGuarded() !== ['*']) { - - throw new LogicException("For added security, guarded attributes are no longer supported. Please use fillable instead."); + throw new LogicException('For added security, guarded attributes are no longer supported. Please use fillable instead.'); } } }
Apply fixes from StyleCI (#<I>)
illuminate_database
train
php
325ea9e5357f8212f8d83735639e1f2e1e5e62f9
diff --git a/store_test.go b/store_test.go index <HASH>..<HASH> 100644 --- a/store_test.go +++ b/store_test.go @@ -330,13 +330,14 @@ func testStoreOps(t *testing.T, spo StorePersistOptions) { m.Start() - testOps(t, m) + persistWaiterCh := make(chan bool, 100) - persistWaiterCh := make(chan bool) mu.Lock() eventWaiters[EventKindPersisterProgress] = persistWaiterCh mu.Unlock() + testOps(t, m) + err = m.(*collection).NotifyMerger("mergeAll", true) if err != nil { t.Errorf("mergeAll err")
another attempted test race fix The last fix didn't work, where travis-CI this time timed out due to missing a persistence event... <URL>
couchbase_moss
train
go
ed05b0e0183ba7dde2c03e837445785912226dc5
diff --git a/test/fixtures/dot/first-level.js b/test/fixtures/dot/first-level.js index <HASH>..<HASH> 100644 --- a/test/fixtures/dot/first-level.js +++ b/test/fixtures/dot/first-level.js @@ -1 +1 @@ -with ({}) {} \ No newline at end of file +with ({}) {}
Add newline char to the end of the test file
jscs-dev_grunt-jscs
train
js
3ec4b94998bd2b413f1a5c77bfed590ce684b9b9
diff --git a/references/detection/train.py b/references/detection/train.py index <HASH>..<HASH> 100644 --- a/references/detection/train.py +++ b/references/detection/train.py @@ -158,10 +158,7 @@ def main(args): device = torch.device(args.device) if args.use_deterministic_algorithms: - torch.backends.cudnn.benchmark = False torch.use_deterministic_algorithms(True) - else: - torch.backends.cudnn.benchmark = True # Data loading code print("Loading data") @@ -253,8 +250,6 @@ def main(args): scaler.load_state_dict(checkpoint["scaler"]) if args.test_only: - # We disable the cudnn benchmarking because it can noticeably affect the accuracy - torch.backends.cudnn.benchmark = False torch.backends.cudnn.deterministic = True evaluate(model, data_loader_test, device=device) return
Fix regression on Detection training script (#<I>)
pytorch_vision
train
py
b484e3df2ab49a8a5c0968c9c109ec7e8274a288
diff --git a/cyclops-closures/src/main/java/com/aol/cyclops/closures/Convertable.java b/cyclops-closures/src/main/java/com/aol/cyclops/closures/Convertable.java index <HASH>..<HASH> 100644 --- a/cyclops-closures/src/main/java/com/aol/cyclops/closures/Convertable.java +++ b/cyclops-closures/src/main/java/com/aol/cyclops/closures/Convertable.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Optional; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; import java.util.stream.Stream; @@ -25,6 +26,13 @@ public interface Convertable<T> extends Iterable<T>{ return Stream.of(get()).filter(v->v!=null); } + default AtomicReference<T> toAtomicReference(){ + return new AtomicReference<T>(get()); + } + default Optional<AtomicReference<T>> toOptionalAtomicReference(){ + return toOptional().map(u->new AtomicReference<T>(u)); + } + /**Get the contained value or else the provided alternative * * @param value
Convertable to AtomicReference
aol_cyclops
train
java
166ad0101f1e17c0fb0aebde277bbba13d03b27f
diff --git a/lib/nodes/index.js b/lib/nodes/index.js index <HASH>..<HASH> 100644 --- a/lib/nodes/index.js +++ b/lib/nodes/index.js @@ -51,25 +51,3 @@ exports.Arguments = require('./arguments'); exports.true = new exports.Boolean(true); exports.false = new exports.Boolean(false); exports.null = new exports.Null; - -/** - * JS to Stylus conversion. - */ - -exports.cast = function(val){ - switch (typeof val) { - case 'string': - return new exports.String(val); - case 'number': - return new exports.Unit(val); - case 'boolean': - return exports.Boolean(val); - default: - if (Array.isArray(val)) { - var expr = new exports.Expression; - expr.nodes = val.map(exports.cast); - val = expr; - } - return val; - } -}; \ No newline at end of file
removed unused nodes.cast()
stylus_stylus
train
js
6856760048308e78a09869448026d610f51cdda5
diff --git a/lib/flor.rb b/lib/flor.rb index <HASH>..<HASH> 100644 --- a/lib/flor.rb +++ b/lib/flor.rb @@ -52,3 +52,14 @@ require 'flor/core/texecutor' Flor.load_procedures('pcore') + +if RUBY_PLATFORM.match(/java/) + class Array + alias original_collect collect + def collect(&block) +puts [ caller[0] + " <---" ] + caller[1, 2] + original_collect(&block) + end + end +end +
Add debug output to Array when JRuby trying to locate the thread-safety issue...
floraison_flor
train
rb
f1a3a8e17cfd4733e7a3a906b50f460351074315
diff --git a/neo4jrestclient/query.py b/neo4jrestclient/query.py index <HASH>..<HASH> 100644 --- a/neo4jrestclient/query.py +++ b/neo4jrestclient/query.py @@ -215,7 +215,10 @@ class Q(BaseQ): op_not = self._not.get_query_objects(params=params, version=version) params.update(op_not[1]) - query = u"True = NOT ( {0} )".format(op_not[0]) + if version and version.split(".")[0] >= "2": + query = u"True = NOT ( {0} )".format(op_not[0]) + else: + query = u"NOT ( {0} )".format(op_not[0]) elif self._or is not None: left_or = self._or[0].get_query_objects(params=params, version=version)
Using True=NOT() only for Neo4J v2
versae_neo4j-rest-client
train
py
e3215c93bec579f425fcaeab9bfaadf52a5a9e9b
diff --git a/lib/casting.rb b/lib/casting.rb index <HASH>..<HASH> 100644 --- a/lib/casting.rb +++ b/lib/casting.rb @@ -64,14 +64,14 @@ module Casting begin !client.nil? && delegated_method.bind(client) rescue TypeError => e - raise TypeError.new("`to' argument must be an instance of #{client.class}") + raise TypeError.new("`to' argument must be a module or an instance of #{client.class}") end end def method_carrier(object_or_module) if Module === object_or_module if RedCard.check '2.0' - return object_or_module + object_or_module else client.clone.extend(object_or_module) end
remove unnecessary return. make type error for 'to' assignment clearer
saturnflyer_casting
train
rb
ee5605e8a4181311aa5b38ee80c4f1bebe384ea7
diff --git a/closure/goog/ui/container.js b/closure/goog/ui/container.js index <HASH>..<HASH> 100644 --- a/closure/goog/ui/container.js +++ b/closure/goog/ui/container.js @@ -871,7 +871,7 @@ goog.ui.Container.prototype.addChildAt = function(control, index, opt_render) { goog.ui.Container.superClass_.addChildAt.call(this, control, index, opt_render); - if (opt_render && this.isInDocument()) { + if (control.isInDocument() && this.isInDocument()) { this.registerChildId_(control); }
Allow child components that are already rendered to be added to Container and have their ids registered. R=nnaze DELTA=1 (0 added, 0 deleted, 1 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=<I> git-svn-id: <URL>
google_closure-library
train
js
6ec349cde1a96d60760ecd054cdc11e03eb53ef4
diff --git a/src/dag-node.js b/src/dag-node.js index <HASH>..<HASH> 100644 --- a/src/dag-node.js +++ b/src/dag-node.js @@ -76,6 +76,29 @@ function DAGNode (data, links) { } }) } + // removeNodeLink removes a Link from this node based on a multihash + this.removeNodeLinkByHash = (multihash) => { + encoded = null // uncache + this.links = this.links.filter(link => { + if (link.hash.equals(multihash)) { + return false + } else { + return true + } + }) + } + + // removeNodeLink removes a Link from this node based on name + this.removeNodeLink = (name) => { + encoded = null // uncache + this.links = this.links.filter(link => { + if (link.name === name) { + return false + } else { + return true + } + }) + } // makeLink returns a DAGLink node from a DAGNode // TODO: this would make more sense as an utility
Added node removal by multihash helper method
ipld_js-ipld-dag-pb
train
js
b34c4ccbf7934676aeec44605c1d8be9284d82bd
diff --git a/sb.js b/sb.js index <HASH>..<HASH> 100644 --- a/sb.js +++ b/sb.js @@ -1706,7 +1706,7 @@ sb.ajax.prototype = { t.count = 0; if(typeof t.onTimeout == 'function'){ - t.timeout(); + t.onTimeout(); } window.clearInterval(t.timer);
fixed bug that was causing ontimeout to not fire for sb.ajax instances
surebert_surebert-framework
train
js
63a099eab397336ad2af25a9bc8855ab8e1a5e24
diff --git a/lib/validation.js b/lib/validation.js index <HASH>..<HASH> 100644 --- a/lib/validation.js +++ b/lib/validation.js @@ -40,6 +40,9 @@ class ValidationNode extends Node { get inner() { return this._innerNode; } + get value() { + return this.inner.value; + } renderHB() { // TODO: Is it always appropriate to attach validation messages to the body? var {head, body: innerBody} = this._innerNode.renderHB();
A validation node now provides a value, namely the value of its inner node.
webXcerpt_openCPQ
train
js
4e660f7b3e57770f1321d298ddd021a531236060
diff --git a/src/babel/generation/generators/template-literals.js b/src/babel/generation/generators/template-literals.js index <HASH>..<HASH> 100644 --- a/src/babel/generation/generators/template-literals.js +++ b/src/babel/generation/generators/template-literals.js @@ -1,5 +1,5 @@ /** - * [Please add a description.] + * Prints TaggedTemplateExpression, prints tag and quasi. */ export function TaggedTemplateExpression(node, print) { @@ -8,7 +8,7 @@ export function TaggedTemplateExpression(node, print) { } /** - * [Please add a description.] + * Prints TemplateElement, prints value. */ export function TemplateElement(node) { @@ -16,7 +16,7 @@ export function TemplateElement(node) { } /** - * [Please add a description.] + * Prints TemplateLiteral, prints quasis, and expressions. */ export function TemplateLiteral(node, print) {
Add descriptions to generation/generators/template-literals
babel_babel
train
js
fedc2150e9cbe012088485684f09c49b72f666ce
diff --git a/myfitnesspal/client.py b/myfitnesspal/client.py index <HASH>..<HASH> 100644 --- a/myfitnesspal/client.py +++ b/myfitnesspal/client.py @@ -231,6 +231,17 @@ class Client(MFPBase): self._get_url_for_measurements() ) + return self._get_measurements(document) + + def _get_measurements(self, document): + types = document.xpath("//select[@id='type']/option") + + measurements = {} + for element in types: + measurements[element.text] = element.attrib["value"] + + return measurements + def _get_notes(self, document): notes_header = document.xpath("//p[@class='note']")[0] header_text = [notes_header.text] if notes_header.text else []
#<I> Added method to retrieve measurement ids MyFitnessPal uses IDs to identify custom measurements. This method returns a dictionary of measurement names as keys and IDs as values. Method will be expanded to collect actual data in following commits.
coddingtonbear_python-myfitnesspal
train
py
f445b789e38b710ae77d81b514a6a5f3842f3a4c
diff --git a/lib/mongo/database/view.rb b/lib/mongo/database/view.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/database/view.rb +++ b/lib/mongo/database/view.rb @@ -51,7 +51,6 @@ module Mongo def collection_names(options = {}) @batch_size = options[:batch_size] server = next_primary(false) - @limit = -1 if server.features.list_collections_enabled? session = client.send(:get_session, options) collections_info(server, session, name_only: true).collect do |info| if server.features.list_collections_enabled?
RUBY-<I> Remove -1 limit in db view (#<I>) As far as I can tell the -1 limit is ignored by the driver, just like a nil limit would be ignored. However the call on server is problematic with the new retryable reads API since server may change during a read operation.
mongodb_mongo-ruby-driver
train
rb
d84a3e2b9d980acde8f641474af9c2f0b8c9ce45
diff --git a/src/OverlayTrigger.js b/src/OverlayTrigger.js index <HASH>..<HASH> 100644 --- a/src/OverlayTrigger.js +++ b/src/OverlayTrigger.js @@ -27,7 +27,7 @@ class OverlayTrigger extends Overlay { } showOverlay () { - $(`#${this.overlayID}`).openModal(this.props.modalOptions); + $(`#${this.overlayID}`).modal(this.props.modalOptions).modal('open'); } }
Fixes Modal not working after Materialize update (#<I>)
react-materialize_react-materialize
train
js
d731e7797eb44906f36e5c4582059751693831a6
diff --git a/src/Components/Menu/Installer.php b/src/Components/Menu/Installer.php index <HASH>..<HASH> 100644 --- a/src/Components/Menu/Installer.php +++ b/src/Components/Menu/Installer.php @@ -35,6 +35,6 @@ final class Installer extends AbstractInstaller */ public function install(): void { - $this->require('nunomaduro/laravel-console-menu "^2.3"'); + $this->require('nunomaduro/laravel-console-menu "^3.0"'); } }
Update to use Laravel Console Menu version 3.x
laravel-zero_framework
train
php
d654615e894ef8cde4b24a13047c591482f99845
diff --git a/lib/coral_core/mixin/lookup.rb b/lib/coral_core/mixin/lookup.rb index <HASH>..<HASH> 100644 --- a/lib/coral_core/mixin/lookup.rb +++ b/lib/coral_core/mixin/lookup.rb @@ -92,7 +92,7 @@ module Lookup value = hiera.lookup(property, nil, hiera_scope, override, context) end - if Util::Data.undef?(value) + if Util::Data.undef?(value) && puppet_scope.respond_to?(:lookupvar) log_level = Puppet::Util::Log.level Puppet::Util::Log.level = :err # Don't want failed parameter lookup warnings here.
Fixing a nonexistent method error in the lookup configuration mixin.
coralnexus_corl
train
rb
7fd8c1c200ebe39a2ae12bd37c5d7b35dbdc2b08
diff --git a/core/logging.js b/core/logging.js index <HASH>..<HASH> 100644 --- a/core/logging.js +++ b/core/logging.js @@ -23,7 +23,7 @@ * * var timer = logger.timer('some_work'); * - * some_work().then(timer.done); + * some_work().then(timer.stop); * * It *also* has a `gauge` method for tracking integer values. * diff --git a/core/logging/stats.js b/core/logging/stats.js index <HASH>..<HASH> 100644 --- a/core/logging/stats.js +++ b/core/logging/stats.js @@ -72,7 +72,7 @@ var wrapLogger = function(getLoggerForConfig, opts){ // This is just a convenience wrapper around the `time` method. mainLogger.timer = (token) => { var t0 = new Date - return { done: () => mainLogger.time(token, new Date - t0) }; + return { stop: () => mainLogger.time(token, new Date - t0) }; } return mainLogger;
Rename timer.done => timer.stop This avoids confusion with the `done` method on Q promises.
redfin_react-server
train
js,js
1b754c79cfa680f2d7d6b7a4a121fd1075a7ff3a
diff --git a/src/core.js b/src/core.js index <HASH>..<HASH> 100644 --- a/src/core.js +++ b/src/core.js @@ -14,6 +14,12 @@ if (!isInitialized) { // TODO check config file integrity + // make sure rangy is initialized. e.g Rangy doesn't initialize + // when loaded after the document is ready. + if (!rangy.initialized) { + rangy.init(); + } + isInitialized = true; dispatcher.setup(); } @@ -81,7 +87,6 @@ }, - isDisabled: false, disable: function() {
Ensure that rangy is initialized Rangy intializes itself on DOMContentReady, but this doesn't always work when using scriptloaders.
livingdocsIO_editable.js
train
js
b0aa71a302dd351bd81d5f24f0630835dc49626b
diff --git a/src/Resources/public/js/be_main.js b/src/Resources/public/js/be_main.js index <HASH>..<HASH> 100644 --- a/src/Resources/public/js/be_main.js +++ b/src/Resources/public/js/be_main.js @@ -127,6 +127,25 @@ var restoreSelectorScripts = function(element) { } +var persistSelects = function(element) { + + $(element).getElements('select').each(function(select) { + + var option = select.getElement('option:selected') || select.getElement('option'); + var oldOption = select.getElement('option[selected]'); + + if (oldOption) { + oldOption.removeAttribute('selected'); + } + + if (option) { + option.setAttribute('selected', ''); + } + + }); + +} + var updateListButtons = function(listElement) { listElement = $(listElement); @@ -408,6 +427,7 @@ var duplicateElement = function(linkElement) { removeTinyMCEs(element); restoreSelectorScripts(element); + persistSelects(element); var newItem = element.cloneNode(true);
Persist state of select elements before clonig them, fixes #<I>
madeyourday_contao-rocksolid-custom-elements
train
js
ec0c040f26625ad59b3789009a87ea259cc0b328
diff --git a/master/buildbot/test/unit/test_db_buildrequests.py b/master/buildbot/test/unit/test_db_buildrequests.py index <HASH>..<HASH> 100644 --- a/master/buildbot/test/unit/test_db_buildrequests.py +++ b/master/buildbot/test/unit/test_db_buildrequests.py @@ -467,7 +467,10 @@ class TestBuildsetsConnectorComponent( ], 1300305712, [ 44, 45 ], expfailure=buildrequests.AlreadyClaimedError) def check(_): - # check that the time wasn't updated on 44 + # check that the time wasn't updated on 44, noting that MySQL does + # not support this. + if self.db_engine.dialect.name == 'mysql': + return def thd(conn): tbl = self.db.model.buildrequest_claims q = tbl.select(order_by=tbl.c.brid)
don't expect txn.rollback to work on mysql
buildbot_buildbot
train
py
3874e7827983860f474457dd665d973f6957245f
diff --git a/code/models/VideoEmbed.php b/code/models/VideoEmbed.php index <HASH>..<HASH> 100644 --- a/code/models/VideoEmbed.php +++ b/code/models/VideoEmbed.php @@ -76,7 +76,8 @@ class VideoEmbed extends DataObject { $title = parent::getTitle(); if (!$title) { - $title = $this->GetOembed()->getField("Title"); + $oembed = $this->GetOembed(); + $title = $oembed ? $oembed->getField("Title") : ""; } return $title; } @@ -408,4 +409,4 @@ class VideoEmbedSettings public $pluginFile = ""; public $pluginTech = ""; -} +} \ No newline at end of file
Prevent fatal error when video has no title
guru-digital_silverstripe-video-embed
train
php
1f0eb91e889c264fb92597fd08c217614f3a65d2
diff --git a/server/php/UploadHandler.php b/server/php/UploadHandler.php index <HASH>..<HASH> 100755 --- a/server/php/UploadHandler.php +++ b/server/php/UploadHandler.php @@ -1,6 +1,6 @@ <?php /* - * jQuery File Upload Plugin PHP Class 8.1.0 + * jQuery File Upload Plugin PHP Class 8.2.0 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan
Updated minor version for last merge.
blueimp_jQuery-File-Upload
train
php
4f5a2c951daffb0d0f397d3829124fdfc2229ac7
diff --git a/lib/dir-writer.js b/lib/dir-writer.js index <HASH>..<HASH> 100644 --- a/lib/dir-writer.js +++ b/lib/dir-writer.js @@ -37,6 +37,7 @@ DirWriter.prototype._create = function () { // ready to start getting entries! me.ready = true me.emit("ready") + me._process() }) }
Fix calling add() on the DirWriter before it is "ready".
npm_fstream
train
js
178c52fbca7117dfdfbd091c6f9acff85732e663
diff --git a/lib/artifactory/resources/repository.rb b/lib/artifactory/resources/repository.rb index <HASH>..<HASH> 100644 --- a/lib/artifactory/resources/repository.rb +++ b/lib/artifactory/resources/repository.rb @@ -57,7 +57,7 @@ module Artifactory attribute :handle_snapshots, true attribute :includes_pattern, '**/*' attribute :key, ->{ raise 'Key is missing!' } - attribute :maximum_unique_snapshots, 0 + attribute :max_unique_snapshots, 0 attribute :notes attribute :property_sets, [] attribute :repo_layout_ref, 'maven-2-default'
Use the proper attribute name for max unique snapshots The JSON key name for this attribute is `maxUniqueSnapshots` which has the underscored name of `max_unique_snapshots`.
chef_artifactory-client
train
rb
789069008dd2530c79f98740c155eb0606009a7c
diff --git a/source/org/jasig/portal/ChannelRegistryManager.java b/source/org/jasig/portal/ChannelRegistryManager.java index <HASH>..<HASH> 100644 --- a/source/org/jasig/portal/ChannelRegistryManager.java +++ b/source/org/jasig/portal/ChannelRegistryManager.java @@ -209,7 +209,7 @@ public class ChannelRegistryManager { * @throws PortalException */ public static Element getChannel (String channelPublishId) throws PortalException { - Document channelRegistry = (Document)channelRegistryCache.get(CHANNEL_REGISTRY_CACHE_KEY); + Document channelRegistry = getChannelRegistry(); Element channelE = null; try { // This is unfortunately dependent on Xalan 2. Is there a way to use a standard interface?
modified getChannel() to call getChannelRegistry() rather than looking directly in the cache for the resulting Document. This will allow the Document to get regenerated if it is not in the cache. git-svn-id: <URL>
Jasig_uPortal
train
java
22ed97bdfa2ad161031470ebaab97b95fd0f3bd5
diff --git a/Kwc/Basic/Text/Form.php b/Kwc/Basic/Text/Form.php index <HASH>..<HASH> 100644 --- a/Kwc/Basic/Text/Form.php +++ b/Kwc/Basic/Text/Form.php @@ -11,7 +11,7 @@ class Kwc_Basic_Text_Form extends Kwc_Abstract_Form $ignoreSettings = array('tablename', 'componentName', 'default', 'assets', 'assetsAdmin', - 'placeholder'); + 'placeholder', 'plugins'); $c = strpos($class, '.') ? substr($class, 0, strpos($class, '.')) : $class; foreach (call_user_func(array($c, 'getSettings')) as $key => $val) { if (!in_array($key, $ignoreSettings)) {
add 'plugins' to ignoreSettings in Basic Text Form because it uses javascript plugins and crashes
koala-framework_koala-framework
train
php
36d408e7de188361ae862286b4c40782f2ea8e7c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +34,9 @@ setup( install_requires=[ 'six>=1.10.0', 'promise==2.1', - 'graphql-core >=2.0', - 'graphene >=2.0', - 'pynamodb>=2.0.0', + 'graphql-core < 3.0, >=2.0', + 'graphene < 3.0, >= 2.0', + 'pynamodb < 3.0.0, >=2.0.0', 'singledispatch>=3.4.0.3', 'wrapt>=1.10.8' ],
Fixing pynamodb to <I> for now
yfilali_graphql-pynamodb
train
py
88ccf1a3ce04c7cf74f94931b0f2fc4ceed988e1
diff --git a/lib/pbs/torque.rb b/lib/pbs/torque.rb index <HASH>..<HASH> 100644 --- a/lib/pbs/torque.rb +++ b/lib/pbs/torque.rb @@ -9,9 +9,26 @@ require 'ffi' module PBS + + # Torque library can be changed dynamically + @@torque_lib = 'torque' + + def self.set(lib) + @@torque_lib = lib + ffi_lib @@torque_lib + end + + def self.get + @@torque_lib + end + + # FFI Library extension using above torque lib extend FFI::Library - ffi_lib 'torque' + ffi_lib @@torque_lib + + # Module methods below + ################################################# extend self # int pbs_errno /* error number */
allow for torque lib to be changed dynamically
OSC_ood_core
train
rb
68e5a94e44d3a154c27759ad9aba3d726aeb4b98
diff --git a/src/Channel/Channel.php b/src/Channel/Channel.php index <HASH>..<HASH> 100644 --- a/src/Channel/Channel.php +++ b/src/Channel/Channel.php @@ -36,6 +36,6 @@ class Channel extends Part const TYPE_GROUP = 3; protected $endpoints = [ - 'get' => 'channels/:id' + 'get' => 'channels/:id', ]; }
the bot is now responding in the channel, next up is responding based on its type
discodian_parts
train
php
ffc8e307f3949980c6f1908ad30c3e985e611824
diff --git a/repository/lib.php b/repository/lib.php index <HASH>..<HASH> 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -2567,6 +2567,8 @@ abstract class repository implements cacheable_object { if ($tempfile = $fs->get_file($user_context->id, 'user', 'draft', $itemid, $newfilepath, $newfilename)) { // Remember original file source field. $source = @unserialize($file->get_source()); + // Remember the original sortorder. + $sortorder = $file->get_sortorder(); if ($tempfile->is_external_file()) { // New file is a reference. Check that existing file does not have any other files referencing to it if (isset($source->original) && $fs->search_references_count($source->original)) { @@ -2585,6 +2587,7 @@ abstract class repository implements cacheable_object { $newfilesource->original = $source->original; $newfile->set_source(serialize($newfilesource)); } + $newfile->set_sortorder($sortorder); // remove temp file $tempfile->delete(); return true;
MDL-<I> Repositories: Maintain the sortorder of a file when overwriting it.
moodle_moodle
train
php
5a80b120b271ae11c25cf8b6825d662b16ec8c72
diff --git a/src/Algebra.php b/src/Algebra.php index <HASH>..<HASH> 100644 --- a/src/Algebra.php +++ b/src/Algebra.php @@ -306,7 +306,7 @@ class Algebra public static function cubic($a₃, $a₂, $a₁, $a₀, bool $return_complex = false): array { if ($a₃ === 0) { - return self::quadratic($a₂, $a₁, $a₀); + return self::quadratic($a₂, $a₁, $a₀, $return_complex); } // Take coefficient a₃ of z³ to be 1 @@ -425,7 +425,7 @@ class Algebra $r = $a₀; // Create the resolvent cubic. // 8m³ + 8pm² + (2p² - 8r)m - q² = 0 - $cubic_roots = self::cubic(8, 8 * $p, 2 * $p ** 2 - 8 * $r, -1 * $q ** 2); + $cubic_roots = self::cubic(8, 8 * $p, 2 * $p ** 2 - 8 * $r, -1 * $q ** 2, $return_complex); // $z₁ will always be a real number, so select it. $m = $cubic_roots[0];
Fix to return_complex flag not being passed to derivatives of the eq. solvers
markrogoyski_math-php
train
php
08fe387b18449b71adf829bc86aecb28c28474c9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -139,7 +139,7 @@ setup( license='MIT', classifiers=classifiers, keywords=keywords, - packages=['moderngl'], + packages=['moderngl', 'moderngl.program_members'], install_requires=install_requires, ext_modules=[mgl], platforms=['any'],
Missing program_members package in release
moderngl_moderngl
train
py
eba4c23c989244cb20382c917965f3fd3e7438c8
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py index <HASH>..<HASH> 100644 --- a/spyder/app/mainwindow.py +++ b/spyder/app/mainwindow.py @@ -2444,8 +2444,8 @@ class MainWindow(QMainWindow): * Spyder: {spyder_version} {commit} * Python: {python_version} * Qt: {qt_version} -* Qt API: {qt_api} {qt_api_ver} -* Operating System: {system_version} {system_release} +* Qt API: {qt_api_name} {qt_api_version} +* Operating System: {os_name} {os_version} ## Dependencies @@ -2459,10 +2459,10 @@ class MainWindow(QMainWindow): commit=revision, python_version=versions['python'], qt_version=versions['qt'], - qt_api=versions['qt_api'], - qt_api_ver=versions['qt_api_ver'], - system_version=versions['system'], - system_release=versions['release'], + qt_api_name=versions['qt_api'], + qt_api_version=versions['qt_api_ver'], + os_name=versions['system'], + os_version=versions['release'], dependencies=dependencies.status()) return issue_template
Remove junk text, use format() and copy to clipboard in report_issue
spyder-ide_spyder
train
py
624e6cdbf386d0862e882db9e35d2c7caaa1b337
diff --git a/integration-cli/docker_test_vars.go b/integration-cli/docker_test_vars.go index <HASH>..<HASH> 100644 --- a/integration-cli/docker_test_vars.go +++ b/integration-cli/docker_test_vars.go @@ -61,12 +61,13 @@ var ( // driver of the daemon. This is initialized in docker_utils by sending // a version call to the daemon and examining the response header. daemonStorageDriver string -) -const ( // WindowsBaseImage is the name of the base image for Windows testing + // Environment variable WINDOWS_BASE_IMAGE can override this WindowsBaseImage = "windowsservercore" +) +const ( // DefaultImage is the name of the base image for the majority of tests that // are run across suites DefaultImage = "busybox" @@ -128,4 +129,9 @@ func init() { } volumesConfigPath = dockerBasePath + "/volumes" containerStoragePath = dockerBasePath + "/containers" + + if len(os.Getenv("WINDOWS_BASE_IMAGE")) > 0 { + WindowsBaseImage = os.Getenv("WINDOWS_BASE_IMAGE") + fmt.Println("INFO: Windows Base image is ", WindowsBaseImage) + } }
Windows: Allow nanoserver image for CLI
moby_moby
train
go
fc27fdb2d3fe468ed31277bbe6b699ea04f9632d
diff --git a/View/Helper/BootstrapHtmlHelper.php b/View/Helper/BootstrapHtmlHelper.php index <HASH>..<HASH> 100644 --- a/View/Helper/BootstrapHtmlHelper.php +++ b/View/Helper/BootstrapHtmlHelper.php @@ -6,8 +6,12 @@ * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2014, George Mponos <gmponos@gmail.com> + * @copyright Copyright 2014, George Mponos + * @author George Mponos, <gmponos@gmail.com> + * @link http://github.com/gmponos/CakeTwitterBootstrap * @license MIT License (http://www.opensource.org/licenses/mit-license.php) + * @todo The functions for the horizontal elements must be removed and the + * horizontal elements must be created with an option */ App::uses('HtmlHelper', 'View/Helper');
Merge origin/master Conflicts: README.md
cakeoven_CakeTwitterBootstrap
train
php
9cfc7da9b3da45e77dae4efb2ca19c63c08105be
diff --git a/velbus/module.py b/velbus/module.py index <HASH>..<HASH> 100644 --- a/velbus/module.py +++ b/velbus/module.py @@ -39,6 +39,7 @@ class Module(object): self._loaded_callbacks = [] self.loaded = False + self._load_in_progress = False self._controller = controller self._controller.subscribe(self.on_message) @@ -148,18 +149,24 @@ class Module(object): """ Retrieve names of channels """ - if not self._is_submodule(): - # load the data from memory ( the stuff that we need) - self._load_memory() - # load the module status - self._request_module_status() - if not self._is_submodule(): - # load the channel names - self._request_channel_name() - if callback: - self._loaded_callbacks.append(callback) - # load the module specific stuff - self._load() + if not self.loaded: + if not self._load_in_progress: + self._load_in_progress = True + if not self._is_submodule(): + # load the data from memory ( the stuff that we need) + self._load_memory() + # load the module status + self._request_module_status() + if not self._is_submodule(): + # load the channel names + self._request_channel_name() + # load the module specific stuff + self._load() + if callback: + self._loaded_callbacks.append(callback) + else: + if callback: + callback() def loading_in_progress(self): return not self._name_messages_complete()
Don't load modules while loading is running
thomasdelaet_python-velbus
train
py
d1ffafdce91a221c9cbcd11808616455c3a4e556
diff --git a/pyowm/webapi25/weather.py b/pyowm/webapi25/weather.py index <HASH>..<HASH> 100644 --- a/pyowm/webapi25/weather.py +++ b/pyowm/webapi25/weather.py @@ -388,8 +388,14 @@ def weather_from_dictionary(d): temp_kf = d['main']['temp_kf'] else: temp_kf = None - temp_max = d['main']['temp_max'] - temp_min = d['main']['temp_min'] + if 'temp_max' in d['main']: + temp_max = d['main']['temp_max'] + else: + temp_max = None + if 'temp_min' in d['main']: + temp_min = d['main']['temp_min'] + else: + temp_min = None temperature = {'temp': temp, 'temp_kf': temp_kf, 'temp_max': temp_max,
Changed weather parser to allow temp_min and temp_max to be optional.
csparpa_pyowm
train
py
33c2f401cd3e104bae125912a5e757a19fbcdc69
diff --git a/spec/shared/spec/dusen/active_record/base_ext_spec.rb b/spec/shared/spec/dusen/active_record/base_ext_spec.rb index <HASH>..<HASH> 100644 --- a/spec/shared/spec/dusen/active_record/base_ext_spec.rb +++ b/spec/shared/spec/dusen/active_record/base_ext_spec.rb @@ -181,6 +181,24 @@ shared_examples_for 'model with search syntax' do end end + + describe '.where_like' do + + it 'finds a word in any of the given columns' do + match1 = subject.create!(:name => 'word', :city => 'XXXX') + match2 = subject.create!(:name => 'XXXX', :city => 'word') + no_match = subject.create!(:name => 'XXXX', :city => 'XXXX') + subject.where_like([:name, :city] => 'word').to_a.should =~ [match1, match2] + end + + it 'requires all the given words' do + match1 = subject.create!(:city => 'word1 word2') + match2 = subject.create!(:city => 'word2 word1') + no_match = subject.create!(:city => 'word1') + subject.where_like(:city => ['word1', 'word2']).to_a.should =~ [match1, match2] + end + + end end
Add specs for .where_like
makandra_dusen
train
rb
a38822ec3d6d73053a67159c3a69e85b483ce6f4
diff --git a/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java b/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java index <HASH>..<HASH> 100644 --- a/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java +++ b/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java @@ -66,8 +66,14 @@ import static org.openscience.cdk.renderer.generators.standard.HydrogenPosition. * * Atoms and bonds can be highlighted by setting the {@link #HIGHLIGHT_COLOR}. The style of * highlight is set with the {@link Highlighting} parameter. + * + * <p/> * + * The <a href="https://github.com/cdk/cdk/wiki/Standard-Generator">Standard Generator - CDK Wiki + * page</a> provides extended details of using and configuring this generator. + * * @author John May + * @see <a href="https://github.com/cdk/cdk/wiki/Standard-Generator">Standard Generator - CDK Wiki</a> */ public final class StandardGenerator implements IGenerator<IAtomContainer> {
Link to the Wiki page in the documentation.
cdk_cdk
train
java
c9fd44efdfe90146cec43061076b77c6cbbab46e
diff --git a/src/client/windshaft.js b/src/client/windshaft.js index <HASH>..<HASH> 100644 --- a/src/client/windshaft.js +++ b/src/client/windshaft.js @@ -406,7 +406,10 @@ export default class Windshaft { } _decodeMVTLayer(mvtLayer, metadata, mvt_extent, catFields, numFields, datesField) { - var properties = [new Float32Array(mvtLayer.length + 1024), new Float32Array(mvtLayer.length + 1024), new Float32Array(mvtLayer.length + 1024), new Float32Array(mvtLayer.length + 1024)]; + const properties = []; + for (let i=0; i<catFields.length+numFields.length; i++){ + properties.push(new Float32Array(mvtLayer.length + 1024)); + } if (this.geomType == 'point') { var points = new Float32Array(mvtLayer.length * 2); }
Flexible number of properties with Windshaft
CartoDB_carto-vl
train
js
09e4def3213b02c8658472781cc3e302cf9398d5
diff --git a/stickytape/__init__.py b/stickytape/__init__.py index <HASH>..<HASH> 100644 --- a/stickytape/__init__.py +++ b/stickytape/__init__.py @@ -509,10 +509,6 @@ _stdlib_modules = set([ ]) -if sys.version_info[0] == 3: - _stdlib_modules.add("asyncio") - - if sys.version_info[0] == 2: _iteritems = lambda x: x.iteritems() @@ -523,3 +519,5 @@ else: _iteritems = lambda x: x.items() _string_escape = repr + + _stdlib_modules.add("asyncio")
Include asyncio as stdlib module for any Python != 2
mwilliamson_stickytape
train
py
c0408664311a6a260b37584ed0a789c831e9878c
diff --git a/private/model/cli/gen-api/main.go b/private/model/cli/gen-api/main.go index <HASH>..<HASH> 100644 --- a/private/model/cli/gen-api/main.go +++ b/private/model/cli/gen-api/main.go @@ -183,6 +183,7 @@ func writeServiceFiles(g *generateInfo, filename string) { if r := recover(); r != nil { fmt.Fprintf(os.Stderr, "Error generating %s\n%s\n%s\n", filename, r, debug.Stack()) + os.Exit(1) } }()
Fix bug in SDK API code gen to exit with failure on error (#<I>)
aws_aws-sdk-go
train
go
4773d65e7e3d012cb1f7350ad1bac6effd9d8832
diff --git a/packages/core/logger/src/Logger.js b/packages/core/logger/src/Logger.js index <HASH>..<HASH> 100644 --- a/packages/core/logger/src/Logger.js +++ b/packages/core/logger/src/Logger.js @@ -75,10 +75,7 @@ class Logger { if (this.logLevel > 4) { if (!this.logFile) { this.logFile = fs.createWriteStream( - path.join( - process.cwd(), - `parcel-debug-${currDate.toLocaleDateString()}@${currDate.toLocaleTimeString()}.log` - ) + path.join(process.cwd(), `parcel-debug-${currDate.toISOString()}.log`) ); } this.logFile.write(stripAnsi(message) + '\n');
fix: remove Date.toLocaleString() in logfile names to prevent slashes (#<I>)
parcel-bundler_parcel
train
js
44ef6e629a7fc0fd9971dcaa4b1d980ace916808
diff --git a/tests/alias_dict.py b/tests/alias_dict.py index <HASH>..<HASH> 100644 --- a/tests/alias_dict.py +++ b/tests/alias_dict.py @@ -56,6 +56,7 @@ class AliasDict_(Spec): ad['myalias'] class dangling_aliases: + "dangling aliases" @raises(KeyError) def raise_KeyError_on_access(self): ad = AliasDict() @@ -76,6 +77,7 @@ class AliasDict_(Spec): ad['myalias'] class recursive_aliasing: + "recursive aliasing" def _recursive_aliases(self): ad = AliasDict() ad.alias('alias1', to='realkey')
Tweak non-method-related test subclasses
bitprophet_lexicon
train
py
be646bdf52ee57d06ef1a4451c8f0d64d8f5cd46
diff --git a/src/LiteCQRS/Bus/AbstractEventMessageBus.php b/src/LiteCQRS/Bus/AbstractEventMessageBus.php index <HASH>..<HASH> 100644 --- a/src/LiteCQRS/Bus/AbstractEventMessageBus.php +++ b/src/LiteCQRS/Bus/AbstractEventMessageBus.php @@ -19,7 +19,7 @@ abstract class AbstractEventMessageBus implements EventMessageBus $this->scheduledEvents = new SplObjectStorage(); } - public function publish(DomainEvent $event) + public function publish($event) { if ($this->events->contains($event)) { return; diff --git a/src/LiteCQRS/Bus/EventMessageBus.php b/src/LiteCQRS/Bus/EventMessageBus.php index <HASH>..<HASH> 100644 --- a/src/LiteCQRS/Bus/EventMessageBus.php +++ b/src/LiteCQRS/Bus/EventMessageBus.php @@ -19,7 +19,7 @@ interface EventMessageBus * @param DomainEvent $event * @return void */ - public function publish(DomainEvent $event); + public function publish($event); /** * Clear all events that have been published, but not yet dispatched to handlers.
Fix bug in EventMEssageBus
beberlei_litecqrs-php
train
php,php
cc4c81ec10f1a4f2365820d741a746d438c48036
diff --git a/project/library/CM/Mail.php b/project/library/CM/Mail.php index <HASH>..<HASH> 100644 --- a/project/library/CM/Mail.php +++ b/project/library/CM/Mail.php @@ -49,10 +49,13 @@ class CM_Mail extends CM_Renderable_Abstract { /** * @param CM_Model_User|string $recipient - * @param array $tplParams - * @param boolean $delayed + * @param array|null $tplParams + * @param boolean|null $delayed */ - public function __construct($recipient, array $tplParams = null, $renderLayout = true, $delayed = false) { + public function __construct($recipient, array $tplParams = null, $delayed = null) { + if ($delayed === null) { + $delayed = false; + } $this->_delayed = (bool) $delayed; if ($this->hasTemplate()) { $this->setRenderLayout(true);
t<I>: changed constructor signature
cargomedia_cm
train
php
d26e19e20d0d40e5e50a311e2a1264b2427f84ba
diff --git a/lib/transforms/writeAssetsToDisc.js b/lib/transforms/writeAssetsToDisc.js index <HASH>..<HASH> 100644 --- a/lib/transforms/writeAssetsToDisc.js +++ b/lib/transforms/writeAssetsToDisc.js @@ -27,12 +27,22 @@ module.exports = function (queryObj, outRoot, root) { return function writeAssetsToDisc(assetGraph, cb) { seq(assetGraph.findAssets(_.extend({isInline: false}, queryObj || {}))) .parEach(40, function (asset) { - var targetUrl; + var targetUrl, + error; + if (outRoot) { targetUrl = urlTools.resolveUrl(outRoot, urlTools.buildRelativeUrl(root || assetGraph.root, asset.url)); } else { targetUrl = asset.url; } + + if (asset.fileName === undefined) { + error = new Error('Missing `fileName` while trying to write file to disc: ' + targetUrl); + error.asset = asset; + assetGraph.emit('error', error); + return this(); + } + mkpathAndWriteFile(urlTools.fileUrlToFsPath(targetUrl), asset.rawSrc, null, this); }) .seq(function () {
Emit a better error message when enountering an asset with a missing file name in tranforms/writeAssetsToDisc
assetgraph_assetgraph
train
js
8cd4bb88ac6be3a0c269c176bba1367eb07610bc
diff --git a/rstcheck.py b/rstcheck.py index <HASH>..<HASH> 100755 --- a/rstcheck.py +++ b/rstcheck.py @@ -670,6 +670,16 @@ def parse_args(): return args +def output_message(text, file=sys.stderr): + """Output message to terminal.""" + if hasattr(file, 'encoding') and file.encoding is None: + # If the output file does not support Unicode, encode it to a byte + # string. This occurs when Python is launched in Vim on some machines. + text = text.encode('utf-8') + + print(text, file=file) + + def main(): """Return 0 on success.""" args = parse_args() @@ -696,14 +706,13 @@ def main(): if not re.match(r'\([A-Z]+/[0-9]+\)', message): message = '(ERROR/3) ' + message - print('{}:{}: {}'.format(filename, - line_number, - message), - file=sys.stderr) + output_message('{}:{}: {}'.format(filename, + line_number, + message)) status = 1 except IOError as exception: - print(exception, file=sys.stderr) + output_message(exception) status = 1 return status
Handle case where Unicode cannot be outputted
myint_rstcheck
train
py
15863772554cbea9a75e1146a152cd9fb112bb0f
diff --git a/builtin/logical/pki/crl_util.go b/builtin/logical/pki/crl_util.go index <HASH>..<HASH> 100644 --- a/builtin/logical/pki/crl_util.go +++ b/builtin/logical/pki/crl_util.go @@ -80,6 +80,13 @@ func revokeCert(ctx context.Context, b *backend, req *logical.Request, serial st } } if certEntry == nil { + if fromLease { + // We can't write to revoked/ or update the CRL anyway because we don't have the cert, + // and there's no reason to expect this will work on a subsequent + // retry. Just give up and let the lease get deleted. + b.Logger().Warn("expired certificate revoke failed because not found in storage, treating as success", "serial", serial) + return nil, nil + } return logical.ErrorResponse(fmt.Sprintf("certificate with serial %s not found", serial)), nil }
When expiration attempts to revoke a cert that's not in storage (perhaps due to pki tidy), don't treat that as an error. Let the lease get expired. (#<I>)
hashicorp_vault
train
go
d7f22a68669ccb9ab93d89bd4493b7b744a9f79e
diff --git a/documenteer/stackdocs/stackcli.py b/documenteer/stackdocs/stackcli.py index <HASH>..<HASH> 100644 --- a/documenteer/stackdocs/stackcli.py +++ b/documenteer/stackdocs/stackcli.py @@ -171,10 +171,11 @@ def clean(ctx): - ``modules`` (symlinks to the module doc directories of Stack packages) - ``packages`` (symlinks to the package doc directories of Stack packages) - ``py-api`` (pages created by automodapi for the Python API reference) + - ``_doxygen`` (the Doxygen build) """ logger = logging.getLogger(__name__) - dirnames = ['py-api', '_build', 'modules', 'packages'] + dirnames = ['py-api', '_build', 'modules', 'packages', '_doxygen'] dirnames = [os.path.join(ctx.obj['root_project_dir'], dirname) for dirname in dirnames] for dirname in dirnames:
Add _doxygen directory to stack-docs clean
lsst-sqre_documenteer
train
py
6aec6375d537415d27cc24d4b401b45270810f3a
diff --git a/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java b/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java index <HASH>..<HASH> 100644 --- a/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java +++ b/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java @@ -398,6 +398,12 @@ public class DefaultAndroidEmulator extends AbstractDevice implements AndroidEmu } event1.remove(coordinate); } + + try { + Thread.sleep(750); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } @Override
need to sleep after clicking all apps button, to check for launch
selendroid_selendroid
train
java
2c1022298e2099b38198acd68ac8c6f0053fb028
diff --git a/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php b/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php index <HASH>..<HASH> 100644 --- a/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php +++ b/wp-multi-network/includes/classes/class-wp-ms-networks-admin.php @@ -865,8 +865,8 @@ class WP_MS_Networks_Admin { $success = '0'; if ( ! empty( $result ) && ! is_wp_error( $result ) ) { - if ( ! empty( $posted['title'] ) ) { - update_network_option( $result, 'site_name', $posted['title'] ); + if ( ! empty( $network_title ) ) { + update_network_option( $result, 'site_name', $network_title ); } update_network_option(
Add Network: use correct $network_title variable. (#<I>) This commit fixes the saving of the New Network name/title. Introduced in 3b<I>ac. Holy crap that was 3 years ago. 😢
stuttter_wp-multi-network
train
php
8f0f5d84c57aa05d6d394b2a847e186062c9b026
diff --git a/curdling/index.py b/curdling/index.py index <HASH>..<HASH> 100644 --- a/curdling/index.py +++ b/curdling/index.py @@ -1,8 +1,8 @@ from __future__ import absolute_import, print_function, unicode_literals from collections import defaultdict from distlib.util import parse_requirement +from threading import RLock from pkg_resources import parse_version, safe_name - from curdling.util import split_name, filehash import os @@ -41,9 +41,11 @@ class PackageNotFound(Exception): class Index(object): + def __init__(self, base_path): self.base_path = base_path self.storage = defaultdict(lambda: defaultdict(list)) + self.lock = RLock() def scan(self): if not os.path.isdir(self.base_path): @@ -55,8 +57,9 @@ class Index(object): def ensure_path(self, destination): path = os.path.dirname(destination) - if not os.path.isdir(path): - os.makedirs(path) + with self.lock: + if not os.path.isdir(path): + os.makedirs(path) return destination def index(self, path):
Fix race condition in Index.ensure_path()
clarete_curdling
train
py
7205366c9f85bbfcf86ac78efcd005bb10dfc5fe
diff --git a/core/state/statedb.go b/core/state/statedb.go index <HASH>..<HASH> 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -471,8 +471,14 @@ func (self *StateDB) Copy() *StateDB { } // Copy the dirty states, logs, and preimages for addr := range self.journal.dirties { - state.stateObjects[addr] = self.stateObjects[addr].deepCopy(state) - state.stateObjectsDirty[addr] = struct{}{} + // As documented [here](https://github.com/ethereum/go-ethereum/pull/16485#issuecomment-380438527), + // and in the Finalise-method, there is a case where an object is in the journal but not + // in the stateObjects: OOG after touch on ripeMD prior to Byzantium. Thus, we need to check for + // nil + if object, exist := self.stateObjects[addr]; exist { + state.stateObjects[addr] = object.deepCopy(state) + state.stateObjectsDirty[addr] = struct{}{} + } } // Above, we don't copy the actual journal. This means that if the copy is copied, the // loop above will be a no-op, since the copy's journal is empty.
core/state: fix ripemd-cornercase in Copy
ethereum_go-ethereum
train
go
6f6e14ee52cb46f76870a8ae0968af88f6f87e01
diff --git a/graph/bolt/quadstore.go b/graph/bolt/quadstore.go index <HASH>..<HASH> 100644 --- a/graph/bolt/quadstore.go +++ b/graph/bolt/quadstore.go @@ -37,6 +37,10 @@ func init() { } var ( + errNoBucket = errors.New("bolt: bucket is missing") +) + +var ( hashPool = sync.Pool{ New: func() interface{} { return sha1.New() }, } @@ -97,7 +101,9 @@ func newQuadStore(path string, options graph.Options) (graph.QuadStore, error) { return nil, err } err = qs.getMetadata() - if err != nil { + if err == errNoBucket { + panic("bolt: quadstore has not been initialised") + } else if err != nil { return nil, err } return &qs, nil @@ -451,6 +457,9 @@ func (qs *QuadStore) SizeOf(k graph.Value) int64 { func (qs *QuadStore) getInt64ForKey(tx *bolt.Tx, key string, empty int64) (int64, error) { var out int64 b := tx.Bucket(metaBucket) + if b == nil { + return empty, errNoBucket + } data := b.Get([]byte(key)) if data == nil { return empty, nil
Fix nil pointer panic when meta bucket is missing If NewQuadStore was called without first calling InitQuadStore, the runtime would panic since the meta bucket never was created.
cayleygraph_cayley
train
go
52654a9d634c93a5a46f176b4ec6137d3ddb81a8
diff --git a/framework/yii/gii/generators/form/templates/form.php b/framework/yii/gii/generators/form/templates/form.php index <HASH>..<HASH> 100644 --- a/framework/yii/gii/generators/form/templates/form.php +++ b/framework/yii/gii/generators/form/templates/form.php @@ -27,7 +27,7 @@ use yii\widgets\ActiveForm; <?php endforeach; ?> <div class="form-group"> - <?php echo '<?php'; ?> echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?> + <?php echo '<?php'; ?> echo Html::submitButton('Submit', array('class' => 'btn btn-primary')); ?> </div> <?php echo '<?php'; ?> ActiveForm::end(); ?>
Changed label for gii generated form [skip ci]
yiisoft_yii2-debug
train
php
09e44aef4dd6fc3c06097b8a7c566b0ab40a7639
diff --git a/src/rez/pip.py b/src/rez/pip.py index <HASH>..<HASH> 100644 --- a/src/rez/pip.py +++ b/src/rez/pip.py @@ -200,29 +200,17 @@ def pip_to_rez_package_name(distribution): return name -def run_pip_command(command_args, process_output=False, pip_version=None, python_version=None): +def run_pip_command(command_args, pip_version=None, python_version=None): """Run a pip command. - Args: command_args (list of str): Args to pip. - Returns: `subprocess.Popen`: Pip process. """ pip_exe, context = find_pip(pip_version, python_version) command = [pip_exe] + list(command_args) - if process_output: - try: - subprocess.check_output(command, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as e: - regex = r"(?<=\(from versions:).*?(?=\))" - pattern = re.compile(regex) - match = pattern.search(e.output) - output = match.group(0).split(",") - return output - - elif context is None: + if context is None: return popen(command) else: return context.execute_shell(command=command, block=False)
fix(rez-pip): revert to original run pip command function
nerdvegas_rez
train
py
869ce1742e1678bee7d59b0569dad984745c673e
diff --git a/panels/_version.py b/panels/_version.py index <HASH>..<HASH> 100644 --- a/panels/_version.py +++ b/panels/_version.py @@ -1,2 +1,2 @@ # Versions compliant with PEP 440 https://www.python.org/dev/peps/pep-0440 -__version__ = "0.0.55" +__version__ = "0.0.56"
Update version number to <I>
chaoss_grimoirelab-sigils
train
py
8fcdcf459a66c052cb31bdbb6de649651f394f84
diff --git a/app/controllers/api/content_view_definitions_controller.rb b/app/controllers/api/content_view_definitions_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/api/content_view_definitions_controller.rb +++ b/app/controllers/api/content_view_definitions_controller.rb @@ -28,14 +28,12 @@ class Api::ContentViewDefinitionsController < Api::ApiController api :GET, "/organizations/:organization_id/content_view_definitions", "List content view definitions" param :organization_id, :identifier, :desc => "organization identifier" - param :label, :identifier, :desc => "content view identifier" - param :environment_id, :identifier, :desc => "environment id for filtering" + param :label, String, :desc => "content view label" + param :name, String, :desc => "content view name" + param :id, :identifier, :desc => "content view id" def index - @definitions = if (label = params[:label]).present? - ContentViewDefinition.readable(@organization).where(:label => label) - else - ContentViewDefinition.readable(@organization) - end + query_params.delete(:organization_id) + @definitions = ContentViewDefinition.where(query_params).readable(@organization) render :json => @definitions end
Content views: added id and name to cli definition commands
Katello_katello
train
rb
2380be3a38bc210337398a22732f917d45f516bd
diff --git a/kernel/classes/ezcontentobjecttreenode.php b/kernel/classes/ezcontentobjecttreenode.php index <HASH>..<HASH> 100644 --- a/kernel/classes/ezcontentobjecttreenode.php +++ b/kernel/classes/ezcontentobjecttreenode.php @@ -1790,6 +1790,12 @@ class eZContentObjectTreeNode extends eZPersistentObject */ static function getLimitationList( &$limitation ) { + // do not check currentUser if limitation is disabled + if ( empty( $limitation ) and is_array( $limitation ) ) + { + return $limitation; + } + $currentUser = eZUser::currentUser(); $currentUserID = $currentUser->attribute( 'contentobject_id' ); $limitationList = array();
Update kernel/classes/ezcontentobjecttreenode.php eZContentObjectTreeNode::getLimitationList() does not need to know the user permissions when policy limitations are disabled, so don't check it. This enables using methods like eZContentObjectTreeNode::subTreeByNodeID() to be used in SSO handler functions without an infinite loop.
ezsystems_ezpublish-legacy
train
php
4516db5c777a2f48f4a5f2713c76a589e7577f7f
diff --git a/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/servicedescription/freemarker/RestServiceResourceInfo.java b/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/servicedescription/freemarker/RestServiceResourceInfo.java index <HASH>..<HASH> 100644 --- a/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/servicedescription/freemarker/RestServiceResourceInfo.java +++ b/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/servicedescription/freemarker/RestServiceResourceInfo.java @@ -266,8 +266,9 @@ public class RestServiceResourceInfo implements Comparable<RestServiceResourceIn sb.append(" \"").append(url).append('"'); - // Add Content-Type and binary for POST/PUT - if (getRequestEntity() != null && (getHttpMethod().equals("POST") || getHttpMethod().equals("PUT"))) + // Add Content-Type and binary for POST/PUT/PATCH + if (getRequestEntity() != null && + (getHttpMethod().equals("POST") || getHttpMethod().equals("PUT") || getHttpMethod().equals("PATCH"))) { final boolean isXML = isRequestXML();
Treat PATCH methods like PUT/POST in autogenerated docs
petergeneric_stdlib
train
java
5cc6f74ef161b2bd8d8205e3f8643cfba715bad0
diff --git a/httpdlog/httpdlog-pigloader/src/test/java/nl/basjes/pig/input/apachehttpdlog/ScreenResolutionDissector.java b/httpdlog/httpdlog-pigloader/src/test/java/nl/basjes/pig/input/apachehttpdlog/ScreenResolutionDissector.java index <HASH>..<HASH> 100644 --- a/httpdlog/httpdlog-pigloader/src/test/java/nl/basjes/pig/input/apachehttpdlog/ScreenResolutionDissector.java +++ b/httpdlog/httpdlog-pigloader/src/test/java/nl/basjes/pig/input/apachehttpdlog/ScreenResolutionDissector.java @@ -35,8 +35,8 @@ public class ScreenResolutionDissector extends Dissector { return; // Nothing to do here } - if (fieldValue.contains("x")) { - String[] parts = fieldValue.split("x"); + if (fieldValue.contains(separator)) { + String[] parts = fieldValue.split(separator); if (wantWidth) { parsable.addDissection(inputname, "SCREENWIDTH", "width", parts[0]); }
Small fix in Pig loader unit test
nielsbasjes_logparser
train
java
924c9c239e26d7ed2bbf052237c16e76a648ace7
diff --git a/src/openaccess_epub/utils/element_methods.py b/src/openaccess_epub/utils/element_methods.py index <HASH>..<HASH> 100644 --- a/src/openaccess_epub/utils/element_methods.py +++ b/src/openaccess_epub/utils/element_methods.py @@ -14,6 +14,11 @@ import xml.parsers.expat import html.parser import logging +__all__ = ['append_new_text', 'append_all_below', 'all_text', 'comment', + 'elevate_element', 'get_attribute', 'insert_before', 'ns_format', + 'remove', 'remove_all_attributes', 'rename_attributes', 'replace', + 'serialize', 'uncomment'] + log = logging.getLogger('openaccess_epub.utils.element_methods')
creating an __all__ list for element_methods
SavinaRoja_OpenAccess_EPUB
train
py
5fd839f108b6f065c3d1734d82b2f8be8e767b73
diff --git a/printf.go b/printf.go index <HASH>..<HASH> 100644 --- a/printf.go +++ b/printf.go @@ -95,19 +95,19 @@ func ShouldColorize(out io.Writer) bool { } func Printf(format string, a ...interface{}) (int, error) { - s := colorize(format) + s := Sprintf(format, a...) if !ShouldColorize(os.Stdout) { s = strip(s) } - return fmt.Printf(s, a...) + return fmt.Printf("%s", s) } func Fprintf(out io.Writer, format string, a ...interface{}) (int, error) { - s := colorize(format) + s := Sprintf(format, a...) if !ShouldColorize(out) { s = strip(s) } - return fmt.Fprintf(out, s, a...) + return fmt.Fprintf(out, "%s", s) } func Sprintf(format string, a ...interface{}) string {
Properly scrub ANSI sequences from arguments too ansi.Printf("%s", ansi.Sprintf("@R{...}")) should just work, and now it does. The strip() operation (based on colorable / tty-ness) is deferred until the final print via the real fmt library.
jhunt_go-ansi
train
go
9e154f8ab55a9aaec907c534a5d2c563dded353d
diff --git a/straps/GroupAuth.php b/straps/GroupAuth.php index <HASH>..<HASH> 100644 --- a/straps/GroupAuth.php +++ b/straps/GroupAuth.php @@ -26,11 +26,13 @@ class GroupAuth extends \admin\ngrest\StrapAbstract implements \admin\ngrest\Str ]); } - public function callbackUpdateSubscription($rights = []) + public function callbackUpdateSubscription() { - $safeCopy = []; + $rights = \yii::$app->request->post('rights', []); + $safeCopy = []; foreach($rights as $authId => $options) { + if (!isset($options['base'])) { return $this->response(false, ['message' => 'you have to select at least the ANZEIGEN value.']); }
fixed bug where rights came from get param instead of post param.
luyadev_luya-module-admin
train
php
4ec77aadcb7781ac95785e33d533a2d61536b7f8
diff --git a/telemetry/telemetry/page.py b/telemetry/telemetry/page.py index <HASH>..<HASH> 100644 --- a/telemetry/telemetry/page.py +++ b/telemetry/telemetry/page.py @@ -20,6 +20,7 @@ class Page(object): self.url = url self.base_dir = base_dir self.credentials = None + self.disabled = False self.wait_time_after_navigate = 2 if attributes: diff --git a/telemetry/telemetry/page_runner.py b/telemetry/telemetry/page_runner.py index <HASH>..<HASH> 100644 --- a/telemetry/telemetry/page_runner.py +++ b/telemetry/telemetry/page_runner.py @@ -48,7 +48,16 @@ def _ShuffleAndFilterPageSet(page_set, options): page_regex = re.compile(options.page_filter) except re.error: raise Exception('--page-filter: invalid regex') - pages = [page for page in pages if page_regex.search(page.url)] + else: + page_regex = None + + def IsSelected(page): + if page.disabled: + return False + if page_regex: + return page_regex.search(page.url) + return True + pages = [page for page in pages if IsSelected(page)] if options.test_shuffle: random.Random().shuffle(pages)
[telemetry] Add page.disabled so that page set items can be temporarily disabled The key_mobile_sites is busted in a few wierd ways with impl-side painting, but I dont want to lose the site from the page set. This is what This is what I thought of as a way around that concern NOTRY=True Review URL: <URL>
catapult-project_catapult
train
py,py
d135b3f903333e6177cd06a0699a3985c3afc6b0
diff --git a/aeron-archiver/src/main/java/io/aeron/archiver/RecordingWriter.java b/aeron-archiver/src/main/java/io/aeron/archiver/RecordingWriter.java index <HASH>..<HASH> 100644 --- a/aeron-archiver/src/main/java/io/aeron/archiver/RecordingWriter.java +++ b/aeron-archiver/src/main/java/io/aeron/archiver/RecordingWriter.java @@ -65,15 +65,7 @@ final class RecordingWriter implements AutoCloseable, RawBlockHandler static final int END_OF_DATA_INDICATOR = 0; private static final int NULL_SEGMENT_POSITION = -1; - private static final ThreadLocal<Marker> MARKER = new ThreadLocal<Marker>() - { - protected Marker initialValue() - { - return new Marker(); - } - }; - - + private static final ThreadLocal<Marker> MARKER = ThreadLocal.withInitial(Marker::new); private final boolean forceWrites;
[Java] use ThreadLocal.withInitial instead
real-logic_aeron
train
java
16f17377c0e48d2a4a8853fd7edd0bae2c1d9710
diff --git a/bcbio/pipeline/variation.py b/bcbio/pipeline/variation.py index <HASH>..<HASH> 100644 --- a/bcbio/pipeline/variation.py +++ b/bcbio/pipeline/variation.py @@ -56,7 +56,7 @@ def _combine_validations(items): if v and v.get("grading_plots"): pngs |= set(v.get("grading_plots")) if len(csvs) == 1: - grading_summary = csvs.pop(0) + grading_summary = csvs.pop() else: grading_summary = os.path.join(utils.safe_makedir(os.path.join(dd.get_work_dir(items[0]), "validation")), "grading-summary-combined.csv")
CWL: fix grading summary for single batch
bcbio_bcbio-nextgen
train
py
cde3a73f46c173f4fe304a6e1f7e29d61f1496b7
diff --git a/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LabelBy.java b/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LabelBy.java index <HASH>..<HASH> 100644 --- a/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LabelBy.java +++ b/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LabelBy.java @@ -44,18 +44,18 @@ public class LabelBy extends SingleElementOrNullBy { @Override public WebElement findElement(SearchContext context) { WebElement label = by.findElement(context); - WebElement element = getLabelledElement(label); + WebElement element = getLabelledElement(context, label); return element; } - public static WebElement getLabelledElement(WebElement label) { + public static WebElement getLabelledElement(SearchContext conetxt, WebElement label) { WebElement element = null; if (label != null) { String forAttr = label.getAttribute("for"); if (forAttr == null || "".equals(forAttr)) { element = ConstantBy.nestedElementForValue().findElement(label); } else { - element = new BestMatchBy(By.id(forAttr)).findElement(label); + element = new BestMatchBy(By.id(forAttr)).findElement(conetxt); } } return element;
Finding the element the for points to should look at whole scope, not just inside the label
fhoeben_hsac-fitnesse-fixtures
train
java
09cbe51999f423fd2d1434d3abd81cdfdb36d0ac
diff --git a/version.php b/version.php index <HASH>..<HASH> 100644 --- a/version.php +++ b/version.php @@ -29,11 +29,11 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2019042700.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2019050100.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. -$release = '3.7dev+ (Build: 20190427)'; // Human-friendly version name +$release = '3.7dev+ (Build: 20190501)'; // Human-friendly version name $branch = '37'; // This version's branch. $maturity = MATURITY_ALPHA; // This version's maturity level.
on-demand release <I>dev+
moodle_moodle
train
php
9e76dbe10b00dd1fa8f29cfa4fac72297beb32a4
diff --git a/builder/builder.go b/builder/builder.go index <HASH>..<HASH> 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -47,6 +47,9 @@ func (b *Builder) Run() error { } base := strings.ToLower(filepath.Base(path)) + if strings.HasPrefix(base, "_") { + return filepath.SkipDir + } for _, f := range b.IgnoredFolders { if strings.ToLower(f) == base { return filepath.SkipDir
ignore directories starting with _ as per the go spec
gobuffalo_packr
train
go
ab1edc79e05a27318b91020dd4145ef370bb1754
diff --git a/conn.go b/conn.go index <HASH>..<HASH> 100644 --- a/conn.go +++ b/conn.go @@ -78,7 +78,8 @@ type Identifier []string func (ident Identifier) Sanitize() string { parts := make([]string, len(ident)) for i := range ident { - parts[i] = `"` + strings.Replace(ident[i], `"`, `""`, -1) + `"` + s := strings.Replace(ident[i], string([]byte{0}), "", -1) + parts[i] = `"` + strings.Replace(s, `"`, `""`, -1) + `"` } return strings.Join(parts, ".") } diff --git a/conn_test.go b/conn_test.go index <HASH>..<HASH> 100644 --- a/conn_test.go +++ b/conn_test.go @@ -647,6 +647,10 @@ func TestIdentifierSanitize(t *testing.T) { ident: pgx.Identifier{`you should " not do this`, `please don't`}, expected: `"you should "" not do this"."please don't"`, }, + { + ident: pgx.Identifier{`you should ` + string([]byte{0}) + `not do this`}, + expected: `"you should not do this"`, + }, } for i, tt := range tests {
Remove 0 bytes when sanitizing identifiers Port of <I>ea<I>a<I>c<I>d<I>a<I>a<I> from v3.
jackc_pgx
train
go,go
f534e13a7ec5fde84adcf0725f5b8b3aae5bd217
diff --git a/test/helper/InstrumentTests.js b/test/helper/InstrumentTests.js index <HASH>..<HASH> 100644 --- a/test/helper/InstrumentTests.js +++ b/test/helper/InstrumentTests.js @@ -2,7 +2,7 @@ define(["helper/OutputAudio", "Tone/instrument/Instrument", "helper/OutputAudioS "Test", "helper/Offline"], function (OutputAudio, Instrument, OutputAudioStereo, Test, Offline) { - return function(Constr, note, constrArg){ + return function(Constr, note, constrArg, optionsIndex){ context("Instrument Tests", function(){ @@ -19,9 +19,15 @@ define(["helper/OutputAudio", "Tone/instrument/Instrument", "helper/OutputAudioS }); it ("can set the volume", function(){ - var instance = new Constr({ - "volume" : -10 - }); + if (!optionsIndex){ + var instance = new Constr({ + "volume" : -10 + }); + }else if (optionsIndex === 1){ + var instance = new Constr(constrArg, { + "volume" : -10 + }); + } expect(instance.volume.value).to.be.closeTo(-10, 0.1); instance.dispose(); });
optionally pass in the options object in the second argument
Tonejs_Tone.js
train
js
f963b059943e5c3c33507e95c1a5116ad3ae71b5
diff --git a/azurerm/internal/services/privatedns/client.go b/azurerm/internal/services/privatedns/client.go index <HASH>..<HASH> 100644 --- a/azurerm/internal/services/privatedns/client.go +++ b/azurerm/internal/services/privatedns/client.go @@ -8,7 +8,7 @@ import ( type Client struct { RecordSetsClient *privatedns.RecordSetsClient PrivateZonesClient *privatedns.PrivateZonesClient - VirtualNetworkLinksClient privatedns.VirtualNetworkLinksClient + VirtualNetworkLinksClient *privatedns.VirtualNetworkLinksClient } func BuildClient(o *common.ClientOptions) *Client { @@ -24,6 +24,6 @@ func BuildClient(o *common.ClientOptions) *Client { return &Client{ RecordSetsClient: &RecordSetsClient, PrivateZonesClient: &PrivateZonesClient, - VirtualNetworkLinksClient: virtualNetworkLinksClient, + VirtualNetworkLinksClient: &virtualNetworkLinksClient, } }
refactor: making the virtual networks client a pointer
terraform-providers_terraform-provider-azurerm
train
go
6e5090c9c35e55b510e439fe62410ab5dc916f05
diff --git a/tools/webpack.client.js b/tools/webpack.client.js index <HASH>..<HASH> 100644 --- a/tools/webpack.client.js +++ b/tools/webpack.client.js @@ -166,6 +166,21 @@ module.exports = { }) }, { + // set up standard-loader as a preloader + enforce: 'pre', + test: /\.js$/, + loader: 'standard-loader', + exclude: /node_modules/, + options: { + // Emit errors instead of warnings (default = false) + error: false, + // enable snazzy output (default = true) + snazzy: true, + // other config options to be passed through to standard e.g. + parser: 'babel-eslint' + } + }, + { test: /\.js$/, loader: 'babel-loader', options: {
Add standard-loader to webpack config #<I>
nossas_bonde-client
train
js
df6637c073824b9df9e2399a4d389ff86bb5e064
diff --git a/bibtasklets/bst_elsevier.py b/bibtasklets/bst_elsevier.py index <HASH>..<HASH> 100644 --- a/bibtasklets/bst_elsevier.py +++ b/bibtasklets/bst_elsevier.py @@ -41,14 +41,12 @@ def bst_elsevier(): continue else: write_message("New pacakge discovered for publisher %s: %s" % ('Elsevier', name)) - run_sql("INSERT INTO package(name, delivery_date) VALUES(%s, %s)", (name, date)) + run_sql("INSERT INTO package(name, delivery_date) VALUES(%s, %s)", (name.strip(), date)) for dp in els.doi_package_name_mapping: try: p_name, doi = dp - write_message('%s %s' % (p_name, doi)) - p_id = run_sql("SELECT id FROM package WHERE name=%s", (p_name,)) - write_message(p_id) + p_id = run_sql("SELECT id FROM package WHERE name=%s", (p_name.strip(),)) try: write_message("Adding doi to package: %d %s" % (p_id[0][0], doi)) run_sql("INSERT INTO doi_package VALUES(%s, %s)", (p_id[0][0], doi))
Removes whitespaces from package names in db "package" table.
inspirehep_harvesting-kit
train
py
2fdc327f37f3fda53e0dd27eb2dd15b9ea9af408
diff --git a/ABC.py b/ABC.py index <HASH>..<HASH> 100644 --- a/ABC.py +++ b/ABC.py @@ -46,7 +46,7 @@ class ABC: self.employers.append(Bee('employer', generateRandomValues())) self.employers[i].currFitnessScore = runNeuralNet(self.employers[i].values) - ''' + ''' Assign a new position to the given bee, firstBee and secondBee are represented in the form of index values for the list of all bees inside the employers list. @@ -124,6 +124,7 @@ class ABC: self.assignNewPositions(i) print("Checking if done") running = self.checkIfDone() + saveScore(self.bestFitnessScore, self.bestValues) if running == False: break print("Getting fitness average") @@ -138,4 +139,3 @@ class ABC: print("Iteration score:", self.iterBestFitnessScore) print("Iteratiion values:", self.iterBestValues) -# TODO -- Add file logging to store the best scores as they go.
Save scores/values in a text file
ECRL_ecabc
train
py