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
ef2a28ca8643a88546f42fb39d4851f7a421f90d
diff --git a/spec/webview-spec.js b/spec/webview-spec.js index <HASH>..<HASH> 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -4,7 +4,7 @@ const http = require('http') const url = require('url') const {remote} = require('electron') -const {BrowserWindow} = remote +const {app} = remote describe('<webview> tag', function () { this.timeout(10000) @@ -79,14 +79,8 @@ describe('<webview> tag', function () { it('disables node integration on child windows when it is disabled on the webview', function (done) { - webview.addEventListener('console-message', function (e) { - assert.equal(e.message, 'window opened') - const sourceId = remote.getCurrentWindow().id - const windows = BrowserWindow.getAllWindows().filter(function (window) { - return window.id !== sourceId - }) - assert.equal(windows.length, 1) - assert.equal(windows[0].webContents.getWebPreferences().nodeIntegration, false) + app.once('browser-window-created', function (event, window) { + assert.equal(window.webContents.getWebPreferences().nodeIntegration, false) done() })
Listen for browser-window-created event for asserts
electron_electron
train
js
aee52294c7cdbb25cdc70267b6030e3a62e7fc38
diff --git a/feature/deps.go b/feature/deps.go index <HASH>..<HASH> 100644 --- a/feature/deps.go +++ b/feature/deps.go @@ -72,9 +72,6 @@ var deps = depDesc{ lnwire.KeysendOptional: { lnwire.TLVOnionPayloadOptional: {}, }, - lnwire.ScidAliasOptional: { - lnwire.ExplicitChannelTypeOptional: {}, - }, lnwire.ZeroConfOptional: { lnwire.ScidAliasOptional: {}, },
feature: remove `ScidAliasOptional` dependency on `ExplicitChannelTypeOptional` The [spec](<URL>) does not specify a dependency between `ScidAliasOptional` (<I>) and `ExplicitChannelTypeOptional` (<I>). This bug lead to some connectivity issues with peers not setting the <I> feature bit while setting the <I>. The issue [<I>](<URL>) is an example of this.
lightningnetwork_lnd
train
go
5f6f0627e731b68419f7c6a7426b370ac3da00e9
diff --git a/pyemma/_base/serialization/serialization.py b/pyemma/_base/serialization/serialization.py index <HASH>..<HASH> 100644 --- a/pyemma/_base/serialization/serialization.py +++ b/pyemma/_base/serialization/serialization.py @@ -92,8 +92,8 @@ class SerializableMixIn(object): flattened = jsonpickle.dumps(self) except Exception as e: if isinstance(self, Loggable): - self.logger.exception('During saving the object ("%s") ' - 'the following error occured' % e) + self.logger.exception('During saving the object ("{error}") ' + 'the following error occurred'.format(error=e)) raise if six.PY3: @@ -253,6 +253,10 @@ class SerializableMixIn(object): state = self.get_model_params() res.update(state) + # store the current software version + from pyemma import version + state['_pyemma_version'] = version + return res def __setstate__(self, state): @@ -281,3 +285,6 @@ class SerializableMixIn(object): names = self._get_param_names() new_state = {key: state[key] for key in names if key in state} self.set_params(**new_state) + + if hasattr(state, '_pyemma_version'): + self._pyemma_version = state['_pyemma_version']
[serialization] save pyemma version
markovmodel_PyEMMA
train
py
3cee1f9f790cb5197d9f3a27cf725fd9137e8fe4
diff --git a/salt/modules/file.py b/salt/modules/file.py index <HASH>..<HASH> 100644 --- a/salt/modules/file.py +++ b/salt/modules/file.py @@ -3480,7 +3480,12 @@ def open_files(by_pid=False): fd_.append('{0}/fd/{1}'.format(ppath, fpath)) for tid in tids: - fd_.append(os.path.realpath('{0}/task/{1}/exe'.format(ppath, tid))) + try: + fd_.append( + os.path.realpath('{0}/task/{1}/exe'.format(ppath, tid)) + ) + except OSError: + continue for tpath in os.listdir('{0}/task/{1}/fd'.format(ppath, tid)): fd_.append('{0}/task/{1}/fd/{2}'.format(ppath, tid, tpath))
Add back in try/except for checking files
saltstack_salt
train
py
2d6498da546a33ca8909b449bc844cfff5243639
diff --git a/main.go b/main.go index <HASH>..<HASH> 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,21 @@ import ( // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket#Ready_state_constants type ReadyState uint16 +func (rs ReadyState) String() string { + switch rs { + case Connecting: + return "Connecting" + case Open: + return "Open" + case Closing: + return "Closing" + case Closed: + return "Closed" + default: + return "Unknown" + } +} + // Ready state constants from // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket#Ready_state_constants const (
Add ReadyState.String()
gopherjs_websocket
train
go
0c2a9826279fb9f19e3291a393760a9fb7c55d0b
diff --git a/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java b/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java index <HASH>..<HASH> 100644 --- a/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java +++ b/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java @@ -123,7 +123,9 @@ public class ScriptableOutputStream extends ObjectOutputStream { "Date", "Date.prototype", "RegExp", "RegExp.prototype", "Script", "Script.prototype", - "Continuation", "Continuation.prototype" + "Continuation", "Continuation.prototype", + "XML", "XML.prototype", + "XMLList", "XMLList.prototype", }; for (int i=0; i < names.length; i++) { addExcludedName(names[i]);
Added XML and XMLList to the exclusion list
mozilla_rhino
train
java
1431551d05998ac752ca6badafbc493299cb3313
diff --git a/openquake/calculators/scenario_risk.py b/openquake/calculators/scenario_risk.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/scenario_risk.py +++ b/openquake/calculators/scenario_risk.py @@ -48,12 +48,12 @@ def scenario_risk(riskinputs, riskmodel, rlzs_assoc, monitor): :class:`openquake.baselib.performance.PerformanceMonitor` instance :returns: a dictionary { - 'agg': array of shape (E, R, 2), - 'avg': list of tuples (rlz_ids, asset_idx, statistics) + 'agg': array of shape (E, L, R, 2), + 'avg': list of tuples (lt_idx, rlz_idx, asset_idx, statistics) } - where E is the number of simulated events, R the number of realizations - and statistics is an array of shape (n, R, 4), being n the number of - assets in the current riskinput object. + where E is the number of simulated events, L the number of loss types, + R the number of realizations and statistics is an array of shape + (n, R, 4), with n the number of assets in the current riskinput object """ E = monitor.oqparam.number_of_ground_motion_fields logging.info('Process %d, considering %d risk input(s) of weight %d',
Fixed docstring (again)
gem_oq-engine
train
py
01bcfa3c332a939d4d2b56ef2db00b6c7e50932d
diff --git a/bin/kong-dashboard.js b/bin/kong-dashboard.js index <HASH>..<HASH> 100755 --- a/bin/kong-dashboard.js +++ b/bin/kong-dashboard.js @@ -125,7 +125,7 @@ function start(argv) { argv.kongRequestOpts.headers['Authorization'] = 'Basic ' + base64; } - if (argv.apiKey !== '') { + if (argv.apiKey !== '' && typeof argv.apiKey !== 'undefined') { argv.kongRequestOpts.headers[argv.apiKeyName.toLowerCase()] = argv.apiKey; }
do not send null apikey header if it wasn't provided
PGBI_kong-dashboard
train
js
c39f019849870b48dc1476d397a6f100b142e029
diff --git a/filter/tex/texed.php b/filter/tex/texed.php index <HASH>..<HASH> 100644 --- a/filter/tex/texed.php +++ b/filter/tex/texed.php @@ -31,10 +31,12 @@ $texexp = str_replace('&lt;','<',$texexp); $texexp = str_replace('&gt;','>',$texexp); $texexp = preg_replace('!\r\n?!',' ',$texexp); + $pathname = "$CFG->dataroot/filter/tex/$image"; $cmd = tex_filter_get_cmd($pathname, $texexp); system($cmd, $status); if (file_exists($pathname)) { + require_once($CFG->libdir . '/filelib.php'); send_file($pathname, $image); } else { echo "Image not found!";
MDL-<I> filter/tex reverting removal of $pathname in <URL>
moodle_moodle
train
php
8785c55796a32ba11ab19911d182959be0a5d5a9
diff --git a/tests/pytests/unit/modules/test_iptables.py b/tests/pytests/unit/modules/test_iptables.py index <HASH>..<HASH> 100644 --- a/tests/pytests/unit/modules/test_iptables.py +++ b/tests/pytests/unit/modules/test_iptables.py @@ -218,9 +218,10 @@ def test_build_rule(): ) # Should allow the --save jump option to CONNSECMARK - # self.assertEqual(iptables.build_rule(jump='CONNSECMARK', - # **{'save': ''}), - # '--jump CONNSECMARK --save ') + # assert ( + # iptables.build_rule(jump='CONNSECMARK', **{'save': ''}) + # == '--jump CONNSECMARK --save ' + # ) ret = "/sbin/iptables --wait -t salt -I INPUT 3 -m state --jump ACCEPT" with patch.object(
make comment in iptables module test file align with pytest
saltstack_salt
train
py
ce3756ff12b22f6ddf7714f01a8920c9e8a7da58
diff --git a/Makefile b/Makefile index <HASH>..<HASH> 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ GOFILES=\ mmap.go GOFILES_freebsd=\ - mmap_linux.go\ + mmap_darwin.go\ mmap_unix.go GOFILES_darwin=\ diff --git a/mmap_darwin.go b/mmap_darwin.go index <HASH>..<HASH> 100644 --- a/mmap_darwin.go +++ b/mmap_darwin.go @@ -12,6 +12,3 @@ import ( const ( MAP_ANONYMOUS = syscall.MAP_ANON ) - - - diff --git a/mmap_linux.go b/mmap_linux.go index <HASH>..<HASH> 100644 --- a/mmap_linux.go +++ b/mmap_linux.go @@ -11,5 +11,3 @@ import ( const ( MAP_ANONYMOUS = syscall.MAP_ANONYMOUS ) - -
Use MAP_ANON with FreeBSD Untested, but the documentation makes it seem like this will work.
edsrzf_mmap-go
train
Makefile,go,go
90f0306fc029002969ba1eac2679dc13fc9c1e3c
diff --git a/addon/internal-model.js b/addon/internal-model.js index <HASH>..<HASH> 100644 --- a/addon/internal-model.js +++ b/addon/internal-model.js @@ -77,7 +77,7 @@ export default class InternalModel { model.beginPropertyChanges(); } - let props = []; + let props = Ember.A(); let changed = key => { if(notifyModel) { diff --git a/addon/properties/relations/belongs-to.js b/addon/properties/relations/belongs-to.js index <HASH>..<HASH> 100644 --- a/addon/properties/relations/belongs-to.js +++ b/addon/properties/relations/belongs-to.js @@ -56,7 +56,7 @@ export default class BelongsToRelation extends Relation { } internalModelDidChange(internal, props) { - if(props.indexOf('isDeleted') !== -1) { + if(internal.state.isDeleted && props.includes('isDeleted')) { this.onValueDeleted(); } }
actually check for isDeleted value not only isDeleted change --HG-- branch : feature/belongs-to-persisted
ampatspell_ember-cli-sofa
train
js,js
eb05f3de20fd718e4107dc4d0c1efab12b073544
diff --git a/scripts/Roots/Bedrock/Installer.php b/scripts/Roots/Bedrock/Installer.php index <HASH>..<HASH> 100644 --- a/scripts/Roots/Bedrock/Installer.php +++ b/scripts/Roots/Bedrock/Installer.php @@ -32,7 +32,7 @@ class Installer { } $salts = array_map(function ($key) { - return sprintf("%s='%s'", $key, Installer::generate_salt()); + return sprintf("%s='%s'", $key, Installer::generateSalt()); }, self::$KEYS); $env_file = "{$root}/.env"; @@ -49,7 +49,7 @@ class Installer { * Slightly modified/simpler version of wp_generate_password * https://github.com/WordPress/WordPress/blob/cd8cedc40d768e9e1d5a5f5a08f1bd677c804cb9/wp-includes/pluggable.php#L1575 */ - public static function generate_salt($length = 64) { + public static function generateSalt($length = 64) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $chars .= '!@#$%^&*()'; $chars .= '-_ []{}<>~`+=,.;:/?|';
Fixing PSR-1 issues in installer
roots_bedrock
train
php
2996273ade4eface95ecdce8a2fee36c14dfe8e6
diff --git a/app/models/has_vcards/concerns/has_vcards.rb b/app/models/has_vcards/concerns/has_vcards.rb index <HASH>..<HASH> 100644 --- a/app/models/has_vcards/concerns/has_vcards.rb +++ b/app/models/has_vcards/concerns/has_vcards.rb @@ -27,7 +27,8 @@ module HasVcards def vcard_with_autobuild vcard_without_autobuild || build_vcard end - alias_method_chain :vcard, :autobuild + alias_method :vcard_without_autobuild, :vcard + alias_method :vcard, :vcard_with_autobuild # Access restrictions if defined?(ActiveModel::MassAssignmentSecurity) diff --git a/app/models/has_vcards/vcard.rb b/app/models/has_vcards/vcard.rb index <HASH>..<HASH> 100644 --- a/app/models/has_vcards/vcard.rb +++ b/app/models/has_vcards/vcard.rb @@ -28,7 +28,9 @@ module HasVcards def address_with_autobuild address_without_autobuild || build_address end - alias_method_chain :address, :autobuild + alias_method :address_without_autobuild, :address + alias_method :address, :address_with_autobuild + # Contacts has_many :contacts, class_name: 'PhoneNumber', inverse_of: :vcard do
fix: alias_method_chain is deprecated, replaced with alias_method
huerlisi_has_vcards
train
rb,rb
67ebcf947108d06a77f5552b809e307494a20749
diff --git a/lib/sassc/rails/railtie.rb b/lib/sassc/rails/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/sassc/rails/railtie.rb +++ b/lib/sassc/rails/railtie.rb @@ -53,9 +53,7 @@ module SassC::Rails end initializer :setup_compression, group: :all do |app| - app.config.assets.css_compressor = nil - - if !Rails.env.development? + unless Rails.env.development? app.config.assets.css_compressor ||= :sass else # Use expanded output instead of the sass default of :nested unless specified diff --git a/test/sassc_rails_test.rb b/test/sassc_rails_test.rb index <HASH>..<HASH> 100644 --- a/test/sassc_rails_test.rb +++ b/test/sassc_rails_test.rb @@ -13,6 +13,7 @@ class SassRailsTest < MiniTest::Unit::TestCase @app.config.log_level = :debug # reset config back to default + @app.config.assets.css_compressor = nil @app.config.sass = ActiveSupport::OrderedOptions.new @app.config.sass.preferred_syntax = :scss @app.config.sass.load_paths = []
Stop overriding the app css_compressor setting
sass_sassc-rails
train
rb,rb
0cfe8bb946edd76c21e3e32df4caf775d2caab42
diff --git a/pyaxo.py b/pyaxo.py index <HASH>..<HASH> 100644 --- a/pyaxo.py +++ b/pyaxo.py @@ -23,23 +23,23 @@ For more information, see https://github.com/rxcomm/pyaxo """ import errno -import sqlite3 -import binascii -import hmac import os +import sqlite3 import sys -import nacl.utils -import nacl.secret from binascii import a2b_base64 as a2b from binascii import b2a_base64 as b2a from collections import namedtuple from getpass import getpass -from time import time from threading import Lock -from passlib.utils.pbkdf2 import pbkdf2 -from nacl.public import PrivateKey, PublicKey, Box +from time import time + +import nacl.secret +import nacl.utils from nacl.exceptions import CryptoError from nacl.hash import sha256 +from nacl.public import PrivateKey, PublicKey, Box +from passlib.utils.pbkdf2 import pbkdf2 + ALICE_MODE = True BOB_MODE = False
Organize imports Remove unused (`binascii` and `hmac`), separate standard from third-party and sort.
rxcomm_pyaxo
train
py
3b2a565ec9d257c2ef2703f088286d990abe3a44
diff --git a/src/main/java/net/kyori/adventure/text/minimessage/parser/TokenParser.java b/src/main/java/net/kyori/adventure/text/minimessage/parser/TokenParser.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/kyori/adventure/text/minimessage/parser/TokenParser.java +++ b/src/main/java/net/kyori/adventure/text/minimessage/parser/TokenParser.java @@ -490,7 +490,6 @@ public final class TokenParser { final @NotNull String message, final @NotNull TemplateResolver templateResolver ) { - final RootNode dummy = new RootNode(message); final List<Token> tokens = tokenize(message); final StringBuilder sb = new StringBuilder(); @@ -502,8 +501,7 @@ public final class TokenParser { break; case OPEN_TAG: - final TagNode tagNode = new TagNode(dummy, token, message, templateResolver); - final Template template = templateResolver.resolve(tagNode.name()); + final Template template = templateResolver.resolve(token.get(message).toString()); if (template instanceof Template.StringTemplate) { sb.append(((Template.StringTemplate) template).value()); } else {
Directly resolve token content instead of creating a node And also an extra test because i was paranoid about this actually working
KyoriPowered_text
train
java
96ea3d25ed79b38226b167021407a885fa03b514
diff --git a/chainlet/chainlink.py b/chainlet/chainlink.py index <HASH>..<HASH> 100644 --- a/chainlet/chainlink.py +++ b/chainlet/chainlink.py @@ -338,6 +338,11 @@ class NeutralLink(ChainLink): __nonzero__ = __bool__ + def __eq__(self, other): + if isinstance(other, self.__class__): + return bool(self) == bool(other) + return NotImplemented + def __str__(self): return self.__class__.__name__
NeutralLink now compares equal by boolean value
maxfischer2781_chainlet
train
py
c5bf2d790263f902e8d2705e3a8d539e5cb34eaf
diff --git a/app/controllers/pbw/commands_controller.rb b/app/controllers/pbw/commands_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/pbw/commands_controller.rb +++ b/app/controllers/pbw/commands_controller.rb @@ -7,5 +7,10 @@ module Pbw def update_model_before_create(model) model.user = current_user end + + def index_scope + scope = super + scope.where(user: current_user) + end end end \ No newline at end of file diff --git a/app/controllers/pbw/tokens_controller.rb b/app/controllers/pbw/tokens_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/pbw/tokens_controller.rb +++ b/app/controllers/pbw/tokens_controller.rb @@ -7,5 +7,10 @@ module Pbw def update_model_before_create(model) model.user = current_user end + + def index_scope + scope = super + scope.where(user: current_user) + end end end \ No newline at end of file
Filter tokens and commands by current user
monkeyx_pbw
train
rb,rb
5f43bb7267df40b5d466148dd044fb1bdd98ae4b
diff --git a/modules/web/src/main/java/org/torquebox/web/servlet/RackFilter.java b/modules/web/src/main/java/org/torquebox/web/servlet/RackFilter.java index <HASH>..<HASH> 100644 --- a/modules/web/src/main/java/org/torquebox/web/servlet/RackFilter.java +++ b/modules/web/src/main/java/org/torquebox/web/servlet/RackFilter.java @@ -88,7 +88,14 @@ public class RackFilter implements Filter { return; } - String servletName = ((ApplicationFilterChain) chain).getServlet().getServletConfig().getServletName(); + String servletName = ""; + + try { + servletName = ((ApplicationFilterChain) chain).getServlet().getServletConfig().getServletName(); + } catch (Exception e) { + log.error(e); + } + if (servletName == RackWebApplicationInstaller.FIVE_HUNDRED_SERVLET_NAME || servletName == RackWebApplicationInstaller.STATIC_RESROUCE_SERVLET_NAME) { // Only hand off requests to Rack if they're handled by one of the
Log if we can't fetch a servlet name, but don't error out.
torquebox_torquebox
train
java
62f4b9fdf6734d54cc0fd2ecc76dff781f64234c
diff --git a/db/sql.php b/db/sql.php index <HASH>..<HASH> 100644 --- a/db/sql.php +++ b/db/sql.php @@ -148,8 +148,8 @@ class SQL extends \PDO { $this->rollback(); user_error('PDOStatement: '.$error[2]); } - if (preg_match( - '/\b(?:CALL|EXPLAIN|SELECT|PRAGMA|SHOW|RETURNING)\b/i', + if (preg_match('/^\s*'. + '(?:CALL|EXPLAIN|SELECT|PRAGMA|SHOW|RETURNING)\b/is', $cmd)) { $result=$query->fetchall(\PDO::FETCH_ASSOC); $this->rows=count($result);
Bug fix: DB Exec does not return affected row if query contain subselect (Issue #<I>)
bcosca_fatfree-core
train
php
4a003c405a818550b2b04728fe0b23c23101a261
diff --git a/O365/account.py b/O365/account.py index <HASH>..<HASH> 100644 --- a/O365/account.py +++ b/O365/account.py @@ -157,9 +157,9 @@ class Account(object): def planner(self, *, resource=''): """ Get an instance to read information from Microsoft planner """ - - if not isinstance(self.protocol , MSGraphProtocol): - # TODO: Custom protocol accessing OneDrive/Sharepoint Api fails here + + if not isinstance(self.protocol, MSGraphProtocol): + # TODO: Custom protocol accessing OneDrive/Sharepoint Api fails here raise RuntimeError( 'planner api only works on Microsoft Graph API') diff --git a/O365/connection.py b/O365/connection.py index <HASH>..<HASH> 100644 --- a/O365/connection.py +++ b/O365/connection.py @@ -152,7 +152,7 @@ class Protocol: scopes = set() for app_part in user_provided_scopes: - for scope in self._oauth_scopes.get(app_part, [app_part]): + for scope in self._oauth_scopes.get(app_part, [(app_part,)]): scopes.add(self._prefix_scope(scope)) return list(scopes)
"protocol.get_scopes_for" now won't prefix scopes that are not scope_helpers
O365_python-o365
train
py,py
28202337193a8fa6f467e35b4c66b8899401775d
diff --git a/src/OutputFilter.php b/src/OutputFilter.php index <HASH>..<HASH> 100644 --- a/src/OutputFilter.php +++ b/src/OutputFilter.php @@ -154,18 +154,10 @@ class OutputFilter * @return string Processed string. * * @since 1.0 - * @todo There must be a better way??? */ public static function ampReplace($text) { - $text = str_replace('&&', '*--*', $text); - $text = str_replace('&#', '*-*', $text); - $text = str_replace('&amp;', '&', $text); - $text = preg_replace('|&(?![\w]+;)|', '&amp;', $text); - $text = str_replace('*-*', '&#', $text); - $text = str_replace('*--*', '&&', $text); - - return $text; + return preg_replace('/(?<!&)&(?!&|#|[\w]+;)/', '&amp;', $text); } /**
use negative lookbehind/lookahed instead of a lot of str_replaces
joomla-framework_filter
train
php
5740f4846458492d0ec6a3d5dd48da7aa55aba1c
diff --git a/src/main/java/org/fit/layout/api/AreaTreeOperator.java b/src/main/java/org/fit/layout/api/AreaTreeOperator.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/fit/layout/api/AreaTreeOperator.java +++ b/src/main/java/org/fit/layout/api/AreaTreeOperator.java @@ -16,6 +16,12 @@ public interface AreaTreeOperator extends Service, ParametrizedOperation { /** + * Returns the operator category that allows to group similar operators in the GUI. + * @return The category name + */ + public String getCategory(); + + /** * Applies the operation to the given tree. * @param atree the area tree to be modified. */
Add a category to each visual area tree operator In order to provide categorization in the GUI
FitLayout_api
train
java
3d53e149ef07b8f7f3230477e8df81efd49468a7
diff --git a/tests/openwrt/test_default.py b/tests/openwrt/test_default.py index <HASH>..<HASH> 100644 --- a/tests/openwrt/test_default.py +++ b/tests/openwrt/test_default.py @@ -1,5 +1,7 @@ import unittest +from openwisp_utils.tests import capture_stdout + from netjsonconfig import OpenWrt from netjsonconfig.utils import _TabsMixin @@ -176,6 +178,7 @@ config custom 'custom' o = OpenWrt({"skipme": {"enabled": True}}) self.assertEqual(o.render(), '') + @capture_stdout() def test_warning(self): o = OpenWrt({"luci": [{"unrecognized": True}]}) self.assertEqual(o.render(), '')
[tests] Avoided noisy output during tests #<I> Applied `capture_stdout` decorator on noisy tests. Closes #<I>
openwisp_netjsonconfig
train
py
c11c9cc0e4300ec6185298403a5a8bc834b326f0
diff --git a/pkg/kvstore/allocator/allocator.go b/pkg/kvstore/allocator/allocator.go index <HASH>..<HASH> 100644 --- a/pkg/kvstore/allocator/allocator.go +++ b/pkg/kvstore/allocator/allocator.go @@ -488,17 +488,6 @@ func (a *Allocator) lockedAllocate(ctx context.Context, key AllocatorKey) (idpoo return 0, false, fmt.Errorf("another writer has allocated this key") } - value, err = a.GetNoCache(ctx, key) - if err != nil { - releaseKeyAndID() - return 0, false, err - } - - if value != 0 { - releaseKeyAndID() - return 0, false, fmt.Errorf("master key already exists") - } - // create /id/<ID> and fail if it already exists keyPath := path.Join(a.idPrefix, strID) success, err := kvstore.CreateOnly(ctx, keyPath, []byte(k), false)
kvstore/allocator: do not re-get slave key on allocation As the slave key is protected by the kvstore global lock it is not really necessary to do another Get of the slave key as the key will not be created by any other agent due the lock is still being held.
cilium_cilium
train
go
aa2ccf893c1ac62914a72c53d584e5c04c707f2e
diff --git a/tests/Container/ConnectionFactoryTest.php b/tests/Container/ConnectionFactoryTest.php index <HASH>..<HASH> 100644 --- a/tests/Container/ConnectionFactoryTest.php +++ b/tests/Container/ConnectionFactoryTest.php @@ -313,6 +313,10 @@ class ConnectionFactoryTest extends TestCase $this->markTestSkipped('php pcntl extension not loaded'); } + if (! class_exists('PhpAmqpLib\Connection\Heartbeat\PCNTLHeartbeatSender')) { + $this->markTestSkipped('PCNTLHeartbeatSender requires phpamqplib >= 2.12.0'); + } + $container = $this->prophesize(ContainerInterface::class); $heartbeat = 4;
add conditional so we can still test lowest dependencies as is
prolic_HumusAmqp
train
php
3e2124e0bd0859bda515ac84bc397345b60fbfb2
diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index <HASH>..<HASH> 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -1097,10 +1097,9 @@ export default class InternalClient { self.messageAwaits[channel.id + msg.author.id].map( fn => fn(msg) ); self.messageAwaits[channel.id + msg.author.id] = null; client.emit("message", msg, true); //2nd param is isAwaitedMessage - }else{ + } else { client.emit("message", msg); } - self.ack(msg); } else { client.emit("warn", "message created but channel is not cached"); }
Don't acknowledge messages, fixes #<I>
discordjs_discord.js
train
js
b8142cd7d654109e76c7dc8cdc5d8203c552ff33
diff --git a/src/macroresolver.py b/src/macroresolver.py index <HASH>..<HASH> 100644 --- a/src/macroresolver.py +++ b/src/macroresolver.py @@ -122,7 +122,7 @@ class MacroResolver(Borg): if callable(value): return str(value()) else: - return (value) + return str(value) except AttributeError as exp: return str(exp)
* fixed a typo in the last commit
Alignak-monitoring_alignak
train
py
ee04bf303ead8d10bd4ab51cf26d80f85d7323eb
diff --git a/src/Console/Commands/SeedCommand.php b/src/Console/Commands/SeedCommand.php index <HASH>..<HASH> 100644 --- a/src/Console/Commands/SeedCommand.php +++ b/src/Console/Commands/SeedCommand.php @@ -35,6 +35,8 @@ class SeedCommand extends Command */ public function handle() { + $this->warn('Seed cortex/contacts:'); + if ($this->ensureExistingContactsTables()) { // No seed data at the moment! }
Tweak seeder's output
rinvex_cortex-contacts
train
php
e67f24e9dd6b783391654218db345f564bf68c7d
diff --git a/Components/FileManager.php b/Components/FileManager.php index <HASH>..<HASH> 100644 --- a/Components/FileManager.php +++ b/Components/FileManager.php @@ -311,6 +311,11 @@ class FileManager if (is_file($fullpath) ) { Splash::Log()->Deb("MsgFileExists",__FUNCTION__,$file); //====================================================================// + // Check if file is different + if ( $md5 === md5_file ($fullpath) ) { + return True; + } + //====================================================================// // Check if file is writable if (!is_writable($file)) { return Splash::Log()->Err("ErrFileWriteable",__FUNCTION__,$file);
Improve : We don't care of unwritable file if similar => skip writing
SplashSync_Php-Core
train
php
e87f902d30fd3c6e5dfaf996477fbeb5976a9f2b
diff --git a/src/core/graphics/webgl/utils/buildRoundedRectangle.js b/src/core/graphics/webgl/utils/buildRoundedRectangle.js index <HASH>..<HASH> 100644 --- a/src/core/graphics/webgl/utils/buildRoundedRectangle.js +++ b/src/core/graphics/webgl/utils/buildRoundedRectangle.js @@ -76,6 +76,21 @@ export default function buildRoundedRectangle(graphicsData, webGLData) } } +/** + * Calculate a single point for a quadratic bezier curve. + * Utility function used by quadraticBezierCurve. + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + */ +function getPt(n1, n2, perc) +{ + const diff = n2 - n1; + + return n1 + (diff * perc); +} + /** * Calculate the points for a quadratic bezier curve. (helper function..) * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c @@ -105,13 +120,6 @@ function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out = []) let x = 0; let y = 0; - function getPt(n1, n2, perc) - { - const diff = n2 - n1; - - return n1 + (diff * perc); - } - for (let i = 0, j = 0; i <= n; ++i) { j = i / n;
minor optimisation of quadratic bezier curve calculation. (#<I>)
pixijs_pixi.js
train
js
9896a6f90866761161675f83872d15a85e6a52ec
diff --git a/soccer/writers.py b/soccer/writers.py index <HASH>..<HASH> 100644 --- a/soccer/writers.py +++ b/soccer/writers.py @@ -85,7 +85,7 @@ class Stdout(BaseWriter): self.league_header(league) for game in games: self.scores(self.parse_result(game), add_new_line=False) - click.secho(' %s' % self.convert_utc_to_local_time(game["time"]), fg=self.colors.TIME) + click.secho(' %s' % Stdout.convert_utc_to_local_time(game["time"]), fg=self.colors.TIME) click.echo() def team_scores(self, team_scores, time): @@ -212,7 +212,8 @@ class Stdout(BaseWriter): return result - def convert_utc_to_local_time(self, time_str): + @staticmethod + def convert_utc_to_local_time(time_str): """Converts the API UTC time string to the local user time.""" if not time_str.endswith(" UTC"): return time_str
Move utc-to-local function into a static method.
architv_soccer-cli
train
py
ea9d5d2bffc3a0285d2bf78b699c43e60140abc2
diff --git a/lib/rubycritic/core/analysed_file.rb b/lib/rubycritic/core/analysed_file.rb index <HASH>..<HASH> 100644 --- a/lib/rubycritic/core/analysed_file.rb +++ b/lib/rubycritic/core/analysed_file.rb @@ -31,9 +31,11 @@ module Rubycritic end def complexity_per_method - complexity.fdiv(methods_count).round(1) - rescue ZeroDivisionError - "N/A" + if methods_count == 0 + "N/A" + else + complexity.fdiv(methods_count).round(1) + end end def has_smells?
Fix dividing by zero (Never thought I'd ever write this aha)
whitesmith_rubycritic
train
rb
13a0fddb0420d4aed0c38067d5030f2635600ae5
diff --git a/prettyprinter/extras/django.py b/prettyprinter/extras/django.py index <HASH>..<HASH> 100644 --- a/prettyprinter/extras/django.py +++ b/prettyprinter/extras/django.py @@ -213,7 +213,7 @@ def pretty_queryset(queryset, ctx): else: truncated = False - element_ctx = ctx.set(ModelVerbosity, ModelVerbosity.SHORT) + element_ctx = ctx.assoc(ModelVerbosity, ModelVerbosity.SHORT) return pretty_call( element_ctx,
Use assoc instead of set in Django definitions
tommikaikkonen_prettyprinter
train
py
d572730aa1ecc8804f6ae31ca362586ca73137cf
diff --git a/src/codegeneration/BlockBindingTransformer.js b/src/codegeneration/BlockBindingTransformer.js index <HASH>..<HASH> 100644 --- a/src/codegeneration/BlockBindingTransformer.js +++ b/src/codegeneration/BlockBindingTransformer.js @@ -686,8 +686,7 @@ traceur.define('codegeneration', function() { /** * Transforms the variable statement. Inside a block const and let * are transformed into block-scoped variables. - * Outside of the block, const stays the same, let becomes regular - * variable. + * Outside of the block, const and let becomes regular variables. * @param {VariableStatement} tree * @return {ParseTree} */ @@ -796,9 +795,9 @@ traceur.define('codegeneration', function() { } // Package up in the declaration list. - if (transformed != null || tree.declarationType == TokenType.LET) { + if (transformed != null || tree.declarationType != TokenType.VAR) { var declarations = transformed != null ? transformed : tree.declarations; - var declarationType = tree.declarationType == TokenType.LET ? + var declarationType = tree.declarationType != TokenType.VAR ? TokenType.VAR : tree.declarationType;
Transform const to var outside blocks BUG= TEST= Review URL: <URL>
google_traceur-compiler
train
js
d06a7bd6f5ff04a16f84780a611ec46bb68a16fc
diff --git a/platform/nativescript/runtime/components/frame.js b/platform/nativescript/runtime/components/frame.js index <HASH>..<HASH> 100644 --- a/platform/nativescript/runtime/components/frame.js +++ b/platform/nativescript/runtime/components/frame.js @@ -22,6 +22,16 @@ export default { required: false, default: null }, + clearHistory: { + type: Boolean, + required: false, + default: false + }, + backstackVisible: { + type: Boolean, + required: false, + default: true + }, // injected by the template compiler hasRouterView: { default: false @@ -88,6 +98,8 @@ export default { notifyPageMounted(pageVm) { let options = { + backstackVisible: this.backstackVisible, + clearHistory: this.clearHistory, create: () => pageVm.$el.nativeView }
feat(frame): allow setting clearHistory and backstackVisible options for default pages. (#<I>)
nativescript-vue_nativescript-vue
train
js
f2413e78f4880bcade567a9859fe203805c42230
diff --git a/bokeh/server/views/main.py b/bokeh/server/views/main.py index <HASH>..<HASH> 100644 --- a/bokeh/server/views/main.py +++ b/bokeh/server/views/main.py @@ -213,7 +213,7 @@ def make_plot(): from bokeh.objects import ( Plot, DataRange1d, LinearAxis, - ColumnDataSource, GlyphRenderer, + ColumnDataSource, Glyph, PanTool, PreviewSaveTool) from bokeh.glyphs import Circle @@ -233,7 +233,7 @@ def make_plot(): circle = Circle(x="x", y="y", fill="red", radius=5, line_color="black") - glyph_renderer = GlyphRenderer( + glyph_renderer = Glyph( data_source = source, xdata_range = xdr, ydata_range = ydr,
GlyphRenderer -> Glyhp rename
bokeh_bokeh
train
py
1c4c38d924b0f5f933ea6823ad545f0f3d0729b8
diff --git a/client/js/util.js b/client/js/util.js index <HASH>..<HASH> 100644 --- a/client/js/util.js +++ b/client/js/util.js @@ -416,6 +416,10 @@ qq.android = function(){ "use strict"; return navigator.userAgent.toLowerCase().indexOf('android') !== -1; }; +qq.ios7 = function() { + "use strict"; + return qq.ios() && navigator.userAgent.indexOf(" OS 7_") !== -1; +}; qq.ios = function() { "use strict"; return navigator.userAgent.indexOf("iPad") !== -1
fix(client/js/util.js): #<I>, closes #<I> - provide a workaround for the MOV file size bug in iOS7
FineUploader_fine-uploader
train
js
d5af20f4175cf2e49320cae91bde7332a33bf147
diff --git a/estnltk/layer/layer.py b/estnltk/layer/layer.py index <HASH>..<HASH> 100644 --- a/estnltk/layer/layer.py +++ b/estnltk/layer/layer.py @@ -59,6 +59,9 @@ class Layer: as database serialisation does not work for other types. See [estnltk.storage.postgres] for further documentation. """ + __slots__ = ['default_values', 'attributes', 'name', 'parent', '_base', 'enveloping', '_span_list', 'ambiguous', + 'text_object', 'meta', '_is_frozen', '_bound'] + def __init__(self, name: str, attributes: Sequence[str] = (), @@ -371,8 +374,6 @@ class Layer: def __getattr__(self, item): if item in {'_ipython_canary_method_should_not_exist_', '__getstate__', '__setstate__'}: raise AttributeError - if item in self.__getattribute__('__dict__'): - return self.__getattribute__('__dict__')[item] if item in self.__getattribute__('attributes'): return self.__getitem__(item)
added __slots__ for Layer (to be shortened in the future)
estnltk_estnltk
train
py
ffbb2c1ad7de3f9255c4daf306135208a038e249
diff --git a/examples/server/generator.js b/examples/server/generator.js index <HASH>..<HASH> 100644 --- a/examples/server/generator.js +++ b/examples/server/generator.js @@ -384,7 +384,7 @@ var Generator = { //setInterval(randomActivity, 10000); }, - listen: function (handler) { + listen: function () { //listener = handler; } }; diff --git a/examples/server/server.js b/examples/server/server.js index <HASH>..<HASH> 100644 --- a/examples/server/server.js +++ b/examples/server/server.js @@ -30,7 +30,7 @@ router.get('/', function (req, res) { res.redirect('/docs'); }); -app.use('/tour/', function (req, res, next) { +app.use('/tour/', function (req, res) { res.redirect('/medium-app'); });
Removing used vars from the code.
grommet_grommet
train
js,js
e1c5c964cbeec3ba546cb872a128c5c80546be1b
diff --git a/system_tests/language.py b/system_tests/language.py index <HASH>..<HASH> 100644 --- a/system_tests/language.py +++ b/system_tests/language.py @@ -115,3 +115,10 @@ class TestLanguage(unittest.TestCase): document = Config.CLIENT.document_from_url(gcs_url) entities = document.analyze_entities() self._check_analyze_entities_result(entities) + + def test_analyze_sentiment(self): + positive_msg = 'Jogging is fun' + document = Config.CLIENT.document_from_text(positive_msg) + sentiment = document.analyze_sentiment() + self.assertEqual(sentiment.polarity, 1) + self.assertTrue(0.5 < sentiment.magnitude < 1.5)
Adding system test for analyze_sentiment() in language.
googleapis_google-cloud-python
train
py
659ac44917bc0b964f3b4bdef93076bb5ca0a505
diff --git a/src/test/java/org/javamoney/moneta/PerformanceTest.java b/src/test/java/org/javamoney/moneta/PerformanceTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/javamoney/moneta/PerformanceTest.java +++ b/src/test/java/org/javamoney/moneta/PerformanceTest.java @@ -98,7 +98,7 @@ public class PerformanceTest { b.setLength(0); Money money1 = Money.of(BigDecimal.ONE,EURO); long start = System.currentTimeMillis(); - final int NUM = 100000; + final int NUM = 10000; MonetaryAmount adding = Money.of( 1234567.3444,EURO); MonetaryAmount subtracting = Money.of( 232323,EURO); for (int i = 0; i < NUM; i++) {
Reduced loop size of test by factor <I>.
JavaMoney_jsr354-ri-bp
train
java
3d706fd22448d7bdc9ec52780a6c791b39ec05db
diff --git a/lib/analyzeMultipleSites.js b/lib/analyzeMultipleSites.js index <HASH>..<HASH> 100644 --- a/lib/analyzeMultipleSites.js +++ b/lib/analyzeMultipleSites.js @@ -96,6 +96,7 @@ AnalyzeMultipleSites.prototype._setupConfigurationForSite = function(args, cb) { var urls = data.toString().split(EOL).filter(function(l) { return l.length > 0; }); + config.urls = urls; config.url = urls[0]; config.urlObject = urlParser.parse(urls[0]); }
fix for fetching site urls from file
sitespeedio_sitespeed.io
train
js
e732e90a1e256f98df1a918d039afd8f5c1d8c9b
diff --git a/lib/middleware/pre_fetch.js b/lib/middleware/pre_fetch.js index <HASH>..<HASH> 100644 --- a/lib/middleware/pre_fetch.js +++ b/lib/middleware/pre_fetch.js @@ -36,6 +36,8 @@ function createRemoteReadStream(request, urlPath) { URL = url.resolve(server, urlPath), protocol = protocolOf(options.server); + if (options.verbose.remote || options.verbose['local:error']) console.log(URL); + var opt = url.parse(URL); opt.headers = request.headers; delete opt.headers['accept-encoding']; @@ -68,8 +70,11 @@ function readFromStream(options, request, fileName, urlPath) { .then( () => createRemoteReadStream(request, urlPath) - .catch((err) => options.verbose.proxy ? console.error(urlPath, err) : ''), - (localFile) => fs.createReadStream(localFile) + .catch((err) => options.verbose.remote ? console.error(urlPath, err) : ''), + function (localFile) { + if (options.verbose.local) console.log(localFile); + return fs.createReadStream(localFile); + } ) ]); }
add more logging according to README documentation
Open-Xchange-Frontend_appserver
train
js
dca8afa333f47dcdaf44162d66a0ac18f9ea126b
diff --git a/js/tooltip.js b/js/tooltip.js index <HASH>..<HASH> 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -281,11 +281,11 @@ var $tip = this.tip() var e = $.Event('hide.bs.' + this.type) - this.$element.removeAttr('aria-describedby') - function complete() { if (that.hoverState != 'in') $tip.detach() - that.$element.trigger('hidden.bs.' + that.type) + that.$element + .removeAttr('aria-describedby') + .trigger('hidden.bs.' + that.type) } this.$element.trigger(e)
Remove `aria-describedby` attribute later Fixes #<I>
twbs_bootstrap
train
js
1c73d2f911877fbbd26db9f43e3c4a87c5fed0f6
diff --git a/bambou/nurest_object.py b/bambou/nurest_object.py index <HASH>..<HASH> 100644 --- a/bambou/nurest_object.py +++ b/bambou/nurest_object.py @@ -771,7 +771,7 @@ class NURESTObject(object): request = NURESTRequest(method=HTTP_METHOD_GET, url=self.get_resource_url()) if async: - return self.send_request(request=request, async=async, local_callback=self._did_fetch, remote_callback=callback) + return self.send_request(request=request, async=async, local_callback=self._did_retrieve, remote_callback=callback) else: connection = self.send_request(request=request) return self._did_retrieve(connection)
Fixed missing _did_fetch method
nuagenetworks_bambou
train
py
6eb552781d6dc91155f697ad895f4ee0245312fc
diff --git a/openquake/calculators/hazard/classical/core.py b/openquake/calculators/hazard/classical/core.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/hazard/classical/core.py +++ b/openquake/calculators/hazard/classical/core.py @@ -240,7 +240,6 @@ class ClassicalHazardCalculator(haz_general.BaseHazardCalculatorNext): #: The core calculation Celery task function, which accepts the arguments #: generated by :func:`task_arg_gen`. core_calc_task = hazard_curves - task_arg_gen = classical_task_arg_gen def initialize_hazard_curve_progress(self, lt_rlz): """
calcs/hazard/classical/core: Missed one line.
gem_oq-engine
train
py
321c3f9e25d84604be0fa84ff8430e0373090279
diff --git a/lib/ttb-cache.js b/lib/ttb-cache.js index <HASH>..<HASH> 100644 --- a/lib/ttb-cache.js +++ b/lib/ttb-cache.js @@ -49,8 +49,11 @@ function getModuleVersionFromConfig(cfg) { // This check is specific to the Cordova module if (tu.fileExistsSync(path.join(cfg.projectPath, 'taco.json'))) { var version = require(path.join(cfg.projectPath, 'taco.json'))['cordova-cli']; - console.log('Cordova version set to ' + version + ' based on the contents of taco.json'); - return version; + + if (version) { + console.log('Cordova version set to ' + version + ' based on the contents of taco.json'); + return version; + } } }
Fix taco.json version handling Prior to this change, if taco.json did not contain a 'cordova-cli' entry, then we would default to edge. We now default to edge unless the user has configured the CORDOVA_DEFAULT_VERSION environment variable, which will be used if available.
Microsoft_taco-team-build
train
js
c77676ec85d4394de15ac44002a5b5b211b6dc9b
diff --git a/bcbio/bam/trim.py b/bcbio/bam/trim.py index <HASH>..<HASH> 100644 --- a/bcbio/bam/trim.py +++ b/bcbio/bam/trim.py @@ -51,7 +51,7 @@ def _cutadapt_trim(fastq_files, quality_format, adapters, out_files, config): do.run(cmd.format(**locals()), message) else: with file_transaction(config, out_files) as tx_out_files: - of1_tx, of2_tx = out_files + of1_tx, of2_tx = tx_out_files tmp_fq1 = append_stem(of1_tx, ".tmp") tmp_fq2 = append_stem(of2_tx, ".tmp") singles_file = of1_tx + ".single"
use trasanction files for trimming steps
bcbio_bcbio-nextgen
train
py
7e498de0e275c770d56de7c41c628cbffcb3c8cc
diff --git a/pyperform/timer.py b/pyperform/timer.py index <HASH>..<HASH> 100644 --- a/pyperform/timer.py +++ b/pyperform/timer.py @@ -4,16 +4,23 @@ from time import time from .tools import convert_time_units -timer_format = "{name}: {time}" +timer_format = "{name}: recent: {recent_time} average: {avg_time}" + def timer(func): def _timed_function(*args, **kwargs): t1 = time() result = func(*args, **kwargs) t2 = time() - print(timer_format.format(name=func.__name__, time=convert_time_units(t2-t1))) + delta = t2-t1 + _timed_function._total_time += delta + _timed_function._call_count += 1 + _timed_function._average_time = convert_time_units(_timed_function._total_time / _timed_function._call_count) + print(timer_format.format(name=func.__name__, recent_time=convert_time_units(delta), avg_time=_timed_function._average_time)) return result + _timed_function._total_time = 0 + _timed_function._call_count = 0 _timed_function.__name__ = "_timed_{}".format(func.__name__) return _timed_function
added calculation of average time to @timer
lobocv_pyperform
train
py
162747fbf6050a970e38d061bf41d51b87e6f9bc
diff --git a/numeric.ly.js b/numeric.ly.js index <HASH>..<HASH> 100644 --- a/numeric.ly.js +++ b/numeric.ly.js @@ -106,7 +106,7 @@ var numeric = { if(Math.abs(left + right - whole) <= 15 * eps){ return left + right + (left + right - whole) / 15; }else{ - return simpsonRecursive(func, a, c, eps/2, left) + simpsonRecursive(f, c, b, eps/2, right); + return simpsonRecursive(func, a, c, eps/2, left) + simpsonRecursive(func, c, b, eps/2, right); } }, //execute this @@ -191,12 +191,13 @@ var numeric = { //transpose array transpose: function(arr){ var result = new Array(arr[0].length); - for (var i = 0; i < arr.length; i++) { - arr[i] = new Array(arr.length); - for(var j = 0 ; j < arr[i].length){ - arr[j][i] = arr[i][j]; + for (var i = 0; i < arr[0].length; i++) { + result[i] = new Array(arr.length); + for(var j = 0; j < arr.length; j++){ + result[i][j] = arr[j][i]; } } + return result; }, //return identity matrix of dimension n x n
Fix transpose, simpsonRecursive Transpose wasn't returning anything and was overwriting the data as it attempted to move it. My new implementation probably isn't that fast, but it works. SimpsonRecursive, I think, just had a typo.
numbers_numbers.js
train
js
cfb8028647b9bc03ed30d17d679d5100abfcb167
diff --git a/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb b/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb index <HASH>..<HASH> 100644 --- a/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +++ b/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb @@ -75,7 +75,7 @@ module Fog xml.Protocol service_profile[:Protocol] xml.Port service_profile[:Port] xml.Persistence { - xml.Method service_profile[:Persistence][:method] + xml.Method service_profile[:Persistence][:Method] if service_profile[:Persistence][:Method] == 'COOKIE' xml.CookieName service_profile[:Persistence][:CookieName] xml.CookieMode service_profile[:Persistence][:CookieMode]
[vcloud_director] fix typo as per #<I>
fog_fog
train
rb
644794512e2ac44d8c701ee060978831e4520e23
diff --git a/src/Services/MediaManager.php b/src/Services/MediaManager.php index <HASH>..<HASH> 100644 --- a/src/Services/MediaManager.php +++ b/src/Services/MediaManager.php @@ -212,7 +212,8 @@ class MediaManager implements FileUploaderInterface, FileMoverInterface } /** - * Return the last modified time. + * Return the last modified time. If a timestamp can not be found fall back + * to today's date and time... * * @param $path * @@ -220,7 +221,12 @@ class MediaManager implements FileUploaderInterface, FileMoverInterface */ public function fileModified($path) { - return Carbon::createFromTimestamp($this->disk->lastModified($path)); + try { + return Carbon::createFromTimestamp($this->disk->lastModified($path)); + }catch (\Exception $e) + { + return Carbon::now(); + } } /**
Fallback to today for filesystems that dont give a timestamp value eg dropbox
talvbansal_media-manager
train
php
9bf60f26b45577de80e5ba7652f52e9238640795
diff --git a/detox/src/index.js b/detox/src/index.js index <HASH>..<HASH> 100644 --- a/detox/src/index.js +++ b/detox/src/index.js @@ -6,7 +6,7 @@ const argparse = require('./utils/argparse'); const InvocationManager = require('./invoke').InvocationManager; const configuration = require('./configuration'); -log.level = loglevel = argparse.getArgValue('loglevel') || 'info'; +log.level = argparse.getArgValue('loglevel') || 'info'; log.heading = 'detox'; let websocket;
fix: ReferenceError: loglevel is not defined
wix_Detox
train
js
9b6e6f6f560d525af2ab7072e589597f60e65632
diff --git a/src/Ems/Testing/LoggingCallable.php b/src/Ems/Testing/LoggingCallable.php index <HASH>..<HASH> 100644 --- a/src/Ems/Testing/LoggingCallable.php +++ b/src/Ems/Testing/LoggingCallable.php @@ -18,6 +18,21 @@ class LoggingCallable implements Countable protected $calls = []; /** + * @var callable + **/ + protected $handler; + + /** + * Optionally pass a callable to process the actual call + * + * @param callable $handler (optional) + **/ + public function __construct(callable $handler=null) + { + $this->handler = $handler; + } + + /** * The fake callable * * @return void @@ -25,6 +40,9 @@ class LoggingCallable implements Countable public function __invoke() { $this->calls[] = func_get_args(); + if ($this->handler) { + return call_user_func_array($this->handler, func_get_args()); + } } /** @@ -63,4 +81,4 @@ class LoggingCallable implements Countable { return count($this->calls); } -} \ No newline at end of file +}
Allow a custom handler in LoggingCallable
mtils_php-ems
train
php
b7fd8c3f93a8d645fde10fd6786cb5892d34f414
diff --git a/Controller/SecurityFOSUser1Controller.php b/Controller/SecurityFOSUser1Controller.php index <HASH>..<HASH> 100644 --- a/Controller/SecurityFOSUser1Controller.php +++ b/Controller/SecurityFOSUser1Controller.php @@ -28,9 +28,9 @@ class SecurityFOSUser1Controller extends SecurityController */ public function loginAction() { - $user = $this->container->get('security.context')->getToken()->getUser(); + $token = $this->container->get('security.context')->getToken(); - if ($user instanceof UserInterface) { + if ($token && $token->getUser() instanceof UserInterface) { $this->container->get('session')->getFlashBag()->set('sonata_user_error', 'sonata_user_already_authenticated'); $url = $this->container->get('router')->generate('sonata_user_profile_show');
Security token can be null in login form on <I>
sonata-project_SonataUserBundle
train
php
1d63b09951176b0236c48eef6b34063658980f33
diff --git a/restcomm/restcomm.rvd/src/main/java/org/mobicents/servlet/restcomm/rvd/interpreter/Interpreter.java b/restcomm/restcomm.rvd/src/main/java/org/mobicents/servlet/restcomm/rvd/interpreter/Interpreter.java index <HASH>..<HASH> 100644 --- a/restcomm/restcomm.rvd/src/main/java/org/mobicents/servlet/restcomm/rvd/interpreter/Interpreter.java +++ b/restcomm/restcomm.rvd/src/main/java/org/mobicents/servlet/restcomm/rvd/interpreter/Interpreter.java @@ -330,13 +330,13 @@ public class Interpreter { } if ( esStep.getDoRouting() ) { - String nextLabel = ""; + String next = ""; if ( "fixed".equals( esStep.getNextType() ) ) - nextLabel = esStep.getNext(); + next = esStep.getNext(); else if ( "variable".equals( esStep.getNextType() )) - nextLabel = variables.get( esStep.getNextVariable() ); - return getNodeNameByLabel(nextLabel); + next = getNodeNameByLabel( variables.get( esStep.getNextVariable() ) ); + return next; } } return null;
RESTCOMM-<I> #Resolve-Issue Fixed #time 1h #comment made 'fixed' option rely on module name instead of the label
RestComm_Restcomm-Connect
train
java
fdae350e68f33b28aef7bc466034f6cce32e1814
diff --git a/vagrant_box_defaults.rb b/vagrant_box_defaults.rb index <HASH>..<HASH> 100644 --- a/vagrant_box_defaults.rb +++ b/vagrant_box_defaults.rb @@ -3,12 +3,12 @@ Vagrant.require_version ">= 2.2.0" $SERVER_BOX = "cilium/ubuntu-dev" -$SERVER_VERSION= "227" +$SERVER_VERSION= "228" $NETNEXT_SERVER_BOX= "cilium/ubuntu-next" -$NETNEXT_SERVER_VERSION= "145" +$NETNEXT_SERVER_VERSION= "146" @v54_SERVER_BOX= "cilium/ubuntu-5-4" -@v54_SERVER_VERSION= "31" +@v54_SERVER_VERSION= "32" @v419_SERVER_BOX= "cilium/ubuntu-4-19" -@v419_SERVER_VERSION= "65" +@v419_SERVER_VERSION= "66" @v49_SERVER_BOX= "cilium/ubuntu" -@v49_SERVER_VERSION= "227" +@v49_SERVER_VERSION= "228"
vagrant: Bump Vagrant box versions
cilium_cilium
train
rb
71439e7d7a6630d808735d4372c959b7f19ca3a4
diff --git a/vyper/cli/vyper_compile.py b/vyper/cli/vyper_compile.py index <HASH>..<HASH> 100755 --- a/vyper/cli/vyper_compile.py +++ b/vyper/cli/vyper_compile.py @@ -35,7 +35,7 @@ opcodes - List of opcodes as a string opcodes_runtime - List of runtime opcodes as a string ir - Intermediate representation in list format ir_json - Intermediate representation in JSON format -ir-hex - Output IR and assembly constants in hex instead of decimal +hex-ir - Output IR and assembly constants in hex instead of decimal no-optimize - Do not optimize (don't use this for production code) """ @@ -137,7 +137,7 @@ def _parse_args(argv): action="store_true", ) parser.add_argument( - "--ir-hex", + "--hex-ir", action="store_true", ) parser.add_argument( @@ -159,7 +159,7 @@ def _parse_args(argv): # an error occurred in a Vyper source file. sys.tracebacklimit = 0 - if args.ir_hex: + if args.hex_ir: ir_node.AS_HEX_DEFAULT = True output_formats = tuple(uniq(args.format.split(",")))
rename CLI option --ir-hex to --hex-ir (#<I>) it's easier to remember this way
ethereum_vyper
train
py
558c8923df9d82829ad28a1a4a61e401fb9844cf
diff --git a/module_dtleds.go b/module_dtleds.go index <HASH>..<HASH> 100644 --- a/module_dtleds.go +++ b/module_dtleds.go @@ -55,7 +55,7 @@ func (m *DTLEDModule) SetOptions(options map[string]interface{}) error { } // Get a LED to manipulate. 'led' must be 0 to 3. -func (m *DTLEDModule) GetLED(led string) (*DTLEDModuleLED, error) { +func (m *DTLEDModule) GetLED(led string) (LEDModuleLED, error) { led = strings.ToLower(led) if ol := m.leds[led]; ol != nil {
Fix #<I>, GetLED has wrong signature leading to runtime error
mrmorphic_hwio
train
go
5a39892df257baefce5d06b1a136123201c13eb5
diff --git a/tests/models.py b/tests/models.py index <HASH>..<HASH> 100644 --- a/tests/models.py +++ b/tests/models.py @@ -18,3 +18,6 @@ class EmailUser(AbstractBaseUser): def get_username(self): return self.email + + class Meta: + app_label = 'sudo_tests'
Give test model an app_label for Django <I>
mattrobenolt_django-sudo
train
py
9b541b9f33d006550954cc8e562d383a740502a8
diff --git a/doc/source/examples/dierickx_eccentricities.py b/doc/source/examples/dierickx_eccentricities.py index <HASH>..<HASH> 100644 --- a/doc/source/examples/dierickx_eccentricities.py +++ b/doc/source/examples/dierickx_eccentricities.py @@ -1,5 +1,4 @@ import os, os.path -import pexpect import subprocess from astropy.io import fits, ascii from astropy import units diff --git a/tests/test_actionAngle.py b/tests/test_actionAngle.py index <HASH>..<HASH> 100644 --- a/tests/test_actionAngle.py +++ b/tests/test_actionAngle.py @@ -1274,7 +1274,7 @@ def test_estimateDeltaStaeckel_no_median(): #and the individual ones indiv = numpy.array([estimateDeltaStaeckel(MWPotential2014, o.R(ts[i]), o.z(ts[i])) for i in range(10)]) #check that values agree - assert (numpy.fabs(nomed-indiv) < 1e10).all(), 'no_median option returns different values to individual Delta estimation' + assert (numpy.fabs(nomed-indiv) < 1e-10).all(), 'no_median option returns different values to individual Delta estimation' return None def test_actionAngleStaeckel_indivdelta_actions_c():
modifications to tests for estimateDeltaStaeckel and removed import statement from dierickx_eccentricities
jobovy_galpy
train
py,py
026ca2db87b4927d65a3ee0c52a1d0de5f6b207b
diff --git a/lib/flatiron/plugins/resourceful.js b/lib/flatiron/plugins/resourceful.js index <HASH>..<HASH> 100644 --- a/lib/flatiron/plugins/resourceful.js +++ b/lib/flatiron/plugins/resourceful.js @@ -94,6 +94,8 @@ exports.init = function (done) { app.config.get('resourceful') || {} ); + app.config.set('resourceful', options); + // // Remark: Should we accept the autoMigrate option? //
[fix] Set the `resourceful` config value in the app from provided options
flatiron_flatiron
train
js
a4b7c0fe0a384dc1adb9e93a4b2a3b50d2005091
diff --git a/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java b/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java index <HASH>..<HASH> 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java +++ b/core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java @@ -691,6 +691,9 @@ public class ODocument extends ORecordSchemaAwareAbstract<Object> implements Ite if ("@class".equals(iFieldName)) { setClassName(iPropertyValue.toString()); return this; + } else if ("@rid".equals(iFieldName)) { + _recordId.fromString(iPropertyValue.toString()); + return this; } final int lastSep = _allowChainedAccess ? iFieldName.lastIndexOf('.') : -1;
Fixed issue #<I> about batch HTTP
orientechnologies_orientdb
train
java
0a4be6bb14e0eae79e57af46028ae7b7fc363ecb
diff --git a/tests/spec_test.py b/tests/spec_test.py index <HASH>..<HASH> 100644 --- a/tests/spec_test.py +++ b/tests/spec_test.py @@ -19,6 +19,8 @@ builtins_path = '__builtin__' if sys.version_info > (3,): builtins_path = 'builtins' long = int +else: + builtins_path = 'yapconf.spec' original_env = None original_yaml_flag = yapconf.yaml_support diff --git a/yapconf/spec.py b/yapconf/spec.py index <HASH>..<HASH> 100644 --- a/yapconf/spec.py +++ b/yapconf/spec.py @@ -3,6 +3,7 @@ import logging import json import six import os +import sys from box import Box @@ -11,6 +12,9 @@ from yapconf.exceptions import YapconfSpecError, YapconfLoadError, \ YapconfItemNotFound from yapconf.items import from_specification +if sys.version_info.major < 3: + from io import open + class YapconfSpec(object): """Object which holds your configuration's specification.
Importing `open` from io package in Python 2
loganasherjones_yapconf
train
py,py
047b745110ff445ca1bd2caf9b721320cea245f3
diff --git a/packages/webiny-app-cms/src/editor/plugins/defaultBar/components/PublishPageButton.js b/packages/webiny-app-cms/src/editor/plugins/defaultBar/components/PublishPageButton.js index <HASH>..<HASH> 100644 --- a/packages/webiny-app-cms/src/editor/plugins/defaultBar/components/PublishPageButton.js +++ b/packages/webiny-app-cms/src/editor/plugins/defaultBar/components/PublishPageButton.js @@ -46,7 +46,7 @@ const PublishPageButton = ({ page, showSnackbar, router }) => { }); }} > - Publish + {page.version > 1 ? "Publish changes" : "Publish"} </ButtonPrimary> )} </Mutation>
fix: show "publish changes" instead of just "publish" when editing a new revision (#<I>)
Webiny_webiny-js
train
js
510411d9b6d35ce60d9786028f41795e23ce2065
diff --git a/djcelery/utils.py b/djcelery/utils.py index <HASH>..<HASH> 100644 --- a/djcelery/utils.py +++ b/djcelery/utils.py @@ -7,7 +7,7 @@ from datetime import datetime from django.conf import settings # Database-related exceptions. -from django.db.utils import DatabaseError +from django.db import DatabaseError try: import MySQLdb as mysql _my_database_errors = (mysql.DatabaseError, )
Fixes compatibility with Django < <I>
celery_django-celery
train
py
6ee3a0d7b01cb64802b5a3ae6457080a7732bb89
diff --git a/metal/end_model/loss.py b/metal/end_model/loss.py index <HASH>..<HASH> 100644 --- a/metal/end_model/loss.py +++ b/metal/end_model/loss.py @@ -20,10 +20,9 @@ class SoftCrossEntropyLoss(nn.Module): def __init__(self, weight=None, reduction="elementwise_mean"): super().__init__() - self.weight = weight - if self.weight is not None: - self.weight = torch.Tensor(self.weight) - assert self.weight is None or isinstance(self.weight, torch.FloatTensor) + self.weight = None + if weight is not None: + self.weight = torch.FloatTensor(weight) self.reduction = reduction def forward(self, input, target):
Remove unnecessary assert and convert weight to FloatTensor
HazyResearch_metal
train
py
4cd17b94e5007a2e92cf243c1d1c9d845d20d254
diff --git a/dask_kubernetes/core.py b/dask_kubernetes/core.py index <HASH>..<HASH> 100644 --- a/dask_kubernetes/core.py +++ b/dask_kubernetes/core.py @@ -87,8 +87,8 @@ class Pod(ProcessInterface): raise e async def close(self, **kwargs): - name, namespace = self._pod.metadata.name, self.namespace if self._pod: + name, namespace = self._pod.metadata.name, self.namespace try: await self.core_api.delete_namespaced_pod(name, namespace) except ApiException as e:
ensure Pod.close() succeeds when pod has already been removed (#<I>)
dask_dask-kubernetes
train
py
9e2f335999ae1e8fdbf43fbab8013b9e6621cb5c
diff --git a/Tests/Controller/WikiControllerTest.php b/Tests/Controller/WikiControllerTest.php index <HASH>..<HASH> 100644 --- a/Tests/Controller/WikiControllerTest.php +++ b/Tests/Controller/WikiControllerTest.php @@ -46,6 +46,13 @@ final class WikiControllerTest extends AbstractBootstrapWebTestCase { $client->request("GET", $url); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } + + // Create a client. + $client = static::createClient(); + + // Make a GET request. + $client->request("GET", "/wiki/category/package/page"); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); } }
Add a test for a unknown Wiki page
webeweb_bootstrap-bundle
train
php
5a3c551f2af02fabfd52635457615a1c73662be7
diff --git a/cli/cumulusci.py b/cli/cumulusci.py index <HASH>..<HASH> 100644 --- a/cli/cumulusci.py +++ b/cli/cumulusci.py @@ -316,6 +316,7 @@ def beta_deploy(config, tag, commit, run_tests, retries): raise e if error.find('Error: Invalid Package, Details: This package is not yet available') == -1 and error.find('Error: InstalledPackage version number : %s does not exist!' % package_version) == -1: + click.echo("Not retrying because no log lines were found to trigger a retry") raise e click.echo("Retrying installation of %s due to package unavailable error. Sleeping for 1 minute before retrying installation. %s retries remain" % (package_version, retries - 1))
Add better output to show what is happening with beta_deploy retries
SFDO-Tooling_CumulusCI
train
py
4b6213eb7f5cbe6fcaa3af9c2df077fc6e34bff4
diff --git a/astrobase/varclass/recoverysim.py b/astrobase/varclass/recoverysim.py index <HASH>..<HASH> 100644 --- a/astrobase/varclass/recoverysim.py +++ b/astrobase/varclass/recoverysim.py @@ -884,7 +884,7 @@ def make_fakelc_collection(lclist, with open(dboutfname, 'wb') as outfd: pickle.dump(fakedb, outfd) - LOGINFO('wrote %s fake LCs to: %s' % simbasedir) + LOGINFO('wrote %s fake LCs to: %s' % (len(fakeresults), simbasedir)) LOGINFO('fake LC info written to: %s' % dboutfname) return dboutfname
[WIP] working on recoverysim
waqasbhatti_astrobase
train
py
0fd00b861c6e75df0ed0c60e4906a0c801ff78f7
diff --git a/packages/core/src/Core/Model/Response/CdrResponse.php b/packages/core/src/Core/Model/Response/CdrResponse.php index <HASH>..<HASH> 100644 --- a/packages/core/src/Core/Model/Response/CdrResponse.php +++ b/packages/core/src/Core/Model/Response/CdrResponse.php @@ -34,6 +34,16 @@ class CdrResponse protected $notes; /** + * @return bool + */ + public function isAccepted() + { + $code = intval($this->getCode()); + + return $code === 0 && $code >= 4000; + } + + /** * @return string */ public function getId()
add is accepted, close giansalex/greenter#<I>
giansalex_greenter
train
php
b382d17e3495b1a36d6045af80b22713279e6d2a
diff --git a/pkg/services/sqlstore/migrator/mysql_dialect.go b/pkg/services/sqlstore/migrator/mysql_dialect.go index <HASH>..<HASH> 100644 --- a/pkg/services/sqlstore/migrator/mysql_dialect.go +++ b/pkg/services/sqlstore/migrator/mysql_dialect.go @@ -30,7 +30,10 @@ func (db *Mysql) AutoIncrStr() string { } func (db *Mysql) BooleanStr(value bool) string { - return strconv.FormatBool(value) + if value { + return "1" + } + return "0" } func (db *Mysql) SqlType(c *Column) string {
Fixed alerting bug for mysql (#<I>)
grafana_grafana
train
go
e9189ec3d499b4ddd0bc5cb343e42e23af9dad19
diff --git a/api-spec-testing/rspec_matchers.rb b/api-spec-testing/rspec_matchers.rb index <HASH>..<HASH> 100644 --- a/api-spec-testing/rspec_matchers.rb +++ b/api-spec-testing/rspec_matchers.rb @@ -227,8 +227,12 @@ RSpec::Matchers.define :match_response do |pairs, test| def compare_string(expected, actual_value, test, response) # When you must match a regex. For example: # match: {task: '/.+:\d+/'} - if expected[0] == "/" && expected[-1] == "/" - /#{expected.tr("/", "")}/ =~ actual_value + if expected[0] == '/' && expected[-1] == '/' + parsed = expected + expected.scan(/\$\{([a-z_0-9]+)\}/) do |match| + parsed = parsed.gsub(/\$\{?#{match.first}\}?/, test.cached_values[match.first]) + end + /#{parsed.tr("/", "")}/ =~ actual_value elsif !!(expected.match?(/[0-9]{1}\.[0-9]+E[0-9]+/)) # When the value in the yaml test is a big number, the format is # different from what Ruby uses, so we transform X.XXXXEXX to X.XXXXXe+XX
Test Runner: Modify rspec_matcher to parse more than one regex in expected values
elastic_elasticsearch-ruby
train
rb
5b311f9b63d3f04d8873034b295c9304b9aa638d
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,6 @@ var parsers = require('./parsers') var url = require('url') -const CONTENT_TYPE_PARSERS = { - 'application/json': parsers.json, - 'text/plain': parsers.text, - 'application/octet-stream': parsers.raw -} - const CONTENT_TYPE_MAP = { 'object': 'application/json', 'string': 'text/plain' @@ -55,8 +49,12 @@ function request (http, options, callback) { callback(null, result) } - var parser = CONTENT_TYPE_PARSERS[response.headers['content-type']] - if (parser) return parser(response, length, fin) + var contentType = response.headers['content-type'] + if (contentType) { + if (/application\/json/.test(contentType)) return parsers.json(response, length, fin) + if (/text\/plain/.test(contentType)) return parsers.json(response, length, fin) + if (/application\/octet-stream/.test(contentType)) return parsers.json(response, length, fin) + } fin() })
use regex for content-types
dcousens_dhttp
train
js
679bb716d577d27d67d8b85fcea4915b9ca2eaaf
diff --git a/resource_aws_efs_file_system_test.go b/resource_aws_efs_file_system_test.go index <HASH>..<HASH> 100644 --- a/resource_aws_efs_file_system_test.go +++ b/resource_aws_efs_file_system_test.go @@ -317,7 +317,6 @@ resource "aws_efs_file_system" "foo" { func testAccAWSEFSFileSystemConfigPagedTags(rInt int) string { return fmt.Sprintf(` resource "aws_efs_file_system" "foo" { - creation_token = "radeksimko" tags { Name = "foo-efs-%d" Another = "tag" @@ -338,7 +337,6 @@ func testAccAWSEFSFileSystemConfigPagedTags(rInt int) string { func testAccAWSEFSFileSystemConfigWithTags(rInt int) string { return fmt.Sprintf(` resource "aws_efs_file_system" "foo-with-tags" { - creation_token = "yada_yada" tags { Name = "foo-efs-%d" Another = "tag"
remove some manual names to allow the automatic random names, avoid some possible conflicts
terraform-providers_terraform-provider-aws
train
go
0b4c3a1a53056b839eef571a24081b5ae97d881c
diff --git a/src/transformers/models/wav2vec2/modeling_wav2vec2.py b/src/transformers/models/wav2vec2/modeling_wav2vec2.py index <HASH>..<HASH> 100755 --- a/src/transformers/models/wav2vec2/modeling_wav2vec2.py +++ b/src/transformers/models/wav2vec2/modeling_wav2vec2.py @@ -1606,6 +1606,7 @@ class Wav2Vec2ForMaskedLM(Wav2Vec2PreTrainedModel): >>> from transformers import Wav2Vec2Processor, Wav2Vec2ForMaskedLM >>> from datasets import load_dataset >>> import soundfile as sf + >>> import torch >>> processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-base-960h") >>> model = Wav2Vec2ForMaskedLM.from_pretrained("facebook/wav2vec2-base-960h")
fix missing import (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
8158ae421ce7f5b019376074e0ccd5337eafc479
diff --git a/lib/glimpse/views/active_record.rb b/lib/glimpse/views/active_record.rb index <HASH>..<HASH> 100644 --- a/lib/glimpse/views/active_record.rb +++ b/lib/glimpse/views/active_record.rb @@ -21,7 +21,7 @@ module Glimpse end def formatted_duration - "%.2f" % (duration * 1000) + "%.2fms" % (duration * 1000) end def results
Add ms after duration for ActiveRecord
peek_peek
train
rb
86a09b8b1f349727cebb36a9be500e8b17b31bf4
diff --git a/src/console/ConsoleLogTarget.php b/src/console/ConsoleLogTarget.php index <HASH>..<HASH> 100644 --- a/src/console/ConsoleLogTarget.php +++ b/src/console/ConsoleLogTarget.php @@ -6,6 +6,7 @@ use hidev\components\Log; use Psr\Log\LogLevel; use yii\helpers\Console; use yii\helpers\VarDumper; +use yii\log\Logger; /** * Class ConsoleLogTarget @@ -31,12 +32,21 @@ class ConsoleLogTarget extends \yii\log\Target LogLevel::CRITICAL => [Console::FG_RED], LogLevel::WARNING => [Console::FG_YELLOW], ]; + + private $convertYiiToPSR = [ + Logger::LEVEL_ERROR => LogLevel::ERROR, + Logger::LEVEL_WARNING => LogLevel::WARNING, + Logger::LEVEL_INFO => LogLevel::INFO, + Logger::LEVEL_TRACE => LogLevel::DEBUG, + ]; public function export() { foreach ($this->messages as $message) { - $this->out($message[0], $message[1]); - $this->outContext($message[0], $message[2]); + $level = $this->convertYiiToPSR[$message[1]] ?? $message[1]; + + $this->out($level, $message[0]); + $this->outContext($level, $message[2]); } }
Convert log levels from Yii to PSR
hiqdev_hiapi
train
php
71d0c39ef96167a3078497a5bfc4701b03542d0d
diff --git a/builder/vmware/common/driver_fusion6.go b/builder/vmware/common/driver_fusion6.go index <HASH>..<HASH> 100644 --- a/builder/vmware/common/driver_fusion6.go +++ b/builder/vmware/common/driver_fusion6.go @@ -22,6 +22,12 @@ func (d *Fusion6Driver) Clone(dst, src string) error { "clone", src, dst, "full") if _, _, err := runAndLog(cmd); err != nil { + if strings.Contains(err.Error(), "parameters was invalid") { + return fmt.Errorf( + "Clone is not supported with your version of Fusion. Packer " + + "only works with Fusion 6 Professional. Please verify your version.") + } + return err }
builder/vmware: better error if clone not supported [GH-<I>]
hashicorp_packer
train
go
e31d9830f6e2ee62d230d0e628970d98ce0c072e
diff --git a/lib/chef/resource/homebrew_tap.rb b/lib/chef/resource/homebrew_tap.rb index <HASH>..<HASH> 100644 --- a/lib/chef/resource/homebrew_tap.rb +++ b/lib/chef/resource/homebrew_tap.rb @@ -48,7 +48,7 @@ class Chef description: "The path to the Homebrew binary.", default: "/usr/local/bin/brew" - property :owner, [String, Integer], + property :owner, String, description: "The owner of the Homebrew installation.", default: lazy { find_homebrew_username }
Revert homebrew_tap to using String for owner It's using owner in an env variable and I'm not sure if that will actually work. We should stick with a string here.
chef_chef
train
rb
5223586abf36790a4f109a11d1351b9ddd4e9f9e
diff --git a/git/githistory/log/log.go b/git/githistory/log/log.go index <HASH>..<HASH> 100644 --- a/git/githistory/log/log.go +++ b/git/githistory/log/log.go @@ -185,11 +185,7 @@ func (l *Logger) consume() { func (l *Logger) logTask(task Task) { defer l.wg.Done() - var logAll bool - if durable, ok := task.(DurableTask); ok { - logAll = durable.Durable() - } - + logAll := task.Durable() var last time.Time var msg string diff --git a/git/githistory/log/task.go b/git/githistory/log/task.go index <HASH>..<HASH> 100644 --- a/git/githistory/log/task.go +++ b/git/githistory/log/task.go @@ -6,12 +6,6 @@ type Task interface { // of the Task when an update is present. It is closed when the task is // complete. Updates() <-chan string -} - -// DurableTask is a Task sub-interface which ensures that all activity is -// logged by disabling throttling behavior in the logger. -type DurableTask interface { - Task // Durable returns whether or not this task should be treated as // Durable.
git/githistory/log: collapse DurableTask interface into Task
git-lfs_git-lfs
train
go,go
1152f8ea08b7f5a3024115557e6530548674b351
diff --git a/salt/modules/wordpress.py b/salt/modules/wordpress.py index <HASH>..<HASH> 100644 --- a/salt/modules/wordpress.py +++ b/salt/modules/wordpress.py @@ -10,8 +10,8 @@ from __future__ import absolute_import import collections # Import Salt Modules -from salt.ext.six.moves import map import salt.utils.path +from salt.ext.six.moves import map Plugin = collections.namedtuple('Plugin', 'name status update versino')
Update reference to old salt.utils.which function
saltstack_salt
train
py
83048f10cad15265135b7a2c69775dca18046174
diff --git a/rocketchat_API/rocketchat.py b/rocketchat_API/rocketchat.py index <HASH>..<HASH> 100644 --- a/rocketchat_API/rocketchat.py +++ b/rocketchat_API/rocketchat.py @@ -609,6 +609,10 @@ class RocketChat: """Removes the direct message from the user’s list of direct messages.""" return self.__call_api_post('im.close', roomId=room_id, kwargs=kwargs) + def im_messages(self, username, **kwargs): + """Retrieves direct messages from the server by username""" + return self.__call_api_get('im.messages', username=username, args=kwargs) + def im_messages_others(self, room_id, **kwargs): """Retrieves the messages from any direct message in the server""" return self.__call_api_get('im.messages.others', roomId=room_id, kwargs=kwargs)
Added method to retrieve DMs by username.
jadolg_rocketchat_API
train
py
64d022dbda311df87e489222a9310249afae4f43
diff --git a/src/goals/ReadmeGoal.php b/src/goals/ReadmeGoal.php index <HASH>..<HASH> 100644 --- a/src/goals/ReadmeGoal.php +++ b/src/goals/ReadmeGoal.php @@ -42,6 +42,10 @@ class ReadmeGoal extends TemplateGoal public function renderBadges() { + $c = $this->config->get('composer.json'); + if (!$c->has('require') && !$c->has('require-dev')) { + unset($this->badges['versioneye.status']); + } $res = ''; foreach ($this->badges as $badge) { $res .= $this->renderBadge($badge) . "\n";
fixed versioneye badge: don't show when no dependencies
hiqdev_hidev
train
php
1cd9e90171d0b61bc784847fdf43738b3d416f01
diff --git a/src/widgets/editor/editor.js b/src/widgets/editor/editor.js index <HASH>..<HASH> 100644 --- a/src/widgets/editor/editor.js +++ b/src/widgets/editor/editor.js @@ -5,7 +5,7 @@ * Copyright (c) 2015-2017 Fabio Spampinato * Licensed under MIT (https://github.com/svelto/svelto/blob/master/LICENSE) * ========================================================================= - * @require ./vendor/marked.js + * @before ./vendor/marked.js * @require core/widget/widget.js * ========================================================================= */ @@ -25,7 +25,7 @@ plugin: true, selector: '.editor', options: { - parser: window.marked, + parser: window.marked || _.identity, actions: { bold () { this._action ( '**', '**', 'bold' );
Editor: avoid errors if the parser has not been loaded
svelto_svelto
train
js
18f419ef723fb30957e2e68e15a1e795d4943976
diff --git a/project_generator/yaml_parser.py b/project_generator/yaml_parser.py index <HASH>..<HASH> 100644 --- a/project_generator/yaml_parser.py +++ b/project_generator/yaml_parser.py @@ -13,6 +13,8 @@ # limitations under the License. import os +from os import listdir +from os.path import isfile, join class YAML_parser: @@ -82,10 +84,18 @@ class YAML_parser: self.data['include_paths'] = include_paths def find_source_files(self, common_attributes, group_name): + files = [] try: for k, v in common_attributes.items(): if k == 'source_files': - self.process_files(v, group_name) + # Source directory can be either a directory or files + for paths in v: + if os.path.isdir(paths): + files_in_dir = [ join(paths, f) for f in listdir(paths) if isfile(join(paths,f)) ] + files += files_in_dir + else: + files = v + self.process_files(files, group_name) except KeyError: pass
source_files can be folders, or separate files
project-generator_project_generator
train
py
ca8f8be6436540a11bfe349da2d5a82a339c8fc1
diff --git a/static/manager/js/src/article.js b/static/manager/js/src/article.js index <HASH>..<HASH> 100644 --- a/static/manager/js/src/article.js +++ b/static/manager/js/src/article.js @@ -10,11 +10,13 @@ var imageManager = React.render( var articleId = $('#article-admin').data('id'); var articleId = articleId ? articleId : false; -var section = $('#article-admin').data('section'); -var section = section ? section : false; +var sectionId = $('#article-admin').data('section-id'); +var sectionId = sectionId ? sectionId : false; +var sectionName = $('#article-admin').data('section-name'); +var sectionName = sectionName ? sectionName : false; var articleAdmin = React.render( - <ArticleAdmin imageManager={imageManager} articleId={articleId} section={section} />, + <ArticleAdmin imageManager={imageManager} articleId={articleId} sectionId={sectionId} sectionName={sectionName} />, document.getElementById('article-admin') );
pass section id and slug into ArticleAdmin component
ubyssey_dispatch
train
js
c3acfc0f676fac4e3304c28ef327199b90ddca7b
diff --git a/src/Symfony/Console/Command/Command.php b/src/Symfony/Console/Command/Command.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Console/Command/Command.php +++ b/src/Symfony/Console/Command/Command.php @@ -21,9 +21,9 @@ abstract class Command extends Base final protected static function tempnamCheck(OutputInterface $output) : ? string { - $tempnam = realpath(static::tempnam()); + $tempnam = strval(realpath(static::tempnam())); - if ( ! is_string($tempnam) || ! is_writable($tempnam) || is_dir($tempnam)) { + if (is_dir($tempnam) || ! is_file($tempnam) || ! is_writable($tempnam)) { $output->writeln('could not get temporary filename!'); return null;
snagging scrutinizer issues is getting annoying now ¬_¬
SignpostMarv_daft-framework
train
php
fa44a498ac26cad5372dfab48df2c4e3f191f860
diff --git a/client/sizes.go b/client/sizes.go index <HASH>..<HASH> 100644 --- a/client/sizes.go +++ b/client/sizes.go @@ -36,11 +36,11 @@ func main() { prot = t } - var wg sync.WaitGroup + wg := &sync.WaitGroup{} wg.Add(f.NumWorkers) for i := 0; i < f.NumWorkers; i++ { - go func(prot common.Prot, wg sync.WaitGroup) { + go func(prot common.Prot, wg *sync.WaitGroup) { conn, err := common.Connect("localhost", f.Port) if err != nil { panic("Couldn't connect")
Passing sync.WaitGroup by reference in client sizes testing program Previously it was passed by value, meaning the program would never stop.
Netflix_rend
train
go
b0d33b86ed383478ac23ed14ef6c1ad398ce243a
diff --git a/tests/test_isort.py b/tests/test_isort.py index <HASH>..<HASH> 100644 --- a/tests/test_isort.py +++ b/tests/test_isort.py @@ -836,6 +836,15 @@ def test_remove_imports() -> None: ) assert test_output == "import lib1\nimport lib5\n" + # From imports + test_input = "from x import y" + test_output = api.sort_code_string(test_input, remove_imports=["x"]) + assert test_output == "" + + test_input = "from x import y" + test_output = api.sort_code_string(test_input, remove_imports=["x.y"]) + assert test_output == "" + def test_explicitly_local_import() -> None: """Ensure that explicitly local imports are separated."""
Add test for removing from imports
timothycrosley_isort
train
py
bcbd67841676c1f19b611f7d932c3625ba76d5ab
diff --git a/packages/fireplace/lib/utils/expand_path.js b/packages/fireplace/lib/utils/expand_path.js index <HASH>..<HASH> 100644 --- a/packages/fireplace/lib/utils/expand_path.js +++ b/packages/fireplace/lib/utils/expand_path.js @@ -4,7 +4,7 @@ FP.Utils = FP.Utils || {}; FP.Utils.expandPath = function(path, opts) { return path.replace(/{{([^}]+)}}/g, function(match, optName){ var value = get(opts, optName); - Ember.assert("missing part for path generation ("+optName+")", value); + Ember.assert("Missing part for path expansion, looking for "+optName+" in "+Ember.inspect(opts) + " for "+path, value); return value; }); }; \ No newline at end of file
better assert message when path expansion is missing parts
rlivsey_fireplace
train
js
b5473c7fe65959a26064b2c69c9e7865d12a4c5a
diff --git a/src/client/pps.go b/src/client/pps.go index <HASH>..<HASH> 100644 --- a/src/client/pps.go +++ b/src/client/pps.go @@ -240,7 +240,7 @@ func (c APIClient) ListJob(pipelineName string, inputCommit []*pfs.Commit, outpu if err == io.EOF { break } else if err != nil { - return nil, err + return nil, grpcutil.ScrubGRPC(err) } result = append(result, ji) } @@ -303,7 +303,7 @@ func (c APIClient) ListDatum(jobID string, pageSize int64, page int64) (*pps.Lis if err == io.EOF { break } else if err != nil { - return nil, err + return nil, grpcutil.ScrubGRPC(err) } if first { resp.TotalPages = r.TotalPages
Scrub GRPC error text from streaming errors (so that they work with client-side error libraries)
pachyderm_pachyderm
train
go
635ef5f2fd409a5602b2c68b4382530e67f244c5
diff --git a/TYPO3.Media/Classes/TYPO3/Media/Domain/Repository/AssetRepository.php b/TYPO3.Media/Classes/TYPO3/Media/Domain/Repository/AssetRepository.php index <HASH>..<HASH> 100644 --- a/TYPO3.Media/Classes/TYPO3/Media/Domain/Repository/AssetRepository.php +++ b/TYPO3.Media/Classes/TYPO3/Media/Domain/Repository/AssetRepository.php @@ -35,7 +35,10 @@ class AssetRepository extends \TYPO3\Flow\Persistence\Repository { public function findBySearchTermOrTags($searchTerm, array $tags = array()) { $query = $this->createQuery(); - $constraints = array($query->like('title', '%' . $searchTerm . '%')); + $constraints = array( + $query->like('title', '%' . $searchTerm . '%'), + $query->like('resource.filename', '%' . $searchTerm . '%') + ); foreach ($tags as $tag) { $constraints[] = $query->contains('tags', $tag); }
[TASK] Match filenames in asset search When searching for assets the filename is now included in the search criteria allowing assets without titles to be found. Change-Id: I<I>ba<I>ead<I>e<I>b0cc<I>d8f1d4a<I>e8 Releases: master Resolves: NEOS-<I> Reviewed-on: <URL>
neos_neos-development-collection
train
php
6b3bcbe224ee555485980e2230046210b8b0e7ce
diff --git a/src/utils/network_utils.js b/src/utils/network_utils.js index <HASH>..<HASH> 100644 --- a/src/utils/network_utils.js +++ b/src/utils/network_utils.js @@ -74,7 +74,7 @@ const NetworkUtils = { }, getAddressAndPortFromUri(uriString) { - let regexStr = /(?:http:\/\/|rosrpc:\/\/)?([a-zA-Z\d\-.:]+):(\d+)/; + let regexStr = /(?:http:\/\/|rosrpc:\/\/)?([a-zA-Z\d\-_.]+):(\d+)/; let match = uriString.match(regexStr); if (match === null) { throw new Error ('Unable to find host and port from uri ' + uriString + ' with regex ' + regexStr);
Fix regex for parsing url. (#<I>) Added `_` to the valid characters in the hostname and removed ':'. Fixes #<I>.
RethinkRobotics-opensource_rosnodejs
train
js
b21e52be8d4f78ad12ce2eb7517d7e75981e5a73
diff --git a/bliss/core/dmc.py b/bliss/core/dmc.py index <HASH>..<HASH> 100644 --- a/bliss/core/dmc.py +++ b/bliss/core/dmc.py @@ -42,6 +42,7 @@ TwoPi = 2 * math.pi DOY_Format = '%Y-%jT%H:%M:%SZ' ISO_8601_Format = '%Y-%m-%dT%H:%M:%SZ' +_DEFAULT_FILE_NAME = 'leapseconds.dat' LeapSeconds = None def getTimestampUTC(): @@ -340,7 +341,7 @@ class UTCLeapSeconds(object): def _load_leap_second_data(self): ls_file = bliss.config.get( 'leapseconds.filename', - os.path.join(bliss.config._directory, 'leapseconds.pkl') + os.path.join(bliss.config._directory, _DEFAULT_FILE_NAME) ) try: @@ -380,7 +381,7 @@ class UTCLeapSeconds(object): ls_file = bliss.config.get( 'leapseconds.filename', - os.path.join(bliss.config._directory, 'leapseconds.dat') + os.path.join(bliss.config._directory, _DEFAULT_FILE_NAME) ) url = 'https://www.ietf.org/timezones/data/leap-seconds.list'
Issue #8 - Fix inconsistent default leap second file name
NASA-AMMOS_AIT-Core
train
py
2013f28e35e1b81388b623d3f91342aac07f6347
diff --git a/src/Listener/GenerateSitemap.php b/src/Listener/GenerateSitemap.php index <HASH>..<HASH> 100644 --- a/src/Listener/GenerateSitemap.php +++ b/src/Listener/GenerateSitemap.php @@ -4,6 +4,7 @@ namespace Terabin\Sitemap\Listener; use Illuminate\Contracts\Events\Dispatcher; use Flarum\Event\DiscussionWasStarted; +use Flarum\Event\DiscussionWasDeleted; use Flarum\Core\Discussion; use Flarum\Core\User; use Flarum\Tags\Tag; @@ -30,6 +31,7 @@ class GenerateSitemap public function subscribe(Dispatcher $events) { $events->listen(DiscussionWasStarted::class, [$this, 'UpdateSitemap']); + $events->listen(DiscussionWasDeleted::class, [$this, 'UpdateSitemap']); } /**
add(): generate sitemap after discussion was deleted
terabin_flarum-ext-sitemap
train
php
82affabb4866393a2fe563302ed2e29e9f620793
diff --git a/test/stream-end.js b/test/stream-end.js index <HASH>..<HASH> 100644 --- a/test/stream-end.js +++ b/test/stream-end.js @@ -173,9 +173,35 @@ tape('close after both sides of a duplex stream ends', function (t) { }) A.close(function (err) { - console.log('A CLOSE') + console.log('A CLOSE', err) t.notOk(err, 'as is closed') }) }) + +tape('closed is emitted when stream disconnects', function (t) { + t.plan(2) + var A = mux(client, null) () + A.on('closed', function (err) { + console.log('EMIT CLOSED') + t.notOk(err) + }) + pull(pull.empty(), A.createStream(function (err) { + console.log(err) + t.notOk(err) //end of parent stream + }), pull.drain()) +}) + +tape('closed is emitted with error when stream errors', function (t) { + t.plan(2) + var A = mux(client, null) () + A.on('closed', function (err) { + t.notOk(err) + }) + pull(pull.empty(), A.createStream(function (err) { + console.log(err) + t.notOk(err) //end of parent stream + }), pull.drain()) +}) +
test that "closed" is always emitted
ssbc_muxrpc
train
js