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
0039ba600527bc579094269b1411f991a5f2650c
diff --git a/js/core/telemetryV3Interface.js b/js/core/telemetryV3Interface.js index <HASH>..<HASH> 100644 --- a/js/core/telemetryV3Interface.js +++ b/js/core/telemetryV3Interface.js @@ -128,12 +128,9 @@ var Telemetry = (function() { this.telemetry.assess = function(data, options) { instance.updateValues(options); assessEvent = instance.getEvent('ASSESS', data); - // This code will replace current version with the new version number, if present in the data. - if (data.item && data.item.eventVer) { - assessEvent.ver = data.item.eventVer; - delete assessEvent.edata.item.eventVer; - } - instance._dispatch(assessEvent); + // This code will replace current version with the new version number, if present in options. + if (options && options.eventVer) assessEvent.ver = options.eventVer; + instance._dispatch(assessEvent); } /**
Issue #SB-<I> fix: Default assess event version will be overridden
project-sunbird_sunbird-telemetry-sdk
train
js
15b97a44eae813bd3ce6d49ba6881bf265331c5f
diff --git a/src/timepicker/timepicker.js b/src/timepicker/timepicker.js index <HASH>..<HASH> 100644 --- a/src/timepicker/timepicker.js +++ b/src/timepicker/timepicker.js @@ -27,6 +27,7 @@ export class MdTimePicker { twelvehour: this.twelveHour }; $(this.element).pickatime(options); + this.element.value = this.value; } detached() {
fix(md-timepicker): Set value if assigned before the attach
aurelia-ui-toolkits_aurelia-materialize-bridge
train
js
4a0890f183d9c2c31a21805ab84d84d27c7eae3d
diff --git a/src/App.php b/src/App.php index <HASH>..<HASH> 100644 --- a/src/App.php +++ b/src/App.php @@ -440,10 +440,13 @@ class App extends \samson\cms\App // form relative path to the image $dir = quotemeta(__SAMSON_BASE__); - if ($dir == '/') { - return substr($path, 1); - } else { - return preg_replace('/' . addcslashes($dir, '/') . '/', '', $path); + // TODO: WTF? Why do we need this, need comments!!! + if (strpos($path, 'http://') === false) { + if ($dir == '/') { + return substr($path, 1); + } else { + return preg_replace('/' . addcslashes($dir, '/') . '/', '', $path); + } } } }
Temporary fixed bug with removing first character from image path loigc based on __SAMSON_BASE @omaximus check it!
samsonos_cms_app_gallery
train
php
c183e1953995961995e1deb2afcf6d17591a004e
diff --git a/aioboto3/s3/inject.py b/aioboto3/s3/inject.py index <HASH>..<HASH> 100644 --- a/aioboto3/s3/inject.py +++ b/aioboto3/s3/inject.py @@ -190,14 +190,15 @@ async def upload_fileobj(self, Fileobj: BinaryIO, Bucket: str, Key: str, ExtraAr # Success, add the result to the finished_parts, increment the sent_bytes finished_parts.append({'ETag': resp['ETag'], 'PartNumber': part_args['PartNumber']}) - sent_bytes += len(part_args['Body']) + current_bytes = len(part_args['Body']) + sent_bytes += current_bytes uploaded_parts += 1 logger.debug('Uploaded part to S3') # Call the callback, if it blocks then not good :/ if Callback: try: - Callback(sent_bytes) + Callback(current_bytes) except: # noqa: E722 pass
Changed callback to use current bytes rather than cumulative bytes
terrycain_aioboto3
train
py
031febd265b47354dc3d8a895a84214538c0632f
diff --git a/src/Controller/Base.php b/src/Controller/Base.php index <HASH>..<HASH> 100644 --- a/src/Controller/Base.php +++ b/src/Controller/Base.php @@ -143,7 +143,6 @@ abstract class Base extends BaseMiddle $oAsset->load('admin.min.js', 'nails/module-admin'); $oAsset->load('nails.admin.min.js', 'NAILS'); $oAsset->load('nails.forms.min.js', 'NAILS'); - $oAsset->load('nails.api.min.js', 'NAILS'); // Component assets foreach (Components::available() as $oComponent) { @@ -186,11 +185,7 @@ abstract class Base extends BaseMiddle $aJs = [ // @todo (Pablo - 2019-12-05) - Remove these items (move into module-admin/admin.js as components) - 'var _nails_admin,_nails_api, _nails_forms;', - - 'if (typeof(NAILS_API) === "function"){', - '_nails_api = new NAILS_API();', - '}', + 'var _nails_admin, _nails_forms;', 'if (typeof(NAILS_Admin) === "function"){', '_nails_admin = new NAILS_Admin();',
Removes outdated Nails API JS lib
nails_module-admin
train
php
e906d4d6430071dbe7269a13b48641979d60c005
diff --git a/pex/pex_bootstrapper.py b/pex/pex_bootstrapper.py index <HASH>..<HASH> 100644 --- a/pex/pex_bootstrapper.py +++ b/pex/pex_bootstrapper.py @@ -156,6 +156,13 @@ def bootstrap_pex(entry_point): pex.PEX(entry_point).execute() +# NB: This helper is used by third party libs - namely https://github.com/wickman/lambdex. +# TODO(John Sirois): Kill once https://github.com/wickman/lambdex/issues/5 is resolved. +def is_compressed(entry_point): + from .pex_info import PexInfo + return os.path.exists(entry_point) and not os.path.exists(os.path.join(entry_point, PexInfo.PATH)) + + def bootstrap_pex_env(entry_point): """Bootstrap the current runtime environment using a given pex.""" pex_info = _bootstrap(entry_point)
Restore `pex.pex_bootstrapper.is_compressed` API. (#<I>) This was eliminated in #<I> since it was (locally) unused but it turns out it was used over in lambdex. The long term fix allowing safe removal of the API is tracked by: <URL>
pantsbuild_pex
train
py
d78063c7bb0f216a8991cb207a5442e8f8bb2621
diff --git a/mr/awsome/config.py b/mr/awsome/config.py index <HASH>..<HASH> 100644 --- a/mr/awsome/config.py +++ b/mr/awsome/config.py @@ -1,6 +1,7 @@ from mr.awsome.common import Hooks from ConfigParser import RawConfigParser import os +import warnings class BaseMassager(object): @@ -89,15 +90,19 @@ class Config(dict): 'plain': { 'module': 'mr.awsome.plain'}} if 'instance' in self: + warnings.warn("The 'instance' section type is deprecated, use 'ec2-instance' instead.") self['ec2-instance'] = self['instance'] del self['instance'] if 'securitygroup' in self: + warnings.warn("The 'securitygroup' section type is deprecated, use 'ec2-securitygroup' instead.") self['ec2-securitygroup'] = self['securitygroup'] del self['securitygroup'] if 'server' in self: + warnings.warn("The 'server' section type is deprecated, use 'plain-instance' instead.") self['plain-instance'] = self['server'] del self['server'] if 'global' in self and 'aws' in self['global']: + warnings.warn("The 'aws' section type is deprecated, define an 'ec2-master' instead.") self.setdefault('ec2-master', {}) self['ec2-master']['default'] = self['global']['aws'] del self['global']['aws']
Warn about deprecated section names.
ployground_ploy_fabric
train
py
579c8e5f9cdafc8b0996b5570d1b6466e72c5ad8
diff --git a/contrib/ovirt/test_scenarios/bootstrap.py b/contrib/ovirt/test_scenarios/bootstrap.py index <HASH>..<HASH> 100644 --- a/contrib/ovirt/test_scenarios/bootstrap.py +++ b/contrib/ovirt/test_scenarios/bootstrap.py @@ -172,14 +172,14 @@ def add_iscsi_storage_domain(prefix): api = prefix.virt_env.engine_vm().get_api() # Find LUN GUIDs - ret = prefix.virt_env.get_vm('storage-iscsi').ssh( + ret, out, _ = prefix.virt_env.get_vm('storage-iscsi').ssh( ['multipath', '-ll'], ) - nt.assert_equals(ret.code, 0) + nt.assert_equals(ret, 0) lun_guids = [ line.split()[0] - for line in ret.out.split('\n') + for line in out.split('\n') if line.find('LIO-ORG') != -1 ]
Revert ssh ret changes until ssh methods are done Change-Id: I<I>fc<I>a<I>bac3d<I>b<I>c<I>f3f<I>afadec
lago-project_lago
train
py
d8e2484eb0e21aca22f2623e909c319df8b3e918
diff --git a/closure/goog/fx/dragger.js b/closure/goog/fx/dragger.js index <HASH>..<HASH> 100644 --- a/closure/goog/fx/dragger.js +++ b/closure/goog/fx/dragger.js @@ -469,7 +469,7 @@ goog.fx.Dragger.prototype.setupDragHandlers = function() { this.eventHandler_.listen( doc, [goog.events.EventType.TOUCHMOVE, goog.events.EventType.MOUSEMOVE], - this.handleMove_, useCapture); + this.handleMove_, {capture: useCapture, passive: false}); this.eventHandler_.listen( doc, [goog.events.EventType.TOUCHEND, goog.events.EventType.MOUSEUP], this.endDrag, useCapture);
Closure: Dragger: Make touchmove listener cancellable to prevent Chrome from panning. See <URL>
google_closure-library
train
js
e7235d68b03dc5d1b5f83889f2dc868da85593fd
diff --git a/hererocks.py b/hererocks.py index <HASH>..<HASH> 100755 --- a/hererocks.py +++ b/hererocks.py @@ -1173,7 +1173,6 @@ def main(argv=None): bat_h.write(b"set exitcode=%errorlevel%\r\n") bat_h.write(b"if %exitcode% equ 0 (\r\n") - bat_h.write(b" endlocal\r\n") bat_h.write(b" {}\r\n".format(recursive_call)) bat_h.write(b") else (\r\n") @@ -1181,7 +1180,6 @@ def main(argv=None): bat_h.write(b' type "{}"\r\n'.format(setup_output_name)) bat_h.write(b" echo Error: got exitcode %exitcode% from command {}\r\n".format(vs_setup_cmd)) - bat_h.write(b" endlocal\r\n") bat_h.write(b" exit /b 1\r\n") bat_h.write(b")\r\n") bat_h.close()
Don't run endlocal before recursive call
mpeterv_hererocks
train
py
2796407fe87d67c23d313ef7cb59cb473a81d0be
diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ClientUpgradeCodec.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ClientUpgradeCodec.java index <HASH>..<HASH> 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ClientUpgradeCodec.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ClientUpgradeCodec.java @@ -111,7 +111,6 @@ public class Http2ClientUpgradeCodec implements HttpClientUpgradeHandler.Upgrade } @Override - public CharSequence protocol() { return HTTP_UPGRADE_PROTOCOL_NAME; }
Remove unnecessary line in Http2ClientUpgradeCodec (#<I>) Motivation: To clean up code. Modification: Remove unnecessary line. Result: There's no functional change.
netty_netty
train
java
f7de062249ae9251ce3d5cf5134d63e0ed0dba4e
diff --git a/src/main/java/com/rabbitmq/http/client/domain/AbstractPagination.java b/src/main/java/com/rabbitmq/http/client/domain/AbstractPagination.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/rabbitmq/http/client/domain/AbstractPagination.java +++ b/src/main/java/com/rabbitmq/http/client/domain/AbstractPagination.java @@ -40,6 +40,7 @@ public abstract class AbstractPagination { itemCount = totalItems; totalCount = totalItems; pageCount = 1; + page = 1; pageSize = totalItems; filteredCount = totalItems; }
Initialize AbstractPagination with page 1 when initialized directly from an array
rabbitmq_hop
train
java
a6e5dab784fe148c4aa5d4a69c08ae64ceb77164
diff --git a/spring-vaadin/src/main/java/org/vaadin/spring/servlet/SpringAwareUIProvider.java b/spring-vaadin/src/main/java/org/vaadin/spring/servlet/SpringAwareUIProvider.java index <HASH>..<HASH> 100644 --- a/spring-vaadin/src/main/java/org/vaadin/spring/servlet/SpringAwareUIProvider.java +++ b/spring-vaadin/src/main/java/org/vaadin/spring/servlet/SpringAwareUIProvider.java @@ -53,7 +53,7 @@ public class SpringAwareUIProvider extends UIProvider { Class<?> beanType = webApplicationContext.getType(uiBeanName); if (UI.class.isAssignableFrom(beanType)) { logger.info(String.format("Found Vaadin UI [%s]", beanType.getCanonicalName())); - final String path = beanType.getAnnotation(VaadinUI.class).path(); + final String path = webApplicationContext.findAnnotationOnBean(uiBeanName, VaadinUI.class).path(); Class<? extends UI> existingBeanType = pathToUIMap.get(path); if (existingBeanType != null) { throw new IllegalStateException(String.format("[%s] is already mapped to the path [%s]", existingBeanType.getCanonicalName(), path));
Now using the application context to ask for annotations
peholmst_vaadin4spring
train
java
c82847a64cc78299f5b0b8266bc04767ca812640
diff --git a/DependencyInjection/MonologExtension.php b/DependencyInjection/MonologExtension.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/MonologExtension.php +++ b/DependencyInjection/MonologExtension.php @@ -125,7 +125,7 @@ class MonologExtension extends Extension $handler['level'], $handler['bubble'], )); - $definition->addTag('kernel.listener', array('event' => 'onCoreResponse')); + $definition->addTag('kernel.listener', array('event' => 'core.response', 'method' => 'onCoreResponse')); break; case 'rotating_file':
[EventDispatcher] Allow registration of arbitrary callbacks This in effect removes the direct link between event name and the method name on the handler. Any callback can be given as a handler and the event name becomes an arbitrary string. Allowing for easier namespacing (see next commit)
symfony_monolog-bundle
train
php
3095a22503e4508b6de3519c13644e44ccf220a1
diff --git a/app/Module/BatchUpdate/BatchUpdateBasePlugin.php b/app/Module/BatchUpdate/BatchUpdateBasePlugin.php index <HASH>..<HASH> 100644 --- a/app/Module/BatchUpdate/BatchUpdateBasePlugin.php +++ b/app/Module/BatchUpdate/BatchUpdateBasePlugin.php @@ -148,7 +148,7 @@ class BatchUpdateBasePlugin { public static function createEditLinks($gedrec, GedcomRecord $record) { return preg_replace( "/@([^#@\n]+)@/m", - '<a href="'. e(route('edit-raw-record', ['ged' => $record->getTree()->getName(), 'xref' => $record->getXref()])) .'">@\\1@</a>', + '<a href="' . e(route('edit-raw-record', ['ged' => $record->getTree()->getName(), 'xref' => $record->getXref()])) . '">@\\1@</a>', $gedrec ); }
Scrutinizer Auto-Fixes (#<I>) This commit consists of patches automatically generated for this project on <URL>
fisharebest_webtrees
train
php
690a1e04bd945c51f1c7b46c711d105b474f90bc
diff --git a/cbamf/interpolation.py b/cbamf/interpolation.py index <HASH>..<HASH> 100644 --- a/cbamf/interpolation.py +++ b/cbamf/interpolation.py @@ -146,8 +146,7 @@ class ChebyshevInterpolation1D(object): Evaluates an individual Chebyshev polynomial `k` in coordinate space with proper transformation given the window """ - weights = np.zeros(k+1) - weights[k] = 1. + weights = np.diag(np.ones(k+1))[k] return np.polynomial.chebyshev.chebval(self._x2c(x), weights) def __call__(self, x):
quicker way to get chebval for a single poly
peri-source_peri
train
py
7dc1d50809a9f1c6b593c41949c28896c6ee0dd7
diff --git a/astroid/inference.py b/astroid/inference.py index <HASH>..<HASH> 100644 --- a/astroid/inference.py +++ b/astroid/inference.py @@ -307,6 +307,8 @@ def infer_attribute(self, context=None): except exceptions._NonDeducibleTypeHierarchy: # Can't determine anything useful. pass + elif not context: + context = contextmod.InferenceContext() try: context.boundnode = owner
Don't crash upon invalid contex on attr. inference (#<I>)
PyCQA_astroid
train
py
a644eb4472ab61cdef8405b4e42bc9892f2e9295
diff --git a/plugin/hosts/hostsfile_test.go b/plugin/hosts/hostsfile_test.go index <HASH>..<HASH> 100644 --- a/plugin/hosts/hostsfile_test.go +++ b/plugin/hosts/hostsfile_test.go @@ -45,16 +45,13 @@ var ( singlelinehosts = `127.0.0.2 odin` ipv4hosts = `# See https://tools.ietf.org/html/rfc1123. # - # The literal IPv4 address parser in the net package is a relaxed - # one. It may accept a literal IPv4 address in dotted-decimal notation - # with leading zeros such as "001.2.003.4". # internet address and host name 127.0.0.1 localhost # inline comment separated by tab - 127.000.000.002 localhost # inline comment separated by space + 127.0.0.2 localhost # inline comment separated by space # internet address, host name and aliases - 127.000.000.003 localhost localhost.localdomain` + 127.0.0.3 localhost localhost.localdomain` ipv6hosts = `# See https://tools.ietf.org/html/rfc5952, https://tools.ietf.org/html/rfc4007. # internet address and host name
The IPv4 parser no longer accepts leading zeros (#<I>)
coredns_coredns
train
go
ceba5155ab1b4f7cd1b431da3db97d9feef9e3d1
diff --git a/src/extensions/filter-control/utils.js b/src/extensions/filter-control/utils.js index <HASH>..<HASH> 100644 --- a/src/extensions/filter-control/utils.js +++ b/src/extensions/filter-control/utils.js @@ -359,7 +359,10 @@ export function createControls (that, header) { $.each(that.columns, (_, column) => { html = [] - if (!column.visible) { + if ( + !column.visible && + !(that.options.filterControlContainer && $(`.bootstrap-table-filter-control-${column.field}`).length >= 1) + ) { return }
Allow filtering of not visible columns if filterControlContainer is used (#<I>)
wenzhixin_bootstrap-table
train
js
5b8f52563433594f360e4ea42163717a42514cf3
diff --git a/src/OoGlee/Domain/Providers/LaravelServiceProvider.php b/src/OoGlee/Domain/Providers/LaravelServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/OoGlee/Domain/Providers/LaravelServiceProvider.php +++ b/src/OoGlee/Domain/Providers/LaravelServiceProvider.php @@ -120,14 +120,6 @@ abstract class LaravelServiceProvider extends ServiceProvider { { if (isLaravel5()) { - // Bind the returned class to the namespace packageConfigClass - $this->app->bind($this->packageConfigClass, function($app) - { - $configNameSpace = 'vendor.'.$this->packageVendor.'.'.$this->packageName.'.'; - // Register the corresponding config for package - return new $this->packageConfigClass($app['config'], $configNameSpace); - }); - $this->app->bindShared($this->packageName.'.config', function($app) { $configNameSpace = 'vendor.'.$this->packageVendor.'.'.$this->packageName.'.';
fix: Enable dynamic config class resolution
RowlandOti_ooglee-core
train
php
ac43c245e6c87a7bbf2529bd45c9fd93e091c518
diff --git a/scripts/create_index.js b/scripts/create_index.js index <HASH>..<HASH> 100644 --- a/scripts/create_index.js +++ b/scripts/create_index.js @@ -1,7 +1,7 @@ const child_process = require('child_process'); const config = require('pelias-config').generate(); const es = require('elasticsearch'); -const SUPPORTED_ES_VERSIONS = '>=6.8.5 || >=7.5.1'; +const SUPPORTED_ES_VERSIONS = '>=6.5.4 || >=7.4.2'; const cli = require('./cli'); const schema = require('../schema');
Add flexibility regarding older minor ES versions In order to allow people using reasonably new, but not the newest, releases on each of our supported Elasticsearch major versions, this lowers the version requirements sightly. We may continue to update these versions over time either for increased flexibility or to reflect features required by Pelias. <URL>
pelias_schema
train
js
99e1dc45adfdde9c8f7dc80f31e49df2ef034a0c
diff --git a/tests/__init__.py b/tests/__init__.py index <HASH>..<HASH> 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -11,6 +11,7 @@ try: except ImportError: from io import StringIO import subprocess +import sys from tempfile import NamedTemporaryFile import unittest @@ -25,7 +26,10 @@ import utility @contextmanager def stdout_guard(): - stdout = io.BytesIO() + if isinstance(sys.stdout, io.TextIOWrapper): + stdout = io.StringIO() + else: + stdout = io.BytesIO() with patch('sys.stdout', stdout): yield if stdout.getvalue() != '': @@ -128,7 +132,10 @@ setup_test_logging.__test__ = False @contextmanager def parse_error(test_case): - stderr = io.BytesIO() + if isinstance(sys.stdout, io.TextIOWrapper): + stderr = io.StringIO() + else: + stderr = io.BytesIO() with test_case.assertRaises(SystemExit): with patch('sys.stderr', stderr): yield stderr
Use StringIO or BytesIO as stdin/stderr replacement as needed.
juju_juju
train
py
ef437ea44831c949650376c24f925a023f4192db
diff --git a/src/_pytest/junitxml.py b/src/_pytest/junitxml.py index <HASH>..<HASH> 100644 --- a/src/_pytest/junitxml.py +++ b/src/_pytest/junitxml.py @@ -410,7 +410,7 @@ def pytest_addoption(parser): "Write captured log messages to JUnit report: " "one of no|system-out|system-err", default="no", - ) # choices=['no', 'stdout', 'stderr']) + ) parser.addini( "junit_log_passing_tests", "Capture log information for passing tests to JUnit report: ",
Remove incorrect choices comment (#<I>)
pytest-dev_pytest
train
py
44428f67f41384c03aea13e7e25f884764653617
diff --git a/benchexec/container.py b/benchexec/container.py index <HASH>..<HASH> 100644 --- a/benchexec/container.py +++ b/benchexec/container.py @@ -231,9 +231,10 @@ def get_mount_points(): (this avoids encoding problems with mount points with problematic characters). """ def decode_path(path): - # replace tab and space escapes with actual characters - # (according to man 5 fstab, only these are escaped) - return path.replace(br"\011", b"\011").replace(br"\040", b"\040") + # Replace tab, space, newline, and backslash escapes with actual characters. + # According to man 5 fstab, only tab and space escaped, but Linux escapes more: + # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc_namespace.c?id=12a54b150fb5b6c2f3da932dc0e665355f8a5a48#n85 + return path.replace(br"\011", b"\011").replace(br"\040", b"\040").replace(br"\012", b"\012").replace(br"\134", b"\134") with open("/proc/self/mounts", "rb") as mounts: # The format of this file is the same as of /etc/fstab (cf. man 5 fstab)
unescape more charcters in /proc/self/mounts
sosy-lab_benchexec
train
py
e5e5b5583a6904a82cd7f540047e9b0ff8a78737
diff --git a/src/utils.js b/src/utils.js index <HASH>..<HASH> 100644 --- a/src/utils.js +++ b/src/utils.js @@ -398,7 +398,8 @@ export function firefoxStrictMinVersion(manifestJson) { if ( manifestJson.applications && manifestJson.applications.gecko && - manifestJson.applications.gecko.strict_min_version + manifestJson.applications.gecko.strict_min_version && + typeof manifestJson.applications.gecko.strict_min_version === 'string' ) { return parseInt( manifestJson.applications.gecko.strict_min_version.split('.')[0], diff --git a/tests/unit/test.utils.js b/tests/unit/test.utils.js index <HASH>..<HASH> 100644 --- a/tests/unit/test.utils.js +++ b/tests/unit/test.utils.js @@ -512,6 +512,14 @@ describe('firefoxStrictMinVersion', () => { }) ).toEqual(60); }); + + it('should return null when value is not a string', () => { + expect( + firefoxStrictMinVersion({ + applications: { gecko: { strict_min_version: 12.3 } }, + }) + ).toEqual(null); + }); }); describe('basicCompatVersionComparison', () => {
Prevent error when strict_min_version is not a string value (#<I>)
mozilla_addons-linter
train
js,js
7cbd9ed702eec441d996d5348da02ae2a36bb0de
diff --git a/test/cli.js b/test/cli.js index <HASH>..<HASH> 100644 --- a/test/cli.js +++ b/test/cli.js @@ -6,7 +6,10 @@ var expect = require('code').expect; var Chalk = require('chalk'); var CLI = require('../lib/cli'); var Commands = require('../lib/commands'); -var fullHelp = Object.keys(Commands).map(function (command) { +var Pkg = require('../package.json'); + +var header = Chalk.bold('requireSafe(+)') + ' v' + Pkg.version + '\n\n'; +var fullHelp = header + Object.keys(Commands).map(function (command) { return [ ' ' + Chalk.bold(command),
adds the version # to the help header cause it's useful
nodesecurity_nsp
train
js
4f2bffcae8fe1c594ea69d2e37a4e5192c7dfa00
diff --git a/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java b/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java index <HASH>..<HASH> 100644 --- a/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java +++ b/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java @@ -12,8 +12,8 @@ public class CursorWithError { private final Vtrpc.RPCError error; public CursorWithError(Query.ResultWithError resultWithError) { - if (null == resultWithError.getError() || Vtrpc.ErrorCode.SUCCESS == resultWithError - .getError().getCode()) { + if (!resultWithError.hasError() || + Vtrpc.ErrorCode.SUCCESS == resultWithError.getError().getCode()) { this.cursor = new SimpleCursor(resultWithError.getResult()); this.error = null; } else {
Fixing a java error. Was picked up by our internal java compiler: a proto returned value cannot be null.
vitessio_vitess
train
java
36c9b145aa08571a833063bafe146735fb55d1ea
diff --git a/tests/test_process.py b/tests/test_process.py index <HASH>..<HASH> 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -158,7 +158,7 @@ class ProcessTestCase(unittest.TestCase): cfg = {"noprealloc": True, "smallfiles": True, "oplogSize": 10} config_path = process.write_config(cfg) self.tmp_files.append(config_path) - result = process.mprocess(bin_path, config_path, port=port, timeout=60) + result = process.mprocess(bin_path, config_path, port=port, timeout=300) self.assertTrue(isinstance(result, tuple)) pid, host = result self.assertTrue(isinstance(pid, int))
Update tests/test_process.py
10gen_mongo-orchestration
train
py
6969b70aa532f623c7d8fccea63f765b0b2a5468
diff --git a/enrol/ldap/db/install.php b/enrol/ldap/db/install.php index <HASH>..<HASH> 100644 --- a/enrol/ldap/db/install.php +++ b/enrol/ldap/db/install.php @@ -96,5 +96,7 @@ function xmldb_enrol_ldap_install() { } // Remove a setting that's never been used at all - unset_config('enrol_ldap_user_memberfield'); + if (isset($CFG->enrol_ldap_user_memberfield)) { + unset_config('enrol_ldap_user_memberfield'); + } }
enrol/ldap: MDL-<I> don't use $CFG->enrol_ldap_user_memberfield if it's not defined
moodle_moodle
train
php
38b0984331caf9d73a313b6f4759cfec517889a2
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/binary/type-serializers.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/binary/type-serializers.js index <HASH>..<HASH> 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/binary/type-serializers.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/binary/type-serializers.js @@ -169,7 +169,7 @@ class UuidSerializer { const uuid_str = String(item) .replace(/^urn:uuid:/, '') - .replaceAll(/[{}-]/g, ''); + .replace(/[{}-]/g, ''); const bufs = []; if (fullyQualifiedFormat)
Switch from String.replaceAll to String.replace for support of older JS/node
apache_tinkerpop
train
js
761e77caff4e4481d12cde503a40e58a4b70695b
diff --git a/inspire_dojson/hep/rules/bd0xx.py b/inspire_dojson/hep/rules/bd0xx.py index <HASH>..<HASH> 100644 --- a/inspire_dojson/hep/rules/bd0xx.py +++ b/inspire_dojson/hep/rules/bd0xx.py @@ -103,20 +103,13 @@ def dois(self, key, value): def _get_material(value): MATERIAL_MAP = { - 'addendum': 'addendum', 'ebook': 'publication', - 'editorial note': 'editorial note', - 'erratum': 'erratum', - 'preprint': 'preprint', - 'publication': 'publication', - 'reprint': 'reprint', - 'translation': 'translation', } q_value = force_single_element(value.get('q', '')) normalized_q_value = q_value.lower() - return MATERIAL_MAP.get(normalized_q_value) + return MATERIAL_MAP.get(normalized_q_value, normalized_q_value) def _is_doi(id_, type_): return (not type_ or type_.upper() == 'DOI') and is_doi(id_)
hep: allow more materials in dois
inspirehep_inspire-dojson
train
py
80cfb59201c53d8edd0204383ba18a79b32bb505
diff --git a/lib/models.js b/lib/models.js index <HASH>..<HASH> 100644 --- a/lib/models.js +++ b/lib/models.js @@ -45,10 +45,10 @@ Models.prototype.run = function(model_id, data, params) { let batches = []; if (this.ml.settings.auto_batch) { - for (let ii=0; ii < data.length; ii+=ml.settings.batch_size) { + for (let ii=0; ii < data.length; ii+=this.ml.settings.batch_size) { // keep all the params except the data list, which will get overloaded let batch = cloneDeep(params); - batch.data = data.slice(ii, ii+ml.settings.batch_size); + batch.data = data.slice(ii, ii+this.ml.settings.batch_size); batches.push(batch) } } else {
Solves "ReferenceError: ml is not defined" #7
monkeylearn_monkeylearn-node
train
js
8bd5e622521880ef398a0e8ddff9ec439df2e450
diff --git a/src/server/pps/server/worker_rc.go b/src/server/pps/server/worker_rc.go index <HASH>..<HASH> 100644 --- a/src/server/pps/server/worker_rc.go +++ b/src/server/pps/server/worker_rc.go @@ -279,7 +279,7 @@ func (a *apiServer) getWorkerOptions(pipelineName string, rcName string, Name: client.PPSWorkerVolume, MountPath: client.PPSScratchSpace, }) - if resourceRequests != nil && resourceRequests.NvidiaGPU() != nil && !resourceRequests.NvidiaGPU().IsZero() { + if resourceLimits != nil && resourceLimits.NvidiaGPU() != nil && !resourceLimits.NvidiaGPU().IsZero() { volumes = append(volumes, api.Volume{ Name: "root-lib", VolumeSource: api.VolumeSource{
No, use limits on GPU k8s <I> now requires gpu limits to be set
pachyderm_pachyderm
train
go
d049b353974a8f091939775ef34106df7d9ef733
diff --git a/testing/test_pdb.py b/testing/test_pdb.py index <HASH>..<HASH> 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -853,7 +853,7 @@ class TestDebuggingBreakpoints: Test that supports breakpoint global marks on Python 3.7+ and not on CPython 3.5, 2.7 """ - if sys.version_info.major == 3 and sys.version_info.minor >= 7: + if sys.version_info >= (3, 7): assert SUPPORTS_BREAKPOINT_BUILTIN is True if sys.version_info.major == 3 and sys.version_info.minor == 5: assert SUPPORTS_BREAKPOINT_BUILTIN is False
Fix for Python 4: replace unsafe PY3 with PY2
pytest-dev_pytest
train
py
22bdd9e32401111e4ba7ed26d7fb8d15d948590a
diff --git a/superset/security.py b/superset/security.py index <HASH>..<HASH> 100644 --- a/superset/security.py +++ b/superset/security.py @@ -37,6 +37,10 @@ ADMIN_ONLY_VIEW_MENUS = { 'RoleModelView', 'Security', 'UserDBModelView', + 'UserLDAPModelView', + 'UserOAuthModelView', + 'UserOIDModelView', + 'UserRemoteUserModelView', } ALPHA_ONLY_VIEW_MENUS = {
[security] Adding all derived FAB UserModelView views to admin only (#<I>)
apache_incubator-superset
train
py
c9a08e7680306ac3c23c5897fd3a07539811d858
diff --git a/ara/clients/offline.py b/ara/clients/offline.py index <HASH>..<HASH> 100644 --- a/ara/clients/offline.py +++ b/ara/clients/offline.py @@ -46,11 +46,18 @@ class AraOfflineClient(object): def _request(self, method, endpoint, **kwargs): func = getattr(self.client, method) - response = func( - endpoint, - json.dumps(kwargs), - content_type='application/json' - ) + # TODO: Is there a better way than doing this if/else ? + if kwargs: + response = func( + endpoint, + json.dumps(kwargs), + content_type='application/json' + ) + else: + response = func( + endpoint, + content_type='application/json' + ) self.log.debug('HTTP {status}: {method} on {endpoint}'.format( status=response.status_code,
Don't pass kwargs to the client if there isn't any This resolves an issue where doing a request (i.e, GET) without kwargs would fail. Change-Id: Iac5be<I>bd1a<I>c0ac0dbca<I>e<I>bebe
ansible-community_ara
train
py
971b98189806a9492735ddd61f7fdf77f472940c
diff --git a/dexmaker/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java b/dexmaker/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java index <HASH>..<HASH> 100644 --- a/dexmaker/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java +++ b/dexmaker/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java @@ -128,7 +128,7 @@ public class ProxyBuilderTest extends TestCase { try { proxy.getClass().getDeclaredMethod("result"); fail(); - } catch (NoSuchMethodException e) { + } catch (NoSuchMethodException expected) { } @@ -148,14 +148,14 @@ public class ProxyBuilderTest extends TestCase { try { proxy.getClass().getDeclaredMethod("result"); fail(); - } catch (NoSuchMethodException e) { + } catch (NoSuchMethodException expected) { } try { proxy.result(); fail(); - } catch (AssertionFailedError e) { + } catch (AssertionFailedError expected) { } }
-Gave some expected exceptions in ProxyBuilderTest more descriptive variable names.
linkedin_dexmaker
train
java
50b6a28179625cca7fcca3592c1f7aee184bd8f2
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -3,9 +3,12 @@ __author__ = 'ahmetdal' from setuptools import setup, find_packages try: - long_description = open('README.md').read() -except IOError: - long_description = '' + from pypandoc import convert + + read_md = lambda f: convert(f, 'rst') +except ImportError: + print("warning: pypandoc module not found, could not convert Markdown to RST") + read_md = lambda f: open(f, 'r').read() setup( name='django-river', @@ -15,7 +18,7 @@ setup( packages=find_packages(), url='https://github.com/javrasya/django-river.git', description='Django Workflow Library', - long_description=long_description, + long_description=read_md('README.md'), dependency_links=[ "https://bitbucket.org/ahmetdal/river.io-python/tarball/master/#egg=0.0.1" ],
rst conversion of README.md file is added for PyPI page.
javrasya_django-river
train
py
62492dd4944f7b12881b00906699a23879fa1436
diff --git a/Generator/YMLFile.php b/Generator/YMLFile.php index <HASH>..<HASH> 100644 --- a/Generator/YMLFile.php +++ b/Generator/YMLFile.php @@ -21,7 +21,7 @@ class YMLFile extends File { parent::mergeComponentData($additional_component_data); // The hacky yaml_inline_level property may not be an array! - if (is_array($this->component_data['yaml_inline_level'])) { + if (isset($this->component_data['yaml_inline_level']) && is_array($this->component_data['yaml_inline_level'])) { $this->component_data['yaml_inline_level'] = reset($this->component_data['yaml_inline_level']); } }
Fixed bug with YML generator expecting property to be set.
drupal-code-builder_drupal-code-builder
train
php
8c414fb1726e64167ae7a60f0c3081592ba4e439
diff --git a/core/src/main/java/org/bitcoinj/script/Script.java b/core/src/main/java/org/bitcoinj/script/Script.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/bitcoinj/script/Script.java +++ b/core/src/main/java/org/bitcoinj/script/Script.java @@ -101,7 +101,7 @@ public class Script { public Script(byte[] programBytes) throws ScriptException { program = programBytes; parse(programBytes); - creationTimeSeconds = Utils.currentTimeSeconds(); + creationTimeSeconds = 0; } public Script(byte[] programBytes, long creationTimeSeconds) throws ScriptException {
Script: don't query the clock when parsing a script. This actually shows up in Android performance profiles.
bitcoinj_bitcoinj
train
java
75383d060fa55de111d8e472eadf6afd388a31d0
diff --git a/api/models/task.go b/api/models/task.go index <HASH>..<HASH> 100644 --- a/api/models/task.go +++ b/api/models/task.go @@ -52,7 +52,7 @@ type Task struct { Read Only: true */ - AppName string `json:"route_name,omitempty"` + AppName string `json:"app_name,omitempty"` Path string `json:"path"` diff --git a/api/server/runner.go b/api/server/runner.go index <HASH>..<HASH> 100644 --- a/api/server/runner.go +++ b/api/server/runner.go @@ -73,7 +73,7 @@ func handleRequest(c *gin.Context, enqueue models.Enqueue) { } // if still no appName, we gotta exit if appName == "" { - log.WithError(err).Error(models.ErrAppsNotFound) + log.WithError(err).Error("Invalid app, blank") c.JSON(http.StatusBadRequest, simpleError(models.ErrAppsNotFound)) return }
Updated route_name in json to app_name.
iron-io_functions
train
go,go
3da244d3f26c433b7ec8afa9ebda5723481940ff
diff --git a/rootpy/io/pickler.py b/rootpy/io/pickler.py index <HASH>..<HASH> 100644 --- a/rootpy/io/pickler.py +++ b/rootpy/io/pickler.py @@ -293,7 +293,8 @@ class Unpickler(pickle.Unpickler): return obj def persistent_load(self, pid): - pid = pid.decode('utf-8') + if sys.version_info[0] >= 3: + pid = pid.decode('utf-8') log.debug("unpickler reading {0}".format(pid)) if self.__use_proxy: obj = ROOT_Proxy(self.__file, pid)
fix broken pickler test due to py2 compat string handling
rootpy_rootpy
train
py
69d51d3a81077c0c78e2b8d9a56c8d6f146e8939
diff --git a/lib/weblib.php b/lib/weblib.php index <HASH>..<HASH> 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -717,6 +717,10 @@ function highlight($needle, $haystack, $case=0, /// this function after performing any conversions to HTML. /// Function found here: http://forums.devshed.com/t67822/scdaa2d1c3d4bacb4671d075ad41f0854.html + if (empty($needle)) { + return $haystack; + } + $list_of_words = eregi_replace("[^-a-zA-Z0-9&']", " ", $needle); $list_array = explode(" ", $list_of_words); for ($i=0; $i<sizeof($list_array); $i++) {
Prevent funny-looking text when trying to highlight a null string
moodle_moodle
train
php
d6275375b221c77277e007c20e184ad654dbfef1
diff --git a/mysql/toolkit/connector.py b/mysql/toolkit/connector.py index <HASH>..<HASH> 100644 --- a/mysql/toolkit/connector.py +++ b/mysql/toolkit/connector.py @@ -68,8 +68,10 @@ class Connector: """Execute a single SQL query without returning a result.""" self._cursor.execute(command) self._commit() + return True def executemany(self, command): """Execute multiple SQL queries without returning a result.""" self._cursor.executemany(command) self._commit() + return True
Added return statements for conditional validation
mrstephenneal_mysql-toolkit
train
py
2d13087d9ad087899107f99c7f2cb21bd473dba1
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -17,9 +17,13 @@ module.exports = function(config) { debug('initializing "%s", from "%s"', __filename, module.parent.id); this.use(utils.cwd()); - this.use(utils.vfs()); this.use(utils.pipeline()); + // if templates need to be rendered, register assemble-fs before this plugin + if (typeof this.src !== 'function') { + this.use(utils.vfs()); + } + this.define('process', function(files, options) { debug('running base-files-process', files);
only add `base-fs` if src doesn't exist
base_base-files-process
train
js
1d666cf27ec366a967d9afa0e8a370cb4cf33481
diff --git a/rpc/server.go b/rpc/server.go index <HASH>..<HASH> 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -145,7 +145,7 @@ func (s *Server) serveRequest(ctx context.Context, codec ServerCodec, singleShot defer cancel() // if the codec supports notification include a notifier that callbacks can use - // to send notification to clients. It is thight to the codec/connection. If the + // to send notification to clients. It is tied to the codec/connection. If the // connection is closed the notifier will stop and cancels all active subscriptions. if options&OptionSubscriptions == OptionSubscriptions { ctx = context.WithValue(ctx, notifierKey{}, newNotifier(codec))
rpc: fix a comment typo (#<I>)
ethereum_go-ethereum
train
go
59dcbcf95aa4aab4a4a42ccee6404d27bcfccc90
diff --git a/tests/test4.py b/tests/test4.py index <HASH>..<HASH> 100644 --- a/tests/test4.py +++ b/tests/test4.py @@ -37,6 +37,7 @@ class TestStrategy(bt.Strategy): btindicators.MovingAverageSimple(self.datas[0], period=30) btindicators.MovingAverageSimple(self.datas[0], period=50) self.ind = btindicators.StochasticSlow(self.datas[0]) + btindicators.MACDHisto(self.datas[0]) # self.ind = btindicators.RSI(self.datas[0]) pass else:
test4.py slightly changed - Added MACD to the current indicators
backtrader_backtrader
train
py
361f6cc23f715248aba9b1e8647fc985e887f15c
diff --git a/salt/modules/zpool.py b/salt/modules/zpool.py index <HASH>..<HASH> 100644 --- a/salt/modules/zpool.py +++ b/salt/modules/zpool.py @@ -238,9 +238,9 @@ def create(pool_name, *vdevs, **kwargs): ret[vdev] = '{0} not present on filesystem'.format(vdev) return ret mode = os.stat(vdev).st_mode - if not stat.S_ISBLK(mode) and not stat.S_ISREG(mode): - # Not a block device or file vdev so error and return - ret[vdev] = '{0} is not a block device or a file vdev'.format(vdev) + if not stat.S_ISBLK(mode) and not stat.S_ISREG(mode) and not stat.S_ISCHR(mode): + # Not a block device, file vdev, or character special device so error and return + ret[vdev] = '{0} is not a block device, a file vdev, or character special device'.format(vdev) return ret dlist.append(vdev)
Allow zpool.create on character devices Fixes #<I>
saltstack_salt
train
py
ab02f7a17049beca3b68c09e6b05109ff51a8e22
diff --git a/inc/template.php b/inc/template.php index <HASH>..<HASH> 100644 --- a/inc/template.php +++ b/inc/template.php @@ -181,10 +181,10 @@ function hybrid_get_content_template() { $templates = apply_filters( 'hybrid_content_template_hierarchy', $templates ); // Locate the template. - $template = locate_template( $templates ); + $template = apply_filters( 'hybrid_content_template', locate_template( $templates ), $templates ); // If template is found, include it. - if ( apply_filters( 'hybrid_content_template', $template, $templates ) ) + if ( $template ) include( $template ); } @@ -219,10 +219,10 @@ function hybrid_get_embed_template() { $templates = apply_filters( 'hybrid_embed_template_hierarchy', $templates ); // Locate the template. - $template = locate_template( $templates ); + $template = apply_filters( 'hybrid_embed_template', locate_template( $templates ), $templates ); // If template is found, include it. - if ( apply_filters( 'hybrid_embed_template', $template, $templates ) ) + if ( $template ) include( $template ); }
Bring fix from the <I> branch where the `hybrid_content_template` hook worked. This commit also applies the same fix to `hybrid_embed_template`. See original commit: <URL>
justintadlock_hybrid-core
train
php
b30f847e190b6d09d1aba1ee31ef882d10198fff
diff --git a/geopy/geocoders/googlev3.py b/geopy/geocoders/googlev3.py index <HASH>..<HASH> 100644 --- a/geopy/geocoders/googlev3.py +++ b/geopy/geocoders/googlev3.py @@ -58,7 +58,7 @@ class GoogleV3(Geocoder): # pylint: disable=R0902 .. versionadded:: 0.98.2 :param string domain: Should be the localized Google Maps domain to - connect to. The default is 'maps.google.com', but if you're + connect to. The default is 'maps.googleapis.com', but if you're geocoding address in the UK (for example), you may want to set it to 'maps.google.co.uk' to properly bias results.
Fix GoogleV3 outdated default domain in docs
geopy_geopy
train
py
9a17cf0617da0a348d448ea609a4ac3452e677f5
diff --git a/ocelot-processor/src/main/java/org/ocelotds/processors/AbstractDataServiceVisitor.java b/ocelot-processor/src/main/java/org/ocelotds/processors/AbstractDataServiceVisitor.java index <HASH>..<HASH> 100644 --- a/ocelot-processor/src/main/java/org/ocelotds/processors/AbstractDataServiceVisitor.java +++ b/ocelot-processor/src/main/java/org/ocelotds/processors/AbstractDataServiceVisitor.java @@ -10,6 +10,7 @@ import java.io.Writer; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; import javax.annotation.processing.Messager; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.AnnotationMirror; @@ -100,7 +101,7 @@ public abstract class AbstractDataServiceVisitor implements ElementVisitor<Strin * @return */ String getJsInstancename(String classname) { - return classname.substring(0, 1).toLowerCase()+classname.substring(1); + return classname.substring(0, 1).toLowerCase(Locale.US)+classname.substring(1); } /**
add locale to toLowerCase
ocelotds_ocelot
train
java
22403f9a039ff6ab81250f7ab73592f10ae16562
diff --git a/analytical/tests/test_tag_uservoice.py b/analytical/tests/test_tag_uservoice.py index <HASH>..<HASH> 100644 --- a/analytical/tests/test_tag_uservoice.py +++ b/analytical/tests/test_tag_uservoice.py @@ -40,14 +40,7 @@ class UserVoiceTagTestCase(TagTestCase): @override_settings(USERVOICE_WIDGET_KEY='') def test_empty_key(self): - r = UserVoiceNode().render(Context()) - self.assertEqual(r, "") - - @override_settings(USERVOICE_WIDGET_KEY='') - def test_overridden_empty_key(self): - vars = {'uservoice_widget_key': 'bcdefghijklmnopqrstu'} - r = UserVoiceNode().render(Context(vars)) - self.assertIn("widget.uservoice.com/bcdefghijklmnopqrstu.js", r) + self.assertRaises(AnalyticalException, UserVoiceNode) def test_overridden_key(self): vars = {'uservoice_widget_key': 'defghijklmnopqrstuvw'}
Fix uservoice tests Rewrite test_empty_key in the same way as in the other modules. Delete test_overridden_empty_key, because the Node (In this case, the UserVoiceNode) should not be created if there is no configuration initially.
jazzband_django-analytical
train
py
6debb830292611d1b48cb51a6c52c554abcad6b9
diff --git a/spyderlib/utils/dochelpers.py b/spyderlib/utils/dochelpers.py index <HASH>..<HASH> 100644 --- a/spyderlib/utils/dochelpers.py +++ b/spyderlib/utils/dochelpers.py @@ -159,7 +159,7 @@ def isdefined(obj, force_import=False, namespace=None): return False import __builtin__ if base not in __builtin__.__dict__ and base not in namespace: - if force_import: + if force_import and base != 'setup': try: module = __import__(base, globals(), namespace) if base not in globals(): @@ -171,7 +171,7 @@ def isdefined(obj, force_import=False, namespace=None): return False for attr in attr_list: if not hasattr(eval(base, namespace), attr): - if force_import: + if force_import and base != 'setup': try: __import__(base+'.'+attr, globals(), namespace) except ImportError:
Object inspector/bugfix (workaround) -- utils.dochelpers.isdefined (force_import=True): do not import module if it's a setup module (may crash the introspection thread)
spyder-ide_spyder
train
py
0f673620b47c9530f263a60efdfc9576a3087b76
diff --git a/src/ReadModel/MultilingualJsonLDProjectorTrait.php b/src/ReadModel/MultilingualJsonLDProjectorTrait.php index <HASH>..<HASH> 100644 --- a/src/ReadModel/MultilingualJsonLDProjectorTrait.php +++ b/src/ReadModel/MultilingualJsonLDProjectorTrait.php @@ -16,4 +16,17 @@ trait MultilingualJsonLDProjectorTrait $jsonLd->mainLanguage = $language->getCode(); return $jsonLd; } + + /** + * @param \stdClass $jsonLd + * @return Language + */ + protected function getMainLanguage(\stdClass $jsonLd) + { + if (isset($jsonLd->mainLanguage)) { + return new Language($jsonLd->mainLanguage); + } else { + return new Language('nl'); + } + } }
III-<I>: Add method to read mainLanguage from JSON-LD in projectors
cultuurnet_udb3-php
train
php
a998a64e86066e1b95d5c94250ab57ddab940ac2
diff --git a/decidim-dev/lib/decidim/dev/test/rspec_support/vcr.rb b/decidim-dev/lib/decidim/dev/test/rspec_support/vcr.rb index <HASH>..<HASH> 100644 --- a/decidim-dev/lib/decidim/dev/test/rspec_support/vcr.rb +++ b/decidim-dev/lib/decidim/dev/test/rspec_support/vcr.rb @@ -8,6 +8,10 @@ VCR.configure do |config| config.hook_into :webmock config.configure_rspec_metadata! config.ignore_request do |request| - URI(request.uri).port != URI(Decidim::Elections.bulletin_board.server).port + if defined?(Decidim::Elections) + URI(request.uri).port != URI(Decidim::Elections.bulletin_board.server).port + else + true + end end end
Fix name error when no elections (#<I>) * fix: NameError - uninitialized constant Decidim::Elections * Linters
decidim_decidim
train
rb
e06f92bf3119837cf314ba63b957277116ef1e6b
diff --git a/precise/__init__.py b/precise/__init__.py index <HASH>..<HASH> 100644 --- a/precise/__init__.py +++ b/precise/__init__.py @@ -1 +1 @@ -__version__ = '0.2.0' +__version__ = '0.3.0'
Increment version to <I>
MycroftAI_mycroft-precise
train
py
8ae7603fd1f9f0e91700f1f8183cae9877b1fa70
diff --git a/acceptancetests/assess_upgrade_series.py b/acceptancetests/assess_upgrade_series.py index <HASH>..<HASH> 100755 --- a/acceptancetests/assess_upgrade_series.py +++ b/acceptancetests/assess_upgrade_series.py @@ -41,15 +41,15 @@ def assess_juju_upgrade_series(client, args): def upgrade_series_prepare(client, machine, series, **flags): - args = (machine, series) + args = (machine, 'prepare', series) if flags['agree']: - args += ('--agree',) - client.juju('upgrade-series prepare', args) + args += ('-y',) + client.juju('upgrade-series', args) def upgrade_series_complete(client, machine): - args = (machine) - client.juju('upgrade-series complete', args) + args = (machine, 'complete') + client.juju('upgrade-series', args) def do_release_upgrade(client, machine):
Modifies upgrade-series acceptance test to accomodate new command order and --yes flag.
juju_juju
train
py
0c667194f29b34d31700aee8029805cef4af5086
diff --git a/dygraph-layout.js b/dygraph-layout.js index <HASH>..<HASH> 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -211,6 +211,10 @@ DygraphLayout.prototype._evaluateLineCharts = function() { // on chrome+linux, they are 6 times more expensive than iterating through the // points and drawing the lines. The brunt of the cost comes from allocating // the |point| structures. + var boundaryIdStart = 0; + if (this.dygraph_.boundaryIds_.length > 0) { + boundaryIdStart = this.dygraph_.boundaryIds_[this.dygraph_.boundaryIds_.length-1][0] + } for (var setIdx = 0; setIdx < this.datasets.length; setIdx++) { var dataset = this.datasets[setIdx]; var setName = this.setNames[setIdx]; @@ -243,7 +247,7 @@ DygraphLayout.prototype._evaluateLineCharts = function() { xval: xValue, yval: yValue, name: setName, // TODO(danvk): is this really necessary? - idx: j + this.dygraph_.boundaryIds_[setIdx][0] + idx: j + boundaryIdStart }; }
Bugfix: avoid exception when one series is hidden
danvk_dygraphs
train
js
136539e67e51ac4a32aa13decb77f2158925c6ef
diff --git a/system/Validation/Rules.php b/system/Validation/Rules.php index <HASH>..<HASH> 100644 --- a/system/Validation/Rules.php +++ b/system/Validation/Rules.php @@ -304,9 +304,9 @@ class Rules // If the field is present we can safely assume that // the field is here, no matter whether the corresponding // search field is present or not. - $present = $this->required($data[$str] ?? null); + $present = $this->required($str ?? ''); - if ($present === true) + if ($present) { return true; } @@ -326,8 +326,8 @@ class Rules // Remove any keys with empty values since, that means they // weren't truly there, as far as this is concerned. - $requiredFields = array_filter($requiredFields, function ($item) use ($data) { - return empty($data[$item]); + $requiredFields = array_filter($requiredFields, function ($item) use ($data, $str) { + return ! empty($data[$item]); }); return empty($requiredFields);
Fix required_with rule bug. <I>
codeigniter4_CodeIgniter4
train
php
398e58e4a08dc9703d75c79a4d3fbd53d341799b
diff --git a/lxd/project/limits.go b/lxd/project/limits.go index <HASH>..<HASH> 100644 --- a/lxd/project/limits.go +++ b/lxd/project/limits.go @@ -357,7 +357,12 @@ func getInstanceLimits(instance db.Instance, keys []string) (map[string]int64, e } var aggregateLimitConfigValueParsers = map[string]func(string) (int64, error){ - "limits.memory": units.ParseByteSizeString, + "limits.memory": func(value string) (int64, error) { + if strings.HasSuffix(value, "%") { + return -1, fmt.Errorf("Value can't be a percentage") + } + return units.ParseByteSizeString(value) + }, "limits.processes": func(value string) (int64, error) { limit, err := strconv.Atoi(value) if err != nil {
lxd/project: Don't allow percentage values for limits.memory
lxc_lxd
train
go
2f162bee85dda9a0fd50d64a94c365bb701779ee
diff --git a/source/server.js b/source/server.js index <HASH>..<HASH> 100644 --- a/source/server.js +++ b/source/server.js @@ -338,9 +338,9 @@ app.get('/api/fs/listDirectories', ensureAuthenticated, function(req, res) { }); async.filter(absolutePaths, function(absolutePath, callback) { fs.stat(absolutePath, function(err, stat) { - callback(!err && stat && stat.isDirectory()); + callback(null, !err && stat && stat.isDirectory()); }); - }, function(filteredFiles) { + }, function(err, filteredFiles) { res.json(filteredFiles); }); }
fix callback arguments for async.filter so directory autocomplete works again this was a breaking change in the async library <I> <URL>
FredrikNoren_ungit
train
js
779a3d54141ce16abd0b3142629a9b3aed05c4f7
diff --git a/src/Model/CustomPostType/Query.php b/src/Model/CustomPostType/Query.php index <HASH>..<HASH> 100644 --- a/src/Model/CustomPostType/Query.php +++ b/src/Model/CustomPostType/Query.php @@ -136,12 +136,12 @@ class Query $offset = (int)get_query_var('paged', 1); $this->limit($postsPerPage); - $this->offset($offset + 1); + $this->offset($offset); if ($count > $postsPerPage) { $config += array( 'mid-size' => 1, - 'current' => $offset, + 'current' => $offset === 0 ? 1 : $offset, 'total' => ceil($count / $postsPerPage), 'prev_next' => true, 'prev_text' => __('Previous', 'strata'),
offset were being confused in between WPs and Stratas
strata-mvc_strata
train
php
bb16f2ca56f7da4f526b94c800df014bfdfe46c9
diff --git a/EventListener/TargetWebspaceListener.php b/EventListener/TargetWebspaceListener.php index <HASH>..<HASH> 100644 --- a/EventListener/TargetWebspaceListener.php +++ b/EventListener/TargetWebspaceListener.php @@ -59,7 +59,7 @@ class TargetWebspaceListener $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey(); if ($document->getMainWebspace() === $webspaceKey - || in_array($webspaceKey, $document->getAdditionalWebspaces()) + || ($document->getAdditionalWebspaces() && in_array($webspaceKey, $document->getAdditionalWebspaces())) ) { return $webspaceKey; }
Fixed PHP warning in TargetWebspaceListene (#<I>)
sulu_SuluArticleBundle
train
php
b541b24b9d74d3ed62990c07e7e3a06ce3995318
diff --git a/source/org/jasig/portal/layout/ALFolder.java b/source/org/jasig/portal/layout/ALFolder.java index <HASH>..<HASH> 100644 --- a/source/org/jasig/portal/layout/ALFolder.java +++ b/source/org/jasig/portal/layout/ALFolder.java @@ -78,12 +78,11 @@ public class ALFolder extends ALNode { } - /** - * Gets the node type - * @return a node type - */ - public String getNodeType() { - return "folder"; + /* + * @see org.jasig.portal.layout.ALNode#getNodeType() + */ + public int getNodeType() { + return FOLDER_TYPE; } public static ALFolder createLostFolder() { @@ -99,4 +98,9 @@ public class ALFolder extends ALNode { return lostFolder; } + /* + * Constant indicating the type of ALNode + */ + public static final int FOLDER_TYPE = 2; + }
Added missing FOLDER_TYPE constant Updated getNode method to sync with ALNode - it now returns an int. git-svn-id: <URL>
Jasig_uPortal
train
java
a3b91dc70001f8e274144510c825ab1902930a2f
diff --git a/pyemma/coordinates/clustering/kmeans.py b/pyemma/coordinates/clustering/kmeans.py index <HASH>..<HASH> 100644 --- a/pyemma/coordinates/clustering/kmeans.py +++ b/pyemma/coordinates/clustering/kmeans.py @@ -64,7 +64,7 @@ class KmeansClustering(AbstractClustering, ProgressReporter): tolerance : float stop iteration when the relative change in the cost function - ..1: C(S) = \sum_{i=1}^{k} \sum_{\mathbf x \in S_i} \left\| \mathbf x - \boldsymbol\mu_i \right\|^2 + .. math:: C(S) = \sum_{i=1}^{k} \sum_{\mathbf x \in S_i} \left\| \mathbf x - \boldsymbol\mu_i \right\|^2 is smaller than tolerance. metric : str
[kmeans] fix math rendering of cost function (#<I>)
markovmodel_PyEMMA
train
py
0d7690d3e0c54d3577cc94f57eb4af86fbb1835e
diff --git a/src/L.Realtime.js b/src/L.Realtime.js index <HASH>..<HASH> 100644 --- a/src/L.Realtime.js +++ b/src/L.Realtime.js @@ -30,7 +30,7 @@ L.Realtime = L.GeoJSON.extend({ this._src = src; } else { this._src = L.bind(function(responseHandler, errorHandler) { - if ( typeof this._url !== 'undefined') { + if ( this._url !== undefined) { src.url = this._url; } var reqOptions = this.options.cache ? src : this._bustCache(src);
In "initialize" a more clean _url if condition. change typeof this._url !== 'undefined' to this._url !== undefined within "initialize".
perliedman_leaflet-realtime
train
js
d6286e94638ce2f0bcace01d6b8e9bbef5e0ca71
diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index <HASH>..<HASH> 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -13405,7 +13405,11 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness, if err != nil { t.Fatalf("unable to create new node: %v", err) } - defer shutdownAndAssert(net, t, dave) + // Defer to a closure instead of to shutdownAndAssert due to the value + // of 'dave' changing throughout the test. + defer func() { + shutdownAndAssert(net, t, dave) + }() carol, err := net.NewNode("carol", nil) if err != nil { t.Fatalf("unable to make new node: %v", err)
itest: Shutdown final Dave node in testChanRestore This changes the defer function in the test for channel backups to correctly close over the 'dave' variable. Without this closure, the shutdownAndAssert call would attempt to shutdown the original (non-restored) dave instead of the most recently created (restored) dave, causing a leak of a node during tests.
lightningnetwork_lnd
train
go
88ecc3c28080fe752c14f012126aebe3a4bfe2e6
diff --git a/pabot/pabot.py b/pabot/pabot.py index <HASH>..<HASH> 100755 --- a/pabot/pabot.py +++ b/pabot/pabot.py @@ -1036,7 +1036,7 @@ def store_suite_names(hashes, suite_names): # type: (Hashes, List[ExecutionItem] assert(all(isinstance(s, ExecutionItem) for s in suite_names)) suite_lines = [s.line() for s in suite_names] _write("Storing .pabotsuitenames file") - with open(".pabotsuitenames", "w") as suitenamesfile: + with open(".pabotsuitenames", "w", encoding="utf-8") as suitenamesfile: suitenamesfile.write("datasources:"+hashes.dirs+'\n') suitenamesfile.write("commandlineoptions:"+hashes.cmd+'\n') suitenamesfile.write("suitesfrom:"+hashes.suitesfrom+'\n')
ensure .pabotsuitenames utf-8 encoding
mkorpela_pabot
train
py
643dd5c9eea9fb1dca7264d62cd7b266e49e5960
diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index <HASH>..<HASH> 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -780,7 +780,7 @@ class LeftAndMain extends Controller implements PermissionProvider public function afterHandleRequest() { - if ($this->response->isError()) { + if ($this->response->isError() && !$this->request->isAjax()) { $this->init(); $errorCode = $this->response->getStatusCode(); $errorType = $this->response->getStatusDescription(); @@ -2035,7 +2035,7 @@ class LeftAndMain extends Controller implements PermissionProvider */ public function getHttpErrorMessage(): string { - return $this->httpErrorMessage; + return $this->httpErrorMessage ?? ''; } /**
FIX Don't override ajax errors or use uninitialised property
silverstripe_silverstripe-admin
train
php
1fd877f7c18455aee7202e55856f287e40fcd4ab
diff --git a/ryu/controller/network.py b/ryu/controller/network.py index <HASH>..<HASH> 100644 --- a/ryu/controller/network.py +++ b/ryu/controller/network.py @@ -368,7 +368,12 @@ class Network(app_manager.RyuApp): old_mac_address = self._get_old_mac(network_id, dpid, port_no) self.dpids.remove_port(dpid, port_no) - self.networks.remove(network_id, dpid, port_no) + try: + self.networks.remove(network_id, dpid, port_no) + except NetworkNotFound: + # port deletion can be called after network deletion + # due to Openstack auto deletion port.(dhcp/router port) + pass if old_mac_address is not None: self.mac_addresses.remove_port(network_id, dpid, port_no, old_mac_address)
network.py: exception in Networks.remove_port() Neutron plugin can call remove_port after network deletion for automatic delete port like router/dhcp port. So ignore NetworkNotFound exception.
osrg_ryu
train
py
3b0cc0bd841b9798ae3a1df6640b4edf70f7e148
diff --git a/asl/interface/webservice/performers/resource.py b/asl/interface/webservice/performers/resource.py index <HASH>..<HASH> 100644 --- a/asl/interface/webservice/performers/resource.py +++ b/asl/interface/webservice/performers/resource.py @@ -24,6 +24,7 @@ def perform_resource(path): resource_task = get_resource_task(resource) if resource_task == None: raise ImportError("No resource named {0}.".format(resource)) + app.logger.debug("Fetched resource named {0} with data\n{1}.".format(resource, request.data)) data = request.json rv = resource_task(params=params, args=args_to_dict(request.args), data=data)
Improved logging of the resource request. We can not reserve already reserved surprise. #<I>
AtteqCom_zsl
train
py
71b97963697b796b04a606feb5a28890e1731af0
diff --git a/src/ORM/TransactionMiddleware.php b/src/ORM/TransactionMiddleware.php index <HASH>..<HASH> 100644 --- a/src/ORM/TransactionMiddleware.php +++ b/src/ORM/TransactionMiddleware.php @@ -31,6 +31,7 @@ class TransactionMiddleware implements Middleware * @param callable $next * @return mixed * @throws Throwable + * @throws Exception */ public function execute($command, callable $next) {
Readd Exception to throws for PHP 5.x
thephpleague_tactician-doctrine
train
php
11aaa30a8f71089128f92ed6a59dedbfa06d0026
diff --git a/tests/screenshot.py b/tests/screenshot.py index <HASH>..<HASH> 100644 --- a/tests/screenshot.py +++ b/tests/screenshot.py @@ -1,15 +1,18 @@ # -*- coding: utf-8 -*- -# Copyright 2013 splinter authors. All rights reserved. +# Copyright 2014 splinter authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. +import tempfile + + class ScreenshotTest(object): def test_take_screenshot(self): "should take a screenshot of the current page" filename = self.browser.screenshot() - self.assertTrue('tmp' in filename) + self.assertTrue(tempfile.gettempdir() in filename) def test_take_screenshot_with_prefix(self): "should add the prefix to the screenshot file name"
tests: improved screenshot test to get tempdir using tempfile module.
cobrateam_splinter
train
py
31d9566f2ec8c5db00721498ddddb198279ac9e3
diff --git a/spyderlib/widgets/codeeditor/syntaxhighlighters.py b/spyderlib/widgets/codeeditor/syntaxhighlighters.py index <HASH>..<HASH> 100644 --- a/spyderlib/widgets/codeeditor/syntaxhighlighters.py +++ b/spyderlib/widgets/codeeditor/syntaxhighlighters.py @@ -423,7 +423,8 @@ C_TYPES = 'bool char double enum float int long mutable short signed struct unsi class CythonSH(PythonSH): """Cython Syntax Highlighter""" - ADDITIONAL_KEYWORDS = ["cdef", "ctypedef"] + ADDITIONAL_KEYWORDS = ["cdef", "ctypedef", "cpdef", "inline", "cimport", + "DEF"] ADDITIONAL_BUILTINS = C_TYPES.split() PROG = re.compile(make_python_patterns(ADDITIONAL_KEYWORDS, ADDITIONAL_BUILTINS), re.S)
(Fixes Issue <I>) Code editor syntax highlighting: added more keywords to Cython syntax highlighter (cpdef, inline, cimport and DEF)
spyder-ide_spyder
train
py
41711bda7ec9ad394fa761ef5eb638bedb27a8f6
diff --git a/lib/output-engine/dom/container.js b/lib/output-engine/dom/container.js index <HASH>..<HASH> 100644 --- a/lib/output-engine/dom/container.js +++ b/lib/output-engine/dom/container.js @@ -180,7 +180,7 @@ var proto = { return this; }, removeChild: function(child) { - if (typeof child === 'number') { + if (typeof child !== 'object') { var index = child; child = this.childNodes[index]; if (!child)
Container : .removeChild : check if is not object in place of is number
nomocas_yamvish
train
js
e160d8e027eadd6c9a2f6b4839eb0b4fe406493d
diff --git a/src/Api/Invoices.php b/src/Api/Invoices.php index <HASH>..<HASH> 100644 --- a/src/Api/Invoices.php +++ b/src/Api/Invoices.php @@ -66,14 +66,17 @@ class Invoices extends Api * * @param string $customerId * @param string $subscriptionId + * @param array $parameters * @return array */ - public function upcomingInvoice($customerId, $subscriptionId = null) + public function upcomingInvoice($customerId, $subscriptionId = null, array $parameters = []) { - return $this->_get('invoices/upcoming', [ + $parameters = array_merge($parameters, [ 'customer' => $customerId, 'subscription' => $subscriptionId, ]); + + return $this->_get('invoices/upcoming', $parameters); } /**
chore: Add extra argument to the upcomingInvoice method.
cartalyst_stripe
train
php
1c68fd276ba2413b506e7bdb7ccb7fdf81be3728
diff --git a/src/DefaultNode.php b/src/DefaultNode.php index <HASH>..<HASH> 100644 --- a/src/DefaultNode.php +++ b/src/DefaultNode.php @@ -7,6 +7,7 @@ use NoTee\Exceptions\PathOutdatedException; class DefaultNode implements Fertile, Node { + public static $validateAttributes = true; public static $validateAttributeNames = true; protected $tagName; @@ -82,8 +83,10 @@ class DefaultNode implements Fertile, Node private static function validateAttributes($attributes) { - foreach($attributes as $key => $value) { - static::validateAttribute($key, $value); + if(static::$validateAttributes) { + foreach($attributes as $key => $value) { + static::validateAttribute($key, $value); + } } }
added switch for attribute check for performance comparison reasons
mschop_NoTeePHP
train
php
ec01c0bdd7a242e9102e8015f70edf0d7dcfe35f
diff --git a/ui/app/models/node.js b/ui/app/models/node.js index <HASH>..<HASH> 100644 --- a/ui/app/models/node.js +++ b/ui/app/models/node.js @@ -91,6 +91,21 @@ export default Model.extend({ } }), + compositeStatusIcon: computed('isDraining', 'isEligible', 'status', function() { + // ineligible = exclamation point + // ready = checkmark + // down = x + // initializing = exclamation??? + if (this.isDraining || !this.isEligible) { + return 'alert-circle-fill'; + } else if (this.status === 'down') { + return 'cancel-plain'; + } else if (this.status === 'initializing') { + return 'run'; + } + return 'check-plain'; + }), + setEligible() { if (this.isEligible) return RSVP.resolve(); // Optimistically update schedulingEligibility for immediate feedback
Assign icons to node statuses
hashicorp_nomad
train
js
beac5543cea4cafe22bf61a8b863b6018dc7d2e5
diff --git a/ghost/admin/mirage/fixtures/configs.js b/ghost/admin/mirage/fixtures/configs.js index <HASH>..<HASH> 100644 --- a/ghost/admin/mirage/fixtures/configs.js +++ b/ghost/admin/mirage/fixtures/configs.js @@ -1,7 +1,7 @@ export default [{ clientExtensions: {}, database: 'mysql', - enableDeveloperExperiments: true, + enableDeveloperExperiments: false, environment: 'development', labs: {}, mail: 'SMTP',
Default developer experiments to "off" in tests no issue - we should be testing production functionality by default, if tests need to test functionality behind the developer experiments flag they should explicitly enable it
TryGhost_Ghost
train
js
231a61dac214750b406c6735684fafb3510a2745
diff --git a/test/test-api.js b/test/test-api.js index <HASH>..<HASH> 100644 --- a/test/test-api.js +++ b/test/test-api.js @@ -19,5 +19,18 @@ describe('Twitter.API Functions:', function() { api.should.be.an.instanceOf(Object); }); + + it('should throw an exception on missing arguments', function (done) { + try { + var api = new Twitter.API({ + 'consumer_key': config.consumer_key + }); + } catch (err) { + should.exist(err); + should.not.exist(api); + done(); + } + }); }); + });
Testing exceptions on missing parameters On API initialization errors are throwed if it fails to found some arguments
ghostbar_twitter-rest-lite
train
js
bbbbf04e7d7f3a361e26428383923c2577b46383
diff --git a/src/app/Services/Search.php b/src/app/Services/Search.php index <HASH>..<HASH> 100644 --- a/src/app/Services/Search.php +++ b/src/app/Services/Search.php @@ -23,11 +23,8 @@ class Search public function remove($models) { - $models = collect($models); - - $this->sources = $this->sources - ->reject(function ($config, $model) use ($models) { - return $models->contains($model); - }); + collect($models)->each(function ($model) { + $this->sources->forget($model); + }); } }
refines remove logic in search.php
laravel-enso_Searchable
train
php
7faeb51d4852eefb50c28dbb57270d4aace450fc
diff --git a/cartoframes/context.py b/cartoframes/context.py index <HASH>..<HASH> 100644 --- a/cartoframes/context.py +++ b/cartoframes/context.py @@ -2018,7 +2018,6 @@ def _df2pg_schema(dataframe, pgcolnames): a SQL query""" util_cols = set(('the_geom', 'the_geom_webmercator', 'cartodb_id')) if set(dataframe.columns).issubset(util_cols): - print(f'subset: {", ".join(dataframe.columns)}') return ', '.join(dataframe.columns) schema = ', '.join([ 'NULLIF("{col}", \'\')::{t} AS {col}'.format(col=c,
removes print with f-string
CartoDB_cartoframes
train
py
9c964dfb22bb56c4aad8c035a1f2a796fae2c302
diff --git a/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/deployment/ClusteringDependencyProcessor.java b/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/deployment/ClusteringDependencyProcessor.java index <HASH>..<HASH> 100644 --- a/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/deployment/ClusteringDependencyProcessor.java +++ b/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/deployment/ClusteringDependencyProcessor.java @@ -35,7 +35,8 @@ import org.jboss.modules.ModuleLoader; * {@link DeploymentUnitProcessor} that adds the clustering api to the deployment classpath. * @author Paul Ferraro */ -public class ClusteringDependencyProcessor implements DeploymentUnitProcessor { +@SuppressWarnings("deprecation") +public class ClusteringDependencyProcessor implements DeploymentUnitProcessor { private static final ModuleIdentifier API = ModuleIdentifier.create("org.wildfly.clustering.api"); private static final ModuleIdentifier MARSHALLING_API = ModuleIdentifier.create("org.wildfly.clustering.marshalling.api");
Suppress deprecation warnings so long as ModuleIdentifier is required by ModuleSpecification API.
wildfly_wildfly
train
java
90bfb18ce1819a7329753650fc61dfd2cdb52d3a
diff --git a/tests/common.py b/tests/common.py index <HASH>..<HASH> 100644 --- a/tests/common.py +++ b/tests/common.py @@ -94,9 +94,6 @@ class EWSTest(TimedTestCase): # Allow unverified TLS if requested in settings file BaseProtocol.HTTP_ADAPTER_CLS = NoVerifyHTTPAdapter - # Speed up tests a bit. We don't need to wait 10 seconds for every nonexisting server in the discover dance - AutodiscoverProtocol.TIMEOUT = 2 - # Create an account shared by all tests tz = EWSTimeZone.timezone('Europe/Copenhagen') cls.retry_policy = FaultTolerance(max_wait=600) diff --git a/tests/test_autodiscover_legacy.py b/tests/test_autodiscover_legacy.py index <HASH>..<HASH> 100644 --- a/tests/test_autodiscover_legacy.py +++ b/tests/test_autodiscover_legacy.py @@ -22,7 +22,7 @@ class AutodiscoverLegacyTest(EWSTest): @classmethod def setUpClass(cls): super(AutodiscoverLegacyTest, cls).setUpClass() - AutodiscoverProtocol.INITIAL_RETRY_POLICY = FaultTolerance(max_wait=30) + exchangelib.autodiscover.legacy.INITIAL_RETRY_POLICY = FaultTolerance(max_wait=30) def test_magic(self): # Just test we don't fail
Tweak test settings for stability. Fix for moved INITIAL_RETRY_POLICY
ecederstrand_exchangelib
train
py,py
6030109fcde703736d3e22b21ce56497bc8e1da7
diff --git a/redisdb/datadog_checks/redisdb/redisdb.py b/redisdb/datadog_checks/redisdb/redisdb.py index <HASH>..<HASH> 100644 --- a/redisdb/datadog_checks/redisdb/redisdb.py +++ b/redisdb/datadog_checks/redisdb/redisdb.py @@ -134,7 +134,7 @@ class Redis(AgentCheck): if 'unix_socket_path' in instance: return instance.get('unix_socket_path'), instance.get('db') else: - return instance.get('host'), self.instance.get('port'), instance.get('db') + return instance.get('host'), instance.get('port'), instance.get('db') def _get_conn(self, instance=None): if instance is None:
Remove self.instance when getting port (#<I>)
DataDog_integrations-core
train
py
ec3beef3ba86c4352fe6e9ab2848b3b4f61ac1da
diff --git a/packages/enzyme/src/ReactWrapper.js b/packages/enzyme/src/ReactWrapper.js index <HASH>..<HASH> 100644 --- a/packages/enzyme/src/ReactWrapper.js +++ b/packages/enzyme/src/ReactWrapper.js @@ -298,19 +298,23 @@ class ReactWrapper { * @param {Function} cb - callback function * @returns {ReactWrapper} */ - setState(state, callback = noop) { + setState(state, callback = undefined) { if (this[ROOT] !== this) { throw new Error('ReactWrapper::setState() can only be called on the root'); } if (this.instance() === null || this[RENDERER].getNode().nodeType === 'function') { throw new Error('ReactWrapper::setState() can only be called on class components'); } - if (typeof callback !== 'function') { + if (arguments.length > 1 && typeof callback !== 'function') { throw new TypeError('ReactWrapper::setState() expects a function as its second argument'); } this.instance().setState(state, () => { this.update(); - callback(); + if (callback) { + const adapter = getAdapter(this[OPTIONS]); + const instance = this.instance(); + adapter.invokeSetStateCallback(instance, callback); + } }); return this; }
[Fix] `mount`: `setState`: invoke callback with the proper receiver
airbnb_enzyme
train
js
f56cd2580d2c5869ca360407dcf4ff5b028cbcf7
diff --git a/lib/active_record_extensions/geometry_columns.rb b/lib/active_record_extensions/geometry_columns.rb index <HASH>..<HASH> 100644 --- a/lib/active_record_extensions/geometry_columns.rb +++ b/lib/active_record_extensions/geometry_columns.rb @@ -57,6 +57,15 @@ module Geos @geometry_columns end + # Grabs a geometry column based on name. + def geometry_column_by_name(name) + @geometry_column_by_name ||= self.geometry_columns.inject(HashWithIndifferentAccess.new) do |memo, obj| + memo[obj.name] = obj + memo + end + @geometry_column_by_name[name] + end + protected # Sets up nifty setters and getters for geometry columns. # The methods created look like this:
New method for grabbing a particular geometry column by its' column name. git-svn-id: file:///usr/local/svnroot/ruby_extensions/geos_extensions/trunk@<I> <I>ac<I>-ee<I>-4e<I>-b<I>-<I>b<I>ff<I>b
dark-panda_geos-extensions
train
rb
9bd158a3c7df8df6331cc9f68d98ae32f39bd864
diff --git a/lib/tests/modinfolib_test.php b/lib/tests/modinfolib_test.php index <HASH>..<HASH> 100644 --- a/lib/tests/modinfolib_test.php +++ b/lib/tests/modinfolib_test.php @@ -470,9 +470,10 @@ class core_modinfolib_testcase extends advanced_testcase { * Tests for function cm_info::get_course_module_record() */ public function test_cm_info_get_course_module_record() { - global $DB, $CFG; + global $DB; $this->resetAfterTest(); + $this->setAdminUser(); set_config('enableavailability', 1); set_config('enablecompletion', 1);
MDL-<I> core: fixed failing unit test Part of MDL-<I> epic.
moodle_moodle
train
php
8f4b6fa9e976fa084492a4c10e0d10ac1ece50ec
diff --git a/pyani/pyani_graphics.py b/pyani/pyani_graphics.py index <HASH>..<HASH> 100644 --- a/pyani/pyani_graphics.py +++ b/pyani/pyani_graphics.py @@ -96,6 +96,10 @@ def heatmap_seaborn(df, outfilename=None, title=None, cmap=None, # Obtain colour map cmap = plt.get_cmap(cmap) + # Decide on figure layout size + figsize = max(8, df.shape[0] * 1.1) + print(figsize) + # Add class colour bar. The aim is to get a pd.Series for the columns # of the form: # 0 colour for class in col 0 @@ -118,6 +122,7 @@ def heatmap_seaborn(df, outfilename=None, title=None, cmap=None, # Plot heatmap fig = sns.clustermap(df, cmap=cmap, vmin=vmin, vmax=vmax, col_colors=col_cb, row_colors=col_cb, + figsize=(figsize, figsize), linewidths=0.5, xticklabels=newlabels, yticklabels=newlabels, @@ -132,7 +137,6 @@ def heatmap_seaborn(df, outfilename=None, title=None, cmap=None, fig.ax_heatmap.set_yticklabels(fig.ax_heatmap.get_yticklabels(), rotation=0) - # Save to file if outfilename: fig.savefig(outfilename)
pyani_graphics.py: Modified seaborn presentation Using seaborn, the annotations in the heatmaps are now visible.
widdowquinn_pyani
train
py
5e0c63ccc2759f2c7640eac7f4dd4b947b7d5e95
diff --git a/src/main/java/net/masterthought/cucumber/ReportBuilder.java b/src/main/java/net/masterthought/cucumber/ReportBuilder.java index <HASH>..<HASH> 100755 --- a/src/main/java/net/masterthought/cucumber/ReportBuilder.java +++ b/src/main/java/net/masterthought/cucumber/ReportBuilder.java @@ -51,7 +51,7 @@ public class ReportBuilder { private Map<String, String> customHeader; - private final String VERSION = "cucumber-reporting-0.0.23"; + private final String VERSION = "cucumber-reporting-0.0.24"; public ReportBuilder(List<String> jsonReports, File reportDirectory, String pluginUrlPath, String buildNumber, String buildProject, boolean skippedFails, boolean undefinedFails, boolean flashCharts, boolean runWithJenkins, boolean artifactsEnabled, String artifactConfig, boolean highCharts) throws Exception {
Updated VERSION variable to the latest version The version should be taken from somewhere instead of being hardcoded in the Java file.
damianszczepanik_cucumber-reporting
train
java
0f271f38454f60f6ee0039ab5b0cbb4173a41cfa
diff --git a/lib/less/tree/debug-info.js b/lib/less/tree/debug-info.js index <HASH>..<HASH> 100644 --- a/lib/less/tree/debug-info.js +++ b/lib/less/tree/debug-info.js @@ -16,9 +16,10 @@ const debugInfo = (context, ctx, lineSeparator) => { return result; }; -debugInfo.asComment = ctx => `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n`; +debugInfo.asComment = ctx => ctx.debugInfo ? `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n` : ''; debugInfo.asMediaQuery = ctx => { + if (!ctx.debugInfo) { return ''; } let filenameWithProtocol = ctx.debugInfo.fileName; if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { filenameWithProtocol = `file://${filenameWithProtocol}`;
issue#<I> ignore missing debugInfo (#<I>)
less_less.js
train
js
7366f5a42efa50ba135a138b9346b23f480a313a
diff --git a/utils/reflector/src/main/java/org/robolectric/util/reflector/ReflectorClassWriter.java b/utils/reflector/src/main/java/org/robolectric/util/reflector/ReflectorClassWriter.java index <HASH>..<HASH> 100644 --- a/utils/reflector/src/main/java/org/robolectric/util/reflector/ReflectorClassWriter.java +++ b/utils/reflector/src/main/java/org/robolectric/util/reflector/ReflectorClassWriter.java @@ -80,7 +80,7 @@ class ReflectorClassWriter extends ClassWriter { void write() { int accessModifiers = - iClass.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE); + iClass.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED); visit( V1_5, accessModifiers | ACC_SUPER | ACC_FINAL,
Generate reflector class with valid access
robolectric_robolectric
train
java
41f7cc940678cbc892639818d1095091b8d34009
diff --git a/command/format.go b/command/format.go index <HASH>..<HASH> 100644 --- a/command/format.go +++ b/command/format.go @@ -74,7 +74,7 @@ func outputFormatTable(ui cli.Ui, s *api.Secret, whitespace bool) int { if len(s.Warnings) != 0 { input = append(input, "") - input = append(input, "The following warnings were generated:") + input = append(input, "The following warnings were returned from the Vault server:") for _, warning := range s.Warnings { input = append(input, fmt.Sprintf("* %s", warning)) }
Adjust warnings message to make it clear they are from the server
hashicorp_vault
train
go
d796c619460bc7faa3ccafdd6bc22b104e10eb2e
diff --git a/pkg/services/notifications/webhook.go b/pkg/services/notifications/webhook.go index <HASH>..<HASH> 100644 --- a/pkg/services/notifications/webhook.go +++ b/pkg/services/notifications/webhook.go @@ -48,6 +48,10 @@ func (ns *NotificationService) sendWebRequestSync(ctx context.Context, webhook * webhook.HttpMethod = http.MethodPost } + if webhook.HttpMethod != http.MethodPost && webhook.HttpMethod != http.MethodPut { + return fmt.Errorf("webhook only supports HTTP methods PUT or POST") + } + request, err := http.NewRequest(webhook.HttpMethod, webhook.Url, bytes.NewReader([]byte(webhook.Body))) if err != nil { return err
Security: Fixes minor security issue with alert notification webhooks that allowed GET & DELETE requests #<I>
grafana_grafana
train
go
061a24b59385f6038f65674ff8089815e6c25ada
diff --git a/web/src/getValueOrFallback.js b/web/src/getValueOrFallback.js index <HASH>..<HASH> 100644 --- a/web/src/getValueOrFallback.js +++ b/web/src/getValueOrFallback.js @@ -1,23 +1,21 @@ -import { has, get } from 'lodash'; +import { has, get, merge } from 'lodash'; export default function getValueOrFallback(state, calculatedState, fallbackState, paths, parse) { + const combinedState = merge({}, state, calculatedState); for (let path of paths) { - if (has(state, path)) { + if (has(combinedState, path)) { if (parse) { try { - return parse(get(state, path)); + return parse(get(combinedState, path)); } catch { continue; } } else { - return get(state, path); + return get(combinedState, path); } } - else if (has(calculatedState, path)) { - return get(calculatedState, path); - } else { continue; }
Calculated state should override raw state.
mjswensen_themer
train
js
47fb850536f65f9e29931a37d7c433ce65b8881f
diff --git a/lib/EasyPost/Resource.php b/lib/EasyPost/Resource.php index <HASH>..<HASH> 100644 --- a/lib/EasyPost/Resource.php +++ b/lib/EasyPost/Resource.php @@ -96,15 +96,6 @@ abstract class Resource extends Object return Util::convertToEasyPostObject($response, $apiKey); } - public static function string_to_params($params = array(), $pieces = array()) { - if (count($pieces) == 0) { - return $params; - } - $first_piece = array_shift($pieces); - $params[] = $first_piece; - return \EasyPost\Resource::string_to_params($params, $pieces); - } - protected function _save($class) { self::_validate('save');
Removed a vestigial function.
EasyPost_easypost-php
train
php
298f8123288e7dc89c903c209862d88df7f3ce52
diff --git a/lib/tdiary/configuration.rb b/lib/tdiary/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/tdiary/configuration.rb +++ b/lib/tdiary/configuration.rb @@ -111,9 +111,10 @@ module TDiary cgi_conf = @io_class.load_cgi_conf(self) - eval( def_vars1, binding ) + b = binding + eval( def_vars1, b ) begin - eval( cgi_conf, binding, "(TDiary::Configuration#load_cgi_conf)", 1 ) + eval( cgi_conf, b, "(TDiary::Configuration#load_cgi_conf)", 1 ) rescue SyntaxError enc = case @lang when 'en' @@ -124,7 +125,7 @@ module TDiary cgi_conf.force_encoding( enc ) retry end if cgi_conf - eval( def_vars2, binding ) + eval( def_vars2, b ) end # loading tdiary.conf in current directory
Partly reverted evaluate binding on configuration
tdiary_tdiary-core
train
rb
55fbafaa5199200088cd4129126d8210a848c556
diff --git a/lib/server.js b/lib/server.js index <HASH>..<HASH> 100644 --- a/lib/server.js +++ b/lib/server.js @@ -72,7 +72,7 @@ const startServer = (config, callback) => { child.kill(); return typeof cb === 'function' ? cb() : undefined; }; - serverCb(); + setTimeout(serverCb, 0); return child; } else { const opts = {noLog: true, path: publicPath};
Fix handling of custom servers. Closes GH-<I>
brunch_brunch
train
js
bdcbb083a112d3cc81bb98ee63a26674b5397563
diff --git a/ibis/backends/datafusion/__init__.py b/ibis/backends/datafusion/__init__.py index <HASH>..<HASH> 100644 --- a/ibis/backends/datafusion/__init__.py +++ b/ibis/backends/datafusion/__init__.py @@ -128,13 +128,12 @@ class Backend(BaseBackend): schema An optional schema """ - self._context.register_csv(name, path, schema=schema) + self._context.register_csv(name, str(path), schema=schema) def register_parquet( self, name: str, path: str | Path, - schema: sch.Schema | None = None, ) -> None: """Register a parquet file with with `name` located at `path`. @@ -147,7 +146,7 @@ class Backend(BaseBackend): schema An optional schema """ - self._context.register_parquet(name, path, schema=schema) + self._context.register_parquet(name, str(path)) def execute( self,
fix: remove passing schema into register_parquet
ibis-project_ibis
train
py
3795b59a0c267f4560538cc4010ab507c1b3c5bf
diff --git a/Test/function_test.py b/Test/function_test.py index <HASH>..<HASH> 100644 --- a/Test/function_test.py +++ b/Test/function_test.py @@ -705,4 +705,8 @@ array([[5, 1], >>> cm4.to_array() array([[3, 1], [0, 0]]) +>>> cm4 = ConfusionMatrix([1,1,1,1],["1",2,1,1],classes=[1,2]) +>>> cm4.to_array() +array([[3, 1], + [0, 0]]) """
test : a test added.
sepandhaghighi_pycm
train
py