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
da01c8d4726b76bc0478255497dd055c6b0b6e7f
diff --git a/pkg/volume/rbd/rbd_util.go b/pkg/volume/rbd/rbd_util.go index <HASH>..<HASH> 100644 --- a/pkg/volume/rbd/rbd_util.go +++ b/pkg/volume/rbd/rbd_util.go @@ -712,7 +712,7 @@ func (util *rbdUtil) rbdInfo(b *rbdMounter) (int, error) { // klog.V(4).Infof("rbd: info %s using mon %s, pool %s id %s key %s", b.Image, mon, b.Pool, id, secret) output, err = b.exec.Command("rbd", - "info", b.Image, "--pool", b.Pool, "-m", mon, "--id", id, "--key="+secret, "-k=/dev/null", "--format=json").CombinedOutput() + "info", b.Image, "--pool", b.Pool, "-m", mon, "--id", id, "--key="+secret, "-k=/dev/null", "--format=json").Output() if err, ok := err.(*exec.Error); ok { if err.Err == exec.ErrNotFound {
fix expanding rbd volumes without ceph.conf Ignore stderr of rbd info --format=json as without a ceph.conf it will print messages about no configuration onto stderr which break the json parsing. The actual json information the function wants is always on stdout. Closes: gh-<I>
kubernetes_kubernetes
train
go
aa2d63aefea9ee27fb7a4fcc75fc7d1abd8717e9
diff --git a/inliner.js b/inliner.js index <HASH>..<HASH> 100755 --- a/inliner.js +++ b/inliner.js @@ -215,7 +215,9 @@ function Inliner(url, options, callback) { // some protection against putting script tags in the body final_code = final_code.replace(/<\/script>/gi, '<\\/script>'); - this.innerHTML = final_code; + this.innerText = final_code; + // window.$(this).text(final_code); + if (src) { inliner.emit('progress', 'compress ' + URL.resolve(root, src)); } else { @@ -230,7 +232,7 @@ function Inliner(url, options, callback) { inliner.emit('jobs', (inliner.total - inliner.todo) + '/' + inliner.total); } else if (orig_code) { // window.$(this).text(orig_code.replace(/<\/script>/gi, '<\\/script>')); - this.innerHTML = orig_code.replace(/<\/script>/gi, '<\\/script>'); + this.innerText = orig_code.replace(/<\/script>/gi, '<\\/script>'); } }); finished();
fixed HTML encoding when it should not have been happening
remy_inliner
train
js
57a7989b28dddd9542c2b53d6cff9d557454efbc
diff --git a/test/dialects/from-clause-tests.js b/test/dialects/from-clause-tests.js index <HASH>..<HASH> 100644 --- a/test/dialects/from-clause-tests.js +++ b/test/dialects/from-clause-tests.js @@ -17,6 +17,10 @@ Harness.test({ mysql: { text : 'SELECT `user`.* FROM `user` , `post`', string: 'SELECT `user`.* FROM `user` , `post`' + }, + sqlserver: { + text : 'SELECT [user].* FROM [user] , [post]', + string: 'SELECT [user].* FROM [user] , [post]' } }); @@ -33,5 +37,9 @@ Harness.test({ mysql: { text : 'SELECT `user`.*, `post`.* FROM `user` , `post`', string: 'SELECT `user`.*, `post`.* FROM `user` , `post`' + }, + sqlserver: { + text : 'SELECT [user].*, [post].* FROM [user] , [post]', + string: 'SELECT [user].*, [post].* FROM [user] , [post]' } });
Added from-clause-tests for SqlServer.
brianc_node-sql
train
js
1085052131eb4382d9cc187b82bb7d5ea257891b
diff --git a/src/array.js b/src/array.js index <HASH>..<HASH> 100644 --- a/src/array.js +++ b/src/array.js @@ -143,15 +143,6 @@ var foldRight = curry(function(a, v, f) { return v; }); -var foreach = curry(function(a, f) { - var total, - i; - - for (i = 0, total = a.length; i < total; i++) { - f(a[i]); - } -}); - var map = curry(function(a, f) { var accum = [], total, @@ -252,7 +243,6 @@ squishy = squishy .method('flatMap', isArray, flatMap) .method('fold', isArray, fold) .method('foldRight', isArray, foldRight) - .method('foreach', isArray, foreach) .method('map', isArray, map) .method('partition', isArray, partition) .method('reduce', isArray, reduce) diff --git a/src/promise.js b/src/promise.js index <HASH>..<HASH> 100644 --- a/src/promise.js +++ b/src/promise.js @@ -20,7 +20,7 @@ var Promise = function Promise(deferred) { listeners = [], invoke = function(a) { return function(value) { - foreach(a(), function(f) { + map(a(), function(f) { f(value); }); };
Removing foreach from array.
SimonRichardson_squishy-pants
train
js,js
0b3da381d06907efd7758e8952f47e551c0e87d8
diff --git a/mautrix/client/state_store/asyncpg/upgrade.py b/mautrix/client/state_store/asyncpg/upgrade.py index <HASH>..<HASH> 100644 --- a/mautrix/client/state_store/asyncpg/upgrade.py +++ b/mautrix/client/state_store/asyncpg/upgrade.py @@ -25,15 +25,18 @@ async def upgrade_blank_to_v2(conn: Connection, scheme: Scheme) -> None: power_levels TEXT )""" ) + membership_check = "" if scheme != Scheme.SQLITE: await conn.execute( "CREATE TYPE membership AS ENUM ('join', 'leave', 'invite', 'ban', 'knock')" ) + else: + membership_check = "CHECK (membership IN ('join', 'leave', 'invite', 'ban', 'knock'))" await conn.execute( - """CREATE TABLE mx_user_profile ( + f"""CREATE TABLE mx_user_profile ( room_id TEXT, user_id TEXT, - membership membership NOT NULL, + membership membership NOT NULL {membership_check}, displayname TEXT, avatar_url TEXT, PRIMARY KEY (room_id, user_id)
Add CHECK constraint for membership column on SQLite
tulir_mautrix-python
train
py
fab090c3a545c64996bd752ee408ff518b4eb3f3
diff --git a/PelEntry.php b/PelEntry.php index <HASH>..<HASH> 100644 --- a/PelEntry.php +++ b/PelEntry.php @@ -172,8 +172,8 @@ abstract class PelEntry { $d = explode('-', strtr($data->getBytes(0, -1), '.: ', '---')); // TODO: handle timezones. require_once('PelEntryAscii.php'); - return new PelEntryTime($tag, mktime($d[3], $d[4], $d[5], - $d[1], $d[2], $d[0])); + return new PelEntryTime($tag, gmmktime($d[3], $d[4], $d[5], + $d[1], $d[2], $d[0])); case PelTag::COPYRIGHT: if ($format != PelFormat::ASCII)
The timestamps should be treated uniformly as UTC time, and not local time, otherwise we cannot guarantee a safe round trip where an entry is written to a file and then later retrieved.
pel_pel
train
php
2b387c58dd746fbbd7b6c0efb7abefe34bae3410
diff --git a/lib/app/models/invitation.rb b/lib/app/models/invitation.rb index <HASH>..<HASH> 100644 --- a/lib/app/models/invitation.rb +++ b/lib/app/models/invitation.rb @@ -7,7 +7,19 @@ class Invitation < ActiveRecord::Base private + def call_back_method + Inviter::InvitationCallbacks.invitation_created_callback(inviter, invitee, invited_to) + end + def trigger_callbacks - puts 'CALL BACKS WILL BE TRIGGERED' + inviters = Inviter::ActsAsInviter.inviters + invitees = Inviter::ActsAsInvitee.invitees + invitations = Inviter::ActsAsInvitation.invitations + [inviters, invitees, invitations].each do |klass| + _call_back_method = call_back_method + klass.each do |_klass| + _klass.send(_call_back_method) if _klass.respond_to?(_call_back_method) + end + end end end
added method to trigger callbacks for members involved
mjmorales_inviter
train
rb
dd51f9b1c51ab962604110a832fa10118a197031
diff --git a/admin/tool/customlang/db/upgrade.php b/admin/tool/customlang/db/upgrade.php index <HASH>..<HASH> 100644 --- a/admin/tool/customlang/db/upgrade.php +++ b/admin/tool/customlang/db/upgrade.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -function xmldb_report_customlang_upgrade($oldversion) { +function xmldb_tool_customlang_upgrade($oldversion) { global $CFG, $DB, $OUTPUT; $dbman = $DB->get_manager();
MDL-<I> fix customlang upgrade script
moodle_moodle
train
php
ed89f10fcd2e0266c7b5c764c8dcc8751a4d3b89
diff --git a/pymc3/distributions/continuous.py b/pymc3/distributions/continuous.py index <HASH>..<HASH> 100644 --- a/pymc3/distributions/continuous.py +++ b/pymc3/distributions/continuous.py @@ -1131,12 +1131,12 @@ class Bounded(Continuous): self.testval = 0.5 * (upper + lower) if not np.isinf(lower) and np.isinf(upper): - self.transform = transforms.lowerbound_elemwise(lower) + self.transform = transforms.lowerbound(lower) if default <= lower: self.testval = lower + 1 if np.isinf(lower) and not np.isinf(upper): - self.transform = transforms.upperbound_elemwise(upper) + self.transform = transforms.upperbound(upper) if default >= upper: self.testval = upper - 1
BUG Wrong search/replace.
pymc-devs_pymc
train
py
ead5a8f233901ac7e8e1c6b2c3fa4f289a7a0852
diff --git a/zarr/tests/test_core.py b/zarr/tests/test_core.py index <HASH>..<HASH> 100644 --- a/zarr/tests/test_core.py +++ b/zarr/tests/test_core.py @@ -855,11 +855,6 @@ class TestArray(unittest.TestCase): assert_array_equal(a['bar'], z['bar']) assert_array_equal(a['baz'], z['baz']) - # this does not raise with numpy 1.14 - # with pytest.raises(ValueError): - # # dodgy fill value - # self.create_array(shape=a.shape, chunks=2, dtype=a.dtype, fill_value=42) - def test_dtypes(self): # integers
delete commented code [ci skip]
zarr-developers_zarr
train
py
9c3cbb240313fbe81260f445bf65d1e75f7f09d2
diff --git a/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/UserMetadata.java b/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/UserMetadata.java index <HASH>..<HASH> 100644 --- a/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/UserMetadata.java +++ b/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/UserMetadata.java @@ -75,7 +75,8 @@ public class UserMetadata extends SystemEntityType { .setLabel("Username") .setUnique(true) .setNillable(false) - .setReadOnly(true); + .setReadOnly(true) + .setValidationExpression("$('" + USERNAME + "').matches(/^[\\S].+[\\S]$/).value()"); addAttribute(PASSWORD) .setLabel("Password") .setDescription("This is the hashed password, enter a new plaintext password to update.")
Fix #<I>: Usernames are not checked for spaces
molgenis_molgenis
train
java
55e7e1a198631e19fe6657f02cbfcd62a10fb12a
diff --git a/tests/Symfony/Tests/Component/Translation/Loader/ResourceBundleLoaderTest.php b/tests/Symfony/Tests/Component/Translation/Loader/ResourceBundleLoaderTest.php index <HASH>..<HASH> 100644 --- a/tests/Symfony/Tests/Component/Translation/Loader/ResourceBundleLoaderTest.php +++ b/tests/Symfony/Tests/Component/Translation/Loader/ResourceBundleLoaderTest.php @@ -51,7 +51,7 @@ class ResourceBundleFileLoaderTest extends LocalizedTestCase } /** - * @expectedException Exception + * @expectedException \RuntimeException */ public function testLoadInvalidResource() {
[Translation] changed some unit tests for PHPUnit <I> compatibility
symfony_symfony
train
php
3f09bdd40e4d69c8658ced6187114040a655fdc4
diff --git a/lib/stealth/base.rb b/lib/stealth/base.rb index <HASH>..<HASH> 100644 --- a/lib/stealth/base.rb +++ b/lib/stealth/base.rb @@ -71,6 +71,8 @@ module Stealth def self.load_environment require File.join(Stealth.root, 'config', 'boot') require_directory("config/initializers") + # Require explicitly to ensure it loads first + require File.join(Stealth.root, 'bot', 'controllers', 'bot_controller') require_directory("bot") end
Ensure BotController loads before all controllers
hellostealth_stealth
train
rb
93487c761fc5e2b5281099b237aab46c46764d11
diff --git a/lib/cb/clients/job_branding.rb b/lib/cb/clients/job_branding.rb index <HASH>..<HASH> 100755 --- a/lib/cb/clients/job_branding.rb +++ b/lib/cb/clients/job_branding.rb @@ -8,6 +8,7 @@ # 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_relative 'base' module Cb module Clients class JobBranding < Base
linux vs mac file pathing crap again
careerbuilder_ruby-cb-api
train
rb
ed541bf215a4e10b815c64ede995200a4928f358
diff --git a/gengen.go b/gengen.go index <HASH>..<HASH> 100644 --- a/gengen.go +++ b/gengen.go @@ -52,8 +52,11 @@ func generate(filename string, typenames ...string) ([]byte, error) { } var buf bytes.Buffer - err = format.Node(&buf, fset, f) - return buf.Bytes(), err + if err = format.Node(&buf, fset, f); err != nil { + return nil, err + } + + return format.Source(buf.Bytes()) } func main() {
Pass generated source through format.Source() (i.e. gofmt) Fixes #1
joeshaw_gengen
train
go
5e5cba65761b0fe071cdf9cad8371053dac58df6
diff --git a/spec/suite/compat/unit/rom/configuration/relation_classes_spec.rb b/spec/suite/compat/unit/rom/configuration/relation_classes_spec.rb index <HASH>..<HASH> 100644 --- a/spec/suite/compat/unit/rom/configuration/relation_classes_spec.rb +++ b/spec/suite/compat/unit/rom/configuration/relation_classes_spec.rb @@ -11,7 +11,8 @@ RSpec.describe ROM::Configuration, "#relation_classes" do rel_default = Class.new(ROM::Relation[:memory]) { schema(:users) {} } rel_custom = Class.new(ROM::Relation[:memory]) { gateway :custom - schema(:others) {} } + schema(:others) {} +} conf.register_relation(rel_default) conf.register_relation(rel_custom)
[rubocop] address Layout/BlockEndNewline
rom-rb_rom
train
rb
f013a88e8d445a923155ef0d308c89bbdbf3fe68
diff --git a/chunkypipes/util/__init__.py b/chunkypipes/util/__init__.py index <HASH>..<HASH> 100644 --- a/chunkypipes/util/__init__.py +++ b/chunkypipes/util/__init__.py @@ -1,4 +1,5 @@ import sys +import os import traceback from importlib import import_module @@ -8,6 +9,12 @@ def fetch_command_class(subcommand): return module.Command() +def print_no_init(): + sys.stderr.write('ChunkyPipes cannot find an init directory at the user ' + + 'home or in the CHUNKY_HOME environment variable. Please ' + + 'run \'chunky init\' before using ChunkyPipes.\n') + + def print_help_text(): fetch_command_class('help').run_from_argv() @@ -38,6 +45,11 @@ def execute_from_command_line(argv=None): print_help_text() sys.exit(0) + chunky_home_root = os.environ.get('CHUNKY_HOME') or os.path.expanduser('~') + if not os.path.exists(os.path.join(chunky_home_root, '.chunky')): + print_no_init() + sys.exit(1) + send_argv = [] if len(argv) > 2: send_argv = argv[2:]
ChunkyPipes now halts execution if it can't find an initialized hidden directory and asks the user to run chunky init
djf604_chunky-pipes
train
py
979b51958bb78bd9624324bef1e784262deb55f8
diff --git a/upload/admin/model/openbay/ebay_profile.php b/upload/admin/model/openbay/ebay_profile.php index <HASH>..<HASH> 100644 --- a/upload/admin/model/openbay/ebay_profile.php +++ b/upload/admin/model/openbay/ebay_profile.php @@ -56,7 +56,7 @@ class ModelOpenbayEbayProfile extends Model{ foreach ($qry->rows as $row) { $row['link_edit'] = HTTPS_SERVER . 'index.php?route=openbay/ebay_profile/edit&token=' . $this->session->data['token'] . '&ebay_profile_id=' . $row['ebay_profile_id']; $row['link_delete'] = HTTPS_SERVER . 'index.php?route=openbay/ebay_profile/delete&token=' . $this->session->data['token'] . '&ebay_profile_id=' . $row['ebay_profile_id']; - $row['data'] = unserialize($row['data']); + $row['data'] = !empty($row['data']) ? unserialize($row['data']) : array(); $profiles[] = $row; }
Added check for data before trying to unserialize.
opencart_opencart
train
php
469f9e2f1643a07294640b1b22708ef71fc50a7c
diff --git a/modules/clean-up.php b/modules/clean-up.php index <HASH>..<HASH> 100644 --- a/modules/clean-up.php +++ b/modules/clean-up.php @@ -119,7 +119,7 @@ add_filter('body_class', 'soil_body_class'); function soil_embed_wrap($cache) { return '<div class="entry-content-asset">' . $cache . '</div>'; } -add_filter('embed_oembed_html', 'soil_embed_wrap', 10, 4); +add_filter('embed_oembed_html', 'soil_embed_wrap'); /** * Remove unnecessary dashboard widgets
Fixing add_filter call to have right parameters
roots_soil
train
php
cd97c1b2d29eebe16de807c259b06e8d4ec2cd1c
diff --git a/salesforce/tests/test_integration.py b/salesforce/tests/test_integration.py index <HASH>..<HASH> 100644 --- a/salesforce/tests/test_integration.py +++ b/salesforce/tests/test_integration.py @@ -95,7 +95,7 @@ class BasicSOQLTest(TestCase): def test_exclude_query_construction(self): """ - Test that excludde query construction returns valid SOQL + Test that exclude query construction returns valid SOQL. """ contacts = Contact.objects.filter(FirstName__isnull=False).exclude(Email="steve@apple.com", LastName="Wozniak").exclude(LastName="smith") number_of_contacts = contacts.count()
Fix typ in docstring.
django-salesforce_django-salesforce
train
py
650c68be44d396609e1388a6d9dccea66cf76475
diff --git a/nap/__init__.py b/nap/__init__.py index <HASH>..<HASH> 100644 --- a/nap/__init__.py +++ b/nap/__init__.py @@ -1,6 +1,6 @@ __author__ = 'Kimmo Brunfeldt' __email__ = 'kimmobrunfeldt@gmail.com' __url__ = 'https://github.com/kimmobrunfeldt/nap' -__version__ = '1.0.0' +__version__ = '1.0.0-dev' from . import url diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ readme = """Read docs from GitHub_ setup( name='nap', - version='1.0.0', + version='1.0.0-dev', description='Convenient way to request HTTP APIs', long_description=readme, author='Kimmo Brunfeldt',
Set development version: <I>-dev
kimmobrunfeldt_nap
train
py,py
a492d7776402dea239135bedc607f7e80d423043
diff --git a/lib/modules.js b/lib/modules.js index <HASH>..<HASH> 100644 --- a/lib/modules.js +++ b/lib/modules.js @@ -216,9 +216,13 @@ var //dependencies "client/html/templates/simple-thumbnails.html" ], fuImages: [ + "client/continue.gif", + "client/edit.gif", "client/loading.gif", + "client/pause.gif", "client/processing.gif", - "client/edit.gif" + "client/retry.gif", + "client/trash.gif" ], fuPlaceholders: [ "client/placeholders/not_available-generic.png",
chore(build): include new images in packaged builds #<I> #<I>
FineUploader_fine-uploader
train
js
85eac7200dc6e3c9c9d06243450d5a96148f241a
diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -1353,7 +1353,8 @@ class SqlWalker implements TreeWalker break; case ($expr instanceof AST\NewObjectExpression): - $sql .= $this->walkNewObject($expr); + $resultAlias = $selectExpression->fieldIdentificationVariable ?: null; + $sql .= $this->walkNewObject($expr,$resultAlias); break; default: @@ -1519,10 +1520,10 @@ class SqlWalker implements TreeWalker * * @return string The SQL. */ - public function walkNewObject($newObjectExpression) + public function walkNewObject($newObjectExpression, $newObjectResultAlias=null) { $sqlSelectExpressions = array(); - $objIndex = $this->newObjectCounter++; + $objIndex = $newObjectResultAlias?:$this->newObjectCounter++; foreach ($newObjectExpression->args as $argIndex => $e) { $resultAlias = $this->scalarResultCounter++;
Adding the ability to alias new object expressions
doctrine_orm
train
php
c63b99ee029b6730e4b0702ac7c22b4076049e2a
diff --git a/lib/frameworks/jasmine.js b/lib/frameworks/jasmine.js index <HASH>..<HASH> 100644 --- a/lib/frameworks/jasmine.js +++ b/lib/frameworks/jasmine.js @@ -85,7 +85,7 @@ exports.run = function(runner, specs) { spec.getFullName().match(new RegExp(jasmineNodeOpts.grep)) != null; var invertGrep = !!(jasmineNodeOpts && jasmineNodeOpts.invertGrep); if (grepMatch == invertGrep) { - spec.pend(); + spec.disable(); } return true; };
fix(grep): change excluded tests to disabled instead of pending (#<I>)
angular_protractor
train
js
436f4747e6b7cd511434bf8fb6269720924a06ca
diff --git a/classes/PodsUI.php b/classes/PodsUI.php index <HASH>..<HASH> 100644 --- a/classes/PodsUI.php +++ b/classes/PodsUI.php @@ -389,7 +389,7 @@ class PodsUI { $options = array(); if ( isset( $object->ui ) ) { - $options = $object->ui; + $options = (array) $object->ui; unset( $object->ui ); } @@ -454,6 +454,7 @@ class PodsUI { */ public function setup_deprecated ( $deprecated_options ) { $options = array(); + if ( isset( $deprecated_options[ 'id' ] ) ) $options[ 'id' ] = $deprecated_options[ 'id' ]; if ( isset( $deprecated_options[ 'action' ] ) ) @@ -705,6 +706,13 @@ class PodsUI { if ( isset( $deprecated_options[ 'wpcss' ] ) ) $options[ 'wpcss' ] = $deprecated_options[ 'wpcss' ]; + $remaining_options = array_diff_assoc( $options, $deprecated_options ); + + foreach ( $remaining_options as $option => $value ) { + if ( isset( $this->$option ) ) + $options[ $option ] = $value; + } + return $options; }
Loop through extra options in deprecated options handling, fix for when you use new options in a deprecated pods_ui call
pods-framework_pods
train
php
8ee30ce1dfcf38195d0ea311319a975324904f2d
diff --git a/lib/dbus/proxy_object.rb b/lib/dbus/proxy_object.rb index <HASH>..<HASH> 100644 --- a/lib/dbus/proxy_object.rb +++ b/lib/dbus/proxy_object.rb @@ -144,10 +144,5 @@ module DBus raise NoMethodError, "undefined method `#{name}' for DBus interface `#{@default_iface}' on object `#{@path}'" end end - - # Returns the singleton class of the object. - def singleton_class - (class << self ; self ; end) - end end # class ProxyObject end diff --git a/lib/dbus/proxy_object_interface.rb b/lib/dbus/proxy_object_interface.rb index <HASH>..<HASH> 100644 --- a/lib/dbus/proxy_object_interface.rb +++ b/lib/dbus/proxy_object_interface.rb @@ -34,11 +34,6 @@ module DBus @name end - # Returns the singleton class of the interface. - def singleton_class - (class << self ; self ; end) - end - # Defines a method on the interface from the Method descriptor _m_. def define_method_from_descriptor(m) m.params.each do |fpar|
Removed superfulous definitions of Object#singleton_class MRI implemented it in <I> already.
mvidner_ruby-dbus
train
rb,rb
d5ec811f137377c185c0e4054a6571167ea59f56
diff --git a/src/Student.php b/src/Student.php index <HASH>..<HASH> 100644 --- a/src/Student.php +++ b/src/Student.php @@ -77,20 +77,23 @@ class Student extends Person */ protected static function fromSimpleIdentifier($identifier) { - $person = parent::fromSimpleIdentifier($identifier); - $uwregid = $person->getAttr("UWRegID"); + if ($person !== null) { + $uwregid = $person->getAttr("UWRegID"); - $resp = static::getStudentConnection()->execGET( - "person/$uwregid.json" - ); + $resp = static::getStudentConnection()->execGET( + "person/$uwregid.json" + ); - $resp = static::parse($resp); + $resp = static::parse($resp); - $person->attrs = array_merge($person->attrs, $resp); + $person->attrs = array_merge($person->attrs, $resp); - return $person; + return $person; + } else { + return null; + } } /**
Handle null person when creating student.
UWEnrollmentManagement_Person
train
php
2feedfaadde24568625e93f20c35bcebf9f383b4
diff --git a/test/db/postgresql/jsonb_test.rb b/test/db/postgresql/jsonb_test.rb index <HASH>..<HASH> 100644 --- a/test/db/postgresql/jsonb_test.rb +++ b/test/db/postgresql/jsonb_test.rb @@ -49,14 +49,14 @@ class PostgreSQLJSONBTest < Test::Unit::TestCase assert @column = JsonbDataType.columns.find { |c| c.name == 'payload' } data = "{\"a_key\":\"a_value\"}" - hash = @column.class.string_to_json data + hash = @column.class.string_to_json(data) assert_equal({'a_key' => 'a_value'}, hash) assert_equal({'a_key' => 'a_value'}, @column.type_cast(data)) assert_equal({}, @column.type_cast("{}")) assert_equal({'key'=>nil}, @column.type_cast('{"key": null}')) assert_equal({'c'=>'}','"a"'=>'b "a b'}, @column.type_cast(%q({"c":"}", "\"a\"":"b \"a b"}))) - end + end unless ar_version('4.2') def test_rewrite @connection.execute "insert into jsonb_data_type (payload) VALUES ('{\"k\":\"v\"}')"
jsonb (type-cast) test makes no longer sense on AR <I>
jruby_activerecord-jdbc-adapter
train
rb
54d0d91c7ec5fcc8ab95647389fc420531416c5d
diff --git a/lib/rb/lib/thrift/transport.rb b/lib/rb/lib/thrift/transport.rb index <HASH>..<HASH> 100644 --- a/lib/rb/lib/thrift/transport.rb +++ b/lib/rb/lib/thrift/transport.rb @@ -231,10 +231,6 @@ module Thrift return @rpos < @wpos end - def get_buffer - return @buf - end - def reset_buffer(new_buf = '') @buf = new_buf @sz = new_buf.length
Rip out MemoryBuffer#get_buffer Nobody should be using that method and it's preventing MemoryBuffer from being optimized wrt. memory usage git-svn-id: <URL>
limingxinleo_thrift
train
rb
74f15cd085bbe6976d4ea9cfdc9b32bf77a45c6a
diff --git a/redis/client.py b/redis/client.py index <HASH>..<HASH> 100644 --- a/redis/client.py +++ b/redis/client.py @@ -1111,9 +1111,7 @@ class Redis(StrictRedis): if len(args) % 2 != 0: raise RedisError("ZADD requires an equal number of " "values and scores") - temp_args = args - temp_args.reverse() - pieces.extend(temp_args) + pieces.extend(reversed(args)) for pair in kwargs.iteritems(): pieces.append(pair[1]) pieces.append(pair[0])
Fix zadd: 'tuple' object has no attribute 'reverse' (and args is a tuple)
andymccurdy_redis-py
train
py
29290923b309cff24d5d8d56abff3da7d016e966
diff --git a/src/Saft/Rdf/StatementIteratorFactoryImpl.php b/src/Saft/Rdf/StatementIteratorFactoryImpl.php index <HASH>..<HASH> 100644 --- a/src/Saft/Rdf/StatementIteratorFactoryImpl.php +++ b/src/Saft/Rdf/StatementIteratorFactoryImpl.php @@ -13,15 +13,6 @@ class StatementIteratorFactoryImpl implements StatementIteratorFactory */ public function createIteratorFromArray(array $statements) { - if (is_array($statements)) { - return new ArrayStatementIteratorImpl($statements); - - } elseif ($statements instanceof \Iterator) { - $arrayIterator = new \ArrayIterator($statements); - return new ArrayStatementIteratorImpl($arrayIterator->getArrayCopy()); - - } else { - throw new \Exception('Parameter $statements is neither an array nor instace of \Iterator.'); - } + return new ArrayStatementIteratorImpl($statements); } }
Simplify createIteratorFromArray It directly returns an instance of an StatementIterator without further checks because $statements can only be an array.
SaftIng_Saft
train
php
4c1735386eb0651258dedf16ff330aeca647408e
diff --git a/react-native/react/engine/index.js b/react-native/react/engine/index.js index <HASH>..<HASH> 100644 --- a/react-native/react/engine/index.js +++ b/react-native/react/engine/index.js @@ -11,6 +11,8 @@ import NativeEventEmitter from '../common-adapters/native-event-emitter' import windowsHack from './windows-hack' import {log} from '../native/log/logui' +import {constants} from '../constants/types/keybase_v1' + class Engine { constructor () { windowsHack() @@ -220,7 +222,10 @@ class Engine { console.log(`Unknown incoming rpc: ${sessionID} ${method} ${param}${response ? ': Sending back error' : ''}`) } if (response && response.error) { - response.error('Unhandled rpc') + response.error({ + code: constants.StatusCode.scgeneric, + desc: 'Unhandled incoming RPC' + }) } } }
sending scgeneric error to daemon
keybase_client
train
js
dc48b4d372d9b5895ed6564558d2d375b0d3dc61
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -197,7 +197,7 @@ exports.init = function (sbot, config) { get: function (opts, cb) { if(!cb) cb = opts, opts = {} - index.get(function (err, value) { + index.get({}, function (err, value) { if(err) return cb(err) //opts is used like this in ssb-ws if(opts && opts.source) { @@ -205,6 +205,13 @@ exports.init = function (sbot, config) { if(value && opts.dest) value = value[opts.dest] } + else if( opts && opts.dest) { + var _value = {} + for(var k in value) + if('undefined' !== typeof value[k][opts.dest]) + _value[k] = value[k][opts.dest] + return cb(null, _value) + } cb(null, value) }) }, @@ -226,3 +233,6 @@ exports.init = function (sbot, config) { } } + + +
support friends.get with dest only
ssbc_ssb-friends
train
js
b2aab5317f72776cc38f521fc336410385fb1c08
diff --git a/src/semantic_tree/semantic_processor.js b/src/semantic_tree/semantic_processor.js index <HASH>..<HASH> 100644 --- a/src/semantic_tree/semantic_processor.js +++ b/src/semantic_tree/semantic_processor.js @@ -906,6 +906,9 @@ sre.SemanticProcessor.prototype.getPunctuationInRow_ = function(nodes) { // similar to an mrow. The only exception are ellipses, which we assume to be // in lieu of identifiers. // In addition we keep the single punctuation nodes as content. + if (nodes.length <= 1) { + return nodes; + } var partition = sre.SemanticProcessor.partitionNodes_( nodes, function(x) { return sre.SemanticPred.isPunctuation(x) &&
Adds a special case to avoid single punctuation elements being turned into trivial punctuated elements. Fixes issue #<I>.
zorkow_speech-rule-engine
train
js
884f01074a8fa402f2584356ded258a5b1260da1
diff --git a/tests/Localization/DvMvTest.php b/tests/Localization/DvMvTest.php index <HASH>..<HASH> 100644 --- a/tests/Localization/DvMvTest.php +++ b/tests/Localization/DvMvTest.php @@ -10,6 +10,8 @@ */ namespace Tests\Localization; +use Carbon\Translator; + class DvMvTest extends LocalizationTestCase { const LOCALE = 'dv_MV'; // Divehi @@ -218,4 +220,15 @@ class DvMvTest extends LocalizationTestCase // CarbonInterval::create('P1DT3H')->forHumans(true) '1 ދުވަސް 3 ގަޑި', ]; + + public function testPlural() + { + $translator = Translator::get('dv_MV'); + $translator->setTranslations([ + 'a' => 'a|b', + ]); + + $this->assertSame('a', $translator->transChoice('a', 1)); + $this->assertSame('b', $translator->transChoice('a', 2)); + } }
Test dv_MV plural rule
briannesbitt_Carbon
train
php
97da365dca1d9fad2f45e8c0f83b92e6e4699aee
diff --git a/Lib/fontbakery/specifications/head.py b/Lib/fontbakery/specifications/head.py index <HASH>..<HASH> 100644 --- a/Lib/fontbakery/specifications/head.py +++ b/Lib/fontbakery/specifications/head.py @@ -81,7 +81,8 @@ def parse_version_string(name): ) def com_google_fonts_check_044(ttFont): """Checking font version fields (head and name table).""" - head_version = parse_version_string(str(ttFont["head"].fontRevision)) + from decimal import Decimal + head_version = parse_version_string(str(Decimal(ttFont["head"].fontRevision).quantize(Decimal('1.000')))) # Compare the head version against the name ID 5 strings in all name records. from fontbakery.constants import NAMEID_VERSION_STRING
fix #<I>: accept rounding fontRevision due to bad ... interpretations of float values causing false-FAILs (such as <I> being interpreted as <I>)
googlefonts_fontbakery
train
py
962bdf744d54f114dc2903e8b8114a29d55eb97e
diff --git a/scheduler/util_test.go b/scheduler/util_test.go index <HASH>..<HASH> 100644 --- a/scheduler/util_test.go +++ b/scheduler/util_test.go @@ -580,6 +580,12 @@ func TestInplaceUpdate_Success(t *testing.T) { if len(ctx.plan.NodeAllocation) != 1 { t.Fatal("inplaceUpdate did not do an inplace update") } + + // Get the alloc we inserted. + a := ctx.plan.NodeAllocation[alloc.NodeID][0] + if len(a.Services) != 0 { + t.Fatalf("Expected number of services: %v, Actual: %v", 0, len(a.Services)) + } } func TestEvictAndPlace_LimitGreaterThanAllocs(t *testing.T) {
Added a test to prove services are removed from the map in Alloc if they are removed from the Tasks
hashicorp_nomad
train
go
9e36344725579d5fe767e33024323455c4dc560d
diff --git a/src/MetaModels/Attribute/Base.php b/src/MetaModels/Attribute/Base.php index <HASH>..<HASH> 100644 --- a/src/MetaModels/Attribute/Base.php +++ b/src/MetaModels/Attribute/Base.php @@ -102,9 +102,9 @@ abstract class Base implements IAttribute public function getName() { if (is_array($this->arrData['name'])) { - return $this->getLangValue($this->get('name')); + return $this->getLangValue($this->get('name')) ?: $this->getColName(); } - return $this->arrData['name']; + return $this->arrData['name'] ?: $this->getColName(); } /**
Apply fallback to colName if attribute has no name See #<I>, #<I>
MetaModels_core
train
php
aa27b009f7b1ea5311b65e105d0dc5e19d794a7b
diff --git a/plugins/Actions/Actions/ActionSiteSearch.php b/plugins/Actions/Actions/ActionSiteSearch.php index <HASH>..<HASH> 100644 --- a/plugins/Actions/Actions/ActionSiteSearch.php +++ b/plugins/Actions/Actions/ActionSiteSearch.php @@ -64,6 +64,16 @@ class ActionSiteSearch extends Action return null; } + public function getIdActionUrlForEntryAndExitIds() + { + return $this->getIdActionUrl(); + } + + public function getIdActionNameForEntryAndExitIds() + { + return $this->getIdActionName(); + } + public function getCustomFloatValue() { return $this->request->getPageGenerationTime();
Site search requests are also pageviews
matomo-org_matomo
train
php
1cc72b8e31cce0abdacb1b5f141532ed72407a51
diff --git a/tests/test_incuna_mail.py b/tests/test_incuna_mail.py index <HASH>..<HASH> 100644 --- a/tests/test_incuna_mail.py +++ b/tests/test_incuna_mail.py @@ -8,7 +8,8 @@ import incuna_mail class TestIncunaMail(TestCase): def tearDown(self): - mail.outbox = [] + # Empty the outbox to avoid emails persisting between tests. + mail.outbox = None def send_and_assert_email(self, text_template_name=()): """Runs send() on proper input and checks the result."""
Use None instead of [] to empty the outbox. * Add an explanatory comment as well.
incuna_incuna-mail
train
py
b49da9c1e872ffaedb0e265cd5c8d06269cc415d
diff --git a/test/urlMatcherFactorySpec.js b/test/urlMatcherFactorySpec.js index <HASH>..<HASH> 100644 --- a/test/urlMatcherFactorySpec.js +++ b/test/urlMatcherFactorySpec.js @@ -463,7 +463,7 @@ describe("urlMatcherFactoryProvider", function () { }); }); -fdescribe("urlMatcherFactory", function () { +describe("urlMatcherFactory", function () { var $umf;
chore(urlMatcherFactory): remove f
ui-router_angular
train
js
cce732ee149bbda8ad7773129967afc948093096
diff --git a/src/Api.php b/src/Api.php index <HASH>..<HASH> 100644 --- a/src/Api.php +++ b/src/Api.php @@ -40,11 +40,11 @@ $this->loadWhitelist(); - if ($this->checkWhitelist() === false) + if (isset($this->request->headers->authorization) && !empty($this->request->headers->authorization())) { try { - $this->authenticate(); + $this->authenticate($this->checkWhitelist()); } catch (Exceptions\Authentication $exception) {
Efficiency improvements to whitelist/authentication system Always process auth header if it exists Pass whitelisted state to authenticate method
irwtdvoys_bolt-api
train
php
b313f84c61abeb099d558af7925dabd9a177230a
diff --git a/lib/logstasher/version.rb b/lib/logstasher/version.rb index <HASH>..<HASH> 100644 --- a/lib/logstasher/version.rb +++ b/lib/logstasher/version.rb @@ -1,3 +1,3 @@ module LogStasher - VERSION = "0.3.0" + VERSION = "0.3.1" end
Version update after merging pull request #<I>
shadabahmed_logstasher
train
rb
062d72075bacb321052cd00640071c193e3f5466
diff --git a/src/main/org/openscience/cdk/aromaticity/DaylightModel.java b/src/main/org/openscience/cdk/aromaticity/DaylightModel.java index <HASH>..<HASH> 100644 --- a/src/main/org/openscience/cdk/aromaticity/DaylightModel.java +++ b/src/main/org/openscience/cdk/aromaticity/DaylightModel.java @@ -174,6 +174,8 @@ final class DaylightModel extends ElectronDonation { int v = valence(element, charge); if (v - bondOrderSum[i] >= 2) electrons[i] = 2; + else + electrons[i] = -1; } else {
Not enough electrons - then it cannot participate.
cdk_cdk
train
java
7ea47923819657f1411885f93f94d9442434ff78
diff --git a/consumer_test.go b/consumer_test.go index <HASH>..<HASH> 100644 --- a/consumer_test.go +++ b/consumer_test.go @@ -211,7 +211,15 @@ func TestSequentialConsuming(t *testing.T) { closeWithin(t, 10*time.Second, consumer) } -func TestCompression(t *testing.T) { +func TestGzipCompression(t *testing.T) { + testCompression(t, sarama.CompressionGZIP) +} + +func TestSnappyCompression(t *testing.T) { + testCompression(t, sarama.CompressionSnappy) +} + +func testCompression(t *testing.T, codec sarama.CompressionCodec) { topic := fmt.Sprintf("test-compression-%d", time.Now().Unix()) messages := make([]string, 0) for i := 0; i < numMessages; i++ { @@ -220,7 +228,7 @@ func TestCompression(t *testing.T) { CreateMultiplePartitionsTopic(localZk, topic, 1) EnsureHasLeader(localZk, topic) - produce(t, messages, topic, localBroker, sarama.CompressionGZIP) + produce(t, messages, topic, localBroker, codec) config := testConsumerConfig() config.NumWorkers = 1
tests for gzip and snappy compression
elodina_go_kafka_client
train
go
ae1c467b8f1cfca3343f0b47f7163b511cb79d8f
diff --git a/dirutility/_version.py b/dirutility/_version.py index <HASH>..<HASH> 100644 --- a/dirutility/_version.py +++ b/dirutility/_version.py @@ -1 +1 @@ -__version__ = '0.3.4' +__version__ = '0.3.5' diff --git a/dirutility/gui.py b/dirutility/gui.py index <HASH>..<HASH> 100644 --- a/dirutility/gui.py +++ b/dirutility/gui.py @@ -129,8 +129,8 @@ class BackupZipGUI: [gui.Text('-' * 200)], # Source - [gui.Text('Select source folder', size=(15, 1), font=("Helvetica", 25), auto_size_text=False), - gui.InputText('Source', key='source', font=("Helvetica", 20)), + [gui.Text('Select source folder', size=(20, 1), font=("Helvetica", 25), auto_size_text=False), + gui.InputText('', key='source', font=("Helvetica", 20)), gui.FolderBrowse()], [gui.Submit(), gui.Cancel()]]
Updated to version <I>
mrstephenneal_dirutility
train
py,py
b3c974b0e587315bf64e0f6eeacf008807aedc11
diff --git a/vendor/refinerycms/images/lib/images.rb b/vendor/refinerycms/images/lib/images.rb index <HASH>..<HASH> 100644 --- a/vendor/refinerycms/images/lib/images.rb +++ b/vendor/refinerycms/images/lib/images.rb @@ -22,6 +22,12 @@ module Refinery app_images.analyser.register(Dragonfly::Analysis::RMagickAnalyser) app_images.analyser.register(Dragonfly::Analysis::FileCommandAnalyser) + # This little eval makes it so that dragonfly urls work in traditional + # situations where the filename and extension are required, e.g. lightbox. + # What this does is takes the url that is about to be produced e.g. + # /system/images/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw + # and adds the filename onto the end (say the image was 'refinery_is_awesome.jpg') + # /system/images/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw/refinery_is_awesome.jpg app_images.instance_eval %{ def url_for(job, *args) image_url = nil
Serious hacks require serious documentation.
refinery_refinerycms
train
rb
8cb4c95406f551ce90d36f15b4a4bab2a1acb696
diff --git a/getgauge/connection.py b/getgauge/connection.py index <HASH>..<HASH> 100755 --- a/getgauge/connection.py +++ b/getgauge/connection.py @@ -7,13 +7,13 @@ from google.protobuf.internal.encoder import _EncodeVarint def connect(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.connect(('localhost', int(os.environ['GAUGE_INTERNAL_PORT']))) + s.connect(('127.0.0.1', int(os.environ['GAUGE_INTERNAL_PORT']))) return s def to_api(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.connect(('localhost', int(os.environ['GAUGE_API_PORT']))) + s.connect(('127.0.0.1', int(os.environ['GAUGE_API_PORT']))) return s
Changing localhost to <I> #<I>
getgauge_gauge-python
train
py
e37992d44d919f0bace4ff25fc37c2d4625905d2
diff --git a/lib/event_source/stream_name.rb b/lib/event_source/stream_name.rb index <HASH>..<HASH> 100644 --- a/lib/event_source/stream_name.rb +++ b/lib/event_source/stream_name.rb @@ -2,9 +2,7 @@ module EventSource module StreamName extend self - def stream_name(category_name, id=nil) - id ||= Identifier::UUID.random - + def stream_name(category_name, id) "#{category_name}-#{id}" end
StreamName creation does not optionally randomize IDs
eventide-project_message-store
train
rb
af58a05f5d8d3ca22e6655d40466468e72345cef
diff --git a/src/test/java/org/dstadler/commons/util/ExecutorUtilTest.java b/src/test/java/org/dstadler/commons/util/ExecutorUtilTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/dstadler/commons/util/ExecutorUtilTest.java +++ b/src/test/java/org/dstadler/commons/util/ExecutorUtilTest.java @@ -83,6 +83,10 @@ public class ExecutorUtilTest { ExecutorUtil.shutdownAndAwaitTermination(executor, 10); + // allow some time for thread to vanish from the list of threads, sometimes + // they can "linger" on for a short while... + ThreadTestHelper.waitForThreadToFinishSubstring("ExecutorTest"); + ThreadTestHelper.assertNoThreadLeft( "No thread expected after shutting down the executor, look at log for thread-dump", "ExecutorTest");
Wait a bit for thread to actually fully stop to not fail in CI sometimes
centic9_commons-dost
train
java
6b4228538c6ef187853f17cdec9ccad669c2d23e
diff --git a/openquake/commands/restore.py b/openquake/commands/restore.py index <HASH>..<HASH> 100644 --- a/openquake/commands/restore.py +++ b/openquake/commands/restore.py @@ -33,7 +33,7 @@ def restore(archive, oqdata): Build a new oqdata directory from the data contained in the zip archive """ if not os.path.exists(archive): - raise OSError('%s does not exist' % archive) + sys.exit('%s does not exist' % archive) t0 = time.time() oqdata = os.path.abspath(oqdata) assert archive.endswith('.zip'), archive
Cleanup [skip CI]
gem_oq-engine
train
py
92fb3859e073936294f1909bd86a6c534dcdb1c9
diff --git a/src/Codeception/Module/WebDriver.php b/src/Codeception/Module/WebDriver.php index <HASH>..<HASH> 100644 --- a/src/Codeception/Module/WebDriver.php +++ b/src/Codeception/Module/WebDriver.php @@ -369,6 +369,7 @@ class WebDriver extends \Codeception\Module implements WebInterface { $matched = true; } catch (\NoSuchElementWebDriverError $e) {} } + if ($matched) return; foreach ($option as $opt) { try { $select->selectByValue($opt);
Add a return to separate different select situations
Codeception_base
train
php
cee91d889f621d5252645132331bc514bc768ede
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -81,7 +81,7 @@ function gulpRepl(_gulp_){ exports.instances.push({ gulp: gulp, tasks: util.getTasks(gulp), - runner: gulp.parallel || gulp.start + runner: gulp.start }); return repl;
refactor: runner is only one now (gulp-runtime)
stringparser_gulp-repl
train
js
4de3971c00c93e59ba09bb460549c5ecb74a180a
diff --git a/liquibase-core/src/main/java/liquibase/datatype/DataTypeFactory.java b/liquibase-core/src/main/java/liquibase/datatype/DataTypeFactory.java index <HASH>..<HASH> 100644 --- a/liquibase-core/src/main/java/liquibase/datatype/DataTypeFactory.java +++ b/liquibase-core/src/main/java/liquibase/datatype/DataTypeFactory.java @@ -96,6 +96,13 @@ public class DataTypeFactory { primaryKey = true; } + String[] splitTypeName = dataTypeName.split("\\s+", 2); + dataTypeName = splitTypeName[0]; + String additionalInfo = null; + if (splitTypeName.length > 1) { + additionalInfo = splitTypeName[1]; + } + SortedSet<Class<? extends LiquibaseDataType>> classes = registry.get(dataTypeName.toLowerCase()); LiquibaseDataType liquibaseDataType = null; @@ -113,6 +120,7 @@ public class DataTypeFactory { liquibaseDataType = new UnknownType(dataTypeName); } + liquibaseDataType.setAdditionalInformation(additionalInfo); if (dataTypeDefinition.matches(".+\\s*\\(.*")) { String paramStrings = dataTypeDefinition.replaceFirst(".*?\\(", "").replaceFirst("\\).*", "");
CORE-<I> AutoIncrement not working with some types
liquibase_liquibase
train
java
7f62376538cad0f2adce01850b461e3d5198a750
diff --git a/consumer.go b/consumer.go index <HASH>..<HASH> 100644 --- a/consumer.go +++ b/consumer.go @@ -167,7 +167,7 @@ func (c *Consumer) MarkOffsets(s *OffsetStash) { } } -// ResetOffsets marks the provided message as processed, alongside a metadata string +// ResetOffset marks the provided message as processed, alongside a metadata string // that represents the state of the partition consumer at that point in time. The // metadata string can be used by another consumer to restore that state, so it // can resume consumption.
Fix based on best practices from Effective Go (#<I>)
bsm_sarama-cluster
train
go
979285a60f2b4c8dfefcc8bdf8d13347155b700d
diff --git a/flake8_author.py b/flake8_author.py index <HASH>..<HASH> 100644 --- a/flake8_author.py +++ b/flake8_author.py @@ -30,19 +30,24 @@ class Checker(object): @classmethod def add_options(cls, parser): + extra_kwargs = {} + if hasattr(parser, 'config_options'): # flake8 < 3.0 + parser.config_options.append('author-attribute') + parser.config_options.append('author-pattern') + else: # flake8 >= 3.0 + extra_kwargs['parse_from_config'] = True + parser.add_option( '--author-attribute', default='optional', help="__author__ attribute: {0}".format( - ', '.join(cls.attribute_choices))) + ', '.join(cls.attribute_choices)), + **extra_kwargs) parser.add_option( '--author-pattern', default=r'.*', - help="__author__ attribute validation pattern (regex)") - - if hasattr(parser, 'config_options'): # flake8 < 3.0 - parser.config_options.append('author-attribute') - parser.config_options.append('author-pattern') + help="__author__ attribute validation pattern (regex)", + **extra_kwargs) @classmethod def parse_options(cls, options):
Pass parse_from_config=True for flake8 <I>+ Otherwise, the options won't be read from the configuration file. This case still needs test coverage.
jparise_flake8-author
train
py
467f90456c2179b1a2123e64618329ea5d17764b
diff --git a/librecaptcha/recaptcha.py b/librecaptcha/recaptcha.py index <HASH>..<HASH> 100644 --- a/librecaptcha/recaptcha.py +++ b/librecaptcha/recaptcha.py @@ -35,7 +35,7 @@ import time BASE_URL = "https://www.google.com/recaptcha/api2/" API_JS_URL = "https://www.google.com/recaptcha/api.js" -JS_URL_TEMPLATE = "https://www.gstatic.com/recaptcha/api2/{}/recaptcha__en.js" +JS_URL_TEMPLATE = "https://www.gstatic.com/recaptcha/releases/{}/recaptcha__en.js" STRINGS_VERSION = "0.1.0" STRINGS_PATH = os.path.join( @@ -127,7 +127,7 @@ def get_js_strings(user_agent, rc_version): def get_rc_version(user_agent): - match = re.search(r"/recaptcha/api2/(.+?)/", requests.get( + match = re.search(r"/recaptcha/releases/(.+?)/", requests.get( API_JS_URL, headers={ "User-Agent": user_agent, },
Script url no longer works reCAPTCHA changed its urls for `recaptcha__en.js`, now it is not under `/api2/`, but `/releases/`. This PR fixes the issue.
nickolas360_librecaptcha
train
py
2f1c763e7d9c43721606768ab41d1aba9a79f232
diff --git a/pressbooks.php b/pressbooks.php index <HASH>..<HASH> 100644 --- a/pressbooks.php +++ b/pressbooks.php @@ -24,6 +24,7 @@ function _pb_session_start() { if ( ! session_id() ) { if ( ! headers_sent() ) { ini_set( 'session.use_only_cookies', true ); + ini_set( 'session.cookie_domain', COOKIE_DOMAIN ); /** * Adjust session configuration as needed. * @@ -54,7 +55,7 @@ function _pb_session_kill() { } // @codingStandardsIgnoreEnd -add_action( 'init', '_pb_session_start', 1 ); +add_action( 'plugins_loaded', '_pb_session_start', 1 ); add_action( 'wp_logout', '_pb_session_kill' ); add_action( 'wp_login', '_pb_session_kill' );
Regain control of $_SESSION (#<I>)
pressbooks_pressbooks
train
php
d4ec871a76db740ebeee6ad9f5fd837bd6d111e8
diff --git a/dvc/repo/reproduce.py b/dvc/repo/reproduce.py index <HASH>..<HASH> 100644 --- a/dvc/repo/reproduce.py +++ b/dvc/repo/reproduce.py @@ -10,7 +10,7 @@ logger = logging.getLogger(__name__) def _reproduce_stage(stage, **kwargs): - if stage.locked: + if stage.locked and not stage.is_import: logger.warning( "{} is locked. Its dependencies are" " not going to be reproduced.".format(stage)
repro: do not log when stage is locked and is repo import (#<I>)
iterative_dvc
train
py
30539b8f8944b17711a6df9bb5ee7f0dbb7ef920
diff --git a/parallel.js b/parallel.js index <HASH>..<HASH> 100644 --- a/parallel.js +++ b/parallel.js @@ -32,6 +32,7 @@ function fastparallel (options) { function parallel (that, toCall, arg, done) { var i var holder = next() + done = done || nop if (toCall.length === 0) { done.call(that) released(head) diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -240,3 +240,22 @@ test('call the result callback when the each array is empty with no results', fu t.error('this should never be called') } }) + +test('does not require a done callback', function (t) { + t.plan(4) + + var instance = parallel() + var count = 0 + var obj = {} + + instance(obj, [something, something], 42) + + function something (arg, cb) { + t.equal(obj, this) + t.equal(arg, 42) + setImmediate(function () { + count++ + cb() + }) + } +})
Do not require a done callback.
mcollina_fastparallel
train
js,js
b9ab1856199f5e727b9f1d0c43c8cfe45a630b92
diff --git a/alot/widgets.py b/alot/widgets.py index <HASH>..<HASH> 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -476,10 +476,12 @@ class MessageWidget(urwid.WidgetWrap): mail = self.message.get_email() # normalize values if only filtered list is shown norm = not (self._displayed_headers == self._all_headers) + lowercase_keys = [k.lower() for k in self._displayed_headers] + #build lines lines = [] for k, v in mail.items(): - if k in self._displayed_headers: + if k.lower() in lowercase_keys: lines.append((k, message.decode_header(v, normalize=norm))) cols = [HeadersList(lines)]
case insensitive header key filter closes #<I>
pazz_alot
train
py
9a85815017ed9324ea3929c6b6cf8c850c835c88
diff --git a/lib/spidr/page.rb b/lib/spidr/page.rb index <HASH>..<HASH> 100644 --- a/lib/spidr/page.rb +++ b/lib/spidr/page.rb @@ -280,7 +280,7 @@ module Spidr def cookie_params params = {} - cookie.split(/;\s+/).each do |key_value| + (@headers['set-cookie'] || []).each do |key_value| key, value = key_value.split('=',2) next if RESERVED_COOKIE_NAMES.include?(key) diff --git a/spec/page_spec.rb b/spec/page_spec.rb index <HASH>..<HASH> 100644 --- a/spec/page_spec.rb +++ b/spec/page_spec.rb @@ -81,7 +81,7 @@ describe Page do describe "cookies" do before(:all) do - @page = get_page('http://github.com/postmodern/spidr/') + @page = get_page('http://twitter.com/login') end it "should provide access to the raw Cookie" do @@ -97,7 +97,7 @@ describe Page do params.each do |key,value| key.should_not be_empty - value.should_not be_nil + value.should_not be_empty end end end
fix potential parse error with multiple header cookies
postmodern_spidr
train
rb,rb
9340866c1bce48164c1cc10b8aa6ca73425a73e9
diff --git a/lib/node-mplayer.js b/lib/node-mplayer.js index <HASH>..<HASH> 100644 --- a/lib/node-mplayer.js +++ b/lib/node-mplayer.js @@ -112,10 +112,17 @@ Mplayer.prototype.getTimeLength = function(callback) { Mplayer.prototype.getTimePosition = function(callback) { if(this.childProc !== null){ + var that = this; this.rl.question("get_time_pos\n", function(answer) { - callback(answer.split('=')[1]); + if (answer.split('=')[0]=='ANS_TIME_POSITION'){ + callback(answer.split('=')[1]); + } + else{ + // Try again :( + that.getTimePosition(callback); + } }); } }; -module.exports = Mplayer; \ No newline at end of file +module.exports = Mplayer;
Fix for getTimePosition on ubuntu <I> As the answer from the subprocess sometimes is blank when I poll for the time position, I suggest adding some lines to test the answer
loics2_node-mplayer
train
js
63e56a9e17da0099e89ba57a35baaf25cf26d75f
diff --git a/tests/pytests/unit/states/test_cmd.py b/tests/pytests/unit/states/test_cmd.py index <HASH>..<HASH> 100644 --- a/tests/pytests/unit/states/test_cmd.py +++ b/tests/pytests/unit/states/test_cmd.py @@ -155,7 +155,7 @@ def test_script_runas_no_password(): "changes": {}, "result": False, "comment": "", - "commnd": "Must supply a password if runas argument is used on Windows.", + "command": "Must supply a password if runas argument is used on Windows.", } patch_opts = patch.dict(cmd.__opts__, {"test": False}) @@ -198,8 +198,6 @@ def test_call(): specified in the state declaration. """ name = "cmd.script" - # func = 'myfunc' - ret = {"name": name, "result": False, "changes": {}, "comment": ""} flag = None
Fix typo and remove superfluous comment
saltstack_salt
train
py
e7b28164c13b4d2c16ee46bc86ee93c06b17cb18
diff --git a/bids/variables/entities.py b/bids/variables/entities.py index <HASH>..<HASH> 100644 --- a/bids/variables/entities.py +++ b/bids/variables/entities.py @@ -46,9 +46,13 @@ class RunNode(Node): super(RunNode, self).__init__('run', entities) def get_info(self): - - return RunInfo(self.entities, self.duration, self.repetition_time, - self.image_file) + # Note: do not remove the dict() call! self.entities is a SQLAlchemy + # association_proxy mapping, and without the conversion, the connection + # to the DB persists, causing problems on Python 3.5 if we try to clone + # a RunInfo or any containing object. + entities = dict(self.entities) + return RunInfo(entities, self.duration, + self.repetition_time, self.image_file) # Stores key information for each Run.
fixes BIDSVariable deepcopy error by ensuring we have no connection to the DB
bids-standard_pybids
train
py
4094b5fe3a3f0efaae5bebce91e06617c3bd139a
diff --git a/mutagen/flac.py b/mutagen/flac.py index <HASH>..<HASH> 100644 --- a/mutagen/flac.py +++ b/mutagen/flac.py @@ -45,10 +45,10 @@ class FLACVorbisError(ValueError, error): pass -def to_int_be(string): +def to_int_be(data): """Convert an arbitrarily-long string to a long using big-endian byte order.""" - return reduce(lambda a, b: (a << 8) + b, bytearray(string), 0) + return reduce(lambda a, b: (a << 8) + b, bytearray(data), 0) class StrictFileObject(object): @@ -619,8 +619,8 @@ class FLAC(mutagen.FileType): """Known metadata block types, indexed by ID.""" @staticmethod - def score(filename, fileobj, header): - return (header.startswith(b"fLaC") + + def score(filename, fileobj, header_data): + return (header_data.startswith(b"fLaC") + endswith(filename.lower(), ".flac") * 3) def __read_metadata_block(self, fileobj):
flac.py: renamed variable names for clarity.
quodlibet_mutagen
train
py
5d5ec48527bc00646610e6533880c34f24749bf4
diff --git a/table/tables.py b/table/tables.py index <HASH>..<HASH> 100644 --- a/table/tables.py +++ b/table/tables.py @@ -14,13 +14,13 @@ from addon import (TableSearchBox, TableInfoLabel, TablePagination, class BaseTable(object): def __init__(self, data=None): - if isinstance(data, QuerySet) or isinstance(data, list): + model = getattr(self.opts, 'model', None) + if model: + self.data = model.objects.all() + elif hasattr(data, "__iter__"): self.data = data else: - model = getattr(self.opts, 'model', None) - if not model: - raise ValueError("Model class or QuerySet-like object is required.") - self.data = model.objects.all() + raise ValueError("Model class or QuerySet-like object is required.") # Make a copy so that modifying this will not touch the class definition. self.columns = copy.deepcopy(self.base_columns)
Fix bug about checking type of datasource
shymonk_django-datatable
train
py
46fe8d1d77873083d7cee0b803821eb093dc31d3
diff --git a/programs/thumbnails.py b/programs/thumbnails.py index <HASH>..<HASH> 100755 --- a/programs/thumbnails.py +++ b/programs/thumbnails.py @@ -105,6 +105,16 @@ def make_thumbnails(directory=".", fmt="png"): top = 0 + height * .155 right = width * .902 bottom = height * .86 + elif "ty:_day" in lower_infile: + left = 0 + width * .124 + top = 0 + height * .12 + right = width * .902 + bottom = height * .855 + elif "ty:_s-bc" in lower_infile or "ty:_s-bcr" in lower_infile: + left = 0 + width * .124 + top = 0 + height * .12 + right = width * .902 + bottom = height * .892 else: error_log("Could not crop {}".format(infile)) im.save(infile[:-4] + ".thumb.{}".format(fmt), fmt, dpi=(300, 300))
add dayplot sizes into thumbnail cropping
PmagPy_PmagPy
train
py
bc89ecfe981f18d7111ce84d7293e0d6d265c364
diff --git a/activejdbc/src/main/java/activejdbc/Model.java b/activejdbc/src/main/java/activejdbc/Model.java index <HASH>..<HASH> 100644 --- a/activejdbc/src/main/java/activejdbc/Model.java +++ b/activejdbc/src/main/java/activejdbc/Model.java @@ -587,7 +587,7 @@ public abstract class Model extends CallbackSupport implements Externalizable { StringWriter sw = new StringWriter(); - sw.write(indent + "{" + (pretty?"\n " + indent: "") + "\"type\":\"" + getClass().getName() + "\","); + sw.write(indent + "{" + (pretty?"\n " + indent: "") + "\"model_class\":\"" + getClass().getName() + "\","); List<String> attributeStrings = new ArrayList<String>();
changed "type" to "model_class" in JSON, references: <URL>
javalite_activejdbc
train
java
6ac858b60491dc4e30431556d45db29e5299441e
diff --git a/djstripe/models/webhooks.py b/djstripe/models/webhooks.py index <HASH>..<HASH> 100644 --- a/djstripe/models/webhooks.py +++ b/djstripe/models/webhooks.py @@ -219,7 +219,7 @@ class WebhookEventTrigger(models.Model): if obj.valid: if djstripe_settings.WEBHOOK_EVENT_CALLBACK: # If WEBHOOK_EVENT_CALLBACK, pass it for processing - djstripe_settings.WEBHOOK_EVENT_CALLBACK(obj) + djstripe_settings.WEBHOOK_EVENT_CALLBACK(obj, api_key=api_key) else: # Process the item (do not save it, it'll get saved below) obj.process(save=False, api_key=api_key)
Passed api_key in WEBHOOK_EVENT_CALLBACK
dj-stripe_dj-stripe
train
py
51d8d8ab7aacc183edc24257cc0fe632d78b136f
diff --git a/lib/Gitlab/HttpClient/Builder.php b/lib/Gitlab/HttpClient/Builder.php index <HASH>..<HASH> 100644 --- a/lib/Gitlab/HttpClient/Builder.php +++ b/lib/Gitlab/HttpClient/Builder.php @@ -5,6 +5,7 @@ namespace Gitlab\HttpClient; use Http\Client\Common\HttpMethodsClient; use Http\Client\Common\Plugin; use Http\Client\Common\PluginClient; +use Http\Client\Common\PluginClientFactory; use Http\Client\HttpClient; use Http\Discovery\HttpClientDiscovery; use Http\Discovery\MessageFactoryDiscovery; @@ -81,7 +82,7 @@ class Builder $this->httpClientModified = false; $this->pluginClient = new HttpMethodsClient( - new PluginClient($this->httpClient, $this->plugins), + (new PluginClientFactory())->createClient($this->httpClient, $this->plugins), $this->requestFactory ); }
Use the plugin client factory in the http client builder
m4tthumphrey_php-gitlab-api
train
php
8bdb16fca8ee03a22960d8f02e521abaac9c8d75
diff --git a/Swat/exceptions/SwatException.php b/Swat/exceptions/SwatException.php index <HASH>..<HASH> 100644 --- a/Swat/exceptions/SwatException.php +++ b/Swat/exceptions/SwatException.php @@ -283,12 +283,12 @@ class SwatException extends Exception { ob_start(); - printf("%s Exception: %s\n\nCode: %s\n\nMessage:\n\t%s\n\n". + printf("%s Exception: %s\n\nMessage: %s\n\nCode:\n\t%s\n\n". "Created in file '%s' on line %s.\n\n", $this->wasHandled() ? 'Caught' : 'Uncaught', $this->class, - $this->getCode(), $this->getMessage(), + $this->getCode(), $this->getFile(), $this->getLine());
Display message first and code second. svn commit r<I>
silverorange_swat
train
php
d42f5a41a5ad3ba0888286b38deb4064167fa4a2
diff --git a/testing/test_runner.py b/testing/test_runner.py index <HASH>..<HASH> 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -468,10 +468,7 @@ reporttypes = [reports.BaseReport, reports.TestReport, reports.CollectReport] "reporttype", reporttypes, ids=[x.__name__ for x in reporttypes] ) def test_report_extra_parameters(reporttype): - if hasattr(inspect, "signature"): - args = list(inspect.signature(reporttype.__init__).parameters.keys())[1:] - else: - args = inspect.getargspec(reporttype.__init__)[0][1:] + args = list(inspect.signature(reporttype.__init__).parameters.keys())[1:] basekw = dict.fromkeys(args, []) report = reporttype(newthing=1, **basekw) assert report.newthing == 1
delete inspect.getargspect() as is deprecated since Python <I>
pytest-dev_pytest
train
py
6a2c894ec9b548f96df31dcbef7302791446ba6e
diff --git a/android_asset_resizer/resizer.py b/android_asset_resizer/resizer.py index <HASH>..<HASH> 100755 --- a/android_asset_resizer/resizer.py +++ b/android_asset_resizer/resizer.py @@ -40,7 +40,7 @@ class AssetResizer(): try: path = os.path.join(self.out, 'res/drawable-%s' % d) - os.makedirs(path, 0755) + os.makedirs(path, 0o755) except OSError: pass
Fix another octal definition.
twaddington_android-asset-resizer
train
py
48272cb8495aab5dd641ed8652b7e194f37c02d3
diff --git a/course/format/weeks/lib.php b/course/format/weeks/lib.php index <HASH>..<HASH> 100644 --- a/course/format/weeks/lib.php +++ b/course/format/weeks/lib.php @@ -25,6 +25,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot. '/course/format/lib.php'); +require_once($CFG->dirroot. '/course/lib.php'); /** * Main class for the Weeks course format @@ -363,10 +364,12 @@ class format_weeks extends format_base { * @return stdClass property start for startdate, property end for enddate */ public function get_section_dates($section, $startdate = false) { + global $USER; if ($startdate === false) { $course = $this->get_course(); - $startdate = $course->startdate; + $userdates = course_get_course_dates_for_user_id($course, $USER->id); + $startdate = $userdates['start']; } if (is_object($section)) {
MDL-<I> course: make course format weeks show relative dates
moodle_moodle
train
php
68a854bdad36fc7f2a4f04aa889eed5d142407f2
diff --git a/spec/server_spec.rb b/spec/server_spec.rb index <HASH>..<HASH> 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -72,6 +72,24 @@ module Jimson 'id' => 1 } end + + it "handles bignums" do + req = { + 'jsonrpc' => '2.0', + 'method' => 'subtract', + 'params' => [24, 20], + 'id' => 123456789_123456789_123456789 + } + post_json(req) + + last_response.should be_ok + resp = MultiJson.decode(last_response.body) + resp.should == { + 'jsonrpc' => '2.0', + 'result' => 4, + 'id' => 123456789_123456789_123456789 + } + end end end
Add a test for bignums handling.
chriskite_jimson
train
rb
c6d8b477fc739d9e51114b8a18c59ac877a6c135
diff --git a/lib/Cake/Error/exceptions.php b/lib/Cake/Error/exceptions.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Error/exceptions.php +++ b/lib/Cake/Error/exceptions.php @@ -63,7 +63,7 @@ class CakeBaseException extends RuntimeException { * * @package Cake.Error */ -if (!class_exists('HttpException')) { +if (!class_exists('HttpException', false)) { class HttpException extends CakeBaseException { } }
Prevent autoload when checking for the existence of HttpException The class_exists check has been added in <URL>
cakephp_cakephp
train
php
e616ab22c040158b38b0f6382a711cae5252902f
diff --git a/packages/ember-handlebars/tests/helpers/outlet_test.js b/packages/ember-handlebars/tests/helpers/outlet_test.js index <HASH>..<HASH> 100644 --- a/packages/ember-handlebars/tests/helpers/outlet_test.js +++ b/packages/ember-handlebars/tests/helpers/outlet_test.js @@ -40,6 +40,24 @@ test("outlet should allow controllers to fill in slots", function() { equal(view.$().text(), 'HIBYE'); }); +test("outlet should allow controllers to fill in slots in prerender state", function() { + var controller = Ember.Object.create({ + view: Ember.View.create({ + template: compile("<p>BYE</p>") + }) + }); + + var template = "<h1>HI</h1>{{outlet}}"; + view = Ember.View.create({ + controller: controller, + template: Ember.Handlebars.compile(template) + }); + + appendView(view); + + equal(view.$().text(), 'HIBYE'); +}); + test("outlet should support an optional name", function() { var controller = Ember.Object.create();
add another test for the previous commit but for an outlet setup in the prerender state
emberjs_ember.js
train
js
64a2bac6a79c00e3acb46804b92082a5c77a0468
diff --git a/src/tiledMapLoader.js b/src/tiledMapLoader.js index <HASH>..<HASH> 100644 --- a/src/tiledMapLoader.js +++ b/src/tiledMapLoader.js @@ -4,7 +4,7 @@ var path = require('path'), module.exports = function() { return function(resource, next) { - if (!resource.data || !resource.isXml || !resource.data.children[0].getElementsByTagName('tileset')) { + if (!resource.data || resource.type != Resource.TYPE.XML || !resource.data.children[0].getElementsByTagName('tileset')) { return next(); } @@ -12,7 +12,8 @@ module.exports = function() { var loadOptions = { crossOrigin: resource.crossOrigin, - loadType: PIXI.loaders.Resource.LOAD_TYPE.IMAGE + loadType: PIXI.loaders.Resource.LOAD_TYPE.IMAGE, + parentResource: resource }; var that = this;
added parentResource to loadOptions
riebel_pixi-tiledmap
train
js
022c81110a8a3b76d8062116862d44555e968e6e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ from setuptools import setup,find_packages setup( name='synapse', - version='0.0.8', # sync with synapse.version! + version='0.0.9', # sync with synapse.version! description='Synapse Distributed Computing Framework', author='Invisigoth Kenshoto', author_email='invisigoth.kenshoto@gmail.com', diff --git a/synapse/__init__.py b/synapse/__init__.py index <HASH>..<HASH> 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -10,7 +10,7 @@ if msgpack.version < (0,4,2): if tornado.version_info < (3,2): raise Exception('synapse requires tornado >= 3.2') -version = (0,0,8) +version = (0,0,9) verstring = '.'.join([ str(x) for x in version ]) import synapse.lib.modules as s_modules
update versions to <I> in prep for <I> tag
vertexproject_synapse
train
py,py
724bbd981c8a69d99c25c57e6c7eb2142ad1f86c
diff --git a/widgetsnbextension/src/extension.js b/widgetsnbextension/src/extension.js index <HASH>..<HASH> 100644 --- a/widgetsnbextension/src/extension.js +++ b/widgetsnbextension/src/extension.js @@ -102,9 +102,9 @@ function register_events(Jupyter, events, outputarea) { */ function render(output, data, node) { // data is a model id - var manager = Jupyter.notebook.kernel.widget_manager; - if (!manager) { - node.textContent = "Missing widget manager"; + var manager = Jupyter.notebook && Jupyter.notebook.kernel && Jupyter.notebook.kernel.widget_manager; + if (manager === undefined) { + node.textContent = "Error rendering Jupyter widget: missing widget manager"; return; } @@ -120,7 +120,7 @@ function register_events(Jupyter, events, outputarea) { PhosphorWidget.Widget.attach(view.pWidget, node); }); } else { - node.textContent = "Widget not found: "+JSON.stringify(data); + node.textContent = "Error rendering Jupyter widget. Widget not found: "+JSON.stringify(data); } }
Add a bit more error checking when rendering widgets in the classic notebook. Works around #<I>
jupyter-widgets_ipywidgets
train
js
3c2c74611d63d66d1ffe5b76972c620f8a804e05
diff --git a/lib/progress.rb b/lib/progress.rb index <HASH>..<HASH> 100644 --- a/lib/progress.rb +++ b/lib/progress.rb @@ -220,13 +220,12 @@ class Progress message_cl << " - #{note}" end - unless lines? - previous_length = @previous_length || 0 - @previous_length = message_cl.length - message << "#{' ' * [previous_length - message_cl.length, 0].max}\r" + if lines? + io.puts(message) + else + io << message << "\e[K\r" end - lines? ? io.puts(message) : io.print(message) set_title(message_cl) end end
using control character to clear line to end
toy_progress
train
rb
2540da4279684ab5962fe4150795d8968c45cd6a
diff --git a/jbpm-runtime-manager/src/test/java/org/jbpm/runtime/manager/impl/SimpleRuntimeEnvironmentTest.java b/jbpm-runtime-manager/src/test/java/org/jbpm/runtime/manager/impl/SimpleRuntimeEnvironmentTest.java index <HASH>..<HASH> 100644 --- a/jbpm-runtime-manager/src/test/java/org/jbpm/runtime/manager/impl/SimpleRuntimeEnvironmentTest.java +++ b/jbpm-runtime-manager/src/test/java/org/jbpm/runtime/manager/impl/SimpleRuntimeEnvironmentTest.java @@ -80,4 +80,17 @@ public class SimpleRuntimeEnvironmentTest extends SimpleRuntimeEnvironment { assertEquals( "Incorrect file type", DecisionTableInputType.XLS, ((DecisionTableConfiguration) replacedConfig).getInputType()); assertEquals( "Worksheet name not preserved", worksheetName, ((DecisionTableConfiguration) replacedConfig).getWorksheetName()); } + + @Test + public void addAssetXLSDtableWithOwnConfigTest() { + Resource resource = ResourceFactory.newClassPathResource("/data/resource.xls", getClass()); + DecisionTableConfigurationImpl config = new DecisionTableConfigurationImpl(); + config.setInputType(DecisionTableInputType.XLS); + String worksheetName = "test-worksheet-name"; + config.setWorksheetName(worksheetName); + resource.setConfiguration(config); + + addAsset(resource, ResourceType.DTABLE); + verify(this.kbuilder).add(any(Resource.class), any(ResourceType.class)); + } }
[BZ-<I>] add test case with XLS dtable with own config * forgotten commit that is already on <I>.x
kiegroup_jbpm
train
java
b6d1f3b30b465c6264291a09f38ce19b1df31366
diff --git a/openquake/risk/job/general.py b/openquake/risk/job/general.py index <HASH>..<HASH> 100644 --- a/openquake/risk/job/general.py +++ b/openquake/risk/job/general.py @@ -57,7 +57,9 @@ def preload(mixin): def write_output(mixin): - """ Write the output of a block to kvs. """ + """ + Write the output of a block to db/xml. + """ for block_id in mixin.blocks_keys: #pylint: disable=W0212 mixin._write_output_for_block(mixin.job_id, block_id)
risk/job/general.py: more correct docstring in write_output() Former-commit-id: <I>c6d<I>f<I>be0a<I>fabbeb8efa<I>ef
gem_oq-engine
train
py
2e27015720e1abaebf920f735b8734fd0cb9755c
diff --git a/includes/class-freemius.php b/includes/class-freemius.php index <HASH>..<HASH> 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -8897,7 +8897,7 @@ if ( $this->is_submenu_item_visible( 'support' ) ) { $this->add_submenu_link_item( $this->apply_filters( 'support_forum_submenu', $this->get_text( 'support-forum' ) ), - $this->apply_filters( 'support_forum_url', 'https://wordpress.org/support/plugin/' . $this->_slug ), + $this->apply_filters( 'support_forum_url', 'https://wordpress.org/support/' . $this->_module_type . '/' . $this->_slug ), 'wp-support-forum', null, 50
[themes] [bug-fix] Fixed the wp.org support forum URL for themes.
Freemius_wordpress-sdk
train
php
78d83851fb69810c8985672b9a53348c4a61405f
diff --git a/elasticsearch-api/api-spec-testing/wipe_cluster.rb b/elasticsearch-api/api-spec-testing/wipe_cluster.rb index <HASH>..<HASH> 100644 --- a/elasticsearch-api/api-spec-testing/wipe_cluster.rb +++ b/elasticsearch-api/api-spec-testing/wipe_cluster.rb @@ -187,7 +187,7 @@ module Elasticsearch break if repositories.empty? repositories.each_key do |repository| - if repositories[repository]['type'] == 'fs' + if ['fs', 'source'].include? repositories[repository]['type'] response = client.snapshot.get(repository: repository, snapshot: '_all', ignore_unavailable: true) response['snapshots'].each do |snapshot| if snapshot['state'] != 'SUCCESS'
[API] Test Runner: adds source type snapshot to delete_snapshots on wipe cluster
elastic_elasticsearch-ruby
train
rb
14333c1128c36136f8917ee2b82f44da359658c4
diff --git a/version.php b/version.php index <HASH>..<HASH> 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2010101300; // YYYYMMDD = date of the last version bump +$version = 2010101400; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 RC1 (Build: 20101014)'; // Human-friendly version name
MDL-<I> version bump needed for js cache resetting
moodle_moodle
train
php
01581b42af935ebd246220858c498f536fd9943a
diff --git a/spyder/widgets/findinfiles.py b/spyder/widgets/findinfiles.py index <HASH>..<HASH> 100644 --- a/spyder/widgets/findinfiles.py +++ b/spyder/widgets/findinfiles.py @@ -263,13 +263,13 @@ class FindOptions(QWidget): self.more_options.setChecked(more_options) self.ok_button = create_toolbutton(self, text=_("Search"), - icon=ima.icon('DialogApplyButton'), + icon=ima.icon('find'), triggered=lambda: self.find.emit(), tip=_("Start search"), text_beside_icon=True) self.ok_button.clicked.connect(self.update_combos) self.stop_button = create_toolbutton(self, text=_("Stop"), - icon=ima.icon('stop'), + icon=ima.icon('editclear'), triggered=lambda: self.stop.emit(), tip=_("Stop search"), @@ -504,7 +504,6 @@ class FileMatchItem(QTreeWidgetItem): QTreeWidgetItem.__init__(self, parent, [title], QTreeWidgetItem.Type) self.setToolTip(0, filename) - self.setIcon(0, get_filetype_icon(filename)) def __lt__(self, x): return self.filename < x.filename
Brand new buttons to search and stop functions
spyder-ide_spyder
train
py
b9ad35d2de45f375d8f8e48a018b2ee8e91cc931
diff --git a/src/FormComponents/Uploader.js b/src/FormComponents/Uploader.js index <HASH>..<HASH> 100644 --- a/src/FormComponents/Uploader.js +++ b/src/FormComponents/Uploader.js @@ -84,6 +84,7 @@ export default props => { ...files.map(file => { return { originFileObj: file, + originalFileObj: file, id: file.id, lastModified: file.lastModified, lastModifiedDate: file.lastModifiedDate,
adding a field originalFileObj as alternative to originFileObj for clarity
TeselaGen_teselagen-react-components
train
js
d2d1a01b665119695f102eaa4058a21b96b14489
diff --git a/src/controllers/admin/AdminAngelController.php b/src/controllers/admin/AdminAngelController.php index <HASH>..<HASH> 100644 --- a/src/controllers/admin/AdminAngelController.php +++ b/src/controllers/admin/AdminAngelController.php @@ -52,7 +52,7 @@ class AdminAngelController extends AngelController { * @param string $name - The string to sluggify. * @return string $slug - The sluggified string. */ - private function sluggify($name) + protected function sluggify($name) { $slug = strtolower($name); $slug = strip_tags($slug); diff --git a/src/models/Menu.php b/src/models/Menu.php index <HASH>..<HASH> 100644 --- a/src/models/Menu.php +++ b/src/models/Menu.php @@ -52,7 +52,7 @@ class Menu extends Eloquent { }); } - private function modelsToFetch($menuItems, $fetchModels = array(), $goDeeper = true) + protected function modelsToFetch($menuItems, $fetchModels = array(), $goDeeper = true) { foreach ($menuItems as $menuItem) { if (!isset($fetchModels[$menuItem->fmodel])) {
private -> protected (extendable)
JVMartin_angel-core
train
php,php
f19acce2b8956920b7130f572eb6aec5019a31dc
diff --git a/variable.go b/variable.go index <HASH>..<HASH> 100644 --- a/variable.go +++ b/variable.go @@ -92,6 +92,11 @@ func (vr *variableResolver) resolve(ctx *ExecutionContext) (*Value, error) { } if !is_func { + // Check whether this is an interface + if current.Kind() == reflect.Interface { + current = reflect.ValueOf(current.Interface()) + } + // If current a pointer, resolve it if current.Kind() == reflect.Ptr { current = current.Elem()
interface-support added for Context variables.
flosch_pongo2
train
go
fc0b15ad45a1f6c23d9ae10c8149242adb84c894
diff --git a/lib/OpenLayers/Tile/Image/IFrame.js b/lib/OpenLayers/Tile/Image/IFrame.js index <HASH>..<HASH> 100644 --- a/lib/OpenLayers/Tile/Image/IFrame.js +++ b/lib/OpenLayers/Tile/Image/IFrame.js @@ -196,6 +196,19 @@ OpenLayers.Tile.Image.IFrame = { OpenLayers.Tile.Image.prototype.setImgSrc.apply(this, arguments); } }, + + /** + * Method: onImageLoad + * Handler for the image onload event + */ + onImageLoad: function() { + //TODO de-uglify opacity handling + OpenLayers.Tile.Image.prototype.onImageLoad.apply(this, arguments); + if (this.useIFrame === true) { + this.imgDiv.style.opacity = 1; + this.frame.style.opacity = this.layer.opacity; + } + }, /** * Method: createBackBuffer
Overriding onImageLoad to set the opacity on the correct element.
openlayers_openlayers
train
js
ef0dccfe36adb9ba0be40641aec751027fd1758b
diff --git a/law/target/remote.py b/law/target/remote.py index <HASH>..<HASH> 100644 --- a/law/target/remote.py +++ b/law/target/remote.py @@ -116,7 +116,7 @@ class GFALInterface(object): # expand variables in base and bases self.base = map(os.path.expandvars, self.base) - self.bases = {k: map(os.path.expandvars, b) for k, b in six.iteritems(bases)} + self.bases = {k: map(os.path.expandvars, b) for k, b in six.iteritems(self.bases)} # prepare gfal options self.gfal_options = gfal_options or {}
Fix bases in GFALInterface.
riga_law
train
py
86bdbb017880ed0874e59970c1eff0dceb17332c
diff --git a/zinnia/settings.py b/zinnia/settings.py index <HASH>..<HASH> 100644 --- a/zinnia/settings.py +++ b/zinnia/settings.py @@ -83,7 +83,7 @@ COMPARISON_FIELDS = getattr(settings, 'ZINNIA_COMPARISON_FIELDS', 'excerpt', 'image_caption']) SPAM_CHECKER_BACKENDS = getattr(settings, 'ZINNIA_SPAM_CHECKER_BACKENDS', - ()) + []) URL_SHORTENER_BACKEND = getattr(settings, 'ZINNIA_URL_SHORTENER_BACKEND', 'zinnia.url_shortener.backends.default')
SPAM_CHECKER_BACKENDS is now a list instead of a tuple for consistency
Fantomas42_django-blog-zinnia
train
py
4499f2ef6c2a96320b7b263d2b2237ad87f80081
diff --git a/titan-test/src/main/java/com/thinkaurelius/titan/graphdb/TitanOperationCountingTest.java b/titan-test/src/main/java/com/thinkaurelius/titan/graphdb/TitanOperationCountingTest.java index <HASH>..<HASH> 100644 --- a/titan-test/src/main/java/com/thinkaurelius/titan/graphdb/TitanOperationCountingTest.java +++ b/titan-test/src/main/java/com/thinkaurelius/titan/graphdb/TitanOperationCountingTest.java @@ -616,7 +616,7 @@ public abstract class TitanOperationCountingTest extends TitanGraphBaseTest { System.out.println(round(timecoldglobal) + "\t" + round(timewarmglobal) + "\t" + round(timehotglobal)); assertTrue(timecoldglobal + " vs " + timewarmglobal, timecoldglobal>timewarmglobal*2); - assertTrue(timewarmglobal + " vs " + timehotglobal, timewarmglobal>timehotglobal); + //assertTrue(timewarmglobal + " vs " + timehotglobal, timewarmglobal>timehotglobal); Sometimes, this is not true } private double testAllVertices(long vid, int numV) {
Removed assertion that is time dependent.
thinkaurelius_titan
train
java
884b79d25e8279616256c2185580c2320c774d88
diff --git a/ga4gh/datarepo.py b/ga4gh/datarepo.py index <HASH>..<HASH> 100644 --- a/ga4gh/datarepo.py +++ b/ga4gh/datarepo.py @@ -926,7 +926,14 @@ class SqlDataRepository(AbstractDataRepository): """ sql = "DELETE FROM ReferenceSet WHERE id=?" cursor = self._dbConnection.cursor() - cursor.execute(sql, (referenceSet.getId(),)) + try: + cursor.execute(sql, (referenceSet.getId(),)) + except sqlite3.IntegrityError: + msg = ("Unable to delete reference set. " + "There are objects currently in the registry which are " + "aligned against it. Remove these objects before removing " + "the reference set.") + raise exceptions.RepoManagerException(msg) def _readReadGroupSetTable(self, cursor): cursor.row_factory = sqlite3.Row
Emit error when attempting to delete in use refset Issue #<I>
ga4gh_ga4gh-server
train
py
6833c702d839ec89eeb80b76949dc1e16026af4f
diff --git a/generator/lib/builder/om/PHP5ObjectBuilder.php b/generator/lib/builder/om/PHP5ObjectBuilder.php index <HASH>..<HASH> 100644 --- a/generator/lib/builder/om/PHP5ObjectBuilder.php +++ b/generator/lib/builder/om/PHP5ObjectBuilder.php @@ -2155,7 +2155,7 @@ abstract class ".$this->getClassname()." extends ".$parentClass." "; } $script .= " - if (\$deep) { // also de-associate any related objects?"; + if (\$deep) { // also de-associate any related objects?\n"; foreach ($table->getForeignKeys() as $fk) { $varName = $this->getFKVarName($fk); @@ -2166,10 +2166,10 @@ abstract class ".$this->getClassname()." extends ".$parentClass." "; foreach ($table->getReferrers() as $refFK) { if ($refFK->isLocalPrimaryKey()) { $script .= " - \$this->".$this->getPKRefFKVarName($refFK)." = null;"; + \$this->".$this->getPKRefFKVarName($refFK)." = null;\n"; } else { $script .= " - \$this->".$this->getRefFKCollVarName($refFK)." = null;"; + \$this->".$this->getRefFKCollVarName($refFK)." = null;\n"; } }
[<I>][<I>] Line break regressions from whitespace cleanup
propelorm_Propel
train
php
b5a9b90ecc860c79481c4a60fe8e598536076c9a
diff --git a/src/main/resources/META-INF/resources/primefaces/autocomplete/autocomplete.js b/src/main/resources/META-INF/resources/primefaces/autocomplete/autocomplete.js index <HASH>..<HASH> 100644 --- a/src/main/resources/META-INF/resources/primefaces/autocomplete/autocomplete.js +++ b/src/main/resources/META-INF/resources/primefaces/autocomplete/autocomplete.js @@ -569,7 +569,7 @@ PrimeFaces.widget.AutoComplete = PrimeFaces.widget.BaseWidget.extend({ if(this.panel.children().is('ul') && query.length > 0) { this.items.filter(':not(.ui-autocomplete-moretext)').each(function() { var item = $(this), - text = item.html(), + text = item.text(), re = new RegExp(PrimeFaces.escapeRegExp(query), 'gi'), highlighedText = text.replace(re, '<span class="ui-autocomplete-query">$&</span>');
Fix #<I>: Autocomplete fixed & in search results.
primefaces_primefaces
train
js
327cfb34fcac6d3217b8a1fe9a1e36a923c4e488
diff --git a/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java b/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java +++ b/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java @@ -68,7 +68,7 @@ public class ApnsClientTest { private ApnsClient<SimpleApnsPushNotification> client; @Rule - public Timeout globalTimeout = new Timeout(10000); + public Timeout globalTimeout = new Timeout(30000); @BeforeClass public static void setUpBeforeClass() throws Exception {
Extended the test timeout to <I> seconds. `testSendManyNotifications` was right on the edge and would fail intermittently depending on system load.
relayrides_pushy
train
java
4a4b14819a5ca77312983adc7c5fd086d0cf27e0
diff --git a/p2p/host/relay/autorelay.go b/p2p/host/relay/autorelay.go index <HASH>..<HASH> 100644 --- a/p2p/host/relay/autorelay.go +++ b/p2p/host/relay/autorelay.go @@ -136,7 +136,9 @@ again: ar.mx.Unlock() // this dance is necessary to cover the Private->Public->Private transition // where we were already connected to enough relays while private and dropped - // the addrs while public + // the addrs while public. + // Note tht we don't need the lock for reading addrs, as the only writer is + // the current goroutine. if ar.addrs == nil { ar.updateAddrs() }
add comment about eliding the lock on addrs read
libp2p_go-libp2p
train
go