hash
stringlengths 40
40
| diff
stringlengths 131
114k
| message
stringlengths 7
980
| project
stringlengths 5
67
| split
stringclasses 1
value |
|---|---|---|---|---|
caa54db8a000b537473f30bf6d64eead9154cbb7
|
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -26,9 +26,9 @@ module ActionDispatch
def matches?(env)
req = @request.new(env)
- @constraints.none? do |constraint|
- (constraint.respond_to?(:matches?) && !constraint.matches?(req)) ||
- (constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req)))
+ @constraints.all? do |constraint|
+ (constraint.respond_to?(:matches?) && constraint.matches?(req)) ||
+ (constraint.respond_to?(:call) && constraint.call(*constraint_args(constraint, req)))
end
ensure
req.reset_parameters
|
clearer conditional in constraint match check
|
rails_rails
|
train
|
e4d507f47de5a0b8f3755f379d6ed5fb99417bc6
|
diff --git a/cython/gen_data.py b/cython/gen_data.py
index <HASH>..<HASH> 100644
--- a/cython/gen_data.py
+++ b/cython/gen_data.py
@@ -50,13 +50,18 @@ def gen_factorial_data(gen_seed, num_clusters,
data = numpy.hstack(data_list)
return data, inverse_permutation_indices_list
-def gen_factorial_data_objects(gen_seed, num_clusters,
- num_cols, num_rows, num_splits,
- max_mean=10, max_std=1):
- T, data_inverse_permutation_indices = gen_factorial_data(
- gen_seed, num_clusters,
- num_cols, num_rows, num_splits, max_mean, max_std)
- T = T.tolist()
+def gen_M_r_from_T(T):
+ num_rows = len(T)
+ num_cols = len(T[0])
+ #
+ name_to_idx = dict(zip(map(str, range(num_rows)), range(num_rows)))
+ idx_to_name = dict(zip(map(str, range(num_rows)), range(num_rows)))
+ M_r = dict(name_to_idx=name_to_idx, idx_to_name=idx_to_name)
+ return M_r
+
+def gen_M_c_from_T(T):
+ num_rows = len(T)
+ num_cols = len(T[0])
#
gen_continuous_metadata = lambda: dict(modeltype="normal_inverse_gamma",
value_to_code=dict(),
@@ -65,11 +70,6 @@ def gen_factorial_data_objects(gen_seed, num_clusters,
gen_continuous_metadata()
for col_idx in range(num_cols)
]
- #
- name_to_idx = dict(zip(map(str, range(num_rows)), range(num_rows)))
- idx_to_name = dict(zip(map(str, range(num_rows)), range(num_rows)))
- M_r = dict(name_to_idx=name_to_idx, idx_to_name=idx_to_name)
- #
name_to_idx = dict(zip(map(str, range(num_cols)),range(num_cols)))
idx_to_name = dict(zip(map(str, range(num_cols)),range(num_cols)))
M_c = dict(
@@ -77,4 +77,15 @@ def gen_factorial_data_objects(gen_seed, num_clusters,
idx_to_name=idx_to_name,
column_metadata=column_metadata,
)
+ return M_c
+
+def gen_factorial_data_objects(gen_seed, num_clusters,
+ num_cols, num_rows, num_splits,
+ max_mean=10, max_std=1):
+ T, data_inverse_permutation_indices = gen_factorial_data(
+ gen_seed, num_clusters,
+ num_cols, num_rows, num_splits, max_mean, max_std)
+ T = T.tolist()
+ M_r = gen_M_r_from_T(T)
+ M_c = gen_M_c_from_T(T)
return T, M_r, M_c
|
add functions to generate M_c, M_r from T
|
probcomp_crosscat
|
train
|
87e7c584f9b883af6a9c2d2b8e76a19e88494868
|
diff --git a/src/main/java/com/fiftyonred/mock_jedis/MockPipeline.java b/src/main/java/com/fiftyonred/mock_jedis/MockPipeline.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/fiftyonred/mock_jedis/MockPipeline.java
+++ b/src/main/java/com/fiftyonred/mock_jedis/MockPipeline.java
@@ -288,16 +288,20 @@ public class MockPipeline extends Pipeline {
@Override
public Response<String> setex(final String key, final int seconds, final String value) {
- return psetex(key, seconds * 1000, value);
+ return psetex(key, (long)seconds * 1000, value);
}
@Override
public Response<String> setex(final byte[] key, final int seconds, final byte[] value) {
- return psetex(key, seconds * 1000, value);
+ return psetex(key, (long)seconds * 1000, value);
}
@Override
public Response<String> psetex(final String key, final int milliseconds, final String value) {
+ return psetex(key, (long)milliseconds, value);
+ }
+
+ public Response<String> psetex(final String key, final long milliseconds, final String value) {
mockStorage.psetex(DataContainer.from(key), milliseconds, DataContainer.from(value));
final Response<String> response = new Response<String>(BuilderFactory.STRING);
response.set(OK_RESPONSE);
@@ -306,6 +310,10 @@ public class MockPipeline extends Pipeline {
@Override
public Response<String> psetex(final byte[] key, final int milliseconds, final byte[] value) {
+ return psetex(key, (long)milliseconds, value);
+ }
+
+ public Response<String> psetex(final byte[] key, final long milliseconds, final byte[] value) {
mockStorage.psetex(DataContainer.from(key), milliseconds, DataContainer.from(value));
final Response<String> response = new Response<String>(BuilderFactory.STRING);
response.set(OK_RESPONSE);
diff --git a/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java b/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java
+++ b/src/main/java/com/fiftyonred/mock_jedis/MockStorage.java
@@ -203,6 +203,10 @@ public class MockStorage {
}
public synchronized void psetex(final DataContainer key, final int milliseconds, final DataContainer value) {
+ psetex(key, (long)milliseconds, value);
+ }
+
+ public synchronized void psetex(final DataContainer key, final long milliseconds, final DataContainer value) {
set(key, value);
pexpireAt(key, System.currentTimeMillis() + milliseconds);
}
diff --git a/src/test/java/com/fiftyonred/mock_jedis/MockJedisExpireTest.java b/src/test/java/com/fiftyonred/mock_jedis/MockJedisExpireTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/fiftyonred/mock_jedis/MockJedisExpireTest.java
+++ b/src/test/java/com/fiftyonred/mock_jedis/MockJedisExpireTest.java
@@ -43,6 +43,17 @@ public class MockJedisExpireTest {
}
@Test
+ public void testSetexWithHighTtl() throws InterruptedException {
+ int delay = 7776000; //90 days in seconds
+
+ j.setex("test", delay, "value");
+
+ assertTrue(j.ttl("test") > 0);
+ assertNotNull(j.get("test"));
+ assertEquals("value",j.get("test"));
+ }
+
+ @Test
public void testExpire() throws InterruptedException {
int delay = 1;
|
Fixed Integer calculation overflow when use high TTL in seconds (like <I> days in seconds) when converting to milliseconds using int
|
50onRed_mock-jedis
|
train
|
f91656d357412713797e2dd8009f447063637fdf
|
diff --git a/lib/active_record/connection_adapters/sqlserver_adapter.rb b/lib/active_record/connection_adapters/sqlserver_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record/connection_adapters/sqlserver_adapter.rb
+++ b/lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -940,7 +940,7 @@ module ActiveRecord
utf8_cols.each do |col|
sql.gsub!("[#{col.to_s}] = '", "[#{col.to_s}] = N'")
end
- elsif sql =~ /^\s*INSERT/i
+ elsif sql =~ /^\s*INSERT/i and sql !~ /DEFAULT VALUES\s*$/i
# TODO This code should be simplified
# Get columns and values, split them into arrays, and store the original_values for when we need to replace them
columns_and_values = sql.scan(/\((.*?)\)/m).flatten
|
Change set_utf8_values! to cope with 'INSERT INTO table DEFAULT VALUES' style inserts.
|
rails-sqlserver_activerecord-sqlserver-adapter
|
train
|
8ef1f9571a0cc7e8ad47f43c95ec02cb2c58bf3a
|
diff --git a/src/main/java/org/jboss/netty/util/TimeBasedUuidGenerator.java b/src/main/java/org/jboss/netty/util/TimeBasedUuidGenerator.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jboss/netty/util/TimeBasedUuidGenerator.java
+++ b/src/main/java/org/jboss/netty/util/TimeBasedUuidGenerator.java
@@ -23,8 +23,7 @@
package org.jboss.netty.util;
import java.io.UnsupportedEncodingException;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
+import java.lang.reflect.Method;
import java.net.InetAddress;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -81,11 +80,25 @@ public class TimeBasedUuidGenerator {
//// Finally, append the another distinguishable string (probably PID.)
try {
- RuntimeMXBean rtb = ManagementFactory.getRuntimeMXBean();
+ Class<?> mgmtFactoryType =
+ Class.forName("java.lang.management.ManagementFactory");
+ Method getRuntimeMXBean =
+ mgmtFactoryType.getMethod("getRuntimeMXBean", (Class[]) null);
+ Object runtimeMXBean =
+ getRuntimeMXBean.invoke(null, (Object[]) null);
+ Class<?> runtimeMXBeanType =
+ Class.forName("java.lang.management.RuntimeMXBean");
+ Method getName =
+ runtimeMXBeanType.getMethod("getName", (Class[]) null);
+ String vmId = String.valueOf(
+ getName.invoke(runtimeMXBean, (Object[]) null));
+
nodeKey.append(':');
- nodeKey.append(rtb.getName());
+ nodeKey.append(vmId);
} catch (Exception e) {
- // Ignore.
+ // Perhaps running with a security manager (e.g. Applet) or on a
+ // platform without the java.lang.management package (e.g. Android.)
+ nodeKey.append(":?");
}
// Generate the digest of the nodeKey.
|
Resolved issue: NETTY-<I> - Support the Android platform
* Made sure TimeBasedUuidGenerator runs without statically importing java.lang.management package
|
netty_netty
|
train
|
f72a6f3c61ff61de2184fdac55842575056bb667
|
diff --git a/lib/formtastic/helpers/action_helper.rb b/lib/formtastic/helpers/action_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/formtastic/helpers/action_helper.rb
+++ b/lib/formtastic/helpers/action_helper.rb
@@ -17,9 +17,9 @@ module Formtastic
# <%= semantic_form_for @post do |f| %>
# ...
# <%= f.actions do %>
- # <%= f.action(:submit) %>
- # <%= f.action(:reset) %>
- # <%= f.action(:cancel) %>
+ # <%= f.action :submit %>
+ # <%= f.action :reset %>
+ # <%= f.action :cancel %>
# <% end %>
# <% end %>
#
diff --git a/lib/formtastic/helpers/actions_helper.rb b/lib/formtastic/helpers/actions_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/formtastic/helpers/actions_helper.rb
+++ b/lib/formtastic/helpers/actions_helper.rb
@@ -10,8 +10,8 @@ module Formtastic
# <%= semantic_form_for @post do |f| %>
# ...
# <%= f.actions do %>
- # <%= f.action(:submit)
- # <%= f.action(:cancel)
+ # <%= f.action :submit
+ # <%= f.action :cancel
# <% end %>
# <% end %>
#
@@ -62,8 +62,8 @@ module Formtastic
# <% semantic_form_for @post do |f| %>
# ...
# <% f.actions do %>
- # <%= f.action(:submit) %>
- # <%= f.action(:cancel) %>
+ # <%= f.action :submit %>
+ # <%= f.action :cancel %>
# <% end %>
# <% end %>
#
diff --git a/lib/generators/templates/_form.html.erb b/lib/generators/templates/_form.html.erb
index <HASH>..<HASH> 100644
--- a/lib/generators/templates/_form.html.erb
+++ b/lib/generators/templates/_form.html.erb
@@ -6,6 +6,6 @@
<%% end %>
<%%= f.actions do %>
- <%%= f.action(:submit, :as => :input) %>
+ <%%= f.action :submit, :as => :input %>
<%% end %>
<%% end %>
|
Remove parentheses for consistency with f.input
|
justinfrench_formtastic
|
train
|
97c91440410b93d3712651262eff9a86af391b57
|
diff --git a/werkzeug/__init__.py b/werkzeug/__init__.py
index <HASH>..<HASH> 100644
--- a/werkzeug/__init__.py
+++ b/werkzeug/__init__.py
@@ -19,7 +19,7 @@ import sys
from werkzeug._compat import iteritems
-__version__ = '0.14.1'
+__version__ = '0.14.2.dev'
# This import magic raises concerns quite often which is why the implementation
|
<I> In case we need more
|
pallets_werkzeug
|
train
|
194b8cd7d8261908ec22f925b009ef2c2fc2fbee
|
diff --git a/test/integration/helpers.go b/test/integration/helpers.go
index <HASH>..<HASH> 100644
--- a/test/integration/helpers.go
+++ b/test/integration/helpers.go
@@ -201,9 +201,9 @@ func clusterLogs(t *testing.T, profile string) {
return
}
- t.Logf("-----------------------post-mortem--------------------------------")
+ t.Logf("------------------------------------------------------------------")
t.Logf("<<< %s FAILED: start of post-mortem logs <<<", t.Name())
- t.Logf("-------------------post-mortem minikube logs----------------------")
+ t.Logf("------++> post-mortem[%s]: minikube logs", t.Name())
rr, err := Run(t, exec.Command(Target(), "-p", profile, "logs", "--problems"))
if err != nil {
@@ -212,21 +212,20 @@ func clusterLogs(t *testing.T, profile string) {
}
t.Logf("%s logs: %s", t.Name(), rr.Output())
- t.Logf("------------------post-mortem disk usage-------------------")
+ t.Logf("------++> post-mortem[%s]: disk usage", t.Name())
rr, err = Run(t, exec.Command(Target(), "-p", profile, "ssh", "df -h /var/lib/docker/overlay2 /var /; du -hs /var/lib/docker/overlay2"))
if err != nil {
t.Logf("failed df error: %v", err)
}
t.Logf("%s df: %s", t.Name(), rr.Stdout)
- t.Logf("------------------post-mortem api server status-------------------")
st = Status(context.Background(), t, Target(), profile, "APIServer")
if st != state.Running.String() {
t.Logf("%q apiserver is not running, skipping kubectl commands (state=%q)", profile, st)
return
}
- t.Logf("--------------------post-mortem get pods--------------------------")
+ t.Logf("------++> post-mortem[%s]: get pods", t.Name())
rr, rerr := Run(t, exec.Command("kubectl", "--context", profile, "get", "po", "-A", "--show-labels"))
if rerr != nil {
t.Logf("%s: %v", rr.Command(), rerr)
@@ -234,7 +233,7 @@ func clusterLogs(t *testing.T, profile string) {
}
t.Logf("(dbg) %s:\n%s", rr.Command(), rr.Output())
- t.Logf("-------------------post-mortem describe node----------------------")
+ t.Logf("------++> post-mortem[%s]: describe node", t.Name())
rr, err = Run(t, exec.Command("kubectl", "--context", profile, "describe", "node"))
if err != nil {
t.Logf("%s: %v", rr.Command(), err)
@@ -242,7 +241,7 @@ func clusterLogs(t *testing.T, profile string) {
t.Logf("(dbg) %s:\n%s", rr.Command(), rr.Output())
}
- t.Logf("-------------------post-mortem describe pods----------------------")
+ t.Logf("------++> post-mortem[%s]: describe pods", t.Name())
rr, err = Run(t, exec.Command("kubectl", "--context", profile, "describe", "po", "-A"))
if err != nil {
t.Logf("%s: %v", rr.Command(), err)
@@ -250,7 +249,6 @@ func clusterLogs(t *testing.T, profile string) {
t.Logf("(dbg) %s:\n%s", rr.Command(), rr.Stdout)
}
- t.Logf("------------------------------------------------------------------")
t.Logf("<<< %s FAILED: end of post-mortem logs <<<", t.Name())
t.Logf("---------------------/post-mortem---------------------------------")
}
|
Modify post-mortem logs so I don't need to count dashes
|
kubernetes_minikube
|
train
|
22cace1c4f3230d71aa3a39ed53f8d44a26a0079
|
diff --git a/edx_rest_api_client/tests/test_client.py b/edx_rest_api_client/tests/test_client.py
index <HASH>..<HASH> 100644
--- a/edx_rest_api_client/tests/test_client.py
+++ b/edx_rest_api_client/tests/test_client.py
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
+from types import NoneType
from unittest import TestCase
import ddt
import mock
+from edx_rest_api_client.auth import JwtAuth
from edx_rest_api_client.client import EdxRestApiClient
@@ -21,19 +23,26 @@ JWT = 'abc.123.doremi'
class EdxRestApiClientTests(TestCase):
""" Tests for the E-Commerce API client. """
+ @ddt.unpack
@ddt.data(
- {'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME, 'full_name': FULL_NAME, 'email': EMAIL},
- {'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME, 'full_name': None, 'email': EMAIL},
- {'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME, 'full_name': FULL_NAME, 'email': None},
- {'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME, 'full_name': None, 'email': None},
- {'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME},
- {'url': URL, 'signing_key': None, 'username': USERNAME},
- {'url': URL, 'signing_key': SIGNING_KEY, 'username': None},
- {'url': URL, 'signing_key': None, 'username': None, 'oauth_access_token': None},
+ ({'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME,
+ 'full_name': FULL_NAME, 'email': EMAIL}, JwtAuth),
+ ({'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME, 'full_name': None, 'email': EMAIL}, JwtAuth),
+ ({'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME,
+ 'full_name': FULL_NAME, 'email': None}, JwtAuth),
+ ({'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME, 'full_name': None, 'email': None}, JwtAuth),
+ ({'url': URL, 'signing_key': SIGNING_KEY, 'username': USERNAME}, JwtAuth),
+ ({'url': URL, 'signing_key': None, 'username': USERNAME}, NoneType),
+ ({'url': URL, 'signing_key': SIGNING_KEY, 'username': None}, NoneType),
+ ({'url': URL, 'signing_key': None, 'username': None, 'oauth_access_token': None}, NoneType)
)
- def test_valid_configuration(self, kwargs):
- """ The constructor should return successfully if all arguments are valid. """
- EdxRestApiClient(**kwargs)
+ def test_valid_configuration(self, kwargs, auth_type):
+ """
+ The constructor should return successfully if all arguments are valid.
+ We also check that the auth type of the api is what we expect.
+ """
+ api = EdxRestApiClient(**kwargs)
+ self.assertEqual(auth_type, type(getattr(api._store["session"], "auth"))) # pylint: disable=protected-access
@ddt.data(
{'url': None, 'signing_key': SIGNING_KEY, 'username': USERNAME},
|
Added a check for auth type after an api is constructed.
|
edx_edx-rest-api-client
|
train
|
19e29c29447bcdf6bdd3f1dc05ecd73e51f940c9
|
diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_group.go b/builtin/providers/aws/resource_aws_cloudwatch_log_group.go
index <HASH>..<HASH> 100644
--- a/builtin/providers/aws/resource_aws_cloudwatch_log_group.go
+++ b/builtin/providers/aws/resource_aws_cloudwatch_log_group.go
@@ -109,7 +109,7 @@ func resourceAwsCloudWatchLogGroupRead(d *schema.ResourceData, meta interface{})
d.Set("retention_in_days", lg.RetentionInDays)
}
- if meta.(*AWSClient).partition != "aws-us-gov" {
+ if meta.(*AWSClient).IsChinaCloud() || meta.(*AWSClient).IsGovCloud() {
tags, err := flattenCloudWatchTags(d, conn)
if err != nil {
return err
@@ -172,7 +172,9 @@ func resourceAwsCloudWatchLogGroupUpdate(d *schema.ResourceData, meta interface{
}
}
- if meta.(*AWSClient).partition != "aws-us-gov" && d.HasChange("tags") {
+ restricted := meta.(*AWSClient).IsChinaCloud() || meta.(*AWSClient).IsGovCloud()
+
+ if !restricted && d.HasChange("tags") {
oraw, nraw := d.GetChange("tags")
o := oraw.(map[string]interface{})
n := nraw.(map[string]interface{})
|
provider/aws: Use helper methods for checking partition
|
hashicorp_terraform
|
train
|
22e70f069cec86f94e17774c9c2b84b1bb9cda6c
|
diff --git a/lib/puppet.rb b/lib/puppet.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -100,10 +100,28 @@ module Puppet
conf = "/etc/puppet"
var = "/var/puppet"
end
+
self.setdefaults(:puppet,
:confdir => [conf, "The main Puppet configuration directory."],
- :vardir => [var, "Where Puppet stores dynamic and growing data."],
- :logdir => ["$vardir/log", "The Puppet log directory."],
+ :vardir => [var, "Where Puppet stores dynamic and growing data."]
+ )
+
+ if self.name == "puppetmasterd"
+ self.setdefaults(:puppetmasterd,
+ :logdir => {:default => "$vardir/log",
+ :mode => 0750,
+ :owner => "$user",
+ :group => "$group",
+ :desc => "The Puppet log directory."
+ }
+ )
+ else
+ self.setdefaults(:puppet,
+ :logdir => ["$vardir/log", "The Puppet log directory."]
+ )
+ end
+
+ self.setdefaults(:puppet,
:statedir => { :default => "$vardir/state",
:mode => 01777,
:desc => "The directory where Puppet state is stored. Generally,
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -251,11 +251,13 @@ module Puppet
Puppet::Rails.init
# We store all of the objects, even the collectable ones
- Puppet::Rails::Host.store(
- :objects => objects,
- :host => client,
- :facts => facts
- )
+ benchmark(:info, "Stored configuration for #{client}") do
+ Puppet::Rails::Host.store(
+ :objects => objects,
+ :host => client,
+ :facts => facts
+ )
+ end
# Now that we've stored everything, we need to strip out
# the collectable objects so that they are not sent on
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/rails/host.rb
+++ b/lib/puppet/rails/host.rb
@@ -1,6 +1,6 @@
require 'puppet/rails/rails_object'
-RailsObject = Puppet::Rails::RailsObject
+#RailsObject = Puppet::Rails::RailsObject
class Puppet::Rails::Host < ActiveRecord::Base
Host = self
serialize :facts, Hash
@@ -45,11 +45,13 @@ class Puppet::Rails::Host < ActiveRecord::Base
host[param] = hostargs[param]
end
end
+ host.addobjects(objects)
else
- host = Host.new(hostargs)
+ host = Host.new(hostargs) do |hostobj|
+ hostobj.addobjects(objects)
+ end
end
- host.addobjects(objects)
host.save
@@ -69,15 +71,12 @@ class Puppet::Rails::Host < ActiveRecord::Base
end
end
- robj = RailsObject.new(args)
+ robj = rails_objects.build(args)
+ robj.addparams(params)
if tobj.collectable
robj.toggle(:collectable)
end
-
- self.rails_objects << robj
-
- robj.addparams(params)
end
end
end
diff --git a/lib/puppet/rails/rails_object.rb b/lib/puppet/rails/rails_object.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/rails/rails_object.rb
+++ b/lib/puppet/rails/rails_object.rb
@@ -1,7 +1,7 @@
require 'puppet'
require 'puppet/rails/rails_parameter'
-RailsParameter = Puppet::Rails::RailsParameter
+#RailsParameter = Puppet::Rails::RailsParameter
class Puppet::Rails::RailsObject < ActiveRecord::Base
has_many :rails_parameters, :dependent => :delete_all
serialize :tags, Array
@@ -11,12 +11,12 @@ class Puppet::Rails::RailsObject < ActiveRecord::Base
# Add a set of parameters.
def addparams(params)
params.each do |pname, pvalue|
- pobj = RailsParameter.new(
+ rails_parameters.build(
:name => pname,
:value => pvalue
)
- self.rails_parameters << pobj
+ #self.rails_parameters << pobj
end
end
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -68,9 +68,9 @@ module Puppet
munge do |value|
case value
- when false, "false":
+ when false, "false", :false:
false
- when true, "true", ".puppet-bak":
+ when true, "true", ".puppet-bak", :true:
".puppet-bak"
when String:
# We can't depend on looking this up right now,
|
Made a *huge* performance difference in storing hosts -- down from about <I> seconds per host to about 5 seconds on my machine. I will almost definitely still use forking or something to make this not affect the clients
git-svn-id: <URL>
|
puppetlabs_puppet
|
train
|
19767126c950e9e18b646a94e13bb91b1a17965d
|
diff --git a/test/request-schema-tests-utils.js b/test/request-schema-tests-utils.js
index <HASH>..<HASH> 100644
--- a/test/request-schema-tests-utils.js
+++ b/test/request-schema-tests-utils.js
@@ -182,5 +182,44 @@ module.exports = {
_.partial(U.shouldBeInSchemaError, 'enum', 'method')
]
}
+ },
+ /**
+ * Returns a ReqSchemaTest which should check valid integer for retries property.
+ */
+ invalidRetries: function() {
+ return {
+ name: 'retries not an integer',
+ IODOpts: { retries: 'not an integer' },
+ it: [
+ U.shouldError,
+ _.partial(U.shouldBeInSchemaError, 'type', 'retries')
+ ]
+ }
+ },
+ /**
+ * Returns a ReqSchemaTest which should check valid array for errorCodes property.
+ */
+ invalidErrorCodesArr: function() {
+ return {
+ name: 'errorCodes not an array',
+ IODOpts: { errorCodes: { not: 'an array' } },
+ it: [
+ U.shouldError,
+ _.partial(U.shouldBeInSchemaError, 'type', 'errorCodes')
+ ]
+ }
+ },
+ /**
+ * Returns a ReqSchemaTest which should check valid array integers for errorCodes property.
+ */
+ invalidErrorCodesInt: function() {
+ return {
+ name: 'errorCodes array not integers',
+ IODOpts: { errorCodes: ['not an integer'] },
+ it: [
+ U.shouldError,
+ _.partial(U.shouldBeInSchemaError, 'type', 'errorCodes')
+ ]
+ }
}
}
\ No newline at end of file
diff --git a/test/request-types/discovery.js b/test/request-types/discovery.js
index <HASH>..<HASH> 100644
--- a/test/request-types/discovery.js
+++ b/test/request-types/discovery.js
@@ -34,7 +34,10 @@ exports.schemaTests = function(IOD) {
RSTests.invalidMajorVer(),
RSTests.invalidAction(),
RSTests.invalidMethod(),
- RSTests.invalidParams()
+ RSTests.invalidParams(),
+ RSTests.invalidRetries(),
+ RSTests.invalidErrorCodesArr(),
+ RSTests.invalidErrorCodesInt()
]
}
diff --git a/test/request-types/result.js b/test/request-types/result.js
index <HASH>..<HASH> 100644
--- a/test/request-types/result.js
+++ b/test/request-types/result.js
@@ -33,7 +33,8 @@ exports.schemaTests = function(IOD) {
RSTests.empty(),
RSTests.invalidMajorVer(),
RSTests.invalidMethod(),
- RSTests.invalidJobId()
+ RSTests.invalidJobId(),
+ RSTests.invalidRetries()
]
}
diff --git a/test/request-types/sync.js b/test/request-types/sync.js
index <HASH>..<HASH> 100644
--- a/test/request-types/sync.js
+++ b/test/request-types/sync.js
@@ -34,24 +34,9 @@ exports.schemaTests = function(IOD) {
RSTests.invalidMethod(),
RSTests.invalidParams(),
RSTests.invalidFiles(),
-
- {
- name: 'retries not an integer',
- IODOpts: {
- majorVersion: T.attempt(U.paths.MAJORV1)(IOD),
- action: T.attempt(U.paths.SENTIMENT)(IOD),
- apiVersion: T.attempt(U.paths.APIV1)(IOD),
- method: 'get',
- params: { text: '=)'},
- files: ['files'],
- getResults: 'not a boolean',
- retries: 'a string'
- },
- it: [
- U.shouldError,
- _.partial(U.shouldBeInSchemaError, 'type', 'retries')
- ]
- }
+ RSTests.invalidRetries(),
+ RSTests.invalidErrorCodesArr(),
+ RSTests.invalidErrorCodesInt()
]
}
|
Updated unit test for errorCodes option.
|
benzhou1_iod
|
train
|
52115c6144fa8dbf7f88c5ac12fcea7e258bc254
|
diff --git a/pymouse/x11.py b/pymouse/x11.py
index <HASH>..<HASH> 100644
--- a/pymouse/x11.py
+++ b/pymouse/x11.py
@@ -195,12 +195,12 @@ class PyMouseEvent(PyMouseEventMeta):
def stop(self):
self.state = False
- self.display.ungrab_pointer(X.CurrentTime)
- self.display.record_disable_context(self.ctx)
- self.display.flush()
- self.display2.ungrab_pointer(X.CurrentTime)
- self.display2.record_disable_context(self.ctx)
- self.display2.flush()
+ with display_manager(self.display) as d:
+ d.ungrab_pointer(X.CurrentTime)
+ d.record_disable_context(self.ctx)
+ with display_manager(self.display2) as d:
+ d.ungrab_pointer(X.CurrentTime)
+ d.record_disable_context(self.ctx)
def handler(self, reply):
data = reply.data
|
Trap errors in pymouse.x<I>.PyMouseEvent
|
SavinaRoja_PyUserInput
|
train
|
459f208e6aa561b9f95f612734f127f5d07e76d8
|
diff --git a/src/dig/dot/layout.js b/src/dig/dot/layout.js
index <HASH>..<HASH> 100644
--- a/src/dig/dot/layout.js
+++ b/src/dig/dot/layout.js
@@ -452,6 +452,43 @@ dig.dot.alg.removeType1Conflicts = function(g, medians, layers, layerTraversal)
}
/*
+ * Generates an alignment given the medians and layering of a graph. This
+ * function returns the blocks of the alignment (maximal set of vertically
+ * aligned nodes) and the roots of the alignment (topmost vertex of a block).
+ */
+dig.dot.alg.verticalAlignment = function(g, layers, medians) {
+ var root = {};
+ dig_util_forEach(g.nodes(), function(u) { root[u] = u; });
+
+ var align = {};
+ dig_util_forEach(g.nodes(), function(u) { align[u] = u; });
+
+ for (var i = 1; i < layers.length; ++i) {
+ var r = -1;
+ var prevLayer = layers[i - 1];
+ var prevLayerOrder = dig_dot_alg_nodeOrderMap(g, prevLayer);
+ var currLayer = layers[i];
+ for (var j = 0; j < currLayer.length; ++j) {
+ var v = currLayer[j];
+ var meds = medians[v];
+ for (var k = 0; k < meds.length; ++k) {
+ var u = meds[k];
+ var uPos = prevLayerOrder[u];
+ if (align[v] == v && r < uPos) {
+ align[u] = v;
+ align[v] = root[v] = root[u];
+ r = uPos;
+ }
+ }
+ }
+ }
+ return {
+ root: root,
+ align: align
+ }
+}
+
+/*
* Helper function that creates a map that contains the order of nodes in a
* particular layer.
*/
diff --git a/test/dig/dot/layout-test.js b/test/dig/dot/layout-test.js
index <HASH>..<HASH> 100644
--- a/test/dig/dot/layout-test.js
+++ b/test/dig/dot/layout-test.js
@@ -387,3 +387,40 @@ describe("dig.dot.alg.removeType1Conflicts(graph, layers)", function() {
assert.deepEqual({A1: [], A2: ["B1"], B1: [], B2: []}, meds);
});
});
+
+describe("dig.dot.alg.verticalAlignment(graph, layers, medians)", function() {
+ it("returns two roots for 2 unconnected nodes", function() {
+ var g = dig.dot.read("digraph { 1; 2 }");
+ var layers = [[1], [2]];
+ var meds = {1: [], 2: []};
+ var expected = {
+ root: {1: 1, 2: 2},
+ align: {1: 1, 2: 2}
+ };
+ assert.deepEqual(expected, dig.dot.alg.verticalAlignment(g, layers, meds));
+ });
+
+ it("returns a single root for 2 connected nodes", function() {
+ var g = dig.dot.read("digraph { 1 -> 2 }");
+ var layers = [[1], [2]];
+ var meds = {1: [], 2: [1]};
+ var expected = {
+ root: {1: 1, 2: 1},
+ align: {1: 2, 2: 1}
+ };
+
+ assert.deepEqual(expected, dig.dot.alg.verticalAlignment(g, layers, meds));
+ });
+
+ it("biases to the left when there are two medians", function() {
+ var g = dig.dot.read("digraph { 1 -> 3; 2 -> 3 }");
+ var layers = [[1, 2], [3]];
+ var meds = {1: [], 2: [], 3: [1, 2]};
+ var expected = {
+ root: {1: 1, 2: 2, 3: 1},
+ align: {1: 3, 2: 2, 3: 1}
+ };
+
+ assert.deepEqual(expected, dig.dot.alg.verticalAlignment(g, layers, meds));
+ });
+});
|
dot: initial work on vertical alignment
|
cpettitt_dig.js
|
train
|
ab3f63662c55b8b4ff392fd39c1bff01fadfba1c
|
diff --git a/SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java b/SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java
index <HASH>..<HASH> 100644
--- a/SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java
+++ b/SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java
@@ -1,5 +1,6 @@
package com.hubspot.singularity.mesos;
+import java.net.ConnectException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
@@ -234,6 +235,15 @@ public class SingularityMesosSchedulerClient {
// This is the observable that is responsible for sending calls to mesos master.
PublishSubject<Optional<SinkOperation<Call>>> p = PublishSubject.create();
+ // Retry any operations currently in the pipe if the mesos master temporarily stpos responding
+ p.retry((i, t) -> Throwables.getCausalChain(t).stream().anyMatch((th) -> th instanceof ConnectException));
+
+ // Don't let the publisher stop emitting if it hits an error
+ p.onErrorResumeNext((throwable -> {
+ LOG.error("Could not send call", throwable);
+ return Observable.empty();
+ }));
+
// toSerialised handles the fact that we can add calls on different threads.
publisher = p.toSerialized();
return publisher.onBackpressureBuffer();
|
Additional logic for PublishSubject retries
|
HubSpot_Singularity
|
train
|
86fbbac419468c52d000fe0e0743c555fac8a42a
|
diff --git a/src/PHPCheckstyle/PHPCheckstyle.php b/src/PHPCheckstyle/PHPCheckstyle.php
index <HASH>..<HASH> 100644
--- a/src/PHPCheckstyle/PHPCheckstyle.php
+++ b/src/PHPCheckstyle/PHPCheckstyle.php
@@ -1171,9 +1171,10 @@ class PHPCheckstyle {
break;
case T_BRACES_OPEN: // {
- $this->_processBracesOpen($token);
+ if (!$this->_checkComplexVariable2($token)) {
+ $this->_processBracesOpen($token);
+ }
break;
-
case T_BRACES_CLOSE: // }
$this->_processBracesClose($token);
break;
@@ -1234,8 +1235,9 @@ class PHPCheckstyle {
$this->_inString = !$this->_inString;
break;
case T_DOLLAR:
- $this->_checkComplexVariable($token);
- $this->_checkVariableVariable($token);
+ if (!$this->_checkComplexVariable($token)) {
+ $this->_checkVariableVariable($token);
+ }
break;
case T_ARRAY:
$this->_processArray($token);
@@ -3747,8 +3749,42 @@ class PHPCheckstyle {
// Skip the analysis of the content of the variable.
$this->tokenizer->setCurrentPosition($closePos + 1);
+
+ return true;
}
}
+
+ return false;
+ }
+
+ /**
+ * Check the use of a complex variable {$.
+ *
+ * Skip the analysis inside the variable.
+ * Should be the token T_CURLY_OPEN but can also be T_BRACES_OPEN + T_DOLLAR
+ *
+ * Called when the current token is a single {.
+ *
+ * @param TokenInfo $token
+ */
+ private function _checkComplexVariable2($token) {
+
+ // Right after the { there is a $ with no space between
+ if ($this->tokenizer->checkNextToken(T_DOLLAR) || ($this->tokenizer->checkNextToken(T_VARIABLE))) {
+
+ // Detect the end of the complexe variable
+ $closePos = $this->tokenizer->findNextTokenPosition(T_BRACES_CLOSE);
+
+ if ($closePos !== null) {
+
+ // Skip the analysis of the content of the variable.
+ $this->tokenizer->setCurrentPosition($closePos + 1);
+
+ return true;
+ }
+ }
+
+ return false;
}
/**
diff --git a/test/sample/good_unused.php b/test/sample/good_unused.php
index <HASH>..<HASH> 100644
--- a/test/sample/good_unused.php
+++ b/test/sample/good_unused.php
@@ -20,8 +20,6 @@ class Used {
$a = 2;
$result = $a + $this->toto;
- echo ${$a}; // This should not generate a warning
-
return $result;
}
|
#<I> : checkWhiteSpaceBefore {, unless it's in
|
PHPCheckstyle_phpcheckstyle
|
train
|
67b96f9f232b8f8d27028c0ad0891189e2549735
|
diff --git a/src/REST/__init__.py b/src/REST/__init__.py
index <HASH>..<HASH> 100644
--- a/src/REST/__init__.py
+++ b/src/REST/__init__.py
@@ -8,7 +8,7 @@ from robot.api import logger
from .keywords import Keywords
-__version__ = '1.0.0b2'
+__version__ = '1.0.0b3'
class REST(Keywords):
|
Set next version to '<I>b3'
|
asyrjasalo_RESTinstance
|
train
|
386a4d01ff60a6d202d52d9bc7189bcc5bc5231e
|
diff --git a/openquake/server/tests/views_test.py b/openquake/server/tests/views_test.py
index <HASH>..<HASH> 100644
--- a/openquake/server/tests/views_test.py
+++ b/openquake/server/tests/views_test.py
@@ -92,13 +92,6 @@ class CalcHazardTestCase(BaseViewTestCase):
self.assertEqual(200, response.status_code)
self.assertEqual(expected_content, json.loads(response.content))
- def test_404_no_calcs(self):
- with mock.patch('openquake.server.views._get_calcs') as ghc:
- ghc.return_value = []
- response = views.calc(self.request)
-
- self.assertEqual(404, response.status_code)
-
class CalcRiskTestCase(BaseViewTestCase):
diff --git a/openquake/server/views.py b/openquake/server/views.py
index <HASH>..<HASH> 100644
--- a/openquake/server/views.py
+++ b/openquake/server/views.py
@@ -158,8 +158,6 @@ def calc(request):
base_url = _get_base_url(request)
calc_data = _get_calcs(request.GET)
- if not calc_data:
- return HttpResponseNotFound()
response_data = []
for hc_id, status, job_type, desc in calc_data:
|
If there are not calculations, an empty list is returned, not a NotFound
|
gem_oq-engine
|
train
|
25661209fef6aac063f7c46c97c7328ed50518a8
|
diff --git a/statscraper/base_scraper.py b/statscraper/base_scraper.py
index <HASH>..<HASH> 100644
--- a/statscraper/base_scraper.py
+++ b/statscraper/base_scraper.py
@@ -142,9 +142,9 @@ class Valuelist(list):
"""
def __getitem__(self, key):
- """Make it possible to get dimension by id or identity."""
+ """Make it possible to get value by *dimension id* or or value identity."""
if isinstance(key, six.string_types):
- def f(x): return (x.id == key)
+ def f(x): return (x.dimension.id == key)
elif isinstance(key, DimensionValue):
def f(x): return (x is key)
else:
|
allowed values must be accessed by dimension id
|
jplusplus_statscraper
|
train
|
40cffd65515fbfc4504a00c8c9caa8a7304cd7fd
|
diff --git a/spyder/config/main.py b/spyder/config/main.py
index <HASH>..<HASH> 100644
--- a/spyder/config/main.py
+++ b/spyder/config/main.py
@@ -495,6 +495,8 @@ DEFAULTS = [
'explorer/paste file': 'Ctrl+V',
'explorer/copy absolute path': 'Ctrl+Alt+C',
'explorer/copy relative path': 'Ctrl+Alt+Shift+C',
+ # ---- In plugins/findinfiles/plugin ----
+ 'find_in_files/find in files': 'Ctrl+Alt+F',
}),
('appearance', APPEARANCE),
('lsp-server',
diff --git a/spyder/plugins/findinfiles/plugin.py b/spyder/plugins/findinfiles/plugin.py
index <HASH>..<HASH> 100644
--- a/spyder/plugins/findinfiles/plugin.py
+++ b/spyder/plugins/findinfiles/plugin.py
@@ -27,7 +27,7 @@ _ = get_translation('spyder')
# --- Constants
# ----------------------------------------------------------------------------
class FindInFilesActions:
- FindInFiles = 'find_in_files_action'
+ FindInFiles = 'find in files'
# --- Plugin
@@ -79,13 +79,13 @@ class FindInFiles(SpyderDockablePlugin):
tip=_("Search text in multiple files"),
triggered=self.find,
register_shortcut=True,
+ context=Qt.WindowShortcut
)
menu = self.get_application_menu(ApplicationMenus.Search)
self.add_item_to_application_menu(
findinfiles_action,
menu=menu,
)
- findinfiles_action.triggered.connect(lambda: self.switch_to_plugin())
search_toolbar = self.get_application_toolbar(
ApplicationToolBars.Search)
|
Find: Add shortcut for new "Find in files" action
|
spyder-ide_spyder
|
train
|
e8290206e0c6b4335db3710352ed2913aedba64c
|
diff --git a/test/extended/prometheus/prometheus.go b/test/extended/prometheus/prometheus.go
index <HASH>..<HASH> 100644
--- a/test/extended/prometheus/prometheus.go
+++ b/test/extended/prometheus/prometheus.go
@@ -226,7 +226,7 @@ var _ = g.Describe("[Feature:Prometheus][Conformance] Prometheus", func() {
execPod := exutil.CreateCentosExecPodOrFail(oc.AdminKubeClient(), ns, "execpod", nil)
defer func() { oc.AdminKubeClient().CoreV1().Pods(ns).Delete(execPod.Name, metav1.NewDeleteOptions(1)) }()
- g.By("creating a non-default ingresscontroller")
+ g.By("creating a new ingresscontroller")
replicas := int32(1)
ingress := &operatorv1.IngressController{
ObjectMeta: metav1.ObjectMeta{
@@ -250,6 +250,18 @@ var _ = g.Describe("[Feature:Prometheus][Conformance] Prometheus", func() {
o.Expect(err).NotTo(o.HaveOccurred())
defer func() {
+ dump := func(resources ...string) {
+ for _, resource := range resources {
+ out, err := oc.AsAdmin().Run("get").Args("--namespace", "openshift-ingress", resource, "-o", "json").Output()
+ if err == nil {
+ e2e.Logf("%s", out)
+ } else {
+ e2e.Logf("error getting %s: %v", resource, err)
+ }
+ }
+ }
+ dump("servicemonitors", "services", "endpoints", "pods")
+
if err := oc.AdminOperatorClient().OperatorV1().IngressControllers(ingress.Namespace).Delete(ingress.Name, metav1.NewDeleteOptions(1)); err != nil {
e2e.Logf("WARNING: failed to delete ingresscontroller '%s/%s' created during test cleanup: %v", ingress.Namespace, ingress.Name, err)
} else {
|
ingress metrics debugging
Add additional context to ingress metrics tests to debug prometheus
integration issues.
|
openshift_origin
|
train
|
5545bbc59a35d001f363b5582c42cf42c2a7db56
|
diff --git a/lib/rspec_api_documentation/dsl/endpoint.rb b/lib/rspec_api_documentation/dsl/endpoint.rb
index <HASH>..<HASH> 100644
--- a/lib/rspec_api_documentation/dsl/endpoint.rb
+++ b/lib/rspec_api_documentation/dsl/endpoint.rb
@@ -59,6 +59,11 @@ module RspecApiDocumentation::DSL
parameters
end
+ def header(name, value)
+ example.metadata[:headers] ||= {}
+ example.metadata[:headers][name] = value
+ end
+
def headers
return unless example.metadata[:headers]
example.metadata[:headers].inject({}) do |hash, (header, value)|
diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/dsl_spec.rb
+++ b/spec/dsl_spec.rb
@@ -401,6 +401,19 @@ resource "Order" do
end
put "/orders" do
+ context "setting header in example level" do
+ before do
+ header "Accept", "application/json"
+ header "Content-Type", "application/json"
+ end
+
+ it "adds to headers" do
+ headers.should == { "Accept" => "application/json", "Content-Type" => "application/json" }
+ end
+ end
+ end
+
+ put "/orders" do
header "Accept", :accept
let(:accept) { "application/json" }
|
Allow headers to be set inside an example.
Closes #<I>
|
zipmark_rspec_api_documentation
|
train
|
a62cbdeb47e5e504e670c546ad8bec45e696f370
|
diff --git a/builder/internals.go b/builder/internals.go
index <HASH>..<HASH> 100644
--- a/builder/internals.go
+++ b/builder/internals.go
@@ -539,7 +539,7 @@ func (b *Builder) run(c *daemon.Container) error {
logsJob.Setenv("stdout", "1")
logsJob.Setenv("stderr", "1")
logsJob.Stdout.Add(b.OutStream)
- logsJob.Stderr.Add(b.ErrStream)
+ logsJob.Stderr.Set(b.ErrStream)
if err := logsJob.Run(); err != nil {
return err
}
|
Use Set for stderr "logs" job in builder
Because engine implicitly adds his stder to job stderr
|
containers_storage
|
train
|
902fd82cfb03cf097420689304a8791fd1e15798
|
diff --git a/graylog2-server/src/main/java/org/graylog2/security/RestPermissions.java b/graylog2-server/src/main/java/org/graylog2/security/RestPermissions.java
index <HASH>..<HASH> 100644
--- a/graylog2-server/src/main/java/org/graylog2/security/RestPermissions.java
+++ b/graylog2-server/src/main/java/org/graylog2/security/RestPermissions.java
@@ -109,7 +109,10 @@ public class RestPermissions {
MESSAGES_READ,
METRICS_READ,
SYSTEM_READ,
- THROUGHPUT_READ
+ THROUGHPUT_READ,
+ SAVEDSEARCHES_CREATE,
+ SAVEDSEARCHES_EDIT,
+ SAVEDSEARCHES_READ
);
public static Set<String> readerPermissions(String username) {
|
give reader users permission to saved searches
also adds permission checks in the templates, basically everyone has those permissions now.
fixes Graylog2/graylog2-web-interface#<I>
|
Graylog2_graylog2-server
|
train
|
2de6335fc65eafae1c089e6568fc202129308f7f
|
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphbinary/AnySerializer-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphbinary/AnySerializer-test.js
index <HASH>..<HASH> 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphbinary/AnySerializer-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphbinary/AnySerializer-test.js
@@ -214,6 +214,9 @@ describe('GraphBinary.AnySerializer', () => {
]
},
+ // GraphSerializer
+ // TODO: it's ignored for now
+
// VertexPropertySerializer
{ v:new VertexProperty('00010203-0405-0607-0809-0a0b0c0d0e0f', 'Label', 42),
b:[
@@ -226,6 +229,9 @@ describe('GraphBinary.AnySerializer', () => {
]
},
+ // BindingSerializer
+ // TODO: it's ignored for now
+
// LongSerializer
// TODO +
@@ -399,6 +405,9 @@ describe('GraphBinary.AnySerializer', () => {
]
},
+ // GRAPH
+ // TODO: it's ignored for now
+
// VERTEX
{ v:null, b:[0x11,0x01] },
{ v:new Vertex('00010203-0405-0607-0809-0a0b0c0d0e0f', 'A', null),
@@ -422,6 +431,9 @@ describe('GraphBinary.AnySerializer', () => {
{ v:null, b:[0x13,0x01] },
{ v:new t.EnumValue('Barrier','normSack'), b:[0x13,0x00, 0x03,0x00, 0x00,0x00,0x00,0x08, ...from('normSack')] },
+ // BINDING
+ // TODO: it's ignored for now
+
// BYTECODE
{ v:null, b:[0x15,0x01] },
{ v:new Bytecode(), b:[0x15,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00] },
|
Ignore Graph and Binding types
|
apache_tinkerpop
|
train
|
7fa6dc2346653f31a0c0a40c028ae068c4ad91f8
|
diff --git a/Neos.Neos/Resources/Public/JavaScript/index.js b/Neos.Neos/Resources/Public/JavaScript/index.js
index <HASH>..<HASH> 100644
--- a/Neos.Neos/Resources/Public/JavaScript/index.js
+++ b/Neos.Neos/Resources/Public/JavaScript/index.js
@@ -51,16 +51,16 @@ modalTrigger.forEach((_modalTrigger) => {
}
});
-const expanableElements = document.querySelectorAll(
+const expandableElements = document.querySelectorAll(
"[data-neos-expandable=dropdown]"
);
-expanableElements.forEach((expanableElement) => {
- new DropDown(expanableElement);
+expandableElements.forEach((expandableElement) => {
+ new DropDown(expandableElement);
});
-const expanableGroupElements = document.querySelectorAll(
+const expandableGroupElements = document.querySelectorAll(
"[data-neos-expandable=dropdown-group]"
);
-expanableGroupElements.forEach((expanableElement) => {
- new DropDownGroup(expanableElement);
+expandableGroupElements.forEach((expandableElement) => {
+ new DropDownGroup(expandableElement);
});
|
TASK: Fix typo in variable name for expandable components
|
neos_neos-development-collection
|
train
|
89232931b72d0eb8a8d571d626a05e279ce42db4
|
diff --git a/lib/quadrigacx/coin.rb b/lib/quadrigacx/coin.rb
index <HASH>..<HASH> 100644
--- a/lib/quadrigacx/coin.rb
+++ b/lib/quadrigacx/coin.rb
@@ -1,6 +1,8 @@
module QuadrigaCX
module Coin
BITCOIN = 'bitcoin'
+ BITCOIN_CASH = 'bitcoincash'
+ BITCOIN_GOLD = 'bitcoingold'
LITECOIN = 'litecoin'
ETHER = 'ether'
@@ -12,6 +14,8 @@ module QuadrigaCX
ALL_COINS = [
BITCOIN,
+ BITCOIN_CASH,
+ BITCOIN_GOLD,
LITECOIN,
ETHER
]
|
Fix #<I> - Add bitcoin gold/cash support for withdraw/deposit_address
|
mhluska_quadrigacx
|
train
|
b0c6993c8c688490b199d8a4a0ae495b68cc01a7
|
diff --git a/src/main/java/org/primefaces/extensions/component/reseteditablevalues/ResetEditableValuesTagHandler.java b/src/main/java/org/primefaces/extensions/component/reseteditablevalues/ResetEditableValuesTagHandler.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/primefaces/extensions/component/reseteditablevalues/ResetEditableValuesTagHandler.java
+++ b/src/main/java/org/primefaces/extensions/component/reseteditablevalues/ResetEditableValuesTagHandler.java
@@ -80,12 +80,12 @@ public class ResetEditableValuesTagHandler extends TagHandler {
for (List<ClientBehavior> listBehaviors : clientBehaviors) {
for (ClientBehavior clientBehavior : listBehaviors) {
- if (clientBehavior instanceof javax.faces.component.behavior.AjaxBehavior) {
- ((javax.faces.component.behavior.AjaxBehavior) clientBehavior).addAjaxBehaviorListener(
- new ResetEditableValuesListener(strFor));
- } else if (clientBehavior instanceof org.primefaces.component.behavior.ajax.AjaxBehavior) {
+ if (clientBehavior instanceof org.primefaces.component.behavior.ajax.AjaxBehavior) {
((org.primefaces.component.behavior.ajax.AjaxBehavior) clientBehavior).addAjaxBehaviorListener(
new ResetEditableValuesListener(strFor));
+ } else if (clientBehavior instanceof javax.faces.component.behavior.AjaxBehavior) {
+ ((javax.faces.component.behavior.AjaxBehavior) clientBehavior).addAjaxBehaviorListener(
+ new ResetEditableValuesListener(strFor));
}
}
}
|
Added p:ajax showcase for ResetEditableValues (not finished yet).
|
primefaces-extensions_core
|
train
|
2887161677d42ee4f2a6a29d86f88882abf80977
|
diff --git a/src/canmatrix/canmatrix.py b/src/canmatrix/canmatrix.py
index <HASH>..<HASH> 100644
--- a/src/canmatrix/canmatrix.py
+++ b/src/canmatrix/canmatrix.py
@@ -61,7 +61,7 @@ class BoardUnit(object):
"""
name = attr.ib(type=str)
- comment = attr.ib(type=str, default=None)
+ comment = attr.ib(default=None)
attributes = attr.ib(factory=dict, repr=False)
def attribute(self, attributeName, db=None, default=None):
|
remove type=str as the comment can be None as well
|
ebroecker_canmatrix
|
train
|
80544678c910c659ea31642ec382ea66b690d87f
|
diff --git a/src/basis/data/vector.js b/src/basis/data/vector.js
index <HASH>..<HASH> 100644
--- a/src/basis/data/vector.js
+++ b/src/basis/data/vector.js
@@ -19,7 +19,7 @@
var DataObject = basisData.Object;
var Slot = basisData.Slot;
var SourceDataset = require('basis.data.dataset').SourceDataset;
-
+ var createRuleEvents = require('./dataset/createRuleEvents.js');
//
@@ -245,20 +245,18 @@
};
}
- var VECTOR_ITEM_HANDLER = {
- update: function(object){
- var sourceObjectInfo = this.sourceMap_[object.basisObjectId];
- var key = this.rule(object);
+ var VECTOR_SOURCEOBJECT_UPDATE = function(object){
+ var sourceObjectInfo = this.sourceMap_[object.basisObjectId];
+ var key = this.rule(object);
- if (sourceObjectInfo.key !== key)
- {
- var delta = changeSourceObjectKey(this, key, sourceObjectInfo, true);
- if (delta = getDelta(delta.inserted && [delta.inserted], delta.deleted && [delta.deleted]))
- this.emit_itemsChanged(delta);
- }
- else
- recalcSourceObject(this, sourceObjectInfo);
+ if (sourceObjectInfo.key !== key)
+ {
+ var delta = changeSourceObjectKey(this, key, sourceObjectInfo, true);
+ if (delta = getDelta(delta.inserted && [delta.inserted], delta.deleted && [delta.deleted]))
+ this.emit_itemsChanged(delta);
}
+ else
+ recalcSourceObject(this, sourceObjectInfo);
};
var VECTOR_SOURCE_HANDLER = {
@@ -311,7 +309,7 @@
member.count++;
// add handler
- object.addHandler(VECTOR_ITEM_HANDLER, this);
+ object.addHandler(this.ruleEvents, this);
var updateData = {};
for (var calcName in calcs)
@@ -339,7 +337,7 @@
delete member[objectId];
// remove handler
- object.removeHandler(VECTOR_ITEM_HANDLER, this);
+ object.removeHandler(this.ruleEvents, this);
// process member
if (--member.count == 0)
@@ -392,6 +390,7 @@
slots_: null,
rule: defaultRule,
+ ruleEvents: createRuleEvents(VECTOR_SOURCEOBJECT_UPDATE, 'update'),
emit_itemsChanged: function(delta){
SourceDataset.prototype.emit_itemsChanged.call(this, delta);
|
basis.data.vector: implement ruleEvents
|
basisjs_basisjs
|
train
|
8e7e5ac96baa292e43e2d7f6509b8f4bf5e3ffa9
|
diff --git a/zounds/timeseries/samplerate.py b/zounds/timeseries/samplerate.py
index <HASH>..<HASH> 100644
--- a/zounds/timeseries/samplerate.py
+++ b/zounds/timeseries/samplerate.py
@@ -92,6 +92,9 @@ class SampleRate(object):
def samples_per_second(self):
return int(Picoseconds(int(1e12)) / self.frequency)
+ def __int__(self):
+ return self.samples_per_second
+
@property
def nyquist(self):
return self.samples_per_second // 2
@@ -129,9 +132,6 @@ class AudioSampleRate(SampleRate):
self.one_sample = Picoseconds(int(1e12)) // samples_per_second
super(AudioSampleRate, self).__init__(self.one_sample, self.one_sample)
- def __int__(self):
- return self.samples_per_second
-
def half_lapped(self):
return SampleRate(
self.one_sample * self.suggested_hop,
|
Push samples_per_second method into base class, as it is just as valid there
|
JohnVinyard_zounds
|
train
|
11614f00cb120bc2d3d6c4a897e16f624c50044a
|
diff --git a/tests/rw_functional.py b/tests/rw_functional.py
index <HASH>..<HASH> 100644
--- a/tests/rw_functional.py
+++ b/tests/rw_functional.py
@@ -876,10 +876,14 @@ class RHPartnerTest(BaseTest):
# Delete any existing external trackers to get to a known state
self._deleteAllExistingExternalTrackers(bugid)
+ url = "https://bugzilla.mozilla.org"
+ if bz.bz_ver_major < 5:
+ url = "http://bugzilla.mozilla.org"
+
# test adding tracker
kwargs = {
'ext_type_id': 6,
- 'ext_type_url': 'http://bugzilla.mozilla.org',
+ 'ext_type_url': url,
'ext_type_description': 'Mozilla Foundation',
'ext_status': 'Original Status',
'ext_description': 'the description',
|
tests: Fix externalbug test to work with rhbz version 4 and 5
The mozilla URL changed
|
python-bugzilla_python-bugzilla
|
train
|
644a4dfba6cd80a2f3ca3be7a7b3374dff0a9bff
|
diff --git a/spec/scss_lint/linter_registry_spec.rb b/spec/scss_lint/linter_registry_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/scss_lint/linter_registry_spec.rb
+++ b/spec/scss_lint/linter_registry_spec.rb
@@ -2,24 +2,33 @@ require 'spec_helper'
describe SCSSLint::LinterRegistry do
context 'when including the LinterRegistry module' do
+ after do
+ described_class.linters.delete(FakeLinter)
+ end
+
it 'adds the linter to the set of registered linters' do
expect do
class FakeLinter < SCSSLint::Linter
include SCSSLint::LinterRegistry
end
- end.to change { SCSSLint::LinterRegistry.linters.count }.by(1)
+ end.to change { described_class.linters.count }.by(1)
end
end
describe '.extract_linters_from' do
module SCSSLint
- class Linter::SomeLinter < Linter; include LinterRegistry; end
- class Linter::SomeOtherLinter < Linter::SomeLinter; end
+ class Linter::SomeLinter < Linter; end
+ class Linter::SomeOtherLinter < Linter; end
end
+
let(:linters) do
[SCSSLint::Linter::SomeLinter, SCSSLint::Linter::SomeOtherLinter]
end
+ before do
+ described_class.stub(:linters).and_return(linters)
+ end
+
context 'when the linters exist' do
let(:linter_names) { %w[SomeLinter SomeOtherLinter] }
|
Fix LinterRegistry specs to not pollute actual registry
In the process of writing some other specs, there was a problem where
the linters inserted into the registry by this spec were breaking other
specs.
Fix by modifying the specs to not modify the global linter registry.
Change-Id: I<I>c0e<I>da4f6ebc8f<I>f<I>e<I>bd5f
Reviewed-on: <URL>
|
sds_scss-lint
|
train
|
a3aa5134e5d7d5d81e19451b551041d0c56dc1d4
|
diff --git a/aiortc/sctp.py b/aiortc/sctp.py
index <HASH>..<HASH> 100644
--- a/aiortc/sctp.py
+++ b/aiortc/sctp.py
@@ -230,7 +230,7 @@ class Packet:
def __bytes__(self):
checksum = 0
data = pack(
- '!HHII',
+ '!HHLL',
self.source_port,
self.destination_port,
self.verification_tag,
@@ -240,7 +240,7 @@ class Packet:
# calculate checksum
checksum = swapl(crc32c(data))
- return data[0:8] + pack('!I', checksum) + data[12:]
+ return data[0:8] + pack('!L', checksum) + data[12:]
@classmethod
def parse(cls, data):
@@ -248,7 +248,7 @@ class Packet:
raise ValueError('SCTP packet length is less than 12 bytes')
source_port, destination_port, verification_tag, checksum = unpack(
- '!HHII', data[0:12])
+ '!HHLL', data[0:12])
# verify checksum
check_data = data[0:8] + b'\x00\x00\x00\x00' + data[12:]
|
[sctp] use 'L' for 4 byte packing for consistency
|
aiortc_aiortc
|
train
|
e303218ca0d8ce5e61e1560fbb50223fa7adc498
|
diff --git a/aeron-cluster/src/main/java/io/aeron/cluster/IngressAdapter.java b/aeron-cluster/src/main/java/io/aeron/cluster/IngressAdapter.java
index <HASH>..<HASH> 100644
--- a/aeron-cluster/src/main/java/io/aeron/cluster/IngressAdapter.java
+++ b/aeron-cluster/src/main/java/io/aeron/cluster/IngressAdapter.java
@@ -30,7 +30,7 @@ class IngressAdapter implements ControlledFragmentHandler, AutoCloseable
{
private static final int INGRESS_HEADER =
MessageHeaderDecoder.ENCODED_LENGTH + IngressMessageHeaderDecoder.BLOCK_LENGTH;
- private static final int FRAGMENT_POLL_LIMIT = 10;
+ private static final int FRAGMENT_POLL_LIMIT = 100;
private final MessageHeaderDecoder messageHeaderDecoder = new MessageHeaderDecoder();
private final SessionConnectRequestDecoder connectRequestDecoder = new SessionConnectRequestDecoder();
|
[Java] Increase fragment poll limit for ingress adapter to allow for greater batching under burst conditions in the cluster.
|
real-logic_aeron
|
train
|
572b7b6dda9ca0d3578eaaca02eaee3e0cc84edd
|
diff --git a/src/Mapper/AbstractMapper.php b/src/Mapper/AbstractMapper.php
index <HASH>..<HASH> 100644
--- a/src/Mapper/AbstractMapper.php
+++ b/src/Mapper/AbstractMapper.php
@@ -199,29 +199,10 @@ abstract class AbstractMapper implements MapperInterface
$select = $this->newSelect();
$table = $this->table->getName();
$select->from($table);
- foreach ($colsVals as $col => $val) {
- $this->selectWhere($select, $table, $col, $val);
- }
+ $select->colsVals($table, $colsVals);
return $select;
}
- protected function selectWhere(Select $select, $table, $col, $val)
- {
- $col = $table . '.' . $col;
-
- if (is_array($val)) {
- $select->where("{$col} IN (?)", $val);
- return;
- }
-
- if ($val === null) {
- $select->where("{$col} IS NULL");
- return;
- }
-
- $select->where("{$col} = ?", $val);
- }
-
/**
*
* Inserts the Row for a Record.
diff --git a/src/Mapper/Select.php b/src/Mapper/Select.php
index <HASH>..<HASH> 100644
--- a/src/Mapper/Select.php
+++ b/src/Mapper/Select.php
@@ -194,6 +194,30 @@ class Select
return $this;
}
+ public function colsVals($table, array $colsVals)
+ {
+ foreach ($colsVals as $col => $val) {
+ $this->colVal($table, $col, $val);
+ }
+ }
+
+ protected function colVal($table, $col, $val)
+ {
+ $col = $table . '.' . $col;
+
+ if (is_array($val)) {
+ $this->where("{$col} IN (?)", $val);
+ return;
+ }
+
+ if ($val === null) {
+ $this->where("{$col} IS NULL");
+ return;
+ }
+
+ $this->where("{$col} = ?", $val);
+ }
+
public function fetchRecord()
{
$this->select->cols($this->colNames);
|
move select-where-colsvals to Select
|
atlasphp_Atlas.Orm
|
train
|
e57068e9a6df7546d1fbb76d0d02b4beaee9acc8
|
diff --git a/lib/entities/tokens.js b/lib/entities/tokens.js
index <HASH>..<HASH> 100644
--- a/lib/entities/tokens.js
+++ b/lib/entities/tokens.js
@@ -10,7 +10,9 @@
var self = {},
crypto = require("../utils/crypto"),
- db = require("../db");
+ users = require("./users"),
+ db = require("../db"),
+ q = require('q');
self.getById = function(token){
return db.tokens.getById(token);
@@ -28,5 +30,17 @@
});
};
+ self.validate = function(token){
+ var deferred = q.defer();
+
+ function parseToken(token){
+ users.getById(token.uid).then(deferred.resolve).fail(deferred.reject);
+ }
+
+ self.getById(token).then(parseToken).fail(deferred.reject);
+
+ return deferred.promise;
+ };
+
module.exports = self;
})();
\ No newline at end of file
diff --git a/lib/entities/users.js b/lib/entities/users.js
index <HASH>..<HASH> 100644
--- a/lib/entities/users.js
+++ b/lib/entities/users.js
@@ -114,7 +114,7 @@
db.users.getByLogin(userObj.login)
.then(function(existingUserObj){
//Validate if the user tried to change their role without being an admin.
- if(existingUserObj && (userObj.role != existingUserObj.role && existingUserObj.role != privileges.available.ADMIN)){
+ if(existingUserObj && (userObj.role !== existingUserObj.role && privileges.available[existingUserObj.role.toUpperCase()] !== privileges.available.ADMIN)){
deferred.reject(new Error("You do not have the permissions to change your role."));
|
Synced modules with bomberman.
|
grasshopper-cms_grasshopper-core-nodejs
|
train
|
36b1cc80ee6980d21bc8fe5ea0f6c4fd77bd4dc8
|
diff --git a/src/PlaygroundUser/Module.php b/src/PlaygroundUser/Module.php
index <HASH>..<HASH> 100644
--- a/src/PlaygroundUser/Module.php
+++ b/src/PlaygroundUser/Module.php
@@ -178,10 +178,10 @@ class Module
'invokables' => array(
'PlaygroundUser\Form\Login' => 'PlaygroundUser\Form\Login',
'playgrounduser_redirectionstrategy_service' => 'PlaygroundUser\View\Strategy\RedirectionStrategy',
+ 'playgrounduser_user_service' => 'PlaygroundUser\Service\User',
),
'factories' => array(
- 'playgrounduser_user_service' => 'PlaygroundUser\Service\Factory\UserFactory',
'playgrounduser_rememberme_service' => 'PlaygroundUser\Service\Factory\RememberMeFactory',
'playgrounduser_team_service' => 'PlaygroundUser\Service\Factory\TeamFactory',
'playgrounduser_password_service' => 'PlaygroundUser\Service\Factory\PasswordFactory',
diff --git a/src/PlaygroundUser/Service/User.php b/src/PlaygroundUser/Service/User.php
index <HASH>..<HASH> 100644
--- a/src/PlaygroundUser/Service/User.php
+++ b/src/PlaygroundUser/Service/User.php
@@ -5,6 +5,7 @@ namespace PlaygroundUser\Service;
use PlaygroundUser\Entity\UserProvider;
use Zend\Form\Form;
use Zend\ServiceManager\ServiceManager;
+use Zend\ServiceManager\ServiceManagerAwareInterface;
use Zend\Crypt\Password\Bcrypt;
use PlaygroundUser\Options\ModuleOptions;
use Zend\Validator\File\Size;
@@ -14,7 +15,7 @@ use PlaygroundUser\Entity\User as UserEntity;
use PlaygroundUser\Entity\Role;
use Zend\ServiceManager\ServiceLocatorInterface;
-class User extends \ZfcUser\Service\User
+class User extends \ZfcUser\Service\User implements ServiceManagerAwareInterface
{
/**
@@ -50,10 +51,10 @@ class User extends \ZfcUser\Service\User
*/
protected $options;
- public function __construct(ServiceLocatorInterface $locator)
- {
- $this->serviceManager = $locator;
- }
+ // public function __construct(ServiceLocatorInterface $locator)
+ // {
+ // $this->serviceManager = $locator;
+ // }
/**
* functional mandatory fields go in the form validator part
@@ -1133,4 +1134,11 @@ class User extends \ZfcUser\Service\User
{
return $this->serviceManager;
}
+
+ public function setServiceManager(ServiceManager $serviceManager)
+ {
+ $this->serviceManager = $serviceManager;
+
+ return $this;
+ }
}
|
revert to saty compatible with zfcuser 2.*...
|
gregorybesson_PlaygroundUser
|
train
|
d8a468ae79457e8bbfdf93189b70633fe56fe794
|
diff --git a/liquibase-core/src/main/java/liquibase/diff/DiffResult.java b/liquibase-core/src/main/java/liquibase/diff/DiffResult.java
index <HASH>..<HASH> 100644
--- a/liquibase-core/src/main/java/liquibase/diff/DiffResult.java
+++ b/liquibase-core/src/main/java/liquibase/diff/DiffResult.java
@@ -6,7 +6,9 @@ import liquibase.diff.compare.DatabaseObjectComparatorFactory;
import liquibase.exception.DatabaseException;
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.structure.DatabaseObject;
+import liquibase.structure.core.Catalog;
import liquibase.structure.core.Column;
+import liquibase.structure.core.Schema;
import java.io.*;
import java.util.*;
@@ -167,6 +169,21 @@ public class DiffResult {
public void addChangedObject(DatabaseObject obj, ObjectDifferences differences) {
+ if (obj instanceof Catalog || obj instanceof Schema) {
+ if (differences.getSchemaComparisons() != null && differences.getDifferences().size() == 1 && differences.getDifference("name") != null) {
+ boolean schemasMapped = false;
+ for (CompareControl.SchemaComparison comparison : differences.getSchemaComparisons()) {
+ if (comparison.getReferenceSchema() != null
+ && comparison.getComparisonSchema() != null
+ && !comparison.getReferenceSchema().toString().equalsIgnoreCase(comparison.getComparisonSchema().toString())) {
+ schemasMapped = true;
+ }
+ }
+ if (schemasMapped) {
+ return; //don't save name differences
+ }
+ }
+ }
changedObjects.put(obj, differences);
}
diff --git a/liquibase-core/src/main/java/liquibase/diff/compare/core/CatalogComparator.java b/liquibase-core/src/main/java/liquibase/diff/compare/core/CatalogComparator.java
index <HASH>..<HASH> 100644
--- a/liquibase-core/src/main/java/liquibase/diff/compare/core/CatalogComparator.java
+++ b/liquibase-core/src/main/java/liquibase/diff/compare/core/CatalogComparator.java
@@ -58,7 +58,55 @@ public class CatalogComparator implements DatabaseObjectComparator {
return otherSchema.getCatalogName() == null;
}
- return thisSchema.getCatalogName().equalsIgnoreCase(otherSchema.getCatalogName());
+ if (thisSchema.getCatalogName().equalsIgnoreCase(otherSchema.getCatalogName())) {
+ return true;
+ }
+
+ if (accordingTo.supportsSchemas()) { //no need to check schema mappings
+ return false;
+ }
+
+ //check with schemaComparisons
+ if (chain.getSchemaComparisons() != null && chain.getSchemaComparisons().length > 0) {
+ for (CompareControl.SchemaComparison comparison : chain.getSchemaComparisons()) {
+ String comparisonCatalog1;
+ String comparisonCatalog2;
+ if (accordingTo.supportsSchemas()) {
+ comparisonCatalog1 = comparison.getComparisonSchema().getSchemaName();
+ comparisonCatalog2 = comparison.getReferenceSchema().getSchemaName();
+ } else if (accordingTo.supportsCatalogs()) {
+ comparisonCatalog1 = comparison.getComparisonSchema().getCatalogName();
+ comparisonCatalog2 = comparison.getReferenceSchema().getCatalogName();
+ } else {
+ break;
+ }
+
+ String finalCatalog1 = thisSchema.getCatalogName();
+ String finalCatalog2 = otherSchema.getCatalogName();
+
+ if (comparisonCatalog1 != null && comparisonCatalog1.equalsIgnoreCase(finalCatalog1)) {
+ finalCatalog1 = comparisonCatalog2;
+ } else if (comparisonCatalog2 != null && comparisonCatalog2.equalsIgnoreCase(finalCatalog1)) {
+ finalCatalog1 = comparisonCatalog1;
+ }
+
+ if (StringUtils.trimToEmpty(finalCatalog1).equalsIgnoreCase(StringUtils.trimToEmpty(finalCatalog2))) {
+ return true;
+ }
+
+ if (comparisonCatalog1 != null && comparisonCatalog1.equalsIgnoreCase(finalCatalog2)) {
+ finalCatalog2 = comparisonCatalog2;
+ } else if (comparisonCatalog2 != null && comparisonCatalog2.equalsIgnoreCase(finalCatalog2)) {
+ finalCatalog2 = comparisonCatalog1;
+ }
+
+ if (StringUtils.trimToEmpty(finalCatalog1).equalsIgnoreCase(StringUtils.trimToEmpty(finalCatalog2))) {
+ return true;
+ }
+ }
+ }
+
+ return false;
}
@Override
diff --git a/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java b/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java
index <HASH>..<HASH> 100644
--- a/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java
+++ b/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java
@@ -64,6 +64,9 @@ public class DiffToReport {
});
types.addAll(diffResult.getCompareControl().getComparedTypes());
for (Class<? extends DatabaseObject> type : types) {
+ if (type.equals(Schema.class) && !diffResult.getComparisonSnapshot().getDatabase().supportsSchemas()) {
+ continue;
+ }
printSetComparison("Missing " + getTypeName(type), diffResult.getMissingObjects(type, comparator), out);
printSetComparison("Unexpected " + getTypeName(type), diffResult.getUnexpectedObjects(type, comparator), out);
|
CORE-<I> Multi-schema snapshot bugfixes
Improve diff report output
|
liquibase_liquibase
|
train
|
8e3300b46d43941dad0acd0a644a7ea19239e145
|
diff --git a/lib/action_kit_api/data_model.rb b/lib/action_kit_api/data_model.rb
index <HASH>..<HASH> 100644
--- a/lib/action_kit_api/data_model.rb
+++ b/lib/action_kit_api/data_model.rb
@@ -28,14 +28,8 @@ module ActionKitApi
call = "#{class_name}.save_or_create"
- # Debugging stuff
- if self.respond_to?('ap')
- ap call
- ap attrs_hash
- else
- puts call
- puts attrs_hash
- end
+ puts call
+ puts attrs_hash
response = ActionKitApi.connection.call(call, attrs_hash)
@@ -72,7 +66,7 @@ module ActionKitApi
user_hash = {}
self.instance_variables.each do |iv|
- key = iv.delete("@").to_sym
+ key = iv.to_s.delete("@").to_sym
next if key == :required_attrs
next if key == :read_only_attrs
|
Issue was with differences between <I> and <I>.x instance_variables method
|
Democracy-for-America_ActionKitApi
|
train
|
a7a8f2bde972d18d545323d49c64f7520161c578
|
diff --git a/sentry.go b/sentry.go
index <HASH>..<HASH> 100644
--- a/sentry.go
+++ b/sentry.go
@@ -18,6 +18,7 @@ func InitSentry() {
if err != nil {
log.WithError(err).Fatal("Error creating sentry client")
}
+ log.AddHook(sentryHook{sentry, []log.Level{log.ErrorLevel, log.FatalLevel, log.PanicLevel}})
Sentry = sentry
}
@@ -58,3 +59,63 @@ func ConsumePanic(err interface{}) {
panic(err)
}
+
+// logrus hook to send error/fatal/panic messages to sentry
+type sentryHook struct {
+ c *raven.Client
+ lv []log.Level
+}
+
+var _ log.Hook = sentryHook{}
+
+func (s sentryHook) Levels() []log.Level {
+ return s.lv
+}
+
+func (s sentryHook) Fire(e *log.Entry) error {
+ p := raven.Packet{
+ ServerName: Config.Hostname,
+ Interfaces: []raven.Interface{
+ // ignore the stack frames for the Fire function itself
+ // the logrus machinery that invoked Fire will also be hidden
+ // because it is not an "in-app" library
+ raven.NewStacktrace(2, 3, []string{"main", "github.com/stripe/veneur"}),
+ },
+ }
+
+ if err, ok := e.Data[log.ErrorKey].(error); ok {
+ p.Message = err.Error()
+ } else {
+ p.Message = e.Message
+ }
+
+ p.Extra = make(map[string]interface{}, len(e.Data)-1)
+ for k, v := range e.Data {
+ if k == log.ErrorKey {
+ continue // already handled this key, don't put it into the Extra hash
+ }
+ p.Extra[k] = v
+ }
+
+ switch e.Level {
+ case log.FatalLevel, log.PanicLevel:
+ p.Level = raven.FATAL
+ case log.ErrorLevel:
+ p.Level = raven.ERROR
+ case log.WarnLevel:
+ p.Level = raven.WARNING
+ case log.InfoLevel:
+ p.Level = raven.INFO
+ case log.DebugLevel:
+ p.Level = raven.DEBUG
+ }
+
+ _, ch := s.c.Capture(&p, nil)
+
+ if e.Level == log.PanicLevel || e.Level == log.FatalLevel {
+ // we don't want the program to terminate before reporting to sentry
+ return <-ch
+ } else {
+ return nil
+ }
+}
|
Add logrus hook for sentry error reporting
Panics are our main concern when reporting to sentry, but if we have the
sentry client anyway, we might as well report other errors too.
|
stripe_veneur
|
train
|
207222cc52b0d92c78744c59c5e2f2635adf0a42
|
diff --git a/src/enhancer.js b/src/enhancer.js
index <HASH>..<HASH> 100644
--- a/src/enhancer.js
+++ b/src/enhancer.js
@@ -52,28 +52,20 @@ export default ({ history, matchRoute, createMatcher }: EnhancerArgs) => (
matchCache.clear();
const match = currentMatcher(location.pathname);
-
+ const payload = {
+ ...location,
+ ...match,
+ query: qs.parse(location.search)
+ };
// Other actions come from the user, so they already have a
// corresponding queued navigation action.
if (action === 'POP') {
store.dispatch({
type: POP,
- payload: {
- // We need to parse the query here because there's no user-facing
- // action creator for POP (where we usually parse query strings).
- ...location,
- ...match,
- query: qs.parse(location.search)
- }
+ payload
});
}
-
- store.dispatch(
- locationDidChange({
- ...location,
- ...match
- })
- );
+ store.dispatch(locationDidChange(payload));
});
return {
|
Include parsed query in all history listener dispatches
|
FormidableLabs_redux-little-router
|
train
|
7850d1f4460f6fbcbf7b3c5ae52c23d18c5147a2
|
diff --git a/lib/models/datastores/Atiaa.php b/lib/models/datastores/Atiaa.php
index <HASH>..<HASH> 100644
--- a/lib/models/datastores/Atiaa.php
+++ b/lib/models/datastores/Atiaa.php
@@ -80,7 +80,7 @@ abstract class Atiaa extends SqlDatabase
'primary_key' => array(),
'unique' => array()
);
- $description = self::$db->describeTable($this->table);
+ $description = self::$db->describeTable("{$this->schema}.{$this->table}");
$description = $description[$this->table];
$this->appendConstraints($this->description, $description['primary_key'], 'primary_key', true);
@@ -89,7 +89,7 @@ abstract class Atiaa extends SqlDatabase
foreach($description['columns'] as $field)
{
$field['required'] = !$field['nulls'];
- $field['type'] = $this->fixType($field['type']);
+ $field['type'] = $this->fixType($field['type']);
unset($field['nulls']);
unset($field['default']);
$this->description['fields'][$field['name']] = $field;
|
Worked on the representation of tables for descriptions with respect to their default schemas
|
ntentan_ntentan
|
train
|
891c7ebce5c207c73bfcf79ecd51d58ee8fab395
|
diff --git a/msvccompiler.py b/msvccompiler.py
index <HASH>..<HASH> 100644
--- a/msvccompiler.py
+++ b/msvccompiler.py
@@ -385,7 +385,7 @@ class MSVCCompiler (CCompiler) :
debug=0,
target_lang=None):
- if not self.initialized: self.initialize()
+ if not self.initialized: self.initialize()
(objects, output_dir) = self._fix_object_args (objects, output_dir)
output_filename = \
self.library_filename (output_libname, output_dir=output_dir)
@@ -419,7 +419,7 @@ class MSVCCompiler (CCompiler) :
build_temp=None,
target_lang=None):
- if not self.initialized: self.initialize()
+ if not self.initialized: self.initialize()
(objects, output_dir) = self._fix_object_args (objects, output_dir)
(libraries, library_dirs, runtime_library_dirs) = \
self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
|
Remove some more tab usage to prevent an error when run as ``python -tt``.
|
pypa_setuptools
|
train
|
1eab315c75327507bf885b81de16ed7038528b66
|
diff --git a/src/Sulu/Component/Webspace/Loader/XmlFileLoader.php b/src/Sulu/Component/Webspace/Loader/XmlFileLoader.php
index <HASH>..<HASH> 100644
--- a/src/Sulu/Component/Webspace/Loader/XmlFileLoader.php
+++ b/src/Sulu/Component/Webspace/Loader/XmlFileLoader.php
@@ -401,7 +401,7 @@ class XmlFileLoader extends FileLoader
/** @var \DOMNode $urlNode */
$url = new Url();
- $url->setUrl($urlNode->nodeValue);
+ $url->setUrl(rtrim($urlNode->nodeValue, '/'));
// set optional nodes
$url->setLanguage($this->getOptionalNodeAttribute($urlNode, 'language'));
diff --git a/tests/Resources/DataFixtures/Webspace/valid/sulu.io.xml b/tests/Resources/DataFixtures/Webspace/valid/sulu.io.xml
index <HASH>..<HASH> 100644
--- a/tests/Resources/DataFixtures/Webspace/valid/sulu.io.xml
+++ b/tests/Resources/DataFixtures/Webspace/valid/sulu.io.xml
@@ -61,6 +61,7 @@
<environment type="dev">
<urls>
<url language="de" country="at">sulu.lo</url>
+ <url language="de" country="at">sulu-with-slash.lo/</url>
</urls>
</environment>
</environments>
diff --git a/tests/Sulu/Component/Webspace/Loader/XmlFileLoaderTest.php b/tests/Sulu/Component/Webspace/Loader/XmlFileLoaderTest.php
index <HASH>..<HASH> 100644
--- a/tests/Sulu/Component/Webspace/Loader/XmlFileLoaderTest.php
+++ b/tests/Sulu/Component/Webspace/Loader/XmlFileLoaderTest.php
@@ -76,8 +76,9 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
$environmentDev = $webspace->getPortals()[0]->getEnvironment('dev');
$this->assertEquals('dev', $environmentDev->getType());
- $this->assertEquals(1, count($environmentDev->getUrls()));
+ $this->assertEquals(2, count($environmentDev->getUrls()));
$this->assertEquals('sulu.lo', $environmentDev->getUrls()[0]->getUrl());
+ $this->assertEquals('sulu-with-slash.lo', $environmentDev->getUrls()[1]->getUrl());
$webspace = $this->loader->load(
__DIR__ . '/../../../../Resources/DataFixtures/Webspace/valid/massiveart.xml'
|
fixed #<I> trailing slash in defining url in webspace config
|
sulu_sulu
|
train
|
3048969e83183f1093cc9260060c872fde2da57a
|
diff --git a/stagpy/plates.py b/stagpy/plates.py
index <HASH>..<HASH> 100644
--- a/stagpy/plates.py
+++ b/stagpy/plates.py
@@ -130,9 +130,9 @@ def _surf_diag(snap, name):
Can be a sfield, a regular scalar field evaluated at the surface,
or dv2 (which is dvphi/dphi).
"""
- isurf = _isurf(snap)
with suppress(error.UnknownVarError):
return snap.sfields[name]
+ isurf = _isurf(snap)
with suppress(error.UnknownVarError):
field, meta = snap.fields[name]
return Field(field[0, :, isurf, 0], meta)
|
Only compute _isurf when needed in _surf_diag
|
StagPython_StagPy
|
train
|
02910939fb77e2318a5485ab3fc5fe34def11acd
|
diff --git a/tests/test_wheel.py b/tests/test_wheel.py
index <HASH>..<HASH> 100644
--- a/tests/test_wheel.py
+++ b/tests/test_wheel.py
@@ -77,7 +77,8 @@ def test_read_invalid_wheel_extension():
file_name = os.path.join(os.path.dirname(__file__), "fixtures/twine-1.5.0.tar.gz")
with pytest.raises(
- exceptions.InvalidDistribution, match=f"Not a known archive format: {file_name}"
+ exceptions.InvalidDistribution,
+ match=f"Not a known archive format for file: {file_name}",
):
wheel.Wheel(file_name)
diff --git a/twine/wheel.py b/twine/wheel.py
index <HASH>..<HASH> 100644
--- a/twine/wheel.py
+++ b/twine/wheel.py
@@ -64,7 +64,9 @@ class Wheel(distribution.Distribution):
return archive.read(name)
else:
- raise exceptions.InvalidDistribution("Not a known archive format: %s" % fqn)
+ raise exceptions.InvalidDistribution(
+ "Not a known archive format for file: %s" % fqn
+ )
try:
for path in self.find_candidate_metadata_files(names):
diff --git a/twine/wininst.py b/twine/wininst.py
index <HASH>..<HASH> 100644
--- a/twine/wininst.py
+++ b/twine/wininst.py
@@ -36,7 +36,9 @@ class WinInst(distribution.Distribution):
return archive.read(name)
else:
- raise exceptions.InvalidDistribution("Not a known archive format: %s" % fqn)
+ raise exceptions.InvalidDistribution(
+ "Not a known archive format for file: %s" % fqn
+ )
try:
tuples = [
|
Reword error message in wheel and wininst read (#<I>)
* Reword error message in wheel and wininst read
* Updated invalid while error msg in wheel test
|
pypa_twine
|
train
|
172998ba6898cdac3e99f8e1832679ef1163cc64
|
diff --git a/src/main/java/com/ning/billing/recurly/RecurlyClient.java b/src/main/java/com/ning/billing/recurly/RecurlyClient.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/ning/billing/recurly/RecurlyClient.java
+++ b/src/main/java/com/ning/billing/recurly/RecurlyClient.java
@@ -1624,6 +1624,22 @@ public class RecurlyClient {
}
/**
+ * Purchases pending endpoint.
+ *
+ * Use for Adyen HPP transaction requests. Runs validations
+ + but does not run any transactions.
+ *
+ * <p>
+ * https://dev.recurly.com/docs/pending-purchase
+ *
+ * @param purchase The purchase data
+ * @return The authorized invoice collection
+ */
+ public InvoiceCollection pendingPurchase(final Purchase purchase) {
+ return doPOST(Purchase.PURCHASES_ENDPOINT + "/pending", purchase, InvoiceCollection.class);
+ }
+
+ /**
* Sets the acquisition details for an account
* <p>
* https://dev.recurly.com/docs/create-account-acquisition
diff --git a/src/main/java/com/ning/billing/recurly/model/GiftCard.java b/src/main/java/com/ning/billing/recurly/model/GiftCard.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/ning/billing/recurly/model/GiftCard.java
+++ b/src/main/java/com/ning/billing/recurly/model/GiftCard.java
@@ -20,8 +20,6 @@ package com.ning.billing.recurly.model;
import com.google.common.base.Objects;
import org.joda.time.DateTime;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
diff --git a/src/test/java/com/ning/billing/recurly/model/TestGiftCard.java b/src/test/java/com/ning/billing/recurly/model/TestGiftCard.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/ning/billing/recurly/model/TestGiftCard.java
+++ b/src/test/java/com/ning/billing/recurly/model/TestGiftCard.java
@@ -108,4 +108,4 @@ public class TestGiftCard extends TestModelBase {
assertEquals(giftCard.hashCode(), otherGiftCard.hashCode());
assertEquals(giftCard, otherGiftCard);
}
-}
\ No newline at end of file
+}
|
Adyen pendingPurchase endpoint
|
killbilling_recurly-java-library
|
train
|
0f50921e0ef3d536569b31c370ba8d66c744bde7
|
diff --git a/src/main/java/org/mapdb/Bind.java b/src/main/java/org/mapdb/Bind.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/mapdb/Bind.java
+++ b/src/main/java/org/mapdb/Bind.java
@@ -88,7 +88,7 @@ public final class Bind {
* @param <K> key type in map
* @param <V> value type in map
*/
- public interface MapWithModificationListener<K,V> extends Map<K,V> {
+ public interface MapWithModificationListener<K,V> extends ConcurrentMap<K,V> {
/**
* Add new modification listener notified when Map has been updated
* @param listener callback interface notified when map changes
|
Bind: fix complation error on Java 6 and 7
|
jankotek_mapdb
|
train
|
a6519f60e57a66c6452054db99353e7065362443
|
diff --git a/composer.json b/composer.json
index <HASH>..<HASH> 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,7 @@
}
],
"require": {
- "symfony/css-selector": "^2.7|~3.0",
+ "tijsverkoyen/css-to-inline-styles": "^2.2",
"twig/twig": "^1.26"
},
"autoload": {
diff --git a/src/CssStore.php b/src/CssStore.php
index <HASH>..<HASH> 100644
--- a/src/CssStore.php
+++ b/src/CssStore.php
@@ -10,6 +10,7 @@ class CssStore
public function addCssStyle($cssRules)
{
$this->styles[] = $cssRules;
+ return $this;
}
public function getStyles()
diff --git a/src/PageSpecificCss.php b/src/PageSpecificCss.php
index <HASH>..<HASH> 100644
--- a/src/PageSpecificCss.php
+++ b/src/PageSpecificCss.php
@@ -3,17 +3,17 @@
namespace PageSpecificCss;
use TijsVerkoyen\CssToInlineStyles\Css\Processor;
-use TijsVerkoyen\CssToInlineStyles\Css\Rule\Rule;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
class PageSpecificCss extends CssToInlineStyles
{
- /**
- * @var CssStore
- */
+ /** @var CssStore */
private $cssStore;
+ /** @var Processor */
+ private $processor;
+
/**
* PageSpecificCss constructor.
*/
@@ -22,7 +22,7 @@ class PageSpecificCss extends CssToInlineStyles
parent::__construct();
$this->cssStore = new CssStore();
-
+ $this->processor = new Processor(true);
}
/**
@@ -40,7 +40,6 @@ class PageSpecificCss extends CssToInlineStyles
*/
public function extractCss($html)
{
- // Do something..
- return '';
+ return $this->processor->getCssFromStyleTags($html);
}
}
\ No newline at end of file
diff --git a/src/Twig/TokenParsers/FoldTokenParser.php b/src/Twig/TokenParsers/FoldTokenParser.php
index <HASH>..<HASH> 100644
--- a/src/Twig/TokenParsers/FoldTokenParser.php
+++ b/src/Twig/TokenParsers/FoldTokenParser.php
@@ -23,7 +23,7 @@ class FoldTokenParser extends Twig_TokenParser
{
$lineno = $token->getLine();
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
- $body = $this->parser->subparse([$this, 'decideJsEnd'], true);
+ $body = $this->parser->subparse([$this, 'decideFoldEnd'], true);
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
return new FoldNode($body, [], $lineno, $this->getTag());
}
@@ -37,4 +37,9 @@ class FoldTokenParser extends Twig_TokenParser
{
return 'fold';
}
+
+ public function decideFoldEnd(Twig_Token $token)
+ {
+ return $token->test('endfold');
+ }
}
\ No newline at end of file
|
reinserted inlinecss dependency (I have no clue what I'm doing...)
|
JanDC_css-from-html-extractor
|
train
|
6061dce438cd905a716c68e337f981a3b5bc6865
|
diff --git a/lib/locomotive/steam/middlewares/private_access.rb b/lib/locomotive/steam/middlewares/private_access.rb
index <HASH>..<HASH> 100644
--- a/lib/locomotive/steam/middlewares/private_access.rb
+++ b/lib/locomotive/steam/middlewares/private_access.rb
@@ -53,7 +53,7 @@ module Locomotive::Steam
<title>#{site.name} - Password protected</title>
<style>
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);
- body { background: #f8f8f8; font-family: "Open Sans", sans-serif; font-size: 12px; }
+ body { background: #f8f8f8; height: 100%; font-family: "Open Sans", sans-serif; font-size: 12px; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d; }
form { position: relative; top: 50%; width: 300px; margin: 0px auto; transform: translateY(-50%); -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); }
form p { text-align: center; color: #d9684c; }
form input[type=password] { border: 2px solid #eee; font-size: 14px; padding: 5px 8px; background: #fff; }
|
align vertically the unlock screen form in Firefox
|
locomotivecms_steam
|
train
|
8563c7a25f5e322f1d098244e2d9e5b0eebf9a67
|
diff --git a/cloudflare.go b/cloudflare.go
index <HASH>..<HASH> 100644
--- a/cloudflare.go
+++ b/cloudflare.go
@@ -251,6 +251,10 @@ func (api *API) makeRequestWithAuthTypeAndHeaders(ctx context.Context, method, u
// retry if the server is rate limiting us or if it failed
// assumes server operations are rolled back on failure
if respErr != nil || resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode >= 500 {
+ if resp.StatusCode == http.StatusTooManyRequests {
+ respErr = errors.New("exceeded available rate limit retries")
+ }
+
// if we got a valid http response, try to read body so we can reuse the connection
// see https://golang.org/pkg/net/http/#Client.Do
if respErr == nil {
|
cloudflare: update rate limit exceeded error message
Updates the messaging when the rate limit retry policy has been
exhausted to convey the actual failure instead of the generic `could not
read response body` failure.
|
cloudflare_cloudflare-go
|
train
|
f1de89c8b81b61ceee5e1ff8f4da35f9c478027d
|
diff --git a/bzr_exporter.py b/bzr_exporter.py
index <HASH>..<HASH> 100755
--- a/bzr_exporter.py
+++ b/bzr_exporter.py
@@ -54,7 +54,8 @@ class BzrFastExporter(object):
if self.import_marks_file:
marks_info = marks_file.import_marks(self.import_marks_file)
if marks_info is not None:
- self.revid_to_mark = helpers.invert_dict(marks_info[0])
+ self.revid_to_mark = dict((r, m) for m, r in
+ marks_info[0].items())
self.branch_names = marks_info[1]
def run(self):
@@ -85,7 +86,7 @@ class BzrFastExporter(object):
def _save_marks(self):
if self.export_marks_file:
- revision_ids = helpers.invert_dict(self.revid_to_mark)
+ revision_ids = dict((m, r) for r, m in self.revid_to_mark.items())
marks_file.export_marks(self.export_marks_file, revision_ids,
self.branch_names)
|
fix marks importing in fast-export
|
jelmer_python-fastimport
|
train
|
527f0e011bedca321ed66fd91ab90cac3c904231
|
diff --git a/lib/collection/url.js b/lib/collection/url.js
index <HASH>..<HASH> 100644
--- a/lib/collection/url.js
+++ b/lib/collection/url.js
@@ -400,7 +400,7 @@ _.assign(Url, /** @lends Url */ {
* @returns {Object}
*/
parse: function (url) {
- url = _.trim(url);
+ url = _.trimStart(url);
var pathVariables,
p = {
raw: url
diff --git a/test/unit/url.test.js b/test/unit/url.test.js
index <HASH>..<HASH> 100644
--- a/test/unit/url.test.js
+++ b/test/unit/url.test.js
@@ -1092,5 +1092,17 @@ describe('Url', function () {
expect(url.path).to.be.an('array').that.eql(['', '', 'get']);
});
});
+
+ describe('query', function () {
+ // Tests issue where trailing spaces were removed from value of query parameter
+ // Reference: https://github.com/postmanlabs/postman-app-support/issues/6097
+ it('should not remove trailing whitespace from value of last query parameter', function () {
+ var url = new Url('https://postman-echo.com/get?foo1 =bar1 &foo2 =bar2 ');
+ expect(url.query.all()[0].key).to.eql('foo1 ');
+ expect(url.query.all()[0].value).to.eql('bar1 ');
+ expect(url.query.all()[1].key).to.eql('foo2 ');
+ expect(url.query.all()[1].value).to.eql('bar2 ');
+ });
+ });
});
});
|
Replaced _.trim() with _.trimStart() in Url.parse()
|
postmanlabs_postman-collection
|
train
|
7b6541aaa2c1f44b43e52be34670c6739a1b3c82
|
diff --git a/ndarray.js b/ndarray.js
index <HASH>..<HASH> 100644
--- a/ndarray.js
+++ b/ndarray.js
@@ -305,6 +305,11 @@ b"+i+"*=d\
}
function arrayDType(data) {
+ if(hasBuffer) {
+ if(Buffer.isBuffer(data)) {
+ return "buffer"
+ }
+ }
if(hasTypedArrays) {
switch(Object.prototype.toString.call(data)) {
case "[object Float64Array]":
@@ -327,11 +332,6 @@ function arrayDType(data) {
return "uint8_clamped"
}
}
- if(hasBuffer) {
- if(Buffer.isBuffer(data)) {
- return "buffer"
- }
- }
if(Array.isArray(data)) {
return "array"
}
diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -65,6 +65,7 @@ test("uint8clamped", function(t) {
test("buffer", function(t) {
var p = ndarray(new Buffer(5))
+ t.equals(p.dtype, "buffer")
p.set(0, 1)
p.set(1, 2)
p.set(2, 3)
@@ -76,10 +77,24 @@ test("buffer", function(t) {
t.end()
})
+test("dtypes", function(t) {
+ t.equals(ndarray(new Uint8Array(5)).dtype, "uint8")
+ t.equals(ndarray(new Uint16Array(5)).dtype, "uint16")
+ t.equals(ndarray(new Uint32Array(5)).dtype, "uint32")
+ t.equals(ndarray(new Int8Array(5)).dtype, "int8")
+ t.equals(ndarray(new Int16Array(5)).dtype, "int16")
+ t.equals(ndarray(new Int32Array(5)).dtype, "int32")
+ t.equals(ndarray(new Float32Array(5)).dtype, "float32")
+ t.equals(ndarray(new Float64Array(5)).dtype, "float64")
+ t.equals(ndarray([1,2,3]).dtype, "array")
+ t.end()
+})
+
test("shape/stride", function(t) {
var p = ndarray(new Float32Array(100), [3,3,3], [3,2,1])
+ t.equals(p.dtype, "float32")
t.equals(p.shape[0], 3)
p.shape[0] = 1
t.equals(p.shape[0], 1)
@@ -143,8 +158,6 @@ test("pick", function(t) {
t.equals(y.get(4), 5)
t.equals(y.shape.join(","), "5")
-
-
t.end()
})
@@ -210,7 +223,6 @@ test("hi", function(t) {
test("step", function(t) {
-
var x = ndarray(new Float32Array(10))
for(var i=0; i<10; ++i) {
x.set(i, i)
@@ -278,4 +290,28 @@ test("toJSON", function(t) {
t.same(JSON.stringify(x.shape), "[10]")
t.end()
+})
+
+test("generic", function(t) {
+ var hash = {}
+ var hashStore = {
+ get: function(i) {
+ return +hash[i]
+ },
+ set: function(i,v) {
+ return hash[i]=v
+ },
+ length: Infinity
+ }
+ var array = ndarray(hashStore, [1000,1000,1000])
+
+ t.equals(array.dtype, "generic")
+ t.same(array.shape.slice(), [1000,1000,1000])
+
+ array.set(10,10,10, 1)
+ t.equals(array.get(10,10,10), 1)
+ t.equals(array.pick(10).dtype, "generic")
+ t.equals(+array.pick(10).pick(10).pick(10), 1)
+
+ t.end()
})
\ No newline at end of file
|
added quick test case for generic arrays
|
scijs_ndarray
|
train
|
8f766e575ac6e0bf743ab673dc44e605be19ba89
|
diff --git a/lib/bmc-daemon-lib/logger.rb b/lib/bmc-daemon-lib/logger.rb
index <HASH>..<HASH> 100644
--- a/lib/bmc-daemon-lib/logger.rb
+++ b/lib/bmc-daemon-lib/logger.rb
@@ -56,7 +56,7 @@ module BmcDaemonLib
end
# Add details from hash
- elsif details.is_a? Hash
+ elsif details.is_a?(Hash) || details.is_a?(Hashie::Mash)
details.each do |key, value|
messages << sprintf(@format[:hash], key, value)
end
|
logger: also dump Hashie hashes
|
bmedici_bmc-daemon-lib
|
train
|
063babcad7f9d99dc6905012115a54e9f8481ac9
|
diff --git a/lib/licensee/matchers/gemspec.rb b/lib/licensee/matchers/gemspec.rb
index <HASH>..<HASH> 100644
--- a/lib/licensee/matchers/gemspec.rb
+++ b/lib/licensee/matchers/gemspec.rb
@@ -2,7 +2,8 @@ module Licensee
module Matchers
class Gemspec < Licensee::Matchers::Package
# a value is a string surrounded by any amount of whitespace
- VALUE_REGEX = /\s*[\'\"]([a-z\-0-9\.]+)[\'\"]\s*/i
+ # optionally ended with (non-captured) ".freeze"
+ VALUE_REGEX = /\s*[\'\"]([a-z\-0-9\.]+)[\'\"](?:\.freeze)?\s*/i
# an array contains one or more values. all values, or array itself,
# can be surrounded by any amount of whitespace. do not capture
diff --git a/spec/licensee/matchers/gemspec_matcher_spec.rb b/spec/licensee/matchers/gemspec_matcher_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/licensee/matchers/gemspec_matcher_spec.rb
+++ b/spec/licensee/matchers/gemspec_matcher_spec.rb
@@ -19,7 +19,8 @@ RSpec.describe Licensee::Matchers::Gemspec do
'double quotes' => 's.license = "mit"',
'no whitespace' => "s.license='mit'",
'uppercase' => "s.license = 'MIT'",
- 'array' => "s.licenses = ['mit']"
+ 'array' => "s.licenses = ['mit']",
+ 'frozen' => "s.license = 'mit'.freeze"
}.each do |description, license_declaration|
context "with a #{description} declaration" do
let(:content) { license_declaration }
|
allow for .freeze on strings
|
licensee_licensee
|
train
|
34e24ab2a1d984ea2025cca337f45fa16ea08fec
|
diff --git a/impl/src/main/java/org/ehcache/internal/store/heap/OnHeapStore.java b/impl/src/main/java/org/ehcache/internal/store/heap/OnHeapStore.java
index <HASH>..<HASH> 100644
--- a/impl/src/main/java/org/ehcache/internal/store/heap/OnHeapStore.java
+++ b/impl/src/main/java/org/ehcache/internal/store/heap/OnHeapStore.java
@@ -619,8 +619,16 @@ public class OnHeapStore<K, V> implements Store<K,V>, HigherCachingTier<K, V> {
}
@Override
- public void setInvalidationListener(final InvalidationListener<K, V> invalidationListener) {
- this.invalidationListener = invalidationListener;
+ public void setInvalidationListener(final InvalidationListener<K, V> providedInvalidationListener) {
+ this.invalidationListener = new InvalidationListener<K, V>() {
+ @Override
+ public void onInvalidation(final K key, final ValueHolder<V> valueHolder) {
+ if (!(valueHolder instanceof Fault)) {
+ providedInvalidationListener.onInvalidation(key, valueHolder);
+ }
+ }
+ };
+
this.eventListener = new StoreEventListener<K, V>() {
@Override
public void onEviction(final K key, final ValueHolder<V> valueHolder) {
diff --git a/impl/src/test/java/org/ehcache/internal/store/heap/BaseOnHeapStoreTest.java b/impl/src/test/java/org/ehcache/internal/store/heap/BaseOnHeapStoreTest.java
index <HASH>..<HASH> 100644
--- a/impl/src/test/java/org/ehcache/internal/store/heap/BaseOnHeapStoreTest.java
+++ b/impl/src/test/java/org/ehcache/internal/store/heap/BaseOnHeapStoreTest.java
@@ -16,8 +16,12 @@
package org.ehcache.internal.store.heap;
import org.ehcache.Cache.Entry;
+import org.ehcache.CacheConfigurationChangeEvent;
+import org.ehcache.CacheConfigurationChangeListener;
+import org.ehcache.CacheConfigurationProperty;
import org.ehcache.config.Eviction;
import org.ehcache.config.EvictionVeto;
+import org.ehcache.config.units.EntryUnit;
import org.ehcache.events.StoreEventListener;
import org.ehcache.exceptions.CacheAccessException;
import org.ehcache.expiry.Duration;
@@ -51,6 +55,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
+import static org.ehcache.config.ResourcePoolsBuilder.newResourcePoolsBuilder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
@@ -900,6 +905,62 @@ public abstract class BaseOnHeapStoreTest {
}
@Test
+ public void testGetOrComputeIfAbsentInvalidatesFault() throws CacheAccessException, InterruptedException {
+ final OnHeapStore<String, String> store = newStore();
+ final CountDownLatch testCompletionLatch = new CountDownLatch(1);
+ final CountDownLatch threadFaultCompletionLatch = new CountDownLatch(1);
+ CacheConfigurationChangeListener listener = store.getConfigurationChangeListeners().get(0);
+ CachingTier.InvalidationListener<String, String> invalidationListener = new CachingTier.InvalidationListener<String, String>() {
+ @Override
+ public void onInvalidation(final String key, final ValueHolder<String> valueHolder) {
+ try {
+ valueHolder.getId();
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Test tried to invalidate Fault");
+ }
+ }
+ };
+
+ store.setInvalidationListener(invalidationListener);
+ listener.cacheConfigurationChange(new CacheConfigurationChangeEvent(CacheConfigurationProperty.UPDATESIZE,
+ newResourcePoolsBuilder().heap(100, EntryUnit.ENTRIES).build(),
+ newResourcePoolsBuilder().heap(1, EntryUnit.ENTRIES).build()));
+
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ store.getOrComputeIfAbsent("1", new Function<String, ValueHolder<String>>() {
+ @Override
+ public ValueHolder<String> apply(final String s) {
+ threadFaultCompletionLatch.countDown();
+ try {
+ testCompletionLatch.await();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ });
+ } catch (CacheAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+
+ threadFaultCompletionLatch.await();
+ store.getOrComputeIfAbsent("10", new Function<String, ValueHolder<String>>() {
+ @Override
+ public ValueHolder<String> apply(final String s) {
+ return null;
+ }
+ });
+ testCompletionLatch.countDown();
+ }
+
+ @Test
public void testGetOrComputeIfAbsentContention() throws InterruptedException {
final OnHeapStore<Long, String> store = newStore();
|
Issue #<I> : Fixing fault being invalidated in case of smaller heap size
|
ehcache_ehcache3
|
train
|
fc5f6eff5d0e76d716de227db3eccf48142ba99b
|
diff --git a/lib/Request.js b/lib/Request.js
index <HASH>..<HASH> 100644
--- a/lib/Request.js
+++ b/lib/Request.js
@@ -107,6 +107,7 @@ Request.prototype = {
data = JSON.parse(data);
} catch (err) {
reject(err);
+ return;
} finally {
//释放当前请求数
var count = +(config.requestLimit * (eval(res.headers[API_CALL_LIMIT]) + 1e-6)).toFixed(0);
|
fix: Cannot read property 'length' of undefined
|
yeezon_yhsd-api-node
|
train
|
f381a108813fc477db6a395bda6a7217d0b9bb2d
|
diff --git a/optaplanner-core/src/main/java/org/optaplanner/core/impl/score/director/AbstractScoreDirector.java b/optaplanner-core/src/main/java/org/optaplanner/core/impl/score/director/AbstractScoreDirector.java
index <HASH>..<HASH> 100644
--- a/optaplanner-core/src/main/java/org/optaplanner/core/impl/score/director/AbstractScoreDirector.java
+++ b/optaplanner-core/src/main/java/org/optaplanner/core/impl/score/director/AbstractScoreDirector.java
@@ -470,7 +470,8 @@ public abstract class AbstractScoreDirector<Solution_, Factory_ extends Abstract
+ " the expectedWorkingScore (" + expectedWorkingScore
+ ") is not the workingScore (" + workingScore
+ ") after all " + VariableListener.class.getSimpleName()
- + "s were triggered without changes to the genuine variables.\n"
+ + "s were triggered without changes to the genuine variables"
+ + " after completedAction (" + completedAction + ").\n"
+ "But all the shadow variable values are still the same, so this is impossible.");
}
}
|
PLANNER-<I> Also include completedAction in the error message
|
kiegroup_optaplanner
|
train
|
708f66487f8cc5282d53bb54ef4f7a63f28baa9a
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -15,9 +15,8 @@ with open('README.rst') as f:
install_requires = [
'numpy >=1.8.1, <2.0.0',
'scipy >=0.13.3, <1.0.0',
- 'pyemd'
+ 'pyemd >=0.0.7'
]
-dependency_links = ['git+https://github.com/wmayner/pyemd.git@master#egg=pyemd']
test_require = [
'pytest',
@@ -36,7 +35,6 @@ setup(
install_requires=install_requires,
tests_require=test_require,
test_suite="py.test",
- dependency_links=dependency_links,
packages=['cyphi'],
package_data={'': ['LICENSE']},
license='GNU General Public License v3.0',
|
PyEMD is in the Cheeseshop now
|
wmayner_pyphi
|
train
|
27666f699f0b7b35f2e3f16d4e3c72630dfd252a
|
diff --git a/agent/engine/docker_task_engine_test.go b/agent/engine/docker_task_engine_test.go
index <HASH>..<HASH> 100644
--- a/agent/engine/docker_task_engine_test.go
+++ b/agent/engine/docker_task_engine_test.go
@@ -470,6 +470,8 @@ func TestRemoveEvents(t *testing.T) {
eventStream <- createDockerEvent(api.ContainerStopped)
eventStream <- createDockerEvent(api.ContainerStopped)
}).Return(nil)
+
+ client.EXPECT().StopContainer(gomock.Any(), gomock.Any()).AnyTimes()
imageManager.EXPECT().RemoveContainerReferenceFromImageState(gomock.Any())
// This ensures that managedTask.waitForStopReported makes progress
|
engine: fix flakey TestRemoveEvents
since we "Emit a couple of events for the task before cleanup finishes."
We should also add corresponding client.EXPECT().StopContainer()
|
aws_amazon-ecs-agent
|
train
|
d5dea3879b785dfc9d0b8a3f420ac3555dfecb47
|
diff --git a/dbussy.py b/dbussy.py
index <HASH>..<HASH> 100644
--- a/dbussy.py
+++ b/dbussy.py
@@ -581,7 +581,8 @@ def _get_error(error) :
#end _get_error
class Connection :
- "wrapper around a DBusConnection object."
+ "wrapper around a DBusConnection object. Do not instantiate directly; use the open" \
+ " or bus_get methods."
# <https://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html>
__slots__ = ("__weakref__", "_dbobj",) # to forestall typos
@@ -625,6 +626,60 @@ class Connection :
dbus.dbus_connection_close(self._dbobj)
#end close
+ @property
+ def is_connected(self) :
+ return \
+ dbus.dbus_connection_get_is_connected(self._dbobj) != 0
+ #end is_connected
+
+ @property
+ def is_authenticated(self) :
+ return \
+ dbus.dbus_connection_get_is_authenticated(self._dbobj) != 0
+ #end is_authenticated
+
+ @property
+ def is_anonymous(self) :
+ return \
+ dbus.dbus_connection_get_is_anonymous(self._dbobj) != 0
+ #end is_anonymous
+
+ @property
+ def server_id(self) :
+ c_result = dbus.dbus_connection_get_server_id(self._dbobj)
+ result = ct.cast(c_result, ct.c_char_p).decode()
+ dbus.dbus_free(c_result)
+ return \
+ result
+ #end server_id
+
+ def can_send_type(self, type_code) :
+ return \
+ dbus.dbus_connection_can_send_type(self._dbobj, type_code) != 0
+ #end can_send_type
+
+ def set_exit_on_disconnect(self, exit_on_disconnect) :
+ dbus.dbus_connection_set_exit_on_disconnect(self._dbobj, exit_on_disconnect)
+ #end set_exit_on_disconnect
+
+ def preallocate_send(self) :
+ result = dbus.dbus_connection_preallocate_send(self._dbobj)
+ if result == None :
+ raise RuntimeError("dbus_connection_preallocate_send failed")
+ #end if
+ return \
+ PreallocatedSend(result, self)
+ #end preallocate_send
+
+ def send_preallocated(self, preallocated, message) :
+ if not isinstance(preallocated, PreallocatedSend) or not isinstance(message, Message) :
+ raise TypeError("preallocated must be a PreallocatedSend and message must be a Message")
+ #end if
+ assert not preallocated._sent, "preallocated has already been sent"
+ dbus.dbus_connection_send_preallocated(self._dbobj, preallocated._dbobj, message._dbobj)
+ preallocated._sent = True
+ #end send_preallocated
+
# more TBD
# message bus APIs
@@ -705,7 +760,7 @@ class Connection :
my_error.raise_if_set()
return \
result
- #end if
+ #end bus_name_has_owner
def bus_start_service_by_name(self, name, flags = 0, error = None) :
error, my_error = _get_error(error)
@@ -730,6 +785,48 @@ class Connection :
#end Connection
+class PreallocatedSend :
+ "wrapper around a DBusPreallocatedSend object. Do not instantiate directly;" \
+ " get from Connection.preallocate_send method."
+ # <https://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html>
+
+ __slots__ = ("_dbobj", "_parent", "_sent") # to forestall typos
+
+ def __new__(celf, _dbobj, _parent) :
+ self = celf._instances.get(_dbobj)
+ if self == None :
+ self = super().__new__(celf)
+ self._dbobj = _dbobj
+ self._parent = _parent
+ self._sent = False
+ celf._instances[_dbobj] = self
+ else :
+ assert self._parent == _parent
+ #end if
+ return \
+ self
+ #end __new__
+
+ def __del__(self) :
+ if self._dbobj != None :
+ if not self._sent :
+ dbus.dbus_connection_free_preallocated_send(self._parent._dbobj, self._dbobj)
+ #end if
+ self._dbobj = None
+ #end if
+ #end __del__
+
+ def send(self, message) :
+ if not isinstance(message, Message) :
+ raise TypeError("message must be a Message")
+ #end if
+ assert not self._sent, "preallocated has already been sent"
+ dbus.dbus_connection_send_preallocated(self._parent._dbobj, self._dbobj, message._dbobj)
+ self._sent = True
+ #end send
+
+#end PreallocatedSend
+
class Message :
"wrapper around a DBusMessage object."
# <https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html>
@@ -740,7 +837,7 @@ class Error :
"wrapper around a DBusError object."
# <https://dbus.freedesktop.org/doc/api/html/group__DBusErrors.html>
- __slots__ = ("_dbobj",) # to forestall typos
+ __slots__ = ("_dbobj") # to forestall typos
def __init__(self) :
dbobj = DBUS.Error()
|
more Connection stuff, including PreallocatedSend
|
ldo_dbussy
|
train
|
18c04ac595674dc59348eec8c974c7006ae382e5
|
diff --git a/spec/support/spec_organizer.rb b/spec/support/spec_organizer.rb
index <HASH>..<HASH> 100644
--- a/spec/support/spec_organizer.rb
+++ b/spec/support/spec_organizer.rb
@@ -17,12 +17,16 @@ class SpecOrganizer
[%r,^mongo,, :unit],
[%r,^kerberos,, :unit],
[%r,^integration/sdam_error_handling,, :sdam_integration],
+ [%r,^integration/cursor_reaping,, :cursor_reaping],
[%r,^(atlas|integration),, :integration],
[%r,^spec_tests,, :spec],
[%r,^spec_tests/sdam_integration,, :spec_sdam_integration],
]
- RUN_PRIORITY = %i(unit integration sdam_integration spec spec_sdam_integration)
+ RUN_PRIORITY = %i(unit
+ integration sdam_integration cursor_reaping
+ spec spec_sdam_integration
+ )
SPEC_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
ROOT = File.expand_path(File.join(SPEC_ROOT, '..'))
|
RUBY-<I> Run cursor reaping spec separately (#<I>)
|
mongodb_mongo-ruby-driver
|
train
|
b56613793222392cd123fe5fa5a29e1de3c152fc
|
diff --git a/closure/goog/crypt/sha2_64bit_test.js b/closure/goog/crypt/sha2_64bit_test.js
index <HASH>..<HASH> 100644
--- a/closure/goog/crypt/sha2_64bit_test.js
+++ b/closure/goog/crypt/sha2_64bit_test.js
@@ -22,6 +22,7 @@ goog.require('goog.crypt.Sha512');
goog.require('goog.crypt.Sha512_256');
goog.require('goog.crypt.hashTester');
goog.require('goog.testing.jsunit');
+goog.require('goog.userAgent');
/**
@@ -141,7 +142,10 @@ function hashGoldenTester(hasher, key) {
/** Test that Sha512() returns the published values */
function testHashing512() {
- hashGoldenTester(new goog.crypt.Sha512(), '512');
+ // This test tends to time out on IE7.
+ if (!goog.userAgent.IE || goog.userAgent.isVersionOrHigher('8')) {
+ hashGoldenTester(new goog.crypt.Sha512(), '512');
+ }
}
|
Disable testHashing<I> in sha2_<I>bit_test.js for IE7. It times out too often.
-------------
Created by MOE: <URL>
|
google_closure-library
|
train
|
66abdf4fc899037b1d780035a3f4cabb2d634ae5
|
diff --git a/Provider/BaseProvider.php b/Provider/BaseProvider.php
index <HASH>..<HASH> 100644
--- a/Provider/BaseProvider.php
+++ b/Provider/BaseProvider.php
@@ -58,6 +58,11 @@ abstract class BaseProvider implements MediaProviderInterface
protected $thumbnail;
/**
+ * @var string
+ */
+ protected $name;
+
+ /**
* @param string $name
* @param Filesystem $filesystem
* @param CDNInterface $cdn
|
Added missing BaseProvider::$name property (#<I>)
|
sonata-project_SonataMediaBundle
|
train
|
de6856e41ea859cf08380430f912cbf263c0f1e4
|
diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php
index <HASH>..<HASH> 100644
--- a/library/WT/Controller/Individual.php
+++ b/library/WT/Controller/Individual.php
@@ -339,19 +339,23 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord {
* @return string returns 'person_box', 'person_boxF', or 'person_boxNN'
*/
function getPersonStyle($person) {
- $sex = $person->getSex();
- switch($sex) {
- case "M":
- $isf = "";
+ switch($person->getSex()) {
+ case 'M':
+ $class = 'person_box';
break;
- case "F":
- $isf = "F";
+ case 'F':
+ $class = 'person_boxF';
break;
default:
- $isf = "NN";
+ $class = 'person_boxNN';
break;
}
- return "person_box".$isf;
+ if ($person->isOld()) {
+ $class .= ' old';
+ } elseif ($person->isNew()) {
+ $class .= ' new';
+ }
+ return $class;
}
/**
|
Show separate pending changes for fam->indi links and indi-fam links on the families tab
|
fisharebest_webtrees
|
train
|
06f564717eb074242bff8b7bce34fd86e95f5cd6
|
diff --git a/src/Illuminate/Support/Manager.php b/src/Illuminate/Support/Manager.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Support/Manager.php
+++ b/src/Illuminate/Support/Manager.php
@@ -57,7 +57,7 @@ abstract class Manager
$driver = $driver ?: $this->getDefaultDriver();
if (is_null($driver)) {
- throw new InvalidArgumentException("Unable to resolve NULL driver for [".get_class($this)."].");
+ throw new InvalidArgumentException('Unable to resolve NULL driver for ['.get_class($this).'].');
}
// If the given driver has not been created before, we will create the instances
|
Apply fixes from StyleCI (#<I>)
|
laravel_framework
|
train
|
1e00f84fbf533d59cb53fb3c08f29d0dea9efcb4
|
diff --git a/src/js/selectable.js b/src/js/selectable.js
index <HASH>..<HASH> 100644
--- a/src/js/selectable.js
+++ b/src/js/selectable.js
@@ -91,17 +91,22 @@
}
if(handleResult !== true) {
that.selections[id] = isSelect ? that.selectOrder++ : false;
- var selected = [];
- $.each(that.selections, function(thisId, thisIsSelected) {
- if(thisIsSelected) selected.push(thisId);
- });
- that.callEvent(isSelect ? 'select' : 'unselect', {id: id, selections: that.selections, target: $element, selected: selected}, that);
+ that.callEvent(isSelect ? 'select' : 'unselect', {id: id, selections: that.selections, target: $element, selected: that.getSelectedArray()}, that);
}
}
$element.toggleClass(that.options.selectClass, isSelect);
}
};
+ Selectable.prototype.getSelectedArray = function()
+ {
+ var selected = [];
+ $.each(this.selections, function(thisId, thisIsSelected) {
+ if(thisIsSelected) selected.push(thisId);
+ });
+ return selected;
+ };
+
Selectable.prototype._init = function() {
var options = this.options, that = this;
var ignoreVal = options.ignoreVal;
@@ -182,12 +187,8 @@
checkRange();
range = null;
}
- var selected = [];
- $.each(that.selections, function(thisId, thisIsSelected) {
- if(thisIsSelected) selected.push(thisId);
- });
}
- that.callEvent('finish', {selections: that.selections, selected: selected});
+ that.callEvent('finish', {selections: that.selections, selected: that.getSelectedArray()});
e.preventDefault();
};
@@ -212,6 +213,7 @@
}
if(that.callEvent('startDrag', e) === false) {
+ that.callEvent('finish', {selections: that.selections, selected: that.getSelectedArray()});
return;
}
|
* fix error for 'finish' event not call sometimes.
|
easysoft_zui
|
train
|
2ed469e781073879044be16c8759fe71e21a6511
|
diff --git a/lib/validators.js b/lib/validators.js
index <HASH>..<HASH> 100644
--- a/lib/validators.js
+++ b/lib/validators.js
@@ -8,14 +8,10 @@ var trim = (function () {
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF",
wsChars = '[' + ws + ']',
trimBeginRegexp = new RegExp("^" + wsChars + wsChars + "*"),
- trimEndRegexp = new RegExp(wsChars + wsChars + "*$");
- return function (str) {
- str = str ? String(str) : '';
- if (String.prototype.trim && !ws.trim()) {
- return str.trim();
- } else {
- return String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, '');
- }
+ trimEndRegexp = new RegExp(wsChars + wsChars + "*$"),
+ useES5 = function (str) { return String(str || '').trim(); };
+ return String.prototype.trim && !ws.trim() ? useES5 : function (str) {
+ return String(str || '').replace(trimBeginRegexp, '').replace(trimEndRegexp, '');
};
}());
|
Fixing a bug in my port of the String#trim shim, and cleaning it up a bit.
|
caolan_forms
|
train
|
8ca8ccc3106138235d77b476b49ec29f2c166eac
|
diff --git a/src/main/java/org/jboss/aesh/console/Console.java b/src/main/java/org/jboss/aesh/console/Console.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jboss/aesh/console/Console.java
+++ b/src/main/java/org/jboss/aesh/console/Console.java
@@ -118,6 +118,8 @@ public class Console {
private Attributes attributes;
private PrintStream out;
+ private boolean controlledMode = false;
+
private static final Logger LOGGER = LoggerUtil.getLogger(Console.class.getName());
public Console(final Settings settings) {
@@ -329,6 +331,14 @@ public class Console {
return (!processing && !processManager.hasProcesses() && !hasInput() && readingInput == -1);
}
+ public void controlled(){
+ controlledMode = true;
+ }
+
+ public void continuous(){
+ controlledMode = false;
+ }
+
public synchronized void start() {
if(running)
throw new IllegalStateException("Not allowed to start the Console without stopping it first");
@@ -608,7 +618,7 @@ public class Console {
private void executeLoop() {
try {
while(!executorService.isShutdown()) {
- if (!processManager.hasForegroundProcess() && hasInput()) {
+ if (!processManager.hasForegroundProcess() && hasInput() && !controlledMode) {
execute();
}
Thread.sleep(10);
|
Redirection issue. Handling input continuously can be difficult in some situations. Allowing AESH to pause processing, and only return input when the program using the library is ready, allows the redirected input to be processed as-needed.
|
aeshell_aesh
|
train
|
765251dee213e953533a0e134e180128a8caff8c
|
diff --git a/library/src/main/java/com/qiniu/android/http/Client.java b/library/src/main/java/com/qiniu/android/http/Client.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/qiniu/android/http/Client.java
+++ b/library/src/main/java/com/qiniu/android/http/Client.java
@@ -267,7 +267,7 @@ public final class Client {
rbody = RequestBody.create(null, new byte[0]);
}
if (progressHandler != null || c != null) {
- rbody = new CountingRequestBody(rbody, progressHandler, c);
+ rbody = new CountingRequestBody(rbody, progressHandler, totalSize, c);
}
Request.Builder requestBuilder = new Request.Builder().url(url).post(rbody);
@@ -289,7 +289,7 @@ public final class Client {
file = RequestBody.create(MediaType.parse(args.mimeType), args.data);
totalSize = args.data.length;
}
- asyncMultipartPost(url, args.params, upToken, totalSize, progressHandler, args.fileName, file, completionHandler, c);
+ asyncMultipartPost(url, args.params, upToken, totalSize, progressHandler, args.fileName, file, completionHandler, c);
}
private void asyncMultipartPost(String url,
@@ -316,7 +316,7 @@ public final class Client {
mb.setType(MediaType.parse("multipart/form-data"));
RequestBody body = mb.build();
if (progressHandler != null || cancellationHandler != null) {
- body = new CountingRequestBody(body, progressHandler, cancellationHandler);
+ body = new CountingRequestBody(body, progressHandler, totalSize, cancellationHandler);
}
Request.Builder requestBuilder = new Request.Builder().url(url).post(body);
asyncSend(requestBuilder, null, upToken, totalSize, completionHandler);
diff --git a/library/src/main/java/com/qiniu/android/http/CountingRequestBody.java b/library/src/main/java/com/qiniu/android/http/CountingRequestBody.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/qiniu/android/http/CountingRequestBody.java
+++ b/library/src/main/java/com/qiniu/android/http/CountingRequestBody.java
@@ -21,12 +21,14 @@ public final class CountingRequestBody extends RequestBody {
private final RequestBody body;
private final ProgressHandler progress;
+ private final long totalSize;
private final CancellationHandler cancellationHandler;
- public CountingRequestBody(RequestBody body, ProgressHandler progress,
+ public CountingRequestBody(RequestBody body, ProgressHandler progress, long totalSize,
CancellationHandler cancellationHandler) {
this.body = body;
this.progress = progress;
+ this.totalSize = totalSize;
this.cancellationHandler = cancellationHandler;
}
@@ -75,11 +77,7 @@ public final class CountingRequestBody extends RequestBody {
AsyncRun.runInMain(new Runnable() {
@Override
public void run() {
- try {
- progress.onProgress(bytesWritten, (int) contentLength());
- } catch (IOException e) {
- e.printStackTrace();
- }
+ progress.onProgress(bytesWritten, totalSize);
}
});
}
diff --git a/library/src/main/java/com/qiniu/android/http/ProgressHandler.java b/library/src/main/java/com/qiniu/android/http/ProgressHandler.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/qiniu/android/http/ProgressHandler.java
+++ b/library/src/main/java/com/qiniu/android/http/ProgressHandler.java
@@ -10,5 +10,5 @@ public interface ProgressHandler {
* @param bytesWritten 已经写入字节
* @param totalSize 总字节数
*/
- void onProgress(int bytesWritten, int totalSize);
+ void onProgress(long bytesWritten, long totalSize);
}
diff --git a/library/src/main/java/com/qiniu/android/storage/FormUploader.java b/library/src/main/java/com/qiniu/android/storage/FormUploader.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/qiniu/android/storage/FormUploader.java
+++ b/library/src/main/java/com/qiniu/android/storage/FormUploader.java
@@ -94,7 +94,7 @@ final class FormUploader {
final ProgressHandler progress = new ProgressHandler() {
@Override
- public void onProgress(int bytesWritten, int totalSize) {
+ public void onProgress(long bytesWritten, long totalSize) {
double percent = (double) bytesWritten / (double) totalSize;
if (percent > 0.95) {
percent = 0.95;
diff --git a/library/src/main/java/com/qiniu/android/storage/ResumeUploader.java b/library/src/main/java/com/qiniu/android/storage/ResumeUploader.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/qiniu/android/storage/ResumeUploader.java
+++ b/library/src/main/java/com/qiniu/android/storage/ResumeUploader.java
@@ -249,7 +249,7 @@ final class ResumeUploader implements Runnable {
final int chunkSize = (int) calcPutSize(offset);
ProgressHandler progress = new ProgressHandler() {
@Override
- public void onProgress(int bytesWritten, int totalSize) {
+ public void onProgress(long bytesWritten, long totalSize) {
double percent = (double) (offset + bytesWritten) / totalSize;
if (percent > 0.95) {
percent = 0.95;
|
[PDEX-<I>] fix the bug of upload progress callback error
|
qiniu_android-sdk
|
train
|
1dfef37fb66cabaefacacf11418eef0a72d6adb5
|
diff --git a/router/src/main/java/org/wisdom/router/RequestRouter.java b/router/src/main/java/org/wisdom/router/RequestRouter.java
index <HASH>..<HASH> 100644
--- a/router/src/main/java/org/wisdom/router/RequestRouter.java
+++ b/router/src/main/java/org/wisdom/router/RequestRouter.java
@@ -146,7 +146,6 @@ public class RequestRouter extends AbstractRouter {
for (Map.Entry<String, Object> entry : params.entrySet()) {
- // The original regex. For the example above this results in {id}
String originalRegex = String.format("{%s}", entry.getKey());
String originalRegexEscaped = String.format("\\{%s\\}", entry.getKey());
|
[TD] major
* This block of commented-out lines of code should be removed.
|
wisdom-framework_wisdom
|
train
|
b24e05b3abd2c073adb6246110934756601b6af4
|
diff --git a/blockstack_cli_0.14.1/blockstack_registrar/registrar/rpc_daemon.py b/blockstack_cli_0.14.1/blockstack_registrar/registrar/rpc_daemon.py
index <HASH>..<HASH> 100644
--- a/blockstack_cli_0.14.1/blockstack_registrar/registrar/rpc_daemon.py
+++ b/blockstack_cli_0.14.1/blockstack_registrar/registrar/rpc_daemon.py
@@ -343,17 +343,23 @@ def process_register(fqu, payment_privkey, owner_address):
owner_address=owner_address)
-def start_monitor():
+def get_current_block():
try:
current_block = get_block_height()
except:
current_block = 5
- if current_block is not None:
- last_block = current_block - 1
- else:
- last_block = 5
+ if current_block is None:
+ current_block = 5
+
+ return current_block
+
+
+def start_monitor():
+
+ current_block = get_current_block()
+ last_block = current_block - 1
RPC_DAEMON = 'http://' + REGISTRAR_IP + ':' + str(REGISTRAR_PORT)
wallet_data = None
@@ -373,7 +379,7 @@ def start_monitor():
try:
if last_block == current_block:
sleep(SLEEP_INTERVAL)
- current_block = get_block_height()
+ current_block = get_current_block()
else:
# monitor process reads from preorder queue
|
make sure current_block has a valid int value, even on rpc error
|
blockstack_blockstack-core
|
train
|
6915843013820d55019015f0f644560b602b4353
|
diff --git a/examples/demo.rb b/examples/demo.rb
index <HASH>..<HASH> 100644
--- a/examples/demo.rb
+++ b/examples/demo.rb
@@ -1,5 +1,6 @@
require 'rubygems'
require 'tvdbr'
+require 'active_support/all'
tvdb = Tvdbr::Client.new('YOUR_API_KEY')
@@ -27,15 +28,16 @@ series.episodes.each do |e|
puts e.name + " (S#{e.season_num}E#{e.episode_num})"
end
-# # Fetch series updates since given timestamp
-# results = tvdb.find_updates_since(2.hours.ago)
-# puts "\n\nUpdated series since 2 hours ago: #{results[:series].size} series\n\n"
-# tvdb.each_updated_series(:since => 2.hours.ago) do |series|
-# puts "#{series.id} - #{series.title}"
-# end
-#
-# # Fetch episode udpates since given timestamp
-# puts "Updated episodes since 2 hours ago: #{results[:episodes].size} episodes\n\n"
-# tvdb.each_updated_episode(:since => 2.hours.ago) do |episode|
-# puts "#{episode.id} - #{episode.name} - #{episode.seriesid}"
-# end
\ No newline at end of file
+ # Fetch series updates since given timestamp
+ time = 10.minutes.ago
+ results = tvdb.find_updates_since(time)
+ puts "\n\nUpdated series since 10 mins ago: #{results[:series].size} series\n\n"
+ tvdb.each_updated_series(:since => time) do |series|
+ puts "#{series.id} - #{series.title}"
+ end
+
+ # Fetch episode udpates since given timestamp
+ puts "\nUpdated episodes since 10 mins ago: #{results[:episodes].size} episodes\n\n"
+ tvdb.each_updated_episode(:since => time) do |episode|
+ puts "#{episode.id} - #{episode.name} - #{episode.seriesid}"
+ end
\ No newline at end of file
|
Require activerecord and show all updates in <I> minutes
|
bazaarlabs_tvdbr
|
train
|
225b8bd945f3c4df444c81c565572ac292de0a30
|
diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -61,45 +61,56 @@ describe('chai-immutable', function () {
describe('keys method', function () {
var mapFoobar = new Map({ foo: 1, bar: 2 });
+ var objectFoobar = { foo: 1, bar: 2 };
it('should be true when given an existing key', function () {
expect(new Map({ foo: 1 })).to.have.key('foo');
+ expect({ foo: 1 }).to.have.key('foo');
});
it('should be false when given a non existing key', function () {
expect(mapFoobar).to.not.have.key('notfoo');
+ expect(objectFoobar).to.not.have.key('notfoo');
});
it('should be true when given multiple existing keys', function () {
expect(mapFoobar).to.have.keys('foo', 'bar');
+ expect(objectFoobar).to.have.keys('foo', 'bar');
});
it('should be false when given multiple non existing keys', function () {
expect(mapFoobar).to.not.have.keys('not-foo', 'not-bar');
+ expect(objectFoobar).to.not.have.keys('not-foo', 'not-bar');
});
it('should accept an Array of keys to check against', function () {
expect(mapFoobar).to.have.keys(['bar', 'foo']);
+ expect(objectFoobar).to.have.keys(['bar', 'foo']);
});
it('should accept an Object to check against', function () {
expect(mapFoobar).to.have.keys({ 'bar': 6, 'foo': 7 });
+ expect(objectFoobar).to.have.keys({ 'bar': 6, 'foo': 7 });
});
it('should be true when used with any and an existing key', function () {
expect(mapFoobar).to.have.any.keys('foo', 'not-foo');
+ expect(objectFoobar).to.have.any.keys('foo', 'not-foo');
});
it('should be false when used with any and inexisting keys', function () {
expect(mapFoobar).to.not.have.any.keys('not-foo', 'not-bar');
+ expect(objectFoobar).to.not.have.any.keys('not-foo', 'not-bar');
});
it('should be true when used with all and existing keys', function () {
expect(mapFoobar).to.have.all.keys('foo', 'bar');
+ expect(objectFoobar).to.have.all.keys('foo', 'bar');
});
it('should be false when used with all and inexisting keys', function () {
expect(mapFoobar).to.not.have.all.keys('not-foo', 'bar');
+ expect(objectFoobar).to.not.have.all.keys('not-foo', 'bar');
});
});
|
Check consistency for all tests for keys method
|
astorije_chai-immutable
|
train
|
74c061bf97026d9c65b9d134fb8c3e352bdc0b81
|
diff --git a/languagetool-core/src/main/java/org/languagetool/rules/patterns/UnifierConfiguration.java b/languagetool-core/src/main/java/org/languagetool/rules/patterns/UnifierConfiguration.java
index <HASH>..<HASH> 100644
--- a/languagetool-core/src/main/java/org/languagetool/rules/patterns/UnifierConfiguration.java
+++ b/languagetool-core/src/main/java/org/languagetool/rules/patterns/UnifierConfiguration.java
@@ -23,6 +23,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
/**
* @author Stefan Lotties
@@ -42,8 +44,9 @@ public class UnifierConfiguration {
private final Map<String, List<String>> equivalenceFeatures;
public UnifierConfiguration() {
- equivalenceTypes = new HashMap<>();
- equivalenceFeatures = new HashMap<>();
+ // FIXME: workaround for issue #13
+ equivalenceTypes = new ConcurrentHashMap<>();
+ equivalenceFeatures = new ConcurrentHashMap<>();
}
/**
@@ -57,18 +60,22 @@ public class UnifierConfiguration {
*/
public final void setEquivalence(final String feature, final String type,
final Element elem) {
- if (equivalenceTypes.containsKey(new EquivalenceTypeLocator(feature, type))) {
+
+ EquivalenceTypeLocator typeKey = new EquivalenceTypeLocator(feature, type);
+ if (equivalenceTypes.containsKey(typeKey)) {
return;
}
- equivalenceTypes.put(new EquivalenceTypeLocator(feature, type), elem);
+ equivalenceTypes.put(typeKey, elem);
+
final List<String> lTypes;
if (equivalenceFeatures.containsKey(feature)) {
lTypes = equivalenceFeatures.get(feature);
} else {
- lTypes = new ArrayList<>();
+ // FIXME: workaround for issue #13
+ lTypes = new CopyOnWriteArrayList<>();
+ equivalenceFeatures.put(feature, lTypes);
}
lTypes.add(type);
- equivalenceFeatures.put(feature, lTypes);
}
public Map<String, List<String>> getEquivalenceFeatures() {
|
implemented workaround for concurrent usage of the equivalenceTypes and equivalenceFeatures (Issue #<I>)
|
languagetool-org_languagetool
|
train
|
93b8124b8e24567341b2beccc698e80f3e0e6896
|
diff --git a/libraries/ValidForm/class.vf_element.php b/libraries/ValidForm/class.vf_element.php
index <HASH>..<HASH> 100644
--- a/libraries/ValidForm/class.vf_element.php
+++ b/libraries/ValidForm/class.vf_element.php
@@ -300,9 +300,13 @@ class VF_Element extends VF_Base {
}
} else {
if (is_array($this->__default)) {
- if (isset($this->__default[$intDynamicPosition]) && strlen($this->__default[$intDynamicPosition]) > 0) {
- $varReturn = $this->__default[$intDynamicPosition];
- }
+ if ($this->isDynamic()) {
+ if (isset($this->__default[$intDynamicPosition]) && strlen($this->__default[$intDynamicPosition]) > 0) {
+ $varReturn = $this->__default[$intDynamicPosition];
+ }
+ } else {
+ $varReturn = $this->__default;
+ }
} else {
if (strlen($this->__default) > 0) {
$varReturn = $this->__default;
|
Fixed a bug where multiple checkboxes didn't get checked when set by default.
git-svn-id: <URL>
|
validformbuilder_validformbuilder
|
train
|
6b3e8ec45d2b14629aad8c5662757cb7348b664f
|
diff --git a/documentation/website/build.js b/documentation/website/build.js
index <HASH>..<HASH> 100644
--- a/documentation/website/build.js
+++ b/documentation/website/build.js
@@ -1,4 +1,7 @@
'use strict';
+
+// copy webfonts
+
const
{ readFileSync } = require('fs'),
{ resolve } = require('path'),
@@ -38,6 +41,8 @@ Metalsmith(__dirname)
.use(renamePath(/\.\/node_modules\/@serenity-js\/(.*)\/target\/site\//, 'modules/$1/'))
.use(source('../../CHANGELOG.md'))
.use(renamePath(/\.\.\/\.\.\/(.*)/, '$1'))
+ .use(sources('../../node_modules/@fortawesome/fontawesome-free/webfonts'))
+ .use(renamePath(new RegExp('../../node_modules/@fortawesome/fontawesome-free/webfonts'), 'webfonts'))
.destination('target/site')
// .ignore()
.clean(true)
|
docs(website): corrected missing icons
|
jan-molak_serenity-js
|
train
|
41211de2d7854e27aca8e3d1eccb24352be7e915
|
diff --git a/libraries/botbuilder-applicationinsights/setup.py b/libraries/botbuilder-applicationinsights/setup.py
index <HASH>..<HASH> 100644
--- a/libraries/botbuilder-applicationinsights/setup.py
+++ b/libraries/botbuilder-applicationinsights/setup.py
@@ -12,7 +12,7 @@ REQUIRES = [
]
TESTS_REQUIRES = [
"aiounittest==1.3.0",
- "django==2.2.10", # For samples
+ "django==2.2.24", # For samples
"djangorestframework==3.10.3", # For samples
"flask==1.1.1", # For samples
]
|
Fix django vulnerability (#<I>)
|
Microsoft_botbuilder-python
|
train
|
833e26eb2c6f43bb03f1cb16aee7fbc63f67e7aa
|
diff --git a/src/com/mattbertolini/hermes/MessagesProxy.java b/src/com/mattbertolini/hermes/MessagesProxy.java
index <HASH>..<HASH> 100644
--- a/src/com/mattbertolini/hermes/MessagesProxy.java
+++ b/src/com/mattbertolini/hermes/MessagesProxy.java
@@ -153,10 +153,13 @@ public class MessagesProxy extends AbstractI18nProxy {
}
/**
- * Instantiates the plural rule class given inside the PluralCount annotation.
+ * Instantiates the plural rule class given inside the PluralCount
+ * annotation. The pluralRule class that is instantiated is based on the
+ * language originally given to the library. If that language is not found,
+ * defaults to the given class.
*
- * @param clazz
- * @return
+ * @param clazz The PluralRule class
+ * @return An instantiated PluralRule class
*/
private PluralRule instantiateCustomPluralRuleClass(Class<? extends PluralRule> clazz) {
PluralRule retVal = null;
|
Updating the javadoc for the instantiate method.
|
mattbertolini_Hermes
|
train
|
6d1349e8612c48dd41ff2c5029c02ecb5a7333e7
|
diff --git a/framework/core/src/Extension/ExtensionServiceProvider.php b/framework/core/src/Extension/ExtensionServiceProvider.php
index <HASH>..<HASH> 100644
--- a/framework/core/src/Extension/ExtensionServiceProvider.php
+++ b/framework/core/src/Extension/ExtensionServiceProvider.php
@@ -27,7 +27,7 @@ class ExtensionServiceProvider extends AbstractServiceProvider
// Boot extensions when the app is booting. This must be done as a boot
// listener on the app rather than in the service provider's boot method
// below, so that extensions have a chance to register things on the
- // container before the core boot code runs.
+ // container before the core boots up (and starts resolving services).
$this->app->booting(function (Container $app) {
$app->make('flarum.extensions')->extend($app);
});
diff --git a/framework/core/src/Foundation/InstalledSite.php b/framework/core/src/Foundation/InstalledSite.php
index <HASH>..<HASH> 100644
--- a/framework/core/src/Foundation/InstalledSite.php
+++ b/framework/core/src/Foundation/InstalledSite.php
@@ -36,6 +36,7 @@ use Illuminate\Cache\Repository as CacheRepository;
use Illuminate\Config\Repository as ConfigRepository;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Cache\Store;
+use Illuminate\Contracts\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Filesystem\FilesystemServiceProvider;
use Illuminate\Hashing\HashServiceProvider;
@@ -146,9 +147,14 @@ class InstalledSite implements SiteInterface
$laravel->register(ExtensionServiceProvider::class);
- foreach ($this->extenders as $extension) {
- $extension->extend($laravel);
- }
+ $laravel->booting(function (Container $app) {
+ // Run all local-site extenders before booting service providers
+ // (but after those from "real" extensions, which have been set up
+ // in a service provider above).
+ foreach ($this->extenders as $extension) {
+ $extension->extend($app);
+ }
+ });
$laravel->boot();
|
Make site extenders run after extensions
Fixes #<I>.
|
flarum_core
|
train
|
d325534a5c6b5a22861046e6cf545ee654752a9e
|
diff --git a/src/Illuminate/Database/Eloquent/Collection.php b/src/Illuminate/Database/Eloquent/Collection.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Eloquent/Collection.php
+++ b/src/Illuminate/Database/Eloquent/Collection.php
@@ -356,14 +356,4 @@ class Collection extends BaseCollection implements QueueableCollection
{
return $this->modelKeys();
}
-
- /**
- * Get a base Support collection instance from this collection.
- *
- * @return \Illuminate\Support\Collection
- */
- public function toBase()
- {
- return new BaseCollection($this->items);
- }
}
diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Support/Collection.php
+++ b/src/Illuminate/Support/Collection.php
@@ -1183,13 +1183,11 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
/**
* Get a base Support collection instance from this collection.
*
- * Provided for API compatibility with Eloquent collections.
- *
* @return \Illuminate\Support\Collection
*/
public function toBase()
{
- return $this;
+ return is_subclass_of($this, self::class) ? new self($this) : $this;
}
/**
diff --git a/tests/Database/DatabaseEloquentCollectionTest.php b/tests/Database/DatabaseEloquentCollectionTest.php
index <HASH>..<HASH> 100755
--- a/tests/Database/DatabaseEloquentCollectionTest.php
+++ b/tests/Database/DatabaseEloquentCollectionTest.php
@@ -161,18 +161,16 @@ class DatabaseEloquentCollectionTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf(Collection::class, $cAfterMap);
}
- public function testCollectionChangesToBaseCollectionIfMapLosesModels()
+ public function testMappingToNonModelsReturnsABaseCollection()
{
$one = m::mock('Illuminate\Database\Eloquent\Model');
$two = m::mock('Illuminate\Database\Eloquent\Model');
- $c = new Collection([$one, $two]);
-
- $cAfterMap = $c->map(function ($item) {
- return [];
+ $c = (new Collection([$one, $two]))->map(function ($item) {
+ return 'not-a-model';
});
- $this->assertInstanceOf(BaseCollection::class, $cAfterMap);
+ $this->assertEquals(BaseCollection::class, get_class($c));
}
public function testCollectionDiffsWithGivenCollection()
@@ -276,12 +274,12 @@ class DatabaseEloquentCollectionTest extends PHPUnit_Framework_TestCase
{
$a = new Collection([['foo' => 'bar'], ['foo' => 'baz']]);
$b = new Collection(['a', 'b', 'c']);
- $this->assertEquals(get_class($a->pluck('foo')), BaseCollection::class);
- $this->assertEquals(get_class($a->keys()), BaseCollection::class);
- $this->assertEquals(get_class($a->collapse()), BaseCollection::class);
- $this->assertEquals(get_class($a->flatten()), BaseCollection::class);
- $this->assertEquals(get_class($a->zip(['a', 'b'], ['c', 'd'])), BaseCollection::class);
- $this->assertEquals(get_class($b->flip()), BaseCollection::class);
+ $this->assertEquals(BaseCollection::class, get_class($a->pluck('foo')));
+ $this->assertEquals(BaseCollection::class, get_class($a->keys()));
+ $this->assertEquals(BaseCollection::class, get_class($a->collapse()));
+ $this->assertEquals(BaseCollection::class, get_class($a->flatten()));
+ $this->assertEquals(BaseCollection::class, get_class($a->zip(['a', 'b'], ['c', 'd'])));
+ $this->assertEquals(BaseCollection::class, get_class($b->flip()));
}
public function testMakeVisibleRemovesHiddenAndIncludesVisible()
|
[<I>] Make toBase on the base collection actually be useful (#<I>)
* Fix test: ascertain that the returned collection is not an Eloquent collection
* Make the toBase method on the base collection actually work
* Delete the toBase method on the Eloquent Collection
* Fix tests: pass expected values first
|
laravel_framework
|
train
|
ee6be381170975c5d94bd2ed49244d75cea018c8
|
diff --git a/util/src/main/java/org/killbill/billing/util/tag/dao/DefaultTagDefinitionDao.java b/util/src/main/java/org/killbill/billing/util/tag/dao/DefaultTagDefinitionDao.java
index <HASH>..<HASH> 100644
--- a/util/src/main/java/org/killbill/billing/util/tag/dao/DefaultTagDefinitionDao.java
+++ b/util/src/main/java/org/killbill/billing/util/tag/dao/DefaultTagDefinitionDao.java
@@ -105,8 +105,12 @@ public class DefaultTagDefinitionDao extends EntityDaoBase<TagDefinitionModelDao
return transactionalSqlDao.execute(true, new EntitySqlDaoTransactionWrapper<TagDefinitionModelDao>() {
@Override
public TagDefinitionModelDao inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception {
- final TagDefinitionModelDao tagDefinitionModelDao = SystemTags.lookup(definitionId);
- return tagDefinitionModelDao != null ? tagDefinitionModelDao : entitySqlDaoWrapperFactory.become(TagDefinitionSqlDao.class).getById(definitionId.toString(), context);
+ final TagDefinitionModelDao systemTag = SystemTags.lookup(definitionId);
+ final TagDefinitionModelDao tag = systemTag != null ? systemTag : entitySqlDaoWrapperFactory.become(TagDefinitionSqlDao.class).getById(definitionId.toString(), context);
+ if(tag == null) {
+ throw new TagDefinitionApiException(ErrorCode.TAG_DEFINITION_DOES_NOT_EXIST, definitionId);
+ }
+ return tag;
}
});
}
|
#<I> - Fix for `NullPointerException` when tag definition does not exist.
|
killbill_killbill
|
train
|
6bbc5f7804f9cc288e1714bfa754ded8a67e55b8
|
diff --git a/spinner.go b/spinner.go
index <HASH>..<HASH> 100644
--- a/spinner.go
+++ b/spinner.go
@@ -319,7 +319,6 @@ func (s *Spinner) erase() {
}
del, _ := hex.DecodeString("7f")
for _, c := range []string{
- "\r",
"\b",
string(del),
"\b",
|
also unnessecary for windows
|
briandowns_spinner
|
train
|
0fc937810c54137c3442cea5db6799d15c6f7bc5
|
diff --git a/ChangeLog b/ChangeLog
index <HASH>..<HASH> 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2007-09-28 Brian Warner <warner@lothar.com>
+ * buildbot/status/web/baseweb.py (OneBoxPerBuilder): make this page
+ respect branch= queryargs, by restricting the builds displayed to
+ those matching the given branch names
+ * buildbot/status/web/waterfall.py (BuildTopBox): same
+
* buildbot/test/test_web.py (WaterfallSteps.test_urls.FakeRequest):
fix a test failure by adding .prepath to this fake object
diff --git a/buildbot/status/web/baseweb.py b/buildbot/status/web/baseweb.py
index <HASH>..<HASH> 100644
--- a/buildbot/status/web/baseweb.py
+++ b/buildbot/status/web/baseweb.py
@@ -210,8 +210,10 @@ class OneBoxPerBuilder(HtmlResource):
builder = status.getBuilder(bn)
data += "<tr>\n"
data += "<td>%s</td>\n" % html.escape(bn)
- b = builder.getLastFinishedBuild()
- if b:
+ builds = list(builder.generateFinishedBuilds(branches,
+ num_builds=1))
+ if builds:
+ b = builds[0]
url = (self.path_to_root(req) +
"builders/" +
urllib.quote(bn, safe='') +
diff --git a/buildbot/status/web/waterfall.py b/buildbot/status/web/waterfall.py
index <HASH>..<HASH> 100644
--- a/buildbot/status/web/waterfall.py
+++ b/buildbot/status/web/waterfall.py
@@ -99,14 +99,17 @@ class BuildTopBox(components.Adapter):
def getBox(self, req):
assert interfaces.IBuilderStatus(self.original)
- b = self.original.getLastFinishedBuild()
- if not b:
+ branches = [b for b in req.args.get("branch", []) if b]
+ builds = list(self.original.generateFinishedBuilds(branches,
+ num_builds=1))
+ if not builds:
return Box(["none"], "white", class_="LastBuild")
+ b = builds[0]
name = b.getBuilder().getName()
number = b.getNumber()
url = path_to_build(req, b)
text = b.getText()
- # TODO: add logs?
+ # TODO: maybe add logs?
# TODO: add link to the per-build page at 'url'
c = b.getColor()
class_ = build_get_class(b)
|
web: make BuildTopBox and OneBoxPerBuilder respect branch= queryargs
|
buildbot_buildbot
|
train
|
3094d423c498640f01d267ca7589533f862e9ac4
|
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/util/monkey_patches.rb
+++ b/lib/puppet/util/monkey_patches.rb
@@ -90,3 +90,17 @@ if RUBY_VERSION == '1.8.1' || RUBY_VERSION == '1.8.2'
r
}
end
+
+class Array
+ # Ruby < 1.8.7 doesn't have this method but we use it in tests
+ def combination(num)
+ return [] if num < 0 || num > size
+ return [[]] if num == 0
+ return map{|e| [e] } if num == 1
+ tmp = self.dup
+ self[0, size - (num - 1)].inject([]) do |ret, e|
+ tmp.shift
+ ret += tmp.combination(num - 1).map{|a| a.unshift(e) }
+ end
+ end unless method_defined? :combination
+end
diff --git a/spec/unit/util/monkey_patches_spec.rb b/spec/unit/util/monkey_patches_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/util/monkey_patches_spec.rb
+++ b/spec/unit/util/monkey_patches_spec.rb
@@ -31,3 +31,26 @@ describe "yaml deserialization" do
obj.foo.should == 100
end
end
+
+# In Ruby > 1.8.7 this is a builtin, otherwise we monkey patch the method in
+describe "Array#combination" do
+ it "should fail if wrong number of arguments given" do
+ lambda { [1,2,3].combination() }.should raise_error(ArgumentError, /wrong number/)
+ lambda { [1,2,3].combination(1,2) }.should raise_error(ArgumentError, /wrong number/)
+ end
+
+ it "should return an empty array if combo size than array size or negative" do
+ [1,2,3].combination(4).to_a.should == []
+ [1,2,3].combination(-1).to_a.should == []
+ end
+
+ it "should return an empty array with an empty array if combo size == 0" do
+ [1,2,3].combination(0).to_a.should == [[]]
+ end
+
+ it "should all provide all combinations of size passed in" do
+ [1,2,3,4].combination(1).to_a.should == [[1], [2], [3], [4]]
+ [1,2,3,4].combination(2).to_a.should == [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]
+ [1,2,3,4].combination(3).to_a.should == [[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]
+ end
+end
|
maint: Add Array combinations method
Ruby < <I> doesn't have this method and we're using it in a test, so
tests won't run on <I> until this is in place.
It's probably a good thing to use much in implementation since it's
written in pure Ruby when using < <I> and in C when in > <I>, but
then if you're using older Rubies you're probably not expecting much for
performance anyway.
|
puppetlabs_puppet
|
train
|
9b1339150801eca78296db9088dcec580bcf334f
|
diff --git a/Classes/FlowQueryOperations/NeosUiDefaultNodesOperation.php b/Classes/FlowQueryOperations/NeosUiDefaultNodesOperation.php
index <HASH>..<HASH> 100644
--- a/Classes/FlowQueryOperations/NeosUiDefaultNodesOperation.php
+++ b/Classes/FlowQueryOperations/NeosUiDefaultNodesOperation.php
@@ -74,7 +74,7 @@ class NeosUiDefaultNodesOperation extends AbstractOperation
/** @var TraversableNodeInterface $siteNode */
/** @var TraversableNodeInterface $documentNode */
list($siteNode, $documentNode) = $flowQuery->getContext();
- /** @var TraversableNodeInterface $toggledNodes */
+ /** @var string[] $toggledNodes */
list($baseNodeType, $loadingDepth, $toggledNodes, $clipboardNodesContextPaths) = $arguments;
// Collect all parents of documentNode up to siteNode
@@ -100,7 +100,7 @@ class NeosUiDefaultNodesOperation extends AbstractOperation
if (
$level < $loadingDepth || // load all nodes within loadingDepth
$loadingDepth === 0 || // unlimited loadingDepth
- in_array((string)$baseNode->getNodeAggregateIdentifier(), $toggledNodes) || // load toggled nodes
+ in_array($baseNode->getContextPath(), $toggledNodes) || // load toggled nodes
in_array((string)$baseNode->getNodeAggregateIdentifier(), $parents) // load children of all parents of documentNode
) {
foreach ($baseNode->findChildNodes($this->nodeTypeConstraintFactory->parseFilterString($baseNodeType)) as $childNode) {
|
BUGFIX: fix refreshing of page tree with expanded nodes
$toggledNodes from the client side is an array of strings, each being a currently expanded NodeContextPath.
Thus, we cannot compare it based on the NodeAggregateIdentifier; because that's not what it is from the client side.
|
neos_neos-ui
|
train
|
c325f9a7fedf8f931b2a91f79b230dc036cf09f3
|
diff --git a/packet-manager_test.go b/packet-manager_test.go
index <HASH>..<HASH> 100644
--- a/packet-manager_test.go
+++ b/packet-manager_test.go
@@ -2,6 +2,7 @@ package sftp
import (
"encoding"
+ "fmt"
"sync"
"testing"
"time"
@@ -89,6 +90,19 @@ func TestPacketManager(t *testing.T) {
s.close()
}
+func (p sshFxpRemovePacket) String() string {
+ return fmt.Sprintf("RmPct:%d", p.ID)
+}
+func (p sshFxpOpenPacket) String() string {
+ return fmt.Sprintf("OpPct:%d", p.ID)
+}
+func (p sshFxpWritePacket) String() string {
+ return fmt.Sprintf("WrPct:%d", p.ID)
+}
+func (p sshFxpClosePacket) String() string {
+ return fmt.Sprintf("ClPct:%d", p.ID)
+}
+
// Test what happens when the pool processes a close packet on a file that it
// is still reading from.
func TestCloseOutOfOrder(t *testing.T) {
|
nicer debugging output for a few packet types
|
pkg_sftp
|
train
|
03ab2ec45481f64b1599437c47e21f4a99e63ad6
|
diff --git a/component.json b/component.json
index <HASH>..<HASH> 100644
--- a/component.json
+++ b/component.json
@@ -9,7 +9,6 @@
"main": "lib/index.js",
"scripts": [
"lib/index.js",
- "lib/realSetImmediate.js",
"lib/nextTick.js",
"lib/postMessage.js",
"lib/messageChannel.js",
diff --git a/dist/immediate.js b/dist/immediate.js
index <HASH>..<HASH> 100644
--- a/dist/immediate.js
+++ b/dist/immediate.js
@@ -203,7 +203,6 @@ require.relative = function(parent) {
require.register("immediate/lib/index.js", function(exports, require, module){
"use strict";
var types = [
- //require("./realSetImmediate"),
require("./nextTick"),
require("./mutation"),
require("./postMessage"),
@@ -252,18 +251,6 @@ retFunc.clear = function (n) {
module.exports = retFunc;
});
-require.register("immediate/lib/realSetImmediate.js", function(exports, require, module){
-"use strict";
-var globe = require("./global");
-exports.test = function () {
- return globe.setImmediate;
-};
-
-exports.install = function () {
- return globe.setImmediate.bind(globe);
-};
-
-});
require.register("immediate/lib/nextTick.js", function(exports, require, module){
"use strict";
exports.test = function () {
diff --git a/dist/main.js b/dist/main.js
index <HASH>..<HASH> 100644
--- a/dist/main.js
+++ b/dist/main.js
@@ -1,7 +1,6 @@
require.register("immediate/lib/index.js", function(exports, require, module){
"use strict";
var types = [
- //require("./realSetImmediate"),
require("./nextTick"),
require("./mutation"),
require("./postMessage"),
@@ -50,18 +49,6 @@ retFunc.clear = function (n) {
module.exports = retFunc;
});
-require.register("immediate/lib/realSetImmediate.js", function(exports, require, module){
-"use strict";
-var globe = require("./global");
-exports.test = function () {
- return globe.setImmediate;
-};
-
-exports.install = function () {
- return globe.setImmediate.bind(globe);
-};
-
-});
require.register("immediate/lib/nextTick.js", function(exports, require, module){
"use strict";
exports.test = function () {
diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,6 +1,5 @@
"use strict";
var types = [
- //require("./realSetImmediate"),
require("./nextTick"),
require("./mutation"),
require("./postMessage"),
|
don't build with the obsolete stuff
|
calvinmetcalf_macrotask
|
train
|
d1b1fee08013569e22eb8fed3db59ee06c4420d5
|
diff --git a/cmd/background-newdisks-heal-ops.go b/cmd/background-newdisks-heal-ops.go
index <HASH>..<HASH> 100644
--- a/cmd/background-newdisks-heal-ops.go
+++ b/cmd/background-newdisks-heal-ops.go
@@ -118,6 +118,7 @@ func initBackgroundHealing(ctx context.Context, objAPI ObjectLayer) {
// 2. Only the node hosting the disk is responsible to perform the heal
func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerSets, bgSeq *healSequence) {
// Perform automatic disk healing when a disk is replaced locally.
+wait:
for {
select {
case <-ctx.Done():
@@ -176,6 +177,26 @@ func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerSets, bgSeq *
for _, disk := range disks {
logger.Info("Healing disk '%s' on %s zone", disk, humanize.Ordinal(i+1))
+ // So someone changed the drives underneath, healing tracker missing.
+ if !disk.Healing() {
+ logger.Info("Healing tracker missing on '%s', disk was swapped again on %s zone", disk, humanize.Ordinal(i+1))
+ diskID, err := disk.GetDiskID()
+ if err != nil {
+ logger.LogIf(ctx, err)
+ // reading format.json failed or not found, proceed to look
+ // for new disks to be healed again, we cannot proceed further.
+ goto wait
+ }
+
+ if err := saveHealingTracker(disk, diskID); err != nil {
+ logger.LogIf(ctx, err)
+ // Unable to write healing tracker, permission denied or some
+ // other unexpected error occurred. Proceed to look for new
+ // disks to be healed again, we cannot proceed further.
+ goto wait
+ }
+ }
+
lbDisks := z.serverSets[i].sets[setIndex].getOnlineDisks()
if err := healErasureSet(ctx, setIndex, buckets, lbDisks); err != nil {
logger.LogIf(ctx, err)
diff --git a/cmd/format-erasure.go b/cmd/format-erasure.go
index <HASH>..<HASH> 100644
--- a/cmd/format-erasure.go
+++ b/cmd/format-erasure.go
@@ -339,6 +339,19 @@ func loadFormatErasureAll(storageDisks []StorageAPI, heal bool) ([]*formatErasur
return formats, g.Wait()
}
+func saveHealingTracker(disk StorageAPI, diskID string) error {
+ htracker := healingTracker{
+ ID: diskID,
+ }
+ htrackerBytes, err := htracker.MarshalMsg(nil)
+ if err != nil {
+ return err
+ }
+ return disk.WriteAll(context.TODO(), minioMetaBucket,
+ pathJoin(bucketMetaPrefix, slashSeparator, healingTrackerFilename),
+ htrackerBytes)
+}
+
func saveFormatErasure(disk StorageAPI, format *formatErasureV3, heal bool) error {
if disk == nil || format == nil {
return errDiskNotFound
@@ -373,16 +386,7 @@ func saveFormatErasure(disk StorageAPI, format *formatErasureV3, heal bool) erro
disk.SetDiskID(diskID)
if heal {
- htracker := healingTracker{
- ID: diskID,
- }
- htrackerBytes, err := htracker.MarshalMsg(nil)
- if err != nil {
- return err
- }
- return disk.WriteAll(context.TODO(), minioMetaBucket,
- pathJoin(bucketMetaPrefix, slashSeparator, healingTrackerFilename),
- htrackerBytes)
+ return saveHealingTracker(disk, diskID)
}
return nil
}
|
fix: save healing tracker right before healing (#<I>)
this change avoids a situation where accidentally
if the user deleted the healing tracker or drives
were replaced again within the <I>sec window.
|
minio_minio
|
train
|
0cc2e14861872731019f00e8c9b2127213504cba
|
diff --git a/src/main/resources/META-INF/resources/primefaces/overlaypanel/overlaypanel.js b/src/main/resources/META-INF/resources/primefaces/overlaypanel/overlaypanel.js
index <HASH>..<HASH> 100644
--- a/src/main/resources/META-INF/resources/primefaces/overlaypanel/overlaypanel.js
+++ b/src/main/resources/META-INF/resources/primefaces/overlaypanel/overlaypanel.js
@@ -7,9 +7,7 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
this._super(cfg);
this.content = this.jq.children('div.ui-overlaypanel-content')
-
- this.target = PrimeFaces.expressions.SearchExpressionFacade.resolveComponentsAsSelector(this.cfg.target);
-
+
//configuration
this.cfg.my = this.cfg.my||'left top';
this.cfg.at = this.cfg.at||'left bottom';
@@ -20,18 +18,23 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
if(this.cfg.showCloseIcon) {
this.closerIcon = $('<a href="#" class="ui-overlaypanel-close ui-state-default" href="#"><span class="ui-icon ui-icon-closethick"></span></a>').appendTo(this.jq);
}
-
- this.bindEvents();
-
+
if(this.cfg.appendToBody) {
this.jq.appendTo(document.body);
}
+
+ this.bindDocumentEvents();
- //dialog support
- this.setupDialogSupport();
+ if(this.cfg.target) {
+ this.target = PrimeFaces.expressions.SearchExpressionFacade.resolveComponentsAsSelector(this.cfg.target);
+ this.bindTargetEvents();
+
+ //dialog support
+ this.setupDialogSupport();
+ }
},
- bindEvents: function() {
+ bindTargetEvents: function() {
var $this = this;
//mark target and descandants of target as a trigger for a primefaces overlay
@@ -89,19 +92,25 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
e.preventDefault();
});
}
-
+ },
+
+ bindDocumentEvents: function() {
+ var $this = this;
+
//hide overlay when mousedown is at outside of overlay
if(this.cfg.dismissable) {
var hideNS = 'mousedown.' + this.id;
- $(document.body).off(hideNS).on(hideNS, function (e) {
+ $(document.body).off(hideNS).on(hideNS, function (e) {
if($this.jq.hasClass('ui-overlay-hidden')) {
return;
}
//do nothing on target mousedown
- var target = $(e.target);
- if($this.target.is(target)||$this.target.has(target).length > 0) {
- return;
+ if($this.target) {
+ var target = $(e.target);
+ if($this.target.is(target)||$this.target.has(target).length > 0) {
+ return;
+ }
}
//hide overlay if mousedown is on outside
@@ -132,17 +141,17 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
this.hide();
},
- show: function() {
+ show: function(target) {
if(!this.loaded && this.cfg.dynamic)
- this.loadContents();
+ this.loadContents(target);
else
- this._show();
+ this._show(target);
},
- _show: function() {
+ _show: function(target) {
var $this = this;
- this.align();
+ this.align(target);
//replace visibility hidden with display none for effect support, toggle marker class
this.jq.removeClass('ui-overlay-hidden').addClass('ui-overlay-visible').css({
@@ -161,16 +170,17 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
}
},
- align: function() {
+ align: function(target) {
var fixedPosition = this.jq.css('position') == 'fixed',
win = $(window),
- positionOffset = fixedPosition ? '-' + win.scrollLeft() + ' -' + win.scrollTop() : null;
+ positionOffset = fixedPosition ? '-' + win.scrollLeft() + ' -' + win.scrollTop() : null,
+ targetId = target||this.cfg.target;
this.jq.css({'left':'', 'top':'', 'z-index': ++PrimeFaces.zindex})
.position({
my: this.cfg.my
,at: this.cfg.at
- ,of: document.getElementById(this.cfg.target)
+ ,of: document.getElementById(targetId)
,offset: positionOffset
});
},
@@ -223,7 +233,7 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
}
},
- loadContents: function() {
+ loadContents: function(target) {
var $this = this,
options = {
source: this.id,
@@ -244,7 +254,7 @@ PrimeFaces.widget.OverlayPanel = PrimeFaces.widget.BaseWidget.extend({
return true;
},
oncomplete: function() {
- $this._show();
+ $this._show(element);
}
};
|
OverlayPanel refactor
|
primefaces_primefaces
|
train
|
74446db177b925792c03efff5afd4c4ca57a1c73
|
diff --git a/Components/Queues/Drivers/StompQueueDriver.php b/Components/Queues/Drivers/StompQueueDriver.php
index <HASH>..<HASH> 100644
--- a/Components/Queues/Drivers/StompQueueDriver.php
+++ b/Components/Queues/Drivers/StompQueueDriver.php
@@ -234,6 +234,8 @@ class StompQueueDriver extends Service implements QueueDriverInterface
$this->subscriptionId = false;
$this->currentFrame = null;
}
+ //Top purge the queue independently of the Queuing system, the safest way is to disconnect
+ $this->disconnect();
}
/** {@inheritdoc} */
|
Add disconnect when unsubscribing
|
smartboxgroup_integration-framework-bundle
|
train
|
20a02dddeecef0d134737fbc8b30947381ec753d
|
diff --git a/src/SilexCMS/Page/DynamicPage.php b/src/SilexCMS/Page/DynamicPage.php
index <HASH>..<HASH> 100644
--- a/src/SilexCMS/Page/DynamicPage.php
+++ b/src/SilexCMS/Page/DynamicPage.php
@@ -39,6 +39,7 @@ class DynamicPage implements ServiceProviderInterface
$app->get($route, function (Application $app, Request $req, $_route_params) use ($name, $route, $template, $table) {
$repository = new GenericRepository($app['db'], $table);
+ $app['silexcms.dynamic.route'] = array('name' => $name, 'route' => $route, 'table' => $table, 'route_params' => $_route_params);
$app['set'] = $repository->findOneBy($_route_params);
$response = new TransientResponse($app['twig'], $template);
return $response;
|
- added route_params in silex.dynamic.route
|
Wisembly_SilexCMS
|
train
|
f999acddabf22569b607f82f484cebbbceaf4694
|
diff --git a/mpd/base.py b/mpd/base.py
index <HASH>..<HASH> 100644
--- a/mpd/base.py
+++ b/mpd/base.py
@@ -427,7 +427,6 @@ class MPDClient(MPDClientBase):
self._pending = []
self._iterating = False
self._sock = None
- self._rfile = _NotConnected()
self._rbfile = _NotConnected()
self._wfile = _NotConnected()
@@ -525,7 +524,9 @@ class MPDClient(MPDClientBase):
self._write_line(cmd)
def _read_line(self):
- line = self._rfile.readline()
+ line = self._rbfile.readline()
+ if not IS_PYTHON2:
+ line = line.decode("utf-8")
if self.use_unicode:
line = decode_str(line)
if not line.endswith("\n"):
@@ -727,29 +728,23 @@ class MPDClient(MPDClientBase):
self._sock = self._connect_tcp(host, port)
if IS_PYTHON2:
- self._rfile = self._sock.makefile("r", 1)
+ self._rbfile = self._sock.makefile("rb")
self._wfile = self._sock.makefile("w")
- self._rbfile = self._sock.makefile("rb", 0)
else:
# - Force UTF-8 encoding, since this is dependant from the LC_CTYPE
# locale.
# - by setting newline explicit, we force to send '\n' also on
# windows
- self._rfile = self._sock.makefile(
- "r",
- encoding="utf-8",
- newline="\n",
- buffering=1)
+ self._rbfile = self._sock.makefile(
+ "rb",
+ newline="\n")
self._wfile = self._sock.makefile(
"w",
encoding="utf-8",
newline="\n")
- self._rbfile = self._sock.makefile(
- "rb",
- buffering=0)
try:
- helloline = self._rfile.readline()
+ helloline = self._rbfile.readline().decode('utf-8')
self._hello(helloline)
except Exception:
self.disconnect()
@@ -757,9 +752,6 @@ class MPDClient(MPDClientBase):
def disconnect(self):
logger.info("Calling MPD disconnect()")
- if (self._rfile is not None and
- not isinstance(self._rfile, _NotConnected)):
- self._rfile.close()
if (self._rbfile is not None and
not isinstance(self._rbfile, _NotConnected)):
self._rbfile.close()
diff --git a/mpd/tests.py b/mpd/tests.py
index <HASH>..<HASH> 100755
--- a/mpd/tests.py
+++ b/mpd/tests.py
@@ -80,8 +80,11 @@ class TestMPDClient(unittest.TestCase):
def MPDWillReturn(self, *lines):
# Return what the caller wants first, then do as if the socket was
# disconnected.
- self.client._rfile.readline.side_effect = itertools.chain(
- lines, itertools.repeat(''))
+ innerIter = itertools.chain(lines, itertools.repeat(''))
+ if sys.version_info >= (3, 0):
+ self.client._rbfile.readline.side_effect = (x.encode("utf-8") for x in innerIter)
+ else:
+ self.client._rbfile.readline.side_effect = innerIter
def assertMPDReceived(self, *lines):
self.client._wfile.write.assert_called_with(*lines)
@@ -436,26 +439,11 @@ class TestMPDClient(unittest.TestCase):
# Force the reconnection to refill the mock
self.client.disconnect()
self.client.connect(TEST_MPD_HOST, TEST_MPD_PORT)
- self.assertEqual([mock.call('r', encoding="utf-8", newline="\n", buffering=1),
- mock.call('w', encoding="utf-8", newline="\n"),
- mock.call('rb', buffering=0)],
- # We are only interested into the 3 first entries,
- # otherwise we get all the readline() & co...
- self.client._sock.makefile.call_args_list[0:3])
-
- @unittest.skipIf(sys.version_info >= (3, 0),
- "sock.makefile arguments differ between Python 2 and 3, "
- "see test_force_socket_encoding_and_nonbuffering")
- def test_force_socket_nonbuffering_python2(self):
- # Force the reconnection to refill the mock
- self.client.disconnect()
- self.client.connect(TEST_MPD_HOST, TEST_MPD_PORT)
- self.assertEqual([mock.call('r', 1),
- mock.call('w'),
- mock.call('rb', 0)],
- # We are only interested into the 3 first entries,
+ self.assertEqual([mock.call('rb', newline="\n"),
+ mock.call('w', encoding="utf-8", newline="\n")],
+ # We are only interested into the 2 first entries,
# otherwise we get all the readline() & co...
- self.client._sock.makefile.call_args_list[0:3])
+ self.client._sock.makefile.call_args_list[0:2])
def test_ranges_as_argument(self):
self.MPDWillReturn('OK\n')
|
Removed MPDClient binary/text file distinction
All operations now use a binary mode file, and decode as needed
|
Mic92_python-mpd2
|
train
|
c488e259f456348801217e8ea16cc57b12d62ab1
|
diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php
index <HASH>..<HASH> 100644
--- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php
+++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer.php
@@ -21,7 +21,7 @@ use igorw;
class Indexer
{
- /** @var Elasticsearch\Client */
+ /** @var \Elasticsearch\Client */
private $client;
private $options;
private $logger;
@@ -66,6 +66,8 @@ class Indexer
$params['index'] = $this->options['index'];
$params['type'] = self::TYPE_RECORD;
$params['body'][self::TYPE_RECORD] = $this->getRecordMapping();
+
+ // @todo This must throw a new indexation if a mapping is edited
$this->client->indices()->putMapping($params);
}
@@ -119,7 +121,7 @@ class Indexer
// Optimize index
$params = array('index' => $this->options['index']);
$this->client->indices()->optimize($params);
-
+ $this->restoreShardRefreshing();
} catch (Exception $e) {
$this->restoreShardRefreshing();
throw $e;
|
Fix the refresh interval not resseting to the original value
|
alchemy-fr_Phraseanet
|
train
|
4763cae0738c882a24a7b0abdb8d21ba4c187215
|
diff --git a/pythran/backend.py b/pythran/backend.py
index <HASH>..<HASH> 100644
--- a/pythran/backend.py
+++ b/pythran/backend.py
@@ -577,10 +577,11 @@ class Cxx(Backend):
def visit_Print(self, node):
values = [self.visit(n) for n in node.values]
- return Statement("print{0}({1})".format(
+ stmt = Statement("print{0}({1})".format(
"" if node.nl else "_nonl",
", ".join(values))
)
+ return self.process_omp_attachements(node, stmt)
def visit_For(self, node):
if not isinstance(node.target, ast.Name):
|
Fix bad OpenMP directive processing for print
The directive was correctly parsed and attached to the node, but not
pretty-printed.
|
serge-sans-paille_pythran
|
train
|
8dcf2b69bb2a44af08f4fa822fa591f08639a4cc
|
diff --git a/lib/rom/header.rb b/lib/rom/header.rb
index <HASH>..<HASH> 100644
--- a/lib/rom/header.rb
+++ b/lib/rom/header.rb
@@ -116,6 +116,10 @@ module ROM
by_type(Wrap)
end
+ # Return all Combined attributes
+ #
+ # @return [Array<Combined>]
+ #
# @api private
def combined
by_type(Combined)
|
Add docs for list of combined attributes
|
rom-rb_rom
|
train
|
a086b609b5b06ff8fd988edc23b58dea429b0a0b
|
diff --git a/src/Invoice.php b/src/Invoice.php
index <HASH>..<HASH> 100644
--- a/src/Invoice.php
+++ b/src/Invoice.php
@@ -2,8 +2,8 @@
namespace Laravel\Cashier;
-use DOMPDF;
use Carbon\Carbon;
+use Dompdf\Dompdf;
use Illuminate\Support\Facades\View;
use Symfony\Component\HttpFoundation\Response;
use Braintree\Transaction as BraintreeTransaction;
@@ -236,9 +236,9 @@ class Invoice
require_once $configPath;
}
- $dompdf = new DOMPDF;
+ $dompdf = new Dompdf;
- $dompdf->load_html($this->view($data)->render());
+ $dompdf->loadHtml($this->view($data)->render());
$dompdf->render();
|
Fix Dompdf call, when creating invoices.
|
laravel_cashier-braintree
|
train
|
f186f0157473c39067bf63d99f86d3043b05c466
|
diff --git a/python/ccxt/base/exchange.py b/python/ccxt/base/exchange.py
index <HASH>..<HASH> 100644
--- a/python/ccxt/base/exchange.py
+++ b/python/ccxt/base/exchange.py
@@ -1467,10 +1467,11 @@ class Exchange(object):
array = self.to_array(data)
result = []
for item in array:
- if isinstance(item, list):
- result += [self.extend(self.parse_ledger_entry(i, currency), params) for i in item]
+ entry = self.parse_ledger_entry(item, currency)
+ if isinstance(entry, list):
+ result += [self.extend(i, params) for i in entry]
else:
- result.append(self.extend(self.parse_ledger_entry(item, currency), params))
+ result.append(self.extend(entry, params))
result = self.sort_by(result, 'timestamp')
code = currency['code'] if currency else None
return self.filter_by_currency_since_limit(result, code, since, limit)
|
exchange.py parse_ledger edits
|
ccxt_ccxt
|
train
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.