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
575eb7d656f6077a959d0e1971c81588d6f7a486
diff --git a/container/api/src/main/java/org/wildfly/swarm/container/Container.java b/container/api/src/main/java/org/wildfly/swarm/container/Container.java index <HASH>..<HASH> 100644 --- a/container/api/src/main/java/org/wildfly/swarm/container/Container.java +++ b/container/api/src/main/java/org/wildfly/swarm/container/Container.java @@ -169,8 +169,10 @@ public class Container { * @return The container. */ public Container fraction(Fraction fraction) { - this.fractions.put(fractionRoot(fraction.getClass()), fraction); - fraction.initialize(new InitContext()); + if ( fraction != null ) { + this.fractions.put(fractionRoot(fraction.getClass()), fraction); + fraction.initialize(new InitContext()); + } return this; }
Logstash fraction test but not a super great one.
thorntail_thorntail
train
java
2f71ec1a2bdd46c8fbab6784174acb3175a808b4
diff --git a/pyemma/coordinates/tests/test_featurereader.py b/pyemma/coordinates/tests/test_featurereader.py index <HASH>..<HASH> 100644 --- a/pyemma/coordinates/tests/test_featurereader.py +++ b/pyemma/coordinates/tests/test_featurereader.py @@ -90,8 +90,8 @@ class TestFeatureReader(unittest.TestCase): # reproduce outcome xyz_s = self.xyz.shape - fake_lagged = np.empty((xyz_s[0]-lag,xyz_s[1],xyz_s[2])) - fake_lagged = self.xyz[lag:] + fake_lagged = np.empty((xyz_s[0]-lag,xyz_s[1]*xyz_s[2])) + fake_lagged = self.xyz.reshape((xyz_s[0],-1))[lag:] self.assertTrue(np.allclose(merged_lagged, fake_lagged)) @@ -128,7 +128,7 @@ class TestFeatureReader(unittest.TestCase): for _, _, y in reader: lagged_chunks.append(y) - coords = self.xyz + coords = self.xyz.reshape((self.xyz.shape[0],-1)) for ii, c in enumerate(lagged_chunks[:-1]): # all despite last chunk shall have chunksize
[tests] fixed bug in test_featurereader
markovmodel_PyEMMA
train
py
e5b50cd7082b79dfd11cf27733462cc3911e2ff1
diff --git a/yaks/lib/yaks.rb b/yaks/lib/yaks.rb index <HASH>..<HASH> 100644 --- a/yaks/lib/yaks.rb +++ b/yaks/lib/yaks.rb @@ -23,8 +23,8 @@ require 'yaks/errors' require 'yaks/default_policy' module Yaks - # A PORO - Undefined = Object.new + Undefined = Module.new.freeze + # Set the Root constant as the gems root path Root = Pathname(__FILE__).join('../..')
Make Yaks::Undefined look like "Undefined" when inspected, instead of #<Object...>
plexus_yaks
train
rb
3c5f6e05f510ecec8dfee3fc34ec9b889911bb86
diff --git a/lib/mail/network/delivery_methods/smtp.rb b/lib/mail/network/delivery_methods/smtp.rb index <HASH>..<HASH> 100644 --- a/lib/mail/network/delivery_methods/smtp.rb +++ b/lib/mail/network/delivery_methods/smtp.rb @@ -88,8 +88,8 @@ module Mail :openssl_verify_mode => nil, :ssl => nil, :tls => nil, - :open_timeout => nil, - :read_timeout => nil + :open_timeout => 5, + :read_timeout => 5 } def initialize(values)
Add default timeouts for SMTP I get lots of reports of "stuck" Sidekiq jobs due to email delivery. SMTP servers in the wild are notoriously unreliable, e.g. spam honeypots can leave TCP connections lingering. We need network connection timeouts by default.
mikel_mail
train
rb
c28a7fd0c37cc09901bcf4085e252f335207def3
diff --git a/src/DebuggerManager.php b/src/DebuggerManager.php index <HASH>..<HASH> 100644 --- a/src/DebuggerManager.php +++ b/src/DebuggerManager.php @@ -3,9 +3,9 @@ namespace Recca0120\LaravelTracy; use ErrorException; -use Exception; use Illuminate\Contracts\Routing\UrlGenerator; use Illuminate\Support\Arr; +use Throwable; use Tracy\Bar; use Tracy\BlueScreen; use Tracy\Debugger; @@ -224,7 +224,7 @@ class DebuggerManager * @param \Exception $exception * @return string */ - public function exceptionHandler(Exception $exception) + public function exceptionHandler(Throwable $exception) { return $this->renderBuffer(function () use ($exception) { Helpers::improveException($exception);
Fixed wrong type hint of DebuggerManager::exceptionHandler() * this is essential for laravel 7
recca0120_laravel-tracy
train
php
42b55674958f580e58fd3e0b244981a8e576c46b
diff --git a/tasks/version_build.js b/tasks/version_build.js index <HASH>..<HASH> 100644 --- a/tasks/version_build.js +++ b/tasks/version_build.js @@ -111,7 +111,6 @@ module.exports = function (grunt) { // Stage and commit to a branch function gitCommit () { - var status = shelljs.exec('git status --porcelain'); var commitMsg = options.commitMsg .replace(/%sourceName%/g, tokens.name) .replace(/%sourceCommit%/g, tokens.commit) @@ -121,7 +120,7 @@ module.exports = function (grunt) { shelljs.exec('git reset', {silent: true}); // If there are no changes, skip commit - if (status.output === '') { + if (shelljs.exec('git status --porcelain', {silent: true}).output === '') { grunt.log.writeln('No changes to your branch. Skipping commit.'); return; }
Remove single use var to make code style consistant
robwierzbowski_grunt-build-control
train
js
d2106564da7a843c8ab1f508a8fc0deea7a17173
diff --git a/spec/requests/as_account/channel_spec.rb b/spec/requests/as_account/channel_spec.rb index <HASH>..<HASH> 100644 --- a/spec/requests/as_account/channel_spec.rb +++ b/spec/requests/as_account/channel_spec.rb @@ -79,16 +79,19 @@ describe Yt::Channel, :device_app do it { expect(channel.videos.where(chart: 'invalid').first).to be_a Yt::Video } end - # @note: these tests are slow because they go through multiple pages of - # results and do so to test that we can overcome YouTube’s limitation of - # only returning the first 500 results for each query. - # @note: in principle, the following three counters should match, but in - # reality +video_count+ and +size+ are only approximations. context 'with more than 500 videos' do let(:id) { 'UCsmvakQZlvGsyjyOhmhvOsw' } + # @note: in principle, the following three counters should match, but in + # reality +video_count+ and +size+ are only approximations. it { expect(channel.video_count).to be > 500 } it { expect(channel.videos.size).to be > 500 } - it { expect(channel.videos.count).to be > 500 } + context 'with default order (by date)' do + # @note: these tests are slow because they go through multiple pages of + # results and do so to test that we can overcome YouTube’s limitation of + # only returning the first 500 results when ordered by date. + it { expect(channel.videos.count).to be > 500 } + it { expect(channel.videos.where(order: 'viewCount').count).to be 500 } + end end end
Add missing spec for b<I>aac<I> When the order is *not* by date, only the first <I> videos can be retrieved, since YouTube does not provide a way to paginate beyond that limit.
Fullscreen_yt
train
rb
84ab0bbd74e9729e691107271aaab93739070dd2
diff --git a/salt/states/boto_secgroup.py b/salt/states/boto_secgroup.py index <HASH>..<HASH> 100644 --- a/salt/states/boto_secgroup.py +++ b/salt/states/boto_secgroup.py @@ -376,7 +376,7 @@ def _rules_present( _source_group_name = rule.get('source_group_name', None) if _source_group_name: _group_id = __salt__['boto_secgroup.get_group_id']( - _source_group_name, vpc_id, vpc_id, region, key, keyid, profile + _source_group_name, vpc_id, vpc_name, region, key, keyid, profile ) if not _group_id: msg = ('source_group_name {0} does not map to a valid'
One last bug to squash. Seriously. It's the last one. Ever! - fixed param vpc_id being passed where vpc_name was intended.
saltstack_salt
train
py
be343b4b4485a11ccc5fa130dcece09a0a360f81
diff --git a/src/Sylius/Component/Core/spec/Taxation/OrderShipmentTaxesByZoneApplicatorSpec.php b/src/Sylius/Component/Core/spec/Taxation/OrderShipmentTaxesByZoneApplicatorSpec.php index <HASH>..<HASH> 100644 --- a/src/Sylius/Component/Core/spec/Taxation/OrderShipmentTaxesByZoneApplicatorSpec.php +++ b/src/Sylius/Component/Core/spec/Taxation/OrderShipmentTaxesByZoneApplicatorSpec.php @@ -105,7 +105,7 @@ class OrderShipmentTaxesByZoneApplicatorSpec extends ObjectBehavior $calculator->calculate(1000, $taxRate)->willReturn(0); - $adjustmentsFactory->createWithData(Argument::any())->shouldNotBeCalled(); + $adjustmentsFactory->createWithData(Argument::cetera())->shouldNotBeCalled(); $order->addAdjustment(Argument::any())->shouldNotBeCalled(); $this->apply($order, $zone);
Use the Argument::cetera to match every adjustment factory createWithData method call in the OrderShipmentTaxesByZoneApplicatorSpec.
Sylius_Sylius
train
php
4957d77fff4d2e53181d78928e8bae132a1a453b
diff --git a/shellish/layout/table.py b/shellish/layout/table.py index <HASH>..<HASH> 100644 --- a/shellish/layout/table.py +++ b/shellish/layout/table.py @@ -119,9 +119,13 @@ class Table(object): False to disable this behavior but be warned the table will not look good. """ self.title = title - self.columns_def = columns - self.accessors_def = accessors - self.headers = headers + # Freeze the table definitions... + try: + self.columns_def = columns.copy() if columns is not None else None + except AttributeError: + self.columns_def = tuple(columns) + self.accessors_def = tuple(accessors or ()) + self.headers = tuple(headers or ()) self.width = width self.flex = flex self.file = file if file is not None else sys.stdout @@ -187,7 +191,7 @@ class Table(object): if not self.accessors_def: accessors = [operator.itemgetter(i) for i in range(columns)] else: - accessors = self.accessors_def[:] + accessors = list(self.accessors_def) for i, x in enumerate(accessors): if not callable(x): accessors[i] = operator.itemgetter(x)
Freeze and iterate through table configurations. Grab the headers, columns and accessors definitions at init time and put them into frozen tuples. This lets us grab Sequence type definitions and protects us from being corrupted should the user modify these datastructures after they are passed in to the table code.
mayfield_shellish
train
py
fcbc2e4452aee2804bff8fd81af533293678c278
diff --git a/spec/integration/migration_spec.rb b/spec/integration/migration_spec.rb index <HASH>..<HASH> 100644 --- a/spec/integration/migration_spec.rb +++ b/spec/integration/migration_spec.rb @@ -54,15 +54,20 @@ describe "A Migration" do end adapter = DataMapper::Spec.adapter_name - expected_module = { - :sqlite => lambda { SQL::Sqlite }, - :mysql => lambda { SQL::Mysql }, + + expected_module_lambda = { + :sqlite => lambda { SQL::Sqlite }, + :mysql => lambda { SQL::Mysql }, :postgres => lambda { SQL::Postgres } - }[adapter.to_sym][] + }[adapter.to_sym] + + expected_module = expected_module_lambda ? expected_module_lambda.call : nil - it "should extend with #{expected_module} when adapter is #{adapter}" do - migration = DataMapper::Migration.new(1, :"#{adapter}_adapter_test") { } - (class << migration.adapter; self; end).included_modules.should include(expected_module) + if expected_module + it "should extend with #{expected_module} when adapter is #{adapter}" do + migration = DataMapper::Migration.new(1, :"#{adapter}_adapter_test") { } + (class << migration.adapter; self; end).included_modules.should include(expected_module) + end end end
More robust checks before checking module inclusion Specs for in_memory and yaml still fail, but at least they're running now. Previously they bailed out immediately because of calling [] (lambda.call) on nil. This (like many other dm-migrations specs) looks kinda weird and will probably be refactored soonish
datamapper_dm-migrations
train
rb
163062e0aa54c7e2a62f95a49addc84adc488c06
diff --git a/Services/Navitia.php b/Services/Navitia.php index <HASH>..<HASH> 100644 --- a/Services/Navitia.php +++ b/Services/Navitia.php @@ -199,6 +199,8 @@ class Navitia public function getRouteStopPoints($perimeter, $externalRouteId) { $pathFilter = 'networks/'.$perimeter->getExternalNetworkId().'/routes/'.$externalRouteId; + $fromdatetime = new \DateTime('now'); + $fromdatetime->setTime(4, 0); $query = array( 'api' => 'coverage', @@ -206,7 +208,7 @@ class Navitia 'region' => $perimeter->getExternalCoverageId(), 'action' => 'route_schedules', 'path_filter' => $pathFilter, - 'parameters' => '?depth=0', + 'parameters' => '?depth=0&from_datetime='.$fromdatetime->format('Ymd\THis') ), );
added from_datetime to route_schedules call
CanalTP_MttBundle
train
php
60550ca0ec2d715671a7c8c961465b8197f38199
diff --git a/libraries/joomla/utilities/simplecrypt.php b/libraries/joomla/utilities/simplecrypt.php index <HASH>..<HASH> 100644 --- a/libraries/joomla/utilities/simplecrypt.php +++ b/libraries/joomla/utilities/simplecrypt.php @@ -43,10 +43,7 @@ class JSimpleCrypt } // Build the JCryptKey object. - $key = new JCryptKey; - $key->private = $privateKey; - $key->public = $privateKey; - $key->type = 'simple'; + $key = new JCryptKey('simple', $privateKey, $privateKey); // Setup the JCrypt object. $this->_crypt = new JCrypt(new JCryptCipherSimple, $key);
Fix minor problem in JSimpleCrypt.
joomla_joomla-framework
train
php
ee5762beba4558e1d1d995e4bfceb2dc9d95b16d
diff --git a/sphinxcontrib/swaggerdoc/swaggerv2_doc.py b/sphinxcontrib/swaggerdoc/swaggerv2_doc.py index <HASH>..<HASH> 100644 --- a/sphinxcontrib/swaggerdoc/swaggerv2_doc.py +++ b/sphinxcontrib/swaggerdoc/swaggerv2_doc.py @@ -7,6 +7,7 @@ from past.builtins import basestring from sphinx.locale import _ +from six.moves.urllib import parse as urlparse # Retain Py2 compatibility for urlparse import requests from requests_file import FileAdapter import json @@ -28,10 +29,21 @@ class SwaggerV2DocDirective(Directive): has_content = True def processSwaggerURL(self, url): - s = requests.Session() - s.mount('file://', FileAdapter()) - r = s.get(url) - return r.json() + parsed_url = urlparse.urlparse(url) + if not parsed_url.scheme: # Assume file relative to documentation + env = self.state.document.settings.env + relfn, absfn = env.relfn2path(url) + env.note_dependency(relfn) + + with open(absfn) as fd: + content = fd.read() + + return json.loads(content) + else: + s = requests.Session() + s.mount('file://', FileAdapter()) + r = s.get(url) + return r.json() def create_item(self, key, value): para = nodes.paragraph()
Support references to locally referenced swagger documents. resolves unaguil/sphinx-swaggerdoc#<I>
unaguil_sphinx-swaggerdoc
train
py
df7692d24388ebbca2cad3fa5d44262fd036299d
diff --git a/client.py b/client.py index <HASH>..<HASH> 100644 --- a/client.py +++ b/client.py @@ -180,7 +180,8 @@ def get_screenshots(s, job_id, res_dir=None): _mkdir(output_dir) else: new_direcory = os.path.join(output_dir, res_dir) - _mkdir(new_direcory) + output_dir=new_direcory + _mkdir(output_dir) try: print 'Screenshot job complete. Saving files..' _purge(output_dir, '.diff', 'stale diff')
modify output for saving screens - now it depend from file config name
cmck_pybrowserstack-screenshots
train
py
51e5f6f78a19a24f15d9bfacd9c62299ee9552ab
diff --git a/scripts/python/startSwarm.py b/scripts/python/startSwarm.py index <HASH>..<HASH> 100755 --- a/scripts/python/startSwarm.py +++ b/scripts/python/startSwarm.py @@ -2,10 +2,10 @@ # Start netplugin and netmaster import api.tnode -import time -import sys -import os import argparse +import os +import re +import time # Parse command line args # Create the parser and sub parser @@ -45,6 +45,21 @@ if args.swarm == "swarm_mode": node.runCmdThread(command) time.sleep(15) + + print "Check netplugin is installed and enabled" + out, _, _ = nodes[0].runCmd("docker plugin ls") + + installed = re.search('contiv/v2plugin', out[1]) + + if installed == None: + print "Make target failed: Contiv plugin is not installed" + os._exit(1) + + enabled = re.search('false', out[1]) + if enabled != None: + print "Make target failed: Contiv plugin is installed but disabled" + os._exit(1) + print "################### Swarm Mode is up #####################" else: swarmScript= scriptPath + "/start-swarm.sh"
Add extra validation check for v2plugin (#<I>) * Add extra validation check for v2plugin Currently, demo-v2plugin doesn't check if contiv is installed and enabled. This patchset is to check if v2plugin is installed and enabled at the end of the installation
contiv_netplugin
train
py
5c8c0ccdaf430c3901420815fa30e611964acd91
diff --git a/edx_rest_api_client/client.py b/edx_rest_api_client/client.py index <HASH>..<HASH> 100644 --- a/edx_rest_api_client/client.py +++ b/edx_rest_api_client/client.py @@ -20,7 +20,7 @@ ACCESS_TOKEN_EXPIRED_THRESHOLD_SECONDS = 5 # How long should we wait to connect to the auth service. # https://requests.readthedocs.io/en/master/user/advanced/#timeouts REQUEST_CONNECT_TIMEOUT = 3.05 -REQUEST_READ_TIMEOUT = 1 +REQUEST_READ_TIMEOUT = 5 def user_agent():
Make sure oauth requests do not timeout during read The previous default timeout of 1s was causing issues in communication between services, in particular when the server was under load. This timeout is configurable by passing a `timeout=...` keyword argument to the OAuthClient constructor; but that requires patching every IDA. It makes more sense to define a comfortable timeout that avoids the need to override for each IDA. See these conversations: <URL>
edx_edx-rest-api-client
train
py
939e1356e1bc450112c3a7602369d55c5e63bbcc
diff --git a/test/test_socks.py b/test/test_socks.py index <HASH>..<HASH> 100644 --- a/test/test_socks.py +++ b/test/test_socks.py @@ -738,7 +738,7 @@ class SocksErrorTests(unittest.TestCase): self.assertEquals(error.message, message) self.assertEquals(str(error), message) - def test_socks_error_factory(self): + def test_error_factory(self): for cls in socks.SocksError.__subclasses__(): error = socks._create_socks_error(cls.code) self._check_error(error, cls, cls.code, cls.message)
Make method names of the `SocksErrorTests` consistent
meejah_txtorcon
train
py
5442bc4925f019a8a2535971d3164827e3c38448
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -41,6 +41,7 @@ module.exports = function(app, dcPath) { dcFile, 'run', '--service-ports', + '--rm', app, cmd ].join(' ');
[#3] add the --rm option to remove containers on exit
markbirbeck_docker-compose-run
train
js
b0a496dd23ffa127451ddfae71b62a76c00f6e97
diff --git a/lib/platform.rb b/lib/platform.rb index <HASH>..<HASH> 100644 --- a/lib/platform.rb +++ b/lib/platform.rb @@ -59,52 +59,4 @@ module Ronin end end - - class Linux < Platform - - def initialize(version,arch) - super('Linux',version,arch) - end - - end - - class FreeBSD < Platform - - def initialize(version,arch) - super('FreeBSD',version,arch) - end - - end - - class OpenBSD < Platform - - def initialize(version,arch) - super('OpenBSD',version,arch) - end - - end - - class NetBSD < Platform - - def initialize(version,arch) - super('NetBSD',version,arch) - end - - end - - class Windows < Platform - - def initialize(version,arch) - super('Windows',version,arch) - end - - end - - class OSX < Platform - - def initialize(version,arch) - super('OSX',version,arch) - end - - end end
* Removed extra-classes.
ronin-ruby_ronin
train
rb
f0efda482ebf0d76bc3478257655a2e079c11cd7
diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/Eloquent/Builder.php +++ b/src/Illuminate/Database/Eloquent/Builder.php @@ -34,8 +34,8 @@ class Builder { * @var array */ protected $passthru = array( - 'toSql', 'lists', 'insert', 'insertGetId', 'pluck', - 'count', 'min', 'max', 'avg', 'sum', 'exists', + 'toSql', 'lists', 'insert', 'insertGetId', 'pluck', 'count', + 'min', 'max', 'avg', 'sum', 'exists', 'getBindings', ); /**
Pass getBindings through to querybuilder
laravel_framework
train
php
c2aa9fdaf5b03996f715ecfd27788145cc09c075
diff --git a/lib/yap/shell/version.rb b/lib/yap/shell/version.rb index <HASH>..<HASH> 100644 --- a/lib/yap/shell/version.rb +++ b/lib/yap/shell/version.rb @@ -1,5 +1,5 @@ module Yap module Shell - VERSION = "0.4.6" + VERSION = "0.4.7" end end
Bumping version to <I>
zdennis_yap-shell-core
train
rb
b4125f819d9d1aa0c0138318dc7509e84d55a731
diff --git a/aviator.js b/aviator.js index <HASH>..<HASH> 100644 --- a/aviator.js +++ b/aviator.js @@ -436,7 +436,7 @@ Navigator.prototype = { pathname, uri; - if (ev.metaKey || ev.ctrlKey) return; + if (ev.button === 1 || ev.metaKey || ev.ctrlKey) return; // Sub optimal. It itererates through all ancestors on every single click :/ while (target) {
Rebuild the aviator.js file
swipely_aviator
train
js
459b15980a0a7b160dca887e9406537d07088c40
diff --git a/src/main/java/common/CharsetDetector.java b/src/main/java/common/CharsetDetector.java index <HASH>..<HASH> 100644 --- a/src/main/java/common/CharsetDetector.java +++ b/src/main/java/common/CharsetDetector.java @@ -1,5 +1,26 @@ package common; +/*- + * #%L + * FOKProjects Common + * %% + * Copyright (C) 2016 - 2017 Frederik Kammel + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream;
Added the license header to the new class
vatbub_common
train
java
e20df5df7a1151cee43b18664a651391fdceb81f
diff --git a/scripts/run_pylint.py b/scripts/run_pylint.py index <HASH>..<HASH> 100644 --- a/scripts/run_pylint.py +++ b/scripts/run_pylint.py @@ -51,6 +51,8 @@ TEST_DISABLED_MESSAGES = [ 'import-error', 'invalid-name', 'missing-docstring', + 'missing-raises-doc', + 'missing-returns-doc', 'no-init', 'no-self-use', 'superfluous-parens',
Update disabled messages from new pylint.
googleapis_google-cloud-python
train
py
870666ae95bc7a5247a4223e8cc35771eeb50ffd
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ setup( packages=find_packages(), - install_requires=['aioredis'], + install_requires=['aioredis', 'attrs'], setup_requires=['pytest-runner'], tests_require=['pytest', 'pytest-asyncio', 'pytest-mock', 'pytest-cov'] )
Adding attrs to requirements in setup.py
joanvila_aioredlock
train
py
0c6a85d5f7ef3eb90fdb00394c9c8df3078f8c6f
diff --git a/fundingmanager_test.go b/fundingmanager_test.go index <HASH>..<HASH> 100644 --- a/fundingmanager_test.go +++ b/fundingmanager_test.go @@ -166,7 +166,7 @@ func createTestWallet(cdb *channeldb.DB, netParams *chaincfg.Params, ChainIO: bio, FeeEstimator: estimator, NetParams: *netParams, - DefaultConstraints: defaultChannelConstraints, + DefaultConstraints: defaultBtcChannelConstraints, }) if err != nil { return nil, err
fundingmanager_test: use renamed defaultBtcChannelConstraints const
lightningnetwork_lnd
train
go
1a17d8b535356b5e1874d4e9a808f190fa662e29
diff --git a/src/test/java/net/bramp/ffmpeg/FFmpegExecutorTest.java b/src/test/java/net/bramp/ffmpeg/FFmpegExecutorTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/net/bramp/ffmpeg/FFmpegExecutorTest.java +++ b/src/test/java/net/bramp/ffmpeg/FFmpegExecutorTest.java @@ -79,15 +79,6 @@ public class FFmpegExecutorTest { } protected void runAndWait(FFmpegJob job) throws ExecutionException, InterruptedException { - Future<?> future = executor.submit(job); - - // TODO Why do we loop, and not future.get()? - while (!future.isDone()) { - try { - future.get(100, TimeUnit.MILLISECONDS); - break; - } catch (TimeoutException e) { - } - } + executor.submit(job).get(); } }
Minor change to FFmpegExecutorTest to not loop while waiting.
bramp_ffmpeg-cli-wrapper
train
java
404c15fb59158425bfc0a12d09c5b38da5b72cf9
diff --git a/build/build.transforms.js b/build/build.transforms.js index <HASH>..<HASH> 100644 --- a/build/build.transforms.js +++ b/build/build.transforms.js @@ -10,7 +10,7 @@ const { writeFile } = require('./build.utils') function relative (name) { - return path.relative(root, name) + return path.relative(root, name).split('\\').join('/') } function getWithoutExtension (filename) {
Fix build of imports file to use unix separator (#<I>)
quasarframework_quasar
train
js
c9affc6de7c6c8e763723f100c6cfa9e31ab7a0c
diff --git a/Model/Service/CallbackService.php b/Model/Service/CallbackService.php index <HASH>..<HASH> 100755 --- a/Model/Service/CallbackService.php +++ b/Model/Service/CallbackService.php @@ -170,11 +170,12 @@ class CallbackService { // Update order status $order->setStatus($this->gatewayConfig->getOrderStatusAuthorized()); - // Send the email - $this->orderSender->send($order); - - // Set email sent - $order->setEmailSent(1); + // Send the email only for Hosted integration + // Frames is using the core placeOrder email sender and doesn't need manual action + if ($this->gatewayConfig->isHostedIntegration()) { + $this->orderSender->send($order); + $order->setEmailSent(1); + } // Comments override if ($overrideComments) {
Order email fix Fixed an issue creating a double confirmation email with Frames.
checkout_checkout-magento2-plugin
train
php
c4ad29692c635fb529efba89c1f27a335ac261ff
diff --git a/internal/validate/schema_props.go b/internal/validate/schema_props.go index <HASH>..<HASH> 100644 --- a/internal/validate/schema_props.go +++ b/internal/validate/schema_props.go @@ -180,12 +180,3 @@ func (s *schemaPropsValidator) Validate(data interface{}) *Result { mainResult.Inc() return mainResult } - -// IsZero returns true when the value is a zero for the type -func isZero(data reflect.Value) bool { - if !data.CanInterface() { - return true - } - tpe := data.Type() - return reflect.DeepEqual(data.Interface(), reflect.Zero(tpe).Interface()) -}
fixes #<I> separate listener creation from serving
go-openapi_validate
train
go
fd7e06daa4f039576e3924383e17fd4bdcabbdf9
diff --git a/src/components/input/QInput.js b/src/components/input/QInput.js index <HASH>..<HASH> 100644 --- a/src/components/input/QInput.js +++ b/src/components/input/QInput.js @@ -29,11 +29,12 @@ export default { decimals: Number, step: Number, upperCase: Boolean, - lowerCase: Boolean + lowerCase: Boolean, + initialShowPassword: Boolean }, data () { return { - showPass: false, + showPass: this.initialShowPassword, showNumber: true, model: this.value, watcher: null, @@ -358,7 +359,7 @@ export default { [].concat(this.$slots.before).concat([ this.isTextarea ? this.__getTextarea(h) : this.__getInput(h), - (!this.disable && this.isPassword && !this.noPassToggle && this.length && h(QIcon, { + (!this.disable && this.isPassword && !this.noPassToggle && (this.initialShowPassword || this.length) && h(QIcon, { slot: 'after', staticClass: 'q-if-control', props: {
Allow password to be shown by default (#<I>) * Allow password to be shown by default Usage `<q-input v-model="user.password" type="password" :show-password="true" float-label="Password" />` this change will allow a password field and show/hide icon to be visible by default. This might be good for an admin panel where you have to make a user account and send that user the credentials. * Update QInput.js
quasarframework_quasar
train
js
9902043878e8218460e50c548048fb263cc2e25a
diff --git a/pipeline/compress/compress.go b/pipeline/compress/compress.go index <HASH>..<HASH> 100644 --- a/pipeline/compress/compress.go +++ b/pipeline/compress/compress.go @@ -44,9 +44,9 @@ func create(system, arch string, config config.ProjectConfig) error { gw := gzip.NewWriter(file) tw := tar.NewWriter(gw) defer func() { - _ = file.Close() - _ = gw.Close() _ = tw.Close() + _ = gw.Close() + _ = file.Close() }() for _, f := range config.Files { if err := addFile(tw, f, f); err != nil {
Reorder `defer`'d closers Commit <URL> whereby the tarball is closed before data is completely written, thus breaking the release package
goreleaser_goreleaser
train
go
1dcfd2086ebcd785df949ba5157c9bdaaa8b344c
diff --git a/go/porcelain/site.go b/go/porcelain/site.go index <HASH>..<HASH> 100644 --- a/go/porcelain/site.go +++ b/go/porcelain/site.go @@ -51,12 +51,15 @@ func (n *Netlify) CreateSite(ctx context.Context, site *models.Site, configureDN } // UpdateSite modifies an existent site. -func (n *Netlify) UpdateSite(ctx context.Context, site *models.Site) error { +func (n *Netlify) UpdateSite(ctx context.Context, site *models.Site) (*models.Site, error) { authInfo := context.GetAuthInfo(ctx) params := operations.NewUpdateSiteParams().WithSite(site).WithSiteID(site.ID) - _, err := n.Netlify.Operations.UpdateSite(params, authInfo) - return err + resp, err := n.Netlify.Operations.UpdateSite(params, authInfo) + if err != nil { + return nil, err + } + return resp.Payload, nil } // ConfigureSiteTLS provisions a TLS certificate for a site with a custom domain.
Make site update to return the updated site. So we can show up to date settings.
netlify_open-api
train
go
5b7cad660d1c534e0d0af1608d566b516df415e0
diff --git a/extensions/waitForSelector/waitForSelector.js b/extensions/waitForSelector/waitForSelector.js index <HASH>..<HASH> 100644 --- a/extensions/waitForSelector/waitForSelector.js +++ b/extensions/waitForSelector/waitForSelector.js @@ -4,15 +4,23 @@ /* global document: true */ 'use strict'; -exports.version = '0.1'; +exports.version = '0.2'; function checkSelector(phantomas, selector) { var res = phantomas.evaluate(function(selector) { - try { - return document.querySelector(selector) !== null; - } catch (ex) { - return ex.toString(); - } + (function(phantomas) { + try { + var result; + + phantomas.spyEnabled(false, 'checking the selector'); + result = (document.querySelector(selector) !== null); + phantomas.spyEnabled(true); + + return result; + } catch (ex) { + return ex.toString(); + } + }(window.__phantomas)); }, selector); phantomas.log('Selector: query for "%s" returned %j', selector, res);
waitForSelector: use phantomas.spyEnabled()
macbre_phantomas
train
js
76ee13fbcf801c9cbbf8f3d86e24827ac790882d
diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/tomcat/TomcatMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/tomcat/TomcatMetrics.java index <HASH>..<HASH> 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/tomcat/TomcatMetrics.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/tomcat/TomcatMetrics.java @@ -283,6 +283,7 @@ public class TomcatMetrics implements MeterBinder { * </ul> * * @param jmxDomain JMX domain to be used + * @since 1.0.11 */ public void setJmxDomain(String jmxDomain) { this.jmxDomain = jmxDomain;
Add Javadoc since to TomcatMetrics.setJmxDomain() (#<I>)
micrometer-metrics_micrometer
train
java
c37513b9bef594b6bdfb21cb5c42dcd722061221
diff --git a/bhmm/estimators/maximum_likelihood.py b/bhmm/estimators/maximum_likelihood.py index <HASH>..<HASH> 100644 --- a/bhmm/estimators/maximum_likelihood.py +++ b/bhmm/estimators/maximum_likelihood.py @@ -278,6 +278,10 @@ class MaximumLikelihoodEstimator(object): C = np.zeros((self._nstates, self._nstates)) for k in range(len(self._observations)): # update count matrix C += count_matrices[k] + + # trim counts below machine precision + C[C < 1e-16] = 0 + return C def _update_model(self, gammas, count_matrices, maxiter=10000000):
[estimators.MaximumLikelihoodEstimator] fix count matrix summation for numbers < 1e-<I> Disconnected 2 state system could not detect disconnected T matrix but instead returned implied timescales = inf and T matrix off diagonal entries ~1e-<I>. Cf. <URL>
bhmm_bhmm
train
py
99d176b45a73149466300086878eb7ed5418bf21
diff --git a/modules/Cockpit/AuthController.php b/modules/Cockpit/AuthController.php index <HASH>..<HASH> 100755 --- a/modules/Cockpit/AuthController.php +++ b/modules/Cockpit/AuthController.php @@ -20,7 +20,7 @@ class AuthController extends \LimeExtra\Controller { $user = $app->module('cockpit')->getUser(); if (!$user) { - $app->reroute('/auth/login?to='.$this->app->retrieve('route')); + $app->reroute('/auth/login?to='.$app->retrieve('route')); $app->stop(); }
fixed "Call to a member function retrieve() on null" on login page
agentejo_cockpit
train
php
6b3acd21a6bf23a5e3a9805cd8da878b926c1225
diff --git a/externs/html5.js b/externs/html5.js index <HASH>..<HASH> 100644 --- a/externs/html5.js +++ b/externs/html5.js @@ -594,6 +594,12 @@ Window.prototype.openDatabase = function(name, version, description, size) {}; HTMLImageElement.prototype.complete; /** + * @type {string} + * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#attr-img-crossorigin + */ +HTMLImageElement.prototype.crossOrigin; + +/** * The postMessage method (as defined by HTML5 spec and implemented in FF3). * @param {*} message * @param {string|Array} targetOrigin The target origin in the 2-argument
Adds the HTMLImageElement 'crossOrigin' property to the externs. This is a new tag being added to the spec to help tighten security regarding handling of cross-domain resources. More information here: <URL> Revision created by MOE tool push_codebase. MOE_MIGRATION=<I> git-svn-id: <URL>
google_closure-compiler
train
js
81da9f5b3a0b00bc22039cd377237835da4434eb
diff --git a/pep/project.py b/pep/project.py index <HASH>..<HASH> 100644 --- a/pep/project.py +++ b/pep/project.py @@ -1119,8 +1119,9 @@ def check_sample_sheet(sample_file, dtype=str): missing = set(req) - set(df.columns) if len(missing) != 0: raise ValueError( - "Annotation sheet ('{}') is missing column(s): {}; has: {}". - format(sample_file, missing, df.columns)) + "Annotation sheet ('{}') is missing column(s):\n{}\nIt has: {}". + format(sample_file, "\n".join(missing), + ", ".join(list(df.columns)))) return df
better messaging for case of insufficient columns in annotations sheet
pepkit_peppy
train
py
d4029bd0144312ed1d6747098ac385851cbefe66
diff --git a/pybomb/clients/base_client.py b/pybomb/clients/base_client.py index <HASH>..<HASH> 100644 --- a/pybomb/clients/base_client.py +++ b/pybomb/clients/base_client.py @@ -99,7 +99,7 @@ class BaseClient(object): """ return ','.join( ['{0}:{1}'.format(key, value) for - key, value in filter_by.iteritems() if value is not None] + key, value in filter_by.items() if value is not None] ) def _query(self, params): @@ -133,7 +133,7 @@ class BaseClient(object): try: response.raise_for_status() except requests.exceptions.HTTPError as http_error: - raise pybomb.exceptions.BadRequestException(http_error.message) + raise pybomb.exceptions.BadRequestException(str(http_error)) response_data = response.json() if response_data['status_code'] != self.RESPONSE_STATUS_OK:
Fix base_client to work with python 3
steveYeah_PyBomb
train
py
707eb18dc23bd07f38b87cd25efabbf06290361e
diff --git a/hangups/__main__.py b/hangups/__main__.py index <HASH>..<HASH> 100644 --- a/hangups/__main__.py +++ b/hangups/__main__.py @@ -270,6 +270,9 @@ class ConversationWidget(urwid.WidgetWrap): def _on_return(self, text): """Called when the user presses return on the send message widget.""" + # Ignore if the user hasn't typed a message. + if len(text) == 0: + return # XXX: Exception handling here is still a bit broken. Uncaught # exceptions in _on_message_sent will only be logged. self._conversation.send_message(text).add_done_callback( diff --git a/hangups/client.py b/hangups/client.py index <HASH>..<HASH> 100644 --- a/hangups/client.py +++ b/hangups/client.py @@ -189,6 +189,8 @@ class Conversation(object): def send_message(self, text): """Send a message to this conversation. + text may not be empty. + Raises hangups.NetworkError if the message can not be sent. """ yield self._client.sendchatmessage(self._id, text) @@ -763,6 +765,8 @@ class Client(object): is_underlined=False): """Send a chat message to a conversation. + message may not be empty. + Raises hangups.NetworkError if the message can not be sent. """ client_generated_id = random.randint(0, 2**32)
Don't try to send empty chat messages
tdryer_hangups
train
py,py
84b1b009cf55e028dbf7e66e3687d856e5f59377
diff --git a/pythran/unparse.py b/pythran/unparse.py index <HASH>..<HASH> 100644 --- a/pythran/unparse.py +++ b/pythran/unparse.py @@ -482,7 +482,7 @@ class Unparser: binop = {"Add": "+", "Sub": "-", "Mult": "*", "Div": "/", "Mod": "%", "LShift": "<<", "RShift": ">>", "BitOr": "|", "BitXor": "^", - "BitAnd": "&", "FloorDiv": "//", "Pow": "**"} + "BitAnd": "&", "FloorDiv": "//", "Pow": "**", "MatMult": "@"} def _BinOp(self, t): self.write("(")
Add support for matplut in unparse
serge-sans-paille_pythran
train
py
b8a0557132007b91378fac4c56fdb2e5fb9ff479
diff --git a/pyfolio/timeseries.py b/pyfolio/timeseries.py index <HASH>..<HASH> 100644 --- a/pyfolio/timeseries.py +++ b/pyfolio/timeseries.py @@ -551,7 +551,7 @@ def rolling_regression(returns, factor_returns, rolling_window=APPROX_BDAYS_PER_MONTH * 6, nan_threshold=0.1): """ - Computes rolling single factor betas using a multivariate linear regression + Computes rolling factor betas using a multivariate linear regression (separate linear regressions is problematic because the factors may be confounded).
DOC: cleared up confusing regression terminology
quantopian_pyfolio
train
py
25679a63a27b55f6af70f37e9d4563ee6b97bc4c
diff --git a/lib/coach/handler.rb b/lib/coach/handler.rb index <HASH>..<HASH> 100644 --- a/lib/coach/handler.rb +++ b/lib/coach/handler.rb @@ -93,7 +93,11 @@ module Coach end def middleware - @middleware ||= ActiveSupport::Dependencies.constantize(name) + @middleware ||= if ActiveSupport::Dependencies.respond_to?(:constantize) + ActiveSupport::Dependencies.constantize(name) + else + name.constantize + end end # Remove middleware that have been included multiple times with the same
Remove reference to ActiveSupport::Dependencies This is removed in rails 7 due to the classic autoloader being removed - see <URL>
gocardless_coach
train
rb
874c8cad76f8bb0a0ee59cf7f749016e7b4cfcf4
diff --git a/client_test.go b/client_test.go index <HASH>..<HASH> 100644 --- a/client_test.go +++ b/client_test.go @@ -169,7 +169,7 @@ func TestPipelineClientIssue832(t *testing.T) { }() select { - case <-time.After(time.Second): + case <-time.After(time.Second * 2): t.Fatal("PipelineClient did not restart worker") case <-done: } @@ -2580,7 +2580,7 @@ func TestHostClientMaxConnWaitTimeoutSuccess(t *testing.T) { return ln.Dial() }, MaxConns: 1, - MaxConnWaitTimeout: 200 * time.Millisecond, + MaxConnWaitTimeout: time.Second, } for i := 0; i < 5; i++ { @@ -2618,7 +2618,7 @@ func TestHostClientMaxConnWaitTimeoutSuccess(t *testing.T) { } select { case <-serverStopCh: - case <-time.After(time.Second): + case <-time.After(time.Second * 5): t.Fatalf("timeout") }
Increase timeouts for Windows github actions
valyala_fasthttp
train
go
6426f55111d30b25eaf294ed6188155340084c99
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -27,9 +27,9 @@ setup_options = dict( # For these actions, NumPy is not required. We want them to succeed without, # for example when pip is used to install seqlearn without NumPy present. -NO_NUMPY_ACTIONS = ('egg_info', '--version', 'clean') -if len(sys.argv) < 2 or (not sys.argv[1:].startswith('--help') - and sys.argv[1] not in NO_NUMPY_ACTIONS): +NO_NUMPY_ACTIONS = ('--help-commands', 'egg_info', '--version', 'clean') +if not (len(sys.argv) >= 2 and ('--help' in sys.argv[1:] + or sys.argv[1] in NO_NUMPY_ACTIONS)): import numpy setup_options['include_dirs'] = [numpy.get_include()]
FIX setup.py numpy-awareness XXX [@larsmans]: I screwed up this commit by @kmike, so cherry-picking it again.
larsmans_seqlearn
train
py
3149c975409aad4f35104899f6697f0b7ea996d9
diff --git a/PAM.py b/PAM.py index <HASH>..<HASH> 100644 --- a/PAM.py +++ b/PAM.py @@ -163,6 +163,7 @@ PAM_TTY = 3 PAM_USER = 2 PAM_USER_PROMPT = 9 PAM_USER_UNKNOWN = 10 +PAM_XDISPLAY = 11 class error(Exception): # noqa: N801 @@ -282,7 +283,7 @@ class pam(object): # noqa: N801 self.user = item elif item_type == PAM_SERVICE: self.service = item - elif item_type not in (PAM_TTY,): + elif item_type not in (PAM_TTY, PAM_XDISPLAY): raise TypeError("bad parameter") item = c_char_p(self.__securestring(item)) retval = pam_set_item(self.pamh, int(item_type), cast(item, c_void_p)) diff --git a/pam.py b/pam.py index <HASH>..<HASH> 100644 --- a/pam.py +++ b/pam.py @@ -96,6 +96,7 @@ class pam(): # set the TTY, needed when pam_securetty is used and the username root is used p.set_item(PAM.PAM_TTY, ctty) + p.set_item(PAM.PAM_XDISPLAY, ctty) try: p.authenticate() p.acct_mgmt()
Add PAM_XDISPLAY
FirefighterBlu3_python-pam
train
py,py
b1842a979d1fa46b04b39cc4a38fe3c826c733b5
diff --git a/shared/container.go b/shared/container.go index <HASH>..<HASH> 100644 --- a/shared/container.go +++ b/shared/container.go @@ -133,11 +133,10 @@ func IsDeviceID(value string) error { return nil } -// IsRootDiskDevice returns true if the given device representation is -// configured as root disk for a container. It typically get passed a specific -// entry of api.Container.Devices. +// IsRootDiskDevice returns true if the given device representation is configured as root disk for +// a container. It typically get passed a specific entry of api.Container.Devices. func IsRootDiskDevice(device map[string]string) bool { - if device["type"] == "disk" && device["path"] == "/" && device["source"] == "" { + if device["type"] == "disk" && device["path"] == "/" && device["source"] == "" && device["pool"] != "" { return true }
shared/container: Updates IsRootDiskDevice to use same definition of rootfs as container_lxc
lxc_lxd
train
go
d66bb00c5d2b42e04659452e8c969dc6fff02872
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb index <HASH>..<HASH> 100755 --- a/spec/unit/property_spec.rb +++ b/spec/unit/property_spec.rb @@ -141,17 +141,18 @@ describe Puppet::Property do end describe "when shadowing metaparameters" do - before :each do - @shadow_class = Class.new(Puppet::Property) do + let :shadow_class do + shadow_class = Class.new(Puppet::Property) do @name = :alias end - @shadow_class.initvars + shadow_class.initvars + shadow_class end it "should create an instance of the metaparameter at initialization" do Puppet::Type.metaparamclass(:alias).expects(:new).with(:resource => resource) - @shadow_class.new :resource => resource + shadow_class.new :resource => resource end it "should munge values using the shadow's munge method" do @@ -160,7 +161,7 @@ describe Puppet::Property do shadow.expects(:munge).with "foo" - property = @shadow_class.new :resource => resource + property = shadow_class.new :resource => resource property.munge("foo") end end
Property Spec cleanup: last let method extraction. This helps eliminate member variables in tests, making it easier to see where state is or isn't shared between tests.
puppetlabs_puppet
train
rb
23b97e3e7de9e2208ff0d09b50768d4dbffd6faf
diff --git a/src/main/java/com/github/underscore/U.java b/src/main/java/com/github/underscore/U.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/github/underscore/U.java +++ b/src/main/java/com/github/underscore/U.java @@ -3149,6 +3149,10 @@ public class U<T> { return reference; } + public static boolean nonNull(Object obj) { + return obj != null; + } + public static <T> T defaultTo(T value, T defaultValue) { if (value == null) { return defaultValue; diff --git a/src/test/java/com/github/underscore/UnderscoreTest.java b/src/test/java/com/github/underscore/UnderscoreTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/github/underscore/UnderscoreTest.java +++ b/src/test/java/com/github/underscore/UnderscoreTest.java @@ -448,6 +448,12 @@ _.elementAtOrNull(arr, 3) // => null } @Test + public void nonNull() { + assertFalse(U.nonNull(null)); + assertTrue(U.nonNull("")); + } + + @Test public void defaultTo() { assertNull(U.defaultTo(null, null)); }
Add support for U.nonNull(object).
javadev_underscore-java
train
java,java
938318219c11feb963ca93c49ef9426a9758ae69
diff --git a/packages/openneuro-server/graphql/schema.js b/packages/openneuro-server/graphql/schema.js index <HASH>..<HASH> 100644 --- a/packages/openneuro-server/graphql/schema.js +++ b/packages/openneuro-server/graphql/schema.js @@ -149,7 +149,7 @@ const typeDefs = ` # File tree input FileTree { name: ID! # directory name (or empty string for root) - path: String! # path to file + path: String # path to file files: [Upload!] # files within the directory directories: [FileTree] # directories within the directory }
update schema to account for client FileTree type
OpenNeuroOrg_openneuro
train
js
fe6ae2065277035ec6685a89bb807eaa377858f9
diff --git a/cpu/facts/facts.go b/cpu/facts/facts.go index <HASH>..<HASH> 100644 --- a/cpu/facts/facts.go +++ b/cpu/facts/facts.go @@ -257,7 +257,8 @@ func (prof *Profiler) Get() (facts *Facts, err error) { } continue } - if v == 'b' { // bogomips + // also check 2nd name pos for o as some output also have a bugs line. + if v == 'b' && prof.Val[1] == 'o' { // bogomips f, err := strconv.ParseFloat(string(prof.Val[nameLen:]), 32) if err != nil { return nil, &joe.ParseError{Info: string(prof.Val[:nameLen]), Err: err}
add check of 2nd char in name for bogomips as some systems also have a "bugs" line
mohae_joefriday
train
go
00a4720069f345d240b3b15866fde3c384794b5a
diff --git a/ipyrad/assemble/util.py b/ipyrad/assemble/util.py index <HASH>..<HASH> 100644 --- a/ipyrad/assemble/util.py +++ b/ipyrad/assemble/util.py @@ -244,6 +244,10 @@ def merge_pairs(data, files_to_merge, merged_file, merge): raise IPyradWarningExit(" Attempting to merge file that "\ "doesn't exist - {}.".format(f)) + ## If it already exists, clean up the old merged file + if os.path.exists(merged_file): + os.remove(merged_file) + ## if merge then catch nonmerged in a separate file if merge: nonmerged1 = tempfile.NamedTemporaryFile(mode='wb',
Fixed a nasty bug in merge_pairs that resulted in constant reconcatenation to the merged outfile
dereneaton_ipyrad
train
py
83dc36945c77c347ebab630dd4ee4ecd3d8f0da3
diff --git a/gears/asset_attributes.py b/gears/asset_attributes.py index <HASH>..<HASH> 100644 --- a/gears/asset_attributes.py +++ b/gears/asset_attributes.py @@ -19,8 +19,8 @@ class AssetAttributes(object): @cached_property def path_without_extensions(self): - if self.extensions: - return self.path[:-len(''.join(self.extensions))] + if self.suffix: + return self.path[:-len(''.join(self.suffix))] return self.path @cached_property diff --git a/tests/test_asset_attributes.py b/tests/test_asset_attributes.py index <HASH>..<HASH> 100644 --- a/tests/test_asset_attributes.py +++ b/tests/test_asset_attributes.py @@ -36,6 +36,9 @@ class AssetAttributesTests(TestCase): check('js/readme', 'js/readme') check('js/app.min.js.coffee', 'js/app') + self.environment.mimetypes.register('.js', 'application/javascript') + check('js/app.min.js.coffee', 'js/app.min') + def test_search_paths(self): def check(path, expected_result):
path_without_extensions removes only suffix now Earlier it removed all extensions from asset path, so result for 'jquery' and 'jquery.min' was the same.
gears_gears
train
py,py
54438e3ae5bb1f263f9d55c80dead906b7630834
diff --git a/system/Commands/Utilities/Routes.php b/system/Commands/Utilities/Routes.php index <HASH>..<HASH> 100644 --- a/system/Commands/Utilities/Routes.php +++ b/system/Commands/Utilities/Routes.php @@ -97,7 +97,7 @@ class Routes extends BaseCommand $tbody[] = [ strtoupper($method), $route, - is_string($handler) ? $handler : 'Closure', + is_string($handler) ? $handler : '(Closure)', ]; } } diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index <HASH>..<HASH> 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -110,7 +110,7 @@ final class CommandTest extends CIUnitTestCase { command('routes'); - $this->assertStringContainsString('| Closure', $this->getBuffer()); + $this->assertStringContainsString('| (Closure)', $this->getBuffer()); $this->assertStringContainsString('| Route', $this->getBuffer()); $this->assertStringContainsString('| testing', $this->getBuffer()); $this->assertStringContainsString('\\TestController::index', $this->getBuffer());
Feature: "spark routes" closure. Decoration.
codeigniter4_CodeIgniter4
train
php,php
0c067b17054acc6be7e464d704728635ef626d38
diff --git a/chef/lib/chef/shell_out.rb b/chef/lib/chef/shell_out.rb index <HASH>..<HASH> 100644 --- a/chef/lib/chef/shell_out.rb +++ b/chef/lib/chef/shell_out.rb @@ -288,6 +288,10 @@ class Chef File.umask(umask) if umask end + def set_cwd + Dir.chdir(cwd) if cwd + end + def initialize_ipc @stdout_pipe, @stderr_pipe, @process_status_pipe = IO.pipe, IO.pipe, IO.pipe @process_status_pipe.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) @@ -381,6 +385,7 @@ class Chef set_group set_environment set_umask + set_cwd begin command.kind_of?(Array) ? exec(*command) : exec(command)
CHEF-<I>: chdir to :cwd arg before running a command
chef_chef
train
rb
f2dac0bc86c6ddccef0dbf974847429471c5f283
diff --git a/pyinotify.py b/pyinotify.py index <HASH>..<HASH> 100755 --- a/pyinotify.py +++ b/pyinotify.py @@ -711,6 +711,12 @@ class _SysProcessEvent(_ProcessEvent): # to provide as additional information to the IN_MOVED_TO event # the original pathname of the moved file/directory. to_append['src_pathname'] = mv_[0] + elif raw_event.mask & IN_ISDIR and watch_.auto_add: + # We got a diretory that's "moved in" from an unknown source and + # auto_add is enabled. Manually add watches to the inner subtrees. + self._watch_manager.add_watch(dst_path, watch_.mask, + proc_fun=watch_.proc_fun, + rec=True, auto_add=True) return self.process_default(raw_event, to_append) def process_IN_MOVE_SELF(self, raw_event): @@ -731,7 +737,7 @@ class _SysProcessEvent(_ProcessEvent): if mv_: dest_path = mv_[0] watch_.path = dest_path - # The next loop renames all watches. + # The next loop renames all watches with src_path as base path. # It seems that IN_MOVE_SELF does not provide IN_ISDIR information # therefore the next loop is iterated even if raw_event is a file. for w in self._watch_manager.watches.itervalues():
Automatically watch a non watched tree moved to a watched directory with flag auto_add activated (contributed by John Feuerstein <EMAIL>).
seb-m_pyinotify
train
py
fd01a788d84289d0858f0632d42f5fd2467ac146
diff --git a/emoji/urls.py b/emoji/urls.py index <HASH>..<HASH> 100644 --- a/emoji/urls.py +++ b/emoji/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls import patterns, url +from django.conf.urls import url from .views import EmojiJSONListView -urlpatterns = patterns('', +urlpatterns = [ url(r'^all.json$', EmojiJSONListView.as_view(), name='list.json'), -) +]
Start getting ready for <I>
gaqzi_django-emoji
train
py
049b46e6092b351173eacd92dba921539f44e7ba
diff --git a/helpers/array.php b/helpers/array.php index <HASH>..<HASH> 100644 --- a/helpers/array.php +++ b/helpers/array.php @@ -89,7 +89,7 @@ if (!function_exists('in_array_multi')) { if (!function_exists('arrayExtractProperty')) { function arrayExtractProperty(array $aInput, $sProperty) { - return ArrayHelper::arrayExtractProperty($aInput, $sProperty); + return ArrayHelper::extract($aInput, $sProperty); } } diff --git a/src/Common/Helper/ArrayHelper.php b/src/Common/Helper/ArrayHelper.php index <HASH>..<HASH> 100644 --- a/src/Common/Helper/ArrayHelper.php +++ b/src/Common/Helper/ArrayHelper.php @@ -277,7 +277,7 @@ class ArrayHelper * * @return array */ - public static function arrayExtractProperty(array $aInput, $sProperty) + public static function extract(array $aInput, $sProperty) { $aOutput = []; foreach ($aInput as $mItem) {
Renamed arrayExtractProperty method
nails_common
train
php,php
c83aa3b4a32eafd1281c7e473931e458f0006228
diff --git a/modules/utils/DateTime.js b/modules/utils/DateTime.js index <HASH>..<HASH> 100644 --- a/modules/utils/DateTime.js +++ b/modules/utils/DateTime.js @@ -568,14 +568,13 @@ DateTime.createFromTime = function(time, guessDate) { } } - // PM: after 12 PM - else if ( ns >= 43200 ) { - // Assume early morning times (before 4 AM) are next day - if ( ts <= 14400 ) { + // PM: after 4 PM + else if ( ns >= 57600 ) { + // Assume early morning times (before 8 AM) are next day + if ( ts <= 28800 ) { delta = +1; } } - } // Create the DateTime
DateTime: createFromTime guessDate increase time ranges to guess next day
right-track_right-track-core
train
js
6bfc2fb00cc5b09cb13b21987ee6c1beec484d86
diff --git a/session/manager.go b/session/manager.go index <HASH>..<HASH> 100644 --- a/session/manager.go +++ b/session/manager.go @@ -102,6 +102,11 @@ func (bw *bufferedResponseWriter) Flush() { } } +func (bw *bufferedResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { + hj := bw.ResponseWriter.(http.Hijacker) + return hj.Hijack() +} + func defaultErrorFunc(w http.ResponseWriter, r *http.Request, err error) { log.Output(2, err.Error()) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
implement Hijack interface for bufferedResponseWriter
alexedwards_scs
train
go
783bae64cfea77bf96047ca082026ac35f8f97e6
diff --git a/mergexml.js b/mergexml.js index <HASH>..<HASH> 100644 --- a/mergexml.js +++ b/mergexml.js @@ -4,7 +4,7 @@ * * @package MergeXML * @author Vallo Reima - * @copyright (C)2014 + * @copyright (C)2014-2016 */ /**
Update mergexml.js
hareko_js-merge-xml
train
js
4e94184cff6d92eb1732c216a9c609f86e4ea402
diff --git a/lib/github/kv.rb b/lib/github/kv.rb index <HASH>..<HASH> 100644 --- a/lib/github/kv.rb +++ b/lib/github/kv.rb @@ -136,7 +136,7 @@ module GitHub validate_expires(expires) if expires rows = kvs.map { |key, value| - [key, value, GitHub::SQL::NOW, GitHub::SQL::NOW, expires || GitHub::SQL::NULL] + [key, GitHub::SQL::BINARY(value), GitHub::SQL::NOW, GitHub::SQL::NOW, expires || GitHub::SQL::NULL] } encapsulate_error do @@ -225,7 +225,7 @@ module GitHub DELETE FROM key_values WHERE `key` = :key AND expires_at <= NOW() SQL - sql = GitHub::SQL.run(<<-SQL, :key => key, :value => value, :expires => expires || GitHub::SQL::NULL, :connection => connection) + sql = GitHub::SQL.run(<<-SQL, :key => key, :value => GitHub::SQL::BINARY(value), :expires => expires || GitHub::SQL::NULL, :connection => connection) INSERT IGNORE INTO key_values (`key`, value, created_at, updated_at, expires_at) VALUES (:key, :value, NOW(), NOW(), :expires) SQL
Use binary escaping for value Since the `value` is a binary blob in the MySQL database, we also need to ensure we escape it as binary. This prevent potential query warnings (or errors if MySQL is configured that way) for when 4 byte UTF-8 characters get sent to a binary field but with string escaping.
github_github-ds
train
rb
d81c64f68aa47581aa8207f858aec8af1bb805d9
diff --git a/wallace/sources.py b/wallace/sources.py index <HASH>..<HASH> 100644 --- a/wallace/sources.py +++ b/wallace/sources.py @@ -9,14 +9,14 @@ class Source(Node): uuid = Column(String(32), ForeignKey("node.uuid"), primary_key=True) - def create_information(self, what=None, to_whom=None): + def create_information(self): """Generate new information.""" raise NotImplementedError( "You need to overwrite the default create_information.") def transmit(self, what=None, to_whom=None): - self.create_information(what=what, to_whom=to_whom) - super(Source, self).transmit(to_whom=to_whom, what=what) + info = self.create_information() + super(Source, self).transmit(to_whom=to_whom, what=info) class RandomBinaryStringSource(Source): @@ -26,11 +26,12 @@ class RandomBinaryStringSource(Source): __mapper_args__ = {"polymorphic_identity": "random_binary_string_source"} - def create_information(self, what=None, to_whom=None): - Info( + def create_information(self): + info = Info( origin=self, origin_uuid=self.uuid, contents=self._binary_string()) + return info def _binary_string(self): return "".join([str(random.randint(0, 1)) for i in range(2)])
Fix bug that arose through grammar tweaking
berkeley-cocosci_Wallace
train
py
0cfacb9b4b5edae224708ffec74b1e7cf5149869
diff --git a/uportal-war/src/main/java/org/jasig/portal/security/provider/PersonImpl.java b/uportal-war/src/main/java/org/jasig/portal/security/provider/PersonImpl.java index <HASH>..<HASH> 100644 --- a/uportal-war/src/main/java/org/jasig/portal/security/provider/PersonImpl.java +++ b/uportal-war/src/main/java/org/jasig/portal/security/provider/PersonImpl.java @@ -249,7 +249,7 @@ public class PersonImpl implements IPerson { public boolean isGuest() { boolean isGuest = false; // default String userName = (String) getAttribute(IPerson.USERNAME); - if (PersonFactory.GUEST_USERNAME.equals(userName) && + if (PersonFactory.GUEST_USERNAME.equalsIgnoreCase(userName) && (m_securityContext == null || !m_securityContext.isAuthenticated())) { isGuest = true; }
UP-<I>: Perform the guest user name comparison in a case-insensitive way; some LDAP setups (MS AD) have a 'Guest' user account that is making the first letter uppercase and therefore generating a bad result from this method
Jasig_uPortal
train
java
5a56c39a735258f38e67a44414f7a80d032ad639
diff --git a/syntax/filetests_test.go b/syntax/filetests_test.go index <HASH>..<HASH> 100644 --- a/syntax/filetests_test.go +++ b/syntax/filetests_test.go @@ -1637,6 +1637,13 @@ var fileTests = []testCase{ }, }, { + Strs: []string{`${foo[@]}`}, + bash: &ParamExp{ + Param: lit("foo"), + Ind: &Index{Expr: litWord("@")}, + }, + }, + { Strs: []string{`${foo[*]-etc}`}, bash: &ParamExp{ Param: lit("foo"), diff --git a/syntax/parser.go b/syntax/parser.go index <HASH>..<HASH> 100644 --- a/syntax/parser.go +++ b/syntax/parser.go @@ -949,8 +949,12 @@ func (p *parser) paramExp() *ParamExp { } lpos := p.pos p.quote = paramExpInd - if p.next(); p.tok == star { + p.next() + switch p.tok { + case star: p.tok, p.val = _LitWord, "*" + case at: + p.tok, p.val = _LitWord, "@" } pe.Ind = &Index{ Expr: p.arithmExpr(leftBrack, lpos, 0, false, false),
syntax: parse ${foo[@]} properly again This is a regression from <I>d<I>, which introduced support for ${foo@bar}. '@' is now a token in this context, so make sure it's handled separately like '*'.
mvdan_sh
train
go,go
c3215063d5e811eb662ac1b07d5d03453b6b15ac
diff --git a/src/main/java/org/dasein/cloud/google/capabilities/GCEFirewallCapabilities.java b/src/main/java/org/dasein/cloud/google/capabilities/GCEFirewallCapabilities.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/dasein/cloud/google/capabilities/GCEFirewallCapabilities.java +++ b/src/main/java/org/dasein/cloud/google/capabilities/GCEFirewallCapabilities.java @@ -114,14 +114,4 @@ public class GCEFirewallCapabilities extends AbstractCapabilities<Google> implem public boolean supportsFirewallDeletion() throws CloudException, InternalException { return false; } - - private static volatile Iterable<Protocol> allProtocolTypes; - - @Override - public Iterable<Protocol> listSupportedProtocols( boolean inVlan ) throws InternalException, CloudException { - if( allProtocolTypes == null ) { - allProtocolTypes = Collections.unmodifiableList(Arrays.asList(Protocol.UDP, Protocol.TCP, Protocol.ICMP)); - } - return allProtocolTypes; - } }
Not ready for this one until core updates... Revert "Cope with new core method listSupportedProtocols" This reverts commit <I>c<I>e<I>b<I>a<I>efbf<I>fa1cf<I>.
dasein-cloud_dasein-cloud-google
train
java
21e546417fe48ac226a8cface0a6c111f6a3cfd7
diff --git a/unleash/unleash.py b/unleash/unleash.py index <HASH>..<HASH> 100644 --- a/unleash/unleash.py +++ b/unleash/unleash.py @@ -69,14 +69,6 @@ class Unleash(object): def __init__(self, plugins=[]): self.plugins = plugins - def set_global_opts(self, root, debug=False, opts=None): - self.opts = opts or {} - self.root = root - self.debug = debug - - self.repo = Repo(root) - self.gitconfig = self.repo.get_config_stack() - def create_release(self, ref): try: opts = self.opts @@ -154,6 +146,14 @@ class Unleash(object): def run_user_shell(self, **kwargs): return subprocess.call(os.environ['SHELL'], env=os.environ, **kwargs) + def set_global_opts(self, root, debug=False, opts=None): + self.opts = opts or {} + self.root = root + self.debug = debug + + self.repo = Repo(root) + self.gitconfig = self.repo.get_config_stack() + def ____(): for obj in objects_to_add:
Moved set_global_opts function.
mbr_unleash
train
py
58d705853ae0d93fa0311208506b6db84c1b77f3
diff --git a/java/src/main/java/com/mapd/parser/server/CalciteDirect.java b/java/src/main/java/com/mapd/parser/server/CalciteDirect.java index <HASH>..<HASH> 100644 --- a/java/src/main/java/com/mapd/parser/server/CalciteDirect.java +++ b/java/src/main/java/com/mapd/parser/server/CalciteDirect.java @@ -127,6 +127,10 @@ final static Logger MAPDLOGGER = LoggerFactory.getLogger(CalciteDirect.class); } String relAlgebra; try { + if (Thread.currentThread().getContextClassLoader() == null) { + ClassLoader cl = ClassLoader.getSystemClassLoader(); + Thread.currentThread().setContextClassLoader(cl); + } relAlgebra = parser.getRelAlgebra(sqlText, legacySyntax, mapDUser); MAPDLOGGER.debug("After get relalgebra"); } catch (SqlParseException ex) {
Set context class loader in CalciteDirect Calcite needs it when running through JNI when serializing RexSubQuery nodes because of Janino.
omnisci_mapd-core
train
java
ddf502ddc65efac0d4753e93ca412e496cfffbb6
diff --git a/lice/core.py b/lice/core.py index <HASH>..<HASH> 100644 --- a/lice/core.py +++ b/lice/core.py @@ -66,6 +66,7 @@ LANGS = { "php": "c", "pl": "perl", "py": "unix", + "ps": "powershell", "rb": "ruby", "scm": "lisp", "sh": "unix", @@ -84,6 +85,7 @@ LANG_CMT = { "lua": [u'--[[', u'', u'--]]'], "ml": [u'(*', u'', u'*)'], "perl": [u'=item', u'', u'=cut'], + "powershell": [u'<#', u'#', u'#>'], "ruby": [u'=begin', u'', u'=end'], "text": [u'', u'', u''], "unix": [u'', u'#', u''],
Add PowerShell language (#<I>) PowerShell is my day to day language and being able to automatically add the license to the header of every single file would be a god-send for me as it takes a lot of work. Please share the implementation with this pull request for all other users. Let's not restrict this to just the core compiled languages that we were all once used to.
licenses_lice
train
py
a320ff91e0b354e0a9af76a095e97fd5fcd8cd77
diff --git a/src/lib/api.js b/src/lib/api.js index <HASH>..<HASH> 100644 --- a/src/lib/api.js +++ b/src/lib/api.js @@ -10,7 +10,7 @@ function api (opbeat, queuedCommands) { if (queuedCommands) { for (var i = 0; i < queuedCommands.length; i++) { var cmd = queuedCommands[i] - this.push(cmd) + this.push.apply(this, cmd) } } }
Fix 'Cannot read property 'apply' of undefined' introduced in daaae<I>
opbeat_opbeat-react
train
js
476be2493888996bdcfc00845e9d5fb6f7a37cc2
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ var defaultBase = 1 -var defaultRatio = 'goldenSection' +var defaultRatio = 1.618 var ratioNames = { minorSecond: 1.067, majorSecond: 1.125, @@ -36,6 +36,9 @@ module.exports = function modularscale (options) { ratio = ratioNames[ratio] ? ratioNames[ratio] : parseFloat(ratio, 10) + if (Number.isNaN(ratio)) { + ratio = defaultRatio + } } return function ms (value) { diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -65,7 +65,7 @@ test('should not bomb on empty bases and ratios', t => { test('should not bomb when pased completely wrong values', t => { var ms = modularScale({ - ratio: 0, + ratio: 'yolo', base: 'nope' }) t.equals(ms(1), 1.618)
Patch guards against passing bad ratio string.
kristoferjoseph_modular-scale
train
js,js
0e170d0670e17e6d7bfc8af5bc14da455c13e16f
diff --git a/lib/ib/project.rb b/lib/ib/project.rb index <HASH>..<HASH> 100644 --- a/lib/ib/project.rb +++ b/lib/ib/project.rb @@ -103,7 +103,7 @@ class IB::Project # Add all other resources, ignoring files in existing asset catalogs Dir.glob(File.join(dir, "**/*.{#{RESOURCE_EXTENSIONS.join(",")}}")) .reject {|f| f[%r{.*\.xcassets/.*}] }.each do |file| - group.new_reference(File.basename(file)) + group.new_reference(file.sub(dir + '/', '')) end end end
Fixes issue with subfolders in resources folder not being recognized in the resulting xcode project Closes #<I>
rubymotion_ib
train
rb
de4f79b2e583349aafa4604be054602bca342262
diff --git a/MQ2/mq2.py b/MQ2/mq2.py index <HASH>..<HASH> 100644 --- a/MQ2/mq2.py +++ b/MQ2/mq2.py @@ -234,7 +234,7 @@ def _append_count_to_matrix(qtl_matrixfile, lod_threshold): while cnt < len(matrix): row = list(matrix[cnt]) nr_qtl = 0 - for cel in row[4:]: + for cel in row[3:]: if cel and float(cel) > float(lod_threshold): nr_qtl = nr_qtl + 1 row.append(str(nr_qtl))
Fix adding the QTL count at the end of the matrix file
PBR_MQ2
train
py
6792d6df2a28aac436eb9e2afb1fe07bd30a1831
diff --git a/ryu/controller/ofp_handler.py b/ryu/controller/ofp_handler.py index <HASH>..<HASH> 100644 --- a/ryu/controller/ofp_handler.py +++ b/ryu/controller/ofp_handler.py @@ -280,7 +280,10 @@ class OFPHandler(ryu.base.app_manager.RyuApp): hex(msg.type), hex(msg.code), utils.binary_str(msg.data), ofp.ofp_error_type_to_str(msg.type), ofp.ofp_error_code_to_str(msg.type, msg.code)) - if len(msg.data) >= ofp.OFP_HEADER_SIZE: + if msg.type == ofp.OFPET_HELLO_FAILED: + self.logger.debug( + " `-- data: %s", msg.data.decode('ascii')) + elif len(msg.data) >= ofp.OFP_HEADER_SIZE: (version, msg_type, msg_len, xid) = ofproto_parser.header(msg.data) self.logger.debug( " `-- data: version=%s, msg_type=%s, msg_len=%s, xid=%s\n"
Log OFPErrorMsg.data as ascii when type is OFPET_HELLO_FAILED OFPErrorMsg.data usually contains the offending OpenFlow message, but is an ASCII text string if its type is OFPET_HELLO_FAILED.
osrg_ryu
train
py
f18f89a6e319280b5773aff16a2fb071f8a4e487
diff --git a/yabt/builders/proto.py b/yabt/builders/proto.py index <HASH>..<HASH> 100644 --- a/yabt/builders/proto.py +++ b/yabt/builders/proto.py @@ -143,6 +143,8 @@ def proto_builder(build_context, target): process_generated(src_base + '.pb.h', AT.gen_h) if target.props.gen_go or target.props.gen_go_grpc: process_generated(src_base + '.pb.go', AT.gen_go) + if target.props.gen_go_grpc: + process_generated(src_base + '_grpc.pb.go', AT.gen_go) if target.props.gen_python_rpcz: process_generated(src_base + '_rpcz.py', AT.gen_py) if target.props.gen_cpp_rpcz:
Generate grpc go artifacts (#<I>)
resonai_ybt
train
py
123faf4d81b04d10683d37726afdc20cc3c1200b
diff --git a/tests.py b/tests.py index <HASH>..<HASH> 100644 --- a/tests.py +++ b/tests.py @@ -26,11 +26,13 @@ from jsonschema import ( def make_case(schema, data, valid): if valid: def test_case(self): - validate(data, schema, cls=self.validator_class) + kwargs = getattr(self, "validator_kwargs", {}) + validate(data, schema, cls=self.validator_class, **kwargs) else: def test_case(self): + kwargs = getattr(self, "validator_kwargs", {}) with self.assertRaises(ValidationError): - validate(data, schema, cls=self.validator_class) + validate(data, schema, cls=self.validator_class, **kwargs) return test_case @@ -97,7 +99,11 @@ class BigNumMixin(object): pass +@load_json_cases("json/tests/draft3/optional/format.json") class FormatMixin(object): + + validator_kwargs = {"format_checker" : FormatChecker()} + def test_it_does_not_validate_formats_by_default(self): validator = self.validator_class({}) self.assertIsNone(validator.format_checker)
OK this works. Non-ideal, but works.
Julian_jsonschema
train
py
3984b809a7e70526dcf511653996a951ec2f828d
diff --git a/src/Menu/Provider/GroupMenuProvider.php b/src/Menu/Provider/GroupMenuProvider.php index <HASH>..<HASH> 100644 --- a/src/Menu/Provider/GroupMenuProvider.php +++ b/src/Menu/Provider/GroupMenuProvider.php @@ -179,7 +179,7 @@ class GroupMenuProvider implements MenuProviderInterface 'admin' => $admin, ]; - return $this->menuFactory->createItem($admin->getLabel(), $options); + return $this->menuFactory->createItem($admin->getLabel() ?? '', $options); } return $this->menuFactory->createItem($item['label'], [
Prevent passing a null label to createItem This method requires a string
sonata-project_SonataAdminBundle
train
php
26d83dce8d4c44350726c1d10f858a6cc133a86f
diff --git a/src/Auth/TinyAuthorize.php b/src/Auth/TinyAuthorize.php index <HASH>..<HASH> 100644 --- a/src/Auth/TinyAuthorize.php +++ b/src/Auth/TinyAuthorize.php @@ -63,6 +63,7 @@ class TinyAuthorize extends BaseAuthorize { 'cache' => AUTH_CACHE, 'cacheKey' => 'tiny_auth_acl', 'autoClearCache' => false, // usually done by Cache automatically in debug mode, + 'aclPath' => null, // possible to locate acl.ini at given path e.g. Plugin::configPath('Admin') ]; /** @@ -157,7 +158,7 @@ class TinyAuthorize extends BaseAuthorize { } if ($this->_acl === null) { - $this->_acl = $this->_getAcl(); + $this->_acl = $this->_getAcl($this->_config['aclPath']); } // Allow access if user has a role with wildcard access to the resource
aclPath configuration to be possible to use acl.ini from different path
dereuromark_cakephp-tinyauth
train
php
c11132c09ab1ed8d599d0dbde959d75249eb0e26
diff --git a/tests/db_routers_unittest.py b/tests/db_routers_unittest.py index <HASH>..<HASH> 100644 --- a/tests/db_routers_unittest.py +++ b/tests/db_routers_unittest.py @@ -113,7 +113,7 @@ class OQRouterTestCase(unittest.TestCase): For each model in the 'uiapi' schema, test for proper db routing for read operations. ''' - classes = [Upload, Input, OqJob, OqParams, Output, ErrorMsg] + classes = [Upload, Input, InputSet, OqJob, OqParams, Output, ErrorMsg] expected_db = 'reslt_writer' self._db_for_read_helper(classes, expected_db) @@ -123,7 +123,7 @@ class OQRouterTestCase(unittest.TestCase): For each model in the 'uiapi' schema, test for proper db routing for write operations. ''' - classes = [Upload, Input, OqJob, OqParams, ErrorMsg] + classes = [Upload, Input, InputSet, OqJob, OqParams, ErrorMsg] expected_db = 'job_init' self._db_for_write_helper(classes, expected_db)
Added test to verify InputSet is routed as expected.
gem_oq-engine
train
py
53fe630910374f3736aca9c5a5c9022f4d31df36
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( description = 'parser combinator.', long_description = 'A univeral Python parser combinator library inspirted by Parsec library of Haskell.', author = 'He Tao', - author_email = 'sighingnow@gmail', + author_email = '[email protected]', url = 'https://github.com/sighignow/parsec.py', license = 'MIT', classifiers=[
Fix a error about the author_email in setup.py.
sighingnow_parsec.py
train
py
ca32aa0dd70bd2771a8a3fa83c739dc85bdfc8bf
diff --git a/src/Serverfireteam/Blog/BlogServiceProvider.php b/src/Serverfireteam/Blog/BlogServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Serverfireteam/Blog/BlogServiceProvider.php +++ b/src/Serverfireteam/Blog/BlogServiceProvider.php @@ -15,7 +15,7 @@ class BlogServiceProvider extends ServiceProvider $this->app->register('Serverfireteam\Panel\PanelServiceProvider'); - include __DIR__."/Commands/Command.php"; + include_once __DIR__."/Commands/Command.php"; $this->app['blog::install'] = $this->app->share(function() { return new \Serverfireteam\Blog\Commands\BlogCommand();
Fixing include -> include_once
serverfireteam_blog
train
php
c7c5266e90c9c851101543dd137a713290b5e597
diff --git a/salt/utils/timed_subprocess.py b/salt/utils/timed_subprocess.py index <HASH>..<HASH> 100644 --- a/salt/utils/timed_subprocess.py +++ b/salt/utils/timed_subprocess.py @@ -27,7 +27,7 @@ class TimedProc(object): elif self.stdin is not None: # Translate a newline submitted as '\n' on the CLI to an actual # newline character. - self.stdin = self.stdin.replace('\\n', '\n') + self.stdin = self.stdin.replace('\\n', '\n').encode(__salt_system_encoding__) kwargs['stdin'] = subprocess.PIPE if not self.with_communicate:
Encode stdin to subproc calls for Py3 compat We need a bytes-like object for stdin for a subprocess in python3
saltstack_salt
train
py
8c88aaa9214f37fc401095530fd6f110a8c7cc5a
diff --git a/spec/poole_spec.rb b/spec/poole_spec.rb index <HASH>..<HASH> 100644 --- a/spec/poole_spec.rb +++ b/spec/poole_spec.rb @@ -10,11 +10,13 @@ module MrPoole context 'no jekyll directory' do before :all do # make a directory to work in + @olddir = Dir.pwd() @dir = Dir.mktmpdir('nojekyll') Dir.chdir(@dir) end after :all do + Dir.chdir(@olddir) FileUtils.rm_rf(@dir) end @@ -30,20 +32,22 @@ module MrPoole before :each do # make a directory to work in @olddir = Dir.pwd() - #puts "---#{@olddir}" @dir = Dir.mktmpdir('jekyll') - #posts = File.join(@dir, '_posts') - #Dir.mkdir(posts) - #Dir.chdir(@dir) + posts = File.join(@dir, '_posts') + Dir.mkdir(posts) + Dir.chdir(@dir) end after :each do - #Dir.chdir(@olddir) # change out of dir before removing it - Dir.chdir() + Dir.chdir(@olddir) FileUtils.rm_rf(@dir) end it "should not exit with _posts directory" do + argv = [] + lambda { + cli = CLI.new(argv) + }.should_not raise_error end end # end context 'in jekyll'
Fix to stupid bug in spec. I wasn't changing out of the directory in the old context before I removed it, so pwd was failing in the new context.
mmcclimon_mr_poole
train
rb
5a16782e086cdbaddcf1ce2b83c703bbc1efa041
diff --git a/html.py b/html.py index <HASH>..<HASH> 100644 --- a/html.py +++ b/html.py @@ -447,7 +447,7 @@ ckeditor_available = LocalProxy(is_html_text_editor_installed) def get_html_text_editor(name, id=None, content='', textual_content=None, width='300px', height='200px', enabled=True, file_upload_url=None, toolbar_set="Basic", - custom_configurations_path='/ckeditor/invenio-ckeditor-config.js', + custom_configurations_path='/js/ckeditor/invenio-ckeditor-config.js', ln=None): """ Returns a wysiwyg editor (CKEditor) to embed in html pages.
global: fixes for javascript and translations
inveniosoftware-attic_invenio-utils
train
py
89a9ee549832c147e3fd08b86e1bf5c621661367
diff --git a/fireplace/card.py b/fireplace/card.py index <HASH>..<HASH> 100644 --- a/fireplace/card.py +++ b/fireplace/card.py @@ -33,7 +33,6 @@ class BaseCard(Entity): has_deathrattle = boolean_property("has_deathrattle") atk = int_property("atk") max_health = int_property("max_health") - cost = int_property("cost") def __init__(self, data): self.data = data @@ -130,6 +129,18 @@ class PlayableCard(BaseCard, TargetableByAuras): return self.base_events + self._events @property + def cost(self): + ret = self._getattr("cost", 0) + mod = getattr(self.data.scripts, "cost_mod", None) + if mod is not None: + ret += mod.evaluate(self) + return max(0, ret) + + @cost.setter + def cost(self, value): + self._cost = value + + @property def deathrattles(self): ret = [] if not self.has_deathrattle: @@ -664,6 +675,8 @@ class Secret(Spell): class Enchantment(BaseCard): + cost = int_property("cost") + def __init__(self, data): self.one_turn_effect = False super().__init__(data)
Implement `cost_mod` script for card definitions
jleclanche_fireplace
train
py
3737e7c95f61420db7ca2fbbdb4d1d198d604536
diff --git a/spec/support/setup.rb b/spec/support/setup.rb index <HASH>..<HASH> 100644 --- a/spec/support/setup.rb +++ b/spec/support/setup.rb @@ -1,5 +1,6 @@ RSpec.configure do |config| config.before :suite do `docker build --tag nibtest:latest .` + `cd spec/dummy && docker-compose build` end end
Build dummy docker images before spec run
technekes_nib
train
rb
72468c33c35262cb31eb1e1eb48fecef0b966d18
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name='appdaemontestframework', - version='2.6.0', + version='2.6.1', description='Clean, human-readable tests for Appdaemon', long_description='See: https://floriankempenich.github.io/Appdaemon-Test-Framework/', keywords='appdaemon homeassistant test tdd clean-code home-automation',
Release <I>: Add support for kwargs in 'turned_off' (by snjoetw) + Fix bug when turning on/off via service
FlorianKempenich_Appdaemon-Test-Framework
train
py
e446b5a67596b046bb822879517c37aab3962618
diff --git a/source/application/transforms/react/index.js b/source/application/transforms/react/index.js index <HASH>..<HASH> 100644 --- a/source/application/transforms/react/index.js +++ b/source/application/transforms/react/index.js @@ -10,12 +10,16 @@ export default function createReactCodeFactory(application) { return async function createReactCode(file, demo) { let result = convertCode(file, config.opts); + let requireBlock = createRequireBlock(getDependencies(file), config.opts); + result = requireBlock + result; if (demo) { demo.dependencies = { pattern: file }; merge(demo.dependencies, file.dependencies); let demoResult = convertCode(demo, config.opts); + let requireBlock = createRequireBlock(getDependencies(demo), config.opts); + demoResult = requireBlock + demoResult; file.demoSource = demo.source; file.demoBuffer = new Buffer(demoResult, 'utf-8'); } @@ -34,8 +38,7 @@ function convertCode(file, opts) { source = createWrappedRenderFunction(file, source); } let result = transform(source, opts).code; - let requireBlock = createRequireBlock(getDependencies(file), opts); - return requireBlock + result; + return result; } function createWrappedRenderFunction(file, source) {
Big speed improvement of dependencies Only prepare and compile each dependency once per pattern.
patternplate-archive_patternplate-server
train
js
48175329141e0bf191ee8699b2012f85f27fad9a
diff --git a/lib/agent.js b/lib/agent.js index <HASH>..<HASH> 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -75,7 +75,7 @@ module.exports = function(uaString) { } // Patch ua.family with the normalised name - ua.family = agentlist[ua.family.toLowerCase()] || ua.family; + ua.family = agentlist[ua.family.toLowerCase()] || ua.family.toLowerCase(); return ua; }
UA family must always be lowercase
Financial-Times_polyfill-service
train
js
431f26a3e861144e7fdd700ca65c36eeb073441c
diff --git a/mixins/observe.js b/mixins/observe.js index <HASH>..<HASH> 100644 --- a/mixins/observe.js +++ b/mixins/observe.js @@ -36,6 +36,11 @@ function makeGetter(fnc, key) { var value = fnc(el); + /* do not set value if we are extracting and no value has been set in DOM + * element + */ + if(!value && data && data.extract) return; + // TODO... should probably unset here if(!value && !_.isBoolean(value) && value !== 0) value = null; @@ -168,7 +173,7 @@ module.exports = { var self = this; this._bindings.forEach(function(binding) { - binding.getter && self.$(binding.selector).trigger(binding.getter.events[0]); + binding.getter && self.$(binding.selector).trigger(binding.getter.events[0], { extract: true }); //binding.getter && binding.setter.call(self, null, self.model.get(binding.key)); }); },
Do not set value on model if we are 'extracting' and no value is gotten from DOM.
thecodebureau_ridge
train
js
5a19dc342921e75d45aea82f55d493b48e3dd7ea
diff --git a/tests/lax_scipy_test.py b/tests/lax_scipy_test.py index <HASH>..<HASH> 100644 --- a/tests/lax_scipy_test.py +++ b/tests/lax_scipy_test.py @@ -137,8 +137,9 @@ class LaxBackedScipyTests(jtu.JaxTestCase): if test_autodiff: jtu.check_grads(lax_op, args, order=1, - atol=jtu.if_device_under_test("tpu", 2e-3, 1e-3), - rtol=2e-2, eps=1e-3) + atol=jtu.if_device_under_test("tpu", .02, 1e-3), + rtol=jtu.if_device_under_test("tpu", .01, .02), + eps=1e-3) @parameterized.named_parameters(jtu.cases_from_list( {"testcase_name": "_inshape={}_d={}".format(
Adjust test tolerances for TPU. (#<I>) Ideally this is temporary, as the tolerances are getting high.
tensorflow_probability
train
py
43a802b48add4494636fc48955023c797b019b12
diff --git a/Guard.php b/Guard.php index <HASH>..<HASH> 100755 --- a/Guard.php +++ b/Guard.php @@ -17,6 +17,13 @@ class Guard { protected $user; /** + * Indicates if the user was authenticated via a recaller cookie. + * + * @var bool + */ + protected $viaRemember = false; + + /** * The user provider implementation. * * @var \Illuminate\Auth\UserProviderInterface @@ -131,6 +138,8 @@ class Guard { if (is_null($user) and ! is_null($recaller)) { $user = $this->provider->retrieveByID($recaller); + + $this->viaRemember = ! is_null($user); } return $this->user = $user; @@ -578,4 +587,14 @@ class Guard { return 'remember_'.md5(get_class($this)); } + /** + * Determine if the user was authenticated via "remember me" cookie. + * + * @return bool + */ + public function viaRemember() + { + return $this->viaRemember; + } + }
Added new 'Auth::viaRemember method to determine if user was authed via 'remember me' cookie.
illuminate_auth
train
php
fef8a09c916bc155722508d241a9c654a7b1eec5
diff --git a/bibliopixel/animation/animation.py b/bibliopixel/animation/animation.py index <HASH>..<HASH> 100644 --- a/bibliopixel/animation/animation.py +++ b/bibliopixel/animation/animation.py @@ -52,7 +52,7 @@ class Animation(object): @color_list.setter def color_list(self, cl): - self.layout.color_list[:] = cl + self.layout.color_list = cl @property def completed(self):
Fix animation to use the layout's color_list property * Otherwise we don't get the cool conversions from the Layout.color_list setter.
ManiacalLabs_BiblioPixel
train
py
e3e958030545b126550a8b9bcb60a1bd5345c580
diff --git a/views/js/qtiCommonRenderer/renderers/ModalFeedback.js b/views/js/qtiCommonRenderer/renderers/ModalFeedback.js index <HASH>..<HASH> 100755 --- a/views/js/qtiCommonRenderer/renderers/ModalFeedback.js +++ b/views/js/qtiCommonRenderer/renderers/ModalFeedback.js @@ -12,6 +12,7 @@ define([ qtiClass : 'modalFeedback', template : tpl, getContainer : Helper.getContainer, + minHeight : 200, minWidth : 400, maxWidth : 800, render : function(modalFeedback, data){ @@ -21,8 +22,10 @@ define([ var $modal = $('#' + modalFeedback.getSerial()); sizeFinder.measure($modal, function(size){ + $modal.modal({ - startClosed : false, + startClosed : false, + minHeight : Math.max(size.height , modalFeedbackRenderer.minHeight), width : Math.max( Math.min(size.width, modalFeedbackRenderer.maxWidth), modalFeedbackRenderer.minWidth) }); @@ -36,4 +39,4 @@ define([ }; return modalFeedbackRenderer; -}); +}); \ No newline at end of file
fixed modal min height issue on delivery
oat-sa_extension-tao-itemqti
train
js
811cf34c954bad73a3f6c0f1cf4ef4c9df89175f
diff --git a/app/assets/javascripts/peoplefinder.js b/app/assets/javascripts/peoplefinder.js index <HASH>..<HASH> 100644 --- a/app/assets/javascripts/peoplefinder.js +++ b/app/assets/javascripts/peoplefinder.js @@ -26,4 +26,4 @@ $(function() { $(this).closest('.role-summary').hide(); $(this).closest('.membership').children('.editable-fields').show(); }); -}) +});
Add trailing semicolon to js file
ministryofjustice_peoplefinder
train
js
8b8851dc7c500dbb0aeb59634043ef483c62bc5c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='python_cowbull_game', - version='2.0.1', + version='2.0.2', description='Python cowbull game object', url='https://github.com/dsandersAzure/python_cowbull_game', author='David Sanders',
Refactor guesses_allowed; rename to guesses.
dsandersAzure_python_cowbull_game
train
py
590401cba96c581c88c1acc0c9975a2aeb7d4599
diff --git a/src/BaseRepositoryEloquent.php b/src/BaseRepositoryEloquent.php index <HASH>..<HASH> 100644 --- a/src/BaseRepositoryEloquent.php +++ b/src/BaseRepositoryEloquent.php @@ -85,6 +85,22 @@ abstract class BaseRepositoryEloquent implements RepositoryInterface { $query = $this->query ?: $this->model; + if (is_array($this->eagerLoadRelations)) { + $eagerLoads = []; + + foreach ($this->eagerLoadRelations as $relation => $rules) { + if (array_key_exists('attributes', $rules)) { + $eagerLoads[$relation] = function ($q) use ($rules) { + $q->select($rules['attributes']); + }; + } else { + $eagerLoads[] = $relation; + } + } + + $query->with($eagerLoads); + } + return $query->with($this->eagerLoadRelations); }
Add feature of selective attributes in eagerloading
sedp-mis_base-repository
train
php
ea211b57ece9b1b4899cdfed07f27ad97cb11b95
diff --git a/languagetool-dev/src/main/java/org/languagetool/dev/diff/LightRuleMatchParser.java b/languagetool-dev/src/main/java/org/languagetool/dev/diff/LightRuleMatchParser.java index <HASH>..<HASH> 100644 --- a/languagetool-dev/src/main/java/org/languagetool/dev/diff/LightRuleMatchParser.java +++ b/languagetool-dev/src/main/java/org/languagetool/dev/diff/LightRuleMatchParser.java @@ -180,7 +180,7 @@ class LightRuleMatchParser { private String getContextWithSpan(String context, int startMarkerPos, int maxEnd) { context = context.substring(0, startMarkerPos) + "<span class='marker'>" + - context.substring(startMarkerPos, maxEnd) + + context.substring(startMarkerPos, maxEnd).replace(" ", "&nbsp;") + "</span>" + context.substring(maxEnd); return context;
avoid collapsing consecutive spaces
languagetool-org_languagetool
train
java