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
94727f321611f2ba69cd8bcf3918cc54d55ef1c7
diff --git a/includes/general.php b/includes/general.php index <HASH>..<HASH> 100644 --- a/includes/general.php +++ b/includes/general.php @@ -1052,14 +1052,13 @@ function pods_shortcode_run( $tags, $content = null ) { return $pod->form( $tags['fields'], $tags['label'], $tags['thank_you'] ); } elseif ( ! empty( $tags['field'] ) ) { - $template = ! empty( $tags['template'] ) ? $tags['template'] : $content; - - if ( $template ) { + if ( $tags['template'] || $content ) { $return = ''; $related = $pod->field( $tags['field'], array( 'output' => 'find' ) ); if ( $related instanceof Pods && $related->valid() ) { - $return .= $related->template( $tags['template'], $template ); + // Content is null by default. + $return .= $related->template( $tags['template'], $content ); } } elseif ( empty( $tags['helper'] ) ) { $return = $pod->display( $tags['field'] );
Fix template params Both are always available as `null` so no need to check with `empty`
pods-framework_pods
train
php
8605dc5a1b3dd27ad6ce373a614b8d11a9950699
diff --git a/simple_open_graph/templatetags/simple_open_graph.py b/simple_open_graph/templatetags/simple_open_graph.py index <HASH>..<HASH> 100644 --- a/simple_open_graph/templatetags/simple_open_graph.py +++ b/simple_open_graph/templatetags/simple_open_graph.py @@ -1,4 +1,5 @@ from django import template +from django.contrib.sites.models import Site from ..utils import string_to_dict @@ -25,6 +26,7 @@ class OpenGraphNode(template.Node): def render(self, context): og_layout = u'<meta property="og:{0}" content="{1}" />' + site_domain = Site.objects.get_current().domain result_list = [] for key, value in self.properties.items(): try: @@ -33,6 +35,10 @@ class OpenGraphNode(template.Node): continue value = value.replace('"', ' ') key = key.replace('"', '') + # fix absolute links + if key in [u'url', u'image', u'audio', u'video'] and\ + value and value[0] == u'/': + value = u'http://{0}{1}'.format(site_domain, value) og_formatted = og_layout.format(key, value) result_list.append(og_formatted) return u'\n'.join(result_list)
fix absolute links for url, image, video, audio OpenGraph properties
saippuakauppias_django-simple-open-graph
train
py
9e3b375bfa13ee98b7fd5984f421afcd3943d5c7
diff --git a/src/Eris/Shrinker/Random.php b/src/Eris/Shrinker/Random.php index <HASH>..<HASH> 100644 --- a/src/Eris/Shrinker/Random.php +++ b/src/Eris/Shrinker/Random.php @@ -28,6 +28,7 @@ class Random // implements Shrinker if ($elementsAfterShrink === $elements) { $attempts->increase(); $attempts->ensureLimit($this->giveUpAfter, $exception); + continue; } Evaluation::of($this->assertion)
If $elements do not change there is no need to re-run the Evaluation
giorgiosironi_eris
train
php
d5796931f77c44e70ad2de6140663dafb3671450
diff --git a/cnxepub/html_parsers.py b/cnxepub/html_parsers.py index <HASH>..<HASH> 100644 --- a/cnxepub/html_parsers.py +++ b/cnxepub/html_parsers.py @@ -21,7 +21,7 @@ def _squash_to_text(elm): for child in elm.getchildren(): value.append(etree.tostring(child).decode('utf-8')) value.append(child.tail or '') - value = ''.join(value).encode('utf-8') + value = ''.join(value) return value @@ -66,7 +66,7 @@ def _nav_to_tree(root): else: # It's a node and should only have an li. a = li.xpath('xhtml:a', namespaces=HTML_DOCUMENT_NAMESPACES)[0] - yield {'id': a.get('href'), 'title': a.text} + yield {'id': a.get('href'), 'title': _squash_to_text(a)} raise StopIteration() @@ -145,7 +145,7 @@ class DocumentMetadataParser: items = self.parse('.//xhtml:*[@data-type="description"]') try: description = items[0] - value = _squash_to_text(description) + value = _squash_to_text(description).encode('utf-8') except IndexError: value = None return value
Allow html within the nav parsed titles
openstax_cnx-epub
train
py
d3b5f5e23ccb3abb5ae72cf67a96b7469dc76985
diff --git a/stp_zmq/zstack.py b/stp_zmq/zstack.py index <HASH>..<HASH> 100644 --- a/stp_zmq/zstack.py +++ b/stp_zmq/zstack.py @@ -768,17 +768,20 @@ class ZStack(NetworkInterface): try: if not serialized: msg = self.prepare_to_send(msg) + + logger.trace('{} transmitting message {} to {} by socket {} {}' + .format(self, msg, uid, socket.FD, socket.underlying)) + socket.send(msg, flags=zmq.NOBLOCK) + if remote.isConnected or msg in self.healthMessages: self.metrics.add_event(self.mt_outgoing_size, len(msg)) - logger.trace('{} transmitting message {} to {} by socket {} {}' - .format(self, msg, uid, socket.FD, socket.underlying)) - socket.send(msg, flags=zmq.NOBLOCK) else: logger.warning('Remote {} is not connected - message will not be sent immediately.' 'If this problem does not resolve itself - check your firewall settings'.format(uid)) self._stashed_to_disconnected \ .setdefault(uid, deque(maxlen=self.config.ZMQ_STASH_TO_NOT_CONNECTED_QUEUE_SIZE)) \ .append(msg) + return True, err_str except zmq.Again: logger.warning('{} could not transmit message to {}'.format(self, uid))
send regardless of whether remote is connected since it can be a Batch with ping/pongs
hyperledger_indy-plenum
train
py
8af4ba63b2097d0fdea1fe2daf8084a1272db46f
diff --git a/examples/ex_cifar10_tf.py b/examples/ex_cifar10_tf.py index <HASH>..<HASH> 100644 --- a/examples/ex_cifar10_tf.py +++ b/examples/ex_cifar10_tf.py @@ -14,7 +14,7 @@ from tensorflow.python.platform import flags from cleverhans.attacks import FastGradientMethod from cleverhans.utils_keras import cnn_model -from cleverhans.utils_tf import train, model_eval, batch_eval +from cleverhans.utils_tf import model_train, train, model_eval, batch_eval FLAGS = flags.FLAGS @@ -113,7 +113,7 @@ def main(argv=None): 'batch_size': FLAGS.batch_size, 'learning_rate': FLAGS.learning_rate } - train(sess, x, y, predictions, X_train, Y_train, + model_train(sess, x, y, predictions, X_train, Y_train, evaluate=evaluate, args=train_params) # Craft adversarial examples using Fast Gradient Sign Method (FGSM) @@ -151,7 +151,7 @@ def main(argv=None): print('Test accuracy on adversarial examples: ' + str(accuracy_adv)) # Perform adversarial training - train(sess, x, y, predictions_2, X_train, Y_train, + model_train(sess, x, y, predictions_2, X_train, Y_train, predictions_adv=predictions_2_adv, evaluate=evaluate_2, args=train_params)
Adapt train() api to be compatible with the latest utils_tf version
tensorflow_cleverhans
train
py
e4c719b55f635a22967284478230ab9cd3482735
diff --git a/salt/minion.py b/salt/minion.py index <HASH>..<HASH> 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -1073,7 +1073,7 @@ class Minion(MinionBase): # Flag meaning minion has finished initialization including first connect to the master. # True means the Minion is fully functional and ready to handle events. self.ready = False - self.jid_queue = jid_queue or [] + self.jid_queue = [] if jid_queue is None else jid_queue self.periodic_callbacks = {} if io_loop is None:
Ensure that the shared list of jids is passed when creating the Minion. Fixes an issue when minions are pointed at multiple syndics.
saltstack_salt
train
py
98954da5a89b0aa33d5c46b14d7c5769a182adfe
diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index <HASH>..<HASH> 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -1630,10 +1630,9 @@ define(function (require, exports, module) { * Respond to a FileSystem change event. */ _fileSystemChange = function (event, item) { - // TODO: Batch multiple changes into a single refresh - if (!item || item.isDirectory()) { - refreshFileTree(); - } + // TODO: Refresh file tree too - once watchers are precise enough to notify only + // when real changes occur, instead of on every window focus! + FileSyncManager.syncOpenDocuments(); };
Fix frequent project tree flickering & scroll pos loss: effectively revert to master's behavior where tree is only refreshed manually by user (it's still incrementally updated due to changes within Brackets, but updating to pick up external changes - which is always a full, flickery refresh - never occurs automatically). We'll reintroduce auto-tree-refresh once we can bring down the false- positive rate for fs change events (once we have real watchers instead of just a window-focus listener).
adobe_brackets
train
js
5d391fb3c535e5e3fe6bf4c21feff15bed61df8e
diff --git a/lib/data_mapper/adapters/mysql_adapter.rb b/lib/data_mapper/adapters/mysql_adapter.rb index <HASH>..<HASH> 100644 --- a/lib/data_mapper/adapters/mysql_adapter.rb +++ b/lib/data_mapper/adapters/mysql_adapter.rb @@ -69,16 +69,16 @@ module DataMapper query('SHOW VARIABLES WHERE `variable_name` = ?', name).first.value rescue nil end - def quote_table_name(name) - "`#{name}`" + def quote_table_name(table_name) + "`#{table_name.gsub('`', '``')}`" end - def quote_column_name(name) - "`#{name}`" + def quote_column_name(column_name) + "`#{column_name.gsub('`', '``')}`" end - def quote_column_value(value) - case value + def quote_column_value(column_value) + case column_value when TrueClass then quote_column_value(1) when FalseClass then quote_column_value(0) else
Updated MySQL adapter to escape table and column names properly
datamapper_dm-core
train
rb
11bbee3e2a5a85e3e23dbc61baee1d8859472cd9
diff --git a/gromacs/analysis/plugins/distances.py b/gromacs/analysis/plugins/distances.py index <HASH>..<HASH> 100644 --- a/gromacs/analysis/plugins/distances.py +++ b/gromacs/analysis/plugins/distances.py @@ -212,7 +212,10 @@ class _Distances(Worker): # hack: callbacks for customization if not callbacks is None: - callbacks[name](name=name, axis=ax) + try: + callbacks[name](name=name, axis=ax) + except KeyError: + pass # pylab.legend(loc='best') if figure is True:
protect call back with try git-svn-id: svn+ssh://gonzo.med.jhmi.edu/scratch/svn/woolf_repository/users/oliver/Library/GromacsWrapper@<I> df5ba8eb-4b0b-<I>-8c<I>-c<I>f<I>b<I>c
Becksteinlab_GromacsWrapper
train
py
631af0dfde487c40b3ccd71a432d425983beeb5d
diff --git a/src/components/cards/index.js b/src/components/cards/index.js index <HASH>..<HASH> 100644 --- a/src/components/cards/index.js +++ b/src/components/cards/index.js @@ -15,8 +15,7 @@ const CardMedia = { default: 'auto' }, src: { - type: String, - required: true + type: String } }, @@ -28,18 +27,22 @@ const CardMedia = { } } - const background = h('div', { - 'class': 'card__media__background', - style: { - background: `url(${this.src}) center center` - } - }) + const children = [] - const content = h('div', { + if (this.src) { + children.push(h('div', { + 'class': 'card__media__background', + style: { + background: `url(${this.src}) center center` + } + })) + } + + children.push(h('div', { 'class': 'card__media__content' - }, this.$slots.default) + }, this.$slots.default)) - return h('div', data, [background, content]) + return h('div', data, children) } }
made v-card-media src prop not required
vuetifyjs_vuetify
train
js
0298767f1ac867750707198e981b3a1b6f70eb39
diff --git a/pymc/Matplot.py b/pymc/Matplot.py index <HASH>..<HASH> 100755 --- a/pymc/Matplot.py +++ b/pymc/Matplot.py @@ -1167,9 +1167,9 @@ def summary_plot(pymc_obj, name='model', format='png', suffix='-summary', path= k = size(value) if k>1: - pyplot([min(r, 2) for r in R[varname]], [-(j+i) for j in range(k)], 'bo') + pyplot([min(r, 2) for r in R[varname]], [-(j+i) for j in range(k)], 'bo', markersize=4) else: - pyplot(min(R[varname], 2), -i, 'bo') + pyplot(min(R[varname], 2), -i, 'bo', markersize=4) i += k
Fixed marker size bug in summary_plot
pymc-devs_pymc
train
py
f8e3de1b7915bc5661acb334ccd7a6357bfb27bf
diff --git a/src/clients/MentionsClient.js b/src/clients/MentionsClient.js index <HASH>..<HASH> 100644 --- a/src/clients/MentionsClient.js +++ b/src/clients/MentionsClient.js @@ -12,14 +12,15 @@ export default class MentionsClient extends _FetchClient { return Promise.resolve([]); } - let url = `https://api.cimpress.io/auth/access-management/v1/principals?q=${query}`; + let url = `https://api.cimpress.io/auth/access-management/v1/search/canonicalPrincipals/bySubstring?q=${query}`; let init = this.getDefaultConfig('GET'); return fetch(url, init) .then((response) => { if (response.status === 200) { - return response.json().then((responseJson) => responseJson.principals.map((p) => { - return {id: p.user_id, display: p.name, email: p.email}; + return response.json().then((responseJson) => responseJson.canonical_principals.map((p) => { + const profile = p.profiles[0] || {}; + return {id: profile.user_id || p.canonical_principal, display: profile.name, email: p.canonical_principal}; })); } else { throw new Error(`Unable to fetch principals for query: ${query}`);
Pull canonical data from coam
Cimpress_react-cimpress-comment
train
js
3c7af569650858acaf3487d2bae73dc85551a87a
diff --git a/commands/MailQueueController.php b/commands/MailQueueController.php index <HASH>..<HASH> 100644 --- a/commands/MailQueueController.php +++ b/commands/MailQueueController.php @@ -6,7 +6,7 @@ * @author Rochdi B. <rochdi80tn@gmail.com> */ -namespace nterms\mailqueue; +namespace nterms\mailqueue\commands; use yii\console\Controller; @@ -18,10 +18,13 @@ use yii\console\Controller; */ class MailQueueController extends Controller { + + public $defaultAction = 'process'; + /** * This command processes the mail queue */ - public function actionIndex() + public function actionProcess() { \Yii::$app->mailqueue->process(); }
fix namesapce and set default action to process
nterms_yii2-mailqueue
train
php
d97f0372b19c0d58261c8f357ddc27cb3265b5a4
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index <HASH>..<HASH> 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1161,7 +1161,7 @@ func setSmartCard(ctx *cli.Context, cfg *node.Config) { // Sanity check that the smartcard path is valid fi, err := os.Stat(path) if err != nil { - log.Error("Failed to verify smartcard daemon path", "path", path, "err", err) + log.Info("Smartcard socket not found, disabling", err", err) return } if fi.Mode()&os.ModeType != os.ModeSocket {
accounts/scwallet: don't error when pcsc socket is missing (#<I>) * scwallet: don't error when pcsc socket is missing * review feedback * more review feedback
ethereum_go-ethereum
train
go
ef098db34234c4f533be2a3f5063bf609e960337
diff --git a/aws/resource_aws_s3_access_point_test.go b/aws/resource_aws_s3_access_point_test.go index <HASH>..<HASH> 100644 --- a/aws/resource_aws_s3_access_point_test.go +++ b/aws/resource_aws_s3_access_point_test.go @@ -67,7 +67,7 @@ func testSweepS3AccessPoints(region string) error { }) if testSweepSkipSweepError(err) { - log.Printf("[WARN] Skipping S3 Access Point sweep for %s: %w", region, err) + log.Printf("[WARN] Skipping S3 Access Point sweep for %s: %s", region, err) return nil }
tests/resource/aws_s3_access_point: Fix log.Printf linting issue
terraform-providers_terraform-provider-aws
train
go
b12c3b9b6e3b93ecd4d6ac3098e448a183f44ff8
diff --git a/src/search/FindInFiles.js b/src/search/FindInFiles.js index <HASH>..<HASH> 100644 --- a/src/search/FindInFiles.js +++ b/src/search/FindInFiles.js @@ -163,7 +163,7 @@ define(function (require, exports, module) { return matches; } - function _showSearchResults(searchResults) { + function _showSearchResults(searchResults, query) { var $searchResultsDiv = $("#search-results"); if (searchResults && searchResults.length) { @@ -188,7 +188,7 @@ define(function (require, exports, module) { $("#search-result-summary") .text(summary + (numMatches > FIND_IN_FILES_MAX ? StringUtils.format(Strings.FIND_IN_FILES_MAX, FIND_IN_FILES_MAX) : "")) - .prepend("&nbsp;"); // putting a normal space before the "-" is not enough + .prepend("&nbsp;" + "for: " + query + "&nbsp;"); // putting a normal space before the "-" is not enough var resultsDisplayed = 0; @@ -321,7 +321,7 @@ define(function (require, exports, module) { return result.promise(); }) .done(function () { - _showSearchResults(searchResults); + _showSearchResults(searchResults, query); }) .fail(function () { console.log("find in files failed.");
Added Enhancement: Search Query in Search Results Label
adobe_brackets
train
js
984a076d9ab1d47945415908aae0ac718c12feb0
diff --git a/salt/modules/systemd.py b/salt/modules/systemd.py index <HASH>..<HASH> 100644 --- a/salt/modules/systemd.py +++ b/salt/modules/systemd.py @@ -132,7 +132,7 @@ def _untracked_custom_unit_found(name): ''' unit_path = os.path.join('/etc/systemd/system', _canonical_unit_name(name)) - return name not in get_all() and os.access(unit_path, os.R_OK) + return os.access(unit_path, os.R_OK) and name not in get_all() def _unit_file_changed(name):
systemd.py: stat before iterating over known units A stat is cheap and most units don't reside in /etc/systemd so the expensive operation of gathering all known units and iterating over them can be avoided.
saltstack_salt
train
py
3ae3b6155c4d67dab6be6e88fc3b3bd237fe6728
diff --git a/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/Ping.java b/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/Ping.java index <HASH>..<HASH> 100644 --- a/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/Ping.java +++ b/aeron-samples/src/main/java/uk/co/real_logic/aeron/samples/Ping.java @@ -110,7 +110,6 @@ public class Ping } while (barrier.await()); } - } CloseHelper.quietClose(driver);
[Java]: Formatting.
real-logic_aeron
train
java
6ea320c2be23b5314032fab0d66a71dbfc268b22
diff --git a/lib/nats/client.rb b/lib/nats/client.rb index <HASH>..<HASH> 100644 --- a/lib/nats/client.rb +++ b/lib/nats/client.rb @@ -8,7 +8,7 @@ require "#{ep}/ext/json" module NATS - VERSION = '0.4.22'.freeze + VERSION = '0.4.24'.freeze DEFAULT_PORT = 4222 DEFAULT_URI = "nats://localhost:#{DEFAULT_PORT}".freeze diff --git a/lib/nats/server/const.rb b/lib/nats/server/const.rb index <HASH>..<HASH> 100644 --- a/lib/nats/server/const.rb +++ b/lib/nats/server/const.rb @@ -1,7 +1,7 @@ module NATSD #:nodoc: - VERSION = '0.4.22' + VERSION = '0.4.24' APP_NAME = 'nats-server' DEFAULT_PORT = 4222
Bumped version to <I>
nats-io_ruby-nats
train
rb,rb
28c3c45d3be82f115630c4a887a0cf5e611ef5e0
diff --git a/docs/_static/js/script.js b/docs/_static/js/script.js index <HASH>..<HASH> 100644 --- a/docs/_static/js/script.js +++ b/docs/_static/js/script.js @@ -6,7 +6,7 @@ $(function() { if(window.location.pathname.toLocaleLowerCase().indexOf('installation-guide') != -1) { $('<style>.closed, .opened {cursor: pointer;} .closed:before, .opened:before {font-family: FontAwesome; display: inline-block; padding-right: 6px;} .closed:before {content: "\\f078";} .opened:before {content: "\\f077";}</style>').appendTo('body'); var collapsable = ['#build-threadless-version-not-recommended', '#build-mpi-version', '#build-gpu-version', - '#build-cuda-version-experimental', '#build-hdfs-version', '#build-java-wrapper']; + '#build-cuda-version-experimental', '#build-hdfs-version', '#build-java-wrapper', '#build-c-unit-tests']; $.each(collapsable, function(i, val) { var header = val + ' > :header:first'; var content = val + ' :not(:header:first)';
[docs] make building of C++ tests section collapsable (#<I>)
Microsoft_LightGBM
train
js
b5b115764a8b729e076fc91c1b5af9420dbeae3b
diff --git a/tests/__init__.py b/tests/__init__.py index <HASH>..<HASH> 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -49,7 +49,7 @@ except StandardError as err: ''' -Copyright (c) 2014, Brooke M. Fujita. +Copyright (c) 2014-2015, Brooke M. Fujita. All rights reserved. Redistribution and use in source and binary forms, with or without
__init__.py edited online with Bitbucket; updating copyright to include <I>.
buruzaemon_natto-py
train
py
181c4cae4e8a1191e33469211dce28b2c46aa9b4
diff --git a/pyrap_fitting/trunk/pyrap/fitting/fitting.py b/pyrap_fitting/trunk/pyrap/fitting/fitting.py index <HASH>..<HASH> 100644 --- a/pyrap_fitting/trunk/pyrap/fitting/fitting.py +++ b/pyrap_fitting/trunk/pyrap/fitting/fitting.py @@ -177,7 +177,8 @@ class fitserver(object): raise TypeError("No or illegal functional") if not self.set(n=kw["fnct"].npar(), fid=fid): raise ValueError("Illegal fit id") - kw["fnct"] = kw["fnct"].todict() + fnct = kw["fnct"] + kw["fnct"] = fnct.todict() self.reset(fid) x = self._as_array(kw["x"]) if x.ndim > 1 and fnct.ndim() == x.ndim:
Handle numpy arrays for (ndim functionals)
casacore_python-casacore
train
py
c7f068c72d62354aae7b4a66dd23cea6df6ed7a1
diff --git a/tests/ProxyManagerTest/Autoloader/AutoloaderTest.php b/tests/ProxyManagerTest/Autoloader/AutoloaderTest.php index <HASH>..<HASH> 100644 --- a/tests/ProxyManagerTest/Autoloader/AutoloaderTest.php +++ b/tests/ProxyManagerTest/Autoloader/AutoloaderTest.php @@ -29,6 +29,7 @@ use ProxyManager\Generator\Util\UniqueIdentifierGenerator; * @license MIT * * @covers \ProxyManager\Autoloader\Autoloader + * @group Coverage */ class AutoloaderTest extends PHPUnit_Framework_TestCase {
Adding `@group Coverage` to explicitly differentiate coverage-related tests from others
Ocramius_ProxyManager
train
php
c592a418ce183a85f0f6c662e1695ec0384b3850
diff --git a/gridmap/job.py b/gridmap/job.py index <HASH>..<HASH> 100644 --- a/gridmap/job.py +++ b/gridmap/job.py @@ -395,7 +395,7 @@ def _collect_jobs(sid, jobids, joblist, redis_server, uniq_id, pool = ThreadPool() retrieve_args = [(redis_server, uniq_id, ix) for ix in range(len(joblist))] - job_output_tuples = pool.map_async(_retrieve_job_output, retrieve_args) + job_output_tuples = pool.map(_retrieve_job_output, retrieve_args) # Iterate through job outputs and check them for problems for ix, job in enumerate(joblist):
Fixed issue where I was using map_async instead of map.
pygridtools_gridmap
train
py
20d97b12f7040f9277a3f398b069164e4700f993
diff --git a/storage/store.go b/storage/store.go index <HASH>..<HASH> 100644 --- a/storage/store.go +++ b/storage/store.go @@ -335,7 +335,10 @@ func copyIDMap(idmap []idtools.IDMap) []idtools.IDMap { m = make([]idtools.IDMap, len(idmap)) copy(m, idmap) } - return m[:] + if len(m) > 0 { + return m[:] + } + return nil } func (s *store) GetRunRoot() string {
Never use empty ID maps When setting up ID maps, never use an empty one, for which mapping fails unconditionally. If we see an empty one, use nil, which is treated as no mapping.
containers_storage
train
go
484aeff75c5dbe9997cb621255a6e00190518e37
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 @@ -81,8 +81,10 @@ abstract class Base implements ControllerProviderInterface $template = $twig->resolveTemplate($template); - foreach ($globals as $name => $value) { - $twig->addGlobal($name, $value); + if ($this->getOption('compatibility/twig_globals', true)) { + foreach ($globals as $name => $value) { + $twig->addGlobal($name, $value); + } } $context += $globals;
Added "compatibility/twig_globals" flag for Controller\Base::render(). If false globals won't be assigned as twig globals. If globals are not needed this can be set to false. More code will come later to remove dependency on current twig globals (record and pager).
bolt_bolt
train
php
04097c4e7c7481b2cff070a16730f5d081fbce45
diff --git a/src/style_manager/model/Layer.js b/src/style_manager/model/Layer.js index <HASH>..<HASH> 100644 --- a/src/style_manager/model/Layer.js +++ b/src/style_manager/model/Layer.js @@ -33,6 +33,15 @@ module.exports = Backbone.Model.extend({ } }, + /** + * Get property at some index + * @param {Number} index + * @return {Object} + */ + getPropertyAt(index) { + return this.get('properties').at(index); + }, + getPropertyValue(property) { let result = ''; this.get('properties').each(prop => { diff --git a/src/style_manager/model/PropertyStack.js b/src/style_manager/model/PropertyStack.js index <HASH>..<HASH> 100644 --- a/src/style_manager/model/PropertyStack.js +++ b/src/style_manager/model/PropertyStack.js @@ -20,6 +20,14 @@ module.exports = Property.extend({ Property.callInit(this, props, opts); }, + getLayers() { + return this.get('layers'); + }, + + getCurrentLayer() { + return this.getLayers().filter(layer => layer.get('active'))[0]; + }, + getFullValue() { return this.get('detached') ? '' : this.get('layers').getFullValue(); }
Add some helper methods in Layer and PropertyStack
artf_grapesjs
train
js,js
6d3b75c9ec5045b26b535a46375bfb62b63f2878
diff --git a/lib/oxcelix/workbook.rb b/lib/oxcelix/workbook.rb index <HASH>..<HASH> 100644 --- a/lib/oxcelix/workbook.rb +++ b/lib/oxcelix/workbook.rb @@ -48,6 +48,7 @@ module Oxcelix # * Interpolation of the shared strings # * adding comments to the cells # * Converting each sheet to a Matrix object + # * Deleting the temporary directory that stores the XML files. def initialize(filename=nil, options={}) @sheets=[] @sheetbase={} @@ -56,6 +57,7 @@ module Oxcelix unpack filename open filename parse filename, options + FileUtils.remove_dir(@destination, true) end end @@ -122,7 +124,6 @@ module Oxcelix x[:cells] = @sheet.cellarray x[:mergedcells] = @sheet.mergedcells end - FileUtils.remove_dir(@destination, true) matrixto options[:copymerge] end
Parse will NOT take cary anymore of deleting the temp files. This is handled manually, or by the constructor from now on!
gbiczo_oxcelix
train
rb
b0338faa151849f70cf163753e3999b90fa66412
diff --git a/database/migrations/2018_07_27_000000_create_translations_table.php b/database/migrations/2018_07_27_000000_create_translations_table.php index <HASH>..<HASH> 100644 --- a/database/migrations/2018_07_27_000000_create_translations_table.php +++ b/database/migrations/2018_07_27_000000_create_translations_table.php @@ -16,7 +16,7 @@ class CreateTranslationsTable extends Migration Schema::create('translations', function(Blueprint $table) { $table->increments('id'); - $table->char('hash_id', 32); + $table->char('hash_id', 32)->unique(); $table->integer('source_id')->unsigned()->nullable(); $table->foreign('source_id') ->references('id')
unique constraint on hash_id
sysoce_laravel-translation
train
php
a770a7cf6c2b0a4703cf29f419c400266fee1530
diff --git a/tornado/web.py b/tornado/web.py index <HASH>..<HASH> 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -344,6 +344,16 @@ class RequestHandler(object): if timestamp < time.time() - 31 * 86400: logging.warning("Expired cookie %r", value) return None + if timestamp > time.time() + 31 * 86400: + # _cookie_signature does not hash a delimiter between the + # parts of the cookie, so an attacker could transfer trailing + # digits from the payload to the timestamp without altering the + # signature. For backwards compatibility, sanity-check timestamp + # here instead of modifying _cookie_signature. + logging.warning("Cookie timestamp in future; possible tampering %r", value) + return None + if parts[1].startswith("0"): + logging.warning("Tampered cookie %r", value) try: return base64.b64decode(parts[0]) except:
Check for far-future timestamps in secure cookies.
tornadoweb_tornado
train
py
1e51d611fe4036a7f8de9b4d08d5ddd15e791a63
diff --git a/angr/analyses/cfg/cfg_fast.py b/angr/analyses/cfg/cfg_fast.py index <HASH>..<HASH> 100644 --- a/angr/analyses/cfg/cfg_fast.py +++ b/angr/analyses/cfg/cfg_fast.py @@ -3325,7 +3325,7 @@ class CFGFast(ForwardAnalysis, CFGBase): # pylint: disable=abstract-method # in the end, check the distance between `addr` and the closest occupied region in segment list next_noncode_addr = self._seg_list.next_pos_with_sort_not_in(addr, { "code" }, max_distance=distance) if next_noncode_addr is not None: - distance_to_noncode_addr = next_noncode_addr - addr + distance_to_noncode_addr = next_noncode_addr - real_addr distance = min(distance, distance_to_noncode_addr) # Let's try to create the pyvex IRSB directly, since it's much faster
CFGFast: Use real_addr instead of addr to calculate the distance to the next block.
angr_angr
train
py
c6a8ad9e3a960637526d2dd9dbd31a2080218532
diff --git a/script/upload-index-json.py b/script/upload-index-json.py index <HASH>..<HASH> 100755 --- a/script/upload-index-json.py +++ b/script/upload-index-json.py @@ -10,7 +10,7 @@ from lib.util import s3put, scoped_cwd, safe_mkdir SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'D') -BASE_URL = 'https://electron-metadumper.herokuapp.com/?version=v' +BASE_URL = 'https://electron-metadumper.herokuapp.com/?version=' version = sys.argv[1] authToken = os.getenv('META_DUMPER_AUTH_HEADER')
chore: remove v from script :sigh: (#<I>)
electron_electron
train
py
4fe41aabbaa4e018ea4e0ae5e42e53859ac65f58
diff --git a/src/Channel/Dispatcher/BroadcastingDispatcher.php b/src/Channel/Dispatcher/BroadcastingDispatcher.php index <HASH>..<HASH> 100644 --- a/src/Channel/Dispatcher/BroadcastingDispatcher.php +++ b/src/Channel/Dispatcher/BroadcastingDispatcher.php @@ -17,7 +17,7 @@ class BroadcastingDispatcher implements MessageDispatcher /** * @var MessageHandler[] */ - private $messageHandlers; + private $messageHandlers = []; public static function create() : self {
broadcasting with empty message handlers
SimplyCodedSoftware_integration-messaging
train
php
9a377ddcd3f127603d4170e3704431a890c726f1
diff --git a/tensorflow_probability/python/sts/local_level.py b/tensorflow_probability/python/sts/local_level.py index <HASH>..<HASH> 100644 --- a/tensorflow_probability/python/sts/local_level.py +++ b/tensorflow_probability/python/sts/local_level.py @@ -297,14 +297,13 @@ class LocalLevel(StructuralTimeSeries): dtype = dtype_util.common_dtype([level_scale_prior, initial_level_prior]) - if level_scale_prior is None or initial_level_prior is None: - if observed_time_series is not None: - _, observed_stddev, observed_initial = ( - sts_util.empirical_statistics(observed_time_series)) - else: - observed_stddev, observed_initial = (tf.convert_to_tensor( - value=1., dtype=dtype), tf.convert_to_tensor( - value=0., dtype=dtype)) + if observed_time_series is not None: + _, observed_stddev, observed_initial = ( + sts_util.empirical_statistics(observed_time_series)) + else: + observed_stddev, observed_initial = (tf.convert_to_tensor( + value=1., dtype=dtype), tf.convert_to_tensor( + value=0., dtype=dtype)) # Heuristic default priors. Overriding these may dramatically # change inference performance and results.
Fix bug in which necessary stats were not computed when both a level_scale_prior and initial_level_prior were specified for a LocalLevel model. PiperOrigin-RevId: <I>
tensorflow_probability
train
py
62c388bc090dd8db16af17b2f0b2df7e61a03142
diff --git a/TYPO3.Fluid/Classes/Core/Parser/Configuration.php b/TYPO3.Fluid/Classes/Core/Parser/Configuration.php index <HASH>..<HASH> 100644 --- a/TYPO3.Fluid/Classes/Core/Parser/Configuration.php +++ b/TYPO3.Fluid/Classes/Core/Parser/Configuration.php @@ -33,19 +33,10 @@ namespace F3\Fluid\Core\Parser; class Configuration { /** - * generic interceptors registered with the configuration. + * Generic interceptors registered with the configuration. * @var array<\SplObjectStorage> */ - protected $interceptors; - - /** - * Set up the internals... - * - * @author Karsten Dambekalns <karsten@typo3.org> - */ - public function __construct() { - $this->interceptors = array(); - } + protected $interceptors = array(); /** * Adds an interceptor to apply to values coming from object accessors.
[~TASK] TYPO3: Adjusted Policy.yaml to new expected format. [~TASK] FLOW3: Some small fixes to doc comments and code. [~TASK] Fluid (Parser): Got rid of the constructor in Parser\Configuration. Original-Commit-Hash: 6e<I>e3f<I>e3e<I>bd<I>ff1d<I>c4a<I>e
neos_flow-development-collection
train
php
df22c0aaeef7bffa856036f7114743faace44df3
diff --git a/git/git.go b/git/git.go index <HASH>..<HASH> 100644 --- a/git/git.go +++ b/git/git.go @@ -65,7 +65,7 @@ func LsRemote(remote, remoteRef string) (string, error) { func ResolveRef(ref string) (*Ref, error) { outp, err := subprocess.SimpleExec("git", "rev-parse", ref, "--symbolic-full-name", ref) if err != nil { - return nil, err + return nil, fmt.Errorf("Git can't resolve ref: %q", ref) } if outp == "" { return nil, fmt.Errorf("Git can't resolve ref: %q", ref)
Improved error-reporting in ResolveRef. This is required when SimpleExec stops swallowing the error return. Related test "ls-files: with zero files".
git-lfs_git-lfs
train
go
95a7796d697d5ec25e838fcbc7f3be867bd30198
diff --git a/plugins/PluginSessionRenegotiation.py b/plugins/PluginSessionRenegotiation.py index <HASH>..<HASH> 100644 --- a/plugins/PluginSessionRenegotiation.py +++ b/plugins/PluginSessionRenegotiation.py @@ -93,6 +93,9 @@ class PluginSessionRenegotiation(PluginBase.PluginBase): clientReneg = False elif 'no renegotiation' in str(e.args): clientReneg = False + elif 'tlsv1 unrecognized name' in str(e.args): + # Yahoo's very own way of rejecting a renegotiation + clientReneg = False else: raise
Detect when Yahoo rejects a renegotiation Fixes issue #<I>
nabla-c0d3_sslyze
train
py
d3d8d186ff8b3706f3c0ba92d0ccc536f2614b53
diff --git a/ewma.go b/ewma.go index <HASH>..<HASH> 100644 --- a/ewma.go +++ b/ewma.go @@ -102,8 +102,9 @@ func (e *VariableEWMA) Add(value float64) { // Value returns the current value of the average, or 0.0 if the series hasn't // warmed up yet. func (e *VariableEWMA) Value() float64 { - if e.count < WARMUP_SAMPLES { + if e.count <= WARMUP_SAMPLES { return 0.0 } + return e.value }
fix off by one error in VariableEWMA.Value() return
VividCortex_ewma
train
go
4469a513ea68ce2a1b5211ce18cc10bfb1584e73
diff --git a/fsdb/fsdb.py b/fsdb/fsdb.py index <HASH>..<HASH> 100644 --- a/fsdb/fsdb.py +++ b/fsdb/fsdb.py @@ -260,7 +260,10 @@ class Fsdb(object): """Calculate digest of the file located at @filepath Args: - digest -- digest of the file to remove + filepath -- the filepath of the file from which calculate digest + algorithn -- the algorithm to use + [md5,sha1,sha224,sha256,sha384,sha512] + block_size -- the size of the block to read at each iteration """ if(algorithm == "md5"): algFunct = hashlib.md5 @@ -278,9 +281,12 @@ class Fsdb(object): raise ValueError('"' + algorithm + '" it is not a supported algorithm function') hashM = algFunct() - with open(filepath, 'r') as f: - data = f.read(block_size) - hashM.update(data) + with open(filepath, 'rb') as f: + while True: + chunk = f.read(block_size) + if not chunk: + break + hashM.update(chunk) return hashM.hexdigest() @staticmethod
fixed bug: wrong digest digest was calculated only for the first chunk
ael-code_pyFsdb
train
py
03a3f128df19172cbcda16a8846984b88e03354d
diff --git a/src/com/opera/core/systems/OperaDriver.java b/src/com/opera/core/systems/OperaDriver.java index <HASH>..<HASH> 100644 --- a/src/com/opera/core/systems/OperaDriver.java +++ b/src/com/opera/core/systems/OperaDriver.java @@ -167,9 +167,9 @@ public class OperaDriver implements WebDriver, FindsByLinkText, FindsById, /** * Shutdown webdriver, will kill opera and such if running. */ + // quit() == services.quit() public void shutdown() { - if (settings.getNoQuit()) services.shutdown(); - else quit(); + services.shutdown(); if (operaRunner != null) operaRunner.shutdown(); }
Fix for DSK-<I>, taking long to shutdown
operasoftware_operaprestodriver
train
java
1ebbf27a4382d8f32da087008187f1c22f23b6bc
diff --git a/app/Http/RequestHandlers/SiteLogsPage.php b/app/Http/RequestHandlers/SiteLogsPage.php index <HASH>..<HASH> 100644 --- a/app/Http/RequestHandlers/SiteLogsPage.php +++ b/app/Http/RequestHandlers/SiteLogsPage.php @@ -87,12 +87,12 @@ class SiteLogsPage implements RequestHandlerInterface $user_options = $this->user_service->all()->mapWithKeys(static function (User $user): array { return [$user->userName() => $user->userName()]; }); - $user_options = (new Collection(['' => '']))->merge($user_options); + $user_options->prepend('', ''); $tree_options = $this->tree_service->all()->mapWithKeys(static function (Tree $tree): array { return [$tree->name() => $tree->title()]; }); - $tree_options = (new Collection(['' => '']))->merge($tree_options); + $tree_options->prepend('', ''); $title = I18N::translate('Website logs');
Fix: trees with numeric names don't work in site logs
fisharebest_webtrees
train
php
ba589430e084f2a0311ac9f2e1a9c58baf377fba
diff --git a/lib/components/form/date-time-preview.js b/lib/components/form/date-time-preview.js index <HASH>..<HASH> 100644 --- a/lib/components/form/date-time-preview.js +++ b/lib/components/form/date-time-preview.js @@ -48,7 +48,7 @@ class DateTimePreview extends Component { ) return ( - <div className='settings-preview'> + <div className='settings-preview' onClick={this.props.onClick}> {summary} {button} <div style={{ clear: 'both' }} />
feat(form): Make full date/time tab clickable in desktop
opentripplanner_otp-react-redux
train
js
5736ecf6e67d466216086f7d8b5d58c0a46ddda4
diff --git a/grunt/tasks/browserify.js b/grunt/tasks/browserify.js index <HASH>..<HASH> 100644 --- a/grunt/tasks/browserify.js +++ b/grunt/tasks/browserify.js @@ -35,7 +35,7 @@ var bundles = { 'standard-specs': { src: [ 'test/spec/src-browserify/standard.spec.js', - 'test/spec/src-browserify/bundles/create-cdb.spec.js', + 'test/spec/src-browserify/create-cdb.spec.js', 'test/spec/src-browserify/core/decorators.spec.js', 'test/spec/src-browserify/core/log.spec.js', 'test/spec/src-browserify/core/log/*.js',
Fix create-cdb specs being run
CartoDB_carto.js
train
js
10716d73108197a2303d277a8a5a1fee9669c729
diff --git a/lib/authn/config.rb b/lib/authn/config.rb index <HASH>..<HASH> 100644 --- a/lib/authn/config.rb +++ b/lib/authn/config.rb @@ -5,8 +5,8 @@ module AuthN class Config < AltStruct DEFAULTS = { - account_klass: :Account, password_digest_method: :password_digest, + account_klass: "Account", login_password_key: :password, model_id_method: :id, model_critera_method: :where, diff --git a/lib/authn/version.rb b/lib/authn/version.rb index <HASH>..<HASH> 100644 --- a/lib/authn/version.rb +++ b/lib/authn/version.rb @@ -1,3 +1,3 @@ module AuthN - VERSION = "2.1.0" + VERSION = "2.2.0" end
Using a string instead of a symbol for the class name of the account
krainboltgreene_authn
train
rb,rb
00dcf5eb1651b2265e858c3ed31d35d87e0fde30
diff --git a/Framework/Request.php b/Framework/Request.php index <HASH>..<HASH> 100644 --- a/Framework/Request.php +++ b/Framework/Request.php @@ -14,15 +14,6 @@ public $contentType; public $pageCodeStop = false; public function __construct($config, $t) { - // Force removal of www subdomain. - if(strpos($_SERVER["HTTP_HOST"], "www.") === 0) { - $host = substr( - $_SERVER["HTTP_HOST"], - strlen("www.") - ); - header("Location: //$host" . $_SERVER["REQUEST_URI"], 302); - exit; - } date_default_timezone_set($config["App"]::getTimezone()); $this->contentType = "text/html"; session_start();
Remove forcing of www removal, fixes #<I>.
PhpGt_WebEngine
train
php
454365617a2a80b4e2b7e2f2ccd362bd94e3b9af
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -378,13 +378,17 @@ algos_ext = Extension('pandas._algos', lib_depends = tseries_depends + ['pandas/src/numpy_helper.h', 'pandas/src/datetime/np_datetime.h', 'pandas/src/datetime/np_datetime_strings.h'] + +# some linux distros require it +libraries = ['m'] if 'win' not in sys.platform else [] + lib_ext = Extension('pandas.lib', depends=lib_depends, sources=[srcpath('tseries', suffix=suffix), 'pandas/src/datetime/np_datetime.c', 'pandas/src/datetime/np_datetime_strings.c'], include_dirs=[np.get_include()], - libraries=['m'], # some linux distros require it + libraries=libraries, # pyrex_gdb=True, # extra_compile_args=['-Wconversion'] )
BLD: don't link against math library on windows
pandas-dev_pandas
train
py
f8c1e36690abd6edaff8881c812432a51678f77d
diff --git a/model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/VariantMetricInformation.java b/model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/VariantMetricInformation.java index <HASH>..<HASH> 100644 --- a/model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/VariantMetricInformation.java +++ b/model/api/src/main/java/org/jboss/aerogear/unifiedpush/api/VariantMetricInformation.java @@ -16,6 +16,8 @@ */ package org.jboss.aerogear.unifiedpush.api; +import org.codehaus.jackson.annotate.JsonIgnore; + import javax.validation.constraints.NotNull; /** @@ -30,6 +32,7 @@ public class VariantMetricInformation extends BaseModel { private Boolean deliveryStatus = Boolean.FALSE; private String reason; + @JsonIgnore private PushMessageInformation pushMessageInformation; public VariantMetricInformation() {
add @jsonignore to child to avoid infinite recursion
aerogear_aerogear-unifiedpush-server
train
java
7afb5a0dcf74746b45cb0e3ef99ed89434c5fe6e
diff --git a/src/Aws/Common/Enum/Region.php b/src/Aws/Common/Enum/Region.php index <HASH>..<HASH> 100644 --- a/src/Aws/Common/Enum/Region.php +++ b/src/Aws/Common/Enum/Region.php @@ -22,7 +22,7 @@ use Aws\Common\Enum; * Contains enumerable region code values. These should be useful in most cases, * with Amazon S3 being the most notable exception * - * @see http://docs.amazonwebservices.com/general/latest/gr/rande.html + * @link http://docs.amazonwebservices.com/general/latest/gr/rande.html AWS Regions and Endpoints */ class Region extends Enum {
Updated the @see tag in Aws\Common\Enum\Region to a @link tag for semantic reasons.
aws_aws-sdk-php
train
php
a916ebfd3f29d26b775a6d61fcdfe1fc8006cb78
diff --git a/src/config/bot-agent-list.php b/src/config/bot-agent-list.php index <HASH>..<HASH> 100644 --- a/src/config/bot-agent-list.php +++ b/src/config/bot-agent-list.php @@ -123,4 +123,4 @@ $botagents=array("trueknowledgebot" => "TrueKnowledgeBot", "mindupbot" => "mindUpBot (datenbutler.de)", "ips-agent" => "http://de.wetena.com/bot/ips-agent", "seobility" => "Seobility SEO-Check", -); ?> \ No newline at end of file +);
[Insight] Text files should end with a newline character
BugBuster1701_botdetection
train
php
1d24259c4f9aef129750e3035acb0b29a096bf62
diff --git a/oidc_auth/authentication.py b/oidc_auth/authentication.py index <HASH>..<HASH> 100644 --- a/oidc_auth/authentication.py +++ b/oidc_auth/authentication.py @@ -122,7 +122,7 @@ class JSONWebTokenAuthentication(BaseOidcAuthentication): keys = self.jwks() try: id_token = JWS().verify_compact(jwt_value, keys=keys) - except JWKESTException: + except (JWKESTException, ValueError): msg = _('Invalid Authorization header. JWT Signature verification failed.') raise AuthenticationFailed(msg)
Handle ValueError for badly formed JWT If you pass `Authorization: JWT XXX.xxx.xxx` then ValueError from JSON decode would be raised, which isn't handled by this library and goes upwards instead of giving authentication error.
ByteInternet_drf-oidc-auth
train
py
8835ff0d7c3c1e08fe5d4f0bacd4c7651f01e079
diff --git a/go/graph/functions.go b/go/graph/functions.go index <HASH>..<HASH> 100644 --- a/go/graph/functions.go +++ b/go/graph/functions.go @@ -7,9 +7,9 @@ import ( ) const ( - dequeued = -1 + iota - unseen - seen + dequeued = ^(1<<31 - 1) + unseen = 0 + seen = 1 ) // O(V + E). It does not matter to traverse back @@ -233,22 +233,10 @@ func (g *Graph) MinimumSpanningTree() []Edge { mst := make([]Edge, 0) for i := range g.nodes { if g.nodes[i].parent != nil { - mst = append(mst, Edge{Weight: g.edgeWeightBetween(g.nodes[i], g.nodes[i].parent), + mst = append(mst, Edge{Weight: g.nodes[i].state, Start: g.nodes[i].container, End: g.nodes[i].parent.container}) } } return mst } - -// only called when the graph is guaranteed to have an edge -// between the two nodes -func (g *Graph) edgeWeightBetween(v, u *node) int { - for _, edge := range u.edges { - // one of the two is always u - if edge.end == v { - return edge.weight - } - } - return 0 -}
change dequeued to ^(1<<<I>-1), removed edgeWeightBetween b/c node.state == minimum edge weight == edgeWeightBetween
twmb_algoimpl
train
go
e95dd9e09bd483e152dff6b05948114b39492108
diff --git a/conn/command_logout_test.go b/conn/command_logout_test.go index <HASH>..<HASH> 100644 --- a/conn/command_logout_test.go +++ b/conn/command_logout_test.go @@ -26,7 +26,8 @@ var _ = Describe("LOGOUT Command", func() { It("should give an error", func() { SendLine("abcd.123 LOGOUT") - ExpectResponse("abcd.123 NO not logged in") + ExpectResponse("* BYE IMAP4rev1 server logging out") + ExpectResponse("abcd.123 OK LOGOUT completed") }) }) })
LOGOUT command should still work when not authenticated
jordwest_imap-server
train
go
44c122d930bafffd95805c3b91a3831ceecf9bfd
diff --git a/test/k8sT/DatapathConfiguration.go b/test/k8sT/DatapathConfiguration.go index <HASH>..<HASH> 100644 --- a/test/k8sT/DatapathConfiguration.go +++ b/test/k8sT/DatapathConfiguration.go @@ -631,6 +631,23 @@ var _ = Describe("K8sDatapathConfig", func() { Expect(testPodConnectivityAcrossNodes(kubectl)).Should(BeTrue(), "Connectivity test between nodes failed") }) }) + + Context("Host firewall", func() { + SkipItIf(func() bool { + return !helpers.IsIntegration(helpers.CIIntegrationGKE) + }, "Check connectivity with IPv6 disabled", func() { + deploymentManager.DeployCilium(map[string]string{ + "ipv4.enabled": "true", + "ipv6.enabled": "false", + "hostFirewall": "true", + // We need the default GKE config. except for per-endpoint + // routes (incompatible with host firewall for now). + "gke.enabled": "false", + "tunnel": "disabled", + }, DeployCiliumOptionsAndDNS) + Expect(testPodConnectivityAcrossNodes(kubectl)).Should(BeTrue(), "Connectivity test between nodes failed") + }) + }) }) func testPodConnectivityAcrossNodes(kubectl *helpers.Kubectl) bool {
test: Minimal test for the host firewall in IPv4-only mode This test is meant to catch complexity regressions such as fixed in the previous commit. It runs only on GKE for now and will be extended in follow up PRs.
cilium_cilium
train
go
f415958ed6570a0ffc507826e6066bb331ca70c3
diff --git a/redis_shard/shard.py b/redis_shard/shard.py index <HASH>..<HASH> 100644 --- a/redis_shard/shard.py +++ b/redis_shard/shard.py @@ -15,13 +15,18 @@ _findhash = re.compile('.*\{(.*)\}.*', re.I) class RedisShardAPI(object): + _servers = {} + def __init__(self, settings=None): self.nodes = [] self.connections = {} settings = format_config(settings) for server_config in settings: name = server_config.pop('name') - conn = redis.Redis(**server_config) + conn = RedisShardAPI._servers.get(name, None) + if not conn: + conn = redis.Redis(**server_config) + RedisShardAPI._servers[name] = conn if name in self.connections: raise ValueError("server's name config must be unique") server_config['name'] = name
use a global pool to re-use the connections.
zhihu_redis-shard
train
py
bd4abdfdd678592a28f3b7d24a2b5b49e066a8e5
diff --git a/plotnine/utils.py b/plotnine/utils.py index <HASH>..<HASH> 100644 --- a/plotnine/utils.py +++ b/plotnine/utils.py @@ -1016,7 +1016,7 @@ def order_as_mapping_data(*args): if data is None or isinstance(data, aes): mapping, data = data, mapping - if mapping and not isinstance(mapping, aes): + if mapping is not None and not isinstance(mapping, aes): raise TypeError( "Unknown argument type {!r}, expected mapping/aes." .format(type(mapping))
Fix potential truth check against a Series (#<I>)
has2k1_plotnine
train
py
effa44bac8fdaa08e4843c311e9e77884d94594d
diff --git a/generators/gae/index.js b/generators/gae/index.js index <HASH>..<HASH> 100644 --- a/generators/gae/index.js +++ b/generators/gae/index.js @@ -774,13 +774,13 @@ module.exports = class extends BaseGenerator { if (this.buildTool === 'maven') { this.log(chalk.bold('\nRun App Engine DevServer Locally: ./mvnw package appengine:run -DskipTests')); this.log( - chalk.bold('Deploy to App Engine: ./mvnw clean && ./mvnw package appengine:deploy -DskipTests -Pgae,prod-gae') + chalk.bold('Deploy to App Engine: ./mvnw package appengine:deploy -DskipTests -Pgae,prod-gae') ); } else if (this.buildTool === 'gradle') { this.log(chalk.bold('\nRun App Engine DevServer Locally: ./gradlew appengineRun')); this.log( chalk.bold( - 'Deploy to App Engine: ./gradlew thinResolve -Pgae -Pprod-gae && ./gradlew appengineDeploy -Pgae -Pprod-gae' + 'Deploy to App Engine: ./gradlew appengineDeploy -Pgae -Pprod-gae' ) ); }
simplify maven and gradle deployment commands to GAE remove clean and thinresolve commands
jhipster_generator-jhipster
train
js
aef966a6d802ad989a33d6bcd852129eb5c58ab3
diff --git a/lib/marky-markov.rb b/lib/marky-markov.rb index <HASH>..<HASH> 100755 --- a/lib/marky-markov.rb +++ b/lib/marky-markov.rb @@ -1,14 +1,23 @@ #!/usr/bin/env ruby -i require_relative 'marky-markov/markov-dictionary' -require_relative 'marky-markov/sentence-generator' require_relative 'marky-markov/two-word-dictionary' +require_relative 'marky-markov/persistent-dictionary' +require_relative 'marky-markov/sentence-generator' require_relative 'marky-markov/two-word-sentence-generator' if __FILE__ == $0 - file = ARGV[0] || "frank.txt" - wordcount = ARGV[1] || 200 + wordcount = ARGV[0] || 200 + source = ARGV[1] - dict = TwoWordDictionary.new(file) + if source.nil? + if File.exists?('dictionary') + dict = PersistentDictionary.new('dictionary') + else + puts "No source text or dictionary supplied." + end + else + dict = TwoWordDictionary.new(source) + end sentence = TwoWordSentenceGenerator.new(dict.dictionary) puts sentence.generate(wordcount.to_i) end
Main runtime can use PersistentDictionary Marky-Markov can build a dictionary based on a supplied file for one time use or if left blank will build a sentence based on the PersistentDictionary, if present.
zolrath_marky_markov
train
rb
9136caeedb311de3d6176bb9f23e03ecbdc4bcfb
diff --git a/spikeextractors/extractors/cedextractors/cedrecordingextractor.py b/spikeextractors/extractors/cedextractors/cedrecordingextractor.py index <HASH>..<HASH> 100644 --- a/spikeextractors/extractors/cedextractors/cedrecordingextractor.py +++ b/spikeextractors/extractors/cedextractors/cedrecordingextractor.py @@ -43,7 +43,7 @@ class CEDRecordingExtractor(RecordingExtractor): file_path = Path(file_path) assert file_path.is_file() and file_path.suffix == '.smrx', 'file_path must lead to a .smrx file!' - RecordingExtractor.__init__(self) + super().__init__(self) # Open smrx file self._recording_file_path = file_path
Update spikeextractors/extractors/cedextractors/cedrecordingextractor.py
SpikeInterface_spikeextractors
train
py
386ed9d49bb444c60b6291715b6efd4d0e3130e0
diff --git a/modules/custom/d_update/src/Updater.php b/modules/custom/d_update/src/Updater.php index <HASH>..<HASH> 100644 --- a/modules/custom/d_update/src/Updater.php +++ b/modules/custom/d_update/src/Updater.php @@ -112,12 +112,20 @@ class Updater { return FALSE; } - // If this is field storage, save it via field_storage_config, otherwise use default config storage. if (preg_match('/^field\.storage\./', $name)) { + // If this is field storage, save it via field_storage_config. return $this->entityTypeManager->getStorage('field_storage_config') ->create($data) ->save(); - } else { + } + else if (preg_match('/^field\.field\./', $name)) { + // If this is field instance, save it via field_config. + return $this->entityTypeManager->getStorage('field_config') + ->create($data) + ->save(); + } + else { + // Otherwise use plain config storage. return $this->configStorage->write($name, $data); }
DROOP-<I> New update hook for <I>: attempt 6: changed field instance handling
droptica_droopler
train
php
36081881e9064ea0d0c8b914a4785c00606ee15b
diff --git a/src/Charcoal/App/ServiceProvider/TranslatorServiceProvider.php b/src/Charcoal/App/ServiceProvider/TranslatorServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Charcoal/App/ServiceProvider/TranslatorServiceProvider.php +++ b/src/Charcoal/App/ServiceProvider/TranslatorServiceProvider.php @@ -95,9 +95,12 @@ class TranslatorServiceProvider implements ServiceProviderInterface $container['translator/resource-repository'] = function (Container $container) { $config = $container['translator/config']->translations(); - $loader = new ResourceRepository(); - $loader->setDependencies($container); - $loader->setPaths($config['paths']); + $loader = new ResourceRepository([ + 'logger' => $container['logger'], + 'cache' => $container['cache'], + 'base_path' => $container['config']['base_path'], + 'paths' => $config['paths'] + ]); return $loader; };
Simplified creation of ResourceRepository
locomotivemtl_charcoal-app
train
php
79828f7543f355180c6225442404dd833a0252a2
diff --git a/tests/Composer/Test/Json/JsonManipulatorTest.php b/tests/Composer/Test/Json/JsonManipulatorTest.php index <HASH>..<HASH> 100644 --- a/tests/Composer/Test/Json/JsonManipulatorTest.php +++ b/tests/Composer/Test/Json/JsonManipulatorTest.php @@ -2310,6 +2310,22 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } + public function testRemoveMainKeyRemovesKeyWhereValueIsNull() + { + $manipulator = new JsonManipulator(json_encode(array( + 'foo' => 9000, + 'bar' => null, + ))); + + $manipulator->removeMainKey('bar'); + + $expected = json_encode(array( + 'foo' => 9000, + )); + + $this->assertJsonStringEqualsJsonString($expected, $manipulator->getContents()); + } + public function testIndentDetection() { $manipulator = new JsonManipulator('{
Enhancement: Assert that key is removed when value is null
composer_composer
train
php
ab98915d83988cc1c306302ca876253650980353
diff --git a/tcp.go b/tcp.go index <HASH>..<HASH> 100644 --- a/tcp.go +++ b/tcp.go @@ -5,7 +5,6 @@ import ( "fmt" "net" "sync" - "time" logging "github.com/ipfs/go-log" reuseport "github.com/jbenet/go-reuseport" @@ -56,8 +55,6 @@ func (t *TcpTransport) Dialer(laddr ma.Multiaddr, opts ...tpt.DialOpt) (tpt.Dial var doReuse bool for _, o := range opts { switch o := o.(type) { - case tpt.TimeoutOpt: - base.Timeout = time.Duration(o) case tpt.ReuseportOpt: doReuse = bool(o) default:
remove the timeoutOpt Timeout should only be set by using contexts.
libp2p_go-tcp-transport
train
go
c8d74d1a7f1e328be57626f2a86d2262a84b1c55
diff --git a/server/application/application.go b/server/application/application.go index <HASH>..<HASH> 100644 --- a/server/application/application.go +++ b/server/application/application.go @@ -1272,8 +1272,9 @@ func (s *Server) plugins() ([]*v1alpha1.ConfigManagementPlugin, error) { return nil, err } tools := make([]*v1alpha1.ConfigManagementPlugin, len(plugins)) - for i, plugin := range plugins { - tools[i] = &plugin + for i, p := range plugins { + p := p + tools[i] = &p } return tools, nil }
Fix bug where the same pointer is used. (#<I>)
argoproj_argo-cd
train
go
faf4460742d503fd4a997e1b547d487892d0973f
diff --git a/src/com/xeiam/sundial/ee/SundialInitializerListener.java b/src/com/xeiam/sundial/ee/SundialInitializerListener.java index <HASH>..<HASH> 100644 --- a/src/com/xeiam/sundial/ee/SundialInitializerListener.java +++ b/src/com/xeiam/sundial/ee/SundialInitializerListener.java @@ -127,6 +127,15 @@ public class SundialInitializerListener implements ServletContextListener { logger.info("Scheduler has not been started. Use scheduler.start()"); } + String globalLockOnLoadString = servletContext.getInitParameter("global-lock-on-load"); + boolean globalLockOnLoad = false; + if (globalLockOnLoadString != null) { + globalLockOnLoad = Boolean.valueOf(globalLockOnLoadString).booleanValue(); + if (globalLockOnLoad) { + SundialJobScheduler.lockScheduler(); + } + } + } catch (Exception e) { logger.error("Quartz Scheduler failed to initialize: ", e); }
added global-lock-on-startup key to context listener
knowm_Sundial
train
java
42b7ab193057177f270f8fc0e5c38dfe587bf6d0
diff --git a/code/widgets/WidgetAreaEditor.php b/code/widgets/WidgetAreaEditor.php index <HASH>..<HASH> 100644 --- a/code/widgets/WidgetAreaEditor.php +++ b/code/widgets/WidgetAreaEditor.php @@ -21,6 +21,8 @@ class WidgetAreaEditor extends FormField { function FieldHolder() { Requirements::css(CMS_DIR . '/css/WidgetAreaEditor.css'); + Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js"); + Requirements::javascript(THIRDPARTY_DIR . '/behaviour/behaviour.js'); Requirements::javascript(CMS_DIR . '/javascript/WidgetAreaEditor.js'); return $this->renderWith("WidgetAreaEditor");
BUGFIX: Prevent JS errors when widget area is loaded (note: doesn't actually fix it fully yet)
silverstripe_silverstripe-siteconfig
train
php
70d0bdb8063387ae6c83d37248b5485e18df478e
diff --git a/src/Tests/MespronosReminderTest.php b/src/Tests/MespronosReminderTest.php index <HASH>..<HASH> 100644 --- a/src/Tests/MespronosReminderTest.php +++ b/src/Tests/MespronosReminderTest.php @@ -84,7 +84,7 @@ class MespronosReminderTest extends WebTestBase { $this->better2 = $this->drupalCreateUser(); } -/* + public function testReminderInitReturnTrue() { $this->assertFalse(ReminderController::init()); $this->assertTrue(is_array(ReminderController::getHoursDefined())); @@ -225,7 +225,7 @@ class MespronosReminderTest extends WebTestBase { $user_ids = ReminderController::getUserWithEnabledReminder(); $this->assertEqual(count($user_ids),1,t('The returned array contains one element')); } -*/ + public function testDayGetGamesIdMethod() { $this->assertTrue(is_array($this->day1->getGamesId()),t('la Methode Day::getGamesId retourne bien un array')); $this->assertEqual(count($this->day1->getGamesId()),0,t('la Methode Day::getGamesId retourne bien un array vide quand pas de match'));
Reminder - uncomment all tests
mespronos_mespronos
train
php
012a41bec5c8d5002d62f71b8f9f1acd0aebf520
diff --git a/config/release.js b/config/release.js index <HASH>..<HASH> 100644 --- a/config/release.js +++ b/config/release.js @@ -3,8 +3,7 @@ var execSync = require('child_process').execSync; module.exports = { // Publish the new release to NPM after a successful push afterPush: function() { - var output = execSync('npm publish'); - console.log('********'); + var output = execSync('npm publish', { encoding: 'utf8' }); console.log(output); } };
Ensure proper encoding of `npm publish` output.
ember-decorators_ember-decorators
train
js
c5e5139a26f545a48c0a4b66a06b64efd6999c29
diff --git a/acceptance/tests/direct_puppet/supports_utf8.rb b/acceptance/tests/direct_puppet/supports_utf8.rb index <HASH>..<HASH> 100644 --- a/acceptance/tests/direct_puppet/supports_utf8.rb +++ b/acceptance/tests/direct_puppet/supports_utf8.rb @@ -1,6 +1,10 @@ test_name "C97172: static catalogs support utf8" do -require 'puppet/acceptance/environment_utils' -extend Puppet::Acceptance::EnvironmentUtils + + confine :except, :platform => /^cisco_/ # skip the test because some of the machines have LANG=C as the default and we break + confine :except, :platform => /^solaris/ # skip the test because some of the machines have LANG=C as the default and we break + + require 'puppet/acceptance/environment_utils' + extend Puppet::Acceptance::EnvironmentUtils app_type = File.basename(__FILE__, '.*') tmp_environment = mk_tmp_environment_with_teardown(master, app_type)
(PUP-<I>) skip test supports_utf8.rb on cisco and solaris Skip the test direct_puppet/supports_utf8.rb on cisco and solaris machines where the LANG=C is set and we fail due to mixed encoding issues
puppetlabs_puppet
train
rb
337666abedc56719b9b6932a7608c3f157e78842
diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php index <HASH>..<HASH> 100644 --- a/tests/ContainerTest.php +++ b/tests/ContainerTest.php @@ -103,6 +103,24 @@ class ContainerTest extends \PHPUnit_Framework_TestCase } /** + * Asserts that fetching a shared item always returns the same item. + */ + public function testGetSharedItemReturnsTheSameItem() + { + $alias = 'foo'; + + $container = new Container; + + $container->share($alias, function () { + return new \stdClass; + }); + + $item = $container->get($alias); + + $this->assertSame($item, $container->get($alias)); + } + + /** * @param array $items * @return \PHPUnit_Framework_MockObject_MockObject|ImmutableContainerInterface */
Enhancement: Assert that items can be shared
thephpleague_container
train
php
77cc0ce064af6b1c4d4f41c9c175ca20e2724112
diff --git a/features/step_definitions/setup_steps.rb b/features/step_definitions/setup_steps.rb index <HASH>..<HASH> 100644 --- a/features/step_definitions/setup_steps.rb +++ b/features/step_definitions/setup_steps.rb @@ -132,6 +132,5 @@ end Given /^the application has a session timeout of (\d+) seconds$/ do |timeout| Bcsec.configuration.add_parameters_for(:policy, %s(session-timeout) => timeout) - stop_spawned_servers - start_main_rack_server(app) + restart_spawned_servers end diff --git a/features/support/env.rb b/features/support/env.rb index <HASH>..<HASH> 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -128,8 +128,12 @@ module Bcsec::Cucumber $stderr.puts "Stopping server pid=#{server.pid} port=#{server.port} failed: #{m}" end end + end + + def restart_spawned_servers + stop_spawned_servers - spawned_servers.clear + spawned_servers.each { |server| server.start } end def app_url(url)
When updating bcsec configuration, restart all spawned servers. #<I>. The CAS scenarios spin up multiple servers (application, CAS server, and proxy callback). It's true that the application server is the only one that requires a restart, but for now it's more convenient to just restart them all. Should a server end up being quite slow to start up then we'll revisit this.
NUBIC_aker
train
rb,rb
fd3a7a94ebd0fb8d7c6cd51132b7c784a6b62570
diff --git a/lib/ditty/cli.rb b/lib/ditty/cli.rb index <HASH>..<HASH> 100644 --- a/lib/ditty/cli.rb +++ b/lib/ditty/cli.rb @@ -47,7 +47,7 @@ module Ditty desc 'migrate', 'Run the Ditty migrations' def migrate # Prep Ditty - Rake::Task['ditty:prep'].invoke + Rake::Task['ditty:prep:migrations'].invoke # Run the migrations Rake::Task['ditty:migrate:up'].invoke
fix: Only prep migrations when running migrations
EagerELK_ditty
train
rb
8fa82dfcc111b61501c964bd73b65f84e6e14d48
diff --git a/lib/curator/riak/data_store.rb b/lib/curator/riak/data_store.rb index <HASH>..<HASH> 100644 --- a/lib/curator/riak/data_store.rb +++ b/lib/curator/riak/data_store.rb @@ -32,7 +32,7 @@ module Curator object.content_type = options.fetch(:content_type, "application/json") object.data = options[:value] options.fetch(:index, {}).each do |index_name, index_data| - object.indexes["#{index_name}_bin"] << _normalized_index_data(index_data) + object.indexes["#{index_name}_bin"].merge(Array(index_data)) end result = object.store result.key @@ -83,14 +83,6 @@ module Curator def _find_key_by_index(bucket, index_name, query) bucket.get_index("#{index_name}_bin", query) end - - def _normalized_index_data(index_data) - if index_data.is_a?(Array) - index_data.join(", ") - else - index_data - end - end end end end
Update the way that Riak::DataStore normalizes indexes to be compatible with updated Riak client and protobufs.
braintree_curator
train
rb
20c9967d7d20902311f0e0b2a67da31406f9c34b
diff --git a/src/js/create-world.js b/src/js/create-world.js index <HASH>..<HASH> 100644 --- a/src/js/create-world.js +++ b/src/js/create-world.js @@ -55,15 +55,6 @@ module.exports = function(options) { var fixturesDebug = require('debug')('fixtures'); - if (options.debug) { - this.browser.on("response", function(request, response) { - request.body = request.body ? request.body.toString() : undefined; - response.body = response.body ? response.body.toString() : undefined; - - that.debug.requests(request); - that.debug.requests(response); - }); - } this.browser.on("opened", function(window) { // make Raphael run in zombie without quitting silently
remove that responses will be converted from buffer to string automatically (this has side effects, when binary is queried)
webforge-labs_cuked-zombie
train
js
1456b9ec559e23d489730b5bec4911cffdd27d15
diff --git a/pycbc/distributions/boundaries.py b/pycbc/distributions/boundaries.py index <HASH>..<HASH> 100644 --- a/pycbc/distributions/boundaries.py +++ b/pycbc/distributions/boundaries.py @@ -318,6 +318,11 @@ class Bounds(object): else: self._reflect = _pass + def __repr__(self): + return str(self.__class__)[:-1] + " " + " ".join( + map(str, ["min", self._min, "max", self._max, + "cyclic", self._cyclic])) + ">" + @property def min(self): return self._min
Add a __repr__ to Bounds. (#<I>) * Add a __repr__ to Bounds. * Include class name.w
gwastro_pycbc
train
py
ad51c7d37213e6618d5f73d40b6c28b5967c68e8
diff --git a/lib/util/search.js b/lib/util/search.js index <HASH>..<HASH> 100644 --- a/lib/util/search.js +++ b/lib/util/search.js @@ -11,7 +11,6 @@ this.lastPos = null; this.query = this.replacing = null; this.marked = []; } function getSearchState(cm) { - if (!cm) debugger; return cm._searchState || (cm._searchState = new SearchState()); } function dialog(cm, text, shortText, f) {
Remove debugger statement in search.js It was confusing the compressor.
codemirror_CodeMirror
train
js
7fb345a3f81ebc180a7c079200fd8b15ea564f65
diff --git a/consul/datadog_checks/consul/consul.py b/consul/datadog_checks/consul/consul.py index <HASH>..<HASH> 100644 --- a/consul/datadog_checks/consul/consul.py +++ b/consul/datadog_checks/consul/consul.py @@ -1,6 +1,8 @@ # (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) +from __future__ import division + from collections import defaultdict from datetime import datetime, timedelta from itertools import islice @@ -460,7 +462,7 @@ class ConsulCheck(AgentCheck): tags = main_tags + ['source_datacenter:{}'.format(name), 'dest_datacenter:{}'.format(other_name)] n = len(latencies) - half_n = int(n // 2) + half_n = n // 2 if n % 2: median = latencies[half_n] else: @@ -487,7 +489,7 @@ class ConsulCheck(AgentCheck): latencies.append(distance(node, other)) latencies.sort() n = len(latencies) - half_n = int(n // 2) + half_n = n // 2 if n % 2: median = latencies[half_n] else:
Finish supporting Py3 (#<I>)
DataDog_integrations-core
train
py
c169fec4a8cfe5a1dd4334247480096c583b6619
diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js index <HASH>..<HASH> 100644 --- a/src/ol/renderer/Map.js +++ b/src/ol/renderer/Map.js @@ -9,7 +9,7 @@ import {getWidth} from '../extent.js'; import {TRUE} from '../functions.js'; import {visibleAtResolution} from '../layer/Layer.js'; import {shared as iconImageCache} from '../style/IconImageCache.js'; -import {compose as composeTransform, invert as invertTransform, setFromArray as transformSetFromArray} from '../transform.js'; +import {compose as composeTransform, makeInverse} from '../transform.js'; /** * @abstract @@ -66,8 +66,7 @@ class MapRenderer extends Disposable { -viewState.rotation, -viewState.center[0], -viewState.center[1]); - invertTransform( - transformSetFromArray(pixelToCoordinateTransform, coordinateToPixelTransform)); + makeInverse(coordinateToPixelTransform, pixelToCoordinateTransform); } /**
Invert and set transform in one step
openlayers_openlayers
train
js
1d4529df8d7eb23ccddb69c5984a4e02b2cd5c92
diff --git a/js/kraken.js b/js/kraken.js index <HASH>..<HASH> 100644 --- a/js/kraken.js +++ b/js/kraken.js @@ -761,7 +761,6 @@ module.exports = class kraken extends Exchange { let request = { 'asset': currency['id'], 'method': method, - 'new': 'false', }; let response = await this.privatePostDepositAddresses (this.extend (request, params)); let result = response['result'];
kraken fetchDepositAddress generating too many new addresses fix #<I>
ccxt_ccxt
train
js
45b08628b7f9ef83d30bab15bcc77f020aaf3b97
diff --git a/scanpy/plotting/_tools/scatterplots.py b/scanpy/plotting/_tools/scatterplots.py index <HASH>..<HASH> 100644 --- a/scanpy/plotting/_tools/scatterplots.py +++ b/scanpy/plotting/_tools/scatterplots.py @@ -995,11 +995,10 @@ def _get_color_source_vector( Get array from adata that colors will be based on. """ if value_to_plot is None: - # TODO: Let null color be handled with missing_color - # values = np.empty(adata.shape[0], dtype=float) - # values.fill(np.nan) - # return values - return "lightgray" + # Points will be plotted with `missing_color`. Ideally this would return an + # array of np.nan, but that throws a warning. _color_vector handles this. + # https://github.com/matplotlib/matplotlib/issues/18294 + return None if ( gene_symbols is not None and value_to_plot not in adata.obs.columns @@ -1032,6 +1031,8 @@ def _color_vector( # the data is either categorical or continuous and the data could be in # 'obs' or in 'var' to_hex = partial(colors.to_hex, keep_alpha=True) + if values is None: + return np.broadcast_to(to_hex(missing_color), adata.n_obs), False if not is_categorical_dtype(values): return values, False else: # is_categorical_dtype(values)
scatterplots: Have missing color be used when color=None
theislab_scanpy
train
py
1e823f6565020755565bd9130ada27498440aa4c
diff --git a/spec/repository_spec.rb b/spec/repository_spec.rb index <HASH>..<HASH> 100644 --- a/spec/repository_spec.rb +++ b/spec/repository_spec.rb @@ -7,7 +7,7 @@ require 'ronin/repository' describe Repository do include Helpers::Repositories - subject { Repository } + subject { described_class } describe "find" do it "should be able to retrieve an Repository by name" do
Use described_class in the specs.
ronin-ruby_ronin
train
rb
571b478b2da0278fe151ec8cd4b64b8f6935e546
diff --git a/saltpylint/fileperms.py b/saltpylint/fileperms.py index <HASH>..<HASH> 100644 --- a/saltpylint/fileperms.py +++ b/saltpylint/fileperms.py @@ -83,7 +83,7 @@ class FilePermsChecker(BaseChecker): module_perms = str(module_perms) if len(desired_perm) == 1: - if module_perms != desired_perm: + if module_perms != desired_perm[0]: self.add_message('E0599', line=1, args=(desired_perm[0], module_perms)) else: if module_perms < desired_perm[0] or module_perms > desired_perm[1]:
Don't compare against a list
saltstack_salt-pylint
train
py
f270deca3a1f64124b9c1aad4e925535be0b01be
diff --git a/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java b/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java index <HASH>..<HASH> 100644 --- a/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java +++ b/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java @@ -268,7 +268,7 @@ public class QueryableStateClient { final String queryableStateName, final int keyHashCode, final byte[] serializedKeyAndNamespace) { - LOG.info("Sending State Request to {}.", remoteAddress); + LOG.debug("Sending State Request to {}.", remoteAddress); try { KvStateRequest request = new KvStateRequest(jobId, queryableStateName, keyHashCode, serializedKeyAndNamespace); return client.sendRequest(remoteAddress, request);
[FLINK-<I>] [QS] Reduce log level in getKvState to DEBUG. This closes #<I>.
apache_flink
train
java
f2952f22d599597937a88761142d825cbe9dbb02
diff --git a/library/Controller/BaseController.php b/library/Controller/BaseController.php index <HASH>..<HASH> 100644 --- a/library/Controller/BaseController.php +++ b/library/Controller/BaseController.php @@ -17,10 +17,19 @@ class BaseController $this->getFooterLayout(); $this->getNavigationMenus(); $this->getHelperVariables(); + $this->getFilterData(); $this->init(); } + public function getFitlerData() + { + $this->data = array_merge( + $this->data, + apply_filters('Municipio/controller/base/view_data', array()); + ); + } + public function getHelperVariables() { $this->data['hasRightSidebar'] = get_field('right_sidebar_always', 'option') || is_active_sidebar('right-sidebar');
Allow pushing data to baseController with filter
helsingborg-stad_Municipio
train
php
d2f9eb1a5fe550e3b07768e838c7992a22b31fce
diff --git a/src/Model/Backup.php b/src/Model/Backup.php index <HASH>..<HASH> 100644 --- a/src/Model/Backup.php +++ b/src/Model/Backup.php @@ -8,9 +8,9 @@ namespace Platformsh\Client\Model; * @property-read string $id The backup name/ID. * @property-read string $status The status of the backup. * @property-read int $index The index of this automated backup. - * @property-read string $commit_id The code commit ID attached to this - * backup. + * @property-read string $commit_id The code commit ID attached to this backup. * @property-read string $environment The environment the backup belongs to. + * @property-read bool $restorable Whether the backup is restorable. * @property-read string $created_at * @property-read string $updated_at * @property-read string $expires_at
Document backup "restorable" property
platformsh_platformsh-client-php
train
php
67b9a80bcfbc7322f8a5d2f2c7f510b8351b4c6a
diff --git a/cake/libs/multibyte.php b/cake/libs/multibyte.php index <HASH>..<HASH> 100644 --- a/cake/libs/multibyte.php +++ b/cake/libs/multibyte.php @@ -966,6 +966,7 @@ class Multibyte extends Object { } $string = array_values($string); + $value = array(); for ($i = 0; $i < $length; $i++) { $value[] = $string[$i]; }
Fix simple problem with substr where warning was being thrown git-svn-id: <URL>
cakephp_cakephp
train
php
5fecdf84053ca1083cd16d54a58d64191c938ae4
diff --git a/{{cookiecutter.repo_name}}/config/wsgi.py b/{{cookiecutter.repo_name}}/config/wsgi.py index <HASH>..<HASH> 100644 --- a/{{cookiecutter.repo_name}}/config/wsgi.py +++ b/{{cookiecutter.repo_name}}/config/wsgi.py @@ -20,7 +20,10 @@ from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise {%- endif %} {% if cookiecutter.use_sentry == "y" -%} -from raven.contrib.django.raven_compat.middleware.wsgi import Sentry +if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production": + from raven.contrib.django.raven_compat.middleware.wsgi import Sentry +else: + pass {%- endif %} # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks @@ -40,7 +43,10 @@ application = get_wsgi_application() application = DjangoWhiteNoise(application) {%- endif %} {% if cookiecutter.use_sentry == "y" -%} -application = Sentry(application) +if os.environ.get("DJANGO_SETTINGS_MODULE") == "config.settings.production": + application = Sentry(application) +else: + pass {%- endif %} # Apply WSGI middleware here.
Fix for wsgi.py for Raven in dev
pydanny_cookiecutter-django
train
py
c7a59b239f67b990c7235f0fd3a1eca0046d954d
diff --git a/python/ray/serve/controller.py b/python/ray/serve/controller.py index <HASH>..<HASH> 100644 --- a/python/ray/serve/controller.py +++ b/python/ray/serve/controller.py @@ -154,7 +154,6 @@ class ActorStateReconciler: backend_replicas_to_stop: Dict[BackendTag, List[ReplicaTag]] = field( default_factory=lambda: defaultdict(list)) backends_to_remove: List[BackendTag] = field(default_factory=list) - endpoints_to_remove: List[EndpointTag] = field(default_factory=list) # TODO(edoakes): consider removing this and just using the names. @@ -833,8 +832,6 @@ class ServeController: if endpoint in self.current_state.traffic_policies: del self.current_state.traffic_policies[endpoint] - self.actor_reconciler.endpoints_to_remove.append(endpoint) - return_uuid = self._create_event_with_result({ route_to_delete: None, endpoint: None
Remove unused endpoints_to_remove (#<I>)
ray-project_ray
train
py
9e1a2fbe2d708e980fbd02c338385461727e0803
diff --git a/src/main/java/net/dv8tion/jda/managers/GuildManager.java b/src/main/java/net/dv8tion/jda/managers/GuildManager.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/dv8tion/jda/managers/GuildManager.java +++ b/src/main/java/net/dv8tion/jda/managers/GuildManager.java @@ -266,7 +266,7 @@ public class GuildManager * @return * unmodifiable list of currently banned Users */ - List<User> getBans() + public List<User> getBans() { List<User> bans = new LinkedList<>(); JSONArray bannedArr = ((JDAImpl) guild.getJDA()).getRequester().getA("https://discordapp.com/api/guilds/" + guild.getId() + "/bans");
made GuildManager#getBans() public
DV8FromTheWorld_JDA
train
java
dc7cde887ae6c749ff2dd515b2b18fe2f24fdad1
diff --git a/index.js b/index.js index <HASH>..<HASH> 100755 --- a/index.js +++ b/index.js @@ -119,7 +119,7 @@ function serveError(requestUrl, response, entryResponse, localPath) { function serveHeaders(response, entryResponse) { // Not really a header, but... - response.statusCode = entryResponse.status; + response.statusCode = (entryResponse.status === 304) ? 200 : entryResponse.status; for (var h = 0; h < entryResponse.headers.length; h++) { var name = entryResponse.headers[h].name;
Return status <I> when entry status is <I> If <I> is set as status then no data can be returned in the request.
Stuk_server-replay
train
js
8766147067a4db0fe2c4a5cce9d21240a0bd9fd6
diff --git a/indra/tests/test_mesh.py b/indra/tests/test_mesh.py index <HASH>..<HASH> 100644 --- a/indra/tests/test_mesh.py +++ b/indra/tests/test_mesh.py @@ -63,3 +63,15 @@ def test_mesh_term_name_norm(): assert mesh_name == 'Cellular Senescence' +def test_mesh_term_lookups(): + queries = {'Breast Cancer': ('D001943', 'Breast Neoplasms'), + 'Neoplasms': ('D009369', 'Neoplasms'), + 'Colorectal Cancer': ('D015179', 'Colorectal Neoplasms'), + 'Intestinal Neoplasms': ('D007414', 'Intestinal Neoplasms'), + 'Carcinoma, Non-Small-Cell Lung': + ('D002289', 'Carcinoma, Non-Small-Cell Lung'), + 'Prostate Cancer': ('D011471', 'Prostatic Neoplasms')} + for query_term, (correct_id, correct_name) in queries.items(): + mesh_id, mesh_name = mesh_client.get_mesh_id_name(query_term) + assert mesh_id == correct_id + assert mesh_name == correct_name
Additional tests using medscan terms
sorgerlab_indra
train
py
22eefb8f612b6b1efcd6544ea44e0d4d5e7d953c
diff --git a/libraries/joomla/mail/mail.php b/libraries/joomla/mail/mail.php index <HASH>..<HASH> 100644 --- a/libraries/joomla/mail/mail.php +++ b/libraries/joomla/mail/mail.php @@ -193,16 +193,19 @@ class JMail extends PHPMailer // If the recipient is an array, add each recipient... otherwise just add the one if (is_array($recipient)) { - if (is_array($name)){ + if (is_array($name)) + { $combined = array_combine($recipient, $name); - foreach ($combined as $recipientEmail=>$recipientName) + foreach ($combined as $recipientEmail => $recipientName) { $recipientEmail = JMailHelper::cleanLine($recipientEmail); $recipientName = JMailHelper::cleanLine($recipientName); - $this->AddAddress($recipientEmail,$recipientName); + $this->AddAddress($recipientEmail, $recipientName); } - }else{ - $name = JMailHelper::cleanLine($name); + } + else + { + $name = JMailHelper::cleanLine($name); foreach ($recipient as $to) { $to = JMailHelper::cleanLine($to);
Fixing up code styling from #<I>.
joomla_joomla-framework
train
php
20921f4bca90b408257f4c3614b4bdcd330fd83b
diff --git a/rapidoid-http-server/src/main/java/org/rapidoid/setup/App.java b/rapidoid-http-server/src/main/java/org/rapidoid/setup/App.java index <HASH>..<HASH> 100644 --- a/rapidoid-http-server/src/main/java/org/rapidoid/setup/App.java +++ b/rapidoid-http-server/src/main/java/org/rapidoid/setup/App.java @@ -289,11 +289,11 @@ public class App extends RapidoidThing { } private static void processProxyArg(String arg) { - String[] parts = arg.split("->"); + String[] parts = arg.split("\\s*->\\s*"); U.must(parts.length == 2, "Expected /uri->target proxy mapping!"); - Reverse.proxy().map(parts[0]).to(parts[1].split("\\,")); + Reverse.proxy().map(parts[0]).to(parts[1].split("\\s*\\,\\s*")); } static void filterAndInvokeMainClasses(Object[] beans) {
Allowing white-spaces in the proxy configuration entries.
rapidoid_rapidoid
train
java
878ff98c3981e98293933ee1c208169efdcb0237
diff --git a/src/Http/FormRequest.php b/src/Http/FormRequest.php index <HASH>..<HASH> 100644 --- a/src/Http/FormRequest.php +++ b/src/Http/FormRequest.php @@ -18,7 +18,9 @@ class FormRequest extends IlluminateFormRequest */ protected function failedValidation(Validator $validator) { - if ($this->container['request'] instanceof Request) { + if ($this->container['request'] instanceof InternalRequest) { + // Do nothing and pass thru to the parent + } elseif ($this->container['request'] instanceof Request) { throw new ValidationHttpException($validator->errors()); }
Allow validation to pass through on Internal Requests (#<I>) * Allow validation to pass through on Internal Requests * Fix StyleCI issue (oops)
laravie_api
train
php
4ba24d0a127fdd5e715b023fa6ba46909587edee
diff --git a/lib/oar/scripting/script.rb b/lib/oar/scripting/script.rb index <HASH>..<HASH> 100644 --- a/lib/oar/scripting/script.rb +++ b/lib/oar/scripting/script.rb @@ -29,16 +29,23 @@ class OAR::Scripting::Script end # def:: self.load_scripts def self.getargs - job = { :id => ARGV[0], - :user => ARGV[1], - :nodesfile => ARGV[2] } + job = { :id => ARGV[0] } + unless ARGV[1].empty? or ARGV[2].empty? + job[:user] = ARGV[1] + job[:nodesfile] = ARGV[2] + else + job[:user] = self.oarstat[:job_user] + job[:nodesfile] = "/var/lib/oar/#{job[:id]}" + end begin File.open(job[:nodesfile]).each { |line| @@resources << line.chomp } rescue - # let @@resources empty + # get data from oarstat + job[:resources_count] = self.oarstat[:assigned_resources].length + job[:host_count] = self.oarstat[:assigned_network_address].length end - job[:resources_count] = @@resources.length - job[:host_count] = @@resources.uniq.length + job[:resources_count] ||= @@resources.length + job[:host_count] ||= @@resources.uniq.length job end # def:: getargs
Use oarstat when pro/epilogues are not called with enough arguments (like server pro/epilogues)
pmorillon_oar-scripting
train
rb
f572595b767abbe60ff4deef29fc43236e445991
diff --git a/dist/pelias-leaflet-geocoder.js b/dist/pelias-leaflet-geocoder.js index <HASH>..<HASH> 100644 --- a/dist/pelias-leaflet-geocoder.js +++ b/dist/pelias-leaflet-geocoder.js @@ -247,7 +247,7 @@ resultItem.coords = feature.geometry.coordinates; var iconSrc = this.getIconType(feature.properties.layer); - if (this.options.markers && iconSrc) { + if (iconSrc) { // Point or polygon icon var layerIconContainer = L.DomUtil.create('span', 'leaflet-pelias-layer-icon-container', resultItem); var layerIcon = L.DomUtil.create('img', 'leaflet-pelias-layer-icon', layerIconContainer);
Remove test for marker option when checking icon image source
pelias_leaflet-plugin
train
js
5cfaef9ff9b121850f1e27afae6819023acadbf7
diff --git a/src/event/eventTest.js b/src/event/eventTest.js index <HASH>..<HASH> 100644 --- a/src/event/eventTest.js +++ b/src/event/eventTest.js @@ -7,8 +7,8 @@ test("toggle(Function, Function) - add toggle event and fake a few clicks", func fn2 = function(e) { count--; }, preventDefault = function(e) { e.preventDefault() }, link = $('#mark'); - if($.browser.msie) - ok( false, "click() on link gets executed in IE, not intended behaviour!" ); + if($.browser.msie || $.browser.opera) + ok( false, "click() on link gets executed in IE/Opera, not intended behaviour!" ); else link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click(); ok( count == 1, "Check for toggle(fn, fn)" );
Exclude Opera from toggle test, too (#<I>)
jquery_jquery
train
js
32c9954a7a392a97172eec0555ad6e43608b9365
diff --git a/core/src/main/java/org/hibernate/ogm/transaction/emulated/impl/EmulatedLocalTransactionCoordinatorBuilder.java b/core/src/main/java/org/hibernate/ogm/transaction/emulated/impl/EmulatedLocalTransactionCoordinatorBuilder.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/hibernate/ogm/transaction/emulated/impl/EmulatedLocalTransactionCoordinatorBuilder.java +++ b/core/src/main/java/org/hibernate/ogm/transaction/emulated/impl/EmulatedLocalTransactionCoordinatorBuilder.java @@ -86,7 +86,7 @@ public class EmulatedLocalTransactionCoordinatorBuilder implements TransactionCo @Override public void rollback() { - status = TransactionStatus.NOT_ACTIVE; + status = TransactionStatus.ROLLED_BACK; } @Override
OGM-<I> On rollback NoopJdbcResourceTransaction has to return TransactionStatus.ROLLED_BACK I think it's fine to use ROLLED_BACK in this case. There are some expectations around it and if the status is different the rollback is tried again causing events to get caught twice (and some of our tests fail).
hibernate_hibernate-ogm
train
java
20e238d1c9df4175c115b3f97e8c561459a36d4c
diff --git a/core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java b/core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java +++ b/core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java @@ -68,13 +68,15 @@ public class InternalCacheRegistryImpl implements InternalCacheRegistry { } if (flags.contains(Flag.PERSISTENT)) { if (globalConfiguration.globalState().enabled()) { - builder.persistence().addSingleFileStore() - .location(globalConfiguration.globalState().persistentLocation()) - // Internal caches don't need to be segmented - .segmented(false) - .purgeOnStartup(false) - .preload(true) - .fetchPersistentState(true); + builder.persistence() + .availabilityInterval(-1) + .addSingleFileStore() + .location(globalConfiguration.globalState().persistentLocation()) + // Internal caches don't need to be segmented + .segmented(false) + .purgeOnStartup(false) + .preload(true) + .fetchPersistentState(true); } else { CONFIG.warnUnableToPersistInternalCaches(); }
ISPN-<I> Internal Caches with persistence don't need availability checks
infinispan_infinispan
train
java
cf499da7ae9c18e01ff0c50eeb9b0e601d8e269f
diff --git a/packages/chrysalis-keymap/src/lib/chrysalis-keymap.js b/packages/chrysalis-keymap/src/lib/chrysalis-keymap.js index <HASH>..<HASH> 100644 --- a/packages/chrysalis-keymap/src/lib/chrysalis-keymap.js +++ b/packages/chrysalis-keymap/src/lib/chrysalis-keymap.js @@ -62,16 +62,16 @@ export default class Keymap { focus(s, keymap) { if (keymap && keymap.length > 0) { - let flatten = (arr) => { - return [].concat(...arr) - }, - t = this._keyTransformers.slice().reverse() + let t = this._keyTransformers.slice().reverse(), + flatten = (arr) => { + return [].concat(...arr) + }, + args = flatten(keymap).map(k => this._serializeKey(t, k)) return new Promise((resolve) => { - s.request("keymap.map", - flatten(keymap).map(k => this._serializeKey(t, k))).then((data) => { - resolve(data) - }) + s.request("keymap.map", ...args).then((data) => { + resolve(data) + }) }) } else { return new Promise((resolve) => {
Fix some formatting mistakes, to make eslint happy
keyboardio_chrysalis-api
train
js