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 |
|---|---|---|---|---|---|
700cb01c8361e235afdf5f54a7eabdc64752c532 | diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index <HASH>..<HASH> 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -397,11 +397,7 @@ func (d *disk) postStart() error {
// Update applies configuration changes to a started device.
func (d *disk) Update(oldDevices deviceConfig.Devices, isRunning bool) error {
- if d.inst.Type() == instancetype.VM {
- if shared.IsRootDiskDevice(d.config) {
- return nil
- }
-
+ if d.inst.Type() == instancetype.VM && !shared.IsRootDiskDevice(d.config) {
return fmt.Errorf("Non-root disks not supported for VMs")
} | lxd/device/disk: Allow VM disks to be updated | lxc_lxd | train | go |
18f8b1750f74feb24b011dc340df8081615e8660 | diff --git a/spyderlib/widgets/editor.py b/spyderlib/widgets/editor.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/editor.py
+++ b/spyderlib/widgets/editor.py
@@ -39,8 +39,8 @@ from spyderlib.widgets.tabs import BaseTabs
from spyderlib.widgets.findreplace import FindReplace
from spyderlib.widgets.editortools import OutlineExplorerWidget
from spyderlib.widgets.sourcecode import syntaxhighlighters, codeeditor
-from spyderlib.widgets.sourcecode.base import TextEditBaseWidget #@UnusedImport
-from spyderlib.widgets.sourcecode.codeeditor import Printer #@UnusedImport
+from spyderlib.widgets.sourcecode.base import TextEditBaseWidget #analysis:ignore
+from spyderlib.widgets.sourcecode.codeeditor import Printer #analysis:ignore
from spyderlib.widgets.sourcecode.codeeditor import get_file_language
@@ -532,6 +532,8 @@ class EditorStack(QWidget):
self.calltips_enabled = True
self.go_to_definition_enabled = True
self.close_parentheses_enabled = True
+ self.close_quotes_enabled = True
+ self.add_colons_enabled = True
self.auto_unindent_enabled = True
self.indent_chars = " "*4
self.tab_stop_width = 40 | widget/editor.py test was broken: added missing attribute definitions | spyder-ide_spyder | train | py |
2a9f208c471c4fd3b12be2550f256d52ec957060 | diff --git a/extended-cpts.php b/extended-cpts.php
index <HASH>..<HASH> 100644
--- a/extended-cpts.php
+++ b/extended-cpts.php
@@ -1503,7 +1503,7 @@ class Extended_CPT_Admin {
global $post;
- $terms = wp_get_object_terms( get_the_ID(), $taxonomy );
+ $terms = get_the_terms( $post, $taxonomy );
$tax = get_taxonomy( $taxonomy );
if ( is_wp_error( $terms ) ) { | Switch to `get_terms()` in the taxonomy admin columns to save some queries. | johnbillion_extended-cpts | train | php |
b78ed20eae44ad29a344d454f1fe164fc7e94001 | diff --git a/neo.py b/neo.py
index <HASH>..<HASH> 100755
--- a/neo.py
+++ b/neo.py
@@ -195,6 +195,9 @@ def scm(name):
return cls
return scm
+# pylint: disable=no-self-argument
+# pylint: disable=no-method-argument
+# pylint: disable=no-member
@scm('hg')
@staticclass
class Hg(object):
@@ -376,6 +379,9 @@ class Hg(object):
except IOError:
error("Unable to write ignore file in \"%s\"" % exclude)
+# pylint: disable=no-self-argument
+# pylint: disable=no-method-argument
+# pylint: disable=no-member
@scm('git')
@staticclass
class Git(object): | Add pylint override for static-classes
The staticclass decorator confuses pylint, causing a large number of
of false-positives. (#<I>) | ARMmbed_mbed-cli | train | py |
023a3da1bf84f90b30660ab19ecee78f6f71979e | diff --git a/segno/writers.py b/segno/writers.py
index <HASH>..<HASH> 100644
--- a/segno/writers.py
+++ b/segno/writers.py
@@ -558,7 +558,7 @@ def write_png(matrix, version, out, scale=1, border=None, color='#000',
res += scanline(chain(vertical_border, row, vertical_border))
res += same_as_above # This is b'' if no scaling factor was provided
res += horizontal_border
- if _PY2:
+ if _PY2: # pragma: no cover
res = bytes(res)
write(chunk(b'IDAT', zlib.compress(res, compresslevel)))
if addad: | Ignore Py2 specific code in coverage report | heuer_segno | train | py |
01d2acbf9197be3f35673d9e3f95d78d0e5c4ad6 | diff --git a/tests/tests.py b/tests/tests.py
index <HASH>..<HASH> 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -308,7 +308,7 @@ class LocationTemplateFilterTest(TestCase):
@skipUnless(geoip, geoip_msg)
def test_locations(self):
- self.assertEqual(location('8.8.8.8'), 'United States')
+ self.assertEqual(location('8.8.8.8'), 'Mountain View, United States')
self.assertEqual(location('44.55.66.77'), 'San Diego, United States') | Fix failing geoip test, with July <I> GeoLite database | Bouke_django-user-sessions | train | py |
abdd56d3b58807421986e9b8fc04b16218507cfe | diff --git a/cypress/integration/example_spec.js b/cypress/integration/example_spec.js
index <HASH>..<HASH> 100644
--- a/cypress/integration/example_spec.js
+++ b/cypress/integration/example_spec.js
@@ -1274,7 +1274,8 @@ describe('Kitchen Sink', function(){
// http://on.cypress.io/api/cypress-blob
// get the dataUrl string for the javascript-logo
- return Cypress.Blob.imgSrcToDataURL('/assets/img/javascript-logo.png').then(function(dataUrl){
+ return Cypress.Blob.imgSrcToDataURL('/assets/img/javascript-logo.png', undefined, {crossOrigin: 'Anonymous'})
+ .then(function(dataUrl){
// create an <img> element and set its src to the dataUrl
var img = Cypress.$('<img />', {src: dataUrl}) | use crossOrigin anonymous for fetching image | cypress-io_cypress-example-kitchensink | train | js |
e04fc6815468ad204521d5b2d3b8e29f6b6c1e60 | diff --git a/Slim/CallableResolver.php b/Slim/CallableResolver.php
index <HASH>..<HASH> 100644
--- a/Slim/CallableResolver.php
+++ b/Slim/CallableResolver.php
@@ -14,7 +14,7 @@ final class CallableResolver implements CallableResolverInterface
protected $resolved;
- public function __construct(Container $container, $toResolve = null)
+ public function __construct(ContainerInterface $container, $toResolve = null)
{
$this->toResolve = $toResolve;
$this->container = $container; | Depend on the ContainerInterface, not the concrete Container | slimphp_Slim | train | php |
7347f6a9fb90cc4ee8e7766de0b413a19d6ace62 | diff --git a/lib/enju_leaf/openurl.rb b/lib/enju_leaf/openurl.rb
index <HASH>..<HASH> 100755
--- a/lib/enju_leaf/openurl.rb
+++ b/lib/enju_leaf/openurl.rb
@@ -122,7 +122,7 @@ class Openurl
if [:issn, :isbn].include?(key.to_sym)
val.gsub!('-', '')
end
- raise OpenurlQuerySyntaxError unless /\A\d{1,#{NUM_CHECK[key]}}\Z/ =~ val
+ raise OpenurlQuerySyntaxError unless /\A\d{1,#{NUM_CHECK[key]}}X?\Z/i =~ val
end
"%s:%s*" % [field, val]
end | fix a error when issn/isbn contains "X" character. | next-l_enju_leaf | train | rb |
194f575903b46509ff4968ea771ba611d323ad12 | diff --git a/axiom/plugins/mantissacmd.py b/axiom/plugins/mantissacmd.py
index <HASH>..<HASH> 100644
--- a/axiom/plugins/mantissacmd.py
+++ b/axiom/plugins/mantissacmd.py
@@ -18,7 +18,7 @@ from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa
-from cryptography.x509.oid import NameOID
+from cryptography.x509.oid import NameOID, ExtendedKeyUsageOID
from xmantissa.ixmantissa import IOfferingTechnician
from xmantissa import webadmin, publicweb, stats
@@ -146,6 +146,20 @@ class Mantissa(axiomatic.AxiomaticCommand):
.add_extension(
x509.BasicConstraints(ca=False, path_length=None),
critical=True)
+ .add_extension(
+ x509.KeyUsage(
+ digital_signature=True,
+ content_commitment=False,
+ key_encipherment=True,
+ data_encipherment=False,
+ key_agreement=False,
+ key_cert_sign=False,
+ crl_sign=False,
+ encipher_only=False,
+ decipher_only=False))
+ .add_extension(
+ x509.ExtendedKeyUsage([
+ ExtendedKeyUsageOID.SERVER_AUTH]))
.sign(
private_key=privateKey,
algorithm=hashes.SHA256(), | Add KU and EKU extensions. | twisted_mantissa | train | py |
ae1cd085160bc7839dfd3f7a8a0bd41fc7b9eda0 | diff --git a/lib/test.js b/lib/test.js
index <HASH>..<HASH> 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -894,6 +894,14 @@ function cleanYamlObj(object, isRoot, seen) {
if (isRoot && (k === 'todo' || k === 'skip'))
return set
+ // Don't dump massive EventEmitter and Domain
+ // objects onto the output, that's never friendly.
+ if (object &&
+ typeof object === 'object' &&
+ object instanceof Error &&
+ /^domain/.test(k))
+ return set
+
if (isRoot && k === 'at' && !object[k])
return set | Don't dump massive domain objects into yaml | tapjs_node-tap | train | js |
0ca693c713f51fbe8e9104f7ebe53022e611b5af | diff --git a/lib/namespace.rb b/lib/namespace.rb
index <HASH>..<HASH> 100644
--- a/lib/namespace.rb
+++ b/lib/namespace.rb
@@ -2,10 +2,13 @@ module Atomy
NAMESPACES = {}
NAMESPACE_DELIM = "_ns_"
- def self.namespaced(ns, name)
- return name.to_s if !ns or ns == "_"
+ def self.namespaced(*names)
+ names.collect!(&:to_s)
+ name = names.pop
+ ns = names.join(NAMESPACE_DELIM)
+ return name if ns.empty? or ns == "_"
raise "empty name" unless name && !name.empty?
- ns.to_s + NAMESPACE_DELIM + name.to_s
+ ns + NAMESPACE_DELIM + name
end
def self.from_namespaced(resolved) | refactor Atomy.namespaced to take a splat arg | vito_atomy | train | rb |
62465a79ab97cccbf84229b71d382c74a315fb35 | diff --git a/paid_witnessing.js b/paid_witnessing.js
index <HASH>..<HASH> 100644
--- a/paid_witnessing.js
+++ b/paid_witnessing.js
@@ -192,7 +192,7 @@ function buildPaidWitnesses(conn, objUnitProps, arrWitnesses, onDone){
graph.readDescendantUnitsByAuthorsBeforeMcIndex(conn, objUnitProps, arrWitnesses, to_main_chain_index, function(arrUnits){
rt+=Date.now()-t;
t=Date.now();
- var strUnitsList = (arrUnits.length === 0) ? 'NULL' : arrUnits.map(conn.escape).join(', ');
+ var strUnitsList = (arrUnits.length === 0) ? 'NULL' : arrUnits.map(function(unit){ return conn.escape(unit); }).join(', ');
//throw "no witnesses before mc "+to_main_chain_index+" for unit "+objUnitProps.unit;
profiler.start();
conn.query( // we don't care if the unit is majority witnessed by the unit-designated witnesses | try to workaround 'this' <URL> | byteball_ocore | train | js |
caddc94abd127da867b7e36bc695ed09766f3ccc | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -5,11 +5,7 @@ if (typeof asap === "undefined") {
var asap = require("../asap");
var expect = require("expect.js");
var mocha = require("mocha");
-
- var domain;
- try {
- domain = require("domain");
- } catch (e) {}
+ var domain = require("domain");
} | `require("domain")` is safe. | kriskowal_asap | train | js |
6825ebbbd083f8bb8e8bb7c087bd87a87b05f413 | diff --git a/fetch-filecache.js b/fetch-filecache.js
index <HASH>..<HASH> 100644
--- a/fetch-filecache.js
+++ b/fetch-filecache.js
@@ -68,6 +68,19 @@ function filenamify(url) {
/**
+ * Sleep during the provided number of ms
+ *
+ * @function
+ * @param {Number} ms Number of milliseconds to sleep
+ * @return {Promise} promise to sleep during the provided number of ms
+ */
+async function sleep(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+
+
+/**
* Wrapper around the baseFetch function that returns the response from the
* local cache if one is found.
*
@@ -248,18 +261,13 @@ async function fetch(url, options) {
// a few seconds elapse between attempts
async function fetchWithRetry(url, options, remainingAttempts) {
try {
- return baseFetch(url, options);
+ return await baseFetch(url, options);
}
catch (err) {
if (remainingAttempts <= 0) throw err;
- log('fetch attempt failed');
- return new Promise((resolve, reject) => {
- setTimeout(function () {
- fetchWithRetry(url, options, remainingAttempts - 1)
- .then(resolve)
- .catch(reject);
- }, 2000 + Math.floor(Math.random() * 8000));
- });
+ log('fetch attempt failed, sleep and try again');
+ await sleep(2000 + Math.floor(Math.random() * 8000));
+ return fetchWithRetry(url, options, remainingAttempts - 1);
}
} | Fix automatic retry feature
The code was supposed to sleep a bit and retry a couple of times a URL that
cannot be fetched directly. The auto-retry code was not being run because of
a missing `await`. | tidoust_fetch-filecache-for-crawling | train | js |
7b4b992b2aeaddf71406b484d47332f27b1ab051 | diff --git a/packages/mdc-bottom-navigation/addon/mixins/bottom-navigation-button.js b/packages/mdc-bottom-navigation/addon/mixins/bottom-navigation-button.js
index <HASH>..<HASH> 100644
--- a/packages/mdc-bottom-navigation/addon/mixins/bottom-navigation-button.js
+++ b/packages/mdc-bottom-navigation/addon/mixins/bottom-navigation-button.js
@@ -12,5 +12,11 @@ export default Mixin.create (RippleMixin, {
horizontal: false,
- createRippleComponent: true
+ createRippleComponent: true,
+
+ didRender () {
+ this._super (...arguments);
+
+ this._ripple.unbounded = true;
+ }
}); | chore: Attempted to fix ripple on buttons | onehilltech_ember-cli-mdc | train | js |
48ea64e9aa2e65a2b4c24cb422cf420726a9f650 | diff --git a/stackmate.rb b/stackmate.rb
index <HASH>..<HASH> 100644
--- a/stackmate.rb
+++ b/stackmate.rb
@@ -18,6 +18,10 @@ opt_parser = OptionParser.new do |opts|
options[:params] = p
puts p
end
+ options[:wait_handles] = true
+ opts.on("-n", "--no-wait-handles", "Do not create any wait handles") do
+ options[:wait_handles] = false
+ end
opts.on("-h", "--help", "Show this message") do
puts opts
exit
@@ -36,8 +40,10 @@ rescue => e
end
if options[:file] && stack_name != ''
- Thread.new do
- WaitConditionServer.run!
+ if options[:wait_handles]
+ Thread.new do
+ WaitConditionServer.run!
+ end
end
engine = Ruote::Dashboard.new(
Ruote::Worker.new( | Add option to not start wait handle server | stackmate_stackmate | train | rb |
90876b38e370ef88cf91f4e7a290f84c76337712 | diff --git a/gwpy/types/series.py b/gwpy/types/series.py
index <HASH>..<HASH> 100644
--- a/gwpy/types/series.py
+++ b/gwpy/types/series.py
@@ -978,19 +978,37 @@ class Series(Array):
% type(self).__name__)
end = None
+ # check if series is irregular
+ try:
+ _ = self.dx
+ irregular = False
+ except AttributeError:
+ irregular = True
+
# find start index
if start is None:
idx0 = None
else:
- idx0 = int((xtype(start) - x0) // self.dx.value)
+ if not irregular:
+ idx0 = int((xtype(start) - x0) // self.dx.value)
+ else:
+ idx0 = numpy.searchsorted(self.xindex.value, xtype(start), side="left")
# find end index
if end is None:
idx1 = None
else:
- idx1 = int((xtype(end) - x0) // self.dx.value)
- if idx1 >= self.size:
- idx1 = None
+ if not irregular:
+ idx1 = int((xtype(end) - x0) // self.dx.value)
+ if idx1 >= self.size:
+ idx1 = None
+ else:
+ if xtype(end) >= self.xindex.value[-1]:
+ idx1 = None
+ else:
+ idx1 = (
+ numpy.searchsorted(self.xindex.value, xtype(end), side="left") - 1
+ )
# crop
if copy: | series.py: allowing cropping of irregular Series | gwpy_gwpy | train | py |
d1a75d1cea9b981d1a0ecd47b2eaefd9ab4018d7 | diff --git a/src/urh/simulator/Simulator.py b/src/urh/simulator/Simulator.py
index <HASH>..<HASH> 100644
--- a/src/urh/simulator/Simulator.py
+++ b/src/urh/simulator/Simulator.py
@@ -371,8 +371,8 @@ class Simulator(QObject):
return False, "Failed to decode message {}".format(msg_index)
for lbl in received_msg.message_type:
- if lbl.value_type_index in [1, 3, 4]:
- # get live, external program, random
+ if lbl.value_type_index in (1, 4):
+ # get live, random
continue
start_recv, end_recv = received_msg.get_label_range(lbl.label, 0, True)
diff --git a/tests/test_simulator.py b/tests/test_simulator.py
index <HASH>..<HASH> 100644
--- a/tests/test_simulator.py
+++ b/tests/test_simulator.py
@@ -332,7 +332,7 @@ class TestSimulator(QtTestCase):
modulator = dialog.project_manager.modulators[0] # type: Modulator
- self.alice.send_raw_data(modulator.modulate("10" * 42), 1)
+ self.alice.send_raw_data(modulator.modulate("100"+"10101010"*42), 1)
self.alice.send_raw_data(np.zeros(self.num_zeros_for_pause, dtype=np.complex64), 1)
bits = self.__demodulate(conn) | check result of external programs when receiving message | jopohl_urh | train | py,py |
b335e65bc7ad82d371daa2aa4a8a98036d2d4b12 | diff --git a/src/main/java/org/thymeleaf/standard/expression/OGNLShortcutExpression.java b/src/main/java/org/thymeleaf/standard/expression/OGNLShortcutExpression.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/thymeleaf/standard/expression/OGNLShortcutExpression.java
+++ b/src/main/java/org/thymeleaf/standard/expression/OGNLShortcutExpression.java
@@ -92,7 +92,14 @@ final class OGNLShortcutExpression {
final PropertyAccessor ognlPropertyAccessor = OgnlRuntime.getPropertyAccessor(targetClass);
// Depending on the returned OGNL property accessor, we will try to apply ours
- if (OGNLVariablesMapPropertyAccessor.class.equals(ognlPropertyAccessor.getClass())) {
+ if (target instanceof Class<?>) {
+
+ // Because of the way OGNL works, the "OgnlRuntime.getTargetClass(...)" of a Class object is the class
+ // object itself, so we might be trying to apply a PropertyAccessor to a Class instead of a real object,
+ // something we avoid by means of this shortcut
+ target = getObjectProperty(textRepository, expressionCache, propertyName, target);
+
+ } else if (OGNLVariablesMapPropertyAccessor.class.equals(ognlPropertyAccessor.getClass())) {
target = getVariablesMapProperty(propertyName, target); | Fixed behaviour with OGNL selecting the same PropertyAccesor for an instance of a class and the class object itself | thymeleaf_thymeleaf | train | java |
05c71f6eb2e2c7712218c60251bf3518417b4108 | diff --git a/time-elements.js b/time-elements.js
index <HASH>..<HASH> 100644
--- a/time-elements.js
+++ b/time-elements.js
@@ -95,7 +95,7 @@
}
CalendarDate.fromDate = function(date) {
- return new this(date.getFullYear(), date.getMonth() + 1, date.getDate());
+ return new this(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate());
};
CalendarDate.today = function() { | Consistently use UTC dates.
Fixes daysPassed() comparison. | github_time-elements | train | js |
e0353f48e0fa2a5165ca39451447bdf20e8830f1 | diff --git a/user.go b/user.go
index <HASH>..<HASH> 100644
--- a/user.go
+++ b/user.go
@@ -2,7 +2,7 @@ package platform
import "context"
-// User is an user. 🎉
+// User is a user. 🎉
type User struct {
ID ID `json:"id,omitempty"`
Name string `json:"name"` | fix(user): update comment about user service | influxdata_influxdb | train | go |
743e7a7853a6757d4056f6b2a27dc660e4e16521 | diff --git a/lib/emir/dataproducts.py b/lib/emir/dataproducts.py
index <HASH>..<HASH> 100644
--- a/lib/emir/dataproducts.py
+++ b/lib/emir/dataproducts.py
@@ -36,10 +36,13 @@ class EMIRConfigurationType(InstrumentConfigurationType):
def validate(self, value):
super(EMIRConfigurationType, self).validate(value)
-class MasterBadPixelMask(FrameDataProduct):
+class EMIRFrame(FrameDataProduct):
pass
-class MasterBias(FrameDataProduct):
+class MasterBadPixelMask(EMIRFrame):
+ pass
+
+class MasterBias(EMIRFrame):
'''Master bias product
This image has 4 extensions: primary, two variance extensions
@@ -53,7 +56,7 @@ class MasterBias(FrameDataProduct):
'''
pass
-class MasterDark(FrameDataProduct):
+class MasterDark(EMIRFrame):
'''Master dark product
This image has 4 extensions: primary, two variance extensions
@@ -67,13 +70,13 @@ class MasterDark(FrameDataProduct):
'''
pass
-class DarkCurrentValue(FrameDataProduct):
+class DarkCurrentValue(EMIRFrame):
pass
-class MasterIntensityFlat(FrameDataProduct):
+class MasterIntensityFlat(EMIRFrame):
pass
-class MasterSpectralFlat(FrameDataProduct):
+class MasterSpectralFlat(EMIRFrame):
pass
class Spectra(FrameDataProduct): | Create a EMIRFrame for validation | guaix-ucm_pyemir | train | py |
262018959f2df199311e2d3d525415fe388d855a | diff --git a/telethon/client/updates.py b/telethon/client/updates.py
index <HASH>..<HASH> 100644
--- a/telethon/client/updates.py
+++ b/telethon/client/updates.py
@@ -160,6 +160,7 @@ class UpdateMethods(UserMethods):
# region Private methods
def _handle_update(self, update):
+ self.session.process_entities(update)
if isinstance(update, (types.Updates, types.UpdatesCombined)):
entities = {utils.get_peer_id(x): x for x in
itertools.chain(update.users, update.chats)}
diff --git a/telethon/client/users.py b/telethon/client/users.py
index <HASH>..<HASH> 100644
--- a/telethon/client/users.py
+++ b/telethon/client/users.py
@@ -25,10 +25,14 @@ class UserMethods(TelegramBaseClient):
if isinstance(future, list):
results = []
for f in future:
- results.append(await f)
+ result = await f
+ self.session.process_entities(result)
+ results.append(result)
return results
else:
- return await future
+ result = await future
+ self.session.process_entities(result)
+ return result
except (errors.ServerError, errors.RpcCallFailError) as e:
__log__.warning('Telegram is having internal issues %s: %s',
e.__class__.__name__, e) | Process entities from sent requests/updates | LonamiWebs_Telethon | train | py,py |
537559e9708324668b790c5774e66d626506b765 | diff --git a/homely/_ui.py b/homely/_ui.py
index <HASH>..<HASH> 100644
--- a/homely/_ui.py
+++ b/homely/_ui.py
@@ -420,7 +420,11 @@ def setcurrentrepo(info):
def _write(path, content):
with open(path + ".new", 'w') as f:
f.write(content)
- os.replace(path + ".new", path)
+ if sys.version_info[0] < 3:
+ # use the less-reliable os.rename() on python2
+ os.rename(path + ".new", path)
+ else:
+ os.replace(path + ".new", path)
_PREV_SECTION = [] | [9] homely._ui: python2 doesn't have os.replace() | phodge_homely | train | py |
4f8273211a0b292a590c4a99cc15427a815a77ec | diff --git a/src/Codeception/Event/DispatcherWrapper.php b/src/Codeception/Event/DispatcherWrapper.php
index <HASH>..<HASH> 100644
--- a/src/Codeception/Event/DispatcherWrapper.php
+++ b/src/Codeception/Event/DispatcherWrapper.php
@@ -4,6 +4,7 @@ namespace Codeception\Event;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
+use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
trait DispatcherWrapper
{
@@ -15,7 +16,8 @@ trait DispatcherWrapper
*/
protected function dispatch(EventDispatcher $dispatcher, $eventType, Event $eventObject)
{
- if (class_exists('Symfony\Contracts\EventDispatcher\Event')) {
+ //TraceableEventDispatcherInterface was introduced in symfony/event-dispatcher 2.5 and removed in 5.0
+ if (!interface_exists(TraceableEventDispatcherInterface::class)) {
//Symfony 5
$dispatcher->dispatch($eventObject, $eventType);
} else { | Improved detection of event-dispatcher version
Previous detector used class from symfony/event-dispatcher-contracts
so it wasn't precise enough.
TraceableEventDispatcherInterface was a part of event-dispatcher,
so it is more accurate | Codeception_Codeception | train | php |
8b837fa7d8a86a2c01c98805a31ae54391f95eff | diff --git a/application/modules/g/controllers/AuthController.php b/application/modules/g/controllers/AuthController.php
index <HASH>..<HASH> 100755
--- a/application/modules/g/controllers/AuthController.php
+++ b/application/modules/g/controllers/AuthController.php
@@ -236,6 +236,9 @@ class G_AuthController extends Garp_Controller_Action {
$flashMessenger = $this->_helper->getHelper('FlashMessenger');
$flashMessenger->addMessage(__($authVars['logout']['successMessage']));
+
+ $cacheBuster = 'action=logout';
+ $target .= (strpos($target, '?') === false ? '?' : '&') . $cacheBuster;
$this->_redirect($target);
} | Refactored logoutAction: add cacheBuster param | grrr-amsterdam_garp3 | train | php |
bc86bbcb91e7dc9d15b46d9f8da34d8038a4e443 | diff --git a/nuimo_dbus.py b/nuimo_dbus.py
index <HASH>..<HASH> 100644
--- a/nuimo_dbus.py
+++ b/nuimo_dbus.py
@@ -137,6 +137,9 @@ class GattDevice:
pass
elif (self.__connect_retry_attempt < 5) and (e.get_dbus_name() == "org.bluez.Error.Failed") and (e.get_dbus_message() == "Software caused connection abort"):
self.__connect()
+ elif (e.get_dbus_name() == "org.freedesktop.DBus.Error.NoReply"):
+ # TODO: How to handle properly? Reproducable when we repeatedly shut off Nuimo immediately after its flashing Bluetooth icon appears
+ self.connect_failed(e)
else:
self.connect_failed(e) | Add error case for “no reply” during connection | getsenic_nuimo-linux-python | train | py |
ae0adb18093aec18c8efad2c75e069e0540995ae | diff --git a/router/distribute.go b/router/distribute.go
index <HASH>..<HASH> 100644
--- a/router/distribute.go
+++ b/router/distribute.go
@@ -36,7 +36,7 @@ import (
// If no route is set messages are forwarded on the incoming router.
// When routing to multiple routers, the incoming stream has to be listed explicitly to be used.
type Distribute struct {
- Broadcast `gollumdoc:embed_type`
+ Broadcast `//gollumdoc:embed_type`
routers []core.Router
boundStreamIDs []core.MessageStreamID
} | Temporary workaround for rst generator | trivago_gollum | train | go |
f73f2299dbc59a3e6c4d66cff4605176e728ee69 | diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/Internal/Cli/Psalm.php
+++ b/src/Psalm/Internal/Cli/Psalm.php
@@ -618,10 +618,14 @@ final class Psalm
): array {
fwrite(STDERR, 'Writing error baseline to file...' . PHP_EOL);
- $issue_baseline = ErrorBaseline::read(
- new \Psalm\Internal\Provider\FileProvider,
- $options['set-baseline']
- );
+ try {
+ $issue_baseline = ErrorBaseline::read(
+ new \Psalm\Internal\Provider\FileProvider,
+ $options['set-baseline']
+ );
+ } catch (\Psalm\Exception\ConfigException $e) {
+ $issue_baseline = [];
+ }
ErrorBaseline::create(
new \Psalm\Internal\Provider\FileProvider, | Fix #<I> - catch exception when baseline cannot be located | vimeo_psalm | train | php |
ce27cc7032025d2c5e9e6e48b5e4c62af2934989 | diff --git a/bokeh/protocol.py b/bokeh/protocol.py
index <HASH>..<HASH> 100644
--- a/bokeh/protocol.py
+++ b/bokeh/protocol.py
@@ -62,7 +62,7 @@ class BokehJSONEncoder(json.JSONEncoder):
return obj.value / millifactor #nanosecond to millisecond
elif isinstance(obj, np.float):
return float(obj)
- elif isinstance(obj, np.integer):
+ elif isinstance(obj, (np.int, np.integer)):
return int(obj)
# Datetime, Date
elif isinstance(obj, (dt.datetime, dt.date)): | Serialize both np.int and np.integer | bokeh_bokeh | train | py |
200e03801bbf4716cfecbdafd332609ed701c6d3 | diff --git a/lib/bundler/local_development.rb b/lib/bundler/local_development.rb
index <HASH>..<HASH> 100644
--- a/lib/bundler/local_development.rb
+++ b/lib/bundler/local_development.rb
@@ -36,6 +36,14 @@ module Bundler
# Check each local gem's gemspec to see if any dependencies need to be made local
gemspec_path = File.join(dir, name, "#{name}.gemspec")
process_gemspec_dependencies(gemspec_path) if File.exist?(gemspec_path)
+ # Evaluate local gem's Gemfile, if present
+ gemfile_path = File.join(dir, name, "Gemfile")
+ if File.exist?(gemfile_path)
+ gemfile = File.read(gemfile_path).
+ gsub(/^(source|gemspec).*\s+/, ''). # Strip sources and gemspecs
+ gsub(/^\s*gem ['"]rake['"].*/, '') # Strip rake
+ eval gemfile
+ end
return gem_without_development name, :path => path
end
end | Evaluate local gem's Gemfile, if present | ndbroadbent_bundler_local_development | train | rb |
8a68bd0b7d0aef9a965c091f1bd11ab7030fba33 | diff --git a/spyder/widgets/tests/test_github.py b/spyder/widgets/tests/test_github.py
index <HASH>..<HASH> 100644
--- a/spyder/widgets/tests/test_github.py
+++ b/spyder/widgets/tests/test_github.py
@@ -6,7 +6,7 @@
# (see spyder/__init__.py for details)
# -----------------------------------------------------------------------------
-"""Tests for the report error dialog."""
+"""Tests for the Github authentication dialog."""
# Third party imports
import pytest | Testing: Fix docstring for the Github dialog tests | spyder-ide_spyder | train | py |
761b5848147f258b9afd46fd718fcf417c34855f | diff --git a/python/ray/serve/config.py b/python/ray/serve/config.py
index <HASH>..<HASH> 100644
--- a/python/ray/serve/config.py
+++ b/python/ray/serve/config.py
@@ -36,7 +36,10 @@ class BackendConfig:
# timeout is default zero seconds, then we keep the existing
# behavior to allow at most max batch size queries.
if self.is_blocking and self.batch_wait_timeout == 0:
- self.max_concurrent_queries = self.max_batch_size or 1
+ if self.max_batch_size:
+ self.max_concurrent_queries = 2 * self.max_batch_size
+ else:
+ self.max_concurrent_queries = 8
# Pipeline/async mode: if the servable is not blocking,
# router should just keep pushing queries to the worker | [Serve] Improve buffering for simple cases (#<I>) | ray-project_ray | train | py |
3e50214ec38d1283d0bfeaac55b1795d3b302732 | diff --git a/flaskext/mongoalchemy.py b/flaskext/mongoalchemy.py
index <HASH>..<HASH> 100644
--- a/flaskext/mongoalchemy.py
+++ b/flaskext/mongoalchemy.py
@@ -122,7 +122,7 @@ class Document(document.Document):
def get(cls, mongo_id):
"""Returns a document instance from its mongo_id"""
query = cls._session.query(cls)
- return query.filter(cls.f.mongo_id==mongo_id).first()
+ return query.filter(cls.mongo_id==mongo_id).first()
def __cmp__(self, other):
if isinstance(other, type(self)) and self.has_id() and other.has_id(): | Updated query API for new MongoAlchemy version (<I>) | cobrateam_flask-mongoalchemy | train | py |
2ae5626ec98e8fb734aeaa14c742c80d017bccfc | diff --git a/refcycle/object_graph.py b/refcycle/object_graph.py
index <HASH>..<HASH> 100755
--- a/refcycle/object_graph.py
+++ b/refcycle/object_graph.py
@@ -330,7 +330,7 @@ class ObjectGraph(IDirectedGraph):
try:
dot_file = os.path.join(tempdir, 'output.gv')
with open(dot_file, 'wb') as f:
- f.write(dot_graph.encode('utf8'))
+ f.write(dot_graph.encode('utf-8'))
cmd = [
dot_executable, | utf-8 seems to be the more standard name for the encoding. | mdickinson_refcycle | train | py |
323caa3b3b557f108ae11ae2cba4b6e6435811c0 | diff --git a/nodeconductor/structure/views.py b/nodeconductor/structure/views.py
index <HASH>..<HASH> 100644
--- a/nodeconductor/structure/views.py
+++ b/nodeconductor/structure/views.py
@@ -557,7 +557,7 @@ class ProjectGroupPermissionViewSet(rf_mixins.RetrieveModelMixin,
def can_save(self, user_group):
user = self.request.user
if user.is_staff:
- return
+ return True
project_group = user_group.group.projectgrouprole.project_group | Fix to allow staff to set PG permissions | opennode_waldur-core | train | py |
7db1aedf893397447e924e5520cf93c31a049d70 | diff --git a/lib/reek/smells/smell_repository.rb b/lib/reek/smells/smell_repository.rb
index <HASH>..<HASH> 100644
--- a/lib/reek/smells/smell_repository.rb
+++ b/lib/reek/smells/smell_repository.rb
@@ -17,10 +17,9 @@ module Reek
def initialize(source_description: nil,
smell_types: self.class.smell_types,
configuration: Configuration::AppConfiguration.new)
- @source_via = source_description
- @typed_detectors = nil
- @configuration = configuration
- @smell_types = smell_types
+ @source_via = source_description
+ @configuration = configuration
+ @smell_types = smell_types
configuration.directive_for(source_via).each do |klass, config|
configure klass, config
@@ -51,14 +50,12 @@ module Reek
private
- private_attr_reader :configuration, :source_via, :smell_types, :typed_detectors
+ private_attr_reader :configuration, :source_via, :smell_types
def smell_listeners
- unless typed_detectors
- @typed_detectors = Hash.new { |hash, key| hash[key] = [] }
- detectors.each_value { |detector| detector.register(typed_detectors) }
+ @smell_listeners ||= Hash.new { |hash, key| hash[key] = [] }.tap do |listeners|
+ detectors.each_value { |detector| detector.register(listeners) }
end
- typed_detectors
end
end
end | SmellRepository: typed_detectors are (refactored) smell_listeners | troessner_reek | train | rb |
860c69a2c955eed2d10c828f86cb2abe478066a5 | diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php
index <HASH>..<HASH> 100644
--- a/tests/system/HTTP/IncomingRequestTest.php
+++ b/tests/system/HTTP/IncomingRequestTest.php
@@ -385,15 +385,17 @@ class IncomingRequestTest extends CIUnitTestCase
public function testGetVarWorksWithJsonAndGetParams()
{
- $config = new App();
+ $config = new App();
$config->baseURL = 'http://example.com/';
- // get method
- $uri = new URI('http://example.com/path?foo=bar&fizz=buzz');
- $_REQUEST['foo'] = 'bar';
+
+ // GET method
+ $_REQUEST['foo'] = 'bar';
$_REQUEST['fizz'] = 'buzz';
- $request = new IncomingRequest($config, $uri, 'php://input', new UserAgent());
+
+ $request = new IncomingRequest($config, new URI('http://example.com/path?foo=bar&fizz=buzz'), 'php://input', new UserAgent());
$request = $request->withMethod('GET');
- // json type
+
+ // JSON type
$request->setHeader('Content-Type', 'application/json');
$this->assertEquals('bar', $request->getVar('foo')); | Update tests/system/HTTP/IncomingRequestTest.php | codeigniter4_CodeIgniter4 | train | php |
4458b3b7cdbcb1c7fae8953cf4d90057ac599703 | diff --git a/docs/src/modules/components/AppNavDrawer.js b/docs/src/modules/components/AppNavDrawer.js
index <HASH>..<HASH> 100644
--- a/docs/src/modules/components/AppNavDrawer.js
+++ b/docs/src/modules/components/AppNavDrawer.js
@@ -9,6 +9,7 @@ import Divider from '@material-ui/core/Divider';
import Hidden from '@material-ui/core/Hidden';
import useMediaQuery from '@material-ui/core/useMediaQuery';
import Box from '@material-ui/core/Box';
+import { unstable_useEnhancedEffect as useEnhancedEffect } from '@material-ui/utils';
import DiamondSponsors from 'docs/src/modules/components/DiamondSponsors';
import AppNavDrawerItem from 'docs/src/modules/components/AppNavDrawerItem';
import Link from 'docs/src/modules/components/Link';
@@ -22,7 +23,7 @@ function PersistScroll(props) {
const { slot, children, enabled } = props;
const rootRef = React.useRef();
- React.useLayoutEffect(() => {
+ useEnhancedEffect(() => {
const parent = rootRef.current ? rootRef.current.parentElement : null;
const activeElement = parent.querySelector('.app-drawer-active'); | [docs] Fix useLayoutEffect warning (#<I>) | mui-org_material-ui | train | js |
4eddda588c43baef25d9823e4af0d204f4843a37 | diff --git a/ufork/test.py b/ufork/test.py
index <HASH>..<HASH> 100644
--- a/ufork/test.py
+++ b/ufork/test.py
@@ -192,6 +192,13 @@ def test_stdout_handler():
print str(i) * 100
time.sleep(11)
+def test_stdout_flood():
+ def stdout_flood():
+ while 1:
+ print 'a' * 10000000
+ arb = ufork.Arbiter(stdout_flood)
+ arb.run()
+
if __name__ == "__main__":
regression_test() | added stdout flood test; unable to reproduce crash with <I>MB chunks written as quickly as possible from 2 workers | kurtbrose_ufork | train | py |
ebf0d91fed101d56108b0a294b05146f239dbf2a | diff --git a/src/main/java/org/aludratest/testcase/data/impl/xml/XmlBasedTestDataProvider.java b/src/main/java/org/aludratest/testcase/data/impl/xml/XmlBasedTestDataProvider.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/aludratest/testcase/data/impl/xml/XmlBasedTestDataProvider.java
+++ b/src/main/java/org/aludratest/testcase/data/impl/xml/XmlBasedTestDataProvider.java
@@ -252,7 +252,7 @@ public class XmlBasedTestDataProvider implements TestDataProvider {
}
// perform auto-conversion based on type
- if (value instanceof String) {
+ if (value instanceof String && !"".equals(value)) {
switch (fieldMeta.getType()) {
case BOOLEAN:
value = Boolean.parseBoolean(value.toString());
@@ -282,6 +282,9 @@ public class XmlBasedTestDataProvider implements TestDataProvider {
return format(value, fieldMeta.getFormatterPattern(), toLocale(fieldMeta.getFormatterLocale()))
.toString();
}
+ else if ("".equals(value)) {
+ return null;
+ }
return value;
}
} | Treat empty string as NULL on load | AludraTest_aludratest | train | java |
fb87e106e6c62d3102770aa9074e6b925f482708 | diff --git a/app/code/local/Aoe/Layout/Helper/Data.php b/app/code/local/Aoe/Layout/Helper/Data.php
index <HASH>..<HASH> 100644
--- a/app/code/local/Aoe/Layout/Helper/Data.php
+++ b/app/code/local/Aoe/Layout/Helper/Data.php
@@ -149,6 +149,18 @@ class Aoe_Layout_Helper_Data extends Mage_Core_Helper_Abstract
}
/**
+ * Simple helper method to expose Mage_Core_Model_App::isSingleStoreMode()
+ *
+ * @return bool
+ *
+ * @see Mage_Core_Model_App::isSingleStoreMode()
+ */
+ public function getIsSingleStoreMode()
+ {
+ return Mage::app()->isSingleStoreMode();
+ }
+
+ /**
* @param Mage_Core_Model_Resource_Db_Collection_Abstract $collection
* @param array $filters
* @param array $ifConditionals | Add helper method to expose single store mode | AOEpeople_Aoe_Layout | train | php |
8a382b4ad99d9cc77a8569c2441bce7b2f97a70c | diff --git a/lib/et-orbi.rb b/lib/et-orbi.rb
index <HASH>..<HASH> 100644
--- a/lib/et-orbi.rb
+++ b/lib/et-orbi.rb
@@ -190,6 +190,8 @@ if Time.respond_to?(:zone) && Time.zone
p Time.zone
p Time.zone.to_s
p Time.zone.inspect
+ p Time.zone.tzinfo
+ p Time.zone.gem
puts "-" * 80
end
etos = Proc.new { |k, v| "#{k}:#{v.inspect}" } | Add even more debug output for ArZone issue, gh-5 | floraison_et-orbi | train | rb |
fe84be184631fa0c4116bb85d8dc3cb623798d8f | diff --git a/adapters/src/main/java/org/jboss/jca/adapters/jdbc/xa/XAManagedConnection.java b/adapters/src/main/java/org/jboss/jca/adapters/jdbc/xa/XAManagedConnection.java
index <HASH>..<HASH> 100644
--- a/adapters/src/main/java/org/jboss/jca/adapters/jdbc/xa/XAManagedConnection.java
+++ b/adapters/src/main/java/org/jboss/jca/adapters/jdbc/xa/XAManagedConnection.java
@@ -397,7 +397,7 @@ public class XAManagedConnection extends BaseWrapperManagedConnection implements
private boolean isFailedXA(int errorCode)
{
- return !(errorCode >= XAException.XA_RBBASE && errorCode < XAException.XA_RBEND);
+ return !(errorCode >= XAException.XA_RBBASE && errorCode <= XAException.XA_RBEND);
}
/** | [JBJCA-<I>] XARB_END should be included in check | ironjacamar_ironjacamar | train | java |
423a511dced6f05795342d60700682346bbe9336 | diff --git a/backend/geomajas-api/src/main/java/org/geomajas/layer/VectorLayer.java b/backend/geomajas-api/src/main/java/org/geomajas/layer/VectorLayer.java
index <HASH>..<HASH> 100644
--- a/backend/geomajas-api/src/main/java/org/geomajas/layer/VectorLayer.java
+++ b/backend/geomajas-api/src/main/java/org/geomajas/layer/VectorLayer.java
@@ -93,10 +93,13 @@ public interface VectorLayer extends Layer<VectorLayerInfo> {
/**
* Reads an existing feature of the model.
+ * <p/>
+ * When no feature with the requested id is found,
+ * {@link org.geomajas.global.ExceptionCode#LAYER_MODEL_FEATURE_NOT_FOUND} is thrown.
*
* @param featureId unique id of the feature
* @return feature value object
- * @throws LayerException oops
+ * @throws LayerException when reading failed, for example ExceptionCode.LAYER_MODEL_FEATURE_NOT_FOUND
*/
Object read(String featureId) throws LayerException; | HIB-7, HBE-<I> improve comments to make requirements more clear | geomajas_geomajas-project-client-gwt2 | train | java |
1567cad4744c964701e51200ff9d9ea055d3f5b6 | diff --git a/lib/views/swagger2.js b/lib/views/swagger2.js
index <HASH>..<HASH> 100644
--- a/lib/views/swagger2.js
+++ b/lib/views/swagger2.js
@@ -4,7 +4,7 @@ import YAML from 'yamljs';
import jsonfile from 'jsonfile';
const loadFile = function (path) {
- if (path.match(/\.yml$/)) {
+ if (path.match(/\.ya?ml$/)) {
return YAML.load(path);
} | Support for .yaml file extension
You may have `.yaml` for YAML file.
The current extension only supports `.yml`
I wonder if trying to load the file as yaml and acting on failure would be better (?). | fmvilas_swagger-node-codegen | train | js |
c2c056e6f665c72061f0bedb37be6fb9cf64ce3f | diff --git a/cerberus/base.py b/cerberus/base.py
index <HASH>..<HASH> 100644
--- a/cerberus/base.py
+++ b/cerberus/base.py
@@ -91,6 +91,11 @@ def normalize_schema(schema: Schema) -> Schema:
if isinstance(rules, str):
continue
+ rules_with_whitespace = [x for x in rules if " " in x]
+ if rules_with_whitespace:
+ for rule in rules_with_whitespace:
+ rules[rule.replace(" ", "_")] = rules.pop(rule)
+
if "type" in rules:
constraint = rules["type"]
if not (
diff --git a/cerberus/tests/test_schema.py b/cerberus/tests/test_schema.py
index <HASH>..<HASH> 100644
--- a/cerberus/tests/test_schema.py
+++ b/cerberus/tests/test_schema.py
@@ -125,3 +125,10 @@ def test_expansion_with_unvalidated_schema():
{"field": {'allof_regex': ['^Aladdin .*', '.* Sane$']}}
)
assert_success(document={"field": "Aladdin Sane"}, validator=validator)
+
+
+def test_rulename_space_is_normalized():
+ validator = Validator(
+ schema={"field": {"default setter": lambda x: x, "type": "string"}}
+ )
+ assert "default_setter" in validator.schema["field"] | Fixes missing normalization of whitespace in schema's rule names | pyeve_cerberus | train | py,py |
e4bd7ed2fa60a0dbb03bbdea6fa532c6ea0ee704 | diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index <HASH>..<HASH> 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -120,7 +120,7 @@ module RailtiesTest
RUBY
@plugin.write "lib/bukkits/plugins/yaffle/init.rb", <<-RUBY
- Bukkits::Engine.config.yaffle_loaded = true
+ config.yaffle_loaded = true
RUBY
boot_rails | Ensure that init.rb is evaled in context of Engine | rails_rails | train | rb |
a89afd4f9787a46db2b4d0edf1100a2221341727 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -111,8 +111,8 @@ ManifestRevisionPlugin.prototype.walkAndPrefetchAssets = function (compiler) {
var walker_options = {
listeners: {
file: function (root, fileStat, next) {
- if (self.isSafeToTrack(root)) {
- var assetPath = './' + path.join(root, fileStat.name);
+ var assetPath = './' + path.join(root, fileStat.name);
+ if (self.isSafeToTrack(assetPath)) {
compiler.apply(new webpack.PrefetchPlugin(assetPath));
} | Now ignorePath takes into account full path with file name | nickjj_manifest-revision-webpack-plugin | train | js |
4cc2188ea16aaaa05a883be8ffdf70140373c093 | diff --git a/src/LaravelShop.php b/src/LaravelShop.php
index <HASH>..<HASH> 100644
--- a/src/LaravelShop.php
+++ b/src/LaravelShop.php
@@ -107,7 +107,10 @@ class LaravelShop
*/
public static function getGateway()
{
- return Session::get('shop.gateway')[0];
+ $gateways = Session::get('shop.gateway');
+ return $gateways && count($gateways) > 0
+ ? $gateways[count($gateways) - 1]
+ : null;
}
/**
@@ -180,12 +183,26 @@ class LaravelShop
if (isset($order)) {
$order->statusCode = 'failed';
$order->save();
+ // Create failed transaction
+ $order->placeTransaction(
+ static::$gatewayKey,
+ uniqid(),
+ static::$exception->getMessage(),
+ $order->statusCode
+ );
}
} catch (GatewayException $e) {
static::$exception = $e;
if (isset($order)) {
$order->statusCode = 'failed';
$order->save();
+ // Create failed transaction
+ $order->placeTransaction(
+ static::$gatewayKey,
+ uniqid(),
+ static::$exception->getMessage(),
+ $order->statusCode
+ );
}
}
if ($order) { | getGateway function fix and added transactions
getGateway now returns the tail not the head in session variable. Failed
transactions are now stored in the transactions table. | amsgames_laravel-shop | train | php |
e86f6ae2b9a6be4cee4d62be3fa5a198e1e46c5b | diff --git a/lib/haml/util.rb b/lib/haml/util.rb
index <HASH>..<HASH> 100644
--- a/lib/haml/util.rb
+++ b/lib/haml/util.rb
@@ -292,6 +292,34 @@ module Haml
warn(msg)
end
+ # Try loading Sass. If the `sass` gem isn't installed,
+ # print a warning and load from the vendored gem.
+ #
+ # @return [Boolean] True if Sass was successfully loaded from the `sass` gem,
+ # false otherwise.
+ def try_sass
+ begin
+ require 'sass/version'
+ loaded = Sass.respond_to?(:version) && Sass.version[:major] &&
+ Sass.version[:minor] && ((Sass.version[:major] > 3 && Sass.version[:minor] > 1) ||
+ ((Sass.version[:major] == 3 && Sass.version[:minor] == 1) &&
+ (Sass.version[:prerelease] || Sass.version[:name] != "Bleeding Edge")))
+ rescue LoadError => e
+ loaded = false
+ end
+
+ unless loaded
+ haml_warn(<<WARNING)
+Sass is in the process of being separated from Haml,
+and will no longer be bundled at all in Haml 3.2.0.
+Please install the 'sass' gem if you want to use Sass.
+WARNING
+ $".delete('sass/version')
+ $LOAD_PATH.unshift(scope("vendor/sass/lib"))
+ end
+ loaded
+ end
+
## Cross Rails Version Compatibility
# Returns the root of the Rails application, | Add a util method to load Sass. | haml_haml | train | rb |
b382e8692a5a0516d53bbead7accbed86e8834af | diff --git a/prestans/rest.py b/prestans/rest.py
index <HASH>..<HASH> 100644
--- a/prestans/rest.py
+++ b/prestans/rest.py
@@ -763,6 +763,7 @@ class RequestHandler(object):
class BlueprintHandler(RequestHandler):
def __init__(self, args, request, response, logger, debug, route_map):
+
super(BlueprintHandler, self).__init__(args, request, response, logger, debug)
self._route_map = route_map
@@ -805,7 +806,9 @@ class BlueprintHandler(RequestHandler):
import logging
logging.error(self._create_blueprint())
- return []
+ logging.error(self.response)
+
+ return self.response(environ, start_response)
class RequestRouter(object):
@@ -823,12 +826,13 @@ class RequestRouter(object):
def __init__(self, routes, serializers=None, default_serializer=None, deserializers=None,
default_deserializer=None, charset="utf-8", application_name="prestans",
- logger=None, debug=False):
+ logger=None, debug=False, description=None):
self._application_name = application_name
self._debug = debug
self._routes = routes
self._charset = charset
+ self._description = description
#: Are formats prestans handlers can send data back as
self._serializers = serializers | Adds description to request router for blueprint | anomaly_prestans | train | py |
947c9047bc37abcd68091b3bb783dfe042dc49d4 | diff --git a/src/main/java/org/dasein/cloud/google/platform/RDS.java b/src/main/java/org/dasein/cloud/google/platform/RDS.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/dasein/cloud/google/platform/RDS.java
+++ b/src/main/java/org/dasein/cloud/google/platform/RDS.java
@@ -866,8 +866,8 @@ public class RDS extends AbstractRelationalDatabaseSupport<Google> {
database.setProductSize(s.getTier()); // D0
LocationPreference lp = s.getLocationPreference();
- if (null != lp)
- database.setProviderDataCenterId(lp.getZone());
+ if ((null != lp) && (null != lp.getZone()))
+ database.setProviderDataCenterId(lp.getZone()); // broken database instance is in a state where this is not set as the database is in maintenence mode.
database.setProviderDatabaseId(d.getInstance()); // dsnrdbms317
database.setProviderOwnerId(d.getProject()); // qa-project-2
database.setProviderRegionId(d.getRegion()); | added comment explaining why database.setProviderDataCenterId is failing
(DUE to a stuck database instance. | dasein-cloud_dasein-cloud-google | train | java |
0dcd15529fc9b8417f3a55b436e113c77ad61d17 | diff --git a/lib/lolcommits/plugins/lol_twitter.rb b/lib/lolcommits/plugins/lol_twitter.rb
index <HASH>..<HASH> 100644
--- a/lib/lolcommits/plugins/lol_twitter.rb
+++ b/lib/lolcommits/plugins/lol_twitter.rb
@@ -65,8 +65,8 @@ module Lolcommits
consumer = OAuth::Consumer.new(TWITTER_CONSUMER_KEY,
TWITTER_CONSUMER_SECRET,
- :site => 'http://api.twitter.com',
- :request_endpoint => 'http://api.twitter.com',
+ :site => 'https://api.twitter.com',
+ :request_endpoint => 'https://api.twitter.com',
:sign_in => true)
request_token = consumer.get_request_token | Replace http with https in twitter plugin.
http requests produce a <I> error during OAuth. | lolcommits_lolcommits | train | rb |
deb2e96d2b97f07ef49cd12f697ff67baf7400d3 | diff --git a/app/assets/javascripts/fae/form/_validator.js b/app/assets/javascripts/fae/form/_validator.js
index <HASH>..<HASH> 100644
--- a/app/assets/javascripts/fae/form/_validator.js
+++ b/app/assets/javascripts/fae/form/_validator.js
@@ -30,7 +30,8 @@ Fae.form.validator = {
FCH.$document.on('submit', 'form', function (e) {
_this.is_valid = true;
- $('[data-validate]').each(function () {
+ // Scope the data-validation only to the form submitted
+ $('[data-validate]', $(this)).each(function () {
if ($(this).data('validate').length) {
_this.judge_it($(this));
} | scope validations to current form to prevent main form from being validated on nested submission | wearefine_fae | train | js |
7a02729fe528ab48222f5f868813e346e276a58f | diff --git a/lib/artifactory/client.rb b/lib/artifactory/client.rb
index <HASH>..<HASH> 100644
--- a/lib/artifactory/client.rb
+++ b/lib/artifactory/client.rb
@@ -266,7 +266,7 @@ module Artifactory
case response
when Net::HTTPRedirection
- redirect = URI.parse(response["location"])
+ redirect = response["location"]
request(verb, redirect, data, headers)
when Net::HTTPSuccess
success(response) | Fix handling of redirection
request expects a path, not a URI. | chef_artifactory-client | train | rb |
3ea6e532189babb654ebee2cb434a12a39ff2d14 | diff --git a/lib/contracts.js b/lib/contracts.js
index <HASH>..<HASH> 100644
--- a/lib/contracts.js
+++ b/lib/contracts.js
@@ -143,7 +143,7 @@ ContractsManager.prototype.build = function() {
};
ContractsManager.prototype.getContract = function(className) {
- return this.compiledContracts[className];
+ return this.contracts[className];
};
ContractsManager.prototype.sortContracts = function(contractList) { | get contract from contract list, not compiled contracts | embark-framework_embark | train | js |
c70558a5bf6d8107972805712291d3dd64c6ef9e | diff --git a/src/fi/tkk/ics/hadoop/bam/cli/Frontend.java b/src/fi/tkk/ics/hadoop/bam/cli/Frontend.java
index <HASH>..<HASH> 100644
--- a/src/fi/tkk/ics/hadoop/bam/cli/Frontend.java
+++ b/src/fi/tkk/ics/hadoop/bam/cli/Frontend.java
@@ -120,8 +120,8 @@ public final class Frontend {
thread.setContextClassLoader(
new URLClassLoader(allURLs, loader2.getParent()));
- // Evidently we don't need to do conf.setClassLoader(). Presumably
- // Hadoop loads the libjars and the main jar in the same class loader.
+ // Make sure Hadoop also uses the right class loader.
+ conf.setClassLoader(thread.getContextClassLoader());
}
/* Call the go(args,conf) method of this class, but do it via | CLI frontend: set conf.setClassLoader
Appears to be necessary at least in CDH <I>. | HadoopGenomics_Hadoop-BAM | train | java |
942763dd418858dee7ee359f007f6b2dfbdb345f | diff --git a/public/src/Route/Link.php b/public/src/Route/Link.php
index <HASH>..<HASH> 100644
--- a/public/src/Route/Link.php
+++ b/public/src/Route/Link.php
@@ -27,6 +27,7 @@ class Link extends Route
$setor = Config::getSetor();
$this->viewAssetsUpdate($setor);
$this->addJsTemplates();
+ $this->createHeadMinify();
$this->formatParam($setor);
}
@@ -40,8 +41,6 @@ class Link extends Route
$this->param['css'] = file_exists(PATH_HOME . "assetsPublic/view/{$setor}/" . parent::getFile() . ".min.css") ? file_get_contents(PATH_HOME . "assetsPublic/view/" . $setor . "/" . parent::getFile() . ".min.css") : "";
$this->param['js'] = file_exists(PATH_HOME . "assetsPublic/view/{$setor}/" . parent::getFile() . ".min.js") ? HOME . "assetsPublic/view/{$setor}/" . parent::getFile() . ".min.js?v=" . VERSION : "";
$this->param['variaveis'] = parent::getVariaveis();
-
- $this->createHeadMinify();
}
/** | remove css and js original, move link and script to css and js | edineibauer_uebRoute | train | php |
d4e0e203246b69d94378845018cbf68d6184c928 | diff --git a/spec/cli_spec.js b/spec/cli_spec.js
index <HASH>..<HASH> 100644
--- a/spec/cli_spec.js
+++ b/spec/cli_spec.js
@@ -114,7 +114,23 @@ describe('prey.js', function(){
})
- describe('when a different signal is received', function(){
+ describe('when SIGINT signal is received', function(){
+
+ it('should do nothing', function(){
+
+ })
+
+ })
+
+ describe('when SIGTERM signal is received', function(){
+
+ it('should do nothing', function(){
+
+ })
+
+ })
+
+ describe('when SIGQUIT signal is received', function(){
it('should do nothing', function(){ | Added a few things on cli spec. | prey_prey-node-client | train | js |
98433e50c1bf32dffba7fefa8c83e47d1140d8bc | diff --git a/lib/kamerling/repos.rb b/lib/kamerling/repos.rb
index <HASH>..<HASH> 100644
--- a/lib/kamerling/repos.rb
+++ b/lib/kamerling/repos.rb
@@ -20,6 +20,10 @@ module Kamerling class Repos
@db = db
end
+ def free_clients_for project
+ repos[Registration].related_to(project).map(&:client).reject(&:busy)
+ end
+
def projects
repos[Project].all
end
diff --git a/spec/kamerling/repos_spec.rb b/spec/kamerling/repos_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/kamerling/repos_spec.rb
+++ b/spec/kamerling/repos_spec.rb
@@ -28,6 +28,20 @@ module Kamerling describe Repos do
end
end
+ describe '.free_clients_for' do
+ it 'returns free clients for the given project' do
+ busy_client = fake :client, busy: true
+ free_client = fake :client, busy: false
+ busy_reg = fake :registration, client: busy_client
+ free_reg = fake :registration, client: free_client
+ project = fake :project
+ repo = fake :repo
+ stub(repo).related_to(project) { [busy_reg, free_reg] }
+ Repos.repos = { Registration => repo }
+ Repos.free_clients_for(project).must_equal [free_client]
+ end
+ end
+
describe '.projects' do
it 'returns all projects' do
Repos.repos = { Project => fake(:repo, all: all_projects = fake) } | add Repos.free_clients_for | chastell_kamerling | train | rb,rb |
052a0c6aedacfed17988a5a175146f96774a2304 | diff --git a/test/system/src/test/java/io/pravega/test/system/ControllerFailoverTest.java b/test/system/src/test/java/io/pravega/test/system/ControllerFailoverTest.java
index <HASH>..<HASH> 100644
--- a/test/system/src/test/java/io/pravega/test/system/ControllerFailoverTest.java
+++ b/test/system/src/test/java/io/pravega/test/system/ControllerFailoverTest.java
@@ -184,7 +184,7 @@ public class ControllerFailoverTest {
// Scale operation should now complete on the second controller instance.
// Note: if scale does not complete within desired time, test will timeout.
while (!scaleStatus) {
- scaleStatus = controller1.checkScaleStatus(stream1, 0).join();
+ scaleStatus = controller2.checkScaleStatus(stream1, 0).join();
Thread.sleep(30000);
} | Issue <I>: Call controller2 instead of controller1 as controller is stopped in system test (#<I>)
* Fixes problem in failovertest where we call a controller that we have shut down to check scaling
status. | pravega_pravega | train | java |
0690de679d1987dd317d57b63a536e4ebe556d86 | diff --git a/agent/test/unit/com/thoughtworks/go/agent/AgentWebSocketClientControllerTest.java b/agent/test/unit/com/thoughtworks/go/agent/AgentWebSocketClientControllerTest.java
index <HASH>..<HASH> 100644
--- a/agent/test/unit/com/thoughtworks/go/agent/AgentWebSocketClientControllerTest.java
+++ b/agent/test/unit/com/thoughtworks/go/agent/AgentWebSocketClientControllerTest.java
@@ -102,8 +102,8 @@ public class AgentWebSocketClientControllerTest {
@After
public void tearDown() {
GuidService.deleteGuid();
- System.clearProperty("go.agent.websocket.enabled");
- System.clearProperty("go.agent.console.logs.websocket.enabled");
+ System.clearProperty(SystemEnvironment.WEBSOCKET_ENABLED.propertyName());
+ System.clearProperty(SystemEnvironment.CONSOLE_LOGS_THROUGH_WEBSOCKET_ENABLED.propertyName());
}
@Test | Change the way we clear system property so keys aren't duplicated in test | gocd_gocd | train | java |
bf9b0556c0aa859754eecef79cb35a85e9414f3a | diff --git a/src/main/java/hudson/plugins/groovy/Groovy.java b/src/main/java/hudson/plugins/groovy/Groovy.java
index <HASH>..<HASH> 100644
--- a/src/main/java/hudson/plugins/groovy/Groovy.java
+++ b/src/main/java/hudson/plugins/groovy/Groovy.java
@@ -186,10 +186,11 @@ public class Groovy extends AbstractGroovy {
public void setInstallations(hudson.plugins.groovy.GroovyInstallation... installations) {
//this.installations = installations;
- this.installations2 = new ArrayList<hudson.plugins.groovy.GroovyInstallation>();
+ List<hudson.plugins.groovy.GroovyInstallation> installations2 = new ArrayList<hudson.plugins.groovy.GroovyInstallation>();
for(hudson.plugins.groovy.GroovyInstallation install: installations){
- this.installations2.add(install);
+ installations2.add(install);
}
+ this.installations2 = installations2;
save();
} | [JENKINS-<I>] Fixed @CopyOnWrite semantics | jenkinsci_groovy-plugin | train | java |
814a97b1d96c17aa2462bc40334052709aeae7e9 | diff --git a/src/main/java/com/cloudbees/jenkins/support/AsyncResultCache.java b/src/main/java/com/cloudbees/jenkins/support/AsyncResultCache.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/cloudbees/jenkins/support/AsyncResultCache.java
+++ b/src/main/java/com/cloudbees/jenkins/support/AsyncResultCache.java
@@ -79,7 +79,7 @@ public class AsyncResultCache<T> implements Runnable {
}
private static String getNodeName(Node node) {
- return node instanceof Jenkins ? "master" : node.getNodeName();
+ return node instanceof Jenkins ? "master" : node.getDisplayName();
}
public AsyncResultCache(Node node, WeakHashMap<Node, T> cache, Future<T> future, String name) { | Use display name of node in order to retain consistency with support bundle | jenkinsci_support-core-plugin | train | java |
3abd4141635aee317555f34cce8d2e4183273261 | diff --git a/phpsec/phpsec.session.php b/phpsec/phpsec.session.php
index <HASH>..<HASH> 100644
--- a/phpsec/phpsec.session.php
+++ b/phpsec/phpsec.session.php
@@ -74,7 +74,7 @@ class phpsecSession {
self::$_currID = null;
}
if(self::$_sessIdRegen === true || self::$_currID === null) {
- self::$_newID = phpsecRand::str(128);
+ self::$_newID = phpsecRand::str(128, 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-_.!*#=%');
} else {
self::$_newID = self::$_currID;
} | Adds more characters to the session ID charset. | phpsec_phpSec | train | php |
90ce344e4e68752652a2dd009f69db2e69125110 | diff --git a/lib/symmetric_encryption.rb b/lib/symmetric_encryption.rb
index <HASH>..<HASH> 100644
--- a/lib/symmetric_encryption.rb
+++ b/lib/symmetric_encryption.rb
@@ -7,18 +7,14 @@ begin
rescue LoadError
end
-begin
- require 'active_record'
+ActiveSupport.on_load(:active_record) do
require 'symmetric_encryption/railties/attr_encrypted'
require 'symmetric_encryption/railties/symmetric_encryption_validator'
ActiveRecord::Base.include(SymmetricEncryption::Railties::AttrEncrypted)
-rescue LoadError
end
-begin
- require 'mongoid'
+ActiveSupport.on_load(:mongoid) do
require 'symmetric_encryption/railties/mongoid_encrypted'
require 'symmetric_encryption/railties/symmetric_encryption_validator'
-rescue LoadError
end | Lazily loads ORM adapters to mitigate #<I> | rocketjob_symmetric-encryption | train | rb |
bcba5070f61b1760a176745f37f8aa68ba02b305 | diff --git a/packages/reactstrap-validation-date/src/AvDateRange.js b/packages/reactstrap-validation-date/src/AvDateRange.js
index <HASH>..<HASH> 100644
--- a/packages/reactstrap-validation-date/src/AvDateRange.js
+++ b/packages/reactstrap-validation-date/src/AvDateRange.js
@@ -326,8 +326,10 @@ export default class AvDateRange extends Component {
disabled={attributes.disabled}
className={classes}
onChange={({ target }) => {
- (target.id === startId || target.id === endId) &&
+ if(target.id === startId || target.id === endId){
this.onDatesChange(target.value);
+
+ }
}}
data-testid={`date-range-input-group-${name}`}
> | refactor(reactstrap-validation-date): linter didnt like shorthand | Availity_availity-react | train | js |
a11c8e543acb39068f027b47f75a885294519a77 | diff --git a/app/models/unidom/visitor/password.rb b/app/models/unidom/visitor/password.rb
index <HASH>..<HASH> 100644
--- a/app/models/unidom/visitor/password.rb
+++ b/app/models/unidom/visitor/password.rb
@@ -6,7 +6,7 @@ class Unidom::Visitor::Password < ActiveRecord::Base
has_one :authenticating, class_name: 'Unidom::Visitor::Authenticating', as: :credential
- include ::Unidom::Common::Concerns::ModelExtension
+ include Unidom::Common::Concerns::ModelExtension
def generate_pepper_content
self.pepper_content = self.pepper_content||::SecureRandom.hex(self.class.columns_hash['pepper_content'].limit/2) | 1, Improved the coding style of the Password model. | topbitdu_unidom-visitor | train | rb |
01f8a0adc9745da0a1eab5615427837b1c5c04c2 | diff --git a/tests/unit/OutputManagerTest.php b/tests/unit/OutputManagerTest.php
index <HASH>..<HASH> 100644
--- a/tests/unit/OutputManagerTest.php
+++ b/tests/unit/OutputManagerTest.php
@@ -92,6 +92,7 @@ class OutputManagerTest extends \Codeception\Test\Unit
"template" => $this->tplName
]
);
+ $this->manager->setHandler(m::mock(\SlaxWeb\Output\AbstractHandler::class));
restore_error_handler();
} | set a mocked output handler in manager unit test | SlaxWeb_Output | train | php |
959ddc965f9b42c5dc9b4cfdd59ac50cb04acf5b | diff --git a/GifExceptionBundle.php b/GifExceptionBundle.php
index <HASH>..<HASH> 100644
--- a/GifExceptionBundle.php
+++ b/GifExceptionBundle.php
@@ -22,9 +22,4 @@ class GifExceptionBundle extends Bundle
$container->addCompilerPass($this->getContainerExtension());
}
-
- public function getParent()
- {
- return 'TwigBundle';
- }
} | Remove getParent call to TwigBundle | jolicode_GifExceptionBundle | train | php |
628b75756159934ab0f7d43581b8ea50af20eb1a | diff --git a/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/restcore/GuiceRestCoreServiceImpl.java b/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/restcore/GuiceRestCoreServiceImpl.java
index <HASH>..<HASH> 100644
--- a/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/restcore/GuiceRestCoreServiceImpl.java
+++ b/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/service/restcore/GuiceRestCoreServiceImpl.java
@@ -22,7 +22,7 @@ public class GuiceRestCoreServiceImpl implements GuiceRestCoreService
@Reconfigurable
@Inject(optional = true)
@Named(GuiceProperties.ALLOW_RESTART)
- boolean allowRestart = false;
+ public boolean allowRestart = false;
@Inject
GuiceConfig configuration; | Make allowRestart public as well as Reconfigurable | petergeneric_stdlib | train | java |
a8e6ecf4cb272b360b3d419fd37c1a700f753200 | diff --git a/dependencyManager.js b/dependencyManager.js
index <HASH>..<HASH> 100644
--- a/dependencyManager.js
+++ b/dependencyManager.js
@@ -86,11 +86,11 @@ function getRequiredDeps(packageJson) {
}
const deps = {
- "@angular/compiler-cli": "~6.1.0-beta.3",
+ "@angular/compiler-cli": "~6.1.0-rc.0",
};
if (!dependsOn(packageJson, "@angular-devkit/build-angular")) {
- deps["@ngtools/webpack"] = "6.1.0-rc.0";
+ deps["@ngtools/webpack"] = "~6.1.0-rc.2";
}
return deps; | chore: compiler cli & ngtools/webpack to latest rc (#<I>)
We no longer need to hardcode @ngtools/webpack to <I>-rc<I> as <URL> | NativeScript_nativescript-dev-webpack | train | js |
febaf1d996e124f19e2dabd6ed163cb4e005dfe9 | diff --git a/test/datepicker_test.js b/test/datepicker_test.js
index <HASH>..<HASH> 100644
--- a/test/datepicker_test.js
+++ b/test/datepicker_test.js
@@ -252,10 +252,10 @@ describe("DatePicker", () => {
TestUtils.Simulate.keyDown(data.nodeInput, getKey("ArrowLeft"));
TestUtils.Simulate.keyDown(data.nodeInput, getKey("ArrowLeft"));
- var day = TestUtils.findRenderedDOMComponentWithClass(
+ var day = TestUtils.scryRenderedDOMComponentsWithClass(
data.datePicker.calendar,
"react-datepicker__day--today"
- );
+ )[0];
TestUtils.Simulate.click(ReactDOM.findDOMNode(day));
TestUtils.Simulate.keyDown(data.nodeInput, getKey("ArrowDown")); | Changed selection of today to allow for multiple instances of today to be rendered (ie. in case today is the start of the month) (#<I>) | Hacker0x01_react-datepicker | train | js |
1371d5d7ecd42bf8e778b1dad07f6d880f8c04e9 | diff --git a/src/anyconfig/backend/xml.py b/src/anyconfig/backend/xml.py
index <HASH>..<HASH> 100644
--- a/src/anyconfig/backend/xml.py
+++ b/src/anyconfig/backend/xml.py
@@ -452,7 +452,8 @@ def etree_write(tree, stream):
:param tree: XML ElementTree object
:param stream: File or file-like object can write to
"""
- tree.write(stream, encoding='UTF-8', xml_declaration=True)
+ enc = "unicode" if anyconfig.compat.IS_PYTHON_3 else "utf-8"
+ tree.write(stream, encoding=enc, xml_declaration=True)
class Parser(anyconfig.backend.base.Parser, | fix: correct encoding arg for xml.etree.ElementTree.write
correct encoding arg for xml.etree.ElementTree.write in python 3 to
avoid the following exception raised on dump:
TypeError: write() argument must be str, not bytes | ssato_python-anyconfig | train | py |
91cf272c2ef1e060a930637832361d2a9b48c618 | diff --git a/python/ray/_private/monitor.py b/python/ray/_private/monitor.py
index <HASH>..<HASH> 100644
--- a/python/ray/_private/monitor.py
+++ b/python/ray/_private/monitor.py
@@ -261,8 +261,9 @@ class Monitor:
redis_client, ray_constants.MONITOR_DIED_ERROR, message)
def _signal_handler(self, sig, frame):
- return self._handle_failure(f"Terminated with signal {sig}\n" +
- "".join(traceback.format_stack(frame)))
+ self._handle_failure(f"Terminated with signal {sig}\n" +
+ "".join(traceback.format_stack(frame)))
+ sys.exit(sig + 128)
def run(self):
# Register signal handlers for autoscaler termination. | [Core] Exit autoscaler with a non-zero exit code upon handling SIGINT/SIGTERM (#<I>) | ray-project_ray | train | py |
46479a9903e1b3134e715f5c442ef050181ca2e8 | diff --git a/lib/deas/version.rb b/lib/deas/version.rb
index <HASH>..<HASH> 100644
--- a/lib/deas/version.rb
+++ b/lib/deas/version.rb
@@ -1,3 +1,3 @@
module Deas
- VERSION = "0.29.0"
+ VERSION = "0.30.0"
end | version to <I>
* Remove render logic from the sinatra runner; switch to always using template source #<I>
* cache template name extensions at the template source #<I>
* rework template source api for querying about configured engines #<I>
* update test runner render args to conform to new render API #<I>
* add source render/partial methods to the view handler and runners #<I>
* template source: rename `default_template_source` engine option #<I>
/cc @jcredding | redding_deas | train | rb |
fddebff7ca1e98f238c6c278369fa994026bdd3b | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -183,7 +183,8 @@ ext_modules = [
State_ext,
]
-if USE_CYTHON:
+# XXX Mega-kludge!
+if USE_CYTHON and sys.argv[1] == 'sdist':
from Cython.Build import cythonize
ext_modules = cythonize(ext_modules) | Cythonize only if we're doing sdist. | probcomp_crosscat | train | py |
dc7c5c6a50060e949f384ebea4916534a5f965eb | diff --git a/backend/__32bit.py b/backend/__32bit.py
index <HASH>..<HASH> 100644
--- a/backend/__32bit.py
+++ b/backend/__32bit.py
@@ -574,7 +574,8 @@ def _ne32(ins):
op1, op2 = tuple(ins.quad[2:])
output = _32bit_oper(op1, op2)
output.append('call __EQ32')
- output.append('cpl') # Negates the result
+ output.append('sub 1') # Carry if A = 0 (False)
+ output.append('sbc a, a') # Negates => A > B ?
output.append('push af')
REQUIRES.add('eq32.asm')
return output | bugfix: NEQ<I> should accept any integer
If the return value where not 0xFF for true (e.g. 1) in the
_EQ<I> routine, this one might fail. Negate the result correctly. | boriel_zxbasic | train | py |
1f44eef29989a4514db1711791ec9b7ef0e920f6 | diff --git a/src/Definition/GraphQLServices.php b/src/Definition/GraphQLServices.php
index <HASH>..<HASH> 100644
--- a/src/Definition/GraphQLServices.php
+++ b/src/Definition/GraphQLServices.php
@@ -17,17 +17,17 @@ final class GraphQLServices
{
private array $services;
private TypeResolver $types;
- private QueryResolver $resolverResolver;
+ private QueryResolver $queryResolver;
private MutationResolver $mutationResolver;
public function __construct(
TypeResolver $typeResolver,
- QueryResolver $resolverResolver,
+ QueryResolver $queryResolver,
MutationResolver $mutationResolver,
array $services = []
) {
$this->types = $typeResolver;
- $this->resolverResolver = $resolverResolver;
+ $this->queryResolver = $queryResolver;
$this->mutationResolver = $mutationResolver;
$this->services = $services;
}
@@ -56,7 +56,7 @@ final class GraphQLServices
*/
public function query(string $alias, ...$args)
{
- return $this->resolverResolver->resolve([$alias, $args]);
+ return $this->queryResolver->resolve([$alias, $args]);
}
/** | Rename attribute in GraphQLServices class | overblog_GraphQLBundle | train | php |
1c4cbdff968c538391dd8f4e476e33c600dd82b4 | diff --git a/components/display.py b/components/display.py
index <HASH>..<HASH> 100644
--- a/components/display.py
+++ b/components/display.py
@@ -13,14 +13,16 @@
origin source code licensed under MIT License
"""
-
+import sys
import time
+import logging
try:
import pygame
except ImportError:
# Maybe Dragon would not be emulated ;)
pygame = None
+log = logging.getLogger("DragonPy.Display")
class Display(object):
@@ -111,6 +113,10 @@ class Display(object):
]
def __init__(self):
+ if pygame is None:
+ log.critical("Pygame is not installed!")
+ sys.exit(1)
+
self.screen = pygame.display.set_mode((560, 384))
pygame.display.set_caption("DragonPy")
self.mix = False | exit if Pygame is not installed | 6809_MC6809 | train | py |
c2abc1368832d0732a26201a1de2f841d9c2cdd1 | diff --git a/lib/chewy/rspec/update_index.rb b/lib/chewy/rspec/update_index.rb
index <HASH>..<HASH> 100644
--- a/lib/chewy/rspec/update_index.rb
+++ b/lib/chewy/rspec/update_index.rb
@@ -18,7 +18,7 @@ require 'i18n/core_ext/hash'
# Combined matcher chain methods:
#
# specify { expect { user1.destroy!; user2.save! } }
-# .to update_index(UsersIndex:User).and_reindex(user2).and_delete(user1)
+# .to update_index(UsersIndex:User).and_reindex(user2).and_delete(user1) }
#
RSpec::Matchers.define :update_index do |type_name, options = {}| | Fix minor code typo in a comment | toptal_chewy | train | rb |
9a62473aaf243886f679afc7d229b4125ca0c63d | diff --git a/src/Domain/Model/Deployment.php b/src/Domain/Model/Deployment.php
index <HASH>..<HASH> 100644
--- a/src/Domain/Model/Deployment.php
+++ b/src/Domain/Model/Deployment.php
@@ -99,14 +99,7 @@ class Deployment implements LoggerAwareInterface, ContainerAwareInterface
{
$this->name = $name;
$this->status = DeploymentStatus::UNKNOWN();
-
- $time = date('YmdHis', time());
-
- if ($time === false) {
- throw new UnexpectedValueException('Could not create valid releaseIdentifier');
- }
-
- $this->releaseIdentifier = $time;
+ $this->releaseIdentifier = date('YmdHis');
$this->setDeploymentLockIdentifier($deploymentLockIdentifier);
} | [BUGFIX] Fix phpstan error
Strict comparison using === between numeric-string and false will always evaluate to false. | TYPO3_Surf | train | php |
fc18a2017a99c7f17d71f40f37a14bed8aba5cd2 | diff --git a/lib/sippy_cup/scenario.rb b/lib/sippy_cup/scenario.rb
index <HASH>..<HASH> 100644
--- a/lib/sippy_cup/scenario.rb
+++ b/lib/sippy_cup/scenario.rb
@@ -122,11 +122,11 @@ module SippyCup
# @param [Hash] opts A set of options to modify the message
# @option opts [Integer] :retrans
# @option opts [String] :headers Extra headers to place into the INVITE
+ #
def invite(opts = {})
opts[:retrans] ||= 500
rtp_string = @rtcp_port ? "m=audio #{@rtcp_port.to_i - 1} RTP/AVP 0 101\na=rtcp:#{@rtcp_port}\n" : "m=audio [media_port] RTP/AVP 0 101\n"
headers = opts.delete :headers
- rtp_string = @rtcp_port ? "m=audio #{@rtcp_port.to_i - 1} RTP/AVP 0 101\na=rtcp:#{@rtcp_port}\n" : "m=audio [media_port] RTP/AVP 0 101\n"
# FIXME: The DTMF mapping (101) is hard-coded. It would be better if we could
# get this from the DTMF payload generator
msg = <<-INVITE | Fix duplicate line and doc newline issue | mojolingo_sippy_cup | train | rb |
8da77010628874da31ec7698cccd0892197a5f46 | diff --git a/flask_appbuilder/security/manager.py b/flask_appbuilder/security/manager.py
index <HASH>..<HASH> 100644
--- a/flask_appbuilder/security/manager.py
+++ b/flask_appbuilder/security/manager.py
@@ -691,7 +691,6 @@ class BaseSecurityManager(AbstractSecurityManager):
# User does not exist, create one if auto user registration.
if user is None and self.auth_user_registration:
- log.info(LOGMSG_WAR_SEC_LOGIN_FAILED.format(username))
user = self.add_user(
# All we have is REMOTE_USER, so we set
# the other fields to blank. | Remove erroneous log message during auto user registration with AUTH_REMOTE_USER | dpgaspar_Flask-AppBuilder | train | py |
c5a6d2ade84241128fcf95eca386e07b11ffa347 | diff --git a/lib/Doctrine/Common/Cache/PhpFileCache.php b/lib/Doctrine/Common/Cache/PhpFileCache.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/Common/Cache/PhpFileCache.php
+++ b/lib/Doctrine/Common/Cache/PhpFileCache.php
@@ -64,6 +64,10 @@ class PhpFileCache extends FileCache
if ( ! is_file($filename)) {
return false;
}
+
+ if ( ! is_readable($filename)) {
+ return false;
+ }
$value = include $filename; | when the file is found but is not readable by the user, then prevent error `Warning: include(tmp/cache/tracker/piwikcache_general.php): failed to open stream: Permission denied in vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php on line <I> | doctrine_cache | train | php |
e1a9d727d21a15c237ef801953ed64ebd747626d | diff --git a/lib/geocoder/stores/active_record.rb b/lib/geocoder/stores/active_record.rb
index <HASH>..<HASH> 100644
--- a/lib/geocoder/stores/active_record.rb
+++ b/lib/geocoder/stores/active_record.rb
@@ -213,8 +213,8 @@ module Geocoder::Store
bearing = false
end
- distance = approx_distance_from_sql(latitude, longitude, options)
options[:units] ||= (geocoder_options[:units] || Geocoder::Configuration.units)
+ distance = approx_distance_from_sql(latitude, longitude, options)
b = Geocoder::Calculations.bounding_box([latitude, longitude], radius, options)
conditions = [ | fixed unit config not working with sqlite distance | alexreisner_geocoder | train | rb |
cccfe3bdd4be4d84e54637261f281a730cdec2c6 | diff --git a/test/src/test/java/ghostdriver/NavigationTest.java b/test/src/test/java/ghostdriver/NavigationTest.java
index <HASH>..<HASH> 100644
--- a/test/src/test/java/ghostdriver/NavigationTest.java
+++ b/test/src/test/java/ghostdriver/NavigationTest.java
@@ -24,4 +24,18 @@ public class NavigationTest extends BaseTest {
d.navigate().forward();
assertTrue(d.getTitle().toLowerCase().contains("HTML5".toLowerCase()));
}
+
+ @Test
+ public void navigateBackWithNoHistory() throws Exception {
+ // Quit the existing driver, and create a brand-new fresh
+ // one to insure we have no history.
+ quitDriver();
+ prepareDriver();
+ WebDriver d = getDriver();
+ d.navigate().back();
+ d.navigate().forward();
+
+ // Make sure explicit navigation still works.
+ d.get("http://google.com");
+ }
} | Navigation back/forward with no history crashes PhantomJS | detro_ghostdriver | train | java |
a3c7d0d04f99a3dc0f4e96a33646831eb8fff50d | diff --git a/vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb b/vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb
index <HASH>..<HASH> 100644
--- a/vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb
+++ b/vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb
@@ -12,8 +12,4 @@ class Admin::InquiriesController < Admin::BaseController
end
end
- def show
- find_inquiry
- end
-
end
diff --git a/vendor/plugins/refinery/lib/crud.rb b/vendor/plugins/refinery/lib/crud.rb
index <HASH>..<HASH> 100644
--- a/vendor/plugins/refinery/lib/crud.rb
+++ b/vendor/plugins/refinery/lib/crud.rb
@@ -34,7 +34,7 @@ module Crud
plural_name = singular_name.pluralize
module_eval %(
- before_filter :find_#{singular_name}, :only => [:update, :destroy, :edit]
+ before_filter :find_#{singular_name}, :only => [:update, :destroy, :edit, :show]
def new
@#{singular_name} = #{class_name}.new | Add find_#{singular_name} to method show as well. This means we can remove def show from controllers/admin/inquiries | refinery_refinerycms | train | rb,rb |
0406627e9dc2c197ffb8feb159df6d0087fdf5d3 | diff --git a/src/Gaufrette/Adapter/Ftp.php b/src/Gaufrette/Adapter/Ftp.php
index <HASH>..<HASH> 100644
--- a/src/Gaufrette/Adapter/Ftp.php
+++ b/src/Gaufrette/Adapter/Ftp.php
@@ -528,7 +528,7 @@ class Ftp implements Adapter,
$this->connection = ftp_ssl_connect($this->host, $this->port, $this->timeout);
}
- if (PHP_VERSION_ID >= 50618) {
+ if (defined('FTP_USEPASVADDRESS')) {
ftp_set_option($this->connection, FTP_USEPASVADDRESS, false);
} | Enable FTP_USEPASVADDRESS option only if the constant exists
As stated by @stof in #<I>, FTP_USEPASVADDRESS is also not supported
by PHP <I> & <I>. See php/php-src@<I>a<I>a4. | KnpLabs_Gaufrette | train | php |
757e1df25bc425472dd43b4ddca27fff4958d472 | diff --git a/api/src/main/java/org/wildfly/swarm/vertx/VertxFraction.java b/api/src/main/java/org/wildfly/swarm/vertx/VertxFraction.java
index <HASH>..<HASH> 100644
--- a/api/src/main/java/org/wildfly/swarm/vertx/VertxFraction.java
+++ b/api/src/main/java/org/wildfly/swarm/vertx/VertxFraction.java
@@ -43,7 +43,40 @@ public class VertxFraction implements Fraction
return this;
}
- public boolean isAdapterDeploymentInhibited()
+ public String jndiName()
+ {
+ return jndiName;
+ }
+
+ public VertxFraction jndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ return this;
+ }
+
+ public String clusterHost()
+ {
+ return clusterHost;
+ }
+
+ public VertxFraction clusterHost(String clusterHost)
+ {
+ this.clusterHost = clusterHost;
+ return this;
+ }
+
+ public Integer clusterPort()
+ {
+ return clusterPort;
+ }
+
+ public VertxFraction clusterPort(Integer clusterPort)
+ {
+ this.clusterPort = clusterPort;
+ return this;
+ }
+
+ public boolean isAdapterDeploymentInhibited()
{
return inhibitAdapterDeployment;
} | Added getters/setters for VertXFraction | thorntail_thorntail | train | java |
0ebbd3caefbd7b267ab149a4e98e64e8f9812797 | diff --git a/dockerscripts/check-user.go b/dockerscripts/check-user.go
index <HASH>..<HASH> 100644
--- a/dockerscripts/check-user.go
+++ b/dockerscripts/check-user.go
@@ -22,7 +22,6 @@ import (
"fmt"
"log"
"os"
- "os/exec"
"os/user"
"syscall"
@@ -43,13 +42,13 @@ func getUserGroup(path string) (string, error) {
if err != nil {
// Fresh directory we should default to what was requested by user.
if os.IsNotExist(err) {
- cmd := exec.Command("chown", "-R", defaultUserGroup, path)
- if err = cmd.Run(); err != nil {
+ fi, err = os.Stat(path)
+ if err != nil {
return "", err
}
- return defaultUserGroup, nil
+ } else {
+ return "", err
}
- return "", err
}
stat, ok := fi.Sys().(*syscall.Stat_t)
if !ok { | Avoid chown instead fallback to rootpath for user perms (#<I>)
Fixes #<I> | minio_minio | train | go |
03acb3faf30e17f2bd3cbc6890649c82d92ed69c | diff --git a/build/Burgomaster.php b/build/Burgomaster.php
index <HASH>..<HASH> 100644
--- a/build/Burgomaster.php
+++ b/build/Burgomaster.php
@@ -43,7 +43,7 @@ class Burgomaster
}
$this->debug("Creating staging directory: $this->stageDir");
-
+
if (!mkdir($this->stageDir, 0777, true)) {
throw new \RuntimeException("Could not create {$this->stageDir}");
}
@@ -343,6 +343,8 @@ EOT
$this->debug("Creating phar file at $dest");
$this->createDirIfNeeded(dirname($dest));
$phar = new \Phar($dest, 0, basename($dest));
+ $alias = basename($dest);
+ $phar->setAlias($alias);
$phar->buildFromDirectory($this->stageDir);
if ($stub !== false) { | Updating phar build to set an alias | aws_aws-sdk-php | train | php |
d5533b99d23c2c2e9f7997c3f606b53be1b2d740 | diff --git a/src/Picqer/Financials/Exact/Budget.php b/src/Picqer/Financials/Exact/Budget.php
index <HASH>..<HASH> 100644
--- a/src/Picqer/Financials/Exact/Budget.php
+++ b/src/Picqer/Financials/Exact/Budget.php
@@ -36,8 +36,8 @@ namespace Picqer\Financials\Exact;
*/
class Budget extends Model
{
- use Findable;
- use Storable;
+ use Query\Findable;
+ use Persistance\Storable;
protected $fillable = [
'ID', | Include namespace path in Budget
Add the directory in the namespace for the traits: Findable & Storable
in the Budget model | picqer_exact-php-client | train | php |
93e77321178d3cc2eda5ea30c2d64991d36d33d8 | diff --git a/framework/core/js/src/forum/components/PostsUserPage.js b/framework/core/js/src/forum/components/PostsUserPage.js
index <HASH>..<HASH> 100644
--- a/framework/core/js/src/forum/components/PostsUserPage.js
+++ b/framework/core/js/src/forum/components/PostsUserPage.js
@@ -145,7 +145,7 @@ export default class PostsUserPage extends UserPage {
parseResults(results) {
this.loading = false;
- this.posts.push(results);
+ this.posts.push(...results);
this.moreResults = results.length >= this.loadLimit;
m.redraw(); | fix: posts tab on users page broken | flarum_core | train | js |
8cf1ec70b7477df2209ee1044f36675524922e89 | diff --git a/yfinance/__init__.py b/yfinance/__init__.py
index <HASH>..<HASH> 100644
--- a/yfinance/__init__.py
+++ b/yfinance/__init__.py
@@ -28,6 +28,7 @@ __all__ = ['download', 'Ticker', 'pdr_override']
import time as _time
import datetime as _datetime
import requests as _requests
+from collections import namedtuple as _namedtuple
import multitasking as _multitasking
import pandas as _pd
import numpy as _np
@@ -43,7 +44,8 @@ def Tickers(tickers):
for ticker in tickers:
ticker_objects[ticker] = Ticker(ticker)
- return ticker_objects
+ return _namedtuple("Tickers", ticker_objects.keys()
+ )(*ticker_objects.values())
class Ticker(): | Ticker returns a named tuple of Ticker objects | ranaroussi_fix-yahoo-finance | train | py |
63b6ee329d5c577b05e49a6a2fbfb83fa07bd474 | diff --git a/src/Piwik.php b/src/Piwik.php
index <HASH>..<HASH> 100644
--- a/src/Piwik.php
+++ b/src/Piwik.php
@@ -361,13 +361,13 @@ class Piwik
$params[$key] = urlencode($value);
}
- if ($this->_period != self::PERIOD_RANGE) {
+ if (empty($this->_date)) {
$params = $params + array(
- 'date' => $this->_date,
+ 'date' => $this->_rangeStart . ',' . $this->_rangeEnd,
);
} else {
$params = $params + array(
- 'date' => $this->_rangeStart . ',' . $this->_rangeEnd,
+ 'date' => $this->_date,
);
} | Fix a bug which prevents users from pulling entries for each of the period of the date range | VisualAppeal_Matomo-PHP-API | train | php |
5f40f92046628a3cee8ffcec6ca8462b10c6cee7 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -12,6 +12,7 @@ module.exports = function build ({ middleware, routes, services }, done) {
const app = express()
app.disable('etag')
app.disable('x-powered-by')
+// app.disable('query parser')
app.enable('case sensitive routing')
app.enable('strict routing')
@@ -39,14 +40,7 @@ module.exports = function build ({ middleware, routes, services }, done) {
(next) => {
if (!services) return next()
- const serviceNames = Object.keys(services)
- if (serviceNames.length === 0) return next()
-
- parallel(serviceNames.map((serviceName) => {
- const _module = services[serviceName]
-
- return (callback) => _module(callback)
- }), next)
+ parallel(Object.values(services), next)
},
(next) => {
if (!routes) return next() | use Object.values as shorthand | dcousens_easy-express-api | train | js |
f62c94201dd2148c064c062590d3bff2f732f3c7 | diff --git a/components/elation/scripts/collection.js b/components/elation/scripts/collection.js
index <HASH>..<HASH> 100644
--- a/components/elation/scripts/collection.js
+++ b/components/elation/scripts/collection.js
@@ -488,7 +488,7 @@ elation.require([], function() {
* Provides a collection interface to a JSONP REST API
*
* @class jsonpapi
- * @augments elation.collection.jsonapi
+ * @augments elation.collection.api
* @memberof elation.collection
* @alias elation.collection.jsonpapi
*
@@ -518,7 +518,7 @@ elation.require([], function() {
document.head.appendChild(this.script);
}
- }, elation.collection.jsonapi);
+ }, elation.collection.api);
/**
* Custom data collection | collection.jsonp inherits from collection.api instead of collection.json | jbaicoianu_elation | 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.