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
d6a534c8606eb5949f51571d794521ba8d53603a
diff --git a/media_library/media_library.go b/media_library/media_library.go index <HASH>..<HASH> 100644 --- a/media_library/media_library.go +++ b/media_library/media_library.go @@ -334,6 +334,15 @@ type File struct { Description string } +// IsImage return if it is an image +func (f File) IsImage() bool { + return media.IsImageFormat(f.Url) +} + +func (f File) IsVideo() bool { + return media.IsVideoFormat(f.Url) +} + func (file File) URL(styles ...string) string { if file.Url != "" && len(styles) > 0 { ext := path.Ext(file.Url)
Add IsImage, IsVideo method for File
qor_media
train
go
73ccdb7e81692d580c21e769a829d895528e30b9
diff --git a/CanvasArray.php b/CanvasArray.php index <HASH>..<HASH> 100644 --- a/CanvasArray.php +++ b/CanvasArray.php @@ -593,6 +593,23 @@ class CanvasPageLink { public function getPerPage() { return $this->params[self::PARAM_PER_PAGE]; } + + /** + * An array representation of the CanvasArray + * + * @return array + **/ + public function getArrayCopy() { + $arr = array(); + $_key = $this->key; + $_page = $this->page; + foreach($this as $obj) { + $arr[] = $obj->getArrayCopy(); + } + $this->page = $_page; + $this->key = $_key; + return $arr; + } } /** diff --git a/CanvasObject.php b/CanvasObject.php index <HASH>..<HASH> 100644 --- a/CanvasObject.php +++ b/CanvasObject.php @@ -205,6 +205,15 @@ class CanvasObject implements ArrayAccess, Serializable { } /****************************************************************************/ + + /** + * An array representation of the CanvasObject + * + * @return array + **/ + public function getArrayCopy() { + return $this->data; + } } /**
getArrayObject() This is probably a return to the prospect of making both `CanvasObject` and `CanvasArray` extensions of `ArrayObject`. But not today.
smtech_canvaspest
train
php,php
67129f9d276e8d8351137f3b08c8a37054e826cb
diff --git a/test/test_c3d2csv.py b/test/test_c3d2csv.py index <HASH>..<HASH> 100644 --- a/test/test_c3d2csv.py +++ b/test/test_c3d2csv.py @@ -17,9 +17,7 @@ class Script_c3d2csv_Test(unittest.TestCase): ('Innovative Sports Training', ['Gait with EMG.c3d', 'Static Pose.c3d']), ('Motion Analysis Corporation', ['Sample_Jump2.c3d', 'Walk1.c3d']), ('NexGen Ergonomics', ['test1.c3d']), - ('Vicon Motion Systems', ['TableTennis.c3d']), - # Vicon files are weird, uses non-standard encodings. Walking01.c3d contain nan values and is not tested. - #('Vicon Motion Systems', ['pyCGM2 lower limb CGM24 Walking01.c3d', 'TableTennis.c3d']), + ('Vicon Motion Systems', ['pyCGM2 lower limb CGM24 Walking01.c3d', 'TableTennis.c3d']), ] def setUp(self):
Added second vicon file to csv test
EmbodiedCognition_py-c3d
train
py
725bfcc3484826083c3e6cdca71b4af41b37a9c9
diff --git a/runtests.py b/runtests.py index <HASH>..<HASH> 100755 --- a/runtests.py +++ b/runtests.py @@ -20,8 +20,9 @@ if not settings.configured: 'fluent_contents.tests.testapp', ), ROOT_URLCONF = 'fluent_contents.tests.testapp.urls', + TEST_RUNNER='django.test.simple.DjangoTestSuiteRunner', # for Django 1.6, see https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner + SITE_ID = 3, FLUENT_CONTENTS_CACHE_OUTPUT = True, - SITE_ID = 3 ) def runtests():
Make sure tests are found in Django <I>
django-fluent_django-fluent-contents
train
py
267af928df41085ef2390d686d245614bf2f6f80
diff --git a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php index <HASH>..<HASH> 100644 --- a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php @@ -143,6 +143,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase 'foo/bar' => '~2.1.0-beta2', 'bar/baz' => '1.0.x-dev as 1.2.0', 'qux/quux' => '1.0.*@rc', + 'zux/complex' => '~1.0,>=1.0.2@dev' ), 'minimum-stability' => 'alpha', )); @@ -151,6 +152,7 @@ class RootPackageLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array( 'bar/baz' => BasePackage::STABILITY_DEV, 'qux/quux' => BasePackage::STABILITY_RC, + 'zux/complex' => BasePackage::STABILITY_DEV, ), $package->getStabilityFlags()); } }
Add a failing testcase for stability flags in complex constraints Refs #<I>
mothership-ec_composer
train
php
36003ca3b3a641c101795e121c4f269095bf017b
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from astropy_helpers.setup_helpers import register_commands, get_package_info from astropy_helpers.version_helpers import generate_version_py NAME = 'astropy_helpers' -VERSION = '1.1rc2' +VERSION = '1.1.dev' RELEASE = 'dev' not in VERSION DOWNLOAD_BASE_URL = 'http://pypi.python.org/packages/source/a/astropy-helpers'
Finishing <I>rc2 release
astropy_astropy-helpers
train
py
8053fd2c8fca51604addb602f283ebea766635ee
diff --git a/pkg/engine/deployment.go b/pkg/engine/deployment.go index <HASH>..<HASH> 100644 --- a/pkg/engine/deployment.go +++ b/pkg/engine/deployment.go @@ -150,10 +150,10 @@ func newDeployment(ctx *Context, info *deploymentContext, opts deploymentOptions projinfo := &Projinfo{Proj: proj, Root: info.Update.GetRoot()} pwd, main, plugctx, err := ProjectInfoContext(projinfo, opts.Host, target, opts.Diag, opts.StatusDiag, opts.DisableProviderPreview, info.TracingSpan) - plugctx = plugctx.WithCancelChannel(ctx.Cancel.Canceled()) if err != nil { return nil, err } + plugctx = plugctx.WithCancelChannel(ctx.Cancel.Canceled()) opts.trustDependencies = proj.TrustResourceDependencies() // Now create the state source. This may issue an error if it can't create the source. This entails,
Fix error check in newDeployment (#<I>)
pulumi_pulumi
train
go
47c7dbfd3757358ae2063015a6ca2ff5884a8887
diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb index <HASH>..<HASH> 100644 --- a/lib/haml/helpers/action_view_mods.rb +++ b/lib/haml/helpers/action_view_mods.rb @@ -142,4 +142,6 @@ module ActionView end end -require "haml/helpers/rails_323_textarea_fix" if Rails.version >= "3.2.3" +if (ActionPack::VERSION::MAJOR == 3) && (ActionPack::VERSION::MINOR >= 2) && (ActionPack::VERSION::TINY >= 3) + require "haml/helpers/rails_323_textarea_fix" +end \ No newline at end of file diff --git a/test/helper_test.rb b/test/helper_test.rb index <HASH>..<HASH> 100644 --- a/test/helper_test.rb +++ b/test/helper_test.rb @@ -132,7 +132,7 @@ HTML HAML end - if Rails.version >= "3.2.3" + if (ActionPack::VERSION::MAJOR == 3) && (ActionPack::VERSION::MINOR >= 2) && (ActionPack::VERSION::TINY >= 3) def test_text_area assert_equal(%(<textarea id="body" name="body">\nFoo&#x000A;Bar&#x000A; Baz&#x000A; Boom</textarea>\n), render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view))
Fix version detection code for Rails <I>+.
haml_haml
train
rb,rb
3196a100f94c0e37b33b3b7700fb01707d8e99bd
diff --git a/pyocd/utility/hex.py b/pyocd/utility/hex.py index <HASH>..<HASH> 100644 --- a/pyocd/utility/hex.py +++ b/pyocd/utility/hex.py @@ -17,6 +17,7 @@ import sys import string import io +import six from . import conversion @@ -101,7 +102,7 @@ def dump_hex_data(data, start_address=0, width=8, output=None, print_ascii=True) break if print_ascii: - s = "" + s = "|" for n in range(start_i, start_i + line_width): if n >= len(data): break @@ -115,7 +116,7 @@ def dump_hex_data(data, start_address=0, width=8, output=None, print_ascii=True) d = conversion.u32le_list_to_byte_list([d]) d.reverse() s += "".join((chr(b) if (chr(b) in _PRINTABLE) else '.') for b in d) - output.write(" " + s) + output.write(" " + s + "|") output.write("\n") @@ -123,6 +124,6 @@ def dump_hex_data_to_str(data, **kwargs): """! @brief Returns a string with data formatted as hex. @see dump_hex_data() """ - sio = io.StringIO() + sio = six.StringIO() dump_hex_data(data, output=sio, **kwargs) return sio.getvalue()
Utility: fix hex dump on Python 2. Also adds vertical bars around the ASCII dump.
mbedmicro_pyOCD
train
py
5ed1ab496d40cdf717b1747b723767a980d8c716
diff --git a/vcs_repo_mgr/tests.py b/vcs_repo_mgr/tests.py index <HASH>..<HASH> 100644 --- a/vcs_repo_mgr/tests.py +++ b/vcs_repo_mgr/tests.py @@ -81,7 +81,7 @@ class VcsRepoMgrTestCase(unittest.TestCase): self.assertEqual(len(repo.branches), 1) self.assertTrue(main_branch in repo.branches) for rev in repo.branches.values(): - self.assertTrue(rev.branch_name) + self.assertTrue(rev.branch) self.assertTrue(rev.revision_number > 0) self.assertTrue(REVISION_ID_PATTERN.match(rev.revision_id))
Bug fix for last commit (test that revisions have a branch name)
xolox_python-vcs-repo-mgr
train
py
70cb0d463f7d39e8fe03fafeb8e50693c2bd1887
diff --git a/lib/Core/Pagination/Pagerfanta/BaseAdapter.php b/lib/Core/Pagination/Pagerfanta/BaseAdapter.php index <HASH>..<HASH> 100644 --- a/lib/Core/Pagination/Pagerfanta/BaseAdapter.php +++ b/lib/Core/Pagination/Pagerfanta/BaseAdapter.php @@ -135,7 +135,11 @@ abstract class BaseAdapter implements AdapterInterface, SearchResultExtras $this->facets = $searchResult->facets; $this->maxScore = $searchResult->maxScore; $this->nbResults = $searchResult->totalCount; - $this->suggestion = $searchResult instanceof ExtraSearchResult ? $searchResult->suggestion : new Suggestion([]); + $this->suggestion = new Suggestion([]); + + if ($searchResult instanceof ExtraSearchResult && $searchResult->suggestion instanceof Suggestion) { + $this->suggestion = $searchResult->suggestion; + } $this->isExtraInfoInitialized = true; }
[FIX] always initialize suggestion property with an empty object, and make sure that the ExtraSearchResult suggestion property actually contains Suggestion object
netgen_ezplatform-search-extra
train
php
6b480d2e8260b88474a33f1b45847e0ad8b1bc96
diff --git a/activesupport/lib/active_support/dependencies/autoload.rb b/activesupport/lib/active_support/dependencies/autoload.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/dependencies/autoload.rb +++ b/activesupport/lib/active_support/dependencies/autoload.rb @@ -9,13 +9,16 @@ module ActiveSupport @@eager_autoload = false def autoload(const_name, path = @@at_path) - full = [self.name, @@under_path, const_name.to_s, path].compact.join("::") - location = path || Inflector.underscore(full) + unless path + full = [name, @@under_path, const_name.to_s, path].compact.join("::") + path = Inflector.underscore(full) + end if @@eager_autoload - @@autoloads[const_name] = location + @@autoloads[const_name] = path end - super const_name, location + + super const_name, path end def autoload_under(path)
Improved ActiveSupport::Autoload performance. `ActiveSupport::Autoload#autoload` performance is improved in the default case where a path is present. Since the full path name is not generated, it isn't necessary to determine the full constant name either. This results in a 3x performance gain and reduces the number of Ruby objects generated. For a full benchmark check [this gist](<URL>).
rails_rails
train
rb
87534b9a6ee8bc534b66b21e8695dc7d5471d920
diff --git a/src/LAG/AdminBundle/Routing/RouteNameGenerator.php b/src/LAG/AdminBundle/Routing/RouteNameGenerator.php index <HASH>..<HASH> 100644 --- a/src/LAG/AdminBundle/Routing/RouteNameGenerator.php +++ b/src/LAG/AdminBundle/Routing/RouteNameGenerator.php @@ -7,8 +7,23 @@ use LAG\AdminBundle\Admin\Configuration\AdminConfiguration; class RouteNameGenerator { + /** + * Generate an admin route name using the pattern in the configuration. + * + * @param string $actionName + * @param string $adminName + * @param AdminConfiguration $configuration + * + * @return string + * + * @throws Exception + */ public function generate($actionName, $adminName, AdminConfiguration $configuration) { + if (!$configuration->isResolved()) { + throw new Exception('The configuration should be resolved before using it'); + } + if (!array_key_exists($actionName, $configuration->getParameter('actions'))) { throw new Exception( sprintf('Invalid action name %s for admin %s (available action are: %s)',
add a test for the configuration resolving in the RouteNameGenerator
larriereguichet_AdminBundle
train
php
5d13244c8cf898f503c37e9613d823b798c859dc
diff --git a/lib/drawille/flipbook.rb b/lib/drawille/flipbook.rb index <HASH>..<HASH> 100644 --- a/lib/drawille/flipbook.rb +++ b/lib/drawille/flipbook.rb @@ -21,7 +21,7 @@ module Drawille end def each_frame options={} - return enum_for(:each_frame) unless block_given? + return enum_for(__callee__) unless block_given? @snapshots.each do |frame| yield frame end diff --git a/lib/drawille/frameable.rb b/lib/drawille/frameable.rb index <HASH>..<HASH> 100644 --- a/lib/drawille/frameable.rb +++ b/lib/drawille/frameable.rb @@ -1,6 +1,5 @@ # -*- encoding: utf-8 -*- -require 'pry' module Drawille module Frameable
Removed pry require && improved enum_for statement
maerch_ruby-drawille
train
rb,rb
3e911135412906e168b91c8f4ca800f18b12922f
diff --git a/bundles/BlockManagerBundle/Controller/API/V1/LayoutController.php b/bundles/BlockManagerBundle/Controller/API/V1/LayoutController.php index <HASH>..<HASH> 100644 --- a/bundles/BlockManagerBundle/Controller/API/V1/LayoutController.php +++ b/bundles/BlockManagerBundle/Controller/API/V1/LayoutController.php @@ -309,13 +309,9 @@ class LayoutController extends Controller protected function loadLayout($layoutId, $loadDraft = true) { if ($loadDraft) { - try { - return $this->layoutService->loadLayoutDraft( - $layoutId - ); - } catch (NotFoundException $e) { - // Do nothing - } + return $this->layoutService->loadLayoutDraft( + $layoutId + ); } return $this->layoutService->loadLayout(
Throw exception in API layouts controller if draft does not exist
netgen-layouts_layouts-core
train
php
1caf8366faefdbc031cf8da6e0821b364caefcdc
diff --git a/codecov/__init__.py b/codecov/__init__.py index <HASH>..<HASH> 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -1044,10 +1044,7 @@ def main(*argv, **kwargs): s3 = requests.put( upload_url, data=reports, - headers={ - "Content-Type": "text/plain", - "x-amz-acl": "public-read", - }, + headers={"Content-Type": "text/plain",}, ) s3.raise_for_status() assert s3.status_code == 200
Removing extra url header Now that we have pre-signed puts, we don't need to use presigned headers. In fact, since they are added post-signing, the system is not responding well to them
codecov_codecov-python
train
py
fea60bfe5123a08e8959a225af6939c277cf369a
diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -92,6 +92,8 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::singularize('faxes'), 'fax'); $this->assertEquals(Inflector::singularize('waxes'), 'wax'); $this->assertEquals(Inflector::singularize('niches'), 'niche'); + $this->assertEquals(Inflector::singularize('caves'), 'cave'); + $this->assertEquals(Inflector::singularize('graves'), 'grave'); $this->assertEquals(Inflector::singularize('waves'), 'wave'); $this->assertEquals(Inflector::singularize('bureaus'), 'bureau'); $this->assertEquals(Inflector::singularize('genetic_analyses'), 'genetic_analysis');
Update InflectorTest.php Added test cases for changes to inflector which affected words ending -aves. Author acknowledges the homonym conflict with 'leaves' and 'leaves', but preferences the word whose singular avoids an exception to the inflection rule.
cakephp_cakephp
train
php
7b4741fa4bee7876333302a659b485483284b280
diff --git a/portmidi.go b/portmidi.go index <HASH>..<HASH> 100644 --- a/portmidi.go +++ b/portmidi.go @@ -26,6 +26,7 @@ import ( ) var ( + ErrUnknown = errors.New("portmidi: unknown error") ErrNoData = errors.New("portmidi: no data") ErrHost = errors.New("portmidi: host error") ErrInvalidDeviceId = errors.New("portmidi: invalid device id") @@ -111,5 +112,9 @@ func Time() Timestamp { } func convertToError(code C.PmError) error { - return errorMap[int(code)] + err, ok := errorMap[int(code)] + if !ok && code != 0 { + return ErrUnknown + } + return err }
Don't ignore non-zero error codes those are not on the conversion map.
rakyll_portmidi
train
go
2a772988f15b3b597dea5ed68a199bfd75adfbca
diff --git a/torchfcn/trainer.py b/torchfcn/trainer.py index <HASH>..<HASH> 100644 --- a/torchfcn/trainer.py +++ b/torchfcn/trainer.py @@ -20,9 +20,9 @@ def cross_entropy2d(input, target, weight=None, size_average=True): # input: (n, c, h, w), target: (n, h, w) n, c, h, w = input.size() # log_p: (n, c, h, w) - log_p = F.log_softmax(input) + log_p = F.log_softmax(input, dim=1) # log_p: (n*h*w, c) - log_p = log_p.transpose(1, 2).transpose(2, 3).contiguous().view(-1, c) + log_p = log_p.transpose(1, 2).transpose(2, 3).contiguous() log_p = log_p[target.view(n, h, w, 1).repeat(1, 1, 1, c) >= 0] log_p = log_p.view(-1, c) # target: (n*h*w,)
Update for PyTorch >= <I>
wkentaro_pytorch-fcn
train
py
c4ac10f5b4f4c007d71e45bc935d928deecd9e64
diff --git a/lib/virtualbox/vm.rb b/lib/virtualbox/vm.rb index <HASH>..<HASH> 100644 --- a/lib/virtualbox/vm.rb +++ b/lib/virtualbox/vm.rb @@ -42,7 +42,7 @@ module VirtualBox # attribute :uuid, :readonly => true # attribute :name # attribute :ostype - # attribute :description + # attribute :description, :readonly => true # attribute :memory # attribute :vram # attribute :acpi @@ -89,7 +89,7 @@ module VirtualBox attribute :uuid, :readonly => true attribute :name attribute :ostype - attribute :description + attribute :description, :readonly => true attribute :memory attribute :vram attribute :acpi
VM Description should be read only as it cannot be changed via vboxmanage
mitchellh_virtualbox
train
rb
08dc16779d3fd829583fa3baed5abdd571be2273
diff --git a/req.go b/req.go index <HASH>..<HASH> 100644 --- a/req.go +++ b/req.go @@ -241,6 +241,15 @@ func (r *Request) Url(url string) *Request { return r } +// Host set the request's Host. +func (r *Request) Host(host string) *Request { + if r == nil || r.req == nil { + return nil + } + r.req.Host = host + return r +} + // ReceiveResponse execute the request and get the response body as *Response, // err is not nil if error happens during the reqeust been executed. func (r *Request) ReceiveResponse() (resp *Response, err error) {
req.Request add Host method set the dest Host for http.Request internally.
imroc_req
train
go
be386c0709972c344457f6f9c8195ac237dd3b98
diff --git a/lib/traco/locale_fallbacks.rb b/lib/traco/locale_fallbacks.rb index <HASH>..<HASH> 100644 --- a/lib/traco/locale_fallbacks.rb +++ b/lib/traco/locale_fallbacks.rb @@ -17,23 +17,17 @@ module Traco @available_locales = I18n.available_locales.sort end - def [](for_locale) - chain = [for_locale] - chain << @default_locale if include_default_locale? - chain |= @available_locales if include_available_locales? - chain + def [](current_locale) + case fallback_option + when DEFAULT_FALLBACK then [ current_locale, @default_locale ] + when ANY_FALLBACK then [ current_locale, @default_locale, *@available_locales ].uniq + when NO_FALLBACK then [ current_locale ] + else raise "Unknown fallback." # Should never get here. + end end private - def include_default_locale? - [ DEFAULT_FALLBACK, ANY_FALLBACK ].include?(fallback_option) - end - - def include_available_locales? - ANY_FALLBACK == fallback_option - end - def validate_option(fallback_option) if OPTIONS.include?(fallback_option) fallback_option
Simplify LocaleFallbacks
barsoom_traco
train
rb
8ded4e7d82c3c8ca8a3bf22869a46f66296d2182
diff --git a/lib/default_config.js b/lib/default_config.js index <HASH>..<HASH> 100644 --- a/lib/default_config.js +++ b/lib/default_config.js @@ -12,6 +12,7 @@ module.exports = { }, publishers: { "s3": "./publishers/s3", + "sftp": "./publishers/sftp", }, server: { port: 9009, diff --git a/lib/publishers/sftp.js b/lib/publishers/sftp.js index <HASH>..<HASH> 100644 --- a/lib/publishers/sftp.js +++ b/lib/publishers/sftp.js @@ -20,6 +20,11 @@ module.exports = { }, connectToRemote: function(supplied_config){ + // correct the private key + if(_.has(supplied_config, "private_key")){ + supplied_config["privateKey"] = supplied_config["private_key"]; + } + return new Sftp(supplied_config, function(error){ if(error) throw error;
added sftp as a default publisher + normalize the options passed to node-sftp
laktek_punch
train
js,js
ba100805670100f125ea233cfdd01c594044eeb1
diff --git a/time_heap.js b/time_heap.js index <HASH>..<HASH> 100644 --- a/time_heap.js +++ b/time_heap.js @@ -248,7 +248,7 @@ TimeHeap.prototype.pop = function pop() { TimeHeap.prototype.siftdown = function siftdown(i) { var self = this; - while (true) { + for (;;) { var left = (2 * i) + 1; var right = left + 1; if (left < self.end &&
linting: [time_heap] comply with no-constant-condition rule
uber_tchannel-node
train
js
c036123176c354a9930585fc24b00715a1e0d97e
diff --git a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/impl/OTransactionPhase1TaskTest.java b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/impl/OTransactionPhase1TaskTest.java index <HASH>..<HASH> 100755 --- a/distributed/src/test/java/com/orientechnologies/orient/server/distributed/impl/OTransactionPhase1TaskTest.java +++ b/distributed/src/test/java/com/orientechnologies/orient/server/distributed/impl/OTransactionPhase1TaskTest.java @@ -76,6 +76,7 @@ public class OTransactionPhase1TaskTest { ODocument rec2 = new ODocument("TestClass"); rec2.field("one", "three"); + ((ODatabaseDocumentInternal) session).assignAndCheckCluster(rec2, null); operations.add(new ORecordOperation(rec1, ORecordOperation.UPDATED)); operations.add(new ORecordOperation(id1.getIdentity(), ORecordOperation.DELETED));
Cluster operations are encapsulated inside of storage. Distributed tests failures were fixed.
orientechnologies_orientdb
train
java
9af79feaf12910e28973e6365da0fe306a7eb15a
diff --git a/src/Linfo/OS/Linux.php b/src/Linfo/OS/Linux.php index <HASH>..<HASH> 100644 --- a/src/Linfo/OS/Linux.php +++ b/src/Linfo/OS/Linux.php @@ -377,7 +377,7 @@ class Linux extends Unixcommon // Get partitions $partitions = []; $partitions_contents = Common::getContents('/proc/partitions'); - if (@preg_match_all('/(\d+)\s+([a-z]{3})(\d+)$/m', $partitions_contents, $partitions_match, PREG_SET_ORDER) > 0) { + if (@preg_match_all('/(\d+)\s+([a-z]{3}|nvme\d+n\d+)(p?\d+)$/m', $partitions_contents, $partitions_match, PREG_SET_ORDER) > 0) { // Go through each match foreach ($partitions_match as $partition) { $partitions[$partition[2]][] = array(
Detect nvme partitions on linux
jrgp_linfo
train
php
523ba9b01d63671e96298a4b14470c63e3e4fee2
diff --git a/lib/SAML2/XML/md/Extensions.php b/lib/SAML2/XML/md/Extensions.php index <HASH>..<HASH> 100644 --- a/lib/SAML2/XML/md/Extensions.php +++ b/lib/SAML2/XML/md/Extensions.php @@ -22,7 +22,7 @@ class SAML2_XML_md_Extensions { $ret[] = new SAML2_XML_shibmd_Scope($node); } elseif ($node->namespaceURI === SAML2_XML_mdattr_EntityAttributes::NS && $node->localName === 'EntityAttributes') { $ret[] = new SAML2_XML_mdattr_EntityAttributes($node); - } elseif ($node->namespaceURL === SAML2_XML_mdrpi_Common::NS_MDRPI && $node->localName === 'PublicationInfo') { + } elseif ($node->namespaceURI === SAML2_XML_mdrpi_Common::NS_MDRPI && $node->localName === 'PublicationInfo') { $ret[] = new SAML2_XML_mdrpi_PublicationInfo($node); } else { $ret[] = new SAML2_XML_Chunk($node);
SAML2_XML_md_Extensions: Fix namespaceURL => namespaceURI. Thanks to Georg Gollmann for reporting this bug.
simplesamlphp_saml2
train
php
dffe2d82614d7f9f773ce4183019e913ff41719f
diff --git a/aeron-driver/src/main/java/io/aeron/driver/media/DataTransportPoller.java b/aeron-driver/src/main/java/io/aeron/driver/media/DataTransportPoller.java index <HASH>..<HASH> 100644 --- a/aeron-driver/src/main/java/io/aeron/driver/media/DataTransportPoller.java +++ b/aeron-driver/src/main/java/io/aeron/driver/media/DataTransportPoller.java @@ -61,7 +61,7 @@ public class DataTransportPoller extends UdpTransportPoller for (final ChannelAndTransport channelEndpoint : channelAndTransports) { final ReceiveChannelEndpoint receiveChannelEndpoint = channelEndpoint.channelEndpoint; - CloseHelper.close(errorHandler, () -> receiveChannelEndpoint.closeMultiRcvDestination(poller)); + receiveChannelEndpoint.closeMultiRcvDestination(poller); CloseHelper.close(errorHandler, receiveChannelEndpoint); }
[Java] Avoid lambda allocation when closing DataTransportPoller when they are not necessary.
real-logic_aeron
train
java
77105aeccfd9d6b923ca80f8ba4bca4aff9d286b
diff --git a/lib/schema/iblockschema.php b/lib/schema/iblockschema.php index <HASH>..<HASH> 100644 --- a/lib/schema/iblockschema.php +++ b/lib/schema/iblockschema.php @@ -150,7 +150,9 @@ class IblockSchema extends AbstractSchema $iblockUid = $this->getUniqIblock($schemaIblock['iblock']); $this->addToQueue('saveProperties', $iblockUid, $schemaIblock['props']); $this->addToQueue('saveElementForm', $iblockUid, $schemaIblock['element_form']); - $this->addToQueue('saveSectionForm', $iblockUid, $schemaIblock['section_form']); + if (isset($schemaIblock['section_form'])) { + $this->addToQueue('saveSectionForm', $iblockUid, $schemaIblock['section_form']); + } } foreach ($schemaIblocks as $schemaIblock) {
fix: add a check for exists section_form field
andreyryabin_sprint.migration
train
php
15479b3baea8d0f5cb58bf7d22321646ac4513bc
diff --git a/spacy/lang/nl/lex_attrs.py b/spacy/lang/nl/lex_attrs.py index <HASH>..<HASH> 100644 --- a/spacy/lang/nl/lex_attrs.py +++ b/spacy/lang/nl/lex_attrs.py @@ -19,6 +19,10 @@ miljardste biljoenste biljardste triljoenste triljardste def like_num(text): + # This only does the most basic check for whether a token is a digit + # or matches one of the number words. In order to handle numbers like + # "drieëntwintig", more work is required. + # See this discussion: https://github.com/explosion/spaCy/pull/1177 text = text.replace(',', '').replace('.', '') if text.isdigit(): return True
Add comment to like_num re: future work
explosion_spaCy
train
py
858e5d9f5fb9d9fd4f3ff82b399a0db2b4778fe6
diff --git a/owncloud/owncloud.py b/owncloud/owncloud.py index <HASH>..<HASH> 100644 --- a/owncloud/owncloud.py +++ b/owncloud/owncloud.py @@ -509,7 +509,7 @@ class Client(): if isinstance(password, basestring): data['password'] = password if ((public_upload is not None) and (isinstance(public_upload, bool))): - data['publicUpload'] = public_upload + data['publicUpload'] = str(public_upload).lower() res = self.__make_ocs_request( 'PUT',
Small fix @ update_share() to make it work with >= OC6
owncloud_pyocclient
train
py
f6f5d9e04bea16206c1dc8058e38c6e56c62e601
diff --git a/tests/Sabre/CalDAV/ValidateICalTest.php b/tests/Sabre/CalDAV/ValidateICalTest.php index <HASH>..<HASH> 100644 --- a/tests/Sabre/CalDAV/ValidateICalTest.php +++ b/tests/Sabre/CalDAV/ValidateICalTest.php @@ -22,6 +22,7 @@ class Sabre_CalDAV_ValidateICalTest extends PHPUnit_Framework_TestCase { 'id' => 'calendar1', 'principaluri' => 'principals/admin', 'uri' => 'calendar1', + '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet( array('VEVENT','VTODO','VJOURNAL') ), ) );
fixing unit test to work with component type verification
sabre-io_dav
train
php
cfb84b3f6b9e38f1fbf700df7d07dedfc615808a
diff --git a/tmux/testsuite/builder.py b/tmux/testsuite/builder.py index <HASH>..<HASH> 100644 --- a/tmux/testsuite/builder.py +++ b/tmux/testsuite/builder.py @@ -63,6 +63,7 @@ class BuilderTest(TestTmux): else: p = w.attached_pane() if isinstance(pconf['shell_command'], basestring): + # not being used at this point pconf['shell_command'] = [pconf['shell_command']] for cmd in pconf['shell_command']: p.send_keys(cmd) diff --git a/tmux/testsuite/config.py b/tmux/testsuite/config.py index <HASH>..<HASH> 100644 --- a/tmux/testsuite/config.py +++ b/tmux/testsuite/config.py @@ -30,7 +30,7 @@ sampleconfigdict = { { 'automatic_rename': True, 'panes': [ - {'shell_command': 'htop'} + {'shell_command': ['htop']} ] }] }
run shell commands via config. don't split first pane unless necessary
tmux-python_tmuxp
train
py,py
39c3648a2e9de3260dd865c051c57f56fd0a8a91
diff --git a/lib/Loop/Loop.php b/lib/Loop/Loop.php index <HASH>..<HASH> 100644 --- a/lib/Loop/Loop.php +++ b/lib/Loop/Loop.php @@ -302,7 +302,7 @@ class Loop { $read = $this->readStreams; $write = $this->writeStreams; $except = null; - if (stream_select($read, $write, $except, $timeout ? 0 : null, $timeout ? $timeout : 0)) { + if (stream_select($read, $write, $except, ($timeout === null) ? null : 0, $timeout ? $timeout * 1000000 : 0)) { // See PHP Bug https://bugs.php.net/bug.php?id=62452 // Fixed in PHP7
Fixed stream_select timeout calculation
sabre-io_event
train
php
ebb85a0d86ca430227cb128c5c18d1ea4d1286d9
diff --git a/test/tests.es6.js b/test/tests.es6.js index <HASH>..<HASH> 100644 --- a/test/tests.es6.js +++ b/test/tests.es6.js @@ -268,3 +268,19 @@ describe("object literal generator", function() { check(gen(4, 2), [4, 2, { a: 3, b: 2 }]); }); }); + +describe("switch statement generator", function() { + function *gen(a) { + switch (yield a) { + case (yield "x") - a: + return "first case"; + case (yield "y") - a: + return "second case"; + } + } + + it("should jump to the correct cases", function() { + check(gen(1), [1, "x"], "first case"); + check(gen(2), [2, "x", "y"], "second case"); + }); +});
Test yielding from switch statement discriminants and case expressions.
facebook_regenerator
train
js
57daed73435d19fb52ff9437dd37054b6237b291
diff --git a/pixiedust/display/chart/renderers/matplotlib/matplotlibBaseDisplay.py b/pixiedust/display/chart/renderers/matplotlib/matplotlibBaseDisplay.py index <HASH>..<HASH> 100644 --- a/pixiedust/display/chart/renderers/matplotlib/matplotlibBaseDisplay.py +++ b/pixiedust/display/chart/renderers/matplotlib/matplotlibBaseDisplay.py @@ -24,6 +24,7 @@ from six import with_metaclass from abc import abstractmethod, ABCMeta import numpy as np import math +import matplotlib.ticker as ticker try: import mpld3 @@ -82,6 +83,12 @@ class MatplotlibBaseDisplay(with_metaclass(ABCMeta, BaseChartDisplay)): return options def setTicks(self, fig, ax): + if self.getBooleanOption("logy",False): + start, end = ax.get_ylim() + ax.yaxis.set_minor_locator(ticker.MultipleLocator((end - start) / 4)) + ax.yaxis.set_minor_formatter(ticker.LogFormatter(labelOnlyBase=False)) + ax.grid(True, which='both') + labels = [s.get_text() for s in ax.get_xticklabels()] totalWidth = sum(len(s) for s in labels) * 5 if totalWidth > self.getPreferredOutputWidth():
enable minor gridlines and ticks for log scale
pixiedust_pixiedust
train
py
4615cdfbf339482e659fef4d9d6deb58f17ee2ab
diff --git a/lib/nei/mobile.oc.pbx.js b/lib/nei/mobile.oc.pbx.js index <HASH>..<HASH> 100644 --- a/lib/nei/mobile.oc.pbx.js +++ b/lib/nei/mobile.oc.pbx.js @@ -96,6 +96,12 @@ exports.update = function (projectName, projectPath, updateResPath) { function createPBXGroupByFullPath(path) { var groupPaths = path.split('/'); + groupPaths = groupPaths.map((groupPath) => { + if (groupPath.indexOf(' ') !== -1) { + return `"${groupPath}"`; + } + return groupPath; + }); var group; var groupKey; var groupItem; @@ -219,8 +225,8 @@ exports.update = function (projectName, projectPath, updateResPath) { // 可以指定更新哪个文件夹,如果不指定,则更新项目根路径 if (updateResPath) { // 只更新 models 和 requests - walk(updateResPath + 'Models/') - walk(updateResPath + 'Requests/') + walk(updateResPath + 'Models/'); + walk(updateResPath + 'Requests/'); } else { walk(projectPath); }
:bug: pbx path has space bug
NEYouFan_nei-toolkit
train
js
d463b24f157dcb126c9e47bd7da18f6f25115e97
diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/core_ext/object/blank.rb +++ b/activesupport/lib/active_support/core_ext/object/blank.rb @@ -2,11 +2,11 @@ class Object # An object is blank if it's false, empty, or a whitespace string. - # For example, '', ' ', +nil+, [], and {} are all blank. + # For example, +false+, '', ' ', +nil+, [], and {} are all blank. # # This simplifies # - # address.nil? || address.empty? + # !address || address.empty? # # to #
docs, make `blank?` behavior clear. Closes #<I>. [ci skip]
rails_rails
train
rb
f80a493184738d4907060440166f40cc30106389
diff --git a/Minimal-J/src/main/java/org/minimalj/util/resources/Resources.java b/Minimal-J/src/main/java/org/minimalj/util/resources/Resources.java index <HASH>..<HASH> 100644 --- a/Minimal-J/src/main/java/org/minimalj/util/resources/Resources.java +++ b/Minimal-J/src/main/java/org/minimalj/util/resources/Resources.java @@ -23,10 +23,10 @@ public class Resources { public static final boolean OPTIONAL = false; - public static String APPLICATION_TITLE = "Application.title"; - public static String APPLICATION_VENDOR = "Application.vendor"; - public static String APPLICATION_HOMEPAGE = "Application.homepage"; - public static String APPLICATION_VERSION = "Application.version"; + public static final String APPLICATION_TITLE = "Application.title"; + public static final String APPLICATION_VENDOR = "Application.vendor"; + public static final String APPLICATION_HOMEPAGE = "Application.homepage"; + public static final String APPLICATION_VERSION = "Application.version"; public static ResourceBundle getResourceBundle() { return resourceBundle;
Resources: added missing final keyword for constants
BrunoEberhard_minimal-j
train
java
7c02a4f0fdc9372c9019e8281d62a7d4cee1acfe
diff --git a/src/FormBuilder.php b/src/FormBuilder.php index <HASH>..<HASH> 100755 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -624,7 +624,7 @@ class FormBuilder { { $selected = $this->getSelectedValue($value, $selected); - $options = ['value' => e($value), 'selected' => $selected]; + $options = ['value' => $value, 'selected' => $selected]; return '<option' . $this->html->attributes($options) . '>' . e($display) . '</option>'; }
Don't double escape in Form::option() html->attributes() already does the escaping.
LaravelCollective_html
train
php
df84cc445f633882a786541979024d7c0ddf8824
diff --git a/assertions/accessibility.js b/assertions/accessibility.js index <HASH>..<HASH> 100644 --- a/assertions/accessibility.js +++ b/assertions/accessibility.js @@ -1,9 +1,11 @@ const script = function (context, options, done) { if (!window.axe) done({ error: 'aXe not found. Make sure it has been injected' }) - window.axe.run(context, options, function (err, results) { - done(err ? { error: err.toString() } : { results: results }) - }) + window + .axe + .run(context, options) + .then((results) => done({ results })) + .catch((error) => done({ error: error.toString() })) } module.exports.assertion = function (context, options, callback) { @@ -34,7 +36,7 @@ module.exports.assertion = function (context, options, callback) { } for (const violation of result.violations) { - this.assert.fail(`${violation.help}`) + this.assert.fail(`${violation.help} [${violation.nodes[0].html}]`) } const success = result.violations.length === 0
feat(violations): display first html element in violations on error
ahmadnassri_nightwatch-accessibility
train
js
110a8a14a0176d98c3d7fd2c11a883f770b4dbbd
diff --git a/models/classes/requiredAction/implementation/TimeRule.php b/models/classes/requiredAction/implementation/TimeRule.php index <HASH>..<HASH> 100644 --- a/models/classes/requiredAction/implementation/TimeRule.php +++ b/models/classes/requiredAction/implementation/TimeRule.php @@ -109,19 +109,11 @@ class TimeRule implements RequiredActionRuleInterface public function __toPhpCode() { $class = get_class($this); - $executionTime = $this->getExecutionTime(); - if ($executionTime === null) { - $serializedExecutionTime = 'null'; - } else { - $serializedExecutionTime = 'new \DateTime(' . $executionTime->getTimestamp() . ')'; - } - $interval = $this->getInterval(); $serializedInterval = 'new \DateInterval("' . $interval->format('P%yY%mM%dDT%hH%iM%sS') . '")'; return "new $class( - $serializedInterval, - $serializedExecutionTime + $serializedInterval )"; }
Prevent config serialisation of execution time
oat-sa_tao-core
train
php
810ad61db83c4687149fa66b5d25aa4b4aaea077
diff --git a/lib/plucky/query.rb b/lib/plucky/query.rb index <HASH>..<HASH> 100644 --- a/lib/plucky/query.rb +++ b/lib/plucky/query.rb @@ -109,14 +109,14 @@ module Plucky def fields(*args) clone.tap { |query| query.options[:fields] = *args } end - + def ignore(*args) - set_fields(args,0) + set_fields(args, 0) end - + def only(*args) - set_fields(args,1) - end + set_fields(args, 1) + end def limit(count=nil) clone.tap { |query| query.options[:limit] = count } @@ -124,7 +124,7 @@ module Plucky def reverse clone.tap do |query| - query[:sort].map! do |s| + query[:sort] = query[:sort].map do |s| [s[0], -s[1]] end unless query.options[:sort].nil? end @@ -197,14 +197,12 @@ module Plucky end.sort.join(",") "#<#{self.class}#{as_nice_string}>" end - - private - + + private def set_fields(field_list, value) the_fields = {} field_list.each {|field| the_fields[field.to_sym] = value} clone.tap { |query| query.options[:fields] = the_fields} end - end end \ No newline at end of file
Whitespace. Formatting. Non-destructive :sort.
mongomapper_plucky
train
rb
c8ef082bbd6b0c086f3091b6d9c5091b2e1de0ca
diff --git a/lib/jss/api_object/osx_configuration_profile.rb b/lib/jss/api_object/osx_configuration_profile.rb index <HASH>..<HASH> 100644 --- a/lib/jss/api_object/osx_configuration_profile.rb +++ b/lib/jss/api_object/osx_configuration_profile.rb @@ -59,20 +59,9 @@ module JSS ### Class Variables ##################################### - @@all_osx_configuration_profiles = nil - ##################################### ### Class Methods ##################################### - def self.all(refresh = false) - @@all_osx_configuration_profiles = nil if refresh - return @@all_osx_configuration_profiles if @@all_osx_configuration_profiles - @@all_osx_configuration_profiles = JSS::API.get_rsrc(self::RSRC_BASE)[self::RSRC_LIST_KEY] - end - - def self.xml_list(array, content = :name) - JSS.item_list_to_rexml_list self::RSRC_LIST_KEY, self::RSRC_OBJECT_KEY, array, content - end ##################################### ### Class Constants
maybe we don't need to write a custom piece
PixarAnimationStudios_ruby-jss
train
rb
906d71bcdd79ed692922fb9f10eee4805bcbb947
diff --git a/bin/eslint-mocha.js b/bin/eslint-mocha.js index <HASH>..<HASH> 100644 --- a/bin/eslint-mocha.js +++ b/bin/eslint-mocha.js @@ -19,7 +19,6 @@ var argv = yargs function parseArgs(option) { var args = argv[option]; - args = words(args, /[^ ]+/g); yargs.reset();
yargs update means no string splitting
kellyselden_eslint-mocha
train
js
eb1aac1c0e8fe3b92041360973d808a4113adee1
diff --git a/features/step_definitions/rails_steps.rb b/features/step_definitions/rails_steps.rb index <HASH>..<HASH> 100644 --- a/features/step_definitions/rails_steps.rb +++ b/features/step_definitions/rails_steps.rb @@ -16,7 +16,7 @@ end When 'I generate a new rails application' do steps %{ - When I run `bundle exec rails new #{APP_NAME}` + When I run `bundle exec rails new #{APP_NAME} --skip-bundle` And I cd to "#{APP_NAME}" And I comment out the gem "turn" from the Gemfile And I comment out the gem "coffee-rails" from the Gemfile
Don't double install gems to speed up Cucumber tests a bit
thoughtbot_shoulda-matchers
train
rb
146e75be3ee0c49d24c94e171dcdac625c2d4979
diff --git a/dvc/analytics.py b/dvc/analytics.py index <HASH>..<HASH> 100644 --- a/dvc/analytics.py +++ b/dvc/analytics.py @@ -127,7 +127,8 @@ def _system_info(): "linux_distro_version": distro.version(), } - return {"os": system.lower()} + # We don't collect data for any other system. + raise NotImplementedError def _find_or_create_user_id():
analytics: raise error when collecting a not supported os
iterative_dvc
train
py
a73d3eae9894781d3eb5e5d42841b3a6aa714565
diff --git a/lib/solargraph/library.rb b/lib/solargraph/library.rb index <HASH>..<HASH> 100644 --- a/lib/solargraph/library.rb +++ b/lib/solargraph/library.rb @@ -150,7 +150,7 @@ module Solargraph result = [] # @param pin [Solargraph::Pin::Base] pins.uniq.each do |pin| - if pin.kind == Solargraph::Pin::METHOD and !pin.location.nil? + if pin.kind != Solargraph::Pin::NAMESPACE and !pin.location.nil? mn_loc = get_symbol_name_location(pin) result.push mn_loc unless mn_loc.nil? end
Library#references_from finds constant references.
castwide_solargraph
train
rb
84e8bc49152ebb8fb2aa1c099ae0802521460db1
diff --git a/version.php b/version.php index <HASH>..<HASH> 100644 --- a/version.php +++ b/version.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2020060500.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2020060500.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. -$release = '3.9dev+ (Build: 20200602)'; // Human-friendly version name +$release = '3.9dev+ (Build: 20200605)'; // Human-friendly version name $branch = '39'; // This version's branch. $maturity = MATURITY_ALPHA; // This version's maturity level.
weekly release <I>dev+
moodle_moodle
train
php
683df716f3261121af4f8e3e03cc1ce70782ac30
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -37,15 +37,16 @@ module ActiveRecord::Associations::Builder def self.create_builder(model, name, scope, options, &block) raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol) + new(model, name, scope, options, &block) + end + + def initialize(model, name, scope, options) + # TODO: Move this to create_builder as soon we drop support to activerecord-deprecated_finders. if scope.is_a?(Hash) options = scope scope = nil end - new(model, name, scope, options, &block) - end - - def initialize(model, name, scope, options) # TODO: Remove this model argument as soon we drop support to activerecord-deprecated_finders. @name = name @scope = scope
Move the parameter normalization to the initialize method activerecord-deprecated_finders expects the parameters denormalized in its initialize method
rails_rails
train
rb
9580fe41a73e2234fbfd55695813a10f4d334158
diff --git a/molmod/log.py b/molmod/log.py index <HASH>..<HASH> 100644 --- a/molmod/log.py +++ b/molmod/log.py @@ -327,6 +327,12 @@ class ScreenLog(object): self.unitsys.log_info() def print_header(self): + # Suppress any logging as soon as an exception is not caught. + def excepthook_wrapper(type, value, traceback): + self.set_level(self.silent) + sys.__excepthook__(type, value, traceback) + sys.excepthook = excepthook_wrapper + if self.do_warning and not self._active: self._active = True print >> self._file, self.head_banner
Stop logging after uncaught exception
molmod_molmod
train
py
64a86e632e40f76027fc8a3a90b9cf271da2cbb3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ from setuptools import setup, find_packages setup( name='virtualchain', - version='0.0.5', + version='0.0.6', url='https://github.com/blockstack/virtualchain', license='GPLv3', author='Blockstack.org', @@ -37,7 +37,7 @@ setup( zip_safe=False, include_package_data=True, install_requires=[ - 'pybitcoin>=0.9.3', + 'pybitcoin>=0.9.7', 'Twisted>=15.3.0', 'txJSON-RPC>=0.3.1' ],
bumped up version, require pybitcoin <I>
blockstack_virtualchain
train
py
c5b03f0d49881caa06f8425fab2a73bcd01bc119
diff --git a/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/AbstractRuntimeManager.java b/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/AbstractRuntimeManager.java index <HASH>..<HASH> 100644 --- a/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/AbstractRuntimeManager.java +++ b/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/AbstractRuntimeManager.java @@ -125,6 +125,7 @@ public abstract class AbstractRuntimeManager implements InternalRuntimeManager { } this.executionErrorManager = new ExecutionErrorManagerImpl(storage); ((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().set(EnvironmentName.EXEC_ERROR_MANAGER, executionErrorManager); + logger.info("{} is created for {}", this.getClass().getSimpleName(), identifier); } private void internalSetDeploymentDescriptor() {
RuntimeManager creation log (#<I>)
kiegroup_jbpm
train
java
d16691e3ad520675752ff319be054e688c50c475
diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -462,13 +462,13 @@ func (srv *Server) ImagesSearch(job *engine.Job) engine.Status { job.Errorf("Usage: %s TERM", job.Name) return engine.StatusErr } - var ( - term = job.Args[0] - metaHeaders = map[string][]string{} - authConfig = &auth.AuthConfig{} - ) - job.GetenvJson("authConfig", authConfig) - job.GetenvJson("metaHeaders", metaHeaders) + var ( + term = job.Args[0] + metaHeaders = map[string][]string{} + authConfig = &auth.AuthConfig{} + ) + job.GetenvJson("authConfig", authConfig) + job.GetenvJson("metaHeaders", metaHeaders) r, err := registry.NewRegistry(authConfig, srv.HTTPRequestFactory(metaHeaders), auth.IndexServerAddress()) if err != nil {
- Ajusted server.go with gofmt Docker-DCO-<I>-
moby_moby
train
go
4a3bda9052a73956b70d12d01115283916ecf846
diff --git a/src/js/SliderHandler.js b/src/js/SliderHandler.js index <HASH>..<HASH> 100644 --- a/src/js/SliderHandler.js +++ b/src/js/SliderHandler.js @@ -58,10 +58,10 @@ class SliderHandler { // Adjust the color if (slider.callLeft) { - color[slider.callLeft].call(color, left / slider.maxLeft); + color[slider.callLeft](left / slider.maxLeft); } if (slider.callTop) { - color[slider.callTop].call(color, top / slider.maxTop); + color[slider.callTop](top / slider.maxTop); } // Set the new color
fix: unnecessary .call() (#<I>)
farbelous_bootstrap-colorpicker
train
js
ba382c475b9724e9d6d89e9a692536efdf54e717
diff --git a/src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php b/src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php index <HASH>..<HASH> 100644 --- a/src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php +++ b/src/Brouwers/Shortcodes/Compilers/ShortcodeCompiler.php @@ -117,13 +117,14 @@ class ShortcodeCompiler { { // Compile the shortcode $compiled = $this->compileShortcode($matches); + $name = $compiled->getName(); // Render the shortcode through the callback - return call_user_func_array($this->getCallback(), array( + return call_user_func_array($this->getCallback($name), array( $compiled, $compiled->getContent(), $this, - $compiled->getName() + $name )); } @@ -180,10 +181,10 @@ class ShortcodeCompiler { * @param string $name * @return callable|array */ - public function getCallback() + public function getCallback($name) { // Get the callback from the shortcodes array - $callback = $this->registered[$this->getName()]; + $callback = $this->registered[$name]; // if is a string if(is_string($callback))
Use compiled shortcode name for callback
patrickbrouwers_Laravel-Shortcodes
train
php
2ffec0d4d32ba946b5fa9a76bad4b974fcae98a4
diff --git a/CartComponent.php b/CartComponent.php index <HASH>..<HASH> 100755 --- a/CartComponent.php +++ b/CartComponent.php @@ -261,12 +261,15 @@ class CartComponent extends Component } $query->where(['c.product_id' => $productId]); + for($i = 0; $i < count($attributes); $i++) { - $attribute = Json::decode($attributes[$i]); - $query->andWhere(['sca' . $i . '.attribute_id' => $attribute['attributeId'], 'sca' . $i . '.attribute_value_id' => $attribute['valueId']]); + $attribute = Json::decode($attributes[key($attributes)]); + $query->andWhere([ + 'sca' . $i . '.attribute_id' => $attribute['attributeId'], + 'sca' . $i . '.attribute_value_id' => $attribute['valueId'] + ]); } $result = $query->one(); - if(!empty($result)) { $combinationId = $result['id']; $combination = Combination::findOne($combinationId);
Fixes getCombination() method in CartComponent class.
black-lamp_blcms-cart
train
php
9c4e4fc41133c1d1b015efa47a14a4b98ad7b918
diff --git a/pysnmp/entity/rfc3413/cmdrsp.py b/pysnmp/entity/rfc3413/cmdrsp.py index <HASH>..<HASH> 100644 --- a/pysnmp/entity/rfc3413/cmdrsp.py +++ b/pysnmp/entity/rfc3413/cmdrsp.py @@ -267,3 +267,16 @@ class BulkCommandResponder(CommandResponderBase): rspVarBinds = rspVarBinds[:self.maxVarBinds] return 0, 0, rspVarBinds + +class SetCommandResponder(CommandResponderBase): + pduTypes = ( rfc1905.SetRequestPDU.tagSet, ) + + # rfc1905: 4.2.5 + def _handleManagementOperation( + self, snmpEngine, contextMibInstrumCtl, PDU, (acFun, acCtx) + ): + # rfc1905: 4.2.5.1-13 + return 0, 0, contextMibInstrumCtl.writeVars( + v2c.apiPDU.getVarBinds(PDU), (acFun, acCtx) + ) +
SetCommandResponder added
etingof_pysnmp
train
py
bd830a4aabebd196f69ea21c8a5aeae5d658307f
diff --git a/dddp/api.py b/dddp/api.py index <HASH>..<HASH> 100644 --- a/dddp/api.py +++ b/dddp/api.py @@ -346,7 +346,9 @@ class Collection(APIMixin): if exps: # clone/update obj with values but only for the expression fields obj = deepcopy(obj) - for name, val in self.model.objects.values(*exps).get(pk=obj.pk): + for name, val in self.model.objects.values(*exps).get( + pk=obj.pk, + ).items(): setattr(obj, name, val) # run serialization now all fields are "concrete" (not F expressions)
Fix change handler for objects updated using F expressions.
jazzband_django-ddp
train
py
34a5e7ed700fb1ccf97b803bc7d2676c03e23e4b
diff --git a/GPy/kern/src/prod.py b/GPy/kern/src/prod.py index <HASH>..<HASH> 100644 --- a/GPy/kern/src/prod.py +++ b/GPy/kern/src/prod.py @@ -31,13 +31,16 @@ class Prod(CombinationKernel): """ def __init__(self, kernels, name='mul'): - for i, kern in enumerate(kernels[:]): + _newkerns = [] + for kern in kernels: if isinstance(kern, Prod): - del kernels[i] - for part in kern.parts[::-1]: - kern.unlink_parameter(part) - kernels.insert(i, part) - super(Prod, self).__init__(kernels, name) + for part in kern.parts: + #kern.unlink_parameter(part) + _newkerns.append(part.copy()) + else: + _newkerns.append(kern.copy()) + + super(Prod, self).__init__(_newkerns, name) def to_dict(self): input_dict = super(Prod, self)._to_dict()
fix: #<I>, product kernel resolution
SheffieldML_GPy
train
py
8864ddd276be399c98d95c89ea793fa4938f223d
diff --git a/packages/create-instance/create-instance.js b/packages/create-instance/create-instance.js index <HASH>..<HASH> 100644 --- a/packages/create-instance/create-instance.js +++ b/packages/create-instance/create-instance.js @@ -11,7 +11,6 @@ import { throwError } from 'shared/util' import { compileTemplate } from './compile-template' import deleteoptions from './delete-mounting-options' import createFunctionalComponent from './create-functional-component' -import cloneDeep from 'lodash/cloneDeep' import { componentNeedsCompiling } from 'shared/validators' export default function createInstance ( @@ -58,9 +57,6 @@ export default function createInstance ( addAttrs(vm, options.attrs) addListeners(vm, options.listeners) - vm.$_mountingOptionsSlots = options.slots - vm.$_originalSlots = cloneDeep(vm.$slots) - if (options.slots) { addSlots(vm, options.slots) }
refactor: remove unnecessary code (#<I>)
vuejs_vue-test-utils
train
js
1c26956d3e70f39383d00ac914edb1895a9ae57a
diff --git a/src/main/java/net/bootsfaces/component/selectMultiMenu/SelectMultiMenuRenderer.java b/src/main/java/net/bootsfaces/component/selectMultiMenu/SelectMultiMenuRenderer.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/bootsfaces/component/selectMultiMenu/SelectMultiMenuRenderer.java +++ b/src/main/java/net/bootsfaces/component/selectMultiMenu/SelectMultiMenuRenderer.java @@ -666,6 +666,11 @@ public class SelectMultiMenuRenderer extends CoreInputRenderer { } else if (s.equals(value)) return true; } + for (String s : options) { + if (s != null && s.trim().equals(value)) { + return true; + } + } return false; }
#<I> allow for values formatted with leading or trailing spaces
TheCoder4eu_BootsFaces-OSP
train
java
a7972f29ec953bae81c8fb8e7d04f153c2c6c291
diff --git a/qtpy/uic.py b/qtpy/uic.py index <HASH>..<HASH> 100644 --- a/qtpy/uic.py +++ b/qtpy/uic.py @@ -229,9 +229,6 @@ else: QMetaObject.connectSlotsByName(widget) return widget - - # Credit: - # http://stackoverflow.com/questions/4442286/python-code-genration-with-pyside-uic/14195313#14195313 def loadUiType(uifile, from_imports=False): """Load a .ui file and return the generated form class and the Qt base class. @@ -240,6 +237,7 @@ else: in-memory first and then execute it in a special frame to retrieve the form_class. + Credit: https://stackoverflow.com/a/14195313/15954282 """ import sys
Add credits in the loadUiType docstring
spyder-ide_qtpy
train
py
7719860b60eacd2e05aebe3c0e04002caca7cd05
diff --git a/lib/adminlib.php b/lib/adminlib.php index <HASH>..<HASH> 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -2427,7 +2427,7 @@ class admin_setting_special_frontpagedesc extends admin_setting { $record->id = SITEID; $record->{$this->name} = $data; $record->timemodified = time(); - return($DB->update_record('course', $record) ? '' : get_string('errorsetting', 'admin')); + return ($DB->update_record('course', $record) ? '' : get_string('errorsetting', 'admin')); } public function output_html($data, $query='') { @@ -4269,7 +4269,11 @@ function admin_write_settings($formdata) { $adminroot->errors[$fullname]->id = $setting->get_id(); $adminroot->errors[$fullname]->error = $error; } - if ($original !== serialize($setting->get_setting())) { + // $SITE didn't update synchronously, and we shouldn't + // update in this loop (expensive to do this). $SITE will + // be updated at the end of this function, see MDL-17966 + // if ($original !== serialize($setting->get_setting())) { + if ($original !== serialize($data[$fullname])) { $count++; $callbackfunction = $setting->updatedcallback; if (function_exists($callbackfunction)) {
"ADMINLIB/MDL-<I>, display changes saved in admin page, merged from <I>"
moodle_moodle
train
php
50e6b4a44db945c4cdd6fd51d02f6de18956aa16
diff --git a/manager-bundle/src/EventListener/InstallCommandListener.php b/manager-bundle/src/EventListener/InstallCommandListener.php index <HASH>..<HASH> 100644 --- a/manager-bundle/src/EventListener/InstallCommandListener.php +++ b/manager-bundle/src/EventListener/InstallCommandListener.php @@ -43,7 +43,7 @@ class InstallCommandListener */ public function onConsoleTerminate(ConsoleTerminateEvent $event) { - if (!($event->getCommand() instanceof InstallCommand)) { + if (!$event->getCommand() instanceof InstallCommand) { return; } diff --git a/manager-bundle/src/Resources/system/initialize.php b/manager-bundle/src/Resources/system/initialize.php index <HASH>..<HASH> 100644 --- a/manager-bundle/src/Resources/system/initialize.php +++ b/manager-bundle/src/Resources/system/initialize.php @@ -22,7 +22,7 @@ $kernel = new ContaoKernel('prod', false); $response = $kernel->handle($request); // Send the response if not generated by the InitializeController -if (!($response instanceof InitializeControllerResponse)) { +if (!$response instanceof InitializeControllerResponse) { $response->send(); $kernel->terminate($request, $response); exit;
[Manager] Allow assignments in conditions.
contao_contao
train
php,php
0526c4fa47d54d84e8297b6eabc0e18efa2b2b9c
diff --git a/salt/minion.py b/salt/minion.py index <HASH>..<HASH> 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -728,8 +728,11 @@ class Syndic(salt.client.LocalClient, Minion): ''' def __init__(self, opts): self._syndic = True - salt.client.LocalClient.__init__(self, opts['_master_conf_file']) Minion.__init__(self, opts) + salt.client.LocalClient.__init__(self, opts['_master_conf_file']) + opts.update(self.opts) + self.opts = opts + def _handle_aes(self, load): '''
modify syndic opts management to cleanly merge minion and master opts
saltstack_salt
train
py
5eb44a81e14846b2ecfbc018d2bb6e2c68e6c966
diff --git a/src/services/SuperTableService.php b/src/services/SuperTableService.php index <HASH>..<HASH> 100644 --- a/src/services/SuperTableService.php +++ b/src/services/SuperTableService.php @@ -314,6 +314,14 @@ class SuperTableService extends Component ProjectConfigHelper::ensureAllFieldsProcessed(); + // Ensure all Matrix blocks are processed + $projectConfig = Craft::$app->getProjectConfig(); + $allBlocks = $projectConfig->get(\craft\services\Matrix::CONFIG_BLOCKTYPE_KEY, true) ?? []; + + foreach ($allBlocks as $blockUid => $blockData) { + $projectConfig->processConfigChanges(\craft\services\Matrix::CONFIG_BLOCKTYPE_KEY . '.' . $blockUid); + } + $blockTypeUid = $event->tokenMatches[0]; $data = $event->newValue; $previousData = $event->oldValue;
Provide a fix for Matrix + Super Table project config issues
verbb_super-table
train
php
b3d6c149ba3544733868c5ec797ce7cb77539227
diff --git a/acceptance_test.go b/acceptance_test.go index <HASH>..<HASH> 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -21,7 +21,7 @@ import ( // nolint: gochecknoglobals var formatArchs = map[string][]string{ "apk": {"amd64", "arm64", "386", "ppc64le", "armv6", "armv7", "s390x"}, - "deb": {"amd64", "arm64", "ppc64le", "armv6", "armv7", "s390x"}, + "deb": {"amd64", "arm64", "ppc64le", "armv7", "s390x"}, "rpm": {"amd64", "arm64", "ppc64le", "armv7"}, }
fix: disable debian arm6 tests (#<I>)
goreleaser_nfpm
train
go
abc1ad4ff9b181e73fcd9a22d61e08b71a1e1f18
diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/ReactNVD3.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/ReactNVD3.js index <HASH>..<HASH> 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/ReactNVD3.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/ReactNVD3.js @@ -20,8 +20,8 @@ import { reactify } from '@superset-ui/chart'; import Component from './NVD3Vis'; import { hideTooltips } from './utils'; -function willUnmount() { +function componentWillUnmount() { hideTooltips(true); } -export default reactify(Component, { willUnmount }); +export default reactify(Component, { componentWillUnmount });
chore: rename willUnmount hook to match the name in `superset-ui/chart` (#<I>)
apache_incubator-superset
train
js
aab61f1805c2c0866f233abaae521acbbbeb7961
diff --git a/sparta.go b/sparta.go index <HASH>..<HASH> 100644 --- a/sparta.go +++ b/sparta.go @@ -503,11 +503,13 @@ func (mapping *EventSourceMapping) export(serviceName string, dynamicArn := spartaCF.DynamicValueToStringExpr(mapping.EventSourceArn) eventSourceMappingResource := gocf.LambdaEventSourceMapping{ - EventSourceArn: dynamicArn.String(), - FunctionName: targetLambdaArn, - StartingPosition: gocf.String(mapping.StartingPosition), - BatchSize: gocf.Integer(mapping.BatchSize), - Enabled: gocf.Bool(!mapping.Disabled), + EventSourceArn: dynamicArn.String(), + FunctionName: targetLambdaArn, + BatchSize: gocf.Integer(mapping.BatchSize), + Enabled: gocf.Bool(!mapping.Disabled), + } + if mapping.StartingPosition != "" { + eventSourceMappingResource.StartingPosition = gocf.String(mapping.StartingPosition) } // Unique components for the hash for the EventSource mapping
Conditionally set `StartingPosition` This field only applies to Kinesis, Dynamo. SQS-based subscribers require it to be non-existent.
mweagle_Sparta
train
go
2f36f349814d234f70605e81c65e4995eac346f9
diff --git a/tests/integration/modules/gem.py b/tests/integration/modules/gem.py index <HASH>..<HASH> 100644 --- a/tests/integration/modules/gem.py +++ b/tests/integration/modules/gem.py @@ -13,7 +13,8 @@ ensure_in_syspath('../../') # Import salt libs import integration -import salt.utils.which +import salt.utils +import salt.utils.http GEM = 'rake' GEM_VER = '11.1.2' @@ -21,9 +22,19 @@ OLD_GEM = 'thor' OLD_VERSION = '0.17.0' DEFAULT_GEMS = ['bigdecimal', 'rake', 'json', 'rdoc'] +def check_status(): + ''' + Check the status of the rubygems source + ''' + ret = salt.utils.http.query('https://rubygems.org', status=True) + if ret['status'] == 200: + return True + return False + @destructiveTest -@skipIf(salt.utils.which('gem') is None, 'Gem is not available on the system') +@skipIf(salt.utils.which('gem') is None, 'Gem is not available') +@skipIf(check_status() is False, 'External source \'https://rubygems.org\' is not available') class GemModuleTest(integration.ModuleCase): ''' Validate gem module
Fixed salt.util import. Added status check to make sure external resource is available
saltstack_salt
train
py
1fa8bd2eeee413a7d2a25a626095c4ee44055eab
diff --git a/test/cmd-collect-detect-port.test.js b/test/cmd-collect-detect-port.test.js index <HASH>..<HASH> 100644 --- a/test/cmd-collect-detect-port.test.js +++ b/test/cmd-collect-detect-port.test.js @@ -27,5 +27,8 @@ test('cmd - collect - detect server port', function (t) { t.end() }) }) + process.on('exit', function () { + cmd.cleanup() + }) }) }) diff --git a/test/cmd-visualize.test.js b/test/cmd-visualize.test.js index <HASH>..<HASH> 100644 --- a/test/cmd-visualize.test.js +++ b/test/cmd-visualize.test.js @@ -33,7 +33,7 @@ test('cmd - test visualization', function (t) { if (err) return cleanup(err, dirname) t.ok(content.length > 1024) - t.end() + cleanup(null, dirname) }) }) }
Clean dir after test (#<I>)
nearform_node-clinic-bubbleprof
train
js,js
d05f6d9e3e2918bf6487b19bf999fe86cf557b8a
diff --git a/lib/librarian/resolver.rb b/lib/librarian/resolver.rb index <HASH>..<HASH> 100644 --- a/lib/librarian/resolver.rb +++ b/lib/librarian/resolver.rb @@ -44,5 +44,20 @@ module Librarian manifest_names.map{|n| manifests[n]} end + def resolved?(dependencies, manifests) + manifests_hash = Hash[manifests.map{|m| [m.name, m]}] + deps_match = dependencies.all? do |dependency| + manifest = manifests_hash[dependency.name] + dependency.requirement.satisfied_by?(manifest.version) + end + mans_match = manifests.all? do |manifest| + manifest.dependencies.all? do |dependency| + manifest = manifests_hash[dependency.name] + dependency.requirement.satisfied_by?(manifest.version) + end + end + deps_match && mans_match + end + end end
A method to check whether a set of manifests is a good resolution for a set of dependencies.
applicationsonline_librarian
train
rb
ef0a44f8e0e4e004d9dce325c11f610cfaaf4fba
diff --git a/tests/Monolog/Handler/RavenHandlerTest.php b/tests/Monolog/Handler/RavenHandlerTest.php index <HASH>..<HASH> 100644 --- a/tests/Monolog/Handler/RavenHandlerTest.php +++ b/tests/Monolog/Handler/RavenHandlerTest.php @@ -72,6 +72,18 @@ class RavenHandlerTest extends TestCase $this->assertEquals($ravenClient::WARNING, $ravenClient->lastData['level']); $this->assertContains($record['message'], $ravenClient->lastData['message']); } + + public function testTag() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $tags = array('tags' => array(1, 2, 'foo')); + $record = $this->getRecord(Logger::INFO, "test", $tags); + $handler->handle($record); + + $this->assertEquals($record['tags'], $tags); + } public function testException() {
Added a test for Tags
Seldaek_monolog
train
php
09d2d1d401aad4c3343c722f7c4806fddcaac864
diff --git a/holoviews/core/ndmapping.py b/holoviews/core/ndmapping.py index <HASH>..<HASH> 100644 --- a/holoviews/core/ndmapping.py +++ b/holoviews/core/ndmapping.py @@ -412,9 +412,12 @@ class MultiDimensionalMapping(Dimensioned): number and type of objects contained within it and information about its dimensions. """ - info_str = self.__class__.__name__ +\ - " containing %d items of type %s\n" % (len(self.keys()), - type(self.values()[0]).__name__) + if (len(self.values()) > 0): + info_str = self.__class__.__name__ +\ + " containing %d items of type %s\n" % (len(self.keys()), + type(self.values()[0]).__name__) + else: + info_str = self.__class__.__name__ + " containing no items\n" info_str += ('-' * (len(info_str)-1)) + "\n\n" aliases = {v: k for k, v in self._dim_aliases.items()} for group in self._dim_groups:
Do not fail if .info is called on an empty holomap
pyviz_holoviews
train
py
7abe20cef2a7283349dd34a0cedf9af34244aa5e
diff --git a/openquake/server/tests/views_test.py b/openquake/server/tests/views_test.py index <HASH>..<HASH> 100644 --- a/openquake/server/tests/views_test.py +++ b/openquake/server/tests/views_test.py @@ -34,6 +34,7 @@ import string import random from django.test import Client from openquake.baselib.general import gettemp +from openquake.commonlib.logs import dbcmd from openquake.engine.export import core from openquake.server.db import actions from openquake.server.dbserver import db, get_status @@ -116,6 +117,8 @@ class EngineServerTestCase(unittest.TestCase): @classmethod def tearDownClass(cls): + c = dbcmd('SELECT count(*) FROM job WHERE status=?x', 'failed')[0][0] + assert c > 0, 'There are no failed jobs??' cls.wait() # tests
Added a test for passing SQL commands [skip hazardlib] Former-commit-id: <I>a3c<I>b9d<I>a<I>c<I>b3b<I>b6ed3c
gem_oq-engine
train
py
db8abd8503b4ff22241ca2d0a15a151c86d347f1
diff --git a/django_cache_url.py b/django_cache_url.py index <HASH>..<HASH> 100644 --- a/django_cache_url.py +++ b/django_cache_url.py @@ -9,7 +9,7 @@ urlparse.uses_netloc.append('dummy') urlparse.uses_netloc.append('file') urlparse.uses_netloc.append('locmem') urlparse.uses_netloc.append('memcached') -urlparse.uses_netloc.append('django_pylibmc') +urlparse.uses_netloc.append('djangopylibmc') urlparse.uses_netloc.append('pymemcached') DEFAULT_ENV = 'CACHE_URL' @@ -20,7 +20,7 @@ CACHE_TYPES = { 'file': 'django.core.cache.backends.filebased.FileBasedCache', 'locmem': 'django.core.cache.backends.locmem.LocMemCache', 'memcached': 'django.core.cache.backends.memcached.PyLibMCCache', - 'django_pylibmc': 'django_pylibmc.memcached.PyLibMCCache', + 'djangopylibmc': 'django_pylibmc.memcached.PyLibMCCache', 'pymemcached': 'django.core.cache.backends.memcached.MemcachedCache' }
URL scheme can't contain an underscore apparently.
ghickman_django-cache-url
train
py
3759bf1a38803f9e727722c96a088dbf54b29ed5
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( description="A replacement for Django's simple_tag decorator.", long_description=readme, author='Sam Bull', - author_email='[email protected]' + author_email='[email protected]', url='https://github.com/trapeze/fancy_tag', packages=find_packages(), zip_safe=False,
Fixed dumb typo in setup.py
trapeze_fancy_tag
train
py
08897315360198bb63b929c6f39672653f5cb529
diff --git a/docs/level-7-use-custom-jinja2-filter-test-n-global/custom-jj2-plugin/filter.py b/docs/level-7-use-custom-jinja2-filter-test-n-global/custom-jj2-plugin/filter.py index <HASH>..<HASH> 100644 --- a/docs/level-7-use-custom-jinja2-filter-test-n-global/custom-jj2-plugin/filter.py +++ b/docs/level-7-use-custom-jinja2-filter-test-n-global/custom-jj2-plugin/filter.py @@ -1,7 +1,13 @@ +import sys import base64 from moban.extensions import JinjaFilter @JinjaFilter('base64encode') def base64_encode(string): - return base64.b64encode(string) + if sys.version_info[0] > 2: + content = base64.b64encode(string.encode('utf-8')) + content = content.decode('utf-8') + else: + content = base64.b64encode(string) + return content
:bug: fix filter for python 3
moremoban_moban
train
py
1473216efe18bb275c24666f1639d6362dcc2769
diff --git a/pycanlib/CAN.py b/pycanlib/CAN.py index <HASH>..<HASH> 100644 --- a/pycanlib/CAN.py +++ b/pycanlib/CAN.py @@ -9,6 +9,8 @@ import types from xml.dom import minidom from pycanlib import canlib, CANLIBErrorHandlers, canstat + + canlib.canInitializeLibrary()
Added newlines to separate import statements from code in CAN.py
hardbyte_python-can
train
py
580e20cce0238fcf4980133c512fe397478928b6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( author_email="[email protected]", include_package_data=True, packages=['gamest', 'gamest_plugins'], - install_requires=['sqlalchemy', 'psutil >= 5.7.0', 'requests', 'appdirs'], + install_requires=['sqlalchemy', 'psutil>=5.7.0', 'requests', 'appdirs'], setup_requires=['setuptools_scm'], use_scm_version=True, entry_points={
Remove space that breaks install_requires.
sopoforic_gamest
train
py
8e5c246bb774969f28e9e7d6663c1f3919eea4c3
diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index <HASH>..<HASH> 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -685,11 +685,14 @@ class BaseBuilder } $cond = ' ON '; - foreach ($conditions as $i => $condition) + $i = 0; + foreach ($conditions as $condition) { - $operator = $this->getOperator($condition); + $operator = $this->getOperator($conditions[$i]); $cond .= $joints[$i]; - $cond .= preg_match("/(\(*)?([\[\]\w\.'-]+)" . preg_quote($operator) . '(.*)/i', $condition, $match) ? $match[1] . $this->db->protectIdentifiers($match[2]) . $operator . $this->db->protectIdentifiers($match[3]) : $condition; + $cond .= preg_match("/(\(*)?([\[\]\w\.'-]+)" . preg_quote($operator) . '(.*)/i', $conditions[$i], $match) ? $match[1] . $this->db->protectIdentifiers($match[2]) . $operator . $this->db->protectIdentifiers($match[3]) : $conditions[$i]; + + $i++; } }
handle find record array by numeric key in join
codeigniter4_CodeIgniter4
train
php
5f186dbcc0b12d8c0bdcb62b90f208c8db48bfe9
diff --git a/src/selector.js b/src/selector.js index <HASH>..<HASH> 100644 --- a/src/selector.js +++ b/src/selector.js @@ -834,6 +834,10 @@ var queryToString = function(query){ var str = ''; + if( query.subject === query ){ + str += '$'; + } + var group = clean(query.group); str += group.substring(0, group.length - 1);
Style JSON serialisation doesn't include subject selector $ #<I>
cytoscape_cytoscape.js
train
js
92912c067848b4b7e49820638c3c9272954bd6b0
diff --git a/lib/set.js b/lib/set.js index <HASH>..<HASH> 100644 --- a/lib/set.js +++ b/lib/set.js @@ -42,7 +42,7 @@ Set.prototype.diff = function(other) { var d = [] , x ; - for (x in this.members) if (!(x in other.members)) d.push(x); + for (x in this.members) if (!(x in other.members)) d.push(this.members[x]); return new Set(d); }; @@ -58,9 +58,14 @@ Set.prototype.remove = function(item) { }; Set.prototype.toArray = function() { - return Object.keys(this.members); + var ms = this.members; + return ownProps(this.members).map(function(k) { return ms[k]; }); }; Set.prototype.union = function(other) { - return new Set(ownProps(this.members).concat(ownProps(other.members))); + var ms = this.members; + , u = ownProps(this.members).map(function(k) { return ms[k]; }); + ms = other.members; + u = u.concat(ownProps(ms).map(function(k) { return ms[k]; })); + return new Set(u); };
make set compatible with non-strings, still very slow
samsonjs_batteries
train
js
001a09f674e44f55c8dad37c5b962a314280ac5a
diff --git a/doc/conf.py b/doc/conf.py index <HASH>..<HASH> 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -118,7 +118,7 @@ pygments_style = 'tango_console_highlighting.TangoStyle' # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'default' +html_theme = 'sphinxdoc' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the
Update sphinx theme to new sphinx version
tango-controls_pytango
train
py
2115847e99d54805232e09e979a35e3e3a958e99
diff --git a/demo/src/demos/SSAODemo.js b/demo/src/demos/SSAODemo.js index <HASH>..<HASH> 100644 --- a/demo/src/demos/SSAODemo.js +++ b/demo/src/demos/SSAODemo.js @@ -169,7 +169,7 @@ export class SSAODemo extends PostProcessingDemo { rangeThreshold: 0.0003, // Occlusion proximity of ~0.3 world units rangeFalloff: 0.0001, // with ~0.1 units of falloff. luminanceInfluence: 0.0, - radius: 8.0, + radius: 25.0, intensity: 2.0, bias: 0.025, height: 480
Update SSAODemo.js
vanruesc_postprocessing
train
js
b894025d4294aab06497278c39c082819ae85d8b
diff --git a/tests/ui/test_widgets.py b/tests/ui/test_widgets.py index <HASH>..<HASH> 100644 --- a/tests/ui/test_widgets.py +++ b/tests/ui/test_widgets.py @@ -2,6 +2,7 @@ from py.test import importorskip import gtk from pygtkhelpers.utils import refresh_gui from pygtkhelpers.ui.widgets import StringList, AttrSortCombo +from pygtkhelpers.ui.objectlist import ObjectList def pytest_funcarg__pl(request): return StringList() @@ -49,8 +50,8 @@ def test_pl_edit(pl): def test_attrsortcombo(): mock = importorskip('mock') - ol = mock.Mock() - model = ol.get_model() + ol = mock.Mock(spec=ObjectList) + model = ol.get_model.return_value = mock.Mock(spec=gtk.TreeSortable) sort = AttrSortCombo(ol, [ ('name', 'Der name'),
use the awesome mock-specs to see if the attrcombo test is robust
sci-bots_pygtkhelpers
train
py
d34f85a63687e6ff3939fbba6302facf720bfab0
diff --git a/library/src/com/nineoldandroids/view/ViewPropertyAnimator.java b/library/src/com/nineoldandroids/view/ViewPropertyAnimator.java index <HASH>..<HASH> 100644 --- a/library/src/com/nineoldandroids/view/ViewPropertyAnimator.java +++ b/library/src/com/nineoldandroids/view/ViewPropertyAnimator.java @@ -19,6 +19,7 @@ package com.nineoldandroids.view; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; +import java.util.WeakHashMap; import com.nineoldandroids.animation.Animator; import com.nineoldandroids.animation.Animator.AnimatorListener; @@ -433,8 +434,16 @@ public class ViewPropertyAnimator { } } + private static WeakHashMap<View, ViewPropertyAnimator> ANIMATORS = + new WeakHashMap<View, ViewPropertyAnimator>(); + public static ViewPropertyAnimator animate(View view) { - return new ViewPropertyAnimator(view); + ViewPropertyAnimator animator = ANIMATORS.get(view); + if (animator == null) { + animator = new ViewPropertyAnimator(view); + ANIMATORS.put(view, animator); + } + return animator; }
Use a weak map to associate a single animator to a view.
JakeWharton_NineOldAndroids
train
java
320cc2143499ce071547dfc5a698d5fada5bcfae
diff --git a/blocks/colour.js b/blocks/colour.js index <HASH>..<HASH> 100644 --- a/blocks/colour.js +++ b/blocks/colour.js @@ -28,6 +28,16 @@ goog.provide('Blockly.Blocks.colour'); goog.require('Blockly.Blocks'); +goog.require('Blockly.constants'); + +/** + * Pick a random colour. + * @return {!string} #RRGGBB for random colour. + */ +function randomColour() { + return '#' + Math.floor(Math.random() * 16777215).toString(16); +} + Blockly.Blocks['colour_picker'] = { /** * Block for colour picker. @@ -40,9 +50,10 @@ Blockly.Blocks['colour_picker'] = { { "type": "field_colour", "name": "COLOUR", - "colour": "#ff0000" + "colour": randomColour() } ], + "outputShape": Blockly.OUTPUT_SHAPE_ROUND, "output": "Colour" }); }
Set default colour for colour picker to random (#<I>)
LLK_scratch-blocks
train
js
1c67927f1d566466c6067f4b2b638a3b241c3ec8
diff --git a/examples/script/concolic.py b/examples/script/concolic.py index <HASH>..<HASH> 100755 --- a/examples/script/concolic.py +++ b/examples/script/concolic.py @@ -17,6 +17,7 @@ import queue import struct import itertools +from manticore import set_verbosity from manticore.native import Manticore from manticore.core.plugin import ExtendedTracer, Follower, Plugin from manticore.core.smtlib.constraints import ConstraintSet @@ -167,7 +168,7 @@ def concrete_run_get_trace(inp): m1 = Manticore.linux(prog, concrete_start=inp, workspace_url="mem:") t = ExtendedTracer() # r = TraceReceiver(t) - m1.verbosity(VERBOSITY) + set_verbosity(VERBOSITY) m1.register_plugin(t) # m1.register_plugin(r) m1.run() @@ -184,7 +185,7 @@ def symbolic_run_get_cons(trace): # mem: has no concurrency support. Manticore should be 'Single' process m2 = Manticore.linux(prog, workspace_url="mem:") f = Follower(trace) - m2.verbosity(VERBOSITY) + set_verbosity(VERBOSITY) m2.register_plugin(f) def on_term_testcase(mm, state, err):
Fix deprecation warnings related to setting verbosity (#<I>)
trailofbits_manticore
train
py
46b1149f127868b06d1a464f4ec712012adb1e37
diff --git a/lib/rack/timeout/legacy.rb b/lib/rack/timeout/legacy.rb index <HASH>..<HASH> 100644 --- a/lib/rack/timeout/legacy.rb +++ b/lib/rack/timeout/legacy.rb @@ -26,12 +26,9 @@ module Rack::Timeout::ClassLevelProperties end module InstanceMethods - def read_timeout_property_with_class_override property_name - read_timeout_property self.class.send(property_name), method(property_name).super_method.call - end [:service_timeout, :wait_timeout, :wait_overtime].each do |m| - define_method(m) { read_timeout_property_with_class_override m } + define_method(m) { read_timeout_property self.class.send(m), super() } end def service_past_wait @@ -43,4 +40,4 @@ end Rack::Timeout.extend Rack::Timeout::ClassLevelProperties::ClassMethods -Rack::Timeout.prepend Rack::Timeout::ClassLevelProperties::InstanceMethods +Rack::Timeout.send :prepend, Rack::Timeout::ClassLevelProperties::InstanceMethods
ruby <I> support: stop using super_method, handle prepend being private
heroku_rack-timeout
train
rb
f919937141d63fffffdddf2016327dc944146cdc
diff --git a/lib/light.rb b/lib/light.rb index <HASH>..<HASH> 100644 --- a/lib/light.rb +++ b/lib/light.rb @@ -72,11 +72,20 @@ class Light state["xy"] end + # TODO: consider x() and y() setters/getters def xy=(value) set(:xy => value) end - # TODO: consider x() and y() setters/getters + #TODO: figure out what this does (and if I can change it) + def alert + state["alert"] + end + + #TODO: figure out what this does (and if I can change it) + def effect + state["effect"] + end def red self.xy = [0.6446, 0.3289] @@ -103,6 +112,7 @@ class Light end __END__ +example state() return value: { "on" => true, "bri" => 254,
Adding alert() and effect() and some comments.
dmerrick_lights_app
train
rb
8bdba3ff3c88be729633ea40b8fbdf875ed1e391
diff --git a/test/videojs.record.spec.js b/test/videojs.record.spec.js index <HASH>..<HASH> 100644 --- a/test/videojs.record.spec.js +++ b/test/videojs.record.spec.js @@ -267,7 +267,7 @@ describe('Record', () => { // and https://www.fxsitecompat.dev/en-CA/docs/2019/requesting-notification-permission-and-screen-capture-now-requires-user-interaction/ expect(player.deviceErrorCode.name).toEqual('InvalidStateError'); expect(player.deviceErrorCode.message).toEqual( - 'getDisplayMedia must be called from a user gesture handler.' + 'getDisplayMedia requires transient activation from a user gesture.' ); } @@ -320,7 +320,7 @@ describe('Record', () => { // and https://www.fxsitecompat.dev/en-CA/docs/2019/requesting-notification-permission-and-screen-capture-now-requires-user-interaction/ expect(player.deviceErrorCode.name).toEqual('InvalidStateError'); expect(player.deviceErrorCode.message).toEqual( - 'getDisplayMedia must be called from a user gesture handler.' + 'getDisplayMedia requires transient activation from a user gesture.' ); }
test: error message for getDisplayMedia user gesture changed in Firefox
collab-project_videojs-record
train
js
bdd74933072904ad8bf1532084568ad1cc482306
diff --git a/mockserver-netty/src/test/java/org/mockserver/integration/mocking/WebsocketCallbackRegistryIntegrationTest.java b/mockserver-netty/src/test/java/org/mockserver/integration/mocking/WebsocketCallbackRegistryIntegrationTest.java index <HASH>..<HASH> 100644 --- a/mockserver-netty/src/test/java/org/mockserver/integration/mocking/WebsocketCallbackRegistryIntegrationTest.java +++ b/mockserver-netty/src/test/java/org/mockserver/integration/mocking/WebsocketCallbackRegistryIntegrationTest.java @@ -165,6 +165,7 @@ public class WebsocketCallbackRegistryIntegrationTest extends AbstractMockingInt private int objectCallbackCounter = 0; @Test + @Ignore public void shouldRespondByMultipleParallelObjectCallbacks() { // when for (int i = 0; i < 50; i++) {
ignoring tests that deadlocks in buildkite
jamesdbloom_mockserver
train
java
9dd3bca79d6102f0f0323351b6c13b0d3d504443
diff --git a/src/components/Select.js b/src/components/Select.js index <HASH>..<HASH> 100644 --- a/src/components/Select.js +++ b/src/components/Select.js @@ -175,7 +175,12 @@ const Select = React.createClass({ onClick={this._handleOptionClick.bind(null, option)} onMouseOver={this._handleOptionMouseOver.bind(null, option)} ref={option.displayValue + option.value} - style={[styles.option, this.props.optionStyle, option === this.state.highlightedValue && styles.activeItem, this.getBackgroundColor(option)]} + style={[ + styles.option, + this.props.optionStyle, + option === this.state.highlightedValue && styles.activeItem, + this.getBackgroundColor(option) + ]} > {option.displayValue} </li> @@ -288,11 +293,7 @@ const styles = { cursor: 'pointer', backgroundColor: '#FFFFFF', padding: '10px', - whiteSpace: 'nowrap', - // ':hover': { - // backgroundColor: StyleConstants.Colors.PRIMARY, - // color: StyleConstants.Colors.WHITE - // } + whiteSpace: 'nowrap' }, scrim: { position: 'fixed',
put element with 3+ props on separate lines, deleted unnecessary hover style state
mxenabled_mx-react-components
train
js
c604bd3550fa523ff5ada078bae2a883c959c061
diff --git a/src/Nats/Connection.php b/src/Nats/Connection.php index <HASH>..<HASH> 100644 --- a/src/Nats/Connection.php +++ b/src/Nats/Connection.php @@ -457,12 +457,12 @@ class Connection if ($this->serverInfo->isTLSRequired()) { set_error_handler( function ($errno, $errstr, $errfile, $errline) { + restore_error_handler(); throw Exception::forFailedConnection($errstr); }); if (!stream_socket_enable_crypto( $this->streamSocket, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)) { - restore_error_handler(); throw Exception::forFailedConnection('Error negotiating crypto'); }
corrected restore_error_handler call
repejota_phpnats
train
php
6ff69bb2068cce443b754201f8e813d57a320d68
diff --git a/charcoal/charcoal.py b/charcoal/charcoal.py index <HASH>..<HASH> 100644 --- a/charcoal/charcoal.py +++ b/charcoal/charcoal.py @@ -12,7 +12,7 @@ import validictory from yapsy.PluginManager import PluginManager from . import COLOURS, get_verify, get_host_overrides, tcptest -from output import Output +from .output import Output FORMAT = '%(asctime)-15s %(name)s [%(levelname)s]: %(message)s' THIS_DIR = os.path.dirname(os.path.realpath(__file__))
Correct path to import module Previously worked fine for Python 2 but not Python 3, so corrected path to import Output module.
sky-shiny_smolder
train
py
b2603303727cd679078c663ef756d69e635fe25c
diff --git a/Form/Type/AdminType.php b/Form/Type/AdminType.php index <HASH>..<HASH> 100644 --- a/Form/Type/AdminType.php +++ b/Form/Type/AdminType.php @@ -27,7 +27,7 @@ class AdminType extends AbstractType public function buildForm(FormBuilder $builder, array $options) { $admin = $this->getAdmin($options); - if ($options['delete']) { + if ($options['delete'] && $admin->isGranted('DELETE') ) { $builder->add('_delete', 'checkbox', array('required' => false, 'property_path' => false)); }
Hide the "delete" option if that capability is not granted.
sonata-project_SonataAdminBundle
train
php
0dfaf0f0d58916c808dd55c28ca580a8a4219c7b
diff --git a/PhpAmqpLib/Connection/AbstractConnection.php b/PhpAmqpLib/Connection/AbstractConnection.php index <HASH>..<HASH> 100644 --- a/PhpAmqpLib/Connection/AbstractConnection.php +++ b/PhpAmqpLib/Connection/AbstractConnection.php @@ -17,9 +17,9 @@ class AbstractConnection extends AbstractChannel public static $LIBRARY_PROPERTIES = array( "library" => array('S', "PHP AMQP Lib"), "library_version" => array('S', "2.0"), - "capabilities" => array( - 'S', - '{publisher_confirms=true}' + "capabilities" => array( + 'F', + array('publisher_confirms' => array('t', true)) ), );
Bugfix The capabilities-table was a string but must be a field-table
php-amqplib_php-amqplib
train
php
e6018124cfa4be1e2597926bce9cea78a1bbab2a
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -17,16 +17,14 @@ const LEVEL = Symbol.for('level'); var TransportStream = module.exports = function TransportStream(opts) { stream.Writable.call(this, { objectMode: true }); opts = opts || {}; - // - // TODO (indexzero): What do we do with formats on TransportStream - // instances? Should we do the same dance as in `winston.Logger`? - // + this.format = opts.format; this.level = opts.level; this.handleExceptions = opts.handleExceptions; - this.log = this.log || opts.log; - this.logv = this.logv || opts.logv; - this.close = this.close || opts.close; + + if (opts.log) this.log = opts.log; + if (opts.logv) this.logv = opts.logv; + if (opts.close) this.close = opts.close; var self = this;
[fix] Do not overwrite prototypal methods unless they are provided in the options.
winstonjs_winston-transport
train
js