hash stringlengths 40 40 | diff stringlengths 131 26.7k | message stringlengths 7 694 | project stringlengths 5 67 | split stringclasses 1 value | diff_languages stringlengths 2 24 |
|---|---|---|---|---|---|
de2e605c3fe322afb1ce7da2c18b9e7eb1d6bd1d | diff --git a/tests/inputs/class.php b/tests/inputs/class.php
index <HASH>..<HASH> 100644
--- a/tests/inputs/class.php
+++ b/tests/inputs/class.php
@@ -15,6 +15,11 @@ class Hello {
}
private function private_world($name) {
}
+ /**
+ * @access private
+ */
+ public function private_access_world($name) {
+ }
/**
* here is docs for $attr1 attribute
@@ -23,6 +28,10 @@ class Hello {
public $attr2;
protected $attr3;
private $attr4;
+ /**
+ * @access private
+ */
+ private $attr5;
}
?>
diff --git a/tests/inputs/interface.php b/tests/inputs/interface.php
index <HASH>..<HASH> 100644
--- a/tests/inputs/interface.php
+++ b/tests/inputs/interface.php
@@ -9,5 +9,10 @@ interface IHello {
*/
public function doc_world($name);
public function undoc_world($name);
+ /**
+ * @access private
+ */
+ public function private_access_world($name) {
+ }
}
?> | Add testcases for @access private methods | tk0miya_tk.phpautodoc | train | php,php |
c0e5ca70cc055aa6ab71cab1d96771d8c7a163b2 | diff --git a/pkg/health/client/client.go b/pkg/health/client/client.go
index <HASH>..<HASH> 100644
--- a/pkg/health/client/client.go
+++ b/pkg/health/client/client.go
@@ -130,14 +130,11 @@ func formatPathStatus(w io.Writer, name string, cp *models.PathStatus, indent st
fmt.Fprintf(w, "%s%s connectivity to %s:\n", indent, name, cp.IP)
indent = fmt.Sprintf("%s ", indent)
- statuses := map[string]*models.ConnectivityStatus{
- "ICMP": cp.Icmp,
- "HTTP via L3": cp.HTTP,
+ if cp.Icmp != nil {
+ formatConnectivityStatus(w, cp.Icmp, "ICMP", indent)
}
- for name, status := range statuses {
- if status != nil {
- formatConnectivityStatus(w, status, name, indent)
- }
+ if cp.HTTP != nil {
+ formatConnectivityStatus(w, cp.HTTP, "HTTP via L3", indent)
}
} | health: Print ICMP then HTTP results
Format the node connectivity results in this specific order so the
output is easier to read and compare with other runs. | cilium_cilium | train | go |
f322f8643910896d8add42223f50a1305f41bbbd | diff --git a/lib/typhoeus/adapters/faraday.rb b/lib/typhoeus/adapters/faraday.rb
index <HASH>..<HASH> 100644
--- a/lib/typhoeus/adapters/faraday.rb
+++ b/lib/typhoeus/adapters/faraday.rb
@@ -137,8 +137,8 @@ module Faraday # :nodoc:
def configure_timeout(req, env)
env_req = env[:request]
- req.options[:timeout_ms] = (env_req[:timeout] * 1000) if env_req[:timeout]
- req.options[:connecttimeout_ms] = (env_req[:open_timeout] * 1000) if env_req[:open_timeout]
+ req.options[:timeout_ms] = (env_req[:timeout] * 1000).to_i if env_req[:timeout]
+ req.options[:connecttimeout_ms] = (env_req[:open_timeout] * 1000).to_i if env_req[:open_timeout]
end
def configure_socket(req, env) | Faraday adapter can provide sub-second timeouts without warnings | typhoeus_typhoeus | train | rb |
9204a231e78281e1074318a1353bcc9db71fc538 | diff --git a/src/main/java/com/hivemq/spi/metrics/HiveMQMetrics.java b/src/main/java/com/hivemq/spi/metrics/HiveMQMetrics.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/hivemq/spi/metrics/HiveMQMetrics.java
+++ b/src/main/java/com/hivemq/spi/metrics/HiveMQMetrics.java
@@ -388,7 +388,7 @@ public class HiveMQMetrics {
* @since 3.0
*/
public static final HiveMQMetric<Counter> HALF_FULL_QUEUE_COUNT =
- HiveMQMetric.valueOf("com.hivemq.clients.half.full.queue.count", Counter.class);
+ HiveMQMetric.valueOf("com.hivemq.clients.half-full-queue.count", Counter.class);
/**
* represents a {@link Meter},which measures the current rate of dropped PUBLISH messages | renamed half-full message queue counter | hivemq_hivemq-spi | train | java |
d3799d7660c0d0463be5b12eea4963c53c3ff9ce | diff --git a/lib/svtplay_dl/fetcher/rtmp.py b/lib/svtplay_dl/fetcher/rtmp.py
index <HASH>..<HASH> 100644
--- a/lib/svtplay_dl/fetcher/rtmp.py
+++ b/lib/svtplay_dl/fetcher/rtmp.py
@@ -6,7 +6,7 @@ import shlex
from svtplay_dl.log import log
from svtplay_dl.fetcher import VideoRetriever
-from svtplay_dl.utils.output import output
+from svtplay_dl.utils.output import output, formatname
class RTMP(VideoRetriever):
@@ -26,8 +26,8 @@ class RTMP(VideoRetriever):
file_d = output(self.output, self.config, "flv", False)
if file_d is None:
return
- args += ["-o", self.output]
- if self.options.silent:
+ args += ["-o", formatname(self.output, self.config, "flv")]
+ if self.config.get("silent"):
args.append("-q")
if self.kwargs.get("other"):
args += shlex.split(self.kwargs.pop("other")) | rtmp: generate correct filename | spaam_svtplay-dl | train | py |
55d619193ba351d4c1b4c0853ce2956d2f39b220 | diff --git a/lib/passgen.js b/lib/passgen.js
index <HASH>..<HASH> 100644
--- a/lib/passgen.js
+++ b/lib/passgen.js
@@ -3,19 +3,27 @@
* Generate a random token.
*/
+ var crypto = require("crypto");
+
function create(len, alphabet) {
- var result = '';
+ var token = '';
+ // Use default alphabet, if needed.
if (!alphabet) alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
- var alphabetLength = alphabet.length;
+ // Use default token length, if needed.
if ((len === undefined) || isNaN(len)) len = 64;
+
+ // Generate cryptographically strong random bytes, if possible.
+ var randomBytes = len > 0 ? crypto.randomBytes(len) : null;
+
+ // Generate token.
for (var i = 0; i < len; i++) {
- var rnd = Math.floor(Math.random() * alphabetLength);
- result += alphabet[rnd];
+ var rnd = Math.floor(randomBytes[i] * 0.00390625 /* / 256.0 */ * alphabet.length);
+ token += alphabet[rnd];
}
- return result;
+ return token;
}
var passgen = {}; | Changed to cryptographically secure pseudo random number generator algorithm | sasadjolic_passgen | train | js |
737c579090f1ec364c79bcbf310b80e0caa092f2 | diff --git a/arcana/utils/interfaces.py b/arcana/utils/interfaces.py
index <HASH>..<HASH> 100644
--- a/arcana/utils/interfaces.py
+++ b/arcana/utils/interfaces.py
@@ -430,7 +430,7 @@ class CopyToDir(BaseInterface):
shutil.copytree(in_file, out_path)
else:
shutil.copy(in_file, out_path)
- file_names.append(out_path)
+ file_names.append(op.basename(out_path))
outputs['out_dir'] = dirname
outputs['file_names'] = file_names
return outputs | fixed up CopyToDir so that it outputs filenames instead of file paths | MonashBI_arcana | train | py |
9f47673568d5721b30b96d5178054330f650677a | diff --git a/lib/install_template.rb b/lib/install_template.rb
index <HASH>..<HASH> 100644
--- a/lib/install_template.rb
+++ b/lib/install_template.rb
@@ -77,10 +77,10 @@ end
end
end
-# Set up symlinks in bin_dir
+aliased_bin_dir = File.join(lib_dir, "schema-evolution-manager", "bin")
Dir.chdir(bin_dir) do
- Dir.foreach(version_bin_dir).each do |filename|
- path = File.join(version_bin_dir, filename)
+ Dir.foreach(aliased_bin_dir).each do |filename|
+ path = File.join(aliased_bin_dir, filename)
if File.file?(path)
Library.system_or_error("rm -f %s && ln -s %s" % [filename, path])
end | Update symlinks to point to schema-evolution-manager alias instead of specific version | mbryzek_schema-evolution-manager | train | rb |
61ac5f2646c7cb941f4566bbbe9cffda33919249 | diff --git a/lib/ey-deploy/deploy.rb b/lib/ey-deploy/deploy.rb
index <HASH>..<HASH> 100644
--- a/lib/ey-deploy/deploy.rb
+++ b/lib/ey-deploy/deploy.rb
@@ -198,12 +198,12 @@ module EY
"ln -nfs #{c.shared_path}/pids #{release_to_link}/tmp/pids",
"ln -nfs #{c.shared_path}/config/database.yml #{release_to_link}/config/database.yml",
"ln -nfs #{c.shared_path}/config/mongrel_cluster.yml #{release_to_link}/config/mongrel_cluster.yml",
- "chown -R #{c.user}:#{c.group} #{release_to_link}",
- "if [ -f \"#{c.shared_path}/config/newrelic.yml\" ]; then ln -nfs #{c.shared_path}/config/newrelic.yml #{release_to_link}/config/newrelic.yml; fi",
-
].each do |cmd|
run cmd
end
+
+ sudo "chown -R #{c.user}:#{c.group} #{release_to_link}"
+ run "if [ -f \"#{c.shared_path}/config/newrelic.yml\" ]; then ln -nfs #{c.shared_path}/config/newrelic.yml #{release_to_link}/config/newrelic.yml; fi"
end
# task | Make sure "chown deploy" runs as root, not deploy. | engineyard_engineyard-serverside | train | rb |
5349248125fc89fd6c71a610cd547a305ef8c487 | diff --git a/riemann_client/client.py b/riemann_client/client.py
index <HASH>..<HASH> 100644
--- a/riemann_client/client.py
+++ b/riemann_client/client.py
@@ -26,6 +26,7 @@ import time
import riemann_client.riemann_pb2
import riemann_client.transport
+import google.protobuf.descriptor
logger = logging.getLogger(__name__)
@@ -152,7 +153,7 @@ class Client(object):
value = list(value)
elif descriptor.name == 'attributes':
value = dict(((a.key, a.value) for a in value))
- elif isinstance(value, float):
+ elif descriptor.type == google.protobuf.descriptor.FieldDescriptor.TYPE_FLOAT:
value = round(value, 1)
data[descriptor.name] = value | protobuf serializes floats into ints on old python, yay | borntyping_python-riemann-client | train | py |
51d7b35f47a2cb470e82f0e91c4f774919324964 | diff --git a/pyOCD/interface/hidapi_backend.py b/pyOCD/interface/hidapi_backend.py
index <HASH>..<HASH> 100644
--- a/pyOCD/interface/hidapi_backend.py
+++ b/pyOCD/interface/hidapi_backend.py
@@ -107,3 +107,7 @@ class HidApiUSB(Interface):
"""
logging.debug("closing interface")
self.device.close()
+
+ def setPacketCount(self, count):
+ # No interface level restrictions on count
+ self.packet_count = count | Enable multiple packets for HID API backend. | mbedmicro_pyOCD | train | py |
2a4bce145f6fa02ed31aca2fc7743a84306ecfa7 | diff --git a/state/modelconfig.go b/state/modelconfig.go
index <HASH>..<HASH> 100644
--- a/state/modelconfig.go
+++ b/state/modelconfig.go
@@ -354,7 +354,7 @@ func (m *Model) UpdateModelConfig(updateAttrs map[string]interface{}, removeAttr
return errors.Trace(err)
}
for _, attr := range removeAttrs {
- // We we are updating an attribute, that takes
+ // We are updating an attribute, that takes
// precedence over removing.
if _, ok := updateAttrs[attr]; ok {
continue
@@ -404,7 +404,10 @@ func (m *Model) UpdateModelConfig(updateAttrs map[string]interface{}, removeAttr
modelSettings.Update(validAttrs)
_, ops := modelSettings.settingsUpdateOps()
- return modelSettings.write(ops)
+ if len(ops) > 0 {
+ return modelSettings.write(ops)
+ }
+ return nil
}
type modelConfigSourceFunc func() (attrValues, error) | Avoid Running no-op transactions. Check the operations slice length
first. | juju_juju | train | go |
2bf6b1f8fce3266965a1786f99b2da63acc04724 | diff --git a/curdling/util.py b/curdling/util.py
index <HASH>..<HASH> 100644
--- a/curdling/util.py
+++ b/curdling/util.py
@@ -28,6 +28,10 @@ def expand_requirements(file_name):
if not req:
break
+ # No comments about it...
+ if req.startswith('#'):
+ continue
+
found = INCLUDE_PATTERN.findall(req)
if found:
requirements.extend(expand_requirements(found[0])) | Ignoring commented lines when expanding requirements files | clarete_curdling | train | py |
20010836b6638b4956d582013ff0d02ba57ae380 | diff --git a/discovery/src/main/java/io/airlift/discovery/client/ExponentialBackOff.java b/discovery/src/main/java/io/airlift/discovery/client/ExponentialBackOff.java
index <HASH>..<HASH> 100644
--- a/discovery/src/main/java/io/airlift/discovery/client/ExponentialBackOff.java
+++ b/discovery/src/main/java/io/airlift/discovery/client/ExponentialBackOff.java
@@ -37,6 +37,7 @@ class ExponentialBackOff
public synchronized void success()
{
if (!serverUp) {
+ serverUp = true;
log.info(serverUpMessage);
}
currentWaitInMillis = -1;
@@ -45,6 +46,7 @@ class ExponentialBackOff
public synchronized Duration failed(Throwable t)
{
if (serverUp) {
+ serverUp = false;
log.error("%s: %s", serverDownMessage, t.getMessage());
}
log.debug(t, serverDownMessage); | Properly track server state in ExponentialBackOff | airlift_airlift | train | java |
f794f4a21077485dbcbec2e5c71b8ed394fe7261 | diff --git a/core/src/main/java/org/kohsuke/stapler/export/Property.java b/core/src/main/java/org/kohsuke/stapler/export/Property.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/kohsuke/stapler/export/Property.java
+++ b/core/src/main/java/org/kohsuke/stapler/export/Property.java
@@ -258,6 +258,13 @@ public abstract class Property implements Comparable<Property> {
writer.value(value.toString());
return;
}
+
+ if(skipIfFail){
+ writer.startObject();
+ writer.endObject();
+ } else {
+ throw ex;
+ }
}
try {
@@ -267,14 +274,9 @@ public abstract class Property implements Comparable<Property> {
}
- if(model!=null) {
- writer.startObject();
- model.writeNestedObjectTo(value, pruner, writer);
- writer.endObject();
- }else if(skipIfFail){
- writer.startObject();
- writer.endObject();
- }
+ writer.startObject();
+ model.writeNestedObjectTo(value, pruner, writer);
+ writer.endObject();
}
private void writeStartObjectNullType(DataWriter writer) throws IOException { | Throw an exception if it's not one of the special type | stapler_stapler | train | java |
e882d214dd430b051580725948e363a418c7fe90 | diff --git a/lib/db/index.js b/lib/db/index.js
index <HASH>..<HASH> 100644
--- a/lib/db/index.js
+++ b/lib/db/index.js
@@ -169,14 +169,13 @@ class Db extends EventEmitter {
return cb(new Error("Unauthorized"), null);
}
- request.query = await filter.prepare(storeDesc, request.query, user);
- console.debug(`[$db][find] query calculated: ${JSON.stringify(request)}. ${baseDebugMessage}`);
-
let p;
const { dataSource } = storeDesc;
if (dataSource) {
p = configStore.getDataSource(storeDesc, this).find(request);
} else {
+ request.query = await filter.prepare(storeDesc, request.query, user);
+ console.debug(`[$db][find] query calculated: ${JSON.stringify(request)}. ${baseDebugMessage}`);
p = db.find(storeName, request);
}
diff --git a/tests/dbTests.js b/tests/dbTests.js
index <HASH>..<HASH> 100644
--- a/tests/dbTests.js
+++ b/tests/dbTests.js
@@ -266,7 +266,6 @@ describe("$db", function () {
},
orderBy: "login, -testProp",
}, (err, res) => {
- console.info(res);
assert.equal(err, null);
assert.notEqual(res, null);
assert.notEqual(res.items, null); | filters not prepared now for custom data sources | getblank_blank-node-worker | train | js,js |
fd5c3c0743bdd0e3d212a7ef5e85685cf26c8d82 | diff --git a/workshift/utils.py b/workshift/utils.py
index <HASH>..<HASH> 100644
--- a/workshift/utils.py
+++ b/workshift/utils.py
@@ -249,7 +249,7 @@ def past_sign_out(instance, moment=None):
if assigned_time.count() > 0:
assigned_time = assigned_time.latest("entry_time")
- if assigned_time > cutoff_time:
+ if assigned_time > cutoff_time.entry_time:
return False
return moment > cutoff_time | Fixed bug comparing ShiftLogEntry to datetime | knagra_farnsworth | train | py |
3eae91b5e829862c8c4e3d57361229ee6665455f | diff --git a/src/FunctionTemplate.php b/src/FunctionTemplate.php
index <HASH>..<HASH> 100644
--- a/src/FunctionTemplate.php
+++ b/src/FunctionTemplate.php
@@ -118,13 +118,19 @@ namespace V8;
class FunctionTemplate extends Template implements AdjustableExternalMemoryInterface
{
/**
- * @param Isolate $isolate
- * @param callable|null $callback
- * @param int $length
- * @param int $behavior
+ * @param Isolate $isolate
+ * @param callable|null $callback
+ * @param FunctionTemplate|null $receiver Specifies which receiver is valid for a function
+ * @param int $length
+ * @param int $behavior
*/
- public function __construct(Isolate $isolate, callable $callback = null, int $length = 0, int $behavior = ConstructorBehavior::kAllow)
- {
+ public function __construct(
+ Isolate $isolate,
+ callable $callback = null,
+ FunctionTemplate $receiver = null,
+ int $length = 0,
+ int $behavior = ConstructorBehavior::kAllow
+ ) {
parent::__construct($isolate);
} | Add V8\FunctionTemplate signature support in ctor (simplified to $receiver) | phpv8_php-v8-stubs | train | php |
df5200210f2d4f197d4f1f5484a161cbbc09ff98 | diff --git a/lib/fs.js b/lib/fs.js
index <HASH>..<HASH> 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -447,13 +447,20 @@ function watch(path, options, callback) {
function _findUnusedPath(path, files) {
const ext = extname(path);
const base = basename(path, ext);
- const regex = new RegExp(`^${escapeRegExp(base)}-(\\d+)${escapeRegExp(ext)}$`);
+ const regex = new RegExp(`^${escapeRegExp(base)}(?:-(\\d+))?${escapeRegExp(ext)}$`);
+ let num = -1;
- const num = files.reduce((_num, item) => {
- const match = regex.exec(item);
+ for (let i = 0, len = files.length; i < len; i++) {
+ const item = files[i];
+ if (!regex.test(item)) continue;
+
+ const match = item.match(regex);
+ const matchNum = match[1] ? parseInt(match[1], 10) : 0;
- return match != null ? Math.max(parseInt(match[1], 10), _num) : _num;
- }, -1);
+ if (matchNum > num) {
+ num = matchNum;
+ }
+ }
return join(dirname(path), `${base}-${num + 1}${ext}`);
} | Fix the CI failing issue on Hexo (#<I>)
* Revert "Reduce scope such as recursive function"
* Update fs.js
* Update fs.js | hexojs_hexo-fs | train | js |
4732cd6d6411c76be6d35c11b2023ec4083fccb3 | diff --git a/cumulus/storage.py b/cumulus/storage.py
index <HASH>..<HASH> 100644
--- a/cumulus/storage.py
+++ b/cumulus/storage.py
@@ -44,8 +44,10 @@ class CloudFilesStorage(Storage):
self.username = username or settings.CUMULUS_USERNAME
self.api_key = api_key or settings.CUMULUS_API_KEY
self.container_name = container or settings.CUMULUS_CONTAINER
+ self.use_servicenet = getattr(settings, 'CUMULUS_USE_SERVICENET', False)
self.connection_kwargs = connection_kwargs or {}
+
def __getstate__(self):
"""
Return a picklable representation of the storage.
@@ -53,12 +55,14 @@ class CloudFilesStorage(Storage):
return dict(username=self.username,
api_key=self.api_key,
container_name=self.container_name,
+ use_servicenet=self.use_servicenet,
connection_kwargs=self.connection_kwargs)
def _get_connection(self):
if not hasattr(self, '_connection'):
self._connection = cloudfiles.get_connection(self.username,
- self.api_key, **self.connection_kwargs)
+ self.api_key, self.use_servicenet,
+ **self.connection_kwargs)
return self._connection
def _set_connection(self, value): | added CUMULUS_USE_SERVICENET into storage backend | django-cumulus_django-cumulus | train | py |
82c2bedd8accd9665e0fc6928808a0f8a6bbe9e8 | diff --git a/frontend/app/hash/hash.js b/frontend/app/hash/hash.js
index <HASH>..<HASH> 100644
--- a/frontend/app/hash/hash.js
+++ b/frontend/app/hash/hash.js
@@ -117,7 +117,7 @@ fm.app.directive("fmHash", function($rootScope, fmUtils, $q) {
// Check if we have a saved view open
if(!searchHash) {
- let defaultView = (map.client.padData.defaultViewId && map.client.views[map.client.padData.defaultViewId]);
+ let defaultView = (map.client.padData && map.client.padData.defaultViewId && map.client.views[map.client.padData.defaultViewId]);
if(defaultView ? map.isAtView(defaultView) : map.isAtView(null))
ret = "#";
else { | Fix error thrown by last commit when opening map without pad (#<I>) | FacilMap_facilmap2 | train | js |
4fdf06dbda10374986e26eb9533980dbfecfecd6 | diff --git a/libtelemetry/src/main/java/com/mapbox/android/telemetry/AttachmentMetadata.java b/libtelemetry/src/main/java/com/mapbox/android/telemetry/AttachmentMetadata.java
index <HASH>..<HASH> 100644
--- a/libtelemetry/src/main/java/com/mapbox/android/telemetry/AttachmentMetadata.java
+++ b/libtelemetry/src/main/java/com/mapbox/android/telemetry/AttachmentMetadata.java
@@ -1,5 +1,8 @@
package com.mapbox.android.telemetry;
+import androidx.annotation.Keep;
+
+@Keep
public class AttachmentMetadata {
private String name; | [libtelemetry] Add `@Keep` annotation to the AttachmentMetadata
This will prevent Proguard / obfuscation issues with `AttachmentMetadata`
class. | mapbox_mapbox-events-android | train | java |
b42f53ca1fa0af0fd9cc37e2765cd9c47b100065 | diff --git a/activemodel/lib/active_model/state_machine/event.rb b/activemodel/lib/active_model/state_machine/event.rb
index <HASH>..<HASH> 100644
--- a/activemodel/lib/active_model/state_machine/event.rb
+++ b/activemodel/lib/active_model/state_machine/event.rb
@@ -2,15 +2,15 @@ module ActiveModel
module StateMachine
class Event
attr_reader :name, :success
-
+
def initialize(machine, name, options = {}, &block)
@machine, @name, @transitions = machine, name, []
if machine
- machine.klass.send(:define_method, "#{name.to_s}!") do |*args|
+ machine.klass.send(:define_method, "#{name}!") do |*args|
machine.fire_event(name, self, true, *args)
end
- machine.klass.send(:define_method, "#{name.to_s}") do |*args|
+ machine.klass.send(:define_method, name.to_s) do |*args|
machine.fire_event(name, self, false, *args)
end
end | Some performance goodness for AM StateMatchine. | rails_rails | train | rb |
36d38b3184058a526f80d33d1565f5599b8b07e9 | diff --git a/js/ftx.js b/js/ftx.js
index <HASH>..<HASH> 100644
--- a/js/ftx.js
+++ b/js/ftx.js
@@ -176,7 +176,7 @@ module.exports = class ftx extends Exchange {
'askVolume': undefined,
'vwap': undefined,
'open': undefined,
- 'close': undefined,
+ 'close': this.safeFloat (market['info'], 'last'),
'last': this.safeFloat (market['info'], 'last'),
'previousClose': undefined,
'change': this.safeFloat (ticker, 'change'), | ticker last price should also be close price | ccxt_ccxt | train | js |
0897aeb61605709e62f056b2c32253676c98a9ad | diff --git a/src/pyiso/pyiso.py b/src/pyiso/pyiso.py
index <HASH>..<HASH> 100644
--- a/src/pyiso/pyiso.py
+++ b/src/pyiso/pyiso.py
@@ -3942,6 +3942,14 @@ class PyIso(object):
self.isohybrid_mbr = None
def full_path_from_dirrecord(self, dr):
+ '''
+ A method to get the absolute path of a directory record.
+
+ Parameters:
+ dr - The directory record to get the full path for.
+ Returns:
+ A string representing the absolute path to the file on the ISO.
+ '''
if not self.initialized:
raise PyIsoException("This object is not yet initialized; call either open() or new() to create an ISO") | Add in more pydoc documentation. | clalancette_pycdlib | train | py |
89d62425fb5335310b5575d2f4aeaaa35564d5ba | diff --git a/lib/crtomo/binaries.py b/lib/crtomo/binaries.py
index <HASH>..<HASH> 100644
--- a/lib/crtomo/binaries.py
+++ b/lib/crtomo/binaries.py
@@ -48,6 +48,7 @@ binaries = {
'Linux': [
'CRTomo',
'/usr/bin/CRTomo_dev',
+ 'CRTomo_master_{}'.format(platform.node()),
],
'Windows': [
r'C:\crtomo\bin\crtomo.exe',
@@ -58,6 +59,7 @@ binaries = {
'CRMod',
'CRMod_dev',
'/usr/bin/CRMod_dev',
+ 'CRMod_master_{}'.format(platform.node()),
],
'Windows': [
r'C:\crtomo\bin\crmod.exe',
@@ -67,6 +69,7 @@ binaries = {
'Linux': [
'CutMcK',
'/usr/bin/CutMcK_dev',
+ 'CutMcK_master_{}'.format(platform.node()),
],
'Windows': [
r'C:\crtomo\bin\cutmck.exe', | [crtomo.binaries] also look for machine-specific binary names for
CRTomo, CRMod, and CutMcK in the form of CRTomo_master_[platform.node()] | geophysics-ubonn_crtomo_tools | train | py |
d929ca3e08c989063f47fb0e7a0bf4a97210dab8 | diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/HttpFoundation/Cookie.php
+++ b/src/Symfony/Component/HttpFoundation/Cookie.php
@@ -87,7 +87,7 @@ class Cookie
*
* @throws \InvalidArgumentException
*/
- public function __construct(string $name, string $value = null, int|string|\DateTimeInterface $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = 'lax')
+ public function __construct(string $name, string $value = null, int|string|\DateTimeInterface $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = self::SAMESITE_LAX)
{
// from PHP source code
if ($raw && false !== strpbrk($name, self::RESERVED_CHARS_LIST)) { | [HttpFoundation] Improve Cookie constructor to use constant | symfony_symfony | train | php |
bf524fcef30ca11258ef677be869c288fc3c2d7c | diff --git a/pcef/qt/__init__.py b/pcef/qt/__init__.py
index <HASH>..<HASH> 100644
--- a/pcef/qt/__init__.py
+++ b/pcef/qt/__init__.py
@@ -136,7 +136,7 @@ def try_pyqt():
# Fatal error, no qt bindings found
__logger.critical("PySide not found, exiting with return code -1")
print("PyQt4 and PySide not found, exiting with return code -1")
- os.environ.setdefault("QT_API", None)
+ os.environ.setdefault("QT_API", "")
return False
else:
os.environ.setdefault("QT_API", "PyQt") | Fix qt api env var set to None with python <I> (#<I>) | pyQode_pyqode.core | train | py |
7e6dc500b222f86bbe3634c1e9d174b47e2fe94c | diff --git a/mount_images.py b/mount_images.py
index <HASH>..<HASH> 100755
--- a/mount_images.py
+++ b/mount_images.py
@@ -11,8 +11,12 @@ import os
def main():
+ if os.geteuid(): # Not run as root
+ print u'This script needs to be ran as root!'
+ sys.exit(1)
if not sys.argv[1:]:
print u'Usage:\n{0} path_to_encase_image..'.format(sys.argv[0])
+ sys.exit(1)
images = sys.argv[1:]
for num, image in enumerate(images):
if not os.path.exists(image):
@@ -56,7 +60,7 @@ class ImageParser(object):
'''
Mount the image at a remporary path for analysis
'''
- self.basemountpoint = tempfile.mkdtemp(prefix=u'bredolab_')
+ self.basemountpoint = tempfile.mkdtemp(prefix=u'ewf_mounter_')
def _mount_base(paths):
try:
@@ -96,7 +100,7 @@ class ImageParser(object):
try:
d = pytsk3.FS_Info(self.image, offset=p.start * 512)
offset = p.start * 512
- mountpoint = tempfile.mkdtemp(prefix=u'bredolab_' + str(offset)
+ mountpoint = tempfile.mkdtemp(prefix=u'ewf_mounter_' + str(offset)
+ u'_')
#mount -t ext4 -o loop,ro,noexec,noload,offset=241790330880 \ | Add root check and remove all traces of bredolab | ralphje_imagemounter | train | py |
3f7264473d9afc3cb5fdb430c4807e1a0bc71434 | diff --git a/plugin_install.go b/plugin_install.go
index <HASH>..<HASH> 100644
--- a/plugin_install.go
+++ b/plugin_install.go
@@ -45,9 +45,17 @@ func (cli *Client) PluginInstall(ctx context.Context, name string, options types
return pluginPermissionDenied{name}
}
}
+
+ if len(options.Args) > 0 {
+ if err := cli.PluginSet(ctx, name, options.Args); err != nil {
+ return err
+ }
+ }
+
if options.Disabled {
return nil
}
+
return cli.PluginEnable(ctx, name)
} | support settings in docker plugins install | docker_cli | train | go |
1fd10fbb6fcaa4bce7e30a8db286a06fee5a3eaa | diff --git a/pinax/blog/parsers/markdown_parser.py b/pinax/blog/parsers/markdown_parser.py
index <HASH>..<HASH> 100644
--- a/pinax/blog/parsers/markdown_parser.py
+++ b/pinax/blog/parsers/markdown_parser.py
@@ -21,7 +21,7 @@ class ImageLookupImagePattern(ImagePattern):
def parse(text):
- md = Markdown(extensions=["codehilite", "tables", "smarty", "admonition", "toc"])
+ md = Markdown(extensions=["codehilite", "tables", "smarty", "admonition", "toc", "fenced_code"])
md.inlinePatterns["image_link"] = ImageLookupImagePattern(IMAGE_LINK_RE, md)
html = md.convert(text)
return html | add support for fenced_code extension | pinax_pinax-blog | train | py |
5204783a239377fc93139a519bbd5ba5ba2cc17e | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -35,7 +35,7 @@ HeathCheck.prototype.register = function (type, check) {
timeout = setTimeout(function () {
timeout = null
check.cleanFn()
- cb(null, buildResult(null, 'Timed Out'))
+ cb(null, buildResult(new Error('Check Timed Out')))
}, this.options.timeout)
check.fn(function (error, status) {
diff --git a/test/index.test.js b/test/index.test.js
index <HASH>..<HASH> 100644
--- a/test/index.test.js
+++ b/test/index.test.js
@@ -156,9 +156,9 @@ describe('health-check', function () {
healthCheck.run(function (ignoreErr, results) {
assert.deepEqual(results
- , { summary: { critical: { fail: 0, pass: 1, count: 1 }, total: { fail: 0, pass: 1, count: 1 } }
+ , { summary: { critical: { fail: 1, pass: 0, count: 1 }, total: { fail: 1, pass: 0, count: 1 } }
, results:
- { critical: [ { name: 'critical test', description: '', status: 'Timed Out', time: 200 } ]
+ { critical: [ { name: 'critical test', description: '', error: 'Check Timed Out', status: 'Error', time: 200 } ]
}
})
mockdate.reset() | Use errors for timeout rather than status | clocklimited_cf-health-check | train | js,js |
e769da88e6c6e94a397822dd8962cbcb83a402a0 | diff --git a/cmd/dockerd/service_windows.go b/cmd/dockerd/service_windows.go
index <HASH>..<HASH> 100644
--- a/cmd/dockerd/service_windows.go
+++ b/cmd/dockerd/service_windows.go
@@ -397,7 +397,7 @@ func initPanicFile(path string) error {
// it when it panics. Remember the old stderr to restore it before removing
// the panic file.
sh := windows.STD_ERROR_HANDLE
- h, err := windows.GetStdHandle(sh)
+ h, err := windows.GetStdHandle(uint32(sh))
if err != nil {
return err
} | Windows: fix build after re-vendoring golang.org/x/sys
Due to the CL <URL> as type uint<I> in argument to windows.GetStdHandle
Fix it by adding an explicit type conversion when calling
windows.GetStdHandle. | moby_moby | train | go |
605118d3e4357a61f84c84f861f07952c1ad20a0 | diff --git a/tests/BrewTest.php b/tests/BrewTest.php
index <HASH>..<HASH> 100644
--- a/tests/BrewTest.php
+++ b/tests/BrewTest.php
@@ -445,7 +445,7 @@ class BrewTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase
public function test_it_can_get_php_binary_path_from_php_version()
{
- // When brew info has `linked_keg` paramert
+ // When brew info has `linked_keg` paramerter
$brewMock = Mockery::mock(Brew::class, [
$cli = Mockery::mock(CommandLine::class),
$files = Mockery::mock(Filesystem::class) | Update tests/BrewTest.php | laravel_valet | train | php |
93fd21850f591dcb69947aa2671e4e4004b3463f | diff --git a/pypot/dynamixel/io/io.py b/pypot/dynamixel/io/io.py
index <HASH>..<HASH> 100644
--- a/pypot/dynamixel/io/io.py
+++ b/pypot/dynamixel/io/io.py
@@ -21,7 +21,7 @@ class DxlIO(AbstractDxlIO):
""" Gets the mode ('joint' or 'wheel') for the specified motors. """
to_get_ids = [id for id in ids if id not in self._known_mode]
limits = self.get_angle_limit(to_get_ids, convert=False)
- modes = ('wheel' if limit == (0, 0) else 'joint' for limit in limits)
+ modes = ['wheel' if limit == (0, 0) else 'joint' for limit in limits]
self._known_mode.update(zip(to_get_ids, modes)) | Fix a bug on Python <I> where the generator was not propagated into the zip. | poppy-project_pypot | train | py |
ee396e4c87c1be27d82a6fafae43bbd4b53a4b32 | diff --git a/bin/run.js b/bin/run.js
index <HASH>..<HASH> 100755
--- a/bin/run.js
+++ b/bin/run.js
@@ -34,8 +34,8 @@ if(argv.version) {
configPath = path.resolve(argv.config);
run(configPath, {
watch: argv.watch,
- maxRetries: Number.parseInt(argv['max-retries'], 10),
- maxConcurrentWorkers: Number.parseInt(argv['parallel'], 10),
+ maxRetries: parseInt(argv['max-retries'], 10),
+ maxConcurrentWorkers: parseInt(argv['parallel'], 10),
bail: argv.bail,
json: argv.json,
modulesSort: argv['sort-modules-by'],
diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -120,9 +120,9 @@ function run(configPath, options, callback) {
};
}
- var maxRetries = options && Number.parseInt(options.maxRetries, 10) || Infinity,
+ var maxRetries = options && parseInt(options.maxRetries, 10) || Infinity,
maxConcurrentWorkers = options
- && Number.parseInt(options.maxConcurrentWorkers, 10)
+ && parseInt(options.maxConcurrentWorkers, 10)
|| require('os').cpus().length,
workers = workerFarm({
maxRetries: maxRetries, | Use global parseInt instead of Number.parseInt
Number.parseInt does not seem to be available on node <I> | trivago_parallel-webpack | train | js,js |
baaa8a6209122b824dca7d9acdeb50675bb65b12 | diff --git a/test/startservers.py b/test/startservers.py
index <HASH>..<HASH> 100644
--- a/test/startservers.py
+++ b/test/startservers.py
@@ -102,7 +102,8 @@ def start(race_detection):
# If one of the servers has died, quit immediately.
if not check():
return False
- for debug_port in range(8000, 8005):
+ ports = range(8000, 8005) + [4000]
+ for debug_port in ports:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', debug_port))
s.close() | check for wfe port liveness in integration tests
We're getting many more spurious "Can't connect to WFE" errors in
TravisCI. So, we add the WFE's main port to the port liveness check in
amqp-integration-test.py.
Fixes #<I> | letsencrypt_boulder | train | py |
40502ec95773210101cc4e67c118d0d47871db1e | diff --git a/src/Phug/Lexer/Scanner/ControlStatementScanner.php b/src/Phug/Lexer/Scanner/ControlStatementScanner.php
index <HASH>..<HASH> 100644
--- a/src/Phug/Lexer/Scanner/ControlStatementScanner.php
+++ b/src/Phug/Lexer/Scanner/ControlStatementScanner.php
@@ -24,7 +24,8 @@ abstract class ControlStatementScanner implements ScannerInterface
$reader = $state->getReader();
$names = implode('|', $this->names);
- if (!$reader->match("({$names})[ \t\n:]", null, " \t\n:")) {
+ if (!$reader->match("({$names})[ \t\n:]", null, " \t\n:") &&
+ !$reader->match("({$names})(?=\()", null, " \t\n:")) {
return;
} | Allow statements to be immediately followed by parentheses | phug-php_lexer | train | php |
b06a78a29aaa44eeb8f4837a3786ec225dac95c0 | diff --git a/core/src/main/java/org/xillium/core/HttpServiceDispatcher.java b/core/src/main/java/org/xillium/core/HttpServiceDispatcher.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/xillium/core/HttpServiceDispatcher.java
+++ b/core/src/main/java/org/xillium/core/HttpServiceDispatcher.java
@@ -433,11 +433,14 @@ public class HttpServiceDispatcher extends HttpServlet {
plcas.add((PlatformLifeCycleAware)gac.getBean(id));
}
+ // Manageable object registration: objects are registered under "bean-id/context-path"
+
+ String contextPath = getServletContext().getContextPath();
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
for (String id: gac.getBeanNamesForType(Manageable.class)) {
try {
_logger.info("Registering MBean '" + id + "', domain=" + domain);
- ObjectName on = new ObjectName(domain == null ? "org.xillium.core.management" : domain, "type", id);
+ ObjectName on = new ObjectName(domain == null ? "org.xillium.core.management" : domain, "type", id + contextPath);
Manageable manageable = (Manageable)gac.getBean(id);
manageable.assignObjectName(on);
mbs.registerMBean(manageable, on); | Manageable objects now registered under "bean-id/context-path" to avoid conflicts | brianwhu_xillium | train | java |
d0deceb6bc34b901d83d021a5e7809e3ac8c7cab | diff --git a/grab/spider/base.py b/grab/spider/base.py
index <HASH>..<HASH> 100644
--- a/grab/spider/base.py
+++ b/grab/spider/base.py
@@ -724,14 +724,23 @@ class Spider(SpiderPattern, SpiderStat):
if self.transport.ready_for_task():
logger_verbose.debug('Transport has free resources. '\
'Trying to add new task (if exists)')
- task = self.load_new_task()
+
+ # Try five times to get new task and proces task generator
+ # because slave parser could agressively consume
+ # tasks from task queue
+ for x in xrange(5):
+ task = self.load_new_task()
+ if not task:
+ if not self.transport.active_task_number():
+ self.process_task_generator()
+ else:
+ break
if not task:
if not self.transport.active_task_number():
logger_verbose.debug('Network transport has no active tasks')
#self.wating_shutdown_event.set()
- #if self.shutdown_event.is_set():
- if True:
+ if True:#self.shutdown_event.is_set():
#logger_verbose.debug('Got shutdown signal')
self.stop()
#else: | Fix issue in handling task generator under heavy load | lorien_grab | train | py |
046d0d1322d1da20edf6e0e33738332464fd9cf8 | diff --git a/Form/Type/DependentFormsType.php b/Form/Type/DependentFormsType.php
index <HASH>..<HASH> 100644
--- a/Form/Type/DependentFormsType.php
+++ b/Form/Type/DependentFormsType.php
@@ -20,7 +20,7 @@ class DependentFormsType extends AbstractType
private $entityManager;
/**
- * @var ParameterBag
+ * @var ParameterBagInterface
*/
private $parameterBag; | refactoring code, change type hint | anacona16_DependentFormsBundle | train | php |
1e2aedc36674743fa0ae75ace23f0e822c18efea | diff --git a/server.py b/server.py
index <HASH>..<HASH> 100644
--- a/server.py
+++ b/server.py
@@ -36,7 +36,9 @@ quit: quit the console session
def init_server(bot):
server = BotNetServer(('', SERVERPORT), BotNetHandler)
server.bot = bot
- threading.Thread(target=server.serve_forever).start()
+ thread = threading.Thread(target=server.serve_forever)
+ thread.daemon = True
+ thread.start()
class BotNetServer(socketserver.ThreadingMixIn, socketserver.TCPServer): | work w/ old python | tjcsl_cslbot | train | py |
a5365b901279830a1fb59f34a05bca071dcf2c3a | diff --git a/gossip/comm/comm_impl.go b/gossip/comm/comm_impl.go
index <HASH>..<HASH> 100644
--- a/gossip/comm/comm_impl.go
+++ b/gossip/comm/comm_impl.go
@@ -212,7 +212,7 @@ func (c *commImpl) createConnection(endpoint string, expectedPKIID common.PKIidT
}
func (c *commImpl) Send(msg *proto.GossipMessage, peers ...*RemotePeer) {
- if c.isStopping() {
+ if c.isStopping() || len(peers) == 0 {
return
} | Gossip- Don't log sending to empty slice of peers
The code that uses the gossip comm layer's Send() method
computes dynamically a set of peers to send a message to,
usually out of a batch of all kinds of messages.
As a result, the peer set passed to the send method is sometimes empty.
This makes the gossip comm layer log something like "sending Msg M to 0 peers".
I added a check that makes the Send() function skip sending if the peer slice
passed is empty. | hyperledger_fabric | train | go |
be87d48aa91e87893bd6f5fe2a3ee1f1da1f4492 | diff --git a/src/test/java/com/datasift/client/mock/TestPylonApiWithMocks.java b/src/test/java/com/datasift/client/mock/TestPylonApiWithMocks.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/datasift/client/mock/TestPylonApiWithMocks.java
+++ b/src/test/java/com/datasift/client/mock/TestPylonApiWithMocks.java
@@ -59,8 +59,8 @@ public class TestPylonApiWithMocks extends IntegrationTestBase {
private String sampleMediaType = "post";
private String sampleContent = "I love data!";
private String sampleLanguage = "en";
- private List<Integer> sampleTopicIDs = new ArrayList<Integer>() { {
- add(565634324);
+ private List<Long> sampleTopicIDs = new ArrayList<Long>() { {
+ add(565634324L);
} };
@Before | issue-<I> fix test for topicids | datasift_datasift-java | train | java |
e1d192c12ee788b440f1f1945707d0f07e1682bf | diff --git a/lib/thinking_sphinx/active_record/base.rb b/lib/thinking_sphinx/active_record/base.rb
index <HASH>..<HASH> 100644
--- a/lib/thinking_sphinx/active_record/base.rb
+++ b/lib/thinking_sphinx/active_record/base.rb
@@ -17,8 +17,9 @@ module ThinkingSphinx::ActiveRecord::Base
reflection_class.include DefaultReflectionAssociations
end
else
- ::ActiveRecord::Associations::CollectionProxy.send :include,
+ ::ActiveRecord::Associations::CollectionProxy.include(
ThinkingSphinx::ActiveRecord::AssociationProxy
+ )
end
end
diff --git a/lib/thinking_sphinx/railtie.rb b/lib/thinking_sphinx/railtie.rb
index <HASH>..<HASH> 100644
--- a/lib/thinking_sphinx/railtie.rb
+++ b/lib/thinking_sphinx/railtie.rb
@@ -7,7 +7,7 @@ class ThinkingSphinx::Railtie < Rails::Railtie
initializer 'thinking_sphinx.initialisation' do
ActiveSupport.on_load(:active_record) do
- ActiveRecord::Base.send :include, ThinkingSphinx::ActiveRecord::Base
+ ActiveRecord::Base.include ThinkingSphinx::ActiveRecord::Base
end
if ActiveSupport::VERSION::MAJOR > 5 | Update include usage to avoid send calls.
Ruby <I> onwards (and perhaps earlier as well) have include as a public method, so this is no longer necessary. | pat_thinking-sphinx | train | rb,rb |
e9be38990f92505811466377798baf3db02f2268 | diff --git a/forms_builder/forms/models.py b/forms_builder/forms/models.py
index <HASH>..<HASH> 100644
--- a/forms_builder/forms/models.py
+++ b/forms_builder/forms/models.py
@@ -21,7 +21,12 @@ STATUS_CHOICES = (
sites_field = None
if USE_SITES:
- sites_field = models.ManyToManyField("sites.Site")
+ from django.contrib.sites.models import Site
+ sites = Site.objects.all()
+ args = {}
+ if len(sites) == 1:
+ args["default"] = (sites[0].id,)
+ sites_field = models.ManyToManyField(Site, **args)
FIELD_CHOICES = (
("CharField", _("Single line text")), | Add default value for sites field when only one site exists. | stephenmcd_django-forms-builder | train | py |
ade77c8b38cc81331a4630708e7556e5b89c56d1 | diff --git a/src/test/java/com/box/sdk/MetadataTemplateTest.java b/src/test/java/com/box/sdk/MetadataTemplateTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/box/sdk/MetadataTemplateTest.java
+++ b/src/test/java/com/box/sdk/MetadataTemplateTest.java
@@ -84,7 +84,13 @@ public class MetadataTemplateTest {
int errorResponseStatusCode = 404;
BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken());
- MetadataTemplate.createMetadataTemplate(api, scope, template, displayName, templateIsHidden, null);
+
+ try {
+ MetadataTemplate.createMetadataTemplate(api, scope, template, displayName, templateIsHidden, null);
+ } catch (BoxAPIException e) {
+ System.out.print("Error while making callout to createMetdataTemplate(): " + e);
+ }
+
MetadataTemplate.deleteMetadataTemplate(api, scope, template);
try { | Metadata template delete patch (#<I>)
enclosed metadata template delete test in a try catch for create to deal with possibility that a metadata template already exists | box_box-java-sdk | train | java |
a8e9843bc472c620a778f96c8dd92358c426d014 | diff --git a/interp/interp_test.go b/interp/interp_test.go
index <HASH>..<HASH> 100644
--- a/interp/interp_test.go
+++ b/interp/interp_test.go
@@ -112,9 +112,9 @@ var fileCases = []struct {
{"unset INTERP_GLOBAL; echo $INTERP_GLOBAL", "\n"},
{"foo=bar; foo=x true; echo $foo", "bar\n"},
{"foo=bar; foo=x true; echo $foo", "bar\n"},
- {"foo=bar; env | grep foo", "exit status 1"},
- {"foo=bar env | grep foo", "foo=bar\n"},
- {"foo=a foo=b env | grep foo", "foo=b\n"},
+ {"foo=bar; env | grep '^foo='", "exit status 1"},
+ {"foo=bar env | grep '^foo='", "foo=bar\n"},
+ {"foo=a foo=b env | grep '^foo='", "foo=b\n"},
{"env | grep INTERP_GLOBAL", "INTERP_GLOBAL=value\n"},
// special vars | interp: make env test more robust
Don't just grep for "foo", as that can easily break if the environment
has any var with "foo" in its value.
This happened to break Travis because the previous commit message
contains "foo" and Travis seems to keep commit messages in an env
variable. | mvdan_sh | train | go |
8380f57bf0dd6fdcd28e8f8bc62b950ee9cec535 | diff --git a/app/controllers/stripe_saas/subscriptions_controller.rb b/app/controllers/stripe_saas/subscriptions_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/stripe_saas/subscriptions_controller.rb
+++ b/app/controllers/stripe_saas/subscriptions_controller.rb
@@ -81,7 +81,7 @@ module StripeSaas
begin
plan = ::Plan.find(params[:plan])
rescue ActiveRecord::RecordNotFound
- plan = ::Plan.by_stripe_id(params[:plan])
+ plan = ::Plan.by_stripe_id(params[:plan]).try(:first)
end
if plan
@@ -132,7 +132,7 @@ module StripeSaas
else
@subscription = ::Subscription.new
- @subscription.plan = ::Plan.find_by_stripe_id(params[:plan])
+ @subscription.plan = ::Plan.find_by_stripe_id(params[:plan]).try(:first)
end
end
diff --git a/lib/stripe_saas/version.rb b/lib/stripe_saas/version.rb
index <HASH>..<HASH> 100644
--- a/lib/stripe_saas/version.rb
+++ b/lib/stripe_saas/version.rb
@@ -1,3 +1,3 @@
module StripeSaas
- VERSION = "0.0.6"
+ VERSION = "0.0.7"
end | Correct usage of scope find_by_stripe_id (it's a relation dummy) | integrallis_stripe_saas | train | rb,rb |
8a38a24b9fc2401b5d3f1783e69af793f2082ced | diff --git a/src/hdnode.js b/src/hdnode.js
index <HASH>..<HASH> 100644
--- a/src/hdnode.js
+++ b/src/hdnode.js
@@ -43,6 +43,8 @@ function HDNode(K, chainCode, network) {
if (K instanceof BigInteger) {
this.privKey = new ECKey(K, true)
this.pubKey = this.privKey.pub
+ } else if (K instanceof ECPubKey) {
+ this.pubKey = K
} else {
this.pubKey = new ECPubKey(K, true)
} | Allow constructing HDNode from an ECPubKey. | BitGo_bitgo-utxo-lib | train | js |
64cf3ff4713863c0bf856c848b7268f9255261df | diff --git a/lib/em-systemcommand/version.rb b/lib/em-systemcommand/version.rb
index <HASH>..<HASH> 100644
--- a/lib/em-systemcommand/version.rb
+++ b/lib/em-systemcommand/version.rb
@@ -1,5 +1,5 @@
module Em
module Systemcommand
- VERSION = "2.0.5"
+ VERSION = "2.0.6"
end
end | bumped version number to <I> | leoc_em-systemcommand | train | rb |
8ab351a5b546a128e5b49d9bc5509c74e72acce4 | diff --git a/lib/jsduck/guides.rb b/lib/jsduck/guides.rb
index <HASH>..<HASH> 100644
--- a/lib/jsduck/guides.rb
+++ b/lib/jsduck/guides.rb
@@ -111,8 +111,9 @@ module JsDuck
html.each_line do |line|
if line =~ /^<h2>(.*)<\/h2>$/
i += 1
- toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{$1}</a></li>\n"
- new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{$1}</h2>\n"
+ text = strip_tags($1)
+ toc << "<li><a href='#!/guide/#{guide['name']}-section-#{i}'>#{text}</a></li>\n"
+ new_html << "<h2 id='#{guide['name']}-section-#{i}'>#{text}</h2>\n"
else
new_html << line
end
@@ -151,6 +152,9 @@ module JsDuck
"guides/" + guide["name"] + "/icon.png"
end
+ def strip_tags(str)
+ str.gsub(/<.*?>/, "")
+ end
end
end | Strip extra HTML from guides TOC.
Some titles contain links, resulting in links-inside-links which is of
no good. | senchalabs_jsduck | train | rb |
72ad8330ebbe38efdf8ff414002de5717e56a933 | diff --git a/lib/uspec/version.rb b/lib/uspec/version.rb
index <HASH>..<HASH> 100644
--- a/lib/uspec/version.rb
+++ b/lib/uspec/version.rb
@@ -1,3 +1,3 @@
module Uspec
- VERSION = '0.1.0'
+ VERSION = '0.1.1'
end | Version bump to <I>. | acook_uspec | train | rb |
e27eccf138ef238d0559e6ae26f53fc64febc5fc | diff --git a/watermarker/templatetags/watermark.py b/watermarker/templatetags/watermark.py
index <HASH>..<HASH> 100644
--- a/watermarker/templatetags/watermark.py
+++ b/watermarker/templatetags/watermark.py
@@ -5,7 +5,10 @@ import errno
import logging
import os
import traceback
-from urllib import unquote
+try:
+ from urllib.parse import unquote
+except: ImportError
+ from urllib import unquote
from django.conf import settings
from django import template | Python 3 reorganization of the standard library. | bashu_django-watermark | train | py |
207104278672deedb859d10da4570e3a57058dac | diff --git a/lib/fewer/engines/abstract.rb b/lib/fewer/engines/abstract.rb
index <HASH>..<HASH> 100644
--- a/lib/fewer/engines/abstract.rb
+++ b/lib/fewer/engines/abstract.rb
@@ -1,3 +1,5 @@
+require 'digest/md5'
+
module Fewer
module Engines
class Abstract
@@ -31,8 +33,8 @@ module Fewer
end
def etag
- # Sum of file modification times
- paths.map { |path| File.mtime(path).to_i }.inject(:+).to_s
+ # MD5 for concatenation of all files
+ Digest::MD5.hexdigest(paths.map { |path| File.read(path) }.join)
end
def read | Switched eTag generation to more dependable MD5
* File timestamps can be unreliable across multiple servers | benpickles_fewer | train | rb |
19da73e609125d7f7dd2d594a77c58b67155eea0 | diff --git a/code/plugins/system/koowa.php b/code/plugins/system/koowa.php
index <HASH>..<HASH> 100644
--- a/code/plugins/system/koowa.php
+++ b/code/plugins/system/koowa.php
@@ -34,6 +34,10 @@ class plgSystemKoowa extends JPlugin
$db =& JFactory::getDBO();
$db = new KDatabase($db);
+ //ACL uses the unwrapped DBO
+ $acl = JFactory::getACL();
+ $acl->_db = $db->getObject(); // getObject returns the unwrapped DBO
+
//Load the koowa plugins
JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
} | Fixed #<I> Bug: Adding users corrupts db when koowa is active | joomlatools_joomlatools-framework | train | php |
782bf8eabaa1ac98e43927bcc07e5a3b3f91bcb6 | diff --git a/pymc/distributions.py b/pymc/distributions.py
index <HASH>..<HASH> 100755
--- a/pymc/distributions.py
+++ b/pymc/distributions.py
@@ -59,7 +59,8 @@ sc_continuous_distributions = ['bernoulli', 'beta', 'cauchy', 'chi2',
'degenerate', 'exponential', 'exponweib',
'gamma', 'half_normal', 'hypergeometric',
'inverse_gamma', 'laplace', 'logistic',
- 'lognormal', 'normal', 't', 'uniform',
+ 'lognormal', 'normal', 'pareto', 't',
+ 'truncated_pareto', 'uniform',
'weibull', 'skew_normal', 'truncated_normal',
'von_mises'] | Added Pareto and truncated Pareto to distributions list, so that Stochastics can be generated. | pymc-devs_pymc | train | py |
edfed6566f3eebd3f10179092270d22cc4a40b48 | diff --git a/tests/PHPUnit/Fixture.php b/tests/PHPUnit/Fixture.php
index <HASH>..<HASH> 100644
--- a/tests/PHPUnit/Fixture.php
+++ b/tests/PHPUnit/Fixture.php
@@ -804,6 +804,7 @@ class Fixture extends PHPUnit_Framework_Assert
public static function updateDatabase($force = false)
{
Cache::deleteTrackerCache();
+ Option::clearCache();
if ($force) {
// remove version options to force update | Fixing tests (clear Option cache when invoking updater from fixture). | matomo-org_matomo | train | php |
44f9ce0bda2d54893fc5882a8d0577f83d415618 | diff --git a/model/LTIDeliveryTool.php b/model/LTIDeliveryTool.php
index <HASH>..<HASH> 100755
--- a/model/LTIDeliveryTool.php
+++ b/model/LTIDeliveryTool.php
@@ -82,10 +82,10 @@ class LTIDeliveryTool extends ConfigurableService
}
/**
- * @param DeliveryExecution|null $deliveryExecution
+ * @param DeliveryExecution $deliveryExecution
* @return mixed
*/
- public function getFinishUrl(DeliveryExecution $deliveryExecution = null)
+ public function getFinishUrl(DeliveryExecution $deliveryExecution)
{
/** @var LtiNavigationService $ltiNavigationService */
$ltiNavigationService = $this->getServiceLocator()->get(LtiNavigationService::SERVICE_ID); | Make delievry execution parameeter mandatory | oat-sa_extension-tao-ltideliveryprovider | train | php |
a35c606c5f125959ecc53e5cbe1ce29e3723e11b | diff --git a/spring/src/test/java/org/hobsoft/symmetry/spring/it/SpringTest.java b/spring/src/test/java/org/hobsoft/symmetry/spring/it/SpringTest.java
index <HASH>..<HASH> 100644
--- a/spring/src/test/java/org/hobsoft/symmetry/spring/it/SpringTest.java
+++ b/spring/src/test/java/org/hobsoft/symmetry/spring/it/SpringTest.java
@@ -65,6 +65,7 @@ public class SpringTest
{
mvc.perform(get("/window"))
.andExpect(status().isOk())
+ .andExpect(content().contentType("text/html"))
.andExpect(content().string("<html><body></body></html>"));
}
@@ -73,6 +74,7 @@ public class SpringTest
{
mvc.perform(get("/windowWithText"))
.andExpect(status().isOk())
+ .andExpect(content().contentType("text/html"))
.andExpect(content().string("<html><body>x</body></html>"));
}
} | Assert content type in Spring ITs | markhobson_symmetry | train | java |
5a93dd14385f817288413a4bec8c51763873ce4c | diff --git a/lib/cskit/lesson/section.rb b/lib/cskit/lesson/section.rb
index <HASH>..<HASH> 100644
--- a/lib/cskit/lesson/section.rb
+++ b/lib/cskit/lesson/section.rb
@@ -15,7 +15,7 @@ module CSKit
volume_name = volume_name.to_sym
volume = CSKit.get_volume(volume_name)
- citation_texts[volume_name].each do |citation_text|
+ (citation_texts[volume_name] || []).each do |citation_text|
citation = volume.parse_citation(citation_text)
yield volume.readings_for(citation), citation
end | Fixing small bug in section retrieval | CSOBerkeley_cskit-rb | train | rb |
69c928650aecc7cf26d35f7462eefff8251da169 | diff --git a/code/extensions/CommentsExtension.php b/code/extensions/CommentsExtension.php
index <HASH>..<HASH> 100644
--- a/code/extensions/CommentsExtension.php
+++ b/code/extensions/CommentsExtension.php
@@ -230,6 +230,9 @@ class CommentsExtension extends DataExtension {
* @return boolean
*/
public function getCommentsEnabled() {
+ // Don't display comments form for pseudo-pages (such as the login form)
+ if(!$this->owner->exists()) return false;
+
// Determine which flag should be used to determine if this is enabled
if($this->owner->getCommentsOption('enabled_cms')) {
return $this->owner->ProvideComments; | BUG Fix comments form appearing on login page | silverstripe_silverstripe-comments | train | php |
56b44d0c8cd05797da8a1fcac41af79b69d37f18 | diff --git a/server/server.go b/server/server.go
index <HASH>..<HASH> 100644
--- a/server/server.go
+++ b/server/server.go
@@ -100,7 +100,10 @@ func (o *OvsdbServer) Close() {
o.readyMutex.Lock()
o.ready = false
o.readyMutex.Unlock()
- o.listener.Close()
+ // Only close the listener if Serve() has been called
+ if o.listener != nil {
+ o.listener.Close()
+ }
close(o.done)
} | server: allow calling Close() without Serve()
Useful for CI tests in other projects where a BeforeEach()
might create the server for multiple tests, but one or more
tests doesn't actually use it and thus doesn't call Serve(). | socketplane_libovsdb | train | go |
7b2ee0df3145879f2fe1a3930f3ef26b3e39ddfe | diff --git a/dockermap/map/runner/base.py b/dockermap/map/runner/base.py
index <HASH>..<HASH> 100644
--- a/dockermap/map/runner/base.py
+++ b/dockermap/map/runner/base.py
@@ -115,7 +115,7 @@ class DockerConfigMixin(object):
ports=[resolve_value(port_binding.exposed_port)
for port_binding in container_config.exposes if port_binding.exposed_port],
hostname=policy.get_hostname(container_name, config.client_name) if container_map.set_hostname else None,
- domainname=resolve_value(client_config.get('domainname', container_map.default_domain)),
+ domainname=resolve_value(client_config.get('domainname', container_map.default_domain)) or None,
)
if container_config.network == 'disabled':
c_kwargs['network_disabled'] = True | Use None for domainname if nothing is set. | merll_docker-map | train | py |
39c094315186474bd4d71c840b08811a4dbc86d9 | diff --git a/src/com/opera/core/systems/scope/internal/OperaFlags.java b/src/com/opera/core/systems/scope/internal/OperaFlags.java
index <HASH>..<HASH> 100644
--- a/src/com/opera/core/systems/scope/internal/OperaFlags.java
+++ b/src/com/opera/core/systems/scope/internal/OperaFlags.java
@@ -28,6 +28,6 @@ public class OperaFlags {
* Whether or not to append to log file instead of overwriting contents. If true the driver will
* append, otherwise it will overwrite. By default it overwrites the file.
*/
- public static final boolean APPEND_TO_LOGFILE = false;
+ public static final boolean APPEND_TO_LOGFILE = true;
}
\ No newline at end of file | By default, we'll append to log file instead | operasoftware_operaprestodriver | train | java |
3acc14a72c84aaf4fed5bc47de6d2ee9a5ce2d6d | diff --git a/controller/schema.go b/controller/schema.go
index <HASH>..<HASH> 100644
--- a/controller/schema.go
+++ b/controller/schema.go
@@ -23,7 +23,7 @@ func migrateDB(db *sql.DB) error {
`CREATE TABLE releases (
release_id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
artifact_id uuid REFERENCES artifacts (artifact_id),
- data text NOT NULL,
+ data jsonb NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
deleted_at timestamptz
)`,
@@ -50,7 +50,7 @@ func migrateDB(db *sql.DB) error {
object_type event_type NOT NULL,
object_id text NOT NULL,
unique_id text,
- data text,
+ data jsonb,
created_at timestamptz NOT NULL DEFAULT now()
)`, | controller: Use JSONB for release and deployment data | flynn_flynn | train | go |
9b2b74e80596ab7b2f5d5b53d604a3f2d1ef795e | diff --git a/src/Form/Type/ComparisonType.php b/src/Form/Type/ComparisonType.php
index <HASH>..<HASH> 100644
--- a/src/Form/Type/ComparisonType.php
+++ b/src/Form/Type/ComparisonType.php
@@ -87,7 +87,7 @@ class ComparisonType extends AbstractType
$resolver->setAllowedValues('type', ['array', 'datetime', 'choice', 'entity', 'numeric', 'text']);
}
- public function getParent()
+ public function getParent(): ?string
{
return ChoiceType::class;
} | Fix deprecation in form type | EasyCorp_EasyAdminBundle | train | php |
a9b3b73ed8c80c7e9afda5e945adfa4f93aa162b | diff --git a/examples/simple/webpack.config.js b/examples/simple/webpack.config.js
index <HASH>..<HASH> 100644
--- a/examples/simple/webpack.config.js
+++ b/examples/simple/webpack.config.js
@@ -32,8 +32,9 @@ module.exports = {
'RedirectionSideEffect',
'RefreshSideEffect',
]),
- new BundleAnalyzerPlugin(),
- ],
+ ].concat(
+ process.env.NODE_ENV === 'development' ? [new BundleAnalyzerPlugin()] : [],
+ ),
resolve: {
extensions: ['.ts', '.js', '.tsx', '.json'],
alias: { | Only use BundleAnalyzerPlugin in development | marmelab_react-admin | train | js |
9240817a2de99f4835d65fbca9cc1cc002b260a8 | diff --git a/lib/asyncblock.js b/lib/asyncblock.js
index <HASH>..<HASH> 100644
--- a/lib/asyncblock.js
+++ b/lib/asyncblock.js
@@ -158,5 +158,20 @@ module.exports.getCurrentFlow = function(){
}
};
+//Creates a callback handler which only calls its callback in the case of an error
+//This is just some sugar provided for a case like this:
+//app.get('/handler', function(req, res, next) {
+// asyncblock(function(){
+// //do stuff here
+// }, asyncblock.ifError(next)); //Only calls next if an error is thrown / returned
+//});
+module.exports.ifError = function(callback){
+ return function(err){
+ if(err != null){
+ callback.apply(this, arguments);
+ }
+ };
+};
+
//Allow other modules to determine whether asyncblock has been loaded. Placing on the process object to avoid a "global" variable.
process.__asyncblock_included__ = module.exports;
\ No newline at end of file | Adding "ifError" to wrap callbacks that should only be called in the case of an error | scriby_asyncblock-generators | train | js |
6ca1d6cc3c2e45dc7cc93ab314632882eafa61f5 | diff --git a/aws/resource_aws_lambda_permission.go b/aws/resource_aws_lambda_permission.go
index <HASH>..<HASH> 100644
--- a/aws/resource_aws_lambda_permission.go
+++ b/aws/resource_aws_lambda_permission.go
@@ -301,6 +301,13 @@ func resourceAwsLambdaPermissionDelete(d *schema.ResourceData, meta interface{})
log.Printf("[DEBUG] Removing Lambda permission: %s", input)
_, err := conn.RemovePermission(&input)
if err != nil {
+ // Missing whole policy or Lambda function (API error)
+ if awsErr, ok := err.(awserr.Error); ok {
+ if awsErr.Code() == "ResourceNotFoundException" {
+ log.Printf("[WARN] No Lambda Permission Policy found: %v", input)
+ return nil
+ }
+ }
return err
} | Do not throw error when lambda permission is deleted after deleting lambda function | terraform-providers_terraform-provider-aws | train | go |
d575ac12fd74ae42994542814c5eaa96d74fd395 | diff --git a/plugins/Goals/Visualizations/Goals.php b/plugins/Goals/Visualizations/Goals.php
index <HASH>..<HASH> 100644
--- a/plugins/Goals/Visualizations/Goals.php
+++ b/plugins/Goals/Visualizations/Goals.php
@@ -33,7 +33,7 @@ class Goals extends HtmlTable
{
parent::beforeLoadDataTable();
- if (!$this->config->disable_subtable_when_show_goals) {
+ if($this->config->disable_subtable_when_show_goals) {
$this->config->subtable_controller_action = null;
} | Refs #<I> Allow to get custom variable values by name, in the Goals/Ecommerce reports. | matomo-org_matomo | train | php |
b6d24f4fa0e36ecb30620566aad5f4a85fe5ea05 | diff --git a/app/Site.php b/app/Site.php
index <HASH>..<HASH> 100644
--- a/app/Site.php
+++ b/app/Site.php
@@ -68,7 +68,7 @@ class Site {
} else {
Database::prepare(
"REPLACE INTO `##site_setting` (setting_name, setting_value)" .
- " VALUES (:setting_name, LEFT(:setting_value, 65535))"
+ " VALUES (:setting_name, LEFT(:setting_value, 2000))"
)->execute(array(
'setting_name' => $setting_name,
'setting_value' => $setting_value, | limit to <I> chars while saving | fisharebest_webtrees | train | php |
58279994cd42959dcdad5f632c6008d3e9bf2b9e | diff --git a/ips_vagrant/models/sites.py b/ips_vagrant/models/sites.py
index <HASH>..<HASH> 100644
--- a/ips_vagrant/models/sites.py
+++ b/ips_vagrant/models/sites.py
@@ -74,7 +74,8 @@ class Domain(Base):
"""
Domain = cls
dname = dname.hostname if hasattr(dname, 'hostname') else dname
- extras = 'www.{dn}'.format(dn=dname)
+ extras = 'www.{dn}'.format(dn=dname) if dname not in ('localhost', ) and not \
+ re.match('^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$', dname) else None
# Fetch the domain entry if it already exists
logging.getLogger('ipsv.sites.domain').debug('Checking if the domain %s has already been registered', dname)
domain = Session.query(Domain).filter(Domain.name == dname).first()
@@ -163,7 +164,7 @@ class Site(Base):
self.disable()
Session.delete(self)
- if drop_database:
+ if drop_database and self.db_name:
mysql = create_engine('mysql://root:secret@localhost')
mysql.execute('DROP DATABASE IF EXISTS `{db}`'.format(db=self.db_name))
try: | Don't create www versions of IP address and localhost domains, don't try and drop undefined databases | FujiMakoto_IPS-Vagrant | train | py |
ad9a0fe936560135ad8dac0db262f01775f3afaf | diff --git a/cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java b/cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java
index <HASH>..<HASH> 100644
--- a/cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java
+++ b/cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java
@@ -683,6 +683,25 @@ class Nidsheader{
bos.position(bos.position() + len);
}
break;
+ case 0x0802:
+ log.warn("Encountered unhandled packet code 0x0802 (contour color) -- reading past.");
+ Divlen_divider = bos.getShort(); // Color marker
+ if (Divlen_divider != 0x0002) {
+ log.warn("Missing color marker!");
+ }
+ plen = 2;
+ break;
+ case 0x0E03:
+ log.warn("Encountered unhandled packet code 0x0E03 (linked contours) -- reading past.");
+ Divlen_divider = bos.getShort(); // Start marker
+ if (Divlen_divider != 0x8000) {
+ log.warn("Missing start marker!");
+ }
+ // Read past start x, y for now
+ bos.getShort();
+ bos.getShort();
+ plen = 6 + bos.getShort();
+ break;
default:
if ( pkcode == 0xAF1F || pkcode == 16) { /* radial image */ | Add stubs for handling NIDS contour packets.
This allows us to serve up the NIDS melting layer products without
throwing <I> errors. Actual implementation to add netcdf variables, etc.
remains to be done.
(cherry picked from commit ca1b<I>c<I>f<I>c2f<I>f<I>cdde9a8a6f<I>) | Unidata_thredds | train | java |
4743aa744ee0c3dae07665f393667c84fc2aaf18 | diff --git a/dynaphopy/__init__.py b/dynaphopy/__init__.py
index <HASH>..<HASH> 100644
--- a/dynaphopy/__init__.py
+++ b/dynaphopy/__init__.py
@@ -812,7 +812,7 @@ class Quasiparticle:
print('\nThermal properties per unit cell ({0:.2f} K) [From phonopy (Reference)]\n'
'----------------------------------------------').format(temperature)
- print(' Harmonic Renormalized\n')
+ print(' Harmonic Quasiparticle\n')
print('Free energy (not corrected): {0:.4f} {3:.4f} KJ/mol\n'
'Entropy: {1:.4f} {4:.4f} J/K/mol\n' | small modifications in some labels and texts (no API changes) | abelcarreras_DynaPhoPy | train | py |
9f154fd4540966a9291a5ff621e8b7f1963ba712 | diff --git a/src/Router.php b/src/Router.php
index <HASH>..<HASH> 100644
--- a/src/Router.php
+++ b/src/Router.php
@@ -554,7 +554,9 @@ class Router
}
}
}
- $response->headers['Link'] = $this->headerLink($routes);
+ if (!empty($routes)) {
+ $response->headers['Link'] = $this->headerLink($routes);
+ }
} else {
$body = $model->toArray();
} | Fix empty Link in resources without foreigns | aryelgois_medools-router | train | php |
64386a6cbba3f775021f39c0e65485cf0a1f0182 | diff --git a/src/pymlab/sensors/lightning.py b/src/pymlab/sensors/lightning.py
index <HASH>..<HASH> 100644
--- a/src/pymlab/sensors/lightning.py
+++ b/src/pymlab/sensors/lightning.py
@@ -25,16 +25,18 @@ class AS3935(Device):
def reset(self):
self.soft_reset()
+ self.setTUN_CAP(self._TUN_CAP)
def calib_rco(self):
- byte = self.bus.read_byte_data(self.address, 0x08) # TODO tunning
+ """calibrate RCO"""
+ byte = self.bus.read_byte_data(self.address, 0x08)
self.bus.write_byte_data(self.address, 0x3d, 0x96);
print bin(self.bus.read_byte_data(self.address, 0x3A))
print bin(self.bus.read_byte_data(self.address, 0x3B))
return
- def antennatune_on(self, FDIV = 0,TUN_CAP=0): #todo antenna tunnig
-
+ def antennatune_on(self, FDIV = 0,TUN_CAP=0):
+ """Display antenna resonance at IRQ pin"""
# set frequency division
data = self.bus.read_byte_data(self.address, 0x03)
data = (data & (~(3<<6))) | (FDIV<<6) | The tunning capacity is configured again after sensor reset. | MLAB-project_pymlab | train | py |
711217ab2f2552b133c02f4bfb726ebe671dc061 | diff --git a/lib/eparoption.py b/lib/eparoption.py
index <HASH>..<HASH> 100644
--- a/lib/eparoption.py
+++ b/lib/eparoption.py
@@ -44,7 +44,7 @@ MAXLIST = 15
MAXLINES = 100
XSHIFT = 110
-class EparOption:
+class EparOption(object):
"""EparOption base class | for pyraf ticket #<I>; EparOption is a (now old) new-style class
git-svn-id: <URL> | spacetelescope_stsci.tools | train | py |
2b9c6b8609aecfec5d56b768583056e2afa76459 | diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php
index <HASH>..<HASH> 100644
--- a/cake/libs/model/datasources/dbo/dbo_sqlite.php
+++ b/cake/libs/model/datasources/dbo/dbo_sqlite.php
@@ -284,7 +284,7 @@ class DboSqlite extends DboSource {
// so try to figure it out based on the querystring
$querystring = $results->queryString;
if (stripos($querystring, 'SELECT') === 0) {
- $last = stripos($querystring, 'FROM');
+ $last = strripos($querystring, 'FROM');
if ($last !== false) {
$selectpart = substr($querystring, 7, $last - 8);
$selects = explode(',', $selectpart); | optimizing sqlite driver to look for the "From" keyword in reverse order on the sql string | cakephp_cakephp | train | php |
c7a9cff07968ba5ad39721dd378563dc10eed06d | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ setup(
name='gffutils',
cmdclass={'build_ext': build_ext},
install_requires=['cython'],
- ext_modules=[Extension('gfffeature', sources=['gffutils/gfffeature.pyx'])],
+ ext_modules=[Extension('gffutils.gfffeature', sources=['gffutils/gfffeature.pyx'])],
packages=['gffutils'],
author='Ryan Dale',
package_dir={'gffutils': 'gffutils'}, | put gfffeature.so in the right place | daler_gffutils | train | py |
dbedca4e5fe81ba68969835399c3d0866a260fa3 | diff --git a/main.go b/main.go
index <HASH>..<HASH> 100644
--- a/main.go
+++ b/main.go
@@ -473,14 +473,17 @@ func (s *DB) Get(name string) (value interface{}, ok bool) {
}
func (s *DB) SetJoinTableHandler(source interface{}, column string, handler JoinTableHandlerInterface) {
- for _, field := range s.NewScope(source).GetModelStruct().StructFields {
+ scope := s.NewScope(source)
+ for _, field := range scope.GetModelStruct().StructFields {
if field.Name == column || field.DBName == column {
if many2many := parseTagSetting(field.Tag.Get("gorm"))["MANY2MANY"]; many2many != "" {
source := (&Scope{Value: source}).GetModelStruct().ModelType
destination := (&Scope{Value: reflect.New(field.Struct.Type).Interface()}).GetModelStruct().ModelType
handler.Setup(field.Relationship, many2many, source, destination)
field.Relationship.JoinTableHandler = handler
- s.Table(handler.Table(s)).AutoMigrate(handler)
+ if table := handler.Table(s); scope.Dialect().HasTable(scope, table) {
+ s.Table(table).AutoMigrate(handler)
+ }
}
}
} | Don't run auto migrate if join table doesn't exist | jinzhu_gorm | train | go |
4ce64dacd313b99fcd55ac653ccbebd601cb44ba | diff --git a/Configuration/Configurator.php b/Configuration/Configurator.php
index <HASH>..<HASH> 100644
--- a/Configuration/Configurator.php
+++ b/Configuration/Configurator.php
@@ -149,9 +149,6 @@ class Configurator
// introspect regular entity fields
foreach ($entityMetadata->fieldMappings as $fieldName => $fieldMetadata) {
- // field names are tweaked this way to simplify Twig templates and extensions
- $fieldName = str_replace('_', '', $fieldName);
-
$entityPropertiesMetadata[$fieldName] = $fieldMetadata;
} | Fixed a bug with properties that include underscores in their names | EasyCorp_EasyAdminBundle | train | php |
ab90b48967a087e97f297ab2b079d2c3b3ddf653 | diff --git a/src/java/voldemort/server/scheduler/SlopPusherJob.java b/src/java/voldemort/server/scheduler/SlopPusherJob.java
index <HASH>..<HASH> 100644
--- a/src/java/voldemort/server/scheduler/SlopPusherJob.java
+++ b/src/java/voldemort/server/scheduler/SlopPusherJob.java
@@ -122,10 +122,14 @@ public class SlopPusherJob implements Runnable {
+ ((VectorClock) versioned.getVersion()).sizeInBytes()
+ 1;
- } else if(slop.getOperation() == Operation.DELETE)
+ } else if(slop.getOperation() == Operation.DELETE) {
+ nBytes += ((VectorClock) versioned.getVersion()).sizeInBytes() + 1;
store.delete(slop.getKey(), versioned.getVersion());
- else
+ }
+ else {
logger.error("Unknown slop operation: " + slop.getOperation());
+ continue;
+ }
failureDetector.recordSuccess(node, deltaMs(startNs));
slopStore.delete(slop.makeKey(), versioned.getVersion());
slopsPushed++; | Throttle on vector clock size in delete operations | voldemort_voldemort | train | java |
6876f08f9550d6479a7697ad87b1ac650e6ab371 | diff --git a/lib/bridges/file_column/lib/as_file_column_bridge.rb b/lib/bridges/file_column/lib/as_file_column_bridge.rb
index <HASH>..<HASH> 100644
--- a/lib/bridges/file_column/lib/as_file_column_bridge.rb
+++ b/lib/bridges/file_column/lib/as_file_column_bridge.rb
@@ -1,4 +1,4 @@
-class ActiveScaffold::DataStructures::Column.class_eval do
+ActiveScaffold::DataStructures::Column.class_eval do
attr_accessor :file_column_display
end | Fix file_column bridge to work with validation_reflection bridge in all ruby versions | activescaffold_active_scaffold | train | rb |
b34dde70027100d9e2d2a3b37efa05e3531f4bb4 | diff --git a/code/libraries/koowa/components/com_koowa/translator/catalogue/abstract.php b/code/libraries/koowa/components/com_koowa/translator/catalogue/abstract.php
index <HASH>..<HASH> 100644
--- a/code/libraries/koowa/components/com_koowa/translator/catalogue/abstract.php
+++ b/code/libraries/koowa/components/com_koowa/translator/catalogue/abstract.php
@@ -165,9 +165,12 @@ abstract class ComKoowaTranslatorCatalogueAbstract extends KTranslatorCatalogueA
{
$lowercase = strtolower($string);
- if (!parent::has($lowercase) && !JFactory::getLanguage()->hasKey($string) && !isset($this->_aliases[$lowercase]))
+ if (!parent::has($lowercase) && !JFactory::getLanguage()->hasKey($string))
{
- if (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
+ if (isset($this->_aliases[$lowercase])) {
+ $key = $this->_aliases[$lowercase];
+ }
+ elseif (substr($string, 0, strlen($this->getPrefix())) === $this->getPrefix()) {
$key = $string;
} else {
//Gets a key from the catalogue and prefixes it | re #<I>: Run the alias through hasKey to make sure it exists | joomlatools_joomlatools-framework | train | php |
7ff8164d966199321e38e417e0ce46ab71769853 | diff --git a/src/diamond/handler/graphite.py b/src/diamond/handler/graphite.py
index <HASH>..<HASH> 100644
--- a/src/diamond/handler/graphite.py
+++ b/src/diamond/handler/graphite.py
@@ -41,6 +41,8 @@ class GraphiteHandler(Handler):
self.port = int(self.config.get('port', 2003))
self.timeout = int(self.config.get('timeout', 15))
self.batch_size = int(self.config.get('batch', 1))
+ self.max_backlog_multiplier = int(self.config.get('max_backlog_multiplier', 5))
+ self.trim_backlog_multiplier = int(self.config.get('trim_backlog_multiplier', 4))
self.metrics = []
# Connect
@@ -81,13 +83,15 @@ class GraphiteHandler(Handler):
else:
# Send data to socket
self.socket.sendall("\n".join(self.metrics))
+ self.metrics = []
except Exception:
self._close()
self.log.error("GraphiteHandler: Error sending metrics.")
raise
finally:
- # Clear metrics no matter what the result
- self.metrics = []
+ if len(self.metrics) >= self.batch_size * self.max_backlog_multiplier:
+ trim_offset = self.batch_size * self.trim_backlog_multiplier * -1
+ self.metrics = self.metrics[trim_offset:]
def _connect(self):
""" | Fix #<I>, this setup options to control the max backlog and how far to trim the list once we match. We store the last set of metrics when trimming. | python-diamond_Diamond | train | py |
d412e0e3bd55372a4c6bc9215fd0160f84a57be8 | diff --git a/src/Joseki/Migration/DefaultMigration.php b/src/Joseki/Migration/DefaultMigration.php
index <HASH>..<HASH> 100644
--- a/src/Joseki/Migration/DefaultMigration.php
+++ b/src/Joseki/Migration/DefaultMigration.php
@@ -25,10 +25,11 @@ class DefaultMigration extends AbstractMigration
$this->dibiConnection->begin();
try {
parent::run();
- $this->dibiConnection->commit();
} catch (\Exception $e) {
$this->dibiConnection->rollback();
+ throw $e;
}
+ $this->dibiConnection->commit();
} | DefaultMigration: fixed exception delegating | Joseki_Migration | train | php |
3e54858fe68384b10b0ccbf2dc5b3f65f35027a4 | diff --git a/lib/plugins/aws/package/compile/events/cognitoUserPool/index.js b/lib/plugins/aws/package/compile/events/cognitoUserPool/index.js
index <HASH>..<HASH> 100644
--- a/lib/plugins/aws/package/compile/events/cognitoUserPool/index.js
+++ b/lib/plugins/aws/package/compile/events/cognitoUserPool/index.js
@@ -350,7 +350,7 @@ class AwsCompileCognitoUserPoolEvents {
const userPoolLogicalId = this.provider.naming.getCognitoUserPoolLogicalId(poolName);
// If overrides exist in `Resources`, merge them in
- if (this.serverless.service.resources[userPoolLogicalId]) {
+ if (_.get(this.serverless.service.resources, 'userPoolLogicalId')) {
const customUserPool = this.serverless.service.resources[userPoolLogicalId];
const generatedUserPool = this.generateTemplateForPool(
poolName, | fix(AWS Cognito): Fix low level refactor regression
Regression introduced with #<I> | serverless_serverless | train | js |
61476a2dbae05edb7ad4b508a2109504996f8a69 | diff --git a/javamelody-core/src/main/java/net/bull/javamelody/TomcatInformations.java b/javamelody-core/src/main/java/net/bull/javamelody/TomcatInformations.java
index <HASH>..<HASH> 100644
--- a/javamelody-core/src/main/java/net/bull/javamelody/TomcatInformations.java
+++ b/javamelody-core/src/main/java/net/bull/javamelody/TomcatInformations.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
@@ -115,6 +116,10 @@ final class TomcatInformations implements Serializable {
// nécessaire pour JBoss 6.0 quand appelé depuis MonitoringFilter.destroy via
// writeHtmlToLastShutdownFile
return Collections.emptyList();
+ } catch (final AttributeNotFoundException e) {
+ // issue 220 and end of issue 133:
+ // AttributeNotFoundException: No attribute called maxThreads (in some JBossAS or JBossWeb)
+ return Collections.emptyList();
} catch (final JMException e) {
// n'est pas censé arriver
throw new IllegalStateException(e); | fix for issue <I>: AttributeNotFoundException: No attribute called maxThreads (in some JBossAS or JBossWeb) | javamelody_javamelody | train | java |
1eeebe18e32e5759eb34cbe139d5c8eb42a1bb68 | diff --git a/testing/test_mean_functions.py b/testing/test_mean_functions.py
index <HASH>..<HASH> 100644
--- a/testing/test_mean_functions.py
+++ b/testing/test_mean_functions.py
@@ -54,10 +54,6 @@ class TestModelsWithMeanFuncs(unittest.TestCase):
GPflow.vgp.VGP(X, Y, mean_function=mf, kern=k(), likelihood=GPflow.likelihoods.Gaussian()),
GPflow.gpmc.GPMC(X, Y, mean_function=mf, kern=k(), likelihood=GPflow.likelihoods.Gaussian()),
GPflow.sgpmc.SGPMC(X, Y, mean_function=mf, kern=k(), likelihood=GPflow.likelihoods.Gaussian(), Z=Z)] for mf in (const, zero)]
-
-
- for m in self.models_with + self.models_without:
- m._compile()
def test_mean_function(self):
for m_with, m_without in zip(self.models_with, self.models_without): | Removing extraneous compile. | GPflow_GPflow | train | py |
83218b31685ca990df356762a424f15cfb268ecb | diff --git a/packages/material-ui/src/Badge/Badge.test.js b/packages/material-ui/src/Badge/Badge.test.js
index <HASH>..<HASH> 100644
--- a/packages/material-ui/src/Badge/Badge.test.js
+++ b/packages/material-ui/src/Badge/Badge.test.js
@@ -29,6 +29,7 @@ describe('<Badge />', () => {
inheritComponent: BadgeUnstyled,
mount,
refInstanceof: window.HTMLSpanElement,
+ muiName: 'MuiBadge',
testVariantProps: { color: 'secondary', variant: 'dot' },
}),
); | [core] Fix failing CI on HEAD (#<I>) | mui-org_material-ui | train | js |
35226f2784b13920ac2ea991c2c120904639e3ee | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -40,7 +40,7 @@ if __name__ == '__main__':
platforms=['Any'],
install_requires=[
'requests',
- 'beautifulsoup',
+ 'beautifulsoup4',
'mf2py',
'html5lib',
'lxml', | fix package name for beautifulsoup4 | bear_ronkyuu | train | py |
e94c6c8c7da83cccc900ecf101a6ae452d76ce5d | diff --git a/lib/constants.js b/lib/constants.js
index <HASH>..<HASH> 100644
--- a/lib/constants.js
+++ b/lib/constants.js
@@ -25,7 +25,7 @@ var defaultSettings = {
return cliColor.green(statusLabel);
}
- if (state === states.done) {
+ if (state === states.fail) {
return cliColor.red(statusLabel);
} | fix fail state to show red. fixes #4 | dylang_observatory | train | js |
29f3195db96f90b25bf323668a9b63932ce116b9 | diff --git a/cogen/core/schedulers.py b/cogen/core/schedulers.py
index <HASH>..<HASH> 100644
--- a/cogen/core/schedulers.py
+++ b/cogen/core/schedulers.py
@@ -7,6 +7,7 @@ import datetime
import heapq
import weakref
import sys
+import errno
from cogen.core.reactors import DefaultReactor
from cogen.core import events
@@ -184,7 +185,11 @@ class Scheduler(object):
break
if self.poll:
- urgent = self.poll.run(timeout = self.next_timer_delta())
+ try:
+ urgent = self.poll.run(timeout = self.next_timer_delta())
+ except OSError, exc:
+ if exc[0] != errno.EINTR:
+ raise
#~ if urgent:print '>urgent:', urgent
if self.timewait:
self.run_timer() | catch reactor's EINTR and ignore it | ionelmc_python-cogen | train | py |
99d29b862e156120313f38be0470496aef101b38 | diff --git a/spec/controllers/xml_controller_spec.rb b/spec/controllers/xml_controller_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/controllers/xml_controller_spec.rb
+++ b/spec/controllers/xml_controller_spec.rb
@@ -2,7 +2,6 @@ require 'rails_helper'
describe XmlController, type: :controller do
before do
- Blog.where(base_url: 'http://myblog.net').each(&:destroy)
create(:blog, base_url: 'http://myblog.net')
allow(Trigger).to receive(:fire) {}
end
@@ -170,7 +169,9 @@ describe XmlController, type: :controller do
describe '#feed with googlesitemap format' do
render_views
before do
- FactoryGirl.create(:tag)
+ tag = create(:tag)
+ article = create :article
+ article.tags = [tag]
get :feed, format: 'googlesitemap', type: 'sitemap'
end | Improve googlesitemap feed spec to bring out error | publify_publify | train | rb |
dc0c0a2f6832b38cfabdc0cfcd378d3ac48a3455 | diff --git a/buildpackrunner/zip_buildpack.go b/buildpackrunner/zip_buildpack.go
index <HASH>..<HASH> 100644
--- a/buildpackrunner/zip_buildpack.go
+++ b/buildpackrunner/zip_buildpack.go
@@ -39,6 +39,7 @@ func (z *ZipDownloader) DownloadAndExtract(u *url.URL, destination string) (uint
return os.OpenFile(zipFile.Name(), os.O_WRONLY, 0666)
},
cacheddownloader.CachingInfoType{},
+ cacheddownloader.ChecksumInfoType{},
make(chan struct{}),
)
if err != nil { | Checksum support for buildpackrunner
[#<I>] | cloudfoundry_buildpackapplifecycle | train | go |
99d3439bd5267d14f8b284b80fdc47fe76be5166 | diff --git a/src/org/opencms/ade/configuration/CmsConfigurationReader.java b/src/org/opencms/ade/configuration/CmsConfigurationReader.java
index <HASH>..<HASH> 100644
--- a/src/org/opencms/ade/configuration/CmsConfigurationReader.java
+++ b/src/org/opencms/ade/configuration/CmsConfigurationReader.java
@@ -615,7 +615,7 @@ public class CmsConfigurationReader {
fileName = fileName.substring(0, fileName.length() - ".properties".length());
}
String localeSuffix = CmsStringUtil.getLocaleSuffixForName(fileName);
- if (fileName.endsWith(localeSuffix)) {
+ if ((localeSuffix != null) && fileName.endsWith(localeSuffix)) {
fileName = fileName.substring(0, fileName.length() - localeSuffix.length() - 1);
}
localization = fileName; | Fixed NPE when configuring a localization bundle without a locale
extension in a module config file. | alkacon_opencms-core | train | java |
fabc5478970e2ade62e078b429d79a93a4cef3ce | diff --git a/spec/addressable/uri_spec.rb b/spec/addressable/uri_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/addressable/uri_spec.rb
+++ b/spec/addressable/uri_spec.rb
@@ -173,6 +173,28 @@ describe Addressable::URI, "when created with an invalid host" do
end
end
+describe Addressable::URI, "when created with a host consisting of " +
+ "sub-delims characters" do
+ it "should not raise an error" do
+ expect(lambda do
+ Addressable::URI.new(
+ :host => Addressable::URI::CharacterClasses::SUB_DELIMS.gsub(/\\/, '')
+ )
+ end).not_to raise_error
+ end
+end
+
+describe Addressable::URI, "when created with a host consisting of " +
+ "unreserved characters" do
+ it "should not raise an error" do
+ expect(lambda do
+ Addressable::URI.new(
+ :host => Addressable::URI::CharacterClasses::UNRESERVED.gsub(/\\/, '')
+ )
+ end).not_to raise_error
+ end
+end
+
describe Addressable::URI, "when created from nil components" do
before do
@uri = Addressable::URI.new | Explicitly test that unreserved and sub-delims are allowed in a host. | sporkmonger_addressable | train | rb |
495714912c5de6028859b6d98e4d2d8db852932f | diff --git a/demo_app/app.py b/demo_app/app.py
index <HASH>..<HASH> 100644
--- a/demo_app/app.py
+++ b/demo_app/app.py
@@ -4,7 +4,10 @@ from collections import OrderedDict
from flask import Flask, render_template
from werkzeug.serving import run_simple
-from werkzeug.middleware.dispatcher import DispatcherMiddleware
+try:
+ from werkzeug.middleware.dispatcher import DispatcherMiddleware
+except ImportError:
+ from werkzeug.wsgi import DispatcherMiddleware
from flasgger import __version__
from flasgger.utils import get_examples | Ensure downward compatability
Switching to old import workflow on werkzeug when new workflow fails. | rochacbruno_flasgger | train | py |
76b2ebc92ba9f64292d7460d01b929c4deeca58c | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -47,7 +47,11 @@ export const formatErrorGenerator = (formatErrorOptions) => {
}
if (err === undefined || !err.isBoom) {
- logger.log('Transform error to boom error');
+ if (logger.info) {
+ logger.info('Transform error to boom error');
+ } else {
+ logger.log('Transform error to boom error');
+ }
err = SevenBoom.wrap(err, 500);
} | Fallback to info if missing log
Certain logger like Bunyan doesn't implement .log
So fallback to info which is same as log | GiladShoham_graphql-apollo-errors | train | js |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.