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
|
---|---|---|---|---|---|
cd9e3cea7bb59040db1f15330fee8306bc317c24 | diff --git a/lib/active_record/turntable/active_record_ext/association_preloader.rb b/lib/active_record/turntable/active_record_ext/association_preloader.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record/turntable/active_record_ext/association_preloader.rb
+++ b/lib/active_record/turntable/active_record_ext/association_preloader.rb
@@ -11,8 +11,8 @@ module ActiveRecord::Turntable
def records_for_with_turntable(ids)
returning_scope = records_for_without_turntable(ids)
- if should_use_shard_key? && owners_have_same_shard_key?
- returning_scope = returning_scope.where(klass.turntable_shard_key => owners.first.send(foreign_shard_key))
+ if should_use_shard_key?
+ returning_scope = returning_scope.where(klass.turntable_shard_key => owners.map(&foreign_shard_key).uniq)
end
returning_scope
end
@@ -32,10 +32,6 @@ module ActiveRecord::Turntable
klass.turntable_enabled? &&
model.turntable_shard_key == klass.turntable_shard_key
end
-
- def owners_have_same_shard_key?
- owners.map(&foreign_shard_key).uniq.size == 1
- end
end
end
end | Add all of owner's shard keys to specify shards when association preloading | drecom_activerecord-turntable | train | rb |
8dd2708e24423152ad0c71e7714e948547f7184e | diff --git a/src/parse.js b/src/parse.js
index <HASH>..<HASH> 100644
--- a/src/parse.js
+++ b/src/parse.js
@@ -117,7 +117,7 @@ parse.roles = function (conf, roles) {
parse.scope = function(scope) {
if (scope && scope.constructor === Array)
return scope;
- if (scope === undefined)
+ if (scope === undefined || scope === [])
return [];
return [scope];
}; | Accounted for case where scope is an empty array | SPANDigital_presidium-core | train | js |
70a8399e0dab0d9ee4c11959721e48e87ef261c0 | diff --git a/table/message.go b/table/message.go
index <HASH>..<HASH> 100644
--- a/table/message.go
+++ b/table/message.go
@@ -193,9 +193,14 @@ func CreateUpdateMsgFromPaths(pathList []*Path) []*bgp.BGPMessage {
var msgs []*bgp.BGPMessage
pathByAttrs := make(map[uint32][]*bucket)
-
+ pathLen := len(pathList)
for _, path := range pathList {
y := func(p *Path) bool {
+ // the merging logic makes gobgpd slower so if
+ // paths are not many, let's avoid mering.
+ if pathLen < 1024 {
+ return false
+ }
if p.GetRouteFamily() != bgp.RF_IPv4_UC {
return false
} | table: disable merging NLRIs if we don't have many NLRIs | osrg_gobgp | train | go |
cd3e2572cb5c29859a7bcbd9a1f5511961bae0c3 | diff --git a/lib/object/lazy_class.rb b/lib/object/lazy_class.rb
index <HASH>..<HASH> 100644
--- a/lib/object/lazy_class.rb
+++ b/lib/object/lazy_class.rb
@@ -2,10 +2,12 @@
module BBLib
class LazyClass
+ extend Hooks
+ extend Attr
- def initialize *args, **named
+ def initialize *args
lazy_setup
- lazy_init(*args, **named)
+ lazy_init(*args)
end
protected
@@ -14,19 +16,22 @@ module BBLib
# Instantiate necessary variables here
end
- def lazy_init *args, **named
- hash = named
- args.find_all{|a| a.is_a?(Hash)}.each{|a| hash.merge!(a)}
- hash.each do |k,v|
+ def _lazy_init *args
+ BBLib::named_args(*args).each do |k,v|
if self.respond_to?("#{k}=".to_sym)
send("#{k}=".to_sym, v)
end
end
- custom_lazy_init hash, *args
+ lazy_init *args
+ custom_lazy_init BBLib::named_args(*args), *args
end
- def custom_lazy_init hash, *args
- # Defined custom initialization here...
+ def lazy_init *args
+ # Define custom initialization here...
+ end
+
+ def custom_lazy_init *args
+ # Left in for legacy support...don't use this!
end
end | Added extends to the new Hooks and Attr modules. Modified the way lazy_init works. | bblack16_bblib-ruby | train | rb |
877bf722be7c3c5047ce004b32e91e09bf88a4ce | diff --git a/molo/commenting/migrations/0005_add_commenting_permissions_to_groups.py b/molo/commenting/migrations/0005_add_commenting_permissions_to_groups.py
index <HASH>..<HASH> 100644
--- a/molo/commenting/migrations/0005_add_commenting_permissions_to_groups.py
+++ b/molo/commenting/migrations/0005_add_commenting_permissions_to_groups.py
@@ -70,7 +70,7 @@ class Migration(migrations.Migration):
('core', '0047_add_core_permissions_to_groups'),
('contenttypes', '__latest__'),
('sites', '__latest__'),
- ('auth', '0009_alter_user_last_name_max_length.py'),
+ ('auth', '0008_alter_user_username_max_length'),
('wagtailcore', '__latest__'),
('wagtailadmin', '__latest__'),
('wagtailusers', '__latest__'), | reference correct migration on django auth | praekeltfoundation_molo.commenting | train | py |
3de056cdc223a80e0a78d6102c3eb1c2c6a2ce05 | diff --git a/tests/MethodSignatureTest.php b/tests/MethodSignatureTest.php
index <HASH>..<HASH> 100644
--- a/tests/MethodSignatureTest.php
+++ b/tests/MethodSignatureTest.php
@@ -573,11 +573,6 @@ class MethodSignatureTest extends TestCase
}
}',
],
- 'mysqliRealConnectMethodAllowsNullParameters' => [
- '<?php
- $mysqli = mysqli_init();
- $mysqli->real_connect(null, \'test\', null);',
- ],
];
} | Remove test that’s a bit broken | vimeo_psalm | train | php |
43eff0afb428c834c7a95fe380c9a6a7ff127330 | diff --git a/spec/unit/middleware/authentication_spec.rb b/spec/unit/middleware/authentication_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/middleware/authentication_spec.rb
+++ b/spec/unit/middleware/authentication_spec.rb
@@ -39,7 +39,10 @@ describe Restforce::Middleware::Authentication do
subject(:connection) { middleware.connection }
its(:url_prefix) { should eq(URI.parse('https://login.salesforce.com')) }
- its(:proxy) { should eq({ :uri => URI.parse('https://not-a-real-site.com') }) }
+
+ it "should have a proxy URI" do
+ connection.proxy[:uri].should eq(URI.parse('https://not-a-real-site.com'))
+ end
describe '.builder' do
subject(:builder) { connection.builder } | Fix Proxy test for all current Faraday versions | restforce_restforce | train | rb |
4f5b2ba20e980def4d14fd399fad3b06d640839f | diff --git a/src/main/java/org/dasein/cloud/openstack/nova/os/AbstractMethod.java b/src/main/java/org/dasein/cloud/openstack/nova/os/AbstractMethod.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/dasein/cloud/openstack/nova/os/AbstractMethod.java
+++ b/src/main/java/org/dasein/cloud/openstack/nova/os/AbstractMethod.java
@@ -1161,7 +1161,7 @@ public abstract class AbstractMethod {
throw new NovaException(items);
}
else {
- std.error("Expected OK for GET request, got " + code);
+ std.info("Expected OK for GET request, got " + code);
String data = null;
try {
@@ -2515,7 +2515,7 @@ public abstract class AbstractMethod {
}
private @Nonnull String toAPIResource(@Nonnull String resource) {
- if( resource.equals("/") || resource.length() < 2 ) {
+ if( resource == null || resource.equals("/") || resource.length() < 2 ) {
return resource;
}
while( resource.startsWith("/") ) { | fixed NPE and incorrect logging level | dasein-cloud_dasein-cloud-openstack | train | java |
8dcd7dde98107b2e2bff32f2359db3e2b71a60ef | diff --git a/properties/basic.py b/properties/basic.py
index <HASH>..<HASH> 100644
--- a/properties/basic.py
+++ b/properties/basic.py
@@ -576,12 +576,15 @@ class StringChoice(Property):
if isinstance(value, (set, list, tuple)):
if len(value) != len(set(value)):
raise TypeError("'choices' must contain no duplicate strings")
- self._choices = {v: v for v in value}
+ self._choices = {v: [] for v in value}
return
if not isinstance(value, dict):
raise TypeError("'choices' must be a set, list, tuple, or dict")
for key, val in value.items():
- value[key] = list(val)
+ if isinstance(val, (set, list, tuple)):
+ value[key] = list(val)
+ else:
+ value[key] = [val]
all_items = []
for key, val in value.items():
if not isinstance(key, string_types): | Improvements to how StringChoice choices are coerced | seequent_properties | train | py |
15152124d8f7ea9377c0dde6bcec5ecde7981a8d | diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java
index <HASH>..<HASH> 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java
@@ -526,6 +526,11 @@ public class SessionOpProcessor extends AbstractEvalOpProcessor {
throw new IllegalStateException(String.format(
"Bytecode in request is not a recognized graph operation: %s", bytecode.toString()));
}
+ } else {
+ UnsupportedOperationException uoe = Graph.Exceptions.transactionsNotSupported();
+ context.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR)
+ .statusMessage(uoe.getMessage())
+ .statusAttributeException(uoe).create());
}
} | Throw exception if transaction attempted on non transaction supported graph | apache_tinkerpop | train | java |
176c7f336ce147441c5a0096775f31fca71fcdbe | diff --git a/tests/RegisterCardTest.php b/tests/RegisterCardTest.php
index <HASH>..<HASH> 100644
--- a/tests/RegisterCardTest.php
+++ b/tests/RegisterCardTest.php
@@ -33,14 +33,17 @@ class RegisterCardTest extends PaymentTests
public function testPaymentChangedAmount()
{
+ // When we try to change the amount
$registerCard = $this->getBuilder()
- ->setAttribute('amount', 100500)
+ ->setAttribute('amount', 1.01)
->build(ConfigHelper::getConfig());
$result = $registerCard->create();
AssertionHelper::assertSuccessfulPayment($result);
- $this->assertEquals(1.01, $result['amount']);
+
+ // The amount is set by the API
+ $this->assertEquals(2.00, $result['amount']);
}
public function testPaymentWithoutCurrency() | API value for Register is <I> | Judopay_Judo-PHP | train | php |
4060c7754103af3952bffb6a1d4671fb1367f25b | diff --git a/Lib/Network/Email/MandrillTransport.php b/Lib/Network/Email/MandrillTransport.php
index <HASH>..<HASH> 100644
--- a/Lib/Network/Email/MandrillTransport.php
+++ b/Lib/Network/Email/MandrillTransport.php
@@ -52,7 +52,7 @@ class MandrillTransport extends AbstractTransport {
'from_email' => $fromEmail,
'from_name' => $fromName,
'to' => array(),
- 'headers' => array('Reply-To' => $fromEmail),
+ 'headers' => array('Reply-To' => $this->_cakeEmail->replyTo()),
'important' => false,
'track_opens' => null,
'track_clicks' => null, | Reply-to header
The reply-to header should probably be getting set to the reply-to header set in the CakeEmail object... | a2design-inc_Mandrill-CakePHP-plugin | train | php |
e4e65ca4707703077dd5c2798fdd796849a119c3 | diff --git a/app/models/foreman_ansible/ansible_provider.rb b/app/models/foreman_ansible/ansible_provider.rb
index <HASH>..<HASH> 100644
--- a/app/models/foreman_ansible/ansible_provider.rb
+++ b/app/models/foreman_ansible/ansible_provider.rb
@@ -38,6 +38,7 @@ if defined? ForemanRemoteExecution
def secrets(host)
{
+ :key_passphrase => Setting[:remote_execution_ssh_key_passphrase],
'per-host' => {
host.name => {
'ansible_password' => rex_ssh_password(host), | Refs #<I> - Support setting key passphrase through settings | theforeman_foreman_ansible | train | rb |
c15043317165481fb6a208877342eaeeda491e6d | diff --git a/core/src/main/java/com/orientechnologies/common/concur/lock/OReadersWriterSpinLock.java b/core/src/main/java/com/orientechnologies/common/concur/lock/OReadersWriterSpinLock.java
index <HASH>..<HASH> 100755
--- a/core/src/main/java/com/orientechnologies/common/concur/lock/OReadersWriterSpinLock.java
+++ b/core/src/main/java/com/orientechnologies/common/concur/lock/OReadersWriterSpinLock.java
@@ -96,7 +96,7 @@ public class OReadersWriterSpinLock extends AbstractOwnableSynchronizer {
final OModifiableInteger lHolds = lockHolds.get();
final int holds = lHolds.intValue();
if (holds > 1) {
- lockHolds.get().decrement();
+ lHolds.decrement();
return;
} else if (holds < 0) {
// write lock was acquired before, do nothing | double thread local access removed in OReadersWriterSpinLock#releaseReadLock, <I>-3k ops in MT loads | orientechnologies_orientdb | train | java |
bc07e1433a4cc815801a996362bd203c873c0bd0 | diff --git a/indra/assemblers/html/assembler.py b/indra/assemblers/html/assembler.py
index <HASH>..<HASH> 100644
--- a/indra/assemblers/html/assembler.py
+++ b/indra/assemblers/html/assembler.py
@@ -74,7 +74,8 @@ class HtmlAssembler(object):
rest_api_results=self.rest_api_results)
return self.model
- def format_evidence_text(self, stmt):
+ @staticmethod
+ def format_evidence_text(stmt):
"""Returns evidence metadata with highlighted evidence text.
Parameters | Make format_evidence_text into staticmethod | sorgerlab_indra | train | py |
67ffa99be135cbfe082197745d851967425089d1 | diff --git a/strgen/__init__.py b/strgen/__init__.py
index <HASH>..<HASH> 100644
--- a/strgen/__init__.py
+++ b/strgen/__init__.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
# Copyright (c) 2013-2020, Paul Wolf
# All rights reserved. | Remove encoding line at file start | paul-wolf_strgen | train | py |
6afde9644fb631c6e8328cc604df09982cd544e6 | diff --git a/spec/lib/data_magic_spec.rb b/spec/lib/data_magic_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/data_magic_spec.rb
+++ b/spec/lib/data_magic_spec.rb
@@ -31,7 +31,7 @@ describe DataMagic do
include DataMagic
end
data = UserPage.new.data_for "user/valid"
- expect(data.keys).to eq(['name', 'job'])
+ expect(data.keys.sort).to eq(['job','name'])
end
end
end | Fix failing <I> travis builds by sorting expected hash keys | cheezy_data_magic | train | rb |
74804ce737262bf65cc2799ed9da6423f219e61d | diff --git a/src/Naneau/SemVer/Version/Build.php b/src/Naneau/SemVer/Version/Build.php
index <HASH>..<HASH> 100644
--- a/src/Naneau/SemVer/Version/Build.php
+++ b/src/Naneau/SemVer/Version/Build.php
@@ -119,14 +119,25 @@ class Build
**/
public function __toString()
{
+ // If there are other parts
if (count($this->getParts()) > 0) {
- return implode('.', array(
- 'build.' . $this->getNumber(),
- implode('.', $this->getParts())
- ));
+ $parts = array('build');
+
+ // Add number if we have one
+ if ($this->getNumber() !== null) {
+ $parts[] = $this->getNumber();
+ }
+
+ $parts[] = implode('.', $this->getParts());
+
+ return implode('.', $parts);
+ }
+
+ // No number, no parts, no output.
+ if ($this->getNumber() === null) {
+ return '';
}
return 'build.' . $this->getNumber();
}
}
- | fixing bug when number is empty in build part | naneau_semver | train | php |
2d7019766d7e2be553e1b9fd1464ac0433a0f77a | diff --git a/lib/active_admin/arbre/builder.rb b/lib/active_admin/arbre/builder.rb
index <HASH>..<HASH> 100644
--- a/lib/active_admin/arbre/builder.rb
+++ b/lib/active_admin/arbre/builder.rb
@@ -109,7 +109,14 @@ module Arbre
end
def appendable_return_block?(tag)
- !tag.is_a?(Arbre::HTML::Element) && tag.respond_to?(:to_s) && !tag.blank?
+ appendable = !tag.is_a?(Arbre::HTML::Element) && tag.respond_to?(:to_s)
+
+ # Ruby 1.9 returns empty array as "[]"
+ if tag.respond_to?(:empty?) && tag.empty?
+ appendable = false
+ end
+
+ appendable
end
end | checking empty as to not add rails as dependency | activeadmin_activeadmin | train | rb |
aef766aa6c094c68db2164d88133fc64dfe85ed3 | diff --git a/Access/Gate.php b/Access/Gate.php
index <HASH>..<HASH> 100644
--- a/Access/Gate.php
+++ b/Access/Gate.php
@@ -126,6 +126,10 @@ class Gate implements GateContract
*/
public function define($ability, $callback)
{
+ if (is_array($callback) && isset($callback[0]) && is_string($callback[0])) {
+ $callback = $callback[0].'@'.$callback[1];
+ }
+
if (is_callable($callback)) {
$this->abilities[$ability] = $callback;
} elseif (is_string($callback)) { | allow array callback format with non-static methods | illuminate_auth | train | php |
e2ea29666db3d3ac1fb8359c5d30f02d07a1c733 | diff --git a/src/ContentBundle/Controller/Api/ContentController.php b/src/ContentBundle/Controller/Api/ContentController.php
index <HASH>..<HASH> 100644
--- a/src/ContentBundle/Controller/Api/ContentController.php
+++ b/src/ContentBundle/Controller/Api/ContentController.php
@@ -194,8 +194,8 @@ class ContentController extends Controller
$content = $repository->find($paramFetcher->get('content'));
$ids = [];
- if ($attributes = $paramFetcher->get('attributes') !== null) {
- foreach ($attributes as $attribute) {
+ if (null !== $paramFetcher->get('attributes')) {
+ foreach ($paramFetcher->get('attributes') as $attribute) {
/** @var OptionValue $value */
$value = $content->getValueSet()->get($attribute);
$ids = array_merge($ids, $value->getIds()); | Loop over the correct value instead of a boolean | Opifer_Cms | train | php |
9187cf5bf83753ff83c500d3d9d53224d74c03a6 | diff --git a/formats/folia.py b/formats/folia.py
index <HASH>..<HASH> 100644
--- a/formats/folia.py
+++ b/formats/folia.py
@@ -397,11 +397,14 @@ def makeelement(E, tagname, **kwargs):
if sys.version < '3':
try:
return E._makeelement(tagname.encode('utf-8'), **{ k.encode('utf-8'): v.encode('utf-8') for k,v in kwargs.items() } )
- except Exception as e:
- print(e,file=stderr)
- print("tagname=",tagname,file=stderr)
- print("kwargs=",kwargs,file=stderr)
- raise e
+ except ValueError as e:
+ try:
+ return E._makeelement(tagname,**kwargs)
+ except:
+ print(e,file=stderr)
+ print("tagname=",tagname,file=stderr)
+ print("kwargs=",kwargs,file=stderr)
+ raise e
else:
return E._makeelement(tagname,**kwargs) | different behaviour on different lxml versions? testing | proycon_pynlpl | train | py |
67b5e2e87e92fcb2952c7e3d5b6a46e835377450 | diff --git a/java/src/com/google/template/soy/jssrc/dsl/SoyJsPluginUtils.java b/java/src/com/google/template/soy/jssrc/dsl/SoyJsPluginUtils.java
index <HASH>..<HASH> 100644
--- a/java/src/com/google/template/soy/jssrc/dsl/SoyJsPluginUtils.java
+++ b/java/src/com/google/template/soy/jssrc/dsl/SoyJsPluginUtils.java
@@ -86,7 +86,6 @@ public final class SoyJsPluginUtils {
arg.collectRequires(collector);
if (!arg.isRepresentableAsSingleExpression()) {
isSingleExpr = false;
- break;
}
}
if (directive instanceof SoyLibraryAssistedJsSrcPrintDirective) { | Soy JS codegen: fix latent (unreported) goog.require bug.
Currently, SoyJsPluginUtils::applyDirective collects the symbols that need to be goog.require'd from the directive's arguments. But due to a spurious break statement, it stops collecting the symbols after the first arg that is not representable as a single expression.
-------------
Created by MOE: <URL> | google_closure-templates | train | java |
0d28beb7cbf45a1c33f0206f47dfd259840f552b | diff --git a/spec/sti-model/element_spec.rb b/spec/sti-model/element_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/sti-model/element_spec.rb
+++ b/spec/sti-model/element_spec.rb
@@ -119,4 +119,25 @@ describe Element do
end
+ describe "ranking by STI parent" do
+
+ before {
+ @elements[:helium].update_attribute :combination_order_position, :first
+ @elements[:chromium].update_attribute :combination_order_position, :first
+ }
+
+ describe "Element" do
+
+ subject { Element.rank(:combination_order) }
+
+ its(:size) { should == 5 }
+
+ its(:first) { should == @elements[:chromium] }
+
+ its(:second) { should == @elements[:helium] }
+
+ end
+
+ end
+
end | Failing spec for ranking by STI parent | mixonic_ranked-model | train | rb |
22a62931d39497b08f6e3e62ffdfc24b1193953e | diff --git a/glances/plugins/glances_cloud.py b/glances/plugins/glances_cloud.py
index <HASH>..<HASH> 100644
--- a/glances/plugins/glances_cloud.py
+++ b/glances/plugins/glances_cloud.py
@@ -147,7 +147,7 @@ class ThreadAwsEc2Grabber(threading.Thread):
for k, v in iteritems(self.AWS_EC2_API_METADATA):
r_url = '{}/{}'.format(self.AWS_EC2_API_URL, v)
try:
- r = requests.get(r_url)
+ r = requests.get(r_url)[1]
except Exception as e:
logger.debug('Can not connect to the AWS EC2 API {}'.format(r_url, e))
else: | Correct issue in the cloud plugin, do not retreive the good data in the API | nicolargo_glances | train | py |
51745e6261650658c48847e05dae1d38546856bd | diff --git a/lib/git-process/changed_file_helper.rb b/lib/git-process/changed_file_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/git-process/changed_file_helper.rb
+++ b/lib/git-process/changed_file_helper.rb
@@ -22,6 +22,8 @@ module GitProc
#noinspection RubyControlFlowConversionInspection,RubyClassMethodNamingConvention,RubyInstanceMethodNamingConvention
class ChangeFileHelper
+ attr_reader :gitlib
+
# @param [GitLib] gitlib
def initialize(gitlib)
@gitlib = gitlib
@@ -105,11 +107,6 @@ module GitProc
resp == 'c' ? :commit : :stash
end
-
- def gitlib
- @gitlib
- end
-
end
end
diff --git a/lib/git-process/sync_process.rb b/lib/git-process/sync_process.rb
index <HASH>..<HASH> 100644
--- a/lib/git-process/sync_process.rb
+++ b/lib/git-process/sync_process.rb
@@ -34,7 +34,7 @@ module GitProc
super
if not gitlib.status.clean?
- change_file_helper.offer_to_help_uncommitted_changes
+ GitProc::ChangeFileHelper.new(gitlib).offer_to_help_uncommitted_changes
end
raise ParkedChangesError.new(self) if gitlib.is_parked? | Unknown variable for handling uncommited changes for sync.
Resolves GH-<I> | jdigger_git-process | train | rb,rb |
35982bd27da911c6daaeeb452156b706afa48ae7 | diff --git a/test/file_reload_test.go b/test/file_reload_test.go
index <HASH>..<HASH> 100644
--- a/test/file_reload_test.go
+++ b/test/file_reload_test.go
@@ -5,8 +5,8 @@ import (
"testing"
"time"
- "github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/plugin/file"
+ "github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
) | Fix unsorted imports (#<I>)
Imports should be sorted by Go coding convention | coredns_coredns | train | go |
593abe95c42ebec8d2d2e9786919c9ebcb8a8656 | diff --git a/docs/source/conf.py b/docs/source/conf.py
index <HASH>..<HASH> 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -12,7 +12,11 @@
#
import os
import sys
-sys.path.insert(0, os.path.abspath('../src'))
+import inspect
+
+__location__ = os.path.join(os.getcwd(), os.path.dirname(
+ inspect.getfile(inspect.currentframe())))
+sys.path.insert(0, os.path.join(__location__, '../src'))
# -- Project information ----------------------------------------------------- | use inspect to find conf.py path :-/ (borrowed from pyscaffold) | biocommons_bioutils | train | py |
975a00e7a093f903ebfcf91c27bf10978c4abb77 | diff --git a/lib/rufus/scheduler/zotime.rb b/lib/rufus/scheduler/zotime.rb
index <HASH>..<HASH> 100644
--- a/lib/rufus/scheduler/zotime.rb
+++ b/lib/rufus/scheduler/zotime.rb
@@ -282,6 +282,7 @@ class Rufus::Scheduler
# ok, it's a timezone then
+ ostr = str
str = Time.now.zone if str == :current || str == :local
# utc_offset
@@ -344,6 +345,13 @@ class Rufus::Scheduler
) if hr
end
+ # last try with ENV['TZ']
+
+ z =
+ (ostr == :local || ostr == :current) &&
+ (::TZInfo::Timezone.get(ENV['TZ']) rescue nil)
+ return z if z
+
# so it's not a timezone.
nil | Fall back on ENV['TZ'] when unknown Time.now.zone
gh-<I> | jmettraux_rufus-scheduler | train | rb |
094dc311a250096daf0ea10362f82ffd4fe54cfc | diff --git a/angr/engines/soot/expressions/phi.py b/angr/engines/soot/expressions/phi.py
index <HASH>..<HASH> 100644
--- a/angr/engines/soot/expressions/phi.py
+++ b/angr/engines/soot/expressions/phi.py
@@ -8,18 +8,6 @@ l = logging.getLogger('angr.engines.soot.expressions.phi')
class SimSootExpr_Phi(SimSootExpr):
def _execute(self):
- locals_option = [self._translate_value(v) for v in self.expr.values]
- values = []
- for local in locals_option:
- value = self.state.memory.load(local, none_if_missing=True)
- if value is not None:
- values.append(value)
-
- if len(values) == 0:
- l.warning("Couldn't find a value of Phi expression in memory.")
- return
-
- if len(values) > 2:
- l.warning("Found multiple values of Phi expression in memory.")
-
- self.expr = values[-1]
+ local = [self._translate_value(v) for v, idx in self.expr.values if idx == self.state.scratch.source.block_idx][0]
+ value = self.state.memory.load(local, none_if_missing=True)
+ self.expr = value | SimSootExpr_Phi considers pred block | angr_angr | train | py |
073dbed4102726219d2bda9f435e64552db86233 | diff --git a/assertj-android/src/main/java/org/assertj/android/api/bluetooth/BluetoothGattCharacteristicPermissions.java b/assertj-android/src/main/java/org/assertj/android/api/bluetooth/BluetoothGattCharacteristicPermissions.java
index <HASH>..<HASH> 100644
--- a/assertj-android/src/main/java/org/assertj/android/api/bluetooth/BluetoothGattCharacteristicPermissions.java
+++ b/assertj-android/src/main/java/org/assertj/android/api/bluetooth/BluetoothGattCharacteristicPermissions.java
@@ -14,7 +14,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM,
BluetoothGattCharacteristic.PERMISSION_WRITE,
BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED,
- BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED_MITM,
+ BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED_MITM,
BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED,
BluetoothGattCharacteristic.PERMISSION_WRITE_SIGNED_MITM
} | Fix bluetooth characteristic intdef copy-paste typo.
PERMISSION_READ_ENCRYPTED_MITM was duplicated and
PERMISSION_WRITE_ENCRYPTED_MITM was missing.
Full list of available values:
<URL> | square_assertj-android | train | java |
b5e40e2b1a846e9599ecae195336901283592f85 | diff --git a/src/components/Tabs.js b/src/components/Tabs.js
index <HASH>..<HASH> 100644
--- a/src/components/Tabs.js
+++ b/src/components/Tabs.js
@@ -159,8 +159,8 @@ const Tabs = React.createClass({
padding: 5,
textTransform: 'uppercase',
- ':hover': {
- color: this._isLargeOrMediumWindowSize() ? StyleConstants.Colors.ASH : StyleConstants.Colors.CHARCOAL
+ ':hover': !this._isLargeOrMediumWindowSize() ? null : {
+ color: StyleConstants.Colors.ASH
}
},
menuWrapper: { | Display null for hover if it's not a largeOrMedium window size
Hover in mobile is triggered by clicking on or pressing on the element
which is not a behavior we want. | mxenabled_mx-react-components | train | js |
71ac255a97cd588deaedafe6d6beae0c79eb583a | diff --git a/lib/rules/rule.rb b/lib/rules/rule.rb
index <HASH>..<HASH> 100755
--- a/lib/rules/rule.rb
+++ b/lib/rules/rule.rb
@@ -28,11 +28,15 @@ module Rules
end
def lhs_parameter_key
- expression[:lhs_parameter_key].blank? ? nil : expression[:lhs_parameter_key]
+ key_from_store :lhs_parameter_key
end
def rhs_parameter_key
- expression[:rhs_parameter_key].blank? ? nil : expression[:rhs_parameter_key]
+ key_from_store :rhs_parameter_key
+ end
+
+ def evaluator_key
+ key_from_store :evaluator_key
end
def lhs_parameter_value(attributes = {})
@@ -73,6 +77,10 @@ module Rules
private
+ def key_from_store(key)
+ expression[key].blank? ? nil : expression[key]
+ end
+
def parameter_from_key(key)
if key
Parameters.constants[key] || valid_attributes[key] | Cleaner syntax for retrieving keys from store | azach_rules | train | rb |
e073df8007572ba26b175c0fb1153ba988b3c059 | diff --git a/packages/ringcentral-integration/modules/Conversations/index.js b/packages/ringcentral-integration/modules/Conversations/index.js
index <HASH>..<HASH> 100644
--- a/packages/ringcentral-integration/modules/Conversations/index.js
+++ b/packages/ringcentral-integration/modules/Conversations/index.js
@@ -160,10 +160,12 @@ export default class Conversations extends RcModule {
this._contactMatcher.triggerMatch();
}
} else if (this._lastConversaionList.length > this._messageStore.allConversations.length) {
- this.store.dispatch({
- type: this.actionTypes.cleanOldConversatioans
- });
this._lastConversaionList = this._messageStore.allConversations;
+ if (this.oldConversations.length) {
+ this.store.dispatch({
+ type: this.actionTypes.cleanOldConversatioans
+ });
+ }
}
}
@@ -205,6 +207,7 @@ export default class Conversations extends RcModule {
this.store.dispatch({
type: this.actionTypes.initSuccess,
});
+ this._lastConversaionList = this._messageStore.allConversations;
if (
this.allConversations.length <= this._perPage &&
this._enableLoadOldMessages && | fix: clean oldconversation (#<I>) | ringcentral_ringcentral-js-widgets | train | js |
ebecc95da43bbe09d6151161fedf815b9a32b417 | diff --git a/sshtunnel.py b/sshtunnel.py
index <HASH>..<HASH> 100644
--- a/sshtunnel.py
+++ b/sshtunnel.py
@@ -738,7 +738,9 @@ class SSHTunnelForwarder(object):
"""
skip_tunnel_checkup = True
+ # This option affects the `ForwardServer` and all his threads
daemon_forward_servers = _DAEMON #: flag tunnel threads in daemon mode
+ # This option affect only `Transport` thread
daemon_transport = _DAEMON #: flag SSH transport thread in daemon mode
def local_is_up(self, target):
@@ -1667,7 +1669,7 @@ def open_tunnel(*args, **kwargs):
ssh_port = kwargs.pop('ssh_port', 22)
skip_tunnel_checkup = kwargs.pop('skip_tunnel_checkup', True)
- block_on_close = kwargs.pop('block_on_close', _DAEMON)
+ block_on_close = kwargs.pop('block_on_close', None)
if block_on_close:
warnings.warn("'block_on_close' is DEPRECATED. You should use either"
" .stop() or .stop(force=True), depends on what you do" | sshtunnel: more comments for daemon options | pahaz_sshtunnel | train | py |
80535f916995517168e693970664d6c9a9087256 | diff --git a/examples/qt/example1_video.py b/examples/qt/example1_video.py
index <HASH>..<HASH> 100755
--- a/examples/qt/example1_video.py
+++ b/examples/qt/example1_video.py
@@ -20,7 +20,7 @@ Caveats:
2. Currently, it expects an AVI file as a command line parameter.
Only AVI formats supported by OpenCV can be used (typically JPEG encoded).
-Requirements:
+ Requirements:
To run this example you will need the OpenCV bindings for Python installed.
This module lets us access the video stream of an AVI file frame-by-frame.
@@ -178,7 +178,7 @@ class GingaVision(QtGui.QMainWindow):
# Get the frame rate
fps = cap.get(cv.CV_CAP_PROP_FPS)
if fps is not None:
- if not numpy.isnan(fps):
+ if not numpy.isnan(fps) and float(fps) >= 1.0:
self.logger.info("Video rate is %d fps" % (fps))
self.set_playback_rate(fps) | Workaround for a bug in OpenCV on mac os x
- frame rate is incorrectly reported (Issue<I>) | ejeschke_ginga | train | py |
9e6b5c3bbfbafacc6c8f0ea8de73f8403152669d | diff --git a/src/discoursegraphs/util.py b/src/discoursegraphs/util.py
index <HASH>..<HASH> 100644
--- a/src/discoursegraphs/util.py
+++ b/src/discoursegraphs/util.py
@@ -222,14 +222,18 @@ def create_dir(path):
raise
-def find_files(directory, pattern):
+def find_files(directory, pattern='*'):
"""
find files recursively, e.g. all *.txt files
in a given directory (or its subdirectories)
- source: http://stackoverflow.com/a/2186673
+ adapted from: http://stackoverflow.com/a/2186673
"""
- for root, dirs, files in os.walk(directory):
+ import os
+ import fnmatch
+
+ abspath = os.path.abspath(os.path.expanduser(directory))
+ for root, dirs, files in os.walk(abspath):
for basename in files:
if fnmatch.fnmatch(basename, pattern):
filename = os.path.join(root, basename) | made find_files more eror-prone
- expand ~/
- abspath
- default pattern: *
- inlined imports (for copy&paste-ability) | arne-cl_discoursegraphs | train | py |
53412fb25ac8008d7efd2bac899fcc87001f619f | diff --git a/lib/formtastic.rb b/lib/formtastic.rb
index <HASH>..<HASH> 100644
--- a/lib/formtastic.rb
+++ b/lib/formtastic.rb
@@ -14,7 +14,7 @@ module Formtastic #:nodoc:
@@required_string = proc { %{<abbr title="#{I18n.t 'formtastic.required', :default => 'required'}">*</abbr>} }
@@optional_string = ''
@@inline_errors = :sentence
- @@label_str_method = :titleize
+ @@label_str_method = :to_s
@@collection_label_methods = %w[to_label display_name full_name name title username login value to_s]
cattr_accessor :default_text_field_size, :all_fields_required_by_default, :required_string, :optional_string, :inline_errors, :label_str_method, :collection_label_methods | Since we are using human_attribute_name, @@label_str_method should has :to_s as default. This is needed because human_attribute_name already returns the string in a user readable and specified format. For example, when we set human_attribute_name to "E-mail", having :titleize as default would returns "E Mail" and "Confirm your password" as "Confirm Your Password". | justinfrench_formtastic | train | rb |
213000fd3d542726e9eb8dba919ff7dabcd0c664 | diff --git a/test/unit/vagrant/registry_test.rb b/test/unit/vagrant/registry_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/vagrant/registry_test.rb
+++ b/test/unit/vagrant/registry_test.rb
@@ -40,10 +40,10 @@ describe Vagrant::Registry do
instance["foo"].should eql(object)
end
-
+
it "should be able to get keys with #keys" do
instance.register("foo") { "bar" }
- instance.register("baz") { "qux" }
+ instance.register("baz") { raise "BOOM" }
instance.keys.sort.should == [ 'baz', 'foo' ]
end | core: update Registry tests to make sure #keys doesn't load | hashicorp_vagrant | train | rb |
9dbe4c2f53738556173fbcef171e7c26edc23041 | diff --git a/msg/messages.js b/msg/messages.js
index <HASH>..<HASH> 100644
--- a/msg/messages.js
+++ b/msg/messages.js
@@ -239,7 +239,11 @@ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
/// tooltip - Describes the 'else' subblock during [https://github.com/google/blockly/wiki/IfElse#block-modification if block modification].
Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP = 'Add a final, catch-all condition to the if block.';
-/// block text - See [https://github.com/google/blockly/wiki/IfElse https://github.com/google/blockly/wiki/IfElse]. The English word "otherwise" would probably be superior to "else", but the latter is used because it is traditional and shorter.
+/// block text - Evaluates a boolean condition (%1), and will either execute
+/// the statements in %2 if true, otherwise execute the statements in %3.
+/// The English word "otherwise" would probably be superior to "else", but the
+/// latter is used because it is traditional and shorter.
+/// See [https://github.com/google/blockly/wiki/IfElse#if-else-blocks https://github.com/google/blockly/wiki/IfElse#if-else-blocks].
Blockly.Msg.CONTROLS_IFELSE_TITLE = 'if %1 do %2 else %3';
/// url - Information about comparisons. | Clarify the translation comment for CONTROLS_IFELSE_TITLE, including parameter usage descriptions and more specific example link. | LLK_scratch-blocks | train | js |
e7f34e5e750325e009e57ffaf423afd697341794 | diff --git a/youtube/plugin.js b/youtube/plugin.js
index <HASH>..<HASH> 100755
--- a/youtube/plugin.js
+++ b/youtube/plugin.js
@@ -335,7 +335,7 @@ function handleLinkChange(el, api) {
if (el.getValue().length > 0) {
el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').disable();
}
- else {
+ else if (!disabled.length || !disabled.includes('txtEmbed')) {
el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').enable();
} | Proposed fix for Issue #<I>
A check is added before enabling the embed field, to check if its in the disabled list. | fonini_ckeditor-youtube-plugin | train | js |
5d86bc7f079b81ea430ac1e15a183868e8c658e3 | diff --git a/vc_zoom/indico_vc_zoom/util.py b/vc_zoom/indico_vc_zoom/util.py
index <HASH>..<HASH> 100644
--- a/vc_zoom/indico_vc_zoom/util.py
+++ b/vc_zoom/indico_vc_zoom/util.py
@@ -31,10 +31,11 @@ class ZoomMeetingType(int, IndicoEnum):
instant_meeting = 1
scheduled_meeting = 2
recurring_meeting_no_time = 3
- recurring_meeting_fixed_time = 4
+ recurring_meeting_fixed_time = 8
+ pmi_meeting = 4
webinar = 5
recurring_webinar_no_time = 6
- recurring_meeting_fixed_time = 9
+ recurring_webinar_fixed_time = 9
class UserLookupMode(unicode, RichEnum): | VC/Zoom: Fix meeting type enum | indico_indico-plugins | train | py |
3779795430de7c4228823642198c8310aa49e5d6 | diff --git a/lib/chunk2json.js b/lib/chunk2json.js
index <HASH>..<HASH> 100644
--- a/lib/chunk2json.js
+++ b/lib/chunk2json.js
@@ -65,11 +65,12 @@ Parser.prototype.consume = function(buffer){
Parser.prototype._extractJSON = function(){
var parser = this;
- parser._eventHandlers.json.forEach(function(cb){
- cb(new Buffer(parser.jsonByteStream));
- });
+ var jsonByteStream = parser.jsonByteStream;
parser.jsonByteStream = new Array();
parser.currentIndex = 0;
+ parser._eventHandlers.json.forEach(function(cb){
+ cb(new Buffer(jsonByteStream));
+ });
};
Parser.prototype.on = function(event, callback){ | lib/chunk2json.js: Now throws proper error upon incorrect use of 'consume' function call from withing 'json' callback. fixes #2 | jahnestacado_chunk2json | train | js |
a1cbece9188cb5a0f914bdd8bc7c5d6dca613e87 | diff --git a/blockstack_cli_0.14.1/blockstack_registrar/registrar/network.py b/blockstack_cli_0.14.1/blockstack_registrar/registrar/network.py
index <HASH>..<HASH> 100644
--- a/blockstack_cli_0.14.1/blockstack_registrar/registrar/network.py
+++ b/blockstack_cli_0.14.1/blockstack_registrar/registrar/network.py
@@ -30,6 +30,7 @@ from blockstore_client import client as bs_client
from .config import BLOCKSTORED_IP, BLOCKSTORED_PORT
from .config import DHT_MIRROR_IP, DHT_MIRROR_PORT
from .config import RESOLVER_URL, RESOLVER_USERS_ENDPOINT
+from .config import MAX_DHT_WRITE
from .utils import get_hash, config_log
from .utils import pretty_dump as pprint
@@ -75,7 +76,11 @@ def get_dht_profile(fqu):
if resp is None:
return None
- profile_hash = resp['value_hash']
+ try:
+ profile_hash = resp['value_hash']
+ except Exception as e:
+ log.debug(e)
+ return None
profile = None
@@ -98,6 +103,10 @@ def write_dht_profile(profile):
key = get_hash(profile)
value = json.dumps(profile, sort_keys=True)
+ if len(value) > MAX_DHT_WRITE:
+ log.debug("DHT value too large: %s, %s" % (key, len(value)))
+ return resp
+
log.debug("DHT write (%s, %s)" % (key, value))
try: | added checks for max dht write, and small bug fix | blockstack_blockstack-core | train | py |
9f9a4fa74688e5b8521f9bf163bdc35ea1f4ab46 | diff --git a/lxc/__init__.py b/lxc/__init__.py
index <HASH>..<HASH> 100644
--- a/lxc/__init__.py
+++ b/lxc/__init__.py
@@ -133,6 +133,7 @@ def all_as_dict():
continue
if c == 'FROZEN':
current = frozen
+ continue
if not len(c):
continue
current.append(c) | Added frozen support to all_as_dict | cloud9ers_pylxc | train | py |
90fa32faad13a0b4ab34620b242300f639c7849b | diff --git a/auth_backends/__init__.py b/auth_backends/__init__.py
index <HASH>..<HASH> 100644
--- a/auth_backends/__init__.py
+++ b/auth_backends/__init__.py
@@ -3,4 +3,4 @@
These package is designed to be used primarily with Open edX Django projects, but should be compatible with non-edX
projects as well.
"""
-__version__ = '1.0.0' # pragma: no cover
+__version__ = '1.0.1' # pragma: no cover | Updated to version <I> | edx_auth-backends | train | py |
b1776f0fba57ae0c7146fd6271df3ff6ba1a5f48 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -1,11 +1,7 @@
(function() {
function buggy() {
- function detect() {
- var a = [0, 1];
- a.reverse();
- return a[0] === 0;
- }
- return detect() || detect();
+ var a = [1, 2];
+ return String(a) === String(a.reverse());
}
if(!buggy()) return;
Array.prototype._reverse = Array.prototype.reverse; | Simplify buggy detection
`toString()` is memorized for JSImmutableButterfly, so we can just test it. And the effect is local, so no need to call `reverse()` twice to recover. | fanmingfei_array-reverse-ios12 | train | js |
b9cd0caa7c91127d48a7a920436b340e0b4e912e | diff --git a/pkg/minikube/out/out.go b/pkg/minikube/out/out.go
index <HASH>..<HASH> 100644
--- a/pkg/minikube/out/out.go
+++ b/pkg/minikube/out/out.go
@@ -95,7 +95,7 @@ func String(format string, a ...interface{}) {
// Ln writes a basic formatted string with a newline to stdout
func Ln(format string, a ...interface{}) {
if JSON {
- register.PrintStep(format + "\n")
+ glog.Warningf("please use out.T to log steps in JSON")
return
}
String(format+"\n", a...) | only out.T should be used to convert steps to JSON | kubernetes_minikube | train | go |
8d8cd156ca8d270ef333a35d7ff45a489643ff9f | diff --git a/hacking/checks/except_checks.py b/hacking/checks/except_checks.py
index <HASH>..<HASH> 100644
--- a/hacking/checks/except_checks.py
+++ b/hacking/checks/except_checks.py
@@ -16,6 +16,8 @@ import re
from hacking import core
+RE_ASSERT_RAISES_EXCEPTION = re.compile(r"self\.assertRaises\(Exception[,\)]")
+
@core.flake8ext
def hacking_except_format(logical_line, physical_line, noqa):
@@ -51,5 +53,5 @@ def hacking_except_format_assert(logical_line, physical_line, noqa):
"""
if noqa:
return
- if re.match(r"self\.assertRaises\(Exception[,\)]", logical_line):
+ if RE_ASSERT_RAISES_EXCEPTION.search(logical_line):
yield 1, "H202: assertRaises Exception too broad" | Only compile regex for hacking_except_format once
Instead of using re.match which compiles the regex each time use
re.compile and re.search. A small scale timeit test shows this method
reduces the time needed by about <I>%.
Change-Id: I<I>a4c<I>ec9e<I>bb<I>bd9c<I>b<I> | openstack_hacking | train | py |
e852055f5ab1c9aabef4554def6990efc300303c | diff --git a/appinst/platforms/win32.py b/appinst/platforms/win32.py
index <HASH>..<HASH> 100644
--- a/appinst/platforms/win32.py
+++ b/appinst/platforms/win32.py
@@ -80,7 +80,7 @@ class Win32(object):
cmd_list = shortcut['cmd']
cmd = cmd_list[0]
if len(cmd_list) > 1:
- args = cmd_list[1:0]
+ args = cmd_list[1:]
else:
args = [] | * Fixed stupid typo that broke EPD post-install. | ContinuumIO_menuinst | train | py |
254895747cfdbd4e693f3c26c97c1f49a55b1c0e | diff --git a/packages/transformers/html/src/dependencies.js b/packages/transformers/html/src/dependencies.js
index <HASH>..<HASH> 100644
--- a/packages/transformers/html/src/dependencies.js
+++ b/packages/transformers/html/src/dependencies.js
@@ -33,6 +33,7 @@ const ATTRS = {
// - http://ogp.me
// - https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/markup
// - https://msdn.microsoft.com/en-us/library/dn255024.aspx
+// - https://vk.com/dev/publications
const META = {
property: [
'og:image',
@@ -42,6 +43,7 @@ const META = {
'og:audio:secure_url',
'og:video',
'og:video:secure_url',
+ 'vk:image',
],
name: [
'twitter:image', | support vk:image (#<I>)
* support vk:image
* Update dependencies.js | parcel-bundler_parcel | train | js |
eff65f0fd480131f417d003bb792525caadd65a5 | diff --git a/repository/ws.php b/repository/ws.php
index <HASH>..<HASH> 100644
--- a/repository/ws.php
+++ b/repository/ws.php
@@ -166,7 +166,7 @@ EOD;
case 'search':
try {
$search_result = $repo->search($search_text);
- $search_result['search_result'] = 'test';
+ $search_result['search_result'] = true;
$search_result['client_id'] = $client_id;
$search_result['repo_id'] = $repo_id;
echo json_encode($search_result); | "Repository/MDL-<I>, search_result should be boolean value" | moodle_moodle | train | php |
e04959b9dbf725ba0b3e48b48a8c2a9f7015db03 | diff --git a/Lib/glyphsLib/builder.py b/Lib/glyphsLib/builder.py
index <HASH>..<HASH> 100644
--- a/Lib/glyphsLib/builder.py
+++ b/Lib/glyphsLib/builder.py
@@ -734,7 +734,21 @@ def load_glyph_libdata(glyph, layer):
value = getattr(layer, key)
except KeyError:
continue
- glyph.lib[GLYPHS_PREFIX + key] = value
+ if key == 'annotations':
+ annotations = []
+ for an in list(value.values()):
+ annot = {}
+ for attr in ['angle', 'position', 'text', 'type', 'width']:
+ val = getattr(an, attr, None)
+ if attr == 'position' and val:
+ val = list(val)
+ if val:
+ annot[attr] = val
+ annotations.append(annot)
+ value = annotations
+
+ if value:
+ glyph.lib[GLYPHS_PREFIX + key] = value
# data related to components stored in lists of booleans
# each list's elements correspond to the components in order | builder.py: annotations | googlefonts_glyphsLib | train | py |
bea8d1ba44e7ec5db3e29b6ed5459c1aaeb728ec | diff --git a/Tests/Command/ExplainAdminCommandTest.php b/Tests/Command/ExplainAdminCommandTest.php
index <HASH>..<HASH> 100644
--- a/Tests/Command/ExplainAdminCommandTest.php
+++ b/Tests/Command/ExplainAdminCommandTest.php
@@ -186,6 +186,7 @@ class ExplainAdminCommandTest extends \PHPUnit_Framework_TestCase
public function testExecute()
{
+ // NEXT_MAJOR: Remove check, when bumping requirements to SF 2.5+
if (interface_exists('Symfony\Component\Validator\Mapping\MetadataInterface')) { //sf2.5+
$metadata = $this->getMock('Symfony\Component\Validator\Mapping\MetadataInterface');
} else {
@@ -197,6 +198,7 @@ class ExplainAdminCommandTest extends \PHPUnit_Framework_TestCase
->with($this->equalTo('Acme\Entity\Foo'))
->will($this->returnValue($metadata));
+ // NEXT_MAJOR: Remove check, when bumping requirements to SF 2.5+
if (class_exists('Symfony\Component\Validator\Mapping\GenericMetadata')) {
$class = 'GenericMetadata';
} else { | added NEXT_MAJOR | sonata-project_SonataAdminBundle | train | php |
592f51d2a4e98d0f23998a32ab0fb4cfb04cd2a0 | diff --git a/AlphaTwirl/AlphaTwirl.py b/AlphaTwirl/AlphaTwirl.py
index <HASH>..<HASH> 100644
--- a/AlphaTwirl/AlphaTwirl.py
+++ b/AlphaTwirl/AlphaTwirl.py
@@ -79,7 +79,7 @@ def buildEventLoopRunner(progressMonitor, communicationChannel, processes):
if communicationChannel is None: # single process
eventLoopRunner = EventLoopRunner(progressMonitor)
else:
- eventLoopRunner = MPEventLoopRunner(processes, progressMonitor)
+ eventLoopRunner = MPEventLoopRunner(communicationChannel)
return eventLoopRunner
##__________________________________________________________________||
diff --git a/AlphaTwirl/EventReader/MPEventLoopRunner.py b/AlphaTwirl/EventReader/MPEventLoopRunner.py
index <HASH>..<HASH> 100755
--- a/AlphaTwirl/EventReader/MPEventLoopRunner.py
+++ b/AlphaTwirl/EventReader/MPEventLoopRunner.py
@@ -3,8 +3,8 @@ from CommunicationChannel import CommunicationChannel
##__________________________________________________________________||
class MPEventLoopRunner(object):
- def __init__(self, nprocesses = 16, progressMonitor = None):
- self.communicationChannel = CommunicationChannel(nprocesses, progressMonitor)
+ def __init__(self, communicationChannel):
+ self.communicationChannel = communicationChannel
self._ntasks = 0
def begin(self): | make MPEventLoopRunner receive CommunicationChannel instead of create it | alphatwirl_alphatwirl | train | py,py |
7206699cb30312c5df12cb1fe2b0bf95dfa74405 | diff --git a/Query/Grammars/Grammar.php b/Query/Grammars/Grammar.php
index <HASH>..<HASH> 100755
--- a/Query/Grammars/Grammar.php
+++ b/Query/Grammars/Grammar.php
@@ -131,8 +131,6 @@ class Grammar extends BaseGrammar
{
$sql = [];
- $query->setBindings([], 'join');
-
foreach ($joins as $join) {
$table = $this->wrapTable($join->table);
@@ -145,10 +143,6 @@ class Grammar extends BaseGrammar
$clauses[] = $this->compileJoinConstraint($clause);
}
- foreach ($join->bindings as $binding) {
- $query->addBinding($binding, 'join');
- }
-
// Once we have constructed the clauses, we'll need to take the boolean connector
// off of the first clause as it obviously will not be required on that clause
// because it leads the rest of the clauses, thus not requiring any boolean. | Don't manipulate bindings in query grammar | illuminate_database | train | php |
0475e6fb5c8b57dce2ab2a4544be7a292049ddb6 | diff --git a/static/lib/composer/resize.js b/static/lib/composer/resize.js
index <HASH>..<HASH> 100644
--- a/static/lib/composer/resize.js
+++ b/static/lib/composer/resize.js
@@ -74,6 +74,10 @@ define('composer/resize', [], function() {
resizeIt = function(postContainer, ratio) {
raf(function() {
doResize(postContainer, ratio);
+
+ setTimeout(function () {
+ $window.trigger('action:composer.resize');
+ }, 0);
});
};
} | Add composer.resize hook back in | NodeBB_nodebb-plugin-composer-default | train | js |
41f0e31835caef201731a18b08b561c5e001f69f | diff --git a/lib/godot/net/server.js b/lib/godot/net/server.js
index <HASH>..<HASH> 100644
--- a/lib/godot/net/server.js
+++ b/lib/godot/net/server.js
@@ -248,7 +248,7 @@ Server.prototype._onTcpSocket = function (socket) {
id = address + ':' + port,
parser = new JsonParser(),
self = this,
- reactor;
+ reactors;
if (!this.hosts[id]) {
this.createReactors(id); | [fix] minor typo in _onTcpSocket | nodejitsu_godot | train | js |
9eb0f97bc1eef360488d0ab42caae01c82e0aede | diff --git a/cumulusci/cli/cli.py b/cumulusci/cli/cli.py
index <HASH>..<HASH> 100644
--- a/cumulusci/cli/cli.py
+++ b/cumulusci/cli/cli.py
@@ -56,11 +56,14 @@ def dbm_cache():
context manager for accessing simple dbm cache
located at ~/.cumlusci/cache.dbm
"""
- db = dbm.open(os.path.join(
+ config_dir = os.path.join(
os.path.expanduser('~'),
YamlGlobalConfig.config_local_dir,
- 'cache.dbm'
- ), 'c',)
+
+ if not os.path.exists(config_dir):
+ os.mkdir(config_dir)
+
+ db = dbm.open(os.path.join(config_dir, 'cache.dbm'), 'c',)
yield db
db.close() | Create ~/.cumulusci if it doesn't exist when setting up dbm cache for
cli | SFDO-Tooling_CumulusCI | train | py |
6019b1308d4c513cb327f1e7c3f7ff86f258a217 | diff --git a/src/input/ContentEditableInput.js b/src/input/ContentEditableInput.js
index <HASH>..<HASH> 100644
--- a/src/input/ContentEditableInput.js
+++ b/src/input/ContentEditableInput.js
@@ -238,6 +238,10 @@ ContentEditableInput.prototype = copyObj({
let cm = this.cm, display = cm.display, sel = cm.doc.sel.primary()
let from = sel.from(), to = sel.to()
+ if (from.ch == 0 && from.line > cm.firstLine())
+ from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length)
+ if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
+ to = Pos(to.line + 1, 0)
if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false
let fromIndex, fromLine, fromNode
@@ -258,6 +262,7 @@ ContentEditableInput.prototype = copyObj({
toNode = display.view[toIndex + 1].node.previousSibling
}
+ if (!fromNode) return false
let newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine))
let oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length))
while (newText.length > 1 && oldText.length > 1) { | [contenteditable input] Expand scanned range when selection at start/end of line
So that the code doesn't get confused when backspacing or
deleting across a line.
This is still flaky. Ideally we'd capture backspace as a key event,
but Android Chrome makes that impossible.
Issue #<I> | codemirror_CodeMirror | train | js |
80fca2768ba71d53777fdb9f6f09f786953e5b0b | diff --git a/lib/class_kit/value_helper.rb b/lib/class_kit/value_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/class_kit/value_helper.rb
+++ b/lib/class_kit/value_helper.rb
@@ -17,16 +17,12 @@ module ClassKit
elsif type == Date
if value.is_a?(Date)
value
- elsif value.is_a?(Integer)
- Date.at(value)
else
Date.parse(value)
end
elsif type == DateTime
if value.is_a?(DateTime)
value
- elsif value.is_a?(Integer)
- DateTime.at(value)
else
DateTime.parse(value)
end | Remove broken code
The methods DateTime.at and Date.at do not exist. | Sage_class_kit | train | rb |
14f8b10dd458ba1c2bcc578629e82cd3dfdb3ef2 | diff --git a/pt/reminders.php b/pt/reminders.php
index <HASH>..<HASH> 100644
--- a/pt/reminders.php
+++ b/pt/reminders.php
@@ -12,12 +12,12 @@ return array(
| has failed, such as for an invalid token or invalid new password.
|
*/
- "password" => "A palavra passe deverá conter pelo menos seis carateres e ser igual à confirmação.",
+ "password" => "A palavra-passe deverá conter pelo menos seis carateres e ser igual à confirmação.",
- "user" => "Não conseguimos encontrar nenhum utilizador com o endereço de correio eletrónico indicado.",
+ "user" => "Não existe nenhum utilizador com o endereço de correio eletrónico indicado.",
- "token" => "Este código de recuperação da palavra chave é inválido.",
+ "token" => "Este código de recuperação da palavra-passe é inválido.",
- "sent" => "Password reminder sent!",
+ "sent" => "O lembrete para a palavra-passe foi enviado!",
); | Password reminder sent for portuguese | caouecs_Laravel-lang | train | php |
8ae2047b48fcb6c8381d8b91c93ec531e4fd4075 | diff --git a/pyinstrument/renderers/speedscope.py b/pyinstrument/renderers/speedscope.py
index <HASH>..<HASH> 100644
--- a/pyinstrument/renderers/speedscope.py
+++ b/pyinstrument/renderers/speedscope.py
@@ -204,7 +204,7 @@ class SpeedscopeRenderer(Renderer):
profile_decls.append('"type": %s' % encode_str(profile_type))
profile_name: str = session.program
- profile_decls.append('"name": %s' % encode_str(session.program))
+ profile_decls.append('"name": %s' % encode_str(profile_name))
unit: str = "seconds"
profile_decls.append('"unit": %s' % encode_str(unit)) | SpeedscopeRenderer.render: use profile_name object
This commit uses the previously-unused profile_name object within
SpeedscopeRenderer.render. | joerick_pyinstrument | train | py |
3a505ecb4499f43123d3729829027a7a59001754 | diff --git a/lib/bumbleworks.rb b/lib/bumbleworks.rb
index <HASH>..<HASH> 100644
--- a/lib/bumbleworks.rb
+++ b/lib/bumbleworks.rb
@@ -7,8 +7,13 @@ module Bumbleworks
yield configuration if block_given?
end
+
def configuration
@configuration ||= Bumbleworks::Configuration.new
end
+
+ def reset!
+ @configuration = nil
+ end
end
end
diff --git a/spec/lib/bumbleworks_spec.rb b/spec/lib/bumbleworks_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/bumbleworks_spec.rb
+++ b/spec/lib/bumbleworks_spec.rb
@@ -8,4 +8,34 @@ describe Bumbleworks do
end
end
end
+
+ describe '.reset' do
+ it 'resets memoized variables' do
+ configuration = described_class.configuration
+ described_class.reset!
+ described_class.configuration.should_not equal(configuration)
+ end
+ end
+
+ describe '.configuration' do
+ before :each do
+ described_class.reset!
+ end
+
+ let!(:configuration) do
+ double.tap do |configuration|
+ Bumbleworks::Configuration.should_receive(:new).and_return(configuration)
+ end
+ end
+
+ it 'creates an instance of Bumbleworks::Configuration' do
+ described_class.configuration.should == configuration
+ end
+
+ it 'returns the same instance when called multiple times' do
+ described_class.configuration.should == configuration
+ described_class.configuration.should == configuration
+ end
+ end
+
end | Add reset! and configuration to Bumbleworks. | bumbleworks_bumbleworks | train | rb,rb |
9e79e06da918b9171a2e833fa93b18af8f30c466 | diff --git a/src/commands/deploy/legacy.js b/src/commands/deploy/legacy.js
index <HASH>..<HASH> 100644
--- a/src/commands/deploy/legacy.js
+++ b/src/commands/deploy/legacy.js
@@ -817,7 +817,7 @@ async function sync({
note(
`You can use ${cmd(
'now --public'
- )} or upgrade your plan (${url}) to skip this prompt`
+ )} or upgrade your plan to skip this prompt. More: ${url}`
);
if (!proceed) { | Update legacy note structure (#<I>) | zeit_now-cli | train | js |
01c2881787cc141028ea61277f0facf45f7e7311 | diff --git a/src/modrewrite.js b/src/modrewrite.js
index <HASH>..<HASH> 100644
--- a/src/modrewrite.js
+++ b/src/modrewrite.js
@@ -57,8 +57,8 @@ module.exports = function(rules) {
_next = false;
return true;
} else if(rewrite.regex.test(req.url) && rewrite.proxy) {
- var opts = url.parse(req.url.replace(rewrite.regex, rewrite.replace));
- opts.path = opts.pathname + '/';
+ var opts = url.parse(req.url.replace(rewrite.regex, rewrite.replace));
+ opts.path = opts.pathname + '/' + opts.search;
opts.method = req.method;
opts.headers = req.headers;
var via = '1.1 ' + require('os').hostname(); | added support for query strings in proxy mode | tinganho_connect-modrewrite | train | js |
cb68d4fc81435a6636fb60e30ae0e304f28890e8 | diff --git a/examples/using-jquery-for-ajax.js b/examples/using-jquery-for-ajax.js
index <HASH>..<HASH> 100644
--- a/examples/using-jquery-for-ajax.js
+++ b/examples/using-jquery-for-ajax.js
@@ -3,12 +3,12 @@
var jquery = require('jquery');
var v1sdk = require('./../dist/v1sdk');
-var hostname = "ec2-54-205-135-234.compute-1.amazonaws.com";
-var instance = "VersionOne";
+var hostname = "www14.v1host.com";
+var instance = "v1sdktesting";
var username = "admin";
var password = "admin";
-var port = "80";
-var protocol = "http";
+var port = "443";
+var protocol = "https";
var v1 = new v1sdk.V1Meta({
hostname: hostname,
@@ -45,4 +45,4 @@ v1.create('Actual', {Value: 5.4, Date: new Date()})
})
.catch(function (error) {
console.log(error);
- });
\ No newline at end of file
+ }); | Updated to use v1sdktesting public instance | versionone_VersionOne.SDK.JavaScript | train | js |
09097c63bf2b743697609b49b43ec57048492680 | diff --git a/src/Distilleries/Expendable/Exports/BaseExport.php b/src/Distilleries/Expendable/Exports/BaseExport.php
index <HASH>..<HASH> 100644
--- a/src/Distilleries/Expendable/Exports/BaseExport.php
+++ b/src/Distilleries/Expendable/Exports/BaseExport.php
@@ -34,7 +34,7 @@ class BaseExport implements FromQuery, WithHeadings, ExportContract
public function export($fileName)
{
- $this->download($fileName);
+ return $this->download($fileName);
}
/**
diff --git a/src/Distilleries/Expendable/Imports/BaseImport.php b/src/Distilleries/Expendable/Imports/BaseImport.php
index <HASH>..<HASH> 100644
--- a/src/Distilleries/Expendable/Imports/BaseImport.php
+++ b/src/Distilleries/Expendable/Imports/BaseImport.php
@@ -22,7 +22,7 @@ class BaseImport implements ToModel, WithHeadingRow, ImportContract
public function importFromFile($filepath)
{
- $this->import($filepath);
+ return $this->import($filepath);
}
/** | :ok_hand: Fixing empty response when exporting file | Distilleries_Expendable | train | php,php |
eb47a40085e3699f1ba1deda21e517bb61b112e3 | diff --git a/tests/unit/test_handlers.py b/tests/unit/test_handlers.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_handlers.py
+++ b/tests/unit/test_handlers.py
@@ -6,3 +6,14 @@ def test_contains_always_match():
"""
handler = core.ContainsHandler(name='#', func=None)
assert handler.match('Tell me about #foo', channel='bar')
+
+def test_contains_rate_limit():
+ """
+ Contains handler with a rate should only appear sometimes.
+ """
+ handler = core.ContainsHandler(name='#', func=None, rate=0.5)
+ results = set(
+ handler.match('Tell me about #foo', channel='bar')
+ for x in xrange(1000)
+ )
+ assert True in results and False in results | Added test proving rate limiting is also working (to some extent) | yougov_pmxbot | train | py |
bd2875496fda37b29ec6f03a9389faa808f3f12a | diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py
index <HASH>..<HASH> 100755
--- a/seleniumbase/fixtures/base_case.py
+++ b/seleniumbase/fixtures/base_case.py
@@ -248,7 +248,7 @@ class BaseCase(unittest.TestCase):
pass
self.execute_script(
'''var script = document.createElement("script"); '''
- '''script.src = "http://code.jquery.com/jquery-2.2.4.min.js"; '''
+ '''script.src = "http://code.jquery.com/jquery-3.1.0.min.js"; '''
'''document.getElementsByTagName("head")[0]'''
'''.appendChild(script);''')
for x in xrange(30): | Use the latest version of jQuery when activating it. | seleniumbase_SeleniumBase | train | py |
8e9bdfc69dd22bf892a568c2f61e57ac62fcd929 | diff --git a/lib/appsignal/version.rb b/lib/appsignal/version.rb
index <HASH>..<HASH> 100644
--- a/lib/appsignal/version.rb
+++ b/lib/appsignal/version.rb
@@ -1,3 +1,3 @@
module Appsignal
- VERSION = '0.1.6.rc.2'
+ VERSION = '0.2.0.beta.0'
end | Bump to <I>.beta<I> [ci skip] | appsignal_appsignal-ruby | train | rb |
46dc3e03240d5c49f593337b1f4335987132e4fe | diff --git a/server.js b/server.js
index <HASH>..<HASH> 100755
--- a/server.js
+++ b/server.js
@@ -49,6 +49,8 @@ var Rumours = module.exports = function (config) {
return sh
}
+Rumours.static = join(__dirname, 'static')
+
if(!module.parent) {
var ecstatic = require('ecstatic')
var http = require('http')
@@ -63,7 +65,7 @@ if(!module.parent) {
Rumours(config).install(
http.createServer(Stack(
ecstatic(config.static),
- ecstatic(join(__dirname, 'static'))
+ ecstatic(Rumours.static)
))
.listen(config.port, function () {
console.log( 'listening on', config.port) | export Rumours.static, path to static js bundles | dominictarr_rumours | train | js |
e096c350234ded5456315c3d6e818f83ce8326a5 | diff --git a/examples/lib/activerecord.rb b/examples/lib/activerecord.rb
index <HASH>..<HASH> 100644
--- a/examples/lib/activerecord.rb
+++ b/examples/lib/activerecord.rb
@@ -1,6 +1,6 @@
-require 'activerecord'
+require 'active_record'
-ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
+ActiveRecord::Base.establish_connection(:adapter => "#{"jdbc" if defined?(JRUBY_VERSION)}sqlite3", :database => ":memory:")
ActiveRecord::Schema.define(:version => 1) do
create_table :widgets do |t|
diff --git a/features/step_definitions/database_cleaner_steps.rb b/features/step_definitions/database_cleaner_steps.rb
index <HASH>..<HASH> 100644
--- a/features/step_definitions/database_cleaner_steps.rb
+++ b/features/step_definitions/database_cleaner_steps.rb
@@ -11,7 +11,7 @@ When "I run my scenarios that rely on a clean database" do
Dir.chdir(full_dir) do
ENV['ORM'] = @orm.downcase
ENV['STRATEGY'] = @strategy
- @out = `cucumber features`
+ @out = `#{"jruby -S " if defined?(JRUBY_VERSION)}cucumber features`
@status = $?.exitstatus
end
end | use jdbc for activerecord if running under jruby | DatabaseCleaner_database_cleaner | train | rb,rb |
41d40f7cd10d7f3f0c3a1e7acfca2cce33db0713 | diff --git a/app/controllers/failed_authentication_controller.rb b/app/controllers/failed_authentication_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/failed_authentication_controller.rb
+++ b/app/controllers/failed_authentication_controller.rb
@@ -22,7 +22,7 @@ class FailedAuthenticationController < ActionController::Base
# otherwise, these actions would report an error that user must be logged in to perform them.
if request.env['HTTP_X_FORWARDED_USER'].blank?
- flash[:error] = {"notices" => [_("You've entered an incorrect username, password combination or account disabled, please try again.")]}.to_json
+ flash[:error] = {"notices" => [_("You have entered an incorrect username or password combination or your account may currently be disabled. Please try again or contact your administrator.")]}.to_json
redirect_to new_user_session_url
else
flash[:error] = {"notices" => [_("You do not have valid credentials to access this system. Please contact your administrator.")]}.to_json | <I> - updated the failed login message based on patch provided by Og | Katello_katello | train | rb |
d70433faeae2fadf84ee4c80283682e5483e3ad2 | diff --git a/lib/unitwise/measurement.rb b/lib/unitwise/measurement.rb
index <HASH>..<HASH> 100644
--- a/lib/unitwise/measurement.rb
+++ b/lib/unitwise/measurement.rb
@@ -41,6 +41,15 @@ module Unitwise
end
end
+ def coerce(other)
+ case other
+ when Numeric
+ return self.class.new(other, '1'), self
+ else
+ raise TypeError, "#{self.class} can't be coerced into #{other.class}"
+ end
+ end
+
def method_missing(meth, *args, &block)
if Unitwise::Expression.decompose(meth)
self.convert(meth)
diff --git a/test/unitwise/measurement_test.rb b/test/unitwise/measurement_test.rb
index <HASH>..<HASH> 100644
--- a/test/unitwise/measurement_test.rb
+++ b/test/unitwise/measurement_test.rb
@@ -155,6 +155,13 @@ describe Unitwise::Measurement do
end
end
+ describe "#coerce" do
+ let(:meter) { Unitwise::Measurement.new(1, 'm') }
+ it "must coerce numerics" do
+ meter.coerce(5).must_equal [ Unitwise::Measurement.new(5, '1'), meter ]
+ end
+ end
+
describe "#method_missing" do
let(:meter) { Unitwise::Measurement.new(1, 'm')}
it "must convert 'mm'" do | Add measurement coercion so that '2 * <I>.meter' works as expected. | joshwlewis_unitwise | train | rb,rb |
88acf8a4d9cb8a7200640d6326fc6952f6b82d86 | diff --git a/grimoire_elk/_version.py b/grimoire_elk/_version.py
index <HASH>..<HASH> 100644
--- a/grimoire_elk/_version.py
+++ b/grimoire_elk/_version.py
@@ -1,2 +1,2 @@
# Versions compliant with PEP 440 https://www.python.org/dev/peps/pep-0440
-__version__ = "0.30.20"
+__version__ = "0.30.21" | [release] Update version number to <I> | chaoss_grimoirelab-elk | train | py |
64fa53a0640fd67536548a2568ee9d17f8201d67 | diff --git a/src/main/java/org/komamitsu/fluency/buffer/PackedForwardBuffer.java b/src/main/java/org/komamitsu/fluency/buffer/PackedForwardBuffer.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/komamitsu/fluency/buffer/PackedForwardBuffer.java
+++ b/src/main/java/org/komamitsu/fluency/buffer/PackedForwardBuffer.java
@@ -31,7 +31,7 @@ public class PackedForwardBuffer
bufferPool = new BufferPool(bufferConfig.getInitialBufferSize(), bufferConfig.getMaxBufferSize());
}
- private synchronized RetentionBuffer prepareBuffer(String tag, int writeSize)
+ private RetentionBuffer prepareBuffer(String tag, int writeSize)
throws BufferFullException
{
RetentionBuffer retentionBuffer = retentionBuffers.get(tag); | Remove unnecessary and dangerous lock from PackedForwardBuffer | komamitsu_fluency | train | java |
1ed6daf5e04eeb1050d951596474e13ce1eef71f | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -90,10 +90,10 @@ Pagelet.extend({
var bootstrap = this
, data = {};
- this.keys.reduce(function reduce(memo, key) {
+ data = this.keys.reduce(function reduce(memo, key) {
memo[key] = bootstrap[key];
return memo;
- }, {});
+ }, data);
//
// Introduce the bootstrap code for the framework. It kinda depends on the | [fix] Put the reduced data back into the data variable | bigpipe_bootstrap-pagelet | train | js |
2c519a185ea7797840a68f9c587eaed00704cf61 | diff --git a/app/controllers/itsf/backend/base_controller.rb b/app/controllers/itsf/backend/base_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/itsf/backend/base_controller.rb
+++ b/app/controllers/itsf/backend/base_controller.rb
@@ -5,6 +5,8 @@ module Itsf::Backend
class BaseController < Configuration.resource_base_controller.constantize
if Itsf::Backend.features?(:pundit)
include RestActionsConcernWithPundit
+ include Pundit
+ prepend Controller::PunditNamespacedAuthorizeConcern
else
include RestActionsConcern
end
@@ -12,8 +14,8 @@ module Itsf::Backend
include ResourceInflectionsConcern
include Controller::PaginationConcern if Itsf::Backend.features?(:kaminari)
- include Pundit
- prepend Controller::PunditNamespacedAuthorizeConcern
+ # include Pundit
+ # prepend Controller::PunditNamespacedAuthorizeConcern
helper_method :engine_policy
helper_method :resource_class | Not including pundit concerns if pundit is disabled | robotex82_itsf_backend | train | rb |
54728c59bc51f8506641037b68f3037e14c794b7 | diff --git a/lib/rgot/m.rb b/lib/rgot/m.rb
index <HASH>..<HASH> 100644
--- a/lib/rgot/m.rb
+++ b/lib/rgot/m.rb
@@ -11,7 +11,6 @@ module Rgot
end
def run
- exit_code = 0
test_ok = false
example_ok = false
@@ -21,13 +20,11 @@ module Rgot
}
if !test_ok || !example_ok
puts "FAIL"
- exit_code = 1
- else
- puts "PASS"
+ return 1
end
+ puts "PASS"
run_benchmarks
-
- exit_code
+ 0
end
private | Benchmark should not be run when fail | ksss_rgot | train | rb |
4fd879733cd7e4f83788361ef97ab47921cd86cf | diff --git a/REST/SalesforceClient.php b/REST/SalesforceClient.php
index <HASH>..<HASH> 100755
--- a/REST/SalesforceClient.php
+++ b/REST/SalesforceClient.php
@@ -84,7 +84,7 @@ class SalesforceClient
return $this;
}
catch (\Exception $e) {
- throw new \Exception($e->getMessage());
+ throw new ExternalApiException($e->getMessage(), $e->getCode());
}
} | CampaignChain/campaignchain#<I> Use guzzlehttp/guzzle instead of guzzle/guzzle | CampaignChain_channel-salesforce | train | php |
dbe367054aa15f29f45cede9d228fc0226f643c1 | diff --git a/tx.go b/tx.go
index <HASH>..<HASH> 100644
--- a/tx.go
+++ b/tx.go
@@ -114,7 +114,7 @@ func (tx *tx) CreateIterators(stmt *influxql.SelectStatement) ([]influxql.Iterat
// Find shard groups within time range.
var shardGroups []*ShardGroup
for _, group := range rp.shardGroups {
- if timeBetweenInclusive(group.StartTime, tmin, tmax) || timeBetweenInclusive(group.EndTime, tmin, tmax) {
+ if timeBetweenInclusive(group.StartTime, tmin, tmax) || timeBetweenInclusive(group.EndTime, tmin, tmax) || (group.StartTime.Before(tmin) && group.EndTime.After(tmax)) {
shardGroups = append(shardGroups, group)
}
} | fix wrong time range calculation
The code which was used to check whether a shard group should be
queried was wrong.
The if-condition was:
timeBetweenInclusive(group.StartTime, tmin, tmax) || timeBetweenInclusive(group.EndTime, tmin, tmax)
It excludes group if tmin > group.StartTime && tmax < group.EndTime.
This patch fixes the bug. | influxdata_influxdb | train | go |
4e8d462788a9b0462ea8d9eec75d6e78f490217e | diff --git a/src/lib/m2/index.js b/src/lib/m2/index.js
index <HASH>..<HASH> 100644
--- a/src/lib/m2/index.js
+++ b/src/lib/m2/index.js
@@ -74,6 +74,12 @@ const Color = new r.Struct({
alpha: new AnimationBlock(r.uint16le)
});
+const UVAnimation = new r.Struct({
+ translation: new AnimationBlock(Vec3Float),
+ rotation: new AnimationBlock(Quat16Float),
+ scaling: new AnimationBlock(Vec3Float)
+});
+
export default new r.Struct({
signature: new r.String(4),
version: r.uint32le,
@@ -98,14 +104,14 @@ export default new r.Struct({
colors: new Nofs(Color),
textures: new Nofs(Texture),
transparencies: new Nofs(new AnimationBlock(r.int16le)),
- uvAnimations: new Nofs(),
+ uvAnimations: new Nofs(UVAnimation),
replacableTextures: new Nofs(),
renderFlags: new Nofs(RenderFlags),
boneLookups: new Nofs(),
textureLookups: new Nofs(r.int16le),
textureUnits: new Nofs(r.uint16le),
transparencyLookups: new Nofs(r.int16le),
- uvAnimationLookups: new Nofs(),
+ uvAnimationLookups: new Nofs(r.int16le),
minVertexBox: Vec3Float,
maxVertexBox: Vec3Float, | Added UV animation parsing to M2s | wowserhq_blizzardry | train | js |
98a95a2bafbb50576063bfa85f9876d97c45a9c7 | diff --git a/posts/models.py b/posts/models.py
index <HASH>..<HASH> 100644
--- a/posts/models.py
+++ b/posts/models.py
@@ -1,11 +1,11 @@
from django.db import models
-from django.contrib.auth.models import User
+from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
class AbstractPost(models.Model):
- author = models.ForeignKey(User, editable=False, related_name = "%(app_label)s_%(class)s")
+ author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, related_name="%(app_label)s_%(class)s")
headline = models.CharField(_("Headline"), max_length=255)
text = models.TextField(_("Text"))
creation_date = models.DateTimeField(_("Creation Date"), auto_now_add=True) | change foreign key to author in model to settings.AUTH_USER_MODEL | byteweaver_django-posts | train | py |
2ad6128890da3a4664f0543e8857b4b8549ac76e | diff --git a/lib/partialruby.rb b/lib/partialruby.rb
index <HASH>..<HASH> 100644
--- a/lib/partialruby.rb
+++ b/lib/partialruby.rb
@@ -113,7 +113,7 @@ module PartialRuby
return ("
class #{classname}
- #{object_ref self}.run(#{object_ref subtree}, Frame.new(binding,self) )
+ #{emul subtree, frame}
end
")
end | refactor: implemented recursive emul call in ruby_emul_class method | tario_partialruby | train | rb |
6c0c75e589eb2c2be2e7f0783699600ecf8a0bd7 | diff --git a/src/Cygnite/Foundation/ApplicationInterface.php b/src/Cygnite/Foundation/ApplicationInterface.php
index <HASH>..<HASH> 100644
--- a/src/Cygnite/Foundation/ApplicationInterface.php
+++ b/src/Cygnite/Foundation/ApplicationInterface.php
@@ -50,7 +50,7 @@ interface ApplicationInterface extends ContainerAwareInterface
*
* @return locale
*/
- public function setLocale();
+ public function setLocale($localization = null);
/**
* Set all configurations and boot application | Updated ApplicationInterface for setLocale method. | cygnite_framework | train | php |
61b60e3488f011db54088895e438a8ef6475fa2c | diff --git a/agrona/src/main/java/org/agrona/AsciiSequenceView.java b/agrona/src/main/java/org/agrona/AsciiSequenceView.java
index <HASH>..<HASH> 100644
--- a/agrona/src/main/java/org/agrona/AsciiSequenceView.java
+++ b/agrona/src/main/java/org/agrona/AsciiSequenceView.java
@@ -18,7 +18,7 @@ package org.agrona;
/**
* View over a {@link DirectBuffer} which contains an ASCII string for a given range.
*/
-public final class AsciiSequenceView implements CharSequence
+public class AsciiSequenceView implements CharSequence
{
private DirectBuffer buffer;
private int offset; | Remove final from AsciiSequenceView. Issue #<I>. | real-logic_agrona | train | java |
3523aa90a18e02077f92d7ce7f29234d2a5030aa | diff --git a/core/client/app/serializers/setting.js b/core/client/app/serializers/setting.js
index <HASH>..<HASH> 100644
--- a/core/client/app/serializers/setting.js
+++ b/core/client/app/serializers/setting.js
@@ -27,6 +27,8 @@ var SettingSerializer = ApplicationSerializer.extend({
payload[setting.key] = setting.value;
});
+ payload = this.normalize(type, payload);
+
return [payload];
}, | Normalize settings payloads in client serializer
Closes #<I> | TryGhost_Ghost | train | js |
c311889cc0dd08cdeda2031c3c2c5b2f60f6103a | diff --git a/lib/filestorage/zip_archive.php b/lib/filestorage/zip_archive.php
index <HASH>..<HASH> 100644
--- a/lib/filestorage/zip_archive.php
+++ b/lib/filestorage/zip_archive.php
@@ -68,7 +68,7 @@ class zip_archive extends file_archive {
switch($mode) {
case file_archive::OPEN: $flags = 0; break;
- case file_archive::OVERWRITE: $flags = ZIPARCHIVE::OVERWRITE; break;
+ case file_archive::OVERWRITE: $flags = ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE; break;
case file_archive::CREATE:
default : $flags = ZIPARCHIVE::CREATE; break;
} | MDL-<I> use of ZIPARCHIVE::OVERWRITE changed in <I> | moodle_moodle | train | php |
2b66ecd5172b764950b6954c206bcdb454f94139 | diff --git a/core/src/main/java/com/segment/analytics/Analytics.java b/core/src/main/java/com/segment/analytics/Analytics.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/com/segment/analytics/Analytics.java
+++ b/core/src/main/java/com/segment/analytics/Analytics.java
@@ -287,6 +287,15 @@ public class Analytics {
}
/**
+ * Same as <code>identify(anonymousId, new Options());</code>.
+ *
+ * @see {@link #identify(String, Options)}
+ */
+ public void identify() {
+ identify(traits.userId(), new Options());
+ }
+
+ /**
* Same as <code>identify(userId, new Options());</code>.
*
* @see {@link #identify(String, Options)} | Fallback to `anonymousId` if `userId` is not passed in. | segmentio_analytics-android | train | java |
8cd87dedb65b407cf5ce025c9f815b087a5bbda7 | diff --git a/xml4h/impls/xml_etree_elementtree.py b/xml4h/impls/xml_etree_elementtree.py
index <HASH>..<HASH> 100644
--- a/xml4h/impls/xml_etree_elementtree.py
+++ b/xml4h/impls/xml_etree_elementtree.py
@@ -328,7 +328,12 @@ class ElementTreeAdapter(XmlImplAdapter):
# with a local default namespace declaration
if node.attrib.get('xmlns') == ns_uri:
return None
- return self.lookup_ns_prefix_for_uri(node, ns_uri)
+ ns_prefix = self.lookup_ns_prefix_for_uri(node, ns_uri)
+ # Don't add unnecessary excess namespace prefixes for default ns
+ if ns_prefix == 'xmlns':
+ return None
+ else:
+ return ns_prefix
def get_node_value(self, node):
if node.tag in (BaseET.ProcessingInstruction, BaseET.Comment): | Tests in test_writer now passing for (c)ElementTree | jmurty_xml4h | train | py |
72fdbdffe734747a5d6c9f18babd1399cfe704b4 | diff --git a/src/phpDocumentor/Plugin/Core/Transformer/Writer/Pathfinder.php b/src/phpDocumentor/Plugin/Core/Transformer/Writer/Pathfinder.php
index <HASH>..<HASH> 100644
--- a/src/phpDocumentor/Plugin/Core/Transformer/Writer/Pathfinder.php
+++ b/src/phpDocumentor/Plugin/Core/Transformer/Writer/Pathfinder.php
@@ -34,13 +34,9 @@ class Pathfinder
/**
* Walks an object graph and/or array using a twig query string.
*
- * Note: this method is public because it is used in a closure in {{@see getDestinationPath()}}.
- *
* @param \Traversable|mixed $objectOrArray
* @param string $query A path to walk separated by dots, i.e. `namespace.namespaces`.
*
- * @todo move this to a separate class and make it more flexible.
- *
* @return mixed
*/
private function walkObjectTree($objectOrArray, $query)
@@ -78,6 +74,4 @@ class Pathfinder
return $node;
}
-
-
-}
\ No newline at end of file
+} | Update DocBlock to reflect the new situation | phpDocumentor_phpDocumentor2 | train | php |
d11351fdfb61d5ae0aa789a53c7f4ac9657e8951 | diff --git a/src/Rocketeer/Services/Ignition/RocketeerIgniter.php b/src/Rocketeer/Services/Ignition/RocketeerIgniter.php
index <HASH>..<HASH> 100644
--- a/src/Rocketeer/Services/Ignition/RocketeerIgniter.php
+++ b/src/Rocketeer/Services/Ignition/RocketeerIgniter.php
@@ -87,6 +87,7 @@ class RocketeerIgniter
$fileDestination = $destination.DS.$basename;
if ($namespace) {
+ $namespace = preg_replace("/[^\w]/", "", $namespace);// only words allowed
$contents = str_replace('namespace App', 'namespace '.$namespace, $contents);
$contents = str_replace('AppServiceProvider', $namespace.'ServiceProvider', $contents);
$fileDestination = strpos($basename, 'ServiceProvider') === false | namespace in stubs can contain only words | rocketeers_rocketeer | train | php |
11c4f95a78077e562b8f72425b62153ba2bbc259 | diff --git a/src/jquery.rss.js b/src/jquery.rss.js
index <HASH>..<HASH> 100644
--- a/src/jquery.rss.js
+++ b/src/jquery.rss.js
@@ -59,7 +59,7 @@
RSS.prototype.appendEntriesAndApplyEffects = function(target, entries) {
var self = this
- entries.forEach(function(entry) {
+ $.each(entries, function(idx, entry) {
var $html = self.wrapContent(entry)
if(self.options.effect === 'show') { | Replaced forEach with jQuery's $.each to support browsers without native support of forEach | sdepold_jquery-rss | train | js |
1e843c4e1b9b85443ee1cdd93605024b84fdd16d | diff --git a/go/vt/worker/clone_utils.go b/go/vt/worker/clone_utils.go
index <HASH>..<HASH> 100644
--- a/go/vt/worker/clone_utils.go
+++ b/go/vt/worker/clone_utils.go
@@ -50,8 +50,8 @@ func resolveDestinationShardMaster(ctx context.Context, keyspace, shard string,
ti, err = wr.TopoServer().GetTablet(shortCtx, si.MasterAlias)
cancel()
if err != nil {
- return ti, fmt.Errorf("unable to get master tablet from alias %v in shard %v/%v",
- topoproto.TabletAliasString(si.MasterAlias), keyspace, shard)
+ return ti, fmt.Errorf("unable to get master tablet from alias %v in shard %v/%v: %v",
+ topoproto.TabletAliasString(si.MasterAlias), keyspace, shard, err)
}
return ti, nil
} | Add more logging on errors for clone_utils.go:resolveDestinationShardMaster | vitessio_vitess | train | go |
148532fdd985e666265a8d45c8b120ca67fd572e | diff --git a/rails_event_store/lib/rails_event_store/event.rb b/rails_event_store/lib/rails_event_store/event.rb
index <HASH>..<HASH> 100644
--- a/rails_event_store/lib/rails_event_store/event.rb
+++ b/rails_event_store/lib/rails_event_store/event.rb
@@ -1,19 +1,3 @@
module RailsEventStore
- class Event < RubyEventStore::Event
- def initialize(**args)
- attributes = args.except(:event_type, :event_id, :metadata)
- singleton_class = (class << self; self; end)
- attributes.each do |key, value|
- singleton_class.send(:define_method, key) { value }
- end
-
- event_data = {
- event_type: args[:event_type] || self.class.name,
- data: attributes,
- }
- event_data[:event_id] = args[:event_id] if args.key?(:event_id)
- event_data[:metadata] = args[:metadata] if args.key?(:metadata)
- super(event_data)
- end
- end
+ Event = RubyEventStore::Event
end | Moved to RubyEventStore::Event | RailsEventStore_rails_event_store | train | rb |
f6bd52d90b47913ab00e4a555d96fcb79647b55f | diff --git a/tests/spec/color-spec.js b/tests/spec/color-spec.js
index <HASH>..<HASH> 100644
--- a/tests/spec/color-spec.js
+++ b/tests/spec/color-spec.js
@@ -4,8 +4,6 @@ describe("me.Color", function () {
var green_color = new me.Color().parseCSS("green");
var blue_color = new me.Color().parseHex("#0000FF");
- me.video.renderer = me.CanvasRenderer;
-
describe("parseHex Function", function () {
// #RGB
it("#00F value is rgb(0, 0, 255)", function () { | this has nothing to do here as well | melonjs_melonJS | train | js |
525d8da65fc71b951bfabcb5cb2d0f9de27474cd | diff --git a/model.go b/model.go
index <HASH>..<HASH> 100644
--- a/model.go
+++ b/model.go
@@ -22,7 +22,7 @@ var tableMapMu = sync.RWMutex{}
// m := &pop.Model{Value: User{}}
// m.TableName() // "users"
//
-// pop.MapTableName("user", "people")
+// pop.MapTableName("User", "people")
// m = &pop.Model{Value: User{}}
// m.TableName() // "people"
func MapTableName(name string, tableName string) { | fixed a typo in the docs | gobuffalo_pop | train | go |
e48580bdcc621529660edfb06bb4ce1310812cd0 | diff --git a/course/search.php b/course/search.php
index <HASH>..<HASH> 100644
--- a/course/search.php
+++ b/course/search.php
@@ -150,17 +150,22 @@
." WHERE module.course=c.id";
$courseids = $DB->get_records_sql($sql);
-
- $firstcourse = $page*$perpage;
- $lastcourse = $page*$perpage + $perpage -1;
- $i = 0;
- foreach ($courseids as $courseid) {
- if ($i>= $firstcourse && $i<=$lastcourse) {
- $courses[$courseid->id] = $DB->get_record('course', array('id'=> $courseid->id));
+ $courses = array();
+ if (!empty($courseids)) {
+ $firstcourse = $page*$perpage;
+ $lastcourse = $page*$perpage + $perpage -1;
+ $i = 0;
+ foreach ($courseids as $courseid) {
+ if ($i>= $firstcourse && $i<=$lastcourse) {
+ $courses[$courseid->id] = $DB->get_record('course', array('id'=> $courseid->id));
+ }
+ $i++;
}
- $i++;
+ $totalcount = count($courseids);
+ }
+ else {
+ $totalcount = 0;
}
- $totalcount = count($courseids);
}
else {
$courses = get_courses_search($searchterms, "fullname ASC", | MDL-<I>: fix navigation links for Activities Administration page: check that the course list is not empty, merged from <I> | moodle_moodle | train | php |
7e7bbd560ef943e4cfa2ecc23e4768030163f55b | diff --git a/lib/bolt/outputter/human.rb b/lib/bolt/outputter/human.rb
index <HASH>..<HASH> 100644
--- a/lib/bolt/outputter/human.rb
+++ b/lib/bolt/outputter/human.rb
@@ -194,7 +194,7 @@ module Bolt
end
end
when 'lookup'
- @stream.puts(indent(2, result['value']))
+ @stream.puts(indent(2, Bolt::Util::Format.stringify(result['value'])))
else
if result.generic_value.any?
@stream.puts(indent(2, ::JSON.pretty_generate(result.generic_value))) | (GH-<I>) Print hiera lookups with bolt lookup using human outputter
Previously the human outputter could not print all valid data using the `lookup` command. This commit ensures the data is stringified so it is printed properly with the human outputter.
!bug
* **Properly print hiera data with bolt lookup**
([#<I>](#<I>))
The human outputter can now properly print hiera data including
values that are hashes. | puppetlabs_bolt | train | rb |
Subsets and Splits