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 |
|---|---|---|---|---|---|
42b4a1cc55ed890a465e824d18493b7cad46c5b5 | diff --git a/h2o-core/src/main/java/water/util/Log.java b/h2o-core/src/main/java/water/util/Log.java
index <HASH>..<HASH> 100644
--- a/h2o-core/src/main/java/water/util/Log.java
+++ b/h2o-core/src/main/java/water/util/Log.java
@@ -293,5 +293,14 @@ abstract public class Log {
if( strb.length() < size ) strb.append(' ');
return strb.toString();
}
-
+
+ public static void ignore(Throwable e) {
+ ignore(e,"[h2o] Problem ignored: ");
+ }
+ public static void ignore(Throwable e, String msg) {
+ ignore(e, msg, true);
+ }
+ public static void ignore(Throwable e, String msg, boolean printException) {
+ debug(msg + (printException? e.toString() : ""));
+ }
} | Tiny log functions marking ignored exceptions.
Useful for retry-logic inside HDFS/S3 persist API. | h2oai_h2o-3 | train | java |
d8f22c67d57ea5794fe510bab264a2ed905b00e5 | diff --git a/esda/getisord.py b/esda/getisord.py
index <HASH>..<HASH> 100644
--- a/esda/getisord.py
+++ b/esda/getisord.py
@@ -4,7 +4,7 @@ Getis and Ord G statistic for spatial autocorrelation
__author__ = "Sergio J. Rey <srey@asu.edu>, Myunghwa Hwang <mhwang4@gmail.com> "
__all__ = ['G', 'G_Local']
-from libpysal.common import np, stats, math
+from libpysal.common import np, stats
from libpysal.weights.spatial_lag import lag_spatial as slag
from .tabular import _univariate_handler
@@ -106,7 +106,7 @@ class G(object):
y = y.reshape(len(y), 1) # Ensure that y is an n by 1 vector, otherwise y*y.T == y*y
self.den_sum = (y * y.T).sum() - (y * y).sum()
self.G = self.__calc(self.y)
- self.z_norm = (self.G - self.EG) / math.sqrt(self.VG)
+ self.z_norm = (self.G - self.EG) / np.sqrt(self.VG)
self.p_norm = 1.0 - stats.norm.cdf(np.abs(self.z_norm))
if permutations: | remove math and swap to numpy | pysal_esda | train | py |
a60f4939699be67e883a0cf411dac0fb98355c1d | diff --git a/cmd/auth.go b/cmd/auth.go
index <HASH>..<HASH> 100644
--- a/cmd/auth.go
+++ b/cmd/auth.go
@@ -241,15 +241,14 @@ func (c *teamCreate) Run(context *Context, client *Client) error {
return nil
}
-type teamRemove struct{}
+type teamRemove struct {
+ ConfirmationCommand
+}
func (c *teamRemove) Run(context *Context, client *Client) error {
team := context.Args[0]
- var answer string
- fmt.Fprintf(context.Stdout, `Are you sure you want to remove team "%s"? (y/n) `, team)
- fmt.Fscanf(context.Stdin, "%s", &answer)
- if answer != "y" {
- fmt.Fprintln(context.Stdout, "Abort.")
+ question := fmt.Sprintf("Are you sure you want to remove team %q?", team)
+ if !c.Confirm(context, question) {
return nil
}
url, err := GetURL(fmt.Sprintf("/teams/%s", team)) | cmd: use ConfirmationCommand in teamRemove | tsuru_tsuru | train | go |
65e85c5647072d29effb695d7770ed6d1882e459 | diff --git a/commons/src/main/java/com/composum/sling/core/logging/MessageContainer.java b/commons/src/main/java/com/composum/sling/core/logging/MessageContainer.java
index <HASH>..<HASH> 100644
--- a/commons/src/main/java/com/composum/sling/core/logging/MessageContainer.java
+++ b/commons/src/main/java/com/composum/sling/core/logging/MessageContainer.java
@@ -101,12 +101,21 @@ public class MessageContainer implements Iterable<Message> {
/**
* Adds a message to the container, and logs it into the logger if one was specified for this container.
+ * Like in SLF4J, if the last argument is a Throwable we use it for logging with {@link #add(Message, Throwable)}.
*
* @return this MessageContainer, for builder-style operation chaining.
*/
@Nonnull
public MessageContainer add(@Nullable Message message) {
- return add(message, null);
+ Throwable throwable = null;
+ List<Object> args = message.getArguments();
+ if (args != null && !args.isEmpty()) {
+ Object lastarg = args.get(args.size() - 1);
+ if (lastarg instanceof Throwable) {
+ throwable = (Throwable) lastarg;
+ }
+ }
+ return add(message, throwable);
}
/** | Status: ensure that throwable given to error as last argument is logged with stacktrace | ist-dresden_composum | train | java |
adb4f98cf8c35aa974bf639ae626f13912cb738d | diff --git a/osmnx/stats.py b/osmnx/stats.py
index <HASH>..<HASH> 100644
--- a/osmnx/stats.py
+++ b/osmnx/stats.py
@@ -418,8 +418,9 @@ def extended_stats(G, connectivity=False, anc=False, ecc=False, bc=False, cc=Fal
if bc:
# betweenness centrality of a node is the sum of the fraction of
# all-pairs shortest paths that pass through node
+ # networkx 2.4+ implementation cannot run on Multi(Di)Graphs, so use DiGraph
start_time = time.time()
- betweenness_centrality = nx.betweenness_centrality(G, weight='length')
+ betweenness_centrality = nx.betweenness_centrality(G_dir, weight='length')
stats['betweenness_centrality'] = betweenness_centrality
stats['betweenness_centrality_avg'] = sum(betweenness_centrality.values())/len(betweenness_centrality)
log('Calculated betweenness centrality in {:,.2f} seconds'.format(time.time() - start_time)) | convert to DiGraph for betweenness centrality calculation | gboeing_osmnx | train | py |
f19982803b3067ca3a7ac705c31b75e64825ddd9 | diff --git a/warren/main.py b/warren/main.py
index <HASH>..<HASH> 100644
--- a/warren/main.py
+++ b/warren/main.py
@@ -72,9 +72,6 @@ class RabbitMQCtl(object):
local_node = self._trim_quotes(match.group(1))
else:
raise Exception('Unexpected header line: {0!r}'.format(output[0]))
- match = re.match('^...done', output[-1])
- if not match:
- raise Exception('Unexpected footer line: {0!r}'.format(output[-1]))
cluster_info = ''.join(output[1:-1])
match = re.search(r'{nodes,\[((?:{.*?\[.*?\]},?)+)\]}', cluster_info)
if not match: | Remove unnecessary get_cluster_status lines
These lines do not exist in newer version of rabbitmq-server and aren't
necessary for the function to execute safely. | RSEmail_warren | train | py |
fbb2886168f593ba69f15bd27bbc6f0e78b87ed6 | diff --git a/src/Offer/OfferIdentifierCollection.php b/src/Offer/OfferIdentifierCollection.php
index <HASH>..<HASH> 100644
--- a/src/Offer/OfferIdentifierCollection.php
+++ b/src/Offer/OfferIdentifierCollection.php
@@ -5,6 +5,7 @@ namespace CultuurNet\UDB3\Offer;
use TwoDotsTwice\Collection\AbstractCollection;
/**
+ * @method OfferIdentifierCollection with($item)
* @method OfferIdentifierInterface[] toArray()
*/
class OfferIdentifierCollection extends AbstractCollection | III-<I>: Docblock for better type hinting. | cultuurnet_udb3-php | train | php |
9f8e89bb97d6981b64c4e761e265550f8a615b01 | diff --git a/Controller/ConnectController.php b/Controller/ConnectController.php
index <HASH>..<HASH> 100644
--- a/Controller/ConnectController.php
+++ b/Controller/ConnectController.php
@@ -271,7 +271,8 @@ class ConnectController extends Controller
}
}
- return $this->redirect($authorizationUrl);
+ $this->redirect($authorizationUrl)->sendHeaders();
+ return new RedirectResponse($authorizationUrl);
}
/** | redirectToServiceAction is not redirecting (SF2 <I>)
redirectToServiceAction is not redirect, in order to work I have done this change. | hwi_HWIOAuthBundle | train | php |
e144f098f154352d92a593733ca3294467d98a84 | diff --git a/actionview/lib/action_view/testing/resolvers.rb b/actionview/lib/action_view/testing/resolvers.rb
index <HASH>..<HASH> 100644
--- a/actionview/lib/action_view/testing/resolvers.rb
+++ b/actionview/lib/action_view/testing/resolvers.rb
@@ -36,10 +36,11 @@ module ActionView #:nodoc:
end
end
- class NullResolver < PathResolver
- def query(path, exts, _, locals, cache:)
- handler, format, variant = extract_handler_and_format_and_variant(path)
- [ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, virtual_path: path.virtual, format: format, variant: variant, locals: locals)]
+ class NullResolver < Resolver
+ def find_templates(name, prefix, partial, details, locals = [])
+ path = Path.build(name, prefix, partial)
+ handler = ActionView::Template::Handlers::Raw
+ [ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, virtual_path: path.virtual, format: nil, variant: nil, locals: locals)]
end
end
end | Reimplement NullResolver on base resolver | rails_rails | train | rb |
4f14f775884796994b840e25570c47fdccdcfd21 | diff --git a/lib/opal/lexer.rb b/lib/opal/lexer.rb
index <HASH>..<HASH> 100644
--- a/lib/opal/lexer.rb
+++ b/lib/opal/lexer.rb
@@ -1371,6 +1371,7 @@ module Opal
return :SUPER, matched
when 'then'
+ @lex_state = :expr_beg
return :THEN, matched
when 'while' | Fix lex_state after 'then' keyword | opal_opal | train | rb |
e4c67f15027163d2168c6299f1a13a8b9c7c5361 | diff --git a/ghost/admin/components/gh-navitem-url-input.js b/ghost/admin/components/gh-navitem-url-input.js
index <HASH>..<HASH> 100644
--- a/ghost/admin/components/gh-navitem-url-input.js
+++ b/ghost/admin/components/gh-navitem-url-input.js
@@ -27,13 +27,13 @@ var NavItemUrlInputComponent = Ember.TextField.extend({
var url = this.get('url'),
baseUrl = this.get('baseUrl');
+ this.set('value', url);
+
// if we have a relative url, create the absolute url to be displayed in the input
if (this.get('isRelative')) {
url = joinUrlParts(baseUrl, url);
+ this.set('value', url);
}
-
- this.set('value', url);
- this.sendAction('change', this.get('value'));
},
focusIn: function (event) { | Set 'value' property before a dependent CP is used
No issue.
- Make sure value property has been set before computed
property isRelative is referenced. | TryGhost_Ghost | train | js |
fc4e51a295569347a0491dbc23b85480af987df0 | diff --git a/salt/cloud/clouds/gce.py b/salt/cloud/clouds/gce.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/clouds/gce.py
+++ b/salt/cloud/clouds/gce.py
@@ -445,6 +445,15 @@ def __get_network(conn, vm_):
default='default', search_global=False)
return conn.ex_get_network(network)
+def __get_subnetwork(vm_):
+ '''
+ Get configured subnetwork.
+ '''
+ ex_subnetwork = config.get_cloud_config_value(
+ 'subnetwork', vm_, __opts__,
+ default='default', search_global=False)
+
+ return ex_subnetwork
def __get_ssh_interface(vm_):
'''
@@ -2226,6 +2235,7 @@ def request_instance(vm_):
'image': __get_image(conn, vm_),
'location': __get_location(conn, vm_),
'ex_network': __get_network(conn, vm_),
+ 'ex_subnetwork': __get_subnetwork(vm_),
'ex_tags': __get_tags(vm_),
'ex_metadata': __get_metadata(vm_),
} | bugfix adding subnetwork option to gce
Previously when deploying to custom networks salt-cloud would fail with the error described in #<I>
Now it is possible to specify a subnetwork in the profile, to deploy to a custom network and a specific subnet in that network. | saltstack_salt | train | py |
742c0f5de38972f1e3402c028410566c5c837501 | diff --git a/test/test_helper.js b/test/test_helper.js
index <HASH>..<HASH> 100644
--- a/test/test_helper.js
+++ b/test/test_helper.js
@@ -206,6 +206,10 @@ if (process.env.GLOBAL_CLIENT !== 'false') {
before(() => client.connect()
.then(() => serverInfoHelper.fetch_info())
.then(() => serverInfoHelper.fetch_namespace_config(options.namespace))
+ .catch(error => {
+ console.error(error)
+ throw error
+ })
)
} | Print full connection error if test is unable to connect | aerospike_aerospike-client-nodejs | train | js |
94bb34d1dd7c9c3b18220c1131f4d9eb0d12da70 | diff --git a/templates/module/modularity-mod-slider.php b/templates/module/modularity-mod-slider.php
index <HASH>..<HASH> 100644
--- a/templates/module/modularity-mod-slider.php
+++ b/templates/module/modularity-mod-slider.php
@@ -28,7 +28,7 @@
</div>
<?php elseif ($slide['acf_fc_layout'] == 'video' && $slide['type'] == 'embed') : ?>
- <?php echo \Modularity\Module\Slider\Slider::getEmbed($slide['embed_link'], ['player','ratio-16-9'], $image); ?>
+ <?php echo \Modularity\Module\Slider\Slider::getEmbed($slide['embed_link'], ['player'], $image); ?>
<?php elseif ($slide['acf_fc_layout'] == 'video' && $slide['type'] == 'upload') : ?>
<div class="slider-video" style="background-image:url('<?php echo ($image !== false ) ? $image[0] : ''; ?>');"> | REmoved <I>:9 class. Better to default to cropped view. | helsingborg-stad_Modularity | train | php |
f0c8541aee5ecd86882656f0198bdd3ff1513937 | diff --git a/aeron-cluster/src/test/java/io/aeron/cluster/SingleNodeTest.java b/aeron-cluster/src/test/java/io/aeron/cluster/SingleNodeTest.java
index <HASH>..<HASH> 100644
--- a/aeron-cluster/src/test/java/io/aeron/cluster/SingleNodeTest.java
+++ b/aeron-cluster/src/test/java/io/aeron/cluster/SingleNodeTest.java
@@ -46,7 +46,7 @@ public class SingleNodeTest
@Ignore
public void shouldBeAbleToLoadUpFromPreviousLog()
{
- final int count = 110_000;
+ final int count = 150_000;
final int length = 100;
ConsensusModuleHarness.makeRecordingLog(count, length, null, null, new ConsensusModule.Context()); | [Java] Put back failing value. | real-logic_aeron | train | java |
f3d44c72f9d7b6d9fa93d9313f02f3a2a124c9ad | diff --git a/Module.php b/Module.php
index <HASH>..<HASH> 100644
--- a/Module.php
+++ b/Module.php
@@ -39,7 +39,7 @@ class Module
public function getConfig()
{
- defined('APPLICTION_PATH') or define('APPLICATION_PATH', realpath(dirname('./')));
+ defined('APPLICATION_PATH') or define('APPLICATION_PATH', realpath(dirname('./')));
return include __DIR__ . '/config/module.config.php';
} | fixed typo in module check for APPLICATION_PATH | uthando-cms_uthando-session-manager | train | php |
bf48f8e808cbdca913c79c8cb67a0b0b40f7bd21 | diff --git a/lib/ood_core/job/adapters/pbspro.rb b/lib/ood_core/job/adapters/pbspro.rb
index <HASH>..<HASH> 100644
--- a/lib/ood_core/job/adapters/pbspro.rb
+++ b/lib/ood_core/job/adapters/pbspro.rb
@@ -310,10 +310,6 @@ module OodCore
end
end
- def supports_job_arrays?
- false
- end
-
# Retrieve job info from the resource manager
# @param id [#to_s] the id of the job
# @raise [JobAdapterError] if something goes wrong getting job info | Remove the override for supports_job_arrays? | OSC_ood_core | train | rb |
7fa7381bb55f251f945e2d85f139934b358e41ea | diff --git a/Resources/public/js/apps/ez-editorialapp.js b/Resources/public/js/apps/ez-editorialapp.js
index <HASH>..<HASH> 100644
--- a/Resources/public/js/apps/ez-editorialapp.js
+++ b/Resources/public/js/apps/ez-editorialapp.js
@@ -145,6 +145,7 @@ YUI.add('ez-editorialapp', function (Y) {
container.addClass(APP_OPEN);
viewContainer.setStyle('height', container.get('docHeight') + 'px');
+ this.showView('dummyView');
if ( L.isFunction(next) ) {
next();
} | Fixed: made the first view transition a bit smoother | ezsystems_PlatformUIBundle | train | js |
4d1dd720fd52e5d8188541c0c28c8931504a34cf | diff --git a/src/validators/numeric.js b/src/validators/numeric.js
index <HASH>..<HASH> 100644
--- a/src/validators/numeric.js
+++ b/src/validators/numeric.js
@@ -1,8 +1,6 @@
-const numericRegex = /^[-+]?[0-9]+$/;
-
const validate = val => {
if (val) {
- return numericRegex.test(val);
+ return !isNaN(Number(val));
}
return true; | Cast to number and check if the result isNaN or not | cermati_satpam | train | js |
008b6d9a1598e0c2e7cb6de1ab2aa8bd9d710970 | diff --git a/tests/sanity_tests.py b/tests/sanity_tests.py
index <HASH>..<HASH> 100644
--- a/tests/sanity_tests.py
+++ b/tests/sanity_tests.py
@@ -1 +1,4 @@
-from appengine_fixture_loader.loader import *
+#from appengine_fixture_loader.loader import load_fixture
+
+# TODO: We need a way to test it without relying on Google App Engine SDK being
+# installed on this envidonment | There has to be a better way. Mock, perhaps? | rbanffy_appengine-fixture-loader | train | py |
0452b8cea97c2f8c88de8e1d876756ebf824d6b1 | diff --git a/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java b/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java
index <HASH>..<HASH> 100644
--- a/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java
+++ b/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java
@@ -268,7 +268,7 @@ public class HttpUtils {
return getQueryStringFromParams(queryParams, "UTF-8", encodeValues);
} catch (UnsupportedEncodingException e) {
// Should NEVER happen
- throw new RuntimeException(e);
+ throw new IllegalStateException("UTF-8 should always be supported by the JVM", e);
}
} | Code style fix:
* Fixed issue with raw type being thrown: now an IllegalStateException is thrown instead of a raw RuntimeException. | craftercms_commons | train | java |
002a1711f6d3ee1873addbc39e7f71ac2945e648 | diff --git a/src/analyse/callback/analyse/Objects.php b/src/analyse/callback/analyse/Objects.php
index <HASH>..<HASH> 100644
--- a/src/analyse/callback/analyse/Objects.php
+++ b/src/analyse/callback/analyse/Objects.php
@@ -323,6 +323,7 @@ class Objects extends AbstractCallback
// We've got a required parameter!
// We will not call this one.
$foundRequired = true;
+ break;
}
}
unset($ref); | Optimized the calling of configured debug methods. | brainworxx_kreXX | train | php |
2eb600fc124876ab2b5f315ddbe27925f3c6ad1a | diff --git a/text/bayes_test.go b/text/bayes_test.go
index <HASH>..<HASH> 100644
--- a/text/bayes_test.go
+++ b/text/bayes_test.go
@@ -253,19 +253,15 @@ func TestConcurrentPredictionAndLearningShouldNotFail(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
- // fmt.Println("beginning predicting")
for i := 0; i < 500; i++ {
model.Predict(strings.Repeat("some stuff that might be in the training data like iterate", 25))
}
- // fmt.Println("done predicting")
}()
wg.Add(1)
go func() {
defer wg.Done()
- // fmt.Println("beginning learning")
model.OnlineLearn(errors)
- // fmt.Println("done learning")
}()
go func() { | Remove fmt.printf from Naive Bayes test | cdipaolo_goml | train | go |
db0fcc3733529438956fd2b2275fde65a88f9e79 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,12 +13,10 @@
import sys, os
-# import sphinx_rtd_theme
-
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath('../'))
# -- General configuration -----------------------------------------------------
@@ -98,8 +96,6 @@ pygments_style = 'sphinx'
# html_theme = "sphinx_rtd_theme"
-# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
-
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation. | Trying to make docs work correctly | appdotnet_ADNpy | train | py |
0a5d7a7bd2f159e747ceed5e59c3a6e359dd8ca2 | diff --git a/src/xterm.js b/src/xterm.js
index <HASH>..<HASH> 100644
--- a/src/xterm.js
+++ b/src/xterm.js
@@ -1915,6 +1915,10 @@ Terminal.prototype.resize = function(x, y) {
return;
}
+ if (y > this.getOption('scrollback')) {
+ this.setOption('scrollback', y)
+ }
+
var line
, el
, i | Set minimum scrollback value to number of rows if needed on resize | xtermjs_xterm.js | train | js |
2bd9f42b81c89cfa8a709517a9b7375794dbe6e6 | diff --git a/addon/services/notification.js b/addon/services/notification.js
index <HASH>..<HASH> 100644
--- a/addon/services/notification.js
+++ b/addon/services/notification.js
@@ -15,7 +15,9 @@ function notification(status) {
export default class NotificationService extends Service {
_notification(message, options) {
const n = UIkit.notification(
- Object.assign(config["ember-uikit"]?.notification, options, { message })
+ Object.assign(config["ember-uikit"]?.notification ?? {}, options, {
+ message,
+ })
);
return n?.$el | fix(notification): fix notification options if app doesn't configure anything | adfinis-sygroup_ember-uikit | train | js |
9afe92f0a8f88449b3a2fe09f6caa16c404f9170 | diff --git a/shoebot/gui/gtk_drawingarea.py b/shoebot/gui/gtk_drawingarea.py
index <HASH>..<HASH> 100644
--- a/shoebot/gui/gtk_drawingarea.py
+++ b/shoebot/gui/gtk_drawingarea.py
@@ -48,9 +48,7 @@ class ShoebotDrawingArea(gtk.DrawingArea):
self.is_dynamic = True
if self.is_dynamic:
- print self.bot.WIDTH, self.bot.HEIGHT
self.bot.run()
- print self.bot.WIDTH, self.bot.HEIGHT
if 'setup' in self.bot.namespace:
self.bot.namespace['setup']() | Removed extraneous print statements from debugging | shoebot_shoebot | train | py |
3531d91b029c1a2ca509666cdade2a8119645da6 | diff --git a/lint.py b/lint.py
index <HASH>..<HASH> 100644
--- a/lint.py
+++ b/lint.py
@@ -526,6 +526,7 @@ This is used by the global evaluation report (RP0004).'}),
"""
if not modname and filepath is None:
return
+ self.reporter.on_set_current_module(modname, filepath)
self.current_name = modname
self.current_file = filepath or modname
self.stats['by_module'][modname] = {}
diff --git a/reporters/__init__.py b/reporters/__init__.py
index <HASH>..<HASH> 100644
--- a/reporters/__init__.py
+++ b/reporters/__init__.py
@@ -77,3 +77,9 @@ class BaseReporter:
"""display the layout"""
raise NotImplementedError()
+ # Event callbacks
+
+ def on_set_current_module(self, module, filepath):
+ """starting analyzis of a module"""
+ pass
+ | Add 'on_set_current_module' event trigerring and event callback for reporters. | PyCQA_pylint | train | py,py |
2f6b5d3368252c896d211b89fe4de63bc4706651 | diff --git a/src/Generator/EntityBundleGenerator.php b/src/Generator/EntityBundleGenerator.php
index <HASH>..<HASH> 100644
--- a/src/Generator/EntityBundleGenerator.php
+++ b/src/Generator/EntityBundleGenerator.php
@@ -48,11 +48,11 @@ class EntityBundleGenerator extends Generator
/**
* Generate core.entity_view_mode.node.teaser.yml
*/
-/* $this->renderFile(
+ $this->renderFile(
'module/src/Entity/Bundle/core.entity_view_mode.node.teaser.yml.twig',
$this->getSite()->getModulePath($module) . '/config/install/core.entity_view_mode.node.teaser.yml',
$parameters
- ); */
+ );
/**
* Generate field.field.node.{ bundle_name }.body.yml
@@ -66,11 +66,11 @@ class EntityBundleGenerator extends Generator
/**
* Generate field.storage.node.body.yml
*/
-/* $this->renderFile(
+ $this->renderFile(
'module/src/Entity/Bundle/field.storage.node.body.yml.twig',
$this->getSite()->getModulePath($module) . '/config/install/field.storage.node.body.yml',
$parameters
- ); */
+ );
/**
* Generate node.type.{ bundle_name }.yml | [generate:entity:bundle] Accept blank spaces in human readable name. | hechoendrupal_drupal-console | train | php |
e540499c86021438306a874b547446f7b55acee0 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -19,8 +19,8 @@ setup(
version='0.9',
author='Andrea de Marco',
author_email='<24erre@gmail.com>',
- url='https://github.com/z4r/python-mocket',
- description='A Mock Socket Framework',
+ url='https://github.com/mocketize/python-mocket',
+ description='Socket Mock Framework',
long_description=open('README.rst').read(),
packages=find_packages(exclude=('tests', )),
install_requires=install_requires, | repo fix [ci skip] | mindflayer_python-mocket | train | py |
95381cac9e75291c4440cfaa85f0da7f9cf163ab | diff --git a/sources/scalac/backend/msil/GenMSIL.java b/sources/scalac/backend/msil/GenMSIL.java
index <HASH>..<HASH> 100644
--- a/sources/scalac/backend/msil/GenMSIL.java
+++ b/sources/scalac/backend/msil/GenMSIL.java
@@ -21,7 +21,6 @@ import scalac.ast.Tree;
import scalac.ast.TreeList;
import scalac.atree.AConstant;
import Tree.*;
-import scalac.symtab.AttrInfo;
import scalac.symtab.Symbol;
import scalac.symtab.TypeTags;
import scalac.symtab.Modifiers; | Removed in import that prevented proper compila...
Removed in import that prevented proper compilation from the CVS
repository | scala_scala | train | java |
34b191cd219ab736506910202e153a69150bd58b | diff --git a/tests/local/serializer.php b/tests/local/serializer.php
index <HASH>..<HASH> 100644
--- a/tests/local/serializer.php
+++ b/tests/local/serializer.php
@@ -7,9 +7,9 @@ use WebSharks\Core\Classes\CoreFacades as c;
require_once dirname(__FILE__, 2).'/includes/local.php';
/* ------------------------------------------------------------------------------------------------------------------ */
-
-echo $closure = c::serializeClosure(function (string $string) {
- return $string;
+$_brand_name = $App->Config->©brand['©name'];
+echo $closure = c::serializeClosure(function (string $string) use ($_brand_name) {
+ return $_brand_name.' says: '.$string;
})."\n\n";
c::dump($closure = c::unserializeClosure($closure));
echo $closure('Closure serialization works.')."\n\n"; | Updating tests against serializer. | wpsharks_core | train | php |
33ccca315b5b542d3b8fddea3c6566b5ee0087dd | diff --git a/src/hmr/hotModuleReplacement.js b/src/hmr/hotModuleReplacement.js
index <HASH>..<HASH> 100644
--- a/src/hmr/hotModuleReplacement.js
+++ b/src/hmr/hotModuleReplacement.js
@@ -174,17 +174,12 @@ function reloadAll() {
function isUrlRequest(url) {
// An URL is not an request if
- // 1. It's an absolute url
- if (/^[a-z][a-z0-9+.-]*:/i.test(url)) {
- return false;
- }
-
- // 2. It's a protocol-relative
+ // 1. It's a protocol-relative
if (/^\/\//.test(url)) {
return false;
}
- // 3. Its a `#` link
+ // 2. Its a `#` link
if (/^#/.test(url)) {
return false;
} | fix: Remove absolute URL condition from HMR request checker. (#<I>) | faceyspacey_extract-css-chunks-webpack-plugin | train | js |
f9054252cf278b8196a7366dfdfbd0bf7be2b486 | diff --git a/src/Caouecs/Sirtrevorjs/Converter/ImageConverter.php b/src/Caouecs/Sirtrevorjs/Converter/ImageConverter.php
index <HASH>..<HASH> 100644
--- a/src/Caouecs/Sirtrevorjs/Converter/ImageConverter.php
+++ b/src/Caouecs/Sirtrevorjs/Converter/ImageConverter.php
@@ -37,9 +37,15 @@ class ImageConverter extends BaseConverter implements ConverterInterface
return;
}
+ $text = array_get($this->data, 'text');
+
+ if ($text != null) {
+ $text = $this->markdown->text($text);
+ }
+
return $this->view('image.image', [
'url' => array_get($this->data, 'file.url'),
- 'text' => array_get($this->data, 'text'),
+ 'text' => $text,
]);
} | feature: markdown in image's caption | caouecs_Laravel-SirTrevorJS | train | php |
8366d04bb779feaac299db03d14db3bcca16a5cf | diff --git a/rinoh/dimension.py b/rinoh/dimension.py
index <HASH>..<HASH> 100644
--- a/rinoh/dimension.py
+++ b/rinoh/dimension.py
@@ -135,9 +135,17 @@ class DimensionMultiplication(DimensionBase):
return float(self.multiplicand) * self.multiplier
+class DimensionUnit(object):
+ def __init__(self, points_per_unit):
+ self.points_per_unit = float(points_per_unit)
+
+ def __rmul__(self, value):
+ return Dimension(value * self.points_per_unit)
+
+
# Units
-PT = Dimension(1)
-INCH = 72*PT
-MM = INCH / 25.4
-CM = 10*MM
+PT = DimensionUnit(1)
+INCH = DimensionUnit(72*PT)
+MM = DimensionUnit(1 / 25.4 * INCH)
+CM = DimensionUnit(10*MM) | Introduce DimensionUnit class
- 1*PT now produces a Dimension instead of a DimensionMultiplication
- Eliminates most of the DimensionMultiplication.__float__ calls
- Allow only right-multiplication with a DimensionUnit | brechtm_rinohtype | train | py |
4b7448442357ee0e9e741f2953711e060c0d0fda | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,12 +1,5 @@
-"use strict";
-module.exports = function(grunt) {
- function readOptionalJSON( filepath ) {
- var data = {};
- try {
- data = grunt.file.readJSON( filepath );
- } catch(e) {}
- return data;
- }
+module.exports = grunt => {
+ const jshintrc = grunt.file.readJSON("./.jshintrc");
// Project configuration.
grunt.initConfig({
@@ -17,7 +10,7 @@ module.exports = function(grunt) {
jshint: {
all: {
src: ["grunt.js", "lib/**/*.js", "test/**/*.js"],
- options: readOptionalJSON(".jshintrc")
+ options: jshintrc
}
},
jsbeautifier: {
@@ -63,7 +56,5 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-nodeunit");
grunt.loadNpmTasks("grunt-jsbeautifier");
// Default task.
- grunt.registerTask( "default", [ "jsbeautifier", "jshint", "nodeunit" ] );
-
-
+ grunt.registerTask("default", ["jsbeautifier", "jshint", "nodeunit"]);
}; | Gruntfile: nitpicking | rwaldron_temporal | train | js |
3672b8e7b107f241004353ab00dad42d9e1ddfc4 | diff --git a/salt/states/dockerng.py b/salt/states/dockerng.py
index <HASH>..<HASH> 100644
--- a/salt/states/dockerng.py
+++ b/salt/states/dockerng.py
@@ -183,6 +183,8 @@ def _compare(actual, create_kwargs, defaults_from_image):
continue
elif item == 'environment':
+ if actual_data is None:
+ actual_data = []
actual_env = {}
for env_var in actual_data:
try: | docker daemon returns sometimes empty list and sometimes None
We deal with it | saltstack_salt | train | py |
699426379f7477fec45543fa0eed128f98c2ca7f | diff --git a/molgenis-omx-biobankconnect/src/main/java/org/molgenis/omx/biobankconnect/ontologyannotator/AsyncOntologyAnnotator.java b/molgenis-omx-biobankconnect/src/main/java/org/molgenis/omx/biobankconnect/ontologyannotator/AsyncOntologyAnnotator.java
index <HASH>..<HASH> 100644
--- a/molgenis-omx-biobankconnect/src/main/java/org/molgenis/omx/biobankconnect/ontologyannotator/AsyncOntologyAnnotator.java
+++ b/molgenis-omx-biobankconnect/src/main/java/org/molgenis/omx/biobankconnect/ontologyannotator/AsyncOntologyAnnotator.java
@@ -100,7 +100,6 @@ public class AsyncOntologyAnnotator implements OntologyAnnotator, InitializingBe
List<String> requiredColumns = new ArrayList<String>(Arrays.asList(ObservableFeature.NAME.toLowerCase(),
ObservableFeature.DESCRIPTION));
Iterator<AttributeMetaData> columnNamesIterator = csvRepository.getAttributes().iterator();
- // Iterator<String> columnNamesIterator = reader.colNamesIterator();
while (columnNamesIterator.hasNext())
{
requiredColumns.remove(columnNamesIterator.next().getName()); | removed unused comment from AsyncOntologyAnnotator.java | molgenis_molgenis | train | java |
6c2ea3d852f63fe44a6da215f7bd04250a978556 | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -26,7 +26,6 @@ import { setAutoPlan, setMapCenter } from './actions/config'
import { getCurrentPosition } from './actions/location'
import { setLocationToCurrent } from './actions/map'
import { findNearbyStops } from './actions/api'
-import { setShowExtendedSettings } from './actions/ui'
import createOtpReducer from './reducers/create-otp-reducer'
@@ -76,7 +75,6 @@ export {
setAutoPlan,
setLocationToCurrent,
setMapCenter,
- setShowExtendedSettings,
// redux utilities
createOtpReducer, | fix(api): Remove obselete include from index.js | opentripplanner_otp-react-redux | train | js |
ff9a42d144c5eb327bff95461b460926f1e32c2b | diff --git a/languagetool-core/src/main/java/org/languagetool/MultiThreadedJLanguageTool.java b/languagetool-core/src/main/java/org/languagetool/MultiThreadedJLanguageTool.java
index <HASH>..<HASH> 100644
--- a/languagetool-core/src/main/java/org/languagetool/MultiThreadedJLanguageTool.java
+++ b/languagetool-core/src/main/java/org/languagetool/MultiThreadedJLanguageTool.java
@@ -55,7 +55,7 @@ public class MultiThreadedJLanguageTool extends JLanguageTool {
}
private static int getDefaultThreadCount() {
- String threadCountStr = System.getProperty("org.languagetool.thread_count", "-1");
+ String threadCountStr = System.getProperty("org.languagetool.thread_count_internal", "-1");
int threadPoolSize = Integer.parseInt(threadCountStr);
if (threadPoolSize == -1) {
threadPoolSize = Runtime.getRuntime().availableProcessors(); | Rename thred_count property as internal | languagetool-org_languagetool | train | java |
fd32d09e43851204618c923e365e05dbfbfe0cfb | diff --git a/Tests/Entity/Parameters/BodyParameterTest.php b/Tests/Entity/Parameters/BodyParameterTest.php
index <HASH>..<HASH> 100644
--- a/Tests/Entity/Parameters/BodyParameterTest.php
+++ b/Tests/Entity/Parameters/BodyParameterTest.php
@@ -55,7 +55,7 @@ class BodyParameterTest extends \PHPUnit_Framework_TestCase
public function testSerialization()
{
$data = json_encode([
- 'in' => 'body',
+ 'in' => AbstractParameter::IN_BODY,
'name' => 'foo',
'description' => 'bar',
'required' => false, | Converted to using class constant in body serialization test | epfremmer_swagger-php | train | php |
78b0ff4577c93adf72e93b51f9d45ad41daf86ba | diff --git a/tests/test_xlsm_wrf.py b/tests/test_xlsm_wrf.py
index <HASH>..<HASH> 100644
--- a/tests/test_xlsm_wrf.py
+++ b/tests/test_xlsm_wrf.py
@@ -53,7 +53,7 @@ def test_read_wrf(wrf):
# make sure coordinates correct
assert wrf.lsm_lat_var in xd.coords
assert wrf.lsm_lon_var in xd.coords
- assert wrf.lsm_time_var in xd.coords
+ assert 'time' in xd.coords
# check @property attributes
date_array = ['2016-08-23 22:00:00', '2016-08-23 23:00:00',
'2016-08-24 00:00:00', '2016-08-24 01:00:00', | rename time dimension for slicing | snowman2_pangaea | train | py |
9a318185518169ebbccfa1b03685baec6ccbf3f6 | diff --git a/carrot/messaging.py b/carrot/messaging.py
index <HASH>..<HASH> 100644
--- a/carrot/messaging.py
+++ b/carrot/messaging.py
@@ -248,7 +248,7 @@ class Consumer(object):
self.decoder = kwargs.get("decoder", deserialize)
if not self.backend:
self.backend = DefaultBackend(connection=connection,
- decoder=self.decoder)
+ decoder=self.decoder)
self.queue = queue or self.queue
# Binding.
@@ -354,7 +354,8 @@ class Consumer(object):
disabled and the receiver is required to manually handle
acknowledgment.
- :returns: The resulting :class:`carrot.backends.base.BaseMessage` object.
+ :returns: The resulting :class:`carrot.backends.base.BaseMessage`
+ object.
"""
message = self.fetch()
@@ -401,13 +402,6 @@ class Consumer(object):
message.ack()
discarded_count = discarded_count + 1
- def next(self):
- """*DEPRECATED*: Process the next pending message.
- Deprecated in favour of :meth:`process_next`"""
- warnings.warn("next() is deprecated, use process_next() instead.",
- DeprecationWarning)
- return self.process_next()
-
def wait(self):
"""Go into consume mode. | Consumer.next() is now removed (it was deprecated in favor of Consumer.process_next()) | ask_carrot | train | py |
b7b21273e31d74588e5c3772f1dcce0a69477703 | diff --git a/rados/ioctx.go b/rados/ioctx.go
index <HASH>..<HASH> 100644
--- a/rados/ioctx.go
+++ b/rados/ioctx.go
@@ -137,15 +137,15 @@ func (ioctx *IOContext) Create(oid string, exclusive CreateOption) error {
// Write writes len(data) bytes to the object with key oid starting at byte
// offset offset. It returns an error, if any.
func (ioctx *IOContext) Write(oid string, data []byte, offset uint64) error {
- c_oid := C.CString(oid)
- defer C.free(unsafe.Pointer(c_oid))
+ coid := C.CString(oid)
+ defer C.free(unsafe.Pointer(coid))
dataPointer := unsafe.Pointer(nil)
if len(data) > 0 {
dataPointer = unsafe.Pointer(&data[0])
}
- ret := C.rados_write(ioctx.ioctx, c_oid,
+ ret := C.rados_write(ioctx.ioctx, coid,
(*C.char)(dataPointer),
(C.size_t)(len(data)),
(C.uint64_t)(offset)) | rados: naming conventions: fixes in Write function
Fix up variable names that don't meet Go standards. | ceph_go-ceph | train | go |
5be94b753211cf7fd4ed38630e6c58d5419f9e82 | diff --git a/bugwarrior/services/bitbucket.py b/bugwarrior/services/bitbucket.py
index <HASH>..<HASH> 100644
--- a/bugwarrior/services/bitbucket.py
+++ b/bugwarrior/services/bitbucket.py
@@ -24,7 +24,7 @@ class BitbucketIssue(Issue):
'label': 'Bitbucket URL',
},
FOREIGN_ID: {
- 'type': 'string',
+ 'type': 'numeric',
'label': 'Bitbucket Issue ID',
}
} | Make bitbucketid numeric. (#<I>)
This silences all the warnings from taskw that a number is being coerced
into a string. | ralphbean_bugwarrior | train | py |
0c4055ffa1d6b87e785af3799a1d876e0e2e81cc | diff --git a/moment.js b/moment.js
index <HASH>..<HASH> 100644
--- a/moment.js
+++ b/moment.js
@@ -1508,12 +1508,12 @@
get : function (units) {
units = normalizeUnits(units);
- return this[units.toLowerCase() + 's']();
+ return this[units.toLowerCase()]();
},
set : function (units, value) {
units = normalizeUnits(units);
- this[units.toLowerCase() + 's'](value);
+ this[units.toLowerCase()](value);
},
// If passed a language key, it will set the language for this | removing extra s in get() and set() | moment_moment | train | js |
aeeef21c61cd9999875a85de90c6eb9f534066d7 | diff --git a/event/event.go b/event/event.go
index <HASH>..<HASH> 100644
--- a/event/event.go
+++ b/event/event.go
@@ -28,9 +28,8 @@ var levelNames = [8]string{
"Emergency",
}
-// LevelName converts a level into its textual representation.
-func LevelName(level Level) string {
- return levelNames[level]
+func (l Level) String() string {
+ return levelNames[l]
}
type Event struct {
@@ -60,8 +59,3 @@ func NewEvent(id uint64, level Level, message string, fields interface{}) *Event
return event
}
-
-// LevelName returns the textual representation of the level name for the event.
-func (event *Event) LevelName() string {
- return LevelName(event.Level)
-}
diff --git a/event/formatter/formatter.go b/event/formatter/formatter.go
index <HASH>..<HASH> 100644
--- a/event/formatter/formatter.go
+++ b/event/formatter/formatter.go
@@ -61,7 +61,7 @@ func (formatter *Formatter) Time(format string) string {
// Level converts the event's level into a string.
func (formatter *Formatter) Level() string {
- return formatter.Event.LevelName()
+ return formatter.Event.Level.String()
}
// Color wraps the given text in ANSI color escapes appropriate to the event's level. | add stringer interface to levels and drop LevelName | phemmer_sawmill | train | go,go |
b29d7671621de14b140bc8710b7325e98af87b8b | diff --git a/lib/rubocop/target_ruby.rb b/lib/rubocop/target_ruby.rb
index <HASH>..<HASH> 100644
--- a/lib/rubocop/target_ruby.rb
+++ b/lib/rubocop/target_ruby.rb
@@ -7,7 +7,7 @@ module RuboCop
DEFAULT_VERSION = KNOWN_RUBIES.first
OBSOLETE_RUBIES = {
- 1.9 => '0.50', 2.0 => '0.50', 2.1 => '0.58', 2.2 => '0.69', 2.3 => '0.82'
+ 1.9 => '0.50', 2.0 => '0.50', 2.1 => '0.58', 2.2 => '0.69', 2.3 => '0.81'
}.freeze
private_constant :KNOWN_RUBIES, :OBSOLETE_RUBIES | Update target_ruby.rb
rubocop <I> is the last version to support <I> mode, not <I>.
This is a partical revert of <I>a5bee<I>bb<I> | rubocop-hq_rubocop | train | rb |
89b67e7c590b281e4f338a4f74d8605cf3531563 | diff --git a/src/Writer.php b/src/Writer.php
index <HASH>..<HASH> 100644
--- a/src/Writer.php
+++ b/src/Writer.php
@@ -15,6 +15,14 @@ class Writer
/** @var string Write method to be relayed to Colorizer */
protected $method;
+ /** @var Color */
+ protected $colorizer;
+
+ public function __construct()
+ {
+ $this->colorizer = new Color;
+ }
+
/**
* Magically set methods.
*
@@ -22,7 +30,7 @@ class Writer
*
* @return self
*/
- public function __get($name)
+ public function __get(string $name): self
{
if (\strpos($this->method, $name) === false) {
$this->method .= $this->method ? \ucfirst($name) : $name;
@@ -39,12 +47,12 @@ class Writer
*
* @return void
*/
- public function write($text, $eol = false)
+ public function write(string $text, bool $eol = false)
{
list($method, $this->method) = [$this->method ?: 'line', ''];
$stream = \stripos($method, 'error') !== false ? \STDERR : \STDOUT;
- \fwrite($stream, Color::{$method}($text, [], $eol));
+ \fwrite($stream, $this->colorizer->{$method}($text, [], $eol));
}
} | refactor(writer): colorizer is no longer static, add typehints | adhocore_php-cli | train | php |
6f46d434f54fed068233c8e195244857db46ffce | diff --git a/core-bundle/src/Monolog/ContaoTableHandler.php b/core-bundle/src/Monolog/ContaoTableHandler.php
index <HASH>..<HASH> 100644
--- a/core-bundle/src/Monolog/ContaoTableHandler.php
+++ b/core-bundle/src/Monolog/ContaoTableHandler.php
@@ -2,8 +2,8 @@
namespace Contao\CoreBundle\Monolog;
-use Contao\CoreBundle\EventListener\ScopeAwareTrait;
use Contao\CoreBundle\Framework\ContaoFrameworkInterface;
+use Contao\CoreBundle\Framework\ScopeAwareTrait;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Statement; | [Core] ScopeAwareTrait namespace has changed | contao_contao | train | php |
9fd5bfc48c2d3bc3a8251bc9c8dba824d1b02dab | diff --git a/decompress_tar_test.go b/decompress_tar_test.go
index <HASH>..<HASH> 100644
--- a/decompress_tar_test.go
+++ b/decompress_tar_test.go
@@ -9,14 +9,18 @@ import (
func TestTar(t *testing.T) {
mtime := time.Unix(0, 0)
cases := []TestDecompressCase{
- {
- "extended_header.tar",
- true,
- false,
- []string{"directory/", "directory/a", "directory/b"},
- "",
- nil,
- },
+ /*
+ Disabled for now, this was broken in Go 1.10 and doesn't parse at
+ all anymore. Issue open here: https://github.com/golang/go/issues/28843
+ {
+ "extended_header.tar",
+ true,
+ false,
+ []string{"directory/", "directory/a", "directory/b"},
+ "",
+ nil,
+ },
+ */
{
"implied_dir.tar",
true, | Disable extended headers tar test
Go <I> and <I> can't even parse the tar header anymore (errors with
"invalid header"). I'm not sure if this is a bug so I opened an issue
here: <URL> | hashicorp_go-getter | train | go |
106671ebdf0f77f283876c2c972da4114b7fc689 | diff --git a/test/test-integration-sftp.js b/test/test-integration-sftp.js
index <HASH>..<HASH> 100644
--- a/test/test-integration-sftp.js
+++ b/test/test-integration-sftp.js
@@ -1693,13 +1693,8 @@ function cleanupTemp() {
}
function next() {
- if (t === tests.length - 1) {
- cleanup(function() {
- if (fs.existsSync(join(fixturesdir, 'testfile')))
- fs.unlinkSync(join(fixturesdir, 'testfile'));
- });
- return;
- }
+ if (t === tests.length - 1)
+ return cleanup();
//cleanupTemp();
var v = tests[++t];
v.run.call(v);
@@ -1723,12 +1718,14 @@ function waitForSshd(cb) {
waitForSshd(cb);
}, 50);
}
- cb();
+ cb && cb();
});
}
function cleanup(cb) {
cleanupTemp();
+ if (fs.existsSync(join(fixturesdir, 'testfile')))
+ fs.unlinkSync(join(fixturesdir, 'testfile'));
cpexec('lsof -Fp -a -u '
+ USER
+ ' -c sshd -i tcp@localhost:'
@@ -1741,7 +1738,7 @@ function cleanup(cb) {
} catch (ex) {}
}
}
- cb();
+ cb && cb();
});
} | test: make sure big testfile is removed on error or normal exit | mscdex_ssh2 | train | js |
c029e630379cfc155db035238e7e3063ae3d312b | diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py
index <HASH>..<HASH> 100644
--- a/openstack_dashboard/api/neutron.py
+++ b/openstack_dashboard/api/neutron.py
@@ -283,7 +283,7 @@ class SecurityGroupManager(network_base.SecurityGroupManager):
sg_ids = []
for p in ports:
sg_ids += p.security_groups
- return self._list(id=set(sg_ids))
+ return self._list(id=set(sg_ids)) if sg_ids else []
def update_instance_security_group(self, instance_id,
new_security_group_ids): | Ensure to return empty when no secgroup is associated to VM
Change-Id: I6a<I>bc6d3d<I>e7cb<I>e<I>e<I>d<I>f2bfbfc5
Closes-Bug: #<I> | openstack_horizon | train | py |
4b4888532a79c54b27f96532ab77a8ef0e6145bb | diff --git a/acceptancetests/assess_bootstrap.py b/acceptancetests/assess_bootstrap.py
index <HASH>..<HASH> 100755
--- a/acceptancetests/assess_bootstrap.py
+++ b/acceptancetests/assess_bootstrap.py
@@ -87,7 +87,8 @@ def assess_to(bs_manager, to):
log.info('To {} bootstrap successful.'.format(to))
addr = get_controller_hostname(client)
if addr != to:
- raise JujuAssertionError('Not bootstrapped to the correct address.')
+ raise JujuAssertionError(
+ 'Not bootstrapped to the correct address; expected {}, got {}'.format(to, addr))
def assess_bootstrap(args): | Adds detail to assertion error output for deployment tests that
bootstrap with the --to option. | juju_juju | train | py |
359191e6f7cd50119189a546de1de0ad0950ba87 | diff --git a/tests/unit/test_s3.py b/tests/unit/test_s3.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_s3.py
+++ b/tests/unit/test_s3.py
@@ -27,9 +27,9 @@ class S3Tests(unittest.TestCase):
@classmethod
def setUpClass(cls):
# create mock session, replace dummytoken with real token to create cassette
- #mock_gbdx_session = get_mock_gbdx_session(token="dummytoken")
- #cls.gbdx = Interface(gbdx_connection=mock_gbdx_session)
- cls.gbdx = Interface()
+ mock_gbdx_session = get_mock_gbdx_session(token="dummytoken")
+ cls.gbdx = Interface(gbdx_connection=mock_gbdx_session)
+ #cls.gbdx = Interface()
cls._temp_path = tempfile.mkdtemp()
print("Created: {}".format(cls._temp_path)) | using mock interface in s3 test | DigitalGlobe_gbdxtools | train | py |
746bd1b1bd395f1c3355fe40aa5f07d68e530434 | diff --git a/js/cdax.js b/js/cdax.js
index <HASH>..<HASH> 100644
--- a/js/cdax.js
+++ b/js/cdax.js
@@ -865,6 +865,8 @@ module.exports = class cdax extends Exchange {
// 'transfer': undefined,
'name': name,
'active': active,
+ 'deposit': depositEnabled,
+ 'withdraw': withdrawEnabled,
'fee': undefined, // todo need to fetch from fee endpoint
'precision': precision,
'limits': { | cdax: add deposit/withdraw flag in currencies ccxt/ccxt#<I> | ccxt_ccxt | train | js |
d948c2cd6be24ef60ebb471a55d01a36a1932110 | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -95,7 +95,8 @@ module.exports = function(grunt) {
port: port,
base: base,
livereload: true,
- open: true
+ open: true,
+ useAvailablePort: true
}
}
}, | adds `useAvailablePort` option when serving page with connect. | hakimel_reveal.js | train | js |
5e21491835524826825d85cd1f098b6bb18a772a | diff --git a/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java b/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java
index <HASH>..<HASH> 100644
--- a/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java
+++ b/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/DefaultVelocityEngine.java
@@ -295,9 +295,6 @@ public class DefaultVelocityEngine extends AbstractSLF4JLogChute implements Velo
// to make macros included with #includeMacros() work even though we're using
// the Velocity setting:
// velocimacro.permissions.allow.inline.local.scope = true
- // TODO: Fix this when by rewriting the XWiki.include() implementation so that
- // included Velocity templates are added to the current document before
- // evaluation instead of doing 2 separate executions.
this.rsvc = runtimeServices;
} | [misc] Remove TODO that does not make sense anymore | xwiki_xwiki-commons | train | java |
6c0fe2d32592c2789afa18ba35cdc4b8ba198628 | diff --git a/ipywidgets/static/widgets/js/widget_bool.js b/ipywidgets/static/widgets/js/widget_bool.js
index <HASH>..<HASH> 100644
--- a/ipywidgets/static/widgets/js/widget_bool.js
+++ b/ipywidgets/static/widgets/js/widget_bool.js
@@ -178,9 +178,10 @@ define([
}
this.$el.text(readout);
$('<i class="fa"></i>').prependTo(this.$el).addClass(icon);
+ var that = this;
this.displayed.then(function() {
- this.$el.css("color", color);
- }, this);
+ that.$el.css("color", color);
+ });
}
}); | then does not take a context argument | jupyter-widgets_ipywidgets | train | js |
65d77094dcf660c80ddc58ff05d13acb0ba9e5cb | diff --git a/src/DoctrineServiceProvider.php b/src/DoctrineServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/DoctrineServiceProvider.php
+++ b/src/DoctrineServiceProvider.php
@@ -108,7 +108,6 @@ class DoctrineServiceProvider extends ServiceProvider
protected function registerManagerRegistry()
{
$this->app->singleton('registry', function ($app) {
-
$registry = new IlluminateRegistry($app, $app->make(EntityManagerFactory::class));
// Add all managers into the registry
@@ -122,7 +121,6 @@ class DoctrineServiceProvider extends ServiceProvider
// Once the registry get's resolved, we will call the resolve callbacks which were waiting for the registry
$this->app->afterResolving('registry', function (ManagerRegistry $registry, Container $container) {
-
$this->bootExtensionManager();
BootChain::boot($registry);
@@ -176,7 +174,6 @@ class DoctrineServiceProvider extends ServiceProvider
// Bind extension manager as singleton,
// so user can call it and add own extensions
$this->app->singleton(ExtensionManager::class, function ($app) {
-
$manager = new ExtensionManager($app);
// Register the extensions
@@ -214,7 +211,6 @@ class DoctrineServiceProvider extends ServiceProvider
protected function extendAuthManager()
{
$this->app->make('auth')->provider('doctrine', function ($app, $config) {
-
$entity = $config['model'];
$em = $app['registry']->getManagerForClass($entity); | Applied fixes from StyleCI (#<I>) | laravel-doctrine_orm | train | php |
eb7e0e05e9f507e01a1ffa9a7b279263d55ae08c | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup
from codecs import open
REPO_URL = "http://github.com/MatMaul/pynetgear"
-VERSION = "0.10.1"
+VERSION = "0.10.2"
with open("requirements.txt") as f:
required = f.read().splitlines() | bump to version <I> (#<I>) | MatMaul_pynetgear | train | py |
718cbb8d6b7e2a3e7ae036533ae4894b65d149eb | diff --git a/zendesk/endpoints_v2.py b/zendesk/endpoints_v2.py
index <HASH>..<HASH> 100644
--- a/zendesk/endpoints_v2.py
+++ b/zendesk/endpoints_v2.py
@@ -335,11 +335,11 @@ mapping_table = {
'method': 'POST',
},
'update_organzation': {
- 'path': '/organizations.json',
+ 'path': '/organizations/{{organization_id}}.json',
'method': 'PUT',
},
'delete_organzation': {
- 'path': '/organizations.json',
+ 'path': '/organizations/{{organization_id}}.json',
'method': 'DELETE',
}, | Fixed update and delete organization endpoint for v2 API. | fprimex_zdesk | train | py |
7a27f997b2d022f6dd2bddb3705dbdb9f2523920 | diff --git a/lib/spring/version.rb b/lib/spring/version.rb
index <HASH>..<HASH> 100644
--- a/lib/spring/version.rb
+++ b/lib/spring/version.rb
@@ -1,3 +1,3 @@
module Spring
- VERSION = "1.1.0.beta3"
+ VERSION = "1.1.0.beta4"
end | Bump to <I>.beta4 | rails_spring | train | rb |
6fa17eb4e984c6a05a0eca6d0b41400b5926ff1a | diff --git a/test/rjsconfig.js b/test/rjsconfig.js
index <HASH>..<HASH> 100644
--- a/test/rjsconfig.js
+++ b/test/rjsconfig.js
@@ -2,12 +2,7 @@ var require = {
paths: {
"power-assert": "../build/power-assert",
expect: "../bower_components/expect/index",
- "power-assert-formatter": "../bower_components/power-assert-formatter/lib/power-assert-formatter",
- "qunit-tap": "../bower_components/qunit-tap/lib/qunit-tap",
- qunit: "../bower_components/qunit/qunit/qunit",
mocha: "../bower_components/mocha/mocha",
- empower: "../bower_components/empower/lib/empower",
- esprima: "../bower_components/esprima/esprima",
requirejs: "../bower_components/requirejs/require"
},
shim: { | Remove unused dependencies from AMD testing. | power-assert-js_power-assert | train | js |
eb02579814540e4da4b6115e9490442e7fc51a59 | diff --git a/src/Floppy/Client/BuzzFileSourceUploader.php b/src/Floppy/Client/BuzzFileSourceUploader.php
index <HASH>..<HASH> 100644
--- a/src/Floppy/Client/BuzzFileSourceUploader.php
+++ b/src/Floppy/Client/BuzzFileSourceUploader.php
@@ -32,7 +32,7 @@ class BuzzFileSourceUploader implements FileSourceUploader
$formUpload = new FormUpload();
$formUpload->setName($this->fileKey);
- $formUpload->setFilename(basename($fileSource->filepath()));
+ $formUpload->setFilename($this->getFilename($fileSource));
$formUpload->setContent($fileSource->content());
$request->addFields($extraFields + array(
@@ -63,4 +63,17 @@ class BuzzFileSourceUploader implements FileSourceUploader
throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
}
}
+
+ private function getFilename(FileSource $fileSource)
+ {
+ $filename = basename($fileSource->filepath());
+ $extension = pathinfo($filename, PATHINFO_EXTENSION);
+ $preferredExtension = $fileSource->fileType()->prefferedExtension();
+
+ //make sure filename has valid extension. When FileSource was created from UploadedFile, filepath might be a hash
+ //and extension would be meaningless
+ return $preferredExtension && $preferredExtension !== $extension
+ ? 'file.'.$preferredExtension
+ : $filename;
+ }
}
\ No newline at end of file | fix BuzzFileSourceUploader compatibility with FileSource created from UploadedFile | zineinc_floppy-client | train | php |
da1de4e75f572a56d9c9a3378deebebd36a54f56 | diff --git a/tests/integration/test.replication.js b/tests/integration/test.replication.js
index <HASH>..<HASH> 100644
--- a/tests/integration/test.replication.js
+++ b/tests/integration/test.replication.js
@@ -2924,7 +2924,11 @@ adapters.forEach(function (adapters) {
live: true,
onChange: function (change) {
change.changes.should.have.length(1);
- change.seq.should.equal(info.update_seq);
+
+ // not a valid assertion in CouchDB 2.0
+ if (!testUtils.isCouchMaster()) {
+ change.seq.should.equal(info.update_seq);
+ }
done();
}
}); | (#<I>) - Fix "issue #<I> update_seq after replication"
Do not assume that the update_seq and change seq are equal (not
true in CouchDB <I>). | pouchdb_pouchdb | train | js |
472488d5727f062c7963eb70a70be5469e26182a | diff --git a/test/e2e/driver.go b/test/e2e/driver.go
index <HASH>..<HASH> 100644
--- a/test/e2e/driver.go
+++ b/test/e2e/driver.go
@@ -74,10 +74,7 @@ func RunE2ETests(authConfig, certDir, host, repoRoot, provider string, orderseed
}()
tests := []testSpec{
- /* Disable TestKubernetesROService due to rate limiter issues.
- TODO: Add this test back when rate limiting is working properly.
- {TestKubernetesROService, "TestKubernetesROService"},
- */
+ {TestKubernetesROService, "TestKubernetesROService"},
{TestKubeletSendsEvent, "TestKubeletSendsEvent"},
{TestImportantURLs, "TestImportantURLs"},
{TestPodUpdate, "TestPodUpdate"}, | Reinstate ROService test now that rate limit issue has been addressed | kubernetes_kubernetes | train | go |
7d1913ded50c8f9aec0e65e077ee8e66a78ecb23 | diff --git a/src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java b/src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java
+++ b/src/main/java/com/j256/ormlite/dao/BaseDaoImpl.java
@@ -622,6 +622,9 @@ public abstract class BaseDaoImpl<T, ID> implements Dao<T, ID> {
public ID extractId(T data) throws SQLException {
checkForInitialized();
FieldType idField = tableInfo.getIdField();
+ if (idField == null) {
+ throw new SQLException("Class " + dataClass + " does not have an id field");
+ }
@SuppressWarnings("unchecked")
ID id = (ID) idField.extractJavaFieldValue(data);
return id; | Added a better throw instead of a NPE. | j256_ormlite-core | train | java |
56ce97aea9ebc3460c2208803ab2d5dab5cd4087 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -65,6 +65,7 @@ An extensive
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules',
],
) | Added "Implementation :: PyPy" to classifiers. | johnbywater_eventsourcing | train | py |
0838754145316ca685a3af821c457be78e82028a | diff --git a/src/Security/Auth0Service.php b/src/Security/Auth0Service.php
index <HASH>..<HASH> 100644
--- a/src/Security/Auth0Service.php
+++ b/src/Security/Auth0Service.php
@@ -116,6 +116,12 @@ class Auth0Service
*/
public function getUserProfileByA0UID(string $jwt): ?array
{
+ // The /userinfo endpoint is only accessible with RS256.
+ // Return details from JWT instead, in this case.
+ if ('HS256' === $this->algorithm) {
+ return (array) $this->tokenInfo;
+ }
+
return $this->a0->userinfo($jwt);
} | fix: HS<I> does not support /userinfo; return profile based on JWT data in this case. | auth0_jwt-auth-bundle | train | php |
6c1ca693fb17c2b17cb711d18de2295a0ec105a2 | diff --git a/src/Toolbar/LeftElement.react.js b/src/Toolbar/LeftElement.react.js
index <HASH>..<HASH> 100644
--- a/src/Toolbar/LeftElement.react.js
+++ b/src/Toolbar/LeftElement.react.js
@@ -27,7 +27,6 @@ const contextTypes = {
uiTheme: PropTypes.object.isRequired,
};
-const SEARCH_BACK_ICON = 'arrow-back';
const SEARCH_FORWARD_ICON = 'arrow-forward';
function shouldUpdateStyles(props, nextProps) {
@@ -90,12 +89,7 @@ class LeftElement extends PureComponent {
easing: Easing.linear,
useNativeDriver: Platform.OS === 'android',
}).start(() => {
- let leftElement = activate ? SEARCH_FORWARD_ICON : this.props.leftElement;
-
- if (!this.state.leftElement) {
- // because there won't be animation in this case
- leftElement = SEARCH_BACK_ICON;
- }
+ const leftElement = activate ? SEARCH_FORWARD_ICON : this.props.leftElement;
this.setState({ leftElement }); | Toolbar search without leftElement shows forward icon (#<I>)
* Show back icon while search is active
It should show back icon instead of forward icon
* Show back icon while search is active
* Fix eslint syntax error | xotahal_react-native-material-ui | train | js |
6ea6243b8c54658addae6b7d34d093252a0e84ab | diff --git a/src/components/autocomplete/AutoComplete.js b/src/components/autocomplete/AutoComplete.js
index <HASH>..<HASH> 100644
--- a/src/components/autocomplete/AutoComplete.js
+++ b/src/components/autocomplete/AutoComplete.js
@@ -223,7 +223,7 @@ export class AutoComplete extends Component {
formatValue(value) {
if (value) {
- if (this.props.selectedItemTemplate) {
+ if (this.props.selectedItemTemplate && (this.props.multiple ? this.isSelected(value) : this.findOptionIndex(value) > -1)) {
const resolvedFieldData = this.props.selectedItemTemplate(value);
return resolvedFieldData ? resolvedFieldData : value;
}
@@ -472,9 +472,9 @@ export class AutoComplete extends Component {
findOptionIndex(option) {
let index = -1;
- if (this.suggestions) {
- for (let i = 0; i < this.suggestions.length; i++) {
- if (ObjectUtils.equals(option, this.suggestions[i])) {
+ if (this.props.suggestions) {
+ for (let i = 0; i < this.props.suggestions.length; i++) {
+ if (ObjectUtils.equals(option, this.props.suggestions[i])) {
index = i;
break;
} | Fixed #<I> - AutoComplete: selectedItemTemplate gets called for query | primefaces_primereact | train | js |
3712707f725a04b42a146802841e56dc93ef09ee | diff --git a/pysswords/__main__.py b/pysswords/__main__.py
index <HASH>..<HASH> 100644
--- a/pysswords/__main__.py
+++ b/pysswords/__main__.py
@@ -1,4 +1,4 @@
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
import argparse
from getpass import getpass | Add unicode literals from future to support python2 | marcwebbie_passpie | train | py |
99f2077852273843eb59e1d4629e7f592ac3d832 | diff --git a/lib/jquery.go.js b/lib/jquery.go.js
index <HASH>..<HASH> 100644
--- a/lib/jquery.go.js
+++ b/lib/jquery.go.js
@@ -311,7 +311,7 @@ var jQuery = _.extend(function(selector, context) {
*/
config: {
addJQuery: true,
- jQuery: '//code.jquery.com/jquery-1.11.1.min.js',
+ jQuery: 'https://code.jquery.com/jquery-1.11.1.min.js',
site: '',
width: 1920,
height: 1080, | use https for the jQuery path | travist_jquery.go.js | train | js |
9816755b578e7d1538822be7565031cc09382179 | diff --git a/cmd/juju/subnet/remove.go b/cmd/juju/subnet/remove.go
index <HASH>..<HASH> 100644
--- a/cmd/juju/subnet/remove.go
+++ b/cmd/juju/subnet/remove.go
@@ -19,14 +19,20 @@ type RemoveCommand struct {
}
const removeCommandDoc = `
-Removes an existing and unused subnet from Juju. It does not delete
-the subnet from the cloud substrate (i.e. it is not the opposite of
-"juju subnet create").
+Marks an existing and unused subnet for removal. Depending on what features
+the cloud infrastructure supports, this command will either delete the
+subnet using the cloud API (if supported, e.g. in Amazon VPC) or just
+remove the subnet entity from Juju's database (with non-SDN substrates,
+e.g. MAAS). In other words "remove" acts like the opposite of "create"
+(if supported) or "add" (if "create" is not supported).
If any machines are still using the subnet, it cannot be removed and
an error is returned instead. If the subnet is not in use, it will be
marked for removal, but it will not be removed from the Juju database
until all related entites are cleaned up (e.g. allocated addresses).
+Just before ultimately removing the subnet from the Juju database, and
+if the infrastructure supports it, the subnet will be also deleted from
+the underlying substrate.
`
// Info is defined on the cmd.Command interface. | Updated "subnet remove" doc | juju_juju | train | go |
0470bd79aaf4a57a3d5f8f236ecc4a5c5c5aac09 | diff --git a/scss/__init__.py b/scss/__init__.py
index <HASH>..<HASH> 100644
--- a/scss/__init__.py
+++ b/scss/__init__.py
@@ -1033,10 +1033,10 @@ class Scss(object):
log.warn(dequote(to_str(name)))
elif code == '@print':
name = self.calculate(name, rule[CONTEXT], rule[OPTIONS], rule)
- log.info(dequote(to_str(name)))
+ print >>sys.stderr, dequote(to_str(name))
elif code == '@raw':
name = self.calculate(name, rule[CONTEXT], rule[OPTIONS], rule)
- log.info(repr(name))
+ print >>sys.stderr, repr(name)
elif code == '@dump_context':
log.info(repr(rule[CONTEXT]))
elif code == '@dump_options': | @print and @raw output to the standard error | Kronuz_pyScss | train | py |
efdd48ca2b931e8aa1de50d504add9f6e17e571a | diff --git a/lib/sabisu_rails.rb b/lib/sabisu_rails.rb
index <HASH>..<HASH> 100644
--- a/lib/sabisu_rails.rb
+++ b/lib/sabisu_rails.rb
@@ -50,6 +50,10 @@ module SabisuRails
mattr_accessor :app_name
@@app_name = 'Sabisu'
+ # Sets the default format for requests to the api, :json, :xml
+ mattr_accessor :api_format
+ @@api_format = :json
+
mattr_accessor :default_resource
@@configured = false
diff --git a/lib/sabisu_rails/request.rb b/lib/sabisu_rails/request.rb
index <HASH>..<HASH> 100644
--- a/lib/sabisu_rails/request.rb
+++ b/lib/sabisu_rails/request.rb
@@ -4,6 +4,9 @@ module SabisuRails
base_uri SabisuRails.base_api_uri
headers SabisuRails.api_headers
+ headers "Accept" => "application/#{SabisuRails.api_format}"
+ headers "Content-Type" => "application/#{SabisuRails.api_format}"
+ format SabisuRails.api_format
def initialize(explorer, body_params, params)
@explorer = explorer | Sets the default format for the api to be json, solves #<I> | kurenn_sabisu-rails | train | rb,rb |
3680ca82b707e3cfc093b8b86ba86ec911698206 | diff --git a/src/requirementslib/models/requirements.py b/src/requirementslib/models/requirements.py
index <HASH>..<HASH> 100644
--- a/src/requirementslib/models/requirements.py
+++ b/src/requirementslib/models/requirements.py
@@ -920,10 +920,18 @@ class Requirement(object):
:return: A set of requirement strings of the dependencies of this requirement.
:rtype: set(str)
"""
-
- if not sources:
- sources = [{'url': 'https://pypi.org/simple', 'name': 'pypi', 'verify_ssl': True},]
- return get_dependencies(self.ireq, sources=sources)
+ if self.is_named:
+ if not sources:
+ sources = [{
+ 'name': 'pypi',
+ 'url': 'https://pypi.org/simple',
+ 'verify_ssl': True,
+ }]
+ return get_dependencies(self.ireq, sources=sources)
+ else:
+ # FIXME: how should this work? Run setup.py egg_info and dig things
+ # from dist-info?
+ return []
def get_abstract_dependencies(self, sources=None):
"""Retrieve the abstract dependencies of this requirement. | get_dependencies only works for named ireq
So we need to do something else if this is a URL-based, or local requirement. | sarugaku_requirementslib | train | py |
4a752d74fa8f99176d5bb52cbcdf26bc07308948 | diff --git a/multiloader.go b/multiloader.go
index <HASH>..<HASH> 100644
--- a/multiloader.go
+++ b/multiloader.go
@@ -18,3 +18,10 @@ func (m multiLoader) Load(s interface{}) error {
return nil
}
+
+// MustLoad loads the source into the struct, it panics if gets any error
+func (m multiLoader) MustLoad(s interface{}) {
+ if err := m.Load(s); err != nil {
+ panic(err)
+ }
+} | Multiconfig: added MustLoad method | koding_multiconfig | train | go |
1b532cc448e975c65f246ccaa223011c983e37b0 | diff --git a/faststat/faststat.py b/faststat/faststat.py
index <HASH>..<HASH> 100644
--- a/faststat/faststat.py
+++ b/faststat/faststat.py
@@ -138,7 +138,7 @@ try:
# keep buckets for intervals in size from 100ns to ~14 hours
TIME_BUCKETS = sum(
- [(1*10**-x, 2*10**-x, 5*10**-x) for x in (7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4)], ())
+ [(1*10**x, 2*10**x, 5*10**x) for x in range(2, 13)], ())
class _BaseStats(object):
'base class to avoid repeating code' | corrected scale on time buckets to nanoseconds | kurtbrose_faststat | train | py |
85712134617e73ec16d59f316bc9e35abe81985c | diff --git a/lib/cargo_streamer.rb b/lib/cargo_streamer.rb
index <HASH>..<HASH> 100644
--- a/lib/cargo_streamer.rb
+++ b/lib/cargo_streamer.rb
@@ -1,6 +1,5 @@
require 'zlib'
require 'digest/md5'
-require 'set'
require 'exceptions'
@@ -104,27 +103,24 @@ module OfflineMirror
private
- def encodable?(value, known_ids = Set.new, depth = 0)
+ def encodable?(value, depth = 0)
# Not using is_a? because any derivative-ness would be sliced off by JSONification
# Depth check is because we require that the top type be an Array or Hash
return true if depth > 0 && ENCODABLE_TYPES.include?(value.class)
if value.class == Array || value.class == Hash
- return false if known_ids.include?(value.object_id) # Protect against recursive loops
return false if depth > 4 # Protect against excessively deep structures
- known_ids.add value.object_id
if value.class == Array
value.each do |val|
- return false unless encodable?(val, known_ids, depth + 1)
+ return false unless encodable?(val, depth + 1)
end
else
value.each do |key, val|
return false unless key.class == String # JSON only supports string keys
- return false unless encodable?(val, known_ids, depth + 1)
+ return false unless encodable?(val, depth + 1)
end
end
- known_ids.delete value.object_id
return true
end | Removed the explicit circular loop detection code in cargo streamer; the depth maximum takes care of that anyways | DavidMikeSimon_offroad | train | rb |
997012af55dec2b52a602601457296e04f39dc8c | diff --git a/src/bsh/XThis.java b/src/bsh/XThis.java
index <HASH>..<HASH> 100644
--- a/src/bsh/XThis.java
+++ b/src/bsh/XThis.java
@@ -69,6 +69,10 @@ public class XThis extends This
return "'this' reference (XThis) to Bsh object: " + namespace;
}
+ private Object readResolve() throws ObjectStreamException {
+ throw new NotSerializableException("Deserializing XThis not supported");
+ }
+
/**
Get dynamic proxy for interface, caching those it creates.
*/ | Prevent deserialization of XThis | beanshell_beanshell | train | java |
2cd2d2f0b8c8c9706976a08c5deefe781badf2ec | diff --git a/router.go b/router.go
index <HASH>..<HASH> 100644
--- a/router.go
+++ b/router.go
@@ -277,7 +277,7 @@ func (da *doubleArray) findBase(siblings []sibling, start int, usedBase map[int]
if len(da.bc) <= next {
da.extendBaseCheckArray()
}
- if len(da.bc) <= next || !da.bc[next].IsEmpty() {
+ if !da.bc[next].IsEmpty() {
break
}
} | Remove unneeded condition for `if' | naoina_denco | train | go |
41a4fef95d0880fb5b09ef099dd8448756e10037 | diff --git a/src/vimpdb/proxy.py b/src/vimpdb/proxy.py
index <HASH>..<HASH> 100755
--- a/src/vimpdb/proxy.py
+++ b/src/vimpdb/proxy.py
@@ -17,10 +17,10 @@ def getPackagePath(instance):
class ProxyToVim(object):
def __init__(self):
- self.setupRemote()
self.comm_init()
def comm_init(self):
+ self.setupRemote()
self._send(':call PDB_comm_init()<CR>')
def setupRemote(self): | setupRemote before call to PDB functions in Vim | gotcha_vimpdb | train | py |
2a5e55546d270e21a310c6303f18b4cac07b4516 | diff --git a/mambustruct.py b/mambustruct.py
index <HASH>..<HASH> 100644
--- a/mambustruct.py
+++ b/mambustruct.py
@@ -636,16 +636,14 @@ class MambuStruct(object):
Returns the number of requests done to Mambu.
"""
try:
- try:
- customFieldValue = [l['value'] for l in self[self.customFieldName] if l['customFieldID'] == customfield][0]
- except IndexError as ierr:
- err = MambuError("The object does not have a custom field to set")
- raise err
-
+ customFieldValue = [l['value'] for l in self[self.customFieldName] if l['customFieldID'] == customfield][0]
datatype = [l['customField']['dataType'] for l in self[self.customFieldName] if l['customFieldID'] == customfield][0]
except IndexError as ierr:
err = MambuError("The object %s has not the custom field '%s'" % (self['id'], customfield))
raise err
+ except AttributeError:
+ err = MambuError("The object does not have a custom field to set")
+ raise err
if datatype == "USER_LINK":
from mambuuser import MambuUser | The anidated 'try' was changed by exception 'AttributeError' in mambustruct | jstitch_MambuPy | train | py |
7a9f9bf0835945c744f8973d8791d2e3fb3c8ad0 | diff --git a/rakelib/yard_builder.rb b/rakelib/yard_builder.rb
index <HASH>..<HASH> 100644
--- a/rakelib/yard_builder.rb
+++ b/rakelib/yard_builder.rb
@@ -237,10 +237,10 @@ class YardBuilder
Dir.chdir(gh_pages_repo_dir + "docs" + gem) do
Dir.glob(File.join("**","*.html")).each do |file_path|
file_contents = File.read file_path
- file_contents.gsub! "dynamic print site_values.console_name %",
- "Google Cloud Platform Console"
file_contents.gsub! "{% dynamic print site_values.console_name %}",
"Google Cloud Platform Console"
+ file_contents.gsub! "dynamic print site_values.console_name %",
+ "Google Cloud Platform Console"
File.write file_path, file_contents
end
end | Fix order of Trace docs fixes
These search and replace calls are here to remove the protobuf templating
directives that were missed before these protos were published.
Unfortunately, these directives look like valid YARD templating when
generating the HTML output, and look like valid Liquid templating for
the source code view.
GitHub Pages cannot load the site with these left alone, so we must
fix them. | googleapis_google-cloud-ruby | train | rb |
c1faf0c6be9a7802f38d31f0d6fd8bd0fb9988b0 | diff --git a/stun/packet.go b/stun/packet.go
index <HASH>..<HASH> 100644
--- a/stun/packet.go
+++ b/stun/packet.go
@@ -17,6 +17,7 @@
package stun
import (
+ "bytes"
"crypto/rand"
"encoding/binary"
"encoding/hex"
@@ -159,18 +160,24 @@ func (v *packet) send(conn net.PacketConn, addr net.Addr) (net.Addr, *packet, er
if timeout < 1600 {
timeout *= 2
}
- packetBytes := make([]byte, 1024)
- length, raddr, err := conn.ReadFrom(packetBytes)
- if err == nil {
+ for {
+ packetBytes := make([]byte, 1024)
+ length, raddr, err := conn.ReadFrom(packetBytes)
+ if err != nil {
+ if err.(net.Error).Timeout() {
+ break
+ }
+ return nil, nil, err
+ }
pkt, err := newPacketFromBytes(packetBytes[0:length])
+ if !bytes.Equal(v.id, pkt.id) {
+ continue
+ }
if debug {
fmt.Print(hex.Dump(pkt.bytes()))
}
return raddr, pkt, err
}
- if !err.(net.Error).Timeout() {
- return nil, nil, err
- }
}
return nil, nil, nil
} | check trans id in send and resp | ccding_go-stun | train | go |
4555a9bded8dc118de1a892bb0267480e5bf61f6 | diff --git a/classes/Boom/Group/Group.php b/classes/Boom/Group/Group.php
index <HASH>..<HASH> 100644
--- a/classes/Boom/Group/Group.php
+++ b/classes/Boom/Group/Group.php
@@ -69,6 +69,13 @@ class Group
return $this;
}
+ public function delete()
+ {
+ $this->model->delete();
+
+ return $this;
+ }
+
public function getId()
{
return $this->model->id; | Added method Group\Group->delete() | boomcms_boom-core | train | php |
200202c1060ac0c43509e4a9a669a251bbc13390 | diff --git a/multiqc/utils/util_functions.py b/multiqc/utils/util_functions.py
index <HASH>..<HASH> 100644
--- a/multiqc/utils/util_functions.py
+++ b/multiqc/utils/util_functions.py
@@ -85,7 +85,12 @@ def write_data_file(data, fn, sort_cols=False, data_format=None):
if not data: # no items left for regular export
return
- elif len(data) == 1 and type(data) is not dict and type(data) is not OrderedDict:
+ elif (
+ data_format not in ["json", "yaml"]
+ and len(data) == 1
+ and type(data) is not dict
+ and type(data) is not OrderedDict
+ ):
config.logger.debug(
"Metrics of " + fn + "can't be saved as tab-separated output. Choose JSON or YAML output instead."
) | Need to check data format in the condition, too | ewels_MultiQC | train | py |
a74346f7a714be359d28d87471ebc360c801303e | diff --git a/ldapcherry/ppolicy/simple.py b/ldapcherry/ppolicy/simple.py
index <HASH>..<HASH> 100644
--- a/ldapcherry/ppolicy/simple.py
+++ b/ldapcherry/ppolicy/simple.py
@@ -19,14 +19,14 @@ class PPolicy(ldapcherry.ppolicy.PPolicy):
def check(self, password):
if len(password) < self.min_length:
- return {'match': False, 'reason': 'password too short'}
+ return {'match': False, 'reason': 'Password too short'}
if len(re.findall(r'[A-Z]', password)) < self.min_upper:
return {
'match': False,
- 'reason': 'not enough upper case characters'
+ 'reason': 'Not enough upper case characters'
}
if len(re.findall(r'[0-9]', password)) < self.min_digit:
- return {'match': False, 'reason': 'not enough digits'}
+ return {'match': False, 'reason': 'Not enough digits'}
return {'match': True, 'reason': 'password ok'}
def info(self): | very small improvements on ppolicy.simple | kakwa_ldapcherry | train | py |
06496403eeeb6f4a3e373debe05424432c29fcae | diff --git a/tests/unit/Codeception/Lib/Driver/MysqlTest.php b/tests/unit/Codeception/Lib/Driver/MysqlTest.php
index <HASH>..<HASH> 100644
--- a/tests/unit/Codeception/Lib/Driver/MysqlTest.php
+++ b/tests/unit/Codeception/Lib/Driver/MysqlTest.php
@@ -49,7 +49,7 @@ class MysqlTest extends \PHPUnit_Framework_TestCase
public function testCleanupDatabase()
{
- $this->assertNotEmpty(1, count(self::$mysql->getDbh()->query("SHOW TABLES")->fetchAll()));
+ $this->assertNotEmpty(self::$mysql->getDbh()->query("SHOW TABLES")->fetchAll());
self::$mysql->cleanup();
$this->assertEmpty(self::$mysql->getDbh()->query("SHOW TABLES")->fetchAll());
} | Fixed assertion in testCleanupDatabase | Codeception_base | train | php |
fee217f56f64c7e2ad8249830d82e56cd9ad806e | diff --git a/tests/Symfony/Tests/Component/Process/ProcessTest.php b/tests/Symfony/Tests/Component/Process/ProcessTest.php
index <HASH>..<HASH> 100644
--- a/tests/Symfony/Tests/Component/Process/ProcessTest.php
+++ b/tests/Symfony/Tests/Component/Process/ProcessTest.php
@@ -55,8 +55,8 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
*/
public function testProcessPipes($expected, $code)
{
- if (strpos(PHP_OS, "WIN") === 0 ) {
- $this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120');
+ if (strpos(PHP_OS, "WIN") === 0 && version_compare(phpversion(), "5.3.9", "<")) {
+ $this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
}
$p = new Process(sprintf('php -r %s', escapeshellarg($code))); | Update tests/Symfony/Tests/Component/Process/ProcessTest.php | symfony_symfony | train | php |
75bccc353d454725ff72eef7d20cb7c2df20cdd6 | diff --git a/lib/hash/hash_path_proc.rb b/lib/hash/hash_path_proc.rb
index <HASH>..<HASH> 100644
--- a/lib/hash/hash_path_proc.rb
+++ b/lib/hash/hash_path_proc.rb
@@ -1,9 +1,11 @@
require 'time'
class Hash
- def hash_path_proc action, paths, *args, **params
+ def path_proc action, paths, *args, **params
BBLib.hash_path_proc self, action, paths, *args, **params
end
+
+ alias_method :hash_path_proc, :path_proc
end
class Array
@@ -55,8 +57,6 @@ module BBLib
delete: { aliases: [:del]},
remove: { aliases: [:rem]},
custom: {aliases: [:send]},
- # TODO
- # titlecase: { aliases: [:title_case]},
encapsulate: {aliases: []},
uncapsulate: {aliases: []},
extract_integers: {aliases: [:extract_ints]},
@@ -67,7 +67,6 @@ module BBLib
avg_number: {aliases: [:avg, :average, :average_number]},
sum_number: {aliases: [:sum]},
strip: {aliases: [:trim]},
- # rename: { aliases: [:rename_key]},
concat: { aliases: [:join, :concat_with]},
reverse_concat: { aliases: [:reverse_join, :reverse_concat_with]}
} | Changed name of method to path_proc and added alias. | bblack16_bblib-ruby | train | rb |
516e077c5d15a4bf8216c1fb76d7b57ad7546fd0 | diff --git a/sovrin_client/test/agent/faber.py b/sovrin_client/test/agent/faber.py
index <HASH>..<HASH> 100644
--- a/sovrin_client/test/agent/faber.py
+++ b/sovrin_client/test/agent/faber.py
@@ -1,18 +1,13 @@
from plenum.common.log import getlogger
from anoncreds.protocol.types import AttribType, AttribDef, SchemaKey
-from sovrin_client.agent.agent import createAgent
from sovrin_client.client.client import Client
from sovrin_client.client.wallet.wallet import Wallet
from sovrin_client.test.agent.base_agent import BaseAgent
from sovrin_client.test.agent.helper import buildFaberWallet
from sovrin_client.test.agent.test_walleted_agent import TestWalletedAgent
from sovrin_client.test.helper import TestClient
-from sovrin_client.agent.exception import NonceNotFound
-from plenum.common.constants import NAME, VERSION
-from sovrin_client.agent.agent import createAgent, runAgent
-from sovrin_client.test.conftest import primes
-from anoncreds.protocol.types import ID
+from sovrin_client.agent.agent import createAgent
logger = getlogger() | removed unwanted imports causing unnecessary dependencing to run agents | hyperledger-archives_indy-client | train | py |
e9a04489c039e197d119d55f925bff17c26f24a3 | diff --git a/programs/polemap_magic.py b/programs/polemap_magic.py
index <HASH>..<HASH> 100755
--- a/programs/polemap_magic.py
+++ b/programs/polemap_magic.py
@@ -220,6 +220,8 @@ def main():
files = {}
for key in list(FIG.keys()):
+ if len(locations) > 50:
+ locations = locations[:50]
if pmagplotlib.isServer: # use server plot naming convention
files[key] = 'LO:_' + locations + '_POLE_map.' + fmt
else: # use more readable naming convention | prevent heinously long names in polemap_magic | PmagPy_PmagPy | train | py |
12681d1101eb24a288e81c3aa64f98d7422c9b6a | diff --git a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js
index <HASH>..<HASH> 100644
--- a/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js
+++ b/packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.js
@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import compose from 'recompose/compose';
import ActionDelete from '@material-ui/icons/Delete';
import { withStyles, createStyles } from '@material-ui/core/styles';
+import { fade } from '@material-ui/core/styles/colorManipulator';
import inflection from 'inflection';
import { crudDeleteMany } from 'ra-core'; | Fic missing fade in BulkDeleteWithConfirmButton | marmelab_react-admin | train | js |
7f29afdda0fa03b227e0bd4d7c8aabd0be63f3b0 | diff --git a/lib/adapter/http.js b/lib/adapter/http.js
index <HASH>..<HASH> 100644
--- a/lib/adapter/http.js
+++ b/lib/adapter/http.js
@@ -50,6 +50,14 @@ function createRequestResponseHandler(params) {
return;
}
var connection = connectionPool.get();
+ if (!connection) {
+ // When the cluster members are changing, we cannot get
+ // actual connection for a member, so retry later.
+ setTimeout(function() {
+ processRequest();
+ }, CONNECTION_RETRY_INTERVAL);
+ return;
+ }
var wrappedConnection = new wrapper.DroongaProtocolConnectionWrapper(connection, callback, options);
if (definition.onRequest) {
try { | Don't create new connection while updating | droonga_express-droonga | train | js |
d510061b7bfc56e9b0bf75ceef6396e1bbca860f | diff --git a/librosa/onset.py b/librosa/onset.py
index <HASH>..<HASH> 100644
--- a/librosa/onset.py
+++ b/librosa/onset.py
@@ -421,7 +421,8 @@ def onset_strength_multi(y=None, sr=22050, S=None, lag=1, max_size=3,
axis=0)
# compensate for lag
- onset_env = np.pad(onset_env, (lag, 0), mode='constant')
+ onset_env = util.pad_center(onset_env, len(onset_env) + lag, mode='constant')
+ # onset_env = np.pad(onset_env, (lag, 0), mode='constant')
# Counter-act framing effects. Shift the onsets by n_fft / hop_length
if centering: | trying center-padding with lag | librosa_librosa | train | py |
68411daa179accd40d08d48d5f9ceb116f4ec9f2 | diff --git a/src/main/com/mongodb/ReplicaSetStatus.java b/src/main/com/mongodb/ReplicaSetStatus.java
index <HASH>..<HASH> 100644
--- a/src/main/com/mongodb/ReplicaSetStatus.java
+++ b/src/main/com/mongodb/ReplicaSetStatus.java
@@ -63,6 +63,12 @@ public class ReplicaSetStatus {
sb.append("{replSetName: ").append(_setName.get());
sb.append(", nextResolveTime: ").append(new Date(_updater.getNextResolveTime()).toString());
sb.append(", members: ").append(_replicaSetHolder);
+ sb.append(", updaterIntervalMS: ").append(updaterIntervalMS);
+ sb.append(", updaterIntervalNoMasterMS: ").append(updaterIntervalNoMasterMS);
+ sb.append(", slaveAcceptableLatencyMS: ").append(slaveAcceptableLatencyMS);
+ sb.append(", inetAddrCacheMS: ").append(inetAddrCacheMS);
+ sb.append(", latencySmoothFactor: ").append(latencySmoothFactor);
+ sb.append("}");
return sb.toString();
} | Added static field value to ReplicaSetStatus.toString() | mongodb_mongo-java-driver | train | java |
42bb8d552d464236d3cfef2eb0086bc0d0a9e2e7 | diff --git a/lib/Less/Node/Rule.php b/lib/Less/Node/Rule.php
index <HASH>..<HASH> 100755
--- a/lib/Less/Node/Rule.php
+++ b/lib/Less/Node/Rule.php
@@ -9,6 +9,7 @@ class Rule
public $important;
public $index;
public $inline;
+ public $variable;
public function __construct($name, $value, $important = null, $index = null, $inline = false)
{
diff --git a/lib/Less/Node/Ruleset.php b/lib/Less/Node/Ruleset.php
index <HASH>..<HASH> 100755
--- a/lib/Less/Node/Ruleset.php
+++ b/lib/Less/Node/Ruleset.php
@@ -68,6 +68,20 @@ class Ruleset
$rule = $ruleset->rules[$i];
if( $rule instanceof \Less\Node\Mixin\Call ){
$rules = $rule->compile($env);
+
+ $temp = array();
+ foreach($rules as $r){
+ if( ($r instanceof \Less\Node\Rule) && $r->variable ){
+ // do not pollute the scope if the variable is
+ // already there. consider returning false here
+ // but we need a way to "return" variable from mixins
+ if( !$ruleset->variable($r->name) ){
+ $temp[] = $r;
+ }
+ }
+ }
+ $rules = $temp;
+
array_splice($ruleset->rules, $i, 1, $rules);
$i += count($rules)-1;
$ruleset->resetCache(); | do not pollute the parent scope after mixin call if variable is defined | oyejorge_less.php | train | php,php |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.