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 |
|---|---|---|---|---|---|
b386cbb0be86333c9de54cc37528a958278219be | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -6,5 +6,5 @@ setup(name='cleverhans',
version='1.0.0',
url='https://github.com/openai/cleverhans',
license='MIT',
- install_requires=['keras', 'nose', 'pycodestyle', 'theano'],
+ install_requires=['keras==1.2', 'nose', 'pycodestyle', 'theano'],
packages=find_packages()) | Specify Keras version in dependencies
To allow Travis to pass tests before we address #<I> | tensorflow_cleverhans | train | py |
aefcf6b724ddf7b4283cdcd81f328b216728ec31 | diff --git a/lib/active_scaffold/actions/update.rb b/lib/active_scaffold/actions/update.rb
index <HASH>..<HASH> 100644
--- a/lib/active_scaffold/actions/update.rb
+++ b/lib/active_scaffold/actions/update.rb
@@ -69,7 +69,7 @@ module ActiveScaffold::Actions
@updated_record = @record
# get_row so associations are cached like in list action
# if record doesn't fullfil current conditions remove it from list
- @record = get_row
+ get_row
rescue ActiveRecord::RecordNotFound
nil
end | get_row sets @record, just call it is enough | activescaffold_active_scaffold | train | rb |
0da964435445bcddcb1fecf55283bcf7e347a509 | diff --git a/src/ruby/tools/platform_check.rb b/src/ruby/tools/platform_check.rb
index <HASH>..<HASH> 100644
--- a/src/ruby/tools/platform_check.rb
+++ b/src/ruby/tools/platform_check.rb
@@ -43,14 +43,11 @@ module PLATFORM
end
end
- # The 'host_cpu' value on x86, 32-bit rubies, appears to turn out to
- # be the name of the cpu. Only need to know the architecture,
- # so enumerating x86 cpu's here.
def PLATFORM.architecture
- case RbConfig::CONFIG['host_cpu']
+ case RbConfig::CONFIG['target_cpu']
when /x86_64/
'x86_64'
- when /x86|i386|i486|i586|i686|i786/
+ when /x86|i386/
'x86'
else
fail 'cpu architecture detection failed' | use target cpu to get rid of cpu enumerations | grpc_grpc | train | rb |
4cce0d10d6ce358dd52d42a2c1536f4523e704bb | diff --git a/mangooio-core/src/main/java/io/mangoo/routing/handlers/DispatcherHandler.java b/mangooio-core/src/main/java/io/mangoo/routing/handlers/DispatcherHandler.java
index <HASH>..<HASH> 100644
--- a/mangooio-core/src/main/java/io/mangoo/routing/handlers/DispatcherHandler.java
+++ b/mangooio-core/src/main/java/io/mangoo/routing/handlers/DispatcherHandler.java
@@ -82,7 +82,7 @@ public class DispatcherHandler implements HttpHandler {
try {
this.method = Application.getInstance(this.controllerClass)
.getClass()
- .getMethod(this.controllerMethodName, this.methodParameters.values().toArray(new Class[0]));
+ .getDeclaredMethod(this.controllerMethodName, this.methodParameters.values().toArray(new Class[0]));
for (Annotation annotation : this.method.getAnnotations()) {
if (annotation.annotationType().equals(FilterWith.class)) {
@@ -184,4 +184,4 @@ public class DispatcherHandler implements HttpHandler {
private void nextHandler(HttpServerExchange exchange) throws Exception {
Application.getInstance(LimitHandler.class).handleRequest(exchange);
}
-}
\ No newline at end of file
+} | Get Declared Method to support inheritence
.getMethod does not return inherited methods, preventing the usage of inheritance in controllers.
Currently can be bypassed by implementing the method in both and calling super, but not exactly convenient | svenkubiak_mangooio | train | java |
8df2ac687c9383e090cb6068edc20e800a27281c | diff --git a/src/pyiso/pyiso.py b/src/pyiso/pyiso.py
index <HASH>..<HASH> 100644
--- a/src/pyiso/pyiso.py
+++ b/src/pyiso/pyiso.py
@@ -82,8 +82,8 @@ class FileOrTextIdentifier(object):
raise PyIsoException("This File or Text identifier is already initialized")
self.text = ident_str
- # FIXME: we do not support a file identifier here. In the future, we might
- # want to implement this.
+ # FIXME: we do not support a file identifier here. In the future, we
+ # might want to implement this.
self.initialized = True
@@ -2364,8 +2364,8 @@ class PyIso(object):
if not self.initialized:
raise PyIsoException("This object is not yet initialized; call either open() or new() to create an ISO")
- # FIXME: what if the rock ridge, iso, and joliet paths don't agree on the
- # number of subdirectories?
+ # FIXME: what if the rock ridge and iso paths don't agree on the number
+ # of subdirectories?
rr_name = None
if self.rock_ridge:
@@ -2432,7 +2432,7 @@ class PyIso(object):
if not self.initialized:
raise PyIsoException("This object is not yet initialized; call either open() or new() to create an ISO")
- # FIXME: what if the rock ridge, iso, and joliet paths don't agree on the
+ # FIXME: what if the rock ridge and iso paths don't agree on the
# number of subdirectories?
rr_name = None | Clean up some FIXME comments. | clalancette_pycdlib | train | py |
398653996be98561b6e1766a85a0d26122c66e44 | diff --git a/lib/dm-core/adapters/oracle_adapter.rb b/lib/dm-core/adapters/oracle_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/dm-core/adapters/oracle_adapter.rb
+++ b/lib/dm-core/adapters/oracle_adapter.rb
@@ -114,8 +114,8 @@ module DataMapper
# if a unique property is used, and there is no OR operator, then an ORDER
# and LIMIT are unecessary because it should only return a single row
if conditions.kind_of?(Query::Conditions::AndOperation) &&
- conditions.any? { |o| o.kind_of?(Query::Conditions::EqualToComparison) && o.property.unique? } &&
- !conditions.any? { |o| o.kind_of?(Query::Conditions::OrOperation) }
+ conditions.any? { |operand| operand.kind_of?(Query::Conditions::EqualToComparison) && operand.subject.respond_to?(:unique?) && operand.subject.unique? } &&
+ !conditions.any? { |operand| operand.kind_of?(Query::Conditions::OrOperation) }
order = nil
limit = nil
end | replaced property with subject for operands | datamapper_dm-core | train | rb |
517b0a096e2e44ffe952a9484fc9d32b9b52dc24 | diff --git a/tests/jenkins-ng.py b/tests/jenkins-ng.py
index <HASH>..<HASH> 100755
--- a/tests/jenkins-ng.py
+++ b/tests/jenkins-ng.py
@@ -603,7 +603,10 @@ def build_ssh_command(options, *arguments, **parameters):
return cmd + list(arguments)
-def build_scp_command(options, *parameters):
+def build_scp_command(options, *arguments):
+ '''
+ Build the SCP command with the required options
+ '''
return [
'scp',
'-i',
@@ -614,7 +617,7 @@ def build_scp_command(options, *parameters):
'-oUserKnownHostsFile=/dev/null',
# Don't re-use the SSH connection. Less failures.
'-oControlPath=none',
- ] + parameters
+ ] + list(arguments)
def main(): | We can only concatenate lists, not list + tuple | saltstack_salt | train | py |
8f960ccfc5853ed361ff62162a7e8260fa1e0d28 | diff --git a/cmd/juju/action/common.go b/cmd/juju/action/common.go
index <HASH>..<HASH> 100644
--- a/cmd/juju/action/common.go
+++ b/cmd/juju/action/common.go
@@ -166,7 +166,8 @@ func (c *runCommandBase) processOperationResults(ctx *cmd.Context, results *acti
the following task%s failed:
%s
-`[1:], plural, strings.Join(list, "\n"))
+use 'juju show-task' to inspect the failure%s
+`[1:], plural, strings.Join(list, "\n"), plural)
}
return nil
}
diff --git a/cmd/juju/action/exec_test.go b/cmd/juju/action/exec_test.go
index <HASH>..<HASH> 100644
--- a/cmd/juju/action/exec_test.go
+++ b/cmd/juju/action/exec_test.go
@@ -396,6 +396,7 @@ func (s *ExecSuite) TestAllMachinesWithError(c *gc.C) {
- id "1" with return code 2
- id "2" with return code 1
+use 'juju show-task' to inspect the failures
`)
c.Check(cmdtesting.Stdout(context), gc.Equals, `
@@ -707,6 +708,7 @@ Waiting for task 1...
the following task failed:
- id "1" with return code 42
+use 'juju show-task' to inspect the failure
`[1:]
for i, test := range []struct { | Actions: Improve error message
Give hints about where to go next if there was a failure. This just
improves juju usability. | juju_juju | train | go,go |
aec0a5538aed0ca493c0aeaddcd3e301a64cb391 | diff --git a/pr-tagger.js b/pr-tagger.js
index <HASH>..<HASH> 100755
--- a/pr-tagger.js
+++ b/pr-tagger.js
@@ -108,4 +108,6 @@ ghauth(authOptions, function (error, authData) {
})
}
})
+
+ logger.info('Done!')
}) | Add log message to let user know when script is finished | jcollado_pr-tagger | train | js |
c9d1d20228d766aac75c7d0fe74c16932fc7b591 | diff --git a/lib/client_side_validations/action_view/form_builder.rb b/lib/client_side_validations/action_view/form_builder.rb
index <HASH>..<HASH> 100644
--- a/lib/client_side_validations/action_view/form_builder.rb
+++ b/lib/client_side_validations/action_view/form_builder.rb
@@ -99,15 +99,17 @@ module ClientSideValidations::ActionView::Helpers
else
if (conditional = (validator.last[:if] || validator.last[:unless]))
result = case conditional
- when Symbol then
- if @object.respond_to?(conditional)
- @object.send(conditional)
- else
- raise(ArgumentError, "unknown method called '#{conditional}'")
- end
- when String then eval(conditional)
- when Proc then conditional.call(@object)
- end
+ when Symbol
+ if @object.respond_to?(conditional)
+ @object.send(conditional)
+ else
+ raise(ArgumentError, "unknown method called '#{conditional}'")
+ end
+ when String
+ eval(conditional)
+ when Proc
+ conditional.call(@object)
+ end
# :if was specified and result is false OR :unless was specified and result was true
if (validator.last[:if] && !result) || (validator.last[:unless] && result) | Proper indenting and removed unnecessary 'then' for 'when' in case statements | DavyJonesLocker_client_side_validations | train | rb |
85793204310832552ba8fa210f8861c0275d7e7d | diff --git a/test/lazyloadxt_test.js b/test/lazyloadxt_test.js
index <HASH>..<HASH> 100644
--- a/test/lazyloadxt_test.js
+++ b/test/lazyloadxt_test.js
@@ -39,10 +39,10 @@
expect(5);
setTimeout(function () {
var $img = $('img'),
- cntinit = $img.filter(function (el) {
+ cntinit = $img.filter(function (index, el) {
return $(el).data('lazied');
}).length,
- cntnow = $img.filter(function (el) {
+ cntnow = $img.filter(function (index, el) {
return $(el).data('lazied') && ($(el).attr('src') === $(el).attr('data-src'));
}).length;
ok($img.length > 0, 'images should be presented'); | fix tests
(@todo: fix tests with Zepto and DOMtastic) | ressio_lazy-load-xt | train | js |
4d4dd975bc662b9a7c69d5a059e6504dd09b9a72 | diff --git a/scapy.py b/scapy.py
index <HASH>..<HASH> 100755
--- a/scapy.py
+++ b/scapy.py
@@ -5091,8 +5091,12 @@ class Packet(Gen):
pad = self.payload.getlayer(Padding)
if pad:
p += pad.build()
+ p = self.build_done(p)
return p
+ def build_done(self, p):
+ return self.payload.build_done(p)
+
def do_build_ps(self):
p=""
pl = []
@@ -5766,7 +5770,9 @@ class NoPayload(Packet,object):
def __nonzero__(self):
return False
def build(self, internal=0):
- return ""
+ return ""
+ def build_done(self, p):
+ return p
def build_ps(self, internal=0):
return "",[]
def getfieldval(self, attr): | Added Packet.build_done() hook, called once the packet is totally built | secdev_scapy | train | py |
0bbba757c3c039fc48b30f16709fa7628f2ea7e8 | diff --git a/dateparser/parser.py b/dateparser/parser.py
index <HASH>..<HASH> 100644
--- a/dateparser/parser.py
+++ b/dateparser/parser.py
@@ -271,7 +271,6 @@ class _parser(object):
for token, type, _ in self.unset_tokens:
if type == 0:
params.update({attr: int(token)})
- datetime(**params)
setattr(self, '_token_%s' % attr, token)
setattr(self, attr, int(token)) | Remove parser.py line of unknown purpose causing TypeError (#<I>) | scrapinghub_dateparser | train | py |
d9862ae0e150ae7102f4e1875da0a40f6230835d | diff --git a/trezor_agent/gpg/decode.py b/trezor_agent/gpg/decode.py
index <HASH>..<HASH> 100644
--- a/trezor_agent/gpg/decode.py
+++ b/trezor_agent/gpg/decode.py
@@ -48,9 +48,10 @@ def _parse_nist256p1_verifier(mpi):
hashfunc=hashlib.sha256)
def _nist256p1_verify(signature, digest):
- vk.verify_digest(signature=signature,
- digest=digest,
- sigdecode=lambda rs, order: rs)
+ result = vk.verify_digest(signature=signature,
+ digest=digest,
+ sigdecode=lambda rs, order: rs)
+ log.debug('nist256p1 ECDSA signature is OK (%s)', result)
return _nist256p1_verify
@@ -62,7 +63,8 @@ def _parse_ed25519_verifier(mpi):
def _ed25519_verify(signature, digest):
sig = b''.join(util.num2bytes(val, size=32)
for val in signature)
- vk.verify(sig, digest)
+ result = vk.verify(sig, digest)
+ log.debug('ed25519 ECDSA signature is OK (%s)', result)
return _ed25519_verify | gpg: debug logging for ECDSA verification | romanz_trezor-agent | train | py |
b74d8654dce7af97555df6844c9789b59d157d5d | diff --git a/lib/connection.js b/lib/connection.js
index <HASH>..<HASH> 100644
--- a/lib/connection.js
+++ b/lib/connection.js
@@ -116,7 +116,7 @@ Connection.prototype._pollForPort = function(callback) {
});
});
- poll.every(100).ask(7);
+ poll.every(100).ask(20);
poll(function(foundPort) {
if (foundPort) { return callback(null); } | increases generosity with port polling after reset | noopkat_avrgirl-arduino | train | js |
0432be6e40b9be56e50ff8c6ea855d5388ec00bc | diff --git a/pickleshare.py b/pickleshare.py
index <HASH>..<HASH> 100644
--- a/pickleshare.py
+++ b/pickleshare.py
@@ -36,7 +36,7 @@ License: MIT open source license.
from __future__ import print_function
-__version__ = "0.7.1"
+__version__ = "0.7.2"
try:
from pathlib import Path
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ setup(
description="Tiny 'shelve'-like database with concurrency support",
license="MIT",
extras_require = {
- ':python_version == "2.7"': ['pathlib2'],
+ ':python_version < "3.4"': ['pathlib2'],
},
url="https://github.com/pickleshare/pickleshare",
keywords="database persistence pickle ipc shelve", | Require pathlib2 on Python <I> as well | pickleshare_pickleshare | train | py,py |
b393016987e14b5f9b4ef42b585da85180b3f5de | diff --git a/NavigationSample/Scripts/navigation.mvc.js b/NavigationSample/Scripts/navigation.mvc.js
index <HASH>..<HASH> 100644
--- a/NavigationSample/Scripts/navigation.mvc.js
+++ b/NavigationSample/Scripts/navigation.mvc.js
@@ -15,9 +15,12 @@
var elements = e.target.elements;
var req = new win.XMLHttpRequest();
req.onreadystatechange = onReady(req, true, null);
+ var inputTypes = /^(button|image|submit|reset|file)$/i;
var data = {};
for (var i = 0; i < elements.length; i++) {
- data[elements[0].name] = elements[0].value;
+ var element = elements[i];
+ if (!inputTypes.test(element.type) && !element.disabled)
+ data[element.name] = element.value;
}
e.preventDefault();
req.open('post', getAjaxLink(e.target.action)); | Only send down valid input types.
Go for blacklist instead of whitelist because unrecognised types are taken as text | grahammendick_navigation | train | js |
4081e3375852a173c50d55aecb9341e21799d31e | diff --git a/src/Denner/Client/ServiceDescription/Shop.php b/src/Denner/Client/ServiceDescription/Shop.php
index <HASH>..<HASH> 100644
--- a/src/Denner/Client/ServiceDescription/Shop.php
+++ b/src/Denner/Client/ServiceDescription/Shop.php
@@ -75,7 +75,7 @@ return array(
),
),
'responseClass' => Response\ListResponse::CLASS,
- 'responseDataRoot' => 'wines',
+ 'responseDataRoot' => 'articles',
),
),
'models' => array( | changed name of root element (wines -> articles) | detailnet_denner-client | train | php |
a9b3c179ca2993aeaaf10c5f38ee13f86c1af58e | diff --git a/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractProxyResponseHandler.java b/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractProxyResponseHandler.java
index <HASH>..<HASH> 100644
--- a/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractProxyResponseHandler.java
+++ b/moco-core/src/main/java/com/github/dreamhead/moco/handler/AbstractProxyResponseHandler.java
@@ -286,7 +286,7 @@ public abstract class AbstractProxyResponseHandler extends AbstractHttpResponseH
private Optional<URL> remoteUrl(final HttpRequest request) {
Optional<String> remoteUrl = this.doRemoteUrl(request);
- return remoteUrl.flatMap(actual -> doGetRemoteUrl(request, remoteUrl.get()));
+ return remoteUrl.flatMap(actual -> doGetRemoteUrl(request, actual));
}
private Optional<URL> doGetRemoteUrl(final HttpRequest request, final String actual) { | simplified remote url in abstract proxy response handler | dreamhead_moco | train | java |
7b401d1fa3d2c97c0a2b3589527ec6999df0be2f | diff --git a/packages/node_modules/samples/browser-single-party-call-with-mute/test/wdio/spec/normal-dialing.js b/packages/node_modules/samples/browser-single-party-call-with-mute/test/wdio/spec/normal-dialing.js
index <HASH>..<HASH> 100644
--- a/packages/node_modules/samples/browser-single-party-call-with-mute/test/wdio/spec/normal-dialing.js
+++ b/packages/node_modules/samples/browser-single-party-call-with-mute/test/wdio/spec/normal-dialing.js
@@ -55,7 +55,7 @@ describe('samples/browser-single-party-call-with-mute', () => {
it('turns the local camera back on', () => {
browserSpock.assertText('#outgoing-video-stats', noStreamText);
browserSpock.click('[title="start sending video"]');
- browserSpock.waitForSpecificText('#camera-state', 'on', true);
+ browserSpock.waitForSpecificText('#camera-state', 'on');
});
it('ends the call', () => { | test(samples): fix failing mute test | webex_spark-js-sdk | train | js |
2e4055e9762d5eeab7c32c5ef1e898030950b483 | diff --git a/src/Users.php b/src/Users.php
index <HASH>..<HASH> 100644
--- a/src/Users.php
+++ b/src/Users.php
@@ -454,7 +454,9 @@ class Users
$this->app['logger.flash']->info(Trans::__('general.phrase.missing-root-jackpot'));
// If we reach this point, there is no user 'root'. We promote the current user.
- return $this->addRole($this->getCurrentUser(), 'root');
+ $user = $this->getCurrentUser();
+
+ return $this->addRole($user['id'], 'root');
}
/** | Only pass user's ID into Users::addRole() | bolt_bolt | train | php |
a35c2708deb6a076e8fdbaeb1d6cfbc2b5d13d8e | diff --git a/lib/python/dxpy/program_builder.py b/lib/python/dxpy/program_builder.py
index <HASH>..<HASH> 100644
--- a/lib/python/dxpy/program_builder.py
+++ b/lib/python/dxpy/program_builder.py
@@ -19,7 +19,7 @@ def get_program_spec(src_dir):
program_spec_file = os.path.join(src_dir, "dxprogram")
if not os.path.exists(program_spec_file):
program_spec_file = os.path.join(src_dir, "dxprogram.json")
- with open(os.path.join(src_dir, "dxprogram")) as fh:
+ with open(program_spec_file) as fh:
program_spec = json.load(fh)
validate_program_spec(program_spec) | Load either dxprogram or dxprogram.json, whichever is available. | dnanexus_dx-toolkit | train | py |
5bbd96652b34830365d6132dcfd7f514174222fe | diff --git a/winpty/__init__.py b/winpty/__init__.py
index <HASH>..<HASH> 100644
--- a/winpty/__init__.py
+++ b/winpty/__init__.py
@@ -15,5 +15,6 @@ from .winpty_wrapper import PTY
# yapf: enable
PTY
-VERSION_INFO = (0, 2, 2, 'dev0')
+PtyProcess
+VERSION_INFO = (0, 3, 0, 'dev0')
__version__ = '.'.join(map(str, VERSION_INFO)) | Update version to <I>.dev0 | spyder-ide_pywinpty | train | py |
1e2aa00a4a6defbd8c2c3b207e28ee3b456b52e4 | diff --git a/py/testdir_multi_jvm/test_model_management.py b/py/testdir_multi_jvm/test_model_management.py
index <HASH>..<HASH> 100644
--- a/py/testdir_multi_jvm/test_model_management.py
+++ b/py/testdir_multi_jvm/test_model_management.py
@@ -498,7 +498,7 @@ models_to_build = [
# This DL job is SLOOOOWW.... at 1 epoch its still 33sec of train time
# which is half of the total runtime for this entire file. Ponder
# switching to a smaller dataset.
- ModelSpec.for_dataset('deeplearning_airlines_binomial', 'deeplearning', datasets['airlines_binomial'], {'epochs': '1' } ),
+ ModelSpec.for_dataset('deeplearning_airlines_binomial', 'deeplearning', datasets['airlines_binomial'], {'hidden': '[50, 50]', 'epochs': '1.0' } ),
ModelSpec.for_dataset('deeplearning_iris_multinomial', 'deeplearning', datasets['iris_multinomial'], { } ),
ModelSpec.for_dataset('gbm_prostate_regression', 'gbm', datasets['prostate_regression'], { } ), | Modify DL parameters to run faster and pass (1 vs <I>). | h2oai_h2o-3 | train | py |
8f51909792df31fb03dbe8cd2f4e77b7a1809f5c | diff --git a/tests/PuliBinTest.php b/tests/PuliBinTest.php
index <HASH>..<HASH> 100644
--- a/tests/PuliBinTest.php
+++ b/tests/PuliBinTest.php
@@ -12,7 +12,9 @@
namespace Puli\Cli\Tests;
use PHPUnit_Framework_TestCase;
+use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
+use Webmozart\PathUtil\Path;
/**
* @since 1.0
@@ -23,8 +25,14 @@ class PuliBinTest extends PHPUnit_Framework_TestCase
{
public function testRunHelp()
{
- $rootDir = realpath(__DIR__.'/..');
- $process = new Process($rootDir.'/bin/puli');
+ $phpFinder = new PhpExecutableFinder();
+
+ if (!($php = $phpFinder->find())) {
+ $this->markTestSkipped('The "php" command could not be found.');
+ }
+
+ $rootDir = Path::normalize(realpath(__DIR__.'/..'));
+ $process = new Process($php.' '.$rootDir.'/bin/puli');
$status = $process->run();
$output = $process->getOutput(); | Fixed PuliBinTest on Windows | puli_cli | train | php |
d3250f5109055d04915aa8c3be32dc6f422841a9 | diff --git a/src/main/org/openscience/cdk/inchi/InChIGenerator.java b/src/main/org/openscience/cdk/inchi/InChIGenerator.java
index <HASH>..<HASH> 100644
--- a/src/main/org/openscience/cdk/inchi/InChIGenerator.java
+++ b/src/main/org/openscience/cdk/inchi/InChIGenerator.java
@@ -218,15 +218,15 @@ public class InChIGenerator {
}
// Check whether isotopic
- int isotopeNumber = atom.getMassNumber();
- if (isotopeNumber > 0 && ifact != null) {
+ Integer isotopeNumber = atom.getMassNumber();
+ if (isotopeNumber != CDKConstants.UNSET && ifact != null) {
IAtom isotope = atomContainer.getBuilder().newAtom(el);
ifact.configure(isotope);
- if (isotope.getMassNumber() == isotopeNumber) {
+ if (isotope.getMassNumber().intValue() == isotopeNumber.intValue()) {
isotopeNumber = 0;
}
}
- if (isotopeNumber != 0) {
+ if (isotopeNumber != CDKConstants.UNSET) {
iatom.setIsotopicMass(isotopeNumber);
} | Fixed a NPE caused by mass number now being an Object instead of native
git-svn-id: <URL> | cdk_cdk | train | java |
773c95737f05c751a750789edafaec6da8ba9e7d | diff --git a/example/fetch_all_patrons.rb b/example/fetch_all_patrons.rb
index <HASH>..<HASH> 100644
--- a/example/fetch_all_patrons.rb
+++ b/example/fetch_all_patrons.rb
@@ -23,7 +23,7 @@ campaign_id = campaign_response.data[0].id
all_pledges = []
cursor = nil
while true do
- page_response = api_client.fetch_page_of_pledges(campaign_id, 25, cursor)
+ page_response = api_client.fetch_page_of_pledges(campaign_id, { :count => 25, :cursor => cursor })
all_pledges += page_response.data
next_page_link = page_response.links[page_response.data]['next']
if next_page_link | Fix example/fetch_all_patrons.rb (#<I>) | Patreon_patreon-ruby | train | rb |
399912183ec82fb76415345182cc8c39e1f652a7 | diff --git a/filters/test.py b/filters/test.py
index <HASH>..<HASH> 100644
--- a/filters/test.py
+++ b/filters/test.py
@@ -169,7 +169,18 @@ class BaseFilterTestCase(TestCase):
:param kwargs:
Keyword params to pass to the Filter's initializer.
"""
- assert len(args) > 0, 'First argument must be the filtered value.'
+ if not callable(self.filter_type):
+ self.fail('{cls}.filter_type is not callable.'.format(
+ cls = type(self).__name__,
+ ))
+
+ if not args:
+ self.fail(
+ 'First argument to {cls}._filter '
+ 'must be the filtered value.'.format(
+ cls = type(self).__name__,
+ ),
+ )
return FilterRunner(
starting_filter = self.filter_type(*args[1:], **kwargs), | Better error messages when filter test case is misconfigured. | eflglobal_filters | train | py |
dc7476edee4f1f59eb15206e52e50f3341a5f6e8 | diff --git a/src/OptionsStore.php b/src/OptionsStore.php
index <HASH>..<HASH> 100644
--- a/src/OptionsStore.php
+++ b/src/OptionsStore.php
@@ -92,14 +92,13 @@ class OptionsStore
*
* @since 0.1.0
*
- * @param Option $option Option with new value.
- * @param bool $persist Whether to immediately persist the change.
+ * @param Option $option Option with new value.
*
* @return bool Whether the update was successful.
*/
- public function update(Option $option, bool $persist = true): bool
+ public function update(Option $option): bool
{
-
+ return $this->repository->save($option);
}
/**
@@ -107,15 +106,16 @@ class OptionsStore
*
* @since 0.1.0
*
- * @param string $key Option key to set the value of.
- * @param mixed $value New value to set the option to.
- * @param bool $persist Whether to immediately persist the change.
+ * @param string $key Option key to set the value of.
+ * @param mixed $value New value to set the option to.
*
* @return bool Whether the change of value was successful.
*/
- public function set(string $key, $value, bool $persist = true): bool
+ public function set(string $key, $value): bool
{
+ $option = $this->repository->find($key);
+ return $this->update($option->setValue($value));
}
/** | Filled some empty stubs in `OptionsStore` class. | brightnucleus_options-store | train | php |
582ad4ce1ab6e729fe59ee2702eb8c2d3934a059 | diff --git a/test/response_test.rb b/test/response_test.rb
index <HASH>..<HASH> 100644
--- a/test/response_test.rb
+++ b/test/response_test.rb
@@ -134,6 +134,7 @@ class RubySamlTest < Minitest::Test
no_signature_response.settings.idp_cert_fingerprint = "28:74:9B:E8:1F:E8:10:9C:A8:7C:A9:C3:E3:C5:01:6C:92:1C:B4:BA"
XMLSecurity::SignedDocument.any_instance.expects(:validate_signature).returns(true)
assert no_signature_response.validate!
+ XMLSecurity::SignedDocument.any_instance.unstub(:validate_signature)
end
it "validate ADFS assertions" do | Unstub after use, otherwise conflicts with other test in JRuby | onelogin_ruby-saml | train | rb |
9a5ae36a0b36c8f837beecf0c8c2caeb69c423f2 | diff --git a/lib/fakes.rb b/lib/fakes.rb
index <HASH>..<HASH> 100644
--- a/lib/fakes.rb
+++ b/lib/fakes.rb
@@ -17,3 +17,8 @@ module Kernel
return Fakes::Fake.new
end
end
+class Object
+ def matches
+ return Fakes::Matches
+ end
+end | Added the matches convienience method | developwithpassion_fakes | train | rb |
841414f76dc3f89b54afabafc4756de4250e6db1 | diff --git a/spec/yelp/client_spec.rb b/spec/yelp/client_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/yelp/client_spec.rb
+++ b/spec/yelp/client_spec.rb
@@ -16,8 +16,8 @@ describe Yelp::Client do
subject { client }
context 'with valid configuration' do
- its(:configuration) { should be_a(Yelp::Configuration) }
- its(:configuration) { should be_frozen }
+ its(:configuration) { is_expected.to be_a Yelp::Configuration }
+ its(:configuration) { is_expected.to be_frozen }
it 'should not be reconfigurable' do
expect {
@@ -52,8 +52,8 @@ describe Yelp::Client do
expect { configure_client_with_api_keys(valid_api_keys) }.to raise_error
end
- it { should be_a(Yelp::Configuration) }
- it { should be_frozen }
+ it { is_expected.to be_a Yelp::Configuration }
+ it { is_expected.to be_frozen }
end
context 'with invalid configuration' do | Updates to expect syntax in client_spec | Yelp_yelp-ruby | train | rb |
7b915abe4a4f04d43172401f735e04bf2cd395ff | diff --git a/lib/buoy_data/noaa_buoy_forecast.rb b/lib/buoy_data/noaa_buoy_forecast.rb
index <HASH>..<HASH> 100644
--- a/lib/buoy_data/noaa_buoy_forecast.rb
+++ b/lib/buoy_data/noaa_buoy_forecast.rb
@@ -137,7 +137,11 @@ module BuoyData
#"http://polar.ncep.noaa.gov/waves/latest_run/wna.#{buoy_id}.bull"
#
- "http://polar.ncep.noaa.gov/waves/WEB_P/multi_1.latest_run/plots/multi_1.#{buoy_id}.bull"
+ "#{hostname}/waves/WEB/multi_1.latest_run/plots/multi_1.#{buoy_id}.bull"
+ end
+
+ def hostname(protocol = 'http')
+ "#{protocol}://polar.ncep.noaa.gov"
end
# The header is the first 7 lines | Update noaa_buoy_forecast base url. | minch_buoy_data | train | rb |
523020c5c4860b374b19f2d8be28e818cd0927c6 | diff --git a/src/Collection/Iterator/BufferedIterator.php b/src/Collection/Iterator/BufferedIterator.php
index <HASH>..<HASH> 100644
--- a/src/Collection/Iterator/BufferedIterator.php
+++ b/src/Collection/Iterator/BufferedIterator.php
@@ -15,13 +15,14 @@
namespace Cake\Collection\Iterator;
use Cake\Collection\Collection;
+use Countable;
use SplDoublyLinkedList;
/**
* Creates an iterator from another iterator that will keep the results of the inner
* iterator in memory, so that results don't have to be re-calculated.
*/
-class BufferedIterator extends Collection {
+class BufferedIterator extends Collection implements Countable {
/**
* The in-memory cache containing results from previous iterators
@@ -151,4 +152,24 @@ class BufferedIterator extends Collection {
}
}
+/**
+ * Returns the number or items in this collection
+ *
+ * @return int
+ */
+ public function count() {
+ if ($this->getInnerIterator() instanceof Countable) {
+ return $this->getInnerIterator()->count();
+ }
+
+ if (!$this->_started) {
+ $this->rewind();
+ }
+
+ while ($this->valid()) {
+ $this->next();
+ }
+
+ return $this->_buffer->count();
+ }
} | Making BufferedIterator Countable as an optimization for the ORM | cakephp_cakephp | train | php |
ddb8b94768e22b59380fe5eb3873b0ba8915b731 | diff --git a/sortinghat/cmd/init.py b/sortinghat/cmd/init.py
index <HASH>..<HASH> 100644
--- a/sortinghat/cmd/init.py
+++ b/sortinghat/cmd/init.py
@@ -119,7 +119,10 @@ class Init(Command):
import csv
import pkg_resources
- f = pkg_resources.resource_stream('sortinghat', 'data/countries.csv')
- reader = csv.DictReader(f, fieldnames=['name', 'code', 'alpha3'])
+ filename = pkg_resources.resource_filename('sortinghat', 'data/countries.csv')
- return [Country(**c) for c in reader]
+ with open(filename, 'r') as f:
+ reader = csv.DictReader(f, fieldnames=['name', 'code', 'alpha3'])
+ countries = [Country(**c) for c in reader]
+
+ return countries | [cmd:init] Update CSV reader to support Python 2/3
In Python 3, the CSV reader needs a str object as input
and not a stream object. pkg_resources returned a stream
object so, it was needed to open the CSV file in text
mode. This method is compatible on both Python versions. | chaoss_grimoirelab-sortinghat | train | py |
9416d69e50a8880f41eac9fda6caeee0e4318ec2 | diff --git a/tests/unit_project/test_core/test_publishable.py b/tests/unit_project/test_core/test_publishable.py
index <HASH>..<HASH> 100644
--- a/tests/unit_project/test_core/test_publishable.py
+++ b/tests/unit_project/test_core/test_publishable.py
@@ -43,7 +43,7 @@ class TestPublishable(DatabaseTestCase):
self.assert_equals(None, self.publishable.main_placement)
def test_main_placement_with_two_placements_on_one_site(self):
- p = Placement.objects.create(
+ Placement.objects.create(
target_ct=self.publishable_ct,
target_id=self.publishable.pk,
category=self.category,
@@ -64,7 +64,7 @@ class TestPublishable(DatabaseTestCase):
slug=u'zai-jian-category',
)
- p = Placement.objects.create(
+ Placement.objects.create(
target_ct=self.publishable_ct,
target_id=self.publishable.pk,
category=category, | Removed unused variables
(aka testing buildbots :)) | ella_ella | train | py |
caafc2b532d2a8f43d522693202b9db3c5069607 | diff --git a/lib/ransack/helpers/form_helper.rb b/lib/ransack/helpers/form_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/ransack/helpers/form_helper.rb
+++ b/lib/ransack/helpers/form_helper.rb
@@ -77,15 +77,15 @@ module Ransack
def url(routing_proxy)
if routing_proxy && respond_to?(routing_proxy)
- send(routing_proxy).url_for(options_for_url(@options))
+ send(routing_proxy).url_for(options_for_url)
else
- url_for(options_for_url(@options))
+ url_for(options_for_url)
end
end
- def options_for_url(options)
- options[@search_object.context.search_key] = search_and_sort_params
- params.merge(options)
+ def options_for_url
+ @options[@search_object.context.search_key] = search_and_sort_params
+ params.merge(@options)
end
def search_and_sort_params | Don't pass @options ivar needlessly | activerecord-hackery_ransack | train | rb |
652b7d0a1d8a0c4c144d8e805718d5d170c2fb7d | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -6,5 +6,5 @@ setup(
description='Utility functions for strings checking and manipulation.',
author='Davide Zanotti',
author_email='davidezanotti@gmail.com',
- # url='https://www.python.org/sigs/distutils-sig/',
+ url='https://github.com/daveoncode/python-string-utils',
) | added github project url to setup.py | daveoncode_python-string-utils | train | py |
9c0d4407739d5136a7fed35bcdece3e409572673 | diff --git a/src/PeskyCMF/Config/helpers.php b/src/PeskyCMF/Config/helpers.php
index <HASH>..<HASH> 100644
--- a/src/PeskyCMF/Config/helpers.php
+++ b/src/PeskyCMF/Config/helpers.php
@@ -11,11 +11,13 @@ if (!function_exists('routeTpl')) {
function routeTpl($routeName, array $parameters = [], array $tplParams = [], $absolute = false) {
$replacements = [];
foreach ($tplParams as $name => $tplName) {
+ $dotJsVarPrefix = '';
if (is_numeric($name)) {
- $name = 'it.' . $tplName;
+ $name = $tplName;
+ $dotJsVarPrefix = 'it.';
}
$parameters[$name] = '__' . $name . '__';
- $replacements['%' . preg_quote($parameters[$name], '%') . '%'] = "{{= {$tplName} }}";
+ $replacements['%' . preg_quote($parameters[$name], '%') . '%'] = "{{= {$dotJsVarPrefix}{$tplName} }}";
}
$url = route($routeName, $parameters, $absolute);
return preg_replace(array_keys($replacements), array_values($replacements), $url); | helpers.php - routeTpl - added possibility to provide any template var name, not only vars in 'it' object inside dotJs (fix) | swayok_PeskyCMF | train | php |
3158ac8194f2df02b6b247fc439c3cbffeacbb45 | diff --git a/tasks/html.js b/tasks/html.js
index <HASH>..<HASH> 100644
--- a/tasks/html.js
+++ b/tasks/html.js
@@ -80,7 +80,7 @@ function executeTransform (filepath, incremental) {
var fileInPath = filepath
var fileRelativePath = path.relative(config.html.src, fileInPath)
- page.source = fileRelativePath
+ page.source = fileRelativePath // fileRelativePath changes below hence we assign it here
var fileOutDir = path.dirname(path.join(config.html.dest, fileRelativePath))
var fileParsedPath = path.parse(fileInPath)
@@ -92,6 +92,7 @@ function executeTransform (filepath, incremental) {
if (blog) {
fileOutDir = blog.config.dest
+ fileRelativePath = path.join(path.relative(config.out, blog.config.dest), (fileName + '.' + fileExt))
post = blogs.getPost(blog, fileName)
if (post === null) {
return // most probably a draft in production build | Fixing fileRelativePath for blog posts | kunruch_mmpilot | train | js |
3e95e6f9e4affc2c89961cdf621624c44865aebd | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -187,13 +187,6 @@ class Libp2p extends EventEmitter {
})
this._peerDiscovered = this._peerDiscovered.bind(this)
-
- // promisify all instance methods
- ;['start', 'stop', 'dial', 'dialProtocol', 'dialFSM', 'hangUp', 'ping'].forEach(method => {
- this[method] = promisify(this[method], {
- context: this
- })
- })
}
/**
@@ -557,6 +550,11 @@ class Libp2p extends EventEmitter {
}
}
+// promisify all instance methods
+['start', 'stop', 'dial', 'dialProtocol', 'dialFSM', 'hangUp', 'ping'].forEach(method => {
+ Libp2p[method] = promisify(Libp2p[method])
+})
+
module.exports = Libp2p
/**
* Like `new Libp2p(options)` except it will create a `PeerInfo` | fix: dont override methods of created instance (#<I>)
* fix: dont override methods of created instance
* chore: fix lint | libp2p_js-libp2p | train | js |
52798b83a680e9a3696b5e4348946470e0f959b9 | diff --git a/lib/block.js b/lib/block.js
index <HASH>..<HASH> 100644
--- a/lib/block.js
+++ b/lib/block.js
@@ -36,11 +36,11 @@ function Block() {
Block.getDescription = function( type ) {
switch( type ) {
case UDIF.BLOCK.ZEROFILL: return 'ZEROFILL'; break
- case UDIF.BLOCK.RAW: return 'UDRW (UDIF read/write) / UDRO (UDIF read-only)'; break
- case UDIF.BLOCK.FREE: return 'FREE (Unallocated)'; break
- case UDIF.BLOCK.UDCO: return 'UDCO (UDIF ADC-compressed)'; break
- case UDIF.BLOCK.UDZO: return 'UDZO (UDIF zlib-compressed)'; break
- case UDIF.BLOCK.UDBZ: return 'UDBZ (UDIF bzip2-compressed)'; break
+ case UDIF.BLOCK.RAW: return 'UDRW (raw)'; break
+ case UDIF.BLOCK.FREE: return 'FREE (unallocated)'; break
+ case UDIF.BLOCK.UDCO: return 'UDCO (adc-compressed)'; break
+ case UDIF.BLOCK.UDZO: return 'UDZO (zlib-compressed)'; break
+ case UDIF.BLOCK.UDBZ: return 'UDBZ (bzip2-compressed)'; break
case UDIF.BLOCK.COMMENT: return 'COMMENT'; break
case UDIF.BLOCK.TERMINATOR: return 'TERMINATOR'; break
default: return 'UNKNOWN'; break | feat(block): Improve block type descriptions | jhermsmeier_node-udif | train | js |
bfac0e2bdb7a83bc961c2ee19599942aadb47ccf | diff --git a/src/AnyContent/Client/Repository.php b/src/AnyContent/Client/Repository.php
index <HASH>..<HASH> 100755
--- a/src/AnyContent/Client/Repository.php
+++ b/src/AnyContent/Client/Repository.php
@@ -30,8 +30,13 @@ class Repository
}
- public function getContentTypeDefinition($contentTypeName)
+ public function getContentTypeDefinition($contentTypeName = null)
{
+ if ($contentTypeName == null AND $this->contentTypeDefinition)
+ {
+ return $this->contentTypeDefinition;
+ }
+
if ($this->hasContentType($contentTypeName))
{
$cmdl = $this->client->getCMDL($contentTypeName); | - added possibility to retrieve content type definition of a repository object without specifying the contentTypeName (if a content type is selected) | nhagemann_anycontent-client-php | train | php |
bc20dedad9cbb0fe58ff39bd39a6d8bc5689b84b | diff --git a/lib/config.js b/lib/config.js
index <HASH>..<HASH> 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -22,7 +22,6 @@ Config.defaults = {
*/
apis: [
'fs',
- 'foo',
'secrets'
],
@@ -31,7 +30,6 @@ Config.defaults = {
*/
defaultManifestApis: [
'fs',
- 'foo',
'secrets'
], | [TASK] Remove foo from config | codius-deprecated_codius-engine | train | js |
cc6a8176dc735869f900185d0a116c972f45476d | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -276,7 +276,7 @@ async function exec(options = {}) {
}
if (errorLines.length) {
let error = errorLines.join('\n');
- error = error.replace(/===*.*====*\nLicense acceptance recorded. Continuing.\n?/, '');
+ error = error.replace(/===*.*====*\\nLicense acceptance recorded. Continuing.\n?/, '');
const acceptLicenseMessage = /To accept the message please run speedtest interactively or use the following:[\s\S]*speedtest --accept-license/;
const acceptGdprMessage = /To accept the message please run speedtest interactively or use the following:[\s\S]*speedtest --accept-gdpr/;
if (acceptLicenseMessage.test(error)) { | fix: fix regex issue in error check
escaped \n in the regex check, as the string to test is using \n as string. this fixes an issue where the "license accepted" info message would throw an error. | ddsol_speedtest.net | train | js |
769a9687244a2aa8d839a71c787e5d542fd96f98 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ import f3
setup(
name='f3',
- version='1.0.2',
+ version='1.0.4',
license='MIT',
long_description=open('README.rst').read(),
author='Ben Montet', | oops, forgot to increment version | benmontet_f3 | train | py |
594a42129ee2845152ded04278fd9bc71e60e279 | diff --git a/writer.go b/writer.go
index <HASH>..<HASH> 100644
--- a/writer.go
+++ b/writer.go
@@ -243,7 +243,6 @@ func (p *MediaPlaylist) Encode() *bytes.Buffer {
p.buf.WriteString("#EXTM3U\n#EXT-X-VERSION:")
p.buf.WriteString(strver(p.ver))
p.buf.WriteRune('\n')
- p.buf.WriteString("#EXT-X-ALLOW-CACHE:NO\n")
// default key (workaround for Widevine)
if p.Key != nil {
p.buf.WriteString("#EXT-X-KEY:")
@@ -262,6 +261,7 @@ func (p *MediaPlaylist) Encode() *bytes.Buffer {
switch p.MediaType {
case EVENT:
p.buf.WriteString("EVENT\n")
+ p.buf.WriteString("#EXT-X-ALLOW-CACHE:NO\n")
case VOD:
p.buf.WriteString("VOD\n")
} | Move the writing of the no cache header to inside playlist type event.
Let the client determine if it should cache or not unless we are
publishing a live stream. | grafov_m3u8 | train | go |
240f27de29f981798b0b308be96ca7b8ad855a3e | diff --git a/src/Leevel/Kernel/App.php b/src/Leevel/Kernel/App.php
index <HASH>..<HASH> 100644
--- a/src/Leevel/Kernel/App.php
+++ b/src/Leevel/Kernel/App.php
@@ -164,7 +164,10 @@ class App implements IApp
return \PHP_SAPI === 'cli';
}
- return $this->container->make('request')->isConsole();
+ /** @var \Leevel\Http\Request $request */
+ $request = $this->container->make('request');
+
+ return $request->isConsole();
}
/**
diff --git a/src/Leevel/Kernel/ExceptionRuntime.php b/src/Leevel/Kernel/ExceptionRuntime.php
index <HASH>..<HASH> 100644
--- a/src/Leevel/Kernel/ExceptionRuntime.php
+++ b/src/Leevel/Kernel/ExceptionRuntime.php
@@ -328,7 +328,7 @@ abstract class ExceptionRuntime implements IExceptionRuntime
extract($vars);
ob_start();
require $filepath;
- $content = ob_get_contents();
+ $content = ob_get_contents() ?: '';
ob_end_clean();
return $content; | fix(kernel): fix for phpstan level 7 | hunzhiwange_framework | train | php,php |
8d9a8f37327424324513e887f140d64c6f124569 | diff --git a/logdna/logdna.py b/logdna/logdna.py
index <HASH>..<HASH> 100644
--- a/logdna/logdna.py
+++ b/logdna/logdna.py
@@ -33,7 +33,7 @@ class LogDNAHandler(logging.Handler):
if message and message['line']:
if self.max_length and len(message['line']) > defaults['MAX_LINE_LENGTH']:
message['line'] = message['line'][:defaults['MAX_LINE_LENGTH']] + ' (cut off, too long...)'
- print('Line was longer than ' + defaults['MAX_LINE_LENGTH'] + ' chars and was truncated.')
+ print('Line was longer than {0} chars and was truncated.'.format(defaults['MAX_LINE_LENGTH'])
self.bufByteLength += sys.getsizeof(message)
self.buf.append(message) | Fixing TypeError in error printing | logdna_python | train | py |
a0788e0be3164acd65e3bc4b5bc1b51179b967ce | diff --git a/git/repo/base.py b/git/repo/base.py
index <HASH>..<HASH> 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -713,11 +713,14 @@ class Repo(object):
committed_date=int(props[b'committer-time']))
commits[hexsha] = c
else:
- # Discard the next line (it's a filename end tag)
- line = next(stream)
- tag, value = line.split(b' ', 1)
- assert tag == b'filename', 'Unexpected git blame output'
- orig_filename = value
+ # Discard all lines until we find "filename" which is
+ # guaranteed to be the last line
+ while True:
+ line = next(stream)
+ tag, value = line.split(b' ', 1)
+ if tag == b'filename':
+ orig_filename = value
+ break
yield BlameEntry(commits[hexsha],
range(lineno, lineno + num_lines), | Ignore all lines of subsequent hunks until last one is found
Git version <I>+ introduced extra lines into the subsequent hunk
sections for incremental blame output. The documentation notes that
parsers of this output should ignore all lines between the start and end
for robust parsing. | gitpython-developers_GitPython | train | py |
fdcea19ff48ff5721febdb7d3883c5ac8cee94b5 | diff --git a/spec/graph_matching/algorithm/mwm_general_spec.rb b/spec/graph_matching/algorithm/mwm_general_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/graph_matching/algorithm/mwm_general_spec.rb
+++ b/spec/graph_matching/algorithm/mwm_general_spec.rb
@@ -90,9 +90,9 @@ RSpec.describe GraphMatching::Algorithm::MWMGeneral do
[3, 4, 2]
]
m = described_class.new(g).match
- expect(m.vertexes).to match_array([1, 2, 3, 4])
- expect(m.has_edge?([1, 2])).to eq(true)
- expect(m.has_edge?([3, 4])).to eq(true)
+ expect(m.vertexes).to match_array([0, 1, 2, 3])
+ expect(m.has_edge?([0, 1])).to eq(true)
+ expect(m.has_edge?([2, 3])).to eq(true)
expect(m.weight(g)).to eq(6)
end
end | Update test from 1-indexing to 0-indexing | jaredbeck_graph_matching | train | rb |
ee88834acb4c84d92c30127810fede2a65211096 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,6 @@
(function () {
- var helpers = (function () {
+ function assemble() {
var helpers = {
noop: function () {},
no: function () { return false; },
@@ -62,15 +62,20 @@
}
}
return d3h;
- }());
+ }
- if (typeof window === 'object') {
- /* global window */
- window.d3h = helpers;
- } else if (typeof module === 'object') {
- module.exports = helpers;
- } else {
- throw new Error('Do not know how to exports D3 helpers');
+ function register(value, name) {
+ if (typeof window === 'object') {
+ /* global window */
+ window[name] = value;
+ } else if (typeof module === 'object') {
+ module.exports = value;
+ } else {
+ throw new Error('Do not know how to register ' + name);
+ }
}
+ var d3h = assemble();
+ register(d3h, 'd3h');
+
}()); | refactored, fixes #6 | bahmutov_d3-helpers | train | js |
0e37906d97c8f8f1acd3827758e86053db1a8e1a | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ def long_desc():
setup(
name='cellulario',
- version='0',
+ version='1',
description='Cellular IO',
author='Justin Mayfield',
author_email='tooker@gmail.com', | v1 instead of 0 which was already used. | mayfield_cellulario | train | py |
2020afd200c35f8c085b551ec41c7611793d89e1 | diff --git a/cmd/server-mux.go b/cmd/server-mux.go
index <HASH>..<HASH> 100644
--- a/cmd/server-mux.go
+++ b/cmd/server-mux.go
@@ -188,9 +188,9 @@ func NewMuxServer(addr string, handler http.Handler) *MuxServer {
m := &MuxServer{
Server: http.Server{
Addr: addr,
- // Adding timeout of 10 minutes for unresponsive client connections.
- ReadTimeout: 10 * time.Minute,
- WriteTimeout: 10 * time.Minute,
+ // Do not add any timeouts Golang net.Conn
+ // closes connections right after 10mins even
+ // if they are not idle.
Handler: handler,
MaxHeaderBytes: 1 << 20,
}, | server: http.Server do not add deadlines causes issues. (#<I>)
Adding deadlines is a no go since Golang doesn't back off
the timers if there is an active i/o in progress.
It is meant to be for applications to handle this themselves
and manually progress the deadlines.
Fixes #<I> | minio_minio | train | go |
3e08b79e1558b9e99044398b282d2d2c6b786656 | diff --git a/mgmtfn/k8splugin/kubeClient.go b/mgmtfn/k8splugin/kubeClient.go
index <HASH>..<HASH> 100644
--- a/mgmtfn/k8splugin/kubeClient.go
+++ b/mgmtfn/k8splugin/kubeClient.go
@@ -237,7 +237,11 @@ func (c *APIClient) GetPodLabel(ns, name, label string) (string, error) {
}
}
+ c.podCache.labelsMutex.Lock()
+ defer c.podCache.labelsMutex.Unlock()
+
res, found := c.podCache.labels[label]
+
if found {
return res, nil
} | Add lock for getting podCache label | contiv_netplugin | train | go |
ed3c22c2e622ae80257a9db50c4211c687721720 | diff --git a/iopipe/contrib/profiler/plugin.py b/iopipe/contrib/profiler/plugin.py
index <HASH>..<HASH> 100644
--- a/iopipe/contrib/profiler/plugin.py
+++ b/iopipe/contrib/profiler/plugin.py
@@ -26,10 +26,9 @@ class ProfilerPlugin(Plugin):
"""
Instantiates the profiler plugin
- :param enabled: Whether or not the profiler should be enabled for all invocations.
- Alternatively this plugin can be enabled/disabled via
- the `IOPIPE_PROFILER_ENABLED` environment
- variable.
+ :param enabled: Whether or not the profiler should be enabled for all
+ invocations. Alternatively this plugin can be enabled/disabled
+ via the `IOPIPE_PROFILER_ENABLED` environment variable.
:type enabled: bool
"""
self._enabled = enabled
@@ -65,10 +64,10 @@ class ProfilerPlugin(Plugin):
def post_invoke(self, event, context):
if self.profile is not None:
self.profile.disable()
+ self.context.iopipe.label("@iopipe/plugin-profiler")
def pre_report(self, report):
if self.profile is not None:
- self.context.iopipe.label("@iopipe/plugin-profiler")
if self.signed_request is not None:
if isinstance(self.signed_request, Future):
wait([self.signed_request]) | Add profiler auto label earlier to ensure it is added to report | iopipe_iopipe-python | train | py |
0fba106b1fba72cd659cce36e98dd6effd0c244a | diff --git a/lib/tugboat/cli.rb b/lib/tugboat/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/tugboat/cli.rb
+++ b/lib/tugboat/cli.rb
@@ -87,12 +87,12 @@ module Tugboat
method_option "size",
:type => :numeric,
:aliases => "-s",
- :default => 64,
+ :default => 66,
:desc => "The size_id of the droplet"
method_option "image",
:type => :numeric,
:aliases => "-i",
- :default => 2676,
+ :default => 284203,
:desc => "The image_id of the droplet"
method_option "region",
:type => :numeric, | Update the defaults for droplet creation
DigitalOcean seems to have changed the ID's of their server
images...this update continues to use:
Ubuntu <I> x<I> Server (id: <I>, distro: Ubuntu)
As the default image.
I also lowered the default droplet size to <I>mb. | petems_tugboat | train | rb |
eb05774531ffef41f3919dabb5b5a3a4ea723a04 | diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb
index <HASH>..<HASH> 100644
--- a/activemodel/lib/active_model/dirty.rb
+++ b/activemodel/lib/active_model/dirty.rb
@@ -255,7 +255,7 @@ module ActiveModel
end
# Remove changes information for the provided attributes.
- def clear_attribute_changes(attributes)
+ def clear_attribute_changes(attributes) # :doc:
attributes_changed_by_setter.except!(*attributes)
end
end | [Enh] Changed the visibility of the ActiveModel::Dirty#clear_attribute_changes method
In Rails <I> it is impossible to define a custom default value for a model's
attribute without making it appear as _changed?, especially when the model
is first initialized. Making this method publicly visible will allow such a behaviour,
without the need to use private APIs. | rails_rails | train | rb |
39b11f65467846e5a3dff1a7aae744420e9498bf | diff --git a/includes/class-freemius.php b/includes/class-freemius.php
index <HASH>..<HASH> 100755
--- a/includes/class-freemius.php
+++ b/includes/class-freemius.php
@@ -18469,9 +18469,16 @@
function _get_invoice_api_url( $payment_id = false ) {
$this->_logger->entrance();
- return $this->get_api_user_scope()->get_signed_url(
+ $url = $this->get_api_user_scope()->get_signed_url(
"/payments/{$payment_id}/invoice.pdf"
);
+
+ if ( ! fs_starts_with( $url, 'https://' ) ) {
+ // Always use HTTPS for invoices.
+ $url = 'https' . substr( $url, 4 );
+ }
+
+ return $url;
}
/** | [invoices] [update] Always use HTTPS for invoices as those are opened on a new browser page anyways. | Freemius_wordpress-sdk | train | php |
946c758b02159b464f848369ad894fbf0ea334e7 | diff --git a/lib/godmin/resources/resource_controller.rb b/lib/godmin/resources/resource_controller.rb
index <HASH>..<HASH> 100644
--- a/lib/godmin/resources/resource_controller.rb
+++ b/lib/godmin/resources/resource_controller.rb
@@ -76,7 +76,11 @@ module Godmin
protected
def set_resource_service
- @resource_service = resource_service_class.new
+ @resource_service = if authentication_enabled?
+ resource_service_class.new(nil, admin_user: admin_user)
+ else
+ resource_service_class.new
+ end
end
def set_resource_class
diff --git a/lib/godmin/resources/resource_service.rb b/lib/godmin/resources/resource_service.rb
index <HASH>..<HASH> 100644
--- a/lib/godmin/resources/resource_service.rb
+++ b/lib/godmin/resources/resource_service.rb
@@ -15,7 +15,10 @@ module Godmin
include Pagination
include Scopes
- def initialize(resource_class = nil)
+ attr_reader :options
+
+ def initialize(resource_class = nil, options = {})
+ @options = options
@resource_class = resource_class
end | Allow passing in options to the resource services | varvet_godmin | train | rb,rb |
7580657eb77f6b41c10d54d19be86d7d90dae194 | diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -162,7 +162,8 @@ module Functions
type is defined, either as a native type or a defined type, or whether a class is defined.
This is useful for checking whether a class is defined and only including it if it is.
This function can also test whether a resource has been defined, using resource references
- (e.g., ``if defined(File['/tmp/myfile'] { ... }``).") do |vals|
+ (e.g., ``if defined(File['/tmp/myfile'] { ... }``). This function is unfortunately
+ dependent on the parse order of the configuration when testing whether a resource is defined.") do |vals|
result = false
vals.each do |val|
case val | Applying a version of the diff to the defined() docs from David Schmitt
git-svn-id: <URL> | puppetlabs_puppet | train | rb |
cff0a8364804bdd94a10f09cf2814601da09b9d9 | diff --git a/salt/renderers/json_mako.py b/salt/renderers/json_mako.py
index <HASH>..<HASH> 100644
--- a/salt/renderers/json_mako.py
+++ b/salt/renderers/json_mako.py
@@ -13,11 +13,11 @@ from salt.exceptions import SaltRenderError
import salt.utils.templates
-def render(template):
+def render(template_file, env='', sls=''):
'''
Render the data passing the functions and grains into the rendering system
'''
- if not os.path.isfile(template):
+ if not os.path.isfile(template_file):
return {}
tmp_data = salt.utils.templates.mako( | Use consistent signature for json_mako renderer
Use the same signature for both jinja2 and mako templates
The `env` & `sls` names were undefined | saltstack_salt | train | py |
248d6cbd51931317ab42e81fde6988a5ee276a48 | diff --git a/js/bootstrap-select.js b/js/bootstrap-select.js
index <HASH>..<HASH> 100644
--- a/js/bootstrap-select.js
+++ b/js/bootstrap-select.js
@@ -1214,7 +1214,7 @@
li.appendChild(a);
dropdownHeader.appendChild(text.cloneNode(true));
- if (this._liWidest) menuInner.appendChild(this._liWidest);
+ if (this._liWidest) menuInner.appendChild(this._liWidest.cloneNode(true));
menuInner.appendChild(li);
menuInner.appendChild(divider);
menuInner.appendChild(dropdownHeader); | prevent removal of li from the DOM when calling refresh | snapappointments_bootstrap-select | train | js |
51d0baf63129e66cfb6a0da7cf1afffde3d9ebcd | diff --git a/xgraphics/text.go b/xgraphics/text.go
index <HASH>..<HASH> 100644
--- a/xgraphics/text.go
+++ b/xgraphics/text.go
@@ -33,7 +33,7 @@ func (im *Image) Text(x, y int, clr color.Color, fontSize float64,
c.SetSrc(textClr)
// Now let's actually draw the text...
- pt := freetype.Pt(x, y+c.FUnitToPixelRU(font.UnitsPerEm()))
+ pt := freetype.Pt(x, y+int(font.FUnitsPerEm()))
newpt, err := c.DrawString(text, pt)
if err != nil {
return 0, 0, err
@@ -54,10 +54,7 @@ func (im *Image) Text(x, y int, clr color.Color, fontSize float64,
func TextMaxExtents(font *truetype.Font, fontSize float64,
text string) (width int, height int) {
- // We need a context to calculate the extents
- c := ftContext(font, fontSize)
-
- emSquarePix := c.FUnitToPixelRU(font.UnitsPerEm())
+ emSquarePix := int(font.FUnitsPerEm())
return len(text) * emSquarePix, emSquarePix
} | fix breakage due to change in freetype package. | BurntSushi_xgbutil | train | go |
0934c92e10cf106c2f0644eb1d6c9ff401da1c22 | diff --git a/js/kucoin2.js b/js/kucoin2.js
index <HASH>..<HASH> 100644
--- a/js/kucoin2.js
+++ b/js/kucoin2.js
@@ -556,14 +556,16 @@ module.exports = class kucoin2 extends Exchange {
const marketId = this.marketId (symbol);
// required param, cannot be used twice
const clientOid = this.uuid ();
- const request = {
+ let request = {
'clientOid': clientOid,
- 'price': this.priceToPrecision (symbol, price),
'side': side,
'size': this.amountToPrecision (symbol, amount),
'symbol': marketId,
'type': type,
};
+ if (type !== 'market') {
+ request['price'] = this.priceToPrecision (symbol, price);
+ }
const response = await this.privatePostOrders (this.extend (request, params));
const responseData = response['data'];
return { | kucoin fix for market orders | ccxt_ccxt | train | js |
f9a2ad03943d5c2ba54e1d45f155442b519c75da | diff --git a/activesupport/lib/active_support/reloader.rb b/activesupport/lib/active_support/reloader.rb
index <HASH>..<HASH> 100644
--- a/activesupport/lib/active_support/reloader.rb
+++ b/activesupport/lib/active_support/reloader.rb
@@ -58,7 +58,7 @@ module ActiveSupport
prepare!
end
- def self.run! # :nodoc:
+ def self.run!(reset: false) # :nodoc:
if check!
super
else | Fix reloader to work with new Executor signature
This is a follow up to [CVE-<I>-<I>]. | rails_rails | train | rb |
b00ae50be65d1bc88fa95145f1c486a6886a6b76 | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -370,6 +370,7 @@ Server.prototype.serve = function(req, res){
}
debug('serve client source');
+ res.setHeader("Cache-Control", "public, max-age=0");
res.setHeader('Content-Type', 'application/javascript');
res.setHeader('ETag', expectedEtag);
res.writeHead(200); | [feat] Add cache-control header when serving the client source (#<I>) | socketio_socket.io | train | js |
1881515f28aa6e9c1b3c76d3c056ef9143dede19 | diff --git a/openquake/logs.py b/openquake/logs.py
index <HASH>..<HASH> 100644
--- a/openquake/logs.py
+++ b/openquake/logs.py
@@ -53,10 +53,8 @@ flags.DEFINE_string('logfile', '',
# TODO: get rid of this
LOG = logging.getLogger()
-LOGGING_AMQP_FORMAT = '%(asctime)s %(loglevel)-5s %(processName)s' \
- ' [%(name)s] - Job %(job_id)s - %(message)s'
-LOGGING_STDOUT_FORMAT = '%(levelname)-5s %(processName)s' \
- ' [%(name)s] - %(message)s'
+LOGGING_STDERR_FORMAT = '%(hostname)s [%(asctime)s] %(levelname)s ' \
+ '%(processName)s/%(process)s [%(name)s] %(message)s'
def init_logs_amqp_send(level='warn'): | added hostname to stderr log format | gem_oq-engine | train | py |
dfbb81b511a9003bf7d0cf23779f0a9a188941a4 | diff --git a/src/lokijs.js b/src/lokijs.js
index <HASH>..<HASH> 100644
--- a/src/lokijs.js
+++ b/src/lokijs.js
@@ -228,10 +228,6 @@
return listener;
};
- function applyListener(listener, args) {
- listener.apply(null, args);
- }
-
/**
* @propt emit(eventName, data) - emits a particular event
* with the option of passing optional parameters which are going to be processed by the callback | removed applyListener as its not used anymore | techfort_LokiJS | train | js |
05ab1952720a3af32aa5910ea2927da2cd193526 | diff --git a/lib/builder/version.rb b/lib/builder/version.rb
index <HASH>..<HASH> 100644
--- a/lib/builder/version.rb
+++ b/lib/builder/version.rb
@@ -2,7 +2,7 @@ module Builder
VERSION_NUMBERS = [
VERSION_MAJOR = 3,
VERSION_MINOR = 1,
- VERSION_BUILD = 1,
+ VERSION_BUILD = 2,
]
VERSION = VERSION_NUMBERS.join(".")
end | Bump to version <I> | jimweirich_builder | train | rb |
d9e4735e30e28dc0f07250f47ddb3154c2e215ae | diff --git a/examples/consumer_example/consumer_example.go b/examples/consumer_example/consumer_example.go
index <HASH>..<HASH> 100644
--- a/examples/consumer_example/consumer_example.go
+++ b/examples/consumer_example/consumer_example.go
@@ -39,8 +39,7 @@ func main() {
broker := os.Args[1]
group := os.Args[2]
topics := os.Args[3:]
-
- sigchan := make(chan os.Signal)
+ sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)
c, err := kafka.NewConsumer(&kafka.ConfigMap{ | consumer_example: make term signal channel buffered to avoid select() miss | confluentinc_confluent-kafka-go | train | go |
e545ee62a09579ec7de9503cad932b27910eb3e4 | diff --git a/lang/lt/lang.php b/lang/lt/lang.php
index <HASH>..<HASH> 100644
--- a/lang/lt/lang.php
+++ b/lang/lt/lang.php
@@ -63,6 +63,8 @@
'amount' => 'Amount',
'author' => 'Author',
'link' => 'Link',
+ 'is_default' => 'Is default',
+ 'symbol' => 'Symbol',
'sort_order' => 'Sorting',
'created_at' => 'Created', | New translations lang.php (Lithuanian) | lovata_oc-toolbox-plugin | train | php |
c74a27bd3371f8edf1161963305fcf3dc2705f29 | diff --git a/django_cron/__init__.py b/django_cron/__init__.py
index <HASH>..<HASH> 100644
--- a/django_cron/__init__.py
+++ b/django_cron/__init__.py
@@ -113,6 +113,9 @@ class CronJobManager(object):
def make_log(self, *messages, **kwargs):
cron_log = self.cron_log
+ cron_job = getattr(self, 'cron_job', self.cron_job_class)
+ cron_log.code = cron_job.code
+
cron_log.is_success = kwargs.get('success', True)
cron_log.message = self.make_log_msg(*messages)
cron_log.ran_at_time = getattr(self, 'user_time', None)
@@ -139,8 +142,7 @@ class CronJobManager(object):
def __enter__(self):
- cron_job = self.cron_job_class
- self.cron_log = CronJobLog(code=cron_job.code, start_time=timezone.now())
+ self.cron_log = CronJobLog(start_time=timezone.now())
return self | fill the code field in CronJobLog after instantiating the job
(not before) to allow jobs to modify their code in runtime | Tivix_django-cron | train | py |
b1b0b044d25b4135b93a46150a9d2cbc106e7099 | diff --git a/js/jquery.fileupload-fp.js b/js/jquery.fileupload-fp.js
index <HASH>..<HASH> 100644
--- a/js/jquery.fileupload-fp.js
+++ b/js/jquery.fileupload-fp.js
@@ -1,5 +1,5 @@
/*
- * jQuery File Upload File Processing Plugin 1.2.1
+ * jQuery File Upload File Processing Plugin 1.2.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2012, Sebastian Tschan
@@ -62,9 +62,13 @@
// fileupload widget (via file input selection, drag & drop or add
// API call). See the basic file upload widget for more information:
add: function (e, data) {
- $(this).fileupload('process', data).done(function () {
- data.submit();
- });
+ if (data.autoUpload || (data.autoUpload !== false &&
+ ($(this).data('blueimp-fileupload') ||
+ $(this).data('fileupload')).options.autoUpload)) {
+ $(this).fileupload('process', data).done(function () {
+ data.submit();
+ });
+ }
}
}, | Respect the autoUpload setting and process only when submitting. | blueimp_jQuery-File-Upload | train | js |
1edf4cd5c6bd7a21e829c33319a6f13ef5b7e523 | diff --git a/actstream/views.py b/actstream/views.py
index <HASH>..<HASH> 100644
--- a/actstream/views.py
+++ b/actstream/views.py
@@ -21,7 +21,11 @@ def follow_unfollow(request, content_type_id, object_id, follow=True):
}
if follow:
Follow.objects.get_or_create(**lookup)
+ if 'next' in request.REQUEST:
+ return HttpResponseRedirect(request.REQUEST['next'])
return type('Created', (HttpResponse,), {'status_code':201})()
+ if 'next' in request.REQUEST:
+ return HttpResponseRedirect(request.REQUEST['next'])
Follow.objects.get(**lookup).delete()
return type('Deleted', (HttpResponse,), {'status_code':204})() | if next in request, redirect instead of sending fancy responses | justquick_django-activity-stream | train | py |
27479927c46cbfa5def464ebefaed9c160a4c821 | diff --git a/mycluster/slurm.py b/mycluster/slurm.py
index <HASH>..<HASH> 100644
--- a/mycluster/slurm.py
+++ b/mycluster/slurm.py
@@ -95,23 +95,18 @@ def create_submit(queue_id, **kwargs):
num_tasks = 1
if 'num_tasks' in kwargs:
num_tasks = kwargs['num_tasks']
+ else:
+ raise ValueError("num_tasks must be specified")
tpn = tasks_per_node(queue_id)
queue_tpn = tpn
if 'tasks_per_node' in kwargs:
tpn = min(tpn, kwargs['tasks_per_node'])
- nc = node_config(queue_id)
- qc = available_tasks(queue_id)
-
- num_tasks = min(num_tasks, qc['max tasks'])
-
- num_threads_per_task = nc['max thread']
if 'num_threads_per_task' in kwargs:
num_threads_per_task = kwargs['num_threads_per_task']
- num_threads_per_task = min(num_threads_per_task,
- int(math.ceil(float(nc['max thread'])
- / float(tpn))))
+ else:
+ raise ValueError("num_threads_per_task must be specified")
my_name = "myclusterjob"
if 'my_name' in kwargs: | Don't silently reduce parameters passed by user | zenotech_MyCluster | train | py |
3a8db568e1d8935a5650bc4e5bbef8b944c9adb1 | diff --git a/backup/controller/backup_controller.class.php b/backup/controller/backup_controller.class.php
index <HASH>..<HASH> 100644
--- a/backup/controller/backup_controller.class.php
+++ b/backup/controller/backup_controller.class.php
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -16,7 +15,9 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package moodlecore
+ * Backup controller and related exception classes.
+ *
+ * @package core_backup
* @subpackage backup-controller
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -641,7 +642,7 @@ class backup_controller extends base_controller {
}
}
-/*
+/**
* Exception class used by all the @backup_controller stuff
*/
class backup_controller_exception extends backup_exception { | MDL-<I> backup: Code style fixes for the file | moodle_moodle | train | php |
1c11630dea75470a136101b9106387407e68c07e | diff --git a/pages/Login/subscriptions.js b/pages/Login/subscriptions.js
index <HASH>..<HASH> 100644
--- a/pages/Login/subscriptions.js
+++ b/pages/Login/subscriptions.js
@@ -1,7 +1,5 @@
-import errorManager from '@shopgate/pwa-core/classes/ErrorManager';
-import { EINVALIDCREDENTIALS } from '@shopgate/pwa-core/constants/Pipeline';
-import { SHOPGATE_USER_LOGIN_USER } from '@shopgate/pwa-common/constants/Pipelines';
-import { appWillStart$ } from '@shopgate/pwa-common/streams/app';
+import { errorManager, EINVALIDCREDENTIALS, SHOPGATE_USER_LOGIN_USER } from '@shopgate/pwa-core';
+import { appWillStart$ } from '@shopgate/pwa-common/streams';
import { toggleLogin } from 'Components/Navigator/action-creators';
import disableNavigatorSearch from 'Components/Navigator/actions/disableNavigatorSearch';
import enableNavigatorSearch from 'Components/Navigator/actions/enableNavigatorSearch'; | PWA-<I> Optimized and cleaned codebase. | shopgate_pwa | train | js |
b7fc24ef7c0951f4ea5e85e238740adafa6dc4fd | diff --git a/test/plugin-apply-test.js b/test/plugin-apply-test.js
index <HASH>..<HASH> 100644
--- a/test/plugin-apply-test.js
+++ b/test/plugin-apply-test.js
@@ -263,7 +263,8 @@ test.cb("emit inline asset", t => {
io.read(path.join(OUTPUT_PATH, "inline-asset.html")).then(output => {
io.read(sourceFile).then(source => {
- t.true(output.includes(source));
+ const sourceWithoutNewlines = source.replace(/\r?\n|\r/g, "");
+ t.true(output.includes(sourceWithoutNewlines));
t.end();
});
}); | Inconsistent webpack version newline output | jouni-kantola_templated-assets-webpack-plugin | train | js |
28993f9d51506c8c0cfd6d26c19875c58517e1d0 | diff --git a/graylog2-web-interface/webpack.config.js b/graylog2-web-interface/webpack.config.js
index <HASH>..<HASH> 100644
--- a/graylog2-web-interface/webpack.config.js
+++ b/graylog2-web-interface/webpack.config.js
@@ -160,6 +160,10 @@ if (TARGET === 'build') {
minimize: true,
sourceMap: true,
compress: {
+ // Conditionals compression caused issue #5450 so they should be disabled for now.
+ // Looking at uglify-js issues, it seems that the latest changes in version 3.4.9 broke conditionals
+ // compression. For example: https://github.com/mishoo/UglifyJS2/issues/3269
+ conditionals: false,
warnings: false,
},
mangle: { | Fix assets compression on production builds (#<I>)
Due to a bug in uglify-js <I>, compressing conditionals during asset
minimization is broken, leading to #<I>.
This commit disables conditionals compression until we can test it is fixed
in a future uglify-js release.
There are several reports in the upstream project, one of them is:
<URL> | Graylog2_graylog2-server | train | js |
aedb4a3a74fe34ffccc8aaf0743b3b2394823a40 | diff --git a/salt/utils/pyobjects.py b/salt/utils/pyobjects.py
index <HASH>..<HASH> 100644
--- a/salt/utils/pyobjects.py
+++ b/salt/utils/pyobjects.py
@@ -71,8 +71,8 @@ class StateRegistry(object):
id_,
state.full_func
))
- else:
- attr[id_] = OrderedDict()
+ else:
+ attr[id_] = OrderedDict()
# if we have requisites in our stack then add them to the state
if len(self.requisites) > 0: | Oops. <I>d9ef was wrong. The indent was right the first time. Undoing. | saltstack_salt | train | py |
8ee37421d02e527605e46de0309a3b9a9f9bac93 | diff --git a/spec/jira/resource/issue_spec.rb b/spec/jira/resource/issue_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/jira/resource/issue_spec.rb
+++ b/spec/jira/resource/issue_spec.rb
@@ -8,10 +8,10 @@ describe JIRA::Resource::Issue do
response = mock()
response.stub(:body).and_return('{"key":"foo","id":"101"}')
JIRA::Resource::Issue.stub(:collection_path).and_return('/jira/rest/api/2/issue')
- client.should_receive(:get).with('/jira/rest/api/2/issue/foo')
- .and_return(response)
- client.should_receive(:get).with('/jira/rest/api/2/issue/101')
- .and_return(response)
+ client.should_receive(:get).with('/jira/rest/api/2/issue/foo').
+ and_return(response)
+ client.should_receive(:get).with('/jira/rest/api/2/issue/101').
+ and_return(response)
issue_from_id = JIRA::Resource::Issue.find(client,101)
issue_from_key = JIRA::Resource::Issue.find(client,'foo') | Periods must be trailing for <I> | sumoheavy_jira-ruby | train | rb |
bfd10e532fe5cbd0f1e458cb7adcd4231315f2e5 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -7,7 +7,7 @@ var dynamicMatch = typeof window !== 'undefined' ? window.matchMedia : null;
function Mql(query, values){
var self = this;
if(dynamicMatch){
- var mql = dynamicMatch(query);
+ var mql = window.matchMedia(query);
this.matches = mql.matches;
this.media = mql.media;
// TODO: is there a time it makes sense to remove this listener? | Force call to window.matchMedia to work in IE<I>/IE<I> | iceddev_matchmedia | train | js |
9c519757d22514183bfc1f06a4b684b54512d861 | diff --git a/Tests/Mock/WhenBuilder.php b/Tests/Mock/WhenBuilder.php
index <HASH>..<HASH> 100644
--- a/Tests/Mock/WhenBuilder.php
+++ b/Tests/Mock/WhenBuilder.php
@@ -37,21 +37,25 @@ class WhenBuilder
/**
* @param mixed ...
+ * @return $this
*/
public function thenThrow($exception)
{
foreach (func_get_args() as $exception) {
$this->mock->_stubbed_calls[] = new CallStub($this->methodCall, Functions::throwException($exception));
}
+ return $this;
}
/**
* @param mixed ...
+ * @return $this
*/
public function thenAnswer()
{
foreach (func_get_args() as $callback) {
$this->mock->_stubbed_calls[] = new CallStub($this->methodCall, $callback);
}
+ return $this;
}
} | Added chain to mock when (issue #<I>). | letsdrink_ouzo-goodies | train | php |
9b80c24388473567bb28783d5d4afbf135ae34e6 | diff --git a/lib/core/error.js b/lib/core/error.js
index <HASH>..<HASH> 100644
--- a/lib/core/error.js
+++ b/lib/core/error.js
@@ -55,7 +55,11 @@ class MongoError extends Error {
* @returns {boolean} returns true if the error has the provided error label
*/
hasErrorLabel(label) {
- return this[kErrorLabels] && this[kErrorLabels].has(label);
+ if (this[kErrorLabels] == null) {
+ return false;
+ }
+
+ return this[kErrorLabels].has(label);
}
addErrorLabel(label) { | refactor: explicitly return a boolean for errorLabel presence | mongodb_node-mongodb-native | train | js |
d3a752872fe3f85c4e9516c3606171fed6f6db55 | diff --git a/course/lib.php b/course/lib.php
index <HASH>..<HASH> 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -418,7 +418,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
echo "</td>\n";
$fullname = fullname($log, $isteacher);
echo "<td class=\"r$row c3\" nowrap=\"nowrap\">\n";
- echo " <a href=\"../user/view.php?id={$log->userid}&course={$log->course}\">$fullname</a>\n";
+ echo " <a href=\"$CFG->wwwroot/user/view.php?id={$log->userid}&course={$log->course}\">$fullname</a>\n";
echo "</td>\n";
echo "<td class=\"r$row c4\" nowrap=\"nowrap\">\n";
link_to_popup_window( make_log_url($log->module,$log->url), 'fromloglive',"$log->module $log->action", 400, 600); | Fix for bug <I> from Tim Takemoto | moodle_moodle | train | php |
c2c54df0543bc1881bbceba83f069da747c1e35b | diff --git a/i3pystatus/xkblayout.py b/i3pystatus/xkblayout.py
index <HASH>..<HASH> 100644
--- a/i3pystatus/xkblayout.py
+++ b/i3pystatus/xkblayout.py
@@ -16,6 +16,8 @@ class Xkblayout(IntervalModule):
``layouts`` can be stated with or without variants,
e.g.: ``status.register("xkblayout", layouts=["de neo", "de"])``
+ Requires xkbgroup (from PyPI)
+
.. rubric:: Available formatters
* `{num}` — current group number | Xkblayout: document PyPI dependency | enkore_i3pystatus | train | py |
d9c4462c4ec456f71af17ed0983c3f5117958587 | diff --git a/salt/utils/process.py b/salt/utils/process.py
index <HASH>..<HASH> 100644
--- a/salt/utils/process.py
+++ b/salt/utils/process.py
@@ -806,7 +806,7 @@ def default_signals(*signals):
old_signals = {}
for signum in signals:
try:
- old_signals[signum] = signal.getsignal(signum)
+ saved_signal = signal.getsignal(signum)
signal.signal(signum, signal.SIG_DFL)
except ValueError as exc:
# This happens when a netapi module attempts to run a function
@@ -816,6 +816,8 @@ def default_signals(*signals):
'Failed to register signal for signum %d: %s',
signum, exc
)
+ else:
+ old_signals[signum] = saved_signal
# Do whatever is needed with the reset signals
yield | Fix <I> error when using wheel_async
When `wheel_async` is used, the job completes, but for the same reason
we couldn't replace the signal in the first place, we fail to restore it
after control is returned to the context manager.
This fixes this by only adding the signal data to the `old_signals` dict
when we successfully override the signal handling, so that we don't
incorrectly attempt to "restore" the signal later. | saltstack_salt | train | py |
cc1264a83e5c2455d7b5cb1ae661af262a53e800 | diff --git a/timer.go b/timer.go
index <HASH>..<HASH> 100644
--- a/timer.go
+++ b/timer.go
@@ -24,14 +24,14 @@ func (t *Timer) Finish() {
// Writes a log message with extra data or the elapsed time shown. Pass nil or
// use Finish() if there is no extra data.
-func (t *Timer) Log(data Data) {
+func (t *Timer) Log(data Data) error {
if data == nil {
data = make(Data)
}
data["at"] = "finish"
data["elapsed"] = t.durationUnit(t.Elapsed())
- t.context.Log(data)
+ return t.context.Log(data)
}
func (t *Timer) Elapsed() time.Duration { | Timer is a Logger too | technoweenie_grohl | train | go |
db6042e91b1b8dfafa2ae51e9e2b8c4d07b6a329 | diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py
index <HASH>..<HASH> 100644
--- a/pyrogram/client/client.py
+++ b/pyrogram/client/client.py
@@ -615,7 +615,7 @@ class Client(Methods, BaseClient):
if phone is not None:
self.peers_by_phone[phone] = input_peer
- if isinstance(entity, types.Chat):
+ if isinstance(entity, (types.Chat, types.ChatForbidden)):
chat_id = entity.id
peer_id = -chat_id
@@ -625,7 +625,7 @@ class Client(Methods, BaseClient):
self.peers_by_id[peer_id] = input_peer
- if isinstance(entity, types.Channel):
+ if isinstance(entity, (types.Channel, types.ChannelForbidden)):
channel_id = entity.id
peer_id = int("-100" + str(channel_id))
@@ -634,7 +634,7 @@ class Client(Methods, BaseClient):
if access_hash is None:
continue
- username = entity.username
+ username = getattr(entity, "username", None)
input_peer = types.InputPeerChannel(
channel_id=channel_id, | Fetch ChatForbidden and ChannelForbidden peers
This fixes unwanted PEER_ID_INVALID errors in cases where a user or a
bot was kicked/banned from a group, supergroup or channel | pyrogram_pyrogram | train | py |
a334ddbcd22d34bc03baf09267aeeb4ed65d9ed3 | diff --git a/iktomi/web/url_templates.py b/iktomi/web/url_templates.py
index <HASH>..<HASH> 100644
--- a/iktomi/web/url_templates.py
+++ b/iktomi/web/url_templates.py
@@ -66,7 +66,7 @@ def construct_re(url_template, match_whole_str=False, converters=None,
variable = groups['variable']
builder_params.append((variable, conv_object))
url_params[variable] = conv_object
- result += '(?P<%s>[.a-zA-Z0-9_%%:-]+)' % variable
+ result += '(?P<%s>[.a-zA-Z0-9:@&+$,_%%-]+)' % variable
continue
raise ValueError('Incorrect url template "%s"' % url_template)
if match_whole_str: | all unquoted by webob symbols #<I>
all unquoted by webob symbols are included in URL template regex #<I> | SmartTeleMax_iktomi | train | py |
a0d91b0c5e613a6eb744f365736562f2c239b3bf | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from os import path
from distutils.version import LooseVersion
from setuptools import find_packages, setup
-VERSION = '1.25.3'
+VERSION = '1.25.4'
# Import README.md into long_description
pwd = path.abspath(path.dirname(__file__)) | Bump package version to <I> | instana_python-sensor | train | py |
26d92d282f9f227ce62a60d419c83dd1c4b4bbcf | diff --git a/modules/system/classes/ErrorHandler.php b/modules/system/classes/ErrorHandler.php
index <HASH>..<HASH> 100644
--- a/modules/system/classes/ErrorHandler.php
+++ b/modules/system/classes/ErrorHandler.php
@@ -49,7 +49,7 @@ class ErrorHandler extends ErrorHandlerBase
// Route to the CMS error page.
$controller = new Controller($theme);
- return $controller->run('/error');
+ return $controller->run('/error')->getContent();
}
/** | Fixed custom error pages outputting headers
If we don't have this method called, then the controller returns an object. From then on, [Symfony converts this object in to a string](<URL>` returns a string and everything works as expected. | octobercms_october | train | php |
0db521a2812f016e7c54a018bde24a00f3a7d25a | diff --git a/svchost/auth/credentials.go b/svchost/auth/credentials.go
index <HASH>..<HASH> 100644
--- a/svchost/auth/credentials.go
+++ b/svchost/auth/credentials.go
@@ -16,6 +16,10 @@ import (
// there is no good reason to do so.
type Credentials []CredentialsSource
+// NoCredentials is an empty CredentialsSource that always returns nil
+// when asked for credentials.
+var NoCredentials CredentialsSource = Credentials{}
+
// A CredentialsSource is an object that may be able to provide credentials
// for a given host.
// | svchost/auth: expose a "NoCredentials" credentials source
For situations where no credentials are needed but where a working
CredentialsSource is still required, this variable provides a convenient
way to get a fully-functional-but-empty credentials source. | hashicorp_terraform | train | go |
b76d0c6dac6930b7b64f798574b833f408359ed0 | diff --git a/lib/array.js b/lib/array.js
index <HASH>..<HASH> 100644
--- a/lib/array.js
+++ b/lib/array.js
@@ -1 +1,16 @@
+//Delete an element of the array
+module.exports.delete = function(array, item)
+{
+ //Get the index of the item
+ var index = array.indexOf(item);
+ //Check the index
+ if(index !== -1)
+ {
+ //Remove the item from the array
+ array.splice(index, 1);
+ }
+
+ //Return the array
+ return array;
+}; | lib/array.js: added method to remove an element of an array | jmjuanes_utily | train | js |
a598458c464b88535e711ef7ef55f88e25c1820f | diff --git a/rllib/models/torch/complex_input_net.py b/rllib/models/torch/complex_input_net.py
index <HASH>..<HASH> 100644
--- a/rllib/models/torch/complex_input_net.py
+++ b/rllib/models/torch/complex_input_net.py
@@ -115,6 +115,7 @@ class ComplexInputNetwork(TorchModelV2, nn.Module):
name="one_hot_{}".format(i),
)
concat_size += self.one_hot[i].num_outputs
+ self.add_module("one_hot_{}".format(i), self.one_hot[i])
# Everything else (1D Box).
else:
size = int(np.product(component.shape))
@@ -133,6 +134,7 @@ class ComplexInputNetwork(TorchModelV2, nn.Module):
)
self.flatten_dims[i] = size
concat_size += self.flatten[i].num_outputs
+ self.add_module("flatten_{}".format(i), self.flatten[i])
# Optional post-concat FC-stack.
post_fc_stack_config = { | [RLlib] Fix complex torch one-hot and flattened layers not being added to module list. (#<I>) | ray-project_ray | train | py |
b9671e96e40b38d0662dbe0e32dca0ca0c5fe62e | diff --git a/tensor2tensor/rl/trainer_model_based_test.py b/tensor2tensor/rl/trainer_model_based_test.py
index <HASH>..<HASH> 100644
--- a/tensor2tensor/rl/trainer_model_based_test.py
+++ b/tensor2tensor/rl/trainer_model_based_test.py
@@ -17,6 +17,9 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
+import os
+import shutil
+
from tensor2tensor.rl import trainer_model_based
import tensorflow as tf
@@ -26,10 +29,19 @@ FLAGS = tf.flags.FLAGS
class ModelRLExperimentTest(tf.test.TestCase):
- def test_basic(self):
+ def setUp(self):
+ super(ModelRLExperimentTest, self).setUp()
FLAGS.output_dir = tf.test.get_temp_dir()
- FLAGS.loop_hparams_set = "rl_modelrl_tiny"
+ shutil.rmtree(FLAGS.output_dir)
+ os.mkdir(FLAGS.output_dir)
FLAGS.schedule = "train" # skip evaluation for world model training
+
+ def test_basic(self):
+ FLAGS.loop_hparams_set = "rl_modelrl_tiny"
+ trainer_model_based.main(None)
+
+ def test_ae(self):
+ FLAGS.loop_hparams_set = "rl_modelrl_ae_tiny"
trainer_model_based.main(None) | Add a test for the AE experiment | tensorflow_tensor2tensor | train | py |
8632c4cc2082457eb72ccd3c4a337180fc95b5e1 | diff --git a/tests/test_hdate.py b/tests/test_hdate.py
index <HASH>..<HASH> 100644
--- a/tests/test_hdate.py
+++ b/tests/test_hdate.py
@@ -73,3 +73,14 @@ class TestHDate(object):
@pytest.mark.parametrize('execution_number', range(10))
def test_hdate_get_size_of_hebrew_years(self, execution_number, random_hdate):
assert random_hdate._h_size_of_year == hj._get_size_of_hebrew_year(random_hdate._h_year)
+
+ def test_rosh_hashana_day_of_week(self, random_hdate):
+ for year, info in HEBREW_YEARS_INFO.items():
+ random_hdate.hdate_set_hdate(random_hdate._h_day, random_hdate._h_month, year)
+ assert random_hdate._h_new_year_weekday == info[0]
+
+ def test_pesach_day_of_week(self, random_hdate):
+ for year, info in HEBREW_YEARS_INFO.items():
+ random_hdate.hdate_set_hdate(15, 7, year)
+ assert random_hdate._weekday == info[2]
+ assert random_hdate.get_holyday() == 15 | Test for first day of rosh hashana and pesach | royi1000_py-libhdate | train | py |
1605854a866b290d65141c6ea701d9192bf07445 | diff --git a/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java b/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
index <HASH>..<HASH> 100644
--- a/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
+++ b/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
@@ -1042,7 +1042,7 @@ public class CmsDefaultXmlContentHandler implements I_CmsXmlContentHandler {
public boolean isSearchable(I_CmsXmlContentValue value) {
// check for name configured in the annotations
- Boolean anno = m_searchSettings.get(value.getName());
+ Boolean anno = m_searchSettings.get(CmsXmlUtils.removeXpath(value.getPath()));
// if no annotation has been found, use default for value
return (anno == null) ? value.isSearchable() : anno.booleanValue();
} | Improved XSD search settings for considering XPaths instead names. | alkacon_opencms-core | train | java |
a1f4221fc8c1b5776f57beb46488aabbe1b7bcb4 | diff --git a/jenetics/src/main/java/io/jenetics/AbstractAlterer.java b/jenetics/src/main/java/io/jenetics/AbstractAlterer.java
index <HASH>..<HASH> 100644
--- a/jenetics/src/main/java/io/jenetics/AbstractAlterer.java
+++ b/jenetics/src/main/java/io/jenetics/AbstractAlterer.java
@@ -26,7 +26,7 @@ import io.jenetics.internal.util.Requires;
*
* @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
* @since 1.0
- * @version 3.0
+ * @version 5.2
*/
public abstract class AbstractAlterer<
G extends Gene<?, G>, | Set getter as deprecated. | jenetics_jenetics | train | java |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.