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 |
|---|---|---|---|---|---|
e6e8ba7d5b7de307e874a6caed8597e57a6491fe | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ license: GNU-GPL2
from setuptools import setup
setup(name='pyprofiler',
- version='33',
+ version='35',
description='Profiler utility for python, graphical and textual, whole program or segments',
url='https://github.com/erikdejonge/pyprofiler',
author='Erik de Jonge', | pip
Thursday <I> April <I> (week:<I> day:<I>), <I>:<I>:<I> | erikdejonge_pyprofiler | train | py |
c668be37aba40c95b08e23c13f4de9123143ab1d | diff --git a/src/RequestsLibrary/version.py b/src/RequestsLibrary/version.py
index <HASH>..<HASH> 100644
--- a/src/RequestsLibrary/version.py
+++ b/src/RequestsLibrary/version.py
@@ -1 +1 @@
-VERSION = '0.8b1'
+VERSION = '0.8b2' | Increased to version <I>b2 | bulkan_robotframework-requests | train | py |
8f8fd511b7d2a6f221a5cc51641017b4be9c2a40 | diff --git a/index/scorch/segment/zap/build.go b/index/scorch/segment/zap/build.go
index <HASH>..<HASH> 100644
--- a/index/scorch/segment/zap/build.go
+++ b/index/scorch/segment/zap/build.go
@@ -368,7 +368,8 @@ func persistPostingDetails(memSegment *mem.Segment, w *CountHashWriter, chunkFac
var locOffset int
for postingsListItr.HasNext() {
docNum := uint64(postingsListItr.Next())
- for i := 0; i < int(freqs[offset]); i++ {
+ n := int(freqs[offset])
+ for i := 0; i < n; i++ {
if len(locfields) > 0 {
// put field
err := locEncoder.Add(docNum, uint64(locfields[locOffset])) | scorch zap access freqs[offset] outside loop | blevesearch_bleve | train | go |
2d5f8666acf9968b0424b196a26fd92a1e48125e | diff --git a/test/unit/event.js b/test/unit/event.js
index <HASH>..<HASH> 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -1843,21 +1843,27 @@ test("window resize", function() {
ok( !jQuery(window).data("__events__"), "Make sure all the events are gone." );
});
-test("focusin bubbles", function(){
+
+test("focusin bubbles", function() {
//create an input and focusin on it
- var input = jQuery("<input/>"),
- order = 0;
- input.appendTo(document.body);
- jQuery(document.body).bind("focusin.focusinBubblesTest",function(){
+ var input = jQuery("<input/>"), order = 0;
+
+ input.prependTo("body");
+
+ jQuery("body").bind("focusin.focusinBubblesTest",function(){
equals(1,order++,"focusin on the body second")
- })
+ });
+
input.bind("focusin.focusinBubblesTest",function(){
equals(0,order++,"focusin on the element first")
- })
+ });
+
input[0].focus();
input.remove();
- jQuery(document.body).unbind("focusin.focusinBubblesTest");
-})
+
+ jQuery("body").unbind("focusin.focusinBubblesTest");
+});
+
/*
test("jQuery(function($) {})", function() {
stop(); | Use prepend for the focuin test (to avoid making the test suite jump). | jquery_jquery | train | js |
d4c39b1cdfb1eb5bc80da7d824faf64aced45b50 | diff --git a/cc_core/commons/gpu_info.py b/cc_core/commons/gpu_info.py
index <HASH>..<HASH> 100644
--- a/cc_core/commons/gpu_info.py
+++ b/cc_core/commons/gpu_info.py
@@ -129,3 +129,28 @@ def match_gpus(available_devices, requirements=[GPURequirement()]):
raise InsufficientGPUError("Not all GPU requirements could be fulfilled.")
return used_devices
+
+
+def get_gpu_requirements(gpus_reqs, at_least=GPURequirement()):
+ """
+ Extracts the GPU requirements as list of GPURequirements.
+
+ :param gpus_reqs: A dictionary {'count': <count>} or a list [{min_vram: <min_vram>}, {min_vram: <min_vram>}, ...]
+ :param at_least: If gpu_reqs is empty return at_least
+ :return: A list of GPURequirements
+ """
+ requirements = []
+
+ if gpus_reqs:
+ if type(gpus_reqs) is dict:
+ count = gpus_reqs.get('count')
+ if count:
+ for i in range(count):
+ requirements.append(GPURequirement())
+ elif type(gpus_reqs) is list:
+ for gpu_req in gpus_reqs:
+ requirements.append(GPURequirement(**gpu_req))
+ return requirements
+ else:
+ # If no requirements are supplied
+ return [at_least] | moved get_gpu_requirements to cc-core | curious-containers_cc-core | train | py |
96eae3f0a2a54b67972e095f1e833828da5c5b8a | diff --git a/src/utils.js b/src/utils.js
index <HASH>..<HASH> 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -19,6 +19,7 @@ module.exports = {
return uri;
},
getGoogleTypeForBinding: function(binding) {
+ if (binding == null) return null;
if (binding.type != null && (binding.type === 'typed-literal' || binding.type === 'literal')) {
switch (binding.datatype) {
case 'http://www.w3.org/2001/XMLSchema#float':
@@ -50,11 +51,13 @@ module.exports = {
var typeCount = 0;
bindings.forEach(function(binding){
var type = module.exports.getGoogleTypeForBinding(binding[varName]);
- if (!(type in types)) {
- types[type] = 0;
- typeCount++;
+ if (type != null) {
+ if (!(type in types)) {
+ types[type] = 0;
+ typeCount++;
+ }
+ types[type]++;
}
- types[type]++;
});
if (typeCount == 0) {
return 'string'; | made google visualizations more robust, by dealing with null-bindings. this avoid needlessly showing warning msgs | OpenTriply_YASGUI.YASR | train | js |
ff66d4f2001d45b26349055fd95c2ef30805ba51 | diff --git a/stimela/utils/__init__.py b/stimela/utils/__init__.py
index <HASH>..<HASH> 100644
--- a/stimela/utils/__init__.py
+++ b/stimela/utils/__init__.py
@@ -66,8 +66,10 @@ def xrun(command, options, log=None, _log_container_as_started=False, logfile=No
out, err = process.communicate()
sys.stdout.write(out)
sys.stderr.write(err)
+ process.wait()
return out, err
- process.wait()
+ else:
+ process.wait()
finally:
if process.returncode:
raise SystemError('%s: returns errr code %d'%(command, process.returncode)) | Fix case when stdout and stderr not defined in pipe | SpheMakh_Stimela | train | py |
a554eb04934daf62002b6a3743417b86a8d3a13b | diff --git a/src/Maatwebsite/Excel/Excel.php b/src/Maatwebsite/Excel/Excel.php
index <HASH>..<HASH> 100644
--- a/src/Maatwebsite/Excel/Excel.php
+++ b/src/Maatwebsite/Excel/Excel.php
@@ -104,7 +104,7 @@ class Excel extends \PHPExcel
*
*/
- public function load($file, $firstRowAsLabel = false)
+ public function load($file, $firstRowAsLabel = false, $inputEncoding = 'UTF-8')
{
// Set defaults
@@ -117,7 +117,7 @@ class Excel extends \PHPExcel
$this->format = \PHPExcel_IOFactory::identify($this->file);
// Init the reader
- $this->reader = \PHPExcel_IOFactory::createReader($this->format);
+ $this->reader = \PHPExcel_IOFactory::createReader($this->format)->setInputEncoding($inputEncoding);
// Set default delimiter
//$this->reader->setDelimiter($this->delimiter); | Feature: Can set input encoding when loading csv file | Maatwebsite_Laravel-Excel | train | php |
bc5a74cd63200f89e2eb39f3bffbe27950afe63b | diff --git a/testLib/sharedTestCases.js b/testLib/sharedTestCases.js
index <HASH>..<HASH> 100644
--- a/testLib/sharedTestCases.js
+++ b/testLib/sharedTestCases.js
@@ -414,4 +414,9 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
expect(ES2015Module.getLang()).to.equal("nl");
})
+ it("Should have correct __filename and __dirname when mocked using convertConst", function() {
+ expect(rewire("./ES2015Module", { convertConst: true }).filename).to.equal(require("./ES2015Module").filename);
+ expect(rewire("./ES2015Module", { convertConst: true }).dirname).to.equal(require("./ES2015Module").dirname);
+ })
+
}); | Add test to check if __filename and __dirname is correct | jhnns_rewire | train | js |
5077fbcfe681c5239f65661c5e894fa2002b5cd1 | diff --git a/lib/Stripe/FileUpload.php b/lib/Stripe/FileUpload.php
index <HASH>..<HASH> 100644
--- a/lib/Stripe/FileUpload.php
+++ b/lib/Stripe/FileUpload.php
@@ -35,4 +35,16 @@ class Stripe_FileUpload extends Stripe_ApiResource
$class = get_class();
return self::_scopedCreate($class, $params, $apiKey);
}
+
+ /**
+ * @param array|null $params
+ * @param string|null $apiKey
+ *
+ * @return array An array of Stripe_FileUploads
+ */
+ public static function all($params=null, $apiKey=null)
+ {
+ $class = get_class();
+ return self::_scopedAll($class, $params, $apiKey);
+ }
} | Add ability to list file uploads. | stripe_stripe-php | train | php |
6350a4da6048e61f0de4bae4861b474260777693 | diff --git a/boskos/ranch/ranch.go b/boskos/ranch/ranch.go
index <HASH>..<HASH> 100644
--- a/boskos/ranch/ranch.go
+++ b/boskos/ranch/ranch.go
@@ -114,9 +114,6 @@ type acquireRequestPriorityKey struct {
// Out: A valid Resource object on success, or
// ResourceNotFound error if target type resource does not exist in target state.
func (r *Ranch) Acquire(rType, state, dest, owner, requestID string) (*common.Resource, error) {
- r.resourcesLock.Lock()
- defer r.resourcesLock.Unlock()
-
logger := logrus.WithFields(logrus.Fields{
"type": rType,
"state": state,
@@ -124,6 +121,10 @@ func (r *Ranch) Acquire(rType, state, dest, owner, requestID string) (*common.Re
"owner": owner,
"identifier": requestID,
})
+ logger.Debug("Acquiring resource lock...")
+ r.resourcesLock.Lock()
+ defer r.resourcesLock.Unlock()
+
logger.Debug("Determining request priority...")
ts := acquireRequestPriorityKey{rType: rType, state: state}
rank, new := r.requestMgr.GetRank(ts, requestID) | boskos: ranch: log lock acquire time | kubernetes_test-infra | train | go |
314d6d715606ea27e0fd85a4834a1dc3018c76ec | diff --git a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerImpl.java b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerImpl.java
index <HASH>..<HASH> 100644
--- a/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerImpl.java
+++ b/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerImpl.java
@@ -233,6 +233,7 @@ class JettyServerImpl implements JettyServer {
}
}
}
+ removeContext(model.getContextModel().getHttpContext());
if (!removed) {
throw new IllegalStateException(model + " was not found");
} | [PAXWEB-<I>] first try to also remove the ServletContext from the server. | ops4j_org.ops4j.pax.web | train | java |
4b88cf0432a693fe917f806d78c7d7161689af8a | diff --git a/lib/types/array.js b/lib/types/array.js
index <HASH>..<HASH> 100644
--- a/lib/types/array.js
+++ b/lib/types/array.js
@@ -293,7 +293,6 @@ class ArrayPrompt extends Prompt {
this.index = this.choices.indexOf(choice);
this.toggle(this.focused);
- return this.render();
};
clearTimeout(this.numberTimeout); | Remove return value from `number` in ArrayPrompt | enquirer_enquirer | train | js |
46dc843b60f7881808fe75bb74f2e769f62baaeb | diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java
index <HASH>..<HASH> 100644
--- a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java
+++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java
@@ -24,6 +24,8 @@
*/
package java.util;
+
+import com.google.j2objc.annotations.AutoreleasePool;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;
@@ -516,7 +518,7 @@ class TimerThread extends Thread {
* The main timer loop. (See class comment.)
*/
private void mainLoop() {
- while (true) {
+ for (@AutoreleasePool int i = 0;;) {
try {
TimerTask task;
boolean taskFired; | Issue #<I>: fixed leak in java.util.Timer. | google_j2objc | train | java |
1aafaf3d232ab9ab0e368ecdde6707a84ac72758 | diff --git a/lib/qbwc/controller.rb b/lib/qbwc/controller.rb
index <HASH>..<HASH> 100644
--- a/lib/qbwc/controller.rb
+++ b/lib/qbwc/controller.rb
@@ -66,7 +66,7 @@ module QBWC
</Scheduler>
</QBWCXML>
QWC
- send_data qwc, :filename => 'servpac.qwc', :content_type => 'application/x-qwc'
+ send_data qwc, :filename => "#{@filename || Rails.application.class.parent_name}.qwc", :content_type => 'application/x-qwc'
end
class StringArray < WashOut::Type | allow to change qwc filename | qbwc_qbwc | train | rb |
e73d0c320946136ae31d1e48696b596cd725a651 | diff --git a/lib/specinfra/version.rb b/lib/specinfra/version.rb
index <HASH>..<HASH> 100644
--- a/lib/specinfra/version.rb
+++ b/lib/specinfra/version.rb
@@ -1,3 +1,3 @@
module Specinfra
- VERSION = "2.74.0"
+ VERSION = "2.75.0"
end | Bump up version
[skip ci] | mizzy_specinfra | train | rb |
666df6bb2f2ea5084ef536cb6507d698743031df | diff --git a/src/cmdline/settings.py b/src/cmdline/settings.py
index <HASH>..<HASH> 100644
--- a/src/cmdline/settings.py
+++ b/src/cmdline/settings.py
@@ -209,8 +209,6 @@ class SettingsParser(BaseCommand):
parser_args = []
short_option = _info.pop('_short_option', None)
- if short_option:
- parser_args.append(short_option)
if _info.pop('_positional', False):
if short_option:
@@ -238,6 +236,9 @@ class SettingsParser(BaseCommand):
parser_args.append(arg)
+ if short_option:
+ parser_args.append(short_option)
+
parser.add_argument(*parser_args, **_info)
command_info = args.get('_COMMANDS', {}) | Add short option second
When the short option is double-dashed it needs to go after the primary
option in order for the setting to be properly retrieved from the
Settings object. | rca_cmdline | train | py |
4d650a8d7c386366b6fd39975e81c3e634bd7a9d | diff --git a/lib/enju_subject/expire_editable_fragment.rb b/lib/enju_subject/expire_editable_fragment.rb
index <HASH>..<HASH> 100644
--- a/lib/enju_subject/expire_editable_fragment.rb
+++ b/lib/enju_subject/expire_editable_fragment.rb
@@ -23,8 +23,10 @@ module ExpireEditableFragment
fragments.uniq.each do |fragment|
expire_manifestation_fragment(manifestation, fragment, formats)
end
- manifestation.bookmarks.each do |bookmark|
- expire_tag_cloud(bookmark)
+ if defined?(EnjuBookmark)
+ manifestation.bookmarks.each do |bookmark|
+ expire_tag_cloud(bookmark)
+ end
end
end | fixed error if enju_bookmark is not loaded | next-l_enju_subject | train | rb |
d81910149a74ca16318b8c6d6eff5a04cb207a35 | diff --git a/SimplePool/threadpool.py b/SimplePool/threadpool.py
index <HASH>..<HASH> 100644
--- a/SimplePool/threadpool.py
+++ b/SimplePool/threadpool.py
@@ -19,6 +19,9 @@ class ThreadPool(object):
self.is_active = 0
self.nthreads = nthreads
+ def __len__(self):
+ return len(self._threads)
+
def start(self):
for i in range(self.nthreads):
t = WorkerThread(self._job_q, self._result_q) | Added __len__ function. | ssundarraj_py-threadpool | train | py |
91b39e5c2dd1eeb72f7be1646b8ac2b47543b6a9 | diff --git a/src/views/layout/footer.blade.php b/src/views/layout/footer.blade.php
index <HASH>..<HASH> 100644
--- a/src/views/layout/footer.blade.php
+++ b/src/views/layout/footer.blade.php
@@ -1,5 +1,6 @@
<?php
+use Illuminate\Support\Facades\Request;
use Orchestra\Support\Facades\Asset; ?>
<footer>
@@ -23,3 +24,11 @@ echo $asset->styles();
echo $asset->scripts(); ?>
@placeholder("orchestra.layout: footer")
+
+<script>
+jQuery(function onPageReady ($) { 'use strict';
+ var events = new Javie.Events;
+
+ events.fire("orchestra.ready: <?php echo Request::path(); ?>");
+});
+</script> | Add JS event for each page load. | orchestral_foundation | train | php |
2439f5a5bc138735694ed594d69a8f3db45954c9 | diff --git a/naima/radiative.py b/naima/radiative.py
index <HASH>..<HASH> 100644
--- a/naima/radiative.py
+++ b/naima/radiative.py
@@ -387,7 +387,7 @@ class InverseCompton(BaseElectron):
galactic center).
* A list of length three (isotropic source) or four (anisotropic
- source) composed of:
+ source) composed of:
1. A name for the seed photon field.
2. Its temperature (thermal source) or energy (monochromatic or
@@ -399,7 +399,6 @@ class InverseCompton(BaseElectron):
scattered photon direction as a :class:`~astropy.units.Quantity`
float instance.
-
Other parameters
----------------
Eemin : :class:`~astropy.units.Quantity` float instance, optional | really fix sphinx warnings | zblz_naima | train | py |
f551eb537355129aaa3cf80a721acecf6d281945 | diff --git a/sqlite_object/_sqlite_dict.py b/sqlite_object/_sqlite_dict.py
index <HASH>..<HASH> 100644
--- a/sqlite_object/_sqlite_dict.py
+++ b/sqlite_object/_sqlite_dict.py
@@ -28,7 +28,7 @@ class SqliteDict(SqliteObject):
filename=None,
coder=json.dumps,
decoder=json.loads,
- index=True,
+ index=False,
persist=False,
commit_every=0,
):
diff --git a/sqlite_object/_sqlite_set.py b/sqlite_object/_sqlite_set.py
index <HASH>..<HASH> 100644
--- a/sqlite_object/_sqlite_set.py
+++ b/sqlite_object/_sqlite_set.py
@@ -12,7 +12,7 @@ class SqliteSet(SqliteObject):
filename=None,
coder=json.dumps,
decoder=json.loads,
- index=True,
+ index=False,
persist=False,
commit_every=0,
): | Disable redundant index creation for dict/set
primary key will already create an index, so why do it twice? | hospadar_sqlite_object | train | py,py |
3e9ab53824520745e59e309e5eced95107f81831 | diff --git a/java/server/src/org/openqa/grid/web/servlet/DriverServlet.java b/java/server/src/org/openqa/grid/web/servlet/DriverServlet.java
index <HASH>..<HASH> 100644
--- a/java/server/src/org/openqa/grid/web/servlet/DriverServlet.java
+++ b/java/server/src/org/openqa/grid/web/servlet/DriverServlet.java
@@ -86,6 +86,7 @@ public class DriverServlet extends RegistryBasedServlet {
} catch (Throwable e) {
if (r instanceof WebDriverRequest) {
// http://code.google.com/p/selenium/wiki/JsonWireProtocol#Error_Handling
+ response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.setStatus(500); | KristianRosenvold: Added reset of response stream upon grid error
r<I> | SeleniumHQ_selenium | train | java |
5f12457b65dc0a80bff3ea8b6ee642ff6b19dea3 | diff --git a/proso_flashcards/models.py b/proso_flashcards/models.py
index <HASH>..<HASH> 100644
--- a/proso_flashcards/models.py
+++ b/proso_flashcards/models.py
@@ -101,8 +101,11 @@ class Flashcard(models.Model, ModelDiffMixin):
"object_type": "fc_flashcard",
"active": self.active,
"lang": self.lang,
- "term": self.get_term().to_json(nested=True),
}
+ if not nested:
+ data["term"] = self.get_term().to_json(nested=True)
+ else:
+ data['term_id'] = self.term_id
if hasattr(self, "options"):
data["options"] = [o.to_json(nested=True) for o in sorted(self.options, key=lambda f: f.term.name)]
if hasattr(self, 'practice_meta'): | do not show term for nested flashcards (JSON) | adaptive-learning_proso-apps | train | py |
0b6ebd1c8f3ef207dee06f340f878a953aaca7c1 | diff --git a/openquake/engine/db/models.py b/openquake/engine/db/models.py
index <HASH>..<HASH> 100644
--- a/openquake/engine/db/models.py
+++ b/openquake/engine/db/models.py
@@ -1569,7 +1569,7 @@ class SESCollection(djm.Model):
Iterator for walking through all child :class:`SES` objects.
"""
hc = self.output.oq_job.hazard_calculation
- for ordinal in xrange(hc.ses_per_logic_tree_path):
+ for ordinal in xrange(1, hc.ses_per_logic_tree_path + 1):
yield SES(self, ordinal)
def __len__(self):
@@ -1591,7 +1591,10 @@ class SES(object):
Stochastic Event Set: A container for 1 or more ruptures associated with a
specific investigation time span.
"""
- def __init__(self, ses_collection, ordinal=0):
+ # the ordinal must be > 0: the reason is that it appears in the
+ # exported XML file and the schema constraints the number to be
+ # nonzero
+ def __init__(self, ses_collection, ordinal=1):
self.ses_collection = ses_collection
self.ordinal = ordinal | Fixed the ordinal to be greater than zero | gem_oq-engine | train | py |
fc258c41ec23f0ff0eea293d5e79e9c9c98c43e2 | diff --git a/app/models/katello/glue/pulp/repos.rb b/app/models/katello/glue/pulp/repos.rb
index <HASH>..<HASH> 100644
--- a/app/models/katello/glue/pulp/repos.rb
+++ b/app/models/katello/glue/pulp/repos.rb
@@ -191,7 +191,7 @@ module Glue::Pulp::Repos
def sync_status
return @status if @status
- statuses = repos(self.library).map {|r| r.sync_status}
+ statuses = repos(self.library, nil, false).map {|r| r.sync_status}
return PulpSyncStatus.new(:state => PulpSyncStatus::Status::NOT_SYNCED) if statuses.empty?
#if any of repos sync still running -> product sync running | Fixes #<I>,BZ<I> - Sync status only applies to repos with feeds | Katello_katello | train | rb |
45224cc4a5927a5c420b3fe4e560f3fe269d090a | diff --git a/src/frontend/org/voltdb/export/ExportManager.java b/src/frontend/org/voltdb/export/ExportManager.java
index <HASH>..<HASH> 100644
--- a/src/frontend/org/voltdb/export/ExportManager.java
+++ b/src/frontend/org/voltdb/export/ExportManager.java
@@ -128,7 +128,6 @@ public class ExportManager
exportLog.info("Creating connector " + m_loaderClass);
try {
final Class<?> loaderClass = Class.forName(m_loaderClass);
- //TODO may set master ship here
newProcessor = (ExportDataProcessor)loaderClass.newInstance();
newProcessor.addLogger(exportLog);
newProcessor.setExportGeneration(generations.firstEntry().getValue());
@@ -191,10 +190,8 @@ public class ExportManager
"can't acquire mastership twice for partition id: " + partitionId
);
- if (m_masterOfPartitions.add(partitionId)) {
- for( ExportGeneration gen: m_generations.get().values()) {
- gen.acceptMastershipTask(partitionId);
- }
+ for( ExportGeneration gen: m_generations.get().values()) {
+ gen.acceptMastershipTask(partitionId);
}
} | ENG-<I> fix how export manager was delegating mastership to generations | VoltDB_voltdb | train | java |
db0feccfd44521dee86a3562292f732cb95ed370 | diff --git a/db.class.php b/db.class.php
index <HASH>..<HASH> 100644
--- a/db.class.php
+++ b/db.class.php
@@ -16,6 +16,7 @@ class DB
public static $password = '';
public static $host = 'localhost';
public static $encoding = 'latin1';
+ public static $queryMode = 'buffered'; //buffered, unbuffered, queryAllRows
public static function get($dbName = '') {
static $mysql = null;
@@ -247,7 +248,14 @@ class DB
}
public static function quickPrepare() { return call_user_func_array('DB::query', func_get_args()); }
- public static function query() { return DB::prependCall('DB::queryHelper', func_get_args(), 'buffered'); }
+
+ public static function query() {
+ if (DB::$queryMode == 'buffered' || DB::$queryMode == 'unbuffered') {
+ return DB::prependCall('DB::queryHelper', func_get_args(), DB::$queryMode);
+ } else {
+ return call_user_func_array('DB::queryAllRows', func_get_args());
+ }
+ }
public static function queryNull() { return DB::prependCall('DB::queryHelper', func_get_args(), 'null'); }
public static function queryBuf() { return DB::prependCall('DB::queryHelper', func_get_args(), 'buffered'); } | query() can default to buffered, unbuffered, or queryAllRows | SergeyTsalkov_meekrodb | train | php |
b16ba1abd212edc7913edabbd38f942da7207811 | diff --git a/lib/runner.rb b/lib/runner.rb
index <HASH>..<HASH> 100644
--- a/lib/runner.rb
+++ b/lib/runner.rb
@@ -3,7 +3,7 @@ require 'httparty'
require 'macaddr'
require 'ostruct'
-TESTBOT_VERSION = 12
+TESTBOT_VERSION = 13
TIME_BETWEEN_POLLS = 1
TIME_BETWEEN_VERSION_CHECKS = 60
MAX_CPU_USAGE_WHEN_IDLE = 50
@@ -47,7 +47,7 @@ class Job
if @type == 'rspec'
result += `#{base_environment} export RSPEC_COLOR=true; script/spec -O spec/spec.opts #{@files} 2>&1`
elsif @type == 'cucumber'
- result += `#{base_environment} script/cucumber -f progress --backtrace -r features/support -r features/step_definitions #{@files} 2>&1`
+ result += `#{base_environment} export AUTOTEST=1; script/cucumber -f progress --backtrace -r features/support -r features/step_definitions #{@files} 2>&1`
else
raise "Unknown job type! (#{@type})"
end
diff --git a/lib/server.rb b/lib/server.rb
index <HASH>..<HASH> 100644
--- a/lib/server.rb
+++ b/lib/server.rb
@@ -6,7 +6,7 @@ set :port, 2288
class Server
def self.version
- 12
+ 13
end
def self.valid_version?(runner_version) | Cucumber runner now has color. | joakimk_testbot | train | rb,rb |
caa4539d0e2a93b8a904e418bd40a4b8c9832926 | diff --git a/task/backend/scheduler.go b/task/backend/scheduler.go
index <HASH>..<HASH> 100644
--- a/task/backend/scheduler.go
+++ b/task/backend/scheduler.go
@@ -194,9 +194,8 @@ func (s *outerScheduler) ClaimTask(task *StoreTask, meta *StoreTaskMeta) (err er
s.schedulerMu.Unlock()
- // Okay to read ts.nextDue without locking,
- // because we just created it and there won't be any concurrent access.
- if now := atomic.LoadInt64(&s.now); now >= ts.nextDue || len(meta.ManualRuns) > 0 {
+ next, hasQueue := ts.NextDue()
+ if now := atomic.LoadInt64(&s.now); now >= next || hasQueue {
ts.Work()
}
return nil | fix(task): fix data race in scheduler | influxdata_influxdb | train | go |
b91364756fe13f976e88bb6dd406c231a434bd0d | diff --git a/framework/zii/widgets/CListView.php b/framework/zii/widgets/CListView.php
index <HASH>..<HASH> 100644
--- a/framework/zii/widgets/CListView.php
+++ b/framework/zii/widgets/CListView.php
@@ -239,7 +239,7 @@ class CListView extends CBaseListView
$options['url']=CHtml::normalizeUrl($this->ajaxUrl);
if($this->updateSelector!==null)
$options['updateSelector']=$this->updateSelector;
- foreach(array('beforeAjaxUpdate', 'afterAjaxUpdate') as $event)
+ foreach(array('beforeAjaxUpdate', 'afterAjaxUpdate', 'ajaxUpdateError') as $event)
{
if($this->$event!==null)
{ | need to pass ajaxUpdateError to options | yiisoft_yii | train | php |
5f1a56928060bda660d2e9358a09b1faaad4ed25 | diff --git a/publ/template.py b/publ/template.py
index <HASH>..<HASH> 100644
--- a/publ/template.py
+++ b/publ/template.py
@@ -114,6 +114,6 @@ def _get_builtin(filename):
builtin_file = os.path.join(os.path.dirname(__file__), 'default_template', filename)
if os.path.isfile(builtin_file):
with open(builtin_file, 'r') as file:
- BUILTIN_TEMPLATES[filename] = file.read()
+ return file.read()
- return BUILTIN_TEMPLATES.get(filename)
+ return None | Don't excessively cache builtin templates | PlaidWeb_Publ | train | py |
b0e47b178d6c3f87bdf7be2554baca83b6f33cca | diff --git a/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java b/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
index <HASH>..<HASH> 100644
--- a/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
+++ b/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
@@ -44,8 +44,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.StringTokenizer;
import java.util.Map.Entry;
+import java.util.StringTokenizer;
import javax.jcr.RepositoryException;
@@ -422,6 +422,7 @@ public class RepositoryServiceImpl implements RepositoryService, Startable
repositoryContainer.stop();
repositoryContainers.remove(name);
config.getRepositoryConfigurations().remove(repconfig);
+ parentContainer.unregisterComponentByInstance(repositoryContainer);
}
catch (RepositoryConfigurationException e)
{ | EXOJCR-<I>: added uregistration of RepositoryContainer on its removal | exoplatform_jcr | train | java |
58819d2b6c92b992c8894202364bb51e57fb7394 | diff --git a/ca/django_ca/management/base.py b/ca/django_ca/management/base.py
index <HASH>..<HASH> 100644
--- a/ca/django_ca/management/base.py
+++ b/ca/django_ca/management/base.py
@@ -134,7 +134,7 @@ class BaseCommand(_BaseCommand): # pylint: disable=abstract-method; is a base c
def add_subject(
self,
- parser: argparse._ActionsContainer, # called with an argument group, which is _ActionGroup
+ parser: argparse._ActionsContainer, # pylint: disable=protected-access; called with an argument group
arg: str = "subject",
metavar: typing.Optional[str] = None,
help_text: typing.Optional[str] = None,
@@ -388,7 +388,7 @@ class BaseSignCommand(BaseCommand): # pylint: disable=abstract-method; is a bas
help="TLS Feature extensions.",
)
- def test_options(
+ def test_options( # pylint: disable=unused-argument
self,
ca: CertificateAuthority,
expires: timedelta, | minor pylint filters | mathiasertl_django-ca | train | py |
c0d55ee7dd5d5cfee9247ff50e2b5026223441ab | diff --git a/lib/assert-is.js b/lib/assert-is.js
index <HASH>..<HASH> 100644
--- a/lib/assert-is.js
+++ b/lib/assert-is.js
@@ -100,22 +100,7 @@ function isString(obj, ref) {
return obj;
}
-/**
- * @param obj
- * @param {RegExp} regex
- * @param [ref]
- * @returns {*}
- */
-function isStringMatch(obj, regex, ref) {
- isString(obj, ref);
- if (!obj.match(regex)) {
- throwExpectedRegexMatchError(obj, regex, ref);
- }
- return obj;
-}
-
module.exports = exists;
module.exports.promise = isPromise;
module.exports.object = isObject;
-module.exports.string = isString;
-module.exports.string.match = isStringMatch;
\ No newline at end of file
+module.exports.string = isString;
\ No newline at end of file | remove string.match, because it is not used anymore | clay_amphora | train | js |
0367e9d982add01cf239a3f712775327a203f32b | diff --git a/yabt/builders/cpp.py b/yabt/builders/cpp.py
index <HASH>..<HASH> 100644
--- a/yabt/builders/cpp.py
+++ b/yabt/builders/cpp.py
@@ -253,11 +253,14 @@ def compile_cc(build_context, compiler_config, buildenv, sources,
obj_rel_path = '{}.o'.format(splitext(src)[0])
obj_file = join(buildenv_workspace, obj_rel_path)
include_paths = [buildenv_workspace] + compiler_config.include_path
+
+ # ${buildenv_workspace} is replaced by the actual value at
+ # compilation time
compile_cmd = (
[compiler_config.compiler, '-o', obj_file, '-c'] +
- compiler_config.compile_flags +
+ [flag.replace('${buildenv_workspace}',buildenv_workspace) for
+ flag in compiler_config.compile_flags] +
['-I{}'.format(path) for path in include_paths] +
- ['-fdebug-prefix-map=%s=.'%buildenv_workspace] +
[join(buildenv_workspace, src)])
# TODO: capture and transform error messages from compiler so file
# paths match host paths for smooth(er) editor / IDE integration | Refactored new flag, so it can be added normally as a compiler flag | resonai_ybt | train | py |
a718a810a4c3f77750d38a08685951d17d844e06 | diff --git a/pythran/tests/test_numpy_func3.py b/pythran/tests/test_numpy_func3.py
index <HASH>..<HASH> 100644
--- a/pythran/tests/test_numpy_func3.py
+++ b/pythran/tests/test_numpy_func3.py
@@ -22,6 +22,7 @@ class TestNumpyFunc3(TestEnv):
def test_dot4(self):
self.run_test("def np_dot4(x): from numpy import dot ; y = [2, 3] ; return dot(x,y)", numpy.array([2, 3]), np_dot4=[numpy.array([int])])
+ @unittest.skip("Illegal instruction on Travis")
def test_dot5(self):
""" Check for dgemm version of dot. """
self.run_test("""
@@ -42,6 +43,7 @@ class TestNumpyFunc3(TestEnv):
numpy.arange(9, 18).reshape(3, 3),
np_dot6=[numpy.array([[int]]), numpy.array([[int]])])
+ @unittest.skip("Illegal instruction on Travis")
def test_dot7(self):
""" Check for dgemm version of dot with rectangular shape. """
self.run_test(""" | Skip some blas tests because of illegal instruction on travis | serge-sans-paille_pythran | train | py |
31b93170877ca642589ebd86be15c133c192b871 | diff --git a/salt/state.py b/salt/state.py
index <HASH>..<HASH> 100644
--- a/salt/state.py
+++ b/salt/state.py
@@ -495,6 +495,7 @@ class State(object):
opts['grains'] = salt.loader.grains(opts)
self.opts = opts
self.opts['pillar'] = self.__gather_pillar()
+ self.state_con = {}
self.load_modules()
self.active = set()
self.mod_init = set()
@@ -530,7 +531,7 @@ class State(object):
Load the modules into the state
'''
log.info('Loading fresh modules for state activity')
- self.functions = salt.loader.minion_mods(self.opts)
+ self.functions = salt.loader.minion_mods(self.opts, self.state_con)
if isinstance(data, dict):
if data.get('provider', False):
provider = {} | Set a context dict for the state run | saltstack_salt | train | py |
8c57890509dcb3c0b89c21682533e1d9eabc89f4 | diff --git a/apidoc/service/parser.py b/apidoc/service/parser.py
index <HASH>..<HASH> 100644
--- a/apidoc/service/parser.py
+++ b/apidoc/service/parser.py
@@ -20,7 +20,7 @@ class Parser():
raise ValueError("Config file \"%s\" undetermined" % file_extension)
if format == "yaml":
- return yaml.load(open(file_path), Loader=yaml.CLoader if yaml.__with_libyaml__ else yaml.Loader)
+ return yaml.safe_load(open(file_path), Loader=yaml.CLoader if yaml.__with_libyaml__ else yaml.Loader)
elif format == "json":
return json.load(open(file_path))
else: | fixes #1 Security issue in yaml.load() | SolutionsCloud_apidoc | train | py |
e93fbaefeb56e1f9ea9f77e8fd59cedda834c504 | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -231,7 +231,11 @@ module.exports = function(grunt) {
},
style: {
files: helper.watchFiles(['.less','.css'],["./app/**/*.css","./app/**/*.less","./assets/**/*.css", "./assets/**/*.less"]),
- tasks: ['less', 'concat:index_css'],
+ tasks: ['clean:watch', 'dependencies','less', 'concat:index_css'],
+ },
+ html: {
+ files: helper.watchFiles(['.html'], []),
+ tasks: ['clean:watch', 'dependencies']
},
options: {
nospawn: true,
@@ -328,7 +332,6 @@ module.exports = function(grunt) {
grunt.config(['jshint', 'all'], filepath);
}
- console.log(filepath);
if (!!filepath.match(/[Ss]pec.js$/)) {
grunt.task.run(['mochaSetup','mocha_phantomjs']);
} | Fauxton: update watch file to run on addon html and less changes | apache_couchdb-fauxton | train | js |
278199f6ea4ec11465e276b3530d350a3c9e6d4d | diff --git a/zengine/views/crud.py b/zengine/views/crud.py
index <HASH>..<HASH> 100644
--- a/zengine/views/crud.py
+++ b/zengine/views/crud.py
@@ -230,6 +230,8 @@ class CrudView(BaseView):
"""
_form = _form or self.object_form
self.output['forms'] = _form.serialize()
+ self.output['forms']['grouping'] = _form.Meta.grouping
+ self.output['forms']['constraints'] = _form.Meta.constraints
self._apply_form_modifiers(self.output['forms'])
self.set_client_cmd('form') | form grouping and constraints injected into output forms | zetaops_zengine | train | py |
e91636fd4407ab91f7ee0e3b6c7046a84c318cc8 | diff --git a/bugwarrior/services/__init__.py b/bugwarrior/services/__init__.py
index <HASH>..<HASH> 100644
--- a/bugwarrior/services/__init__.py
+++ b/bugwarrior/services/__init__.py
@@ -253,6 +253,9 @@ class Issue(object):
self._origin = origin if origin else {}
self._extra = extra if extra else {}
+ def update_extra(self, extra):
+ self._extra.update(extra)
+
def to_taskwarrior(self):
""" Transform a foreign record into a taskwarrior dictionary."""
raise NotImplementedError() | Adding functionality allowing one to update extra post-object-creation. | ralphbean_bugwarrior | train | py |
8b4857da8119532d0156b721b10563f812e91b6d | diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb
index <HASH>..<HASH> 100644
--- a/lib/capybara/session.rb
+++ b/lib/capybara/session.rb
@@ -32,7 +32,7 @@ module Capybara
:has_no_content?, :has_no_css?, :has_no_xpath?, :has_xpath?, :locate, :save_and_open_page, :select, :source, :uncheck,
:visit, :wait_until, :within, :within_fieldset, :within_table, :within_frame, :within_window, :has_link?, :has_no_link?, :has_button?,
:has_no_button?, :has_field?, :has_no_field?, :has_checked_field?, :has_unchecked_field?, :has_no_table?, :has_table?,
- :unselect, :has_select?, :has_no_select?, :current_path, :scope_to, :click
+ :unselect, :has_select?, :has_no_select?, :current_path, :click, :has_selector?, :has_no_selector?
]
attr_reader :mode, :app | Added has_selector and has_no_selector to DSL methods | teamcapybara_capybara | train | rb |
4ec076f65c9ee5134655a2adce1c0678591edc94 | diff --git a/app/openbel/api/routes/datasets.rb b/app/openbel/api/routes/datasets.rb
index <HASH>..<HASH> 100644
--- a/app/openbel/api/routes/datasets.rb
+++ b/app/openbel/api/routes/datasets.rb
@@ -82,6 +82,7 @@ module OpenBEL
end
}
end
+ io.rewind
nanopub = BEL.nanopub(io, type).each.first | rewind after encoding check; #<I> | OpenBEL_openbel-api | train | rb |
c7bcf9b742d36104d35bacb925e7df27c13d5d05 | diff --git a/src/CollapsableMixin.js b/src/CollapsableMixin.js
index <HASH>..<HASH> 100644
--- a/src/CollapsableMixin.js
+++ b/src/CollapsableMixin.js
@@ -94,8 +94,12 @@ var CollapsableMixin = {
var node = this.getCollapsableDOMNode();
if (node) {
- node.style[dimension] = this.isExpanded() ?
- this.getCollapsableDimensionValue() + 'px' : '0px';
+ if(this.props.expanded && !this.state.collapsing) {
+ node.style[dimension] = 'auto';
+ } else {
+ node.style[dimension] = this.isExpanded() ?
+ this.getCollapsableDimensionValue() + 'px' : '0px';
+ }
}
}, | Fixed CollapsableMixin to set dimension css style to 'auto' when the transition to the expanded state is complete. | react-bootstrap_react-bootstrap | train | js |
6d6155457705bc55a5259f029f176d7c32b70ddf | diff --git a/organizations/__init__.py b/organizations/__init__.py
index <HASH>..<HASH> 100644
--- a/organizations/__init__.py
+++ b/organizations/__init__.py
@@ -1,4 +1,4 @@
"""
edx-organizations app initialization module
"""
-__version__ = '1.0.1' # pragma: no cover
+__version__ = '2.0.1' # pragma: no cover | Prepare for a package release.
Doing this as a major version upgrade because we were previously pinning
the djangorestframework library. If upstream projects were relying on
us pinning it to stick to a specific version, our change might break
them. | edx_edx-organizations | train | py |
14dc081e69e18e927cbc53d08647e2cf4bba40db | diff --git a/static/course/scripts/course.js b/static/course/scripts/course.js
index <HASH>..<HASH> 100644
--- a/static/course/scripts/course.js
+++ b/static/course/scripts/course.js
@@ -36,7 +36,7 @@ function addResults()
$("a.show_results").toggle();
$("a.hide_results").toggle();
- expected.slideToggle("normal");
+ expected.fadeToggle("slow");
});
return expected; | * Use fade, it's more bling. | postmodern_spidr | train | js |
6202907fa47eb1e5624f4711023eed61497da735 | diff --git a/aws/data_source_aws_instance.go b/aws/data_source_aws_instance.go
index <HASH>..<HASH> 100644
--- a/aws/data_source_aws_instance.go
+++ b/aws/data_source_aws_instance.go
@@ -208,7 +208,7 @@ func dataSourceAwsInstance() *schema.Resource {
Computed: true,
},
- "tags": tagsSchema(),
+ "tags": tagsSchemaComputed(),
"throughput": {
Type: schema.TypeInt,
@@ -270,7 +270,7 @@ func dataSourceAwsInstance() *schema.Resource {
Computed: true,
},
- "tags": tagsSchema(),
+ "tags": tagsSchemaComputed(),
"throughput": {
Type: schema.TypeInt, | data source/instance: Fix tags to be computed | terraform-providers_terraform-provider-aws | train | go |
85a131dd1dd6f17545d4f874851da1d4932820ef | diff --git a/lib/acme/client/self_sign_certificate.rb b/lib/acme/client/self_sign_certificate.rb
index <HASH>..<HASH> 100644
--- a/lib/acme/client/self_sign_certificate.rb
+++ b/lib/acme/client/self_sign_certificate.rb
@@ -48,6 +48,7 @@ class Acme::Client::SelfSignCertificate
certificate.not_after = not_after
certificate.public_key = private_key.public_key
certificate.version = 2
+ certificate.serial = 1
certificate
end
diff --git a/spec/self_sign_certificate_spec.rb b/spec/self_sign_certificate_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/self_sign_certificate_spec.rb
+++ b/spec/self_sign_certificate_spec.rb
@@ -19,4 +19,10 @@ describe Acme::Client::SelfSignCertificate do
self_sign_certificate = Acme::Client::SelfSignCertificate.new(private_key: private_key, subject_alt_names: ['test.example.org'])
expect(self_sign_certificate.certificate.version).to eql(2)
end
+
+ it 'sets the certificates serial number' do
+ private_key = generate_private_key
+ self_sign_certificate = Acme::Client::SelfSignCertificate.new(private_key: private_key, subject_alt_names: ['test.example.org'])
+ expect(self_sign_certificate.certificate.serial).to eql(1)
+ end
end | Set serial number of self-signed certificate | unixcharles_acme-client | train | rb,rb |
08cef3f84d341736c15e77ce2700f1001ca998a2 | diff --git a/parsl/version.py b/parsl/version.py
index <HASH>..<HASH> 100644
--- a/parsl/version.py
+++ b/parsl/version.py
@@ -1 +1 @@
-VERSION = '0.2.0'
+VERSION = '0.2.1' | Bumping up bug revision, following addition of property filename | Parsl_parsl | train | py |
d6fffbe7bb6b54821912ea2278e2252e6fc2b009 | diff --git a/react.go b/react.go
index <HASH>..<HASH> 100644
--- a/react.go
+++ b/react.go
@@ -109,6 +109,11 @@ func FlatIdentity() *FlatReactor {
return FlatReactive(IdentityMuxer())
}
+// FlatSimple returns a reactor using the SimpleMuxer as a mux generator
+func FlatSimple(fx func(Reactor, interface{})) Reactor {
+ return Reactive(SimpleMuxer(fx))
+}
+
// FlatAlways returns a reactor with consistently returns the provided value
func FlatAlways(v interface{}) Reactor {
return FlatReactive(IdentityValueMuxer(v)) | completed channelstream api: added FlatSimple | influx6_flux | train | go |
ef2d722196d63d0890d2e92d0543a3c6f96ed491 | diff --git a/mousedb/data/models.py b/mousedb/data/models.py
index <HASH>..<HASH> 100644
--- a/mousedb/data/models.py
+++ b/mousedb/data/models.py
@@ -4,11 +4,6 @@ from django.template.defaultfilters import slugify
from mousedb.animal.models import Animal, Strain
from mousedb.custom_fields import CommaSeparatedFloatField
-FEEDING_TYPES = (
- ('fed', 'Fed'),
- ('fasted', 'Fasted')
-)
-
INJECTIONS = (
('Insulin', 'Insulin'),
('Glucose', 'Glucose'),
@@ -33,6 +28,12 @@ class Experiment(models.Model):
The optional fields are notes, time, experimentID, fasting_time, injection and concentration and the :class:`~experimentdb.data.models.Study`.
"""
+ FEEDING_TYPES = (
+ ('fed', 'Fed'),
+ ('fasted', 'Fasted'),
+ ('refed', 'Re-Fed')
+ )
+
date = models.DateField()
notes = models.TextField(max_length = 500, blank=True)
time = models.TimeField(help_text="Time of the experiment in 24h format", blank=True, null=True) | Added refed to feeding state types. Moved it into the Experiment, rather than a module level list. | davebridges_mousedb | train | py |
4b7ae0d1f6639c0fe5feee1a58436c30739b1e0c | diff --git a/sprd/model/Product.js b/sprd/model/Product.js
index <HASH>..<HASH> 100644
--- a/sprd/model/Product.js
+++ b/sprd/model/Product.js
@@ -115,7 +115,9 @@ define(['sprd/model/ProductBase', 'js/core/List', 'sprd/data/ConfigurationTypeRe
}, this);
this.bind('configurations', 'item:change:offset', this._onConfigurationOffsetChanged, this);
-
+ this.bind('change:productType', function() {
+ this.configurationsOnViewCache = {};
+ }, this)
},
getDefaultAppearance: function () { | [DEV-<I>] Sketchomat does not show configuration errors after changing the product type | spreadshirt_rAppid.js-sprd | train | js |
8dda04856fa0ec061a922ae13108916b4a52b912 | diff --git a/tests/spec/CollectionSpec.php b/tests/spec/CollectionSpec.php
index <HASH>..<HASH> 100644
--- a/tests/spec/CollectionSpec.php
+++ b/tests/spec/CollectionSpec.php
@@ -91,6 +91,34 @@ class CollectionSpec extends ObjectBehavior
$this->take(2)->toArray()->shouldReturn([1, 1]);
}
+ function it_can_convert_to_array()
+ {
+ $iterator = new \ArrayIterator([
+ 'foo',
+ ]);
+
+ $this->beConstructedWith(function () use ($iterator) {
+ yield 'no key';
+ yield 'with key' => 'this value is overwritten by the same key';
+ yield 'nested' => [
+ 'y' => 'z',
+ ];
+ yield 'iterator is not converted' => $iterator;
+ yield 'with key' => 'x';
+ });
+
+ $this
+ ->toArray()
+ ->shouldReturn([
+ 'no key',
+ 'with key' => 'x',
+ 'nested' => [
+ 'y' => 'z',
+ ],
+ 'iterator is not converted' => $iterator,
+ ]);
+ }
+
function it_can_filter()
{
$this->beConstructedWith([1, 3, 3, 2,]); | Add test case for toArray() before refactor | DusanKasan_Knapsack | train | php |
68d8050cb8d8563cd3a33813826fdc18825180b7 | diff --git a/salt/beacons/diskusage.py b/salt/beacons/diskusage.py
index <HASH>..<HASH> 100644
--- a/salt/beacons/diskusage.py
+++ b/salt/beacons/diskusage.py
@@ -61,9 +61,9 @@ def beacon(config):
- /: 63%
- /mnt/nfs: 50%
'''
+ print(config)
ret = []
- for diskusage in config:
- mount = diskusage.keys()[0]
+ for mount in config:
try:
_current_usage = psutil.disk_usage(mount)
@@ -73,7 +73,7 @@ def beacon(config):
continue
current_usage = _current_usage.percent
- monitor_usage = diskusage[mount]
+ monitor_usage = config[mount]
if '%' in monitor_usage:
monitor_usage = re.sub('%', '', monitor_usage)
monitor_usage = float(monitor_usage) | Fix diskusage beacon
The examples given in the config did not match the code.
Adjusted code to line up with examples. | saltstack_salt | train | py |
3fb10d3b7d5ac2ac1dcb23676beeaceddc18f8a6 | diff --git a/HARK/ConsumptionSaving/ConsRiskyAssetModel.py b/HARK/ConsumptionSaving/ConsRiskyAssetModel.py
index <HASH>..<HASH> 100644
--- a/HARK/ConsumptionSaving/ConsRiskyAssetModel.py
+++ b/HARK/ConsumptionSaving/ConsRiskyAssetModel.py
@@ -1160,7 +1160,9 @@ class RiskyContribConsumerType(RiskyAssetConsumerType):
)
# Store controls as attributes of self
- self.cNrmNow = cNrmNow
+ # Since agents might be willing to end the period with a = 0, make
+ # sure consumption does not go over m because of some numerical error.
+ self.cNrmNow = np.minimum(cNrmNow,self.mNrmTildeNow)
def getPostStatesCons(self):
""" | Explicitly bound consumption in simulation | econ-ark_HARK | train | py |
34e74e49f8eba8b2401dd1577cf78450458d635a | diff --git a/examples/gan/dcgan.py b/examples/gan/dcgan.py
index <HASH>..<HASH> 100644
--- a/examples/gan/dcgan.py
+++ b/examples/gan/dcgan.py
@@ -308,8 +308,11 @@ def main(dataset, dataroot,
# attach running average metrics
monitoring_metrics = ['errD', 'errG', 'D_x', 'D_G_z1', 'D_G_z2']
- for metric in monitoring_metrics:
- RunningAverage(alpha=alpha, output_transform=lambda x: x[metric]).attach(trainer, metric)
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['errD']).attach(trainer, 'errD')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['errG']).attach(trainer, 'errG')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['D_x']).attach(trainer, 'D_x')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['D_G_z1']).attach(trainer, 'D_G_z1')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['D_G_z2']).attach(trainer, 'D_G_z2')
# attach progress bar
pbar = ProgressBar() | fix logging in dcgan example (#<I>) | pytorch_ignite | train | py |
44d2ebb5fcadb3fb7414c6388ac67366fa6eea32 | diff --git a/simplify.js b/simplify.js
index <HASH>..<HASH> 100644
--- a/simplify.js
+++ b/simplify.js
@@ -63,9 +63,7 @@ function simplifyRadialDist(points, sqTolerance) {
}
}
- if (prevPoint !== point) {
- newPoints.push(point);
- }
+ if (prevPoint !== point) newPoints.push(point);
return newPoints;
}
@@ -107,9 +105,7 @@ function simplifyDouglasPeucker(points, sqTolerance) {
}
for (i = 0; i < len; i++) {
- if (markers[i]) {
- newPoints.push(points[i]);
- }
+ if (markers[i]) newPoints.push(points[i]);
}
return newPoints;
@@ -127,14 +123,8 @@ function simplify(points, tolerance, highestQuality) {
}
// export as AMD module / Node module / browser variable
-if (typeof define === 'function' && define.amd) {
- define(function() {
- return simplify;
- });
-} else if (typeof module !== 'undefined') {
- module.exports = simplify;
-} else {
- window.simplify = simplify;
-}
+if (typeof define === 'function' && define.amd) define(function() { return simplify; });
+else if (typeof module !== 'undefined') module.exports = simplify;
+else window.simplify = simplify;
})(); | drop brackets for single-line blocks | mourner_simplify-js | train | js |
3af092c62cd54ffa7dcfd1cb3e202796207d12e9 | diff --git a/glue/LSCsegFindServer.py b/glue/LSCsegFindServer.py
index <HASH>..<HASH> 100644
--- a/glue/LSCsegFindServer.py
+++ b/glue/LSCsegFindServer.py
@@ -230,7 +230,10 @@ class ServerHandler(SocketServer.BaseRequestHandler):
result = ""
for x in res:
- result += ' '.join(x).strip() + '\n'
+ if type(x) is types.stringType:
+ result += x.strip() + '\n'
+ else:
+ result += str(x) + '\n'
result = result.rstrip() | better parsing of DISTINCT results | gwastro_pycbc-glue | train | py |
98d42a0d2ef2a50bc70dee93bffd8965389b0ae4 | diff --git a/psiturk/dashboard/__init__.py b/psiturk/dashboard/__init__.py
index <HASH>..<HASH> 100644
--- a/psiturk/dashboard/__init__.py
+++ b/psiturk/dashboard/__init__.py
@@ -1,4 +1,4 @@
-from flask import Blueprint, render_template, request, jsonify, Response, abort, current_app, flash, session, g, redirect, url_for, make_response
+from flask import Blueprint, render_template, request, jsonify, Response, abort, current_app as app, flash, session, g, redirect, url_for, make_response
from flask_login import UserMixin, login_user, logout_user, current_user
from jinja2 import TemplateNotFound
from functools import wraps | dashboard needs `as app` | NYUCCL_psiTurk | train | py |
6fa4ab39007952f92d7803b367c6c36942ca4d35 | diff --git a/src/ComPHPPuebla/Doctrine/TableGateway/Table.php b/src/ComPHPPuebla/Doctrine/TableGateway/Table.php
index <HASH>..<HASH> 100644
--- a/src/ComPHPPuebla/Doctrine/TableGateway/Table.php
+++ b/src/ComPHPPuebla/Doctrine/TableGateway/Table.php
@@ -64,17 +64,6 @@ abstract class Table
}
/**
- * @param array $values
- * @return int The value of the last inserted ID
- */
- protected function insert(array $values)
- {
- $this->connection->insert($this->tableName, $values);
-
- return $this->connection->lastInsertId();
- }
-
- /**
* @param array $values
* @param array $identifier
*/
@@ -114,6 +103,17 @@ abstract class Table
}
/**
+ * @param array $values
+ * @return int The value of the last inserted ID
+ */
+ public function insert(array $values)
+ {
+ $this->connection->insert($this->tableName, $values);
+
+ return $this->connection->lastInsertId();
+ }
+
+ /**
* @param array $criteria
* @return QueryBuilder
*/ | Fixed visibility in TableGateway::insert | ComPHPPuebla_restful-extensions | train | php |
44c30cf5043b4350fa7f3dcc69c7293d3c2dc5b4 | diff --git a/law/target/file.py b/law/target/file.py
index <HASH>..<HASH> 100644
--- a/law/target/file.py
+++ b/law/target/file.py
@@ -174,6 +174,13 @@ class FileSystemTarget(Target, luigi.target.FileSystemTarget):
args, kwargs = self._parent_args()
return self.directory_class(dirname, *args, **kwargs) if dirname is not None else None
+ def sibling(self, *args, **kwargs):
+ parent = self.parent
+ if not parent:
+ raise Exception("cannot determine file parent")
+
+ return parent.child(*args, **kwargs)
+
@property
def stat(self):
return self.fs.stat(self.path) | Add sibling method to FileSystemTarget's. | riga_law | train | py |
5d25a58a1a5b6e3dd3375db9cc51ad3ed48665b2 | diff --git a/lxd/fsmonitor/drivers/errors.go b/lxd/fsmonitor/drivers/errors.go
index <HASH>..<HASH> 100644
--- a/lxd/fsmonitor/drivers/errors.go
+++ b/lxd/fsmonitor/drivers/errors.go
@@ -4,9 +4,6 @@ import (
"fmt"
)
-// ErrNotImplemented is the "Not implemented" error.
-var ErrNotImplemented = fmt.Errorf("Not implemented")
-
// ErrInvalidFunction is the "Invalid function" error.
var ErrInvalidFunction = fmt.Errorf("Invalid function") | lxd/fsmonitor/drivers/errors: Removes unused variable ErrNotImplemented | lxc_lxd | train | go |
02bfb47f03a7075f012070e8ff122958fd29f8f4 | diff --git a/min/lib/Minify/ImportProcessor.php b/min/lib/Minify/ImportProcessor.php
index <HASH>..<HASH> 100644
--- a/min/lib/Minify/ImportProcessor.php
+++ b/min/lib/Minify/ImportProcessor.php
@@ -41,7 +41,11 @@ class Minify_ImportProcessor {
private static $_isCss = null;
- private function __construct($currentDir, $previewsDir)
+ /**
+ * @param String $currentDir
+ * @param String $previewsDir Is only used internally
+ */
+ private function __construct($currentDir, $previewsDir = "")
{
$this->_currentDir = $currentDir;
$this->_previewsDir = $previewsDir; | ImportProcessor: The previews-directory set in the constructor is marked as optional because it should only be used by internal calls. Added PHP-Doc for the constructor. | mrclay_jsmin-php | train | php |
44ec3a151c37e2e15a25c82973f8cd31d70def8c | diff --git a/test/less-test.js b/test/less-test.js
index <HASH>..<HASH> 100644
--- a/test/less-test.js
+++ b/test/less-test.js
@@ -30,6 +30,14 @@ fs.readdirSync('test/less').forEach(function (file) {
sys.print(stylize("ERROR: " + (err && err.message), 'red'));
} else {
sys.print(stylize("FAIL", 'yellow'));
+
+ require('diff').diffLines(css, less).forEach(function(item) {
+ if(item.added || item.removed) {
+ sys.print(stylize(item.value, item.added ? 'green' : 'red'));
+ } else {
+ sys.print(item.value);
+ }
+ })
}
sys.puts("");
}); | use diff in less-test.js to display more info on test failures | less_less.js | train | js |
93a765eacf561ab8334a4b125a65842219ce9cab | diff --git a/src/bootstrap-table.js b/src/bootstrap-table.js
index <HASH>..<HASH> 100644
--- a/src/bootstrap-table.js
+++ b/src/bootstrap-table.js
@@ -913,7 +913,10 @@ class BootstrapTable {
return
}
- if (currentTarget === Utils.getSearchInput(this)[0] || $(currentTarget).hasClass('search-input')) {
+ const $searchInput = Utils.getSearchInput(this)
+ const $currentTarget = currentTarget instanceof jQuery ? currentTarget : $(currentTarget)
+
+ if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) {
this.searchText = text
this.options.searchText = text
} | fix/<I> (#<I>)
* Check if the current target is a jQuery Object to check if the elements
are equals
* use a const for the search input
* improved the check if the search element is a jquery Object | wenzhixin_bootstrap-table | train | js |
f0f645a9d766c9e180a8cc771cb4593d7d58a116 | diff --git a/src/com/opencms/defaults/A_CmsBackoffice.java b/src/com/opencms/defaults/A_CmsBackoffice.java
index <HASH>..<HASH> 100644
--- a/src/com/opencms/defaults/A_CmsBackoffice.java
+++ b/src/com/opencms/defaults/A_CmsBackoffice.java
@@ -1,7 +1,7 @@
/*
* File : $Source: /alkacon/cvs/opencms/src/com/opencms/defaults/Attic/A_CmsBackoffice.java,v $
-* Date : $Date: 2004/07/18 16:27:12 $
-* Version: $Revision: 1.89 $
+* Date : $Date: 2004/09/08 10:23:29 $
+* Version: $Revision: 1.90 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
@@ -74,7 +74,7 @@ import java.util.Vector;
*
* @author Michael Knoll
* @author Michael Emmerich
- * @version $Revision: 1.89 $
+ * @version $Revision: 1.90 $
*
* @deprecated Will not be supported past the OpenCms 6 release.
*/
@@ -2094,7 +2094,7 @@ public abstract class A_CmsBackoffice extends CmsWorkplaceDefault {
// now check if the "do you really want to lock" dialog should be shown.
CmsUserSettings settings = new CmsUserSettings(cms.getRequestContext().currentUser());
- if (settings.getDialogShowLock()) {
+ if (!settings.getDialogShowLock()) {
parameters.put("action", "go");
} | Bugfix for lock dialogs in abstract backoffice, it now uses the correct user settings | alkacon_opencms-core | train | java |
c245aaf4387a86a81fd3f97e745e7613e2fb989c | diff --git a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
index <HASH>..<HASH> 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
@@ -50,6 +50,7 @@ import org.sonar.core.measure.MeasureFilterExecutor;
import org.sonar.core.measure.MeasureFilterFactory;
import org.sonar.core.metric.DefaultMetricFinder;
import org.sonar.core.notification.DefaultNotificationManager;
+import org.sonar.core.permission.ComponentPermissionFacade;
import org.sonar.core.persistence.*;
import org.sonar.core.purge.PurgeProfiler;
import org.sonar.core.qualitymodel.DefaultModelFinder;
@@ -257,6 +258,7 @@ public final class Platform {
servicesContainer.addSingleton(NewUserNotifier.class);
servicesContainer.addSingleton(DefaultUserFinder.class);
servicesContainer.addSingleton(DefaultUserService.class);
+ servicesContainer.addSingleton(ComponentPermissionFacade.class);
servicesContainer.addSingleton(InternalPermissionService.class);
servicesContainer.addSingleton(InternalPermissionTemplateService.class); | SONAR-<I> Apply permission template to a list of resources in the internal permission service | SonarSource_sonarqube | train | java |
120cd969360bd5c0fbab69369a915811f22db38f | diff --git a/mutant/tests/runners.py b/mutant/tests/runners.py
index <HASH>..<HASH> 100644
--- a/mutant/tests/runners.py
+++ b/mutant/tests/runners.py
@@ -35,7 +35,7 @@ class MutantTestSuiteRunner(DiscoverRunner):
if not test_labels:
test_labels = [
"%s.tests" % app for app in settings.INSTALLED_APPS
- if app.startswith('mutant') or app in ('south', 'polymodels')
+ if app.startswith('mutant')
]
return super(MutantTestSuiteRunner, self).build_suite(
test_labels, extra_tests=None, **kwargs | Avoid running South and polymodels tests. | charettes_django-mutant | train | py |
0bab90779e065b8e35bfb153a878fc37b6c262b1 | diff --git a/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorIntrospector.java b/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorIntrospector.java
index <HASH>..<HASH> 100644
--- a/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorIntrospector.java
+++ b/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorIntrospector.java
@@ -32,14 +32,12 @@ public class PersistentExecutorIntrospector implements Introspector {
@Override
@Trivial
public String getIntrospectorName() {
- System.out.println("getIntrospectorName");
return "PersistentExecutorIntrospector";
}
@Override
@Trivial
public String getIntrospectorDescription() {
- System.out.println("getIntrospectorDescription");
return "Persistent timers/tasks diagnostics";
} | Issue #<I> code review fixes | OpenLiberty_open-liberty | train | java |
c6928b5c6e8354ca1dedfa5d5d49a1ad5b4517c4 | diff --git a/discovery/dns/dns_test.go b/discovery/dns/dns_test.go
index <HASH>..<HASH> 100644
--- a/discovery/dns/dns_test.go
+++ b/discovery/dns/dns_test.go
@@ -252,7 +252,7 @@ func TestSDConfigUnmarshalYAML(t *testing.T) {
expectErr: true,
},
{
- name: "invalid unkown dns type",
+ name: "invalid unknown dns type",
input: SDConfig{
Names: []string{"a.example.com", "b.example.com"},
Type: "PTR", | fix-up typo unkown->unknown (#<I>) | prometheus_prometheus | train | go |
42a77b94e545de14d9f2d5fa2fcd1c88977d154a | diff --git a/lib/arjdbc/jdbc/adapter.rb b/lib/arjdbc/jdbc/adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/arjdbc/jdbc/adapter.rb
+++ b/lib/arjdbc/jdbc/adapter.rb
@@ -99,7 +99,7 @@ module ActiveRecord
visitor = nil
arel2_visitors.each do |k,v|
visitor = v
- visitors[k] = v unless visitors.has_key?(k)
+ visitors[k] = v
end
if visitor && config[:adapter] =~ /^(jdbc|jndi)$/
visitors[config[:adapter]] = visitor | Allow configure_arel2_visitors to override previous visitor for a
given key | jruby_activerecord-jdbc-adapter | train | rb |
da96589d005dfb9c3b79710b84cd4867e4e55f96 | diff --git a/asv/commands/profiling.py b/asv/commands/profiling.py
index <HASH>..<HASH> 100644
--- a/asv/commands/profiling.py
+++ b/asv/commands/profiling.py
@@ -223,5 +223,5 @@ class Profile(Command):
else:
with temp_profile(profile_data) as profile_path:
stats = pstats.Stats(profile_path)
- stats.sort_stats('cumtime')
+ stats.sort_stats('cumulative')
stats.print_stats() | Fix profiling on Python <I>
The 'cumtime' sort order is available only for Python >= <I>, the alias
'cumulative' works for all versions. | airspeed-velocity_asv | train | py |
96d7204639c3b5706858c431f5780c5d3c9e1b7a | diff --git a/db/Connection.php b/db/Connection.php
index <HASH>..<HASH> 100644
--- a/db/Connection.php
+++ b/db/Connection.php
@@ -94,7 +94,7 @@ class Connection extends \yii\db\Connection
* @param \yii\base\Object $object
* @return bool|int|string
*/
- protected function getComponentId(\yii\base\Object $object)
+ protected function getComponentId($object)
{
/** @var Application $app */
$app = Yii::$app->getApplication(); | fix rm Object in php7 | deepziyu_yii2-swoole | train | php |
f3201baeb5eb97f129ad1e6c78875a67d09d2465 | diff --git a/pkg/backend/local/display.go b/pkg/backend/local/display.go
index <HASH>..<HASH> 100644
--- a/pkg/backend/local/display.go
+++ b/pkg/backend/local/display.go
@@ -269,7 +269,7 @@ func renderResourcePreEvent(
indent := engine.GetIndent(payload.Metadata, seen)
summary := engine.GetResourcePropertiesSummary(payload.Metadata, indent)
details := engine.GetResourcePropertiesDetails(
- payload.Metadata, indent, opts.SummaryDiff, payload.Planning, payload.Debug)
+ payload.Metadata, indent, payload.Planning, opts.SummaryDiff, payload.Debug)
fprintIgnoreError(out, opts.Color.Colorize(summary))
fprintIgnoreError(out, opts.Color.Colorize(details)) | Fix {computed,output}<> display in preview. (#<I>)
At some point the summary and preview parameters to
`engine.GetResourcePropertiesDetails` were flipped s.t. we stopped
rendering computed<> and output<> values properly during previews. | pulumi_pulumi | train | go |
f3b0268472167f5b0cc3245323be4414d5fa9349 | diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py
index <HASH>..<HASH> 100644
--- a/alot/widgets/thread.py
+++ b/alot/widgets/thread.py
@@ -7,7 +7,7 @@ Widgets specific to thread mode
import logging
import urwid
-from urwidtrees import Tree, SimpleTree, CollapsibleTree
+from urwidtrees import Tree, SimpleTree, CollapsibleTree, ArrowTree
from .ansi import ANSIText
from .globals import TagWidget
@@ -324,9 +324,10 @@ class MessageTree(CollapsibleTree):
def _get_mimetree(self):
if self._mimetree is None:
- mime_tree_txt = self._message.get_mime_tree()
- mime_tree_widgets = self._text_tree_to_widget_tree(mime_tree_txt)
- self._mimetree = SimpleTree([mime_tree_widgets])
+ tree = self._message.get_mime_tree()
+ tree = self._text_tree_to_widget_tree(tree)
+ tree = SimpleTree([tree])
+ self._mimetree = ArrowTree(tree)
return self._mimetree
def _text_tree_to_widget_tree(self, tree): | Use ArrowTree to indent mime tree | pazz_alot | train | py |
f88a2a9c73633e9662791cd73d37b97fb8119dda | diff --git a/jupytext/jupytext.py b/jupytext/jupytext.py
index <HASH>..<HASH> 100644
--- a/jupytext/jupytext.py
+++ b/jupytext/jupytext.py
@@ -77,11 +77,13 @@ class TextNotebookReader(NotebookReader):
set_main_and_cell_language(metadata, cells, self.ext)
- if 'nbrmd_formats' in metadata:
- metadata['jupytext_formats'] = metadata.pop('nbrmd_formats')
+ # Backward compatibility with nbrmd
+ for key in ['nbrmd_formats', 'nbrmd_format_version']:
+ if key in metadata:
+ metadata[key.replace('nbrmd', 'jupytext')] = \
+ metadata.pop(key)
- notebook = new_notebook(cells=cells, metadata=metadata)
- return notebook
+ return new_notebook(cells=cells, metadata=metadata)
class TextNotebookWriter(NotebookWriter): | Improve backward compatibility with nbrmd | mwouts_jupytext | train | py |
9fd8fcecf260a6076dbd989e93d56ba9af537b1a | diff --git a/python/herald/transports/xmpp/bot.py b/python/herald/transports/xmpp/bot.py
index <HASH>..<HASH> 100644
--- a/python/herald/transports/xmpp/bot.py
+++ b/python/herald/transports/xmpp/bot.py
@@ -108,7 +108,7 @@ class HeraldBot(pelixmpp.BasicBot, pelixmpp.InviteMixIn):
groups_str = ",".join(str(group)
for group in groups if group) if groups else ""
msg = beans.Message("boostrap.invite",
- ":".join(("invite", key, groups_str)))
+ ":".join(("invite", str(key or ''), groups_str)))
self.__send_message("chat", monitor_jid, msg)
def __send_message(self, msgtype, target, message, body=None): | Monitor Bot: Convert non-str keys to str when using join()
string.join() only accept strings... | cohorte_cohorte-herald | train | py |
cf277e50c935ccfd07f3717b60aaf90d3e0e3f36 | diff --git a/varlens/evaluation.py b/varlens/evaluation.py
index <HASH>..<HASH> 100644
--- a/varlens/evaluation.py
+++ b/varlens/evaluation.py
@@ -77,8 +77,10 @@ class EvaluationEnvironment(object):
def __getitem__(self, key):
for wrapped in self._wrapped_list:
- if hasattr(wrapped, key):
+ try:
return getattr(wrapped, key)
+ except AttributeError:
+ pass
if key in self._extra:
return self._extra[key]
raise KeyError("No key: %s" % key) | Fix bug in evaluation.py for certain python versions where hasattr does not detect properties | openvax_varlens | train | py |
2538c7283f565422565db08f98c37099e40b2798 | diff --git a/test/gir_ffi/builders/struct_builder_test.rb b/test/gir_ffi/builders/struct_builder_test.rb
index <HASH>..<HASH> 100644
--- a/test/gir_ffi/builders/struct_builder_test.rb
+++ b/test/gir_ffi/builders/struct_builder_test.rb
@@ -74,11 +74,19 @@ describe GirFFI::Builders::StructBuilder do
end
describe '#setup_class' do
+ before do
+ save_module :Regress
+ end
+
it 'stubs the structs methods' do
info = get_introspection_data 'Regress', 'TestStructA'
builder = GirFFI::Builders::StructBuilder.new info
builder.setup_class
Regress::TestStructA.instance_methods(false).must_include :clone
end
+
+ after do
+ restore_module :Regress
+ end
end
end | Avoid constant redefinition warnings in test | mvz_gir_ffi | train | rb |
f658feded488343a5457d38cd9bc146ced182641 | diff --git a/test/test-occurrences-download_request.py b/test/test-occurrences-download_request.py
index <HASH>..<HASH> 100644
--- a/test/test-occurrences-download_request.py
+++ b/test/test-occurrences-download_request.py
@@ -24,7 +24,7 @@ class TestGbifClass(unittest.TestCase):
req = GbifDownload("name", "email")
self.assertIsInstance(req.payload, dict)
- self.assertDictEqual(req.payload, {'created': 2016, 'creator': 'name',
+ self.assertDictEqual(req.payload, {'created': 2017, 'creator': 'name',
'notification_address': ['email'],
'predicate': {'predicates': [],
'type': 'and'},
@@ -36,7 +36,7 @@ class TestGbifClass(unittest.TestCase):
req = GbifDownload("name", "email")
req.main_pred_type = "or"
self.assertIsInstance(req.payload, dict)
- self.assertDictEqual(req.payload, {'created': 2016, 'creator': 'name',
+ self.assertDictEqual(req.payload, {'created': 2017, 'creator': 'name',
'notification_address': ['email'],
'predicate': {'predicates': [],
'type': 'or'}, | minor tweak to expectations for two tests for downloads predicates | sckott_pygbif | train | py |
4d16c8c34163b19416f949c3ad081883c8deb05a | diff --git a/docs/source/conf.py b/docs/source/conf.py
index <HASH>..<HASH> 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -43,7 +43,7 @@ extensions = [
#'matplotlib.sphinxext.ipython_directive',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
- 'sphinx.ext.pngmath',
+ #'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
'sphinx.ext.graphviz',
'sphinx.ext.inheritance_diagram',
@@ -263,7 +263,7 @@ latex_elements = {
'papersize': 'a4paper',
# overwrite printindex -> no index
-'printindex': '',
+'printindex': '',
# The font size ('10pt', '11pt' or '12pt'). | Use sphinx.ext.mathjax only for math support and remove sphinx.ext.pngmath which is deprecated. | brian-rose_climlab | train | py |
cc1cd80b1bfdf3368c4d5411c83fbdb0b8a24bcb | diff --git a/src/S3StreamWrapper/S3StreamWrapper.php b/src/S3StreamWrapper/S3StreamWrapper.php
index <HASH>..<HASH> 100644
--- a/src/S3StreamWrapper/S3StreamWrapper.php
+++ b/src/S3StreamWrapper/S3StreamWrapper.php
@@ -7,6 +7,7 @@
*/
namespace S3StreamWrapper;
+use Aws\S3\Exception\NoSuchKeyException;
use Aws\S3\S3Client;
use Guzzle\Http\EntityBody;
use Guzzle\Http\EntityBodyInterface;
@@ -422,10 +423,7 @@ class S3StreamWrapper
if($this->data === null) {
return false;
}
- var_dump($count, $this->data);
-
- var_dump($result = $this->data->read($count));
- return $result;
+ return $this->data->read($count);
}
/**
@@ -531,6 +529,13 @@ class S3StreamWrapper
$client = $this->getClient();
- $client->headObject($options);
+ try {
+ /** @var $response Model */
+ $response = $client->headObject($options);
+
+ return $response->toArray();
+ } catch(NoSuchKeyException $e) {
+ return false;
+ }
}
}
\ No newline at end of file | Made stat work with nonexistant files and removed some debug code | gwkunze_S3StreamWrapper | train | php |
d013ec36420c2eb482f9b5bc831d73cfc4509525 | diff --git a/src/EntityManagerFactory.php b/src/EntityManagerFactory.php
index <HASH>..<HASH> 100644
--- a/src/EntityManagerFactory.php
+++ b/src/EntityManagerFactory.php
@@ -2,7 +2,6 @@
namespace LaravelDoctrine\ORM;
-use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\Cache;
use Doctrine\ORM\Cache\DefaultCacheFactory;
use Doctrine\ORM\Configuration; | Apply fixes from StyleCI (#<I>) | laravel-doctrine_orm | train | php |
cd7dbee3d6d8a1d34b115b6b250a509126b3bca5 | diff --git a/provision/docker/actions_test.go b/provision/docker/actions_test.go
index <HASH>..<HASH> 100644
--- a/provision/docker/actions_test.go
+++ b/provision/docker/actions_test.go
@@ -342,7 +342,7 @@ func (s *S) TestProvisionAddUnitsToHostForward(c *gocheck.C) {
err = newImage("tsuru/python", s.server.URL())
c.Assert(err, gocheck.IsNil)
var p dockerProvisioner
- app := testing.NewFakeApp("myapp", "python", 0)
+ app := testing.NewFakeApp("myapp-2", "python", 0)
defer p.Destroy(app)
p.Provision(app)
coll := collection() | provision/docker: Using another app name to avoid conflict in tests | tsuru_tsuru | train | go |
d37dc7b4e3f1e37bc06f9ab4c8a153908337e37d | diff --git a/dimod/package_info.py b/dimod/package_info.py
index <HASH>..<HASH> 100644
--- a/dimod/package_info.py
+++ b/dimod/package_info.py
@@ -14,7 +14,7 @@
#
# ================================================================================================
-__version__ = '0.9.3'
+__version__ = '0.9.4'
__author__ = 'D-Wave Systems Inc.'
__authoremail__ = 'acondello@dwavesys.com'
__description__ = 'A shared API for binary quadratic model samplers.' | Update version <I> -> <I>
New Features
------------
* `assert_consistent_bqm` to `dimod.testing` for testing different BQM implementations
* Testing is now done with parameterized package - this does not affect installed packages
* FileView version <I> with improved docs | dwavesystems_dimod | train | py |
c97d9cbf0e8853a52070283ddf413f3cd43c49a8 | diff --git a/txcouchbase/tests/test_ops.py b/txcouchbase/tests/test_ops.py
index <HASH>..<HASH> 100644
--- a/txcouchbase/tests/test_ops.py
+++ b/txcouchbase/tests/test_ops.py
@@ -106,7 +106,7 @@ class OperationTestCase(gen_base(ConnectionTestCase)):
res_fail = err.value.result
self.assertFalse(res_fail.success)
- self.assertEqual(NotFoundError.rc_to_exctype(res.rc), NotFoundError)
+ self.assertEqual(NotFoundError.rc_to_exctype(res_fail.rc), NotFoundError)
d.addErrback(t)
return d | txcouchbase test_ops: Check res_fail rather than res
This somehow accidentally worked in previous runs, because often
res_fail is res
Change-Id: Ieb7da<I>bec<I>c<I>eee<I>d<I>e<I>a<I>
Reviewed-on: <URL> | couchbase_couchbase-python-client | train | py |
1549da2546576e4556e28dcbdce1cf6f28fcf0d3 | diff --git a/ignite/contrib/handlers/base_logger.py b/ignite/contrib/handlers/base_logger.py
index <HASH>..<HASH> 100644
--- a/ignite/contrib/handlers/base_logger.py
+++ b/ignite/contrib/handlers/base_logger.py
@@ -167,7 +167,7 @@ class BaseLogger(metaclass=ABCMeta):
return engine.add_event_handler(event_name, log_handler, self, name)
- def attach_output_handler(self, engine: Engine, event_name: str, *args: Any, **kwargs: Mapping):
+ def attach_output_handler(self, engine: Engine, event_name: Any, *args: Any, **kwargs: Mapping):
"""Shortcut method to attach `OutputHandler` to the logger.
Args:
@@ -182,7 +182,7 @@ class BaseLogger(metaclass=ABCMeta):
"""
return self.attach(engine, self._create_output_handler(*args, **kwargs), event_name=event_name)
- def attach_opt_params_handler(self, engine: Engine, event_name: str, *args: Any, **kwargs: Mapping):
+ def attach_opt_params_handler(self, engine: Engine, event_name: Any, *args: Any, **kwargs: Mapping):
"""Shortcut method to attach `OptimizerParamsHandler` to the logger.
Args: | Fixed typing in attach_opt_params_handler and attach_output_handler (#<I>) | pytorch_ignite | train | py |
7257ba41c5d20974d9e4c6b23c7135e08a4c0ecd | diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py
index <HASH>..<HASH> 100644
--- a/uncompyle6/semantics/pysource.py
+++ b/uncompyle6/semantics/pysource.py
@@ -363,9 +363,14 @@ class SourceWalker(GenericASTTraversal, object):
def n_funcdef(node):
- code_node = node[0][1]
- if (code_node == 'LOAD_CONST' and iscode(code_node.attr)
- and code_node.attr.co_flags & COMPILER_FLAG_BIT['COROUTINE']):
+ if self.version == 3.6:
+ code_node = node[0][0]
+ else:
+ code_node = node[0][1]
+
+ is_code = hasattr(code_node, 'attr') and iscode(code_node.attr)
+ if (is_code and
+ (code_node.attr.co_flags & COMPILER_FLAG_BIT['COROUTINE'])):
self.engine(('\n\n%|async def %c\n', -2), node)
else:
self.engine(('\n\n%|def %c\n', -2), node) | Fix up retreiving "async" property on <I> | rocky_python-uncompyle6 | train | py |
004dd5d9dbea764bcaadde8fb428220f6dfad388 | diff --git a/salt/utils/process.py b/salt/utils/process.py
index <HASH>..<HASH> 100644
--- a/salt/utils/process.py
+++ b/salt/utils/process.py
@@ -205,4 +205,8 @@ class ProcessManager(object):
for pid, p_map in self._process_map.items():
p_map['Process'].terminate()
p_map['Process'].join()
- del self._process_map[pid]
+ # This is a race condition if a signal was passed to all children
+ try:
+ del self._process_map[pid]
+ except KeyError:
+ pass | An additional race condition in shutdown-- if the signal is sent to all children | saltstack_salt | train | py |
8230375cc89d5193c42e1d71a6efdd2e75a647f8 | diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php
index <HASH>..<HASH> 100644
--- a/lang/en_utf8/error.php
+++ b/lang/en_utf8/error.php
@@ -262,7 +262,7 @@ $string['invalidmodule'] = 'Invalid module';
$string['invalidmoduleid'] = 'Invalid module ID: $a';
$string['invalidmodulename'] = 'Invalid module name: $a';
$string['invalidnum'] = 'Invalid numeric value';
-$string['invalidnumkey'] = '$conditions array may not contain numeric keys, please fix the code!';
+$string['invalidnumkey'] = '\$conditions array may not contain numeric keys, please fix the code!';
$string['invalidoutcome'] = 'Incorrect outcome id';
$string['invalidpagesize'] = 'Invalid page size';
$string['invalidpaymentmethod'] = 'Invalid payment method: $a'; | fixing notice - nonescaped $ in langstring | moodle_moodle | train | php |
58f31d461506ef1f8594af1f0f386647b06b7ab8 | diff --git a/ykman/native/pyusb.py b/ykman/native/pyusb.py
index <HASH>..<HASH> 100644
--- a/ykman/native/pyusb.py
+++ b/ykman/native/pyusb.py
@@ -60,12 +60,12 @@ def _find_library_local(libname):
def _load_usb_backend():
# First try to find backend locally, if not found try the systems.
- for local_lib in (libusb1, openusb, libusb0):
- backend = local_lib.get_backend(find_library=_find_library_local)
+ for lib in (libusb1, openusb, libusb0):
+ backend = lib.get_backend(find_library=_find_library_local)
if backend is not None:
return backend
- for system_lib in (libusb1, openusb, libusb0):
- backend = system_lib.get_backend()
+ for lib in (libusb1, openusb, libusb0):
+ backend = lib.get_backend()
if backend is not None:
return backend | pyusb: use lib as variable name | Yubico_yubikey-manager | train | py |
4740ee5bdae609ba112db8b053a56eecfc17b9fd | diff --git a/association.py b/association.py
index <HASH>..<HASH> 100644
--- a/association.py
+++ b/association.py
@@ -6,10 +6,10 @@ from openid.constants import *
from openid.util import *
class Association(object):
- def __init__(self, server_url, handle, key, expiry, replace_after):
+ def __init__(self, server_url, handle, secret, expiry, replace_after):
self.server_url = str(server_url)
self.handle = str(handle)
- self.key = str(key)
+ self.secret = str(secret)
self.expiry = float(expiry)
self.replace_after = float(replace_after) | [project @ changed key attribute to secret on Association class] | openid_python-openid | train | py |
aab347b583becc459e0a5934137e341ac31107d2 | diff --git a/openinghours/templatetags/openinghours_tags.py b/openinghours/templatetags/openinghours_tags.py
index <HASH>..<HASH> 100644
--- a/openinghours/templatetags/openinghours_tags.py
+++ b/openinghours/templatetags/openinghours_tags.py
@@ -91,6 +91,7 @@ def opening_hours(location=None, concise=False):
for o in ohrs:
days.append({
+ 'day_number': o.weekday,
'name': o.get_weekday_display(),
'from_hour': o.from_hour,
'to_hour': o.to_hour,
@@ -101,12 +102,16 @@ def opening_hours(location=None, concise=False):
o.to_hour.strftime('%p').lower()
)
})
- for day in WEEKDAYS:
- if day[1] not in [open_day['name'] for open_day in days]:
+
+ open_days = [o.weekday for o in ohrs]
+ for day_number, day_name in WEEKDAYS:
+ if day_number not in open_days:
days.append({
- 'name': str(day[1]),
+ 'day_number': day_number,
+ 'name': day_name,
'hours': 'Closed'
})
+ days = sorted(days, key=lambda k: k['day_number'])
if concise:
# [{'hours': '9:00am to 5:00pm', 'day_names': u'Monday to Friday'}, | Fixes issue #8 reported upstream
Opening hours are not ordered by weekday, when no data is given for a day | arteria_django-openinghours | train | py |
39994e4d0789556bd58517a302910b05c7c79a0a | diff --git a/src/Graviton/GeneratorBundle/Tests/Definition/DefinitionElementTest.php b/src/Graviton/GeneratorBundle/Tests/Definition/DefinitionElementTest.php
index <HASH>..<HASH> 100644
--- a/src/Graviton/GeneratorBundle/Tests/Definition/DefinitionElementTest.php
+++ b/src/Graviton/GeneratorBundle/Tests/Definition/DefinitionElementTest.php
@@ -43,7 +43,6 @@ class DefinitionElementTest extends \PHPUnit_Framework_TestCase
->addDefaultSerializationVisitors()
->addDefaultDeserializationVisitors()
->addMetadataDir(__DIR__.'/../../Resources/config/serializer', 'Graviton\\GeneratorBundle')
- ->setCacheDir(sys_get_temp_dir())
->setDebug(true)
->build(); | don't set arbitrary cache dir in test | libgraviton_graviton | train | php |
b4996c0be9bbc74a69c0795caffc4db15eb1fb15 | diff --git a/src/python/pants/commands/goal.py b/src/python/pants/commands/goal.py
index <HASH>..<HASH> 100644
--- a/src/python/pants/commands/goal.py
+++ b/src/python/pants/commands/goal.py
@@ -577,8 +577,6 @@ class RunServer(ConsoleTask):
s = reporting_queue.get()
# The child process is done reporting, and is now in the server loop, so we can proceed.
server_port = ReportingServerManager.get_current_server_port()
- if server_port:
- binary_util.ui_open('http://localhost:%d/run/latest' % server_port)
return ret
goal( | Don't auto open UI on pants server | pantsbuild_pants | train | py |
50673fc28a0054466005c127fc75984977ad654b | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -17,11 +17,11 @@ class FetchExternal(setuptools.command.sdist.sdist):
setup(cmdclass={'sdist': FetchExternal},
name='python_moztelemetry',
- version='0.3.1.1',
+ version='0.3.1.2',
author='Roberto Agostino Vitillo',
author_email='rvitillo@mozilla.com',
description='Spark bindings for Mozilla Telemetry',
url='https://github.com/vitillo/python_moztelemetry',
packages=['moztelemetry'],
package_dir={'moztelemetry': 'moztelemetry'},
- install_requires=['boto', 'ujson', 'requests', 'pandas', 'numpy', 'telemetry-tools'])
+ install_requires=['boto', 'ujson', 'requests', 'pandas>=0.15.2', 'numpy>=1.9.2', 'telemetry-tools']) | Add lower bounds for pandas and numpy. | mozilla_python_moztelemetry | train | py |
1828830b4a69e9420718ce1cfde6967dc9ec4fc0 | diff --git a/audio/internal/convert/resampling.go b/audio/internal/convert/resampling.go
index <HASH>..<HASH> 100644
--- a/audio/internal/convert/resampling.go
+++ b/audio/internal/convert/resampling.go
@@ -131,12 +131,12 @@ func (r *Resampling) at(t int64) (float64, float64, error) {
if startN < 0 {
startN = 0
}
- if r.size/4 < startN {
- startN = r.size / 4
+ if r.size/4 <= startN {
+ startN = r.size/4 - 1
}
endN := int64(tInSrc) + windowSize + 1
- if r.size/4 < endN {
- endN = r.size / 4
+ if r.size/4 <= endN {
+ endN = r.size/4 - 1
}
lv := 0.0
rv := 0.0 | audio/internal/convert/resampling: Better boundary check | hajimehoshi_ebiten | train | go |
24c41e2ebf0ca58362a9cbd4cc7513dfcefd8f27 | diff --git a/ruby/server/lib/roma/config.rb b/ruby/server/lib/roma/config.rb
index <HASH>..<HASH> 100644
--- a/ruby/server/lib/roma/config.rb
+++ b/ruby/server/lib/roma/config.rb
@@ -26,7 +26,12 @@ module Roma
RTTABLE_PATH = '.'
# connection setting
+
+ # to use a system call of epoll, CONNECTION_USE_EPOLL is to set true
+ CONNECTION_USE_EPOLL = true
+ # to use a system call of epoll, CONNECTION_DESCRIPTOR_TABLE_SIZE can be setting
CONNECTION_DESCRIPTOR_TABLE_SIZE = 4096
+
# like a MaxStartups spec in the sshd_config
# 'start:rate:full'
CONNECTION_CONTINUOUS_LIMIT = '200:30:300' | added a selection of a system call configuration, which of an epoll or select | roma_roma | train | rb |
55c209f1d6c60be23c51e2efc295eb9745a9e5c4 | diff --git a/lib/github3.js b/lib/github3.js
index <HASH>..<HASH> 100644
--- a/lib/github3.js
+++ b/lib/github3.js
@@ -9,6 +9,9 @@ module.exports = github3 = function(){};
// Mikeal's http.request wrapper
var request = require('request');
+github3.username = '';
+github3.password = '';
+
/*!
Builds and executes a github api call
@param {String} path API URI Path
@@ -16,8 +19,19 @@ var request = require('request');
@returns {Object} error, {Object} data
*/
+github3.setCredentials = function(username,password) {
+ this.username = username;
+ this.password = password;
+};
+
github3._get = function(path, callback) {
- base = 'https://api.github.com'
+ if (this.username && this.password) {
+ // if we have credentials, use them in request
+ base = 'https://'+this.username+':'+this.password+'@api.github.com';
+ }
+ else {
+ base = 'https://api.github.com';
+ }
request(base + path, function(error, response, body) {
if (error) {
callback(error, null); | Basic auth support
Added two variables github3.username and github3.password to store
credentials.
github3._get function now checks for credentials and use them in
request.
A new function github3.setCredentials(username,password) added to fill
credentials data, | edwardhotchkiss_github3 | 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.