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
de22312f55629d0b5d735341a3d695553f2fff00
diff --git a/pow/pow.js b/pow/pow.js index <HASH>..<HASH> 100644 --- a/pow/pow.js +++ b/pow/pow.js @@ -872,7 +872,7 @@ function calculateBitsValueByCycleIndex( oConn, uCycleIndex, pfnCallback ) { return pfnCallback( `call calculateBitsValueByCycleIndex with invalid oConn` ); } - if ( 'number' !== typeof uCycleIndex || uCycleIndex <= 1 ) + if ( 'number' !== typeof uCycleIndex || uCycleIndex < 1 ) { return pfnCallback( `call calculateBitsValueByCycleIndex with invalid uCycleIndex` ); }
Updated pow.js for fixing a issue : allow call method .calculateBitsValueByCycleIndex by passing parameter uCycleIndex with value 1
trustnote_trustnote-pow-common
train
js
0e9349ac1e12245932609af0efc31c8c8a4aa11d
diff --git a/src/semantic_tree/semantic_tree.js b/src/semantic_tree/semantic_tree.js index <HASH>..<HASH> 100644 --- a/src/semantic_tree/semantic_tree.js +++ b/src/semantic_tree/semantic_tree.js @@ -2171,6 +2171,7 @@ sre.SemanticTree.prototype.tableToMatrixOrVector_ = function(node) { sre.SemanticTree.assignRoleToRow_( row, sre.SemanticTree.getComponentRoles_(matrix)); } + matrix.parent = null; return matrix; };
Initial fix for issue #<I>.
zorkow_speech-rule-engine
train
js
1977ab5bd97feb114dedd1619c89413f109f0480
diff --git a/tests/validate_test.py b/tests/validate_test.py index <HASH>..<HASH> 100644 --- a/tests/validate_test.py +++ b/tests/validate_test.py @@ -13,18 +13,18 @@ def test_validate_boxed_type(): def test_validate_record_type(fx_point, fx_record_type, fx_offset): assert validate_record_type(fx_point) with raises(TypeError): - assert validate_record_type(fx_record_type(left=fx_offset, top=1)) + validate_record_type(fx_record_type(left=fx_offset, top=1)) with raises(TypeError): - assert validate_record_type(fx_record_type(left=1, top=fx_offset)) + validate_record_type(fx_record_type(left=1, top=fx_offset)) def test_validate_union_type(fx_rectangle, fx_rectangle_type, fx_point): assert validate_union_type(fx_rectangle) with raises(TypeError): - assert validate_union_type(fx_rectangle_type(1, fx_point)) + validate_union_type(fx_rectangle_type(1, fx_point)) with raises(TypeError): - assert validate_union_type(fx_rectangle_type(fx_point, 1)) + validate_union_type(fx_rectangle_type(fx_point, 1)) with raises(TypeError): - assert validate_union_type(fx_rectangle_type(1, 1)) + validate_union_type(fx_rectangle_type(1, 1))
Remove assert in error-rasing test
nirum-lang_nirum-python
train
py
716becfb4059b532a2f26f218ff506c54da2aaca
diff --git a/salt/modules/rh_network.py b/salt/modules/rh_network.py index <HASH>..<HASH> 100644 --- a/salt/modules/rh_network.py +++ b/salt/modules/rh_network.py @@ -98,10 +98,11 @@ def _parse_ethtool_opts(opts, iface): else: _raise_error(iface, option, valid) - result = '' + result = [] for key in config: - result += '%s %s ' % (key, config[key]) - return result + result.append(key) + result.append(str(config[key])) + return ' '.join(result) def _parse_settings_bond(opts, iface): '''
Return the ethtool opts in a way I like better
saltstack_salt
train
py
60ee63316dda89fdce4830b588abeea6ecbefaa2
diff --git a/lib/analyzeOneSite.js b/lib/analyzeOneSite.js index <HASH>..<HASH> 100644 --- a/lib/analyzeOneSite.js +++ b/lib/analyzeOneSite.js @@ -186,13 +186,6 @@ AnalyzeOneSite.prototype._createOutput = function(callBack) { async.parallel(work, function(err, results) { - // TODO this can be cleaner - // We clear the number of pages tested and - // the collected data, so it is ready for next run - // used when testing multiple sites - self.htmlRenderer.numberOfAnalyzedPages = 0; - self.collector.clear(); - if (!err) { log.log('info', 'Wrote results to ' + self.config.run.absResultDir); }
removed unused code #<I>
sitespeedio_sitespeed.io
train
js
1c2915a367b997c38be9249020dad34f595ee41e
diff --git a/src/scheduled-task.js b/src/scheduled-task.js index <HASH>..<HASH> 100644 --- a/src/scheduled-task.js +++ b/src/scheduled-task.js @@ -9,9 +9,9 @@ module.exports = (function() { * @param {boolean} immediateStart - whether to start the task immediately. */ function ScheduledTask(task, immediateStart) { - this.task = () => { + this.task = function () { var date = new Date() - this.tick = setTimeout(this.task, 1000 - date.getMilliseconds()); + this.tick = setTimeout(this.task.bind(this), 1000 - date.getMilliseconds()); task.update(date); }; @@ -29,7 +29,7 @@ module.exports = (function() { */ ScheduledTask.prototype.start = function() { if (this.task && !this.tick) { - this.tick = setTimeout(this.task, 1000); + this.tick = setTimeout(this.task.bind(this), 1000); } return this;
improving interval update (ES5 version)
node-cron_node-cron
train
js
0269f9d42296f4c7be56fd7adcee9e3d068e5cbd
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -70,7 +70,7 @@ class AboutCommand extends ContainerAwareCommand new TableSeparator(), array('Version', PHP_VERSION), array('Architecture', (PHP_INT_SIZE * 8).' bits'), - array('Intl locale', \Locale::getDefault() ?: 'n/a'), + array('Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'), array('Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'), array('OPcache', extension_loaded('Zend OPcache') && ini_get('opcache.enable') ? 'true' : 'false'), array('APCu', extension_loaded('apcu') && ini_get('apc.enabled') ? 'true' : 'false'),
[FrameworkBundle] Fix "Locale class not found" in AboutCommand
symfony_symfony
train
php
a345a707ca2c8280e92ec4eece1346b5340d1d74
diff --git a/commons/docker/ttl.go b/commons/docker/ttl.go index <HASH>..<HASH> 100644 --- a/commons/docker/ttl.go +++ b/commons/docker/ttl.go @@ -49,6 +49,8 @@ func (ttl DockerTTL) Purge(age time.Duration) (time.Duration, error) { return 0, err } } else if timeToLive < age { + // set the new time to live based on the age of the oldest + // non-expired snapshot. age = timeToLive } }
elaborate on age refresh for non-expired snapshots
control-center_serviced
train
go
54d5c94f68f6093ea7a6979043006fa9e34fa0cb
diff --git a/resources/lang/pt-PT/pagination.php b/resources/lang/pt-PT/pagination.php index <HASH>..<HASH> 100644 --- a/resources/lang/pt-PT/pagination.php +++ b/resources/lang/pt-PT/pagination.php @@ -25,4 +25,4 @@ return [ 'previous' => '&laquo; Anterior', 'next' => 'Próximo &raquo;', -]; +]; \ No newline at end of file
New translations pagination.php (Portuguese)
CachetHQ_Cachet
train
php
74bdc582e3ad4896e763d45ef5abb6ba24068b21
diff --git a/Model/Import/Category.php b/Model/Import/Category.php index <HASH>..<HASH> 100644 --- a/Model/Import/Category.php +++ b/Model/Import/Category.php @@ -480,7 +480,7 @@ class Category extends \Magento\ImportExport\Model\Import\AbstractEntity */ protected function getCollection() { - return $this->categoryCollection->addNameToResult(); + return $this->categoryCollection->setStoreId(0)->addNameToResult(); } /**
[CATEGORY] Added fix for #<I>
firegento_FireGento_FastSimpleImport2
train
php
0942eb7b1e51103e94ee5c2b751f1270fca55e4d
diff --git a/app/models/foreman_tasks/lock.rb b/app/models/foreman_tasks/lock.rb index <HASH>..<HASH> 100644 --- a/app/models/foreman_tasks/lock.rb +++ b/app/models/foreman_tasks/lock.rb @@ -129,7 +129,9 @@ module ForemanTasks def build_locks(resource, lock_names, uuid = nil) locks = [] - lock_names = all_lock_names(resource) if lock_names.empty? + if lock_names.empty? || lock_names == [:all] + lock_names = all_lock_names(resource) + end lock_names.map do |lock_name| locks << build(uuid, resource, lock_name, true) end diff --git a/lib/foreman_tasks/action_helpers/lock.rb b/lib/foreman_tasks/action_helpers/lock.rb index <HASH>..<HASH> 100644 --- a/lib/foreman_tasks/action_helpers/lock.rb +++ b/lib/foreman_tasks/action_helpers/lock.rb @@ -30,7 +30,7 @@ module ForemanTasks # @see Lock.lock! def lock!(resource, *lock_names) - ::ForemanTasks::Lock.lock!(resource, task.id, *lock_names) + ::ForemanTasks::Lock.lock!(resource, task.id, *lock_names.flatten) end # @see Lock.link!
Properly support :all lock
theforeman_foreman-tasks
train
rb,rb
a935cf4cdf9b47b60783d1f1831eee487f80ed03
diff --git a/mod/quiz/category.php b/mod/quiz/category.php index <HASH>..<HASH> 100644 --- a/mod/quiz/category.php +++ b/mod/quiz/category.php @@ -456,7 +456,7 @@ class quiz_category_object { echo '<p><form action="category.php" method="post">'; echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />"; echo '<input type="hidden" name="id" value="'. $this->course->id . '" />'; - echo '<input type="hidden" name="updateid" value=' . $category->id . '" />'; + echo '<input type="hidden" name="updateid" value="' . $category->id . '" />'; print_table($edittable); echo '</form></p>'; }
Fixed a typo in quiz_category_object->output_edit_single_table() Merged from MOODLE_<I>_STABLE
moodle_moodle
train
php
97ef2ae6e7944a530f8ffbc73fc8f1b9d3b280c7
diff --git a/lib/jss-api/api_object/package.rb b/lib/jss-api/api_object/package.rb index <HASH>..<HASH> 100644 --- a/lib/jss-api/api_object/package.rb +++ b/lib/jss-api/api_object/package.rb @@ -102,7 +102,10 @@ module JSS ### When we shouldn't install anything (e.g. switch w/package) DO_NOT_INSTALL = "Do Not Install" - + + ### The table in the database for this object + DB_TABLE = "packages" + ##################################### ### Class Variables #####################################
JSS::Package: added DB_TABLE constant
PixarAnimationStudios_ruby-jss
train
rb
625318f52516b413126be1bb1cb6818231d2eca6
diff --git a/src/transformers/pipelines.py b/src/transformers/pipelines.py index <HASH>..<HASH> 100755 --- a/src/transformers/pipelines.py +++ b/src/transformers/pipelines.py @@ -1226,7 +1226,7 @@ class FillMaskPipeline(Pipeline): values = tf.gather_nd(values, tf.reshape(sort_inds, (-1, 1))).numpy() predictions = target_inds[sort_inds.numpy()] else: - masked_index = (input_ids == self.tokenizer.mask_token_id).nonzero() + masked_index = torch.nonzero(input_ids == self.tokenizer.mask_token_id, as_tuple=False) # Fill mask pipeline supports only one ${mask_token} per sample self.ensure_exactly_one_mask_token(masked_index.numpy())
tensor.nonzero() is deprecated in PyTorch <I> (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
817ebc56eb78d676f614d71115f05102d955049d
diff --git a/controller/TestCenterManager.php b/controller/TestCenterManager.php index <HASH>..<HASH> 100644 --- a/controller/TestCenterManager.php +++ b/controller/TestCenterManager.php @@ -132,6 +132,7 @@ class TestCenterManager extends \tao_actions_SaSModule return array( 'data' => $data, + 'amount' => count($data), 'page' => 1, 'total' => 1 );
returns the total amount of eligibilities
oat-sa_extension-tao-proctoring
train
php
d3455b74e2b986ac0737e038de70a27e8cd71d70
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,14 @@ import codecs -import os -import sys +import sys from setuptools import find_packages, setup from setuptools.command.test import test as TestCommand -def rc_value(): +def version(): with open('version') as fp: val = fp.read().rstrip() - return '{}rc0'.format(val) - - -def version(): - return os.getenv('TRAVIS_TAG', rc_value()) + return val class PyTest(TestCommand):
Fix new releases versions as we are not using Travis anymore
voxpupuli_pypuppetdb
train
py
601f794ccf5f4f635c2088fdcbb374ef3a3ff99e
diff --git a/flask_restful_swagger/swagger.py b/flask_restful_swagger/swagger.py index <HASH>..<HASH> 100644 --- a/flask_restful_swagger/swagger.py +++ b/flask_restful_swagger/swagger.py @@ -198,8 +198,8 @@ class StaticFiles(Resource): if dir3 is not None: filePath = "%s/%s" % (filePath, dir3) if filePath in [ - "index.html", "o2c.html", "swagger-ui.js" - "swagger-ui.min", "lib/swagger-oauth.js"]: + "index.html", "o2c.html", "swagger-ui.js", + "swagger-ui.min.js", "lib/swagger-oauth.js"]: conf = {'resource_list_url': req_registry['spec_endpoint_path']} return render_page(filePath, conf) mime = 'text/plain'
fix typos in list of files returned by render_page This fixes the <I> on throbber.gif
rantav_flask-restful-swagger
train
py
71db3b43f304a94a9c2aeb5a92b8a4f2e60671fc
diff --git a/bosh_aws_bootstrap/lib/bosh_aws_bootstrap/microbosh_manifest.rb b/bosh_aws_bootstrap/lib/bosh_aws_bootstrap/microbosh_manifest.rb index <HASH>..<HASH> 100644 --- a/bosh_aws_bootstrap/lib/bosh_aws_bootstrap/microbosh_manifest.rb +++ b/bosh_aws_bootstrap/lib/bosh_aws_bootstrap/microbosh_manifest.rb @@ -56,7 +56,7 @@ module Bosh vpc_config['compiled_package_cache']['access_key_id'] || warning('Missing compiled_package_cache access_key_id field') end - def cache_cache_secret_access_key + def cache_secret_access_key vpc_config['compiled_package_cache']['secret_access_key'] || warning('Missing compiled_package_cache secret_access_key field') end
fixed typo in microbosh manifest generator
cloudfoundry_bosh
train
rb
5ca5768db439887217c86031ff7dd3bdf56cc466
diff --git a/src/Illuminate/Database/Eloquent/BroadcastsEvents.php b/src/Illuminate/Database/Eloquent/BroadcastsEvents.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Database/Eloquent/BroadcastsEvents.php +++ b/src/Illuminate/Database/Eloquent/BroadcastsEvents.php @@ -124,7 +124,7 @@ trait BroadcastsEvents */ public function newBroadcastableModelEvent($event) { - return tap(new BroadcastableModelEventOccurred($this, $event), function ($event) { + return tap($this->withBroadcastableEvent(new BroadcastableModelEventOccurred($this, $event)), function ($event) { $event->connection = property_exists($this, 'broadcastConnection') ? $this->broadcastConnection : $this->broadcastConnection(); @@ -140,6 +140,17 @@ trait BroadcastsEvents } /** + * Configure the broadcastable model event for the model. + * + * @param \Illuminate\Database\Eloquent\BroadcastableModelEventOccurred $event + * @return \Illuminate\Database\Eloquent\BroadcastableModelEventOccurred + */ + protected function withBroadcastableEvent(BroadcastableModelEventOccurred $event) + { + return $event; + } + + /** * Get the channels that model events should broadcast on. * * @param string $event
add hook to configure broadcastable model event
laravel_framework
train
php
6852c84e823db5b5a94b4d02ef6c10bce2e4dfa2
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -73,12 +73,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.3.0-BETA1'; + const VERSION = '4.3.0-DEV'; const VERSION_ID = 40300; const MAJOR_VERSION = 4; const MINOR_VERSION = 3; const RELEASE_VERSION = 0; - const EXTRA_VERSION = 'BETA1'; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '01/2020'; const END_OF_LIFE = '07/2020';
bumped Symfony version to <I>
symfony_symfony
train
php
4ca86aa82de647f9d6656933f4b97cae795b3543
diff --git a/test/db/derby/simple_test.rb b/test/db/derby/simple_test.rb index <HASH>..<HASH> 100644 --- a/test/db/derby/simple_test.rb +++ b/test/db/derby/simple_test.rb @@ -79,8 +79,9 @@ class DerbySimpleTest < Test::Unit::TestCase db.sample_text = value db.save! db.reload - assert_equal value.to_s, db.sample_string - assert_equal value.to_s, db.sample_text + expected_value = ArJdbc::AR42 ? value.to_s[0] : value.to_s + assert_equal expected_value, db.sample_string + assert_equal expected_value, db.sample_text end value = Date.today
ActiveRecord <I> stores bolean values in a string column as 't' and 'f'
jruby_activerecord-jdbc-adapter
train
rb
9a81d402b7ade2b27cbef09ba02cba05c88df356
diff --git a/api/agent.go b/api/agent.go index <HASH>..<HASH> 100644 --- a/api/agent.go +++ b/api/agent.go @@ -73,6 +73,7 @@ type AgentServiceCheck struct { HTTP string `json:",omitempty"` TCP string `json:",omitempty"` Status string `json:",omitempty"` + Notes string `json:",omitempty"` TLSSkipVerify string `json:",omitempty"` // In Consul 0.7 and later, checks that are associated with a service
Adds notes field to API. Closes #<I>.
hashicorp_consul
train
go
e7a19ace9778b092c923e7ec7507868a67df3994
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 @@ -811,7 +811,7 @@ class Response implements ResponseInterface * * @param string|callable|null $content the string or callable message to be sent * @return string|null Current message buffer if $content param is passed as null - * @deprecated 3.4.0 Mutable response methods are deprecated. Use `withBody()` and `getBody()` instead. + * @deprecated 3.4.0 Mutable response methods are deprecated. Use `withBody()`/`withStringBody()` and `getBody()` instead. */ public function body($content = null) {
Update deprecated tag description.
cakephp_cakephp
train
php
c84afe985c86b2b8cfa209d3eaf37b6d45fa1763
diff --git a/pyxid/pyxid_impl.py b/pyxid/pyxid_impl.py index <HASH>..<HASH> 100644 --- a/pyxid/pyxid_impl.py +++ b/pyxid/pyxid_impl.py @@ -404,7 +404,7 @@ class XidDevice(object): rb_834_keymap) else: raise XidError('Unknown RB Device') - elif product_id == 'S': + elif product_id == b'S': fw_major = int(self._send_command('_d4', 1)) fw_minor = int(self._send_command('_d5', 1))
This small change is needed to make pyxid detect attached StimTracker devices when running Python3.
cedrus-opensource_pyxid
train
py
ef745620c03b56d3b4c5c32c4cb7b6e669188408
diff --git a/modules/junit4/src/main/java/org/powermock/modules/junit4/internal/impl/PowerMockJUnit44RunnerDelegateImpl.java b/modules/junit4/src/main/java/org/powermock/modules/junit4/internal/impl/PowerMockJUnit44RunnerDelegateImpl.java index <HASH>..<HASH> 100644 --- a/modules/junit4/src/main/java/org/powermock/modules/junit4/internal/impl/PowerMockJUnit44RunnerDelegateImpl.java +++ b/modules/junit4/src/main/java/org/powermock/modules/junit4/internal/impl/PowerMockJUnit44RunnerDelegateImpl.java @@ -72,7 +72,7 @@ public class PowerMockJUnit44RunnerDelegateImpl extends Runner implements Filter @SuppressWarnings("unchecked") protected List<Method> getTestMethods(Class<?> klass, String[] methodsToRun) { - if (methodsToRun == null) { + if (methodsToRun == null || methodsToRun.length == 0) { // The getTestMethods of TestClass is not visible so we need to look // it invoke it using reflection. try {
Fixed a bug in the PowerMock JUnit <I> and legacy runner that reported back the wrong number of tests being executed when @Ignore was used.
powermock_powermock
train
java
a4f798532def8a278cfc0f029f031ad0067b590a
diff --git a/prow/plugins/trigger/pr.go b/prow/plugins/trigger/pr.go index <HASH>..<HASH> 100644 --- a/prow/plugins/trigger/pr.go +++ b/prow/plugins/trigger/pr.go @@ -72,9 +72,9 @@ func handlePR(c client, pr github.PullRequestEvent) error { } func askToJoin(ghc githubClient, pr github.PullRequest) error { - commentTemplate := `Hi %s. Thanks for your PR. + commentTemplate := `Hi @%s. Thanks for your PR. -I'm waiting for a [%s](https://github.com/orgs/%s/people) member to verify that this patch is reasonable to test. If it is, they should reply with "@k8s-bot ok to test" on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step. +I'm waiting for a [%s](https://github.com/orgs/%s/people) member to verify that this patch is reasonable to test. If it is, they should reply with ` + "`@k8s-bot ok to test`" + ` on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step. <details>
Add @, use backticks.
kubernetes_test-infra
train
go
043b6243901aea2e7f604e1d4ce655cfe595ceb7
diff --git a/activerecord/lib/active_record/serialization.rb b/activerecord/lib/active_record/serialization.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/serialization.rb +++ b/activerecord/lib/active_record/serialization.rb @@ -31,9 +31,6 @@ module ActiveRecord #:nodoc: def serializable_add_includes(options = {}) return unless include_associations = options.delete(:include) - base_only_or_except = { :except => options[:except], - :only => options[:only] } - include_has_options = include_associations.is_a?(Hash) associations = include_has_options ? include_associations.keys : Array.wrap(include_associations) @@ -46,9 +43,8 @@ module ActiveRecord #:nodoc: end if records - association_options = include_has_options ? include_associations[association] : base_only_or_except - opts = options.merge(association_options) - yield(association, records, opts) + association_options = include_has_options ? include_associations[association] : {} + yield(association, records, association_options) end end
Don't merge base opts into includes when serializing ARs Conflicts: activerecord/lib/active_record/serialization.rb
rails_rails
train
rb
cf50b3cae88b1265790c7f0952833949ea46f491
diff --git a/src/Auth/HybridAuthAuthenticate.php b/src/Auth/HybridAuthAuthenticate.php index <HASH>..<HASH> 100644 --- a/src/Auth/HybridAuthAuthenticate.php +++ b/src/Auth/HybridAuthAuthenticate.php @@ -4,6 +4,7 @@ namespace ADmad\HybridAuth\Auth; use Cake\Auth\FormAuthenticate; use Cake\Controller\ComponentRegistry; use Cake\Core\Configure; +use Cake\Event\Event; use Cake\Network\Request; use Cake\Network\Response; use Cake\ORM\TableRegistry; @@ -234,12 +235,22 @@ class HybridAuthAuthenticate extends FormAuthenticate { /** * Logout all providers * + * @param \Cake\Event\Event $event Event. * @param array $user The user about to be logged out. * @return void */ - public function logout(array $user) { + public function logout(Event $event, array $user) { $this->_init($this->_registry->getController()->request); $this->hybridAuth->logoutAllProviders(); } +/** + * Returns a list of all events that this authenticate class will listen to. + * + * @return array List of events this class listens to. + */ + public function implementedEvents() { + return ['Auth.logout' => 'logout']; + } + }
Make logout() callback for Auth.logout event.
ADmad_CakePHP-HybridAuth
train
php
ce6dbd661c832a875dae1c381349a07c976c91cb
diff --git a/django_autoconfig/autourlconf.py b/django_autoconfig/autourlconf.py index <HASH>..<HASH> 100644 --- a/django_autoconfig/autourlconf.py +++ b/django_autoconfig/autourlconf.py @@ -7,6 +7,9 @@ from .autoconfig import configure_urls urlpatterns = configure_urls(list(settings.INSTALLED_APPS) + list(AUTOCONFIG_EXTRA_URLS)) # pylint: disable=C0103 -if settings.DEBUG and getattr(settings, 'MEDIA_URL', None) and getattr(settings, 'MEDIA_ROOT', None): - from django.conf.urls.static import static - urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +if settings.DEBUG: + media_url = getattr(settings, 'MEDIA_URL', None) + media_root = getattr(settings, 'MEDIA_ROOT', None) + if None not in (media_url, media_root): + from django.conf.urls.static import static + urlpatterns += static(media_url, document_root=media_root)
Fix for case when MEDIA_ROOT or MEDIA_URL are set to ""
mikebryant_django-autoconfig
train
py
95360b08c3a48a4ef7161030ebf4447422ab079c
diff --git a/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/rules/patterns/PatternRule.java b/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/rules/patterns/PatternRule.java index <HASH>..<HASH> 100644 --- a/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/rules/patterns/PatternRule.java +++ b/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/rules/patterns/PatternRule.java @@ -212,7 +212,7 @@ public class PatternRule extends Rule { sb.append("\""); // for now, case sensitivity is per pattern, not per element, // so just use the setting of the first element: - if (patternElements.get(0).getCaseSensitive()) { + if (patternElements.size() > 0 && patternElements.get(0).getCaseSensitive()) { sb.append(" case_sensitive=\"yes\""); } sb.append(">\n");
NPE protection (shouldn't be needed...)
languagetool-org_languagetool
train
java
90289b950f6a12076d75408be8853cf4a0818154
diff --git a/fabfile.py b/fabfile.py index <HASH>..<HASH> 100644 --- a/fabfile.py +++ b/fabfile.py @@ -9,15 +9,13 @@ from contextlib import contextmanager from fabric.api import local, lcd, abort from fabric.decorators import task -from sphinx_bootstrap_theme import __version__ - - DL_DIR = "doc/source/_static/downloads" BUILD_DIRS = ( "dist", "doc/build", "build", + "FlowCytometryTools.egg-info", ) SDIST_RST_FILES = ( diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,6 @@ else: setup( name = 'FlowCytometryTools', - #packages = ['FlowCytometryTools', 'FlowCytometryTools.tests', 'FlowCytometryTools.IO'], packages=find_packages(), version = version, description = 'A python package for performing flow cytometry analysis', @@ -42,6 +41,4 @@ setup( package_data = { '': ['*.fcs'], }, - - )
Updated fabfile and setup.py
eyurtsev_FlowCytometryTools
train
py,py
861a2ffbf8eb7b3caf1febf5562e67307929b6f2
diff --git a/src/migrate/index.js b/src/migrate/index.js index <HASH>..<HASH> 100644 --- a/src/migrate/index.js +++ b/src/migrate/index.js @@ -196,7 +196,7 @@ export default class Migrator { .then(batchNo => { return this._waterfallBatch(batchNo, migrations, direction) }) - .then(retVal => this._freeLock().then(() => retVal)) + .tap(() => this._freeLock()) .catch(error => { var cleanupReady = Promise.resolve();
Simplify promise code with '.tap'
tgriesser_knex
train
js
461551ae4b8d43ebe92748f737cd4161899b2bbc
diff --git a/src/Models/Ability.php b/src/Models/Ability.php index <HASH>..<HASH> 100644 --- a/src/Models/Ability.php +++ b/src/Models/Ability.php @@ -59,6 +59,7 @@ class Ability extends Model 'policy', 'name', 'description', + 'roles', ]; /** @@ -359,4 +360,18 @@ class Ability extends Model return 'unique:'.implode(',', $parameters); } + + /** + * Attach the ability roles. + * + * @param array $roles + * + * @return void + */ + public function setRolesAttribute(array $roles) + { + static::saved(function (self $model) use ($roles) { + $model->roles()->syncWithoutDetaching($roles); + }); + } }
Add ability roles attachment as attribute mutator
rinvex_laravel-auth
train
php
06e42c2ce8ae63fc068ea76245f732acc3fb3710
diff --git a/numina/user.py b/numina/user.py index <HASH>..<HASH> 100644 --- a/numina/user.py +++ b/numina/user.py @@ -143,7 +143,7 @@ def run_recipe_from_file(task_control, workdir=None, resultsdir=None, cleanup=Fa obsres.__dict__) try: RecipeClass = find_recipe_class(obsres.instrument, obsres.mode) - _logger.info('entry point is %s id=%i', RecipeClass, id(RecipeClass)) + _logger.info('entry point is %s', RecipeClass) except ValueError: _logger.warning('cannot find entry point for %(instrument)s and %(mode)s', obsres.__dict__) raise
Removing id in logging, not needed anymore
guaix-ucm_numina
train
py
a1c01ded9c988c082ec51bc76a33b547216e39e3
diff --git a/script/lib/config.py b/script/lib/config.py index <HASH>..<HASH> 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -15,7 +15,7 @@ PLATFORM = { LINUX_BINARIES = [ 'chrome-sandbox', - 'crashpad_handler', + 'chrome_crashpad_handler', 'electron', 'libEGL.so', 'libGLESv2.so',
fix: really strip crashpad handler binary (#<I>)
electron_electron
train
py
ec9a6cec26b64e140cb66c3d02149f8439e2aae1
diff --git a/tests/test_write_readback.py b/tests/test_write_readback.py index <HASH>..<HASH> 100644 --- a/tests/test_write_readback.py +++ b/tests/test_write_readback.py @@ -28,14 +28,11 @@ import sys import copy import os import os.path -import posixpath -import string import math import random import collections import numpy as np -import numpy.testing as npt import numpy.random import hdf5storage
Removed unused imports in test_write_readback
frejanordsiek_hdf5storage
train
py
ab62d4f9c1ddc71ded128fc63bb7ef5b1f27be80
diff --git a/src/component.js b/src/component.js index <HASH>..<HASH> 100644 --- a/src/component.js +++ b/src/component.js @@ -4,7 +4,7 @@ var componentLocal = local(), noop = function (){}; export default function (tagName, className){ - var create, + var create = noop, render = noop, destroy = noop, selector = className ? "." + className : tagName; @@ -24,12 +24,10 @@ export default function (tagName, className){ state: {}, render: noop }); - if(create){ - create(function setState(state){ - Object.assign(local.state, state); - local.render(); - }); - } + create(function setState(state){ + Object.assign(local.state, state); + local.render(); + }); }) .merge(components) .each(function (props){
Eliminate null guard on create by initializing as noop
curran_d3-component
train
js
6e9ec1aa9e975ad997e9a6fb255c846786a8a1de
diff --git a/scripts/orm/sql/adapters/postgres/connections.js b/scripts/orm/sql/adapters/postgres/connections.js index <HASH>..<HASH> 100644 --- a/scripts/orm/sql/adapters/postgres/connections.js +++ b/scripts/orm/sql/adapters/postgres/connections.js @@ -59,12 +59,10 @@ Connections.prototype._unregisterAll = function (db, host, username, password, p Connections.prototype._unregister = function (id, db, host, username, password, port) { var connString = this._connString(db, host, username, password, port); - // TODO: should this code be removed? Are we seeing "partitioners ids missing" errors in the - // server log? // Prevent against race conditions during close - // if (!this._connections[connString]) { - // return Promise.resolve(); - // } + if (!this._connections[connString]) { + return Promise.resolve(); + } delete this._connections[connString].ids[id];
fix(postgres): prevent race conditions
delta-db_deltadb-server
train
js
fd3b2ad98624b6f665ea10b816fe603ead6b57aa
diff --git a/lib/google_apps/atom/group.rb b/lib/google_apps/atom/group.rb index <HASH>..<HASH> 100644 --- a/lib/google_apps/atom/group.rb +++ b/lib/google_apps/atom/group.rb @@ -53,7 +53,6 @@ module GoogleApps def change_value(name, old_value, new_value) - binding.pry find_and_update @document, '//apps:property', { name => [old_value, new_value] } end diff --git a/lib/google_apps/atom/node.rb b/lib/google_apps/atom/node.rb index <HASH>..<HASH> 100644 --- a/lib/google_apps/atom/node.rb +++ b/lib/google_apps/atom/node.rb @@ -67,7 +67,7 @@ module GoogleApps document.find(xpath).each do |node| if node_match?(node, attributes) attributes.each_key do |attrib| - node.attributes[attrib.to_s] = attributes[attrib][1] if node.attributes[attrib.to_s].to_s == attributes[attrib][0].to_s + node.attributes[attrib.to_s] = attributes[attrib][1] end end end
Removed errant binding.pry
LeakyBucket_google_apps
train
rb,rb
dd7552f462fe1295dc5fd631bc82224f558cd7aa
diff --git a/spec/integration/manual_acknowledgement_spec.rb b/spec/integration/manual_acknowledgement_spec.rb index <HASH>..<HASH> 100644 --- a/spec/integration/manual_acknowledgement_spec.rb +++ b/spec/integration/manual_acknowledgement_spec.rb @@ -22,7 +22,7 @@ describe "Manual Message Acknowledgment", :integration => true do end let(:subscriber) { BaconSubscriber } - it "retries rejected messages and stops retrying acknowledged messages" do + it "retries rejected/nacked messages and stops retrying acknowledged messages" do ::ActionSubscriber.start_subscribers! ::ActivePublisher.publish("bacon.served", "BACON!", "events")
update name of spec for nack
mxenabled_action_subscriber
train
rb
7607004a3efab0b0213a51a84114de38d93b0543
diff --git a/Auth/OpenID/Message.php b/Auth/OpenID/Message.php index <HASH>..<HASH> 100644 --- a/Auth/OpenID/Message.php +++ b/Auth/OpenID/Message.php @@ -889,8 +889,8 @@ class Auth_OpenID_Message { { if ($aliased_key == 'ns') { // Return the namespace URI for the OpenID namespace - return $this->getOpenIDNamespace(); - } + return $this->getOpenIDNamespace(); + } $parts = explode('.', $aliased_key, 2);
[project @ Message: indentation]
openid_php-openid
train
php
8002b3e636c40cfd573fecd9deb00a9cfe9b7393
diff --git a/cherrypy/lib/cptools.py b/cherrypy/lib/cptools.py index <HASH>..<HASH> 100644 --- a/cherrypy/lib/cptools.py +++ b/cherrypy/lib/cptools.py @@ -465,7 +465,7 @@ class MonitoredHeaderMap(_httputil.HeaderMap): return _httputil.HeaderMap.has_key(self, key) -def autovary(): +def autovary(ignore=set(['Content-Disposition', 'Content-Length', 'Content-Type'])): """Auto-populate the Vary response header based on request.header access.""" req_h = cherrypy.request.headers cherrypy.request.headers = MonitoredHeaderMap() @@ -474,7 +474,8 @@ def autovary(): def set_response_header(): resp_h = cherrypy.response.headers v = set([e.value for e in resp_h.elements('Vary')]) - v |= cherrypy.request.headers.accessed_headers + v = v.union(cherrypy.request.headers.accessed_headers) + v = v.difference(ignore) v = list(v) v.sort() resp_h['Vary'] = ', '.join(v)
Fixed autovary via an ignore arg; it broke due to _cpreqbody touching some headers.
cherrypy_cheroot
train
py
ec6b61b694ac6264028327c5570f9de4a91acd18
diff --git a/spec/support/test_app.rb b/spec/support/test_app.rb index <HASH>..<HASH> 100644 --- a/spec/support/test_app.rb +++ b/spec/support/test_app.rb @@ -12,7 +12,7 @@ module TestApp def default_config <<-CONFIG set :deploy_to, '#{deploy_to}' - set :repo_url, 'git://github.com/capistrano/capistrano.git' + set :repo_url, 'https://github.com/capistrano/capistrano.git' set :branch, 'master' set :ssh_options, { keys: "\#{ENV['HOME']}/.vagrant.d/insecure_private_key", auth_methods: ['publickey'] } server 'vagrant@localhost:2220', roles: %w{web app}
Switch cucumber tests to use https instead of git:// (#<I>) On my machine, when running `rake features`, the `git clone` operation in some of the cucumber tests hangs and eventually times out. It seems to be due to the repo URL using the `git://` protocol. When I switch to `https://`, it works fine.
capistrano_capistrano
train
rb
5bf9204971fc9515db5e23dd8f41db85f2613c2d
diff --git a/lib/ruby-lint/parser.rb b/lib/ruby-lint/parser.rb index <HASH>..<HASH> 100644 --- a/lib/ruby-lint/parser.rb +++ b/lib/ruby-lint/parser.rb @@ -104,7 +104,8 @@ module RubyLint :super => :super, :yield0 => :yield, :yield => :yield, - :const_path_field => :constant_path + :const_path_field => :constant_path, + :sclass => :sclass } ## diff --git a/spec/ruby-lint/parser/classes.rb b/spec/ruby-lint/parser/classes.rb index <HASH>..<HASH> 100644 --- a/spec/ruby-lint/parser/classes.rb +++ b/spec/ruby-lint/parser/classes.rb @@ -73,4 +73,30 @@ end s(:body, []) ) end + + should 'parse class << self blocks' do + code = <<-CODE +class A + class << self + puts + end +end + CODE + + parse(code).should == s( + :class, + s(:constant, 'A'), + nil, + s( + :body, + [ + s( + :sclass, + s(:keyword, 'self'), + s(:body, [s(:method, 'puts', [], nil, nil)]) + ) + ] + ) + ) + end end
Parsing of sclass blocks. The parser is now capable of parsing blocks such as the following: class << self # ... end
YorickPeterse_ruby-lint
train
rb,rb
42de50736c2375e370f17a234546cd71c59aaf9f
diff --git a/lib/active_type/nested_attributes/association.rb b/lib/active_type/nested_attributes/association.rb index <HASH>..<HASH> 100644 --- a/lib/active_type/nested_attributes/association.rb +++ b/lib/active_type/nested_attributes/association.rb @@ -130,7 +130,7 @@ module ActiveType end def add_errors_to_parent(parent, child, index) - if ActiveRecord::VERSION::MAJOR >= 6 && ActiveRecord::VERSION::MINOR >= 1 + if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("6.1") child.errors.each do |error| attribute = translate_error_attribute(error.attribute, index) parent.errors.add(attribute, error.message)
Improve NestedAttributes::Association#add_errors_to_parent version check Intended to provide a path for ActiveRecord >= <I>, it would fail given <I> due to the individual expressions.
makandra_active_type
train
rb
e60ca5430be0181acd7fe8b2c9f929d491bfc3a2
diff --git a/core/server/common/src/main/java/alluxio/cli/Format.java b/core/server/common/src/main/java/alluxio/cli/Format.java index <HASH>..<HASH> 100644 --- a/core/server/common/src/main/java/alluxio/cli/Format.java +++ b/core/server/common/src/main/java/alluxio/cli/Format.java @@ -18,6 +18,7 @@ import alluxio.ServiceUtils; import alluxio.master.NoopMaster; import alluxio.master.journal.JournalSystem; import alluxio.master.journal.JournalUtils; +import alluxio.util.CommonUtils; import alluxio.util.io.FileUtils; import alluxio.util.io.PathUtils; @@ -81,6 +82,8 @@ public final class Format { LOG.info(USAGE); System.exit(-1); } + // Set the process type as "MASTER" since format needs to access the journal like the master. + CommonUtils.PROCESS_TYPE.set(CommonUtils.ProcessType.MASTER); Mode mode = null; try { mode = Mode.valueOf(args[0].toUpperCase());
[ALLUXIO-<I>] Format should be like a master process (#<I>)
Alluxio_alluxio
train
java
feb86c9b249c1534ad28cfd60392ecada722661e
diff --git a/bl/xbuilder.py b/bl/xbuilder.py index <HASH>..<HASH> 100644 --- a/bl/xbuilder.py +++ b/bl/xbuilder.py @@ -20,10 +20,17 @@ class XBuilder(Dict): def __init__(self, default=None, nsmap=None, **namespaces): Dict.__init__(self) for k in namespaces: # each namespace gets its own method, named k (for each k) - self[k] = ElementMaker(namespace=namespaces[k], nsmap=nsmap or {k:namespaces[k]}) + kdefault = default or namespaces[k] + if nsmap is None: + knsmap = {None:kdefault} + knsmap.update(**{km:namespaces[km] for km in namespaces if namespaces[km]!=kdefault}) + self[k] = ElementMaker(namespace=namespaces[k], nsmap=nsmap or knsmap) if default is not None: # create an ElementMaker that uses the given namespace as the default - self._ = ElementMaker(namespace=default, nsmap=nsmap or {None:default}) + if nsmap is None: + knsmap = {None:default} + knsmap.update(**{km:namespaces[km] for km in namespaces if namespaces[km]!=default}) + self._ = ElementMaker(namespace=default, nsmap=nsmap or knsmap) else: # make elements with no namespace by default self._ = ElementMaker()
XBuilder now handles namespaces as intended
BlackEarth_bl
train
py
dcd04d993ed814869e810aa138496e3e72ed4a23
diff --git a/hazelcast/src/test/java/com/hazelcast/test/AssertEnabledFilterRule.java b/hazelcast/src/test/java/com/hazelcast/test/AssertEnabledFilterRule.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/test/java/com/hazelcast/test/AssertEnabledFilterRule.java +++ b/hazelcast/src/test/java/com/hazelcast/test/AssertEnabledFilterRule.java @@ -38,7 +38,7 @@ public class AssertEnabledFilterRule implements TestRule { if (assertEnabled) { base.evaluate(); } else { - System.err.println("WARNING! Test cannot run when Java assertions are not enabled (java -ea ...): " + System.out.println("WARNING! Test cannot run when Java assertions are not enabled (java -ea ...): " + description.getDisplayName()); } }
Make RequireAssertEnabled print to stdout (#<I>) Apparently our Surefire configuration drops stderr from saved test output.
hazelcast_hazelcast
train
java
102255330bb6ffc5d0ca2888f206813445a29e44
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -521,7 +521,7 @@ module ActiveRecord def include_in_memory?(record) if @reflection.is_a?(ActiveRecord::Reflection::ThroughReflection) - @owner.send(proxy_reflection.through_reflection.name.to_sym).any? do |source| + @owner.send(proxy_reflection.through_reflection.name).any? do |source| target = source.send(proxy_reflection.source_reflection.name) target.respond_to?(:include?) ? target.include?(record) : target == record end
no need to send a symbol to send()
rails_rails
train
rb
3525d91b4622a2ae1a9aae991dd1384d71de291e
diff --git a/calendar/event.php b/calendar/event.php index <HASH>..<HASH> 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -248,6 +248,13 @@ $nav = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$SESSION->cal_course_referer.'">'.$shortname.'</a> -> '.$nav; } + if (!empty($SESSION->cal_course_referer)) { + // TODO: This is part of the Great $course Hack in Moodle. Replace it at some point. + $course = get_record('course', 'id', $SESSION->cal_course_referer); + } else { + $course = $site; + } + print_header($site->shortname.': '.$strcalendar.': '.$title, $strcalendar, $nav.' -> '.$title, $focus, '', true, '', user_login_string($site)); @@ -330,7 +337,9 @@ $form->minutes = ''; } } - if (!empty($form->courseid)) { // Fixes bug 1488 + + if (!empty($form->courseid)) { + // TODO: This is part of the Great $course Hack in Moodle. Replace it at some point. $course = get_record('course', 'id', $form->courseid); } else { $course = $site;
Merging from STABLE: Fix for bug <I>: The Great Global $course Hack strikes again. I had to put in another instance of the hack for course themes to work in the "calendar" part of the course. Hopefully some day we 'll do all that "correctly"! (search for "hack" in weblib and despair).
moodle_moodle
train
php
0dc61748b33dc3bedd74eb519a6add5d31aabe9b
diff --git a/chamber/forms/validators.py b/chamber/forms/validators.py index <HASH>..<HASH> 100644 --- a/chamber/forms/validators.py +++ b/chamber/forms/validators.py @@ -44,9 +44,10 @@ class AllowedContentTypesByContentFileValidator: self.content_types = content_types def __call__(self, data): + data.open() with magic.Magic(flags=magic.MAGIC_MIME_TYPE) as m: - mime_type = m.id_buffer(data.file.read(1024)) - data.file.seek(0) + mime_type = m.id_buffer(data.read(1024)) + data.seek(0) if mime_type not in self.content_types: raise ValidationError(ugettext('File content was evaluated as not supported file type'))
Preventive file opening before content type validation
druids_django-chamber
train
py
74b0330a36aba7de5a3b09ea10440d1dada402df
diff --git a/sufia-models/app/models/concerns/sufia/generic_file.rb b/sufia-models/app/models/concerns/sufia/generic_file.rb index <HASH>..<HASH> 100644 --- a/sufia-models/app/models/concerns/sufia/generic_file.rb +++ b/sufia-models/app/models/concerns/sufia/generic_file.rb @@ -97,7 +97,7 @@ module Sufia solr_doc[Solrizer.solr_name('file_format')] = file_format solr_doc[Solrizer.solr_name('file_format', :facetable)] = file_format solr_doc['all_text_timv'] = full_text.content - solr_doc = index_collection_pids(solr_doc) + solr_doc = index_collection_ids(solr_doc) end end
Switch to using index_collection_ids which removes a deprecation
samvera_hyrax
train
rb
041cc6557de6545ea9809c72be7948cb8180ba58
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -80,6 +80,7 @@ export default class Plunger { closeConnection(force = false) { if (this.options.abort === 'always' || force) { this.response.destroy(); + this.firstChunk = undefined; } return this; } @@ -123,7 +124,6 @@ export default class Plunger { this.response.pipe(destination); destination.write(this.firstChunk); this.response.resume(); - this.firstChunk = undefined; return destination; }
Unset firstChunk in closeConnection
geodatagouv_plunger
train
js
62dbec9d7350660edae4b168cec57964112bd141
diff --git a/src/Web.php b/src/Web.php index <HASH>..<HASH> 100644 --- a/src/Web.php +++ b/src/Web.php @@ -98,17 +98,6 @@ class Web implements MiddlewareInterface } /** - * @param string $routes - * @return mixed - */ - public function execute($routes) - { - /** @noinspection PhpUnusedLocalVariableInspection */ - $app = $this; // to be used in the included file. - return include($routes); - } - - /** * @param Request $request * @return Response|null */
removed execute, which hass less functionality compared to configure method.
TuumPHP_Web
train
php
187738c62c1973c3abd72b5c5335de6773e885fd
diff --git a/includes/admin/class-papi-admin.php b/includes/admin/class-papi-admin.php index <HASH>..<HASH> 100644 --- a/includes/admin/class-papi-admin.php +++ b/includes/admin/class-papi-admin.php @@ -142,7 +142,7 @@ final class Papi_Admin { */ public function admin_menu() { - global $menu, $submenu; + global $submenu; $post_types = papi_get_post_types();
Removed global $menu since it not used
wp-papi_papi
train
php
687af4027e0f52c90166218f3e14ab8dd92efd92
diff --git a/src/Liuggio/StatsdClient/StatsdClient.php b/src/Liuggio/StatsdClient/StatsdClient.php index <HASH>..<HASH> 100644 --- a/src/Liuggio/StatsdClient/StatsdClient.php +++ b/src/Liuggio/StatsdClient/StatsdClient.php @@ -140,13 +140,13 @@ class StatsdClient implements StatsdClientInterface if ($this->getReducePacket()) { $data = $this->reduceCount($data); } + $written = 0; //failures in any of this should be silently ignored if .. try { $fp = $this->getSender()->open(); if (!$fp) { return; } - $written = 0; foreach ($data as $key => $message) { $written += $this->getSender()->write($fp, $message); }
Avoid undefined variable warning in StatsdClient::send() Avoid warning when opening a sender fails and failSilently is set.
liuggio_statsd-php-client
train
php
acf1a87da187fcecc5f54563848437dc9b161397
diff --git a/spec/plugin.py b/spec/plugin.py index <HASH>..<HASH> 100644 --- a/spec/plugin.py +++ b/spec/plugin.py @@ -372,7 +372,7 @@ class SpecPlugin(Plugin): self._print_spec('ok', test) def addFailure(self, test, err): - self._print_spec('failure', test, 'FAILED') + self._print_spec('failure', test, '') self._failures.append((test, err)) def addError(self, test, err): @@ -381,12 +381,12 @@ class SpecPlugin(Plugin): klass = err[0] if issubclass(klass, nose.DeprecatedTest): - blurt('deprecated', 'DEPRECATED') + blurt('deprecated', '') elif issubclass(klass, SkipTest): - blurt('skipped', 'SKIPPED') + blurt('skipped', '') else: self._errors.append((test, err)) - blurt('error', 'ERROR') + blurt('error', '') def afterTest(self, test): self.stream.capture()
Remove extraneous (for spec) suffices
bitprophet_spec
train
py
dcaf610b0a032a9fffeb6ba289b261e1c63da6a5
diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index <HASH>..<HASH> 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -264,7 +264,6 @@ class MethodCallTest extends TestCase ], 'dateTimeImmutableStatic' => [ '<?php - /** @psalm-immutable */ final class MyDate extends DateTimeImmutable {} $today = new MyDate();
Removed `@psalm-immutable` marked from `MyDate` extending `DateTimeImmutable` `DateTimeImmutable` is not really immutable, therefore this marker was wrong upfront
vimeo_psalm
train
php
fbedce34d736fcb4c38168c67a1f7b171d9bde9f
diff --git a/src/PhpParser/Node/Value/ValueResolver.php b/src/PhpParser/Node/Value/ValueResolver.php index <HASH>..<HASH> 100644 --- a/src/PhpParser/Node/Value/ValueResolver.php +++ b/src/PhpParser/Node/Value/ValueResolver.php @@ -191,7 +191,10 @@ final class ValueResolver return $fileInfo->getPathname(); } - private function resolveClassConstFetch(ClassConstFetch $classConstFetch): string + /** + * @return mixed + */ + private function resolveClassConstFetch(ClassConstFetch $classConstFetch) { $class = $this->nodeNameResolver->getName($classConstFetch->class); $constant = $this->nodeNameResolver->getName($classConstFetch->name);
change return type of resolveClassConstFetch to mixed (#<I>)
rectorphp_rector
train
php
a6b7a751365acd3a1a1154e0c88c933e19e039c0
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ class PublishCommand(Command): os.system('git push --tags') -setup(name='dependency_injector', +setup(name='dependency-injector', version=version, description='Python dependency injection framework', long_description=description,
Normalize package names by PEP-<I> (<URL>)
ets-labs_python-dependency-injector
train
py
31e71deb40c2c33a52a689a9be384e6ef7a2bdea
diff --git a/packages/neos-ui-guest-frame/src/initializeGuestFrame.js b/packages/neos-ui-guest-frame/src/initializeGuestFrame.js index <HASH>..<HASH> 100644 --- a/packages/neos-ui-guest-frame/src/initializeGuestFrame.js +++ b/packages/neos-ui-guest-frame/src/initializeGuestFrame.js @@ -95,11 +95,20 @@ export default ({globalRegistry, store}) => function * initializeGuestFrame() { nodes }); - // only of guest frame document did not change in the meantime, we continue initializing the node - if (getGuestFrameDocument() === node.ownerDocument) { - initializeCurrentNode(node); + if ('requestIdleCallback' in window) { + window.requestIdleCallback(() => { + // only of guest frame document did not change in the meantime, we continue initializing the node + if (getGuestFrameDocument() === node.ownerDocument) { + initializeCurrentNode(node); + } + initializeSubSequentNodes(); + }); + } else { + if (getGuestFrameDocument() === node.ownerDocument) { + initializeCurrentNode(node); + } + initializeSubSequentNodes(); } - initializeSubSequentNodes(); }, () => { /* This noop function is called right at the end of content inialization */ }); initializeNodes();
TASK: Use requestIdleCallback only if it is supported
neos_neos-ui
train
js
c8b8a34f3dc7e5b108783b1b17a402e518868989
diff --git a/ryu/services/protocols/bgp/api/prefix.py b/ryu/services/protocols/bgp/api/prefix.py index <HASH>..<HASH> 100644 --- a/ryu/services/protocols/bgp/api/prefix.py +++ b/ryu/services/protocols/bgp/api/prefix.py @@ -64,13 +64,19 @@ class PrefixError(RuntimeConfigError): @validate(name=PREFIX) -def is_valid_prefix(ipv4_prefix): - return validation.is_valid_ipv4_prefix(ipv4_prefix) +def is_valid_prefix(prefix): + if not (validation.is_valid_ipv4_prefix(prefix) + or validation.is_valid_ipv6_prefix(prefix)): + raise ConfigValueError(conf_name=PREFIX, + conf_value=prefix) @validate(name=NEXT_HOP) -def is_valid_next_hop(next_hop_addr): - return validation.is_valid_ipv4(next_hop_addr) +def is_valid_next_hop(next_hop): + if not (validation.is_valid_ipv4(next_hop) + or validation.is_valid_ipv6(next_hop)): + raise ConfigValueError(conf_name=NEXT_HOP, + conf_value=next_hop) @validate(name=EVPN_ROUTE_TYPE)
BGPSpeaker: Raise exception when validation fails In the validator for the API arguments should raise exception when the validator detects invalid arguments, otherwise the decorator for registering API functions, RegisterWithArgChecks, can pass through the invalid arguments. This patch fixes this problem.
osrg_ryu
train
py
e35ce0f113590fb3fd3ebc3a55af9788090e0f05
diff --git a/lib/semmy/changelog.rb b/lib/semmy/changelog.rb index <HASH>..<HASH> 100644 --- a/lib/semmy/changelog.rb +++ b/lib/semmy/changelog.rb @@ -71,7 +71,7 @@ module Semmy def insert_before(line_matcher, text, inserted_text) text.dup.tap do |result| - unless (result.gsub!(line_matcher, inserted_text + "\n\\0")) + unless (result.sub!(line_matcher, inserted_text + "\n\\0")) fail(InsertPointNotFound, "Insert point not found.") end diff --git a/spec/semmy/changelog_spec.rb b/spec/semmy/changelog_spec.rb index <HASH>..<HASH> 100644 --- a/spec/semmy/changelog_spec.rb +++ b/spec/semmy/changelog_spec.rb @@ -69,6 +69,10 @@ module Semmy ## Version 1.2.0 - Something new + + ## Version 1.1.0 + + - Something else END result = Changelog::InsertUnreleasedSection.new(config).call(contents) @@ -85,6 +89,10 @@ module Semmy ## Version 1.2.0 - Something new + + ## Version 1.1.0 + + - Something else END end end
Prevent adding multiple unreleased sections
tf_semmy
train
rb,rb
b57871c16186c83b27f615432bfeb84a71f58aae
diff --git a/old/linux_backend/container_pool/repository_fetcher/repository_fetcher.go b/old/linux_backend/container_pool/repository_fetcher/repository_fetcher.go index <HASH>..<HASH> 100644 --- a/old/linux_backend/container_pool/repository_fetcher/repository_fetcher.go +++ b/old/linux_backend/container_pool/repository_fetcher/repository_fetcher.go @@ -44,8 +44,8 @@ type DockerRepositoryFetcher struct { func New(registry Registry, graph Graph) RepositoryFetcher { return &DockerRepositoryFetcher{ - registry: registry, - graph: graph, + registry: registry, + graph: graph, fetchingLayers: map[string]chan struct{}{}, fetchingMutex: new(sync.Mutex), }
go fmt [#<I>]
cloudfoundry-attic_garden-linux
train
go
cbac18f037e2daa4e9567ad45ac607f6d190b125
diff --git a/src/db/Migration.php b/src/db/Migration.php index <HASH>..<HASH> 100644 --- a/src/db/Migration.php +++ b/src/db/Migration.php @@ -37,21 +37,6 @@ } /** - * If on delete/update not set default value 'SET NULL' is used. - * - * @inheritdoc - */ - public function addForeignKey ($name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null) - { - if ($delete === null) - $delete = 'SET NULL'; - if ($update === null) - $update = 'SET NULL'; - - parent::addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete, $update); - } - - /** * Creates database view. * * @param string $name View name.
#<I> delete migration::addForeignKey
pulsarvp_vps-tools
train
php
e75d0a6e4ce132965aaa2fb1f8404fdbe101aa72
diff --git a/eth/filters/filter.go b/eth/filters/filter.go index <HASH>..<HASH> 100644 --- a/eth/filters/filter.go +++ b/eth/filters/filter.go @@ -258,9 +258,9 @@ Logs: if len(topics) > len(log.Topics) { continue Logs } - for i, topics := range topics { - match := len(topics) == 0 // empty rule set == wildcard - for _, topic := range topics { + for i, sub := range topics { + match := len(sub) == 0 // empty rule set == wildcard + for _, topic := range sub { if log.Topics[i] == topic { match = true break
eth/filters: make filterLogs func more readable (#<I>)
ethereum_go-ethereum
train
go
f4969bf43926c68f5a65f2331e0f4f3987a88f5d
diff --git a/Neos.Media/Classes/TypeConverter/ArrayConverter.php b/Neos.Media/Classes/TypeConverter/ArrayConverter.php index <HASH>..<HASH> 100644 --- a/Neos.Media/Classes/TypeConverter/ArrayConverter.php +++ b/Neos.Media/Classes/TypeConverter/ArrayConverter.php @@ -135,6 +135,7 @@ class ArrayConverter extends AbstractTypeConverter '__identity' => $identity, '__type' => \Neos\Utility\TypeHandling::getTypeForValue($source), 'title' => $source->getTitle(), + 'caption' => $source->getCaption(), 'resource' => $convertedChildProperties['resource'] ); }
BUGFIX: The caption of assets is lost when exporting to Sites.xml Include the caption of assets in exports to Sites.xml
neos_neos-development-collection
train
php
a3a74a18a67205e89a6b19c444ec2f3f9e917d55
diff --git a/solution/__init__.py b/solution/__init__.py index <HASH>..<HASH> 100644 --- a/solution/__init__.py +++ b/solution/__init__.py @@ -18,4 +18,4 @@ from .validators import * from .utils import Markup, get_html_attrs, to_unicode -__version__ = '2.4.8' +__version__ = '2.4.9' diff --git a/solution/fields/date.py b/solution/fields/date.py index <HASH>..<HASH> 100644 --- a/solution/fields/date.py +++ b/solution/fields/date.py @@ -3,6 +3,7 @@ import datetime from .. import validators as v from ..utils import Markup, get_html_attrs +from .field import ValidationError from .text import Text @@ -66,5 +67,8 @@ class Date(Text): if not self.str_value: return self.default or None dt = [int(f) for f in self.str_value.split('-')] - return datetime.date(*dt) + try: + return datetime.date(*dt) + except ValueError as e: + raise ValidationError
Raise ValidationError if a date field value isn't a valid date
jpscaletti_solution
train
py,py
8acf8ae4b2104bdd44714eb5da026ac3e95773dd
diff --git a/cyphi/compute.py b/cyphi/compute.py index <HASH>..<HASH> 100644 --- a/cyphi/compute.py +++ b/cyphi/compute.py @@ -269,6 +269,7 @@ def _evaluate_cut(subsystem, partition, unpartitioned_constellation): # TODO document big_mip [email protected](ignore=["subsystem"]) def _big_mip(cache_key, subsystem): # Special case for single-node subsystems. if (len(subsystem.nodes) == 1):
Cache _big_mip
wmayner_pyphi
train
py
dba13e4df00680e050038468ad570ea1a33dd34f
diff --git a/lib/omnibus/health_check.rb b/lib/omnibus/health_check.rb index <HASH>..<HASH> 100644 --- a/lib/omnibus/health_check.rb +++ b/lib/omnibus/health_check.rb @@ -67,7 +67,6 @@ module Omnibus /libcrypto.so/, /libcurses\.so/, /libdoor\.so/, - /libgcc_s\.so\.1/, /libgen\.so/, /libmd5\.so/, /libmd\.so/, @@ -78,7 +77,6 @@ module Omnibus /libssl.so/, /libthread.so/, /libuutil\.so/, - /libz.so/, # solaris 11 libraries: /libc\.so\.1/, /libm\.so\.2/,
Remove libz and libgcc_s from the whitelist We build and package thes already, so having it in the whitelist defeats the purpose. It may be causing issues here as well: <URL>
chef_omnibus
train
rb
0571fd0d96e70d7cd4f05efbe884325e7aa7be87
diff --git a/xwiki-commons-core/xwiki-commons-velocity/src/test/java/org/xwiki/velocity/internal/DefaultVelocityEngineTest.java b/xwiki-commons-core/xwiki-commons-velocity/src/test/java/org/xwiki/velocity/internal/DefaultVelocityEngineTest.java index <HASH>..<HASH> 100644 --- a/xwiki-commons-core/xwiki-commons-velocity/src/test/java/org/xwiki/velocity/internal/DefaultVelocityEngineTest.java +++ b/xwiki-commons-core/xwiki-commons-velocity/src/test/java/org/xwiki/velocity/internal/DefaultVelocityEngineTest.java @@ -65,6 +65,7 @@ public class DefaultVelocityEngineTest extends AbstractMockingComponentTestCase // Ignore all calls to debug() and enable all logs so that we can assert info(), warn() and error() // calls. + ignoring(any(Logger.class)).method("trace"); ignoring(any(Logger.class)).method("debug"); allowing(any(Logger.class)).method("is.*Enabled"); will(returnValue(true)); }});
XCOMMONS-<I>: Velocity should be configured to use SLF4J logger Fix test
xwiki_xwiki-commons
train
java
498006960910ae2bba6a69cdeaa16ad4b2970d80
diff --git a/source/org/jasig/portal/channels/CBookmarks.java b/source/org/jasig/portal/channels/CBookmarks.java index <HASH>..<HASH> 100644 --- a/source/org/jasig/portal/channels/CBookmarks.java +++ b/source/org/jasig/portal/channels/CBookmarks.java @@ -115,10 +115,10 @@ public class CBookmarks extends GenericPortalBean implements org.jasig.portal.IC out.println (" </tr>"); } out.println ("</table>"); - out.println ("<table border=0><tr>"); + out.println ("<table border=0><tr><form>"); out.println ("<td><br><input type=button name=add value=\"Add Bookmark\" onClick=\"location=\'dispatch.jsp?method=edit&action=add\'\"></td>"); out.println ("<td><br><input type=button name=finished value=\"Finished\" onClick=\"location=\'dispatch.jsp?method=edit&action=done\'\"></td>"); - out.println ("</tr></table>"); + out.println ("</form></tr></table>"); } catch (Exception e) {
Added <form> tags around buttons so that they appear in Netscape git-svn-id: <URL>
Jasig_uPortal
train
java
67cc82bfd04c9ee97f29993d89653833adfce49d
diff --git a/appengine_fixture_loader/loader.py b/appengine_fixture_loader/loader.py index <HASH>..<HASH> 100644 --- a/appengine_fixture_loader/loader.py +++ b/appengine_fixture_loader/loader.py @@ -5,11 +5,8 @@ Tools to automate loading of test fixtures import json from datetime import datetime, time, date -try: - from google.appengine.ext.ndb.model import (DateTimeProperty, DateProperty, +from google.appengine.ext.ndb.model import (DateTimeProperty, DateProperty, TimeProperty) -except: - raise ImportError("This library needs the Google App Engine SDK installed") def _sensible_value(attribute_type, value):
Removing useless check - this is not supposed to run without an App Engine SDK installed
rbanffy_appengine-fixture-loader
train
py
7be43a01af3e10064177359075c23a8786da4c31
diff --git a/spec/models/adhoq/query_spec.rb b/spec/models/adhoq/query_spec.rb index <HASH>..<HASH> 100644 --- a/spec/models/adhoq/query_spec.rb +++ b/spec/models/adhoq/query_spec.rb @@ -7,7 +7,7 @@ module Adhoq describe '#execute' do let(:query) { create(:adhoq_query, query: 'SELECT 42 AS answer') } - specify { expect(query.execute).to eq Adhoq::Result.new(%w[answer], [[42]]) } + xit { expect(query.execute).to eq Adhoq::Result.new(%w[answer], [[42]]) } end end end
Pend old interface Query shouldnt be executed directly
esminc_adhoq
train
rb
e7d80875715d2b26821d0dcde7403ce0ddaf64cc
diff --git a/test/restart-test.js b/test/restart-test.js index <HASH>..<HASH> 100644 --- a/test/restart-test.js +++ b/test/restart-test.js @@ -101,7 +101,8 @@ describe('restarting a cycle app with multiple streams', () => { DOM: count$.map(count => div('.app', [ div('.count', count.toString()), - button('.add', '+') + button('.add', '+'), + button('.subtract', '+') ]) ) };
Add support for applications with multiple streams, closes #1
Widdershin_cycle-restart
train
js
0de5cf1c95584aa9b23a99366561232ced60f0cd
diff --git a/pyocd/__main__.py b/pyocd/__main__.py index <HASH>..<HASH> 100644 --- a/pyocd/__main__.py +++ b/pyocd/__main__.py @@ -438,7 +438,7 @@ class PyOCDTool(object): def do_flash(self): """! @brief Handle 'flash' subcommand.""" - self._increase_logging(["pyocd.tools.loader", "pyocd", "pyocd.flash", "pyocd.flash.flash", "pyocd.flash.flash_builder"]) + self._increase_logging(["pyocd.flash.loader"]) session = ConnectHelper.session_with_chosen_probe( project_dir=self._args.project_dir, @@ -464,7 +464,7 @@ class PyOCDTool(object): def do_erase(self): """! @brief Handle 'erase' subcommand.""" - self._increase_logging(["pyocd.tools.loader", "pyocd"]) + self._increase_logging(["pyocd.flash.loader"]) session = ConnectHelper.session_with_chosen_probe( project_dir=self._args.project_dir,
Correct pyocd erase and flash subcommand log levels.
mbedmicro_pyOCD
train
py
30488e441500f7944d287748ffd85e01d5cbdd7a
diff --git a/tests/friend/test_utils.py b/tests/friend/test_utils.py index <HASH>..<HASH> 100644 --- a/tests/friend/test_utils.py +++ b/tests/friend/test_utils.py @@ -121,7 +121,7 @@ class UtilsTests(unittest.TestCase): with self.assertRaises(RuntimeError) as r: utils.retry_ex(wont_recover, times=count-1) - self.assertEqual(r.exception.message, message) + self.assertEqual(str(r.exception), message) self.assertEqual(state[0], count) def test_retry_bool_no_recover(self): @@ -235,5 +235,5 @@ class UtilsTests(unittest.TestCase): variables = ', '.join(missing) message = 'Environment variables not set: {}'.format( variables) - self.assertEqual(r.exception.message, message) + self.assertEqual(str(r.exception), message) self.assertEqual(r.exception.variables, missing)
Fix exception message incompatibility between Python 2 and 3
cloudboss_friend
train
py
671c907fe833529c634e2c79853d8ed955705d8e
diff --git a/tests/codeception/wpunit/Pods/MetaTest.php b/tests/codeception/wpunit/Pods/MetaTest.php index <HASH>..<HASH> 100644 --- a/tests/codeception/wpunit/Pods/MetaTest.php +++ b/tests/codeception/wpunit/Pods/MetaTest.php @@ -102,7 +102,6 @@ class MetaTest extends Pods_UnitTestCase { $this->_add_save_actions(); // Reset all the hooks. - pods_no_conflict_on( 'all' ); pods_meta()->core(); } @@ -121,6 +120,7 @@ class MetaTest extends Pods_UnitTestCase { $GLOBALS['current_user'] = null; + pods_no_conflict_off( 'all' ); parent::tearDown(); }
Ensure conflicts are fixed if test encounters an error
pods-framework_pods
train
php
a2b4b6d3d36253db0d8d23e8cc4c75d432e93b62
diff --git a/treeherder/webapp/api/exceptions.py b/treeherder/webapp/api/exceptions.py index <HASH>..<HASH> 100644 --- a/treeherder/webapp/api/exceptions.py +++ b/treeherder/webapp/api/exceptions.py @@ -1,8 +1,6 @@ import logging -from django.conf import settings from rest_framework import exceptions -from rest_framework.response import Response from rest_framework.views import exception_handler as drf_exc_handler from treeherder.model.derived import (DatasetNotFoundError, @@ -35,10 +33,4 @@ Mostly a conversion of treeherders ORM exceptions to drf APIExceptions "{0} object not found using: {1}".format( exc.table, unicode(exc.extra_info))) - response = drf_exc_handler(exc, context) - if response is None: - msg = {"detail": unicode(exc)} - if settings.DEBUG: - msg["traceback"] = full_message - response = Response(msg, status=500) - return response + return drf_exc_handler(exc, context)
Bug <I> - new relic should track exceptions The treeherder custom api exception handler always converts unexpected errors into ApiExceptions. In order to keep track of those errors in newrelic we shouldn't do the conversion and let the default exception handler decide what to do instead.
mozilla_treeherder
train
py
05d5608a009ac2dba37867ca262a4c94e1076d45
diff --git a/apollo-runtime/src/main/java/com/apollographql/apollo/cache/normalized/ApolloStoreOperation.java b/apollo-runtime/src/main/java/com/apollographql/apollo/cache/normalized/ApolloStoreOperation.java index <HASH>..<HASH> 100644 --- a/apollo-runtime/src/main/java/com/apollographql/apollo/cache/normalized/ApolloStoreOperation.java +++ b/apollo-runtime/src/main/java/com/apollographql/apollo/cache/normalized/ApolloStoreOperation.java @@ -111,7 +111,7 @@ public abstract class ApolloStoreOperation<T> { * * @param <T> result type */ - interface Callback<T> { + public interface Callback<T> { void onSuccess(T result);
Make ApolloStoreOperation.Callback public (#<I>) Closes #<I>
apollographql_apollo-android
train
java
15ea98e9bfbd4231387b7ced0c2d90b5e52b4248
diff --git a/lib/commands/helpers.rb b/lib/commands/helpers.rb index <HASH>..<HASH> 100644 --- a/lib/commands/helpers.rb +++ b/lib/commands/helpers.rb @@ -120,6 +120,7 @@ helper :print_commits do |our_commits, options| after = Date.parse(options[:after]) if options[:after] rescue puts 'cant parse after date' our_commits.each do |cherry, commit| status, sha, ref_name = cherry + ref_name ||= "" next if shown_commits[sha] || ignores[sha] next if options[:project] && !ref_name.match(Regexp.new(options[:project])) ref_name = ref_name.gsub('remotes/', '')
In 'github commits': handle refs with no ref_name For example, detached refs from your local repo, after a reset --hard
defunkt_github-gem
train
rb
818e491d0a10e1661cf1821f262d6b30983953b3
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -52,18 +52,6 @@ module.exports = function(params, callback) { base = $.util.getDocumentURI(base) || base; - if (/#([^\/]+)/.test(schema.id)) { - base = schema.id.split('#')[1]; - - if (!$.refs[base]) { - $.refs[base] = { - $ref: schema.id - }; - } - - base = schema.id; - } - if (!$.refs[base]) { $.refs[base] = schema; }
Canonical dereferencing not supported (?)
json-schema-faker_refaker
train
js
a122c2880d7b97fac4345692b4d9fedd58bec7b5
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -20,5 +20,5 @@ __revision__ = "$Id$" # #--start constants-- -__version__ = "3.0rc2" +__version__ = "3.0rc3" #--end constants--
Bump to <I>rc3
pypa_setuptools
train
py
0f755e2d790d12bd4ddee0cb6d0c673911fd8ea6
diff --git a/src/CMS/Content.php b/src/CMS/Content.php index <HASH>..<HASH> 100644 --- a/src/CMS/Content.php +++ b/src/CMS/Content.php @@ -128,6 +128,16 @@ class CMS_Content extends Pluf_Model 'verbose' => __('modification'), 'help_text' => __('content modification time'), 'editable' => false + ), + // relations + 'submitter' => array( + 'type' => 'Pluf_DB_Field_Foreignkey', + 'model' => 'Pluf_User', + 'blank' => false, + 'relate_name' => 'content_submitter', + 'verbose' => __('submitter'), + 'help_text' => __('content submitter'), + 'editable' => false ) );
submitter field in cms_content is added again
pluf_cms
train
php
7fb012bbbedfa3ca3e770e1955641ed8422d9e37
diff --git a/tests/tests.py b/tests/tests.py index <HASH>..<HASH> 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -241,6 +241,32 @@ class TestFilters(unittest.TestCase): self.assertEqual(data.status_code, 200) +class TestPostQueryFilters(unittest.TestCase): + + def setUp(self,): + self.yql = YQL(diagnostics=True, debug=True) + + def tearDown(self,): + pass + + def test_post_filter_reverse(self,): + pass + + def test_post_filter_tail(self,): + pass + + def test_post_filter_truncate(self,): + pass + + def test_post_filter_sanitize(self,): + pass + + def test_post_filter_sort(self,): + pass + + def test_post_filter_unique(self,): + pass + class TestRemoteFilters(unittest.TestCase): def setUp(self,):
#<I>: Post query filters tests added
josuebrunel_myql
train
py
fd65fc1df99338a709618736dd5af7628fb7eb98
diff --git a/lib/generators/friendly_id_generator.rb b/lib/generators/friendly_id_generator.rb index <HASH>..<HASH> 100644 --- a/lib/generators/friendly_id_generator.rb +++ b/lib/generators/friendly_id_generator.rb @@ -10,10 +10,14 @@ class FriendlyIdGenerator < Rails::Generators::Base class_option :"skip-migration", :type => :boolean, :desc => "Don't generate a migration for the slugs table" class_option :"skip-tasks", :type => :boolean, :desc => "Don't add friendly_id Rake tasks to lib/tasks" + class_option :"skip-initializer", :type => :boolean, :desc => "Don't add friendly_id initializer to config/initializers" def copy_files(*args) migration_template MIGRATIONS_FILE, "db/migrate/create_slugs.rb" unless options["skip-migration"] rakefile "friendly_id.rake", File.read(RAKE_FILE) unless options["skip-tasks"] + initializer "friendly_id.rb" do + 'require "friendly_id/active_record"' + end unless options["skip-initializer"] end # Taken from ActiveRecord's migration generator
Added initializer for Rails <I>, since it doesn't call rails/init.rb any more.
norman_friendly_id
train
rb
2a1c5f4e11f5d868e883f60ff3f8df97815cdc07
diff --git a/src/main/java/ameba/util/bean/BeanMap.java b/src/main/java/ameba/util/bean/BeanMap.java index <HASH>..<HASH> 100644 --- a/src/main/java/ameba/util/bean/BeanMap.java +++ b/src/main/java/ameba/util/bean/BeanMap.java @@ -572,8 +572,8 @@ public class BeanMap<T> extends AbstractMap<String, Object> implements Cloneable beanClass = (Class<T>) bean.getClass(); bean = (T) ((BeanMap) bean).getBean(); } else { - Set<Entry> entries = ((Map) getBean()).entrySet(); - for (Entry entry : entries) { + Set<Map.Entry> entries = ((Map) getBean()).entrySet(); + for (Map.Entry entry : entries) { String name = transformPropertyName((String) entry.getKey()); if (StringUtils.isNotBlank(name) && entry.getValue() != null) { types.put(name, entry.getValue().getClass());
refactor: 增强bean transformer
icode_ameba-utils
train
java
0d4c26f5e4e07fd822d9abe40789c38ebee79f2a
diff --git a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java index <HASH>..<HASH> 100644 --- a/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java +++ b/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/NavigationCamera.java @@ -36,6 +36,7 @@ import java.util.List; public class NavigationCamera implements LifecycleObserver { private static final long MAX_ANIMATION_DURATION_MS = 1500; + private static final int ONE_POINT = 1; private MapboxMap mapboxMap; private MapboxNavigation navigation; @@ -300,6 +301,9 @@ public class NavigationCamera implements LifecycleObserver { } private void animateMapboxMapForRouteOverview(int[] padding, List<Point> routePoints) { + if (routePoints.size() <= ONE_POINT) { + return; + } CameraUpdate resetUpdate = buildResetCameraUpdate(); final CameraUpdate overviewUpdate = buildOverviewCameraUpdate(padding, routePoints); mapboxMap.animateCamera(resetUpdate, 150,
Prevent route overview animation with insufficient route data (#<I>)
mapbox_mapbox-navigation-android
train
java
463b3d0d550deb1f5d6c7c554493cfd13d535e04
diff --git a/src/Anonym/Components/Session.php b/src/Anonym/Components/Session.php index <HASH>..<HASH> 100644 --- a/src/Anonym/Components/Session.php +++ b/src/Anonym/Components/Session.php @@ -10,6 +10,7 @@ namespace Anonym\Components\Session; use Anonym\Components\Crypt\AnonymCrypt; + use Anonym\Components\Crypt\Base64Crypt; use Anonym\Components\Crypt\CrypterDecodeableInterface; /** @@ -148,7 +149,7 @@ */ private function setDefaultValues(){ $this->setPrefix('AnonymFrameworkSessionComponent'); - $this->setCrypter( new AnonymCrypt()); + $this->setCrypter( new Base64Crypt()); } /**
AnonymCrypt to Base<I>
AnonymPHP_Anonym-Session
train
php
d5f85633067b74585f40bd37d2c61c73892ac878
diff --git a/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php b/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php index <HASH>..<HASH> 100644 --- a/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php +++ b/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php @@ -190,7 +190,7 @@ class ContentCacheFlusher $this->resolveTagsForChildWorkspaces($workspace, $workspace->getName()); } - protected function resolveTagsForChildWorkspaces(Workspace $workspace, string $startingPoint):void + protected function resolveTagsForChildWorkspaces(Workspace $workspace, string $startingPoint): void { $cachingHelper = $this->getCachingHelper(); $this->workspacesToFlush[$startingPoint][$workspace->getName()] = $cachingHelper->renderWorkspaceTagForContextNode($workspace->getName());
Update Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php
neos_neos-development-collection
train
php
0a746ab7a19928cc2ada7f7329ce6e87f154111d
diff --git a/test/timers.mocha.js b/test/timers.mocha.js index <HASH>..<HASH> 100644 --- a/test/timers.mocha.js +++ b/test/timers.mocha.js @@ -49,7 +49,6 @@ describe('Timers', function () { setImmediate(function setImmediateTest1 () { dump = inspector.dump(); utils.testCommon(dump); - console.log(require('util').inspect(dump, {showHidden: false, depth: null})); assert.equal(dump.setImmediates.length, 2); assert.equal(dump.setImmediates[0].name, 'setImmediateTest2'); });
test: remove console.log from test
keymetrics_event-loop-inspector
train
js
484c3262e592a6acdc5dc4a4b9f21ded5c2aa7b4
diff --git a/lib/omnibus/project.rb b/lib/omnibus/project.rb index <HASH>..<HASH> 100644 --- a/lib/omnibus/project.rb +++ b/lib/omnibus/project.rb @@ -32,6 +32,11 @@ module Omnibus def render_tasks namespace :projects do + shell = Mixlib::ShellOut.new("cp setup.sh /opt/opscode", + :live_stream => STDOUT, + :cwd => './scripts') + shell.run_command + shell.error! PACKAGE_TYPES.each do |pkg_type| namespace @name do desc "package #{@name} into a #{pkg_type}" @@ -43,6 +48,8 @@ module Omnibus "-v 0.0.1", "-n #{@name}", "/opt/opscode", + "--post-install '../scripts/postinst'", + "--post-uninstall '../scripts/postrm'", "-m 'Opscode, Inc.'", "--description 'The full stack of #{@name}'", "--url http://www.opscode.com"].join(" ")
added packaging for setup/install/uninst scripts
chef_omnibus
train
rb
dc66d57d475818a83b43259689737e700f660f88
diff --git a/lib/mana-potion/pool.rb b/lib/mana-potion/pool.rb index <HASH>..<HASH> 100644 --- a/lib/mana-potion/pool.rb +++ b/lib/mana-potion/pool.rb @@ -7,7 +7,9 @@ module ManaPotion module ClassMethods def mana_pool_for(association, limit: 1, period: 1.day) before_validation do + limit = instance_exec &limit if limit.respond_to?(:call) period = instance_exec &period if period.respond_to?(:call) + owner = send(association) other_side_association = owner .class diff --git a/spec/mana-potion/pool_spec.rb b/spec/mana-potion/pool_spec.rb index <HASH>..<HASH> 100644 --- a/spec/mana-potion/pool_spec.rb +++ b/spec/mana-potion/pool_spec.rb @@ -29,6 +29,21 @@ describe ManaPotion::Pool do expect { @user.posts.create! }.not_to raise_error end + it 'allows configuring the limit with a proc' do + class Post + mana_pool_for :user, limit: -> { limit } + + def limit + 2 + end + end + + expect { @user.posts.create! }.not_to raise_error + expect { @user.posts.create! }.to raise_error(ActiveRecord::RecordInvalid) + Timecop.travel 1.day.from_now + expect { @user.posts.create! }.not_to raise_error + end + it 'allows configuring the period' do Post.mana_pool_for :user, period: 1.hour
Allow to pass a proc to limit
oddlyfunctional_mana-potion
train
rb,rb
06af3c1e770b18f3d6f7c4333f84447b0deccad4
diff --git a/theanets/layers.py b/theanets/layers.py index <HASH>..<HASH> 100644 --- a/theanets/layers.py +++ b/theanets/layers.py @@ -580,6 +580,7 @@ class Tied(Feedforward): self.partner = partner kwargs['nin'] = partner.nout kwargs['nout'] = partner.nin + kwargs['name'] = 'tied-{}'.format(partner.name) super(Tied, self).__init__(**kwargs) def transform(self, inputs): @@ -606,10 +607,7 @@ class Tied(Feedforward): def setup(self): '''Set up the parameters and initial values for this layer.''' # this layer does not create a weight matrix! - count = self._add_bias('b') - logging.info('layer %s (tied to %s) %s x %s [%s] %d parameters', - self.name, self.partner.name, self.nin, self.nout, - self.activate.__theanets_name__, count) + self._log_setup(self._add_bias('b')) class Classifier(Feedforward):
Use partner layer name for tied layers.
lmjohns3_theanets
train
py
4e2a21a8fb1f3b8fb3714732cbdc978f4f9db864
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -98,7 +98,12 @@ const command = executable + ' ' + params.join(' '); - childProcess.execSync(command, { cwd: elmFolder }); + try { + childProcess.execSync(command, { cwd: elmFolder }); + } catch (error) { + // we don't want Elm compilation error to crash the whole Brunch process + } + this.compiledOnCurrentStep[originSrcFile] = true; };
Don't crash Branch process when Elm compilation fails (#<I>)
madsflensted_elm-brunch
train
js
1d08dff11a337e7f8b8f99ea971085e26119e772
diff --git a/pysat/tests/test_utils.py b/pysat/tests/test_utils.py index <HASH>..<HASH> 100644 --- a/pysat/tests/test_utils.py +++ b/pysat/tests/test_utils.py @@ -196,7 +196,8 @@ class TestListify(): @pytest.mark.parametrize('iterable', ['test', ['test'], [[['test']]], [[[['test']]]], [['test', 'test']], - [['test', 'test'], ['test', 'test']]]) + [['test', 'test'], ['test', 'test']], + [], [[]]]) def test_listify_list_string_inputs(self, iterable): """ Test listify with various list levels of a string""" diff --git a/pysat/utils/_core.py b/pysat/utils/_core.py index <HASH>..<HASH> 100644 --- a/pysat/utils/_core.py +++ b/pysat/utils/_core.py @@ -136,6 +136,8 @@ def listify(iterable): list_iter = [arr_iter.tolist()] elif arr_iter.shape[0] >= 1: list_iter = arr_iter.flatten().tolist() + elif arr_iter.shape[0] == 0: + list_iter = arr_iter.tolist() return list_iter
BUG: Added code for missing listify input of []
rstoneback_pysat
train
py,py
ae43deb098f4dfcc0195ea0e05c63184a8e02810
diff --git a/src/SplitTestsByGroups.php b/src/SplitTestsByGroups.php index <HASH>..<HASH> 100644 --- a/src/SplitTestsByGroups.php +++ b/src/SplitTestsByGroups.php @@ -1,7 +1,6 @@ <?php namespace Codeception\Task; -use Robo\Common\TaskIO; use Robo\Contract\TaskInterface; use Robo\Exception\TaskException; use Robo\Task\BaseTask; @@ -23,8 +22,6 @@ trait SplitTestsByGroups abstract class TestsSplitter extends BaseTask { - use TaskIO; - protected $numGroups; protected $projectRoot = '.'; protected $testsFrom = 'tests';
Remove TaskIO trait from SplitTestsByGroups, as BaseTask already uses it.
Codeception_robo-paracept
train
php
f2e92cfeabbd98b4cb92016b43d7ef08154f5c2a
diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet.go b/builtin/providers/digitalocean/resource_digitalocean_droplet.go index <HASH>..<HASH> 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet.go @@ -355,7 +355,7 @@ func WaitForDropletAttribute( Pending: pending, Target: target, Refresh: newDropletStateRefreshFunc(d, attribute, meta), - Timeout: 10 * time.Minute, + Timeout: 60 * time.Minute, Delay: 10 * time.Second, MinTimeout: 3 * time.Second, }
providers/digitalocean: increase timeout for droplet wait to <I> mins fixes #<I>
hashicorp_terraform
train
go
30a861bc5a4f53a9ba73923c9048a3632a0f9d18
diff --git a/more_itertools/more.py b/more_itertools/more.py index <HASH>..<HASH> 100644 --- a/more_itertools/more.py +++ b/more_itertools/more.py @@ -1,6 +1,6 @@ from __future__ import print_function -from collections import Counter, defaultdict, deque, Sequence +from collections import Counter, defaultdict, deque from functools import partial, wraps from heapq import merge from itertools import ( @@ -17,6 +17,10 @@ from itertools import ( ) from operator import itemgetter, lt, gt, sub from sys import maxsize, version_info +if version_info < (3, 3): + from collections import Sequence +else: + from collections.abc import Sequence from six import binary_type, string_types, text_type from six.moves import filter, map, range, zip, zip_longest
fix for python <I> deprecation warning about importing certain types from collections vs collections.abc
erikrose_more-itertools
train
py
9c9fe3c3d6e9b48ef604ef069b40e8fc77e8aac2
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -95,19 +95,21 @@ function getClientIp(req) { } /** + * Expose mode public functions + */ +exports.getClientIp = getClientIp; + + +/** * Expose a default implemtation for a connect middleware * * @options.attributeName - name of attribute to augment request object with */ -getClientIp.mw = function(options) { +exports.mw = function(options) { + if (!options) options = {}; var attr = options.attributeName || "clientIp"; return function(req, res, next) { - req[attr] = requestIp.getClientIp(req); // on localhost > 127.0.0.1 + req[attr] = getClientIp(req); // on localhost > 127.0.0.1 next(); } }; - -/** - * Expose mode public functions - */ -exports.getClientIp = getClientIp;
export the mw on the module, and not on the function
pbojinov_request-ip
train
js