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
6613448879a45187ea3e8d52d533d1e9475cc1ab
diff --git a/morango/apps.py b/morango/apps.py index <HASH>..<HASH> 100644 --- a/morango/apps.py +++ b/morango/apps.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import logging as logger from django.apps import AppConfig -from django.db.utils import OperationalError, ProgrammingError from morango.utils.register_models import add_syncable_models logging = logger.getLogger(__name__) @@ -14,22 +13,7 @@ class MorangoConfig(AppConfig): verbose_name = 'Morango' def ready(self): - from django.core.management import call_command - from morango.models import InstanceIDModel - from morango.certificates import ScopeDefinition from .signals import add_to_deleted_models # noqa: F401 - # NOTE: Warning: https://docs.djangoproject.com/en/1.10/ref/applications/#django.apps.AppConfig.ready - # its recommended not to execute queries in this method, but we are producing the same result after the first call, so its OK - - # call this on app load up to get most recent system config settings - try: - InstanceIDModel.get_or_create_current_instance() - if not ScopeDefinition.objects.filter(): - call_command("loaddata", "scopedefinitions") - # we catch this error in case the database has not been migrated, b/c we can't query it until its been created - except (OperationalError, ProgrammingError): - pass - # add models to be synced by profile add_syncable_models()
Remove db access at app loading time
learningequality_morango
train
py
a26053925a22cb737638264b49ae837957689cbc
diff --git a/lib/grit/git-ruby.rb b/lib/grit/git-ruby.rb index <HASH>..<HASH> 100644 --- a/lib/grit/git-ruby.rb +++ b/lib/grit/git-ruby.rb @@ -72,8 +72,8 @@ module Grit (sha1, sha2) = string.split('..') return [rev_parse({}, sha1), rev_parse({}, sha2)] end - - if /\w{40}/.match(string) # passing in a sha - just no-op it + + if /^[0-9a-f]{40}$/.match(string) # passing in a sha - just no-op it return string.chomp end
stricter method of guessing if the ref is a sha
mojombo_grit
train
rb
17158902d14e0bbea0dac8c2a91e58a2f4c656a7
diff --git a/lib/getItemDepth.js b/lib/getItemDepth.js index <HASH>..<HASH> 100644 --- a/lib/getItemDepth.js +++ b/lib/getItemDepth.js @@ -1,3 +1,4 @@ +const getCurrentItem = require('./getCurrentItem'); /** * Get depth of current block in a document list @@ -11,14 +12,13 @@ function getItemDepth(opts, state, block) { const { document, startBlock } = state; block = block || startBlock; - const item = document.getParent(block.key); - const list = document.getParent(item.key); - - const isInDocument = document.getChild(list.key); - if (isInDocument) { - return 1; + const currentItem = getCurrentItem(opts, state, block); + if (!currentItem) { + return 0; } + const list = document.getParent(currentItem.key); + return (1 + getItemDepth(opts, state, list)); }
Fix getItemDepth when selection is at range of an item
GitbookIO_slate-edit-list
train
js
ae4edaab0181c711973ad95e9013a41095485923
diff --git a/lib/opal/lexer.rb b/lib/opal/lexer.rb index <HASH>..<HASH> 100644 --- a/lib/opal/lexer.rb +++ b/lib/opal/lexer.rb @@ -748,6 +748,14 @@ module Opal @lex_state = @lex_state == :expr_fname ? :expr_end : :expr_beg return '%', '%' + elsif scanner.scan(/\\/) + if scanner.scan(/\r?\n/) + space_seen = true + next + end + + raise SyntaxError, "backslash must appear before newline :#{@file}:#{@line}" + elsif scanner.scan(/\(/) result = scanner.matched if [:expr_beg, :expr_mid].include? @lex_state
Support backslash escaping of new line tokens in lexer
opal_opal
train
rb
5a885663379eb04ad99c3db56376c5dcb8d764d0
diff --git a/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java b/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java index <HASH>..<HASH> 100644 --- a/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java +++ b/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java @@ -57,7 +57,7 @@ public class SingularityS3UploaderConfiguration extends BaseRunnerConfiguration private int retryWaitMs = 1000; @JsonProperty - private int retryCount = 1; + private int retryCount = 2; public SingularityS3UploaderConfiguration() { super(Optional.of("singularity-s3uploader.log"));
default retry count to 2, so we actually retry
HubSpot_Singularity
train
java
cb9b166e08be51bff9b0a98ce266507c702740eb
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index <HASH>..<HASH> 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -493,7 +493,10 @@ class Plugin(object): if not path: return 0 readable = self.archive.open_file(path) - result, replacements = re.subn(regexp, subst, readable.read()) + content = readable.read() + if not isinstance(content, six.string_types): + content = content.decode('utf8', 'ignore') + result, replacements = re.subn(regexp, subst, content) if replacements: self.archive.add_string(result, srcpath) else:
[Plugin] decode content read from file in do_file_sub() Fixes: #<I>
sosreport_sos
train
py
32d07ed0cfc20895bfef79b09a83870481eaa27c
diff --git a/fades/envbuilder.py b/fades/envbuilder.py index <HASH>..<HASH> 100644 --- a/fades/envbuilder.py +++ b/fades/envbuilder.py @@ -47,7 +47,6 @@ class FadesEnvBuilder(EnvBuilder): self.pip_installer_fname = os.path.join(basedir, "get-pip.py") self.env_bin_path = "" self.deps = deps - super().__init__(with_pip=False) logger.debug("Libs to install: %s", self.deps) logger.debug("Env will be created at: %s", self.env_path) @@ -60,6 +59,11 @@ class FadesEnvBuilder(EnvBuilder): except ImportError: self._pip_installed = False + if self._pip_installed: + super().__init__(with_pip=True) + else: + super().__init__(with_pip=False) + def create_and_install(self): """Create and install the venv.""" self.create(self.env_path)
Creating virtualenv with pip if ensurepip is present. solve #<I>
PyAr_fades
train
py
cfa7a475a000654c33f808b8f995f22c95943399
diff --git a/lib/prawn/svg/elements/gradient.rb b/lib/prawn/svg/elements/gradient.rb index <HASH>..<HASH> 100644 --- a/lib/prawn/svg/elements/gradient.rb +++ b/lib/prawn/svg/elements/gradient.rb @@ -42,12 +42,9 @@ class Prawn::SVG::Elements::Gradient < Prawn::SVG::Elements::Base end def assert_compatible_prawn_version - # At the moment, the patch required for this functionality to work in prawn has not been merged. - raise SkipElementError, "We are unfortunately still waiting on the Prawn project to merge a pull request that is required for this feature to correctly function" - -# if (Prawn::VERSION.split(".").map(&:to_i) <=> [2, 0, 4]) == -1 -# raise SkipElementError, "Prawn 2.0.4+ must be used if you'd like prawn-svg to render gradients" -# end + if (Prawn::VERSION.split(".").map(&:to_i) <=> [2, 2, 0]) == -1 + raise SkipElementError, "Prawn 2.2.0+ must be used if you'd like prawn-svg to render gradients" + end end def load_gradient_configuration
Enable gradients when running with Prawn <I>+ Closes #<I>.
mogest_prawn-svg
train
rb
63324e68598e376aa02e792d2d7e97ef7646faef
diff --git a/src/Http/Url.php b/src/Http/Url.php index <HASH>..<HASH> 100644 --- a/src/Http/Url.php +++ b/src/Http/Url.php @@ -19,11 +19,11 @@ final class Url $parsed = parse_url($value); if ($parsed === false) { - throw new \InvalidArgumentException(); + throw new \InvalidArgumentException($value . ' is not a valid url.'); } if (!isset($parsed['host']) && !isset($parsed['scheme'])) { - throw new \InvalidArgumentException(); + throw new \InvalidArgumentException('The url ' . $value . ' must at least consists of host and scheme.'); } $this->value = $value;
Throw meaningful exception message if given url is not valid.
marein_php-nchan-client
train
php
50eb46b3114a5a10d436f237b96d77e4655abf9f
diff --git a/components/Builder/Builder.php b/components/Builder/Builder.php index <HASH>..<HASH> 100644 --- a/components/Builder/Builder.php +++ b/components/Builder/Builder.php @@ -20,6 +20,7 @@ if ( !function_exists( 'pods_builder_modules_init' ) ) { require_once( PODS_DIR . 'components/Builder/modules/form/PodsBuilderModuleForm.php' ); require_once( PODS_DIR . 'components/Builder/modules/list/PodsBuilderModuleList.php' ); require_once( PODS_DIR . 'components/Builder/modules/single/PodsBuilderModuleSingle.php' ); + require_once( PODS_DIR . 'components/Builder/modules/view/PodsBuilderModuleView.php' ); } add_action( 'builder_modules_loaded', 'pods_builder_modules_init' ); } \ No newline at end of file
Include Builder 'PodsView' module, previously the file wasn't included
pods-framework_pods
train
php
31298732532e700ba1bb7ff6599ec36771384231
diff --git a/ipyrad/assemble/write_outfiles.py b/ipyrad/assemble/write_outfiles.py index <HASH>..<HASH> 100644 --- a/ipyrad/assemble/write_outfiles.py +++ b/ipyrad/assemble/write_outfiles.py @@ -1410,7 +1410,7 @@ def make_outfiles(data, samples, output_formats, ipyclient): ## remove the tmparrays tmparrs = os.path.join(data.dirs.outfiles, "tmp-{}.h5".format(data.name)) - #os.remove(tmparrs) + os.remove(tmparrs) ## DEPRECATED FOR BOSS_MAKE_ARRAYS
put back in a remove tmpdirs call
dereneaton_ipyrad
train
py
e55f782e753476e921f37893a1ed9badbb827779
diff --git a/ibis/impala/client.py b/ibis/impala/client.py index <HASH>..<HASH> 100644 --- a/ibis/impala/client.py +++ b/ibis/impala/client.py @@ -206,7 +206,14 @@ class ImpalaCursor(object): self._cursor.close() except HS2Error as e: # connection was closed elsewhere - if 'invalid session' not in e.args[0].lower(): + already_closed_messages = [ + 'invalid query handle', + 'invalid session', + ] + for message in already_closed_messages: + if message in e.args[0].lower(): + break + else: raise def __enter__(self):
BUG: There is a new exception for already closed (#<I>) * There is a new exception for already closed * There are two messages that can happen
ibis-project_ibis
train
py
bf24353bd35fe4155424d3391ad29d4dfe656ae3
diff --git a/lib/tachikoma/version.rb b/lib/tachikoma/version.rb index <HASH>..<HASH> 100644 --- a/lib/tachikoma/version.rb +++ b/lib/tachikoma/version.rb @@ -1,4 +1,4 @@ # Version of tachikoma module Tachikoma - VERSION = '3.0.10.beta' + VERSION = '4.0.0.beta' end
Bump development version to <I>.beta
sanemat_tachikoma
train
rb
a33efc80075ea37c3f76db14d71c7b0609b10bd7
diff --git a/guava/src/com/google/common/base/Equivalences.java b/guava/src/com/google/common/base/Equivalences.java index <HASH>..<HASH> 100644 --- a/guava/src/com/google/common/base/Equivalences.java +++ b/guava/src/com/google/common/base/Equivalences.java @@ -42,8 +42,10 @@ public final class Equivalences { * * @since 8.0 (present null-friendly behavior) * @since 4.0 (otherwise) + * @deprecated This method has been moved to {@link Equivalence#equals}. This method is scheduled + * to be removed in Guava release 14.0. */ - // TODO(user): Deprecate this method. See b/6512852 + @Deprecated public static Equivalence<Object> equals() { return Equivalence.Equals.INSTANCE; } @@ -52,8 +54,11 @@ public final class Equivalences { * Returns an equivalence that uses {@code ==} to compare values and {@link * System#identityHashCode(Object)} to compute the hash code. {@link Equivalence#equivalent} * returns {@code true} if {@code a == b}, including in the case that a and b are both null. + * + * @deprecated This method has been moved to {@link Equivalence#identity}. This method is schedule + * to be removed in Guava release 14.0. */ - // TODO(user): Deprecate this method. See b/6512852 + @Deprecated public static Equivalence<Object> identity() { return Equivalence.Identity.INSTANCE; }
MOE insert public for the Equivalences class. @Deprecate the 2 methods in Equivalences. ------------- Created by MOE: <URL>
google_guava
train
java
ce26c01c24fa2da9fc23a6a1e3b8f4fdbdc55532
diff --git a/src/effector/store/storeMethods.js b/src/effector/store/storeMethods.js index <HASH>..<HASH> 100644 --- a/src/effector/store/storeMethods.js +++ b/src/effector/store/storeMethods.js @@ -194,10 +194,10 @@ export function mapStore<A, B>( } createLink(store, { child: [innerStore], - scope: {store, handler: fn, state: innerStore.stateRef}, + scope: {store, handler: fn, state: innerStore.stateRef, fail: innerStore.fail}, node: [ step.compute({ - fn(newValue, {state, store, handler}) { + fn(newValue, {state, store, handler, fail}) { startPhaseTimer(store, 'map') let stopPhaseTimerMessage = 'Got error' let result @@ -205,7 +205,7 @@ export function mapStore<A, B>( result = handler(newValue, readRef(state)) stopPhaseTimerMessage = null } catch (error) { - innerStore.fail({error, state: readRef(state)}) + fail({error, state: readRef(state)}) console.error(error) } stopPhaseTimer(stopPhaseTimerMessage)
Use innerStore.fail from scope
zerobias_effector
train
js
8af28bf50ee418c7f142872911fc7dd7260e0c34
diff --git a/src/Mail.php b/src/Mail.php index <HASH>..<HASH> 100644 --- a/src/Mail.php +++ b/src/Mail.php @@ -117,7 +117,7 @@ class Mail extends Notification $iodef->write( [ [ - 'name' => 'iodef:IODEF-Document', + 'name' => 'IODEF-Document', 'attributes' => $this->iodefDocument->getAttributes(), 'value' => $this->iodefDocument, ]
IODEF changes Removed the deafult namespace before IODEF-Document. It's not needed anymore since iodef <I>-dev
AbuseIO_notification-mail
train
php
f86cded537603602421d12b05c29600d8e85eb98
diff --git a/ls/joyous/formats/ical.py b/ls/joyous/formats/ical.py index <HASH>..<HASH> 100644 --- a/ls/joyous/formats/ical.py +++ b/ls/joyous/formats/ical.py @@ -257,7 +257,6 @@ class CancelledVEvent(ExceptionVEvent): class PostponedVEvent(ExceptionVEvent): def __init__(self, page, vparent): super().__init__(page, vparent) - self.add('LOCATION', page.location) @property def summary(self):
LOCATION repeated in ICAL export
linuxsoftware_ls.joyous
train
py
bf5199cc461adbd9a17d5a29e16a31e4642de25d
diff --git a/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java b/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java +++ b/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java @@ -251,7 +251,6 @@ public class MaxStarterTest { private MalformedJUnit38Test() { } - @SuppressWarnings("unused") public void testSucceeds() { } }
Removed unnecessary @SuppressWarnings
junit-team_junit4
train
java
67f63bcf8bfb62ca20882b4681deb3aa6e15559a
diff --git a/test.py b/test.py index <HASH>..<HASH> 100644 --- a/test.py +++ b/test.py @@ -137,6 +137,27 @@ class HClusterIntegerTestCase(unittest.TestCase): result = sorted([sorted(_) for _ in cl.getlevel(40)]) self.assertEqual(result, expected) + def testAverageLinkage(self): + cl = HierarchicalClustering(self.__data, + lambda x, y: abs(x - y), + linkage='average') + # TODO: The current test-data does not really trigger a difference + # between UCLUS and "average" linkage. + expected = [ + [24], + [84], + [124, 131, 134], + [336, 365, 365, 391, 398], + [518, 542, 564], + [594], + [676], + [791], + [835], + [940, 956, 971], + ] + result = sorted([sorted(_) for _ in cl.getlevel(40)]) + self.assertEqual(result, expected) + def testUnmodifiedData(self): cl = HierarchicalClustering(self.__data, lambda x, y: abs(x - y)) new_data = []
Added a unit-test for UCLUS linkage.
exhuma_python-cluster
train
py
a28bb3a8706c56f8410119b9457a458101b09378
diff --git a/scripts/stitch.js b/scripts/stitch.js index <HASH>..<HASH> 100644 --- a/scripts/stitch.js +++ b/scripts/stitch.js @@ -1,3 +1,5 @@ +'use strict'; + var PNG = require('pngjs').PNG; var fs = require('fs');
Enable strict mode, not that it helps fix the missing pixels
deathcap_ProgrammerArt
train
js
9b6d363cfc5db584c969fb7219203868f15915bb
diff --git a/packages/neos-ui-editors/src/References/index.js b/packages/neos-ui-editors/src/References/index.js index <HASH>..<HASH> 100644 --- a/packages/neos-ui-editors/src/References/index.js +++ b/packages/neos-ui-editors/src/References/index.js @@ -18,7 +18,7 @@ export default class ReferencesEditor extends PureComponent { value: PropTypes.arrayOf(PropTypes.string), commit: PropTypes.func.isRequired, options: PropTypes.shape({ - nodeTypes: PropTypes.arrayOf(PropTypes.string), + nodeTypes: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), placeholder: PropTypes.string, threshold: PropTypes.number }),
TASK: Adjust proptype validation for ReferencesEditor The nodetpye option in ReferencesEditor props can be a strig with a single nodetype as well as an array
neos_neos-ui
train
js
bd562b4c94c042886cea11b45c0b8fee7fc47428
diff --git a/bin/convert-argv.js b/bin/convert-argv.js index <HASH>..<HASH> 100644 --- a/bin/convert-argv.js +++ b/bin/convert-argv.js @@ -32,6 +32,14 @@ module.exports = function(optimist, argv, convertOptions) { var extensions = Object.keys(interpret.extensions).sort(function(a, b) { return a.length - b.length; }); + var configFiles = ["webpack.config", "webpackfile"].map(function(filename) { + return extensions.map(function(ext) { + return { + path: path.resolve(filename + ext), + ext: ext + }; + }); + }).reduce(function(a, i) { return a.concat(i); }, []); if(argv.config) { configPath = path.resolve(argv.config); @@ -46,10 +54,10 @@ module.exports = function(optimist, argv, convertOptions) { ext = path.extname(configPath); } } else { - for(var i = 0; i < extensions.length; i++) { - var webpackConfig = path.resolve("webpack.config" + extensions[i]); + for(var i = 0; i < configFiles.length; i++) { + var webpackConfig = configFiles[i].path; if(fs.existsSync(webpackConfig)) { - ext = extensions[i]; + ext = configFiles[i].ext; configPath = webpackConfig; break; }
support `webpackfile.js`
webpack_webpack
train
js
2263536ba17c269cedf11753a4c812b8b5a806dd
diff --git a/pypika/queries.py b/pypika/queries.py index <HASH>..<HASH> 100644 --- a/pypika/queries.py +++ b/pypika/queries.py @@ -1175,14 +1175,14 @@ class JoinOn(Join): def __init__(self, item, how, criteria, collate=None): super(JoinOn, self).__init__(item, how) self.criterion = criteria - self.collate = " COLLATE {}".format(collate) if collate else "" + self.collate = collate def get_sql(self, **kwargs): join_sql = super(JoinOn, self).get_sql(**kwargs) return '{join} ON {criterion}{collate}'.format( join=join_sql, criterion=self.criterion.get_sql(**kwargs), - collate=self.collate + collate=" COLLATE {}".format(self.collate) if self.collate else "" ) def validate(self, _from, _joins):
Raw value of collate in self.collate
kayak_pypika
train
py
08e4c6256877374c3f40ea285419c2fd3b3c58a8
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,8 @@ require "rubygems" require "bundler/setup" +$stdin = File.new("/dev/null") + require "simplecov" SimpleCov.start do add_filter "/spec/"
try using dev/null for stdin during tests
heroku_legacy-cli
train
rb
4535998ae757707e3e8aa161d89cc0df97441755
diff --git a/nameko/messaging.py b/nameko/messaging.py index <HASH>..<HASH> 100644 --- a/nameko/messaging.py +++ b/nameko/messaging.py @@ -360,7 +360,7 @@ class QueueConsumer(SharedExtension, ProviderCollector, ConsumerMixin): type(provider).__name__, message.delivery_info['routing_key'] ) self.container.spawn_managed_thread( - lambda: provider.handle_message(body, message), identifier=ident + partial(provider.handle_message, body, message), identifier=ident ) def get_consumers(self, consumer_cls, channel):
use a partial rather than lambda
nameko_nameko
train
py
85462980478df760edbf201d4b4bd7bad437e1b5
diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index <HASH>..<HASH> 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -251,7 +251,7 @@ module Jekyll "html_pages" => pages.select { |page| page.html? || page.url.end_with?("/") }, "categories" => post_attr_hash('categories'), "tags" => post_attr_hash('tags'), - "collections" => collections, + "collections" => collections.values.map(&:to_liquid), "documents" => documents, "data" => site_data }))
fix collections output, see #<I>
jekyll_jekyll
train
rb
507ad6ebc681b0a65656e382eec207595678cc98
diff --git a/lib/plugins/badges.js b/lib/plugins/badges.js index <HASH>..<HASH> 100644 --- a/lib/plugins/badges.js +++ b/lib/plugins/badges.js @@ -6,7 +6,7 @@ var makeBadges = require('vigour-doc-badges') var Vdoc = require('../') module.exports = exports = function badges (entries, i, j, pkg) { - var info = pkg.repository.url.match(/\/([a-zA-Z-]+)\/([a-zA-Z-]+)/) + var info = pkg.repository.url.match(/\/([a-zA-Z0-9-]+)\/([a-zA-Z0-9-]+)/) if (!info) { let error = new Error('Invalid package.json') error.todo = 'Make sure your package.json contains a `repository.url` field'
Allow numbers in owner and repo names
vigour-io_doc
train
js
21f53d29e7c4b9ba428013f095287af8c4343e7a
diff --git a/juicer/juicer/Juicer.py b/juicer/juicer/Juicer.py index <HASH>..<HASH> 100644 --- a/juicer/juicer/Juicer.py +++ b/juicer/juicer/Juicer.py @@ -191,8 +191,15 @@ class Juicer(object): return cart def show(self, cart_name): - cart = juicer.common.Cart.Cart(cart_name) - cart.load(cart_name) + # use local cart if present + # otherwise use mongo version + cart_file = os.path.join(Constants.CART_LOCATION, '%s.json' % cart_name) + if os.path.exists(cart_file): + cart = juicer.common.Cart.Cart(cart_name) + cart.load(cart_name) + else: + cln = juicer.utils.get_login_info()[1]['start_in'] + cart = juicer.utils.cart_db()[cln].find_one({'_id': cart_name}) return str(cart) def list(self, cart_glob=['*.json']):
show remote carts for #<I> next up, globbing!
juicer_juicer
train
py
c4629b979be692cf146e15101d528a9b3ff8d8e0
diff --git a/tlsobs-api/main.go b/tlsobs-api/main.go index <HASH>..<HASH> 100644 --- a/tlsobs-api/main.go +++ b/tlsobs-api/main.go @@ -37,7 +37,7 @@ func main() { } db, err := pg.RegisterConnection(conf.General.PostgresDB, conf.General.PostgresUser, conf.General.PostgresPass, conf.General.Postgres, "disable") - + defer db.Close() if err != nil { log.Fatal(err) } diff --git a/tlsobs-scanner/main.go b/tlsobs-scanner/main.go index <HASH>..<HASH> 100644 --- a/tlsobs-scanner/main.go +++ b/tlsobs-scanner/main.go @@ -52,6 +52,7 @@ func main() { runtime.GOMAXPROCS(cores * conf.General.GoRoutines) db, err = pg.RegisterConnection(conf.General.PostgresDB, conf.General.PostgresUser, conf.General.PostgresPass, conf.General.Postgres, "disable") + defer db.Close() if err != nil { log.WithFields(logrus.Fields{ "error": err.Error(),
Make sure database handlers get freed on exit
mozilla_tls-observatory
train
go,go
ea9c2ccff5681da215b2b2615ee6862b8746b591
diff --git a/plip/modules/report.py b/plip/modules/report.py index <HASH>..<HASH> 100644 --- a/plip/modules/report.py +++ b/plip/modules/report.py @@ -227,7 +227,7 @@ class TextOutput(): interactions.append(format_interactions('hydrogen_bonds', self.hbond_features, self.hbond_info)) interactions.append(format_interactions('water_bridges', self.waterbridge_features, self.waterbridge_info)) interactions.append(format_interactions('salt_bridges', self.saltbridge_features, self.saltbridge_info)) - interactions.append(format_interactions('pi_stacks', self.pication_features, self.pication_info)) + interactions.append(format_interactions('pi_stacks', self.pistacking_features, self.pistacking_info)) interactions.append(format_interactions('pi_cation_interactions', self.pication_features, self.pication_info)) interactions.append(format_interactions('halogen_bonds', self.halogen_features, self.halogen_info)) return report \ No newline at end of file
Fixes bug for wrong attributes in pistacking.
ssalentin_plip
train
py
5096a2b4024e020aefade98a57ecfa222b84dbd4
diff --git a/test/setup.js b/test/setup.js index <HASH>..<HASH> 100644 --- a/test/setup.js +++ b/test/setup.js @@ -170,3 +170,9 @@ mock('spawnteract', { }); }, }); + +mock('fs', { + unlinkSync: function(){}, + unlink: function(){}, + existsSync: function(){}, +});
test: mock fs I noticed when running the tests that 'filename' (literally) was being created at the root while running tests. This forces our use of `fs` to be mocked within tests.
nteract_nteract
train
js
4f96afe3ab077fb557d2fdd5e1e7fad8ec265ab2
diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php @@ -170,6 +170,10 @@ class Configuration */ public function isBaselineDeprecation(Deprecation $deprecation) { + if ($deprecation->isLegacy()) { + return false; + } + if ($deprecation->originatesFromAnObject()) { $location = $deprecation->originatingClass().'::'.$deprecation->originatingMethod(); } else {
Exclude from baseline generation deprecations triggered in legacy test
symfony_symfony
train
php
64e0c39dfaa6cbe792611ccadd1456915280dec6
diff --git a/src/request.js b/src/request.js index <HASH>..<HASH> 100644 --- a/src/request.js +++ b/src/request.js @@ -17,7 +17,9 @@ if(!xmlhttprequest || typeof xmlhttprequest !== 'object') throw new Error('Could not find ./xmlhttprequest') var XHR = xmlhttprequest.XMLHttpRequest -if(XHR.name !== 'cXMLHttpRequest') +if(!XHR) + throw new Error('Bad xmlhttprequest.XMLHttpRequest') +if(! ('_object' in (new XHR))) throw new Error('This is not portable XMLHttpRequest') module.exports = request
More reliable detection of the portable XHR
iriscouch_browser-request
train
js
1f7c70765fdddb49ccac5bf814729a873bbd7b0b
diff --git a/buildbot/status/mail.py b/buildbot/status/mail.py index <HASH>..<HASH> 100644 --- a/buildbot/status/mail.py +++ b/buildbot/status/mail.py @@ -1,16 +1,11 @@ # -*- test-case-name: buildbot.test.test_status -*- -# the email.MIMEMultipart module is only available in python-2.2.2 and later import re from email.Message import Message from email.Utils import formatdate from email.MIMEText import MIMEText -try: - from email.MIMEMultipart import MIMEMultipart - canDoAttachments = True -except ImportError: - canDoAttachments = False +from email.MIMEMultipart import MIMEMultipart import urllib from zope.interface import implements @@ -405,17 +400,8 @@ class MailNotifier(base.StatusReceiverMultiService): assert type in ('plain', 'html'), "'%s' message type must be 'plain' or 'html'." % type - haveAttachments = False ss = build.getSourceStamp() if (ss and ss.patch and self.addPatch) or self.addLogs: - haveAttachments = True - if not canDoAttachments: - twlog.msg("warning: I want to send mail with attachments, " - "but this python is too old to have " - "email.MIMEMultipart . Please upgrade to python-2.3 " - "or newer to enable addLogs=True") - - if haveAttachments and canDoAttachments: m = MIMEMultipart() m.attach(MIMEText(text, type)) else:
Remove email.MIMEMultipart workaround for versions less than python-<I>
buildbot_buildbot
train
py
180d4dcf5c1cfc1fea20971dc2ce409f9faf9cc9
diff --git a/src/org/ejml/alg/dense/misc/TransposeAlgs.java b/src/org/ejml/alg/dense/misc/TransposeAlgs.java index <HASH>..<HASH> 100644 --- a/src/org/ejml/alg/dense/misc/TransposeAlgs.java +++ b/src/org/ejml/alg/dense/misc/TransposeAlgs.java @@ -41,7 +41,7 @@ public class TransposeAlgs { for( int i = 0; i < mat.numRows; i++ ) { int index = i*mat.numCols+i+1; - int indexOther = i; + int indexOther = (i+1)*mat.numCols + i; for( int j = i+1; j < mat.numCols; j++ , indexOther += mat.numCols) { double val = data[index]; data[index] = data[indexOther];
- fixed a bug in square transpose
lessthanoptimal_ejml
train
java
da298fedc37b33c613fc23300397ec513abcd231
diff --git a/bitcoin/serialization_test.py b/bitcoin/serialization_test.py index <HASH>..<HASH> 100644 --- a/bitcoin/serialization_test.py +++ b/bitcoin/serialization_test.py @@ -130,6 +130,10 @@ VARCHAR = [ dict(str_='\x01\x02', result='\x02\x01\x02'), dict(str_='Ping\x00Pong\n', result='\x0aPing\x00Pong\n'), dict(str_='\x7f\x80\x00\xff', result='\x04\x7f\x80\x00\xff'), + dict(str_='a'*0xfc, result='\xfc'+'a'*0xfc), + dict(str_='a'*0xfd, result='\xfd\xfd\x00'+'a'*0xfd), + dict(str_='a'*0xffff, result='\xfd\xff\xff'+'a'*0xffff), + dict(str_='a'*0x10000, result='\xfe\x00\x00\x01\x00'+'a'*0x10000), ] class TestSerializeVarchar(unittest2.TestCase):
Added tests of serializing very long varchars.
maaku_python-bitcoin
train
py
5b4db728ecfdaddfb93f1a2dd4830b058b6b45a7
diff --git a/src/components/elements/inputs/number-input.js b/src/components/elements/inputs/number-input.js index <HASH>..<HASH> 100644 --- a/src/components/elements/inputs/number-input.js +++ b/src/components/elements/inputs/number-input.js @@ -8,7 +8,7 @@ export default ({ className, errors, onChange, onCommit, property, value }) => ( disabled={property.disabled} id={property.id} onBlur={() => onCommit()} - onChange={e => onChange(e.target.valueAsNumber)} + onChange={e => onChange(e.target.value)} title={property.title} type='number' value={value} />
fix: Fix bug which stopped users from submitting decimal values in number fields
cignium_hypermedia-client
train
js
ef225a97db24eaf29d9e320f52286408669c7a7e
diff --git a/gulp-tasks/utils/constants.js b/gulp-tasks/utils/constants.js index <HASH>..<HASH> 100644 --- a/gulp-tasks/utils/constants.js +++ b/gulp-tasks/utils/constants.js @@ -14,8 +14,8 @@ module.exports = { GENERATED_RELEASE_FILES_DIRNAME: 'generated-release-files', // This is used in the publish-bundle step to avoid doing anything - // with tags < v4.0.0. - MIN_RELEASE_TAG_TO_PUBLISH: 'v6.1.1', + // with tags that have known issues. + MIN_RELEASE_TAG_TO_PUBLISH: 'v6.1.5', GITHUB_OWNER: 'GoogleChrome', GITHUB_REPO: 'workbox',
Bump the min release tag (#<I>)
GoogleChrome_workbox
train
js
4fbf28cea67ed2c1d3255c81922a4775218492bd
diff --git a/reqres.go b/reqres.go index <HASH>..<HASH> 100644 --- a/reqres.go +++ b/reqres.go @@ -89,7 +89,7 @@ func (w *reqResWriter) argWriter(last bool, inState reqResWriterState, outState argWriter, err := w.contents.ArgWriter(last) if err != nil { - return nil, err + return nil, w.failed(err) } w.state = outState
If argwriter fails, fail the call.
uber_tchannel-go
train
go
8b6226ac3e3bf38206b9a161da835d3ac0e0a77e
diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index <HASH>..<HASH> 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -82,35 +82,6 @@ class Repo extends Api } /** - * Delete repo - * - * @param string $name name of the repository - * @param string $token delete token - * @param string $force force repository deletion - * - * @return string|array returns delete_token or repo status - */ - public function delete($name, $token = null, $force = false) - { - //todo old api - if ($token === null) { - $response = $this->post('repos/delete/'.urlencode($name)); - - $token = $response['delete_token']; - - if (!$force) { - return $token; - } - } - - $response = $this->post('repos/delete/'.urlencode($name), array( - 'delete_token' => $token, - )); - - return $response; - } - - /** * Set information of a repository * @link http://developer.github.com/v3/repos/ *
Remove bogus function as it's not exists anymore in API and cause errors
KnpLabs_php-github-api
train
php
c6ea35f68d5b71e690ea7f733f7190bae653f441
diff --git a/system/capistrano-support/lib/torquebox/capistrano/recipes.rb b/system/capistrano-support/lib/torquebox/capistrano/recipes.rb index <HASH>..<HASH> 100644 --- a/system/capistrano-support/lib/torquebox/capistrano/recipes.rb +++ b/system/capistrano-support/lib/torquebox/capistrano/recipes.rb @@ -105,7 +105,15 @@ Capistrano::Configuration.instance.load do task :deployment_descriptor do puts "creating deployment descriptor" - ::TorqueBox::DeployUtils.deploy_yaml( create_deployment_descriptor() ) + dd_str = YAML.dump_stream( create_deployment_descriptor() ) + dd_file = "#{torquebox_home}/apps/#{application}-knob.yml" + dd_tmp_file = "#{dd_file}.tmp" + cmd = "cat /dev/null > #{dd_tmp_file}" + dd_str.each_line do |line| + cmd += " && echo \"#{line}\" >> #{dd_tmp_file}" + end + cmd += " && mv #{dd_tmp_file} #{dd_file}" + run cmd end end
Get rid of that deploy_utils business. Revert to bobmcw's original
torquebox_torquebox
train
rb
6372aa2b3dd4792c4f201610cbca70c7c8ae947d
diff --git a/SoftLayer/managers/network.py b/SoftLayer/managers/network.py index <HASH>..<HASH> 100644 --- a/SoftLayer/managers/network.py +++ b/SoftLayer/managers/network.py @@ -437,16 +437,6 @@ class NetworkManager(object): """ return self.vlan.getObject(id=vlan_id, mask=DEFAULT_GET_VLAN_MASK) - def get_network_gateway_firewall(self, vlan_id): - """Returns information about a single VLAN. - - :param int id: The unique identifier for the VLAN - :returns: A dictionary containing a large amount of information about - the specified VLAN. - - """ - return self.vlan.getObject(id=vlan_id, mask=DEFAULT_GET_VLAN_MASK) - def list_global_ips(self, version=None, identifier=None, **kwargs): """Returns a list of all global IP address records on the account.
#<I> remove duplicated method added on network manager
softlayer_softlayer-python
train
py
5e513c01cc6459e3ab8863eb1fef743263739e08
diff --git a/nsqd/tcp.go b/nsqd/tcp.go index <HASH>..<HASH> 100644 --- a/nsqd/tcp.go +++ b/nsqd/tcp.go @@ -11,6 +11,6 @@ var Protocols = map[int32]nsq.Protocol{} func tcpClientHandler(clientConn net.Conn) error { client := nsq.NewServerClient(clientConn, clientConn.RemoteAddr().String()) log.Printf("TCP: new client(%s)", client.String()) - go client.Handle(Protocols) + client.Handle(Protocols) return nil } diff --git a/util/tcp_server.go b/util/tcp_server.go index <HASH>..<HASH> 100644 --- a/util/tcp_server.go +++ b/util/tcp_server.go @@ -11,12 +11,14 @@ func TcpServer(listener net.Listener, handler func(net.Conn) error) { for { clientConn, err := listener.Accept() if err != nil { + log.Printf("TCP: listening err") if nerr, ok := err.(net.Error); ok && nerr.Temporary() { log.Printf("NOTICE: temporary Accept() failure - %s", err.Error()) continue } break } - handler(clientConn) + go handler(clientConn) } + log.Printf("TCP: listening finished") }
change where the goroutine is started for client handling
nsqio_nsq
train
go,go
290ae1f022c49a522cc1199b077583d7d146bf0c
diff --git a/lib/ethon/easy/mirror.rb b/lib/ethon/easy/mirror.rb index <HASH>..<HASH> 100644 --- a/lib/ethon/easy/mirror.rb +++ b/lib/ethon/easy/mirror.rb @@ -10,7 +10,7 @@ module Ethon end def self.informations_to_log - [:url, :response_code, :return_code, :total_time] + [:effective_url, :response_code, :return_code, :total_time] end def self.from_easy(easy)
Use effective_url instead of url for logging Whenever I look at logs from ethon, I get something like ```performed EASY url= response_code=<I> return_code=ok total_time=<I>``` . I'm on OSX, ethon version <I>. This seems to fix it so that I can see the url in my logs ```EASY effective_url=<URL>
typhoeus_ethon
train
rb
3e841addb139d00e0864f67bc5f15b179450174d
diff --git a/src/main/java/de/btobastian/javacord/Javacord.java b/src/main/java/de/btobastian/javacord/Javacord.java index <HASH>..<HASH> 100644 --- a/src/main/java/de/btobastian/javacord/Javacord.java +++ b/src/main/java/de/btobastian/javacord/Javacord.java @@ -1,6 +1,8 @@ package de.btobastian.javacord; import com.mashape.unirest.http.Unirest; +import de.btobastian.javacord.utils.logging.LoggerUtil; +import org.slf4j.Logger; import java.util.function.Function; @@ -10,6 +12,11 @@ import java.util.function.Function; public class Javacord { /** + * The logger of this class. + */ + private static final Logger logger = LoggerUtil.getLogger(Javacord.class); + + /** * The current javacord version. */ public static final String VERSION = "3.0.0"; @@ -46,7 +53,7 @@ public class Javacord { */ public static <T> Function<Throwable, T> exceptionLogger() { return throwable -> { - throwable.printStackTrace(); + logger.error("Caught unhandled exception!", throwable); return null; }; }
Javacord#exceptionLogger() now uses SLF4J to log the exception
Javacord_Javacord
train
java
da76362018a510419f5c182e2e3bbe001df99209
diff --git a/refactor/components/broker/broker.go b/refactor/components/broker/broker.go index <HASH>..<HASH> 100644 --- a/refactor/components/broker/broker.go +++ b/refactor/components/broker/broker.go @@ -46,7 +46,7 @@ func (b component) HandleUp(data []byte, an AckNacker, up Adapter) (err error) { defer ensureAckNack(an, &ack, &err) // Get some logs / analytics - stats.MarkMeter("boker.uplink.in") + stats.MarkMeter("broker.uplink.in") b.ctx.Debug("Handling uplink packet") // Extract the given packet
[refactor] Fix small typo in broker stat tag
TheThingsNetwork_ttn
train
go
b585a88769ee652ea1f36ee981b601db18246bba
diff --git a/foolbox/zoo/zoo.py b/foolbox/zoo/zoo.py index <HASH>..<HASH> 100644 --- a/foolbox/zoo/zoo.py +++ b/foolbox/zoo/zoo.py @@ -19,7 +19,9 @@ def get_model(url): Instantiate a model: >>> from foolbox import zoo - >>> zoo.get_model(url="https://github.com/bveliqi/foolbox-zoo-dummy.git") + >>> model = zoo.get_model( + >>> url="https://github.com/bveliqi/foolbox-zoo-dummy.git" + >>> ) Only works with a foolbox-zoo compatible repository.
trying to fix DocTestFailure on travis
bethgelab_foolbox
train
py
e1a82715150064c85457bbac83b1cb9856f8ebe2
diff --git a/src/MediaTrait.php b/src/MediaTrait.php index <HASH>..<HASH> 100644 --- a/src/MediaTrait.php +++ b/src/MediaTrait.php @@ -23,7 +23,7 @@ trait MediaTrait { protected $public_path; protected $files_directory; protected $directory; - protected $directory_uri = ''; + protected $directory_uri; protected $create_sub_directories; @@ -39,7 +39,7 @@ trait MediaTrait { $this->directory = $this->public_path . $this->files_directory; if ($this->create_sub_directories) { - $this->directory_uri .= Str::lower(class_basename($this)) . '/'; + $this->directory_uri = Str::lower(class_basename($this)) . '/'; } $this->directory .= $this->directory_uri;
Fixed bug where subdirectories would create a new sub folder in the subfolder for each subsequent image
DevFactoryCH_media
train
php
86d5a32b6dae7ad02ca4f8702d130f2ffaaf1bbf
diff --git a/tests/conftest.py b/tests/conftest.py index <HASH>..<HASH> 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -70,7 +70,7 @@ def _cache_requests(request, context): while folder.resolve() != CACHE_PATH: if folder.is_file(): # need to rename - tmp_folder = folder.parent / folder.name + '.tmp' + tmp_folder = folder.parent / (folder.name + '.tmp') folder.rename(tmp_folder) folder.mkdir(parents=True) tmp_folder.rename(folder / '.get')
Pathlib requires all objects to be Paths
MozillaSecurity_fuzzfetch
train
py
4e5b48834fab3de2d1cc616897a65d06b82f5cef
diff --git a/lib/plugins/init.js b/lib/plugins/init.js index <HASH>..<HASH> 100644 --- a/lib/plugins/init.js +++ b/lib/plugins/init.js @@ -5,21 +5,26 @@ */ var through = require('through2'); +var _ = require('lodash'); var parseMatter = require('../utils/parse-matter'); var parsePath = require('../utils/parse-path'); var extendFile = require('../utils/extend-file'); -module.exports = function initPlugin() { +module.exports = function initPlugin(options) { + var opts = _.extend({}, this.options, options); + return through.obj(function (file, encoding, next) { if (file.isNull()) { this.push(file); return next(); } - file = parseMatter(file, encoding, next); - file = parsePath(file, encoding, next); - file = extendFile(file, encoding, next); + + file = parseMatter(file, encoding, opts); + file = parsePath(file, encoding, opts); + file = extendFile(file, encoding, opts); + this.push(file); next(); });
ensure that options are passed to the init plugin
assemble_assemble
train
js
07eba87d180fce5919b956ba56e2b4b5c3a20940
diff --git a/lib/onebox/engine/image_onebox.rb b/lib/onebox/engine/image_onebox.rb index <HASH>..<HASH> 100644 --- a/lib/onebox/engine/image_onebox.rb +++ b/lib/onebox/engine/image_onebox.rb @@ -18,7 +18,6 @@ module Onebox end escaped_url = ::Onebox::Helpers.normalize_url_for_output(@url) - <<-HTML <a href="#{escaped_url}" target="_blank" class="onebox"> <img src="#{escaped_url}"> diff --git a/lib/onebox/engine/video_onebox.rb b/lib/onebox/engine/video_onebox.rb index <HASH>..<HASH> 100644 --- a/lib/onebox/engine/video_onebox.rb +++ b/lib/onebox/engine/video_onebox.rb @@ -12,6 +12,11 @@ module Onebox end def to_html + # Fix Dropbox image links + if @url[/^https:\/\/www.dropbox.com\/s\//] + @url.sub!("https://www.dropbox.com", "https://dl.dropboxusercontent.com") + end + escaped_url = ::Onebox::Helpers.normalize_url_for_output(@url) <<-HTML <div class="onebox video-onebox">
FIX: Dropbox videos were not loading
discourse_onebox
train
rb,rb
6f4bc189a91b68dfbb7d37bb669e799602d8d4fd
diff --git a/lib/suspenders/app_builder.rb b/lib/suspenders/app_builder.rb index <HASH>..<HASH> 100644 --- a/lib/suspenders/app_builder.rb +++ b/lib/suspenders/app_builder.rb @@ -200,7 +200,7 @@ end def provide_shoulda_matchers_config copy_file( "shoulda_matchers_config_rspec.rb", - "spec/support/shoulda_matchers_config.rb" + "spec/support/shoulda_matchers.rb" ) end
Place shoulda-matchers config at shoulda_matchers.rb We commonly name support files named after the gem that they are configuring, there's no need to put "_config" at the end of the file name.
thoughtbot_suspenders
train
rb
57d1230e6c38fba51d8d29904ef25c07eed7bfba
diff --git a/command/server.go b/command/server.go index <HASH>..<HASH> 100644 --- a/command/server.go +++ b/command/server.go @@ -155,7 +155,7 @@ func (c *ServerCommand) Run(args []string) int { "immediately begin using the Vault CLI.\n\n"+ "The only step you need to take is to set the following\n"+ "environment variables:\n\n"+ - " export VAULT_ADDR='http://127.0.0.1:8200'\n"+ + " export VAULT_ADDR='http://127.0.0.1:8200'\n\n"+ "The unseal key and root token are reproduced below in case you\n"+ "want to seal/unseal the Vault or play with authentication.\n\n"+ "Unseal Key: %s\nRoot Token: %s\n",
command/server: fixing output weirdness
hashicorp_vault
train
go
5835ac55683bbb2893e3ace2c43f0921486afa0b
diff --git a/src/ZfcDatagrid/Renderer/BootstrapTable/View/Helper/TableRow.php b/src/ZfcDatagrid/Renderer/BootstrapTable/View/Helper/TableRow.php index <HASH>..<HASH> 100644 --- a/src/ZfcDatagrid/Renderer/BootstrapTable/View/Helper/TableRow.php +++ b/src/ZfcDatagrid/Renderer/BootstrapTable/View/Helper/TableRow.php @@ -98,7 +98,7 @@ class TableRow extends AbstractHelper implements ServiceLocatorAwareInterface $return = $this->getTr($row); if ($hasMassActions === true) { - $return .= '<td><input type="checkbox" name="massActionSelected[]" value="'.$row['id'].'" /></td>'; + $return .= '<td><input type="checkbox" name="massActionSelected[]" value="'.$row['idConcated'].'" /></td>'; } foreach ($cols as $col) {
Mass Action - Undefined index Hi, When using massAction, I receive this error: "Notice: Undefined index: id (...)" Because my id element has appended the table identifier: "p_id". Should be "idConcated" instead of "id" key? Ivo
zfc-datagrid_zfc-datagrid
train
php
28b9c2eb71b1315bad1e1f65c675d12cde41fe82
diff --git a/lib/small_approximation.js b/lib/small_approximation.js index <HASH>..<HASH> 100644 --- a/lib/small_approximation.js +++ b/lib/small_approximation.js @@ -3,7 +3,6 @@ // CONSTANTS // var EULER = require( 'compute-const-eulergamma' ); -var PINF = Number.POSITIVE_INFINITY; // GAMMA // @@ -17,9 +16,6 @@ var PINF = Number.POSITIVE_INFINITY; * @returns {Number} approximation */ function gamma( x, z ) { - if ( x === 0 ) { - return PINF; - } return z / ((1 + EULER*x) * x ); } // end FUNCTION gamma()
Remove unreachable code path In `small_approximation.js`, the check for `x === 0` was removed as as this path should never be reached. In the original Cephes implementation, the check was needed as `x == 0` was possible. In this implementation, however, we check for `x == 0` as a special condition, preventing it from triggering later code paths. Note that the original also does not take into account negative zero, which would be a bug in JavaScript.
math-io_gamma
train
js
7a40a32ecbb3b22ca35587ab8919da0960351a2d
diff --git a/Access/Response.php b/Access/Response.php index <HASH>..<HASH> 100644 --- a/Access/Response.php +++ b/Access/Response.php @@ -15,6 +15,7 @@ class Response * Create a new response. * * @param string|null $message + * @return void */ public function __construct($message = null) { diff --git a/Events/Attempting.php b/Events/Attempting.php index <HASH>..<HASH> 100644 --- a/Events/Attempting.php +++ b/Events/Attempting.php @@ -23,6 +23,7 @@ class Attempting * * @param array $credentials * @param bool $remember + * @return void */ public function __construct($credentials, $remember) { diff --git a/Events/Failed.php b/Events/Failed.php index <HASH>..<HASH> 100644 --- a/Events/Failed.php +++ b/Events/Failed.php @@ -23,6 +23,7 @@ class Failed * * @param \Illuminate\Contracts\Auth\Authenticatable|null $user * @param array $credentials + * @return void */ public function __construct($user, $credentials) {
Add missing return docblocks (#<I>)
illuminate_auth
train
php,php,php
baa8c89a569d11915a861a8d09725bf8cb2ba585
diff --git a/question/type/numerical/db/upgrade.php b/question/type/numerical/db/upgrade.php index <HASH>..<HASH> 100644 --- a/question/type/numerical/db/upgrade.php +++ b/question/type/numerical/db/upgrade.php @@ -37,7 +37,7 @@ function xmldb_qtype_numerical_upgrade($oldversion) { // Changing length of field multiplier on table question_numerical_units to 38. $table = new xmldb_table('question_numerical_units'); - $field = new xmldb_field('multiplier', XMLDB_TYPE_NUMBER, '38, 19', null, XMLDB_NOTNULL, null, null, 'question'); + $field = new xmldb_field('multiplier', XMLDB_TYPE_NUMBER, '38, 19', null, XMLDB_NOTNULL, null, '1.00000000000000000000'); // Launch change of length for field multiplier. $dbman->change_field_type($table, $field);
MDL-<I> qtype_numerical: Fix db upgrade step The upgrade step was creating a column with no default, which is different to the structure for a new install. This was picked up by the magical cibot.
moodle_moodle
train
php
e53ff8bc57323a68895cb48fc5b53f699200621a
diff --git a/src/createRenderer.js b/src/createRenderer.js index <HASH>..<HASH> 100644 --- a/src/createRenderer.js +++ b/src/createRenderer.js @@ -100,7 +100,9 @@ export function createRenderer (pages, { const nextPathname = nextState.location.pathname const nextPage = resolvePage(pages, nextPathname) if (typeof nextPage === 'string') { + console.log('Redirect', nextPage) replace(nextPage) + callback() } else { handlePathname(nextPathname, callback) }
Fix bug where redirection doesn't work
taskworld_legendary-pancake
train
js
12e032004f08a5ecec0ec776f5955d3c313e7294
diff --git a/src/Deploy/ApplicationSkeletonDeployer.php b/src/Deploy/ApplicationSkeletonDeployer.php index <HASH>..<HASH> 100755 --- a/src/Deploy/ApplicationSkeletonDeployer.php +++ b/src/Deploy/ApplicationSkeletonDeployer.php @@ -386,27 +386,6 @@ class ApplicationSkeletonDeployer implements LoggerAwareInterface } } - - /** - * @param string $name - * - * @return string - */ - private function sanitizeDatabaseName(string $name): string - { - return strtolower(preg_replace('/[^a-z0-9_]/i', '_', $name)); - } - - /** - * @param string $url - * - * @return string - */ - private function sanitizeUrl(string $url): string - { - return strtolower(preg_replace('/[^a-z0-9\.-]/i', '-', $url)); - } - /** * @param string $path */
Removed unused branch file layout strategy methods
conductorphp_conductor-application-orchestration
train
php
a7fb995aa184d6695e7b315fe5cf94d084557d04
diff --git a/manticore/__main__.py b/manticore/__main__.py index <HASH>..<HASH> 100644 --- a/manticore/__main__.py +++ b/manticore/__main__.py @@ -19,7 +19,7 @@ def parse_arguments(): raise argparse.ArgumentTypeError("Argument must be positive") return ivalue - parser = argparse.ArgumentParser(description='Dynamic binary analysis tool') + parser = argparse.ArgumentParser(description='Symbolic execution tool') parser.add_argument('--assertions', type=str, default=None, help=argparse.SUPPRESS) parser.add_argument('--buffer', type=str,
Update __main__.py (#<I>)
trailofbits_manticore
train
py
882aec78a5633b001ef54d0ef118395e27d39ddb
diff --git a/app/readers/fasta.py b/app/readers/fasta.py index <HASH>..<HASH> 100644 --- a/app/readers/fasta.py +++ b/app/readers/fasta.py @@ -47,7 +47,7 @@ def get_uniprot_evidence_level(header): item = item.split('=') try: if item[0] == 'PE': - return 5 - item[1] + return 5 - int(item[1]) except IndexError: continue return -1
Need to report protein evidence (PE) as int to calculate with it
glormph_msstitch
train
py
add2360a37c493f75626ed6f39deee0e1f935abe
diff --git a/src/org/jgroups/util/FixedSizeBitSet.java b/src/org/jgroups/util/FixedSizeBitSet.java index <HASH>..<HASH> 100644 --- a/src/org/jgroups/util/FixedSizeBitSet.java +++ b/src/org/jgroups/util/FixedSizeBitSet.java @@ -119,7 +119,7 @@ public class FixedSizeBitSet { */ public void clear(int from, int to) { if(from < 0 || to < 0 || to < from || to >= size) - throw new IndexOutOfBoundsException("from=" + from + ", to=" + to); + return; int startWordIndex = wordIndex(from); int endWordIndex = wordIndex(to);
FixedSizeBitSet.clear(): return rather than throw exception when bounds are incorrect (<URL>)
belaban_JGroups
train
java
7f0923de5dd8b4f33e405077f552107ecf4ec662
diff --git a/test/test-local.js b/test/test-local.js index <HASH>..<HASH> 100644 --- a/test/test-local.js +++ b/test/test-local.js @@ -548,15 +548,18 @@ describe('vfs-local', function () { if (err) throw err; expect(meta).property("watcher").ok; var watcher = meta.watcher; - watcher.on("change", function (event, filename) { - watcher.close(); + watcher.on("change", function listen(event, filename) { + watcher.removeListener("change", listen); expect(event).equal("change"); expect(filename).equal(vpath.substr(1)); - writable.end(); writable.on("close", function () { + watcher.on("change", function (event, filename) { + watcher.close(); + done(); + }); fs.unlinkSync(base + vpath); - done(); }); + writable.end(); }); writable.write("Change!"); });
updated localfs test for watcher
c9_vfs-local
train
js
51d8d9b91b5fda5cda0b884d94219ca74dd025ef
diff --git a/lib/review/latexbuilder.rb b/lib/review/latexbuilder.rb index <HASH>..<HASH> 100644 --- a/lib/review/latexbuilder.rb +++ b/lib/review/latexbuilder.rb @@ -204,7 +204,9 @@ module ReVIEW puts macro('includegraphics', @chapter.image(id).path) end puts macro('label', image_label(id)) - puts macro('caption', text(caption)) + if !caption.empty? + puts macro('caption', text(caption)) + end puts '\end{reviewimage}' end
do not show any caption if caption words is empty
kmuto_review
train
rb
3c7f8f7f19311c7cd6458d0cfb626f5e4591bcd6
diff --git a/src/config/hisite.php b/src/config/hisite.php index <HASH>..<HASH> 100644 --- a/src/config/hisite.php +++ b/src/config/hisite.php @@ -50,10 +50,6 @@ return [ 'mailer' => [ 'class' => \yii\swiftmailer\Mailer::class, 'viewPath' => '@hipanel/mail', - // send all mails to a file by default. You have to set - // 'useFileTransport' to false and configure a transport - // for the mailer to send real emails. - 'useFileTransport' => true, ], 'i18n' => [ 'class' => \hipanel\components\I18N::class, @@ -171,10 +167,5 @@ return [ [1 => $params['mailing.service.submitUrl']], ], ]), - 'singletons' => [ - \yii\mail\MailerInterface::class => function () { - return Yii::$app->get('mailer'); - }, - ], ], ];
moved MailerInterface DI config into hisite-core, removed useFileTransport=true
hiqdev_hipanel-core
train
php
433627167aa7f6d7cdb264ff28481ca180744507
diff --git a/client/lib/user/support-user-interop.js b/client/lib/user/support-user-interop.js index <HASH>..<HASH> 100644 --- a/client/lib/user/support-user-interop.js +++ b/client/lib/user/support-user-interop.js @@ -2,6 +2,7 @@ * External dependencies */ import debugModule from 'debug'; +import noop from 'lodash/noop'; /** * Internal dependencies @@ -25,7 +26,7 @@ const STORAGE_KEY = 'boot_support_user'; export const isEnabled = () => config.isEnabled( 'support-user' ); -let _setReduxStore = null; +let _setReduxStore = noop; const reduxStoreReady = new Promise( ( resolve ) => { if ( ! isEnabled() ) { return; @@ -95,7 +96,7 @@ export const boot = () => { if ( ! isEnabled() ) { return; } - + const { user, token } = store.get( STORAGE_KEY ); debug( 'Booting Calypso with support user', user );
Support User: Prevent error when support user is disabled
Automattic_wp-calypso
train
js
14d3c656a59da77ddd74622c8919529502e4a732
diff --git a/easybatch-core/src/main/java/org/easybatch/core/record/FileRecord.java b/easybatch-core/src/main/java/org/easybatch/core/record/FileRecord.java index <HASH>..<HASH> 100644 --- a/easybatch-core/src/main/java/org/easybatch/core/record/FileRecord.java +++ b/easybatch-core/src/main/java/org/easybatch/core/record/FileRecord.java @@ -45,7 +45,10 @@ public class FileRecord extends GenericRecord<File> { @Override public String toString() { - return payload.getAbsolutePath(); + return "Record: {" + + "header=" + header + + ", payload=" + payload.getAbsolutePath() + + '}'; } }
fix toString method of FileRecord: it should print the header and the payload of the record
j-easy_easy-batch
train
java
27e4847deb2ac658524270876f98791af2826319
diff --git a/lib/metrics-graphics-rails/view_helpers.rb b/lib/metrics-graphics-rails/view_helpers.rb index <HASH>..<HASH> 100644 --- a/lib/metrics-graphics-rails/view_helpers.rb +++ b/lib/metrics-graphics-rails/view_helpers.rb @@ -37,7 +37,7 @@ module MetricsGraphicsRails private def extra_options_to_options - @extra_options.map{ |k,v| "#{k}: #{v}," }.join("\n ") + @extra_options.map{ |k,v| "#{k}: #{v.is_a?(String) ? "'#{v}'" : v }," }.join("\n ") end def convert_data_js
fixes case when a configuration value is a string and is passed using extra_options
dgilperez_metrics-graphics-rails
train
rb
070a9a8159ce9f0f1e908d10c198da247b4246d1
diff --git a/kaminari-core/test/fake_app/active_record/config.rb b/kaminari-core/test/fake_app/active_record/config.rb index <HASH>..<HASH> 100644 --- a/kaminari-core/test/fake_app/active_record/config.rb +++ b/kaminari-core/test/fake_app/active_record/config.rb @@ -1,4 +1,3 @@ # frozen_string_literal: true # database -ActiveRecord::Base.configurations = {'test' => {adapter: 'sqlite3', database: ':memory:'}} -ActiveRecord::Base.establish_connection :test +ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
Simpler AR configuration because Rails.env isn't always 'test' (unless explicitly given)
kaminari_kaminari
train
rb
125f83e86191aae3f2eddd92030f6bc5038aa34c
diff --git a/lib/init_cmd.js b/lib/init_cmd.js index <HASH>..<HASH> 100644 --- a/lib/init_cmd.js +++ b/lib/init_cmd.js @@ -9,7 +9,12 @@ var home = process.env[isWindows ? 'USERPROFILE' : 'HOME'] function initCmd (cwd, argv) { var initFile = path.resolve(home, '.ied-init') init(cwd, initFile, function (err, data) { - if (err) throw err + if (err && err.message === 'canceled') { + console.log('init canceled!') + return + } + + throw err }) }
User-friendly error output when exiting from the initialization process
alexanderGugel_ied
train
js
b2808409016b17b25f3c77cce9d567cd33aad904
diff --git a/test/everypolitician_index_test.rb b/test/everypolitician_index_test.rb index <HASH>..<HASH> 100644 --- a/test/everypolitician_index_test.rb +++ b/test/everypolitician_index_test.rb @@ -4,10 +4,8 @@ class EverypoliticianIndexTest < Minitest::Test def test_country VCR.use_cassette('countries_json') do index = Everypolitician::Index.new - australia = index.country('Australia') - assert_equal 'Australia', australia.name - assert_equal 'AU', australia.code - assert_equal 2, australia.legislatures.size + sweden = index.country('Sweden') + assert_equal 94_415, sweden.legislature('Riksdag').statement_count end end
Make it clear we're expecting different data for different SHAs This makes the tests in everypolitician_index_test.rb similar to each other, so it's clearer that we're testing for the same thing against different version of the data.
everypolitician_everypolitician-ruby
train
rb
cf5e62b00a0441cfd1836627fddbe2009ca5be57
diff --git a/examples/wbtc2btc-complete-manual.js b/examples/wbtc2btc-complete-manual.js index <HASH>..<HASH> 100644 --- a/examples/wbtc2btc-complete-manual.js +++ b/examples/wbtc2btc-complete-manual.js @@ -121,6 +121,8 @@ Promise.resolve([]).then(() => { console.log('P2SH contract', contract); + opts.redeemScript = contract.redeemScript; + // Subtract miner fee const redeemValue = (new BigNumber(opts.value)).minus(minerFee).toString(); @@ -128,7 +130,6 @@ Promise.resolve([]).then(() => { const signedTx = cctx.buildRedeemTxFromWif( Object.assign({}, opts, { value: redeemValue, - redeemScript: contract.redeemScript, }), );
Move redeemScript assign to make consistent with previous assigns
wanchain_wanx
train
js
500ef1be5ade8b34e54a0f27cc542d0aaf674b22
diff --git a/ipyrad/assemble/jointestimate.py b/ipyrad/assemble/jointestimate.py index <HASH>..<HASH> 100644 --- a/ipyrad/assemble/jointestimate.py +++ b/ipyrad/assemble/jointestimate.py @@ -129,15 +129,12 @@ class Step4: break # cleanup - print("") + self.data._print("") for job in jobs: - if jobs[job].successful(): - # collect results - hest, eest, success = jobs[job].result() - # store results to sample objects - sample_cleanup(self.data.samples[job], hest, eest, success) - else: - raise IPyradError(jobs[job].result()) + # collect results + hest, eest, success = jobs[job].get() + # store results to sample objects + sample_cleanup(self.data.samples[job], hest, eest, success) def cleanup(self):
compat with new exception/traceback for remote
dereneaton_ipyrad
train
py
fd90a31f300e13b3b19a1bdd6f328f24e769f2c9
diff --git a/lib/modules/ptz.js b/lib/modules/ptz.js index <HASH>..<HASH> 100644 --- a/lib/modules/ptz.js +++ b/lib/modules/ptz.js @@ -192,11 +192,13 @@ class Ptz { */ panTiltZoomOptions (vectors) { let soapBody = '' - if ('x' in vectors && 'y' in vectors) { - soapBody += '<tt:PanTilt x="' + vectors['x'] + '" y="' + vectors['y'] + '"/>' - } - if ('z' in vectors) { - soapBody += '<tt:Zoom x="' + vectors['z'] + '"/>' + if (typeof vectors !== 'undefined' && vectors !== null) { + if ('x' in vectors && 'y' in vectors) { + soapBody += '<tt:PanTilt x="' + vectors['x'] + '" y="' + vectors['y'] + '"/>' + } + if ('z' in vectors) { + soapBody += '<tt:Zoom x="' + vectors['z'] + '"/>' + } } return soapBody };
better error handling for panTiltZoomOptions method
hawkeye64_onvif-nvt
train
js
5569645215e4fbd12a0ff08633cd261cb2a0486c
diff --git a/Database/DatabaseUpdateQuery.php b/Database/DatabaseUpdateQuery.php index <HASH>..<HASH> 100644 --- a/Database/DatabaseUpdateQuery.php +++ b/Database/DatabaseUpdateQuery.php @@ -24,7 +24,7 @@ class DatabaseUpdateQuery $this->_where = array($field, $value, $type); } - public function getQuery($databaseConnection) + public function getQuery(Database $databaseConnection) { if (count($this->_fields) == 0) { return '';
DatabaseUpdateQuery: Optimized method signature of getQuery().
cyantree_grout
train
php
6258bb8183757d12ef2260ac4a18a7665c0ca4c4
diff --git a/fsnotify_bsd.go b/fsnotify_bsd.go index <HASH>..<HASH> 100644 --- a/fsnotify_bsd.go +++ b/fsnotify_bsd.go @@ -349,7 +349,7 @@ func (w *Watcher) readEvents() { fileEvent.Name = w.paths[int(watchEvent.Ident)] fileInfo := w.finfo[int(watchEvent.Ident)] w.pmut.Unlock() - if fileInfo.IsDir() && !fileEvent.IsDelete() { + if fileInfo != nil && fileInfo.IsDir() && !fileEvent.IsDelete() { // Double check to make sure the directory exist. This can happen when // we do a rm -fr on a recursively watched folders and we receive a // modification event first but the folder has been deleted and later @@ -360,7 +360,7 @@ func (w *Watcher) readEvents() { } } - if fileInfo.IsDir() && fileEvent.IsModify() && !fileEvent.IsDelete() { + if fileInfo != nil && fileInfo.IsDir() && fileEvent.IsModify() && !fileEvent.IsDelete() { w.sendDirectoryChangeEvents(fileEvent.Name) } else { // Send the event on the events channel
Fixes issue #<I> Not exactly the best fix, but it'll do.
fsnotify_fsnotify
train
go
57c1e783cdb48775dcbeb8cbfe59631e82eb6d0b
diff --git a/go/libkb/util.go b/go/libkb/util.go index <HASH>..<HASH> 100644 --- a/go/libkb/util.go +++ b/go/libkb/util.go @@ -190,6 +190,10 @@ func safeWriteToFileOnce(g SafeWriteLogger, t SafeWriter, mode os.FileMode) erro err = tmp.Close() if err == nil { err = os.Rename(tmpfn, fn) + if err != nil { + g.Errorf(fmt.Sprintf("Error renaming file %s: %s", tmpfn, err)) + os.Remove(tmpfn) + } } else { g.Errorf(fmt.Sprintf("Error closing temporary file %s: %s", tmpfn, err)) os.Remove(tmpfn)
Cleanup file on rename error (#<I>)
keybase_client
train
go
759f989db4aec50070bd121ab38abf7e81634a0d
diff --git a/src/main/java/org/dasein/cloud/cloudstack/compute/CSSnapshotCapabilities.java b/src/main/java/org/dasein/cloud/cloudstack/compute/CSSnapshotCapabilities.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/dasein/cloud/cloudstack/compute/CSSnapshotCapabilities.java +++ b/src/main/java/org/dasein/cloud/cloudstack/compute/CSSnapshotCapabilities.java @@ -50,6 +50,6 @@ public class CSSnapshotCapabilities extends AbstractCapabilities<CSCloud> implem @Override public boolean supportsSnapshotSharingWithPublic() throws InternalException, CloudException { - return false; + return true; } } diff --git a/src/main/java/org/dasein/cloud/cloudstack/compute/CSTemplateCapabilities.java b/src/main/java/org/dasein/cloud/cloudstack/compute/CSTemplateCapabilities.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/dasein/cloud/cloudstack/compute/CSTemplateCapabilities.java +++ b/src/main/java/org/dasein/cloud/cloudstack/compute/CSTemplateCapabilities.java @@ -100,7 +100,7 @@ public class CSTemplateCapabilities extends AbstractCapabilities<CSCloud> implem @Override public boolean supportsImageSharing() throws CloudException, InternalException { - return true; + return false; } @Override
bugzid <I>: templates and snapshots can be made public but not shared with other accounts
greese_dasein-cloud-cloudstack
train
java,java
fe706310e3857a1c75a2cd1b028a88a022a2425d
diff --git a/tests/test_modules/test_scanning/test_runnablecontroller.py b/tests/test_modules/test_scanning/test_runnablecontroller.py index <HASH>..<HASH> 100644 --- a/tests/test_modules/test_scanning/test_runnablecontroller.py +++ b/tests/test_modules/test_scanning/test_runnablecontroller.py @@ -487,7 +487,7 @@ class TestRunnableController(unittest.TestCase): compound.prepare() steps_per_run = get_steps_per_run(compound, ['x'], []) - assert steps_per_run[0] == 10 + assert steps_per_run[0] == [10] def test_steps_per_run(self): line1 = LineGenerator('x', 'mm', -10, -10, 5) @@ -503,7 +503,7 @@ class TestRunnableController(unittest.TestCase): generator=compound, axes_to_move=['x'], breakpoints=breakpoints) - assert steps_per_run == breakpoints + assert steps_per_run == (breakpoints, True) def test_breakpoints_without_last(self): line1 = LineGenerator('x', 'mm', -10, -10, 5)
Added a boolean variable to test if breakpoints are given
dls-controls_pymalcolm
train
py
c775ee9c0fb8bc1dedf391d39bbb55a2c4d5211e
diff --git a/memote/suite/tests/test_biomass.py b/memote/suite/tests/test_biomass.py index <HASH>..<HASH> 100644 --- a/memote/suite/tests/test_biomass.py +++ b/memote/suite/tests/test_biomass.py @@ -28,7 +28,6 @@ from __future__ import absolute_import, division import logging import pytest -import numpy as np from cobra.exceptions import OptimizationError import memote.support.biomass as biomass @@ -87,8 +86,10 @@ def test_biomass_consistency(read_only_model, reaction_id): """The component molar mass of the biomass reaction {} sums up to {} which is outside of the 1e-03 margin from 1 mmol / g[CDW] / h. """.format(reaction_id, ann["data"][reaction_id])) - assert np.isclose( - ann["data"][reaction_id], 1.0, atol=1e-03), ann["message"][reaction_id] + # To account for numerical innacuracies, a range from 1-1e0-3 to 1+1e-06 + # is implemented in the assertion check + assert (1 - 1e-03) < ann["data"][reaction_id] < (1 + 1e-06), \ + ann["message"][reaction_id] @pytest.mark.parametrize("reaction_id", BIOMASS_IDS)
fix: fix assertion check (#<I>) * fix: provide more slack for biomass consistency check
opencobra_memote
train
py
8956866d9347dad91258aad2fe4f143ad6c3b1d9
diff --git a/grimoire_elk/elk/git.py b/grimoire_elk/elk/git.py index <HASH>..<HASH> 100644 --- a/grimoire_elk/elk/git.py +++ b/grimoire_elk/elk/git.py @@ -400,6 +400,10 @@ class GitEnrich(Enrich): if 'project' in item: eitem['project'] = item['project'] + # Adding the git author domain + author_domain = self.get_identity_domain(self.get_sh_identity(item, 'Author')) + eitem['git_author_domain'] = author_domain + eitem.update(self.get_grimoire_fields(commit["AuthorDate"], "commit")) if self.sortinghat:
[enrich][git] Add a new field git_author_domain with the email domain for the Author of the commit
chaoss_grimoirelab-elk
train
py
a113cda6a404efd41e05358dd5ccb816aa0b5ae9
diff --git a/murmurhash/about.py b/murmurhash/about.py index <HASH>..<HASH> 100644 --- a/murmurhash/about.py +++ b/murmurhash/about.py @@ -4,7 +4,7 @@ # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py __name__ = 'murmurhash' -__version__ = '0.27.0' +__version__ = '0.26.1' __summary__ = 'Cython bindings for MurmurHash2' __uri__ = 'https://github.com/syllog1sm/cython-murmurhash' __author__ = 'Matthew Honnibal'
* Make the release <I>, not <I>
explosion_murmurhash
train
py
f9c377f48efc854cc8043b17a21b1e82d1ad7800
diff --git a/lib/pseudohiki/treestack.rb b/lib/pseudohiki/treestack.rb index <HASH>..<HASH> 100644 --- a/lib/pseudohiki/treestack.rb +++ b/lib/pseudohiki/treestack.rb @@ -64,9 +64,7 @@ class TreeStack def initialize(root_node=Node.new) @stack = [root_node] @node_end = NodeEnd.new - def root_node.depth - 0 - end + root_node.depth = 0 end def current_node
refactoring of TreeStack#initialize() to reduce unnecessary generation of objects
nico-hn_PseudoHikiParser
train
rb
848de495024d9b3a9bb74fcbce3216d1a85db3e3
diff --git a/classes/PodsAPI.php b/classes/PodsAPI.php index <HASH>..<HASH> 100644 --- a/classes/PodsAPI.php +++ b/classes/PodsAPI.php @@ -159,7 +159,7 @@ class PodsAPI { if ( $sanitized ) { $data = pods_unsanitize( $data ); - // Do not unsanitize $meta. This is already done by WP. + $meta = pods_unsanitize( $meta ); } if ( $is_meta_object ) { @@ -3994,6 +3994,8 @@ class PodsAPI { $fields_to_send[ $field ] = $field_data; } + $meta_fields = pods_sanitize( $meta_fields ); + $params->id = $this->save_wp_object( $object_type, $object_data, $meta_fields, false, true, $fields_to_send ); if ( ! empty( $params->id ) && 'settings' === $pod['type'] ) {
Fix bug after #<I> This commit sets the fix in #<I> to only occur with WP object fields, not Pod options and other data.
pods-framework_pods
train
php
3fff13e2a1df73419c3f7e719d90b714902c0492
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,14 @@ * Both the construction method and set of exposed * formats. */ -const format = module.exports = require('./format'); +const format = exports.format = require('./format'); + +/** + * @api public + * @method {function} levels + * Registers the specified levels with logform. + */ +const levels = exports.levels = require('./levels'); // // Setup all transports as lazy-loaded getters.
[api breaking] Expose both `format` and `levels` at the top-level.
winstonjs_logform
train
js
b77d1dbe3a4afd5ac9259e85a94f1bd17bc97f34
diff --git a/tests/test_main.py b/tests/test_main.py index <HASH>..<HASH> 100755 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -2969,6 +2969,22 @@ def test_ragnaros(): assert not ragnaros.canAttack() +def test_raid_leader(): + game = prepare_game() + wisp1 = game.player1.give(WISP) + wisp1.play() + wisp2 = game.player1.give(WISP) + wisp2.play() + wisp3 = game.player2.summon(WISP) + raidleader = game.player1.summon("CS2_122") + assert wisp1.atk == wisp2.atk == 2 + assert wisp3.atk == 1 + + raidleader.destroy() + + assert wisp1.atk == wisp2.atk == 1 + + def test_tree_of_life(): game = prepare_game() token1 = game.player1.give(SPELLBENDERT)
add a basic test for Raid Leader
jleclanche_fireplace
train
py
432a5fac4ec2849be0ba5fcd4ae9881379100807
diff --git a/includes/class-mf2-post.php b/includes/class-mf2-post.php index <HASH>..<HASH> 100644 --- a/includes/class-mf2-post.php +++ b/includes/class-mf2-post.php @@ -514,7 +514,7 @@ class MF2_Post implements ArrayAccess { public function get_attached_media( $type, $post ) { $posts = get_attached_media( $type, $post ); - return wp_list_pluck( $posts, 'post_ID' ); + return wp_list_pluck( $posts, 'ID' ); } public function get_audios() {
Update class-mf2-post.php
dshanske_parse-this
train
php
ef1ad23ec9e0b931f530c19b029b4bb0e30c7ed8
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java index <HASH>..<HASH> 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java @@ -51,7 +51,8 @@ public final class NoOpBarrierStep<S> extends AbstractStep<S, S> implements Loca @Override protected Traverser.Admin<S> processNextStart() throws NoSuchElementException { - this.processAllStarts(); + if (this.barrier.isEmpty()) + this.processAllStarts(); return this.barrier.remove(); }
fixed a minor bug in NoOpBarrierStep that was introduced in <I>-SNAPSHOT development. CTR.
apache_tinkerpop
train
java
107b6f18cfc03745627a68b93df1a7d3a2fe676c
diff --git a/stripe/src/main/java/com/stripe/android/model/PaymentMethod.java b/stripe/src/main/java/com/stripe/android/model/PaymentMethod.java index <HASH>..<HASH> 100644 --- a/stripe/src/main/java/com/stripe/android/model/PaymentMethod.java +++ b/stripe/src/main/java/com/stripe/android/model/PaymentMethod.java @@ -65,13 +65,19 @@ public final class PaymentMethod extends StripeModel implements Parcelable { public enum Type { Card("card"), CardPresent("card_present"), - Fpx("fpx"), + Fpx("fpx", false), Ideal("ideal"); @NonNull public final String code; + public final boolean isReusable; Type(@NonNull String code) { + this(code, true); + } + + Type(@NonNull String code, boolean isReusable) { this.code = code; + this.isReusable = isReusable; } }
Add isReusable field to PaymentMethod.Type (#<I>)
stripe_stripe-android
train
java
8ab0c8c8851ce748aac6ee6aa242d3521e1eea2c
diff --git a/db/migrate/20140822093043_restore_slug_index_to_groups.rb b/db/migrate/20140822093043_restore_slug_index_to_groups.rb index <HASH>..<HASH> 100644 --- a/db/migrate/20140822093043_restore_slug_index_to_groups.rb +++ b/db/migrate/20140822093043_restore_slug_index_to_groups.rb @@ -1,10 +1,24 @@ class RestoreSlugIndexToGroups < ActiveRecord::Migration - Group.all.each do |group| - group.slug = nil - group.save! + class Group < ActiveRecord::Base + + extend FriendlyId + friendly_id :slug_candidates, use: :slugged + + has_ancestry cache_depth: true + + def slug_candidates + candidates = [name] + candidates << [parent.name, name] if parent.present? + candidates + end end def change + Group.all.each do |group| + group.slug = nil + group.save + end + add_index :groups, :slug end end
Update the group slugs and restore the index - Note that this migration fails when run in a batch with this error: PG::FeatureNotSupported: ERROR: cached plan must not change result type - This appears to be caused by executing sql in the previous migration that adds ancestry to the group - If the migration fails, it works the next time
ministryofjustice_peoplefinder
train
rb
e2d391f856f44a8d3b06c4070461a095b7a02d11
diff --git a/check.go b/check.go index <HASH>..<HASH> 100644 --- a/check.go +++ b/check.go @@ -406,6 +406,14 @@ func (v *visitor) funcWarns(sign *types.Signature) []string { return warns } +func (v *visitor) stripPkg(fullName string) string { + pname := v.Pkg.Path() + if strings.HasPrefix(fullName, pname+".") { + return fullName[len(pname)+1:] + } + return fullName +} + func (v *visitor) paramWarn(vr *types.Var, vu *varUsage) string { ifname, iftype := v.interfaceMatching(vr, vu) if ifname == "" { @@ -420,9 +428,5 @@ func (v *visitor) paramWarn(vr *types.Var, vu *varUsage) string { return "" } } - pname := v.Pkg.Path() - if strings.HasPrefix(ifname, pname+".") { - ifname = ifname[len(pname)+1:] - } - return fmt.Sprintf("%s can be %s", vr.Name(), ifname) + return fmt.Sprintf("%s can be %s", vr.Name(), v.stripPkg(ifname)) }
Separate package stripping into a function
mvdan_interfacer
train
go
7e2b8f0766363bcce668b93d835df026254c8e1b
diff --git a/applications/desktop/src/notebook/index.js b/applications/desktop/src/notebook/index.js index <HASH>..<HASH> 100644 --- a/applications/desktop/src/notebook/index.js +++ b/applications/desktop/src/notebook/index.js @@ -100,6 +100,9 @@ export default class App extends React.PureComponent<Object, Object> { } } -// $FlowFixMe: Needs to be nullable -const app: Element = document.querySelector("#app"); -ReactDOM.render(<App />, app); +const app = document.querySelector("#app"); +if (app) { + ReactDOM.render(<App />, app); +} else { + console.error("Failed to bootstrap the notebook app"); +}
perform a basic check on desktop app render
nteract_nteract
train
js
5f7f36234c3c37b3f2747282559fe49b20507890
diff --git a/wandb/internal/tb_watcher.py b/wandb/internal/tb_watcher.py index <HASH>..<HASH> 100644 --- a/wandb/internal/tb_watcher.py +++ b/wandb/internal/tb_watcher.py @@ -139,9 +139,16 @@ class TBDirWatcher(object): if "tfevents" not in basename or basename.endswith(".profile-empty"): return False fname_components = basename.split(".") + # check the hostname, which may have dots + for i, part in enumerate(self._hostname.split(".")): + try: + fname_component_part = fname_components[4 + i] + except IndexError: + return False + if part != fname_component_part: + return False try: created_time = int(fname_components[3]) - hostname = fname_components[4] except (ValueError, IndexError): return False # Ensure that the file is newer then our start time, and that it was @@ -149,7 +156,7 @@ class TBDirWatcher(object): # TODO: we should also check the PID (also contained in the tfevents # filename). Can we assume that our parent pid is the user process # that wrote these files? - return created_time >= start_time and hostname == self._hostname # noqa: W503 + return created_time >= start_time # noqa: W503 def _loader(self, save=True, namespace=None): """Incredibly hacky class generator to optionally save / prefix tfevent files"""
Check each component of hostname.split('.') for tboard files (#<I>) * Check each component of hostname.split('.') for tboard files * Format
wandb_client
train
py
a3f255b62f9b10c1adc87d8fc5ac6465bf1b9918
diff --git a/lib/semverse/gem_version.rb b/lib/semverse/gem_version.rb index <HASH>..<HASH> 100644 --- a/lib/semverse/gem_version.rb +++ b/lib/semverse/gem_version.rb @@ -1,3 +1,3 @@ module Semverse - VERSION = "2.0.0" + VERSION = "3.0.0" end
Release <I> Major version bump since ruby <I> support has been removed.
berkshelf_semverse
train
rb
c8e70396e4039e3a632d575b42927800fb95b53a
diff --git a/cli/Valet/Site.php b/cli/Valet/Site.php index <HASH>..<HASH> 100644 --- a/cli/Valet/Site.php +++ b/cli/Valet/Site.php @@ -477,7 +477,9 @@ class Site public function secured() { return collect($this->files->scandir($this->certificatesPath())) - ->map(function ($file) { + ->filter(function ($file) { + return ends_with($file, ['.key', '.csr', '.crt', '.conf']); + })->map(function ($file) { return str_replace(['.key', '.csr', '.crt', '.conf'], '', $file); })->unique()->values()->all(); } diff --git a/tests/SiteTest.php b/tests/SiteTest.php index <HASH>..<HASH> 100644 --- a/tests/SiteTest.php +++ b/tests/SiteTest.php @@ -787,7 +787,7 @@ class SiteTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase $files = Mockery::mock(Filesystem::class); $files->shouldReceive('scandir') ->once() - ->andReturn(['helloworld.tld.crt']); + ->andReturn(['helloworld.tld.crt', '.DS_Store']); swap(Filesystem::class, $files);
Specifically look for cert files in secured() method. Fixes #<I>
laravel_valet
train
php,php
fcd2c7b6d457f2a5956b9e8d71519f3104bd0449
diff --git a/gns3server/schemas/node.py b/gns3server/schemas/node.py index <HASH>..<HASH> 100644 --- a/gns3server/schemas/node.py +++ b/gns3server/schemas/node.py @@ -144,7 +144,7 @@ NODE_OBJECT_SCHEMA = { }, "console_type": { "description": "Console type", - "enum": ["vnc", "telnet", "http", "spice", None] + "enum": ["vnc", "telnet", "http", "https", "spice", None] }, "properties": { "description": "Properties specific to an emulator",
Add missing https console keyword in JSON schema. Fixes #<I>.
GNS3_gns3-server
train
py
0d19fc4805aa48b515b77d87a2476b669be48ae1
diff --git a/chef/spec/unit/provider/group_spec.rb b/chef/spec/unit/provider/group_spec.rb index <HASH>..<HASH> 100644 --- a/chef/spec/unit/provider/group_spec.rb +++ b/chef/spec/unit/provider/group_spec.rb @@ -234,20 +234,20 @@ describe Chef::Provider::User do @new_resource.members << "user2" @new_resource.stub!(:append).and_return true @provider.compare_group.should be_true - @provider.change_desc.should == "would add missing member(s): user1, user2" + @provider.change_desc.should == "add missing member(s): user1, user2" end it "should report that the group members will be overwritten if not appending" do @new_resource.members << "user1" @new_resource.stub!(:append).and_return false @provider.compare_group.should be_true - @provider.change_desc.should == "would replace group members with new list of members" + @provider.change_desc.should == "replace group members with new list of members" end it "should report the gid will be changed when it does not match" do @current_resource.stub!(:gid).and_return("BADF00D") @provider.compare_group.should be_true - @provider.change_desc.should == "would change gid #{@current_resource.gid} to #{@new_resource.gid}" + @provider.change_desc.should == "change gid #{@current_resource.gid} to #{@new_resource.gid}" end
tests expecting a particular string of text fail after modifying converge-by descriptions
chef_chef
train
rb
c522c994cd162bc42d987e2ebb08f3d0a2b6f644
diff --git a/lib/client.js b/lib/client.js index <HASH>..<HASH> 100644 --- a/lib/client.js +++ b/lib/client.js @@ -14,6 +14,7 @@ const { InvalidArgumentError, RequestAbortedError, ClientDestroyedError, + ClientClosedError, HeadersTimeoutError, SocketError, InformationalError, @@ -241,6 +242,14 @@ class Client extends EventEmitter { } [kEnqueue] (request) { + if (this[kDestroyed]) { + throw new ClientDestroyedError() + } + + if (this[kClosed]) { + throw new ClientClosedError() + } + this[kQueue].push(request) if (this[kResuming]) { // Do nothing.
fix: add destroyed & closed check to enqueue
mcollina_undici
train
js
fb30c1e28c617f66b446195580670caeaa24e838
diff --git a/tests/Providers/RouteServiceProviderTest.php b/tests/Providers/RouteServiceProviderTest.php index <HASH>..<HASH> 100644 --- a/tests/Providers/RouteServiceProviderTest.php +++ b/tests/Providers/RouteServiceProviderTest.php @@ -50,10 +50,8 @@ class RouteServiceProviderTest extends TestCase $closure($this->router); }) ->shouldReceive('get') - ->once() ->andReturnNull() ->shouldReceive('post') - ->once() ->andReturnNull(); } @@ -61,4 +59,9 @@ class RouteServiceProviderTest extends TestCase { $this->assertNull($this->serviceProvider->boot($this->router)); } + + public function test_register() + { + $this->assertNull($this->serviceProvider->register()); + } }
test: Make coverage to <I>%
CasperLaiTW_laravel-fb-messenger
train
php
5876dc01864d2f19b73e4555ec88fa045b88e240
diff --git a/tests/test_dynamodb2/test_dynamodb.py b/tests/test_dynamodb2/test_dynamodb.py index <HASH>..<HASH> 100644 --- a/tests/test_dynamodb2/test_dynamodb.py +++ b/tests/test_dynamodb2/test_dynamodb.py @@ -691,8 +691,8 @@ def test_basic_projection_expressions_using_scan(): results = table.scan(FilterExpression=Key('forum_name').eq('the-key'), ProjectionExpression='body')['Items'] - results.should.equal([{u'body': u'yet another test message'}, - {u'body': u'some test message'}]) + assert {u'body': u'some test message'} in results + assert {u'body': u'yet another test message'} in results # The projection expression should not remove data from storage results = table.query(KeyConditionExpression=Key('forum_name').eq('the-key'))
Fix test - List order does not matter for projectionexpression
spulec_moto
train
py