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
63034b44c9849087e391684d9b6c0c6ae9a21113
diff --git a/packages/discord.js/src/structures/Role.js b/packages/discord.js/src/structures/Role.js index <HASH>..<HASH> 100644 --- a/packages/discord.js/src/structures/Role.js +++ b/packages/discord.js/src/structures/Role.js @@ -1,6 +1,5 @@ 'use strict'; -const process = require('node:process'); const Base = require('./Base'); const { Error } = require('../errors'); const Permissions = require('../util/Permissions');
fix(Role): remove unused process (#<I>)
discordjs_discord.js
train
js
c3b6f6ef5be74eb5df0113f4638e729a069be940
diff --git a/saltcloud/clouds/rackspace.py b/saltcloud/clouds/rackspace.py index <HASH>..<HASH> 100644 --- a/saltcloud/clouds/rackspace.py +++ b/saltcloud/clouds/rackspace.py @@ -305,8 +305,10 @@ def create(vm_): data = saltcloud.utils.wait_for_ip( __query_node_data, update_args=(vm_, data), - timeout=25 * 60, - interval=10 + timeout=config.get_config_value( + 'wait_for_ip_timeout', vm_, __opts__, default=25) * 60, + interval=config.get_config_value( + 'wait_for_ip_interval', vm_, __opts__, default=10), ) except (SaltCloudExecutionTimeout, SaltCloudExecutionFailure) as exc: try:
Configurable wait for IP implemented for Rackspace
saltstack_salt
train
py
515f122b4a46d717e3ec149524751464e26aad54
diff --git a/src/scs_core/__init__.py b/src/scs_core/__init__.py index <HASH>..<HASH> 100644 --- a/src/scs_core/__init__.py +++ b/src/scs_core/__init__.py @@ -6,4 +6,4 @@ Created on 3 May 2021 https://packaging.python.org/guides/single-sourcing-package-version/ """ -__version__ = '1.0.11' +__version__ = '1.0.12'
Added ModemConnection null_datum() factory method
south-coast-science_scs_core
train
py
ebbb44261bb1082c80f819b435fef91abb1795ce
diff --git a/django_pandas/utils.py b/django_pandas/utils.py index <HASH>..<HASH> 100644 --- a/django_pandas/utils.py +++ b/django_pandas/utils.py @@ -1,6 +1,5 @@ # coding: utf-8 -from math import isnan from django.core.cache import cache from django.utils.encoding import force_text @@ -32,7 +31,7 @@ def replace_pk(model): base_cache_key = get_base_cache_key(model) def inner(pk_list): - cache_keys = [None if isnan(pk) else base_cache_key % pk + cache_keys = [None if pk is None else base_cache_key % pk for pk in pk_list] out_dict = cache.get_many(frozenset(cache_keys)) try: @@ -42,7 +41,7 @@ def replace_pk(model): out_dict = { base_cache_key % obj.pk: force_text(obj) for obj in model.objects.filter(pk__in={pk for pk in pk_list - if not isnan(pk)})} + if pk is not None})} cache.set_many(out_dict) out_list = map(out_dict.get, cache_keys) return out_list
Replaces math.isnan with simple None comparisons.
chrisdev_django-pandas
train
py
df892907edb9362fd015e5aaa1da613cc85d6116
diff --git a/aioxmpp/ssl_transport.py b/aioxmpp/ssl_transport.py index <HASH>..<HASH> 100644 --- a/aioxmpp/ssl_transport.py +++ b/aioxmpp/ssl_transport.py @@ -251,8 +251,9 @@ class STARTTLSTransport(asyncio.Transport): self._protocol.connection_lost(exc) finally: self._rawsock.close() - self._tls_conn.set_app_data(None) - self._tls_conn = None + if self._tls_conn is not None: + self._tls_conn.set_app_data(None) + self._tls_conn = None self._rawsock = None self._protocol = None self._loop = None
Do not fail with AttributeError if connection is lost before STARTTLS
horazont_aioxmpp
train
py
0f97a8ddc5b860f72ddb9c4cfcdb3f2e9bd77552
diff --git a/lib/util/validate-script.js b/lib/util/validate-script.js index <HASH>..<HASH> 100644 --- a/lib/util/validate-script.js +++ b/lib/util/validate-script.js @@ -10,7 +10,7 @@ const config = Joi.object({ http: Joi.object({ extendedMetrics: Joi.boolean(), maxSockets: Joi.number(), - timeout: Joi.number() + timeout: Joi.alternatives(Joi.number(), Joi.string()) }), environments: Joi.object(), processor: Joi.string(), @@ -70,7 +70,7 @@ const wsItems = { const flowItemSchema = Joi.object({ function: Joi.string(), log: Joi.string(), - think: Joi.number(), + think: Joi.alternatives(Joi.number(), Joi.string()), loop: Joi.array(), ...httpItems, ...wsItems, @@ -78,7 +78,7 @@ const flowItemSchema = Joi.object({ }).when('.loop', { is: Joi.exist(), then: Joi.object({ - count: Joi.number(), + count: Joi.alternatives(Joi.number(), Joi.string()), over: Joi.alternatives(Joi.array(), Joi.string()) }), otherwise: Joi.object().length(1)
fix: allow some properties to be numbers or strings Allow think, count and timeout properties to be string for when they are set through environment variable with "{{ $processEnvironment.SOME_VAR }}"
artilleryio_artillery
train
js
82b7809098a0d14669bca8932e6c573c2dec0343
diff --git a/test/html-to-text.js b/test/html-to-text.js index <HASH>..<HASH> 100644 --- a/test/html-to-text.js +++ b/test/html-to-text.js @@ -421,6 +421,25 @@ describe('html-to-text', function () { ); expect(result).to.equal('test [#link]'); }); + + it('should not uppercase links inside headings', function () { + const html = /*html*/`<h1><a href="http://example.com">Heading</a></h1>`; + expect(htmlToText(html)).to.equal('HEADING [http://example.com]'); + }); + + it('should not uppercase links inside table header cells', function () { + const html = /*html*/` + <table> + <tr> + <th>Header cell 1</th> + <th><a href="http://example.com">Header cell 2</a></th> + <td><a href="http://example.com">Regular cell</a></td> + </tr> + </table> + `; + const expected = 'HEADER CELL 1 HEADER CELL 2 [http://example.com] Regular cell [http://example.com]'; + expect(htmlToText(html, { tables: true })).to.equal(expected); + }); }); describe('lists', function () {
Tests for links inside headings URLs should not be affected by word transformations
werk85_node-html-to-text
train
js
398592c5f1c82a0b5c65a70ac929b98d8f85421f
diff --git a/devices/tuya.js b/devices/tuya.js index <HASH>..<HASH> 100644 --- a/devices/tuya.js +++ b/devices/tuya.js @@ -961,9 +961,13 @@ module.exports = [ model: 'WSD500A', vendor: 'TuYa', description: 'Temperature & humidity sensor', - fromZigbee: [fz.battery, fz.temperature, fz.humidity], + fromZigbee: [fzLocal.TS0201_battery, fz.temperature, fz.humidity], toZigbee: [], exposes: [e.battery(), e.temperature(), e.humidity(), e.battery_voltage()], + configure: async (device, coordinatorEndpoint, logger) => { + const endpoint = device.getEndpoint(1); + await endpoint.read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]); + }, }, { fingerprint: [{modelID: 'SM0201', manufacturerName: '_TYZB01_cbiezpds'}],
Fix no battery value for TuYa WSD<I>A (#<I>)
Koenkk_zigbee-shepherd-converters
train
js
182fabe4a76dd91589dc1bf7b9dd5f7974c10295
diff --git a/lib/yus/session.rb b/lib/yus/session.rb index <HASH>..<HASH> 100644 --- a/lib/yus/session.rb +++ b/lib/yus/session.rb @@ -175,6 +175,7 @@ module Yus end def create_entity(name, pass=nil, valid_until=nil, valid_from=Time.now) info("create_entity(name=#{name}, valid_until=#{valid_until}, valid_from=#{valid_from})") + raise InvalidNameError, "Invalid name: ''" if(name.empty?) entity = nil @mutex.synchronize { if(@needle.persistence.find_entity(name)) @@ -210,6 +211,19 @@ module Yus } } end + def rename(oldname, newname) + info("rename(#{oldname}, #{newname})") + @mutex.synchronize { + user = find_or_fail(oldname) + if((other = @needle.persistence.find_entity(newname)) && other != user) + raise DuplicateNameError, "Duplicate name: #{newname}" + end + user.revoke('set_password', oldname) + user.rename(newname) + user.grant('set_password', newname) + save(user) + } + end def reset_entity_password(name, token, password) info("reset_entity_password(name=#{name}, token=#{token})") @mutex.synchronize {
Allow AutoSession to rename entities
zdavatz_yus
train
rb
95dab34d5588fb155dfed8293ac2fbb1217a95a7
diff --git a/src/transformers/models/reformer/modeling_reformer.py b/src/transformers/models/reformer/modeling_reformer.py index <HASH>..<HASH> 100755 --- a/src/transformers/models/reformer/modeling_reformer.py +++ b/src/transformers/models/reformer/modeling_reformer.py @@ -1512,6 +1512,10 @@ class ReformerLayer(nn.Module): # Implementation of RevNet (see Fig. 6 in https://towardsdatascience.com/illustrating-the-reformer-393575ac6ba0) # This code is heavily inspired by https://github.com/lucidrains/reformer-pytorch/blob/master/reformer_pytorch/reversible.py + assert ( + self.training + ), "If you want to train `ReformerModel` and its variations, make sure to use `model.train()` to put the model into training mode." + with torch.enable_grad(): next_attn_output.requires_grad = True
Add an error message that fires when Reformer is not in training mode, but one runs .backward() (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
2b69cc2e3dfa9c533add039a6d8bec8cb3516250
diff --git a/session_test.go b/session_test.go index <HASH>..<HASH> 100644 --- a/session_test.go +++ b/session_test.go @@ -900,6 +900,17 @@ var _ = Describe("Session", func() { Expect(mconn.written[0]).To(ContainSubstring(string([]byte{0x5E, 0x03}))) }) + It("sends ACK frames when congestion limited", func() { + sess.sentPacketHandler = &mockSentPacketHandler{congestionLimited: true} + sess.packer.packetNumberGenerator.next = 0x1338 + packetNumber := protocol.PacketNumber(0x035E) + sess.receivedPacketHandler.ReceivedPacket(packetNumber, true) + err := sess.sendPacket() + Expect(err).NotTo(HaveOccurred()) + Expect(mconn.written).To(HaveLen(1)) + Expect(mconn.written[0]).To(ContainSubstring(string([]byte{0x5E, 0x03}))) + }) + It("sends two WindowUpdate frames", func() { _, err := sess.GetOrOpenStream(5) Expect(err).ToNot(HaveOccurred())
Add a session test for sending ACK-only packets
lucas-clemente_quic-go
train
go
38b8e2873e8224480124382e352ec74d40238f2a
diff --git a/autopep8.py b/autopep8.py index <HASH>..<HASH> 100644 --- a/autopep8.py +++ b/autopep8.py @@ -33,6 +33,7 @@ class FixPEP8(object): - e211 - e225 - e231 + - e251 - e261 - e262 - e301 @@ -183,6 +184,12 @@ class FixPEP8(object): fixed += target[fixed_end:] self.source[result['line'] - 1] = fixed + def fix_e251(self, result): + target = self.source[result['line'] - 1] + c = result['column'] - 1 + fixed = target[:c] + re.sub(r'\s*=\s*', '=', target[c:], 1) + self.source[result['line'] - 1] = fixed + def fix_e261(self, result): target = self.source[result['line'] - 1] c = result['column'] diff --git a/test_target.py b/test_target.py index <HASH>..<HASH> 100644 --- a/test_target.py +++ b/test_target.py @@ -50,5 +50,13 @@ def func_last(): pass +def func_e251(a, b=1, c = 3): + pass + + +def func_e251_t(a, b=1, c = 3, d = 4): + pass + + if __name__ == '__main__': func_last()
featured: e<I> fixed method (Thanks, Fraser Tweedale)
hhatto_autopep8
train
py,py
2c8de0ed2914b4977f45dc2c911597e78bb93950
diff --git a/code/CalendarDateTime.php b/code/CalendarDateTime.php index <HASH>..<HASH> 100755 --- a/code/CalendarDateTime.php +++ b/code/CalendarDateTime.php @@ -200,6 +200,9 @@ class CalendarDateTime extends DataObject { } public function canCreate($member = null) { + if (!$member) { + $member = Member::currentUser(); + } $extended = $this->extendedCan(__FUNCTION__, $member); if($extended !== null) { return $extended; @@ -208,6 +211,9 @@ class CalendarDateTime extends DataObject { } public function canEdit($member = null) { + if (!$member) { + $member = Member::currentUser(); + } $extended = $this->extendedCan(__FUNCTION__, $member); if($extended !== null) { return $extended; @@ -216,6 +222,9 @@ class CalendarDateTime extends DataObject { } public function canDelete($member = null) { + if (!$member) { + $member = Member::currentUser(); + } $extended = $this->extendedCan(__FUNCTION__, $member); if($extended !== null) { return $extended; @@ -224,6 +233,9 @@ class CalendarDateTime extends DataObject { } public function canView($member = null) { + if (!$member) { + $member = Member::currentUser(); + } $extended = $this->extendedCan(__FUNCTION__, $member); if($extended !== null) { return $extended;
fix(CalendarDateTime): Fixes cases for certain modules where the default member isn't passed.
unclecheese_silverstripe-event-calendar
train
php
05be98f19741b0b29fa90144ccb8ff280a05d600
diff --git a/law/task/base.py b/law/task/base.py index <HASH>..<HASH> 100644 --- a/law/task/base.py +++ b/law/task/base.py @@ -218,13 +218,17 @@ class Register(BaseRegister): for param in inst.interactive_params: value = getattr(inst, param) if value: + skip_abort = False try: logger.debug("evaluating interactive parameter '{}' with value '{}'".format( param, value)) - getattr(inst, "_" + param)(value) + skip_abort = getattr(inst, "_" + param)(value) except KeyboardInterrupt: print("\naborted") - abort(exitcode=0) + + # abort the process if not explicitly skipped + if not skip_abort: + abort(exitcode=0) return inst
Allow skipping the process shutdown in interactive task methods.
riga_law
train
py
72e986ce7cfe22c2ef35a2fa4cd7d391278f65dd
diff --git a/Test/Unit/Parsing/PHPTester.php b/Test/Unit/Parsing/PHPTester.php index <HASH>..<HASH> 100644 --- a/Test/Unit/Parsing/PHPTester.php +++ b/Test/Unit/Parsing/PHPTester.php @@ -338,8 +338,6 @@ class PHPTester { * (optional) The assertion message. */ public function assertClassDocBlockHasLine($line, $message = NULL) { - $message = $message ?? "The docblock has the line '{$line}'."; - // All the class files we generate contain only one class. Assert::assertCount(1, $this->parser_nodes['classes']); $class_node = reset($this->parser_nodes['classes']); @@ -351,6 +349,8 @@ class PHPTester { $line = str_replace(" * ", '', $line); }); + $message = $message ?? "The docblock has the line '{$line}': " . print_r($docblock_lines, TRUE); + Assert::assertContains($line, $docblock_lines, $message); }
Added output of searched docblock lines to assertion message.
drupal-code-builder_drupal-code-builder
train
php
a12f9cdc3e98ae7834924a7132cfa51eb098d8cc
diff --git a/github/github.go b/github/github.go index <HASH>..<HASH> 100644 --- a/github/github.go +++ b/github/github.go @@ -188,6 +188,14 @@ type service struct { client *Client } +// Client returns the http.Client used by this GitHub client. +func (c *Client) Client() *http.Client { + c.clientMu.Lock() + defer c.clientMu.Unlock() + clientCopy := *c.client + return &clientCopy +} + // ListOptions specifies the optional parameters to various List methods that // support offset pagination. type ListOptions struct { diff --git a/github/github_test.go b/github/github_test.go index <HASH>..<HASH> 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -232,6 +232,14 @@ func TestNewClient(t *testing.T) { } } +func TestClient(t *testing.T) { + c := NewClient(nil) + c2 := c.Client() + if c.client == c2 { + t.Error("Client returned same http.Client, but should be different") + } +} + func TestNewEnterpriseClient(t *testing.T) { baseURL := "https://custom-url/api/v3/" uploadURL := "https://custom-upload-url/api/uploads/"
Add Client method (#<I>) Fixes: #<I>.
google_go-github
train
go,go
f9b875f8d25e91fc123a1e209da23347740170f1
diff --git a/libraries/default.rb b/libraries/default.rb index <HASH>..<HASH> 100644 --- a/libraries/default.rb +++ b/libraries/default.rb @@ -185,10 +185,7 @@ class Chef def safe_recipe_eval(&callback_code) recipe_eval(&callback_code) - version = Chef::Version.new(Chef::VERSION) - if version.major >= 10 && version.minor >= 14 - converge - end + converge if respond_to?(:converge) end end end
Only call #converge if it's defined; this lets us tell platforms affected by CHEF-<I> / CHEF-<I> by those where they are fixed. Hat tip to ~kallistec for the idea.
poise_application
train
rb
2a821000783bfe610049c619d93332318b96c9da
diff --git a/functions/attr.php b/functions/attr.php index <HASH>..<HASH> 100644 --- a/functions/attr.php +++ b/functions/attr.php @@ -450,6 +450,7 @@ function hybrid_attr_entry_published( $attr ) { $attr['class'] = 'entry-published updated'; $attr['datetime'] = get_the_time( 'Y-m-d\TH:i:sP' ); + $attr['itemprop'] = 'datePublished'; /* Translators: Post date/time "title" attribute. */ $attr['title'] = get_the_time( _x( 'l, F j, Y, g:i a', 'post time format', 'hybrid-core' ) );
Added datePublished itemprop
justintadlock_hybrid-core
train
php
ae1b896e62859643ee15b1eabd522461702171a3
diff --git a/src/main/java/edu/ucla/sspace/mains/LexSubWordsiMain.java b/src/main/java/edu/ucla/sspace/mains/LexSubWordsiMain.java index <HASH>..<HASH> 100644 --- a/src/main/java/edu/ucla/sspace/mains/LexSubWordsiMain.java +++ b/src/main/java/edu/ucla/sspace/mains/LexSubWordsiMain.java @@ -25,7 +25,7 @@ import edu.ucla.sspace.wordsi.ContextExtractor; import edu.ucla.sspace.wordsi.ContextGenerator; import edu.ucla.sspace.wordsi.Wordsi; import edu.ucla.sspace.wordsi.WordOccrrenceContextGenerator; -import edu.ucla.sspace.wordsi.semeval.SemEvalContextExtractor;; +import edu.ucla.sspace.wordsi.semeval.SemEvalContextExtractor; import java.io.File; import java.io.IOError;
Update src/main/java/edu/ucla/sspace/mains/LexSubWordsiMain.java Delete extra colon, fix Syntax error on token ";", delete this token
fozziethebeat_S-Space
train
java
7fccacfe7aa4e2fca10369416fbf96d8f9526361
diff --git a/porespy/networks/__funcs__.py b/porespy/networks/__funcs__.py index <HASH>..<HASH> 100644 --- a/porespy/networks/__funcs__.py +++ b/porespy/networks/__funcs__.py @@ -134,7 +134,7 @@ def add_boundary_regions(regions=None, faces=['front', 'back', 'left', zero_corners(regions, pw * 3) # Make labels contiguous - regions = relabel_sequential(regions, offset=0)[0] + regions = relabel_sequential(regions, offset=1)[0] return regions
Fix offset variable in call to relabel_sequential (0 -> 1)
PMEAL_porespy
train
py
f80dd05ec014f9515b594667de38b107ae24029d
diff --git a/lib/chef/org.rb b/lib/chef/org.rb index <HASH>..<HASH> 100644 --- a/lib/chef/org.rb +++ b/lib/chef/org.rb @@ -1,3 +1,21 @@ +# +# Author:: Steven Danna (steve@opscode.com) +# Copyright:: Copyright (c) 2014 Chef Software, Inc +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + require 'chef/json_compat' require 'chef/mixin/params_validate' require 'chef/rest' diff --git a/spec/unit/org_spec.rb b/spec/unit/org_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/org_spec.rb +++ b/spec/unit/org_spec.rb @@ -1,6 +1,6 @@ # # Author:: Steven Danna (steve@opscode.com) -# Copyright:: Copyright (c) 2012 Opscode, Inc. +# Copyright:: Copyright (c) 2014 Chef Software, Inc # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License");
Update copyright notices in Chef::Org-related files
chef_chef
train
rb,rb
d096e0d8b5853bb7e3cfb8893cf26a6323b3e6f3
diff --git a/version.php b/version.php index <HASH>..<HASH> 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2006091901; // YYYYMMDD = date + $version = 2006092000; // YYYYMMDD = date // XY = increments within a single day $release = '1.7 dev'; // Human-friendly version name
Bump for new tables. See MDL-<I>
moodle_moodle
train
php
3948628330e96d580acbad33bee9302fef77a10b
diff --git a/openquake/db/models.py b/openquake/db/models.py index <HASH>..<HASH> 100644 --- a/openquake/db/models.py +++ b/openquake/db/models.py @@ -36,7 +36,6 @@ import numpy from django.db import connection from django.contrib.gis.db import models as djm -from django.contrib.gis.geos.geometry import GEOSGeometry from nhlib import geo as nhlib_geo from risklib import vulnerability_function from shapely import wkt @@ -911,7 +910,7 @@ class RiskCalculation(djm.Model): ######################### # Event-Based parameters: ######################### - loss_histogram_bins = djm.IntegerField(null=True, blank=True) + curve_resolution = djm.IntegerField(null=True, blank=True) ###################################### # BCR (Benefit-Cost Ratio) parameters:
renamed lrem_histogram_bins
gem_oq-engine
train
py
a99dc7175f6f52aaeacb0f496f8988b41d195554
diff --git a/datastorage/datastorage.py b/datastorage/datastorage.py index <HASH>..<HASH> 100644 --- a/datastorage/datastorage.py +++ b/datastorage/datastorage.py @@ -381,6 +381,8 @@ class DataStorage(dict): value_str = str(obj)[:50] elif isinstance(obj, str): value_str = obj[:50].replace('\r\n','\n').replace("\n"," ") + elif isinstance(obj, (float, int)): + value_str = "%g" % obj elif self[k] is None: value_str = "None" else:
Improve representation of scalars in DataStorage() Use floating point representation (%g) for scalars.
marcocamma_datastorage
train
py
1d3c48f150e69c8015d2d5c0e32f50a14014078e
diff --git a/src/Storage/Entity/Content.php b/src/Storage/Entity/Content.php index <HASH>..<HASH> 100644 --- a/src/Storage/Entity/Content.php +++ b/src/Storage/Entity/Content.php @@ -18,6 +18,7 @@ namespace Bolt\Storage\Entity; class Content extends Entity { protected $_contenttype; + protected $_legacy; protected $id; protected $slug; protected $datecreated; @@ -55,4 +56,9 @@ class Content extends Entity { $this->_contenttype = $value; } + + public function setLegacyService(ContentLegacyService $service) + { + $this->_legacy = $service; + } }
store a legacy service on the content entity
bolt_bolt
train
php
da192084d6835f71b2ec29393bcb54bd9cefe1c5
diff --git a/bin/pearpackage.php b/bin/pearpackage.php index <HASH>..<HASH> 100755 --- a/bin/pearpackage.php +++ b/bin/pearpackage.php @@ -111,7 +111,7 @@ function getDirectory($path) $files = array(); $ignore = array('.', '..', '.svn','.DS_Store'); - $pathIgnore = array('lib/Sabre/DAV/Auth'); + //$pathIgnore = array('lib/Sabre/DAV/Auth'); $d = opendir($path);
Taking of Auth off the ignore list
sabre-io_dav
train
php
d408e4124a120accdc34b1f4f53f8e254b10b784
diff --git a/tests/TestCase.php b/tests/TestCase.php index <HASH>..<HASH> 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -41,17 +41,17 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase factory(Post::class, 10)->create(); } - public function assertDbProfilerIsActivated() + protected function assertDbProfilerIsActivated() { $this->assertTrue(DB::getEventDispatcher()->hasListeners(QueryExecuted::class)); } - public function assertDbProfilerIsNotActivated() + protected function assertDbProfilerIsNotActivated() { $this->assertFalse(DB::getEventDispatcher()->hasListeners(QueryExecuted::class)); } - public function assertDatabaseQueriesAreDumped() + protected function assertDatabaseQueriesAreDumped() { $queries = [ '[1]: select * from "posts"',
DBP: Methods accessibility changed.
dmitry-ivanov_laravel-db-profiler
train
php
92dce867d1cb6213a02f3e8d2b6163b9ac2529c0
diff --git a/lib/rubocop/cop/style/safe_navigation.rb b/lib/rubocop/cop/style/safe_navigation.rb index <HASH>..<HASH> 100644 --- a/lib/rubocop/cop/style/safe_navigation.rb +++ b/lib/rubocop/cop/style/safe_navigation.rb @@ -112,9 +112,8 @@ module RuboCop end def autocorrect(node) - _check, body, = node.node_parts - _checked_variable, matching_receiver, = extract_parts(node) - method_call, = matching_receiver.parent + body = node.node_parts[1] + method_call = method_call(node) lambda do |corrector| corrector.remove(begin_range(node, body)) @@ -147,6 +146,11 @@ module RuboCop node.else? || node.elsif? || node.ternary? end + def method_call(node) + _checked_variable, matching_receiver, = extract_parts(node) + matching_receiver.parent + end + def extract_parts(node) case node.type when :if
Reduce ABC size of Style/SafeNavigation
rubocop-hq_rubocop
train
rb
fb381c4c8be7df135d7c2e66ab25c8e70c018281
diff --git a/nodeup/pkg/model/kubelet.go b/nodeup/pkg/model/kubelet.go index <HASH>..<HASH> 100644 --- a/nodeup/pkg/model/kubelet.go +++ b/nodeup/pkg/model/kubelet.go @@ -108,7 +108,7 @@ func (b *KubeletBuilder) Build(c *fi.ModelBuilderContext) error { if b.IsMaster || !b.UseBootstrapTokens() { var kubeconfig fi.Resource - if b.IsMaster { + if b.IsMaster && (b.IsKubernetesGTE("1.19") || b.UseBootstrapTokens()) { kubeconfig, err = b.buildMasterKubeletKubeconfig(c) } else { kubeconfig, err = b.BuildBootstrapKubeconfig("kubelet", c)
Don't issue kubelet cert on masters before k8s <I>
kubernetes_kops
train
go
32ea347c4280c7d8bd327f4e265fffcdc19fdeb1
diff --git a/rows/__init__.py b/rows/__init__.py index <HASH>..<HASH> 100644 --- a/rows/__init__.py +++ b/rows/__init__.py @@ -9,6 +9,17 @@ from rows.localization import locale_context # Plugin imports -from rows.plugins.csv import import_from_csv, export_to_csv -from rows.plugins.xls import import_from_xls, export_to_xls -from rows.plugins.html import import_from_html, export_to_html +try: + from rows.plugins.csv import import_from_csv, export_to_csv +except ImportError: + pass + +try: + from rows.plugins.xls import import_from_xls, export_to_xls +except ImportError: + pass + +try: + from rows.plugins.html import import_from_html, export_to_html +except ImportError: + pass
Add try/except ImportError on plugin imports
turicas_rows
train
py
3171bc1ff4e32fd28cd7fcdd44f183278a771c49
diff --git a/src/java/com/threerings/crowd/data/OccupantInfo.java b/src/java/com/threerings/crowd/data/OccupantInfo.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/crowd/data/OccupantInfo.java +++ b/src/java/com/threerings/crowd/data/OccupantInfo.java @@ -74,7 +74,12 @@ public class OccupantInfo extends SimpleStreamableObject _name = name; } public boolean update (OccupantInfo info) { - if (info.username.equals(_name)) { + // The behaviour here used to be to compare the names themselves against one another + // using equals(), but was changed to accommodate the idea of display name changing + // while fundamental identity stays the same -- case in point, Whirled's MemberName + // bases equal()ity on an integer identifier. TODO: investigate whether this is a + // reasonable assumption and whether the behaviour change might break something. + if (info.username.getNormal().equals(_name.getNormal())) { return false; } info.username = _name;
Change the behaviour of the NameUpdater to play nicely with Name implementations where equal() does not depend on display name. Write cumbersome TODO comment. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1
threerings_narya
train
java
4c15afcb8ff1e8fe5158878dc479db0b81985282
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ setup( # Metadata author='Philippe BIONDI', author_email='phil(at)secdev.org', - maintainer='Pierre LALET, Guillaume VALADON', + maintainer='Pierre LALET, Gabriel POTTER, Guillaume VALADON', description='Scapy: interactive packet manipulation tool', long_description=get_long_description(), long_description_content_type='text/markdown',
Gabriel Potter is a Scapy maintainer
secdev_scapy
train
py
30e730df3d57f85d5906c4ae9ebfebd8018d2b3a
diff --git a/Model/Behavior/AttachmentBehavior.php b/Model/Behavior/AttachmentBehavior.php index <HASH>..<HASH> 100644 --- a/Model/Behavior/AttachmentBehavior.php +++ b/Model/Behavior/AttachmentBehavior.php @@ -425,12 +425,10 @@ class AttachmentBehavior extends ModelBehavior { if ($data) { $model->data[$alias] = $data + $model->data[$alias]; } + } - // If we are doing an update, delete the previous files that are being replaced - if ($model->id && $cleanup) { - $this->_cleanupOldFiles($model, $cleanup); - } + return true; } @@ -798,4 +796,4 @@ class AttachmentBehavior extends ModelBehavior { return $config; } -} \ No newline at end of file +}
Update AttachmentBehavior.php
milesj_uploader
train
php
cc1a6a93c9ad26e4d55143038d559f08afc4bf6e
diff --git a/lib/puppet_library/version.rb b/lib/puppet_library/version.rb index <HASH>..<HASH> 100644 --- a/lib/puppet_library/version.rb +++ b/lib/puppet_library/version.rb @@ -16,5 +16,5 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. module PuppetLibrary - VERSION = "0.0.2" + VERSION = "0.1.0" end
[release] Incremented version number
drrb_puppet-library
train
rb
f14046dfc12ac521be6fda78dcba2d0f74258269
diff --git a/src/Webiny/Component/Validation/Validators/CountryCode.php b/src/Webiny/Component/Validation/Validators/CountryCode.php index <HASH>..<HASH> 100644 --- a/src/Webiny/Component/Validation/Validators/CountryCode.php +++ b/src/Webiny/Component/Validation/Validators/CountryCode.php @@ -265,6 +265,10 @@ class CountryCode implements ValidatorInterface 'ZW', ]; + if (!$value) { + return true; + } + if (in_array($value, $twoLetterCodes)) { return true; }
fix on country code validator - if !$value, then it must be considered as true!
Webiny_Framework
train
php
5e51edd7670b4af4fca39fd3b7a50048684685da
diff --git a/jaulp.wicket.behaviors/src/main/java/de/alpharogroup/wicket/behaviors/FocusRequestBehavior.java b/jaulp.wicket.behaviors/src/main/java/de/alpharogroup/wicket/behaviors/FocusRequestBehavior.java index <HASH>..<HASH> 100644 --- a/jaulp.wicket.behaviors/src/main/java/de/alpharogroup/wicket/behaviors/FocusRequestBehavior.java +++ b/jaulp.wicket.behaviors/src/main/java/de/alpharogroup/wicket/behaviors/FocusRequestBehavior.java @@ -169,7 +169,6 @@ public class FocusRequestBehavior extends Behavior super.renderHead(component, response); component.setOutputMarkupId(true); response.render(OnLoadHeaderItem.forScript(newJavaScript(component))); - super.renderHead(component, response); } -} \ No newline at end of file +}
duplicate call of super.renderHead removed duplicate call of super.renderHead(component, response)
astrapi69_jaulp-wicket
train
java
9346a999d8d1ce726b71ad5dc8d95b1dd91b23c6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ install_requires = [ "aws-xray-sdk!=0.96,>=0.93", "responses>=0.9.0", "idna<2.9,>=2.5", - "cfn-lint", + "cfn-lint>=0.4.0", "sshpubkeys>=3.1.0,<4.0" ]
Force minimum version of cfn-lint. Closes #<I>.
spulec_moto
train
py
625a36c321624f6897b83ba467c49a8c5c35487c
diff --git a/mplane_http_transport.js b/mplane_http_transport.js index <HASH>..<HASH> 100644 --- a/mplane_http_transport.js +++ b/mplane_http_transport.js @@ -120,6 +120,7 @@ function checkSpecifications(options , action , callback){ if (body.length == 0) { console.log("+"); } else { + console.log(body); /* for (var i= 0; i<body.length; i++){ var spec = mplane.from_dict(body[i]); @@ -128,6 +129,9 @@ function checkSpecifications(options , action , callback){ async.eachSeries(body ,function(curSpec , callback){ var spec = mplane.from_dict(curSpec); + console.log("---------"); + console.log(spec); + console.log("---------"); action(spec , callback); } , function(){
Trying to understand why only an action is performed
finvernizzi_mplane_http_transport
train
js
900659feeb6d4ce95abb68c7d68767c1bb586111
diff --git a/src/edit/CodeMirror.js b/src/edit/CodeMirror.js index <HASH>..<HASH> 100644 --- a/src/edit/CodeMirror.js +++ b/src/edit/CodeMirror.js @@ -45,7 +45,6 @@ export function CodeMirror(place, options) { themeChanged(this) if (options.lineWrapping) this.display.wrapper.className += " CodeMirror-wrap" - if (options.autofocus && !mobile) display.input.focus() initScrollbars(this) this.state = { @@ -64,6 +63,8 @@ export function CodeMirror(place, options) { specialChars: null } + if (options.autofocus && !mobile) display.input.focus() + // Override magic textarea content restore that IE sometimes does // on our hidden textarea on reload if (ie && ie_version < 11) setTimeout(() => this.display.input.reset(true), 20)
Don't autofocus until the editor has a .state property Since the input object might try to read from that on focusing Issue #<I>
codemirror_CodeMirror
train
js
118ba8a772b1ea1702d4ea291c64cb8ece8a5d35
diff --git a/salt/modules/alternatives.py b/salt/modules/alternatives.py index <HASH>..<HASH> 100644 --- a/salt/modules/alternatives.py +++ b/salt/modules/alternatives.py @@ -82,7 +82,7 @@ def show_link(name): try: with salt.utils.fopen(path, 'rb') as r_file: - return r_file.readlines()[1] + return r_file.readlines()[1].rstrip('\n') except OSError: log.error( 'alternatives: {0} does not exist'.format(name)
Update alternatives module to strip newline chars Refs an error exposed by #<I>
saltstack_salt
train
py
2a039497cec3d50d0d3a62bf3368a7f96033013c
diff --git a/benchmarks/HydratorBench.php b/benchmarks/HydratorBench.php index <HASH>..<HASH> 100644 --- a/benchmarks/HydratorBench.php +++ b/benchmarks/HydratorBench.php @@ -16,7 +16,7 @@ class HydratorBench extends AbstractBench public function provideObjects() { $complicatedXxlSubs = []; - for ($i = 0; $i < 100; $i++) { + for ($i = 0; $i < 25; $i++) { $complicatedXxlSubs[] = [ 'id' => $i, 'slug' => 'Wyrihaximus/php-travis-client',
<I> also takes to long, trying <I>
php-api-clients_hydrator
train
php
992ec291bc4531e217cb625fec1cc915cfd68477
diff --git a/core/node/groups.go b/core/node/groups.go index <HASH>..<HASH> 100644 --- a/core/node/groups.go +++ b/core/node/groups.go @@ -223,8 +223,11 @@ func Online(bcfg *BuildCfg, cfg *config.Config) fx.Option { recordLifetime = d } + /* don't provide from bitswap when the strategic provider service is active */ + shouldBitswapProvide := !cfg.Experimental.StrategicProviding + return fx.Options( - fx.Provide(OnlineExchange(!cfg.Experimental.StrategicProviding)), + fx.Provide(OnlineExchange(shouldBitswapProvide)), fx.Provide(Namesys(ipnsCacheSize)), fx.Invoke(IpnsRepublisher(repubPeriod, recordLifetime)),
Give argument intent revealing name (and add comment)
ipfs_go-ipfs
train
go
305cf4a67a2b02fc32a55f65a496c313bf7e875f
diff --git a/src/init.php b/src/init.php index <HASH>..<HASH> 100644 --- a/src/init.php +++ b/src/init.php @@ -7,7 +7,7 @@ if (!defined('DS')) { } error_reporting(E_ALL); -if (!defined('KAHLAN_DISABLE_FUNCTIONS') || !KAHLAN_DISABLE_FUNCTIONS) { +if (!defined('KAHLAN_DISABLE_FUNCTIONS') || !KAHLAN_DISABLE_FUNCTIONS || !getenv('KAHLAN_DISABLE_FUNCTIONS')) { function before($closure) { return Suite::current()->before($closure);
Added ability to disable Kahlan functions by environment variable.
kahlan_kahlan
train
php
fdeb4277172179dd542baec2de065b87e0a24723
diff --git a/lib/Loop/Driver.php b/lib/Loop/Driver.php index <HASH>..<HASH> 100644 --- a/lib/Loop/Driver.php +++ b/lib/Loop/Driver.php @@ -91,7 +91,11 @@ abstract class Driver { * Executes a single tick of the event loop. */ private function tick() { - $this->deferQueue = \array_merge($this->deferQueue, $this->nextTickQueue); + if (empty($this->deferQueue)) { + $this->deferQueue = $this->nextTickQueue; + } else { + $this->deferQueue = \array_merge($this->deferQueue, $this->nextTickQueue); + } $this->nextTickQueue = []; $this->activate($this->enableQueue);
Use simple assignment if queue is empty The common case is for the queue to be empty at the start of the tick, so a call to array_merge() can be avoided in most cases.
amphp_amp
train
php
02caf43d2ed2f00d748d65689eb212fa19250f25
diff --git a/v3.3/glfw/vulkan.go b/v3.3/glfw/vulkan.go index <HASH>..<HASH> 100644 --- a/v3.3/glfw/vulkan.go +++ b/v3.3/glfw/vulkan.go @@ -5,6 +5,7 @@ package glfw #include "glfw/src/internal.h" GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); +GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); // Helper function for doing raw pointer arithmetic static inline const char* getArrayIndex(const char** array, unsigned int index) { @@ -12,7 +13,7 @@ static inline const char* getArrayIndex(const char** array, unsigned int index) } void* getVulkanProcAddr() { - return vkGetInstanceProcAddr; + return glfwGetInstanceProcAddress; } */ import "C"
glfwGetInstanceProcAddress reference added.
go-gl_glfw
train
go
ea60798b46b4400bdb5602593097e599965df75d
diff --git a/tests/test_commands.py b/tests/test_commands.py index <HASH>..<HASH> 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1,5 +1,5 @@ import unittest -import os, shutil, tempfile, types, time +import os, shutil, tempfile, types, time, json import pdb from fragments import commands, __version__ @@ -46,6 +46,21 @@ class CommandBase(unittest.TestCase): return file_name, file_path + +class TestConfig(CommandBase): + + def test_version_number_updated_on_dump(self): + init() + config = FragmentsConfig() + raw_config = json.loads(file(config.path, 'r').read()) + raw_config['version'] = __version__[0:2] +(__version__[2] - 1,) + file(config.path, 'w').write(json.dumps(raw_config, sort_keys=True, indent=4)) + config = FragmentsConfig() + config.dump() + config = FragmentsConfig() + self.assertEquals(config['version'], __version__) + + class TestHelpCommand(CommandBase): def test_help(self):
test that version number is updated upon config change
glyphobet_fragments
train
py
d1249c1a91df614ceb10167155b0265b9578835e
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -30,13 +30,8 @@ module ActiveRecord end def default_scoped # :nodoc: - scope = build_default_scope - - if scope - relation.spawn.merge!(scope) - else - relation - end + scope = relation + build_default_scope(scope) || scope end # Adds a class method for retrieving and querying objects.
Refactor `default_scoped` to avoid creating extra relation and merging
rails_rails
train
rb
eab59099ac545752fff6d376cad878950bd6f7bf
diff --git a/librosa/core/constantq.py b/librosa/core/constantq.py index <HASH>..<HASH> 100644 --- a/librosa/core/constantq.py +++ b/librosa/core/constantq.py @@ -160,7 +160,24 @@ def cqt(y, sr=22050, hop_length=512, fmin=None, n_bins=84, res_type = 'sinc_best' else: res_type = 'sinc_best' - warnings.warn("Filter passband lies beyond resampling bandwidth") + + if res_type == 'sinc_fastest' and audio._HAS_SAMPLERATE: + + # How many times can we downsample by 2 before filtering? + # Requirements: + # filter_cutoff < BW*nyquist # (BW is resampling bandwidth fraction) + # hop_length > 2**n_octaves + + downsample_count1 = int(np.ceil(np.log2(BW_FASTEST * nyquist + / filter_cutoff)) - 1) + downsample_count2 = int(np.ceil(np.log2(hop_length) - n_octaves) - 1) + downsample_count = min(downsample_count1, downsample_count2) + if downsample_count > 0: + downsample_factor = 2**downsample_count + hop_length = int(hop_length/downsample_factor) + y = audio.resample(y, sr, sr/downsample_factor, res_type=res_type) + sr = sr/downsample_factor + # Generate the basis filters
Add dynamic downsampling before CQT for efficiency
librosa_librosa
train
py
4ab94007840bb88154e3c7a54bd8e168630c034e
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2011, charles leifer' # built documents. # # The short X.Y version. -version = '0.7.0' +version = '0.7.1' # The full version, including alpha/beta/rc tags. -release = '0.7.0' +release = '0.7.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ f.close() setup( name='peewee', - version="0.7.0", + version="0.7.1", description='a little orm', long_description=readme, author='Charles Leifer',
Bumping to <I>
coleifer_peewee
train
py,py
5503cb7a4003e4eed8a0971ebd373d1d2f527ffa
diff --git a/lib/client/index.js b/lib/client/index.js index <HASH>..<HASH> 100644 --- a/lib/client/index.js +++ b/lib/client/index.js @@ -97,6 +97,6 @@ Client.prototype.get = function(nameService) { request(service.host + ':' + service.port + prefix + '/' + action, function (error, response, body) { callback(error, JSON.parse(body)); }); - + }.bind(this); }; diff --git a/lib/client/socket.js b/lib/client/socket.js index <HASH>..<HASH> 100644 --- a/lib/client/socket.js +++ b/lib/client/socket.js @@ -5,7 +5,7 @@ module.exports = function(socket, client) { socket.on('connect', function() { client.add(); client.registerAsListener(); - cliente.emittSubscribed(); + client.emittSubscribed(); }); socket.on('disconnect', function() { diff --git a/lib/socket.js b/lib/socket.js index <HASH>..<HASH> 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -31,8 +31,6 @@ module.exports = function(redis) { socket.on('subscribe on service', function(serviceSubscribe, alias) { - console.log(socket.id) - redis.getRegistrations({ name: serviceSubscribe }, function(err, services) {
<I>-alpha - fix subscribed on socket
voudeonibus_Tourniquet
train
js,js,js
7e7c4073714704bd0553cd8db4090f85c1607ff4
diff --git a/jquery.selectable.js b/jquery.selectable.js index <HASH>..<HASH> 100644 --- a/jquery.selectable.js +++ b/jquery.selectable.js @@ -215,8 +215,15 @@ if(jQuery) (function($) { var container = this, options = $(container).data('options.selectable'), - thisIndex = $(item).index(), - lastIndex = $(container).data('lastIndex.selectable'); + items = $(container).find(options.items), + lastIndex = $(container).data('lastIndex.selectable'), + thisIndex, + i; + + // Determine the current item's index (might not be a sibling, so we can't use `index()`) + for(i = 0; i < items.length; i++) { + if($(items).eq(i).is(item)) thisIndex = i; + } // Don't modify selection when disabled if($(container).data('disabled.selectable')) return;
Fix selection bug Fixes a bug where shift+click fails when items aren't siblings.
claviska_jquery-selectable
train
js
40adf80fd254219df7b2387e1e4daff939fc7e15
diff --git a/AltoRouter.php b/AltoRouter.php index <HASH>..<HASH> 100644 --- a/AltoRouter.php +++ b/AltoRouter.php @@ -55,7 +55,7 @@ class AltoRouter { call_user_func_array(array($this, 'map'), $route); } } - + /** * Set the base path. * Useful if you are running your application from a subdirectory.
Update AltoRouter.php
dannyvankooten_AltoRouter
train
php
365e52dbc70f9704f290ea358ce288679e70226b
diff --git a/fex/collection.py b/fex/collection.py index <HASH>..<HASH> 100644 --- a/fex/collection.py +++ b/fex/collection.py @@ -28,10 +28,10 @@ class FeatureExtractorCollection(object): def run(self, dataset_path): """Run all FeatureExtractors and output results to CSV.""" - features = self.generate_features(self._feature_extractors) + features = self._generate_features(self._feature_extractors) csv.dump_dict(features, dataset_path) - def generate_features(self, feature_extractors): + def _generate_features(self, feature_extractors): """Run all FeatureExtractors and record results in a key-value format. :param feature_extractors: iterable of `FeatureExtractor` objects.
give only internally used method a protected name
bayesimpact_fex
train
py
22411702eafc2f44a6ac0b7ecee503607b1196cf
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -16,5 +16,5 @@ if (undefined === process.env.NODE_PATH) { module.exports = function(grunt) { grunt.initConfig((function () { return require(root + 'webino-devkit'); - })().config(grunt, ['zend', 'module', 'auth'])); + })().config(grunt, ['module', 'auth', 'zend'])); };
Updated Gruntfile, fixed webino-devkit modules order by priority
webino_WebinoDev
train
js
ea2bb6d901385193cfc747ee167d26e7c81d43d2
diff --git a/src/nlpia/book/examples/ch09_imdb_sentiment_lstm_v1.py b/src/nlpia/book/examples/ch09_imdb_sentiment_lstm_v1.py index <HASH>..<HASH> 100644 --- a/src/nlpia/book/examples/ch09_imdb_sentiment_lstm_v1.py +++ b/src/nlpia/book/examples/ch09_imdb_sentiment_lstm_v1.py @@ -3,7 +3,7 @@ # In[1]: - +from __future__ import print_function import keras @@ -20,7 +20,6 @@ Some configurations won't converge. - LSTM loss decrease patterns during training can be quite different from what you see with CNNs/MLPs/etc. ''' -from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility
"from __future__ import print_function" is moved to the beginning of file
totalgood_nlpia
train
py
4aa3a4aae4eca6f000e23962eaeed66174d435be
diff --git a/Email/Writer.php b/Email/Writer.php index <HASH>..<HASH> 100644 --- a/Email/Writer.php +++ b/Email/Writer.php @@ -325,8 +325,12 @@ class sb_Email_Writer { } else { $message .= "--".$mixed_boundary."\r\n"; } - $message .= "Content-class: urn:content-classes:calendarmessage;\r\n"; - $message .= "Content-Type: ".$attachment->mime_type.";\r\n"; + + if($attachment->mime_type == 'text/calendar'){ + $message .= "Content-class: urn:content-classes:calendarmessage;\r\n"; + } + + $message .= "Content-Type: ".$attachment->mime_type.";\r\n"; $message .= " name=".$attachment->name."\r\n"; $message .= "Content-Transfer-Encoding: ".$attachment->encoding."\r\n";
fixed bug that pased content-classes:calendarmessage for every attachment regarless of itf it was type text/calendar
surebert_surebert-framework
train
php
b73a6a49fce2fe593c3e699f55c5127d1b55150e
diff --git a/lib/rest-ftp-daemon/constants.rb b/lib/rest-ftp-daemon/constants.rb index <HASH>..<HASH> 100644 --- a/lib/rest-ftp-daemon/constants.rb +++ b/lib/rest-ftp-daemon/constants.rb @@ -84,18 +84,17 @@ NOTIFY_IDENTIFIER_LEN = 4 # Dashboard row styles DASHBOARD_JOB_STYLES = { - JOB_STATUS_QUEUED => :active, - JOB_STATUS_FAILED => :warning, - JOB_STATUS_FINISHED => :success, - JOB_STATUS_UPLOADING => :info, - JOB_STATUS_RENAMING => :info, + JOB_STATUS_QUEUED => :active, + JOB_STATUS_FAILED => :warning, + JOB_STATUS_FINISHED => :success, + JOB_STATUS_UPLOADING => :info, + JOB_STATUS_RENAMING => :info, } DASHBOARD_WORKER_STYLES = { - waiting: :success, - running: :info, - crashed: :danger, - done: :success, - dead: :danger, + WORKER_STATUS_WAITING => :success, + WORKER_STATUS_RUNNING => :info, + WORKER_STATUS_CRASHED => :danger, + WORKER_STATUS_FINISHED => :success, }
fixed constants according to status format changes
bmedici_rest-ftp-daemon
train
rb
0e95e299d61998f42c5bda44605661915c695b97
diff --git a/Examples/Calculator/spec/librarian_spec.rb b/Examples/Calculator/spec/librarian_spec.rb index <HASH>..<HASH> 100644 --- a/Examples/Calculator/spec/librarian_spec.rb +++ b/Examples/Calculator/spec/librarian_spec.rb @@ -24,7 +24,7 @@ class Find end def Find.joined_together words - words.inject :+ + words.join end def Find.words_from sentence
Refactoring: Make joined_together_words a little clearer
RiverGlide_CukeSalad
train
rb
0d173d4c351f87c3b46b7daa55a09ab740784aef
diff --git a/src/OAuth2/Storage/ClientInterface.php b/src/OAuth2/Storage/ClientInterface.php index <HASH>..<HASH> 100644 --- a/src/OAuth2/Storage/ClientInterface.php +++ b/src/OAuth2/Storage/ClientInterface.php @@ -43,5 +43,5 @@ interface ClientInterface * @param string $redirectUri The client's redirect URI (default = "null") * @return bool|array Returns false if the validation fails, array on success */ - public function get($clientId = null, $clientSecret = null, $redirectUri = null); + public function getClient($clientId = null, $clientSecret = null, $redirectUri = null); } \ No newline at end of file diff --git a/src/OAuth2/Storage/ScopeInterface.php b/src/OAuth2/Storage/ScopeInterface.php index <HASH>..<HASH> 100644 --- a/src/OAuth2/Storage/ScopeInterface.php +++ b/src/OAuth2/Storage/ScopeInterface.php @@ -28,5 +28,5 @@ interface ScopeInterface * @param string $scope The scope * @return bool|array If the scope doesn't exist return false */ - public function get($scope); + public function getScope($scope); }
Renamed methods to prevent ORM conflict
thephpleague_oauth2-server
train
php,php
0627d1456783d453733143deecb1255b7dd637cf
diff --git a/test/reference_test.rb b/test/reference_test.rb index <HASH>..<HASH> 100644 --- a/test/reference_test.rb +++ b/test/reference_test.rb @@ -32,6 +32,7 @@ class ReferenceTest < Rugged::SandboxedTestCase assert_equal [ "refs/heads/br2", "refs/heads/dir", + "refs/heads/ident", "refs/heads/long-file-name", "refs/heads/master", "refs/heads/packed",
Change test case for a change in the fixture data.
libgit2_rugged
train
rb
7fc60ab1d02da8ed7f07ee8fa65392b1b84dc823
diff --git a/lib/omnibus/software.rb b/lib/omnibus/software.rb index <HASH>..<HASH> 100644 --- a/lib/omnibus/software.rb +++ b/lib/omnibus/software.rb @@ -86,7 +86,7 @@ module Omnibus @dependencies = [] @whitelist_files = [] - instance_eval(io, filename, 0) + instance_eval(io, filename) end def <=>(other)
Remove explicit line number 0 (in instance_eval) might cause misleading exception and backtrace messages. The default is 1. Fixes #<I>.
chef_omnibus
train
rb
6c0a372379a323b5e33481682f9415705d1abb96
diff --git a/niworkflows/interfaces/tests/test_bids.py b/niworkflows/interfaces/tests/test_bids.py index <HASH>..<HASH> 100644 --- a/niworkflows/interfaces/tests/test_bids.py +++ b/niworkflows/interfaces/tests/test_bids.py @@ -521,11 +521,7 @@ def test_DerivativesDataSink_data_dtype_source( size = (30, 30, 30, 10) - hdr = nb.Nifti1Header() - hdr.set_qform(np.eye(4), code=0) - hdr.set_sform(np.eye(4), code=2) - hdr.set_data_dtype(dtype) - nb.Nifti1Image(np.zeros(size, dtype=dtype), np.eye(4), hdr).to_filename(fname) + nb.Nifti1Image(np.zeros(size, dtype=dtype), np.eye(4)).to_filename(fname) in_file = str(tmp_path / "in.nii") make_empty_nii_with_dtype(in_file, in_dtype)
Simplify test_DerivativesDataSink_data_dtype_source
poldracklab_niworkflows
train
py
2a931e65ac37f804daad569c3fbfd1149729bf9e
diff --git a/api/routes.js b/api/routes.js index <HASH>..<HASH> 100644 --- a/api/routes.js +++ b/api/routes.js @@ -364,6 +364,12 @@ var wt2html = function( req, res, wt ) { } function parsePageWithOldid() { + if (prefix === 'urwiki' && res.local('pageName') === 'نام_مقامات_اے') { + env.log("error", "Returning http 500 for urwiki:نام_مقامات_اے'"); + return new Promise(function(resolve, reject) { + reject(); + }); + } return parse( env, req, res ).then(function( doc ) { if ( req.headers.cookie || v2 ) { // Don't cache requests with a session.
HACK: Return <I> for urwiki:نام_مقامات_اے * This page is memory/cpu spikes and timeouts that aren't doing a clean process restart. * Weekend and hard to get things fixed now. So, hack till Monday. Change-Id: I<I>ceedb<I>ccba6dcb<I>d<I>a<I>f1c<I>
wikimedia_parsoid
train
js
46d5d3e583138916ce4481138248d66929d685bc
diff --git a/nomad/config.go b/nomad/config.go index <HASH>..<HASH> 100644 --- a/nomad/config.go +++ b/nomad/config.go @@ -43,9 +43,9 @@ func init() { } } -var ( - DefaultRPCAddr = &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4647} -) +func DefaultRPCAddr() *net.TCPAddr { + return &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4647} +} // Config is used to parameterize the server type Config struct { @@ -362,7 +362,7 @@ func DefaultConfig() *Config { RaftConfig: raft.DefaultConfig(), RaftTimeout: 10 * time.Second, LogOutput: os.Stderr, - RPCAddr: DefaultRPCAddr, + RPCAddr: DefaultRPCAddr(), SerfConfig: serf.DefaultConfig(), NumSchedulers: 1, ReconcileInterval: 60 * time.Second,
test: fix race around reused default rpc addr The default RPC addr was a global which is fine for normal runtime use when it only has a single user. However many tests modify it and cause races. Follow our convention of returning defaults from funcs instead of using globals.
hashicorp_nomad
train
go
b125190b87901e02c16a73e88fca9bdd1a6f9c40
diff --git a/pyemma/coordinates/data/feature_reader.py b/pyemma/coordinates/data/feature_reader.py index <HASH>..<HASH> 100644 --- a/pyemma/coordinates/data/feature_reader.py +++ b/pyemma/coordinates/data/feature_reader.py @@ -90,6 +90,9 @@ class FeatureReader(ReaderInterface): self.featurizer = featurizer self.topfile = featurizer.topologyfile + # Check that the topology and the files in the filelist can actually work together + self._assert_toptraj_consistency() + # iteration self._mditer = None # current lag time @@ -232,3 +235,11 @@ class FeatureReader(ReaderInterface): def parametrize(self, stride=1): if self.in_memory: self._map_to_memory(stride) + + def _assert_toptraj_consistency(self): + r""" Check if the topology and the trajfiles of the reader have the same n_atoms""" + with mdtraj.open(self.trajfiles[0],'r') as fh: + xyz, __, __, __ = fh.read(n_frames=1) + assert xyz.shape[1] == self.featurizer.topology.n_atoms, "Mismatch in the number of atoms between the topology" \ + " and the first trajectory file, %u vs %u"% \ + (self.featurizer.topology.n_atoms, xyz.shape[1])
[FeatureReader] method top_matches_traj added
markovmodel_PyEMMA
train
py
8548b7f419aee6b61376706475b77f5c9d2cd848
diff --git a/lib/kalc/interpreter.rb b/lib/kalc/interpreter.rb index <HASH>..<HASH> 100644 --- a/lib/kalc/interpreter.rb +++ b/lib/kalc/interpreter.rb @@ -83,7 +83,7 @@ module Kalc }) env.add_function(:ROUND, lambda { |cxt, num, digits| - num.eval(cxt).round(digits.eval(cxt)) + num.eval(cxt).round(digits.eval(cxt).to_i) }) env.add_function(:SUM, lambda { |cxt, *args| diff --git a/spec/interpreter_spec.rb b/spec/interpreter_spec.rb index <HASH>..<HASH> 100644 --- a/spec/interpreter_spec.rb +++ b/spec/interpreter_spec.rb @@ -120,6 +120,12 @@ describe Kalc::Interpreter do end end + context 'Round function' do + it { evaluate('ROUND(3.256,2)').should eq(3.26) } + it { evaluate('ROUND(3.2,2)').should eq(3.20) } + it { evaluate('ROUND(233.256,-2)').should eq(200) } + end + private def evaluate(expression) g = @grammar.parse(expression)
Fix round function. After the change to return BigDecimals, it wasn't updated the digits to be an integer.
mrcsparker_kalc
train
rb,rb
bce89f1ff65da483066c3ed54cc10d1f275e1630
diff --git a/src-test/core/domhelpertest.js b/src-test/core/domhelpertest.js index <HASH>..<HASH> 100644 --- a/src-test/core/domhelpertest.js +++ b/src-test/core/domhelpertest.js @@ -97,3 +97,12 @@ DomHelperTest.prototype.testSetStyle = function() { assertEquals('3px', e.style.left) assertEquals('1px', e.style.top); }; + +DomHelperTest.prototype.testHasSupportForStyle = function() { + assertUndefined(this.domHelper_.supportForStyle_); + assertBoolean(this.domHelper_.hasSupportForStyle_()); + this.domHelper_.supportForStyle_ = false; + assertFalse(this.domHelper_.hasSupportForStyle_()); + this.domHelper_.supportForStyle_ = true; + assertTrue(this.domHelper_.hasSupportForStyle_()); +};
Add an additional test for the feature detection behavior
typekit_webfontloader
train
js
e84d537a9ba0ffd2b67735b9b602850d64e7b17c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ sys.dont_write_bytecode = True setup( name='pipe2py', - version='0.23.1', + version='0.23.2', description=( 'A project to compile Yahoo! Pipes into Python. ' 'The pipe2py package can compile a Yahoo! Pipe into pure Python source'
Bump to version <I>
ggaughan_pipe2py
train
py
9af61b207f3ec4ab8ec66e32a471eaa605bea7a4
diff --git a/lxd/container_snapshot.go b/lxd/container_snapshot.go index <HASH>..<HASH> 100644 --- a/lxd/container_snapshot.go +++ b/lxd/container_snapshot.go @@ -6,6 +6,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strings" "github.com/gorilla/mux" @@ -161,6 +162,10 @@ func snapshotHandler(d *Daemon, r *http.Request) Response { return response } + snapshotName, err = url.QueryUnescape(snapshotName) + if err != nil { + return SmartError(err) + } sc, err := containerLoadByName( d.State(), containerName+
containers: fix snapshot deletion Closes #<I>.
lxc_lxd
train
go
42b44bf0cc321bc529a3aedbe9d1667c7bb295d5
diff --git a/tensorforce/updater/deep_q_network.py b/tensorforce/updater/deep_q_network.py index <HASH>..<HASH> 100644 --- a/tensorforce/updater/deep_q_network.py +++ b/tensorforce/updater/deep_q_network.py @@ -101,7 +101,7 @@ class DeepQNetwork(Model): self.optimizer = tf.train.RMSPropOptimizer(self.alpha, momentum=0.95, epsilon=0.01) self.create_training_operations() self.saver = tf.train.Saver() - writer = tf.train.SummaryWriter('logs', graph=tf.get_default_graph()) + writer = tf.summary.FileWriter('logs', graph=tf.get_default_graph()) self.session.run(tf.global_variables_initializer()) def get_action(self, state, episode=1, total_states=0):
switched tf.train.SummaryWriter to tr.summary.FileWriter
tensorforce_tensorforce
train
py
05afb7c656e3404b59b4dc44c64c624beefda6f6
diff --git a/lib/xcflushd/priority_auth_renewer.rb b/lib/xcflushd/priority_auth_renewer.rb index <HASH>..<HASH> 100644 --- a/lib/xcflushd/priority_auth_renewer.rb +++ b/lib/xcflushd/priority_auth_renewer.rb @@ -50,8 +50,6 @@ module Xcflushd # ensure thread-safety. @current_auths = Concurrent::Map.new - @random = Random.new - # TODO: Tune the options of the thread pool @thread_pool = Concurrent::ThreadPoolExecutor.new( max_threads: Concurrent.processor_count * 4) @@ -71,7 +69,7 @@ module Xcflushd private attr_reader :authorizer, :storage, :redis_pub, :redis_sub, :auth_valid_min, - :logger, :current_auths, :random, :thread_pool + :logger, :current_auths, :thread_pool def subscribe_to_requests_channel redis_sub.subscribe(AUTH_REQUESTS_CHANNEL) do |on|
priority_auth_renewer: delete unused 'random' attr
3scale_xcflushd
train
rb
92eaf48a5792cbef2993f4f35d0f2e75af840197
diff --git a/tests/cases/DisputesTest.php b/tests/cases/DisputesTest.php index <HASH>..<HASH> 100644 --- a/tests/cases/DisputesTest.php +++ b/tests/cases/DisputesTest.php @@ -39,6 +39,10 @@ class DisputesTest extends Base // } // } + + /* + * TO BE FIXED - DISPUTES TESTS KO - DATA ON ACCOUNT HAVE TO BE FIXED + * function test_Disputes_Get() { $dispute = $this->_api->Disputes->Get($this->_clientDisputes[0]->Id); @@ -473,4 +477,5 @@ class DisputesTest extends Base $this->markTestSkipped('INITIALIZATION FAILURE - cannot test disputes. Not exist any dispute.'); } } + */ }
Skip Disputes test Disputes tests has to be fixed (data issue)
Mangopay_mangopay2-php-sdk
train
php
636514ade6ad73815bd757cc0705eb9eec88bca5
diff --git a/lib/utils/webpackConfig.js b/lib/utils/webpackConfig.js index <HASH>..<HASH> 100644 --- a/lib/utils/webpackConfig.js +++ b/lib/utils/webpackConfig.js @@ -163,7 +163,10 @@ module.exports = function getWebpackConfig( ) { const basename = path.basename(file) - let plugins = userDefinedWebpackConfig.plugins || [] + let plugins = [] + if (userDefinedWebpackConfig.plugins) { + plugins = [...plugins, ...userDefinedWebpackConfig.plugins] + } if (commandIdentifiers) { plugins.push(
avoid mutating `userDefinedWebpackConfig.plugins` inside webpack configuration routine
skpm_skpm
train
js
6040bd6a38d1479c128de9a6ef204d73c07f2bb3
diff --git a/tests/Rules/AbstractRuleTestCase.php b/tests/Rules/AbstractRuleTestCase.php index <HASH>..<HASH> 100644 --- a/tests/Rules/AbstractRuleTestCase.php +++ b/tests/Rules/AbstractRuleTestCase.php @@ -53,7 +53,7 @@ abstract class AbstractRuleTestCase extends TestCase public function testValid() { foreach ($this->valid as $value) { - $this->assertTrue((new $this->classname($value))->isValid()); + $this->assertTrue((new $this->classname($value))->isValid(), $value); } } @@ -61,7 +61,7 @@ abstract class AbstractRuleTestCase extends TestCase { foreach ($this->invalid as $value) { - $this->assertFalse((new $this->classname($value))->isValid()); + $this->assertFalse((new $this->classname($value))->isValid(), $value); } } }
Added the value as the message for rule tester This way it is visible which input values fail when testing
Intervention_validation
train
php
a3d63a605b03b4324f8a078caed12e3994ae564f
diff --git a/lib/grit/git.rb b/lib/grit/git.rb index <HASH>..<HASH> 100644 --- a/lib/grit/git.rb +++ b/lib/grit/git.rb @@ -327,7 +327,12 @@ module Grit # Determine if fork(2) available. When false, native command invocation # uses Open3 instead of the POSIX optimized fork/exec native implementation. def can_fork? - @@can_fork ||= fork { exit! } && true + return @@can_fork if defined?(@@can_fork) + @@can_fork = + if pid = fork { exit! } + Process.wait(pid) + true + end rescue NotImplemented @@can_fork = false end
don't leave zombies around when testing support for fork(2)
mojombo_grit
train
rb
d14d84aff1c4a02a3a7c87aa50a29f0cde170000
diff --git a/DrdPlus/PersonProperties/PersonProperties.php b/DrdPlus/PersonProperties/PersonProperties.php index <HASH>..<HASH> 100644 --- a/DrdPlus/PersonProperties/PersonProperties.php +++ b/DrdPlus/PersonProperties/PersonProperties.php @@ -189,7 +189,7 @@ class PersonProperties extends StrictObject implements BasePropertiesInterface $this->dangerousness = new Dangerousness($this->getStrength(), $this->getWill(), $this->getCharisma()); $this->dignity = new Dignity($this->getIntelligence(), $this->getWill(), $this->getCharisma()); - $this->fight = new Fight($professionLevels->getFirstLevel()->getProfession()->getValue(), $this, $this->getSize()); + $this->fight = new Fight($professionLevels->getFirstLevel()->getProfession(), $this, $this->getSize()); $this->attack = new Attack($this->getAgility()); $this->shooting = new Shooting($this->getKnack()); $this->defense = new Defense($this->getAgility());
Necessary modification due to library incompatible changes
drdplusinfo_drdplus-properties-by-levels
train
php
79f47531b4f860e95d056694a48be5ece00ebdc7
diff --git a/src/Common/Console/Command/Make/Database/Migration.php b/src/Common/Console/Command/Make/Database/Migration.php index <HASH>..<HASH> 100644 --- a/src/Common/Console/Command/Make/Database/Migration.php +++ b/src/Common/Console/Command/Make/Database/Migration.php @@ -175,7 +175,7 @@ class Migration extends BaseMaker ); $aFields['QUERIES'] .= $this->tabs(2) . '$this->query(\'' . "\n"; - $aFields['QUERIES'] .= implode("\n", $aCreate) . "\n"; + $aFields['QUERIES'] .= str_replace("'", "\'", implode("\n", $aCreate)) . "\n"; $aFields['QUERIES'] .= $this->tabs(2) . '\');' . "\n"; }
Escaping single quotes when making the 0 migration
nails_common
train
php
60c01501411fb9c962d394fdf72f94c443508b7d
diff --git a/tests/test_helpers.py b/tests/test_helpers.py index <HASH>..<HASH> 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -128,7 +128,7 @@ def test_multi_daemon(pyscript): sys.stdout.flush() sys.stderr.write('27rUarEY9XRHap294GZ5s3B2oc248XcFuSQ\\n') sys.stderr.flush() - time.sleep(60) + time.sleep(30) MultiDaemon( name='foo_worker_{n:0>4}', @@ -189,7 +189,7 @@ def test_multi_daemon(pyscript): # Try to create a large amount of status data result = script.run( 'status', '--json', - '--fields=pid,name,cpu_times,cwd,environ,io_counters,open_files') + '--fields=pid,name,cmdline,cwd,environ,open_files') assert result.returncode == 0 statuses = json.loads(result.stdout.decode('ascii').rstrip('\n')) for n, status in enumerate(statuses):
Use different set of status fields that's more compatible
jnrbsn_daemonocle
train
py
48ebfc972b1f542b30e2bd71433dd7f6a6e8e92a
diff --git a/eventsourcing/tests/test_application_with_postgres.py b/eventsourcing/tests/test_application_with_postgres.py index <HASH>..<HASH> 100644 --- a/eventsourcing/tests/test_application_with_postgres.py +++ b/eventsourcing/tests/test_application_with_postgres.py @@ -44,3 +44,6 @@ class TestApplicationWithPostgres(TestApplicationWithPOPO): del os.environ["POSTGRES_USER"] del os.environ["POSTGRES_PASSWORD"] super().tearDown() + + +del TestApplicationWithPOPO diff --git a/eventsourcing/tests/test_application_with_sqlite.py b/eventsourcing/tests/test_application_with_sqlite.py index <HASH>..<HASH> 100644 --- a/eventsourcing/tests/test_application_with_sqlite.py +++ b/eventsourcing/tests/test_application_with_sqlite.py @@ -25,3 +25,6 @@ class TestApplicationWithSQLite(TestApplicationWithPOPO): del os.environ["CREATE_TABLE"] del os.environ["SQLITE_DBNAME"] super().tearDown() + + +del TestApplicationWithPOPO
Del imported test case (so it doesn't run).
johnbywater_eventsourcing
train
py,py
e4c0ef42033d2c1ea85eee0b4276b6289ae6644a
diff --git a/spec/features/new_project_spec.rb b/spec/features/new_project_spec.rb index <HASH>..<HASH> 100644 --- a/spec/features/new_project_spec.rb +++ b/spec/features/new_project_spec.rb @@ -119,7 +119,6 @@ RSpec.describe "Suspend a new project with default configuration" do end it "configures public_file_server.headers in production" do - IO.write("production_config.rb", production_config) expect(production_config).to match( /^ +config.public_file_server.headers = {\n +"Cache-Control" => "public,/, )
Do not create test file in repo root folder
thoughtbot_suspenders
train
rb
fee4c11b4141442b513f23cc23e15692e8c94f06
diff --git a/datatypes/ezpaex/ezpaextype.php b/datatypes/ezpaex/ezpaextype.php index <HASH>..<HASH> 100644 --- a/datatypes/ezpaex/ezpaextype.php +++ b/datatypes/ezpaex/ezpaextype.php @@ -212,7 +212,8 @@ class ezpaextype extends eZDataType // Check if the password has changed if ( trim( $newPassword ) && ( $newPassword != "_ezpassword" ) ) { - if ( eZUser::currentUserID() == $contentObjectID ) + $currentUserID = eZUser::currentUserID(); + if ( $currentUserID == $contentObjectID ) { // If self editing, set last_updated to current time $passwordLastUpdated = time(); @@ -220,6 +221,11 @@ class ezpaextype extends eZDataType // if audit is enabled password changes should be logged eZAudit::writeAudit( 'user-password-change-self', array( ) ); } + else if ( $currentUserID == eZUser::anonymousId() ) + { + // register, @see http://issues.ez.no/15391 + $passwordLastUpdated = time(); + } else { // If changing other user's password, set last_updated to 0 to force
Fixed #<I>: ezmbpaex : after registering, you have to change password immediately
ezsystems_ezmbpaex
train
php
3ec157398f995130208a46bd6764b1ab269432ea
diff --git a/src/Controllers/DeleteController.php b/src/Controllers/DeleteController.php index <HASH>..<HASH> 100644 --- a/src/Controllers/DeleteController.php +++ b/src/Controllers/DeleteController.php @@ -2,6 +2,7 @@ namespace UniSharp\LaravelFilemanager\Controllers; +use Illuminate\Support\Facades\Storage; use UniSharp\LaravelFilemanager\Events\ImageIsDeleting; use UniSharp\LaravelFilemanager\Events\ImageWasDeleted; @@ -18,6 +19,12 @@ class DeleteController extends LfmController $errors = []; foreach ($item_names as $name_to_delete) { + $file = $this->lfm->setName($name_to_delete); + + if (!Storage::disk($this->helper->config('disk'))->exists($file->path('storage'))) { + abort(404); + } + $file_to_delete = $this->lfm->pretty($name_to_delete); $file_path = $file_to_delete->path();
security fix: avoid deleting inappropriate files
UniSharp_laravel-filemanager
train
php
175d43f4e7ed0083573902b741621852ac30dce9
diff --git a/topic.go b/topic.go index <HASH>..<HASH> 100644 --- a/topic.go +++ b/topic.go @@ -241,7 +241,7 @@ func (t *Topic) Publish(ctx context.Context, data []byte, opts ...PubOpt) error t.p.disc.Bootstrap(ctx, t.topic, pub.ready) } - return t.p.val.Publish(&Message{m, t.p.host.ID(), nil}) + return t.p.val.PushLocal(&Message{m, t.p.host.ID(), nil}) } // WithReadiness returns a publishing option for only publishing when the router is ready. diff --git a/validation.go b/validation.go index <HASH>..<HASH> 100644 --- a/validation.go +++ b/validation.go @@ -210,9 +210,10 @@ func (v *validation) RemoveValidator(req *rmValReq) { } } -// Publish synchronously accepts a locally published message, performs applicable -// validations and pushes the message for propagate by the pubsub system -func (v *validation) Publish(msg *Message) error { +// PushLocal synchronously pushes a locally published message and performs applicable +// validations. +// Returns an error if validation fails +func (v *validation) PushLocal(msg *Message) error { v.p.tracer.PublishMessage(msg) err := v.p.checkSignature(msg)
rename validation.Publish to PushLocal
libp2p_go-libp2p-pubsub
train
go,go
5ed40bc566f8a88e8a2146377e1c13b7f00e35d4
diff --git a/tools/init_utility_token.js b/tools/init_utility_token.js index <HASH>..<HASH> 100644 --- a/tools/init_utility_token.js +++ b/tools/init_utility_token.js @@ -434,7 +434,6 @@ InitUtilityToken.prototype = { return new Promise( (resolve,reject) => { const json = JSON.stringify(config, null, 4); - const configFilePath = coreConstants.OST_MEMBER_CONFIG_FILE_PATH; logger.log("Updating Config File:" , configFilePath ); fs.writeFile(configFilePath, json, err => err ? reject(err) : resolve() ); logger.log("Config file updated!");
writing & reading member details in shared config path.
OpenSTFoundation_openst-platform
train
js
acc4954499f4c84f00ee787b80504f9612341450
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -82,7 +82,6 @@ module.exports = function (grunt) { exec: { rollup: './node_modules/.bin/rollup -c', lint: './node_modules/.bin/standard', - format: './node_modules/.bin/prettier -c "**/*.{html,json,md}"', 'browserstack-runner': 'node_modules/.bin/browserstack-runner --verbose' } })
Remove obsolete grunt task We have a npm script for format.
js-cookie_js-cookie
train
js
9f29cb7e8edd0a41016ed5c08361498c687faed5
diff --git a/generators/generator-constants.js b/generators/generator-constants.js index <HASH>..<HASH> 100644 --- a/generators/generator-constants.js +++ b/generators/generator-constants.js @@ -29,7 +29,7 @@ const JAVA_VERSION = '11'; // Java version is forced to be 11. We keep the varia // Version of Node, NPM const HUSKY_VERSION = '4.3.6'; -const LINT_STAGED_VERSION = '10.5.1'; +const LINT_STAGED_VERSION = '10.5.3'; const NODE_VERSION = '14.15.0'; const NPM_VERSION = '6.14.9';
Update lint-staged version to <I>
jhipster_generator-jhipster
train
js
be5aa098b2d3f2011e167110c33d47bad3978ffc
diff --git a/src/main/java/com/marklogic/client/document/DocumentManager.java b/src/main/java/com/marklogic/client/document/DocumentManager.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/marklogic/client/document/DocumentManager.java +++ b/src/main/java/com/marklogic/client/document/DocumentManager.java @@ -1138,18 +1138,18 @@ public interface DocumentManager<R extends AbstractReadHandle, W extends Abstrac public Format getContentFormat(); /** - * Returns the categories of metadata to read, write, or patch. + * Returns the categories of metadata to read, write, patch, or search. * * @return the set of metadata categories */ public Set<Metadata> getMetadataCategories(); /** - * Specifies the categories of metadata to read, write, or patch. + * Specifies the categories of metadata to read, write, patch, or search. * @param categories the set of metadata categories */ public void setMetadataCategories(Set<Metadata> categories); /** - * Specifies the categories of metadata to read, write, or patch. + * Specifies the categories of metadata to read, write, patch, or search. * @param categories the set of metadata categories */ public void setMetadataCategories(Metadata... categories);
minor correction to javadoc - include search in things affected by setMetadataCategories
marklogic_java-client-api
train
java
6ceb9d30848d619e884498cc7cdf62dc88fa5aec
diff --git a/karma.conf.js b/karma.conf.js index <HASH>..<HASH> 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -46,7 +46,7 @@ autoWatch = false; // - Safari (only Mac) // - PhantomJS // - IE (only Windows) -browsers = ['Chrome']; +browsers = ['PhantomJS']; // If browser does not capture in given timeout [ms], kill it captureTimeout = 10000;
Update karma.conf.js
frapontillo_angular-bootstrap-switch
train
js
762b2c625cfdc7b679325a284c42b7920940a6b7
diff --git a/clientv3/watch.go b/clientv3/watch.go index <HASH>..<HASH> 100644 --- a/clientv3/watch.go +++ b/clientv3/watch.go @@ -317,14 +317,14 @@ func (w *watcher) Close() (err error) { w.streams = nil w.mu.Unlock() for _, wgs := range streams { - if werr := wgs.Close(); werr != nil { + if werr := wgs.close(); werr != nil { err = werr } } return err } -func (w *watchGrpcStream) Close() (err error) { +func (w *watchGrpcStream) close() (err error) { w.cancel() <-w.donec select {
clientv3: change watchGrpcStream Close() to close() private struct shouldn't have public method.
etcd-io_etcd
train
go
841a15eb2d3789fe7b047d718794d3b83a771629
diff --git a/src/base/extension/AssetsTokenParser.php b/src/base/extension/AssetsTokenParser.php index <HASH>..<HASH> 100644 --- a/src/base/extension/AssetsTokenParser.php +++ b/src/base/extension/AssetsTokenParser.php @@ -28,7 +28,7 @@ class AssetsTokenParser extends \Twig_TokenParser { */ public function parse(\Twig_Token $token) { $env = $this->parser->getEnvironment(); - $path = $env->getLoader()->getCacheKey($this->parser->getFilename()); + $path = $env->getLoader()->getCacheKey($this->parser->getStream()->getSourceContext()->getPath()); $hash = substr(md5($path), 0, 8); $name = $token->getValue(); $this->extractTemplateNodes();
FIxed deprecated method for twig
psfs_core
train
php
2eaf837b1d5208f3f45bab4a55cdddf8632518b5
diff --git a/example/react_withHOC/src/App.test.js b/example/react_withHOC/src/App.test.js index <HASH>..<HASH> 100644 --- a/example/react_withHOC/src/App.test.js +++ b/example/react_withHOC/src/App.test.js @@ -2,6 +2,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; +import './i18n'; + it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(<App />, div);
fix failing example tests for react_withHOC
i18next_react-i18next
train
js
3d4a880f6294853c9721f2a8d95dc4ea479ad1c4
diff --git a/test/insert_test.js b/test/insert_test.js index <HASH>..<HASH> 100644 --- a/test/insert_test.js +++ b/test/insert_test.js @@ -1175,6 +1175,30 @@ exports.shouldCorrectlyPerformUpsertAgainstNewDocumentAndExistingOne = function( } /** + * @ignore + */ +exports.shouldCorrectlyPerformLargeTextInsert = function(test) { + client.createCollection('shouldCorrectlyPerformLargeTextInsert', function(err, collection) { + // Create large string, insert and then retrive + var string = ""; + // Create large text field + for(var i = 0; i < 50000; i++) { + string = string + "a"; + } + + collection.insert({a:1, string:string}, {safe:true}, function(err, result) { + test.equal(null, err); + + collection.findOne({a:1}, function(err, doc) { + test.equal(null, err); + test.equal(50000, doc.string.length); + test.done(); + }); + }); + }); +} + +/** * Retrieve the server information for the current * instance of the db client *
Added test to check for bugfor long strings
mongodb_node-mongodb-native
train
js
c6bee4d32049b2a18d72f94718f2970cf92f45f3
diff --git a/rest/response.py b/rest/response.py index <HASH>..<HASH> 100644 --- a/rest/response.py +++ b/rest/response.py @@ -77,8 +77,7 @@ class RESTfulResponse(object): def render_to_response(self, request, context_dict=None, status=200): mimetype = mimeparse.best_match(self.supported_mimetypes.keys(), request.META['HTTP_ACCEPT']) - import ipdb; ipdb.set_trace() - mimetype = mimetypes.guess_type(request.path_info)[0] or mimetype + mimetype = mimetypes.guess_type(request.path_info.rstrip('/'))[0] or mimetype content_type = '%s; charset=%s' % (mimetype, settings.DEFAULT_CHARSET) templ_or_func = self.supported_mimetypes.get(mimetype) diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ distribute_setup.use_setuptools() from setuptools import setup, find_packages -__version__ = '0.3.0' +__version__ = '0.3.1' __author__ = 'Christopher Roach' __email__ = 'croach@freshplum.com' __license__ = ''
Trailing slashes on URLs no longer interfere with mime type inference
croach_django-simple-rest
train
py,py
31758191c3adc8304e71f59137d0f1f9af86dce3
diff --git a/MEA_package/ProgramFiles/LNA.py b/MEA_package/ProgramFiles/LNA.py index <HASH>..<HASH> 100644 --- a/MEA_package/ProgramFiles/LNA.py +++ b/MEA_package/ProgramFiles/LNA.py @@ -1,14 +1,15 @@ from sympy import Matrix,Symbol,diff,latex #from create_cfile_LNA import create_c -import os -import sys -model_ = sys.argv[1] -LNAout = sys.argv[2] -os.system('python formatmodel.py '+model_) +if __name__ == '__main__': + import os + import sys + model_ = sys.argv[1] + LNAout = sys.argv[2] + os.system('python formatmodel.py '+model_) -from model import model + from model import model -[S,a,nreactions,nvariables,ymat,Mumat,c] = model() + [S,a,nreactions,nvariables,ymat,Mumat,c] = model() def LNA(S,a,ymat,c,LNAout):
moved some of the code into if __name__ == __main__ block so it does not interfere with tests
theosysbio_means
train
py
5ef910fa2fd44189fe0e247077a879c0c7abbe70
diff --git a/lib/hidapi/setup_task_helper.rb b/lib/hidapi/setup_task_helper.rb index <HASH>..<HASH> 100755 --- a/lib/hidapi/setup_task_helper.rb +++ b/lib/hidapi/setup_task_helper.rb @@ -16,6 +16,33 @@ module HIDAPI ObjectSpace.define_finalizer(self, ->{ FileUtils.rm_rf(@temp_dir) }) end + def uninstall + if operating_system == :osx + uninstall_osx + else + puts "Your operating system was detected as '#{operating_system}', but I don't have an uninstall routine for that." + end + true + end + + def uninstall_osx + + target = "/System/Library/Extensions/#{simple_name}.kext" + + if not Dir.exist?(target) + puts 'A kext with the specified name does not exist.' + return false + end + + puts 'Uninstalling kext...' + `sudo rm -rf #{target}` + `sudo touch /System/Library/Extensions` + + puts "The kext has been uninstalled.\nYou may have to unplug/plug the device or restart your computer." + + true + end + def run if valid_options? if operating_system == :osx
uninstall feature request implemented for osx
barkerest_hidapi
train
rb
34f172299eea13aea6b3240a2d267c729daaab59
diff --git a/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/constants/BuilderConstants.java b/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/constants/BuilderConstants.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/constants/BuilderConstants.java +++ b/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/constants/BuilderConstants.java @@ -187,7 +187,7 @@ public class BuilderConstants { "Python", "XML", "Ruby", "C#", "HTML", "CSS", "Javadoc", "Haskell", "Lua", "Makefile", "Pascal", "RPM Spec", "Diff"); public static final List<String> VALID_PROGRAM_LISTING_LANGS_LOWERCASE = Arrays.asList("java", "sql", "c", "c++", "bash", "perl", - "javaScript", "python", "xml", "ruby", "c#", "html", "css", "javadoc", "haskell", "lua", "makefile", "pascal", "rpm spec", + "javascript", "python", "xml", "ruby", "c#", "html", "css", "javadoc", "haskell", "lua", "makefile", "pascal", "rpm spec", "diff"); /**
Fixed a bug that was marking the "JavaScript" programlisting language as invalid.
pressgang-ccms_PressGangCCMSBuilder
train
java
dc91694022a7a816fcbf95cd89107f77950fa9c4
diff --git a/servers/src/main/java/tachyon/Format.java b/servers/src/main/java/tachyon/Format.java index <HASH>..<HASH> 100644 --- a/servers/src/main/java/tachyon/Format.java +++ b/servers/src/main/java/tachyon/Format.java @@ -74,14 +74,17 @@ public class Format { Constants.RAW_TABLE_MASTER_NAME, }; for (String masterServiceName : masterServiceNames) { - if (!formatFolder(masterServiceName + "JOURNAL_FOLDER", PathUtils.concatPath(masterJournal, + if (!formatFolder(masterServiceName + "_JOURNAL_FOLDER", PathUtils.concatPath(masterJournal, masterServiceName), tachyonConf)) { System.exit(-1); } } + // A journal folder is thought to be formatted only when a file with the specific name is + // present under the folder. UnderFileSystemUtils.touch( - masterJournal + Constants.FORMAT_FILE_PREFIX + System.currentTimeMillis(), tachyonConf); + PathUtils.concatPath(masterJournal, Constants.FORMAT_FILE_PREFIX + + System.currentTimeMillis()), tachyonConf); } else if ("WORKER".equals(args[0].toUpperCase())) { String workerDataFolder = tachyonConf.get(Constants.WORKER_DATA_FOLDER); int storageLevels = tachyonConf.getInt(Constants.WORKER_TIERED_STORE_LEVELS);
Use concatPath for better portability
Alluxio_alluxio
train
java
401715ce3c35cd26cba025c2c7a9edad148b7796
diff --git a/Eloquent/Builder.php b/Eloquent/Builder.php index <HASH>..<HASH> 100755 --- a/Eloquent/Builder.php +++ b/Eloquent/Builder.php @@ -249,6 +249,40 @@ class Builder } /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return $this + */ + public function latest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->latest($column); + + return $this; + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return $this + */ + public function oldest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->oldest($column); + + return $this; + } + + /** * Create a collection of models from plain arrays. * * @param array $items
Use custom CREATED_AT column for latest() and oldest() (#<I>)
illuminate_database
train
php
f9db7c527c7c0508e53e086061c5fcaa70b70e75
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,9 +2,29 @@ Based entirely on Django's own ``setup.py``. """ import os +import sys +from distutils.command.install_data import install_data from distutils.command.install import INSTALL_SCHEMES from distutils.core import setup +class osx_install_data(install_data): + # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../ + # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix + # for this in distutils.command.install_data#306. It fixes install_lib but not + # install_data, which is why we roll our own install_data class. + + def finalize_options(self): + # By the time finalize_options is called, install.install_lib is set to the + # fixed directory, so we set the installdir to install_lib. The + # install_data class uses ('install_data', 'install_dir') instead. + self.set_undefined_options('install', ('install_lib', 'install_dir')) + install_data.finalize_options(self) + +if sys.platform == "darwin": + cmdclasses = {'install_data': osx_install_data} +else: + cmdclasses = {'install_data': install_data} + def fullsplit(path, result=None): """ Split a pathname into components (the opposite of os.path.join) in a
Applying weird hack for stock Python on Mac OS X, stolen from Django's setup.py.
django-extensions_django-extensions
train
py
b393948b67014075dbc9ef5033a5460c75f2bda8
diff --git a/gns3server/modules/iou/iou_vm.py b/gns3server/modules/iou/iou_vm.py index <HASH>..<HASH> 100644 --- a/gns3server/modules/iou/iou_vm.py +++ b/gns3server/modules/iou/iou_vm.py @@ -474,7 +474,6 @@ class IOUVM(BaseVM): self._iou_process.kill() if self._iou_process.returncode is None: log.warn("IOU process {} is still running".format(self._iou_process.pid)) - self._iou_process = None if self._iouyap_process is not None: @@ -482,9 +481,10 @@ class IOUVM(BaseVM): try: yield from asyncio.wait_for(self._iouyap_process.wait(), timeout=3) except asyncio.TimeoutError: - self._iou_process.kill() + self._iouyap_process.kill() if self._iouyap_process.returncode is None: - log.warn("IOUYAP process {} is still running".format(self._iou_process.pid)) + log.warn("IOUYAP process {} is still running".format(self._iouyap_process.pid)) + self._iouyap_process = None self._started = False
Fixes iouyap shutdown.
GNS3_gns3-server
train
py