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
ee9e984975de6a22c8bd2005352c9248cd5241e4
diff --git a/cmd/xurls/main.go b/cmd/xurls/main.go index <HASH>..<HASH> 100644 --- a/cmd/xurls/main.go +++ b/cmd/xurls/main.go @@ -22,11 +22,11 @@ func init() { p := func(args ...interface{}) { fmt.Fprintln(os.Stderr, args...) } - p("Usage: xurls [-h]") + p(`Usage: xurls [-h]`) p() - p(" -m <regexp> only match urls whose scheme matches a regexp") - p(" example: \"https?://|mailto:\"") - p(" -r also match urls without a scheme (relaxed)") + p(` -m <regexp> only match urls whose scheme matches a regexp`) + p(` example: "https?://|mailto:"`) + p(` -r also match urls without a scheme (relaxed)`) } }
cmd/xurls: Use literal strings for the usage
mvdan_xurls
train
go
6e073f8bee33c897fd6ed0af12920dfc58a13e67
diff --git a/src/deprecated/platformSpecificDeprecated.android.js b/src/deprecated/platformSpecificDeprecated.android.js index <HASH>..<HASH> 100644 --- a/src/deprecated/platformSpecificDeprecated.android.js +++ b/src/deprecated/platformSpecificDeprecated.android.js @@ -43,7 +43,9 @@ function adaptTopTabs(screen, navigatorID) { tab.navigatorID = navigatorID; } tab.screen = tab.screenId; - addTabIcon(tab); + if (tab.icon) { + addTabIcon(tab); + } addNavigatorButtons(tab); adaptNavigationParams(tab); addNavigationStyleParams(tab);
Fix tabs with out icons (#<I>)
wix_react-native-navigation
train
js
555dd4d7cdc4763bc871aad23381dc98fc3c0a29
diff --git a/test/mathSpec.js b/test/mathSpec.js index <HASH>..<HASH> 100644 --- a/test/mathSpec.js +++ b/test/mathSpec.js @@ -83,6 +83,21 @@ describe('The odd function', function () { }); +describe('The range function', function () { + + it('returns linear values', function () { + var s1 = grob.range(4, 14, 2); + assert.deepEqual(s1, [4, 6, 8, 10, 12]); + var s2 = grob.range(4, 14, 2, true); + assert.deepEqual(s2, [4, 6, 8, 10, 12, 14]); + var s3 = grob.range(3, 14, 2); + assert.deepEqual(s3, [3, 5, 7, 9, 11, 13]); + var s4 = grob.range(3, 14, 2, true); + assert.deepEqual(s4, [3, 5, 7, 9, 11, 13]); + }); + +}); + describe('The sample function', function () { it('returns linear values', function () {
Test for 'range' function.
nodebox_g.js
train
js
829fda8144f84dbd0f318bc2c8191bf5e014edc7
diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListBox.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListBox.java index <HASH>..<HASH> 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListBox.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListBox.java @@ -163,6 +163,13 @@ public class MaterialListBox extends MaterialWidget implements HasId, HasGrid, H }-*/; /** + * Re initialize the material listbox component + */ + public void reinitialize() { + initializeMaterial(getElement()); + } + + /** * Sets whether this list allows multiple selections. * * @param multiple <code>true</code> to allow multiple selections
Added reinitialize method to listbox component.
GwtMaterialDesign_gwt-material
train
java
54a218554a3567afbd84217b4aa8f0b638104694
diff --git a/server/src/main/java/org/openqa/selenium/server/testgenerator/XlateHtmlSeleneseToJava.java b/server/src/main/java/org/openqa/selenium/server/testgenerator/XlateHtmlSeleneseToJava.java index <HASH>..<HASH> 100644 --- a/server/src/main/java/org/openqa/selenium/server/testgenerator/XlateHtmlSeleneseToJava.java +++ b/server/src/main/java/org/openqa/selenium/server/testgenerator/XlateHtmlSeleneseToJava.java @@ -61,7 +61,7 @@ public class XlateHtmlSeleneseToJava { String dirName = args[++j]; File dir = new File(dirName); if (!dir.isDirectory()) { - Usage("-dir must be followed by a directory"); + Usage("-dir is not a directory: " + dirName); } String children[] = dir.list(); for (int k = 0; k < children.length; k++) {
Clarified this error message, for the case where you enter a bad directory but you don't know it r<I>
SeleniumHQ_selenium
train
java
5b1fe8a6595b439751c45ca53dbef7cb482bc9b7
diff --git a/lib/ShopifyResource.php b/lib/ShopifyResource.php index <HASH>..<HASH> 100644 --- a/lib/ShopifyResource.php +++ b/lib/ShopifyResource.php @@ -492,8 +492,8 @@ abstract class ShopifyResource if (isset($responseArray['errors'])) { $message = $this->castString($responseArray['errors']); - - throw new ApiException($message); +z + throw new ApiException($message, CurlRequest::$lastHttpCode); } if ($dataKey && isset($responseArray[$dataKey])) {
Added last http code as exception code
phpclassic_php-shopify
train
php
e9834daa3116ccf1c63887543ca8acd2b3eef355
diff --git a/src/transport/tcp/tcpConnection.js b/src/transport/tcp/tcpConnection.js index <HASH>..<HASH> 100644 --- a/src/transport/tcp/tcpConnection.js +++ b/src/transport/tcp/tcpConnection.js @@ -153,11 +153,22 @@ TcpConnection.createConnectingConnection = function( connection._initSocket(socket); if (onConnectionEstablished) onConnectionEstablished(connection); }); + var timer = setTimeout(function(){ + log.error('TcpConnection: timeout when connecting to %j in %d ms', remoteEndPoint, connectionTimeout); + connection.close(); + if (onConnectionFailed) onConnectionFailed(connection, new Error('Connection failed')); + }, connectionTimeout) socket.once('error', onError); function onError(err) { + clearTimeout(timer); if (onConnectionFailed) onConnectionFailed(connection, err); } + socket.once('connect', onConnect); + function onConnect() { + log.info('TcpConnection: successfully connected to %j', remoteEndPoint); + clearTimeout(timer); + } return connection; }; -module.exports = TcpConnection; \ No newline at end of file +module.exports = TcpConnection;
feat(tcp): add timeout when trying to connect to a TCP endpoint * the timeout parameters in options will trigger a timeout only when the socket is connected (cf. <URL>
nicdex_node-eventstore-client
train
js
e23434eafcfbb7676bdb7dec98beab968632aacf
diff --git a/gwpy/detector/units.py b/gwpy/detector/units.py index <HASH>..<HASH> 100644 --- a/gwpy/detector/units.py +++ b/gwpy/detector/units.py @@ -61,6 +61,7 @@ class PluralFormat(Generic): raise exc +# pylint: disable=redefined-builtin def parse_unit(name, parse_strict='warn', format=PluralFormat): """Attempt to intelligently parse a `str` as a `~astropy.units.Unit` @@ -89,6 +90,7 @@ def parse_unit(name, parse_strict='warn', format=PluralFormat): if name is None: return None + # pylint: disable=unexpected-keyword-arg return units.Unit(name, parse_strict=parse_strict, format=format)
detector.units: added pylint exceptions [ci skip] need code as is to communicate well with astropy, so don't need the warnings
gwpy_gwpy
train
py
ea81a20a750e3e237056b553d2e7fa6f6856129d
diff --git a/test/__tad.js b/test/__tad.js index <HASH>..<HASH> 100644 --- a/test/__tad.js +++ b/test/__tad.js @@ -1,3 +1,3 @@ 'use strict'; -exports.context = {}; +exports.context = null;
Postponed TAD context setting, as it's not well supported by TAD yet
medikoo_es5-ext
train
js
79aea0fa3a5417ebfcfa5e5e7257cce272095dfa
diff --git a/src/BayesianModel.py b/src/BayesianModel.py index <HASH>..<HASH> 100644 --- a/src/BayesianModel.py +++ b/src/BayesianModel.py @@ -201,7 +201,8 @@ class BayesianModel(nx.DiGraph): """ Sets states of nodes as observed. - @param observations: dictionary with key as node and value as a tuple of states that are observed + @param observations: dictionary with key as node and value as a tuple + of states that are observed @return: """ #TODO check if multiple states of same node can be observed @@ -217,7 +218,8 @@ class BayesianModel(nx.DiGraph): def reset_observed(self, nodes=False): """Resets observed-status of given nodes. - Will not change a particular state. For that use, set_observed with reset=True. + Will not change a particular state. For that use, set_observed + with reset=True. If no arguments are given, all states of all nodes are reset. @param nodes:
pep8 compliant [issue <I>]
pgmpy_pgmpy
train
py
8163f3de580343362ea30ce3ed98b5c8cfcddee2
diff --git a/tests/test_executable_containers.py b/tests/test_executable_containers.py index <HASH>..<HASH> 100644 --- a/tests/test_executable_containers.py +++ b/tests/test_executable_containers.py @@ -61,6 +61,18 @@ class ExecutableContainerTestCase(unittest.TestCase): with self.assertRaises(GOSExecutableContainerException): ExecutableContainer.setup_from_file(non_py_file.name) + def test_setup_from_file_no_unique_name(self): + tmp_file = tempfile.NamedTemporaryFile(mode="wt", suffix=".py") + tmp_file.write(self.get_executable_container_import_string()) + tmp_file.write("""class MyContainer(ExecutableContainer):\n\tdef setup():\n\t\tpass""") + tmp_file.flush() + importlib.invalidate_caches() + with self.assertRaises(GOSExecutableContainerException): + ExecutableContainer.setup_from_file(tmp_file.name) + + def get_executable_container_import_string(self): + return """from gos.executable_containers import ExecutableContainer\n""" + def test_setup_from_file_no_setup_method(self): tmp_file = tempfile.NamedTemporaryFile(mode="wt", suffix=".py") tmp_file.write(self.get_executable_container_import_string())
GOS-<I> added a test to check that an exception is thrown, when no unique name is provided for the subclass of the custom executable container class
aganezov_gos
train
py
9f0120ee126928802932ed2d4a38cf1214ce7e3c
diff --git a/lib/Entity/Token.php b/lib/Entity/Token.php index <HASH>..<HASH> 100644 --- a/lib/Entity/Token.php +++ b/lib/Entity/Token.php @@ -19,9 +19,8 @@ class Token * * @param string $tokenString * @param array $tokenData - * @param int $videoManagerId - deprecated, kept for BC */ - public function __construct($tokenString, array $tokenData, $videoManagerId = null) + public function __construct($tokenString, array $tokenData) { $this->tokenString = $tokenString; $this->tokenData = $tokenData; @@ -44,18 +43,6 @@ class Token } /** - * This method is kept for BC and will be removed in the future. - * - * @deprecated - * - * @return int - */ - public function getVideoManagerId() - { - return null; - } - - /** * @return bool */ public function expired() diff --git a/lib/Manager/TokenManager.php b/lib/Manager/TokenManager.php index <HASH>..<HASH> 100644 --- a/lib/Manager/TokenManager.php +++ b/lib/Manager/TokenManager.php @@ -156,11 +156,9 @@ class TokenManager implements LoggerAwareInterface /** * Retrieve a valid token. * - * @param int $videoManagerId - deprecated and unused, preserved for BC - * * @return string */ - public function getToken($videoManagerId = null) + public function getToken() { $logger = $this->getLogger(); $this->logTokenData();
Don't use deprecations - we will bump the major version
MovingImage24_VMProApiClient
train
php,php
12390e7b557bc87adc957066642351f121db5918
diff --git a/src/wavesurfer.js b/src/wavesurfer.js index <HASH>..<HASH> 100644 --- a/src/wavesurfer.js +++ b/src/wavesurfer.js @@ -1028,12 +1028,19 @@ WaveSurfer.util = { ajax: function (options) { var ajax = Object.create(WaveSurfer.Observer); var xhr = new XMLHttpRequest(); + var fired100 = false; xhr.open(options.method || 'GET', options.url, true); xhr.responseType = options.responseType; xhr.addEventListener('progress', function (e) { ajax.fireEvent('progress', e); + if (e.lengthComputable && e.loaded == e.total) { + fired100 = true; + } }); xhr.addEventListener('load', function (e) { + if (!fired100) { + ajax.fireEvent('progress', e); + } ajax.fireEvent('load', e); if (200 == xhr.status || 206 == xhr.status) {
Ensure "progress" fires with <I>% In the event that progress does NOT fire with loaded==total, then fire it with <I>% when the load event happens
katspaugh_wavesurfer.js
train
js
e86cc75ac3806efdc95f77b161015cdc1870927b
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -13,8 +13,11 @@ module.exports = { this.getSize = function() { return {width: 1, height: 1}; }; this.context = { - getContextAttributes: function() { return {alpha: 0}; }, - depthMask: function() {} + getContextAttributes: function() { return {alpha: 0}; } + }; + + this.state = { + setDepthWrite: function() {} }; }
Updated WebGLRenderer mockup.
vanruesc_postprocessing
train
js
308b57b9c7e909ac01f223ebd0e783540d4ffa0a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,7 @@ setuptools.setup( 'pytest', 'pytest-cov', 'tox', + 'twine', ] },
setup.py += twine dev dependency
awdeorio_mailmerge
train
py
f31895239f89f2cb4b0a6a2798df5085e3460e94
diff --git a/resultdb/internal/artifactcontent/rbecas.go b/resultdb/internal/artifactcontent/rbecas.go index <HASH>..<HASH> 100644 --- a/resultdb/internal/artifactcontent/rbecas.go +++ b/resultdb/internal/artifactcontent/rbecas.go @@ -32,6 +32,7 @@ import ( "go.chromium.org/luci/common/logging" "go.chromium.org/luci/common/trace" "go.chromium.org/luci/grpc/appstatus" + "go.chromium.org/luci/grpc/grpcmon" "go.chromium.org/luci/server/auth" "go.chromium.org/luci/server/router" ) @@ -47,6 +48,7 @@ func RBEConn(ctx context.Context) (*grpc.ClientConn, error) { "remotebuildexecution.googleapis.com:443", grpc.WithTransportCredentials(credentials.NewTLS(nil)), grpc.WithPerRPCCredentials(creds), + grpcmon.WithClientRPCStatsMonitor(), ) }
[resultdb] enable grpcmon in rbecas client This can replace the artifact metrics with providing more detailed information. Bug: <I> Change-Id: I7e6ae<I>d<I>f<I>ca<I>aece<I>f2b<I>f5a Reviewed-on: <URL>
luci_luci-go
train
go
26fdd39b7d555795e0bff63f10ef5eb858f6e5da
diff --git a/src/Controller/Admin.php b/src/Controller/Admin.php index <HASH>..<HASH> 100644 --- a/src/Controller/Admin.php +++ b/src/Controller/Admin.php @@ -5,8 +5,16 @@ namespace Phwoolcon\Controller; use Phwoolcon\Config; use Phwoolcon\Controller; use Phwoolcon\Session; +use Phwoolcon\View; -abstract class Admin extends Controller +/** + * Class Admin + * @package Phwoolcon\Controller + * + * @property View $view + * @method Controller addPageTitle(string $title) + */ +trait Admin { public function initialize() diff --git a/src/Controller/Api.php b/src/Controller/Api.php index <HASH>..<HASH> 100644 --- a/src/Controller/Api.php +++ b/src/Controller/Api.php @@ -2,10 +2,9 @@ namespace Phwoolcon\Controller; -use Phwoolcon\Controller; use Phwoolcon\Router; -abstract class Api extends Controller +trait Api { public function initialize()
refactor: change admin/api controller class to trait
phwoolcon_phwoolcon
train
php,php
c707448a729888ba440e2a5b24723617a619f6c6
diff --git a/lib/utils.php b/lib/utils.php index <HASH>..<HASH> 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -23,7 +23,7 @@ class Roots_Wrapping { self::$base = substr(basename(self::$main_template), 0, -4); - if ('index' == self::$base) { + if (self::$base === 'index') { self::$base = false; }
Enforce code standards Correct this is not.
roots_sage
train
php
1cdf55f8b279b5b37e1115b9465a041f9f4a4c31
diff --git a/cake/libs/cache.php b/cake/libs/cache.php index <HASH>..<HASH> 100644 --- a/cake/libs/cache.php +++ b/cake/libs/cache.php @@ -549,10 +549,16 @@ class Cache { return array(); } +/** + * Write the session when session data is persisted with cache. + * + * @return void + * @access public + */ function __destruct() { if (Configure::read('Session.save') == 'cache' && function_exists('session_write_close')) { - session_write_close(); - } + session_write_close(); + } } }
Fixing whitespace and adding doc comment.
cakephp_cakephp
train
php
5535235166b75cb8ef1253ad3c5c9b7ccf9f475d
diff --git a/app/scripts/HiGlassComponent.js b/app/scripts/HiGlassComponent.js index <HASH>..<HASH> 100644 --- a/app/scripts/HiGlassComponent.js +++ b/app/scripts/HiGlassComponent.js @@ -964,7 +964,6 @@ class HiGlassComponent extends React.Component { targetCanvas.toBlob((blob) => { download('export.png', blob); }); - // TODO: Cleanup } } diff --git a/app/scripts/utils/download.js b/app/scripts/utils/download.js index <HASH>..<HASH> 100644 --- a/app/scripts/utils/download.js +++ b/app/scripts/utils/download.js @@ -14,6 +14,7 @@ export function download(filename, stringOrBlob) { document.body.appendChild(elem); elem.click(); document.body.removeChild(elem); + URL.revokeObjectURL(elem.href); } }
Avoid memory leak "The URL lifetime is tied to the document in the window on which it was created." <URL>
higlass_higlass
train
js,js
3092917f736b71217a64df9b697495e17406596b
diff --git a/src/Rapid/Model/Response/Creation3dsEnrolmentResponse.php b/src/Rapid/Model/Response/Creation3dsEnrolmentResponse.php index <HASH>..<HASH> 100644 --- a/src/Rapid/Model/Response/Creation3dsEnrolmentResponse.php +++ b/src/Rapid/Model/Response/Creation3dsEnrolmentResponse.php @@ -7,7 +7,7 @@ namespace Eway\Rapid\Model\Response; * @property string Default3dsUrl * @property string AccessCode */ -class Creation3DsEnrolmentResponse extends AbstractResponse +class Creation3dsEnrolmentResponse extends AbstractResponse { protected $fillable = [ 'Errors',
MUP-<I>: Update SDK
eWAYPayment_eway-rapid-php
train
php
0ff77049c9d5cdf7e6f42dce28406e4822a039f8
diff --git a/ecs-init/docker/docker_test.go b/ecs-init/docker/docker_test.go index <HASH>..<HASH> 100644 --- a/ecs-init/docker/docker_test.go +++ b/ecs-init/docker/docker_test.go @@ -253,6 +253,14 @@ func validateCommonCreateContainerOptions(opts godocker.CreateContainerOptions, if hostCfg.NetworkMode != networkMode { t.Errorf("Expected network mode to be %s, got %s", networkMode, hostCfg.NetworkMode) } + + if len(hostCfg.CapAdd) != 1 { + t.Error("Mismatch detected in added host config capabilities") + } + + if hostCfg.CapAdd[0] != CAP_NET_ADMIN { + t.Errorf("Missing %s from host config capabilities", CAP_NET_ADMIN) + } } func expectKey(key string, input map[string]struct{}, t *testing.T) {
Update tests to validate CAP_NET_ADMIN capability
aws_amazon-ecs-agent
train
go
37351c671b9b693714db2808d7d89dfc9c2e289a
diff --git a/aiohttp/client_reqrep.py b/aiohttp/client_reqrep.py index <HASH>..<HASH> 100644 --- a/aiohttp/client_reqrep.py +++ b/aiohttp/client_reqrep.py @@ -668,8 +668,10 @@ class ClientResponse(HeadersMixin): try: content = self.content if content is not None: - while not content.at_eof(): - yield from content.readany() + content.read_nowait() + if not content.at_eof(): + self._connection.close() + self._connection = None except Exception: self._connection.close() self._connection = None diff --git a/aiohttp/streams.py b/aiohttp/streams.py index <HASH>..<HASH> 100644 --- a/aiohttp/streams.py +++ b/aiohttp/streams.py @@ -329,7 +329,6 @@ class StreamReader(AsyncStreamReaderMixin): # # I believe the most users don't know about the method and # they are not affected. - assert n is not None, "n should be -1" if self._exception is not None: raise self._exception
Close connection if content is not at_eof (#<I>)
aio-libs_aiohttp
train
py,py
cb2cee5374e73654d7d7b839cbe20f0f8a8e805f
diff --git a/khard/actions.py b/khard/actions.py index <HASH>..<HASH> 100644 --- a/khard/actions.py +++ b/khard/actions.py @@ -23,6 +23,15 @@ class Actions: @classmethod def get_action_for_alias(cls, alias): + """Find the name of the action for the supplied alias. If no action s + asociated with the given alias, None is returned. + + :param alias: the alias to look up + :type alias: str + :rturns: the name of the corresponding action or None + :rtype: str or NoneType + + """ for action, alias_list in cls.action_map.items(): if alias in alias_list: return action @@ -30,8 +39,22 @@ class Actions: @classmethod def get_alias_list_for_action(cls, action): + """Find all aliases for the given action. If there is no such action, + None is returned. + + :param action: the action name to look up + :type action: str + :returns: the list of aliases or None + :rtype: list(str) or NoneType + + """ return cls.action_map.get(action) @classmethod def get_list_of_all_actions(cls): - return list(cls.action_map.keys()) + """Find the names of all defined actions. + + :returns: all action names + :rtype: iterable(str) + """ + return cls.action_map.keys()
Add docstrings to actions.Actions' methods
scheibler_khard
train
py
1f6701251ef6f0da4c28f67edc84498cdc725f93
diff --git a/dna.js b/dna.js index <HASH>..<HASH> 100755 --- a/dna.js +++ b/dna.js @@ -505,9 +505,8 @@ dna.compile = { elems.each(dna.compile.propsAndAttrs); dna.compile.separators(elem); //support html5 values for "type" attribute - $('input[data-attr-type]').each(function() { - $(this).attr('type', $(this).data().attrType); - }); + function setTypeAttr() { $(this).attr('type', $(this).data().attrType); } + $('input[data-attr-type]').each(setTypeAttr); return dna.store.stash(elem); } };
replaced annonymous function with named function
dnajs_dna.js
train
js
14ec0d22507c3fef3595545a6010246fa04cff03
diff --git a/unyt/unit_object.py b/unyt/unit_object.py index <HASH>..<HASH> 100644 --- a/unyt/unit_object.py +++ b/unyt/unit_object.py @@ -14,6 +14,10 @@ A class that represents a unit symbol. import copy +try: + from functools import lru_cache +except ImportError: + from backports.functools_lru_cache import lru_cache from keyword import iskeyword as _iskeyword import numpy as np from numbers import Number as numeric_type @@ -765,6 +769,7 @@ def _get_em_base_unit(units): return base_unit +@lru_cache(maxsize=128, typed=False) def _check_em_conversion(unit_expr, to_unit_expr=None): """Check to see if the units contain E&M units
decorate _check_em_conversions with lru_cache for a nice speedup
yt-project_unyt
train
py
5196f76ebc26cc43bf38f983dd68da1367a0f0bb
diff --git a/snap7/logo.py b/snap7/logo.py index <HASH>..<HASH> 100644 --- a/snap7/logo.py +++ b/snap7/logo.py @@ -156,7 +156,6 @@ class Logo(object): amount = 1 wordlen = 0 data = bytearray(0) - print(data) logger.debug("write, vm_address:%s, value:%s" % (vm_address, value)) if re.match("^V[0-9]{1,4}\.[0-7]{1}$", vm_address):
remove a print() statement from logo.py (#<I>)
gijzelaerr_python-snap7
train
py
7d59de89a15b277e878c895148f80189318a61b7
diff --git a/unit_lookup_table.py b/unit_lookup_table.py index <HASH>..<HASH> 100644 --- a/unit_lookup_table.py +++ b/unit_lookup_table.py @@ -18,7 +18,7 @@ from yt.utilities.physical_ratios import \ mass_sun_grams, sec_per_year, sec_per_day, sec_per_hr, \ sec_per_min, temp_sun_kelvin, luminosity_sun_ergs_per_sec, \ metallicity_sun, erg_per_eV, amu_grams, mass_electron_grams, \ - cm_per_ang, jansky_cgs + cm_per_ang, jansky_cgs, mass_jupiter_grams, mass_earth_grams import numpy as np # Lookup a unit symbol with the symbol string, and provide a tuple with the @@ -77,6 +77,8 @@ default_unit_symbol_lut = { "Lsun": ( luminosity_sun_ergs_per_sec, dimensions.power), "Tsun": ( temp_sun_kelvin, dimensions.temperature), "Zsun": (metallicity_sun, dimensions.dimensionless), + "Mjup": (mass_jupiter_grams, dimensions.mass), + "Mearth": (mass_earth_grams, dimensions.mass), # astro distances "AU": (cm_per_au, dimensions.length),
Add masses for solar system's planets. Introduce jupiter and earth mass as new units --HG-- branch : yt-<I>
yt-project_unyt
train
py
f986551bbcdc471491d8bc65b237537256f43bdf
diff --git a/download.js b/download.js index <HASH>..<HASH> 100644 --- a/download.js +++ b/download.js @@ -396,7 +396,7 @@ function getSortedComponents(components, requireName, sorted) { } } if (notNow) { - tmp = sorted[i]; + var tmp = sorted[i]; sorted[i] = sorted[indexOfRequirement]; sorted[indexOfRequirement] = tmp; }
Download page: Fix implicitly declared variable
PrismJS_prism
train
js
bc181f888e2926bd6c06c306149c9ebc0fd084f5
diff --git a/lib/ydim/config.rb b/lib/ydim/config.rb index <HASH>..<HASH> 100644 --- a/lib/ydim/config.rb +++ b/lib/ydim/config.rb @@ -5,7 +5,7 @@ require 'rclconf' require 'fileutils' module YDIM - VERSION = 1.0.0 + VERSION = '1.0.0' class Client home_dir = ENV['HOME'] || '/tmp' ydim_default_dir = File.join(home_dir, '.ydim')
Updated lib/ydim/config.rb
zdavatz_ydim
train
rb
76bf10a952118c6f66a2967e74d5701618927583
diff --git a/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java b/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java index <HASH>..<HASH> 100644 --- a/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java +++ b/liquibase-core/src/main/java/liquibase/integration/commandline/Main.java @@ -729,6 +729,11 @@ public class Main { * @throws CommandLineParsingException if an error occurs during parsing */ protected void parseDefaultPropertyFiles() throws CommandLineParsingException { + if (Main.runningFromNewCli) { + //properties file already handled and set earlier + return; + } + File[] potentialPropertyFiles = new File[2]; potentialPropertyFiles[0] = new File(defaultsFile);
New CLI: - Don't re-handle liquibase.properties in Main when wrapped in new CLI LB-<I> DAT-<I>
liquibase_liquibase
train
java
9e8b3d33d2c535f24fa337dae709a2bf9ab35eac
diff --git a/spec/guard/notifiers/terminal_notifier_spec.rb b/spec/guard/notifiers/terminal_notifier_spec.rb index <HASH>..<HASH> 100644 --- a/spec/guard/notifiers/terminal_notifier_spec.rb +++ b/spec/guard/notifiers/terminal_notifier_spec.rb @@ -27,7 +27,7 @@ describe Guard::Notifier::TerminalNotifier do it "should call the notifier." do ::TerminalNotifier.should_receive(:notify).with( "any message", - {:title=>"Guard Success any title"}, + {:title=>"Guard Success any title"} ) subject.notify('success', 'any title', 'any message', 'any image', { }) end
Fixes old syntax stuff and adds a better implementation of the available? method.
guard_notiffany
train
rb
f418c22487af3ab045fede6b047c48192fca136f
diff --git a/src/Stagehand/TestRunner/Runner/PHPUnit.php b/src/Stagehand/TestRunner/Runner/PHPUnit.php index <HASH>..<HASH> 100644 --- a/src/Stagehand/TestRunner/Runner/PHPUnit.php +++ b/src/Stagehand/TestRunner/Runner/PHPUnit.php @@ -115,9 +115,9 @@ class Stagehand_TestRunner_Runner_PHPUnit extends Stagehand_TestRunner_Runner_Co if (preg_match('/^(?:\x1b\[3[23]m)?(OK[^\x1b]+)/ms', $output, $matches)) { $this->_notification->name = 'Green'; $this->_notification->description = $matches[1]; - } elseif (preg_match('/^(?:\x1b\[31m)?(FAILURES[^\x1b]+)/ms', $output, $matches)) { + } elseif (preg_match('/^(FAILURES!\s)(?:\x1b\[31m)?([^\x1b]+)/ms', $output, $matches)) { $this->_notification->name = 'Red'; - $this->_notification->description = $matches[1]; + $this->_notification->description = "{$matches[1]}{$matches[2]}"; } } }
- Fixed a defect so that the Growl message is output only "FAILURES!" when a test fails.
piece_stagehand-testrunner
train
php
85884e3521287bb5b0a744622beba89c236e5492
diff --git a/packages/analytics-core/src/analytics.js b/packages/analytics-core/src/analytics.js index <HASH>..<HASH> 100644 --- a/packages/analytics-core/src/analytics.js +++ b/packages/analytics-core/src/analytics.js @@ -217,6 +217,11 @@ export default class AvAnalytics { }; trackPageView = url => { + // hashchanges are an object so we want to grab the new url from it + if (typeof url === 'object') { + url = url.newURL; + } + url = url || window.location.href; const promises = []; this.plugins.forEach(plugin => {
refactor(analytics-core): fixed issue with hashchange not having proper url
Availity_sdk-js
train
js
2698452751681f81087baaf2f0fa195798592e1e
diff --git a/go/libkb/constants.go b/go/libkb/constants.go index <HASH>..<HASH> 100644 --- a/go/libkb/constants.go +++ b/go/libkb/constants.go @@ -106,7 +106,7 @@ const ( // could be stale. CachedUserTimeout = 10 * time.Minute - LinkCacheSize = 0x10000 + LinkCacheSize = 4000 LinkCacheCleanDur = 1 * time.Minute UPAKCacheSize = 2000 diff --git a/go/libkb/env.go b/go/libkb/env.go index <HASH>..<HASH> 100644 --- a/go/libkb/env.go +++ b/go/libkb/env.go @@ -1207,8 +1207,7 @@ func (c AppConfig) GetLevelDBNumFiles() (int, bool) { return 50, true } -// Default is 0x10000 (65,536). Turning down on mobile to -// reduce memory usage. +// Default is 4000. Turning down on mobile to reduce memory usage. func (c AppConfig) GetLinkCacheSize() (int, bool) { return 1000, true }
Decrease LinkCacheSize default to <I> (#<I>)
keybase_client
train
go,go
e4258eb46d1055a85abe638272ee52ffa3b7a0f3
diff --git a/src/lib/Behat/BrowserContext/UserPreferencesContext.php b/src/lib/Behat/BrowserContext/UserPreferencesContext.php index <HASH>..<HASH> 100644 --- a/src/lib/Behat/BrowserContext/UserPreferencesContext.php +++ b/src/lib/Behat/BrowserContext/UserPreferencesContext.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Behat\BrowserContext; use Behat\Behat\Context\Context; use Ibexa\AdminUi\Behat\Page\ChangePasswordPage; +use Ibexa\AdminUi\Behat\Page\UserSettingsPage; class UserPreferencesContext implements Context { @@ -15,10 +16,15 @@ class UserPreferencesContext implements Context * @var \Ibexa\AdminUi\Behat\Page\ChangePasswordPage */ private $changePasswordPage; + /** + * @var \Ibexa\AdminUi\Behat\Page\UserSettingsPage + */ + private $userSettingsPage; - public function __construct(ChangePasswordPage $changePasswordPage) + public function __construct(ChangePasswordPage $changePasswordPage, UserSettingsPage $userSettingsPage) { $this->changePasswordPage = $changePasswordPage; + $this->userSettingsPage = $userSettingsPage; } /**
[Behat] IBX-<I> Added missing UserSettingsPage in UserPreferencesContext (#<I>) * added missing context * added missing import * cs fix
ezsystems_ezplatform-admin-ui
train
php
aac064fe4ee45ebd7f65cfe562b4b4d31d973f25
diff --git a/lib/her/model/attributes.rb b/lib/her/model/attributes.rb index <HASH>..<HASH> 100644 --- a/lib/her/model/attributes.rb +++ b/lib/her/model/attributes.rb @@ -145,16 +145,16 @@ module Her attributes.each do |attribute| attribute = attribute.to_sym - define_method "#{attribute}".to_sym do + define_method attribute do @attributes.include?(attribute) ? @attributes[attribute] : nil end - define_method "#{attribute}=".to_sym do |value| - self.send("#{attribute}_will_change!".to_sym) if @attributes[attribute] != value + define_method :"#{attribute}=" do |value| + self.send(:"#{attribute}_will_change!") if @attributes[attribute] != value @attributes[attribute] = value end - define_method "#{attribute}?".to_sym do + define_method :"#{attribute}?" do @attributes.include?(attribute) && @attributes[attribute].present? end end
Remove some useless castings Sorry I couldn't resist.
remiprev_her
train
rb
9c6d6302c3fb5a5c00dd2404482948793452118d
diff --git a/lib/has_scope.rb b/lib/has_scope.rb index <HASH>..<HASH> 100644 --- a/lib/has_scope.rb +++ b/lib/has_scope.rb @@ -11,7 +11,6 @@ module HasScope def self.included(base) base.class_eval do extend ClassMethods - helper_method :current_scopes class_attribute :scopes_configuration, :instance_writer => false end end @@ -184,4 +183,7 @@ module HasScope end end -ActionController::Base.send :include, HasScope +ActionController::Base.instance_eval do + include HasScope + helper_method :current_scopes +end diff --git a/test/has_scope_test.rb b/test/has_scope_test.rb index <HASH>..<HASH> 100644 --- a/test/has_scope_test.rb +++ b/test/has_scope_test.rb @@ -247,3 +247,22 @@ class HasScopeTest < ActionController::TestCase end end +class TreeHugger + include HasScope + + has_scope :color + + def by_color + apply_scopes(Tree, :color => 'blue') + end + +end + +class HasScopeOutsideControllerTest < ActiveSupport::TestCase + + def test_has_scope_usable_outside_controller + Tree.expects(:color).with('blue') + TreeHugger.new.by_color + end + +end
Apply helper_method only on ActionController::Base This way, HasScope can be included in every class.
plataformatec_has_scope
train
rb,rb
13a2c7b5b69df260ea3e658a9aea3ed0427f6514
diff --git a/client/volume_future.go b/client/volume_future.go index <HASH>..<HASH> 100644 --- a/client/volume_future.go +++ b/client/volume_future.go @@ -3,11 +3,11 @@ package client import ( "encoding/json" "fmt" - "math/rand" "net/http" "time" "code.cloudfoundry.org/lager" + "github.com/cenkalti/backoff" "github.com/tedsuo/rata" "github.com/concourse/baggageclaim" @@ -28,7 +28,10 @@ func (f *volumeFuture) Wait() (baggageclaim.Volume, error) { return nil, err } - backoffFactor := uint(0) + exponentialBackoff := backoff.NewExponentialBackOff() + exponentialBackoff.InitialInterval = 10 * time.Millisecond + exponentialBackoff.MaxInterval = 10 * time.Second + exponentialBackoff.MaxElapsedTime = 0 for { response, err := f.client.httpClient(f.logger).Do(request) @@ -39,13 +42,7 @@ func (f *volumeFuture) Wait() (baggageclaim.Volume, error) { if response.StatusCode == http.StatusNoContent { response.Body.Close() - if backoffFactor != 0 { - time.Sleep(time.Duration(rand.Intn((1<<backoffFactor)-1)) * 10 * time.Millisecond) - } - - if backoffFactor < 8 { - backoffFactor++ - } + time.Sleep(exponentialBackoff.NextBackOff()) continue }
Use github.com/cenkalti/backoff in the volume future
concourse_baggageclaim
train
go
10ae1eab317e681f4b64f15feeaad9e69592eca1
diff --git a/src/Internal/ControlUtils.php b/src/Internal/ControlUtils.php index <HASH>..<HASH> 100644 --- a/src/Internal/ControlUtils.php +++ b/src/Internal/ControlUtils.php @@ -1,7 +1,6 @@ <?php namespace mpyw\Co\Internal; -use React\Promise\Deferred; use mpyw\Co\AllFailedException; use mpyw\Co\CoInterface;
Scrutinizer Auto-Fixes (#<I>) This commit consists of patches automatically generated for this project on <URL>
mpyw_co
train
php
a46e0544536cde14c37b8b48998bda31a699943e
diff --git a/test/cases/loaders/_css/generateCss.js b/test/cases/loaders/_css/generateCss.js index <HASH>..<HASH> 100644 --- a/test/cases/loaders/_css/generateCss.js +++ b/test/cases/loaders/_css/generateCss.js @@ -1,3 +1,7 @@ var fs = require("fs"); var path = require("path"); -module.exports = fs.readFileSync(path.join(path.dirname(__filename), "stylesheet.css"), "utf-8") + "\n.generated { color: red; }"; +module.exports = function() { + return { + code: fs.readFileSync(path.join(path.dirname(__filename), "stylesheet.css"), "utf-8") + "\n.generated { color: red; }" + }; +};
fix for val-loader change
webpack_webpack
train
js
17601096be08c6555fa5ae495ad93403b753810b
diff --git a/holoviews/plotting/mpl/chart3d.py b/holoviews/plotting/mpl/chart3d.py index <HASH>..<HASH> 100644 --- a/holoviews/plotting/mpl/chart3d.py +++ b/holoviews/plotting/mpl/chart3d.py @@ -119,7 +119,7 @@ class Scatter3DPlot(Plot3D, PointPlot): style = self.style[self.cyclic_index] cdim = points.get_dimension(self.color_index) - if cdim: + if cdim and 'cmap' in style: cs = points.dimension_values(self.color_index) style['c'] = cs if 'clim' not in style:
Small bugfix for Scatter3DPlot
pyviz_holoviews
train
py
a648be5df859e4dd9e0e9b62026634febe12da49
diff --git a/gwpy/io/nds/__init__.py b/gwpy/io/nds/__init__.py index <HASH>..<HASH> 100644 --- a/gwpy/io/nds/__init__.py +++ b/gwpy/io/nds/__init__.py @@ -47,6 +47,19 @@ finally: (detector.LLO_4k.prefix,('nds.ligo-la.caltech.edu', 31200)), (detector.CIT_40.prefix,('nds40.ligo.caltech.edu', 31200))]) +# set type dicts +NDS2_CHANNEL_TYPESTR = {} +for ctype in (nds2.channel.CHANNEL_TYPE_RAW, + nds2.channel.CHANNEL_TYPE_ONLINE, + nds2.channel.CHANNEL_TYPE_RDS, + nds2.channel.CHANNEL_TYPE_STREND, + nds2.channel.CHANNEL_TYPE_MTREND, + nds2.channel.CHANNEL_TYPE_STATIC, + nds2.channel.CHANNEL_TYPE_TEST_POINT): + NDS2_CHANNEL_TYPESTR[ctype] = nds2.channel_channel_type_to_string(ctype) +NDS2_CHANNEL_TYPE = dict((val, key) for (key, val) in + NDS2_CHANNEL_TYPESTR.iteritems()) + class NDSOutputContext(object): def __init__(self, stdout=sys.stdout, stderr=sys.stderr):
io.nds: added NDS channel type dicts - int->str and str->int
gwpy_gwpy
train
py
1d723668142253d7ab35579cd44a7e72b435e33b
diff --git a/src/Exceptions.php b/src/Exceptions.php index <HASH>..<HASH> 100644 --- a/src/Exceptions.php +++ b/src/Exceptions.php @@ -31,6 +31,8 @@ class Exceptions { private static $handlers; + private static $errorReportingLevel; + public static function setHandler($handler) { if (self::$handlers === null) { @@ -43,14 +45,23 @@ class Exceptions self::$handlers = []; } + if (count(self::$handlers) === 0) { + self::$errorReportingLevel = error_reporting(); + error_reporting(0); + } + self::$handlers[] = $handler; } public static function unsetHandler() { array_pop(self::$handlers); - } + if ((count(self::$handlers) === 0) && (self::$errorReportingLevel !== null)) { + error_reporting(self::$errorReportingLevel); + self::$errorReportingLevel = null; + } + } public static function on() {
Disable error reporting when a handler is in effect
spencer-mortensen_exceptions
train
php
da2aa295895bf24acc05d30d1350be99823520e0
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1538,7 +1538,7 @@ module ActionDispatch path = path_for_action(action, options.delete(:path)) raise ArgumentError, "path is required" if path.blank? - action = action.to_s.dup + action = action.to_s if action =~ /^[\w\-\/]+$/ options[:action] ||= action.tr('-', '_') unless action.include?("/")
Remove unnecessary `dup` from Mapper `add_route` The `dup` was introduced by c<I>d0c<I>b<I>e<I>ec<I>b7bc7ea4b to work around a frozen key. Nowadays, the string is already being duplicated by the `tr` in `options[:action] ||= action.tr('-', '_')` and later joined into a new string in `name_for_action`.
rails_rails
train
rb
70d026420fe4eacfddb4abb544ded60c2a055dae
diff --git a/sos/plugins/apport.py b/sos/plugins/apport.py index <HASH>..<HASH> 100644 --- a/sos/plugins/apport.py +++ b/sos/plugins/apport.py @@ -25,5 +25,12 @@ class Apport(Plugin, DebianPlugin, UbuntuPlugin): def setup(self): self.add_copy_spec("/etc/apport/*") + self.add_copy_spec("/var/lib/whoopsie/whoopsie-id") + self.add_cmd_output( + "gdbus call -y -d com.ubuntu.WhoopsiePreferences \ + -o /com/ubuntu/WhoopsiePreferences \ + -m com.ubuntu.WhoopsiePreferences.GetIdentifier") + self.add_cmd_output("ls -alh /var/crash/") + self.add_cmd_output("bash -c 'grep -B 50 -m 1 ProcMaps /var/crash/*'") # vim: et ts=4 sw=4
[apport] Add information on specific crashes The whoopsie ID let's us look the machine up on errors.ubuntu.com for crash reports. Partial output from /var/crash let's us better know what crashdumps the user has without uploading all of them.
sosreport_sos
train
py
701772c0e891baad1e195fd8b1595b2828e96376
diff --git a/course/format/topics/lib.php b/course/format/topics/lib.php index <HASH>..<HASH> 100644 --- a/course/format/topics/lib.php +++ b/course/format/topics/lib.php @@ -143,6 +143,19 @@ class format_topics extends format_base { // check if there are callbacks to extend course navigation parent::extend_course_navigation($navigation, $node); + + // We want to remove the general section if it is empty. + $modinfo = get_fast_modinfo($this->get_course()); + $sections = $modinfo->get_sections(); + if (!isset($sections[0])) { + // The general section is empty to find the navigation node for it we need to get its ID. + $section = $modinfo->get_section_info(0); + $generalsection = $node->get($section->id, navigation_node::TYPE_SECTION); + if ($generalsection) { + // We found the node - now remove it. + $generalsection->remove(); + } + } } /**
MDL-<I> format_topics: section 0 navigation tweak Section 0 is now only shown in the navigation block if it contains activities. If there are no activities then the section is removed. This mimicks the display on the course page.
moodle_moodle
train
php
cd6056a58463caac1fe6a8e6594bf590e350c4bc
diff --git a/tests/parser/test_parser.py b/tests/parser/test_parser.py index <HASH>..<HASH> 100644 --- a/tests/parser/test_parser.py +++ b/tests/parser/test_parser.py @@ -157,19 +157,12 @@ def test_html_doc_preprocessor(caplog, tmpdir): fake_pdf_folder.join("fake{}.pdf".format(i)).write("content") # No errors expected - preprocessor = HTMLDocPreprocessor( - fake_html_folder, matching_pdf_folder=fake_pdf_folder - ) - # Quick fix so flake won't complain about unused variable - assert isinstance(preprocessor, HTMLDocPreprocessor) + HTMLDocPreprocessor(fake_html_folder, matching_pdf_folder=fake_pdf_folder) # Add html without corresponding pdf fake_html_folder.join("fake5.pdf").write("content") with pytest.raises(FileNotFoundError): - preprocessor = HTMLDocPreprocessor( - fake_html_folder, matching_pdf_folder=fake_pdf_folder - ) - assert isinstance(preprocessor, HTMLDocPreprocessor) + HTMLDocPreprocessor(fake_html_folder, matching_pdf_folder=fake_pdf_folder) def test_warning_on_missing_pdf(caplog):
Updates html preprocessor test
HazyResearch_fonduer
train
py
fce2471d9e99193456586f552165e1716b37e99b
diff --git a/js/src/javascript/beautifier.js b/js/src/javascript/beautifier.js index <HASH>..<HASH> 100644 --- a/js/src/javascript/beautifier.js +++ b/js/src/javascript/beautifier.js @@ -1425,7 +1425,7 @@ Beautifier.prototype.handle_dot = function(current_token) { this.handle_whitespace_and_comments(current_token, true); } - if (this._flags.last_token.text.match('^[0-9]*$')) { + if (this._flags.last_token.text.match('^[0-9]+$')) { this._output.space_before_token = true; }
regex for js implementation, need to do the same for py
beautify-web_js-beautify
train
js
c38ac4511c4fae4963c864c6e6e416426791646b
diff --git a/khard/address_book.py b/khard/address_book.py index <HASH>..<HASH> 100644 --- a/khard/address_book.py +++ b/khard/address_book.py @@ -87,10 +87,8 @@ class AddressBook: """ if self.loaded: return len(self.contact_list), 0 - contacts = 0 errors = 0 for filename in self._find_vcard_files(search=search): - contacts += 1 try: card = CarddavObject.from_file(self, filename, private_objects, localize_dates) @@ -110,7 +108,7 @@ class AddressBook: "There are duplicate UIDs in the address book %s: %s", self.name, duplicates) self.loaded = True - return contacts, errors + return len(self.contact_list), errors def _search_all(self, query): """Search in all fields for contacts matching query. diff --git a/khard/config.py b/khard/config.py index <HASH>..<HASH> 100644 --- a/khard/config.py +++ b/khard/config.py @@ -254,7 +254,7 @@ class Config: "%d of %d vcard files of address book %s " "could not be parsed\nUse --debug for more " "information or --skip-unparsable to proceed", - errors, contacts, name) + errors, contacts+errors, name) sys.exit(2) else: logging.debug(
Correctly report number of loaded contacts The documentation of load_all_vcards() says it reports successfully loaded contacts. That is also the number which is reported in case the vcards have already been loaded.
scheibler_khard
train
py,py
c38cffee9c19c2b33d52e4bc62b476e770f0d928
diff --git a/tlc/prepare.go b/tlc/prepare.go index <HASH>..<HASH> 100644 --- a/tlc/prepare.go +++ b/tlc/prepare.go @@ -10,6 +10,11 @@ import ( // Prepare creates all directories, files, and symlinks. // It also applies the proper permissions if the files already exist func (c *Container) Prepare(basePath string) error { + err := os.MkdirAll(basePath, 0755) + if err != nil { + return errors.Wrap(err, 1) + } + for _, dirEntry := range c.Dirs { err := c.prepareDir(basePath, dirEntry) if err != nil {
Make Prepare create the containing directory if it doesn't exist
itchio_wharf
train
go
fb3ffc34913db687535166a74c06e32487b28dc4
diff --git a/test/test-works.py b/test/test-works.py index <HASH>..<HASH> 100644 --- a/test/test-works.py +++ b/test/test-works.py @@ -25,11 +25,11 @@ def test_works_with_many_ids(): assert 'work' == [ x['message-type'] for x in res ][0] assert dois[0] == res[0]['message']['DOI'] -def test_works_doesnt_allow_cursor_with_ids_input(): - "works - param: ids, cursor not supported with DOIs" - res1 = cr.works(ids = '10.1016/j.neurobiolaging.2010.03.024', cursor = "*") - res2 = cr.works(ids = '10.1016/j.neurobiolaging.2010.03.024') - assert res1 == res2 +# def test_works_doesnt_allow_cursor_with_ids_input(): +# "works - param: ids, cursor not supported with DOIs" +# res1 = cr.works(ids = '10.1016/j.neurobiolaging.2010.03.024', cursor = "*") +# res2 = cr.works(ids = '10.1016/j.neurobiolaging.2010.03.024') +# assert res1 == res2 def test_works_no_id_withlimit(): "works - param: limit, no other inputs"
comment out test for now, cant sort out why not passing on travis is passing locally
sckott_habanero
train
py
b4d999a5a6e2e7fdb20f4a2456439895183470df
diff --git a/privacy/export_files/general.js b/privacy/export_files/general.js index <HASH>..<HASH> 100644 --- a/privacy/export_files/general.js +++ b/privacy/export_files/general.js @@ -62,7 +62,7 @@ function loadContent(datafile, callback) { } newscript.type = 'text/javascript'; - newscript.src = data; + newscript.src = encodeURIComponent(data); newscript.charset = 'utf-8'; document.getElementsByTagName("head")[0].appendChild(newscript); @@ -135,4 +135,4 @@ window.$(document).ready(function() { e.stopPropagation(); handleClick(window.$(this)); }); -}); \ No newline at end of file +});
MDL-<I> privacy: encode data URL when loading content. Previously paths that included ? or # characters would break loading.
moodle_moodle
train
js
f0340f8b0fd3605685446c5bf7b6dce024b7e729
diff --git a/src/Container/Css.php b/src/Container/Css.php index <HASH>..<HASH> 100644 --- a/src/Container/Css.php +++ b/src/Container/Css.php @@ -114,7 +114,7 @@ class Css extends Container $hash .= md5($c); // url case - } elseif (preg_match('#^https?//.+$#', $c)) { + } elseif (preg_match('#^https?://.+$#', $c)) { $contents[] = ['remote', $c]; $hash .= md5($c);
fix css file reges
FrenchFrogs_framework
train
php
6990f9043c712d601cea7d0875badc1e594e7c85
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java index <HASH>..<HASH> 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsRequest.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.Map; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; +import static java.util.Objects.requireNonNull; import static org.sonarqube.ws.client.WsRequest.Method.GET; import static org.sonarqube.ws.client.WsRequest.Method.POST; @@ -62,13 +62,13 @@ public class WsRequest { } public WsRequest setMediaType(MediaType type) { - checkNotNull(type); + requireNonNull(type); this.mimeType = type; return this; } public WsRequest setParam(String key, @Nullable Object value) { - checkNotNull(key, "a WS parameter key cannot be null"); + requireNonNull(key, "a WS parameter key cannot be null"); if (value != null) { this.params.put(key, value); } else {
Replace checkNotNull by requireNonNull in sonar-ws
SonarSource_sonarqube
train
java
e94d409a895c41f82b48a4d3628b0a42679e558f
diff --git a/lib/strings2csv/converter.rb b/lib/strings2csv/converter.rb index <HASH>..<HASH> 100644 --- a/lib/strings2csv/converter.rb +++ b/lib/strings2csv/converter.rb @@ -16,10 +16,11 @@ module Strings2CSV end def default_headers - headers = ['Variables'] + headers = ["Variables"] @filenames.each do |fname| - headers << basename(fname) + headers << fname end + headers end @@ -53,7 +54,7 @@ module Strings2CSV lang_order = [] @filenames.each do |fname| - header = basename(fname) + header = fname strings[header] = load_strings(fname) lang_order << header keys ||= strings[header].keys
use the full strings file path as header and language key fixes problems with en.lproj/Localizable.strings de.lproj/Localizable.strings kind of collisions
netbe_Babelish
train
rb
bbe1bc4a87c15cc99a953f096b924470253d1efe
diff --git a/blueocean-admin/src/main/js/redux/actions.js b/blueocean-admin/src/main/js/redux/actions.js index <HASH>..<HASH> 100644 --- a/blueocean-admin/src/main/js/redux/actions.js +++ b/blueocean-admin/src/main/js/redux/actions.js @@ -112,7 +112,7 @@ export const actions = { fetchRunsIfNeeded(config) { return (dispatch) => { const baseUrl = `${config.getAppURLBase()}/rest/organizations/jenkins` + - `/pipelines/${config.pipeline}/runs`; + `/pipelines/${config.pipeline}/runs/`; return dispatch(actions.fetchIfNeeded({ url: baseUrl, id: config.pipeline,
[UX-<I>] Add Trailing slash to runs fetch to stop redirect
jenkinsci_blueocean-plugin
train
js
29bf2c59d868dacf36310a6e6ef79bc3dde3dd16
diff --git a/suds/sudsobject.py b/suds/sudsobject.py index <HASH>..<HASH> 100644 --- a/suds/sudsobject.py +++ b/suds/sudsobject.py @@ -59,10 +59,11 @@ class Factory: @classmethod def subclass(cls, name, super): name = name.encode('utf-8') - myclass = cls.cache.get(name) + key = "%s.%s" % (name, super.__name__) + myclass = cls.cache.get(key) if myclass is None: myclass = classobj(name,(super,),{}) - cls.cache[name] = myclass + cls.cache[key] = myclass init = '__init__' src = 'def %s(self):\n' % init src += '\t%s.%s(self)\n' % (super.__name__,init)
update cache key in Factory to include class name
ovnicraft_suds2
train
py
2ab367f95b6d16056ea73bc4bd3000a83aa99fd3
diff --git a/salt/states/file.py b/salt/states/file.py index <HASH>..<HASH> 100644 --- a/salt/states/file.py +++ b/salt/states/file.py @@ -2539,7 +2539,7 @@ def line(name, content, match=None, mode=None, location=None, .. code-block: yaml - /etc/myconfig.conf + /etc/myconfig.conf: file.line: - mode: ensure - content: my key = my value
file.line state: add missing colon in docstring
saltstack_salt
train
py
9f98115871360e2ef2f7dbe601a68dd507c4bef4
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,15 @@ import sys import os -from distutils.core import setup, Extension -from distutils.command.clean import clean -from distutils.command.build_ext import build_ext -from distutils.command.install_data import install_data -from distutils.sysconfig import get_python_inc, get_python_lib +try: + from setuptools.core import setup, Extension + from setuptools.command.clean import clean + from setuptools.command.build_ext import build_ext + from setuptools.command.install_data import install_data +except ImportError: + from distutils.core import setup, Extension + from distutils.command.clean import clean + from distutils.command.build_ext import build_ext + from distutils.command.install_data import install_data def writeln(s): sys.stdout.write('%s\n' % s)
More fixes for Windows/Appveyor, Part 4c
aleaxit_gmpy
train
py
8736d74e555d7294761bc8e31c9020bda3160845
diff --git a/lib/veritas/relation/operation/order/direction_set.rb b/lib/veritas/relation/operation/order/direction_set.rb index <HASH>..<HASH> 100644 --- a/lib/veritas/relation/operation/order/direction_set.rb +++ b/lib/veritas/relation/operation/order/direction_set.rb @@ -90,8 +90,6 @@ module Veritas @directions = directions end - EMPTY = new([]) - # Return a direction set with only the attributes specified # # @example @@ -273,6 +271,8 @@ module Veritas memoize :reverse + EMPTY = new([]) + end # class DirectionSet end # class Order end # module Operation
Update DirectionSet so constant is declared at the bottom of the source
dkubb_axiom
train
rb
534a0300eb355e1fe6598f52860caa1104b01a28
diff --git a/Model/AuditReaderInterface.php b/Model/AuditReaderInterface.php index <HASH>..<HASH> 100644 --- a/Model/AuditReaderInterface.php +++ b/Model/AuditReaderInterface.php @@ -38,12 +38,4 @@ interface AuditReaderInterface * @param string $id */ public function findRevisions($className, $id); - - /** - * @param string $className - * @param int $id - * @param int $oldRevision - * @param int $newRevision - */ - public function diff($className, $id, $oldRevision, $newRevision); }
Undo add AuditReader diff method
sonata-project_SonataAdminBundle
train
php
9b013ea1b77fb0d3c16ed219bf41775b8b18f9ae
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -70,7 +70,8 @@ setup( 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', ), zip_safe=False, )
update setup.py with <I> support
singingwolfboy_flask-dance
train
py
9e681bce319c010162f92274ca5e1136f486e7c7
diff --git a/examples/react-web/src/chess/grid.js b/examples/react-web/src/chess/grid.js index <HASH>..<HASH> 100644 --- a/examples/react-web/src/chess/grid.js +++ b/examples/react-web/src/chess/grid.js @@ -84,6 +84,7 @@ export class Grid extends React.Component { onClick={this.onClick} onMouseOver={this.onMouseOver} onMouseOut={this.onMouseOut} + svgRef={this._svgRef} /> ); }
Fix examples (#<I>) * Fix examples * Remove plugin entirely
nicolodavis_boardgame.io
train
js
3e143d98af5d3a56ebda391a600e3a2b2bdc0ac5
diff --git a/src/TestSuite/Fixture/FixtureManager.php b/src/TestSuite/Fixture/FixtureManager.php index <HASH>..<HASH> 100644 --- a/src/TestSuite/Fixture/FixtureManager.php +++ b/src/TestSuite/Fixture/FixtureManager.php @@ -277,11 +277,13 @@ class FixtureManager { foreach ($dbs as $connection => $fixtures) { $db = ConnectionManager::get($connection, false); $db->transactional(function($db) use ($fixtures, $connection) { + $db->disableForeignKeys(); foreach ($fixtures as $f) { if (!empty($fixture->created) && in_array($connection, $fixture->created)) { $fixture->truncate($db); } } + $db->enableForeignKeys(); }); } }
Disable foreign keys when truncating tables. This fixes issues in MySQL where truncation cannot occur when tables have foreign keys.
cakephp_cakephp
train
php
8291119885223f00cc31eacb547b030216405ae0
diff --git a/ledgerautosync/sync.py b/ledgerautosync/sync.py index <HASH>..<HASH> 100644 --- a/ledgerautosync/sync.py +++ b/ledgerautosync/sync.py @@ -7,7 +7,9 @@ class Synchronizer(object): self.ledger = ledger def is_txn_synced(self, acctid, txn): - return (self.ledger.get_transaction("meta ofxid=%s.%s"%(acctid, txn.id)) != None) + ofxid = "%s.%s"%(acctid, txn.id) + ofxid = ofxid.replace('/', '\\/') + return (self.ledger.get_transaction("meta ofxid='%s'"%(ofxid)) != None) def filter(self, ofx): txns = ofx.account.statement.transactions
fix ledger search for crazy fitids
egh_ledger-autosync
train
py
22263e464a4654954f6a29838c24961826e24aee
diff --git a/tests/unit/io/JSONGraphFormatTest.py b/tests/unit/io/JSONGraphFormatTest.py index <HASH>..<HASH> 100644 --- a/tests/unit/io/JSONGraphFormatTest.py +++ b/tests/unit/io/JSONGraphFormatTest.py @@ -51,6 +51,14 @@ class JSONGraphFormatTest: 'pore.area', 'pore.volume'} assert pore_props.issubset(net.props()) + # Ensure correctness of pore properties + assert sp.array_equal(net['pore.area'], sp.array([0, 0])) + assert sp.array_equal(net['pore.index'], sp.array([0, 1])) + assert sp.array_equal(net['pore.volume'], sp.array([0, 0])) + assert sp.array_equal(net['pore.diameter'], sp.array([0, 0])) + assert sp.array_equal(net['pore.coords'][0], sp.array([0, 0, 0])) + assert sp.array_equal(net['pore.coords'][1], sp.array([1, 1, 1])) + if __name__ == '__main__': # All the tests in this file can be run with 'playing' this file
Ensure correctness of pore properties
PMEAL_OpenPNM
train
py
a9501e63ae3403eb2863d310c3ac79f2337b033d
diff --git a/openfisca_web_api/controllers/parameters.py b/openfisca_web_api/controllers/parameters.py index <HASH>..<HASH> 100644 --- a/openfisca_web_api/controllers/parameters.py +++ b/openfisca_web_api/controllers/parameters.py @@ -99,15 +99,16 @@ def api1_parameters(req): parameter_json['description'] = parameter_json_in_cache['description'] parameters_json.append(parameter_json) + response_dict = dict( + apiVersion = 1, + country_package_git_head_sha = environment.country_package_git_head_sha, + method = req.script_name, + parameters = parameters_json, + url = req.url.decode('utf-8'), + ) + if hasattr(tax_benefit_system, 'CURRENCY'): + response_dict['currency'] = tax_benefit_system.CURRENCY return wsgihelpers.respond_json(ctx, - collections.OrderedDict(sorted(dict( - apiVersion = 1, - country_package_git_head_sha = environment.country_package_git_head_sha, - currency = tax_benefit_system.CURRENCY, - method = req.script_name, - parameters = parameters_json, - # parameters_file_path = model.parameters_file_path, - url = req.url.decode('utf-8'), - ).iteritems())), + collections.OrderedDict(sorted(response_dict.iteritems())), headers = headers, )
Return currency only if tax benefit system supports it
openfisca_openfisca-web-api
train
py
aa96fcbc7724ccd0306b6df0b1aaa9f86aa1d507
diff --git a/src/core/lombok/core/AnnotationProcessor.java b/src/core/lombok/core/AnnotationProcessor.java index <HASH>..<HASH> 100644 --- a/src/core/lombok/core/AnnotationProcessor.java +++ b/src/core/lombok/core/AnnotationProcessor.java @@ -121,8 +121,6 @@ public class AnnotationProcessor extends AbstractProcessor { } static class EcjDescriptor extends ProcessorDescriptor { - private Processor processor; - @Override String getName() { return "ECJ"; } @@ -137,7 +135,7 @@ public class AnnotationProcessor extends AbstractProcessor { } @Override boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { - return processor.process(annotations, roundEnv); + return false; } }
Whoops, ecj was broken due to half work on a previous commit to take ecj annotation processing offline.
rzwitserloot_lombok
train
java
550df4244a8cf0db1cfe3c997874286651551eb2
diff --git a/spec/agent_spec.rb b/spec/agent_spec.rb index <HASH>..<HASH> 100644 --- a/spec/agent_spec.rb +++ b/spec/agent_spec.rb @@ -223,6 +223,7 @@ describe Instrumental::Agent, "enabled" do 5.times do |i| @agent.increment('overflow_test', i + 1, 300) end + @agent.instance_variable_get(:@queue).size.should == 0 wait # let the server receive the commands @server.commands.should include("increment overflow_test 1 300") @server.commands.should include("increment overflow_test 2 300")
correctly check queue is empty after sending sync commands
Instrumental_instrumental_agent-ruby
train
rb
c2abcdf94b69a83c4b2536d5fdeac08426c6bd69
diff --git a/src/ScayTrase/StoredFormsBundle/Form/Type/ChoiceFieldType.php b/src/ScayTrase/StoredFormsBundle/Form/Type/ChoiceFieldType.php index <HASH>..<HASH> 100644 --- a/src/ScayTrase/StoredFormsBundle/Form/Type/ChoiceFieldType.php +++ b/src/ScayTrase/StoredFormsBundle/Form/Type/ChoiceFieldType.php @@ -16,6 +16,9 @@ class ChoiceFieldType extends AbstractFieldType { parent::buildForm($builder, $options); + $builder->add('multiple', 'checkbox', array('required' => false)); + $builder->add('expanded', 'checkbox', array('required' => false)); + $builder->add( 'choices', 'key_value_collection',
required, multiple, extended fields at configuration form
nemesis-platform_persistent-forms
train
php
d0d53322c9ef5ce6389f2b8b2edfc48520889785
diff --git a/cherrypy/_cplogging.py b/cherrypy/_cplogging.py index <HASH>..<HASH> 100644 --- a/cherrypy/_cplogging.py +++ b/cherrypy/_cplogging.py @@ -109,9 +109,6 @@ the "log.error_file" config entry, for example). import datetime import logging -# Silence the no-handlers "warning" (stderr write!) in stdlib logging -logging.Logger.manager.emittedNoHandlerWarning = 1 -logfmt = logging.Formatter("%(message)s") import os import sys @@ -122,6 +119,11 @@ from cherrypy import _cperror from cherrypy._cpcompat import ntob +# Silence the no-handlers "warning" (stderr write!) in stdlib logging +logging.Logger.manager.emittedNoHandlerWarning = 1 +logfmt = logging.Formatter("%(message)s") + + class NullHandler(logging.Handler): """A no-op logging handler to silence the logging.lastResort handler."""
Fix E<I> in _cplogging
cherrypy_cheroot
train
py
136ca7c87decaa7d028267d69a1d6ed877a32106
diff --git a/lib/navigationlib.php b/lib/navigationlib.php index <HASH>..<HASH> 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1473,7 +1473,6 @@ class global_navigation extends navigation_node { protected function load_for_user($user=null, $forceforcontext=false) { global $DB, $CFG, $USER; - $iscurrentuser = false; if ($user === null) { // We can't require login here but if the user isn't logged in we don't // want to show anything @@ -1481,11 +1480,13 @@ class global_navigation extends navigation_node { return false; } $user = $USER; - $iscurrentuser = true; } else if (!is_object($user)) { // If the user is not an object then get them from the database $user = $DB->get_record('user', array('id'=>(int)$user), '*', MUST_EXIST); } + + $iscurrentuser = ($user->id == $USER->id); + $usercontext = get_context_instance(CONTEXT_USER, $user->id); // Get the course set against the page, by default this will be the site
NOBUG: Tidied up coding style in navigationlib
moodle_moodle
train
php
ab507a68859341533b16df0cf0952c4082547af8
diff --git a/spec/call/call_spec.rb b/spec/call/call_spec.rb index <HASH>..<HASH> 100644 --- a/spec/call/call_spec.rb +++ b/spec/call/call_spec.rb @@ -46,4 +46,22 @@ describe EvalHook::HookHandler, "hook handler hooks" do }.should_not raise_error end end + + class XDefinedOutside56 + def method_missing(name, param1) + name + end + end + XDefinedOutside56_ins = XDefinedOutside56.new + + context "when there is method_missing defined (two arguments)" do + it "shouldn't raise NoMethodError when trying to call a public method NOT defined" do + hh = EvalHook::HookHandler.new + lambda { + hh.evalhook(" + XDefinedOutside56_ins.foo(1) + ", binding).should be == :foo + }.should_not raise_error + end + end end \ No newline at end of file
<I> failing test: method missing with one argument
tario_evalhook
train
rb
b88ed75b951452bac7c088342a7333134dc1bda1
diff --git a/lib/zss/service.rb b/lib/zss/service.rb index <HASH>..<HASH> 100644 --- a/lib/zss/service.rb +++ b/lib/zss/service.rb @@ -115,19 +115,18 @@ module ZSS def handle_request(message) start_time = Time.now.utc + log.info("Handle request for #{message.address}", request_metadata(message)) log.trace("Request message:\n #{message}") if log.is_debug - if message.address.sid != sid - error = Error[404] - error.developer_message = "Invalid SID: #{message.address.sid}!" - fail error - end + check_sid!(message.address.sid) # the router returns an handler that receives payload and headers handler = router.get(message.address.verb) + message.payload = handler.call(message.payload, message.headers) message.headers["zss-response-time"] = get_time(start_time) + reply message end @@ -166,6 +165,14 @@ module ZSS log.error("An Error ocurred while sending message", request_metadata(message)) unless success end + def check_sid!(message_sid) + return unless message_sid != sid + + error = Error[404] + error.developer_message = "Invalid SID: #{message_sid}!" + fail error + end + def metadata(metadata = {}) metadata ||= {} metadata[:sid] = sid
refactor sid validation on request
micro-toolkit_zmq-service-suite-ruby
train
rb
54a20cf9b461d2c265e87bbbb55351d34b0c1382
diff --git a/wepay.php b/wepay.php index <HASH>..<HASH> 100755 --- a/wepay.php +++ b/wepay.php @@ -80,7 +80,7 @@ class WePay { 'state' => empty($options['state']) ? '' : $options['state'], 'user_name' => empty($options['user_name']) ? '' : $options['user_name'], 'user_email' => empty($options['user_email']) ? '' : $options['user_email'], - )); + ), '', '&'); return $uri; }
Specify $arg_separator in http_build_query() It defaults to arg_separator.output which may not be understood by WePay servers. This parameter is available since PHP <I>, I'm not sure what's the minimum PHP version supported by the SDK.
wepay_PHP-SDK
train
php
b32463b14928efee342386604d662c31b5a7e935
diff --git a/pypyscrypt.py b/pypyscrypt.py index <HASH>..<HASH> 100755 --- a/pypyscrypt.py +++ b/pypyscrypt.py @@ -56,11 +56,8 @@ def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64): N, r, p must be positive """ - def array_overwrite(source, source_start, dest, dest_start, length): - '''Overwrites the dest array with the source array.''' - - for i in xrange(0, length): - dest[dest_start + i] = source[source_start + i] + def array_overwrite(source, s_start, dest, d_start, length): + dest[d_start:d_start + length] = source[s_start:s_start + length] def blockxor(source, source_start, dest, dest_start, length):
Use slicing for array overwrite Improves overall speed by ~<I>%.
jvarho_pylibscrypt
train
py
52889eff9b6ded4a09096e339c0227ca9be8fab1
diff --git a/abydos/fingerprint.py b/abydos/fingerprint.py index <HASH>..<HASH> 100644 --- a/abydos/fingerprint.py +++ b/abydos/fingerprint.py @@ -719,8 +719,8 @@ def synoname_toolcode(lname, fname='', qual='', normalize=0): loc = full_name.find(extra) if loc != -1: toolcode[7] += '{:03d}'.format(num) + 'X' - if full_name[loc + len(extra)] not in toolcode[9]: - toolcode[9] += full_name[loc + len(match)] + if full_name[loc:loc+len(extra)] not in toolcode[9]: + toolcode[9] += full_name[loc:loc+len(match)] return lname, fname, ''.join(toolcode)
BUG: fixed another case of taking a char instead of a slice
chrislit_abydos
train
py
4a1cf7d8b223938aa6339efbeb4fb9d899b50981
diff --git a/tutum/stream.go b/tutum/stream.go index <HASH>..<HASH> 100644 --- a/tutum/stream.go +++ b/tutum/stream.go @@ -94,6 +94,7 @@ func messagesHandler(ws *websocket.Conn, ticker *time.Ticker, msg Event, c chan log.Println("READ ERR") ticker.Stop() e <- err + return } if reflect.TypeOf(msg).String() == "tutum.Event" {
break loop when websocket fails to be read
tutumcloud_go-tutum
train
go
eab66b5a0c700a9415dcb5aee763179f0eb42dd7
diff --git a/OpenPNM/Base/__Controller__.py b/OpenPNM/Base/__Controller__.py index <HASH>..<HASH> 100644 --- a/OpenPNM/Base/__Controller__.py +++ b/OpenPNM/Base/__Controller__.py @@ -295,6 +295,9 @@ class Controller(dict): self[net.name] = net else: raise Exception('Simulation with that name is already present') + for item in net._phases + net._physics + net._geometries: + if item.name not in self.keys(): + self[item.name] = item def save(self, filename=''): r"""
Fixed bug in load_simulation where sub-objects were not being regisistered with the controller
PMEAL_OpenPNM
train
py
b2190fc5404129b6aa775f5f99460d6772a5a6c2
diff --git a/warehouse/search/__init__.py b/warehouse/search/__init__.py index <HASH>..<HASH> 100644 --- a/warehouse/search/__init__.py +++ b/warehouse/search/__init__.py @@ -42,8 +42,8 @@ def includeme(config): [urllib.parse.urlunparse(p[:2] + ("",) * 4)], verify_certs=True, ca_certs=certifi.where(), - timeout=30, - retry_on_timeout=True, + timeout=1, + retry_on_timeout=False, serializer=serializer.serializer, ) config.registry["elasticsearch.index"] = p.path.strip("/")
be aggressive in timeouts/retries with Elasticsearch (#<I>)
pypa_warehouse
train
py
ac1effeb41a0eff711a4427542eb4327477a551c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,6 @@ setup( version=__version__, url="https://github.com/alice1017/watcher", description="The watcher can monitoring the file modification.", - long_description=open("README.md").read(), py_modules=['watcher'], classifiers=[ "Development Status :: 4 - Beta",
Setup script not supported markdown.
alice1017_mdfmonitor
train
py
3ca8ce07a6c4f456cc70fe5c23b6f9f253c4d027
diff --git a/examples/with-segment-analytics/pages/_app.js b/examples/with-segment-analytics/pages/_app.js index <HASH>..<HASH> 100644 --- a/examples/with-segment-analytics/pages/_app.js +++ b/examples/with-segment-analytics/pages/_app.js @@ -24,7 +24,10 @@ function MyApp({ Component, pageProps }) { return ( <Page> {/* Inject the Segment snippet into the <head> of the document */} - <Script dangerouslySetInnerHTML={{ __html: renderSnippet() }} /> + <Script + id="segment-script" + dangerouslySetInnerHTML={{ __html: renderSnippet() }} + /> <Component {...pageProps} /> </Page> )
Add id to inline Segment script (#<I>) When I don't include an `id`, I see the console error "VM<I>:1 Segment snippet included twice." According to <URL>
zeit_next.js
train
js
c2b702f8474c42ba56eaf18548dbab4d271f13cd
diff --git a/lib/list_matcher.rb b/lib/list_matcher.rb index <HASH>..<HASH> 100644 --- a/lib/list_matcher.rb +++ b/lib/list_matcher.rb @@ -159,7 +159,9 @@ module List def best_prefix(list) acceptable = nil - (1..list.map(&:size).min).each do |l| + sizes = list.map(&:size) + lim = sizes.uniq.count == 1 ? list[0].size - 1 : sizes.min + (1..lim).each do |l| c = {} list.each do |w| pfx = w[0...l] @@ -178,7 +180,9 @@ module List def best_suffix(list) acceptable = nil - (1..list.map(&:size).min).each do |l| + sizes = list.map(&:size) + lim = sizes.uniq.count == 1 ? list[0].size - 1 : sizes.min + (1..lim).each do |l| c = {} list.each do |w| i = w.length - l
fixed bug when all items in list are same size
dfhoughton_list_matcher
train
rb
f8a3e90180f3abb7cbbe9068d7a81af3750fcfc9
diff --git a/spec/medie_spec.rb b/spec/medie_spec.rb index <HASH>..<HASH> 100644 --- a/spec/medie_spec.rb +++ b/spec/medie_spec.rb @@ -5,15 +5,28 @@ class Always true end end +class Never + def can_handle?(response) + false + end +end describe Medie do it "should return acceptable registries" do - always = Always.new - registry = Medie::Registry.new.use(always) - registry.for("anything").should == always + handler = Always.new + registry = Medie::Registry.new.use(handler) + registry.for("anything").should == handler end + + it "should return nil if there is no handler available" do + + registry = Medie::Registry.new.use(Never.new) + registry.for("anything").should be_nil + + end + end
supports nil if not found
caelum_medie
train
rb
aaddeae699dd922547a2560aa207bd4b5256a807
diff --git a/packages/veritone-widgets/src/widgets/UserProfile/index.js b/packages/veritone-widgets/src/widgets/UserProfile/index.js index <HASH>..<HASH> 100644 --- a/packages/veritone-widgets/src/widgets/UserProfile/index.js +++ b/packages/veritone-widgets/src/widgets/UserProfile/index.js @@ -89,7 +89,8 @@ export class UserProfile extends React.Component { resetUserPassword: func.isRequired, updateCurrentUserProfile: func.isRequired, invalid: bool, - pristine: bool + pristine: bool, + submitting: bool }; state = { @@ -247,7 +248,9 @@ export class UserProfile extends React.Component { open={this.state.currentModal === 'changeName'} onConfirm={this.submitChanges} onCancel={this.cancelChanges} - disableConfirm={this.props.invalid || this.props.pristine} + disableConfirm={ + this.props.invalid || this.props.pristine || this.props.submitting + } /> <ResetPasswordModal
disable submit button while waiting for network response
veritone_veritone-sdk
train
js
496cfa85729a73fb5807a7e217c2a7d6ad395d37
diff --git a/src/basis/dragdrop.js b/src/basis/dragdrop.js index <HASH>..<HASH> 100644 --- a/src/basis/dragdrop.js +++ b/src/basis/dragdrop.js @@ -44,7 +44,7 @@ } function startDrag(event){ - if (dragElement) + if (dragElement || this.ignoreTarget(event.sender, event)) return; // Some browsers (IE, Opera) wrongly fires mousedown event on scrollbars, @@ -149,6 +149,9 @@ axisYproxy: basis.fn.$self, startRule: basis.fn.$true, + ignoreTarget: function(target, event){ + return /^(INPUT|TEXTAREA|SELECT|BUTTON)$/.test(target.tagName); + }, prepareDrag: function(){}, emit_start: createEvent('start'), // occure on first mouse move
dragdrop: implement DragDropElement#ignoreTarget by default don't init d&d if event target is <input>, <textarea>, <select> and <button> element
basisjs_basisjs
train
js
32f2c236cec805d80fb3a3b5a12cb0258a1276f0
diff --git a/mbed/mbed.py b/mbed/mbed.py index <HASH>..<HASH> 100644 --- a/mbed/mbed.py +++ b/mbed/mbed.py @@ -2434,10 +2434,10 @@ def config_(var=None, value=None, global_cfg=False, unset=False, list_config=Fal else: # Find the root of the program program = Program(os.getcwd()) - if program.is_cwd: + if program.is_cwd and not var == 'ROOT': error( "Could not find mbed program in current path \"%s\".\n" - "Change the current directory to a valid mbed program or use the '--global' option to set global configuration." % program.path) + "Change the current directory to a valid mbed program, set the current directory as an mbed program with 'mbed config root .', or use the '--global' option to set global configuration." % program.path) with cd(program.path): if unset: program.set_cfg(var, None)
Allowing root directory configuration to happen in an unknown project directory
ARMmbed_mbed-cli
train
py
29fa48d8c31a9bb8828a7931df243412b65eef83
diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index <HASH>..<HASH> 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -24,15 +24,15 @@ Object.assign(app, { return Menu.getApplicationMenu() }, commandLine: { - appendSwitch() { - let castedArgs = [...arguments].map((arg) => { + appendSwitch (...args) { + const castedArgs = args.map((arg) => { return typeof arg !== 'string' ? `${arg}` : arg }) return binding.appendSwitch(...castedArgs) }, - appendArgument() { - let castedArgs = [...arguments].map((arg) => { + appendArgument (...args) { + const castedArgs = [...arguments].map((arg) => { return typeof arg !== 'string' ? `${arg}` : arg })
:wrench: Ensure correct types for commandLine This commit ensures that arguments passed to `appendSwitch` and `appendArgument` are turned into strings before passing them over to the binding.
electron_electron
train
js
71285d4dfde9e75b0ff5855d7acabdbcf964e2a8
diff --git a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/deploymentscanner/ScannerView.java b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/deploymentscanner/ScannerView.java index <HASH>..<HASH> 100644 --- a/gui/src/main/java/org/jboss/as/console/client/shared/subsys/deploymentscanner/ScannerView.java +++ b/gui/src/main/java/org/jboss/as/console/client/shared/subsys/deploymentscanner/ScannerView.java @@ -66,6 +66,8 @@ public class ScannerView extends AbstractEntityView<DeploymentScanner> implement form.setFields(formMetaData.findAttribute("name").getFormItemForAdd(), formMetaData.findAttribute("path").getFormItemForAdd(), formMetaData.findAttribute("relativeTo").getFormItemForAdd(), + formMetaData.findAttribute("scanInterval").getFormItemForAdd(), + formMetaData.findAttribute("deploymentTimeout").getFormItemForAdd(), formMetaData.findAttribute("enabled").getFormItemForAdd()); return form; }
Add FormItems to add dialog so that defaults will work correctly.
hal_core
train
java
e2bc9727500584e055ce603bf95f00165c657ec2
diff --git a/lib/py/src/transport/TTransport.py b/lib/py/src/transport/TTransport.py index <HASH>..<HASH> 100644 --- a/lib/py/src/transport/TTransport.py +++ b/lib/py/src/transport/TTransport.py @@ -169,7 +169,6 @@ class TBufferedTransport(TTransportBase, CReadableTransport): # on exception reset wbuf so it doesn't contain a partial function call self.__wbuf = BufferIO() raise e - self.__wbuf.getvalue() def flush(self): out = self.__wbuf.getvalue()
THRIFT-<I> remove useless code cause performance problem Client: python This closes #<I>
limingxinleo_thrift
train
py
41e41de41b8821b6889d4cdb3d5f4e1d0d609293
diff --git a/app/models/abstract.js b/app/models/abstract.js index <HASH>..<HASH> 100644 --- a/app/models/abstract.js +++ b/app/models/abstract.js @@ -42,7 +42,7 @@ export default Model.extend(UserSession, EmberValidations, { this._super(options).then(function(results) { Ember.run(null, resolve, results); }, function(error) { - if (options.retry) { + if (!Ember.isEmpty(options) && options.retry) { //We failed on the second attempt to save the record, so reject the save. Ember.run(null, reject, error); } else {
Fixed issue retrying save.
HospitalRun_hospitalrun-frontend
train
js
f18335b90d4d6cbc7e2e8f5d4e12b30d7ba1d38d
diff --git a/js/cryptopia.js b/js/cryptopia.js index <HASH>..<HASH> 100644 --- a/js/cryptopia.js +++ b/js/cryptopia.js @@ -88,10 +88,12 @@ module.exports = class cryptopia extends Exchange { const currencies = { 'ACC': 'AdCoin', 'CC': 'CCX', + 'CMT': 'Comet', 'FCN': 'Facilecoin', 'NET': 'NetCoin', 'BTG': 'Bitgem', 'FUEL': 'FC2', // FuelCoin != FUEL + 'QBT': 'Cubits', 'WRC': 'WarCoin', }; if (currency in currencies) @@ -103,6 +105,8 @@ module.exports = class cryptopia extends Exchange { const currencies = { 'AdCoin': 'ACC', 'CCX': 'CC', + 'Comet': 'CMT', + 'Cubits': 'QBT', 'Facilecoin': 'FCN', 'NetCoin': 'NET', 'Bitgem': 'BTG',
cryptopia QBT → Cubits, CMT → Comet fix #<I>
ccxt_ccxt
train
js
0d682cf12dd7998d6034a78baf427fdd08506357
diff --git a/omemo/implementations/jsonfilestorage.py b/omemo/implementations/jsonfilestorage.py index <HASH>..<HASH> 100644 --- a/omemo/implementations/jsonfilestorage.py +++ b/omemo/implementations/jsonfilestorage.py @@ -59,7 +59,7 @@ class JSONFileStorage(Storage): @staticmethod def getHashForBareJID(bare_jid): - digest = hashlib.sha256(bare_jid.encode("US-ASCII")).digest() + digest = hashlib.sha256(bare_jid.encode("UTF-8")).digest() return base64.b32encode(digest).decode("US-ASCII")
JSONFileStorage: Prevent from choking on non-ascii characters in JIDs
Syndace_python-omemo
train
py
ae1a0230b0276fbc91985a30dfd7e75fe710ec08
diff --git a/lib/respec.js b/lib/respec.js index <HASH>..<HASH> 100644 --- a/lib/respec.js +++ b/lib/respec.js @@ -28,7 +28,7 @@ } ReSpec.RE = { variable: /^(\w+)([+*?])?$/, - templates: /(?:\\(?:\\\\)*`)|`\s*(\w+[+*?]?)\s*`/g, + templates: /\\(?:\\\\)*{|{\s*(\w+[+*?]?)\s*}/g, countParen: /(?:\\(?:\\\\)*\()|(\((?!\?))/g }; ReSpec.defaultOptions = ReMix.defaultOptions;
{} makes more sense for enclosing vars in a regex structure and it matches what lexx does
bline_remix
train
js
8ba113ffef1a6f3ca65bbab6964aa13c140ca572
diff --git a/lib/veritas/relation/operation/order/direction_set.rb b/lib/veritas/relation/operation/order/direction_set.rb index <HASH>..<HASH> 100644 --- a/lib/veritas/relation/operation/order/direction_set.rb +++ b/lib/veritas/relation/operation/order/direction_set.rb @@ -12,7 +12,7 @@ module Veritas end def reverse - self.class.new(map { |direction| direction.reverse }) + new(map { |direction| direction.reverse }) end def each(&block) @@ -25,7 +25,7 @@ module Veritas end def union(other) - self.class.new(to_ary | other.to_ary) + new(to_ary | other.to_ary) end alias | union @@ -58,6 +58,10 @@ module Veritas private + def new(directions) + self.class.new(directions) + end + def cmp_tuples(left, right) each do |direction| cmp = direction.call(left, right)
Refactored common initialization code in DirectionSet
dkubb_axiom
train
rb
714948da828f9650ab2d30abfe9d19222fa0bca1
diff --git a/worker/buildbot_worker/test/unit/test_scripts_create_slave.py b/worker/buildbot_worker/test/unit/test_scripts_create_slave.py index <HASH>..<HASH> 100644 --- a/worker/buildbot_worker/test/unit/test_scripts_create_slave.py +++ b/worker/buildbot_worker/test/unit/test_scripts_create_slave.py @@ -595,8 +595,8 @@ class TestCreateSlave(misc.LoggingMixin, unittest.TestCase): logfile_mock) # mock Worker class - buildslave_mock = mock.Mock() - buildslave_class_mock = mock.Mock(return_value=buildslave_mock) + worker_mock = mock.Mock() + buildslave_class_mock = mock.Mock(return_value=worker_mock) self.patch(buildbot_worker.bot, "Worker", buildslave_class_mock) expected_tac_contents = \ @@ -625,7 +625,7 @@ class TestCreateSlave(misc.LoggingMixin, unittest.TestCase): allow_shutdown=options["allow-shutdown"]) # check that Worker instance attached to application - self.assertEqual(buildslave_mock.method_calls, + self.assertEqual(worker_mock.method_calls, [mock.call.setServiceParent(application_mock)]) # .tac file must define global variable "application", instance of
rename local buildslave_mock -> worker_mock
buildbot_buildbot
train
py
d621cc56b60aa9c78ad34b568faeeda9cd5211db
diff --git a/Command/PlatformInstallCommand.php b/Command/PlatformInstallCommand.php index <HASH>..<HASH> 100644 --- a/Command/PlatformInstallCommand.php +++ b/Command/PlatformInstallCommand.php @@ -18,6 +18,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Logger\ConsoleLogger; use Symfony\Component\Console\Output\OutputInterface; +use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand; /** * Performs a fresh installation of the platform based on bundles listed @@ -41,6 +42,9 @@ class PlatformInstallCommand extends ContainerAwareCommand protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln(sprintf('<comment>%s - Installing the platform...</comment>', date('H:i:s'))); + $databaseCreator = new CreateDatabaseDoctrineCommand(); + $databaseCreator->setContainer($this->getContainer()); + $databaseCreator->run(new ArrayInput(array()), $output); $verbosityLevelMap = array( LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
claroline:install runs doctrine:database:create
claroline_CoreBundle
train
php
66ec98eca5b69167089b383848b1ab0e856bac9c
diff --git a/Entity/ThemeCssInterface.php b/Entity/ThemeCssInterface.php index <HASH>..<HASH> 100644 --- a/Entity/ThemeCssInterface.php +++ b/Entity/ThemeCssInterface.php @@ -12,7 +12,7 @@ namespace WellCommerce\Bundle\ThemeBundle\Entity; -use WellCommerce\Bundle\AppBundle\Entity\TimestampableInterface; +use WellCommerce\Bundle\CoreBundle\Entity\TimestampableInterface; /** * Interface ThemeCssInterface diff --git a/Entity/ThemeInterface.php b/Entity/ThemeInterface.php index <HASH>..<HASH> 100644 --- a/Entity/ThemeInterface.php +++ b/Entity/ThemeInterface.php @@ -13,8 +13,8 @@ namespace WellCommerce\Bundle\ThemeBundle\Entity; use Doctrine\Common\Collections\Collection; -use WellCommerce\Bundle\AppBundle\Entity\BlameableInterface; -use WellCommerce\Bundle\AppBundle\Entity\TimestampableInterface; +use WellCommerce\Bundle\UserBundle\Entity\BlameableInterface; +use WellCommerce\Bundle\CoreBundle\Entity\TimestampableInterface; /** * Interface ThemeInterface
AppBundle fixes (cherry picked from commit 2cd8a<I>e4ffa<I>ba<I>c6a8d<I>d<I>cb1a<I>df7)
WellCommerce_WishlistBundle
train
php,php
55fb1a39259bf99107c6bb4edf430d6050a6e075
diff --git a/lib/tasque/configuration.rb b/lib/tasque/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/tasque/configuration.rb +++ b/lib/tasque/configuration.rb @@ -41,6 +41,7 @@ module Tasque attr_accessor :worker attr_accessor :heartbeat attr_accessor :heartbeat_interval + attr_accessor :heartbeat_payload attr_accessor :notify def initialize @@ -51,6 +52,7 @@ module Tasque self.progress_interval = 5 # seconds self.heartbeat = false self.heartbeat_interval = 10 # seconds + self.heartbeat_payload = {} self.notify = false end diff --git a/lib/tasque/processor.rb b/lib/tasque/processor.rb index <HASH>..<HASH> 100644 --- a/lib/tasque/processor.rb +++ b/lib/tasque/processor.rb @@ -61,7 +61,7 @@ module Tasque message = { worker: Tasque.config.worker, busy: !@current_job.nil? - } + }.merge(Tasque.config.heartbeat_payload) Insque.broadcast :heartbeat, message end loop do diff --git a/lib/tasque/version.rb b/lib/tasque/version.rb index <HASH>..<HASH> 100644 --- a/lib/tasque/version.rb +++ b/lib/tasque/version.rb @@ -1,3 +1,3 @@ module Tasque - VERSION = "0.0.4" + VERSION = "0.0.5" end
Configuration: heartbeat_payload added
Gropher_tasque
train
rb,rb,rb