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 |
|---|---|---|---|---|---|
1c81d93e3494230a054934bd5e519722552a881b | diff --git a/index_test.go b/index_test.go
index <HASH>..<HASH> 100644
--- a/index_test.go
+++ b/index_test.go
@@ -189,7 +189,14 @@ func TestIndexOpenAndClose(t *testing.T) {
t.Fatalf("expected close index of %q to be acknowledged\n", testIndexName)
}
- time.Sleep(3*time.Second)
+ // Flush
+ flushresp, err := client.Flush().Refresh(true).Do()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if flushresp.Shards.Failed > 0 {
+ t.Fatalf("expected not failed shards on flush; got: %d", flushresp.Shards.Failed)
+ }
// Open index again
oresp, err := client.OpenIndex(testIndexName).Do()
@@ -199,6 +206,15 @@ func TestIndexOpenAndClose(t *testing.T) {
if !oresp.Acknowledged {
t.Fatalf("expected open index of %q to be acknowledged\n", testIndexName)
}
+
+ // Flush again
+ flushresp, err = client.Flush().Refresh(true).Do()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if flushresp.Shards.Failed > 0 {
+ t.Fatalf("expected not failed shards on flush; got: %d", flushresp.Shards.Failed)
+ }
}
func TestDocumentLifecycle(t *testing.T) { | fix tests on travis
open/close index test works on localhost, not on travis.
Experimenting... | olivere_elastic | train | go |
321fe9d83c27c2d0eedc134d9f0f329187fd48b3 | diff --git a/pliers/extractors/api/clarifai.py b/pliers/extractors/api/clarifai.py
index <HASH>..<HASH> 100644
--- a/pliers/extractors/api/clarifai.py
+++ b/pliers/extractors/api/clarifai.py
@@ -184,6 +184,9 @@ class ClarifaiAPIImageExtractor(ClarifaiAPIExtractor, BatchTransformerMixin,
return extractions
def _to_df(self, result):
+ if self.model_name == 'face':
+ # is a list already, no need to wrap it in one
+ return pd.DataFrame(self._parse_annotations(result._data))
return pd.DataFrame([self._parse_annotations(result._data)]) | prevent double list
In the case of clarifai face models, the result object of _parse_annotations is returned as a list. In this case, we should not wrap it in another list prior to df conversion | tyarkoni_pliers | train | py |
f4932c194ab999ef099b0afe3d1d6f8df660d165 | diff --git a/molgenis-jobs/src/main/java/org/molgenis/jobs/model/JobExecutionLogAppender.java b/molgenis-jobs/src/main/java/org/molgenis/jobs/model/JobExecutionLogAppender.java
index <HASH>..<HASH> 100644
--- a/molgenis-jobs/src/main/java/org/molgenis/jobs/model/JobExecutionLogAppender.java
+++ b/molgenis-jobs/src/main/java/org/molgenis/jobs/model/JobExecutionLogAppender.java
@@ -11,7 +11,7 @@ public class JobExecutionLogAppender extends AppenderBase<ILoggingEvent> {
private void createLayout() {
layout = new PatternLayout();
- layout.setPattern("%d{HH:mm:ss.SSS} - %msg%n%nopex");
+ layout.setPattern("%d{HH:mm:ss.SSS zzz} - %msg%n%nopex");
layout.setContext(getContext());
layout.start();
} | Add timezone to the timestamps of job execution logging | molgenis_molgenis | train | java |
344dceb89fe171453ee8efd2731c54679f7f71fe | diff --git a/src/Spiritix/LadaCache/LadaCacheServiceProvider.php b/src/Spiritix/LadaCache/LadaCacheServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/Spiritix/LadaCache/LadaCacheServiceProvider.php
+++ b/src/Spiritix/LadaCache/LadaCacheServiceProvider.php
@@ -54,7 +54,7 @@ class LadaCacheServiceProvider extends ServiceProvider
__DIR__ . '/../../../config/' . self::CONFIG_FILE, str_replace('.php', '', self::CONFIG_FILE)
);
- if (class_exists('Barryvdh\\Debugbar\\LaravelDebugbar')) {
+ if ($this->app->offsetExists('debugbar')) {
$this->registerDebugbarCollector();
}
}
@@ -166,4 +166,4 @@ class LadaCacheServiceProvider extends ServiceProvider
$debugBar = $this->app->make('debugbar');
$debugBar->addCollector($this->app->make('lada.collector'));
}
-}
\ No newline at end of file
+} | Fix according to issue #<I> | spiritix_lada-cache | train | php |
776361d038c8484e90553de03873a9152a1eecc2 | diff --git a/lib/guard/interactor.rb b/lib/guard/interactor.rb
index <HASH>..<HASH> 100644
--- a/lib/guard/interactor.rb
+++ b/lib/guard/interactor.rb
@@ -45,6 +45,7 @@ module Guard
::Guard.run_all
end
end
+ sleep 0.1
rescue LockException
lock
rescue UnlockException | add a sleep to the interactor thread, because it's healthy to take a break every once in a while | guard_guard | train | rb |
b0d12ef197ec119c655e42f905b3dc1b0939291a | diff --git a/src/Pdo/Oci8/Statement.php b/src/Pdo/Oci8/Statement.php
index <HASH>..<HASH> 100644
--- a/src/Pdo/Oci8/Statement.php
+++ b/src/Pdo/Oci8/Statement.php
@@ -439,6 +439,7 @@ class Statement extends PDOStatement
$this->blobBindings[$parameter] = $variable;
$variable = $this->connection->getNewDescriptor();
+ $variable->writeTemporary($this->blobBindings[$parameter], OCI_TEMP_BLOB);
$this->blobObjects[$parameter] = &$variable;
break;
@@ -466,6 +467,7 @@ class Statement extends PDOStatement
$this->blobBindings[$parameter] = $variable;
$variable = $this->connection->getNewDescriptor();
+ $variable->writeTemporary($this->blobBindings[$parameter], OCI_TEMP_CLOB);
$this->blobObjects[$parameter] = &$variable;
break; | For large param
Sometime it's show OCI-Lob::save(): OCI_INVALID_HANDLE" if now writeTemporary. | yajra_pdo-via-oci8 | train | php |
495c5bd7997e7cf5484c73d1dd08e53507b31a75 | diff --git a/lib/inviter/acts_as_inviter.rb b/lib/inviter/acts_as_inviter.rb
index <HASH>..<HASH> 100644
--- a/lib/inviter/acts_as_inviter.rb
+++ b/lib/inviter/acts_as_inviter.rb
@@ -6,7 +6,7 @@ module Inviter
end
included do
- has_many :sent_invitations, as: :inviter, class_name: Invitation
+ has_many :sent_invitations, as: :inviter, class_name: "Invitation"
end
def send_invitation(invitee, invited_to) | Pass string to class_name has_many option
Rails console was failing with error `A class was passed to `:class_name` but we are expecting a string.` | mjmorales_inviter | train | rb |
f613deca28915aee3b420ce715cc87d6c23f2e18 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ Tag a release (simply replace ``0.x`` with the current version number)::
Upload release to PyPI::
- $ python setup.py bdist_wheel upload
+ $ python3 setup.py bdist_wheel upload
"""
# Copyright (c) 2016, Thomas Aglassinger.
# All rights reserved. Distributed under the BSD License. | Cleaned up Python version in cheat sheet. | roskakori_pygount | train | py |
a252a91485700467b13b990592186d111a002421 | diff --git a/slave/buildslave/test/unit/test_scripts_runner.py b/slave/buildslave/test/unit/test_scripts_runner.py
index <HASH>..<HASH> 100644
--- a/slave/buildslave/test/unit/test_scripts_runner.py
+++ b/slave/buildslave/test/unit/test_scripts_runner.py
@@ -224,6 +224,16 @@ class TestCreateSlaveOptions(OptionsMixin, unittest.TestCase):
"log-count parameter needs to be an number or None",
self.parse, "--log-count=X", *self.req_args)
+ def test_inv_umask(self):
+ self.assertRaisesRegexp(usage.UsageError,
+ "umask parameter needs to be an number or None",
+ self.parse, "--umask=X", *self.req_args)
+
+ def test_inv_allow_shutdown(self):
+ self.assertRaisesRegexp(usage.UsageError,
+ "allow-shutdown needs to be one of 'signal' or 'file'",
+ self.parse, "--allow-shutdown=X", *self.req_args)
+
def test_too_few_args(self):
self.assertRaisesRegexp(usage.UsageError,
"incorrect number of arguments", | Add tests for invalid --umask and --allow-shutdown options
Currently fails. | buildbot_buildbot | train | py |
ab472009893a453e6e1e91447da47d11dc8bd6ff | diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js
index <HASH>..<HASH> 100644
--- a/IPython/html/static/notebook/js/widgets/widget.js
+++ b/IPython/html/static/notebook/js/widgets/widget.js
@@ -148,7 +148,7 @@ function(WidgetManager, _, Backbone){
}
// Delete any key value pairs that the back-end already knows about.
- var attrs = (method === 'patch') ? options.attrs : model.toJSON(options);
+ var attrs = (method === 'patch') ? model.changed : model.toJSON(options);
if (this.key_value_lock !== null) {
var key = this.key_value_lock[0];
var value = this.key_value_lock[1]; | Fix incorrect usage of attrs | jupyter-widgets_ipywidgets | train | js |
7d44cbdd6c216221cb0ceec41cb25fdf6bf478ca | diff --git a/networkapiclient/ApiEnvironmentVip.py b/networkapiclient/ApiEnvironmentVip.py
index <HASH>..<HASH> 100644
--- a/networkapiclient/ApiEnvironmentVip.py
+++ b/networkapiclient/ApiEnvironmentVip.py
@@ -33,10 +33,13 @@ class ApiEnvironmentVip(ApiGenericClient):
user_ldap
)
- def get_environment_vip(self, environment_vip_id):
+ def get_environment_vip(self, environment_vip_id, fields=None):
uri = "api/v3/environment-vip/%s/" % environment_vip_id
+ if fields:
+ uri += '?fields={}'.format(','.join(fields))
+
return self.get(uri)
def environmentvip_step(self, finality='', client='', environmentp44=''):
diff --git a/networkapiclient/__init__.py b/networkapiclient/__init__.py
index <HASH>..<HASH> 100644
--- a/networkapiclient/__init__.py
+++ b/networkapiclient/__init__.py
@@ -16,5 +16,5 @@
MAJOR_VERSION = '0'
MINOR_VERSION = '6'
-PATCH_VERSION = '25-rc1'
+PATCH_VERSION = '25-rc2'
VERSION = '.'.join((MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION,)) | Add options fields in get environmentvip | globocom_GloboNetworkAPI-client-python | train | py,py |
fe164df51fe702129073527a551cdcd97fde7fbf | diff --git a/linkGrabber/__init__.py b/linkGrabber/__init__.py
index <HASH>..<HASH> 100644
--- a/linkGrabber/__init__.py
+++ b/linkGrabber/__init__.py
@@ -77,9 +77,9 @@ class Links(object):
if exclude is None:
exclude = []
- if filters is None:
- filters = {}
- search = self._soup.findAll('a', href=True, **filters)
+ if 'href' not in filters:
+ filters['href'] = True
+ search = self._soup.findAll('a', **filters)
if reverse:
search.reverse() | add href=True to filters by defult | michigan-com_linkGrabber | train | py |
f8f64f4ff84be8b90760e075f6b7feb1bd7136e2 | diff --git a/lib/conceptql/nodifier.rb b/lib/conceptql/nodifier.rb
index <HASH>..<HASH> 100644
--- a/lib/conceptql/nodifier.rb
+++ b/lib/conceptql/nodifier.rb
@@ -4,7 +4,7 @@ module ConceptQL
class Nodifier
attr :scope, :data_model, :algorithm_fetcher
- def initialize(scope, opts={})
+ def initialize(opts={})
@scope = opts[:scope] || Scope.new
@data_model = opts[:data_model] || :omopv4
@algorithm_fetcher = opts[:algorithm_fetcher] || (proc do |alg| | Nodifier: no longer accept scope as argument
Instead accept it through the options hash | outcomesinsights_conceptql | train | rb |
e94227e9788156eaba64bd0c03d7484fda309cd7 | diff --git a/test/markdown_test.rb b/test/markdown_test.rb
index <HASH>..<HASH> 100644
--- a/test/markdown_test.rb
+++ b/test/markdown_test.rb
@@ -69,8 +69,7 @@ MarkdownTest = proc do
end
# Will generate RDiscountTest, KramdownTest, etc.
-map = Tilt.respond_to?(:lazy_map) ? Tilt.lazy_map['md'].map(&:first)
- : Tilt.mappings['md']
+map = Tilt.respond_to?(:lazy_map) ? Tilt.lazy_map['md'].map(&:first) : Tilt.mappings['md']
map.each do |t|
begin | Drop a newline for Ruby <I> compatibility | sinatra_sinatra | train | rb |
5ddcc516e4a82a32f866176b804774f23d6cfb70 | diff --git a/js/views/new_message_button.js b/js/views/new_message_button.js
index <HASH>..<HASH> 100644
--- a/js/views/new_message_button.js
+++ b/js/views/new_message_button.js
@@ -108,7 +108,7 @@ var Whisper = Whisper || {};
new_message: function(e) {
e.preventDefault();
$('.conversation').hide().trigger('close'); // detach any existing conversation views
- this.view = new Whisper.NewConversationView().$el.insertAfter($('#gutter'));
+ this.view = new Whisper.NewConversationView();
//todo: less new
}, | remove extra insertion, it's already happening | ForstaLabs_librelay-node | train | js |
71465377a2dfb9bdb403bdf1949106bcf5c72601 | diff --git a/provider/akamai.go b/provider/akamai.go
index <HASH>..<HASH> 100644
--- a/provider/akamai.go
+++ b/provider/akamai.go
@@ -219,7 +219,12 @@ func (p *AkamaiProvider) Records(context.Context) (endpoints []*endpoint.Endpoin
return endpoints, err
}
for _, zone := range zones.Zones {
- records, _ := p.fetchRecordSet(zone.Zone)
+ records, err := p.fetchRecordSet(zone.Zone)
+ if err != nil {
+ log.Warnf("No recordsets could be fetched for zone: '%s'!", zone.Zone)
+ continue
+ }
+
for _, record := range records.Recordsets {
rdata := make([]string, len(record.Rdata)) | check and handle errors in func Records for fetching recordsets | kubernetes-incubator_external-dns | train | go |
9939436c9ef0b9b996b1ecc8e922b71b7cdbfdb2 | diff --git a/django_extensions/management/modelviz.py b/django_extensions/management/modelviz.py
index <HASH>..<HASH> 100644
--- a/django_extensions/management/modelviz.py
+++ b/django_extensions/management/modelviz.py
@@ -320,6 +320,8 @@ def generate_dot(app_labels, **kwargs):
for field in appmodel._meta.local_fields:
if field.attname.endswith('_ptr_id'): # excluding field redundant with inheritance relation
continue
+ if field in abstract_fields: # excluding fields inherited from abstract classes. they too show as local_fields
+ continue
if skip_field(field):
continue
if isinstance(field, OneToOneField): | Excluding fields inherited from abstract models | django-extensions_django-extensions | train | py |
c630e7d3a72d47e73ec5a9e38e28176599173455 | diff --git a/src/html/WithChildren.js b/src/html/WithChildren.js
index <HASH>..<HASH> 100644
--- a/src/html/WithChildren.js
+++ b/src/html/WithChildren.js
@@ -2,9 +2,8 @@ import Class from 'lowclass'
import Mixin from 'lowclass/Mixin'
import { observeChildren } from '../core/Utility'
-// polyfill for Node.isConnected based on a blend of Ryosuke Niwa's and ShadyDOM's
+// polyfill for Node.isConnected based on Ryosuke Niwa's
// https://github.com/w3c/webcomponents/issues/789#issuecomment-459858405
-// https://github.com/webcomponents/webcomponentsjs/issues/1065
if (!Object.getOwnPropertyDescriptor(Node.prototype, 'isConnected')) {
let rootNode = null
@@ -22,10 +21,7 @@ if (!Object.getOwnPropertyDescriptor(Node.prototype, 'isConnected')) {
}
Object.defineProperty(Node.prototype, 'isConnected', {
- get() {
- if (document.contains) return document.contains(this)
- return rootNode(this).nodeType === Node.DOCUMENT_NODE
- },
+ get() { return rootNode(this).nodeType === Node.DOCUMENT_NODE },
enumerable: true,
configurable: true,
}) | remove WithChildren's use of document.contains for the isConnected polyfill, because that won't work with ShadowDOM. | trusktr_infamous | train | js |
835222bb903ec9926d1742ebcbe3d32085b22def | diff --git a/src/Storage/Field/Type/TaxonomyType.php b/src/Storage/Field/Type/TaxonomyType.php
index <HASH>..<HASH> 100644
--- a/src/Storage/Field/Type/TaxonomyType.php
+++ b/src/Storage/Field/Type/TaxonomyType.php
@@ -143,13 +143,14 @@ class TaxonomyType extends FieldTypeBase
public function persist(QuerySet $queries, $entity)
{
$field = $this->mapping['fieldname'];
- $taxonomy = $entity->getTaxonomy();
+ $taxonomy = $entity->getTaxonomy()->getField($field);
// Fetch existing taxonomies
- $existing = $this->getExistingTaxonomies($entity) ?: [];
- $collection = $this->em->getCollectionManager()->create('Bolt\Storage\Entity\Taxonomy');
- $collection->setFromDatabaseValues($existing);
- $collection = $collection->getField($field);
+ $existingDB = $this->getExistingTaxonomies($entity) ?: [];
+ $collection = $this->em->getCollectionManager()
+ ->create('Bolt\Storage\Entity\Taxonomy')
+ ->setFromDatabaseValues($existingDB);
+
$toDelete = $collection->getDeleted($taxonomy);
$collection->merge($taxonomy, true); | minor rewrite to make more sense | bolt_bolt | train | php |
75bb671d1ec8709309196ac96cff66d9e05e36f9 | diff --git a/src/Message/Attachment.php b/src/Message/Attachment.php
index <HASH>..<HASH> 100644
--- a/src/Message/Attachment.php
+++ b/src/Message/Attachment.php
@@ -98,14 +98,18 @@ class Attachment extends Message
public function expectedIs($type)
{
// If people set type = message type, return true
- if (is_array($this->body) && isset($this->body['attachment']['type'])) {
+ if (is_array($this->body) && isset($this->body['attachment']) && isset($this->body['attachment']['type'])) {
return true;
}
+ if (is_string($this->body)) {
+ $fileExtension = $this->detectMediaType($this->body);
+ return $fileExtension === $type;
+ }
+
// If it's string, maybe it's URL. Check the extension
- if (is_string($this->body) || is_string($this->body['attachment']['payload']['url'])) {
+ if (isset($this->body['attachment']) && is_string($this->body['attachment']['payload']['url'])) {
$fileExtension = $this->detectMediaType($this->body['attachment']['payload']['url']);
-
return $fileExtension === $type;
} | Fix parsing problem with Attachment | gigaai_framework | train | php |
854df82f0f82696c55fe5fbbd14d3de329e749c9 | diff --git a/sshd-shell-spring-boot-starter/src/test/java/sshd/shell/springboot/autoconfiguration/ConfigTest.java b/sshd-shell-spring-boot-starter/src/test/java/sshd/shell/springboot/autoconfiguration/ConfigTest.java
index <HASH>..<HASH> 100644
--- a/sshd-shell-spring-boot-starter/src/test/java/sshd/shell/springboot/autoconfiguration/ConfigTest.java
+++ b/sshd-shell-spring-boot-starter/src/test/java/sshd/shell/springboot/autoconfiguration/ConfigTest.java
@@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
import org.springframework.boot.actuate.management.HeapDumpWebEndpoint;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
@@ -49,6 +50,7 @@ import org.springframework.security.crypto.password.NoOpPasswordEncoder;
* @author anand
*/
@SpringBootApplication
+@EnableCaching
@lombok.extern.slf4j.Slf4j
public class ConfigTest { | Updated test cases for new endpoints and functionality | anand1st_sshd-shell-spring-boot | train | java |
053199355b397fe831ae52f3b9ed6796d9ecb1a6 | diff --git a/setting.go b/setting.go
index <HASH>..<HASH> 100644
--- a/setting.go
+++ b/setting.go
@@ -355,7 +355,13 @@ func (widgetSetting *QorWidgetSetting) ConfigureQorResource(res resource.Resourc
Title: "Settings",
Rows: [][]string{{"Kind"}, {"SerializableMeta"}},
},
- "Shared",
+ "Shared", "SourceType", "SourceID",
)
+
+ searchHandler := res.SearchHandler
+ res.SearchHandler = func(keyword string, context *qor.Context) *gorm.DB {
+ context.SetDB(context.GetDB().Where("source_type = ?", ""))
+ return searchHandler(keyword, context)
+ }
}
} | Show source type, source id as new attrs | qor_widget | train | go |
c7aaa3fd259b0d03cd3b707417d836ba8e606605 | diff --git a/src/RestClient/SalesforceRestClient.php b/src/RestClient/SalesforceRestClient.php
index <HASH>..<HASH> 100644
--- a/src/RestClient/SalesforceRestClient.php
+++ b/src/RestClient/SalesforceRestClient.php
@@ -9,6 +9,7 @@ use Psr\Http\Message\ResponseInterface;
class SalesforceRestClient
{
+ const ONE_TENTH_SECOND = 100000;
/**
* @var RestClientInterface
*/
@@ -124,6 +125,7 @@ class SalesforceRestClient
$isAuthorized = $this->isResponseAuthorized($response);
if (!$isAuthorized) {
+ usleep(self::ONE_TENTH_SECOND * $attempts);
$this->refreshAccessToken();
} | Add refresh token delay that increases linear based on attempts. | eventfarm_restforcephp | train | php |
19ad97520b6262ac04f56fc6cde63fa295872e7a | diff --git a/server.go b/server.go
index <HASH>..<HASH> 100644
--- a/server.go
+++ b/server.go
@@ -189,11 +189,7 @@ func (s *Server) LastCommandName() string {
// Retrieves the number of member servers in the consensus.
func (s *Server) MemberCount() int {
- count := 1
- for _, _ = range s.peers {
- count++
- }
- return count
+ return len(s.peers) + 1
}
// Retrieves the number of servers required to make a quorum. | server.MemberCount: count peers with len() is cheaper than loop | influxdata_influxdb | train | go |
3d3512b2c63ec56bf2137177e90c78427a24258c | diff --git a/src/Extensions/Traits/LaravelTestCase.php b/src/Extensions/Traits/LaravelTestCase.php
index <HASH>..<HASH> 100644
--- a/src/Extensions/Traits/LaravelTestCase.php
+++ b/src/Extensions/Traits/LaravelTestCase.php
@@ -99,7 +99,7 @@ trait LaravelTestCase
protected function makeRequestUsingForm(Form $form)
{
return $this->makeRequest(
- $form->getMethod(), $form->getUri(), $form->getValues(), [], $form->getFiles()
+ $form->getMethod(), $form->getUri(), $form->getPhpValues(), [], $form->getFiles()
);
} | Submit array fields
```$this->submitForm('Add', ['group' => [1 => 2, 3 => 4]])``` works with this fix.
The original solution came from <URL> | laracasts_Integrated | train | php |
dbca117aad30481e399221d0f87e47dac021fc76 | diff --git a/lib/active_admin/orm/active_record/comments.rb b/lib/active_admin/orm/active_record/comments.rb
index <HASH>..<HASH> 100644
--- a/lib/active_admin/orm/active_record/comments.rb
+++ b/lib/active_admin/orm/active_record/comments.rb
@@ -8,6 +8,7 @@ ActiveAdmin::Application.inheritable_setting :comments, true
ActiveAdmin::Application.inheritable_setting :show_comments_in_menu, true
ActiveAdmin::Application.inheritable_setting :comments_registration_name, 'Comment'
ActiveAdmin::Application.inheritable_setting :comments_order, "created_at ASC"
+ActiveAdmin::Application.inheritable_setting :comments_menu, {}
# Insert helper modules
ActiveAdmin::Namespace.send :include, ActiveAdmin::Comments::NamespaceHelper
@@ -23,7 +24,11 @@ ActiveAdmin.after_load do |app|
namespace.register ActiveAdmin::Comment, as: namespace.comments_registration_name do
actions :index, :show, :create, :destroy
- menu false unless namespace.comments && namespace.show_comments_in_menu
+ if namespace.comments && namespace.show_comments_in_menu
+ menu namespace.comments_menu
+ elsif !namespace.comments || !namespace.show_comments_in_menu
+ menu false
+ end
config.comments = false # Don't allow comments on comments
config.batch_actions = false # The default destroy batch action isn't showing up anyway... | Allow menu options to be passed into ActiveAdmin::Comment | activeadmin_activeadmin | train | rb |
4bea8886313f91853dfc0d810aef513521b46fe4 | diff --git a/src/atoms/Text/index.js b/src/atoms/Text/index.js
index <HASH>..<HASH> 100644
--- a/src/atoms/Text/index.js
+++ b/src/atoms/Text/index.js
@@ -228,7 +228,7 @@ Text.defaultProps = {
size: 8,
font: 'b',
color: 'primary-3',
- inherit: {},
+ inherit: true,
};
export default Text; | Text component gets default props that match its proptypes | policygenius_athenaeum | train | js |
2934d2f0331a78c73667961dac9002a2de8da789 | diff --git a/cmd/hclspecsuite/runner.go b/cmd/hclspecsuite/runner.go
index <HASH>..<HASH> 100644
--- a/cmd/hclspecsuite/runner.go
+++ b/cmd/hclspecsuite/runner.go
@@ -283,7 +283,7 @@ func (r *Runner) runTestInput(specFilename, inputFilename string, tf *TestFile)
"No %s diagnostic was expected %s. The unexpected diagnostic was shown above.",
severityString(gotEntry.Severity), rangeString(gotEntry.Range),
),
- Subject: &gotEntry.Range,
+ Subject: gotEntry.Range.Ptr(),
})
}
}
@@ -297,7 +297,7 @@ func (r *Runner) runTestInput(specFilename, inputFilename string, tf *TestFile)
"No %s diagnostic was generated %s.",
severityString(wantEntry.Severity), rangeString(wantEntry.Range),
),
- Subject: &declRange,
+ Subject: declRange.Ptr(),
})
}
} | cmd/hclspecsuite: Generate correct ranges in diagnostic-diagnostics
We were taking a pointer to a for loop iterator variable and thus
capturing the final iteration value rather than each one separately. By
using the .Ptr() method instead, we force a copy of the range which we
then take a pointer to. | hashicorp_hcl | train | go |
3737098d4c18a971da865fe6e9f057aa305f1f41 | diff --git a/lxd/storage_volumes.go b/lxd/storage_volumes.go
index <HASH>..<HASH> 100644
--- a/lxd/storage_volumes.go
+++ b/lxd/storage_volumes.go
@@ -379,6 +379,10 @@ func storagePoolVolumeTypeDelete(d *Daemon, r *http.Request) Response {
return BadRequest(fmt.Errorf("invalid storage volume type %s", volumeTypeName))
}
+ if volumeType != storagePoolVolumeTypeCustom {
+ return BadRequest(fmt.Errorf("storage volumes of type \"%s\" cannot be deleted with the storage api", volumeTypeName))
+ }
+
volumeUsedBy, err := storagePoolVolumeUsedByGet(d, volumeName, volumeTypeName)
if err != nil {
return InternalError(err) | storage volumes: only delete custom volumes
We do currently not support deleting any other type of storage volume. | lxc_lxd | train | go |
5957f26d385993776260a03c6758c38fb05ce00a | diff --git a/web/app.js b/web/app.js
index <HASH>..<HASH> 100644
--- a/web/app.js
+++ b/web/app.js
@@ -89,10 +89,10 @@ function verify (req, app, payload) {
if (!app.remote) return
// check repo match
- console.log(JSON.stringify(payload))
+ payload.repository.links.html.href
var repo = payload.repository
- if (/bitbucket\.org/.test(payload.canon_url)) {
+ if (/bitbucket\.org/.test(repo.links.html.href)) {
console.log('\nreceived webhook request from: ' + payload.canon_url + repo.absolute_url)
} else {
console.log('\nreceived webhook request from: ' + repo.url) | Intermediate commit for bitbucket webhook support. | yyx990803_pod | train | js |
de58cb52ccac552aba25d0f9f4ec390fe96ae802 | diff --git a/elasticapm/processors.py b/elasticapm/processors.py
index <HASH>..<HASH> 100644
--- a/elasticapm/processors.py
+++ b/elasticapm/processors.py
@@ -204,7 +204,7 @@ def mark_in_app_frames(client, event):
if 'module' not in frame:
return
mod = frame['module']
- frame['in_app'] = bool(
+ frame['in_app'] = mod and bool(
any(mod.startswith(path + '.') or mod == path for path in include) and
not any(mod.startswith(path + '.') or mod == path for path in exclude)
)
diff --git a/tests/processors/tests.py b/tests/processors/tests.py
index <HASH>..<HASH> 100644
--- a/tests/processors/tests.py
+++ b/tests/processors/tests.py
@@ -212,6 +212,7 @@ def test_mark_in_app_frames():
{'module': 'foo.bar.baz'},
{'module': 'foobar'},
{'module': 'foo.bar.bazzinga'},
+ {'module': None},
]
}
}
@@ -225,3 +226,4 @@ def test_mark_in_app_frames():
assert not frames[2]['in_app']
assert not frames[3]['in_app']
assert frames[4]['in_app']
+ assert not frames[5]['in_app'] | frames can have `None` as module (e.g. in the Python shell) (#<I>) | elastic_apm-agent-python | train | py,py |
3bddb4902c51abb6cf319356f2bd06d2715fb747 | diff --git a/src/stackTools/fusionRenderer.js b/src/stackTools/fusionRenderer.js
index <HASH>..<HASH> 100644
--- a/src/stackTools/fusionRenderer.js
+++ b/src/stackTools/fusionRenderer.js
@@ -31,9 +31,9 @@ export default class FusionRenderer {
const currentLayerId = this.layerIds[0];
const layer = cornerstone.getLayer(element, currentLayerId);
- layer.image = image;
+ layer.image = Object.assign({}, image);
} else {
- const layerId = cornerstone.addLayer(element, image, baseImageObject.options);
+ const layerId = cornerstone.addLayer(element, Object.assign({}, image), baseImageObject.options);
this.layerIds.push(layerId);
}
@@ -58,9 +58,9 @@ export default class FusionRenderer {
const currentLayerId = this.layerIds[layerIndex];
const layer = cornerstone.getLayer(element, currentLayerId);
- layer.image = image;
+ layer.image = Object.assign({}, image);
} else {
- const layerId = cornerstone.addLayer(element, image, imgObj.options);
+ const layerId = cornerstone.addLayer(element, Object.assign({}, image), imgObj.options);
this.layerIds.push(layerId);
} | Feature/shallow copies of images in layers (#<I>)
* Use shallow copies of images in layers, to prevent the function convertImageToFalseColorImage() from altering original images.
* Object.assign() instead of $.extend() | cornerstonejs_cornerstoneTools | train | js |
198455632328b84bcdb92b69f8507e8026fc8632 | diff --git a/ui/src/shared/components/RefreshingGraph.js b/ui/src/shared/components/RefreshingGraph.js
index <HASH>..<HASH> 100644
--- a/ui/src/shared/components/RefreshingGraph.js
+++ b/ui/src/shared/components/RefreshingGraph.js
@@ -29,7 +29,7 @@ const RefreshingGraph = ({
editQueryStatus,
grabDataForDownload,
}) => {
- if (preventLoad || !queries.length) {
+ if (!queries.length) {
return (
<div className="graph-empty">
<p data-test="data-explorer-no-results">
@@ -79,7 +79,7 @@ const RefreshingGraph = ({
axes={axes}
colors={colors}
onZoom={onZoom}
- queries={queries}
+ queries={preventLoad ? [] : queries}
key={manualRefresh}
templates={templates}
timeRange={timeRange} | Prevent running of queries instead of unmounting graph component | influxdata_influxdb | train | js |
9397a9267ce171e305b4f3b2dbac7298cd338eb4 | diff --git a/lib/klam/compilation_stages/emit_ruby.rb b/lib/klam/compilation_stages/emit_ruby.rb
index <HASH>..<HASH> 100644
--- a/lib/klam/compilation_stages/emit_ruby.rb
+++ b/lib/klam/compilation_stages/emit_ruby.rb
@@ -150,13 +150,8 @@ module Klam
apply_handler_rb = emit_application([handler, err_var])
err_var_rb = emit_ruby(err_var)
- render_string(<<-EOT, err_var_rb, expr_rb, apply_handler_rb)
- begin
- $2
- rescue => $1
- $3
- end
- EOT
+ render_string('(begin; $2; rescue => $1; $3; end)', err_var_rb,
+ expr_rb, apply_handler_rb)
end
# Escape single quotes and backslashes
diff --git a/spec/functional/primitives/error_handling_spec.rb b/spec/functional/primitives/error_handling_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/functional/primitives/error_handling_spec.rb
+++ b/spec/functional/primitives/error_handling_spec.rb
@@ -14,5 +14,9 @@ describe 'Error handling primitives', :type => :functional do
.to eq('oops!')
end
end
+
+ it 'may be used as an argument to another function' do
+ expect_kl('(+ (trap-error 2 error-to-string) 3)').to eq(5)
+ end
end
end | Fix bug when trap-error form was not top-level | gregspurrier_klam | train | rb,rb |
4873af1a822905d7a92603ecb6b8005a2d201628 | diff --git a/lib/connect.js b/lib/connect.js
index <HASH>..<HASH> 100644
--- a/lib/connect.js
+++ b/lib/connect.js
@@ -36,10 +36,10 @@ function poolConnect(ctx, db, config) {
resolve({
isFresh, client,
done: () => {
- client.removeListener('error', onError);
client.end = end;
done();
npm.events.disconnect(ctx, client);
+ client.removeListener('error', onError);
}
});
npm.events.connect(ctx, client, isFresh);
@@ -66,10 +66,10 @@ function directConnect(ctx, config) {
isFresh: true,
client,
done: () => {
- client.removeListener('error', onError);
client.end = end;
client.end();
npm.events.disconnect(ctx, client);
+ client.removeListener('error', onError);
}
});
npm.events.connect(ctx, client, true); | postpone removing the event listeners. | vitaly-t_pg-promise | train | js |
840ab3c309d4235d8005d5f3cf4555f04b14b3b7 | diff --git a/Selectable.php b/Selectable.php
index <HASH>..<HASH> 100644
--- a/Selectable.php
+++ b/Selectable.php
@@ -47,7 +47,7 @@ use yii\helpers\Html;
* ```php
* Selectable::begin([
* 'clientOptions' => [
- * 'filter' => 'my-selectable-item'
+ * 'filter' => 'my-selectable-item',
* 'tolerance' => 'touch',
* ],
* ]); | Missing comma in comment added. | yiisoft_yii2-jui | train | php |
b556cb3a58da23f77b811507ce22678ce492eab3 | diff --git a/pyiso.py b/pyiso.py
index <HASH>..<HASH> 100644
--- a/pyiso.py
+++ b/pyiso.py
@@ -3661,7 +3661,6 @@ class PyIso(object):
self.eltorito_boot_catalog = None
self.pvd.decrement_ptr_extent()
- self._reshuffle_extents()
# Search through the filesystem, looking for the file that matches the
# extent that the boot catalog lives at. | Get rid of an unnecessary reshuffle. | clalancette_pycdlib | train | py |
3af9c0b2763afe91addd69e483bac6e771815995 | diff --git a/mistune.py b/mistune.py
index <HASH>..<HASH> 100644
--- a/mistune.py
+++ b/mistune.py
@@ -893,6 +893,13 @@ class Markdown(object):
self.renderer = renderer
self.options = kwargs
+ if inline and callable(inline):
+ # assume it is a class
+ inline = inline(renderer, **kwargs)
+ if block and callable(block):
+ # assume it is a class
+ block = block(**kwargs)
+
self.inline = inline or InlineLexer(renderer, **kwargs)
self.block = block or BlockLexer(**kwargs)
diff --git a/tests/test.py b/tests/test.py
index <HASH>..<HASH> 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -97,7 +97,6 @@ def test_custom_lexer():
alt, link = text.split('|')
return '<a href="%s">%s</a>' % (link, alt)
- inline = MyInlineLexer(renderer=mistune.Renderer())
- markdown = mistune.Markdown(inline=inline)
+ markdown = mistune.Markdown(inline=MyInlineLexer)
ret = markdown('[[Link Text|Wiki Link]]')
assert '<a href' in ret | You can pass inline and block as a class to `Markdown`. | lepture_mistune | train | py,py |
81d764580cdc452e69a35764a7017cbd9da09a0a | diff --git a/examples/i18n/I18n.php b/examples/i18n/I18n.php
index <HASH>..<HASH> 100644
--- a/examples/i18n/I18n.php
+++ b/examples/i18n/I18n.php
@@ -6,7 +6,7 @@ class I18n extends Mustache {
public $name = 'Bob';
// Add a {{#__}} lambda for i18n
- public $__ = array(self, '__trans');
+ public $__ = array(__CLASS__, '__trans');
// A *very* small i18n dictionary :)
private $dictionary = array( | Fix undefined `self` in the i<I>n example. | bobthecow_mustache.php | train | php |
7b2265a920dc46a77f48a7d90b3fc1775f3b986b | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -280,8 +280,11 @@ class ReactPhoneInput extends React.Component {
});
}
- handleInputClick() {
+ handleInputClick(evt) {
this.setState({showDropDown: false});
+ if (this.props.onClick) {
+ this.props.onClick(evt)
+ }
}
handleFlagItemClick(country) { | events(onClick): forward onClick event to parent | razagill_react-phone-input | train | js |
a86787d732a6ebbe0b7a70f61cd74c1ef9d88bd9 | diff --git a/_examples/rest/main.go b/_examples/rest/main.go
index <HASH>..<HASH> 100644
--- a/_examples/rest/main.go
+++ b/_examples/rest/main.go
@@ -378,8 +378,6 @@ func (rd *ArticleResponse) Render(w http.ResponseWriter, r *http.Request) error
return nil
}
-type ArticleListResponse []*ArticleResponse
-
func NewArticleListResponse(articles []*Article) []render.Renderer {
list := []render.Renderer{}
for _, article := range articles { | drop unused type (#<I>) | go-chi_chi | train | go |
1d2a9c081f31ca5c6fbcd453799d37b52437b1ea | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -46,7 +46,7 @@ setup(
tests_require=[
'pytest',
'pytest-djangoapp',
- 'django',
+ 'django<4.0.0',
],
classifiers=[ | Pin down Django for tests (to support py <I> and <I>). | idlesign_uwsgiconf | train | py |
a2aec6f3831738982be413535e81af5c6ca57b3b | diff --git a/twitter/client.go b/twitter/client.go
index <HASH>..<HASH> 100644
--- a/twitter/client.go
+++ b/twitter/client.go
@@ -40,7 +40,8 @@ func (c *Client) Start() error {
}
c.stream = c.api.UserStream(v)
- c.handleStream()
+
+ go c.handleStream()
return nil
} | Make Client.Start start its own goroutine | erbridge_gotwit | train | go |
300a0bad05ae76375f4f61df4ec9fa0d8b23b1b7 | diff --git a/src/Command/Environment/EnvironmentPushCommand.php b/src/Command/Environment/EnvironmentPushCommand.php
index <HASH>..<HASH> 100644
--- a/src/Command/Environment/EnvironmentPushCommand.php
+++ b/src/Command/Environment/EnvironmentPushCommand.php
@@ -43,7 +43,7 @@ class EnvironmentPushCommand extends CommandBase
protected function execute(InputInterface $input, OutputInterface $output)
{
- $this->warnAboutDeprecatedOptions(['branch'], 'The option %s is deprecated and will be removed in future. Use --activate, which has the same effect.');
+ $this->warnAboutDeprecatedOptions(['branch'], 'The option --%s is deprecated and will be removed in future. Use --activate, which has the same effect.');
$this->validateInput($input, true);
$projectRoot = $this->getProjectRoot(); | Tweak deprecation method for the --branch option on the push command [skip changelog] | platformsh_platformsh-cli | train | php |
f679fa1ff6613000a67bddb778e9600cb6e1ef5a | diff --git a/plot.py b/plot.py
index <HASH>..<HASH> 100644
--- a/plot.py
+++ b/plot.py
@@ -48,4 +48,4 @@ def project_ellipsoid(ellipsoid,vecs):
def subplot_gridsize(num):
- return sorted(max([(x,int(np.ceil(num/x))) for x in range(1,int(np.floor(np.sqrt(num)))+1)],key=sum))
+ return sorted(min([(x,int(np.ceil(num/x))) for x in range(1,int(np.floor(np.sqrt(num)))+1)],key=sum)) | typo in subplot_gridsize made it trivial | mattjj_pyhsmm | train | py |
2295a903f5ecbf8732ee6e9a26f7bf183cfb70ab | diff --git a/src/Context/WorkflowContext.php b/src/Context/WorkflowContext.php
index <HASH>..<HASH> 100644
--- a/src/Context/WorkflowContext.php
+++ b/src/Context/WorkflowContext.php
@@ -140,7 +140,7 @@ class WorkflowContext extends ContextBase {
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
*/
- public function getWorkflows() {
+ private function getWorkflows() {
/** @var \Drupal\workflows\WorkflowInterface[] $workflows */
$workflows = $this->entityTypeManager()
->getStorage('workflow') | Tightened access on a workflow method. | acquia_drupal-spec-tool | train | php |
02039f0406954fad0666e464877fbd9633218a69 | diff --git a/src/pycd/__init__.py b/src/pycd/__init__.py
index <HASH>..<HASH> 100644
--- a/src/pycd/__init__.py
+++ b/src/pycd/__init__.py
@@ -1,6 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
+import os
+import sys
+
from .cli import *
from .package import *
from .__version__ import version as __version__
+
+
+# get current PYTHONPATH
+sys.path = os.getenv('PYTHONPATH').split(':') + sys.path | Get current PYTHONPATH in main() | wkentaro_pycd | train | py |
eed408e274f94acdcbbe6e874f8967577514e0f5 | diff --git a/lib/puppet/application/debugger.rb b/lib/puppet/application/debugger.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/application/debugger.rb
+++ b/lib/puppet/application/debugger.rb
@@ -201,7 +201,6 @@ class Puppet::Application::Debugger < Puppet::Application
# if this is a file we don't play back since its part of the environment
# if just the code we put in a file and use the play feature of the debugger
# we could do the same thing with the passed in manifest file but that might be too much code to show
-
if options[:code]
code_input = options.delete(:code)
file = Tempfile.new(['puppet_debugger_input', '.pp'])
@@ -221,7 +220,7 @@ class Puppet::Application::Debugger < Puppet::Application
raise "Could not find file #{manifest}" unless Puppet::FileSystem.exist?(manifest)
Puppet.warning("Only one file can be used per run. Skipping #{command_line.args.join(', ')}") unless command_line.args.empty?
- options[:play] = file
+ options[:play] = manifest
end
begin
if !options[:use_facterdb] && options[:node_name].nil? | Fix issue where puppet debugger command was not loading manifest | nwops_puppet-debugger | train | rb |
42dac6a5a0f5af92d5c31ba70b445d2506e003b3 | diff --git a/lib/codemirror.js b/lib/codemirror.js
index <HASH>..<HASH> 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -181,7 +181,8 @@ var CodeMirror = (function() {
else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
else if (option == "tabSize") updateDisplay(true);
else if (option == "keyMap") keyMapChanged();
- if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" || option == "theme") {
+ if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" ||
+ option == "theme" || option == "lineNumberFormatter") {
gutterChanged();
updateDisplay(true);
}
@@ -2633,7 +2634,8 @@ var CodeMirror = (function() {
col += tab.width;
} else {
col += 1;
- escaped += specials.test(ch) ? '<span class="cm-invalidchar" title="\\u' + ch.charCodeAt(0).toString(16) + '">\u2022</span>' : htmlEscape(ch);
+ escaped += specials.test(ch) ? '<span class="cm-invalidchar" title="\\u' + ch.charCodeAt(0).toString(16) +
+ '">\u2022</span>' : htmlEscape(ch);
}
}
} | Update gutter when lineNumberFormatter is changed | codemirror_CodeMirror | train | js |
1e3549223050e126a421abad5b48df4bed389eab | diff --git a/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java b/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java
index <HASH>..<HASH> 100644
--- a/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java
+++ b/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java
@@ -333,10 +333,9 @@ public class RaftServiceContext implements ServiceContext {
* @param eventIndex The session event index.
*/
public boolean keepAlive(long index, long timestamp, RaftSession session, long commandSequence, long eventIndex) {
- // If the service has been deleted then throw an unknown service exception.
+ // If the service has been deleted, just return false to ignore the keep-alive.
if (deleted) {
- log.warn("Service {} has been deleted by another process", serviceName);
- throw new RaftException.UnknownService("Service " + serviceName + " has been deleted");
+ return false;
}
// Update the state machine index/timestamp. | Ignore keep-alives for deleted Raft services. | atomix_atomix | train | java |
1eacff9d1795ffbdac3a9e0f6cb694f9a31b23f9 | diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py
index <HASH>..<HASH> 100644
--- a/salt/utils/parsers.py
+++ b/salt/utils/parsers.py
@@ -1747,13 +1747,18 @@ class SaltCMDOptionParser(six.with_metaclass(OptionParserMeta,
if len(self.config['fun']) != len(self.config['arg']):
self.exit(42, 'Cannot execute compound command without '
'defining all arguments.\n')
+ # parse the args and kwargs before sending to the publish
+ # interface
+ for i in range(len(self.config['arg'])):
+ self.config['arg'][i] = salt.utils.args.parse_input(
+ self.config['arg'][i])
else:
self.config['fun'] = self.args[1]
self.config['arg'] = self.args[2:]
-
- # parse the args and kwargs before sending to the publish interface
- self.config['arg'] = \
- salt.utils.args.parse_input(self.config['arg'])
+ # parse the args and kwargs before sending to the publish
+ # interface
+ self.config['arg'] = \
+ salt.utils.args.parse_input(self.config['arg'])
except IndexError:
self.exit(42, '\nIncomplete options passed.\n\n') | Bugfix: Kwargs is not correctly parsed when using multi-function jobs
The problem was that in multi-function jobs, 'arg' has an embedded
set of lists. salt.utils.args.parse_input() is not aware of this
embedded set of lists and hence will not correctly parse out the
kwargs (convert it from a string to the proper data types). The
solution is that for each embedded list, call
salt.utils.args.parse_input() separately. | saltstack_salt | train | py |
6e119c7a6dadb7117e61c6c9aa9b988156113453 | diff --git a/partpy/sourcestring.py b/partpy/sourcestring.py
index <HASH>..<HASH> 100644
--- a/partpy/sourcestring.py
+++ b/partpy/sourcestring.py
@@ -466,7 +466,7 @@ class SourceString(object):
Back specifies the amount of lines to look back for a none whitespace
line.
"""
- if not self.has_space(offset=offset):
+ if not self.has_space():
return 0
lines = self.get_surrounding_lines(back, 0)
@@ -481,7 +481,7 @@ class SourceString(object):
Back specifies the amount of lines to look back for a none whitespace
line.
"""
- if not self.has_space(offset=offset):
+ if not self.has_space():
return 0
lines = self.get_surrounding_lines(back, 0) | Removed missing offset check from two count indenters | Nekroze_partpy | train | py |
caafe5cea6330f7ff9608ae7ac8a94470b2ea889 | diff --git a/vuebar.js b/vuebar.js
index <HASH>..<HASH> 100644
--- a/vuebar.js
+++ b/vuebar.js
@@ -290,10 +290,10 @@
function preventParentScroll(el, event){
+ var state = getState(el);
if (state.visibleArea >= 1) {
return false;
}
- var state = getState(el);
var scrollDist = state.el2.scrollHeight - state.el2.clientHeight;
var scrollTop = state.el2.scrollTop; | Copy/Paste error
declare state before using it. | DominikSerafin_vuebar | train | js |
264251ec09ef7760cd801c3ff1171ba95e6560a2 | diff --git a/hibernate4-memcached-example/src/test/java/kr/pe/kwonnam/hibernate4memcached/example/ReadOnlyTest.java b/hibernate4-memcached-example/src/test/java/kr/pe/kwonnam/hibernate4memcached/example/ReadOnlyTest.java
index <HASH>..<HASH> 100644
--- a/hibernate4-memcached-example/src/test/java/kr/pe/kwonnam/hibernate4memcached/example/ReadOnlyTest.java
+++ b/hibernate4-memcached-example/src/test/java/kr/pe/kwonnam/hibernate4memcached/example/ReadOnlyTest.java
@@ -43,7 +43,7 @@ public class ReadOnlyTest {
em = EntityTestUtils.start();
transaction = em.getTransaction();
transaction.begin();
- log.debug("person 2 update.");
+ log.debug("person 2 delete.");
Person person2 = em.find(Person.class, newPerson.getId());
em.remove(person2);
transaction.commit(); | [hibernate4-memcached-5] READ_ONLY support - delete | kwon37xi_hibernate4-memcached | train | java |
1515e5c9eac5ab94a46ee6c4da155329894b97c6 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -59,6 +59,9 @@ var defaultsvgrConfig = {
},
{
removeUnknownsAndDefaults: false
+ },
+ {
+ convertColors: false
}
]
} | SVGO: don't convert colors to shorthand format
<URL> to #rrggbb, from #rrggbb to #rgb)" | kristerkari_react-native-svg-transformer | train | js |
6b28f11b5bdbab630a5b7ef99e88b107b4573289 | diff --git a/ssbio/pipeline/atlas.py b/ssbio/pipeline/atlas.py
index <HASH>..<HASH> 100644
--- a/ssbio/pipeline/atlas.py
+++ b/ssbio/pipeline/atlas.py
@@ -451,8 +451,7 @@ class ATLAS(Object):
# Otherwise, just mark the genes as non-functional
else:
for g in genes_to_remove:
- my_gene = strain_gempro.genes.get_by_id(g)
- my_gene.functional = False
+ strain_gempro.genes.get_by_id(g).functional = False
log.info('{}: marked {} genes as non functional'.format(strain_gempro.id, len(genes_to_remove)))
def _load_strain_sequences(self, strain_gempro): | Small ATLAS fixes, major update coming soon | SBRG_ssbio | train | py |
e341579a064212244109d81bd62543095d83f1d4 | diff --git a/turnstile/compactor.py b/turnstile/compactor.py
index <HASH>..<HASH> 100644
--- a/turnstile/compactor.py
+++ b/turnstile/compactor.py
@@ -406,7 +406,7 @@ def compact_bucket(db, buck_key, limit):
# Were we successful?
if result < 0:
# Insert failed; we'll try again when max_age is hit
- LOG.notice("Bucket compaction on %s failed; will retry" % buck_key)
+ LOG.warning("Bucket compaction on %s failed; will retry" % buck_key)
return
# OK, we have confirmed that the compacted bucket record has been | Use log level WARNING, since there is no NOTICE. | klmitch_turnstile | train | py |
f4531084e52fbb2bcd25bc4c0bde35be721e7f6c | diff --git a/cablemap.core/tests/test_reader_subject.py b/cablemap.core/tests/test_reader_subject.py
index <HASH>..<HASH> 100644
--- a/cablemap.core/tests/test_reader_subject.py
+++ b/cablemap.core/tests/test_reader_subject.py
@@ -238,6 +238,13 @@ SUBJECT: HRC: SPECIAL SESSION ON PALESTINE \
\
REF: A. A) BERN 1253''',
u'''HRC: SPECIAL SESSION ON PALESTINE \\ \\'''),
+ # 09CAIRO1945
+ (u'''
+SUBJECT:
+
+Cooperation and Coordination Busts Fraud Ring
+1.(SBU) Summary: The Cairo Fraud Prevention Unit''',
+ u'Cooperation and Coordination Busts Fraud Ring'),
)
diff --git a/cablemap.core/tests/test_utils_titlefy.py b/cablemap.core/tests/test_utils_titlefy.py
index <HASH>..<HASH> 100644
--- a/cablemap.core/tests/test_utils_titlefy.py
+++ b/cablemap.core/tests/test_utils_titlefy.py
@@ -131,6 +131,9 @@ _TEST_DATA = (
# 10MEXICO690
(u'Scenesetter for Ex-IM Chairman Fred Hochberg',
u'Scenesetter for Ex-IM Chairman Fred Hochberg'),
+ # 09SAOPAULO558
+ (u'WHAT HAPPENED TO THE PCC?',
+ u'What Happened to the PCC?'),
)
def test_titlefy(): | Added more (failing) tests | heuer_cablemap | train | py,py |
5698ef6ba4ae892a8c5bad79ce314a5ecac5a358 | diff --git a/holoviews/core/options.py b/holoviews/core/options.py
index <HASH>..<HASH> 100644
--- a/holoviews/core/options.py
+++ b/holoviews/core/options.py
@@ -397,6 +397,40 @@ class Channel(param.Parameterized):
operation=operation,
kwargs=kwargs)
+ def match_level(self, overlay):
+ """
+ Given an overlay, return an integer if there is a match or
+ None if there is no match.
+
+ The returned integer is the number of matching
+ components. Higher values indicate a stronger match.
+ """
+ level = 0
+ if len(self._pattern_spec) != len(overlay):
+ return None
+
+ for spec, el in zip(self._pattern_spec, overlay):
+ if spec[0] != type(el).__name__:
+ return None
+ level += 1 # Types match
+ if len(spec) > 2 and (spec[1] == el.value):
+ level += 1 # Values match
+ elif spec[1] != el.value:
+ return None
+ if len(spec) == 3 and (spec[2] == el.label):
+ level += 1 # Labels match
+ elif len(spec) == 3:
+ return None
+ return level
+
+
+ def apply(self, value, input_ranges):
+ """
+ Apply the channel operation on the input value using the given
+ input ranges.
+ """
+ return self.operation(value, input_ranges=input_ranges, **self.kwargs)
+
@classmethod
def _collapse(cls, overlay, pattern, fn, style_key): | Implemented match_level and apply methods on Channel objects | pyviz_holoviews | train | py |
7c0ff590c33b7152f5c9dc62798984cf0334588b | diff --git a/angr/functionmanager.py b/angr/functionmanager.py
index <HASH>..<HASH> 100644
--- a/angr/functionmanager.py
+++ b/angr/functionmanager.py
@@ -498,6 +498,10 @@ class Function(object):
def has_return(self):
return len(self._ret_sites) > 0
+ @property
+ def callable(self):
+ return self._function_manager.project.factory.callable(self._addr)
+
class FunctionManager(object):
'''
This is a function boundaries management tool. It takes in intermediate | Add a convenience method on function manager functions to get a callable out of them | angr_angr | train | py |
100929f35239b24852707ab00bdf1b60e0d9c7bd | diff --git a/tests/library/CM/PagingSource/MongoDbTest.php b/tests/library/CM/PagingSource/MongoDbTest.php
index <HASH>..<HASH> 100644
--- a/tests/library/CM/PagingSource/MongoDbTest.php
+++ b/tests/library/CM/PagingSource/MongoDbTest.php
@@ -132,8 +132,8 @@ class CM_PagingSource_MongoDbTest extends CMTest_TestCase {
$source = new CM_PagingSource_MongoDb('my-collection');
$this->assertSame(7, $source->getCount());
- $this->assertSame(4, $source->getCount(3, 2));
- $this->assertSame(5, $source->getCount(2));
+ $this->assertSame(7, $source->getCount(3, 2));
+ $this->assertSame(7, $source->getCount(2));
}
public function testCaching() { | bugfix: count/offset should be ignored when counting items in a pagingSource | cargomedia_cm | train | php |
957fc72eb15a6de56bdd4960d4078fd917ab42ea | diff --git a/isso/js/app/api.js b/isso/js/app/api.js
index <HASH>..<HASH> 100644
--- a/isso/js/app/api.js
+++ b/isso/js/app/api.js
@@ -52,7 +52,9 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) {
}
if (xhr.status >= 500) {
- reject(xhr.body);
+ if (reject) {
+ reject(xhr.body);
+ }
} else {
resolve({status: xhr.status, body: xhr.responseText});
} | reject request if reject is actually defined, fix #<I> | posativ_isso | train | js |
f6f1d1e7f478e98cfc571306b9f5957bc6394f3f | diff --git a/src/Provider/ControllerServiceProvider.php b/src/Provider/ControllerServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/Provider/ControllerServiceProvider.php
+++ b/src/Provider/ControllerServiceProvider.php
@@ -67,6 +67,9 @@ class ControllerServiceProvider implements ServiceProviderInterface, EventSubscr
$app['controller.async.filesystem_manager'] = $app->share(function () {
return new Controller\Async\FilesystemManager();
});
+ $app['controller.async.records'] = $app->share(function () {
+ return new Controller\Async\Records();
+ });
$app['controller.async.stack'] = $app->share(function () {
return new Controller\Async\Stack();
});
@@ -133,6 +136,7 @@ class ControllerServiceProvider implements ServiceProviderInterface, EventSubscr
$asyncKeys = [
'general',
'filesystem_manager',
+ 'records',
'stack',
'system_checks',
]; | Add the Async\Records controller to the provider | bolt_bolt | train | php |
da2c00f60620fde61eac09cd8c6243fabb18f16c | diff --git a/lib/mlrest.js b/lib/mlrest.js
index <HASH>..<HASH> 100644
--- a/lib/mlrest.js
+++ b/lib/mlrest.js
@@ -922,7 +922,7 @@ function dispatchData(data) {
}
}
function projectData(data, subdata, i) {
- if (i === subdata.length) {
+ if (i === subdata.length || valcheck.isNullOrUndefined(data)) {
return data;
} | collatoral bug discovered in fixing #<I> | marklogic_node-client-api | train | js |
8b6ceec67083f0cde82273d9a53f0a53c1b5026b | diff --git a/spec/factories/socializer_person_educations.rb b/spec/factories/socializer_person_educations.rb
index <HASH>..<HASH> 100644
--- a/spec/factories/socializer_person_educations.rb
+++ b/spec/factories/socializer_person_educations.rb
@@ -2,6 +2,11 @@
FactoryGirl.define do
factory :person_education, class: Socializer::PersonEducation do
+ school_name "Hard Knocks"
+ major_or_field_of_study "Slacking"
+ started_on Date.new(2012, 12, 3)
+ ended_on nil
+ current true
association :person, factory: :person
end
end | set additional values to the person educations factory | socializer_socializer | train | rb |
23e48a8ae37003d52a0fa194fa1cb5be519048e6 | diff --git a/server/Top.rb b/server/Top.rb
index <HASH>..<HASH> 100755
--- a/server/Top.rb
+++ b/server/Top.rb
@@ -112,6 +112,7 @@ class Top
# Publish Objects on the bus
@objects.each_value do |object|
+ next if object.proxy_iface.nil?
@service.export(Dbus_measure.new(object)) if object.is_a? Measure
@service.export(Dbus_actuator.new(object)) if object.is_a? Actuator
end | Test if an object is plugged before trying to export it on the bus | openplacos_openplacos | train | rb |
875307b996e4a388f497628cd5c42446d02449c3 | diff --git a/lib/rules/literal-compare-order.js b/lib/rules/literal-compare-order.js
index <HASH>..<HASH> 100644
--- a/lib/rules/literal-compare-order.js
+++ b/lib/rules/literal-compare-order.js
@@ -39,6 +39,10 @@ module.exports = {
}
function checkLiteralCompareOrder(args, compareActualFirst) {
+ if (args.length < 2) {
+ return;
+ }
+
if (compareActualFirst && args[0].type === "Literal" && args[1].type !== "Literal") {
context.report({
node: args[0],
diff --git a/tests/lib/rules/literal-compare-order.js b/tests/lib/rules/literal-compare-order.js
index <HASH>..<HASH> 100644
--- a/tests/lib/rules/literal-compare-order.js
+++ b/tests/lib/rules/literal-compare-order.js
@@ -33,6 +33,8 @@ ruleTester.run("literal-compare-order", rule, {
wrap("equal(variable, 'Literal', 'Message');"),
wrap("assert.equal(variable, 'Literal');"),
wrap("assert.equal(variable, 'Literal', 'Message');"),
+ wrap("equal();"), // avoid crash with missing arguments
+ wrap("equal(variable);"), // avoid crash with missing arguments
// strictEqual
wrap("strictEqual(variable, 'Literal');"), | Fix: crash when missing assert arguments in literal-compare-order rule (#<I>) | platinumazure_eslint-plugin-qunit | train | js,js |
2e9a3060cef4efae7a539f5591d6980b6a6fcdab | diff --git a/TYPO3.TYPO3CR/Classes/TYPO3/TYPO3CR/Domain/Model/Node.php b/TYPO3.TYPO3CR/Classes/TYPO3/TYPO3CR/Domain/Model/Node.php
index <HASH>..<HASH> 100644
--- a/TYPO3.TYPO3CR/Classes/TYPO3/TYPO3CR/Domain/Model/Node.php
+++ b/TYPO3.TYPO3CR/Classes/TYPO3/TYPO3CR/Domain/Model/Node.php
@@ -12,6 +12,7 @@ namespace TYPO3\TYPO3CR\Domain\Model;
* */
use TYPO3\Flow\Annotations as Flow;
+use TYPO3\Flow\Cache\CacheAwareInterface;
use TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository;
use TYPO3\TYPO3CR\Domain\Service\ContextInterface;
use TYPO3\TYPO3CR\Exception\NodeExistsException;
@@ -22,7 +23,7 @@ use TYPO3\TYPO3CR\Exception\NodeExistsException;
* @Flow\Scope("prototype")
* @api
*/
-class Node implements NodeInterface {
+class Node implements NodeInterface, CacheAwareInterface {
/**
* The NodeData entity this version is for.
@@ -1018,6 +1019,16 @@ class Node implements NodeInterface {
}
/**
+ * Returns a string which distinctly identifies this object and thus can be used as an identifier for cache entries
+ * related to this object.
+ *
+ * @return string
+ */
+ public function getCacheEntryIdentifier() {
+ return $this->getContextPath();
+ }
+
+ /**
* For debugging purposes, the node can be converted to a string.
*
* @return string | [TASK] Support "CacheAwareInterface" in Node
This change adds a method to Node which returns an identifier which can
be used for cache entries.
Change-Id: I<I>bca2f<I>a<I>d<I>de4e<I>d<I>e<I>
Releases: master
Reviewed-on: <URL> | neos_neos-development-collection | train | php |
5f6b5fc66de585689745e943df9f2689f452e574 | diff --git a/maya/core.py b/maya/core.py
index <HASH>..<HASH> 100644
--- a/maya/core.py
+++ b/maya/core.py
@@ -219,7 +219,7 @@ class MayaDT(object):
It's assumed to be from gmtime().
"""
- struct_time = time.mktime(struct) - utc_offset()
+ struct_time = time.mktime(struct) - utc_offset(struct)
dt = Datetime.fromtimestamp(struct_time, timezone)
return klass(klass.__dt_to_epoch(dt))
@@ -340,9 +340,20 @@ class MayaDT(object):
return humanize.naturaltime(dt)
-def utc_offset():
- """Returns the current local time offset from UTC accounting for DST """
- ts = time.localtime()
+def utc_offset(time_struct=None):
+ """
+ Returns the time offset from UTC accounting for DST
+
+ Keyword Arguments:
+ time_struct {time.struct_time} -- the struct time for which to
+ return the UTC offset.
+ If None, use current local time.
+ """
+ if time_struct:
+ ts = time_struct
+ else:
+ ts = time.localtime()
+
if ts[-1]:
offset = time.altzone
else: | Use UTC offset from given time struct when converting from time struct. Fixes #<I> | kennethreitz_maya | train | py |
4ab7d1ee9de204137a2955947425bd362fb484f3 | diff --git a/src/ChrisKonnertz/Jobs/Cache/CacheInterface.php b/src/ChrisKonnertz/Jobs/Cache/CacheInterface.php
index <HASH>..<HASH> 100644
--- a/src/ChrisKonnertz/Jobs/Cache/CacheInterface.php
+++ b/src/ChrisKonnertz/Jobs/Cache/CacheInterface.php
@@ -6,7 +6,7 @@ interface CacheInterface
{
/**
- * Returns true if an item with the given ke exists
+ * Returns true if an item with the given key exists, false otherwise
*
* @param string $key
* @return bool
@@ -14,7 +14,7 @@ interface CacheInterface
public function has($key);
/**
- * Stores an item with a given key in the cache without expiration
+ * Stores an item with a given key in the cache, without expiration
*
* @param string $key
* @param mixed $value | Fixed typo and enhanced comments a little bit | chriskonnertz_Jobs | train | php |
69c6f8cceff4fdb0a02f976cd58e1c760e4ce1be | diff --git a/Twig/Extension/EchoExtension.php b/Twig/Extension/EchoExtension.php
index <HASH>..<HASH> 100644
--- a/Twig/Extension/EchoExtension.php
+++ b/Twig/Extension/EchoExtension.php
@@ -61,6 +61,8 @@ class EchoExtension extends \Twig_Extension
*/
public function convertAsForm($options, $formType)
{
+ $options = preg_replace("/'__php\((.+)\)'/i", '$1', $options, -1, $count);
+
if ('collection' == $formType || 'upload' == $formType) {
preg_match("/'type' => '(.+?)'/i", $options, $matches); | Support to call php code on any form option
Adds support to call custom php code on any form option.
The code which should be executed has to be wrapped with __php(<<php code>>).
Example usage:
...
addFormOptions:
languages: __php($this->getLanguages())
type: __php(new \Foo\Bar\BazType)
... | symfony2admingenerator_AdmingeneratorGeneratorBundle | train | php |
bc24b7a91218ab34f10a145467f6ef380a5d22aa | diff --git a/core/types/block.go b/core/types/block.go
index <HASH>..<HASH> 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -381,7 +381,7 @@ func (b *Block) Hash() common.Hash {
if hash := b.hash.Load(); hash != nil {
return hash.(common.Hash)
}
- v := rlpHash(b.header)
+ v := b.header.Hash()
b.hash.Store(v)
return v
} | core/types: use Header.Hash for block hashes (#<I>)
Fixes #<I> | ethereum_go-ethereum | train | go |
fbafc0ad70a0dc3f4fbfc969100a85e3a516555f | diff --git a/spec/unit/provider/package/gem_spec.rb b/spec/unit/provider/package/gem_spec.rb
index <HASH>..<HASH> 100755
--- a/spec/unit/provider/package/gem_spec.rb
+++ b/spec/unit/provider/package/gem_spec.rb
@@ -48,8 +48,8 @@ describe provider_class do
provider.install
end
- it "should return install_options as nil by default" do
- provider.expects(:execute).with { |args| expect(args[5]).to be_nil }.returns ""
+ it "should not append install_options by default" do
+ provider.expects(:execute).with { |args| args.length == 5 }.returns ""
provider.install
end | (maint) Update gem provider spec for recent change.
The spec had an example which was expecting a nil
install_options by checking the 6th element in an array.
With the change to not append the install_options
unless specified, the example was passing but the
functionality no longer matched the example.
Changing the example to ensure 5 elements were
passed to execute instead of the previous 6. | puppetlabs_puppet | train | rb |
8781e4d7eb5a5186caff284a58eb667285c20668 | diff --git a/src/cbednarski/Pharcc/Compiler.php b/src/cbednarski/Pharcc/Compiler.php
index <HASH>..<HASH> 100644
--- a/src/cbednarski/Pharcc/Compiler.php
+++ b/src/cbednarski/Pharcc/Compiler.php
@@ -235,8 +235,10 @@ HEREDOC;
if (!Phar::canWrite()) {
throw new PharException(
'Unable to compile a phar because of php\'s security settings. '
- . 'phar.readonly must be disabled in php.ini. Details here: '
- . 'http://php.net/manual/en/phar.configuration.php');
+ . 'phar.readonly must be disabled in php.ini. ' . PHP_EOL . PHP_EOL
+ . 'You will need to edit ' . php_ini_loaded_file() . ' and add or set'
+ . PHP_EOL . PHP_EOL . " phar.readonly = Off" . PHP_EOL . PHP_EOL
+ . 'to continue. Details here: http://php.net/manual/en/phar.configuration.php');
}
} | Improved error messaging for case when phar.readonly is set in the ini file | cbednarski_pharcc | train | php |
ee8d2ab916ccca19091cd401638ca8e5f031e2ad | diff --git a/pygerduty/__init__.py b/pygerduty/__init__.py
index <HASH>..<HASH> 100755
--- a/pygerduty/__init__.py
+++ b/pygerduty/__init__.py
@@ -590,7 +590,7 @@ class PagerDuty(object):
response = self.execute_request(request)
if not response["status"] == "success":
- raise IntegrationAPIError(event_type, response["message"])
+ raise IntegrationAPIError(response["message"], event_type)
return response["incident_key"]
def resolve_incident(self, service_key, incident_key, | Fix bug of argument order when raising IntegrationAPIError
When raising an `IntegrationAPIError()` the parameters were reversed
in the method `PagerDuty.create_event()` | dropbox_pygerduty | train | py |
40e295ddf91bb746ac3f743d675c6117d183340d | diff --git a/plexapi/gdm.py b/plexapi/gdm.py
index <HASH>..<HASH> 100644
--- a/plexapi/gdm.py
+++ b/plexapi/gdm.py
@@ -23,12 +23,12 @@ class GDM:
"""Scan the network."""
self.update(scan_for_clients)
- def all(self):
+ def all(self, scan_for_clients=False):
"""Return all found entries.
Will scan for entries if not scanned recently.
"""
- self.scan()
+ self.scan(scan_for_clients)
return list(self.entries)
def find_by_content_type(self, value): | Allow scanning for clients when using GDM.all() | pkkid_python-plexapi | train | py |
fe8c9499ae90588728893ba593d5d9bad688c7cd | diff --git a/cipd/appengine/impl/repo/processing/reader.go b/cipd/appengine/impl/repo/processing/reader.go
index <HASH>..<HASH> 100644
--- a/cipd/appengine/impl/repo/processing/reader.go
+++ b/cipd/appengine/impl/repo/processing/reader.go
@@ -15,10 +15,11 @@
package processing
import (
- "archive/zip"
"io"
"math"
+ "github.com/klauspost/compress/zip"
+
"go.chromium.org/luci/common/errors"
) | [cipd] Switch to klauspost/compress on the backend.
It is already used by the client. It is supposedly faster
than the stdlib package.
R=<EMAIL>, <EMAIL>
Change-Id: Id0f<I>a<I>b<I>f<I>cf<I>e<I>d<I>bc<I>bf<I>
Reviewed-on: <URL> | luci_luci-go | train | go |
dcf3518c6968b2d6d5c4e365240259b18f255279 | diff --git a/src/__init__.py b/src/__init__.py
index <HASH>..<HASH> 100644
--- a/src/__init__.py
+++ b/src/__init__.py
@@ -14,7 +14,7 @@ author: Christopher O'Brien <siege@preoccupied.net>
"""
-DEBUG = 1
+DEBUG = 0
def debug(*args):
if DEBUG:
@@ -46,21 +46,32 @@ class JavaConstantPool(object):
debug("unpacking constant pool")
(count,), buff = _funpack(">H", buff)
+
+ # first item is never present in the actual data buffer, but
+ # the count number acts like it would be.
items = [None,]
+ count -= 1
+ # two const types will "consume" an item count, but no data
hackpass = False
- count -= 1
+
for i in xrange(0, count):
+
if hackpass:
+ # previous item was a long or double
hackpass = False
items.append(None)
+
else:
debug("unpacking const item %i of %i" % (i+1, count))
item, buff = _funpack_const_item(buff)
+ items.append(item)
+
+ # if this item was a long or double, skip the next
+ # counter.
if item[0] in (CONST_Long, CONST_Double):
hackpass = True
- items.append(item)
-
+
self.consts = tuple(items)
return buff | comments, and switch debug back off | obriencj_python-javatools | train | py |
507eaaf8c16690efdc009669a567c90af13db626 | diff --git a/tests/test_nudatus.py b/tests/test_nudatus.py
index <HASH>..<HASH> 100644
--- a/tests/test_nudatus.py
+++ b/tests/test_nudatus.py
@@ -41,7 +41,7 @@ def test_mangle_script():
script = f.read()
assert len(script) > 0
with open('tests/bigscript_mangled.py') as f:
- real_mangled = f.read().encode('utf-8')
+ real_mangled = f.read()
assert len(real_mangled) > 0
mangled = nudatus.mangle(script)
assert mangled == real_mangled | In tests, compare str to str, not str to bytes | ZanderBrown_nudatus | train | py |
6fcdeff94432092c64b5ddd7131a7da742b197a0 | diff --git a/tasktiger/worker.py b/tasktiger/worker.py
index <HASH>..<HASH> 100644
--- a/tasktiger/worker.py
+++ b/tasktiger/worker.py
@@ -622,8 +622,13 @@ class Worker(object):
except KeyboardInterrupt:
pass
- if self.stats_thread:
- self.stats_thread.stop()
- self.stats_thread = None
+ except Exception as e:
+ self.log.exception()
+ raise
+
+ finally:
+ if self.stats_thread:
+ self.stats_thread.stop()
+ self.stats_thread = None
- self.log.info('done')
+ self.log.info('done') | Log exceptions in main process, and properly shut down if there is an exception. | closeio_tasktiger | train | py |
6fd6c132182fbd8284f9aabdcee7fb5f02dd1c9f | diff --git a/pyy/web/routing.py b/pyy/web/routing.py
index <HASH>..<HASH> 100644
--- a/pyy/web/routing.py
+++ b/pyy/web/routing.py
@@ -14,6 +14,18 @@ def post(regex):
return func
return inner
+def put(regex):
+ def inner(func):
+ _routes.append(regex_router(func, regex, 'PUT'))
+ return func
+ return inner
+
+def delete(regex):
+ def inner(func):
+ _routes.append(regex_router(func, regex, 'DELETE'))
+ return func
+ return inner
+
def directory(root):
def inner(func):
_routes.append(directory_router(func, root)) | Add common HTTP verbs PUT and DELETE. | Knio_dominate | train | py |
09d39668fa0204a0fe05234dec30ca466f10db0e | diff --git a/packages/postcss-merge-rules/test.js b/packages/postcss-merge-rules/test.js
index <HASH>..<HASH> 100644
--- a/packages/postcss-merge-rules/test.js
+++ b/packages/postcss-merge-rules/test.js
@@ -160,6 +160,10 @@ var tests = [{
fixture: 'h1{h2{}h3{}}',
expected: 'h1{h2,h3{}}'
}, {
+ message: 'should not throw on charset declarations',
+ fixture: '@charset "utf-8";@charset "utf-8";@charset "utf-8";h1{}h2{}',
+ expected: '@charset "utf-8";@charset "utf-8";@charset "utf-8";h1,h2{}'
+}, {
message: 'should not be responsible for deduping declarations when merging',
fixture: 'h1{display:block;display:block}h2{display:block;display:block}',
expected: 'h1,h2{display:block;display:block}' | Add test for charset declarations. | cssnano_cssnano | train | js |
3822614c9ec39e9796d13d4b762d50e1cb05abca | diff --git a/test/org/opencms/main/TestCmsSystemInfo.java b/test/org/opencms/main/TestCmsSystemInfo.java
index <HASH>..<HASH> 100644
--- a/test/org/opencms/main/TestCmsSystemInfo.java
+++ b/test/org/opencms/main/TestCmsSystemInfo.java
@@ -237,10 +237,10 @@ public class TestCmsSystemInfo extends OpenCmsTestCase {
assertNotNull("build.gitid not set", info.get("build.gitid"));
assertNotNull("build.gitbranch not set", info.get("build.gitbranch"));
- // the build system name is hard coded
- assertEquals("Jenkins CI", info.get("build.type")[0]);
// the git commit ID should be 7 chars long
assertTrue(info.get("build.gitid")[0].length() == 7);
+ // the build system name is hard coded
+ assertEquals("Jenkins CI", info.get("build.system")[0]);
} else {
fail("No valid version information for test cases found, version id is '"
+ OpenCms.getSystemInfo().getVersionId() | Corrected wrong property check in test case. | alkacon_opencms-core | train | java |
e7689992fa12b269ac71e0e301e6e2274946a019 | diff --git a/examples/subscribe/client.py b/examples/subscribe/client.py
index <HASH>..<HASH> 100644
--- a/examples/subscribe/client.py
+++ b/examples/subscribe/client.py
@@ -9,7 +9,7 @@ import aiosip
sip_config = {
'srv_host': '127.0.0.1',
'srv_port': 6000,
- 'realm': 'XXXXXX',
+ 'realm': 'example.net',
'user': 'subscriber',
'pwd': 'hunter2',
'local_host': '127.0.0.1',
diff --git a/examples/subscribe/server.py b/examples/subscribe/server.py
index <HASH>..<HASH> 100644
--- a/examples/subscribe/server.py
+++ b/examples/subscribe/server.py
@@ -6,11 +6,6 @@ import itertools
import aiosip
sip_config = {
- 'srv_host': 'xxxxxx',
- 'srv_port': '7000',
- 'realm': 'XXXXXX',
- 'user': 'YYYYYY',
- 'pwd': 'ZZZZZZ',
'local_ip': '127.0.0.1',
'local_port': 6000
} | Small cleanup in dict settings for subscribe example | Eyepea_aiosip | train | py,py |
4ca0a047fc5be7bb7b73067d1f9c0b2b9ea645d6 | diff --git a/lib/public_activity.rb b/lib/public_activity.rb
index <HASH>..<HASH> 100644
--- a/lib/public_activity.rb
+++ b/lib/public_activity.rb
@@ -44,6 +44,7 @@ module PublicActivity
module Model
extend ActiveSupport::Concern
included do
+ ::PublicActivity.config
include Trackable # associations by tracked
include Tracked
include Activist # optional associations by recipient|owner | initialize orm and config when including into models | chaps-io_public_activity | train | rb |
020224f1d4e62644047c73e26637d3b51f005c06 | diff --git a/go/coredns/plugin/pfdns/pfdns.go b/go/coredns/plugin/pfdns/pfdns.go
index <HASH>..<HASH> 100644
--- a/go/coredns/plugin/pfdns/pfdns.go
+++ b/go/coredns/plugin/pfdns/pfdns.go
@@ -189,7 +189,7 @@ func (pf *pfdns) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
switch ansb := ans.(type) {
case *dns.A:
for _, valeur := range v {
- if err := pf.SetPassthrough(ctx, "passthrough", ansb.A.String(), valeur, true); err != nil {
+ if err := pf.SetPassthrough(ctx, "passthrough", ansb.A.String(), valeur, false); err != nil {
log.LoggerWContext(ctx).Error(fmt.Sprintf("Not able to contact localhost for setPassthrough %s", err))
}
} | Sync domain passthrough on all cluster members | inverse-inc_packetfence | train | go |
6ef226bffa74f2bec1804f038921b730fbc3fdd4 | diff --git a/src/Storage/Field/Type/RepeaterType.php b/src/Storage/Field/Type/RepeaterType.php
index <HASH>..<HASH> 100644
--- a/src/Storage/Field/Type/RepeaterType.php
+++ b/src/Storage/Field/Type/RepeaterType.php
@@ -69,7 +69,7 @@ class RepeaterType extends FieldTypeBase
function ($query, $result, $id) use ($repo, $collection, $toDelete) {
foreach ($collection as $entity) {
$entity->content_id = $id;
- $repo->save($entity);
+ $repo->save($entity, $silenceEvents = true);
}
foreach ($toDelete as $entity) {
@@ -279,7 +279,7 @@ class RepeaterType extends FieldTypeBase
$queries->onResult(
function ($query, $result, $id) use ($repo, $fieldValue) {
if ($result === 1) {
- $repo->save($fieldValue);
+ $repo->save($fieldValue, $silenceEvents = true);
}
}
); | some more events need silencing for repeater collection updates | bolt_bolt | train | php |
cc9a43f4c0fa04698d32dc684e889f60bb3093b6 | diff --git a/src/Friday/Console/Command.php b/src/Friday/Console/Command.php
index <HASH>..<HASH> 100644
--- a/src/Friday/Console/Command.php
+++ b/src/Friday/Console/Command.php
@@ -42,16 +42,15 @@ class Command
*/
public function __construct($basePath = null)
{
-
$app = new \Friday\Foundation\Application(
$basePath
);
-
+
$this->argvInput = ($_SERVER['argv'][0] === "jarvis") ? array_slice($_SERVER['argv'], 1) : [] ;
-
- // get all commands
+
$this->commands = new \Friday\Console\Commands($app);
-
+ define('APP_INIT', microtime(true));
+
// run commands
if(count($this->argvInput)) {
$command = $this->argvInput[0];
@@ -66,6 +65,7 @@ class Command
else {
$this->commands->help();
}
+ define('CMD_RUN', microtime(true));
}
/** | time duration point added
- APP_INIT
- CMD_RUN | ironphp_ironphp | train | php |
620dee051032783bd6f6bd6ef67f39a06867f92b | diff --git a/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java b/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java
+++ b/src/main/java/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java
@@ -109,12 +109,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
@Override
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnvironment) {
- if ( roundEnvironment.processingOver() ) {
- if ( !context.isPersistenceUnitCompletelyXmlConfigured() ) {
- context.logMessage( Diagnostic.Kind.OTHER, "Last processing round." );
- createMetaModelClasses();
- context.logMessage( Diagnostic.Kind.OTHER, "Finished processing" );
- }
+ if ( roundEnvironment.processingOver() || annotations.size() == 0) {
return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
}
@@ -134,6 +129,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
}
}
+ createMetaModelClasses();
return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
} | METAGEN-<I> Refactored the process method to generate the metamodel after the first round
To make this work I have to add an additional check for annotations.size == 0. It seem there is on call to process just before the last round where this array is empty. | hibernate_hibernate-metamodelgen | train | java |
664bfa36c2fb1199284057adeb4181c6d5e79102 | diff --git a/lib/record_store/provider/ns1/patch_api_header.rb b/lib/record_store/provider/ns1/patch_api_header.rb
index <HASH>..<HASH> 100644
--- a/lib/record_store/provider/ns1/patch_api_header.rb
+++ b/lib/record_store/provider/ns1/patch_api_header.rb
@@ -4,9 +4,8 @@ require 'net/http'
module NS1::Transport
class NetHttp
def process_response(response)
- ratelimit = ['remaining', 'period']
- .map { |k| [k, response["x-ratelimit-#{k}"].to_i] }.to_h
- sleep(ratelimit['period'] / [1, ratelimit['remaining']].max.to_f)
+ sleep(response.to_hash["x-ratelimit-period"].first.to_i /
+ [1, response.to_hash["x-ratelimit-remaining"].first.to_i].max.to_f)
body = JSON.parse(response.body)
case response | Simplify 'process_response' method | Shopify_record_store | train | rb |
99926c293ceda98e0a0dd4da2363676fd5e081b1 | diff --git a/RAPIDpy/helper_functions.py b/RAPIDpy/helper_functions.py
index <HASH>..<HASH> 100644
--- a/RAPIDpy/helper_functions.py
+++ b/RAPIDpy/helper_functions.py
@@ -6,8 +6,7 @@
## Created by Alan D Snow, 2015.
## Copyright © 2015 Alan D Snow. All rights reserved.
##
-from csv import reader as csvreader
-from csv import writer as csvwriter
+import csv
from numpy import where, unique
from numpy.testing import assert_almost_equal
from numpy import array as np_array
@@ -25,10 +24,11 @@ def csv_to_list(csv_file, delimiter=','):
Reads in a CSV file and returns the contents as list,
where every row is stored as a sublist, and each element
in the sublist represents 1 cell in the table.
-
"""
with open(csv_file, 'rb') as csv_con:
- reader = csvreader(csv_con, delimiter=delimiter)
+ dialect = csv.Sniffer().sniff(csv_con.read(1024), delimiters=delimiter)
+ csv_con.seek(0)
+ reader = csv.reader(csv_con, dialect)
return list(reader)
def compare_csv_decimal_files(file1, file2, header=True): | made csv to list more robust | erdc_RAPIDpy | train | py |
54428fe01e7b8d38798773004065bd5388e6d228 | diff --git a/go/vt/vttablet/tabletmanager/vreplication/engine.go b/go/vt/vttablet/tabletmanager/vreplication/engine.go
index <HASH>..<HASH> 100644
--- a/go/vt/vttablet/tabletmanager/vreplication/engine.go
+++ b/go/vt/vttablet/tabletmanager/vreplication/engine.go
@@ -153,11 +153,7 @@ func (vre *Engine) InitDBConfig(dbcfgs *dbconfigs.DBConfigs) {
vre.dbName = dbcfgs.DBName
// Ensure the schema is created as early as possible
- go func() {
- vre.mu.Lock()
- defer vre.mu.Unlock()
- vre.Exec(warmUpQuery)
- }()
+ go vre.Exec(warmUpQuery)
}
// NewTestEngine creates a new Engine for testing. | whoops; mutex was already there | vitessio_vitess | train | go |
e54d059d64128151e8729c3788b593aaafb8c01a | diff --git a/mod/assign/submission/file/lang/en/assignsubmission_file.php b/mod/assign/submission/file/lang/en/assignsubmission_file.php
index <HASH>..<HASH> 100644
--- a/mod/assign/submission/file/lang/en/assignsubmission_file.php
+++ b/mod/assign/submission/file/lang/en/assignsubmission_file.php
@@ -24,7 +24,7 @@
$string['acceptedfiletypes'] = 'Accepted file types';
-$string['acceptedfiletypes_help'] = 'Accepted file types can be restricted by entering a comma-separated list of mimetypes, e.g. video/mp4, audio/mp3, image/png, image/jpeg, or file extensions including a dot, e.g. .png, .jpg. If the field is left empty, then all file types are allowed.';
+$string['acceptedfiletypes_help'] = 'Accepted file types can be restricted by entering a list of file extensions. If the field is left empty, then all file types are allowed.';
$string['configmaxbytes'] = 'Maximum file size';
$string['countfiles'] = '{$a} files';
$string['default'] = 'Enabled by default'; | MDL-<I> assignsubmission_file: Improve accepted filetypes help | moodle_moodle | train | php |
7f1586b401989e71a02cadf31bb2040953d5278d | diff --git a/src/Charcoal/User/AbstractUser.php b/src/Charcoal/User/AbstractUser.php
index <HASH>..<HASH> 100644
--- a/src/Charcoal/User/AbstractUser.php
+++ b/src/Charcoal/User/AbstractUser.php
@@ -55,11 +55,6 @@ abstract class AbstractUser extends Content implements
private $email;
/**
- * @var boolean
- */
- private $active = true;
-
- /**
* @var string[]
*/
private $roles = [];
@@ -182,23 +177,6 @@ abstract class AbstractUser extends Content implements
}
/**
- * @param boolean $active The active flag.
- * @return UserInterface Chainable
- */
- public function setActive($active)
- {
- $this->active = !!$active;
- return $this;
- }
- /**
- * @return boolean
- */
- public function active()
- {
- return $this->active;
- }
-
- /**
* @param string|string[]|null $roles The ACL roles this user belongs to.
* @throws InvalidArgumentException If the roles argument is invalid.
* @return AbstractUser Chainable | Remove active (provided by Content base class) | locomotivemtl_charcoal-user | train | php |
454b02313f9fa9fd1b12376f070870baa38991ea | diff --git a/lib/components/html.js b/lib/components/html.js
index <HASH>..<HASH> 100644
--- a/lib/components/html.js
+++ b/lib/components/html.js
@@ -1 +1,2 @@
-module.exports = require('./dist/esm/html');
+// eslint-disable-next-line import/no-unresolved
+export * from './dist/esm/html';
diff --git a/lib/router/utils.js b/lib/router/utils.js
index <HASH>..<HASH> 100644
--- a/lib/router/utils.js
+++ b/lib/router/utils.js
@@ -1 +1,2 @@
-module.exports = require('./dist/esm/utils');
+// eslint-disable-next-line import/no-unresolved
+export * from './dist/esm/utils';
diff --git a/lib/theming/create.js b/lib/theming/create.js
index <HASH>..<HASH> 100644
--- a/lib/theming/create.js
+++ b/lib/theming/create.js
@@ -1 +1,2 @@
-module.exports = require('./dist/esm/create');
+// eslint-disable-next-line import/no-unresolved
+export * from './dist/esm/create'; | Fix up entry points that actually don't work due to prebundling | storybooks_storybook | train | js,js,js |
0d6714906453274840adad726ca629a08d3f4f4c | diff --git a/canvasvg.py b/canvasvg.py
index <HASH>..<HASH> 100644
--- a/canvasvg.py
+++ b/canvasvg.py
@@ -84,6 +84,8 @@ def convert(document, canvas, items=None, tounicode=None):
# left state unchanged
assert options['state'] in ['normal', DISABLED, 'hidden']
+ # skip hidden items
+ if options['state'] == 'hidden': continue
def get(name, default=""):
if state == ACTIVE and options.get(state + name): | Skip disabled items.
Disabled items have no bounding box, which leads to an error.
By skipping the disabled items the error cannot occur. | WojciechMula_canvas2svg | train | py |
9bbaf60015091612f3b0acfed50fe6e1c466925a | diff --git a/libs/files.js b/libs/files.js
index <HASH>..<HASH> 100644
--- a/libs/files.js
+++ b/libs/files.js
@@ -171,11 +171,11 @@ export default {
return fs.statSync(path).isDirectory();
} catch (e) {
if (e.code === 'ENOENT') {
- return false;
+ return false;
} else {
- throw e;
+ throw e;
}
}
}
-};
\ No newline at end of file
+}; | Fix libs/files linting issue. | OpenNeuroOrg_openneuro | train | js |
a2d51ba8809ab15f3d3d84043732db42e9be54d9 | diff --git a/lib/eventslib.php b/lib/eventslib.php
index <HASH>..<HASH> 100755
--- a/lib/eventslib.php
+++ b/lib/eventslib.php
@@ -333,6 +333,7 @@ function events_dequeue($qhandler) {
* INTERNAL - to be used from eventslib only
*/
function events_get_handlers($eventname) {
+ global $DB;
static $handlers = array();
if ($eventname == 'reset') { | MDL-<I> Install fails again (missing global $DB) | moodle_moodle | train | php |
47e11da32e5bc4ba4735d72c812e391b710fdcc2 | diff --git a/lib/serve.js b/lib/serve.js
index <HASH>..<HASH> 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -21,6 +21,9 @@ module.exports = function() {
if (err && !path.extname(req.url))
return sendHtml(res)
+ if (err && req.url === '/favicon.ico')
+ return sendFavicon(res)
+
finalHandler(req, res)(err)
})
})
@@ -44,6 +47,11 @@ function sendHtml(res) {
res.end(html({ title: path.basename(config.cwd) }))
}
+function sendFavicon(res) {
+ res.statusCode = 404
+ res.end('Not Found')
+}
+
function html(options) {
return `<!DOCTYPE html>
<html> | Make ready for a wright favicon | porsager_wright | train | js |
84a0d5cde3f50f7ff0456d2fcd96b15f9b0f66c8 | diff --git a/src/js/utils.js b/src/js/utils.js
index <HASH>..<HASH> 100644
--- a/src/js/utils.js
+++ b/src/js/utils.js
@@ -162,11 +162,21 @@ export const bindEvents = (element, events) => {
* @param {Object} field
* @return {String} name
*/
-export const nameAttr = function(field) {
- const epoch = new Date().getTime()
- const prefix = field.type || hyphenCase(field.label)
- return prefix + '-' + epoch
-}
+export const nameAttr = (function() {
+ let lepoch
+ let counter = 0
+ return function(field) {
+ const epoch = new Date().getTime()
+ if (epoch === lepoch) {
+ ++counter
+ } else {
+ counter = 0
+ lepoch = epoch
+ }
+ const prefix = field.type || hyphenCase(field.label)
+ return prefix + '-' + epoch + '-' + counter
+ }
+})()
/**
* Determine content type | Add a per epoch counter to generate unique names
Fixes #<I> this is a proposed fix to ensure unique names are generated names for identical field types at the same epoch. A per epoch counter is implemented.
Changes: New elements now have a default value of prefix-epoch-counter starting from 0
I also investigated using performance.now(), however on Safari and Firefox the resolution for performance.now() is no greater than Date().getTime(). | kevinchappell_formBuilder | train | js |
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.