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 |
|---|---|---|---|---|---|
a2bac72ef99626b0d252cd8bd645f42becd0c7ba | diff --git a/lib/zxcvbn/matchers/repeat.rb b/lib/zxcvbn/matchers/repeat.rb
index <HASH>..<HASH> 100644
--- a/lib/zxcvbn/matchers/repeat.rb
+++ b/lib/zxcvbn/matchers/repeat.rb
@@ -5,28 +5,26 @@ module Zxcvbn
result = []
i = 0
while i < password.length
+ cur_char = password[i]
j = i + 1
- loop do
- prev_char, cur_char = password[j-1..j]
- if password[j-1] == password[j]
- j += 1
- else
- if j - i > 2 # don't consider length 1 or 2 chains.
- result << Match.new(
- :pattern => 'repeat',
- :i => i,
- :j => j-1,
- :token => password[i...j],
- :repeated_char => password[i]
- )
- end
- break
- end
+ while cur_char == password[j]
+ j += 1
end
+
+ if j - i > 2 # don't consider length 1 or 2 chains.
+ result << Match.new(
+ :pattern => 'repeat',
+ :i => i,
+ :j => j-1,
+ :token => password[i...j],
+ :repeated_char => cur_char
+ )
+ end
+
i = j
end
result
end
end
end
-end
\ No newline at end of file
+end | Simplified loop construction
Algorithm is the same, basically moved the if with break, to loop condition. | envato_zxcvbn-ruby | train | rb |
fd5f4f3597a9e38b8735d131cf1eedb3c45ed988 | diff --git a/lib/ssh.js b/lib/ssh.js
index <HASH>..<HASH> 100644
--- a/lib/ssh.js
+++ b/lib/ssh.js
@@ -332,7 +332,6 @@ SSH2Stream.prototype._transform = function(chunk, encoding, callback) {
debug('DEBUG: Parser: IN_PACKETBEFORE (expecting ' + decrypt.size + ')');
// wait for the right number of bytes so we can determine the incoming
// packet length
- //expectData(this, EXP_TYPE_BYTES, decrypt.size, '_decryptBuf');
expectData(this, EXP_TYPE_BYTES, decrypt.size, decrypt.buf);
instate.status = IN_PACKET;
} else if (instate.status === IN_PACKET) {
@@ -414,7 +413,6 @@ SSH2Stream.prototype._transform = function(chunk, encoding, callback) {
if (instate.hmac.size !== undefined) {
// wait for hmac hash
debug('DEBUG: Parser: HMAC size:' + instate.hmac.size);
- //expectData(this, EXP_TYPE_BYTES, instate.hmac.size, '_hmacBuf');
expectData(this, EXP_TYPE_BYTES, instate.hmac.size, instate.hmac.buf);
instate.status = IN_PACKETDATAVERIFY;
instate.packet = buf; | SSH2Stream: remove old comments | mscdex_ssh2-streams | train | js |
4ddb60a5eb50b30dbad268e05b837b69886658f7 | diff --git a/test/rails_root/config/environment.rb b/test/rails_root/config/environment.rb
index <HASH>..<HASH> 100644
--- a/test/rails_root/config/environment.rb
+++ b/test/rails_root/config/environment.rb
@@ -1,6 +1,6 @@
# Specifies gem version of Rails to use when vendor/rails is not present
old_verbose, $VERBOSE = $VERBOSE, nil
-RAILS_GEM_VERSION = '>= 2.1.0' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '= 2.2.2' unless defined? RAILS_GEM_VERSION
$VERBOSE = old_verbose
require File.join(File.dirname(__FILE__), 'boot') | Set the tests to run against Rails <I>, as Rails <I> is currently unsupported | thoughtbot_shoulda-matchers | train | rb |
70b5592faf7319b7f5dbeb7f07b66c010ad857bb | diff --git a/app/controllers/katello/api/v2/products_controller.rb b/app/controllers/katello/api/v2/products_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/katello/api/v2/products_controller.rb
+++ b/app/controllers/katello/api/v2/products_controller.rb
@@ -52,10 +52,7 @@ module Katello
param_group :search, Api::V2::ApiController
def index
filters = [filter_terms(product_ids_filter)]
- # TODO: support enabled filter in products. Product currently has
- # an enabled method, and elasticsearch has mappings, but filtering
- # errors. See elasticsearch output.
- # filters << filter_terms(enabled_filter) if enabled_filter.present?
+ filters << enabled_filter unless params[:enabled] == 'false'
options = sort_params.merge(:filters => filters, :load_records? => true)
@collection = item_search(Product, params, options)
respond_for_index(:collection => @collection)
@@ -121,9 +118,7 @@ module Katello
end
def enabled_filter
- if (enabled = params[:enabled])
- {:enabled => enabled}
- end
+ filter_terms({:enabled => [true]})
end
def filter_terms(terms) | fixing disabled products from showing up by default in the api
also hiding them in the ui | Katello_katello | train | rb |
83a94b61e0eac26c92d1579f3c7e049cfcd32b18 | diff --git a/karma.conf.js b/karma.conf.js
index <HASH>..<HASH> 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -30,7 +30,9 @@ module.exports = config => {
colors: true,
reporters: ['mocha', 'coverage'],
// https://github.com/karma-runner/karma/blob/master/docs/config/01-configuration-file.md#browsernoactivitytimeout
- browserNoActivityTimeout: 100000,
+ browserNoActivityTimeout: 60000,
+ browserDisconnectTimeout: 30000,
+ captureTimeout: 60000,
logLevel: config.LOG_INFO,
preprocessors: {
'test/*.js': ['webpack'] | Update karma.conf.js | rsuite_rsuite | train | js |
c20130cfaf7617eff3566fffa5eca4a21a116593 | diff --git a/lib/Model.php b/lib/Model.php
index <HASH>..<HASH> 100644
--- a/lib/Model.php
+++ b/lib/Model.php
@@ -428,10 +428,6 @@ class Model extends AbstractModel implements ArrayAccess,Iterator {
// determine the actual class of the other model
if(!is_object($model)){
$tmp=$this->api->normalizeClassName($model,'Model');
- /* bug - does not address namespace conversion properly.
- * fix by jancha */
- $tmp=str_replace('/', '\\', $tmp);
- /* */
$tmp=new $tmp; // avoid recursion
}else $tmp=$model;
$our_field=($tmp->table).'_id'; | Model: Janchas fix moved to normalize method | atk4_atk4 | train | php |
591d59595600b2cc88ac92dd55ca09597565be53 | diff --git a/src/Common/BaseRepository.php b/src/Common/BaseRepository.php
index <HASH>..<HASH> 100755
--- a/src/Common/BaseRepository.php
+++ b/src/Common/BaseRepository.php
@@ -60,7 +60,7 @@ abstract class BaseRepository extends \Prettus\Repository\Eloquent\BaseRepositor
$model->$key()->sync(array_values($new_values));
break;
case 'Illuminate\Database\Eloquent\Relations\BelongsTo':
- $model_key = $model->$key()->getQualifiedForeignKey();
+ $model_key = $model->$key()->getQualifiedForeignKeyName();
$new_value = array_get($attributes, $key, null);
$new_value = $new_value == '' ? null : $new_value;
$model->$model_key = $new_value; | fix(relationships): getQualifiedForeignKey -> getQualifiedForeignKeyName (#<I>)
In Laravel <I> the getForeignKey and getQualifiedForeignKey methods of the BelongsTo relationship have been renamed to getForeignKeyName and getQualifiedForeignKeyName respectively. | InfyOmLabs_laravel-generator | train | php |
ef4eacb54a1e30f0d55fff1b0b3c1194d0f3d8d4 | diff --git a/sportsreference/nba/constants.py b/sportsreference/nba/constants.py
index <HASH>..<HASH> 100644
--- a/sportsreference/nba/constants.py
+++ b/sportsreference/nba/constants.py
@@ -292,6 +292,7 @@ PLAYER_SCHEME = {
}
NATIONALITY = {
+ 'ao': 'Angola',
'ag': 'Antigua and Barbuda',
'ar': 'Argentina',
'au': 'Australia',
@@ -324,6 +325,7 @@ NATIONALITY = {
'gh': 'Ghana',
'gr': 'Greece',
'gp': 'Guadeloupe',
+ 'gn': 'Guinea',
'gy': 'Guyana',
'ht': 'Haiti',
'hu': 'Hungary', | Add support for additional NBA nationalities
After the summer <I> NBA draft and transfer window, a couple of new
players became the first ever players to represent their country in the
NBA. As a result, support for their countries was not included yet,
preventing sportsreference from pulling stats from these players without
throwing errors. With support added, all NBA teams can now be pulled
with every roster able to be analyzed. | roclark_sportsreference | train | py |
4a24d500366dc0cebf7b4e7db9a7df3cb79c40d0 | diff --git a/plexapi/myplex.py b/plexapi/myplex.py
index <HASH>..<HASH> 100644
--- a/plexapi/myplex.py
+++ b/plexapi/myplex.py
@@ -217,7 +217,7 @@ class MyPlexAccount(PlexObject):
return []
t = time.time()
- if t - self._sonos_cache_timestamp > 60:
+ if t - self._sonos_cache_timestamp > 5:
self._sonos_cache_timestamp = t
data = self.query('https://sonos.plex.tv/resources')
self._sonos_cache = [PlexSonosClient(self, elem) for elem in data] | Reduce timeout to expire Sonos resource cache (#<I>) | pkkid_python-plexapi | train | py |
38e44bfa9bca71328e21565fcc7b6ae6dcc51b99 | diff --git a/src/record/Records.php b/src/record/Records.php
index <HASH>..<HASH> 100644
--- a/src/record/Records.php
+++ b/src/record/Records.php
@@ -24,7 +24,7 @@ use froq\pager\Pager;
*/
class Records extends ItemCollection
{
- /** @var froq\pager\Pager */
+ /** @var ?froq\pager\Pager */
protected ?Pager $pager;
/** | record.Records: doc-up. | froq_froq-database | train | php |
e8b5a09d0f768595cde20b27d8d50a7f1f45cd95 | diff --git a/tests/demo/basic_usage.py b/tests/demo/basic_usage.py
index <HASH>..<HASH> 100755
--- a/tests/demo/basic_usage.py
+++ b/tests/demo/basic_usage.py
@@ -169,6 +169,7 @@ class DemoApplication:
text=f'Least squares request from {metadata.client_node_id} time={metadata.timestamp.system} '
f'tid={metadata.transfer_id} prio={metadata.priority}',
)
+ print('Least squares request:', request, file=sys.stderr)
self._pub_diagnostic_record.publish_soon(diagnostic_msg)
# This is just the business logic. | We're dealing with an odd case where a test passes on my local machine successfully yet it fais randomly on the CI. | UAVCAN_pyuavcan | train | py |
fceedaa401d77101ad77fe8a790959a5b5bf64fa | diff --git a/controllers/CcmpCompanyController.php b/controllers/CcmpCompanyController.php
index <HASH>..<HASH> 100644
--- a/controllers/CcmpCompanyController.php
+++ b/controllers/CcmpCompanyController.php
@@ -37,6 +37,11 @@ class CcmpCompanyController extends Controller {
'roles' => array('Company.readonly'),
),
array(
+ 'allow',
+ 'actions' => array('view', 'editableSaver'),
+ 'roles' => array('ClientOffice'),
+ ),
+ array(
'deny',
'users' => array('*'),
), | In Company controler added acces to view for Customer Office users | DBRisinajumi_d2company | train | php |
b54d5f55210b720266704dc4437c3598cc58680f | diff --git a/mpv-test.py b/mpv-test.py
index <HASH>..<HASH> 100755
--- a/mpv-test.py
+++ b/mpv-test.py
@@ -106,6 +106,10 @@ class TestProperties(MpvTestCase):
time.sleep(0.05)
check_canaries = lambda: os.path.exists('100') or os.path.exists('foo')
for name in sorted(self.m.property_list):
+ # See issue #108 and upstream mpv issues #7919 and #7920.
+ if name in ('demuxer', 'audio-demuxer', 'audio-files'):
+ continue
+ # These may cause files to be created
if name in ('external-file', 'heartbeat-cmd', 'wid', 'dump-stats', 'log-file') or name.startswith('input-'):
continue
name = name.replace('-', '_') | tests: Fix test_write for segaults in libmpv (#<I>) | jaseg_python-mpv | train | py |
1ea7a62d183430bd94da5147cdb42e09efa4aeb9 | diff --git a/lib/provider.js b/lib/provider.js
index <HASH>..<HASH> 100644
--- a/lib/provider.js
+++ b/lib/provider.js
@@ -38,6 +38,7 @@ function Provider(options) {
this.engine.manager = gethApiDouble;
this.engine.addProvider(new RequestFunnel());
+ this.engine.addProvider(new DelayedBlockFilter());
this.engine.addProvider(subscriptionSubprovider);
this.engine.addProvider(new GethDefaults());
this.engine.addProvider(gethApiDouble); | Add old DelayedBlockFilter subprovider so that old web3 doesn't hang on contract deployments | trufflesuite_ganache-core | train | js |
4bbb4b04459d15867f5ecab8b76d4b5c3d2f69cb | diff --git a/internal/graphics/shader.go b/internal/graphics/shader.go
index <HASH>..<HASH> 100644
--- a/internal/graphics/shader.go
+++ b/internal/graphics/shader.go
@@ -53,9 +53,6 @@ varying vec2 varying_tex_coord_max;
void main(void) {
varying_tex_coord = vec2(tex_coord[0], tex_coord[1]);
- // varying_tex_coord_min and varying_tex_coord_max mean endmost texel values
- // in the source rect. As varying_tex_coord is adjusted with minHighpValue
- // in vertices.go, re-adjust them so that exact endmost texel values.
varying_tex_coord_min = vec2(min(tex_coord[0], tex_coord[2]), min(tex_coord[1], tex_coord[3]));
varying_tex_coord_max = vec2(max(tex_coord[0], tex_coord[2]), max(tex_coord[1], tex_coord[3]));
gl_Position = projection_matrix * vec4(vertex, 0, 1); | graphics: Remove unneeded comments (#<I>) | hajimehoshi_ebiten | train | go |
fc6233879d23cfe94da20aea3ce4803184882162 | diff --git a/js_host/conf.py b/js_host/conf.py
index <HASH>..<HASH> 100644
--- a/js_host/conf.py
+++ b/js_host/conf.py
@@ -10,7 +10,7 @@ class Conf(conf.Conf):
PATH_TO_NODE = 'node'
# An absolute path to the directory which contains your node_modules directory
- SOURCE_ROOT = None
+ SOURCE_ROOT = os.getcwd()
# A path to the binary used to control hosts and managers.
BIN_PATH = os.path.join('node_modules', '.bin', 'js-host') | SOURCE_ROOT now defaults to the current working directory | markfinger_python-js-host | train | py |
4ec104f9332ef0520e785ce607ee503926a30c92 | diff --git a/TYPO3.Flow/Classes/MVC/Controller/ActionController.php b/TYPO3.Flow/Classes/MVC/Controller/ActionController.php
index <HASH>..<HASH> 100644
--- a/TYPO3.Flow/Classes/MVC/Controller/ActionController.php
+++ b/TYPO3.Flow/Classes/MVC/Controller/ActionController.php
@@ -271,17 +271,5 @@ class ActionController extends \F3\FLOW3\MVC\Controller\AbstractController {
protected function initializeAction() {
}
- /**
- * The default action of this controller.
- *
- * This method should always be overridden by the concrete action
- * controller implementation.
- *
- * @return void
- * @author Robert Lemke <robert@typo3.org>
- */
- protected function indexAction() {
- return 'No index action has been implemented yet for this controller.';
- }
}
?>
\ No newline at end of file | FLOW3:
* removed indexAction from the ActionController, as it caused runtime notices about mismatching method signature with subclasses using non-empty argument list.
Original-Commit-Hash: <I>a<I>be<I>e<I>d<I>d8d | neos_flow-development-collection | train | php |
9bd824cd8ad3891d190eda9c7981398b18911505 | diff --git a/shared/my-sites/themes/theme-options.js b/shared/my-sites/themes/theme-options.js
index <HASH>..<HASH> 100644
--- a/shared/my-sites/themes/theme-options.js
+++ b/shared/my-sites/themes/theme-options.js
@@ -68,7 +68,9 @@ function rawOptions( site, theme, isLoggedOut ) {
return [
{
name: 'signup',
- label: i18n.translate( 'Choose this design' ),
+ label: i18n.translate( 'Choose this design', {
+ comment: 'when signing up for a WordPress.com account with a selected theme'
+ } ),
hasUrl: true,
isHidden: ! isLoggedOut
}, | Add translation comment for 'Choose this design' | Automattic_wp-calypso | train | js |
d25deb853ca929f50d43a1ef05ca9509786a9aab | diff --git a/spec/s3uploader_spec.rb b/spec/s3uploader_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/s3uploader_spec.rb
+++ b/spec/s3uploader_spec.rb
@@ -23,7 +23,7 @@ describe S3Uploader do
(access + error).each do |file|
directory, basename = File.split(File.join(tmp_directory, file))
FileUtils.mkdir_p directory
- Open3.popen3("dd if=/dev/zero of=#{directory}/#{basename} count=1024 bs=1024")
+ create_test_file(File.join(directory, basename), 1)
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -8,3 +8,11 @@ RSpec.configure do |config|
config.color_enabled = true
config.formatter = 'documentation'
end
+
+
+def create_test_file(filename, size)
+ File.open(filename, 'w') do |f|
+ contents = "x" * (1024*1024)
+ size.to_i.times { f.write(contents) }
+ end
+end | Use Cross-platform creation of test files | chrishein_s3_uploader | train | rb,rb |
6c690781560e6ac1868abb2e01aa65660237636f | diff --git a/faq-bundle/src/Resources/contao/dca/tl_faq.php b/faq-bundle/src/Resources/contao/dca/tl_faq.php
index <HASH>..<HASH> 100644
--- a/faq-bundle/src/Resources/contao/dca/tl_faq.php
+++ b/faq-bundle/src/Resources/contao/dca/tl_faq.php
@@ -301,7 +301,6 @@ $GLOBALS['TL_DCA']['tl_faq'] = array
'exclude' => true,
'filter' => true,
'inputType' => 'checkbox',
- 'eval' => array('tl_class'=>'w50'),
'sql' => "char(1) NOT NULL default ''"
),
'published' => array | [Faq] Adjust some DCA evaluation keys to comply with the general settings | contao_contao | train | php |
1f847efa26e2bf9b828718b67172fffbb53c77dd | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -103,6 +103,22 @@ const validators = {
throw new Error(`Invalid value for '${term}': '${value}', must be one of: none, quarantine, reject`);
}
}
+ },
+ aspf: {
+ description: 'SPF Alignment mode. Can be "s" or "r".',
+ validate(term, value) {
+ if (!/^(s|r)$/i.test(value)) {
+ throw new Error(`Invalid value for '${term}': '${value}', must be one of: s, r`);
+ }
+ }
+ },
+ adkim: {
+ description: 'DKIM Alignment mode. Can be "s" or "r".',
+ validate(term, value) {
+ if (!/^(s|r)$/i.test(value)) {
+ throw new Error(`Invalid value for '${term}': '${value}', must be one of: s, r`);
+ }
+ }
}
}; | added support for aspf and adkim | softvu_dmarc-parse | train | js |
f5886bf25d0d4babab8deb1d761f5d9bf4c03d40 | diff --git a/tests/common/bootstrap.php b/tests/common/bootstrap.php
index <HASH>..<HASH> 100644
--- a/tests/common/bootstrap.php
+++ b/tests/common/bootstrap.php
@@ -11,5 +11,8 @@
*/
+/**
+ * @uses \phpDocumentor\Bootstrap
+ */
require_once __DIR__ . '/../../src/phpDocumentor/Bootstrap.php';
\phpDocumentor\Bootstrap::createInstance()->initialize();
\ No newline at end of file | put a docblock on the Bootstrap require element | phpDocumentor_phpDocumentor2 | train | php |
13e79dd8eeef263be7300e5a73055373195c120e | diff --git a/hazelcast/src/main/java/com/hazelcast/map/operation/PartitionWideEntryOperation.java b/hazelcast/src/main/java/com/hazelcast/map/operation/PartitionWideEntryOperation.java
index <HASH>..<HASH> 100644
--- a/hazelcast/src/main/java/com/hazelcast/map/operation/PartitionWideEntryOperation.java
+++ b/hazelcast/src/main/java/com/hazelcast/map/operation/PartitionWideEntryOperation.java
@@ -37,7 +37,6 @@ import java.util.Map;
public class PartitionWideEntryOperation extends AbstractMapOperation implements BackupAwareOperation, PartitionAwareOperation {
private static final EntryEventType __NO_NEED_TO_FIRE_EVENT = null;
- private transient EntryEventType eventType;
EntryProcessor entryProcessor;
MapEntrySet response;
@@ -66,6 +65,7 @@ public class PartitionWideEntryOperation extends AbstractMapOperation implements
dataValue = mapService.toData(result);
response.add(new AbstractMap.SimpleImmutableEntry<Data, Data>(dataKey, dataValue));
+ EntryEventType eventType = null;
if (valueAfterProcess == null) {
recordStore.remove(dataKey);
eventType = EntryEventType.REMOVED; | issue #<I> reorganize field declarations | hazelcast_hazelcast | train | java |
8bcdde96a1be8919e7695ca8d562bd4b9ea4ad51 | diff --git a/modules/static/app/controllers/static.go b/modules/static/app/controllers/static.go
index <HASH>..<HASH> 100644
--- a/modules/static/app/controllers/static.go
+++ b/modules/static/app/controllers/static.go
@@ -4,6 +4,7 @@ import (
"github.com/robfig/revel"
"os"
fpath "path/filepath"
+ "strings"
)
type Static struct {
@@ -47,7 +48,12 @@ func (c Static) Serve(prefix, filepath string) revel.Result {
basePath = revel.BasePath
}
- fname := fpath.Join(basePath, fpath.FromSlash(prefix), fpath.FromSlash(filepath))
+ basePathPrefix := fpath.Join(basePath, fpath.FromSlash(prefix))
+ fname := fpath.Join(basePathPrefix, fpath.FromSlash(filepath))
+ if !strings.HasPrefix(fname, basePathPrefix) {
+ revel.WARN.Printf("Attempted to read file outside of base path: %s", fname)
+ return c.NotFound("")
+ }
finfo, err := os.Stat(fname) | Static module should only allow reading files within the base path | revel_revel | train | go |
efe9bbc6867ded73654e91b6e1fcaf0aef61ab4c | diff --git a/LDAP.js b/LDAP.js
index <HASH>..<HASH> 100644
--- a/LDAP.js
+++ b/LDAP.js
@@ -85,6 +85,7 @@ var LDAP = function(opts) {
}
} else {
fn(new Error('LDAP Error ' + binding.err2string(), msgid));
+ reconnect();
}
return msgid;
} | Reconnect on any errored msgid. | jeremycx_node-LDAP | train | js |
e008d0a69de076308438b7745f78667cd2088439 | diff --git a/src/main/java/com/googlecode/lanterna/gui2/ComboBox.java b/src/main/java/com/googlecode/lanterna/gui2/ComboBox.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/googlecode/lanterna/gui2/ComboBox.java
+++ b/src/main/java/com/googlecode/lanterna/gui2/ComboBox.java
@@ -328,6 +328,17 @@ public class ComboBox<V> extends AbstractInteractableComponent<ComboBox<V>> {
}
/**
+ * Returns the item at the selected index, this is the same as calling:
+ * <pre>
+ * comboBox.getItem(comboBox.getSelectedIndex());
+ * </pre>
+ * @return The item at the selected index
+ */
+ public synchronized V getSelectedItem() {
+ return getItem(getSelectedIndex());
+ }
+
+ /**
* Adds a new listener to the {@code ComboBox} that will be called on certain user actions
* @param listener Listener to attach to this {@code ComboBox}
* @return Itself | Adding an extra getSelectedItem() helper method to ComboBox | mabe02_lanterna | train | java |
563c10f5ae844ec8d65f9c32bed3a87f54a15df5 | diff --git a/src/ValidatorFactory.php b/src/ValidatorFactory.php
index <HASH>..<HASH> 100644
--- a/src/ValidatorFactory.php
+++ b/src/ValidatorFactory.php
@@ -66,7 +66,7 @@ class ValidatorFactory
/**
* @param AbstractValidator $validator
- * @param array $rules
+ * @param string[] $rules
*
* @return AbstractValidator
*/ | Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on <URL> | nilportugues_php-validator | train | php |
892e44e65f985a7cc970efeaaafb79e6d745320d | diff --git a/lib/etl/engine.rb b/lib/etl/engine.rb
index <HASH>..<HASH> 100644
--- a/lib/etl/engine.rb
+++ b/lib/etl/engine.rb
@@ -32,7 +32,7 @@ module ETL #:nodoc:
options[:config] = 'config/database.yml' unless File.exist?(options[:config])
database_configuration = YAML::load(ERB.new(IO.read(options[:config])).result + "\n")
ActiveRecord::Base.configurations.merge!(database_configuration)
- ETL::Base.configurations = database_configuration
+ ETL::Base.configurations = HashWithIndifferentAccess.new(database_configuration)
#puts "configurations in init: #{ActiveRecord::Base.configurations.inspect}"
require 'etl/execution' | Turn db config into a HashWithIndifferentAccess to avoid crash in sqlite adapter (line 9) which expects symbol keys not the string keys we present. | activewarehouse_activewarehouse-etl | train | rb |
13a53f123f5d983451148f4aae931308c76ba811 | diff --git a/services/freecodecamp/freecodecamp-points.service.js b/services/freecodecamp/freecodecamp-points.service.js
index <HASH>..<HASH> 100644
--- a/services/freecodecamp/freecodecamp-points.service.js
+++ b/services/freecodecamp/freecodecamp-points.service.js
@@ -2,11 +2,17 @@ import Joi from 'joi'
import { metric } from '../text-formatters.js'
import { BaseJsonService, InvalidResponse, NotFound } from '../index.js'
+/**
+ * Validates that the schema response is what we're expecting.
+ * The username pattern should match the freeCodeCamp repository.
+ *
+ * @see https://github.com/freeCodeCamp/freeCodeCamp/blob/main/utils/validate.js#L14
+ */
const schema = Joi.object({
entities: Joi.object({
user: Joi.object()
.required()
- .pattern(/^\w+$/, {
+ .pattern(/^[a-zA-Z0-9\-_+]*$/, {
points: Joi.number().allow(null).required(),
}),
}).optional(), | [freecodecamp]: allow + symbol in username (#<I>) | badges_shields | train | js |
8505ca6c504cdf3c6fd81d233eb2ba9fa6e4aed5 | diff --git a/lib/pool.js b/lib/pool.js
index <HASH>..<HASH> 100644
--- a/lib/pool.js
+++ b/lib/pool.js
@@ -89,7 +89,7 @@ var pool = module.exports = function pool(options, authorizeFn){
});
//Only let the first fork show synced status or the log wil look flooded with it
- if (portWarnings.length && !process.env.forkId || process.env.forkId === '0') {
+ if (portWarnings.length > 0 && (!process.env.forkId || process.env.forkId === '0')) {
var warnMessage = 'Network difficulty of ' + _this.jobManager.currentJob.difficulty + ' is lower than '
+ portWarnings.join(' and ');
emitWarningLog(warnMessage); | Port diff warnings were happening on accident | zone117x_node-stratum-pool | train | js |
e1aaf1dd11a7c2d2b6c1a869f1df27e28483fee7 | diff --git a/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java b/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java
index <HASH>..<HASH> 100644
--- a/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java
+++ b/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java
@@ -123,7 +123,7 @@ public class Site {
* @return get cookies
*/
public Map<String,Map<String, String>> getAllCookies() {
- return cookies.columnMap();
+ return cookies.rowMap();
}
/** | fix mistake of guava Table #<I> | code4craft_webmagic | train | java |
f796f907abb6e8ea08015614c7311c74d78d2b2e | diff --git a/tests/Gin/Asset/AssetTest.php b/tests/Gin/Asset/AssetTest.php
index <HASH>..<HASH> 100644
--- a/tests/Gin/Asset/AssetTest.php
+++ b/tests/Gin/Asset/AssetTest.php
@@ -89,16 +89,27 @@ class AssetTest extends TestCase
/**
* @test
*/
- public function it_should_throw_on_file_if_no_asset_file()
+ public function it_should_throw_on_getting_file_uri_if_file_is_missing()
{
$config = $this->getConfig();
$asset = $this->getAsset($config, 'js/example.js');
$this->expectException(FileNotFoundException::class);
-
$asset->getUri();
}
+ /**
+ * @test
+ */
+ public function it_should_throw_on_getting_file_path_if_file_is_missing()
+ {
+ $config = $this->getConfig();
+ $asset = $this->getAsset($config, 'js/example.js');
+
+ $this->expectException(FileNotFoundException::class);
+ $asset->getPath();
+ }
+
public function getConfig()
{
return new Config([ | Adds missing test case for Asset class | tonik_gin | train | php |
63b2e0115ee2a171a20239fb6ff9b98d8f8d0df2 | diff --git a/frontend/dockerfile/builder/build.go b/frontend/dockerfile/builder/build.go
index <HASH>..<HASH> 100644
--- a/frontend/dockerfile/builder/build.go
+++ b/frontend/dockerfile/builder/build.go
@@ -861,6 +861,7 @@ func contextByName(ctx context.Context, c client.Client, sessionID, name string,
if err := json.Unmarshal(data, &img); err != nil {
return nil, nil, nil, err
}
+ img.Created = nil
st := llb.Image(ref, imgOpt...)
st, err = st.WithImageConfig(data) | dockerfile: fix created timestamp
Images built using docker-image:// passed through buildkit named
contexts had the wrong Image.Created timestamp, using the timestamp from
the used image, instead of the current datetime.
To fix, we perform the same input cleanup as in Dockerfile2LLB, and
explicitly set the timestamp to nil. | moby_buildkit | train | go |
e88a26793d9452804155f3fa0e027c3c76294787 | diff --git a/lib/cancan/ability.rb b/lib/cancan/ability.rb
index <HASH>..<HASH> 100644
--- a/lib/cancan/ability.rb
+++ b/lib/cancan/ability.rb
@@ -202,6 +202,28 @@ module CanCan
relevant_rules(action, subject).any?(&:only_raw_sql?)
end
+ # Copies all rules of the given +CanCan::Ability+ and adds them to +self+.
+ # class ReadAbility
+ # include CanCan::Ability
+ #
+ # def initialize
+ # can :read, User
+ # end
+ # end
+ #
+ # class WritingAbility
+ # include CanCan::Ability
+ #
+ # def initialize
+ # can :edit, User
+ # end
+ # end
+ #
+ # read_ability = ReadAbility.new
+ # read_ability.can? :edit, User.new #=> false
+ # read_ability.merge(WritingAbility.new)
+ # read_ability.can? :edit, User.new #=> true
+ #
def merge(ability)
ability.rules.each do |rule|
add_rule(rule.dup) | Added documentation for merge. (#<I>) | CanCanCommunity_cancancan | train | rb |
d873474a3f4dd287ad6683b3966732617b9b9064 | diff --git a/account/auth_backends.py b/account/auth_backends.py
index <HASH>..<HASH> 100644
--- a/account/auth_backends.py
+++ b/account/auth_backends.py
@@ -11,12 +11,14 @@ class UsernameAuthenticationBackend(ModelBackend):
def authenticate(self, **credentials):
try:
user = User.objects.get(username__iexact=credentials["username"])
- except User.DoesNotExist:
+ except (User.DoesNotExist, KeyError):
return None
else:
- if user.check_password(credentials["password"]):
- return user
-
+ try:
+ if user.check_password(credentials["password"]):
+ return user
+ except KeyError:
+
class EmailAuthenticationBackend(ModelBackend):
@@ -24,9 +26,12 @@ class EmailAuthenticationBackend(ModelBackend):
qs = EmailAddress.objects.filter(Q(primary=True) | Q(verified=True))
try:
email_address = qs.get(email__iexact=credentials["username"])
- except EmailAddress.DoesNotExist:
+ except (EmailAddress.DoesNotExist, KeyError):
return None
else:
user = email_address.user
- if user.check_password(credentials["password"]):
- return user
+ try:
+ if user.check_password(credentials["password"]):
+ return user
+ except KeyError:
+ return None | Be more resilliant to auth backends that don't require username/password as the params. | pinax_django-user-accounts | train | py |
27c1a4c0c7fde390065d3045886af2b83f0cb28f | diff --git a/apiserver/server_test.go b/apiserver/server_test.go
index <HASH>..<HASH> 100644
--- a/apiserver/server_test.go
+++ b/apiserver/server_test.go
@@ -60,12 +60,15 @@ func (s *serverSuite) TestStop(c *gc.C) {
machine, password := s.Factory.MakeMachineReturningPassword(
c, &factory.MachineParams{Nonce: "fake_nonce"})
+ // A net.TCPAddr cannot be directly stringified into a valid hostname.
+ address := fmt.Sprintf("localhost:%d", srv.Addr().Port)
+
// Note we can't use openAs because we're not connecting to
apiInfo := &api.Info{
Tag: machine.Tag(),
Password: password,
Nonce: "fake_nonce",
- Addrs: []string{srv.Addr().String()},
+ Addrs: []string{address},
CACert: coretesting.CACert,
EnvironTag: s.State.EnvironTag(),
} | Fix test stop to specify the address properly. | juju_juju | train | go |
5e16f9f3e5cddf72a5490d1814c37b95f7934e21 | diff --git a/lib/callcredit.rb b/lib/callcredit.rb
index <HASH>..<HASH> 100644
--- a/lib/callcredit.rb
+++ b/lib/callcredit.rb
@@ -21,8 +21,8 @@ module Callcredit
@config = Config.new(&block)
end
- def self.id_enhanced_check(check_data)
- client.id_enhanced_check(check_data)
+ def self.id_enhanced_check(*args)
+ client.id_enhanced_check(*args)
end
def self.client | Splat delegated method's args | gocardless_callcredit-ruby | train | rb |
ee360c187702064e7692184de6f0ca35f616c09d | diff --git a/forms/UploadField.php b/forms/UploadField.php
index <HASH>..<HASH> 100644
--- a/forms/UploadField.php
+++ b/forms/UploadField.php
@@ -915,16 +915,18 @@ class UploadField_SelectHandler extends RequestHandler {
$config->addComponent(new GridFieldDataColumns());
$config->addComponent(new GridFieldPaginator(10));
- // Create the data source for the list of files within the current directory.
- $files = DataList::create('File')->filter('ParentID', $folderID);
-
- // If relation is to be autoset, make sure only objects from related class are listed.
+ // If relation is to be autoset, we need to make sure we only list compatible objects.
+ $baseClass = null;
if ($this->parent->relationAutoSetting) {
- if ($relationClass = $this->parent->getRelationAutosetClass()) {
- $files->filter('ClassName', $relationClass);
- }
+ $baseClass = $this->parent->getRelationAutosetClass();
}
+ // By default we can attach anything that is a file, or derives from file.
+ if (!$baseClass) $baseClass = 'File';
+
+ // Create the data source for the list of files within the current directory.
+ $files = DataList::create($baseClass)->filter('ParentID', $folderID);
+
$fileField = new GridField('Files', false, $files, $config);
$fileField->setAttribute('data-selectable', true);
if($this->parent->getConfig('allowedMaxFileNumber') > 1) $fileField->setAttribute('data-multiselect', true); | BUGFIX: include derived classes for attaching in the UploadField. | silverstripe_silverstripe-framework | train | php |
9be0845af6bdf1c514b9c3a56b67dc9f3837b8f1 | diff --git a/src/onelogin/api/client.py b/src/onelogin/api/client.py
index <HASH>..<HASH> 100644
--- a/src/onelogin/api/client.py
+++ b/src/onelogin/api/client.py
@@ -1701,7 +1701,6 @@ class OneLoginClient(object):
"""
self.clean_error()
- self.prepare_token()
try:
url = Constants.EMBED_APP_URL | prepare_token is not required on get_embed_apps method | onelogin_onelogin-python-sdk | train | py |
240aab1d7d096d162505f69ab11313cba19f413a | diff --git a/c7n/policy.py b/c7n/policy.py
index <HASH>..<HASH> 100644
--- a/c7n/policy.py
+++ b/c7n/policy.py
@@ -85,7 +85,7 @@ class PolicyExecutionMode(object):
def __init__(self, policy):
self.policy = policy
- def run(self):
+ def run(self, event=None, lambda_context=None):
"""Run the actual policy."""
raise NotImplementedError("subclass responsibility")
@@ -300,7 +300,7 @@ class PeriodicMode(LambdaMode, PullMode):
POLICY_METRICS = ('ResourceCount', 'ResourceTime', 'ActionTime')
- def run(self):
+ def run(self, event, lambda_context):
return PullMode.run(self) | fix run method signature on periodic mode, update base class to reflect run interface params (#<I>) | cloud-custodian_cloud-custodian | train | py |
5b6c8eb155f816d023ccd3fd9c52314edb4aa346 | diff --git a/datapackage/datapackage.py b/datapackage/datapackage.py
index <HASH>..<HASH> 100644
--- a/datapackage/datapackage.py
+++ b/datapackage/datapackage.py
@@ -26,9 +26,9 @@ class DataPackage(object):
metadata (dict, str or file-like object, optional): The contents of the
`datapackage.json` file. It can be a ``dict`` with its contents,
a ``string`` with the local path for the file or its URL, or a
- file-like object. It also can point to a `ZIP` file with the
- `datapackage.json` in its root folder. If you're passing a
- ``dict``, it's a good practice to also set the
+ file-like object. It also can point to a `ZIP` file with one and
+ only one `datapackage.json` (it can be in a subfolder). If
+ you're passing a ``dict``, it's a good practice to also set the
``default_base_path`` parameter to the absolute `datapackage.json`
path.
schema (dict or str, optional): The schema to be used to validate this
@@ -226,7 +226,7 @@ class DataPackage(object):
def _extract_zip_if_possible(self, metadata):
'''str: Path to the extracted datapackage.json if metadata points to
- ZIP, or the unaltered metadata.'''
+ ZIP, or the unaltered metadata otherwise.'''
result = metadata
try:
if isinstance(metadata, six.string_types): | [#<I>] Update docstring | frictionlessdata_datapackage-py | train | py |
2474931ab3b22cb399b8f392b6da74f039eb22c8 | diff --git a/cmd/minikube/cmd/dashboard.go b/cmd/minikube/cmd/dashboard.go
index <HASH>..<HASH> 100644
--- a/cmd/minikube/cmd/dashboard.go
+++ b/cmd/minikube/cmd/dashboard.go
@@ -172,8 +172,8 @@ func kubectlProxy(kubectlVersion string, contextName string) (*exec.Cmd, string,
// readByteWithTimeout returns a byte from a reader or an indicator that a timeout has occurred.
func readByteWithTimeout(r io.ByteReader, timeout time.Duration) (byte, bool, error) {
- bc := make(chan byte)
- ec := make(chan error)
+ bc := make(chan byte, 1)
+ ec := make(chan error, 1)
go func() {
b, err := r.ReadByte()
if err != nil { | prevents a goroutine from being leaked in call to readByteWithTimeout | kubernetes_minikube | train | go |
d043f2b5a9012480cb49473f818390c5c1aefcf2 | diff --git a/messages_extends/static/close-alerts.js b/messages_extends/static/close-alerts.js
index <HASH>..<HASH> 100644
--- a/messages_extends/static/close-alerts.js
+++ b/messages_extends/static/close-alerts.js
@@ -1,6 +1,9 @@
-$("a.close[close-href]").click(function (e) {
- e.preventDefault();
- $.post($(this).attr("close-href"), "", function () {
- });
- }
-);
+$(function() {
+ $("a.close[close-href]").click(function (e) {
+ e.preventDefault();
+ $.post($(this).attr("close-href"), "", function () {
+ });
+ }
+ );
+});
+ | jQuery js need to be executed after document is ready. | AliLozano_django-messages-extends | train | js |
0bc07bfd1e2f3d115606f1bef5a8218e36f6a2ea | diff --git a/src/Eloquent/Model.php b/src/Eloquent/Model.php
index <HASH>..<HASH> 100644
--- a/src/Eloquent/Model.php
+++ b/src/Eloquent/Model.php
@@ -12,6 +12,15 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
class Model extends \Illuminate\Database\Eloquent\Model
{
/**
+ * The "type" of the auto-incrementing ID.
+ * Setting to 'string' prevents Laravel from casting non-integer IDs
+ * to numeric ones. Very helpful with inverted relations.
+ *
+ * @var string
+ */
+ protected $keyType = 'string';
+
+ /**
* Get the format for database stored dates.
*
* @return string | Update Model with $keyType = 'string' property
Use of $keyType property, set to 'string' (instead of default, Laravel's int), prevents Laravel from casting non-integer IDs to numeric ones. Since RethinkDB uses UUIDs instead of ints, thought it might be good to change default $keyType directly in base Model class. | duxet_laravel-rethinkdb | train | php |
627d5bb4672cf118f4c6440d7be5c058b25596d5 | diff --git a/concrete/src/Editor/CkeditorEditor.php b/concrete/src/Editor/CkeditorEditor.php
index <HASH>..<HASH> 100644
--- a/concrete/src/Editor/CkeditorEditor.php
+++ b/concrete/src/Editor/CkeditorEditor.php
@@ -5,6 +5,7 @@ use Concrete\Core\Site\Config\Liaison as Repository;
use Concrete\Core\Http\Request;
use Concrete\Core\Http\ResponseAssetGroup;
use Concrete\Core\Localization\Localization;
+use Concrete\Core\Page\Theme\Theme as PageTheme;
use Concrete\Core\Utility\Service\Identifier;
use URL;
use User;
@@ -84,9 +85,21 @@ EOL;
if ($cp->canViewPage()) {
$pt = $c->getCollectionThemeObject();
if (is_object($pt)) {
- $obj->classes = $pt->getThemeEditorClasses();
+ if ($pt->getThemeHandle()) {
+ $obj->classes = $pt->getThemeEditorClasses();
+ } else {
+ $siteTheme = $pt::getSiteTheme();
+ if (is_object($siteTheme)) {
+ $obj->classes = $siteTheme->getThemeEditorClasses();
+ }
+ }
}
}
+ } else {
+ $siteTheme = PageTheme::getSiteTheme();
+ if (is_object($siteTheme)) {
+ $obj->classes = $siteTheme->getThemeEditorClasses();
+ }
}
return $obj; | get theme editor classes when using CKEditor in dashboard single pages and non-pages | concrete5_concrete5 | train | php |
b9cdaaadfee52ee3918aa942f87fdfd5e6938dac | diff --git a/modopt/opt/algorithms.py b/modopt/opt/algorithms.py
index <HASH>..<HASH> 100644
--- a/modopt/opt/algorithms.py
+++ b/modopt/opt/algorithms.py
@@ -393,7 +393,10 @@ class FISTA(object):
"""
if self.restart_strategy is None:
return False
- criterion = np.dot(z_old - x_new, x_new - x_old) >= 0
+ criterion = np.dot(
+ (z_old - x_new).flatten(),
+ (x_new - x_old).flatten(),
+ ) >= 0
if criterion:
if 'adaptive' in self.restart_strategy:
self.r_lazy *= self.xi_restart | corrected criterion computation in the case of a non-1D optim variable | CEA-COSMIC_ModOpt | train | py |
8a3bc76f93ec7f9807aa69e871fdffe7c66f982b | diff --git a/engine/src/main/java/org/camunda/bpm/engine/task/IdentityLink.java b/engine/src/main/java/org/camunda/bpm/engine/task/IdentityLink.java
index <HASH>..<HASH> 100644
--- a/engine/src/main/java/org/camunda/bpm/engine/task/IdentityLink.java
+++ b/engine/src/main/java/org/camunda/bpm/engine/task/IdentityLink.java
@@ -61,7 +61,10 @@ public interface IdentityLink {
public String getProcessDefId();
/**
- * Get the tenand id
+ * The id of the tenant associated with this identity link.
+ *
+ * @since 7.5
+ *
*/
public String getTenantId(); | fix(engine): Added version number to tenantId in IdentityLink
related to #CAM-<I> | camunda_camunda-bpm-platform | train | java |
7674a828013e8e62ea91892ef3146e2b9b487357 | diff --git a/provider/kv_test.go b/provider/kv_test.go
index <HASH>..<HASH> 100644
--- a/provider/kv_test.go
+++ b/provider/kv_test.go
@@ -264,6 +264,7 @@ func TestKvWatchTree(t *testing.T) {
<-configChan
close(c1) // WatchTree chans can close due to error
case <-time.After(1 * time.Second):
+ t.Fatalf("Failed to create a new WatchTree chan")
}
select {
@@ -271,6 +272,7 @@ func TestKvWatchTree(t *testing.T) {
c2 <- []*store.KVPair{}
<-configChan
case <-time.After(1 * time.Second):
+ t.Fatalf("Failed to create a new WatchTree chan")
}
select { | Fatalf for timeout cases. | containous_traefik | train | go |
8795e977503b3f32ca32969de62e21cafc6ad891 | diff --git a/pycoin/version.py b/pycoin/version.py
index <HASH>..<HASH> 100644
--- a/pycoin/version.py
+++ b/pycoin/version.py
@@ -1 +1 @@
-version = "0.80"
+version = "0.90a" | Update version to <I>a. | richardkiss_pycoin | train | py |
2b11ffd6aadc5f4d30d6b4d0edb7adc626c0cbab | diff --git a/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java b/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java
index <HASH>..<HASH> 100644
--- a/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java
+++ b/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java
@@ -68,7 +68,7 @@ public class DatePropertyParser extends PropertyParser {
@Override
public void parseFormatString(final Schema entity, String expression) throws FrameworkException {
- if (expression.length() == 0) {
+ if (expression == null || expression.length() == 0) {
errorBuffer.add(SchemaNode.class.getSimpleName(), new InvalidPropertySchemaToken(expression, "invalid_date_pattern", "Empty date pattern."));
return;
} | Added null check (was in outer method before) | structr_structr | train | java |
c8ecaf2715c91825976a5443c095baa82d1ef59d | diff --git a/src/path.js b/src/path.js
index <HASH>..<HASH> 100644
--- a/src/path.js
+++ b/src/path.js
@@ -36,7 +36,7 @@ _gpfErrorDeclare("path", {
//region _gpfPathDecompose
function _gpfPathSplit (path) {
- if (-1 < path.indexOf("\\")) {
+ if (path.indexOf("\\") > -1) {
// DOS path is case insensitive, hence lowercase it
return path.toLowerCase().split("\\");
}
@@ -109,7 +109,7 @@ function _gpfPathName (path) {
function _gpfPathExtension (path) {
var name = _gpfPathName(path),
pos = name.lastIndexOf(".");
- if (-1 === pos) {
+ if (pos === -1) {
return "";
}
return name.substr(pos);
@@ -250,7 +250,7 @@ gpf.path = {
nameOnly: function (path) {
var name = _gpfPathName(path),
pos = name.lastIndexOf(".");
- if (-1 === pos) {
+ if (pos === -1) {
return name;
}
return name.substr(0, pos); | !yoda style (#<I>) | ArnaudBuchholz_gpf-js | train | js |
3f8659e99fe2e8b0387f6921a3f7cfa5860e4560 | diff --git a/src/Block/LocaleSwitcherBlockService.php b/src/Block/LocaleSwitcherBlockService.php
index <HASH>..<HASH> 100644
--- a/src/Block/LocaleSwitcherBlockService.php
+++ b/src/Block/LocaleSwitcherBlockService.php
@@ -71,7 +71,7 @@ class LocaleSwitcherBlockService extends AbstractBlockService
), E_USER_DEPRECATED);
parent::__construct($templatingOrDeprecatedName, $showCountryFlagsOrTemplating);
- $this->showCountryFlags = $showCountryFlags;
+ $this->showCountryFlags = $showCountryFlags ?? false;
} else {
throw new \TypeError(sprintf(
'Argument 2 passed to "%s()" must be either a "bool" value, "null" or an instance of "%s", %s given.', | Fix nullable value
$showCountryFlags could be nullable and the class property should
be boolean, there hasn't been a release yet, so there is no need
of changelog. | sonata-project_SonataTranslationBundle | train | php |
eb56c5b63eed75804f9610bf95cffe4e49ca0b91 | diff --git a/packages/okam-build/example/base/scripts/swan.config.js b/packages/okam-build/example/base/scripts/swan.config.js
index <HASH>..<HASH> 100644
--- a/packages/okam-build/example/base/scripts/swan.config.js
+++ b/packages/okam-build/example/base/scripts/swan.config.js
@@ -7,7 +7,7 @@
const merge = require('../../../').merge;
module.exports = merge({}, require('./base.config'), {
- polyfill: ['async'],
+ localPolyfill: ['async'],
wx2swan: true,
framework: ['filter'],
processors: {
diff --git a/packages/okam-cli/templates/base/scripts/swan.config.js b/packages/okam-cli/templates/base/scripts/swan.config.js
index <HASH>..<HASH> 100644
--- a/packages/okam-cli/templates/base/scripts/swan.config.js
+++ b/packages/okam-cli/templates/base/scripts/swan.config.js
@@ -9,7 +9,7 @@ const merge = require('okam-build').merge;
module.exports = merge({}, require('./base.config'), {
<% if: ${async} %>
- polyfill: ['async'],
+ localPolyfill: ['async'],
<% /if %>
// wx2swan: true,
rules: [] | fix(okam-cli): change swan.config.js polyfill to localPoly due to smarty app breackchange | ecomfe_okam | train | js,js |
5eccbc702d6eecba499b078baa6c449980a6b713 | diff --git a/template/parse.go b/template/parse.go
index <HASH>..<HASH> 100644
--- a/template/parse.go
+++ b/template/parse.go
@@ -144,6 +144,11 @@ func (r *rawTemplate) Template() (*Template, error) {
continue
}
+ // The name defaults to the type if it isn't set
+ if pp.Name == "" {
+ pp.Name = pp.Type
+ }
+
// Set the configuration
delete(c, "except")
delete(c, "only") | name a post-processor to it's type if it is not named | hashicorp_packer | train | go |
cf08890daed3f57467c0e7625b41822ffdde06e7 | diff --git a/acceptance-tests/src/test/java/io/blueocean/ath/offline/personalization/FavoritesCardsTest.java b/acceptance-tests/src/test/java/io/blueocean/ath/offline/personalization/FavoritesCardsTest.java
index <HASH>..<HASH> 100644
--- a/acceptance-tests/src/test/java/io/blueocean/ath/offline/personalization/FavoritesCardsTest.java
+++ b/acceptance-tests/src/test/java/io/blueocean/ath/offline/personalization/FavoritesCardsTest.java
@@ -165,6 +165,8 @@ public class FavoritesCardsTest extends AbstractFavoritesTest {
tmpFile.createNewFile();
sseClientRule.untilEvents(pipeline.buildsFinished);
+ dashboardPage.open(); // FIXME - because sse is not yet registered (started before the page was loaded)
+
dashboardPage.checkFavoriteCardStatus(fullNameMaster, SUCCESS);
dashboardPage.checkFavoriteCardStatus(fullNameOther, SUCCESS); | Ugh hax, force the page to have current status after build until sse is fixed | jenkinsci_blueocean-plugin | train | java |
f0dca2f001701e917da1440d34e274be06f09bc4 | diff --git a/classes/ggphpsoapclient.php b/classes/ggphpsoapclient.php
index <HASH>..<HASH> 100644
--- a/classes/ggphpsoapclient.php
+++ b/classes/ggphpsoapclient.php
@@ -180,7 +180,7 @@ var_export($action);
public function setOption( $option, $value )
{
- if ( $opption = 'soapVersion' )
+ if ( $option = 'soapVersion' )
{
$this->SoapVersion = $version;
}
diff --git a/classes/ggsoapclient.php b/classes/ggsoapclient.php
index <HASH>..<HASH> 100644
--- a/classes/ggsoapclient.php
+++ b/classes/ggsoapclient.php
@@ -38,7 +38,7 @@ class ggSOAPClient extends ggWebservicesClient
public function setOption( $option, $value )
{
- if ( $opption = 'soapVersion' )
+ if ( $option = 'soapVersion' )
{
$this->SoapVersion = $version;
} | - fix: setOption (soapVersion) not working | gggeek_ggwebservices | train | php,php |
740ea9ad9b8dcd8b9d80df14725a545d64b956fc | diff --git a/lib/core/DiscordieDispatcher.js b/lib/core/DiscordieDispatcher.js
index <HASH>..<HASH> 100644
--- a/lib/core/DiscordieDispatcher.js
+++ b/lib/core/DiscordieDispatcher.js
@@ -1,5 +1,6 @@
"use strict";
+const DiscordieError = require("./DiscordieError");
const events = require("events");
let lastEvent = null;
diff --git a/lib/core/DiscordieError.js b/lib/core/DiscordieError.js
index <HASH>..<HASH> 100644
--- a/lib/core/DiscordieError.js
+++ b/lib/core/DiscordieError.js
@@ -1,8 +1,8 @@
"use strict";
-class DiscordieError {
+class DiscordieError extends Error {
constructor(message, exception) {
- this.message = message;
+ super(message);
this.exception = exception;
}
} | Fix DiscordieError and DiscordieError | qeled_discordie | train | js,js |
ffbf48f036cbd7d87fe2f42f7c21d57863c2a6d4 | diff --git a/txnserver/ledger_web_client.py b/txnserver/ledger_web_client.py
index <HASH>..<HASH> 100644
--- a/txnserver/ledger_web_client.py
+++ b/txnserver/ledger_web_client.py
@@ -302,8 +302,8 @@ class LedgerWebClient(object):
except urllib2.HTTPError as err:
logger.error('peer operation on url %s failed with response: %d',
url, err.code)
- raise MessageException('operation failed with resonse: {0}'.format(
- err.code))
+ raise MessageException('operation failed '
+ 'with response: {0}'.format(err.code))
except urllib2.URLError as err:
logger.error('peer operation on url %s failed: %s', | Fix line length issue for lint | hyperledger_sawtooth-core | train | py |
2e02f933cf014e42b6c6a4fea3101fed2dddf5f8 | diff --git a/components/colorPicker/index.js b/components/colorPicker/index.js
index <HASH>..<HASH> 100644
--- a/components/colorPicker/index.js
+++ b/components/colorPicker/index.js
@@ -9,6 +9,8 @@ module.exports = {
this.$on('openCP', function (event) {
this.show = true;
this.originalColor = event;
+ this.cancelIntercept = this.onCancel.bind(this);
+ document.addEventListener("backbutton", this.cancelIntercept, true);
});
},
computed: {
@@ -38,6 +40,8 @@ module.exports = {
},
onCancel: function (e) {
e.preventDefault();
+ e.stopPropagation();
+ document.removeEventListener("backbutton", this.cancelIntercept, true);
this.selectedColor = this.originalColor;
this.show = false;
} | color picker always hides on 'back' now | mozilla_webmaker-android | train | js |
0f0b0275f61f70f333d6e861192f00177e6a8a4d | diff --git a/lib/ghtorrent/ghtorrent.rb b/lib/ghtorrent/ghtorrent.rb
index <HASH>..<HASH> 100644
--- a/lib/ghtorrent/ghtorrent.rb
+++ b/lib/ghtorrent/ghtorrent.rb
@@ -944,7 +944,9 @@ module GHTorrent
# Adds a pull request history event
def ensure_pull_request_history(id, ts, unq, act, actor)
- user = ensure_user(actor, false, false)
+ user = unless actor.nil?
+ ensure_user(actor, false, false)
+ end
pull_req_history = @db[:pull_request_history]
entry = pull_req_history.first(:pull_request_id => id,
:created_at => (ts - 3)..(ts + 3), | Don't choke if actor is null | gousiosg_github-mirror | train | rb |
1fe5154ae7c1054bb7e3b2f7fe1e4a45a9496393 | diff --git a/viewport-units-buggyfill.js b/viewport-units-buggyfill.js
index <HASH>..<HASH> 100755
--- a/viewport-units-buggyfill.js
+++ b/viewport-units-buggyfill.js
@@ -365,7 +365,7 @@
};
forEach.call(document.styleSheets, function(sheet) {
- if (!sheet.href || origin(sheet.href) === origin(location.href)) {
+ if (!sheet.href || origin(sheet.href) === origin(location.href) || sheet.ownerNode.getAttribute('data-viewport-units-buggyfill') === 'ignore') {
// skip <style> and <link> from same origin
return;
} | Update viewport-units-buggyfill.js
Problem:
CSS from CDN does not work (CORS error) even if we add data-viewport-units-buggyfill="ignore" as attribute in link tag
Solution:
Add data-viewport-units-buggyfill="ignore" for importCrossOriginLinks function to skip import cross origin links. | rodneyrehm_viewport-units-buggyfill | train | js |
0c8ff12881ad6377af99b5ba394b66de80252b89 | diff --git a/tests/Process/ProcessorCounterTest.php b/tests/Process/ProcessorCounterTest.php
index <HASH>..<HASH> 100644
--- a/tests/Process/ProcessorCounterTest.php
+++ b/tests/Process/ProcessorCounterTest.php
@@ -12,9 +12,9 @@ class ProcessorCounterTest extends \PHPUnit_Framework_TestCase
*/
public function shouldCountTheNumberOfProcessorInLinux()
{
- $processorCount = new ProcessorCounter(__DIR__.'/Fixture/proc_cpuinfo');
+ $processorCount = new ProcessorCounter();
$this->assertEquals(4, $processorCount->execute());
}
}
-
\ No newline at end of file
+ | Fixed test for new ProcessorCounter | liuggio_fastest | train | php |
ae653b3f5276017040a15244c7584122a86b0b73 | diff --git a/lib/apic.js b/lib/apic.js
index <HASH>..<HASH> 100644
--- a/lib/apic.js
+++ b/lib/apic.js
@@ -114,7 +114,16 @@ define(function (require) {
root.getBaseHost = function () {
return base;
};
-
+
+ root.setBaseHost = function (host) {
+
+ if (host) {
+ base = host;
+ }
+
+ return base;
+ };
+
function method(verb, uri, res, params, secure) {
var safe = safeMethods[verb] || false,
protocol = (secure = secure || !safe) ? 'https:' : scheme; | Implemented method to set basehost uri | temich_apic.js | train | js |
5f115fe64fe3f26c11d99bcf8bf08684d2b72caf | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
from setuptools import setup
setup(name='billboard.py',
- version='4.4.0',
+ version='4.4.1',
description='Unofficial Python API for accessing Billboard.com charts',
author='Allen Guo',
author_email='guoguo12@gmail.com', | Bump to <I> (hotfix; see message for prior commit) | guoguo12_billboard-charts | train | py |
d57496d51a29727eab41e60cac3550b9f752cfb9 | diff --git a/myo/math.py b/myo/math.py
index <HASH>..<HASH> 100644
--- a/myo/math.py
+++ b/myo/math.py
@@ -171,7 +171,7 @@ class Quaternion(object):
return iter((self.x, self.y, self.z, self.w))
def __repr__(self):
- return '{}({0}, {1}, {2}, {3})'.format(
+ return '{0}({1}, {2}, {3}, {4})'.format(
type(self).__name__, self.x, self.y, self.z, self.w)
def __invert__(self): | Bugfix for string formatting
The exception `ValueError: cannot switch from automatic field numbering to manual field specification` is raised when running `event.orientation` inside of the `on_orientation` function in a subclassed `myo.DeviceListener` in python <I> | NiklasRosenstein_myo-python | train | py |
fa3f9bdac996d87ec33fa70b8c0c3f29762953aa | diff --git a/packages/wdio-cli/src/constants.js b/packages/wdio-cli/src/constants.js
index <HASH>..<HASH> 100644
--- a/packages/wdio-cli/src/constants.js
+++ b/packages/wdio-cli/src/constants.js
@@ -76,10 +76,10 @@ export const SUPPORTED_PACKAGES = {
{ name: 'browserstack', value: '@wdio/browserstack-service$--$browserstack' },
{ name: 'appium', value: '@wdio/appium-service$--$appium' },
{ name: 'firefox-profile', value: '@wdio/firefox-profile-service$--$firefox-profile' },
+ { name: 'crossbrowsertesting', value: '@wdio/crossbrowsertesting-service$--$crossbrowsertesting' },
// external
{ name: 'zafira-listener', value: 'wdio-zafira-listener-service$--$zafira-listener' },
{ name: 'reportportal', value: 'wdio-reportportal-service$--$reportportal' },
- { name: 'crossbrowsertesting', value: 'wdio-crossbrowsertesting-service$--$crossbrowsertesting' },
{ name: 'docker', value: 'wdio-docker-service$--$docker' },
],
} | Move cbt to internal services in wdio-cli (#<I>) | webdriverio_webdriverio | train | js |
576b869fdad14549847adc15c3c4c2d27e6cf0ad | diff --git a/src/app-router.js b/src/app-router.js
index <HASH>..<HASH> 100644
--- a/src/app-router.js
+++ b/src/app-router.js
@@ -75,7 +75,12 @@ export class AppRouter extends Router {
super.registerViewPort(viewPort, name);
if (!this.isActive) {
- this.activate();
+ if('configureRouter' in this.container.viewModel){
+ var result = this.container.viewModel.configureRouter() || Promise.resolve();
+ return result.then(() => this.activate());
+ }else{
+ this.activate();
+ }
} else {
this.dequeueInstruction();
} | fix(router): enable async configureRouter for app-level router | aurelia_router | train | js |
847ae972bfb664160a1b5b2a35e69f2df37e87fe | diff --git a/lxd/cluster/upgrade.go b/lxd/cluster/upgrade.go
index <HASH>..<HASH> 100644
--- a/lxd/cluster/upgrade.go
+++ b/lxd/cluster/upgrade.go
@@ -194,7 +194,6 @@ func UpgradeMembersWithoutRole(gateway *Gateway, members []db.NodeInfo) error {
if err != nil {
return errors.Wrap(err, "Failed to add dqlite node")
}
-
}
return nil | lxd/cluster/upgrade: Removes empty line in UpgradeMembersWithoutRole | lxc_lxd | train | go |
6a4ff13c82638c10c249813a5d95fcc532f0715f | diff --git a/Kwc/Form/Field/Abstract/Component.php b/Kwc/Form/Field/Abstract/Component.php
index <HASH>..<HASH> 100644
--- a/Kwc/Form/Field/Abstract/Component.php
+++ b/Kwc/Form/Field/Abstract/Component.php
@@ -17,6 +17,10 @@ class Kwc_Form_Field_Abstract_Component extends Kwc_Abstract
{
$ret = parent::getTemplateVars();
$form = $this->_getForm();
+
+ //initialize form, sets formName on fields
+ $form->getComponent()->getForm();
+
$postData = array();
$errors = array();
if ($form->getComponent()->isProcessed()) { | initialize form if view cache is used
fixes test | koala-framework_koala-framework | train | php |
e9d3c87f76a3c026ce968fb1802d1b7a488f87b1 | diff --git a/test/Functional/Fixtures/TestKernel.php b/test/Functional/Fixtures/TestKernel.php
index <HASH>..<HASH> 100644
--- a/test/Functional/Fixtures/TestKernel.php
+++ b/test/Functional/Fixtures/TestKernel.php
@@ -21,11 +21,11 @@ class TestKernel extends Kernel
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
- $loader->load(__DIR__.'/config/config_27.yml');
-// if (self::VERSION_ID < 20800) {
-// } else {
-// $loader->load(__DIR__.'/config/config.yml');
-// }
+ if (Kernel::VERSION_ID >= 30000) {
+ $loader->load(__DIR__.'/config/config.yml');
+ } else {
+ $loader->load(__DIR__.'/config/config_27.yml');
+ }
}
/** | Fixed commented config file in test kernel | hostnet_form-handler-bundle | train | php |
f14743a90221671434c1903014ad415ce72a4c37 | diff --git a/aioelasticsearch/transport.py b/aioelasticsearch/transport.py
index <HASH>..<HASH> 100644
--- a/aioelasticsearch/transport.py
+++ b/aioelasticsearch/transport.py
@@ -278,10 +278,11 @@ class AIOHttpTransport(Transport):
raise
else:
+ self.connection_pool.mark_live(connection)
+
if method == 'HEAD':
return 200 <= status < 300
- self.connection_pool.mark_live(connection)
if data:
data = self.deserializer.loads(
data, headers.get('content-type'), | mark any connection sucessful if server responded | aio-libs_aioelasticsearch | train | py |
6afd94c88d9640d062b7e2605ff759aab476ef13 | diff --git a/services/accounts.php b/services/accounts.php
index <HASH>..<HASH> 100644
--- a/services/accounts.php
+++ b/services/accounts.php
@@ -27,7 +27,7 @@ return array(
),
'deleteSshKey' => array(
'httpMethod' => 'DELETE',
- 'uri' => 'ssh_keys/array(id),',
+ 'uri' => 'ssh_keys/{id}',
'summary' => 'Deletes an ssh key',
'parameters' => array(
'id' => array( | Fix ssh key deletion, broken by an overenthusiastic search&replace. | platformsh_platformsh-cli | train | php |
e18509dca7c4d51f75928593902a0ec91a3ada88 | diff --git a/dataviews/collector.py b/dataviews/collector.py
index <HASH>..<HASH> 100644
--- a/dataviews/collector.py
+++ b/dataviews/collector.py
@@ -589,8 +589,8 @@ class Analyze(Collect):
else:
self.times = []
self.kwargs = kwargs
- self.stackwise = self.kwargs.pop('stackwise', False)
- self.mode = 'set'
+ self.stackwise = kwargs.pop('stackwise', False)
+ self.mode = kwargs.pop('mode', 'set')
self.path = None
@@ -736,7 +736,10 @@ class Collector(AttrTree):
Given a ViewRef and the ViewOperation analysisfn, process the
data resolved by the reference with analysisfn at each step.
"""
- return Analyze(reference, analysisfn, *args, **kwargs)
+ task = Analyze(reference, analysisfn, *args, **kwargs)
+ if task.mode == 'merge':
+ self.path_items[uuid.uuid4().hex] = task
+ return task
def __call__(self, attrtree=AttrTree(), times=[]): | Enable passing of mode (set/merge) via kwargs in Collector.analyze | pyviz_holoviews | train | py |
4cc31ebab166f4d8b9438381e23c437881781131 | diff --git a/test/v2/frame.js b/test/v2/frame.js
index <HASH>..<HASH> 100644
--- a/test/v2/frame.js
+++ b/test/v2/frame.js
@@ -34,8 +34,8 @@ TestBody.testWith('Frame.RW: read/write payload', testRW.cases(Frame.RW, [
0x01, 0x02, 0x03, 0x04, // id:4
0x00, 0x00, 0x00, 0x00, // reserved:4
0x00, 0x00, 0x00, 0x00, // reserved:4
-
- 0x04, 0x64, 0x6f, 0x67, 0x65 // payload~1
+ 0x04, 0x64, 0x6f, 0x67, // payload~1
+ 0x65 // ...
]
], | test/v2/frame: trivial cleanup | uber_tchannel-node | train | js |
dc94fafaaa5fceb5a2ccaae7342bdf4030e05d14 | diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
index <HASH>..<HASH> 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ public class RabbitAutoConfiguration {
@Bean
@ConditionalOnProperty(prefix = "spring.rabbitmq", name = "dynamic", matchIfMissing = true)
@ConditionalOnMissingBean(AmqpAdmin.class)
- public AmqpAdmin amqpAdmin(CachingConnectionFactory connectionFactory) {
+ public AmqpAdmin amqpAdmin(ConnectionFactory connectionFactory) {
return new RabbitAdmin(connectionFactory);
} | Fix dependency of AmqpAdmin
AmqpAdmin does not require a CachingConnectionFactory. Using the more
general CachingConnectionFactory provides more flexibility.
Closes gh-<I> | spring-projects_spring-boot | train | java |
c3bc29f276d77ca976cddc6995a8549895bc39f4 | diff --git a/lib/Parser/DocumentParser.php b/lib/Parser/DocumentParser.php
index <HASH>..<HASH> 100644
--- a/lib/Parser/DocumentParser.php
+++ b/lib/Parser/DocumentParser.php
@@ -563,7 +563,7 @@ class DocumentParser
$message = sprintf(
'Unknown directive: "%s" %sfor line "%s"',
$parserDirective->getName(),
- $this->environment->getCurrentFileName() ? sprintf('in "%s" ', $this->environment->getCurrentFileName()) : '',
+ $this->environment->getCurrentFileName() !== '' ? sprintf('in "%s" ', $this->environment->getCurrentFileName()) : '',
$line
); | Fix "Only booleans are allowed in a ternary operator condition" phpstan error. | doctrine_rst-parser | train | php |
ea2e3cad53e051cad97f9cf46aff15efef26709d | diff --git a/src/Laravel/SentinelServiceProvider.php b/src/Laravel/SentinelServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/Laravel/SentinelServiceProvider.php
+++ b/src/Laravel/SentinelServiceProvider.php
@@ -56,6 +56,7 @@ class SentinelServiceProvider extends ServiceProvider {
$this->registerCheckpoints();
$this->registerReminders();
$this->registerSentinel();
+ $this->setUserResolver();
}
/**
@@ -465,4 +466,17 @@ class SentinelServiceProvider extends ServiceProvider {
return mt_rand(1, $lottery[1]) <= $lottery[0];
}
+ /**
+ * Sets the user resolver on the request class.
+ *
+ * @return void
+ */
+ protected function setUserResolver()
+ {
+ $this->app['request']->setUserResolver(function()
+ {
+ return $this->app['sentinel']->getUser();
+ });
+ }
+
} | set user resolver on the request class | cartalyst_sentinel | train | php |
a75225244e0391a77fc53a1996d6fdde82760268 | diff --git a/packages/veritone-react-common/src/components/FilePicker/index.js b/packages/veritone-react-common/src/components/FilePicker/index.js
index <HASH>..<HASH> 100644
--- a/packages/veritone-react-common/src/components/FilePicker/index.js
+++ b/packages/veritone-react-common/src/components/FilePicker/index.js
@@ -31,7 +31,7 @@ class FilePicker extends Component {
height: 400,
width: 600,
accept: [],
- multiple: true,
+ multiple: false,
allowUrlUpload: true
}; | multiple false by default to match html5 file input: | veritone_veritone-sdk | train | js |
0172bf234bd2746d84370aba1b9c8a9fb8ed8922 | diff --git a/moz_sql_parser/formatting.py b/moz_sql_parser/formatting.py
index <HASH>..<HASH> 100644
--- a/moz_sql_parser/formatting.py
+++ b/moz_sql_parser/formatting.py
@@ -128,6 +128,11 @@ class Formatter:
return self._on(json)
if len(json) > 1:
+ # Nested queries
+ if 'from' in json:
+ return '({})'.format(self.format(json))
+ if 'select' in json:
+ return '({})'.format(self.format(json))
raise Exception('Operators should have only one key!')
key, value = list(json.items())[0]
@@ -208,6 +213,8 @@ class Formatter:
is_join = False
if 'from' in json:
from_ = json['from']
+ if 'union' in from_:
+ return self.union(from_['union'])
if not isinstance(from_, list):
from_ = [from_]
@@ -240,7 +247,8 @@ class Formatter:
def limit(self, json):
if 'limit' in json:
- return 'LIMIT {0}'.format(self.dispatch(json['limit']))
+ if json['limit']:
+ return 'LIMIT {0}'.format(self.dispatch(json['limit']))
def offset(self, json):
if 'offset' in json: | Handle nested queries in def op()
Passed test <I>-<I> | mozilla_moz-sql-parser | train | py |
bfb23ce7a3ba307ba6e57c856fe4f7b930c5c0e3 | diff --git a/gns3server/handlers/api/compute/vpcs_handler.py b/gns3server/handlers/api/compute/vpcs_handler.py
index <HASH>..<HASH> 100644
--- a/gns3server/handlers/api/compute/vpcs_handler.py
+++ b/gns3server/handlers/api/compute/vpcs_handler.py
@@ -99,7 +99,6 @@ class VPCSHandler:
vm = vpcs_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
vm.name = request.json.get("name", vm.name)
vm.console = request.json.get("console", vm.console)
- vm.startup_script = request.json.get("startup_script", vm.startup_script)
vm.updated()
response.json(vm)
@@ -270,7 +269,6 @@ class VPCSHandler:
yield from vm.start_capture(port_number, pcap_file_path)
response.json({"pcap_file_path": pcap_file_path})
-
@Route.post(
r"/projects/{project_id}/vpcs/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/stop_capture",
parameters={ | Fix hostname of VPCS is not changed
Fix <URL> | GNS3_gns3-server | train | py |
9a410605179f6eb1b23cba3b135a2c7067e2059d | diff --git a/lib/eye/process/monitor.rb b/lib/eye/process/monitor.rb
index <HASH>..<HASH> 100644
--- a/lib/eye/process/monitor.rb
+++ b/lib/eye/process/monitor.rb
@@ -3,14 +3,13 @@ module Eye::Process::Monitor
private
def load_external_pid_file
- newpid = load_pid_from_file
+ newpid = failsafe_load_pid
+
if !newpid
self.pid = nil
info "load_external_pid_file: no pid_file"
- return :no_pid_file
- end
-
- if process_pid_running?(newpid)
+ :no_pid_file
+ elsif process_pid_running?(newpid)
self.pid = newpid
info "load_external_pid_file: process <#{self.pid}> from pid_file found and already running"
:ok | use failsafe_load_pid as default | kostya_eye | train | rb |
297c3d3de885047aa28993776d073a1e0aaa6f1e | diff --git a/filesystems/native.py b/filesystems/native.py
index <HASH>..<HASH> 100644
--- a/filesystems/native.py
+++ b/filesystems/native.py
@@ -116,7 +116,7 @@ def _realpath(fs, path):
real = Path.root()
for segment in path.segments:
seen = current, = {str(real.descendant(segment))}
- while os.path.islink(current):
+ while fs.is_link(current):
current = os.path.join(
os.path.dirname(current), os.readlink(current),
) | One less use of os.path in internals. | Julian_Filesystems | train | py |
d867a203b2cf613422a0971f5e31789c9259c339 | diff --git a/master/buildbot/clients/tryclient.py b/master/buildbot/clients/tryclient.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/clients/tryclient.py
+++ b/master/buildbot/clients/tryclient.py
@@ -179,7 +179,10 @@ class MercurialExtractor(SourceStampExtractor):
vcexe = "hg"
def getBaseRevision(self):
- d = self.dovc(["parents", "--template", "{node}\\n"])
+ upstream = ""
+ if self.repository:
+ upstream = "r'%s'" % self.repository
+ d = self.dovc(["log", "--template", "{node}\\n", "-r", "limit(parents(outgoing(%s) and branch(parents())) or parents(), 1)" % upstream])
d.addCallback(self.parseStatus)
return d
@@ -188,7 +191,7 @@ class MercurialExtractor(SourceStampExtractor):
self.baserev = m.group(0)
def getPatch(self, res):
- d = self.dovc(["diff"])
+ d = self.dovc(["diff", "-r", self.baserev])
d.addCallback(self.readPatch, self.patchlevel)
return d | try: For mercurial, create a patch containing all outgoing changesets on the current branch. (fixes #<I>, #<I>) | buildbot_buildbot | train | py |
a5841f81a525dcd2f25da76c127b6b28ce33fdf2 | diff --git a/sift.js b/sift.js
index <HASH>..<HASH> 100755
--- a/sift.js
+++ b/sift.js
@@ -268,7 +268,7 @@
*/
$all: function(a, b) {
-
+ b = b || (b = [])
for(var i = a.length; i--;) {
var a1 = a[i];
var indexInB = ~b.indexOf(a1); | Handle null case in where the data's field may not be set | crcn_sift.js | train | js |
7bf39fc7c5219d4dc8e87c5082c84cf8b8a7ed3b | diff --git a/Tone/type/Frequency.js b/Tone/type/Frequency.js
index <HASH>..<HASH> 100644
--- a/Tone/type/Frequency.js
+++ b/Tone/type/Frequency.js
@@ -131,7 +131,7 @@ define(["Tone/core/Tone", "Tone/type/TimeBase"], function (Tone) {
*/
Tone.Frequency.prototype.toNote = function(){
var freq = this.toFrequency();
- var log = Math.log(freq / Tone.Frequency.A4) / Math.LN2;
+ var log = Math.log2(freq / Tone.Frequency.A4);
var noteNumber = Math.round(12 * log) + 57;
var octave = Math.floor(noteNumber/12);
if(octave < 0){
@@ -279,7 +279,7 @@ define(["Tone/core/Tone", "Tone/type/TimeBase"], function (Tone) {
* Tone.Frequency.ftom(440); // returns 69
*/
Tone.Frequency.ftom = function(frequency){
- return 69 + Math.round(12 * Math.log(frequency / Tone.Frequency.A4) / Math.LN2);
+ return 69 + Math.round(12 * Math.log2(frequency / Tone.Frequency.A4));
};
return Tone.Frequency; | using Math.log2 instead of dividing by Math.LN2 | Tonejs_Tone.js | train | js |
8fcaf508cf6b05ec8c6ef64bd3370901941a6d44 | diff --git a/nose/test_diskdf.py b/nose/test_diskdf.py
index <HASH>..<HASH> 100644
--- a/nose/test_diskdf.py
+++ b/nose/test_diskdf.py
@@ -1291,6 +1291,18 @@ def test_dehnendf_flat_DFcorrection_sigmaR2():
assert diff_corr2 < diff_corr, 'sigmaR2 w/ corrected dehnenDF w/ 2 iterations is does not agree better with target than with 1 iteration'
return None
+def test_dehnendf_flat_DFcorrection_reload():
+ #Test that the corrections aren't re-calculated if they were saved
+ import time
+ start= time.time()
+ reddf= dehnendf(beta=0.,profileParams=(1./4.,1.,0.2),
+ correct=True,
+ niter=1,
+ npoints=21,
+ savedir='.')
+ assert time.time()-start < 1., 'Setup w/ correct=True, but already computed corrections takes too long'
+ return None
+
def stest_dehnendf_flat_DFcorrection_cleanup():
#This should run quickly
dfc= dehnendf(beta=0.,profileParams=(1./4.,1.,0.2), | test that once the corrections are calculated, setting up the corrections again is quick | jobovy_galpy | train | py |
9b0fc3004d5abdc3cc54b0bea80f779e23660289 | diff --git a/src/Model/Activity.php b/src/Model/Activity.php
index <HASH>..<HASH> 100644
--- a/src/Model/Activity.php
+++ b/src/Model/Activity.php
@@ -104,9 +104,19 @@ class Activity extends Resource
/**
* Restore the backup associated with this activity.
*
+ * @param string|null $target The name of the target environment to
+ * which the backup should be restored (this
+ * could be the name of an existing
+ * environment, or a new environment). Leave
+ * this null to restore to the backup's
+ * original environment.
+ * @param string|null $branchFrom If a new environment will be created
+ * (depending on $target), this specifies
+ * the name of the parent branch.
+ *
* @return Activity
*/
- public function restore()
+ public function restore($target = null, $branchFrom = null)
{
if ($this->getProperty('type') !== 'environment.backup') {
throw new \BadMethodCallException('Cannot restore activity (wrong type)');
@@ -115,7 +125,15 @@ class Activity extends Resource
throw new \BadMethodCallException('Cannot restore backup (not complete)');
}
- return $this->runLongOperation('restore');
+ $options = [];
+ if ($target !== null) {
+ $options['environment_name'] = $target;
+ }
+ if ($branchFrom !== null) {
+ $options['branch_from'] = $branchFrom;
+ }
+
+ return $this->runLongOperation('restore', 'post', $options);
}
/** | Allow restoring to another target environment (#<I>)
* Allow restoring to another target environment
* Add $branchFrom option | platformsh_platformsh-client-php | train | php |
dfe531a481e2e753e755f8877bc747147deb7840 | diff --git a/parsl/channels/oauth_ssh/oauth_ssh.py b/parsl/channels/oauth_ssh/oauth_ssh.py
index <HASH>..<HASH> 100644
--- a/parsl/channels/oauth_ssh/oauth_ssh.py
+++ b/parsl/channels/oauth_ssh/oauth_ssh.py
@@ -44,7 +44,7 @@ class OAuthSSHChannel(SSHChannel):
self.hostname = hostname
self.username = username
self.script_dir = script_dir
-
+ self.port = port
self.envs = {}
if envs is not None:
self.envs = envs | Set optional port as proper Channel attribute. (#<I>) | Parsl_parsl | train | py |
fd68a0ca2e65e22bcfcfe886676693e7a339e1e1 | diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index <HASH>..<HASH> 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -525,10 +525,12 @@ class Plugin(object):
"""Execute a command and save the output to a file for inclusion in the
report.
"""
+ start = time()
# pylint: disable-msg = W0612
result = self.get_command_output(exe, timeout=timeout, runat=runat)
if (result['status'] == 127):
return None
+ self.log_debug("collected output of '%s' in %s" % (exe.split()[0], time() - start))
if suggest_filename:
outfn = self.make_command_filename(suggest_filename) | Record duration of calls to external programs at debug level
The old profiling report was removed in favour of using external
profilers like cProfile. This is useful for overall profiling and
identifying code hotspots but is less helpful for drilling down
to the collection of individual items.
Since running programs is the dominant cost on typical hosts log
the time taken to run each call and tag it with the binary name.
This allows looking at the per-call and per-command cost across a
run of sosreport. | sosreport_sos | train | py |
9e920d6dfb0ef1fd270619db8c15266efd5f5a4d | diff --git a/src/main/java/com/github/maven_nar/NarLogger.java b/src/main/java/com/github/maven_nar/NarLogger.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/github/maven_nar/NarLogger.java
+++ b/src/main/java/com/github/maven_nar/NarLogger.java
@@ -88,25 +88,14 @@ public class NarLogger
break;
case Project.MSG_INFO:
log.info( msg );
- /** This looks completely wrong/counterintuitive
- * It also prevents the commandLogLevel feature to have any effect...
- if ( ( msg.indexOf( "files were compiled" ) >= 0 ) || ( msg.indexOf( "Linking..." ) >= 0 ) )
- {
- log.info( msg );
- }
- else if ( msg.indexOf( "error" ) >= 0 )
+ if ( msg.indexOf( "error" ) >= 0 )
{
log.error( msg );
}
- else if ( msg.indexOf( "warning" ) >= 0 )
- {
- log.warn( msg );
- }
- else
- {
- log.debug( msg );
+ else
+ {
+ log.info( msg );
}
- */
break;
case Project.MSG_VERBOSE:
log.debug( msg ); | Show messages properly again
Oops. I wanted to clean that up before merging. | maven-nar_nar-maven-plugin | train | java |
936c2870ad2eaf1befabbd829c4d51d3437f5d5a | diff --git a/pdfconduit/__init__.py b/pdfconduit/__init__.py
index <HASH>..<HASH> 100644
--- a/pdfconduit/__init__.py
+++ b/pdfconduit/__init__.py
@@ -1,5 +1,5 @@
__all__ = ["upscale", "rotate", "Encrypt", "Merge", "Watermark", "Label", "WatermarkAdd", "slicer",
- "GUI"]
+ "GUI", "Info"]
__version__ = '1.1.4'
__author__ = 'Stephen Neal' | Added Info class to __all__ | mrstephenneal_pdfconduit | train | py |
bc6cbe1384e171409a4f8ae738c95dbca2face03 | diff --git a/app/controllers/comfy/cms/content_controller.rb b/app/controllers/comfy/cms/content_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/comfy/cms/content_controller.rb
+++ b/app/controllers/comfy/cms/content_controller.rb
@@ -15,7 +15,7 @@ class Comfy::Cms::ContentController < Comfy::Cms::BaseController
redirect_to @cms_page.target_page.url
else
respond_to do |format|
- format.json { render json: @cms_page }
+ format.json { render json: @cms_page } unless ComfortableMexicanSofa.config.allow_irb
format.all { render_page }
end
end | json api makes no sense if erb is allowed and not rendered | comfy_comfortable-mexican-sofa | train | rb |
3701c60c25770bef4ef46bc72a8373bbdd15cb92 | diff --git a/lib/sidekiq_unique_jobs/version.rb b/lib/sidekiq_unique_jobs/version.rb
index <HASH>..<HASH> 100644
--- a/lib/sidekiq_unique_jobs/version.rb
+++ b/lib/sidekiq_unique_jobs/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module SidekiqUniqueJobs
- VERSION = '6.0.0.beta1'
+ VERSION = '6.0.0.beta2'
end | Bump to <I>.beta2 | mhenrixon_sidekiq-unique-jobs | train | rb |
0f115e0cbcbc9d5022ecec35a77a1f98ef10552b | diff --git a/DependencyInjection/Compiler/QPushCompilerPass.php b/DependencyInjection/Compiler/QPushCompilerPass.php
index <HASH>..<HASH> 100644
--- a/DependencyInjection/Compiler/QPushCompilerPass.php
+++ b/DependencyInjection/Compiler/QPushCompilerPass.php
@@ -6,7 +6,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
-use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
use InvalidArgumentException;
/**
@@ -89,13 +88,6 @@ class QPushCompilerPass implements CompilerPassInterface
$definition->addMethodCall('addSubscriberService', array($id, $class));
}
- $compilerPass = new RegisterListenersPass(
- 'event_dispatcher',
- 'uecode_qpush.listener.' . $listener,
- 'uecode_qpush.subscriber.' . $listener
- );
-
- $container->addCompilerPass($compilerPass);
}
} | removing poor attempt of adding a compiler pass | uecode_qpush-bundle | train | php |
f461e90596d3c04d8d7e8b362fbdebfb2ba92309 | diff --git a/molgenis-data/src/main/java/org/molgenis/data/meta/AttributeMetaDataRepositoryDecorator.java b/molgenis-data/src/main/java/org/molgenis/data/meta/AttributeMetaDataRepositoryDecorator.java
index <HASH>..<HASH> 100644
--- a/molgenis-data/src/main/java/org/molgenis/data/meta/AttributeMetaDataRepositoryDecorator.java
+++ b/molgenis-data/src/main/java/org/molgenis/data/meta/AttributeMetaDataRepositoryDecorator.java
@@ -299,25 +299,20 @@ public class AttributeMetaDataRepositoryDecorator implements Repository<Attribut
@Override
public void deleteById(Object id)
{
- validateDeleteAllowed(findOneById(id));
- decoratedRepo.deleteById(id);
+ AttributeMetaData attr = findOneById(id);
+ delete(attr);
}
@Override
public void deleteAll(Stream<Object> ids)
{
- decoratedRepo.deleteAll(ids.filter(id ->
- {
- validateDeleteAllowed(findOneById(id));
- return true;
- }));
+ delete(findAll(ids));
}
@Override
public void deleteAll()
{
- iterator().forEachRemaining(this::validateDeleteAllowed);
- decoratedRepo.deleteAll();
+ delete(this.query().findAll());
}
@Override | Fix deleting attributes that are mapped by another attribute for deleteById, deleteAll(Stream), deleteAll | molgenis_molgenis | train | java |
06615e67e65278eb7a12529eb1cd2d77acfadc16 | diff --git a/gwpy/tests/test_spectrogram.py b/gwpy/tests/test_spectrogram.py
index <HASH>..<HASH> 100644
--- a/gwpy/tests/test_spectrogram.py
+++ b/gwpy/tests/test_spectrogram.py
@@ -155,13 +155,17 @@ class TestSpectrogram(TestArray2D):
def test_plot(self, array, imshow):
with rc_context(rc={'text.usetex': False}):
plot = array.plot(imshow=imshow)
+ ax = plot.gca()
assert isinstance(plot, TimeSeriesPlot)
- assert isinstance(plot.gca(), TimeSeriesAxes)
- assert plot.gca().lines == []
+ assert isinstance(ax, TimeSeriesAxes)
+ assert ax.lines == []
if imshow:
- assert len(plot.gca().images) == 1
+ assert len(ax.images) == 1
else:
- assert len(plot.gca().collections) == 1
+ assert len(ax.collections) == 1
+ assert ax.get_epoch() == array.x0.value
+ assert ax.get_xlim() == array.xspan
+ assert ax.get_ylim() == array.yspan
with tempfile.NamedTemporaryFile(suffix='.png') as f:
plot.save(f.name)
plot.close() | tests: improved test of Spectrogram.plot | gwpy_gwpy | train | py |
1d827128e59e9f5615829854bd671a4f83b51708 | diff --git a/raiden/api/python.py b/raiden/api/python.py
index <HASH>..<HASH> 100644
--- a/raiden/api/python.py
+++ b/raiden/api/python.py
@@ -72,7 +72,7 @@ def event_filter_for_payments(
)
)
received_and_initiator_matches = (
- isinstance(event, (EventPaymentSentFailed, EventPaymentReceivedSuccess)) and
+ isinstance(event, EventPaymentReceivedSuccess) and
(
partner_address is None or
event.initiator == partner_address | EventPaymentSentFailed has no initiator
This fixes event_filter_for_payments() for #<I> | raiden-network_raiden | train | py |
71c78ca79d45e6c280854caf1d0583cf9fc57a46 | diff --git a/telemetry/telemetry/page/actions/scroll.py b/telemetry/telemetry/page/actions/scroll.py
index <HASH>..<HASH> 100644
--- a/telemetry/telemetry/page/actions/scroll.py
+++ b/telemetry/telemetry/page/actions/scroll.py
@@ -46,6 +46,9 @@ class ScrollAction(page_action.PageAction):
def CanBeBound(self):
return True
+ def CustomizeBrowserOptions(self, options):
+ options.extra_browser_args.append('--enable-gpu-benchmarking')
+
def BindMeasurementJavaScript(self, tab, start_js, stop_js):
# Make the scroll action start and stop measurement automatically.
tab.ExecuteJavaScript(""" | Telemetry: CustomizeBrowserOptions for scroll.py action.
The scroll action needs to set --enable-gpu-benchmarking
so that record_wpr.py can record correctly
(otherwise, scroll.js uses rAF instead of smoothScrollBy).
BUG=<I>
Review URL: <URL> | catapult-project_catapult | train | py |
800b88ebab9c879dcbc72c0bfb0929caa8792842 | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -2,7 +2,7 @@
* grunt-contrib-clean
* http://gruntjs.com/
*
- * Copyright (c) 2013 Tim Branyen, contributors
+ * Copyright (c) 2014 Tim Branyen, contributors
* Licensed under the MIT license.
*/
diff --git a/LICENSE-MIT b/LICENSE-MIT
index <HASH>..<HASH> 100644
--- a/LICENSE-MIT
+++ b/LICENSE-MIT
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Tim Branyen, contributors
+Copyright (c) 2014 Tim Branyen, contributors
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
diff --git a/tasks/clean.js b/tasks/clean.js
index <HASH>..<HASH> 100644
--- a/tasks/clean.js
+++ b/tasks/clean.js
@@ -2,7 +2,7 @@
* grunt-contrib-clean
* http://gruntjs.com/
*
- * Copyright (c) 2013 Tim Branyen, contributors
+ * Copyright (c) 2014 Tim Branyen, contributors
* Licensed under the MIT license.
*/ | Update copyright to <I> | gruntjs_grunt-contrib-clean | train | js,LICENSE-MIT,js |
0a02c18ab2c832649041863f87f317b147121af2 | diff --git a/src/test/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargeMMFF94DescriptorTest.java b/src/test/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargeMMFF94DescriptorTest.java
index <HASH>..<HASH> 100644
--- a/src/test/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargeMMFF94DescriptorTest.java
+++ b/src/test/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargeMMFF94DescriptorTest.java
@@ -185,7 +185,7 @@ public class PartialTChargeMMFF94DescriptorTest extends AtomicDescriptorTest {
*/
@Test
public void testPartialTotalChargeDescriptor_Benzene() throws ClassNotFoundException, CDKException, java.lang.Exception {
- double [] testResult={-0.15,0.15,-0.15,0.15,-0.15,0.15,-0.15,0.15,-0.15, 0.15,-0.15, 0.15};/* from Merck Molecular Force Field. II. Thomas A. Halgren*/
+ double [] testResult={-0.15,-0.15,-0.15,-0.15,-0.15,-0.15,0.15,0.15,0.15,0.15,0.15,0.15};/* from Merck Molecular Force Field. II. Thomas A. Halgren*/
IAtomicDescriptor descriptor = new PartialTChargeMMFF94Descriptor();
// IMolecule mol = sp.parseSmiles("c1ccccc1"); | Fixed test: first six atoms are all carbons, and then all hydrogens come. That's how the test molecule is constructed, and reorded expected values accordingly
git-svn-id: <URL> | cdk_cdk | train | java |
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.