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 |
|---|---|---|---|---|---|
4fb512b6651716036618aa1a3ee3cc57fefe5e04 | diff --git a/lib/flor/punit/fork.rb b/lib/flor/punit/fork.rb
index <HASH>..<HASH> 100644
--- a/lib/flor/punit/fork.rb
+++ b/lib/flor/punit/fork.rb
@@ -17,11 +17,8 @@ class Flor::Pro::Fork < Flor::Procedure
@node['tree'] = Flor.dup(tree)
@node['replyto'] = nil
- ms = super
- nid = ms.any? ? ms.first['nid'] : nil
-
wrap('flavour' => 'fork', 'nid' => parent, 'ret' => nid) +
- ms
+ super
end
end
diff --git a/spec/punit/fork_spec.rb b/spec/punit/fork_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/punit/fork_spec.rb
+++ b/spec/punit/fork_spec.rb
@@ -52,7 +52,7 @@ describe 'Flor punit' do
expect(r['point']).to eq('terminated')
expect(r['payload']['ret']).to eq(nil)
- expect(r['payload']['forked']).to eq('0_0_0_1_0')
+ expect(r['payload']['forked']).to eq('0_0_0_1')
expect(
@unit.traces.collect(&:text).join(' ') | Let "fork" return its own nid
Since it behaves like a "sequence" for its children in their forked parent | floraison_flor | train | rb,rb |
6c46c27c893587ff34d1343de365906e6b2726bd | diff --git a/src/Expression/Func/FuncArguments.php b/src/Expression/Func/FuncArguments.php
index <HASH>..<HASH> 100644
--- a/src/Expression/Func/FuncArguments.php
+++ b/src/Expression/Func/FuncArguments.php
@@ -29,7 +29,7 @@ class FuncArguments implements ExpressionInterface
}
if (is_array($argument)) {
- $this->args += $argument;
+ $this->args += $argument;
return $this;
} | Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on <URL> | phuria_under-query | train | php |
3d2bdc15cf2fb170b9a06c969257fad1026301f6 | diff --git a/atx/device/android.py b/atx/device/android.py
index <HASH>..<HASH> 100644
--- a/atx/device/android.py
+++ b/atx/device/android.py
@@ -79,8 +79,8 @@ class AndroidDevice(DeviceMixin, UiaDevice):
"""
self.__display = None
serialno = serialno or getenvs('ATX_ADB_SERIALNO', 'ANDROID_SERIAL')
- self._host = kwargs.get('host', getenvs('ATX_ADB_HOST', 'ANDROID_ADB_SERVER_HOST') or '127.0.0.1')
- self._port = int(kwargs.get('port', getenvs('ATX_ADB_PORT', 'ANDROID_ADB_SERVER_PORT') or 5037))
+ self._host = kwargs.get('host') or getenvs('ATX_ADB_HOST', 'ANDROID_ADB_SERVER_HOST') or '127.0.0.1'
+ self._port = int(kwargs.get('port') or getenvs('ATX_ADB_PORT', 'ANDROID_ADB_SERVER_PORT') or 5037)
self._adb_client = adbkit.Client(self._host, self._port)
self._adb_device = self._adb_client.device(serialno) | fix exception when passing port=None | NetEaseGame_ATX | train | py |
a181c237faf8dd56337b7be70f97408d94aa5688 | diff --git a/lib/handlers/session.js b/lib/handlers/session.js
index <HASH>..<HASH> 100644
--- a/lib/handlers/session.js
+++ b/lib/handlers/session.js
@@ -115,6 +115,14 @@ module.exports = Observable.extend({
email: req.param('email', '')
}, _this = this;
+ if (req.user) {
+ return this.respond(res, 400, {
+ ok: false,
+ message: 'Too late I\'m afraid, that username is taken.',
+ step: '2.3'
+ });
+ }
+
if (!params.name || !params.key) {
return res.json(400, {ok: false, error: 'Missing username or password'});
} | Checking for existence of username before creating account | jsbin_jsbin | train | js |
015b19c8a8da8e32cabd8a0b5eca46b754c8dcec | diff --git a/system/Test/FeatureTestCase.php b/system/Test/FeatureTestCase.php
index <HASH>..<HASH> 100644
--- a/system/Test/FeatureTestCase.php
+++ b/system/Test/FeatureTestCase.php
@@ -168,7 +168,6 @@ class FeatureTestCase extends CIDatabaseTestCase
// instance get the right one.
Services::injectMock('request', $request);
- ob_start();
$response = $this->app
->setRequest($request)
->run($this->routes, true);
diff --git a/tests/system/Test/FeatureTestCaseTest.php b/tests/system/Test/FeatureTestCaseTest.php
index <HASH>..<HASH> 100644
--- a/tests/system/Test/FeatureTestCaseTest.php
+++ b/tests/system/Test/FeatureTestCaseTest.php
@@ -189,6 +189,7 @@ class FeatureTestCaseTest extends FeatureTestCase
'Tests\Support\Controllers\Popcorn::canyon',
],
]);
+ ob_start();
$response = $this->get('home');
$response->assertSee('Hello-o-o');
} | place ob_start() in test | codeigniter4_CodeIgniter4 | train | php,php |
2f1eb268c4277cdb165317f3de69a571a857f38c | diff --git a/asn1crypto/crl.py b/asn1crypto/crl.py
index <HASH>..<HASH> 100644
--- a/asn1crypto/crl.py
+++ b/asn1crypto/crl.py
@@ -107,6 +107,29 @@ class CRLReason(Enumerated):
10: 'aa_compromise',
}
+ @property
+ def human_friendly(self):
+ """
+ :return:
+ A unicode string with revocation description that is suitable to
+ show to end-users. Starts with a lower case letter and phrased in
+ such a way that it makes sense after the phrase "because of" or
+ "due to".
+ """
+
+ return {
+ 'unspecified': 'an unspecified reason',
+ 'key_compromise': 'a compromised key',
+ 'ca_compromise': 'the CA being compromised',
+ 'affiliation_changed': 'an affiliation change',
+ 'superseded': 'certificate supersession',
+ 'cessation_of_operation': 'a cessation of operation',
+ 'certificate_hold': 'a certificate hold',
+ 'remove_from_crl': 'removal from the CRL',
+ 'privilege_withdrawn': 'privilege withdrawl',
+ 'aa_compromise': 'the AA being compromised',
+ }[self.native]
+
class CRLEntryExtensionId(ObjectIdentifier):
_map = { | Added .human_friendly to CRLReason | wbond_asn1crypto | train | py |
f5ee7f8f4d556d8d0124d5a4713bea601ce42e64 | diff --git a/src/Http/Controllers/VoyagerBaseController.php b/src/Http/Controllers/VoyagerBaseController.php
index <HASH>..<HASH> 100644
--- a/src/Http/Controllers/VoyagerBaseController.php
+++ b/src/Http/Controllers/VoyagerBaseController.php
@@ -401,8 +401,10 @@ class VoyagerBaseController extends Controller
// Delete Files
foreach ($dataType->deleteRows->where('type', 'file') as $row) {
- foreach (json_decode($data->{$row->field}) as $file) {
- $this->deleteFileIfExists($file->download_link);
+ if (isset($data->{$row->field})) {
+ foreach (json_decode($data->{$row->field}) as $file) {
+ $this->deleteFileIfExists($file->download_link);
+ }
}
}
} | Fix BREAD file type bug while delete | the-control-group_voyager | train | php |
67c9e7690b33a443ad0fbd9ea91afa18c38e2bda | diff --git a/Vps/Util/ClearCache.php b/Vps/Util/ClearCache.php
index <HASH>..<HASH> 100644
--- a/Vps/Util/ClearCache.php
+++ b/Vps/Util/ClearCache.php
@@ -229,7 +229,7 @@ class Vps_Util_ClearCache
}
}
if (in_array('setup', $types)) {
- unlink('application/cache/setup.php');
+ if (file_exists('application/cache/setup.php')) unlink('application/cache/setup.php');
}
foreach ($this->getDbCacheTables() as $t) {
if ($server) { | avoid error if cache file does not exist | koala-framework_koala-framework | train | php |
8c0a7ee54bbf36cb83fbfb8fc8986388e032d0f4 | diff --git a/lib/urban_dictionary.rb b/lib/urban_dictionary.rb
index <HASH>..<HASH> 100644
--- a/lib/urban_dictionary.rb
+++ b/lib/urban_dictionary.rb
@@ -1,4 +1,25 @@
+require 'uri'
+require 'net/http'
+
require 'urban_dictionary/version'
+require 'urban_dictionary/word'
+require 'urban_dictionary/entry'
module UrbanDictionary
+ DEFINE_URL = 'http://www.urbandictionary.com/define.php'
+ RANDOM_URL = 'http://www.urbandictionary.com/random.php'
+
+ def self.define(str)
+ Word.from_url("#{DEFINE_URL}?term=#{URI.encode(str)}")
+ end
+
+ def self.random_word
+ url = URI.parse(RANDOM_URL)
+ req = Net::HTTP::Get.new(url.path)
+ rsp = Net::HTTP.start(url.host, url.port) {|http|
+ http.request(req)
+ }
+
+ Word.from_url(rsp['location'])
+ end
end
\ No newline at end of file | Add static methods to UrbanDictionary | ryangreenberg_urban_dictionary | train | rb |
5562e18f8c3c98fe3ee13e4403c7b85a99eba3cd | diff --git a/ajax/endpoints.py b/ajax/endpoints.py
index <HASH>..<HASH> 100644
--- a/ajax/endpoints.py
+++ b/ajax/endpoints.py
@@ -71,7 +71,7 @@ class ModelEndpoint(object):
return encoder.encode(result)
- def get_queryset(self, request):
+ def get_queryset(self, request, **kwargs):
return self.model.objects.none()
def list(self, request): | get_queryset takes kwargs for future expansion. | joestump_django-ajax | train | py |
56768a4c9d26edd53d1ce8b04b1a4d26ad14eb57 | diff --git a/src/core/Common.js b/src/core/Common.js
index <HASH>..<HASH> 100644
--- a/src/core/Common.js
+++ b/src/core/Common.js
@@ -35,7 +35,7 @@ var Common = {};
if (source) {
for (var prop in source) {
- if (deepClone && source[prop].constructor === Object) {
+ if (deepClone && source[prop] && source[prop].constructor === Object) {
if (!obj[prop] || obj[prop].constructor === Object) {
obj[prop] = obj[prop] || {};
Common.extend(obj[prop], deepClone, source[prop]); | fixed issue with extending null properties | liabru_matter-js | train | js |
96c131f2ddf834d67061513b87417719c07e0b79 | diff --git a/fixedsticky.js b/fixedsticky.js
index <HASH>..<HASH> 100644
--- a/fixedsticky.js
+++ b/fixedsticky.js
@@ -107,20 +107,22 @@
return $el.each(function() {
$( this )
- .removeData()
+ .removeData( [ keys.offset, keys.position ] )
.removeClass( S.classes.active )
- .next().remove();
+ .nextUntil( S.classes.clone ).remove();
});
},
init: function( el ) {
var $el = $( el );
- if (S.hasFixSticky()) return;
+ if( S.hasFixSticky() ) {
+ return;
+ }
return $el.each(function() {
var _this = this;
$( win ).bind( 'scroll.fixedsticky', function() {
- S.update( _this);
+ S.update( _this );
}).trigger( 'scroll.fixedsticky' );
$( win ).bind( 'resize.fixedsticky', function() { | Cleanup destroy code, was a little ambiguous. A few style changes. | filamentgroup_fixed-sticky | train | js |
4278b43a568357f9c197a39c4dc70d815c317d68 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -6,7 +6,6 @@ import * as THREE from 'three';
class Line extends THREE.Line {
// ref. https://stackoverflow.com/questions/31399856/drawing-a-line-with-three-js-dynamically
constructor(maxPoints, color=0xff0000) {
- this.version = __version;
let geometry = new THREE.BufferGeometry();
let positions = new Float32Array( maxPoints * 3 );
geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
@@ -15,6 +14,7 @@ class Line extends THREE.Line {
});
super(geometry, material);
+ this.version = __version;
this._maxPoints = maxPoints;
this._numPoints = 0;
} | Fix the runtime error due to `this.version` coming before `super()` | w3reality_three-laser-pointer | train | js |
4221260cfa2903e4efcb69015bff58dcf8c556b3 | diff --git a/angr/engines/vex/engine.py b/angr/engines/vex/engine.py
index <HASH>..<HASH> 100644
--- a/angr/engines/vex/engine.py
+++ b/angr/engines/vex/engine.py
@@ -579,7 +579,7 @@ class SimEngineVEX(SimEngine):
first_imark = True
for stmt in irsb.statements:
- if isinstance(stmt, pyvex.stmt.IMark):
+ if type(stmt) is pyvex.stmt.IMark: # pylint: disable=unidiomatic-typecheck
addr = stmt.addr + stmt.delta
if not first_imark and self.is_stop_point(addr):
# could this part be moved by pyvex? | SimEngineVEX._first_stop_point(): Switch from isinstance() to type() to make it faster. (#<I>) | angr_angr | train | py |
26dcfccabc22e73e97cc66813d691933f1a537cd | diff --git a/src/Http/Response.php b/src/Http/Response.php
index <HASH>..<HASH> 100644
--- a/src/Http/Response.php
+++ b/src/Http/Response.php
@@ -19,7 +19,6 @@ use Cake\Filesystem\File;
use Cake\Http\Cookie\Cookie;
use Cake\Http\Cookie\CookieCollection;
use Cake\Http\Cookie\CookieInterface;
-use Cake\I18n\Time;
use Cake\Log\Log;
use Cake\Network\CorsBuilder;
use Cake\Network\Exception\NotFoundException;
@@ -2084,7 +2083,7 @@ class Response implements ResponseInterface
$cookie = new Cookie(
$name,
'',
- new Time(1),
+ DateTime::createFromFormat('U', 1),
$options['path'],
$options['domain'],
$options['secure'], | no need for I<I>n | cakephp_cakephp | train | php |
5bdfc9f18a7036fd90e682eda1f2e0ac32b43329 | diff --git a/plugin/Backup/Methods/Storagebox/InformationCollector/SidekickCollector.php b/plugin/Backup/Methods/Storagebox/InformationCollector/SidekickCollector.php
index <HASH>..<HASH> 100644
--- a/plugin/Backup/Methods/Storagebox/InformationCollector/SidekickCollector.php
+++ b/plugin/Backup/Methods/Storagebox/InformationCollector/SidekickCollector.php
@@ -16,7 +16,7 @@ class SidekickCollector implements InformationCollector {
* @return
*/
public function collect(InputInterface $input, OutputInterface $output, &$data) {
- $databaseService = $data->getDatabase()->getService();
+ $databaseService = $data->getBackup()->getServiceName();
$composeParser = $data->getComposeParser();
$service = $data->getService();
$composeData = $data->getComposeData(); | fixed SidekickCollector using the Servicename from the database instead of the one from the backup. | ipunkt_rancherize-backup-storagebox | train | php |
b4734b3aecd488f2a18e424bca9fe3cb02d97066 | diff --git a/bundles/org.eclipse.orion.client.core/web/edit/setup.js b/bundles/org.eclipse.orion.client.core/web/edit/setup.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.core/web/edit/setup.js
+++ b/bundles/org.eclipse.orion.client.core/web/edit/setup.js
@@ -177,12 +177,10 @@ exports.setUpEditor = function(isReadOnly){
var searcher = new mSearchClient.Searcher({serviceRegistry: serviceRegistry, commandService: commandService});
- var model = new mTextModel.TextModel();
- model = new mProjectionTextModel.ProjectionTextModel(model);
var textViewFactory = function() {
return new mTextView.TextView({
parent: editorDomNode,
- model: model,
+ model: new mProjectionTextModel.ProjectionTextModel(new mTextModel.TextModel()),
stylesheet: ["/orion/textview/textview.css", "/orion/textview/rulers.css",
"/examples/textview/textstyler.css", "/css/default-theme.css",
"/orion/editor/editor.css"], | fix model created outside of text view factory | eclipse_orion.client | train | js |
388d38b0f8f860affad02b3e9e56a4cdd876ac69 | diff --git a/src/main/java/org/jboss/wsf/spi/deployment/DeploymentAspectManager.java b/src/main/java/org/jboss/wsf/spi/deployment/DeploymentAspectManager.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jboss/wsf/spi/deployment/DeploymentAspectManager.java
+++ b/src/main/java/org/jboss/wsf/spi/deployment/DeploymentAspectManager.java
@@ -36,6 +36,12 @@ public interface DeploymentAspectManager
/** Get the name for this aspect manager */
String getName();
+ /** Get the optional parent for this manager */
+ DeploymentAspectManager getParent();
+
+ /** Set the optional parent for this manager */
+ void setParent(DeploymentAspectManager dam);
+
/** Get the ordered list of registered deployment aspects */
List<DeploymentAspect> getDeploymentAspects(); | Use 'Pre' and 'Post' for JSE handling
Move notion of parent to DAM instead of DAM intaller
Revert container integration version back to snapshot
Sort out commented requires, provides clauses | jbossws_jbossws-spi | train | java |
3e96b9e773e4a9e40a039a5859736fbc1dbb8be7 | diff --git a/lib/support/cli.js b/lib/support/cli.js
index <HASH>..<HASH> 100644
--- a/lib/support/cli.js
+++ b/lib/support/cli.js
@@ -530,7 +530,13 @@ module.exports.parseCommandLine = function parseCommandLine() {
.option('processStartTime', {
type: 'boolean',
default: false,
- describe: 'Capture browser process start time (in milliseconds).'
+ describe:
+ 'Capture browser process start time (in milliseconds). Android only for now.'
+ })
+ .option('edge.edgedriverPath', {
+ describe:
+ 'To run Edge you need to supply the path to the msedgedriver that match your Egde version.',
+ group: 'edge'
})
.option('safari.ios', {
default: false, | Added Egde to the cli | sitespeedio_browsertime | train | js |
2f890facef4a7d34e87b8657a78d0967536bdac4 | diff --git a/tests/integration/boxscore/test_nba_boxscore.py b/tests/integration/boxscore/test_nba_boxscore.py
index <HASH>..<HASH> 100644
--- a/tests/integration/boxscore/test_nba_boxscore.py
+++ b/tests/integration/boxscore/test_nba_boxscore.py
@@ -165,14 +165,12 @@ class TestNBABoxscore:
assert df1.empty
def test_nba_boxscore_players(self):
- boxscore = Boxscore(BOXSCORE)
-
- assert len(boxscore.home_players) == 13
- assert len(boxscore.away_players) == 13
+ assert len(self.boxscore.home_players) == 13
+ assert len(self.boxscore.away_players) == 13
- for player in boxscore.home_players:
+ for player in self.boxscore.home_players:
assert not player.dataframe.empty
- for player in boxscore.away_players:
+ for player in self.boxscore.away_players:
assert not player.dataframe.empty | Fix NBA Boxscore integration tests
The NBA Boxscore integration tests randomly started failing while
attempting to create an instance of the Boxscore class. The issue is now
resolved, allowing the tests to complete as expected again. | roclark_sportsreference | train | py |
720e3a080339b3ab1379ff1c1774b5d9aa6ee80a | diff --git a/Neos.Neos/Classes/Controller/Backend/MenuHelper.php b/Neos.Neos/Classes/Controller/Backend/MenuHelper.php
index <HASH>..<HASH> 100644
--- a/Neos.Neos/Classes/Controller/Backend/MenuHelper.php
+++ b/Neos.Neos/Classes/Controller/Backend/MenuHelper.php
@@ -164,7 +164,10 @@ class MenuHelper
}
$this->moduleListFirstLevelCache[$moduleName] = array_merge(
$this->collectModuleData($controllerContext, $moduleName, $moduleConfiguration, $moduleName),
- ['group' => $moduleName, 'submodules' => $submodules]
+ [
+ 'group' => $moduleName,
+ 'submodules' => (new PositionalArraySorter($submodules))->toArray(),
+ ]
);
}
@@ -217,7 +220,8 @@ class MenuHelper
'label' => $moduleConfiguration['label'] ?? '',
'description' => $moduleConfiguration['description'] ?? '',
'icon' => $icon,
- 'hideInMenu' => (bool)($moduleConfiguration['hideInMenu'] ?? false)
+ 'hideInMenu' => (bool)($moduleConfiguration['hideInMenu'] ?? false),
+ 'position' => $moduleConfiguration['position'] ?? null,
];
}
} | FEATURE: Allow setting the position of backend modules
This change only makes it possible for the menu when displayed
inside backend modules other than the content module.
The content module needs an additional change in the Neos.UI.
Relates: #<I> | neos_neos-development-collection | train | php |
f4162effebc82759c755854ac50b8d48b3331e8c | diff --git a/backup/util/helper/backup_cron_helper.class.php b/backup/util/helper/backup_cron_helper.class.php
index <HASH>..<HASH> 100644
--- a/backup/util/helper/backup_cron_helper.class.php
+++ b/backup/util/helper/backup_cron_helper.class.php
@@ -512,7 +512,8 @@ abstract class backup_cron_automated_helper {
// MDL-33531: use different filenames depending on backup_shortname option
if ( !empty($config->backup_shortname) ) {
- $courseref = $course->shortname;
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseref = format_string($course->shortname, true, array('context' => $context));
$courseref = str_replace(' ', '_', $courseref);
$courseref = textlib::strtolower(trim(clean_filename($courseref), '_'));
} else { | MDL-<I> backup Added format_string to course shortname | moodle_moodle | train | php |
93307b2d28f59124ee2a89f91cf86369236fe856 | diff --git a/lib/grape-markdown/route.rb b/lib/grape-markdown/route.rb
index <HASH>..<HASH> 100644
--- a/lib/grape-markdown/route.rb
+++ b/lib/grape-markdown/route.rb
@@ -36,7 +36,7 @@ module GrapeMarkdown
end
def list?
- %w(GET POST).include?(route_method) && !route_path.include?(':id')
+ route_method == 'GET' && !route_path.include?(':id')
end
def route_binding | Why was POST considered a list endpoint? | technekes_grape-markdown | train | rb |
451f3d2f5fae5d153d337f00e35be9571638101c | diff --git a/packages/@vue/cli/lib/GeneratorAPI.js b/packages/@vue/cli/lib/GeneratorAPI.js
index <HASH>..<HASH> 100644
--- a/packages/@vue/cli/lib/GeneratorAPI.js
+++ b/packages/@vue/cli/lib/GeneratorAPI.js
@@ -283,7 +283,7 @@ class GeneratorAPI {
this._injectFileMiddleware(async (files) => {
const data = this._resolveData(additionalData)
const globby = require('globby')
- const _files = await globby(['**/*'], { cwd: source })
+ const _files = await globby(['**/*'], { cwd: source, dot: true })
for (const rawPath of _files) {
const targetPath = rawPath.split('/').map(filename => {
// dotfiles are ignored when published to npm, therefore in templates | feat: make globby includes dot files (#<I>)
<URL> | vuejs_vue-cli | train | js |
c51dc854bd433f2c37e551f3cf32cb2182dd0a77 | diff --git a/library/Garp/Db/Table/Row.php b/library/Garp/Db/Table/Row.php
index <HASH>..<HASH> 100755
--- a/library/Garp/Db/Table/Row.php
+++ b/library/Garp/Db/Table/Row.php
@@ -46,6 +46,16 @@ class Garp_Db_Table_Row extends Zend_Db_Table_Row_Abstract {
return $props;
}
+ public function __wakeup() {
+ parent::__wakeup();
+
+ // Immediately connect the row again, to not be bothered
+ // by "Cannot save row unless it is connected".
+ if ($this->_tableClass) {
+ $this->setTable(new $this->_tableClass);
+ }
+ }
+
/**
* ATTENTION:
* This code is copied and altered from Zend_Db_Table_Abstract::findManyToManyRowset(). | Change wakeup to connect after unserialization | grrr-amsterdam_garp3 | train | php |
9aba1c19900417a6cb0e55f80c0fe33f3bb7c50a | diff --git a/webapi_tests/setup.py b/webapi_tests/setup.py
index <HASH>..<HASH> 100644
--- a/webapi_tests/setup.py
+++ b/webapi_tests/setup.py
@@ -6,7 +6,7 @@ from setuptools import setup
from setuptools import find_packages
PACKAGE_VERSION = '0.1'
-deps = ['marionette_client==0.7.1',
+deps = ['marionette_client>=0.7.1.1',
'marionette_extension >= 0.1',
'moznetwork>=0.24',
'tornado>=3.2', | Upgrade marionette dependency to above <I>
This contains the wait module which is needed by some tests. | mozilla-b2g_fxos-certsuite | train | py |
a251b0bc6b48014e1a30779dfeabdfadcc95cce3 | diff --git a/openpnm/algorithms/NernstPlanckMultiphysics.py b/openpnm/algorithms/NernstPlanckMultiphysics.py
index <HASH>..<HASH> 100644
--- a/openpnm/algorithms/NernstPlanckMultiphysics.py
+++ b/openpnm/algorithms/NernstPlanckMultiphysics.py
@@ -124,7 +124,7 @@ class NernstPlanckMultiphysics(GenericAlgorithm):
phase.update(e.results())
# Poisson eq
- phys[0].regenerate_models()
+ [x.regenerate_models() for x in phys]
g_old[p_alg.name] = p_alg[p_alg.settings['quantity']].copy()
p_alg._run_reactive(x0=g_old[p_alg.name])
g_new[p_alg.name] = p_alg[p_alg.settings['quantity']].copy()
@@ -133,7 +133,7 @@ class NernstPlanckMultiphysics(GenericAlgorithm):
g_old[p_alg.name]**2 - g_new[p_alg.name]**2))
# Update phase and physics
phase.update(p_alg.results())
- phys[0].regenerate_models()
+ [x.regenerate_models() for x in phys]
if g_convergence:
print('Solution converged') | regenerate all phys attached to the project | PMEAL_OpenPNM | train | py |
0ded2b75991abc5b0d85eb8eb0f4d29c1b0aa495 | diff --git a/melody.go b/melody.go
index <HASH>..<HASH> 100644
--- a/melody.go
+++ b/melody.go
@@ -232,6 +232,16 @@ func (m *Melody) BroadcastOthers(msg []byte, s *Session) error {
})
}
+// BroadcastMultiple broadcasts a text message to multiple sessions given in the sessions slice.
+func (m *Melody) BroadcastMultiple(msg []byte, sessions []*Session) error {
+ return m.BroadcastFilter(msg, func(q *Session) bool {
+ for _, sess := range sessions {
+ return sess == q
+ }
+ return false
+ })
+}
+
// BroadcastBinary broadcasts a binary message to all sessions.
func (m *Melody) BroadcastBinary(msg []byte) error {
if m.hub.closed() { | Add convenience function to broadcast to multiple sessions | olahol_melody | train | go |
68ff8e43c010fe05a93e88f22e6f4d97ee5dbacb | diff --git a/mqlight/src/main/java/com/ibm/mqlight/api/impl/NonBlockingClientImpl.java b/mqlight/src/main/java/com/ibm/mqlight/api/impl/NonBlockingClientImpl.java
index <HASH>..<HASH> 100644
--- a/mqlight/src/main/java/com/ibm/mqlight/api/impl/NonBlockingClientImpl.java
+++ b/mqlight/src/main/java/com/ibm/mqlight/api/impl/NonBlockingClientImpl.java
@@ -1210,6 +1210,7 @@ public class NonBlockingClientImpl extends NonBlockingClient implements FSMActio
externalState = ClientState.RETRYING;
clientListener.onRetrying(callbackService, stoppedByUser ? null : lastException);
+ lastException = null;
logger.exit(this, methodName);
} | Ensure correct exception reported after a new state change | mqlight_java-mqlight | train | java |
4c38ec14ccb6be3250a03e2b9ab9b9ed43d1ac9c | diff --git a/wasync/src/main/java/org/atmosphere/wasync/transport/TransportsUtil.java b/wasync/src/main/java/org/atmosphere/wasync/transport/TransportsUtil.java
index <HASH>..<HASH> 100644
--- a/wasync/src/main/java/org/atmosphere/wasync/transport/TransportsUtil.java
+++ b/wasync/src/main/java/org/atmosphere/wasync/transport/TransportsUtil.java
@@ -80,7 +80,7 @@ public class TransportsUtil {
public static Object matchDecoder(Event e, Object instanceType, List<Decoder<? extends Object, ?>> decoders) {
for (Decoder d : decoders) {
Class<?>[] typeArguments = TypeResolver.resolveArguments(d.getClass(), Decoder.class);
- if (instanceType != null && typeArguments.length > 0 && typeArguments[0].equals(instanceType.getClass())) {
+ if (instanceType != null && typeArguments.length > 0 && typeArguments[0].isAssignableFrom(instanceType.getClass())) {
boolean replay = ReplayDecoder.class.isAssignableFrom(d.getClass());
logger.trace("{} is trying to decode {}", d, instanceType); | Proper resolving decoder | Atmosphere_wasync | train | java |
00b3966667c3f6e4109572a7d0137491bf2665cd | diff --git a/src/ConnectHollandSuluBlockBundle.php b/src/ConnectHollandSuluBlockBundle.php
index <HASH>..<HASH> 100644
--- a/src/ConnectHollandSuluBlockBundle.php
+++ b/src/ConnectHollandSuluBlockBundle.php
@@ -23,6 +23,8 @@ class ConnectHollandSuluBlockBundle extends Bundle
*/
public function boot()
{
+ $rootDirectory = $this->container->get('kernel')->getRootDir();
+ $this->registerStream($rootDirectory);
$this->container->get('twig')->getLoader()->addPath($this->getPath().'/Resources/views', 'sulu-block-bundle');
parent::boot(); | Fix container building
Sometimes the Kernel only boots and is not build, so partially revert 1a<I>ac7a8be7b<I>a<I>a<I>e3c<I>a3a<I>. | ConnectHolland_sulu-block-bundle | train | php |
aad190360b5f8261588026cf36e4ae780a868c5b | diff --git a/base.php b/base.php
index <HASH>..<HASH> 100644
--- a/base.php
+++ b/base.php
@@ -45,7 +45,7 @@ final class Base extends Prefab implements ArrayAccess {
//@{ Framework details
const
PACKAGE='Fat-Free Framework',
- VERSION='3.7.3-Release';
+ VERSION='3.7.4-Dev';
//@}
//@{ HTTP status codes (RFC 2616)
@@ -1376,7 +1376,7 @@ final class Base extends Prefab implements ArrayAccess {
if ($this->hive['CLI'])
echo PHP_EOL.'==================================='.PHP_EOL.
'ERROR '.$error['code'].' - '.$error['status'].PHP_EOL.
- $error['text'].PHP_EOL.PHP_EOL.$error['trace'];
+ $error['text'].PHP_EOL.PHP_EOL.(isset($error['trace']) ?: '');
else
echo $this->hive['AJAX']?
json_encode($error): | fix: trace not present in error handler when in CLI mode and !DEBUG, #<I> | bcosca_fatfree-core | train | php |
fde5d20095b38b33c1547d1756c3254d3bf67246 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -228,7 +228,7 @@ setup(
packages=find_packages(),
package_data={'ugali': ['data/catalog.tgz']},
description="Ultra-faint galaxy likelihood toolkit.",
- long_description=read('README.md'),
+ long_description="See README on %s"%URL,
platforms='any',
classifiers = [_f for _f in CLASSIFIERS.split('\n') if _f]
) | Replaced long_description with link to github | DarkEnergySurvey_ugali | train | py |
7d4177134bc5eab357d02e1b4807165d18c7668d | diff --git a/amino/either.py b/amino/either.py
index <HASH>..<HASH> 100644
--- a/amino/either.py
+++ b/amino/either.py
@@ -28,6 +28,16 @@ class Either(Generic[A, B], Implicits, implicits=True):
else:
return Left('{} has no attribute {}'.format(mod, name))
+ @staticmethod
+ def import_path(path):
+ from amino.list import List
+ return (
+ List.wrap(path.rsplit('.', 1))
+ .lift_all(0, 1)
+ .to_either('invalid module path: {}'.format(path))
+ .flat_map2(Either.import_name)
+ )
+
@property
def is_right(self):
return boolean.Boolean(isinstance(self, Right)) | `Either.import_path` | tek_amino | train | py |
4d97dd79681038651af1d49cfed4399699c77cf8 | diff --git a/tests/Feature/BuiltInSearchTest.php b/tests/Feature/BuiltInSearchTest.php
index <HASH>..<HASH> 100644
--- a/tests/Feature/BuiltInSearchTest.php
+++ b/tests/Feature/BuiltInSearchTest.php
@@ -26,7 +26,6 @@ class BuiltInSearchTest extends TestCase
Config::set('larecipe.search.enabled', true);
Config::set('larecipe.search.default', 'internal');
- $this->withoutExceptionHandling();
$this->get('/docs/search-index/1.0')
->assertStatus(200)
->assertJsonStructure([
@@ -36,7 +35,5 @@ class BuiltInSearchTest extends TestCase
'headings'
]
]);
-
- $this->assertTrue(true);
}
} | Update BuiltInSearchTest.php | saleem-hadad_larecipe | train | php |
310f18aaa1248411d5bb1cc08769ba6c8f575555 | diff --git a/molgenis-omx-protocolmanager/src/main/java/org/molgenis/omx/workflow/WorkflowServiceImpl.java b/molgenis-omx-protocolmanager/src/main/java/org/molgenis/omx/workflow/WorkflowServiceImpl.java
index <HASH>..<HASH> 100644
--- a/molgenis-omx-protocolmanager/src/main/java/org/molgenis/omx/workflow/WorkflowServiceImpl.java
+++ b/molgenis-omx-protocolmanager/src/main/java/org/molgenis/omx/workflow/WorkflowServiceImpl.java
@@ -273,8 +273,6 @@ public class WorkflowServiceImpl implements WorkflowService
List<ObservedValue> observedValues = database.find(ObservedValue.class, new QueryRule(
ObservedValue.OBSERVATIONSET, EQUALS, observationSet), new QueryRule(AND), new QueryRule(
ObservedValue.FEATURE, EQUALS, observableFeature));
- if (observedValues.size() > 1) throw new RuntimeException(
- "expected exactly one value for a row/column combination");
String colName = "key";
KeyValueTuple tuple = new KeyValueTuple();
@@ -311,6 +309,8 @@ public class WorkflowServiceImpl implements WorkflowService
observedValue.setValue(value);
database.add(observedValue);
}
+ else if (observedValues.size() > 1) throw new RuntimeException(
+ "expected exactly one value for a row/column combination");
else
{
Value value = observedValues.get(0).getValue(); | bug fix: perform size check of after null check | molgenis_molgenis | train | java |
34e49c3c0cee0e8ca899780364418c758beb75a7 | diff --git a/src/Generator/Writer/Model/Steps/StubReplaceAccessorsAndMutators.php b/src/Generator/Writer/Model/Steps/StubReplaceAccessorsAndMutators.php
index <HASH>..<HASH> 100644
--- a/src/Generator/Writer/Model/Steps/StubReplaceAccessorsAndMutators.php
+++ b/src/Generator/Writer/Model/Steps/StubReplaceAccessorsAndMutators.php
@@ -33,7 +33,13 @@ class StubReplaceAccessorsAndMutators extends AbstractProcessStep
$parameterString = implode(', ', $parameters);
}
- $replace .= $this->tab() . "public function get" . studly_case($name) . "Attribute({$parameterString})\n"
+ $methodSignature = "public function "
+ . (array_get($accessor, 'mutator') ? 'set' : 'get')
+ . studly_case($name)
+ . "Attribute"
+ . "({$parameterString})";
+
+ $replace .= $this->tab() . $methodSignature . "\n"
. $this->tab() . "{\n"
. $accessor['content']
. $this->tab() . "}\n" | allowed accessors to set mutators with a boolean 'mutator' flag | czim_laravel-pxlcms | train | php |
daee73b39870584585193d63e3d08c75bce0c9aa | diff --git a/spyderlib/widgets/sourcecode/syntaxhighlighters.py b/spyderlib/widgets/sourcecode/syntaxhighlighters.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/sourcecode/syntaxhighlighters.py
+++ b/spyderlib/widgets/sourcecode/syntaxhighlighters.py
@@ -337,7 +337,7 @@ class PythonSH(BaseSH):
title = title.lstrip("#% ")
if title.startswith("<codecell>"):
title = title[10:].lstrip()
- if title.startswith("In["):
+ elif title.startswith("In["):
title = title[3:].rstrip("]:")
oedata = OutlineExplorerData()
oedata.text = title | elif is clearer here | spyder-ide_spyder | train | py |
02b715cc237c4080d0f0c607e294d0ad76bc3a11 | diff --git a/lib/async.js b/lib/async.js
index <HASH>..<HASH> 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -886,7 +886,7 @@
}
workers += 1;
var cb = only_once(_next(q, tasks));
- async.setImmediate(worker(data, cb));
+ worker(data, cb);
}
}
}, | fix tests in node <I> | caolan_async | train | js |
3f8d0166a2e2d656744e51291babda6b02e814a4 | diff --git a/javascript/dashboards.js b/javascript/dashboards.js
index <HASH>..<HASH> 100644
--- a/javascript/dashboards.js
+++ b/javascript/dashboards.js
@@ -90,6 +90,7 @@
}
},
draggable: {
+ handle: '.dashlet-title h3',
stop: function(e, i) {
/*
* If objects have changed position, cycle through all changed objects | Use a drag handle for dashlets istead of whole dashlet | nyeholt_silverstripe-frontend-dashboards | train | js |
bba829110ae6da053d8c8897c5b95499ed6eb4df | diff --git a/iaas/amazonec2/amazonec2.go b/iaas/amazonec2/amazonec2.go
index <HASH>..<HASH> 100644
--- a/iaas/amazonec2/amazonec2.go
+++ b/iaas/amazonec2/amazonec2.go
@@ -1,12 +1,11 @@
package amazonec2
import (
+ "context"
"encoding/json"
"fmt"
"io/ioutil"
- "context"
-
"github.com/docker/machine/drivers/amazonec2"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/drivers/rpc"
@@ -145,8 +144,5 @@ func (p *Provider) CreateMachine() (machine *iaas.Machine, err error) {
func (p *Provider) DeleteMachine() (err error) {
err = p.Host.Driver.Remove()
defer p.Client.Close()
- if err != nil {
- return
- }
return
} | iaas/amazonec2/amazonec2: Fixed context import and return into deleteMachine. (#<I>) | gofn_gofn | train | go |
c8791fec4be9d463cec35eff1ee51777fdae2b82 | diff --git a/cachalot/monkey_patch.py b/cachalot/monkey_patch.py
index <HASH>..<HASH> 100644
--- a/cachalot/monkey_patch.py
+++ b/cachalot/monkey_patch.py
@@ -1,3 +1,4 @@
+import re
from collections.abc import Iterable
from functools import wraps
from time import time
@@ -21,6 +22,13 @@ from .utils import (
WRITE_COMPILERS = (SQLInsertCompiler, SQLUpdateCompiler, SQLDeleteCompiler)
+SQL_DATA_CHANGE_RE = re.compile(
+ '|'.join([
+ fr'(\W|\A){re.escape(keyword)}(\W|\Z)'
+ for keyword in ['update', 'insert', 'delete', 'alter', 'create', 'drop']
+ ]),
+ flags=re.IGNORECASE,
+)
def _unset_raw_connection(original):
def inner(compiler, *args, **kwargs):
@@ -133,9 +141,7 @@ def _patch_cursor():
if isinstance(sql, bytes):
sql = sql.decode('utf-8')
sql = sql.lower()
- if 'update' in sql or 'insert' in sql or 'delete' in sql \
- or 'alter' in sql or 'create' in sql \
- or 'drop' in sql:
+ if SQL_DATA_CHANGE_RE.search(sql):
tables = filter_cachable(
_get_tables_from_sql(connection, sql))
if tables: | table invalidation condition enhanced (#<I>) | noripyt_django-cachalot | train | py |
a3613be312eeb694dbd513693e196807b392dcf7 | diff --git a/modules/logging.js b/modules/logging.js
index <HASH>..<HASH> 100644
--- a/modules/logging.js
+++ b/modules/logging.js
@@ -11,8 +11,21 @@ module.exports = {
initMaster: function(config) {
var logStream = process.stdout;
- if(config.logging && config.logging.logFile)
- logStream = fs.createWriteStream(config.logging.logFile, {'flags': 'a'});
+ var watcher;
+ if(config.logging && config.logging.logFile) {
+ function openLogFile() {
+ logStream = fs.createWriteStream(config.logging.logFile, {'flags': 'a'});
+ logStream.on('open', function() {
+ watcher = fs.watch(config.logging.logFile, function(action, filename) {
+ if(action == 'rename') {
+ watcher.close();
+ openLogFile();
+ }
+ });
+ });
+ }
+ openLogFile();
+ }
process.on('msg:log', function(data) {
var str = JSON.stringify(data) + "\n"; | Detect log file renaming and reopen log file. (for log rotation) | virtkick_http-master | train | js |
3a6c43d2da08a7452f6b76d1813aa70ba36b8a54 | diff --git a/summary/__init__.py b/summary/__init__.py
index <HASH>..<HASH> 100644
--- a/summary/__init__.py
+++ b/summary/__init__.py
@@ -205,14 +205,16 @@ class Summary(object):
stream = response.iter_content(config.CHUNK_SIZE) # , decode_unicode=True
response.stream = stream
while True:
- chunk = next(stream)
- self._html += chunk
- tag = find_tag(tag_name)
- if tag:
- return tag
- if len(self._html) > config.HTML_MAX_BYTESIZE:
- raise HTMLParseError('Maximum response size reached.')
- response.consumed = True
+ try:
+ chunk = next(stream)
+ self._html += chunk
+ tag = find_tag(tag_name)
+ if tag:
+ return tag
+ if len(self._html) > config.HTML_MAX_BYTESIZE:
+ raise HTMLParseError('Maximum response size reached.')
+ except StopIteration:
+ response.consumed = True
tag = find_tag(tag_name)
return decode(tag, encoding) # decode here | Properly iterate stream response content. | svven_summary | train | py |
da3162a06576f5b6ea452d642dd8b85fe1a4fc1c | diff --git a/test/tests.js b/test/tests.js
index <HASH>..<HASH> 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -1,7 +1,7 @@
var assert = require("assert");
var hasOwn = Object.prototype.hasOwnProperty;
-describe("import statements", function () {
+describe("import declarations", function () {
it("should work in nested scopes", function () {
import { name, id } from "./name";
assert.strictEqual(name, "name.js");
@@ -40,7 +40,7 @@ describe("import statements", function () {
});
});
-describe("export statements", function () {
+describe("export declarations", function () {
it("should allow * exports", function () {
import def, {
a, b, c as d,
@@ -82,7 +82,7 @@ describe("export statements", function () {
assert.strictEqual(si, "cee");
});
- it("should be able to contain import statements", function () {
+ it("should be able to contain import declarations", function () {
import { outer } from "./nested";
assert.deepEqual(outer(), ["a", "b", "c"]);
}); | Update statement/declaration terminology in test code. | benjamn_reify | train | js |
5fe229b657521d8f19099b054849d1bb42b537ef | diff --git a/loggers/FileLogger.php b/loggers/FileLogger.php
index <HASH>..<HASH> 100644
--- a/loggers/FileLogger.php
+++ b/loggers/FileLogger.php
@@ -7,6 +7,15 @@ use mpf\WebApp;
class FileLogger extends Logger{
+ public $visibleLevels = array(
+ Levels::EMERGENCY,
+ Levels::CRITICAL,
+ Levels::ALERT,
+ Levels::ERROR,
+ Levels::WARNING,
+ Levels::NOTICE,
+ Levels::INFO
+ );
/**
* Path for file where to save the logs
* Can use key words like {MODULE}, {CONTROLLER} for web apps and {APP_ROOT} for all.
@@ -71,7 +80,7 @@ class FileLogger extends Logger{
}
}
}
- if (false === @file_put_contents($this->_path, $details . "\n")){
+ if (false === @file_put_contents($this->_path, $details . "\n", FILE_APPEND)){
$this->_writeFailure = true;
}
} | Removed debug from logs. Logs are now appended to old file. | mpf-soft_mpf | train | php |
e7e368778d6144043f7cdad1d41d9cd3000bc045 | diff --git a/tests/lib/test-papi-functions-filters.php b/tests/lib/test-papi-functions-filters.php
index <HASH>..<HASH> 100644
--- a/tests/lib/test-papi-functions-filters.php
+++ b/tests/lib/test-papi-functions-filters.php
@@ -26,21 +26,6 @@ class WP_Papi_Functions_Filters extends WP_UnitTestCase {
}
/**
- * Test _papi_body_class.
- *
- * @since 1.0.0
- */
-
- public function test_papi_body_class() {
- global $post;
- $post = get_post( $this->post_id );
- $page_type = add_post_meta( $post->ID, '_papi_page_type', 'simple-page-type' );
- $arr = apply_filters( 'body_class', array() );
- tests_add_filter( 'body_class', '_papi_body_class' );
- $this->assertTrue( in_array( 'simple-page-type', $arr ) );
- }
-
- /**
* Test _papi_filter_default_sort_order.
*
* @since 1.0.0 | Removing body class test since it aint working correct | wp-papi_papi | train | php |
03fd54eeebd08e6586697e1abc051bd903a040f2 | diff --git a/packages/vaex-core/vaex/cpu.py b/packages/vaex-core/vaex/cpu.py
index <HASH>..<HASH> 100644
--- a/packages/vaex-core/vaex/cpu.py
+++ b/packages/vaex-core/vaex/cpu.py
@@ -334,7 +334,10 @@ class TaskPartAggregations:
N = i2 - i1
if filter_mask is not None:
- N = filter_mask.astype(np.uint8).sum()
+ if blocks:
+ N = len(blocks[0])
+ else:
+ N == filter_mask.sum()
blocks = [array_types.to_numpy(block, strict=False) for block in blocks]
for block in blocks:
assert len(block) == N, f'Oops, got a block of length {len(block)} while it is expected to be of length {N} (at {i1}-{i2}, filter={filter_mask is not None})' | perf: avoid counting filtered rows | vaexio_vaex | train | py |
c2efc333bcc970e180914e9a877fbec845fb85c2 | diff --git a/src/com/opera/core/systems/WaitState.java b/src/com/opera/core/systems/WaitState.java
index <HASH>..<HASH> 100644
--- a/src/com/opera/core/systems/WaitState.java
+++ b/src/com/opera/core/systems/WaitState.java
@@ -92,7 +92,7 @@ public class WaitState {
private Response response;
private boolean seen;
private long remainingIdleTimeout;
- private DesktopWindowInfo desktopWindowInfo; // No idea if this is right but it will
+ private DesktopWindowInfo desktopWindowInfo;
private QuickMenuInfo quickMenuInfo;
private QuickMenuID quickMenuId;
private QuickMenuItemID quickMenuItemID; | Not sure what this comment was meant to serve for | operasoftware_operaprestodriver | train | java |
62af36ad9c1b153aa5f38079214a1400cdc2c168 | diff --git a/application/Controllers/Checks.php b/application/Controllers/Checks.php
index <HASH>..<HASH> 100644
--- a/application/Controllers/Checks.php
+++ b/application/Controllers/Checks.php
@@ -7,6 +7,15 @@ use CodeIgniter\I18n\Time;
use CodeIgniter\Model;
use Config\Database;
+/**
+ * NOTE: This is not a valid file for actual tests.
+ * This file came about as a small testbed I was using that
+ * accidentally got committed. It will be removed prior to release
+ * If you commit any changes to this file, it should be accompanied
+ * by actual tests also.
+ *
+ * @package App\Controllers
+ */
class Checks extends Controller
{
use ResponseTrait; | [ci_skip] Quick note to the Checks controller | codeigniter4_CodeIgniter4 | train | php |
41aed1ac89be3e877caf7d61ff9e3784ce8b3467 | diff --git a/symphony/assets/symphony.duplicator.js b/symphony/assets/symphony.duplicator.js
index <HASH>..<HASH> 100644
--- a/symphony/assets/symphony.duplicator.js
+++ b/symphony/assets/symphony.duplicator.js
@@ -224,8 +224,14 @@
var header = template.find(settings.headers).addClass('header');
var option = widgets.selector.append('<option />')
.find('option:last');
-
- option.text(header.text()).val(position);
+
+ var header_children = header.children();
+ if (header_children.length) {
+ header_text = header.get(0).childNodes[0].nodeValue + ' (' + header_children.filter(':eq(0)').text() + ')';
+ } else {
+ header_text = header.text();
+ }
+ option.text(header_text).val(position);
templates.push(template.removeClass('template'));
}); | When building dropdown list options for a duplicator, if the heading contains child elements put this text in brackets. [Closes Issue #<I>] | symphonycms_symphony-2 | train | js |
c45c1fb39ed8af8b5cf055bfbebabf58a74f20d0 | diff --git a/lib/deas/version.rb b/lib/deas/version.rb
index <HASH>..<HASH> 100644
--- a/lib/deas/version.rb
+++ b/lib/deas/version.rb
@@ -1,3 +1,3 @@
module Deas
- VERSION = "0.14.1"
+ VERSION = "0.15.0"
end | version to <I>
* make the Deas logger available in the template scope (#<I>)
* have the test runner `halt` return a `HaltArgs` class for use in testing (#<I>) | redding_deas | train | rb |
24d1e91dd21c692ec50f396f4b125e08d0ae3f7c | diff --git a/PhpCheckstyle/src/PHPCheckstyle.php b/PhpCheckstyle/src/PHPCheckstyle.php
index <HASH>..<HASH> 100644
--- a/PhpCheckstyle/src/PHPCheckstyle.php
+++ b/PhpCheckstyle/src/PHPCheckstyle.php
@@ -2214,9 +2214,12 @@ class PHPCheckstyle {
|| $nextTokenText == ".=");
// Check the following token
- $nextTokenInfo = $this->tokenizer->peekNextValidToken($nextTokenInfo->position);
- $nextTokenText = $this->tokenizer->extractTokenText($nextTokenInfo->token);
- $isSearchResult = in_array($nextTokenText, $this->_config->getTestItems('strictCompare'));
+ $isSearchResult = false;
+ if ($this->_isActive('strictCompare')) {
+ $nextTokenInfo = $this->tokenizer->peekNextValidToken($nextTokenInfo->position);
+ $nextTokenText = $this->tokenizer->extractTokenText($nextTokenInfo->token);
+ $isSearchResult = in_array($nextTokenText, $this->_config->getTestItems('strictCompare'));
+ }
// Check if the variable has already been met
if (empty($this->_variables[$text]) && !in_array($text, $this->_systemVariables)) { | Issue <I>: New Rule : Use of "==" in strpos | PHPCheckstyle_phpcheckstyle | train | php |
6b97aa53521c6424e278b79d326c056a27f2ad00 | diff --git a/core/src/main/java/smile/regression/OLS.java b/core/src/main/java/smile/regression/OLS.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/smile/regression/OLS.java
+++ b/core/src/main/java/smile/regression/OLS.java
@@ -177,6 +177,10 @@ public class OLS implements Regression<double[]> {
int n = x.length;
p = x[0].length;
+
+ if (n <= p) {
+ throw new IllegalArgumentException(String.format("The input matrix is not over determined: %d rows, %d columns", n, p));
+ }
// weights and intercept
double[] w1 = new double[p+1];
diff --git a/core/src/main/java/smile/regression/RidgeRegression.java b/core/src/main/java/smile/regression/RidgeRegression.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/smile/regression/RidgeRegression.java
+++ b/core/src/main/java/smile/regression/RidgeRegression.java
@@ -189,6 +189,11 @@ public class RidgeRegression implements Regression<double[]> {
int n = x.length;
p = x[0].length;
+
+ if (n <= p) {
+ throw new IllegalArgumentException(String.format("The input matrix is not over determined: %d rows, %d columns", n, p));
+ }
+
ym = Math.mean(y);
center = Math.colMean(x); | add early detection of input matrix size for linear and ridge regression | haifengl_smile | train | java,java |
1d22c792b4200b639f9826daa03f11fa5ce1109d | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -85,7 +85,7 @@ function scopedChain(parent) {
title = prefix ? prefix.join(' ') : null;
var targetArgs = title ? [title] : [];
targetArgs = fn ? targetArgs.concat(fn) : targetArgs;
- return target.apply(target, [title, fn]);
+ return target.apply(target, targetArgs);
});
return chain.test;
diff --git a/spec/test.js b/spec/test.js
index <HASH>..<HASH> 100644
--- a/spec/test.js
+++ b/spec/test.js
@@ -1,10 +1,22 @@
'use strict';
var test = require('../');
+test.beforeEach(function (t) {
+ t.context.test = 'test';
+});
+
+test(function (t) {
+ t.is(true, true);
+});
+
test('is compatible with ava', function (t) {
t.is(true, true);
});
+test('is compatible with ava context', function (t) {
+ t.true(t.context.test === 'test');
+});
+
test.describe('describe', function (test) {
test('can be used to nest tests', function (t) {
t.is(true, true); | Prevent exception when using beforeEach (#4) | sheerun_ava-spec | train | js,js |
22404822a7eb74c4f18c9d7f697a9553fadc1c8b | diff --git a/js/exx.js b/js/exx.js
index <HASH>..<HASH> 100644
--- a/js/exx.js
+++ b/js/exx.js
@@ -196,10 +196,10 @@ module.exports = class exx extends Exchange {
const ids = Object.keys (response);
for (let i = 0; i < ids.length; i++) {
const id = ids[i];
- if (!(id in this.marketsById)) {
+ if (!(id in this.markets_by_id)) {
continue;
}
- const market = this.marketsById[id];
+ const market = this.markets_by_id[id];
const symbol = market['symbol'];
const ticker = {
'date': timestamp, | exx marketsById → markets_by_id #<I> | ccxt_ccxt | train | js |
9367ef96e3a7ee80c2b4369c618b5db6a3088c7c | diff --git a/src/GitHub_Updater/API.php b/src/GitHub_Updater/API.php
index <HASH>..<HASH> 100644
--- a/src/GitHub_Updater/API.php
+++ b/src/GitHub_Updater/API.php
@@ -211,7 +211,7 @@ abstract class API extends Base {
}
// Allows advanced caching plugins to control REST transients to avoid double caching
- if ( false === apply_filters( 'ghu_use_remote_call_transients', true, $id, $response ) ) {
+ if ( false === apply_filters( 'ghu_use_remote_call_transients', true ) ) {
return false;
}
return get_site_transient( $transient ); | fix notices from vars that don't exist | afragen_github-updater | train | php |
e978f8b48c945e8bddd4d4dbb2e910dfb758c9ef | diff --git a/lib/loglevel.js b/lib/loglevel.js
index <HASH>..<HASH> 100644
--- a/lib/loglevel.js
+++ b/lib/loglevel.js
@@ -35,7 +35,7 @@
if (method.bind === undefined) {
if (Function.prototype.bind === undefined) {
return function() {
- method.apply(console, arguments);
+ Function.prototype.apply.apply(method, [console, arguments]);
};
} else {
return Function.prototype.bind.call(console[methodName], console); | Transformed apply() to make it work in IE8's with weird callable object console methods. Fixes #<I>, fixes #<I>. | pimterry_loglevel | train | js |
bf2d6499f6f4a7f1a8e9bb375c2534f67d825bb0 | diff --git a/tests/unit/deprecate-test.js b/tests/unit/deprecate-test.js
index <HASH>..<HASH> 100644
--- a/tests/unit/deprecate-test.js
+++ b/tests/unit/deprecate-test.js
@@ -9,14 +9,14 @@ let originalEnvValue;
let originalDeprecateHandler;
module('ember-debug', {
- setup() {
+ beforeEach() {
originalEnvValue = Ember.ENV.RAISE_ON_DEPRECATION;
originalDeprecateHandler = HANDLERS.deprecate;
Ember.ENV.RAISE_ON_DEPRECATION = true;
},
- teardown() {
+ afterEach() {
HANDLERS.deprecate = originalDeprecateHandler;
Ember.ENV.RAISE_ON_DEPRECATION = originalEnvValue; | Replace legacy QUnit 1.x API with 2.x version.
After the general dependency updates done recently we are pulling in
QUnit 2.x which no longer supports `setup` and `teardown`. | rwjblue_ember-debug-handlers-polyfill | train | js |
08d8a0461db900fe947b84b60476e261c85f6e8e | diff --git a/src/CloudApi/Client.php b/src/CloudApi/Client.php
index <HASH>..<HASH> 100644
--- a/src/CloudApi/Client.php
+++ b/src/CloudApi/Client.php
@@ -313,7 +313,7 @@ class Client extends GuzzleClient
/**
* @param string $id
- * @param string $domains
+ * @param array $domains
* @return StreamInterface
*/
public function purgeVarnishCache($id, $domains) | Changes type hinting on domains. | typhonius_acquia-php-sdk-v2 | train | php |
30b958d2302cc6c6c8c1b934badc2a807bc17f68 | diff --git a/lib/Core/Persistence/Doctrine/Layout/Handler.php b/lib/Core/Persistence/Doctrine/Layout/Handler.php
index <HASH>..<HASH> 100644
--- a/lib/Core/Persistence/Doctrine/Layout/Handler.php
+++ b/lib/Core/Persistence/Doctrine/Layout/Handler.php
@@ -666,7 +666,7 @@ class Handler implements LayoutHandlerInterface
$nextBlockPosition = $this->getNextBlockPosition(
$block->layoutId,
- $block->zoneIdentifier,
+ $zoneIdentifier,
$status
); | Fix exception in some cases when moving the block to zone | netgen-layouts_layouts-core | train | php |
1df71dc48718b471260c407562905f1cc5f4b241 | diff --git a/NamedBuilderBagTest.php b/NamedBuilderBagTest.php
index <HASH>..<HASH> 100644
--- a/NamedBuilderBagTest.php
+++ b/NamedBuilderBagTest.php
@@ -11,7 +11,6 @@
namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL;
-
use ONGR\ElasticsearchBundle\DSL\NamedBuilderBag;
use ONGR\ElasticsearchBundle\DSL\NamedBuilderInterface; | Changed warmer parameter from connection to manager | ongr-io_ElasticsearchDSL | train | php |
dc31e3a482124d0f7fcaef6adabd897ab7e5eb35 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -335,8 +335,8 @@ function vuCoin(host, port, authenticated, withSignature, intialized){
dealMerkle(ResultTypes.Voting, '/registry/amendment/' + number + '/' + algo + '/voters/out', opts, done);
},
- flow: function (number, algo, done) {
- getVote('/registry/amendment/' + number + '/' + algo + '/flow', done);
+ statement: function (number, algo, done) {
+ getVote('/registry/amendment/' + number + '/' + algo + '/statement', done);
},
vote: function (number, algo, done) { | Renaming 'flow' to 'statement' | duniter_ucoin-cli | train | js |
6c6dd173c7b8f755d3784ee34368904faa4cd2bf | diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb
index <HASH>..<HASH> 100644
--- a/lib/jekyll/page.rb
+++ b/lib/jekyll/page.rb
@@ -122,7 +122,12 @@ module Jekyll
#
# Returns the path to the source file
def path
- self.data.fetch('path', File.join(@dir, @name).sub(/\A\//, ''))
+ self.data.fetch('path', self.relative_path.sub(/\A\//, ''))
+ end
+
+ # The path to the page source file, relative to the site source
+ def relative_path
+ File.join(@dir, @name)
end
# Obtain destination path.
diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb
index <HASH>..<HASH> 100644
--- a/lib/jekyll/post.rb
+++ b/lib/jekyll/post.rb
@@ -124,7 +124,12 @@ module Jekyll
#
# Returns the path to the file relative to the site source
def path
- self.data.fetch('path', File.join(@dir, '_posts', @name).sub(/\A\//, ''))
+ self.data.fetch('path', self.relative_path.sub(/\A\//, ''))
+ end
+
+ # The path to the post source file, relative to the site source
+ def relative_path
+ File.join(@dir, '_posts', @name)
end
# Compares Post objects. First compares the Post date. If the dates are | Post + Page: extract real path retrieval into separate method (@parkr) | jekyll_jekyll | train | rb,rb |
821305d8855a39176e5ed7b55d91ba5c36e8aeef | diff --git a/lib/muack.rb b/lib/muack.rb
index <HASH>..<HASH> 100644
--- a/lib/muack.rb
+++ b/lib/muack.rb
@@ -48,12 +48,14 @@ module Muack
end
end
- class Unexpected < RuntimeError
+ class Unexpected < Exception
+ attr_reader :expected, :was
def initialize obj, defi, args
- super(
- "\nExpected: #{obj.inspect}.#{defi.message}(#{defi.args.map(&:inspect).join(', ')})\n" \
- " but was: #{obj.inspect}.#{defi.message}(#{args.map(&:inspect).join(', ')})"
- )
+ @expected = "#{obj.inspect}.#{defi.message}(" \
+ "#{defi.args.map(&:inspect).join(', ')})"
+ @was = "#{obj.inspect}.#{defi.message}(" \
+ "#{args.map(&:inspect).join(', ')})"
+ super("\nExpected: #{expected}\n but was: #{was})")
end
end
end | make Unexpected an Exception to avoid rescued wrongly, and ezer to test | godfat_muack | train | rb |
dabd9550ce502082db8748942f237deee7cb2080 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,8 @@ try:
stringify_py('images', 'tk_tools/images.py')
except NameError:
print('warning: stringify not present at time of install,'
- ' you may wish to run this script again')
+ ' you may wish to run this script if tk_tools.images'
+ ' needs to be regenerated')
setup(
name='tk_tools', | Updating error that occurs when 'stringify' is not installed during run of setup.py | slightlynybbled_tk_tools | train | py |
e74d664db0dadf286b402ee4441a1ba43849bd5b | diff --git a/angular-hal.js b/angular-hal.js
index <HASH>..<HASH> 100644
--- a/angular-hal.js
+++ b/angular-hal.js
@@ -217,6 +217,7 @@ angular
case 2:
if (res.data) return createResource(href, options, res.data);
if (res.headers('Content-Location')) return res.headers('Content-Location');
+ if (res.headers('Location')) return res.headers('Location');
return null;
default: | add support to HTTP Response Header Location | LuvDaSun_angular-hal | train | js |
683d60d9f2a02102e63d337e6f3976365c2ef3e7 | diff --git a/src/GrumPHP/Task/Phpunit.php b/src/GrumPHP/Task/Phpunit.php
index <HASH>..<HASH> 100644
--- a/src/GrumPHP/Task/Phpunit.php
+++ b/src/GrumPHP/Task/Phpunit.php
@@ -57,7 +57,7 @@ class Phpunit extends AbstractExternalTask
));
if ($config['config_file']) {
- $this->processBuilder->add('-c' . $config['config_file']);
+ $this->processBuilder->add('--configuration=' . $config['config_file']);
}
$process = $this->processBuilder->getProcess(); | Fixed a problem when running phpunit in Symfony, throwing exceptions with the message 'Unable to guess the Kernel directory.' | phpro_grumphp | train | php |
2f07e8b9545b4f1ec71034a491031c5afc3abfe5 | diff --git a/SearchEndpoint/AggregationsEndpoint.php b/SearchEndpoint/AggregationsEndpoint.php
index <HASH>..<HASH> 100644
--- a/SearchEndpoint/AggregationsEndpoint.php
+++ b/SearchEndpoint/AggregationsEndpoint.php
@@ -40,7 +40,7 @@ class AggregationsEndpoint implements SearchEndpointInterface
*/
public function normalize(NormalizerInterface $normalizer, $format = null, array $context = [])
{
- if (!empty($this->bag->all())) {
+ if (count($this->bag->all()) > 0) {
return $this->bag->toArray();
}
} | AggregationsEndpoint is now using count() instead of empty() | ongr-io_ElasticsearchDSL | train | php |
9e23c5b591ed530d4fd96a5168febe4fab71b2db | diff --git a/lyrics.py b/lyrics.py
index <HASH>..<HASH> 100644
--- a/lyrics.py
+++ b/lyrics.py
@@ -689,13 +689,13 @@ def run_mp(filename):
audiofile.tag.save()
return Mp_res(source, filename, runtimes)
else:
- logger.info('-- '+source.__name__+': Could not find lyrics for ' + filename + '\n')
+ logger.info(f'-- {source.__name__}: Could not find lyrics for {filename}\n')
except (HTTPError, HTTPException, URLError, ConnectionError) as e:
# if not hasattr(e, 'code') or e.code != 404:
# logger.exception(f'== {source.__name__}: {e}\n')
- logger.info('-- '+source.__name__+': Could not find lyrics for ' + filename + '\n')
+ logger.info(f'-- {source.__name__}: Could not find lyrics for {filename}\n')
finally:
end = time.time() | Changed java-style string adding for f-strings | ocaballeror_LyricFetch | train | py |
4bc6ea601b08255dea5d01d719cad1473223270e | diff --git a/bibliopixel/drivers/network_receiver.py b/bibliopixel/drivers/network_receiver.py
index <HASH>..<HASH> 100644
--- a/bibliopixel/drivers/network_receiver.py
+++ b/bibliopixel/drivers/network_receiver.py
@@ -1,14 +1,8 @@
-import threading
-import os
+import os, threading
-try:
- import SocketServer
-except:
- import socketserver as SocketServer
+import socketserver as SocketServer
from .. drivers.return_codes import RETURN_CODES
from . network import CMDTYPE
-
-os.sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from .. util import log | Stop network_receiver.py from changing `sys.path` (fix #<I>) | ManiacalLabs_BiblioPixel | train | py |
04619d72bfeda28d55933c4944b492f097b94810 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -25,8 +25,12 @@ try:
except (IOError, ImportError):
description = ''
-with open('requirements.txt') as fhandle:
- requirements = [line.strip() for line in fhandle]
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+if on_rtd:
+ requirements = []
+else:
+ with open('requirements.txt') as fhandle:
+ requirements = [line.strip() for line in fhandle]
setup(
name='optlang', | Harden setup.py against RTD | biosustain_optlang | train | py |
29495450718fdd1762641b1d81cac33c0fd5e014 | diff --git a/pycbc/inject/injfilterrejector.py b/pycbc/inject/injfilterrejector.py
index <HASH>..<HASH> 100644
--- a/pycbc/inject/injfilterrejector.py
+++ b/pycbc/inject/injfilterrejector.py
@@ -233,7 +233,7 @@ class InjFilterRejector(object):
def generate_short_inj_from_inj(self, inj_waveform, simulation_id):
"""Generate and a store a truncated representation of inj_waveform."""
- if not self.enabled:
+ if not self.enabled or not self.match_threshold:
# Do nothing!
return
if simulation_id in self.short_injections: | Don't gen short injections when not needed (#<I>) | gwastro_pycbc | train | py |
7170b36b89216edc4330181b63f1f77519e7c556 | diff --git a/src/Excel.php b/src/Excel.php
index <HASH>..<HASH> 100644
--- a/src/Excel.php
+++ b/src/Excel.php
@@ -87,7 +87,18 @@ class Excel {
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
*/
public static function sheetToArray( $path, $sheetIndex = 0 ) {
- $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
+ $path_parts = pathinfo($path);
+ $fileExtension = $path_parts['extension'];
+
+ switch($fileExtension):
+ case 'xls':
+ $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
+ break;
+ case 'xlxs':
+ default:
+ $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
+ break;
+ endswitch;
$reader->setLoadSheetsOnly( [ 0 ] );
$spreadsheet = $reader->load( $path );
return $spreadsheet->setActiveSheetIndex( $sheetIndex )->toArray(); | Creating the reader specific to the xls version now. | DPRMC_Excel | train | php |
2d9680e52bd372420e44155ed9b61df5e0537b96 | diff --git a/app/validators/safe_html.rb b/app/validators/safe_html.rb
index <HASH>..<HASH> 100644
--- a/app/validators/safe_html.rb
+++ b/app/validators/safe_html.rb
@@ -19,14 +19,26 @@ class SafeHtml < ActiveModel::Validator
end
def check_string(record, field_name, string)
- dirty_html = Govspeak::Document.new(string).to_html
- clean_html = Sanitize.clean(dirty_html, sanitize_config)
- # Trying to make whitespace consistent
- if Nokogiri::HTML.parse(dirty_html).to_s != Nokogiri::HTML.parse(clean_html).to_s
+ dirty_html = govspeak_to_html(string)
+ clean_html = sanitize_html(dirty_html)
+ unless normalise_html(dirty_html) == normalise_html(clean_html)
record.errors.add(field_name, "cannot include invalid Govspeak or JavaScript")
end
end
+ # Make whitespace in html tags consistent
+ def normalise_html(string)
+ Nokogiri::HTML.parse(string).to_s
+ end
+
+ def govspeak_to_html(string)
+ Govspeak::Document.new(string).to_html
+ end
+
+ def sanitize_html(string)
+ Sanitize.clean(string, sanitize_config)
+ end
+
def sanitize_config
config = Sanitize::Config::RELAXED.dup | Break out html conversion into separate methods to clarify the intent | alphagov_govuk_content_models | train | rb |
38ec08db7e017ff365c434587df1cc836298553a | diff --git a/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php b/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php
index <HASH>..<HASH> 100644
--- a/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php
+++ b/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php
@@ -29,13 +29,17 @@ class AlternativeCodingStandardsBehaviorTest extends PHPUnit_Framework_TestCase
{
}"),
array("if (true) {
-}", "if (true) {
+}", "if (true)
+{
}"),
array("} else {
-}", "} else {
+}", "}
+else
+{
}"),
array("foreach (\$i as \$j) {
-}", "foreach (\$i as \$j) {
+}", "foreach (\$i as \$j)
+{
}"),
);
} | Revert bad CS fix (alternative CS behavior) | propelorm_Propel | train | php |
4ace13d189704a96753ee8f4097465401a51c4a0 | diff --git a/firebirdsql/wireprotocol.py b/firebirdsql/wireprotocol.py
index <HASH>..<HASH> 100644
--- a/firebirdsql/wireprotocol.py
+++ b/firebirdsql/wireprotocol.py
@@ -972,6 +972,7 @@ class WireProtocol(object):
while bytes_to_bint(b) == self.op_dummy:
b = self.recv_channel(4)
if bytes_to_bint(b) == self.op_response:
+ self.lazy_response_count -= 1
return self._parse_op_response()
if bytes_to_bint(b) == self.op_exit or bytes_to_bint(b) == self.op_exit:
raise DisconnectByPeer | one more lazy response counter decrement. | nakagami_pyfirebirdsql | train | py |
cf7bedb51bd8bd5531f5d463f7bbfb018cd63c89 | diff --git a/src/RobotsTxt.php b/src/RobotsTxt.php
index <HASH>..<HASH> 100644
--- a/src/RobotsTxt.php
+++ b/src/RobotsTxt.php
@@ -197,7 +197,7 @@ class RobotsTxt
protected function isDisallowLine(string $line): string
{
- return trim(substr(str_replace(' ', '', strtolower(trim($line))), 0, 6), ': ') === 'disall';
+ return trim(substr(str_replace(' ', '', strtolower(trim($line))), 0, 8), ': ') === 'disallow';
}
protected function isAllowLine(string $line): string | - use full word for disallow | spatie_robots-txt | train | php |
053ac04387f20a88f74698f401fe3204cbc7b081 | diff --git a/code/MultiFormStep.php b/code/MultiFormStep.php
index <HASH>..<HASH> 100644
--- a/code/MultiFormStep.php
+++ b/code/MultiFormStep.php
@@ -162,12 +162,11 @@ class MultiFormStep extends DataObject {
* Custom validation for a step. In most cases, it should be sufficient
* to have built-in validation through the {@link Validator} class
* on the {@link getValidator()} method.
+ *
* Use {@link Form->sessionMessage()} to feed back validation messages
* to the user. Please don't redirect from this method,
* this is taken care of in {@link next()}.
*
- * @usedby next()
- *
* @param array $data Request data
* @param Form $form
* @return boolean Validation success | MINOR Removed @usedby, it's not a valid phpdoc token | silverstripe_silverstripe-multiform | train | php |
b1bfe2454c76529f25c5e2282f6973c019befe44 | diff --git a/tests/Fixture/CounterlessMuffinsFixture.php b/tests/Fixture/CounterlessMuffinsFixture.php
index <HASH>..<HASH> 100644
--- a/tests/Fixture/CounterlessMuffinsFixture.php
+++ b/tests/Fixture/CounterlessMuffinsFixture.php
@@ -7,11 +7,6 @@ use Cake\TestSuite\Fixture\TestFixture;
class CounterlessMuffinsFixture extends TestFixture {
/**
- * @var string
- */
- public $table = 'tags_counterless_muffins';
-
- /**
* @var array
*/
public $fields = [
diff --git a/tests/TestCase/Model/Behavior/TagBehaviorTest.php b/tests/TestCase/Model/Behavior/TagBehaviorTest.php
index <HASH>..<HASH> 100644
--- a/tests/TestCase/Model/Behavior/TagBehaviorTest.php
+++ b/tests/TestCase/Model/Behavior/TagBehaviorTest.php
@@ -668,7 +668,7 @@ class TagBehaviorTest extends TestCase {
* @return void
*/
public function testFinderUntaggedWithoutCounterField() {
- $table = TableRegistry::get('Tags.CounterlessMuffins', ['table' => 'tags_counterless_muffins']);
+ $table = TableRegistry::get('Tags.CounterlessMuffins');
$table->addBehavior('Tags.Tag', [
'taggedCounter' => false, | Fix tests after <I> release | dereuromark_cakephp-tags | train | php,php |
0139d8777db28623647fbc14ac9657a2fcdbcd06 | diff --git a/src/python/grpcio_tests/tests/unit/_logging_test.py b/src/python/grpcio_tests/tests/unit/_logging_test.py
index <HASH>..<HASH> 100644
--- a/src/python/grpcio_tests/tests/unit/_logging_test.py
+++ b/src/python/grpcio_tests/tests/unit/_logging_test.py
@@ -45,13 +45,23 @@ class LoggingTest(unittest.TestCase):
def test_handler_found(self):
try:
reload_module(logging)
- logging.basicConfig()
reload_module(grpc)
self.assertFalse(
"No handlers could be found" in sys.stderr.getvalue())
finally:
reload_module(logging)
+ def test_can_configure_logger(self):
+ reload_module(logging)
+ reload_module(grpc)
+ try:
+ intended_stream = six.StringIO()
+ logging.basicConfig(stream=intended_stream)
+ self.assertEqual(1, len(logging.getLogger().handlers))
+ self.assertTrue(logging.getLogger().handlers[0].stream is intended_stream)
+ finally:
+ reload_module(logging)
+
if __name__ == '__main__':
unittest.main(verbosity=2) | Add explicit test that user can configure their own handler | grpc_grpc | train | py |
037e6cbb7399ca3eb0c63b006120c2fb8550308c | diff --git a/lib/loga/configuration.rb b/lib/loga/configuration.rb
index <HASH>..<HASH> 100644
--- a/lib/loga/configuration.rb
+++ b/lib/loga/configuration.rb
@@ -29,7 +29,7 @@ module Loga
end
def initialize!
- @service_name.to_s.strip!
+ @service_name = service_name.to_s.strip
@service_version = compute_service_version
initialize_logger
diff --git a/lib/loga/version.rb b/lib/loga/version.rb
index <HASH>..<HASH> 100644
--- a/lib/loga/version.rb
+++ b/lib/loga/version.rb
@@ -1,3 +1,3 @@
module Loga
- VERSION = '1.1.0'
+ VERSION = '1.1.1'
end | Remove service_name mutation when initializing, closes #<I> | FundingCircle_loga | train | rb,rb |
3bfa8acebadbe98679029868e7ba0639ccd1d1e1 | diff --git a/lib/yap/shell/evaluation.rb b/lib/yap/shell/evaluation.rb
index <HASH>..<HASH> 100644
--- a/lib/yap/shell/evaluation.rb
+++ b/lib/yap/shell/evaluation.rb
@@ -55,7 +55,7 @@ module Yap::Shell
@aliases_expanded ||= []
@command_node_args_stack ||= []
with_standard_streams do |stdin, stdout, stderr|
- args = node.args.map(&:lvalue).map{ |arg| variable_expand(arg) }
+ args = node.args.map(&:lvalue).map{ |arg| shell_expand(arg) }
if !node.literal? && !@aliases_expanded.include?(node.command) && _alias=Aliases.instance.fetch_alias(node.command)
@suppress_events = true
@command_node_args_stack << args | When processing arguments shell_expand them (not just variable_expand).
This ensures that expansions like ~ work. | zdennis_yap-shell-core | train | rb |
4458b5994f2216c447409652e342d66c7dee55a5 | diff --git a/tests/Negotiation/Tests/NegotiatorTest.php b/tests/Negotiation/Tests/NegotiatorTest.php
index <HASH>..<HASH> 100644
--- a/tests/Negotiation/Tests/NegotiatorTest.php
+++ b/tests/Negotiation/Tests/NegotiatorTest.php
@@ -28,18 +28,22 @@ class NegotiatorTest extends TestCase
{
try {
$acceptHeader = $this->negotiator->getBest($header, $priorities);
-
- if ($acceptHeader === null) {
- $this->assertNull($expected);
- } else {
- $this->assertInstanceOf('Negotiation\Accept', $acceptHeader);
-
- $this->assertSame($expected[0], $acceptHeader->getType());
- $this->assertSame($expected[1], $acceptHeader->getParameters());
- }
} catch (\Exception $e) {
$this->assertEquals($expected, $e);
+
+ return;
+ }
+
+ if ($acceptHeader === null) {
+ $this->assertNull($expected);
+
+ return;
}
+
+ $this->assertInstanceOf('Negotiation\Accept', $acceptHeader);
+
+ $this->assertSame($expected[0], $acceptHeader->getType());
+ $this->assertSame($expected[1], $acceptHeader->getParameters());
}
public static function dataProviderForTestGetBest() | Reduce try/catch to getBest method only.
PHPUnit uses Exceptions in its asserts functions. In case of assertion
failure in test, it is caught by the catch block and give a wrong message. | willdurand_Negotiation | train | php |
5de623ca45ad4e63f282ceec1aaaedfdfeeaf5e4 | diff --git a/datasources/sql/DbModel.php b/datasources/sql/DbModel.php
index <HASH>..<HASH> 100644
--- a/datasources/sql/DbModel.php
+++ b/datasources/sql/DbModel.php
@@ -275,8 +275,8 @@ abstract class DbModel extends BaseModel implements ModelInterface {
}
}
- public function relationIsSet($relatinName) {
- return isset($this->_relations[$relatinName]);
+ public function relationIsSet($relationName) {
+ return isset($this->_relations[$relationName]);
}
/**
@@ -285,7 +285,7 @@ abstract class DbModel extends BaseModel implements ModelInterface {
* @return mixed
*/
public function __get($name) {
- if (isset($this->_attributes[$name])) {
+ if (array_key_exists($name, $this->_attributes)) {
return $this->_attributes[$name];
}
foreach ($this->_columns as $column) { // check for columns that were not read yet [ useful for search and not only ] | Fixed column read when value is null. | mpf-soft_mpf | train | php |
f768f26e0b1da687a04da7256047d12d34b11f1c | diff --git a/examples/example2.js b/examples/example2.js
index <HASH>..<HASH> 100644
--- a/examples/example2.js
+++ b/examples/example2.js
@@ -13,7 +13,7 @@ hosts.forEach(function (host) {
hosts.forEach(function (host) {
ping.promise.probe(host, {
timeout: 10,
- extra: ["-i 2"]
+ extra: ["-i", "2"]
})
.then(function (res) {
console.log(res); | Fix bug on window platform
--Overview
1. Window's ping command treat '-i 2' as an invalid option. Therefore,
we must split them up. IE using ['-i', '2'] instead of ['-i 2'] | danielzzz_node-ping | train | js |
4d0e055e49d786b20cfdbc7f45d1dbf33d667407 | diff --git a/lib/bento_search/version.rb b/lib/bento_search/version.rb
index <HASH>..<HASH> 100644
--- a/lib/bento_search/version.rb
+++ b/lib/bento_search/version.rb
@@ -1,3 +1,3 @@
module BentoSearch
- VERSION = "0.0.1"
+ VERSION = "0.5.0"
end | time for another gem release, let's call it <I>, it's getting stable-ish | jrochkind_bento_search | train | rb |
47740e205b980a7c7a3d230cba48f97eaccc0328 | diff --git a/fireplace/game.py b/fireplace/game.py
index <HASH>..<HASH> 100644
--- a/fireplace/game.py
+++ b/fireplace/game.py
@@ -172,6 +172,9 @@ class BaseGame(Entity):
else:
player.playstate = PlayState.WON
self.state = State.COMPLETE
+ self.manager.step(self.next_step, Step.FINAL_WRAPUP)
+ self.manager.step(self.next_step, Step.FINAL_GAMEOVER)
+ self.manager.step(self.next_step)
raise GameOver("The game has ended.")
def queue_actions(self, source, actions, event_args=None):
diff --git a/fireplace/managers.py b/fireplace/managers.py
index <HASH>..<HASH> 100644
--- a/fireplace/managers.py
+++ b/fireplace/managers.py
@@ -73,11 +73,12 @@ class GameManager(Manager):
for observer in self.observers:
observer.start_game()
- def step(self, step, next_step):
+ def step(self, step, next_step=None):
for observer in self.observers:
observer.game_step(step, next_step)
self.obj.step = step
- self.obj.next_step = next_step
+ if next_step is not None:
+ self.obj.next_step = next_step
class PlayerManager(Manager): | Walk through WRAPUP and GAMEOVER at the end of the game
Touches #<I> | jleclanche_fireplace | train | py,py |
a492c53ba658685b72cc53355c6ae56476e44c73 | diff --git a/salt/modules/virtualenv_mod.py b/salt/modules/virtualenv_mod.py
index <HASH>..<HASH> 100644
--- a/salt/modules/virtualenv_mod.py
+++ b/salt/modules/virtualenv_mod.py
@@ -319,7 +319,7 @@ def _install_script(source, cwd, python, user, saltenv='base'):
if not salt.utils.is_windows():
fn_ = __salt__['cp.cache_file'](source, saltenv)
shutil.copyfile(fn_, tmppath)
- os.chmod(tmppath, 320)
+ os.chmod(tmppath, 0o500)
os.chown(tmppath, __salt__['file.user_to_uid'](user), -1)
try:
return __salt__['cmd.run_all']( | Use octal.
Since it's a permission. I can't do decimal -> octal -> unix perms in my head. | saltstack_salt | train | py |
cb40e003b1c80566a552f0a0ed46e03cc8ee6004 | diff --git a/public/js/directives.js b/public/js/directives.js
index <HASH>..<HASH> 100644
--- a/public/js/directives.js
+++ b/public/js/directives.js
@@ -14,7 +14,12 @@ angular.module('njax.directives', ['njax.services'])
try{
var jBody = $(element[0].contentWindow.document.body);
jBody.find('#njax-payload').val(JSON.stringify(NJaxBootstrap.njax_payload));
- jBody.find('#njax-iframe-form').submit();
+ var jForm = jBody.find('#njax-iframe-form');
+ if(jForm.length == 0){
+ console.error("Cannot find #njax-iframe-form waiting for 1000ms");
+ return setTimeout(setup, 1000);
+ }
+ jForm.submit();
}catch(e){
console.error(e);
return setTimeout(setup, 1000); | Trying to squash iframe bug | schematical_njax | train | js |
704690b798e26339db2efb88157cf4556d8fbe6a | diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php
index <HASH>..<HASH> 100755
--- a/code/model/UserDefinedForm.php
+++ b/code/model/UserDefinedForm.php
@@ -838,7 +838,7 @@ JS
* @param ArrayList fields
* @return ArrayData
*/
- private function getMergeFieldsMap($fields = array())
+ protected function getMergeFieldsMap($fields = array())
{
$data = new ArrayData(array()); | Make getMergeFieldsMap protected
Annoying having to copy this method if you want to replace "process" in an extending class so we'll make it a bit looser shall we? | silverstripe_silverstripe-userforms | train | php |
2bf632740d1c465ea158b06c8e1111982d87d569 | diff --git a/src/Visitor/QueryItemElastica.php b/src/Visitor/QueryItemElastica.php
index <HASH>..<HASH> 100644
--- a/src/Visitor/QueryItemElastica.php
+++ b/src/Visitor/QueryItemElastica.php
@@ -43,7 +43,7 @@ class QueryItemElastica implements QueryItemVisitorInterface
*/
public function visitPhrase(Node\Phrase $phrase)
{
- $query = new Query\MatchPhrase($this->fieldName, $word->getToken());
+ $query = new Query\MatchPhrase($this->fieldName, $phrase->getToken());
if ($phrase->isBoosted()) {
$query->setBoost($phrase->getBoostBy()); | Fixed typo - wrong param name | gdbots_query-parser-php | train | php |
29fcf1f6d52260ba67be90c3c516610c1dc073f8 | diff --git a/python/phonenumbers/phonemetadata.py b/python/phonenumbers/phonemetadata.py
index <HASH>..<HASH> 100644
--- a/python/phonenumbers/phonemetadata.py
+++ b/python/phonenumbers/phonemetadata.py
@@ -402,6 +402,7 @@ class PhoneMetadata(object):
result += ",\n voip=%s" % self.voip
result += ",\n pager=%s" % self.pager
result += ",\n uan=%s" % self.uan
+ result += ",\n emergency=%s" % self.emergency
result += ",\n no_international_dialling=%s" % self.no_international_dialling
if self.preferred_international_prefix is not None: | Include emergency PhoneNumberDesc in metadata self-serialization output | daviddrysdale_python-phonenumbers | train | py |
9e50b66a8e815bf276553f0f314d8d5760c42a37 | diff --git a/docs/_static/js/custom.js b/docs/_static/js/custom.js
index <HASH>..<HASH> 100644
--- a/docs/_static/js/custom.js
+++ b/docs/_static/js/custom.js
@@ -21,8 +21,27 @@ window.onload = function () {
$(" nav.bd-links ").children().hide()
}
- var selected = $("a.current")
- selected.html("→ " + selected.text())
+ // var selected = $("a.current")
+ // selected.html("→ " + selected.text())
+
+ $(".toctree-l3").hide()
+
+ exclude = [
+ 'append', 'clear', 'copy', 'count', 'extend', 'fromkeys', 'get',
+ 'index', 'insert', 'items', 'keys', 'pop', 'popitem', 'remove',
+ 'reverse', 'setdefault', 'sort', 'update', 'values'
+ ]
+
+ for (i in exclude) {
+ // Search through first column of the table for "exclude[i]("
+ tmp = $("tr").find(`td:first:contains(${exclude[i]}()`)
+ // Find the row(s) containing the returned query
+ row = tmp.closest('tr')
+ // Hide that row
+ // row.hide()
+ // Comment the line above and uncomment the next for DEBUGGING
+ row.css("background-color", "red")
+ }
};
// window.onload = function() { | Update custom.js in docs | PMEAL_OpenPNM | train | js |
d0fcfbd036aa6b56fab3da0ddf3cbcda47d6a76c | diff --git a/irc3/plugins/feeds.py b/irc3/plugins/feeds.py
index <HASH>..<HASH> 100644
--- a/irc3/plugins/feeds.py
+++ b/irc3/plugins/feeds.py
@@ -61,6 +61,7 @@ import time
import irc3
import datetime
from concurrent.futures import ThreadPoolExecutor
+from operator import itemgetter
def default_hook(entries):
@@ -108,7 +109,7 @@ def parse(feedparser, args):
e['feed'] = args
entries.append((e.updated, e))
if entries:
- entries = sorted(entries)
+ entries = sorted(entries, key=itemgetter(0))
with open(filename + '.updated', 'w') as fd:
fd.write(str(entries[-1][0]))
return entries | Sort feed entries with the date field only.
Otherwise, if there are multiple entries at the same date, this fails
because the second field is a `FeedParserDict` which is not sortable. | gawel_irc3 | train | py |
8f2f79ca5196d4f11872e57efbbfabccd3e08269 | diff --git a/tile_generator/package_definitions.py b/tile_generator/package_definitions.py
index <HASH>..<HASH> 100644
--- a/tile_generator/package_definitions.py
+++ b/tile_generator/package_definitions.py
@@ -66,7 +66,7 @@ class PackageBoshRelease(BasePackage):
flags = [flag.BoshRelease]
_schema = {
'jobs': {'type': 'list', 'required': False, 'schema':{'type': 'dict', 'schema': {
- 'name': {'type': 'string', 'required': True, 'regex': '^[a-z][a-zA-Z0-9\-]*$'},
+ 'name': {'type': 'string', 'required': True, 'regex': '^[a-zA-Z0-9\-\_]*$'},
'varname': {'type': 'string', 'default_setter': lambda doc: doc['name'].lower().replace('-','_')}}}},
} | Fix issue #<I>, handle Capital letters as a valid package name start, allow for underscore _ in name | cf-platform-eng_tile-generator | train | py |
45b9d2ad931cce0c85fc0828c0f6697a50afde18 | diff --git a/wordpress_xmlrpc/wordpress.py b/wordpress_xmlrpc/wordpress.py
index <HASH>..<HASH> 100644
--- a/wordpress_xmlrpc/wordpress.py
+++ b/wordpress_xmlrpc/wordpress.py
@@ -50,7 +50,6 @@ class WordPressBase(object):
data[output] = fmap.conversion(getattr(self, var))
else:
data[output] = getattr(self, var)
- print data
return data
def __repr__(self): | Removed erroneous print statement. | maxcutler_python-wordpress-xmlrpc | train | py |
3cad0b403c53d5b86aa7a2bbab0c80843ed9ef48 | diff --git a/lib/chrome/webdriver/index.js b/lib/chrome/webdriver/index.js
index <HASH>..<HASH> 100644
--- a/lib/chrome/webdriver/index.js
+++ b/lib/chrome/webdriver/index.js
@@ -55,6 +55,13 @@ module.exports.configureBuilder = function(builder, baseDir, options) {
let chromeOptions = new chrome.Options();
chromeOptions.setLoggingPrefs(logPrefs);
+ // Fixing save password popup
+ chromeOptions.setUserPreferences({
+ 'profile.password_manager_enable': false,
+ 'profile.default_content_setting_values.notifications': 2,
+ credentials_enable_service: false
+ });
+
if (options.headless) {
chromeOptions.headless();
} | Disable save passwords popups in Chrome. (#<I>)
This was introduced when we removed the WebExtension for Chrome. | sitespeedio_browsertime | train | js |
1ccfcbfc809eca300c316a6144f6bbfc07665d70 | diff --git a/packages/request-maxdome/src/Asset.js b/packages/request-maxdome/src/Asset.js
index <HASH>..<HASH> 100644
--- a/packages/request-maxdome/src/Asset.js
+++ b/packages/request-maxdome/src/Asset.js
@@ -21,6 +21,7 @@ class Asset {
this.protocol = protocol;
this.id = data.id;
+ this.referenceId = data.referenceId;
const types = {
assetvideofilm: 'movie',
@@ -110,11 +111,11 @@ class Asset {
path = `/${slugify(this.originalTitle)}-${this.id}.html`;
break;
case 'season':
- let season = '';
- if (this.seasonNumber > 1) {
- season = `-s${this.seasonNumber}`;
+ if (this.seasonNumber === 1) {
+ path = `/${slugify(this.originalTitle)}${season}-b${this.referenceId}.html`;
+ } else {
+ path = `/${slugify(this.originalTitle)}${season}-s${this.seasonNumber}-b${this.id}.html`;
}
- path = `/${slugify(this.originalTitle)}${season}-b${this.id}.html`;
break;
case 'series':
path = `/${slugify(this.originalTitle)}-b${this.id}.html`; | Use ID of the series if its the first season | Sharaal_dnode | train | js |
f0c684ab89fa4fe698c9e20e7e904d3371fe58e2 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,8 @@ setup(
entry_points={
'console_scripts': [
'alfred-workflow-packager=awp.main:main',
- 'workflow-packager=awp.main:main'
+ 'workflow-packager=awp.main:main',
+ 'awp=awp.main:main'
]
}
) | Add awp as an additional shell command | caleb531_alfred-workflow-packager | train | py |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.