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 |
|---|---|---|---|---|---|
b14ba49f74f45f8a379eb426074fe126f1b3ad37 | diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py
index <HASH>..<HASH> 100644
--- a/lib/svtplay_dl/__init__.py
+++ b/lib/svtplay_dl/__init__.py
@@ -66,10 +66,14 @@ def get_media(url, options):
title_tag = re.sub(r'&[^\s]*;', '', match.group(1))
if is_py3:
title = re.sub(r'[^\w\s-]', '', title_tag).strip().lower()
- options.output = re.sub(r'[-\s]+', '-', title)
+ tmp = re.sub(r'[-\s]+', '-', title)
else:
title = unicode(re.sub(r'[^\w\s-]', '', title_tag).strip().lower())
- options.output = unicode(re.sub(r'[-\s]+', '-', title))
+ tmp = "%s%s" % (options.output, unicode(re.sub(r'[-\s]+', '-', title)))
+ if options.output and os.path.isdir(options.output):
+ options.output += "/%s" % tmp
+ else:
+ options.output = tmp
stream.get(options, url) | get_media: output to dir and get automagic name again.
removed it in f<I>d<I>d. but this one is better | spaam_svtplay-dl | train | py |
03e3a3c916a6307c3782aa7f766ad37231c1cf08 | diff --git a/config/routes.rb b/config/routes.rb
index <HASH>..<HASH> 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,7 +1,7 @@
Trestle::Engine.routes.draw do
- root to: "trestle/dashboard#index"
-
Trestle.admins.each do |name, admin|
instance_eval(&admin.routes)
end
+
+ root to: "trestle/dashboard#index"
end | Set dashboard route to lower priority than admins | TrestleAdmin_trestle | train | rb |
893f90f46b21934ab2d146a783da137b7becd37b | diff --git a/safe/impact_functions/earthquake/itb_earthquake_fatality_model/test/test_itb_earthquake_fatality_model.py b/safe/impact_functions/earthquake/itb_earthquake_fatality_model/test/test_itb_earthquake_fatality_model.py
index <HASH>..<HASH> 100644
--- a/safe/impact_functions/earthquake/itb_earthquake_fatality_model/test/test_itb_earthquake_fatality_model.py
+++ b/safe/impact_functions/earthquake/itb_earthquake_fatality_model/test/test_itb_earthquake_fatality_model.py
@@ -67,7 +67,7 @@ class TestITBEarthquakeFatalityFunction(unittest.TestCase):
expected_result = {
'total_population': 200,
- 'total_fatalities': 10, # should be zero FIXME
+ 'total_fatalities': 0, # should be zero FIXME
'total_displaced': 200
}
for key_ in expected_result.keys(): | re fix test code to reflect the change in the zero fatality | inasafe_inasafe | train | py |
f4f78e7f4a0268d9919f375e754b32218d046703 | diff --git a/test/object-test.js b/test/object-test.js
index <HASH>..<HASH> 100755
--- a/test/object-test.js
+++ b/test/object-test.js
@@ -522,6 +522,13 @@ describe("bindable object", function() {
});
+ it("cannot reference a property on the bindable object if the context isn't the bindable property", function() {
+ var bindable = new BindableObject();
+ bindable.name = "craig";
+ expect(bindable.get("name")).to.be(undefined);
+ })
+
+
describe("with delays", function() {
it("can be added to a map", function() { | change @data to @__context - needs to be super private | crcn_bindable.js | train | js |
3d747844d827c5b87da9f52f7843bc0ee61a3e12 | diff --git a/lib/sidekiq-status/client_middleware.rb b/lib/sidekiq-status/client_middleware.rb
index <HASH>..<HASH> 100644
--- a/lib/sidekiq-status/client_middleware.rb
+++ b/lib/sidekiq-status/client_middleware.rb
@@ -21,7 +21,7 @@ module Sidekiq::Status
jid: msg['jid'],
status: :queued,
worker: worker_class,
- args: msg['args'].to_a.empty? ? nil : msg['args']
+ args: msg['args'].to_a.empty? ? nil : msg['args'].to_json
}
store_for_id msg['jid'], initial_metadata, @expiration, redis_pool
yield | ClientMiddleware updates
- Worker arguments converted to JSON before saving
into redis status hash to aviod Redis::CommandError | utgarda_sidekiq-status | train | rb |
eda900ddbb83dd15137eb4290e2df0c979c0a602 | diff --git a/src/Database/Schema/Builder.php b/src/Database/Schema/Builder.php
index <HASH>..<HASH> 100644
--- a/src/Database/Schema/Builder.php
+++ b/src/Database/Schema/Builder.php
@@ -306,7 +306,7 @@ class Builder
// keep lock_attributes state
$lock_attributes = (isset($collection_config['lock_attributes']))
? $collection_config['lock_attributes']
- : (isset($table_schema['lock_attributes'])) ? $table_schema['lock_attributes'] : false;
+ : ((isset($table_schema['lock_attributes'])) ? $table_schema['lock_attributes'] : false);
// add new attributes to table_schema
if (isset($collection_config['attributes'])) { | fix nested ternary syntax. | doubleleft_hook | train | php |
284c5d2b5323c665680199512756dde728bc2290 | diff --git a/tools/c7n_gcp/c7n_gcp/handler.py b/tools/c7n_gcp/c7n_gcp/handler.py
index <HASH>..<HASH> 100644
--- a/tools/c7n_gcp/c7n_gcp/handler.py
+++ b/tools/c7n_gcp/c7n_gcp/handler.py
@@ -18,8 +18,7 @@ import os
import uuid
from c7n.config import Config
-from c7n.policy import PolicyCollection
-
+from c7n.loader import PolicyLoader
# Load resource plugins
from c7n_gcp.entry import initialize_gcp
@@ -48,11 +47,13 @@ def run(event, context=None):
# merge all our options in
options = Config.empty(**options_overrides)
+ loader = PolicyLoader(options)
- policies = PolicyCollection.from_data(policy_config, options)
+ policies = loader.load_data(policy_config, 'config.json', validate=False)
if policies:
for p in policies:
log.info("running policy %s", p.name)
+ p.validate()
p.push(event, context)
return True | gcp - functions use loader for initializing policy (#<I>) | cloud-custodian_cloud-custodian | train | py |
f77a983d1b57b2dba27c64ab2589cf37e036c827 | diff --git a/lib/hocon/impl/simple_config_origin.rb b/lib/hocon/impl/simple_config_origin.rb
index <HASH>..<HASH> 100644
--- a/lib/hocon/impl/simple_config_origin.rb
+++ b/lib/hocon/impl/simple_config_origin.rb
@@ -327,7 +327,7 @@ class Hocon::Impl::SimpleConfigOrigin
def self.merge_value_origins(stack)
# stack is an array of AbstractConfigValue
origins = stack.map { |v| v.origin}
- self.class.merge_origins(origins)
+ merge_origins(origins)
end
def self.merge_origins(stack) | (maint) fix bad reference to self.class | puppetlabs_ruby-hocon | train | rb |
70c50484d8cd7aad7c142e17d3fe049d9b510303 | diff --git a/numina/array/display/polfit_residuals.py b/numina/array/display/polfit_residuals.py
index <HASH>..<HASH> 100644
--- a/numina/array/display/polfit_residuals.py
+++ b/numina/array/display/polfit_residuals.py
@@ -265,21 +265,12 @@ def polfit_residuals(
marker='x', s=srejected, color=crejected,
label="rejected")
- # shrink axes and put a legend
- box = ax2.get_position()
- ax2.set_position([box.x0, box.y0,
- box.width, box.height * 0.92])
- delta_ybox = box.height*0.15
- box = ax.get_position()
- ax.set_position([box.x0, box.y0 - delta_ybox,
- box.width, box.height * 0.92])
- ax.legend(loc=3, bbox_to_anchor=(0.0, 1.1, 1., 0.07),
- mode="expand", borderaxespad=0., ncol=4,
- numpoints=1)
+ # put a legend
+ ax.legend(numpoints=1)
# graph title
if title is not None:
- plt.title(title + "\n\n")
+ plt.title(title)
pause_debugplot(debugplot, pltshow=True, tight_layout=True) | Leave legend in plots to float around. | guaix-ucm_numina | train | py |
2f890d81eb7c675cf8438d15ae7ecb0ad035ab9b | diff --git a/Call/HttpGetHtml.php b/Call/HttpGetHtml.php
index <HASH>..<HASH> 100644
--- a/Call/HttpGetHtml.php
+++ b/Call/HttpGetHtml.php
@@ -54,6 +54,7 @@ class HttpGetHtml extends CurlCall implements ApiCallInterface
}
$curl->setopt(CURLOPT_URL, $url);
$curl->setopt(CURLOPT_COOKIE, $this->cookie);
+ $curl->setopt(CURLOPT_HTTPGET, TRUE);
$curl->setoptArray($options);
$this->curlExec($curl);
} | HttpGetHtml was not defaulting back to GET but rather staying with POST if the previous curl call was a POST. | LeaseWeb_LswApiCallerBundle | train | php |
5b5b174edace0150dd24965632ace3d215f7b136 | diff --git a/src/Backend/DrupalSubscriptionCursor.php b/src/Backend/DrupalSubscriptionCursor.php
index <HASH>..<HASH> 100644
--- a/src/Backend/DrupalSubscriptionCursor.php
+++ b/src/Backend/DrupalSubscriptionCursor.php
@@ -92,9 +92,6 @@ class DrupalSubscriptionCursor extends AbstractDrupalCursor
break;
case Field::SUB_CREATED_TS:
- if ($value instanceof \DateTime) {
- $value = $value->format(Misc::SQL_DATETIME);
- }
$query->orderBy('s.created', $direction);
break; | removed dead code, and potential php warning | makinacorpus_drupal-apubsub | train | php |
ce793d52dbafc0b012aa70492fd9ba59c465ea3c | diff --git a/envy/application.py b/envy/application.py
index <HASH>..<HASH> 100644
--- a/envy/application.py
+++ b/envy/application.py
@@ -110,7 +110,9 @@ def clean(args):
for package in os.listdir(get_envy_base() + "/{}".format(get_active_venv())):
restore_environment(package)
else:
- restore_environment(args.package[0])
+ # needs to be args.package instead of args.package[0] here-- as we can also pass --all, making package technically
+ # an optional argument, and hence we use nargs='?' instead of nargs=1.
+ restore_environment(args.package)
def restore_environment(package_name): | Fix #<I> - correctly pass package arg to restore_environment | shaunvxc_envy | train | py |
8b5780ecc21175e401018c206d323b9a74c2b940 | diff --git a/enoslib/infra/enos_chameleonkvm/schema.py b/enoslib/infra/enos_chameleonkvm/schema.py
index <HASH>..<HASH> 100644
--- a/enoslib/infra/enos_chameleonkvm/schema.py
+++ b/enoslib/infra/enos_chameleonkvm/schema.py
@@ -15,7 +15,7 @@ SCHEMA = {
"subnet": {"$ref": "#/os_subnet"},
"prefix": {"type": "string"}
},
- "additionalProperties": False,
+ "additionalProperties": True,
"required": ["resources", "key_name"],
"os_allocation_pool": {
@@ -46,7 +46,7 @@ SCHEMA = {
"name": {"type": "string"},
"cidr": {"type": "string"}
},
- "required": ["name", "cidr"],
+ "required": ["name"],
"additionalProperties": False
}, | Relax a bit the schema of Chameleon
It's shared between chameleonkvm (ckvm) and chameleonbaremetal (cbm). cbm needs
some more keys in comparison to ckvm. Logically speaking cbm inheritate from
ckvm and instead of duplicating the whole schema, we choose to relax a bit so
that this inheritance can occur also at the schema level. (It seems that there
isn't an obvious mechanism to map the inheritance from the objet layer to the
schema level). | BeyondTheClouds_enoslib | train | py |
1f1452ada9227844ddf460ca69b4f69fcf0654ef | diff --git a/src/Mongolid/ActiveRecord.php b/src/Mongolid/ActiveRecord.php
index <HASH>..<HASH> 100644
--- a/src/Mongolid/ActiveRecord.php
+++ b/src/Mongolid/ActiveRecord.php
@@ -228,4 +228,14 @@ abstract class ActiveRecord
return $this->getDataMapper()->$action($this);
}
+
+ /**
+ * Getter for the $collection attribute.
+ *
+ * @return string
+ */
+ public function getCollectionName()
+ {
+ return $this->collection;
+ }
}
diff --git a/tests/Mongolid/ActiveRecordTest.php b/tests/Mongolid/ActiveRecordTest.php
index <HASH>..<HASH> 100644
--- a/tests/Mongolid/ActiveRecordTest.php
+++ b/tests/Mongolid/ActiveRecordTest.php
@@ -262,4 +262,13 @@ class ActiveRecordTest extends TestCase
$this->assertInstanceOf(DataMapper\DataMapper::class, $result);
$this->assertEquals($schema, $result->schema);
}
+
+ public function testShouldGetCollectionName()
+ {
+ $entity = new class extends ActiveRecord {
+ public $collection = 'collection_name';
+ };
+
+ $this->assertEquals($entity->getCollectionName(), 'collection_name');
+ }
} | Added getter for $collection attribute | leroy-merlin-br_mongolid | train | php,php |
8286ef8c3ba98b27285bf8ac5cfc49ff4b58af38 | diff --git a/anyconfig/schema.py b/anyconfig/schema.py
index <HASH>..<HASH> 100644
--- a/anyconfig/schema.py
+++ b/anyconfig/schema.py
@@ -132,8 +132,7 @@ def gen_schema(node, **options):
:return: A dict represents JSON schema of this node
"""
- typemap = options["ac_schema_typemap"] \
- if "ac_schema_typemap" in options else _SIMPLETYPE_MAP
+ typemap = options.get("ac_schema_typemap", _SIMPLETYPE_MAP)
strict = options.get("ac_schema_type", False) == _STRICT_SCHEMA_TYPE
ret = dict(type="null") | refactor: simplify a conditional branch statement in .schema.gen_schema | ssato_python-anyconfig | train | py |
f0ccc0943f766f3a9ab66dbb0722d4fccb4addef | diff --git a/pysparkling/sql/expressions/aggregate/stat_aggregations.py b/pysparkling/sql/expressions/aggregate/stat_aggregations.py
index <HASH>..<HASH> 100644
--- a/pysparkling/sql/expressions/aggregate/stat_aggregations.py
+++ b/pysparkling/sql/expressions/aggregate/stat_aggregations.py
@@ -107,3 +107,11 @@ class StddevPop(SimpleStatAggregation):
def __str__(self):
return "stddev_pop({0})".format(self.column)
+
+class Skewness(SimpleStatAggregation):
+ def eval(self, row, schema):
+ return self.stat_helper.skewness
+
+ def __str__(self):
+ return "skewness({0})".format(self.column)
+ | Implement Skewness aggregation | svenkreiss_pysparkling | train | py |
0ee6cf5b6c3de67372d624967ce8153914e0781e | diff --git a/input/utils/fieldset-item.js b/input/utils/fieldset-item.js
index <HASH>..<HASH> 100644
--- a/input/utils/fieldset-item.js
+++ b/input/utils/fieldset-item.js
@@ -53,7 +53,7 @@ module.exports = FieldsetItem = function (document, relation/*, options*/) {
this.dom.classList.add('dbjs');
this.domLabel.setAttribute('for', 'input-' + this.id);
- this.input.castAttribute('id', 'input-' + this.id);
+ (this.input.control || this.input.dom).setAttribute('id', 'input-' + this.id);
this.domError.setAttribute('id', 'error-' + this.id);
this.domError.classList.add('error-message-' + | Set id on either control or container | medikoo_dbjs-dom | train | js |
67dc2759995fa498a09dce9e80d430c6ce80d3d8 | diff --git a/tag/tag.js b/tag/tag.js
index <HASH>..<HASH> 100644
--- a/tag/tag.js
+++ b/tag/tag.js
@@ -72,8 +72,7 @@ export const TagNormalBody = props => (
[getClickableContentWrapperTypeClassName({
type: props.type,
isRemovable: Boolean(props.onRemove),
- })]:
- Boolean(props.onClick) && !props.isDisabled,
+ })]: Boolean(props.onClick) && !props.isDisabled,
[styles.clickableContentWrapper]:
!props.isDisabled && Boolean(props.onClick),
[styles.disabledContent]: props.isDisabled, | chore: apply prettier to js | commercetools_ui-kit | train | js |
e194a6b00e5505450b4ea2cdcd04ba6c9b69ec3a | diff --git a/src/Label.php b/src/Label.php
index <HASH>..<HASH> 100644
--- a/src/Label.php
+++ b/src/Label.php
@@ -9,24 +9,9 @@ use CultuurNet\Entry\Keyword;
class Label extends Keyword
{
- /**
- * @var bool
- */
- protected $visible;
-
- /**
- * @return boolean
- */
- public function isVisible()
- {
- return $this->visible;
- }
-
public function __construct($value, $visible = true)
{
- parent::__construct($value);
-
- $this->visible = $visible;
+ parent::__construct($value, $visible);
}
/** | III-<I>: Adapt Label to the changes to Keyword | cultuurnet_udb3-php | train | php |
52c27a0a27e8a7c14b7e1c163a1841df63e300ae | diff --git a/src/main/java/com/cloudesire/tisana4j/RestClient.java b/src/main/java/com/cloudesire/tisana4j/RestClient.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/cloudesire/tisana4j/RestClient.java
+++ b/src/main/java/com/cloudesire/tisana4j/RestClient.java
@@ -996,6 +996,13 @@ public class RestClient implements RestClientInterface
this.mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, flag );
}
+ @Deprecated
+ @Override
+ public ObjectMapper getObjectMapper()
+ {
+ return mapper;
+ }
+
@Override
public void setObjectMapper( ObjectMapper mapper )
{
diff --git a/src/main/java/com/cloudesire/tisana4j/RestClientInterface.java b/src/main/java/com/cloudesire/tisana4j/RestClientInterface.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/cloudesire/tisana4j/RestClientInterface.java
+++ b/src/main/java/com/cloudesire/tisana4j/RestClientInterface.java
@@ -113,5 +113,7 @@ public interface RestClientInterface
void setObjectMapperFailOnUknownField( boolean flag );
+ ObjectMapper getObjectMapper();
+
void setObjectMapper( ObjectMapper mapper );
} | Reintroduce getObjectMapper as a deprecated method | ClouDesire_tisana4j | train | java,java |
24be83798066a23b2e9020812795c77b51e3dbfa | diff --git a/stremio-addon/addon.js b/stremio-addon/addon.js
index <HASH>..<HASH> 100644
--- a/stremio-addon/addon.js
+++ b/stremio-addon/addon.js
@@ -107,9 +107,9 @@ var service = new Stremio.Server({
},
"stats.get": function(args, callback, user) { // TODO
var c = Object.keys(db.indexes.seeders).length;
- callback(null, [
+ callback(null, { stats: [
{ name: "number of torrents - "+c, count: c, colour: "green" }
- ]);
+ ] });
},
}, { allow: [cfg.stremioCentral], secret: cfg.stremioSecret }, _.extend(require("./stremio-manifest"), _.pick(require("../package"), "version"))); | stats must be wrapped in stats.get | jaruba_multipass-torrent | train | js |
127ca542318c4f1201ce564b701a5babdc82e81a | diff --git a/Tests/ApplicationTest.php b/Tests/ApplicationTest.php
index <HASH>..<HASH> 100644
--- a/Tests/ApplicationTest.php
+++ b/Tests/ApplicationTest.php
@@ -66,6 +66,9 @@ class ApplicationTest extends Base
}
}
+ /**
+ * @psalm-suppress AbstractInstantiation
+ */
final public function DataProviderDaftConsoleCommands() : Generator
{
/** | suppressing abstract instantiation, as psalm does not presently pick up on the reflection | SignpostMarv_daft-framework | train | php |
36ba1ed15dc9b2c15ec753991a2a9cfe72dc5256 | diff --git a/tests/unit/components/sl-radio-group-test.js b/tests/unit/components/sl-radio-group-test.js
index <HASH>..<HASH> 100644
--- a/tests/unit/components/sl-radio-group-test.js
+++ b/tests/unit/components/sl-radio-group-test.js
@@ -28,8 +28,8 @@ test( 'Event handlers are registered and unregistered', function( assert ) {
const radioButtonsArray = this.$( 'input:radio' ).toArray();
const matchElements = sinon.match( ( elements ) => {
- return elements.toArray().every( function( element ) {
- const found = radioButtonsArray.find( ( radioElement ) => {
+ return radioButtonsArray.every( function( element ) {
+ const found = elements.toArray().find( ( radioElement ) => {
return element === radioElement;
}); | Changed order of looping arrays closes#<I> | softlayer_sl-ember-components | train | js |
70c11cd0237118b59093fa67747850ad2b736bd7 | diff --git a/oled/device.py b/oled/device.py
index <HASH>..<HASH> 100644
--- a/oled/device.py
+++ b/oled/device.py
@@ -342,7 +342,6 @@ class pygame(device, mixin.noop, mixin.capabilities):
"""
Takes an image and renders it to a pygame display surface.
"""
- assert(image.mode == self.mode)
assert(image.size[0] == self.width)
assert(image.size[1] == self.height) | Don't enforce the mode - it will be converted to RGB anyway | rm-hull_luma.oled | train | py |
525a14100be26a89185421657989616c3711eedc | diff --git a/examples/debiangraph.py b/examples/debiangraph.py
index <HASH>..<HASH> 100644
--- a/examples/debiangraph.py
+++ b/examples/debiangraph.py
@@ -29,7 +29,7 @@ from pyArango.graph import *
from pyArango.theExceptions import *
# Configure your ArangoDB server connection here
-conn = Connection(arangoURL="http://localhost:8529", username="USERNAME", password="SECRET")
+conn = Connection(arangoURL="http://localhost:8529", username="root", password="")
db = None
edgeCols = {} | make username/passvoid better findeable ;-) | ArangoDB-Community_pyArango | train | py |
a4c77f88d0ca52b9c236c95a16b2a527f811c0e6 | diff --git a/searx/utils.py b/searx/utils.py
index <HASH>..<HASH> 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -206,7 +206,13 @@ def format_date_by_locale(date, locale_string):
if locale_string == 'all':
locale_string = settings['ui']['default_locale'] or 'en_US'
- return format_date(date, locale=locale_string)
+ # to avoid crashing if locale is not supported by babel
+ try:
+ formatted_date = format_date(date, locale=locale_string)
+ except:
+ formatted_date = format_date(date, "YYYY-MM-dd")
+
+ return formatted_date
def dict_subset(d, properties): | [fix] exception if locale doesn't have a date format
occitan, for example | asciimoo_searx | train | py |
16cb1e0bc338830cb5c7eec937c9153e20d27b71 | diff --git a/lib/eye/patch.rb b/lib/eye/patch.rb
index <HASH>..<HASH> 100644
--- a/lib/eye/patch.rb
+++ b/lib/eye/patch.rb
@@ -8,7 +8,7 @@ rescue LoadError
end
begin
- require "eye/notify/aws_sdk"
+ require "eye/notify/awssdk"
rescue LoadError
# Don't worry about loading the aws_sdk notifier when
# `aws-sdk-core` is unavailable | properly reference the awssdk.rb file | tablexi_eye-patch | train | rb |
53061b947cde4cc036ee63a635cab46924b0a91e | diff --git a/hypertools/datageometry.py b/hypertools/datageometry.py
index <HASH>..<HASH> 100644
--- a/hypertools/datageometry.py
+++ b/hypertools/datageometry.py
@@ -214,16 +214,16 @@ class DataGeometry(object):
# put geo vars into a dict
geo = {
- 'data' : data,
- 'xform_data' : np.array(self.xform_data),
- 'reduce' : self.reduce,
- 'align' : self.align,
- 'normalize' : self.normalize,
- 'semantic' : self.semantic,
- 'corpus' : np.array(self.corpus) if isinstance(self.corpus, list) else self.corpus,
- 'kwargs' : self.kwargs,
- 'version' : self.version,
- 'dtype' : self.dtype
+ 'data': data,
+ 'xform_data': self.xform_data,
+ 'reduce': self.reduce,
+ 'align': self.align,
+ 'normalize': self.normalize,
+ 'semantic': self.semantic,
+ 'corpus': self.corpus,
+ 'kwargs': self.kwargs,
+ 'version': self.version,
+ 'dtype': self.dtype
}
# if extension wasn't included, add it | don't wrap lists in numpy arrays (less efficient with pickle | ContextLab_hypertools | train | py |
f259273d4da11ff18fd86da72920df78e62b5c2e | diff --git a/lib/rjr/node.rb b/lib/rjr/node.rb
index <HASH>..<HASH> 100644
--- a/lib/rjr/node.rb
+++ b/lib/rjr/node.rb
@@ -138,7 +138,7 @@ class Node
#
# @return self
def halt
- em.stop_event_loop
+ em.halt
tp.stop
self
end
diff --git a/lib/rjr/util/em_adapter.rb b/lib/rjr/util/em_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/rjr/util/em_adapter.rb
+++ b/lib/rjr/util/em_adapter.rb
@@ -48,7 +48,7 @@ class EMAdapter
#
# @return self
def halt
- self.stop_event_loop if self.reactor_running?
+ EventMachine.stop_event_loop if EventMachine.reactor_running?
self
end | Correctly call stop_event_loop during halt operation | movitto_rjr | train | rb,rb |
ec64949a08ef9f0e2db824dccda0fe9080b9df53 | diff --git a/py3status/modules/taskwarrior.py b/py3status/modules/taskwarrior.py
index <HASH>..<HASH> 100644
--- a/py3status/modules/taskwarrior.py
+++ b/py3status/modules/taskwarrior.py
@@ -13,7 +13,7 @@ Format placeholders:
Requires
task: https://taskwarrior.org/download/
-@author James Smith http://jazmit.github.io/
+@author James Smith https://jazmit.github.io
@license BSD
SAMPLE OUTPUT | taskwarrior: replace http with secure https | ultrabug_py3status | train | py |
c7f87edcdd0eb22cfa6e5d8e9af842c30534dd59 | diff --git a/test/autofit/test_non_linear.py b/test/autofit/test_non_linear.py
index <HASH>..<HASH> 100644
--- a/test/autofit/test_non_linear.py
+++ b/test/autofit/test_non_linear.py
@@ -1,6 +1,7 @@
import os
import shutil
from functools import wraps
+import itertools
import pytest
from autolens import conf
@@ -1323,6 +1324,7 @@ class TestLabels(object):
r'x4p2_{\mathrm{a1}}', r'x4p3_{\mathrm{a1}}']
def test_real_class(self, label_optimizer):
+ mass_profiles.EllipticalMassProfile._ids = itertools.count()
label_optimizer.variable.mass_profile = mass_profiles.EllipticalSersic
labels = label_optimizer.paramnames_labels | resetting _id/component number for testing | Jammy2211_PyAutoLens | train | py |
aeebc17d2a7d96668f37a2153f0671e1abaa0994 | diff --git a/lib/term.js b/lib/term.js
index <HASH>..<HASH> 100644
--- a/lib/term.js
+++ b/lib/term.js
@@ -1449,7 +1449,7 @@ Term.prototype.object = function() {
term._query.push(termTypes.OBJECT)
var args = [];
for(var i=0; i<_args.length; i++) {
- args.push(new Term(this._r).expr(_args[i])._wrap()._query)
+ args.push(new Term(this._r).expr(_args[i])._query)
}
term._query.push(args)
return term; | r.object shouldn't wrap for implicit terms. Fix #<I> | mbroadst_rethunk | train | js |
c466699e42cf67c76ae982e1722a24b1484c50cd | diff --git a/rdfunit-validate/src/test/java/org/aksw/rdfunit/validate/integration/PatternsGeneratorsIntegrationTest.java b/rdfunit-validate/src/test/java/org/aksw/rdfunit/validate/integration/PatternsGeneratorsIntegrationTest.java
index <HASH>..<HASH> 100644
--- a/rdfunit-validate/src/test/java/org/aksw/rdfunit/validate/integration/PatternsGeneratorsIntegrationTest.java
+++ b/rdfunit-validate/src/test/java/org/aksw/rdfunit/validate/integration/PatternsGeneratorsIntegrationTest.java
@@ -111,6 +111,8 @@ public class PatternsGeneratorsIntegrationTest {
} else {
assertEquals(executionType + ": Failed test cases not as expected for " + resource, failedTestCases, overviewResults.getFailedTests());
}
+
+ assertEquals(executionType + ": There should be no failed test cases for " + resource, 0, overviewResults.getErrorTests());
}
} | check for test cases that returned an Error | AKSW_RDFUnit | train | java |
b64499207f6fbced3fac4c31c35b4c00589730c2 | diff --git a/montblanc/tests/test_meq_tf.py b/montblanc/tests/test_meq_tf.py
index <HASH>..<HASH> 100644
--- a/montblanc/tests/test_meq_tf.py
+++ b/montblanc/tests/test_meq_tf.py
@@ -116,7 +116,7 @@ def get_point_sources(nsrc):
Q[:] = rf(size=Q.shape)*0.1
U[:] = rf(size=U.shape)*0.1
V[:] = rf(size=V.shape)*0.1
- I[:] = np.sqrt(Q**2 + U**2 + V**2)
+ I[:] = np.sqrt(Q**2 + U**2 + V**2)*1.5 + rf(size=I.shape)*0.1
# Zero and invert selected stokes parameters
if nsrc > 0: | Make radiation non-coherent
to make the test case more representative | ska-sa_montblanc | train | py |
2d8598122acbb1bf1cd9e444cdf59dabfa9317d3 | diff --git a/mocket/mocket.py b/mocket/mocket.py
index <HASH>..<HASH> 100644
--- a/mocket/mocket.py
+++ b/mocket/mocket.py
@@ -94,7 +94,6 @@ class FakeSSLContext(SuperFakeSSLContext):
return sock
def wrap_bio(self, incoming, outcoming, *args, **kwargs):
- # FIXME: fake SSLObject implementation
ssl_obj = MocketSocket()
ssl_obj._host = kwargs['server_hostname']
return ssl_obj | Removing old FIXME. | mindflayer_python-mocket | train | py |
ae64fdbee744eac51f8ea8a4798979596b4a06ec | diff --git a/pulsarpy/submit_to_dcc.py b/pulsarpy/submit_to_dcc.py
index <HASH>..<HASH> 100644
--- a/pulsarpy/submit_to_dcc.py
+++ b/pulsarpy/submit_to_dcc.py
@@ -387,6 +387,17 @@ class Submit():
payload["size_range"] = rec.size_range
payload["strand_specificity"] = rec.strand_specific
payload["source"] = rec.vendor["id"]
+
+ def post_single_cell_sorting(self, rec_id, patch=False)
+ rec = models.SingleCellSorting(rec_id)
+ aliases = []
+ aliases.append(rec.abbrev_id())
+ name = rec.name
+ if name:
+ aliases.append(self.clean_name(name))
+ payload = {}
+ payload["aliases"] = aliases
+ sreqs = rec.sequencing_requests | Started method to post single_cell_sortings | nathankw_pulsarpy | train | py |
914c805ad2baf97b3c574a650490f2ed9dcfaf58 | diff --git a/lib/sprockets/sass_template.rb b/lib/sprockets/sass_template.rb
index <HASH>..<HASH> 100644
--- a/lib/sprockets/sass_template.rb
+++ b/lib/sprockets/sass_template.rb
@@ -27,7 +27,7 @@ module Sprockets
cache_store: SassCacheStore.new(input[:cache]),
load_paths: input[:environment].paths,
sprockets: {
- context: input[:context],
+ context: input[:environment].context_class.new(input),
environment: input[:environment]
}
} | Initialize fresh context for sass template | rails_sprockets | train | rb |
b462865bcba79f1db500777ac4b6556f377d18cb | diff --git a/lib/socket.js b/lib/socket.js
index <HASH>..<HASH> 100644
--- a/lib/socket.js
+++ b/lib/socket.js
@@ -586,12 +586,22 @@ Socket.prototype.close = function () {
close();
}
+ function waitForUpgrade() {
+ // wait for upgrade to finish since we can't send packets while pausing a transport
+ self.once('upgrade', cleanupAndClose);
+ self.once('upgradeError', cleanupAndClose);
+ }
+
if (this.writeBuffer.length) {
- this.once('drain', close);
+ this.once('drain', function() {
+ if (this.upgrading) {
+ waitForUpgrade();
+ } else {
+ close();
+ }
+ });
} else if (this.upgrading) {
- // wait for upgrade to finish since we can't send packets while pausing a transport
- this.once('upgrade', cleanupAndClose);
- this.once('upgradeError', cleanupAndClose);
+ waitForUpgrade();
} else {
close();
} | Fixed transport close deferring logic.
Transport can still be upgrading after deferring until the drain event. | socketio_engine.io-client | train | js |
1af6b8c42a532343f22c2aafadbf55ee1b53b5dc | diff --git a/shared/api/url.go b/shared/api/url.go
index <HASH>..<HASH> 100644
--- a/shared/api/url.go
+++ b/shared/api/url.go
@@ -57,7 +57,7 @@ func (u *URL) Project(projectName string) *URL {
// Target sets the "target" query parameter in the URL if the clusterMemberName is not empty or "default".
func (u *URL) Target(clusterMemberName string) *URL {
- if clusterMemberName != "" {
+ if clusterMemberName != "" && clusterMemberName != "none" {
queryArgs := u.Query()
queryArgs.Add("target", clusterMemberName)
u.RawQuery = queryArgs.Encode() | shared/api/url: Don't allow 'none' as target | lxc_lxd | train | go |
cfd9d789d301f3c1d74afe5a63e6c872ecefede0 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -100,7 +100,8 @@ with readme_file:
with changes_file:
long_description = readme_file.read() + '\n' + changes_file.read()
-package_data = {'setuptools': ['site-patch.py']}
+package_data = {
+ 'setuptools': ['script (dev).tmpl', 'script.tmpl', 'site-patch.py']}
force_windows_specific_files = (
os.environ.get("SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES")
not in (None, "", "0") | Include the script template files - fixes #<I>
The rename of the script template files to be .tmpl put them
into the realm of package data, rather than python files that
would be bundled automatically. Include them specifically in
package data so that they'll actually be installed. | pypa_setuptools | train | py |
a947386ceed8aabbd5186467c57be327671af7ba | diff --git a/src/transformers/models/auto/tokenization_auto.py b/src/transformers/models/auto/tokenization_auto.py
index <HASH>..<HASH> 100644
--- a/src/transformers/models/auto/tokenization_auto.py
+++ b/src/transformers/models/auto/tokenization_auto.py
@@ -369,7 +369,13 @@ class AutoTokenizer:
if tokenizer_class_fast and (use_fast or tokenizer_class_py is None):
return tokenizer_class_fast.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
else:
- return tokenizer_class_py.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
+ if tokenizer_class_py is not None:
+ return tokenizer_class_py.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
+ else:
+ raise ValueError(
+ "This tokenizer cannot be instantiated. Please make sure you have `sentencepiece` installed "
+ "in order to use this tokenizer."
+ )
raise ValueError(
"Unrecognized configuration class {} to build an AutoTokenizer.\n" | Better warning when loading a tokenizer with AutoTokenizer w/o SnetencePiece (#<I>) | huggingface_pytorch-pretrained-BERT | train | py |
cd0d00887767bf23b09d73c55544b158dcdeb4f6 | diff --git a/src/Middleware/EmbeddedMiddleware.php b/src/Middleware/EmbeddedMiddleware.php
index <HASH>..<HASH> 100644
--- a/src/Middleware/EmbeddedMiddleware.php
+++ b/src/Middleware/EmbeddedMiddleware.php
@@ -60,7 +60,12 @@ class EmbeddedMiddleware extends AbstractMiddleware
public function getCallable()
{
- return $this->getInvokable()->getCallable();
+ $invokable = $this->getInvokable();
+ if($application = $this->getApplication()) {
+ $invokable->setApplication($this->getApplication());
+ }
+
+ return $invokable->getCallable();
} | Inject application in invokables embedded in EmbeddedMiddleware | objective-php_application | train | php |
5618f69ff4e2bffac643dd29b52de7fba3b3970c | diff --git a/flubber/loop.py b/flubber/loop.py
index <HASH>..<HASH> 100644
--- a/flubber/loop.py
+++ b/flubber/loop.py
@@ -36,6 +36,7 @@ def get_loop():
class Handler(object):
+ __slots__ = ('_callback', '_args', '_kwargs', '_cancelled')
def __init__(self, callback, args=(), kwargs={}):
self._callback = callback
@@ -61,6 +62,7 @@ class Handler(object):
class Timer(Handler):
+ __slots__ = ('_timer')
def __init__(self, callback, args=(), kwargs={}, timer=None):
super(Timer, self).__init__(callback, args, kwargs) | Added __slots__ to Handler and Timer objects | saghul_evergreen | train | py |
d5afee3675e6bcc00efd702d237a8c593d811e38 | diff --git a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java
index <HASH>..<HASH> 100644
--- a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java
+++ b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java
@@ -64,7 +64,7 @@ public class GermanSpellerRule extends CompoundAwareHunspellRule {
// some exceptions for changes to the spelling in 2017 - just a workaround so we don't have to touch the binary dict:
private static final Pattern PREVENT_SUGGESTION = Pattern.compile(
- ".*(?i:Majonäse|Bravur|Anschovis|Belkanto|Campagne|Frotté|Grisli|Jockei|Joga|Kalvinismus|Kanossa|Kargo|Ketschup|" +
+ ".*(Majonäse|Bravur|Anschovis|Belkanto|Campagne|Frotté|Grisli|Jockei|Joga|Kalvinismus|Kanossa|Kargo|Ketschup|" +
"Kollier|Kommunikee|Masurka|Negligee|Nessessär|Poulard|Varietee|Wandalismus|kalvinist).*");
private final Set<String> wordsToBeIgnoredInCompounds = new HashSet<>(); | [de] exceptions are case-sensitive now, as "Kolier" otherwise hides the suggestions for misspelled "protokolieren", being a substring of it (#<I>) | languagetool-org_languagetool | train | java |
af081250d18c0048089b26b63f9c14dbc1f1bb36 | diff --git a/src/phenomic-loader/minify.js b/src/phenomic-loader/minify.js
index <HASH>..<HASH> 100644
--- a/src/phenomic-loader/minify.js
+++ b/src/phenomic-loader/minify.js
@@ -4,7 +4,7 @@ export default (
): PhenomicCollection => {
if (!Array.isArray(collection)) {
throw new Error(
- `minify except a valid collection instead of ${ typeof collection }`
+ `minify expect a valid collection instead of ${ typeof collection }`
)
} | Fix typo error in phenomic/loader/minify.js (#<I>) | phenomic_phenomic | train | js |
dfcc6c961066cbe841e044406c6ba39901727f06 | diff --git a/lib/pdk/module/update_manager.rb b/lib/pdk/module/update_manager.rb
index <HASH>..<HASH> 100644
--- a/lib/pdk/module/update_manager.rb
+++ b/lib/pdk/module/update_manager.rb
@@ -86,13 +86,13 @@ module PDK
files_to_write = @added_files
files_to_write += @modified_files.reject { |file| @diff_cache[file[:path]].nil? }
- files_to_write.each do |file|
- write_file(file[:path], file[:content])
- end
-
@removed_files.each do |file|
unlink_file(file)
end
+
+ files_to_write.each do |file|
+ write_file(file[:path], file[:content])
+ end
end
private | Delete files before writing into them
If a template rolls out one of the files we would delete in the regular
course of action, it should be there after the conversion. | puppetlabs_pdk | train | rb |
c993e9bed690873b65809b40b0843b430051336c | diff --git a/registry/response/terraform_provider.go b/registry/response/terraform_provider.go
index <HASH>..<HASH> 100644
--- a/registry/response/terraform_provider.go
+++ b/registry/response/terraform_provider.go
@@ -45,13 +45,14 @@ type TerraformProviderPlatform struct {
// structure for a provider platform with all details required to perform a
// download.
type TerraformProviderPlatformLocation struct {
- OS string `json:"os"`
- Arch string `json:"arch"`
- Filename string `json:"filename"`
- DownloadURL string `json:"download_url"`
- ShasumsURL string `json:"shasums_url"`
- ShasumsSignatureURL string `json:"shasums_signature_url"`
- Shasum string `json:"shasum"`
+ Protocols []string `json:"protocols"`
+ OS string `json:"os"`
+ Arch string `json:"arch"`
+ Filename string `json:"filename"`
+ DownloadURL string `json:"download_url"`
+ ShasumsURL string `json:"shasums_url"`
+ ShasumsSignatureURL string `json:"shasums_signature_url"`
+ Shasum string `json:"shasum"`
SigningKeys SigningKeyList `json:"signing_keys"`
} | registry/response: Add protocols to DL resp | hashicorp_terraform | train | go |
c6819e0450d46474f5124ecca8caa776b5c15792 | diff --git a/src/client.js b/src/client.js
index <HASH>..<HASH> 100644
--- a/src/client.js
+++ b/src/client.js
@@ -490,7 +490,7 @@ MatrixClient.prototype.rehydrateDevice = async function() {
},
);
} catch (e) {
- logger.info("could not get dehydrated device", e);
+ logger.info("could not get dehydrated device", e.toString());
return;
} | Omit stack trace if rehydration fails | matrix-org_matrix-js-sdk | train | js |
813d8ea4b5bbbd1d6564d56b35e4f6ba31e07ad5 | diff --git a/test/dnsimple.spec.js b/test/dnsimple.spec.js
index <HASH>..<HASH> 100644
--- a/test/dnsimple.spec.js
+++ b/test/dnsimple.spec.js
@@ -18,12 +18,12 @@ describe('dnsimple module', function() {
describe('#setUserAgent', function() {
it('respects the default User-Agent', function() {
- expect(dnsimple._api.userAgent).to.equal('dnsimple-node/v2');
+ expect(dnsimple._api.userAgent).to.equal('dnsimple-node/2.4.0');
});
it('composes the User-Agent', function() {
dnsimple.setUserAgent('my-app');
- expect(dnsimple._api.userAgent).to.equal('dnsimple-node/v2 my-app');
+ expect(dnsimple._api.userAgent).to.equal('dnsimple-node/2.4.0 my-app');
});
}); | Update User-Agent version in tests | dnsimple_dnsimple-node | train | js |
294927a8a9feb1699117d580b409eae15bef72c1 | diff --git a/tests/test_decode.py b/tests/test_decode.py
index <HASH>..<HASH> 100644
--- a/tests/test_decode.py
+++ b/tests/test_decode.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from bencoder import bdecode
+from bencoder import bdecode, bdecode2
import os
import sys
@@ -10,6 +10,12 @@ TORRENT_PATH = os.path.join(
)
+def test_decode2():
+ decoded, length = bdecode2(b'6:WWWWWWi233e')
+ assert decoded == b'WWWWWW'
+ assert length == 8
+
+
def test_decode_str(benchmark):
assert benchmark(bdecode, b'6:WWWWWW') == b"WWWWWW" | Add test for bdecode2 | whtsky_bencoder.pyx | train | py |
b8cbaaece9b1fc38c8d9969986eacbf4af4ead6c | diff --git a/src/sap.m/src/sap/m/OverflowToolbarAssociativePopover.js b/src/sap.m/src/sap/m/OverflowToolbarAssociativePopover.js
index <HASH>..<HASH> 100644
--- a/src/sap.m/src/sap/m/OverflowToolbarAssociativePopover.js
+++ b/src/sap.m/src/sap/m/OverflowToolbarAssociativePopover.js
@@ -186,6 +186,7 @@ sap.ui.define(['./Popover', './PopoverRenderer', './OverflowToolbarAssociativePo
}
oPosParams._fMarginBottom = oPosParams._fDocumentHeight - oPosParams._$parent.offset().top + this._arrowOffset + oPosParams._fOffsetY;
+ return oPosParams;
};
/** | [INTERNAL] Changes in the popover computation lead to exposing this issue.
- The oPosParams are not returned in some case which looks like a miss and leads to error now.
Change-Id: I<I>b<I>f<I>d<I>b4c<I>ca8d<I>cec0a9f<I>ac6 | SAP_openui5 | train | js |
033b4d5e1bc82f276cf1ba1e61f0ea117cca02a3 | diff --git a/src/toil/test/sort/sortTest.py b/src/toil/test/sort/sortTest.py
index <HASH>..<HASH> 100755
--- a/src/toil/test/sort/sortTest.py
+++ b/src/toil/test/sort/sortTest.py
@@ -73,9 +73,9 @@ class SortTest(ToilTest, MesosTestSupport, ParasolTestSupport):
self.inputFile = os.path.join(self.tempDir, "fileToSort.txt")
def tearDown(self):
- ToilTest.tearDown(self)
if os.path.exists(self.tempDir):
shutil.rmtree(self.tempDir)
+ ToilTest.tearDown(self)
def _toilSort(self, jobStoreLocator, batchSystem,
lines=defaultLines, N=defaultN, testNo=1, lineLen=defaultLineLen, | tearDown after removing the folder. | DataBiosphere_toil | train | py |
458f8a30c3d7e89612c663ae39c388d06fcd9725 | diff --git a/src/Object/Klip/Klip.php b/src/Object/Klip/Klip.php
index <HASH>..<HASH> 100644
--- a/src/Object/Klip/Klip.php
+++ b/src/Object/Klip/Klip.php
@@ -21,6 +21,20 @@ class Klip extends BaseApiResource
'id', 'company', 'date_created', 'last_updated', 'created_by', 'share_rights'
];
+
+ /**
+ * BaseApiResource constructor.
+ * @param array $data
+ */
+ public function __construct(array $data = [])
+ {
+ parent::__construct($data);
+
+ if(isset($this->schema)){
+ $this->schema = new KlipSchema($this->schema);
+ }
+ }
+
/**
* @param $name
* @return $this | S<I> Auto resolve KlipSchema to Klips | ExpandOnline_klipfolio-api-php | train | php |
a962ea3bd987ce1c6f024024c93cb292a031a533 | diff --git a/revel.go b/revel.go
index <HASH>..<HASH> 100644
--- a/revel.go
+++ b/revel.go
@@ -227,6 +227,17 @@ func getLogger(name string) *log.Logger {
output = os.DevNull
}
+ logPath := filepath.Dir(output)
+ if _, err := os.Stat(logPath); err != nil {
+ if os.IsNotExist(err) {
+ if err := os.MkdirAll(logPath, 0777); err != nil {
+ log.Fatalln("Failed to create log dir", output, ":", err)
+ }
+ } else {
+ log.Fatalln("Failed to stat log dir", output, ":", err)
+ }
+ }
+
file, err := os.OpenFile(output, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
log.Fatalln("Failed to open log file", output, ":", err) | create the log directory if it does not already exist | revel_revel | train | go |
f17fedad8eb30e1e107354b9bbf6ef6209e11b94 | diff --git a/jquery-loadTemplate/jquery.loadTemplate-1.2.0.js b/jquery-loadTemplate/jquery.loadTemplate-1.2.0.js
index <HASH>..<HASH> 100644
--- a/jquery-loadTemplate/jquery.loadTemplate-1.2.0.js
+++ b/jquery-loadTemplate/jquery.loadTemplate-1.2.0.js
@@ -361,7 +361,7 @@
formatter = $elem.attr("data-format");
if (formatter && typeof formatters[formatter] === "function") {
var formatOptions = $elem.attr("data-format-options");
- return formatters[formatter](value, formatOptions);
+ return formatters[formatter].call($elem[0],value, formatOptions);
}
} | Pass element to formatter function
let others control elements as well as values associated with template
formatters by passing element as this to to the formatter function | codepb_jquery-template | train | js |
3cb206f57595e24fbd944d1ab229d1c941b21404 | diff --git a/lib/datalib.php b/lib/datalib.php
index <HASH>..<HASH> 100644
--- a/lib/datalib.php
+++ b/lib/datalib.php
@@ -717,7 +717,7 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
$params = array();
$i = 0;
- $concat = $DB->sql_concat("COALESCE(c.summary, ". $DB->sql_empty() .")", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
+ $concat = $DB->sql_concat("COALESCE(c.summary, '". $DB->sql_empty() ."')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
foreach ($searchterms as $searchterm) {
$i++; | MDL-<I> course search - emergency regression fix | moodle_moodle | train | php |
a5e84336eea19ef47b4bc875813cf4edf55f362a | diff --git a/driver/src/main/java/org/neo4j/driver/internal/connector/socket/SocketClient.java b/driver/src/main/java/org/neo4j/driver/internal/connector/socket/SocketClient.java
index <HASH>..<HASH> 100644
--- a/driver/src/main/java/org/neo4j/driver/internal/connector/socket/SocketClient.java
+++ b/driver/src/main/java/org/neo4j/driver/internal/connector/socket/SocketClient.java
@@ -109,7 +109,14 @@ public class SocketClient
}
catch ( IOException e )
{
- throw new ClientException( "Unable to close socket connection properly." + e.getMessage(), e );
+ if( e.getMessage().equals( "An existing connection was forcibly closed by the remote host" ) )
+ {
+ // Swallow this exception as it is caused by connection already closed by server
+ }
+ else
+ {
+ throw new ClientException("Unable to close socket connection properly." + e.getMessage(), e);
+ }
}
} | Mute IOE in socket.close caused by server get killed | neo4j_neo4j-java-driver | train | java |
2aaa249ab824b4c882752b11b469e72c86fcae45 | diff --git a/src/FeedIo/Rule/DateTimeBuilder.php b/src/FeedIo/Rule/DateTimeBuilder.php
index <HASH>..<HASH> 100644
--- a/src/FeedIo/Rule/DateTimeBuilder.php
+++ b/src/FeedIo/Rule/DateTimeBuilder.php
@@ -150,7 +150,7 @@ class DateTimeBuilder
if (false === strtotime($string)) {
throw new \InvalidArgumentException('Impossible to convert date : '.$string);
}
- $date = new \DateTime($string);
+ $date = new \DateTime($string, $this->getFeedTimezone());
$date->setTimezone($this->getTimezone());
return $date; | Sometimes we need to set the timezone for non-standards date | alexdebril_feed-io | train | php |
f9be0bc5f7da4f0e7bff966099096afa8b1ab5db | diff --git a/lib/byebug.rb b/lib/byebug.rb
index <HASH>..<HASH> 100644
--- a/lib/byebug.rb
+++ b/lib/byebug.rb
@@ -102,11 +102,7 @@ module Byebug
Byebug.const_set('INITIAL_DIR', Dir.pwd) unless defined? Byebug::INITIAL_DIR
end
Byebug.tracing = options[:tracing] unless options[:tracing].nil?
- if Byebug.started?
- retval = block && block.call(self)
- else
- retval = Byebug._start(&block)
- end
+ retval = Byebug._start(&block)
post_mortem if options[:post_mortem]
return retval
end | Same behaviour is implemented in _start | deivid-rodriguez_byebug | train | rb |
84fc5262b2781ff840a475cf1123919a4013c7ed | diff --git a/lib/uirusu/vturl.rb b/lib/uirusu/vturl.rb
index <HASH>..<HASH> 100644
--- a/lib/uirusu/vturl.rb
+++ b/lib/uirusu/vturl.rb
@@ -38,9 +38,10 @@ module Uirusu
params = {
apikey: api_key,
- resource: resource
+ url: resource
}
- Uirusu.query_api SCAN_URL, params
+
+ Uirusu.query_api SCAN_URL, params, true
end
# Searches reports by URL from Virustotal.com
@@ -58,7 +59,8 @@ module Uirusu
apikey: api_key,
resource: resource
}
- Uirusu.query_api REPORT_URL, params.merge!(args)
+
+ Uirusu.query_api REPORT_URL, params.merge!(args), true
end
# Searches reports by URL from Virustotal.com | Fixed URL api
It had the wrong parameter and wasn’t a post | hammackj_uirusu | train | rb |
3fb9ba86f2fd7c79da73aab19dd5d351ba3ea3c6 | diff --git a/lib/ui/labels/tests/removable-label-spec.js b/lib/ui/labels/tests/removable-label-spec.js
index <HASH>..<HASH> 100644
--- a/lib/ui/labels/tests/removable-label-spec.js
+++ b/lib/ui/labels/tests/removable-label-spec.js
@@ -9,7 +9,7 @@ describe('avRemovableLabel', function() {
});
beforeEach(inject(function($templateCache) {
- $templateCache.put('ui/removable-label/removable-label-tpl.html', '');
+ $templateCache.put('ui/labels/removable-label-tpl.html', '');
}));
availity.mock.directiveSpecHelper(); | fix label test
* broke on refactor | Availity_availity-angular | train | js |
a660af794bfcc4797fb99ad33c2c8b9ba0635aac | diff --git a/lib/CancellationToken.php b/lib/CancellationToken.php
index <HASH>..<HASH> 100644
--- a/lib/CancellationToken.php
+++ b/lib/CancellationToken.php
@@ -42,6 +42,8 @@ interface CancellationToken
* Throws the `CancelledException` if cancellation has been requested, otherwise does nothing.
*
* @return void
+ *
+ * @throws CancelledException
*/
public function throwIfRequested();
} | Annotate that throwIfRequested might throw CancelledException | amphp_amp | train | php |
3ff821c5e339ac7f136b77127e75c93222b8b22d | diff --git a/lib/migration_runner.rb b/lib/migration_runner.rb
index <HASH>..<HASH> 100644
--- a/lib/migration_runner.rb
+++ b/lib/migration_runner.rb
@@ -54,7 +54,7 @@ module DataMapper
if level.nil?
migration.perform_up()
else
- migration.perform_up() if migration.position <= level
+ migration.perform_up() if migration.position <= level.to_i
end
end
end
@@ -68,7 +68,7 @@ module DataMapper
if level.nil?
migration.perform_down()
else
- migration.perform_down() if migration.position > level
+ migration.perform_down() if migration.position > level.to_i
end
end
end | Make sure our level is an integer. | datamapper_dm-migrations | train | rb |
f7fc538bd852824ed1ae52044480901ed3751572 | diff --git a/telebot/apihelper.py b/telebot/apihelper.py
index <HASH>..<HASH> 100644
--- a/telebot/apihelper.py
+++ b/telebot/apihelper.py
@@ -1,6 +1,10 @@
# -*- coding: utf-8 -*-
import requests
+try:
+ from requests.packages.urllib3 import fields
+except ImportError:
+ fields = None
import telebot
from telebot import types
from telebot import util
@@ -29,6 +33,8 @@ def _make_request(token, method_name, method='get', params=None, files=None, bas
logger.debug("Request: method={0} url={1} params={2} files={3}".format(method, request_url, params, files))
read_timeout = READ_TIMEOUT
connect_timeout = CONNECT_TIMEOUT
+ if files and fields:
+ fields.format_header_param = _no_encode(fields.format_header_param)
if params:
if 'timeout' in params: read_timeout = params['timeout'] + 10
if 'connect-timeout' in params: connect_timeout = params['connect-timeout'] + 10
@@ -568,6 +574,15 @@ def _convert_markup(markup):
return markup
+def _no_encode(func):
+ def wrapper(key, val):
+ if key == 'filename':
+ return '{0}={1}'.format(key, val)
+ else:
+ return func(key, val)
+ return wrapper
+
+
class ApiException(Exception):
"""
This class represents an Exception thrown when a call to the Telegram API fails. | Non-ASCII chars for filename. Telegram doesn't accept rfc<I> styled filename. Using utf-8 directly. | eternnoir_pyTelegramBotAPI | train | py |
f6bbcd602f64712a8ae1ddee5957182793907714 | diff --git a/web/concrete/single_pages/dashboard/system/seo/tracking_codes.php b/web/concrete/single_pages/dashboard/system/seo/tracking_codes.php
index <HASH>..<HASH> 100644
--- a/web/concrete/single_pages/dashboard/system/seo/tracking_codes.php
+++ b/web/concrete/single_pages/dashboard/system/seo/tracking_codes.php
@@ -10,9 +10,6 @@ $form = Loader::helper('form');
<form id="tracking-code-form" action="<?=$this->action('')?>" method="post">
<div class="ccm-pane-body">
<?=$this->controller->token->output('update_tracking_code')?>
- <?php if (!empty($token_error) && is_array($token_error)) { ?>
- <div class="alert-message error"><?=$token_error[0]?></div>
- <?php } ?>
<div class="clearfix">
<?=$form->label('tracking_code', t('Tracking Codes'))?>
<div class="input"> | Remove unnecessary error printing. As it is done by the default error handler now.
Former-commit-id: 4f4eaa<I>f<I>d3eacb<I>e<I>c<I>c1e8dac<I> | concrete5_concrete5 | train | php |
18d20407c6a56ba24892ac10b273d35d0211bfc7 | diff --git a/cmd/minikube/cmd/cache.go b/cmd/minikube/cmd/cache.go
index <HASH>..<HASH> 100644
--- a/cmd/minikube/cmd/cache.go
+++ b/cmd/minikube/cmd/cache.go
@@ -38,8 +38,8 @@ const allFlag = "all"
// cacheCmd represents the cache command
var cacheCmd = &cobra.Command{
Use: "cache",
- Short: "Add, delete, or push a local image into minikube",
- Long: "Add, delete, or push a local image into minikube",
+ Short: "Manage cache for images",
+ Long: "Add an image into minikube as a local cache, or delete, reload the cached images",
}
// addCacheCmd represents the cache add command | Improve description for minikube cache command | kubernetes_minikube | train | go |
3fc2458b3f3850431418c6118d8e45a88cbaf3be | diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -4,9 +4,11 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
-SimpleCov.start
+SimpleCov.start do
+ add_filter('.gems')
+end
-ENV['RACK_ENV'] ||= "test"
+ENV['RACK_ENV'] ||= 'test'
require 'tilt/jbuilder'
require 'sinatra/jbuilder' | Ignore .gems directory when running coverage | anthonator_tilt-jbuilder | train | rb |
4207b1fb5ea4f1b3ba460a2230d5bbd578be953c | diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb
index <HASH>..<HASH> 100644
--- a/lib/haml/helpers/action_view_mods.rb
+++ b/lib/haml/helpers/action_view_mods.rb
@@ -107,9 +107,9 @@ module ActionView
return content_tag_without_haml(name, *args) {preserve(&block)}
end
- returning content_tag_without_haml(name, *args, &block) do |content|
- return Haml::Helpers.preserve(content) if preserve && content
- end
+ content = content_tag_without_haml(name, *args, &block)
+ content = Haml::Helpers.preserve(content) if preserve && content
+ content
end
alias_method :content_tag_without_haml, :content_tag | [Haml] Avoid using Object#returning which was removed in Rails 3.
See <URL> | sass_ruby-sass | train | rb |
30bacf7f95fb7a2529279f993f22121b2265e6dc | diff --git a/dvc/command/init.py b/dvc/command/init.py
index <HASH>..<HASH> 100644
--- a/dvc/command/init.py
+++ b/dvc/command/init.py
@@ -63,7 +63,7 @@ StoragePath =
ProjectName =
'''
- EMPTY_FILE_NAME = 'empty'
+ EMPTY_FILE_NAME = '.empty'
EMPTY_FILE_CHECKSUM = '0000000'
def __init__(self, settings): | dvc: rename empty to .empty
This will allow us to hide it.
Fixes #<I> | iterative_dvc | train | py |
86644261a26750205398b25e472beb42b4f3604d | diff --git a/admin.go b/admin.go
index <HASH>..<HASH> 100644
--- a/admin.go
+++ b/admin.go
@@ -608,7 +608,9 @@ func (ca *clusterAdmin) ListConsumerGroupOffsets(group string, topicPartitions m
partitions: topicPartitions,
}
- if ca.conf.Version.IsAtLeast(V0_8_2_2) {
+ if ca.conf.Version.IsAtLeast(V0_10_2_0) {
+ request.Version = 2
+ } else if ca.conf.Version.IsAtLeast(V0_8_2_2) {
request.Version = 1
} | support ListConsumerGroupOffsets without topicPartition | Shopify_sarama | train | go |
14f39c6e2f2fd0de2cbb7e28000a55ecd06c7461 | diff --git a/lib/airborne/request_expectations.rb b/lib/airborne/request_expectations.rb
index <HASH>..<HASH> 100644
--- a/lib/airborne/request_expectations.rb
+++ b/lib/airborne/request_expectations.rb
@@ -72,6 +72,8 @@ module Airborne
end
def expect_json_impl(expected, actual)
+ return if nil_optional_hash?(expected, actual)
+
actual = actual.to_s if expected.class == Regexp
return expect(actual).to match(expected) if property?(expected)
@@ -90,7 +92,7 @@ module Airborne
expected_value = extract_expected(expected, prop)
actual_value = extract_actual(actual, prop)
- next expect_json_impl(expected_value, actual_value) if expected_value.is_a?(Hash)
+ next expect_json_impl(expected_value, actual_value) if hash?(expected_value)
next expected_value.call(actual_value) if expected_value.is_a?(Proc)
next expect(actual_value.to_s).to match(expected_value) if expected_value.is_a?(Regexp) | add optional hash to expect_json | brooklynDev_airborne | train | rb |
f9f7e4aecb8d378e42237a643029cf002a303bca | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ with open('README.rst') as readme:
setup(
name = 'datapackage',
- version = '0.4.0',
+ version = '0.4.1',
url = 'https://github.com/tryggvib/datapackage',
license = 'GPLv3',
description = description, | Version <I>
Bug fix in data retrieval based on different structure of
the resources property. | frictionlessdata_datapackage-py | train | py |
113157e83ffd118300901c1e7efb52552301ef5c | diff --git a/lib/ronin/config.rb b/lib/ronin/config.rb
index <HASH>..<HASH> 100644
--- a/lib/ronin/config.rb
+++ b/lib/ronin/config.rb
@@ -35,10 +35,10 @@ module Ronin
CONFIG_PATH = File.expand_path(File.join(PATH,'config.rb'))
# Configuration files directory
- CONFIG_DIR = File.expand_path(File.join(PATH,'config'))
+ CONFIG_DIR = FileUtils.mkdir(File.expand_path(File.join(PATH,'config')))
# Temporary file directory
- TMP_DIR = FileUtils.mkdir_p(File.join(PATH,'tmp'))
+ TMP_DIR = FileUtils.mkdir(File.join(PATH,'tmp'))
#
# Require the Ronin configuration file with the given _name_ in the | Automatically make the ~/.ronin/config/ directory. | ronin-ruby_ronin | train | rb |
84c71cc0ddea76ea60b4f0aec60660180055ecdf | diff --git a/spec/integration/presence_channel_spec.rb b/spec/integration/presence_channel_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/integration/presence_channel_spec.rb
+++ b/spec/integration/presence_channel_spec.rb
@@ -22,7 +22,7 @@ describe 'Integration' do
count: 2,
last_event: 'pusher:error'
- messages.last['data']['message'].=~(/^Invalid signature: Expected HMAC SHA256 hex digest of/).should be_true
+ messages.last['data']['message'].should =~ /^Invalid signature: Expected HMAC SHA256 hex digest of/
end
end
end | get nicer failure message than expected false to be true | stevegraham_slanger | train | rb |
7d7ef1b494b59a65393798a11e4d53e6a75bd3c5 | diff --git a/core/src/main/java/org/bitcoinj/core/CheckpointManager.java b/core/src/main/java/org/bitcoinj/core/CheckpointManager.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/bitcoinj/core/CheckpointManager.java
+++ b/core/src/main/java/org/bitcoinj/core/CheckpointManager.java
@@ -142,7 +142,8 @@ public class CheckpointManager {
checkpoints.put(block.getHeader().getTimeSeconds(), block);
}
Sha256Hash dataHash = Sha256Hash.wrap(digest.digest());
- log.info("Read {} checkpoints, hash is {}", checkpoints.size(), dataHash);
+ log.info("Read {} checkpoints up to time {}, hash is {}", checkpoints.size(),
+ Utils.dateTimeFormat(checkpoints.lastEntry().getKey() * 1000), dataHash);
return dataHash;
} catch (ProtocolException e) {
throw new IOException(e);
@@ -179,7 +180,8 @@ public class CheckpointManager {
checkpoints.put(block.getHeader().getTimeSeconds(), block);
}
HashCode hash = hasher.hash();
- log.info("Read {} checkpoints, hash is {}", checkpoints.size(), hash);
+ log.info("Read {} checkpoints up to time {}, hash is {}", checkpoints.size(),
+ Utils.dateTimeFormat(checkpoints.lastEntry().getKey() * 1000), hash);
return Sha256Hash.wrap(hash.asBytes());
} finally {
if (reader != null) reader.close(); | CheckpointManager: Log time of latest checkpoint read. | bitcoinj_bitcoinj | train | java |
a1397db83aa838ebda82d59bf1e0166143a09c67 | 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
@@ -1,22 +1 @@
require 'aruba/cucumber'
-
-#
-# Add bin/ to our PATH
-BIN_DIR = File.expand_path(File.dirname(__FILE__) + '/../../bin')
-ENV['PATH'] = "#{BIN_DIR}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
-
-#
-# ???
-THIS_DIR = File.dirname(__FILE__)
-LIB_DIR = File.join(File.expand_path(THIS_DIR), '..', '..', 'lib')
-
-Before do
- # Using "announce" causes massive warnings on 1.9.2
- @puts = true
- @original_rubylib = ENV['RUBYLIB']
- ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
-end
-
-After do
- ENV['RUBYLIB'] = @original_rubylib
-end | [tools, cucumber] Eliminate <I>% of env.rb?
I don't recall why I added this.. but things appear to run ok when I
remove it.. so.. | jedcn_reveal-ck | train | rb |
9a32bee17171dd8a3435cc66f5f7bf8db080f8aa | diff --git a/rpcserver.go b/rpcserver.go
index <HASH>..<HASH> 100644
--- a/rpcserver.go
+++ b/rpcserver.go
@@ -1465,8 +1465,11 @@ func (r *rpcServer) ListChannels(ctx context.Context,
channelID := lnwire.NewChanIDFromOutPoint(&chanPoint)
var linkActive bool
- if _, err := r.server.htlcSwitch.GetLink(channelID); err == nil {
- linkActive = true
+ if link, err := r.server.htlcSwitch.GetLink(channelID); err == nil {
+ // A channel is only considered active if it is known
+ // by the switch *and* able to forward
+ // incoming/outgoing payments.
+ linkActive = link.EligibleToForward()
}
// As this is required for display purposes, we'll calculate | rpc: a link is now only active if it is eligible to forward HTLCs
In this commit, we further constrain the candidacy for an “active”
channel. In addition to being present within the link, it *must* also
have the RemoteNextRevocation set. Otherwise, this indicates that we
haven’t yet processed a FundingLocked message for this channel. | lightningnetwork_lnd | train | go |
f21edb3bfbd908ce175e923789590bd7459edd3a | diff --git a/app/models/part.rb b/app/models/part.rb
index <HASH>..<HASH> 100644
--- a/app/models/part.rb
+++ b/app/models/part.rb
@@ -8,6 +8,8 @@ class Part
embedded_in :programme_edition
embedded_in :business_support_edition
+ scope :in_order, order_by(:order, :asc)
+
field :order, type: Integer
field :title, type: String
field :body, type: String
diff --git a/test/models/edition_test.rb b/test/models/edition_test.rb
index <HASH>..<HASH> 100644
--- a/test/models/edition_test.rb
+++ b/test/models/edition_test.rb
@@ -587,6 +587,17 @@ class EditionTest < ActiveSupport::TestCase
end
end
+ test "parts can be sorted by the order field using a scope" do
+ edition = GuideEdition.new(title: "One", slug: "one", panopticon_id: @artefact.id)
+ edition.parts.build title: "Biscuits", body:"Never gonna give you up", slug: "biscuits", order: 2
+ edition.parts.build title: "Cookies", body:"NYAN NYAN NYAN NYAN", slug: "cookies", order: 1
+ edition.save!
+ edition.reload
+
+ assert_equal "Cookies", edition.parts.in_order.first.title
+ assert_equal "Biscuits", edition.parts.in_order.last.title
+ end
+
test "user should not be able to review an edition they requested review for" do
user = User.create(name: "Mary") | Allow parts to be sorted by the order value
Use a scope to sort parts by the value of the order
attribute. | alphagov_govuk_content_models | train | rb,rb |
083998f765ddec5bc9075141d935cdc870fd7aa3 | diff --git a/looptools/__init__.py b/looptools/__init__.py
index <HASH>..<HASH> 100644
--- a/looptools/__init__.py
+++ b/looptools/__init__.py
@@ -1,6 +1,6 @@
from looptools.log import LogOutput
-from looptools.timer import Timer, functimer
+from looptools.timer import Timer, functimer, ActiveTimer
from looptools.counter import Counter
-__all__ = ["Timer", "Counter", "LogOutput", "functimer"]
+__all__ = ["Timer", "Counter", "LogOutput", "functimer", "ActiveTimer"]
__name__ = "Loop Tools"
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, find_packages
setup(
name='looptools',
- version='0.1.6',
+ version='0.1.7',
packages=find_packages(),
install_requires=[],
url='https://github.com/mrstephenneal/looptools', | Added timer functions for timer decorations and active timers. | mrstephenneal_looptools | train | py,py |
070f44ba3325a60f4a71c1a4e985e41343bf3b27 | diff --git a/cmsplugin_cascade/link/forms.py b/cmsplugin_cascade/link/forms.py
index <HASH>..<HASH> 100644
--- a/cmsplugin_cascade/link/forms.py
+++ b/cmsplugin_cascade/link/forms.py
@@ -6,6 +6,7 @@ from django.db.models.fields.related import ManyToOneRel
from django.forms import fields, Media, ModelChoiceField
from django.forms.widgets import RadioSelect
from django.utils.html import format_html
+from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django_select2.forms import HeavySelect2Widget
from cms.models import Page
@@ -15,8 +16,9 @@ from filer.fields.file import AdminFileWidget, FilerFileField
from cms.utils import get_current_site
-def format_page_link(*args, **kwargs):
- return format_html("{} ({})", *args, **kwargs)
+def format_page_link(title, path):
+ html = format_html("{} ({})", mark_safe(title), path)
+ return html
class HeavySelectWidget(HeavySelect2Widget): | In LinkPlugin, mark search result as safe html | jrief_djangocms-cascade | train | py |
ba42a323dbc72b226e966d11688ef29bc6e07977 | diff --git a/web/concrete/src/Editor/LinkAbstractor.php b/web/concrete/src/Editor/LinkAbstractor.php
index <HASH>..<HASH> 100644
--- a/web/concrete/src/Editor/LinkAbstractor.php
+++ b/web/concrete/src/Editor/LinkAbstractor.php
@@ -120,6 +120,18 @@ class LinkAbstractor extends Object
$fID = $picture->fid;
$fo = \File::getByID($fID);
if (is_object($fo)) {
+ // move width px to width attribute and height px to height attribute
+ $widthPattern = "/width:\\s([0-9]+)px;?/i";
+ if (preg_match($widthPattern, $picture->style, $matches)) {
+ $picture->style = preg_replace($widthPattern, '', $picture->style);
+ $picture->width = $matches[1];
+ }
+ $heightPattern = "/height:\\s([0-9]+)px;?/i";
+ if (preg_match($heightPattern, $picture->style, $matches)) {
+ $picture->style = preg_replace($heightPattern, '', $picture->style);
+ $picture->height = $matches[1];
+ }
+ $picture->style = preg_replace('/\s+/', '', $picture->style);
if ($picture->style) {
$image = new \Concrete\Core\Html\Image($fo, false);
$image->getTag()->width(false)->height(false); | Allows images that might have something like <img style="width: <I>px; height: <I>px;"...> to leverage the responsive picture elements
Former-commit-id: <I>c<I>d<I>d<I>ffd8cbd2d<I>c<I>
Former-commit-id: <I>c5f<I>c<I>b<I>b<I>f<I>a5a7 | concrete5_concrete5 | train | php |
9d626eada0f0a5e2e55220b852404691f8d75e18 | diff --git a/elki-clustering/src/main/java/elki/index/tree/betula/CFNode.java b/elki-clustering/src/main/java/elki/index/tree/betula/CFNode.java
index <HASH>..<HASH> 100644
--- a/elki-clustering/src/main/java/elki/index/tree/betula/CFNode.java
+++ b/elki-clustering/src/main/java/elki/index/tree/betula/CFNode.java
@@ -91,8 +91,13 @@ public class CFNode<L extends ClusterFeature> implements AsClusterFeature {
* @return CF
*/
public AsClusterFeature getChild(int i) {
+ if(i < children.length) {
return (AsClusterFeature) children[i];
}
+ else {
+ return null;
+ }
+ }
/**
* Add a subtree | fix array out of bounds exeption | elki-project_elki | train | java |
86c3303067bf4f5f0e48f253b7663707fc06a91e | diff --git a/src/Rememberable.php b/src/Rememberable.php
index <HASH>..<HASH> 100644
--- a/src/Rememberable.php
+++ b/src/Rememberable.php
@@ -30,7 +30,7 @@ trait Rememberable
*/
public function __call($method, $parameters)
{
- if (static::rememberable() && in_array($method, ['increment', 'decrement'])) {
+ if (static::rememberable() && static::interceptable() && in_array($method, ['increment', 'decrement'])) {
$result = call_user_func_array([$this, $method], $parameters);
$this->fireModelEvent('saved');
@@ -81,4 +81,18 @@ trait Rememberable
{
return isset(static::$rememberable) && static::$rememberable === true;
}
+
+ /**
+ * Check if we're allowed to intercept __call.
+ *
+ * @return bool
+ */
+ public static function interceptable()
+ {
+ if (! isset(static::$interceptable)) {
+ return true;
+ }
+
+ return (bool) static::$interceptable;
+ }
} | Add a check to see if we're allowed to intercept the increment/decrement operations. | ameliaikeda_rememberable | train | php |
dd5deeced19d88b5d82471b811311acadfe3a878 | diff --git a/src/models/AngelModel.php b/src/models/AngelModel.php
index <HASH>..<HASH> 100644
--- a/src/models/AngelModel.php
+++ b/src/models/AngelModel.php
@@ -76,6 +76,12 @@ abstract class AngelModel extends \Eloquent {
$model->assign();
});
+ static::creating(function($model) {
+ if ($model->reorderable) {
+ $model->order = $model->count();
+ }
+ });
+
// Fill in the `order` gap after deleting a model.
static::deleted(function($model) {
if (!$model->reorderable) return; | Assign order to reorderable models on creation | JVMartin_angel-core | train | php |
6d692ad2c7871435e418127ead4608814a3236b6 | diff --git a/telemetry/telemetry/test.py b/telemetry/telemetry/test.py
index <HASH>..<HASH> 100644
--- a/telemetry/telemetry/test.py
+++ b/telemetry/telemetry/test.py
@@ -39,6 +39,7 @@ class Test(object):
setattr(options, key, value)
options.repeat_options = self._CreateRepeatOptions(options)
+ self.CustomizeBrowserOptions(options)
test = self.test()
ps = self.CreatePageSet(options)
@@ -90,3 +91,7 @@ class Test(object):
def AddTestCommandLineOptions(parser):
"""Override to accept custom command line options."""
pass
+
+ def CustomizeBrowserOptions(self, options):
+ """Add browser options that are required by this benchmark."""
+ pass | Added Web Animations and regular animation blink_perf benchmarks
Add benchmark targets for the current animation implementation and the
in progress Web Animations implementation using the Animations subset of
the blink_perf tests.
BUG=<I>
Review URL: <URL> | catapult-project_catapult | train | py |
23a7959aebd6aab1ffc55244dc60a37636485958 | diff --git a/src/Google2FA.php b/src/Google2FA.php
index <HASH>..<HASH> 100644
--- a/src/Google2FA.php
+++ b/src/Google2FA.php
@@ -103,10 +103,7 @@ class Google2FA extends Google2FAPackage
return new Bacon();
}
- if (
- class_exists('chillerlan\QRCode') ||
- class_exists('BaconQrCode\Renderer\ImageRenderer')
- ) {
+ if (class_exists('chillerlan\QRCode\QRCode')) {
return new Chillerlan();
} | Refer to the right class for chillerlan's package | antonioribeiro_google2fa-qrcode | train | php |
9db3df4bca52af8a2ff73f42ce86ff414af63f1a | diff --git a/ping.go b/ping.go
index <HASH>..<HASH> 100644
--- a/ping.go
+++ b/ping.go
@@ -83,17 +83,18 @@ func NewPinger(addr string) (*Pinger, error) {
ipv4 = false
}
+ r := rand.New(rand.NewSource(time.Now().UnixNano()))
return &Pinger{
ipaddr: ipaddr,
addr: addr,
Interval: time.Second,
Timeout: time.Second * 100000,
Count: -1,
- id: rand.Intn(math.MaxInt16),
+ id: r.Intn(math.MaxInt16),
network: "udp",
ipv4: ipv4,
Size: timeSliceLength,
- Tracker: rand.Int63n(math.MaxInt64),
+ Tracker: r.Int63n(math.MaxInt64),
done: make(chan bool),
}, nil
}
@@ -454,11 +455,11 @@ func (p *Pinger) processPacket(recv *packet) error {
return nil
}
}
-
+
outPkt := &Packet{
Nbytes: recv.nbytes,
IPAddr: p.ipaddr,
- Addr: p.addr,
+ Addr: p.addr,
}
switch pkt := m.Body.(type) { | Set a random source seed to avoid ID conflicts
closes #<I>
closes #<I> | sparrc_go-ping | train | go |
2bfce758362f3450c613b3501184905fc5bd7cb1 | diff --git a/tests/automated/buttonText.js b/tests/automated/buttonText.js
index <HASH>..<HASH> 100644
--- a/tests/automated/buttonText.js
+++ b/tests/automated/buttonText.js
@@ -1,4 +1,3 @@
-
describe('button text', function() {
var settings = {};
@@ -15,6 +14,7 @@ describe('button text', function() {
});
describe('with buttonIcons', function() {
+
describe('when lang is default', function() {
it('should have no text', function() {
expect($('.fc-button-next')).toHaveText('');
@@ -57,7 +57,9 @@ describe('button text', function() {
});
});
});
+
describe('without buttonIcons', function() {
+
beforeEach(function() {
settings.buttonIcons = {
prev: null,
@@ -68,6 +70,7 @@ describe('button text', function() {
});
describe('when lang is default', function() {
+
beforeEach(function() {
$('#cal').fullCalendar(settings);
});
@@ -91,6 +94,7 @@ describe('button text', function() {
});
describe('when buttonText is specified', function() {
+
beforeEach(function() {
settings.buttonText = {
prev: '<-',
@@ -143,4 +147,5 @@ describe('button text', function() {
});
});
});
+
}); | Wasting a minute or two trying to whitespace my test consistent to the other tests | fullcalendar_fullcalendar | train | js |
576aedbb8b9f32f9d8221b3ad712838f0a7d8f75 | diff --git a/test/mysql/employees.js b/test/mysql/employees.js
index <HASH>..<HASH> 100644
--- a/test/mysql/employees.js
+++ b/test/mysql/employees.js
@@ -13,7 +13,13 @@ describe('employees model', function () {
var employees = db.extend('employees');
before(function (done) {
- db.connect(done);
+ db.connect(function (error) {
+ var sql = 'CREATE TABLE IF NOT EXISTS `employees` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `firstName` varchar(45) NOT NULL, `lastName` varchar(45) NOT NULL, `age` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;';
+
+ if (error) return done(error);
+
+ db.query(sql, done);
+ });
});
after(function (done) { | Updating the employees unit test with a 'CREATE TABLE' statement. | jmike_naomi | train | js |
1608002cef55d71da7fdfc73f27ece23abb327fe | diff --git a/js/data/Model.js b/js/data/Model.js
index <HASH>..<HASH> 100644
--- a/js/data/Model.js
+++ b/js/data/Model.js
@@ -194,6 +194,12 @@ define(["js/data/Entity", "js/core/List", "flow", "underscore"], function (Entit
* @param {Function} callback - function(err, model, options)
*/
fetch: function (options, callback) {
+
+ if (arguments.length === 1 && options instanceof Function) {
+ callback = options;
+ options = null;
+ }
+
options = options || {};
var self = this; | added fallback for Model.fetch if no options are passed to function call | rappid_rAppid.js | train | js |
72e818bdbae205a3ae6f16127579eea2f7d2ffff | diff --git a/pytablewriter/style/_theme.py b/pytablewriter/style/_theme.py
index <HASH>..<HASH> 100644
--- a/pytablewriter/style/_theme.py
+++ b/pytablewriter/style/_theme.py
@@ -29,13 +29,9 @@ class ColSeparatorStyleFilterFunc(Protocol):
...
-Theme = NamedTuple(
- "Theme",
- [
- ("style_filter", Optional[StyleFilterFunc]),
- ("col_separator_style_filter", Optional[ColSeparatorStyleFilterFunc]),
- ],
-)
+class Theme(NamedTuple):
+ style_filter: Optional[StyleFilterFunc]
+ col_separator_style_filter: Optional[ColSeparatorStyleFilterFunc]
def list_themes() -> Sequence[str]: | Refactor a NamedTuple definition | thombashi_pytablewriter | train | py |
803c26f9c70b4081f2fb8830d0d2ba6c586d35a6 | diff --git a/src/view/ThemeManager.js b/src/view/ThemeManager.js
index <HASH>..<HASH> 100644
--- a/src/view/ThemeManager.js
+++ b/src/view/ThemeManager.js
@@ -53,7 +53,7 @@ define(function (require, exports, module) {
if(cm) {
ThemeView.setDocumentMode(cm);
- if(force === false) {
+ if(!force) {
ThemeView.updateThemes(cm);
refreshEditor(cm);
}
@@ -250,7 +250,7 @@ define(function (require, exports, module) {
$(EditorManager).on("activeEditorChange", function() {
- refresh(true);
+ refresh();
}); | Fixed issue with unnecessary reload of themes when opening a new document | adobe_brackets | train | js |
43fc7221b458e8bdbdd1b997282b705a6292126c | diff --git a/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php b/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php
index <HASH>..<HASH> 100644
--- a/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php
+++ b/Bundle/BusinessPageBundle/Builder/BusinessPageBuilder.php
@@ -66,7 +66,7 @@ class BusinessPageBuilder
$accessor = PropertyAccess::createPropertyAccessor();
foreach ($patternProperties as $property) {
- if (!in_array($property->getName(), array('id', 'widgetMap', 'slots', 'seo', 'i18n')) && !$property->isStatic()) {
+ if (!in_array($property->getName(), array('id', 'widgetMap', 'slots', 'seo', 'i18n', 'widgets')) && !$property->isStatic()) {
$value = $accessor->getValue($bepPattern, $property->getName());
$setMethod = 'set'.ucfirst($property->getName());
if (method_exists($page, $setMethod)) { | do not give widgets to the generated BP, if so the BT looses it's widgets | Victoire_victoire | train | php |
3fd7ca1a433f86040741df28ef3fcafe1527b9d2 | diff --git a/EventListener/ShopSubscriber.php b/EventListener/ShopSubscriber.php
index <HASH>..<HASH> 100755
--- a/EventListener/ShopSubscriber.php
+++ b/EventListener/ShopSubscriber.php
@@ -22,9 +22,6 @@ use WellCommerce\Bundle\CoreBundle\EventListener\AbstractEventSubscriber;
*/
class ShopSubscriber extends AbstractEventSubscriber
{
- /**
- * {@inheritdoc}
- */
public static function getSubscribedEvents()
{
return [ | Updated readme, small changes in kernel and RouteProvider
(cherry picked from commit <I>e<I>ed<I>a<I>cbc4e<I>d<I>fbeb<I>e6b) | WellCommerce_WishlistBundle | train | php |
11b1dcb553fe802a41003f44d7df733c8ceb257b | diff --git a/core/codegen-runtime/src/main/java/org/overture/codegen/runtime/Utils.java b/core/codegen-runtime/src/main/java/org/overture/codegen/runtime/Utils.java
index <HASH>..<HASH> 100644
--- a/core/codegen-runtime/src/main/java/org/overture/codegen/runtime/Utils.java
+++ b/core/codegen-runtime/src/main/java/org/overture/codegen/runtime/Utils.java
@@ -59,4 +59,10 @@ public class Utils
return "mk_" + record.getClass().getSimpleName() + "(" + str + ")";
}
+
+ @SuppressWarnings("unchecked")
+ public static <T extends ValueType> T clone(T t)
+ {
+ return (T) (t != null ? t.clone() : t);
+ }
} | Now cloning of code generated value types is done using a utility function to guards against values being "null" which is possible for optionally typed values | overturetool_overture | train | java |
6a51d3caa221bad8ea362238da07f11f4b538e9b | diff --git a/src/com/caverock/androidsvg/SVG.java b/src/com/caverock/androidsvg/SVG.java
index <HASH>..<HASH> 100644
--- a/src/com/caverock/androidsvg/SVG.java
+++ b/src/com/caverock/androidsvg/SVG.java
@@ -316,11 +316,6 @@ public class SVG
Canvas canvas = picture.beginRecording(widthInPixels, heightInPixels);
Box viewPort = new Box(0f, 0f, (float) widthInPixels, (float) heightInPixels);
- if (alignment == null)
- alignment = AspectRatioAlignment.xMidYMid;
- if (scale == null)
- scale = AspectRatioScale.MEET;
-
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, viewPort, defaultDPI);
renderer.renderDocument(this, null, alignment, scale, false);
@@ -459,11 +454,6 @@ public class SVG
svgViewPort = new Box(0f, 0f, (float) canvas.getWidth(), (float) canvas.getHeight());
}
- if (alignment == null)
- alignment = AspectRatioAlignment.xMidYMid;
- if (scale == null)
- scale = AspectRatioScale.MEET;
-
SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, svgViewPort, defaultDPI);
renderer.renderDocument(this, null, alignment, scale, true); | Removed code that was overriding null alignment/scale parameters in render methods. There needs to be a way to request "don't scale to fill viewport"! | BigBadaboom_androidsvg | train | java |
b6251cd57ab3378752075cbe5c549c01155bd2dc | diff --git a/test/fixtures/active_record.rb b/test/fixtures/active_record.rb
index <HASH>..<HASH> 100644
--- a/test/fixtures/active_record.rb
+++ b/test/fixtures/active_record.rb
@@ -288,7 +288,12 @@ class Post < ActiveRecord::Base
def destroy_callback
if title == "can't destroy me"
errors.add(:title, "can't destroy me")
- return false
+
+ if Rails::VERSION::MAJOR >= 5
+ throw(:abort)
+ else
+ return false
+ end
end
end
end | Handle stopping in callbacks in new rails 5 way | cerebris_jsonapi-resources | train | rb |
c4903164d4c769121c49aa628dc4c009924aa288 | diff --git a/src/valiant.jquery.js b/src/valiant.jquery.js
index <HASH>..<HASH> 100644
--- a/src/valiant.jquery.js
+++ b/src/valiant.jquery.js
@@ -127,7 +127,8 @@ three.js r65 or higher
this._scene = new THREE.Scene();
// create ThreeJS camera
- this._camera = new THREE.PerspectiveCamera( this.options.fov, $(this.element).width() / $(this.element).height(), 0.1, 1000);
+ this._camera = new THREE.PerspectiveCamera(this._fov, $(this.element).width() / $(this.element).height(), 0.1, 1000);
+ this._camera.setLens(this._fov);
// create ThreeJS renderer and append it to our object
this._renderer = Detector.webgl? new THREE.WebGLRenderer(): new THREE.CanvasRenderer(); | Fix for fov correctly being set in defaults or passed opts object
fov wasn't correctly being set for some reason on the THREE.PerspectiveCamera until setLens() was called in the mouse wheel event handler. This fix calls setLens directly after PerspectiveCamera creation. | flimshaw_Valiant360 | train | js |
968108baa781a30203908d82ca298734562e68d3 | diff --git a/cumulusci/tests/pytest_plugins/pytest_sf_vcr.py b/cumulusci/tests/pytest_plugins/pytest_sf_vcr.py
index <HASH>..<HASH> 100644
--- a/cumulusci/tests/pytest_plugins/pytest_sf_vcr.py
+++ b/cumulusci/tests/pytest_plugins/pytest_sf_vcr.py
@@ -93,7 +93,7 @@ def configure_recording_mode(
elif user_requested_network_access and vcr_cassette_path.exists():
# user wants to keep existing cassette, so disable VCR usage entirely, like:
# https://github.com/ktosiek/pytest-vcr/blob/08482cf0724697c14b63ad17752a0f13f7670add/pytest_vcr.py#L59
- recording_mode = RecordingMode.disabled
+ recording_mode = RecordingMode.DISABLE
elif user_requested_network_access:
recording_mode = RecordingMode.RECORD
else: | Fix load tests. Use different sample task. Update cassettes. keep content-type. | SFDO-Tooling_CumulusCI | train | py |
04ce57e685d16b4afd11ffde2810741290a7976e | diff --git a/demo/extract-img2.py b/demo/extract-img2.py
index <HASH>..<HASH> 100644
--- a/demo/extract-img2.py
+++ b/demo/extract-img2.py
@@ -91,7 +91,7 @@ smasks = [] # stores xrefs of /SMask objects
#------------------------------------------------------------------------------
for i in range(1, lenXREF): # scan through all objects
try:
- text = doc._getObjectString(i) # PDF object definition string
+ text = doc._getXrefString(i) # PDF object definition string
except:
print("xref %i " % i + doc._getGCTXerrmsg())
continue # skip the error | Update extract-img2.py | pymupdf_PyMuPDF | train | py |
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.