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 |
|---|---|---|---|---|---|
be2c09a7e34b4bbb35c05a4cb79a0b9b9dcefb96 | diff --git a/spec/spec_helper_spec.rb b/spec/spec_helper_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper_spec.rb
+++ b/spec/spec_helper_spec.rb
@@ -109,5 +109,24 @@ describe Halite::SpecHelper do
it { is_expected.to eq(:parent) }
end
end # /context regression test for finding the wrong parent in a sibling context
+
+ context 'with step_into:false' do
+ resource(:halite_test, step_into: false)
+ provider(:halite_test) do
+ def action_run
+ ruby_block 'inner'
+ end
+ end
+ recipe do
+ halite_test 'test'
+ end
+ # Have to create this because step_into normally handles that
+ def run_halite_test(resource_name)
+ ChefSpec::Matchers::ResourceMatcher.new(:halite_test, :run, resource_name)
+ end
+
+ it { is_expected.to run_halite_test('test') }
+ it { is_expected.to_not run_ruby_block('inner') }
+ end # /context with step_into:false
end # /describe #resource
end | Test for the new step_into flag being false. | poise_halite | train | rb |
9b3e613a7ee86c20c4a48935b2d0d30002c90a98 | diff --git a/api/app_test.go b/api/app_test.go
index <HASH>..<HASH> 100644
--- a/api/app_test.go
+++ b/api/app_test.go
@@ -32,17 +32,6 @@ import (
"time"
)
-var output = `2012-06-05 17:03:36,887 WARNING ssl-hostname-verification is disabled for this environment
-2012-06-05 17:03:36,887 WARNING EC2 API calls not using secure transport
-2012-06-05 17:03:36,887 WARNING S3 API calls not using secure transport
-2012-06-05 17:03:36,887 WARNING Ubuntu Cloud Image lookups encrypted but not authenticated
-2012-06-05 17:03:36,896 INFO Connecting to environment...
-2012-06-05 17:03:37,599 INFO Connected to environment.
-2012-06-05 17:03:37,727 INFO Connecting to machine 0 at 10.170.0.191
-export DATABASE_HOST=localhost
-export DATABASE_USER=root
-export DATABASE_PASSWORD=secret`
-
type testHandler struct {
body [][]byte
method []string | api: removed unused global variable in tests | tsuru_tsuru | train | go |
d3ecb52a9534a49c33017256d2898b7ce7232db7 | diff --git a/src/Exscript/util/sigint.py b/src/Exscript/util/sigint.py
index <HASH>..<HASH> 100644
--- a/src/Exscript/util/sigint.py
+++ b/src/Exscript/util/sigint.py
@@ -55,6 +55,7 @@ class SigIntWatcher(object):
except KeyboardInterrupt:
print '********** SIGINT RECEIVED - SHUTTING DOWN! **********'
self.kill()
+ sys.exit(1)
sys.exit(status >> 8)
def kill(self): | Exscript.util.sigint: fix: exit status on keyboardinterrupt. | knipknap_exscript | train | py |
2285e07fcae055d75b0122b9bda60685334376e2 | diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
index <HASH>..<HASH> 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
@@ -66,7 +66,14 @@ define([
collection: this.collection,
app: this.options.app
});
- activationView.on('profileActivated', function () {
+ activationView.on('profileActivated', function (severity, params, profile) {
+ var activation = {
+ severity: severity,
+ inherit: 'NONE',
+ params: params,
+ qProfile: profile
+ };
+ that.model.set({ activation: activation });
that.options.app.controller.showDetails(that.model);
});
activationView.render(); | SONAR-<I> Sync rule activation between list and details | SonarSource_sonarqube | train | js |
8126346565547bca552d3b4a7ef78a1839208bd1 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -27,5 +27,5 @@ setup(
author_email = 'jon@eyl.io',
url = 'https://github.com/eyolfson/django-gitolite/',
download_url = ('https://github.com/eyolfson/django-gitolite/archive/'
- 'v0.0.1.tar.gz'),
+ 'v0.0.2.tar.gz'),
) | Updated download_url in setup file | eyolfson_django-gitolite | train | py |
27463b509fb6d468d3ddfa71a1a71bef509128f4 | diff --git a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java
index <HASH>..<HASH> 100644
--- a/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java
+++ b/okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/Http20Draft09.java
@@ -323,7 +323,7 @@ public final class Http20Draft09 implements Variant {
out.flush();
}
- @Override public void ackSettings() throws IOException {
+ @Override public synchronized void ackSettings() throws IOException {
// ACK the settings frame.
out.writeInt(0 | (TYPE_SETTINGS & 0xff) << 8 | (FLAG_ACK & 0xff));
out.writeInt(0); | Synchronize when acking settings.
Without this tests fail. | square_okhttp | train | java |
7bf5ba83c88a10dd6e7621bed9482e3f0847304f | diff --git a/tests/integration/modules/test_pkg.py b/tests/integration/modules/test_pkg.py
index <HASH>..<HASH> 100644
--- a/tests/integration/modules/test_pkg.py
+++ b/tests/integration/modules/test_pkg.py
@@ -324,7 +324,10 @@ class PkgModuleTest(ModuleCase, SaltReturnAssertsMixin):
if ret == '' or ret == {}:
self.skipTest('No updates available for this machine. Skipping pkg.upgrade test.')
else:
- ret = self.run_function(func)
+ args = []
+ if os_family == 'Debian':
+ args = ['dist_upgrade=True']
+ ret = self.run_function(func, args)
self.assertNotEqual(ret, {})
@destructiveTest | upgrade including linux kernels
This is required for ubuntu <I> to pass. | saltstack_salt | train | py |
1837c8a53c4f941c6d4854ed4937ced750071b03 | diff --git a/types/container/config.go b/types/container/config.go
index <HASH>..<HASH> 100644
--- a/types/container/config.go
+++ b/types/container/config.go
@@ -1,9 +1,10 @@
package container
import (
+ "time"
+
"github.com/docker/engine-api/types/strslice"
"github.com/docker/go-connections/nat"
- "time"
)
// HealthConfig holds configuration settings for the HEALTHCHECK feature.
@@ -56,4 +57,5 @@ type Config struct {
OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile
Labels map[string]string // List of labels set to this container
StopSignal string `json:",omitempty"` // Signal to stop a container
+ Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
} | Add shell to support SHELL in dockerfile | docker_engine-api | train | go |
592fa59e88a8ca71927f184ed3c577c5706ab291 | diff --git a/lib/devise/models/confirmable.rb b/lib/devise/models/confirmable.rb
index <HASH>..<HASH> 100644
--- a/lib/devise/models/confirmable.rb
+++ b/lib/devise/models/confirmable.rb
@@ -50,6 +50,7 @@ module Devise
# Send confirmation instructions by email
def send_confirmation_instructions
+ generate_confirmation_token if self.confirmation_token.nil?
::Devise::Mailer.confirmation_instructions(self).deliver
end
diff --git a/test/models/confirmable_test.rb b/test/models/confirmable_test.rb
index <HASH>..<HASH> 100644
--- a/test/models/confirmable_test.rb
+++ b/test/models/confirmable_test.rb
@@ -127,6 +127,14 @@ class ConfirmableTest < ActiveSupport::TestCase
User.send_confirmation_instructions(:email => user.email)
end
end
+
+ test 'should always have confirmation token when email is sent' do
+ user = new_user
+ user.instance_eval { def confirmation_required?; false end }
+ user.save
+ user.send_confirmation_instructions
+ assert_not_nil user.confirmation_token
+ end
test 'should not resend email instructions if the user change his email' do
user = create_user | Automatically create the confirmation_token when email is sent for optionally confirmable models | plataformatec_devise | train | rb,rb |
4be61a59d809aa882dc66a92a76a4097f31e6c82 | diff --git a/test/test_client.py b/test/test_client.py
index <HASH>..<HASH> 100644
--- a/test/test_client.py
+++ b/test/test_client.py
@@ -84,7 +84,8 @@ class ClientTestIndexing(unittest.TestCase):
os.remove('temp_file.json')
except:
pass
-
+
+ @unittest.skip("Don't test remote indexing in travis")
def test_index_json_file(self):
self.docs = self.rand_docs.get_docs(61)
with open('temp_file.json','w') as f: | removed streaming tests since travis can't put files on my server | moonlitesolutions_SolrClient | train | py |
4cbe4cf8d749c510b629a16a0a2fbcccffb418b1 | diff --git a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslator.java b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslator.java
index <HASH>..<HASH> 100644
--- a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslator.java
+++ b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/CqlTranslator.java
@@ -360,7 +360,7 @@ public class CqlTranslator {
UcumService ucumService = null;
if (validateUnits) {
try {
- ucumService = new UcumEssenceService("/ucum-essence.xml");
+ ucumService = new UcumEssenceService(UcumEssenceService.class.getResourceAsStream("/ucum-essence.xml"));
} catch (UcumException e) {
System.err.println("Could not create UCUM validation service:");
e.printStackTrace(); | Fixed the UCUM validation service being created with an incorrect path to the UCUM essence content. | cqframework_clinical_quality_language | train | java |
a9e9a1fcfb7820e6ccdd72f1921b6ef7b4501ee7 | diff --git a/respirometry.py b/respirometry.py
index <HASH>..<HASH> 100644
--- a/respirometry.py
+++ b/respirometry.py
@@ -1,14 +1,3 @@
-def get_n_lines(file_path):
- '''Get number of lines by calling bash command wc'''
- import os
- import subprocess
-
- cmd = 'wc -l {0}'.format(file_path)
- output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
- n_lines = int((output).readlines()[0].split()[0])
-
- return n_lines
-
def read_header(fileio):
'''Read information rows from respirometry files
@@ -84,8 +73,10 @@ def read_respirometry(file_path):
import pandas
import numpy
+ import utils
+
# Create oversized numpy array for data
- n_lines = get_n_lines(file_path)
+ n_lines = utils.get_n_lines(file_path)
data = numpy.zeros((n_lines,4), dtype=object)#n_lines, dtype=dtypes)
data[:] = numpy.nan | changed calling of get_n_lines to match routine move to utils | ryanjdillon_pyotelem | train | py |
77fb67d324f592a31e96a410535bc83f9a21c351 | diff --git a/system/Common.php b/system/Common.php
index <HASH>..<HASH> 100644
--- a/system/Common.php
+++ b/system/Common.php
@@ -1014,10 +1014,13 @@ if (! function_exists('slash_item')) {
function slash_item(string $item): ?string
{
$config = config(App::class);
- $configItem = $config->{$item};
+
+ if (property_exists($config, $item)) {
+ $configItem = $config->{$item};
+ }
if (! isset($configItem) || empty(trim($configItem))) {
- return $configItem;
+ return null;
}
return rtrim($configItem, '/') . '/'; | fix: object property which doesn't exist | codeigniter4_CodeIgniter4 | train | php |
2ad12c13e9ba1ba0fac40dc82d86ea62f2486624 | diff --git a/pkg/util/wellknown.go b/pkg/util/wellknown.go
index <HASH>..<HASH> 100644
--- a/pkg/util/wellknown.go
+++ b/pkg/util/wellknown.go
@@ -46,6 +46,8 @@ const (
Squash = "envoy.squash"
// HTTPExternalAuthorization HTTP filter
HTTPExternalAuthorization = "envoy.ext_authz"
+ // HTTPRoleBasedAccessControl HTTP filter
+ HTTPRoleBasedAccessControl = "envoy.filters.http.rbac"
)
// Network filter names
@@ -70,6 +72,8 @@ const (
MySQLProxy = "envoy.filters.network.mysql_proxy"
// ExternalAuthorization network filter
ExternalAuthorization = "envoy.ext_authz"
+ // RoleBasedAccessControl network filter
+ RoleBasedAccessControl = "envoy.filters.network.rbac"
)
// Listener filter names | add RBAC to wellknown.go (#<I>) | envoyproxy_go-control-plane | train | go |
4ad154c1e9e3c88ebe5e721d4cab7f5533c302d4 | diff --git a/src/main/java/com/moilioncircle/redis/replicator/Constants.java b/src/main/java/com/moilioncircle/redis/replicator/Constants.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/moilioncircle/redis/replicator/Constants.java
+++ b/src/main/java/com/moilioncircle/redis/replicator/Constants.java
@@ -34,12 +34,6 @@ public class Constants {
};
public static final Charset CHARSET = Charset.forName("UTF-8");
-
- /**
- * @since 2.2.0
- * @deprecated unused attribute
- */
- @Deprecated
public static final String EMPTY = "";
/** | <I>-release
raw bytes support | leonchen83_redis-replicator | train | java |
987cb9978dcd053ebac550c790a9d87d8d25aee6 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -56,7 +56,7 @@ setup(
'humanize==0.5.1',
'gunicorn==19.7.1',
'markdown==2.6.8',
- 'pandas==0.19.2',
+ 'pandas==0.20.2',
'parsedatetime==2.0.0',
'pydruid==0.3.1',
'PyHive>=0.3.0', | [hotfix] bumping pandas version to <I> | apache_incubator-superset | train | py |
958f7b8f97ca65adbb22ce342831baa0a2e8afff | diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/rest.rb
+++ b/lib/chef/rest.rb
@@ -148,6 +148,9 @@ class Chef
@cookies["#{url.host}:#{url.port}"] = res['set-cookie']
end
run_request(:GET, create_url(res['location']), false, limit - 1, raw)
+ elsif res.kind_of?(Net::HTTPUnauthorized)
+ Chef::Log.error("Node openid registration is not validated")
+ exit(1)
else
res.error!
end | Print a useful message about node validation on HTTP <I> / Unauthorized Error.
This is assuming that we won't <I> errors from other components sharing this code. | chef_chef | train | rb |
0dafd08a75885c36812cb319e38c422bf391f16b | diff --git a/bonobo/core/contexts.py b/bonobo/core/contexts.py
index <HASH>..<HASH> 100644
--- a/bonobo/core/contexts.py
+++ b/bonobo/core/contexts.py
@@ -67,10 +67,7 @@ class PluginExecutionContext:
self.handle_error(exc, traceback.format_exc())
def run(self):
- try:
- get_initializer(self.plugin)(self)
- except Exception as exc:
- print('error in initializer', type(exc), exc)
+ self.initialize()
while self.alive:
# todo with wrap_errors ....
@@ -82,10 +79,7 @@ class PluginExecutionContext:
sleep(0.25)
- try:
- get_finalizer(self.plugin)(self)
- except Exception as exc:
- print('error in finalizer', type(exc), exc)
+ self.finalize()
def shutdown(self):
self.alive = False
@@ -251,7 +245,7 @@ class ComponentExecutionContext(WithStatistics):
break # BREAK !!!
except Empty:
continue
- except Exception as exc:
+ except Exception as exc: # pylint: disable=broad-except
self.handle_error(exc, traceback.format_exc())
self.finalize() | pylint disable broad excepts when it make sense. | python-bonobo_bonobo | train | py |
c27abe0bebc3b5ce86f3f36bee4744d259ab78ca | diff --git a/test/getdns_test.py b/test/getdns_test.py
index <HASH>..<HASH> 100644
--- a/test/getdns_test.py
+++ b/test/getdns_test.py
@@ -2,7 +2,6 @@ import unittest
import sys, platform
-x = [ 'lib' ]
un = platform.uname()
d = 'lib.' + un[0].lower() + '-' + un[4] + '-' + '.'.join(platform.python_version().split('.')[:2])
sys.path.append(d)
@@ -25,6 +24,10 @@ class TestGetdnsMethods(unittest.TestCase):
def test_dns_root_servers(self):
c = getdns.Context()
+ addrs = [ { 'address_type': 'IPv4', 'address_data': '127.0.0.254' } ]
+ c.dns_root_servers = addrs
+ self.assertEqual(c.dns_root_servers, addrs)
+ del(c)
def test_sync_address(self): | added check for dns_root_servers | getdnsapi_getdns-python-bindings | train | py |
aaac90dae40a48ed1645c81e002ea2ce24e3b2a2 | diff --git a/src/ManagerTools/Command/PullRequestCommand.php b/src/ManagerTools/Command/PullRequestCommand.php
index <HASH>..<HASH> 100644
--- a/src/ManagerTools/Command/PullRequestCommand.php
+++ b/src/ManagerTools/Command/PullRequestCommand.php
@@ -122,7 +122,7 @@ class PullRequestCommand extends BaseCommand
$repoName = $this->getRepoName();
$branchName = $this->getBranchName();
$vendorName = 'cordoval';
- $baseBranch = 'cordoval/master';// $vendorName.'/'.$ref;
+ $baseBranch = 'cordoval:master';
$title = 'sample';
$commands = array(
@@ -149,7 +149,7 @@ class PullRequestCommand extends BaseCommand
->api('pull_request')
->create($vendorName, $repoName, array(
'base' => $baseBranch,
- 'head' => $username.'/'.$branchName,
+ 'head' => $username.':'.$branchName,
'title' => $title,
'body' => $description
) | fix PR command but is still hard coded | gushphp_gush | train | php |
e81e7442e79399b7d01b1baa144a82c1246b599b | diff --git a/climlab/__init__.py b/climlab/__init__.py
index <HASH>..<HASH> 100644
--- a/climlab/__init__.py
+++ b/climlab/__init__.py
@@ -9,3 +9,6 @@ __all__ = ["constants", "thermo", "orbital_table",
# this should ensure that we can still import constants.py as climlab.constants
from climlab.utils import constants, thermo
+
+__version__ = '0.2'
+
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,10 @@ def readme():
with open('README.rst') as f:
return f.read()
+import climlab
+
setup(name='climlab',
- version='0.2',
+ version=climlab.__version__,
description='Package for process-oriented climate modeling',
long_description=readme(),
classifiers=[ | Added __version__ attribute to climlab/__init__.py. setup.py now references this -- only one version tag to maintain. | brian-rose_climlab | train | py,py |
db03d0d32e74879759633fd5c6ae7f499b8bd6c4 | diff --git a/lib/bitcoin/script/multisig.rb b/lib/bitcoin/script/multisig.rb
index <HASH>..<HASH> 100644
--- a/lib/bitcoin/script/multisig.rb
+++ b/lib/bitcoin/script/multisig.rb
@@ -1,7 +1,7 @@
module Bitcoin
# utility for multisig
- class Multisig
+ module Multisig
include Bitcoin::Opcodes
def self.prefix | use Module rather than Class for Multisig | chaintope_bitcoinrb | train | rb |
4ac0cc64a27d757903fc0115693ea27da73cab5b | diff --git a/code/authenticator/RESTfulAPI_TokenAuthenticator.php b/code/authenticator/RESTfulAPI_TokenAuthenticator.php
index <HASH>..<HASH> 100644
--- a/code/authenticator/RESTfulAPI_TokenAuthenticator.php
+++ b/code/authenticator/RESTfulAPI_TokenAuthenticator.php
@@ -421,7 +421,10 @@ class RESTfulAPI_TokenAuthenticator implements RESTfulAPI_Authenticator
}
//all good, log Member in
if (is_a($tokenOwner, 'Member')) {
- $tokenOwner->logIn();
+ # $tokenOwner->logIn();
+ # this is a login without the logging
+ $tokenOwner::session_regenerate_id();
+ Session::set("loggedInAs", $tokenOwner->ID);
}
return true; | do not record login event for every tokenAuth
doing a full login is an expensive process in silverstripe ... so if we go for token auth,
let's have some performance benefit as well .. for single record ops this can give us <I>% more performance. | colymba_silverstripe-restfulapi | train | php |
1cd36439a86e91e5c27b6ef36b694aac87875470 | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -66,11 +66,10 @@ mnfy._js = function (string, options) {
}
mnfy._css = function (string, options) {
- options = options || {
- safe: true
- }
+ options = options || {}
+ if (typeof options.safe !== 'boolean') options.safe = true
- return _postcss()([_cssnano(options)]).process(string).then(function (result) {
+ return _postcss()([_cssnano()(options)]).process(string).then(function (result) {
return {
code: result.css,
}
diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -18,6 +18,12 @@ describe('Standalone', function () {
})
})
+ it('should minify CSS in safe mode by default', function () {
+ return mnfy.css('body { z-index: 1000; }').then(function (css) {
+ assert.equal(css.code, 'body{z-index:1000}')
+ })
+ })
+
it('should minify HTML', function () {
return mnfy.html('<html> </html>').then(function (html) {
assert.equal(html.code, '<html> </html>') | make sure cssnano is in safe mode by default
closes #3 | webdeps_mnfy | train | js,js |
cabe7defb2065c6c55645f6d5d66714cdcb7851a | diff --git a/Item.php b/Item.php
index <HASH>..<HASH> 100644
--- a/Item.php
+++ b/Item.php
@@ -42,5 +42,11 @@
* @return int
*/
public function getWeight();
+
+ /**
+ * Item volume in mm^3
+ * @return int
+ */
+ public function getVolume();
}
diff --git a/ItemList.php b/ItemList.php
index <HASH>..<HASH> 100644
--- a/ItemList.php
+++ b/ItemList.php
@@ -18,10 +18,7 @@
* @see \SplMaxHeap::compare()
*/
public function compare(Item $aItemA, Item $aItemB) {
- $volumeA = $aItemA->getLength() * $aItemA->getWidth() * $aItemA->getDepth();
- $volumeB = $aItemB->getLength() * $aItemB->getWidth() * $aItemB->getDepth();
-
- return $volumeA - $volumeB;
+ return $aItemA->getVolume() - $aItemB->getVolume();
}
} | Let implementing objects carry out volume calculation to allow for caching/storing of value | dvdoug_BoxPacker | train | php,php |
eeb29e6c1423759db3dfc681eb0cbc58068820fe | diff --git a/mysite/ruby/deploy.rb b/mysite/ruby/deploy.rb
index <HASH>..<HASH> 100644
--- a/mysite/ruby/deploy.rb
+++ b/mysite/ruby/deploy.rb
@@ -1,7 +1,8 @@
# Before the switching the current symlink, do the silverstripe specifics
after "deploy:finalize_update", "deploy:silverstripe"
# Automatically remove old releases
-after "deploy:update", "deploy:cleanup"
+# Disabled this because permission problems can cause it to mess up the whole release process
+# after "deploy:update", "deploy:cleanup"
# Override the default capistrano deploy recipe that is build for rails apps
namespace :deploy do | FIX: Disabled deploy:cleanup because it can break releases. | silverstripe-archive_deploynaut | train | rb |
07d47648f1090d46edfba4a30d3140cccc904172 | diff --git a/Renderer/DefaultRenderers.php b/Renderer/DefaultRenderers.php
index <HASH>..<HASH> 100644
--- a/Renderer/DefaultRenderers.php
+++ b/Renderer/DefaultRenderers.php
@@ -21,10 +21,10 @@ final class DefaultRenderers
/**
* Table renderer
*/
- const TABLE = 'table';
+ const TABLE = 'sylius_renderer_table';
/**
* Chart renderer
*/
- const CHART = 'chart';
+ const CHART = 'sylius_renderer_chart';
} | [ReportBundle] Remove prefix on configurationType type | Sylius_Report | train | php |
e9488b637a95b9ff7339f03088d68468e750deb6 | diff --git a/modules/es/views/es.HeadingView.js b/modules/es/views/es.HeadingView.js
index <HASH>..<HASH> 100644
--- a/modules/es/views/es.HeadingView.js
+++ b/modules/es/views/es.HeadingView.js
@@ -27,7 +27,7 @@ es.HeadingView.prototype.setClasses = function() {
level = this.model.getElementAttribute( 'level' );
this.$
// Remove any existing level classes
- .attr( 'class', classes.replace( /es-headingView-level[0-9]/, '' ) )
+ .attr( 'class', classes.replace( /es-headingView-level[0-9]+/, '' ) )
// Add a new level class
.addClass( 'es-headingView-level' + level );
}; | Made regex less specific, so it catches levels that are not officially supported, but also shouldn't get stuck in the dom if for some reason they get added at some point. | wikimedia_parsoid | train | js |
de4c854ac955526285eab6111b9ba9a446d44b62 | diff --git a/lib/Doctrine/ORM/EntityRepository.php b/lib/Doctrine/ORM/EntityRepository.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/ORM/EntityRepository.php
+++ b/lib/Doctrine/ORM/EntityRepository.php
@@ -302,9 +302,7 @@ class EntityRepository implements ObjectRepository, Selectable
*/
private function resolveMagicCall($method, $by, array $arguments)
{
- $argsCount = count($arguments);
-
- if (0 === $argsCount) {
+ if (! $arguments) {
throw ORMException::findByRequiresParameter($method . $by);
} | #<I> removed useless `count()` call | doctrine_orm | train | php |
2c5843ebfdbad07855d37a313a13b275606ea446 | diff --git a/resolver/dns/dns_resolver.go b/resolver/dns/dns_resolver.go
index <HASH>..<HASH> 100644
--- a/resolver/dns/dns_resolver.go
+++ b/resolver/dns/dns_resolver.go
@@ -66,6 +66,9 @@ type dnsBuilder struct {
// Build creates and starts a DNS resolver that watches the name resolution of the target.
func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) {
+ if target.Authority != "" {
+ return nil, fmt.Errorf("Default DNS resolver does not support custom DNS server")
+ }
host, port, err := parseTarget(target.Endpoint)
if err != nil {
return nil, err | DNS resolver: Throw an error for non-default DNS authority. (#<I>) | grpc_grpc-go | train | go |
0eaeaff349e9ee89dd39eb0b229969b399f034cf | diff --git a/lib/route53/version.rb b/lib/route53/version.rb
index <HASH>..<HASH> 100644
--- a/lib/route53/version.rb
+++ b/lib/route53/version.rb
@@ -1,3 +1,3 @@
module Route53
- VERSION = "0.3.0"
+ VERSION = "0.3.1"
end | Upgrading version to <I> | pcorliss_ruby_route_53 | train | rb |
282df7ca50c8fca4cbbeaf595d34d8e0fe3cdf8a | diff --git a/mithril.js b/mithril.js
index <HASH>..<HASH> 100644
--- a/mithril.js
+++ b/mithril.js
@@ -1852,7 +1852,7 @@
return propify(promise.then(resolve, reject), initialValue)
}
- prop.catch = prop.then.bind(null, null)
+ prop["catch"] = prop.then.bind(null, null)
return prop
}
// Promiz.mithril.js | Zolmeister | MIT | update: not to conflict javascript reserved word | MithrilJS_mithril.js | train | js |
5710022c652e31bc15321903b6fffd74c2b74ed2 | diff --git a/admin/cron.php b/admin/cron.php
index <HASH>..<HASH> 100644
--- a/admin/cron.php
+++ b/admin/cron.php
@@ -8,25 +8,13 @@
// The script can either be invoked via the web server or via a standalone
// version of PHP compiled for CGI.
//
-// The script does not require a valid Moodle login, but has it's own unique
-// password, set in ../config.php. This is passed to this script as a parameter.
-//
-// eg wget -q -O /dev/null 'http://moodle.dougiamas.net/admin/cron.php?p=password'
-// or php /web/moodle/admin/cron.php password
+// eg wget -q -O /dev/null 'http://moodle.dougiamas.net/admin/cron.php'
+// or php /web/moodle/admin/cron.php
require("../config.php");
echo "<PRE>\n";
- if (!isset($p)) {
- $p = $GLOBALS[argv][1];
- }
-
- if ($p <> $CFG->cronpassword) {
- echo "Error: bad password.\n";
- die;
- }
-
$timenow = time();
// Run all cron jobs for each module | Removed password ... it's not necessary any more. | moodle_moodle | train | php |
c2b4d46ed3369c203806278747120ce8ad0275e1 | diff --git a/charmhelpers/fetch/ubuntu.py b/charmhelpers/fetch/ubuntu.py
index <HASH>..<HASH> 100644
--- a/charmhelpers/fetch/ubuntu.py
+++ b/charmhelpers/fetch/ubuntu.py
@@ -161,7 +161,7 @@ CLOUD_ARCHIVE_POCKETS = {
APT_NO_LOCK = 100 # The return code for "couldn't acquire lock" in APT.
CMD_RETRY_DELAY = 10 # Wait 10 seconds between command retries.
-CMD_RETRY_COUNT = 30 # Retry a failing fatal command X times.
+CMD_RETRY_COUNT = 3 # Retry a failing fatal command X times.
def filter_installed_packages(packages): | Lower retry count to avoid permanent lock from update-status and optimistic hook retries | juju_charm-helpers | train | py |
4a89a26b7b29f6b191840e1cad57956208c3403d | diff --git a/classes/PodsAPI.php b/classes/PodsAPI.php
index <HASH>..<HASH> 100644
--- a/classes/PodsAPI.php
+++ b/classes/PodsAPI.php
@@ -904,16 +904,16 @@ class PodsAPI {
$lookup_name = $pod[ 'name' ];
- if ( 'post_type' == $pod[ 'type' ] && isset( $built_in[ 'taxonomy' ] ) ) {
+ if ( 'post_type' == $pod[ 'type' ] ) {
$lookup_option = 'built_in_post_types_' . $lookup_name;
$lookup_built_in = 'taxonomy';
}
- elseif ( 'taxonomy' == $pod[ 'type' ] && isset( $built_in[ 'post_type' ] ) ) {
+ elseif ( 'taxonomy' == $pod[ 'type' ] ) {
$lookup_option = 'built_in_taxonomies_' . $lookup_name;
$lookup_built_in = 'post_type';
}
- if ( !empty( $lookup_option ) && !empty( $lookup_built_in ) ) {
+ if ( !empty( $lookup_option ) && !empty( $lookup_built_in ) && isset( $built_in[ $lookup_built_in ] ) && !empty( $built_in[ $lookup_built_in ] ) ) {
foreach ( $built_in[ $lookup_built_in ] as $built_in_object => $val ) {
$search_val = 1 ^ $val; | Further logic tweaks on $lookup_built_in | pods-framework_pods | train | php |
82226ccab74c0e340f93bd720a965b1564ed585e | diff --git a/XNode.php b/XNode.php
index <HASH>..<HASH> 100644
--- a/XNode.php
+++ b/XNode.php
@@ -279,4 +279,8 @@ class XNode {
return $value;
}
+ public function __invoke($select, $index = null) {
+ return $this->find($select, $index);
+ }
+
}
\ No newline at end of file
diff --git a/XNodeList.php b/XNodeList.php
index <HASH>..<HASH> 100644
--- a/XNodeList.php
+++ b/XNodeList.php
@@ -76,4 +76,10 @@ class XNodeList {
return $value;
}
+ public function __invoke(...$args) {
+ foreach($this->getElements() as $element) {
+ $this->elements(...$args);
+ }
+ }
+
}
\ No newline at end of file | __invoke() as find() or something | gymadarasz_xparser | train | php,php |
52a8572d02ef25a78a98bd1a658fd412aef11c8c | diff --git a/src/OpenTok/OpenTok.php b/src/OpenTok/OpenTok.php
index <HASH>..<HASH> 100755
--- a/src/OpenTok/OpenTok.php
+++ b/src/OpenTok/OpenTok.php
@@ -510,7 +510,7 @@ class OpenTok
* @param array<string> $options This array defines options and includes the following keys:
*
* <ul>
- * <li><code>'excludedStreamIds'</code> (array, optional) — An array of stram IDs
+ * <li><code>'excludedStreams'</code> (array, optional) — An array of stream IDs
* corresponding to streams that should not be muted. This is an optional property.
* If you omit this property, all streams in the session will be muted.</li>
* | tweaks for documentation - correct options name in docblock | opentok_OpenTok-PHP-SDK | train | php |
5fcb1d6430fa436b738231b22880407d6bfdcfe0 | diff --git a/lib/middlewares/responseType.js b/lib/middlewares/responseType.js
index <HASH>..<HASH> 100644
--- a/lib/middlewares/responseType.js
+++ b/lib/middlewares/responseType.js
@@ -13,8 +13,8 @@ function parseResponseType(req) {
}
}
- if (req.params && req.params.responseType) {
- return req.params.responseType.toLowerCase();
+ if (req.query && req.query.responseType) {
+ return req.query.responseType.toLowerCase();
}
return 'html'; | update responseType to change with query params | wejs_we-core | train | js |
c4f82e99f7c7345ee02f00b464731eca00c4da1c | diff --git a/spec/unit/resource/api800/c7000/volume_attachment_spec.rb b/spec/unit/resource/api800/c7000/volume_attachment_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/resource/api800/c7000/volume_attachment_spec.rb
+++ b/spec/unit/resource/api800/c7000/volume_attachment_spec.rb
@@ -1,3 +1,14 @@
+# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# You may not use this file except in compliance with the License.
+# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed
+# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+# CONDITIONS OF ANY KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations under the License.
+
require 'spec_helper'
RSpec.describe OneviewSDK::API800::C7000::VolumeAttachment do | Update volume_attachment_spec.rb | HewlettPackard_oneview-sdk-ruby | train | rb |
fef5bb458c430858b5b6ac7233b7147d9c08bfc4 | diff --git a/js/videoElementsHandler.js b/js/videoElementsHandler.js
index <HASH>..<HASH> 100644
--- a/js/videoElementsHandler.js
+++ b/js/videoElementsHandler.js
@@ -201,6 +201,16 @@ function observeVideo(video) {
if (video.srcObject && !video._iosrtcMediaStreamRendererId) {
// If this video element was NOT previously handling a MediaStreamRenderer, release it.
handleVideo(video);
+ } else if (video.srcObject && video._iosrtcMediaStreamRendererId) {
+ // The video element has received a new srcObject.
+ const stream = video.srcObject;
+ if (stream && typeof stream.getBlobId === 'function') {
+ const mediaStreamRenderer = mediaStreamRenderers[video._iosrtcMediaStreamRendererId];
+ const mediaStream = mediaStreams[stream.getBlobId()];
+ if (mediaStreamRenderer && mediaStream) {
+ mediaStreamRenderer.render(mediaStream);
+ }
+ }
}
}); | Recognize when a video receives a new srcObject and re-render the media stream | BasqueVoIPMafia_cordova-plugin-iosrtc | train | js |
dac03af3c745b56c59b3b39e98804723916f9959 | diff --git a/prow/cmd/sinker/main.go b/prow/cmd/sinker/main.go
index <HASH>..<HASH> 100644
--- a/prow/cmd/sinker/main.go
+++ b/prow/cmd/sinker/main.go
@@ -107,7 +107,7 @@ func main() {
cfg := configAgent.Config
pushGateway := cfg().PushGateway
- metrics.ExposeMetrics("sinker", pushGateway.Endpoint, pushGateway.Interval)
+ metrics.ExposeMetrics("sinker", pushGateway.Endpoint, pushGateway.Interval.Duration)
prowJobClient, err := o.kubernetes.ProwJobClient(cfg().ProwJobNamespace, o.dryRun.Value)
if err != nil { | Fix pushGateway.Interval.Duration after rebase | kubernetes_test-infra | train | go |
ae355e0fe760b84000178de8ce692a3a723c2e75 | diff --git a/spec/driver/remote_culerity_driver_spec.rb b/spec/driver/remote_culerity_driver_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/driver/remote_culerity_driver_spec.rb
+++ b/spec/driver/remote_culerity_driver_spec.rb
@@ -13,8 +13,8 @@ describe Capybara::Driver::Culerity do
end
it "should navigate to a fully qualified remote page" do
- @driver.visit('http://elabs.se/contact')
- @driver.body.should include('Edithouse eLabs AB')
+ @driver.visit('http://capybara-testapp.heroku.com/foo')
+ @driver.body.should include('Another World')
end
it_should_behave_like "driver" | "Surely that page could not possibly change"
-- famous last words | teamcapybara_capybara | train | rb |
d4c7a3550f83d3d5dc313c37fde37ff1b0b24175 | diff --git a/mbstrdecoder/_mbstrdecoder.py b/mbstrdecoder/_mbstrdecoder.py
index <HASH>..<HASH> 100644
--- a/mbstrdecoder/_mbstrdecoder.py
+++ b/mbstrdecoder/_mbstrdecoder.py
@@ -118,13 +118,7 @@ class MultiByteStrDecoder(object):
return self.__encoded_str
- def __to_unicode(self):
- encoded_str = self.__get_encoded_str()
-
- if encoded_str == b"":
- self.__codec = "unicode"
- return ""
-
+ def __get_codec_candidate(self, encoded_str):
try:
detect = chardet.detect(encoded_str)
except TypeError:
@@ -136,6 +130,17 @@ class MultiByteStrDecoder(object):
# utf7 tend to be misrecognized as ascii
codec_candidate_list = self.__CODEC_LIST
+ return codec_candidate_list
+
+ def __to_unicode(self):
+ encoded_str = self.__get_encoded_str()
+
+ if encoded_str == b"":
+ self.__codec = "unicode"
+ return ""
+
+ codec_candidate_list = self.__get_codec_candidate(encoded_str)
+
for codec in codec_candidate_list:
try:
self.__codec = codec.lower().replace("-", "_") | Extract a method for further enhancements | thombashi_mbstrdecoder | train | py |
b919627f4094680467b26f4b87fb88255ebaf02d | diff --git a/neo/SmartContract/StateReader.py b/neo/SmartContract/StateReader.py
index <HASH>..<HASH> 100644
--- a/neo/SmartContract/StateReader.py
+++ b/neo/SmartContract/StateReader.py
@@ -440,8 +440,8 @@ class StateReader(InteropService):
def Block_GetTransaction(self, engine):
- block = engine.EvaluationStack.Pop().GetInterface('neo.Core.Block.Block')
index = engine.EvaluationStack.Pop().GetBigInteger()
+ block = engine.EvaluationStack.Pop().GetInterface('neo.Core.Block.Block')
if block is None or index < 0 or index > len(block.Transactions):
return False
@@ -597,8 +597,8 @@ class StateReader(InteropService):
def Account_GetBalance(self, engine):
- account = engine.EvaluationStack.Pop().GetInterface('neo.Core.State.AccountState.AccountState')
assetId = UInt256( data=engine.EvaluationStack.Pop().GetByteArray())
+ account = engine.EvaluationStack.Pop().GetInterface('neo.Core.State.AccountState.AccountState')
if account is None:
return False | fix Pop() order in Block_GetTransaction and Account_GetBalance | CityOfZion_neo-python | train | py |
2fc6f8094b6e87036ae059c26f1b6b211fe6a426 | diff --git a/internal/service/ec2/transit_gateway_multicast_domain.go b/internal/service/ec2/transit_gateway_multicast_domain.go
index <HASH>..<HASH> 100644
--- a/internal/service/ec2/transit_gateway_multicast_domain.go
+++ b/internal/service/ec2/transit_gateway_multicast_domain.go
@@ -808,7 +808,7 @@ func IsMulticastAddress(i interface{}, k string) (warnings []string, errors []er
}
ip := net.ParseIP(v)
- if multicast := ip.IsMulticast(); multicast == false {
+ if multicast := ip.IsMulticast(); !multicast {
errors = append(errors, fmt.Errorf("expected %s to contain a valid Multicast address, got: %s", k, v))
} | Changed multicast == nil to !multicast | terraform-providers_terraform-provider-aws | train | go |
d5e97555614be9449d121d2fe437c6f5fd5d2c43 | diff --git a/src/Psr17/ServerRequestFactory.php b/src/Psr17/ServerRequestFactory.php
index <HASH>..<HASH> 100644
--- a/src/Psr17/ServerRequestFactory.php
+++ b/src/Psr17/ServerRequestFactory.php
@@ -13,9 +13,10 @@
namespace chillerlan\HTTP\Psr17;
use chillerlan\HTTP\Psr7\ServerRequest;
+use Fig\Http\Message\RequestMethodInterface;
use Psr\Http\Message\{ServerRequestFactoryInterface, ServerRequestInterface};
-final class ServerRequestFactory extends RequestFactory implements ServerRequestFactoryInterface{
+final class ServerRequestFactory implements ServerRequestFactoryInterface, RequestMethodInterface{
/**
* @inheritDoc | :octocat: extending RequestFactory doesn't make much sense | chillerlan_php-httpinterface | train | php |
2c1abd881a11157b584641f37c2004ec8ecb4be6 | diff --git a/generators/generator-constants.js b/generators/generator-constants.js
index <HASH>..<HASH> 100644
--- a/generators/generator-constants.js
+++ b/generators/generator-constants.js
@@ -58,7 +58,7 @@ const DOCKER_POSTGRESQL = 'postgres:14.2';
const DOCKER_MONGODB = 'mongo:4.4.12';
const DOCKER_COUCHBASE = 'couchbase/server:7.0.0';
const DOCKER_CASSANDRA = 'cassandra:3.11.12';
-const DOCKER_MSSQL = 'mcr.microsoft.com/mssql/server:2019-CU14-ubuntu-20.04';
+const DOCKER_MSSQL = 'mcr.microsoft.com/mssql/server:2019-CU15-ubuntu-20.04';
const DOCKER_NEO4J = 'neo4j:4.4.2';
const DOCKER_HAZELCAST_MANAGEMENT_CENTER = 'hazelcast/management-center:4.2021.12-1';
const DOCKER_MEMCACHED = 'memcached:1.6.12-alpine'; | Update mcr.microsoft.com/mssql/server docker image version to <I>-CU<I>-ubuntu-<I> | jhipster_generator-jhipster | train | js |
a4e9bec0bb5f7756ef270d472b848e52697cd51d | diff --git a/ceph_deploy/gatherkeys.py b/ceph_deploy/gatherkeys.py
index <HASH>..<HASH> 100644
--- a/ceph_deploy/gatherkeys.py
+++ b/ceph_deploy/gatherkeys.py
@@ -141,9 +141,9 @@ def gatherkeys_missing(args, distro, rlogger, keypath, keytype, dest_dir):
return False
keyring_name_local = keytype_path_to(args, keytype)
keyring_path_local = os.path.join(dest_dir, keyring_name_local)
- with open(keyring_path_local, 'wb') as f:
+ with open(keyring_path_local, 'w') as f:
for line in out:
- f.write(line.decode('utf-8') + '\n')
+ f.write(line + '\n')
return True
@@ -161,7 +161,7 @@ def gatherkeys_with_mon(args, host, dest_dir):
return False
mon_name_local = keytype_path_to(args, "mon")
mon_path_local = os.path.join(dest_dir, mon_name_local)
- with open(mon_path_local, 'wb') as f:
+ with open(mon_path_local, 'w') as f:
f.write(mon_key)
rlogger = logging.getLogger(host)
path_asok = ceph_deploy.util.paths.mon.asok(args.cluster, remote_hostname) | gatherkeys: no need to decode, do not write binary | ceph_ceph-deploy | train | py |
8a16b5714efff37d75037724c1d791868a63bce6 | diff --git a/src/SReg.php b/src/SReg.php
index <HASH>..<HASH> 100644
--- a/src/SReg.php
+++ b/src/SReg.php
@@ -9,7 +9,6 @@ use SilverStripe\ORM\DataExtension;
*/
class SReg extends DataExtension
{
-
public function sreg($string)
{
$string = $this->sregValue($this->sregTokenizer($string));
@@ -61,7 +60,7 @@ class SReg extends DataExtension
return $relValue;
}
} elseif ($key + 1 == $count && !$owner->hasMethod($value) ) {
- return $this->sregTokenizer($value);
+ return $value;
}
}
} | Removed unnessary call to tokenizer | gorriecoe_silverstripe-sreg | train | php |
fadb8505c021ac8e25e2be75a1649d618f935407 | diff --git a/src/Justimmo/Model/Query/AbstractQuery.php b/src/Justimmo/Model/Query/AbstractQuery.php
index <HASH>..<HASH> 100644
--- a/src/Justimmo/Model/Query/AbstractQuery.php
+++ b/src/Justimmo/Model/Query/AbstractQuery.php
@@ -178,6 +178,10 @@ abstract class AbstractQuery implements QueryInterface
*/
public function filter($key, $value = null)
{
+ if ($value === null) {
+ return $this;
+ }
+
if (is_array($value)) {
if (array_key_exists('min', $value)) {
$this->params['filter'][$key . '_von'] = $value['min'];
@@ -186,7 +190,9 @@ abstract class AbstractQuery implements QueryInterface
$this->params['filter'][$key . '_bis'] = $value['max'];
}
- return $this;
+ if (array_key_exists('min', $value) || array_key_exists('max', $value)) {
+ return $this;
+ }
}
$this->params['filter'][$key] = $value; | fix filter by multiple value in AbstractQuery | justimmo_php-sdk | train | php |
dfdd669d1dff1d00b3d54b4a730c28d6d6c9e70c | diff --git a/gocode.go b/gocode.go
index <HASH>..<HASH> 100644
--- a/gocode.go
+++ b/gocode.go
@@ -23,7 +23,25 @@ func get_socket_filename() string {
return filepath.Join(os.TempDir(), fmt.Sprintf("gocode-daemon.%s", user))
}
+func show_usage() {
+ fmt.Fprintf(os.Stderr,
+ "Usage: %s [-s] [-f=<format>] [-in=<path>] [-sock=<type>] [-addr=<addr>]\n"+
+ " <command> [<args>]\n\n",
+ os.Args[0])
+ fmt.Fprintf(os.Stderr,
+ "Flags:\n")
+ flag.PrintDefaults()
+ fmt.Fprintf(os.Stderr,
+ "\nCommands:\n"+
+ " autocomplete [<path>] <offset> main autocompletion command\n"+
+ " close close the gocode daemon\n"+
+ " status gocode daemon status report\n"+
+ " drop-cache drop gocode daemon's cache\n"+
+ " set [<name> [<value>]] list or set config options\n")
+}
+
func main() {
+ flag.Usage = show_usage
flag.Parse()
var retval int | Add command list to the output when running with -h flag. | nsf_gocode | train | go |
b84696851b497553b7f836bc8243ef1dc1fd9b0d | diff --git a/gcloud/bigquery/dataset.py b/gcloud/bigquery/dataset.py
index <HASH>..<HASH> 100644
--- a/gcloud/bigquery/dataset.py
+++ b/gcloud/bigquery/dataset.py
@@ -347,5 +347,6 @@ def _datetime_from_prop(value):
:rtype: ``datetime.datetime``, or ``NoneType``
"""
if value is not None:
+ # back-end returns timestamps as milliseconds since the epoch
value = datetime.datetime.utcfromtimestamp(value / 1000.0)
return value.replace(tzinfo=pytz.utc) | Note rationale for division of back-end's timestamp by <I>.
Addresses:
<URL> | googleapis_google-cloud-python | train | py |
c836bd2e14feab84d08de4e847f24e01e661a633 | diff --git a/resolwe/flow/models/utils.py b/resolwe/flow/models/utils.py
index <HASH>..<HASH> 100644
--- a/resolwe/flow/models/utils.py
+++ b/resolwe/flow/models/utils.py
@@ -341,11 +341,11 @@ def hydrate_input_uploads(input_, input_schema, hydrate_values=True):
for value in files:
if 'file_temp' in value:
if isinstance(value['file_temp'], six.string_types):
- # If file_temp not url, nor absolute path: hydrate path
- if not os.path.isabs(value['file_temp']) and not urlregex.search(value['file_temp']):
+ # If file_temp not url, hydrate path.
+ if not urlregex.search(value['file_temp']):
value['file_temp'] = manager.get_executor().resolve_upload_path(value['file_temp'])
else:
- # Something very strange happened
+ # Something very strange happened.
value['file_temp'] = 'Invalid value for file_temp in DB' | Ensure even absolute upload paths are resolved | genialis_resolwe | train | py |
d96f7c7ece91f48e6a0c6013c6889089e79d0840 | diff --git a/lib/quickeebooks/shared/service/filter.rb b/lib/quickeebooks/shared/service/filter.rb
index <HASH>..<HASH> 100644
--- a/lib/quickeebooks/shared/service/filter.rb
+++ b/lib/quickeebooks/shared/service/filter.rb
@@ -89,7 +89,7 @@ module Quickeebooks
end
def text_to_xml
- "<#{@field}>#{CGI::escapeHTML(@value)}</#{@field}>"
+ "<#{@field}>#{CGI::escapeHTML(@value.to_s)}</#{@field}>"
end
def boolean_to_s
diff --git a/spec/quickeebooks/shared/filter_spec.rb b/spec/quickeebooks/shared/filter_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/quickeebooks/shared/filter_spec.rb
+++ b/spec/quickeebooks/shared/filter_spec.rb
@@ -104,6 +104,12 @@ describe "Quickeebooks::Shared::Service::Filter" do
:field => 'Foo',
:value => "<3 Bar's ><things").to_xml.should == '<Foo><3 Bar\'s ><things</Foo>'
end
+
+ it 'CGI escapes integers' do
+ filter.new(:text,
+ :field => 'Foo',
+ :value => 3).to_xml.should == '<Foo>3</Foo>'
+ end
end
end | CGI::escapeHTML fails for integers | ruckus_quickeebooks | train | rb,rb |
c15fd76ee9052b257dc16e275078a354695141e7 | diff --git a/test/e2e/storage/drivers/csi.go b/test/e2e/storage/drivers/csi.go
index <HASH>..<HASH> 100644
--- a/test/e2e/storage/drivers/csi.go
+++ b/test/e2e/storage/drivers/csi.go
@@ -241,18 +241,16 @@ func (h *hostpathCSIDriver) PrepareTest(f *framework.Framework) (*storageframewo
return err
}
- // Remove csi-external-health-monitor-agent and
- // csi-external-health-monitor-controller
- // containers. They are not needed for any of the
- // tests and may be causing too much overhead when
- // running in a large cluster (see
- // https://github.com/kubernetes/kubernetes/issues/102452#issuecomment-854452816).
+ // Remove csi-external-health-monitor-agent because it is
+ // obsolete and shouldn't have been deployed by csi-driver-host-path v1.7.2.
+ // This can be removed when updating to a newer driver that
+ // doesn't deploy the agent.
switch item := item.(type) {
case *appsv1.StatefulSet:
var containers []v1.Container
for _, container := range item.Spec.Template.Spec.Containers {
switch container.Name {
- case "csi-external-health-monitor-agent", "csi-external-health-monitor-controller":
+ case "csi-external-health-monitor-agent":
// Remove these containers.
default:
// Keep the others. | e2e storage: enable health-check controller in hostpath deployment
It was disabled together with the agent to avoid test failures in
gce-master-scale-correctness (<URL> | kubernetes_kubernetes | train | go |
558cb86b7a9d533ed15db87af70e893fe9027cde | diff --git a/grade/export/lib.php b/grade/export/lib.php
index <HASH>..<HASH> 100755
--- a/grade/export/lib.php
+++ b/grade/export/lib.php
@@ -235,7 +235,7 @@ class grade_export {
$g = new grade_export_update_buffer();
$grade_grade = new grade_grade(array('itemid'=>$itemid, 'userid'=>$user->id));
$status = $g->track($grade_grade);
-echo "status is $status";
+
if ($this->updatedgradesonly && ($status == 'nochange' || $status == 'unknown')) {
echo '<td>'.get_string('unchangedgrade', 'grade').'</td>';
} else { | MDL-<I>, removing debugging statement | moodle_moodle | train | php |
bcd0ac71aea666eca668cab98c883ac0703c9ae9 | diff --git a/common.go b/common.go
index <HASH>..<HASH> 100644
--- a/common.go
+++ b/common.go
@@ -56,7 +56,7 @@ var dockerCommands = []Command{
{"rm", "Remove one or more containers"},
{"rmi", "Remove one or more images"},
{"run", "Run a command in a new container"},
- {"save", "Save images to a tar archive"},
+ {"save", "Save one or more images to a tar archive"},
{"search", "Search the Docker Hub for images"},
{"start", "Start one or more stopped containers"},
{"stats", "Display a live stream of container(s) resource usage statistics"}, | Update 'save' command help
Based on review feedback. | docker_cli | train | go |
f6fd524bcf91c7c581c5a01dbd483541101352cb | diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js
index <HASH>..<HASH> 100644
--- a/lib/media/drm_engine.js
+++ b/lib/media/drm_engine.js
@@ -1750,6 +1750,7 @@ shaka.media.DrmEngine.timeout_ = function(seconds) {
*
* @param {!Array.<shaka.extern.Variant>} variants
* @param {!Object.<string, string>} keySystems
+ * @private
*/
shaka.media.DrmEngine.replaceDrmInfo_ = function(variants, keySystems) {
const drmInfos = [];
diff --git a/lib/offline/storage.js b/lib/offline/storage.js
index <HASH>..<HASH> 100644
--- a/lib/offline/storage.js
+++ b/lib/offline/storage.js
@@ -1291,6 +1291,7 @@ shaka.offline.Storage.verifyConfig_ = function(config) {
* Go over a period and issue warnings for any suspicious properties.
*
* @param {shaka.extern.Period} period
+ * @private
*/
shaka.offline.Storage.validatePeriod_ = function(period) {
// Make sure that the period has not been reduced to nothing. | Add newly missing @private annotations
Issue #<I>
Change-Id: I<I>cd2ab5b<I>d<I>b5f2f<I>b<I>d<I>d | google_shaka-player | train | js,js |
91bb12c78a983b29f1c2d387ffef63c6edad21d2 | diff --git a/test/e2e/listeners.js b/test/e2e/listeners.js
index <HASH>..<HASH> 100644
--- a/test/e2e/listeners.js
+++ b/test/e2e/listeners.js
@@ -738,7 +738,7 @@ menu anchor.</p>
.to.equal('patterns/01-compounds-block/01-compounds-block.html');
await browser.forward();
- await browser.refresh();
+ await browser.refresh(); // Refreshing because there is tendency to fail without it.
expect(await sgRaw.getAttribute('href'))
.to.equal('patterns/02-components-region/02-components-region.html'); | added comment to e2e listeners test | electric-eloquence_fepper-ui | train | js |
a6cad020f9995bcdf904e8d24d683cafead603c4 | diff --git a/bin/now-deploy.js b/bin/now-deploy.js
index <HASH>..<HASH> 100755
--- a/bin/now-deploy.js
+++ b/bin/now-deploy.js
@@ -623,6 +623,22 @@ function printLogs(host, token) {
// log build
const logger = new Logger(host, {debug, quiet})
+ logger.on('error', async () => {
+ if (!quiet) {
+ console.log(`${chalk.cyan('> Deployment failed!')}`)
+ }
+
+ if (gitRepo && gitRepo.cleanup) {
+ // Delete temporary directory that contains repository
+ gitRepo.cleanup()
+
+ if (debug) {
+ console.log(`> [debug] Removed temporary repo directory`)
+ }
+ }
+ process.exit(1)
+ })
+
logger.on('close', async () => {
if (Array.isArray(autoAliases)) {
const aliasList = autoAliases.filter(item => item !== '')
diff --git a/lib/build-logger.js b/lib/build-logger.js
index <HASH>..<HASH> 100644
--- a/lib/build-logger.js
+++ b/lib/build-logger.js
@@ -57,7 +57,6 @@ module.exports = class Logger extends EventEmitter {
}
if (state.error) {
- console.error('> Deployment error')
this.emit('error')
return
} | Show build errors (#<I>) | zeit_now-cli | train | js,js |
5c18adb4b97c678db70fe3e7ae37ac72d6d60abf | diff --git a/lib/sapi.js b/lib/sapi.js
index <HASH>..<HASH> 100644
--- a/lib/sapi.js
+++ b/lib/sapi.js
@@ -289,4 +289,26 @@ SAPI.prototype.deleteConfig = deleteConfig;
+// -- Images
+
+function searchImages(name, callback) {
+ assert.string(name, 'name');
+ assert.func(callback, 'callback');
+
+ return (this.get(sprintf('/images?name=%s', name), callback));
+}
+
+SAPI.prototype.searchImages = searchImages;
+
+function downloadImage(uuid, callback) {
+ assert.string(uuid, 'uuid');
+ assert.func(callback, 'callback');
+
+ return (this.post(sprintf('/images/%s', uuid), callback));
+}
+
+SAPI.prototype.downloadImage = downloadImage;
+
+
+
module.exports = SAPI; | SAPI-9: SAPI client needs image-related methods | joyent_node-sdc-clients | train | js |
db06dc6a30c3337ac93db2ab8f274000c40d4c00 | diff --git a/tests/plugin-import.py b/tests/plugin-import.py
index <HASH>..<HASH> 100644
--- a/tests/plugin-import.py
+++ b/tests/plugin-import.py
@@ -46,11 +46,7 @@ def test_plugin_order_bad():
'name': 'moduletest',
'path': 'tests/plugins/moduletest'
}]}
- res = fixture.start_tangelo('--config', json.dumps(config), stderr=True)
-
- if not isinstance(res, tuple):
- fixture.stop_tangelo()
- assert 'Tangelo started when we expected it to fail' is False
- stderr = '\n'.join(res[1])
+ (_, _, stderr) = fixture.run_tangelo('--config', json.dumps(config), timeout=3, terminate=True)
+ stderr = "\n".join(stderr)
- assert 'Plugin can reference tangelo.plugin.moduletest True' not in stderr
+ assert "Plugin pluginorder failed to load" in stderr | Updating test to use run_tangelo(); simplifying test expectation logic | Kitware_tangelo | train | py |
8588689c96a8948b6d6ba23d18949c7462299464 | diff --git a/nion/swift/Application.py b/nion/swift/Application.py
index <HASH>..<HASH> 100644
--- a/nion/swift/Application.py
+++ b/nion/swift/Application.py
@@ -346,6 +346,7 @@ class Application:
self.library_name = library_base_name + library_base_index_str
def handle_new():
+ self.library_name = self.__library_name_field.text
workspace_dir = os.path.join(self.directory, self.library_name)
Cache.db_make_directory_if_needed(workspace_dir)
path = os.path.join(workspace_dir, "Nion Swift Workspace.nslib")
@@ -357,6 +358,11 @@ class Application:
return True
return False
+ def handle_new_and_close():
+ handle_new()
+ self.request_close()
+ return False
+
column = self.ui.create_column_widget()
directory_header_row = self.ui.create_row_widget()
@@ -389,7 +395,7 @@ class Application:
library_name_row.add_spacing(26)
library_name_field = self.ui.create_line_edit_widget(properties={"width": 400})
library_name_field.text = self.library_name
- library_name_field.on_return_pressed = handle_new
+ library_name_field.on_return_pressed = handle_new_and_close
library_name_field.on_escape_pressed = self.request_close
library_name_row.add(library_name_field)
library_name_row.add_stretch() | Hack together proper handling of new library dialog. Closes #<I>. | nion-software_nionswift | train | py |
d83e2083fd5e33ef909d7220c06d8b3e408c9137 | diff --git a/js/domains.js b/js/domains.js
index <HASH>..<HASH> 100644
--- a/js/domains.js
+++ b/js/domains.js
@@ -504,7 +504,8 @@ jQuery(document).ready(function($) {
set_forwards: function(domain, forwards) {
- $("[data-forwards='" + domain + "']").find("[data-colname='Forwards']").html(forwards);
+ var column_name = seravo_domains_loc.forwards;
+ $("[data-forwards='" + domain + "']").find("[data-colname='" + column_name + "']").html(forwards);
$('.forward-actions .edit').click(function(e) {
e.preventDefault();
diff --git a/modules/domains.php b/modules/domains.php
index <HASH>..<HASH> 100644
--- a/modules/domains.php
+++ b/modules/domains.php
@@ -88,6 +88,7 @@ if ( ! class_exists('Domains') ) {
'forwards_edit_fail' => __('Error! The action might have failed.', 'seravo'),
'forwards_no_source' => __('Source field can\'t be empty.', 'seravo'),
'continue_edit' => __('Continue', 'seravo'),
+ 'forwards' => __('Forwards', 'seravo'),
);
wp_localize_script('seravo_domains', 'seravo_domains_loc', $loc_translation_domains); | Fix mail forwards language incompatibility
The mail forwards were not rendered correctly, because "Forwards" was
hard-coded and it happened to be a translatable string. | Seravo_seravo-plugin | train | js,php |
e2889fe265ecd89b1f911759b3ff17f5fbabb246 | diff --git a/tools/buildgen/extract_metadata_from_bazel_xml.py b/tools/buildgen/extract_metadata_from_bazel_xml.py
index <HASH>..<HASH> 100755
--- a/tools/buildgen/extract_metadata_from_bazel_xml.py
+++ b/tools/buildgen/extract_metadata_from_bazel_xml.py
@@ -589,6 +589,7 @@ _BUILD_EXTRA_METADATA = {
'build': 'all',
'baselib': True,
'secure': True,
+ 'deps_linkage': 'static',
'dll': True,
'generate_plugin_registry': True
},
@@ -622,6 +623,7 @@ _BUILD_EXTRA_METADATA = {
'grpc_csharp_ext': {
'language': 'c',
'build': 'all',
+ 'deps_linkage': 'static',
'dll': 'only'
},
'grpc_unsecure': {
@@ -629,6 +631,7 @@ _BUILD_EXTRA_METADATA = {
'build': 'all',
'baselib': True,
'secure': False,
+ 'deps_linkage': 'static',
'dll': True,
'generate_plugin_registry': True
}, | Added missing deps_linkage | grpc_grpc | train | py |
a9c4b63f231a3ed01975a953171890be144b4b84 | diff --git a/spec/unit/validators/within_validator_spec.rb b/spec/unit/validators/within_validator_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/validators/within_validator_spec.rb
+++ b/spec/unit/validators/within_validator_spec.rb
@@ -11,6 +11,7 @@ describe 'DataMapper::Validations::WithinValidator' do
'WithinValidatorClass'
end
+ property :id, DataMapper::Property::Serial
property :name, String, :auto_validation => false
end.new | Make sure the anonymous model defines a primary key | emmanuel_aequitas | train | rb |
3df92e3cda1046baae73e44e6b0a62282537b99d | diff --git a/eve_elastic/elastic.py b/eve_elastic/elastic.py
index <HASH>..<HASH> 100644
--- a/eve_elastic/elastic.py
+++ b/eve_elastic/elastic.py
@@ -161,11 +161,11 @@ class Elastic(DataLayer):
if index is None:
index = self.index
try:
- get_indices(self.es).create(self.index)
+ get_indices(self.es).create(index)
except elasticsearch.TransportError:
pass
- def put_mapping(self, app):
+ def put_mapping(self, app, index=None):
"""Put mapping for elasticsearch for current schema.
It's not called automatically now, but rather left for user to call it whenever it makes sense.
@@ -192,10 +192,10 @@ class Elastic(DataLayer):
properties[field] = field_mapping
mapping = {'properties': properties}
- indices.put_mapping(index=self.index, doc_type=resource, body=mapping, ignore_conflicts=True)
+ indices.put_mapping(index=index or self.index, doc_type=resource, body=mapping, ignore_conflicts=True)
def find(self, resource, req, sub_resource_lookup):
- args = getattr(req, 'args', request.args if request else {})
+ args = getattr(req, 'args', request.args if request else {}) or {}
source_config = config.SOURCES[resource]
if args.get('source'): | feat(mapping) - allow for putting the mapping on different indexes | petrjasek_eve-elastic | train | py |
2882ae7828b37030a211b864986ed7ca9c443d92 | diff --git a/spyder/plugins/pylint/widgets/pylintgui.py b/spyder/plugins/pylint/widgets/pylintgui.py
index <HASH>..<HASH> 100644
--- a/spyder/plugins/pylint/widgets/pylintgui.py
+++ b/spyder/plugins/pylint/widgets/pylintgui.py
@@ -265,6 +265,13 @@ class PylintWidget(QWidget):
def set_filename(self, filename):
"""Set filename without performing code analysis."""
filename = to_text_string(filename) # filename is a QString instance
+
+ # Don't try to reload saved analysis for filename, if filename
+ # is the one currently displayed.
+ # Fixes spyder-ide/spyder#13347
+ if self.get_filename() == filename:
+ return
+
self.kill_if_running()
index, _data = self.get_data(filename)
is_parent = self.parent is not None | Pylint: Don't try to reload analysis for the currently displayed file | spyder-ide_spyder | train | py |
c9f349f3c75e16ccdf8ce1ede9c4ec1bbfb49d98 | diff --git a/openaps/vendors/dexcom.py b/openaps/vendors/dexcom.py
index <HASH>..<HASH> 100644
--- a/openaps/vendors/dexcom.py
+++ b/openaps/vendors/dexcom.py
@@ -288,14 +288,15 @@ class iter_calibrations_hours (calibrations):
def main (self, args, app):
params = self.get_params(args)
+ delta = relativedelta.relativedelta(hours=params.get('hours'))
+ now = datetime.now( )
+ since = now - delta
+
records = [ ]
for item in self.dexcom.iter_records('METER_DATA'):
- records.append(item.to_dict( ))
- latest_time = dateutil.parser.parse(records[0]["system_time"])
- earliest_time = dateutil.parser.parse(records[-1]["system_time"])
- time_delta = (latest_time - earliest_time)
- td = time_delta.seconds/3600.0 #convert to hours
- if td >= self.get_params(args)['hours']:
+ if item.system_time >= since:
+ records.append(item.to_dict( ))
+ else:
break
return records | make iter_calibrations_hours more sensitive to hours
Might as well do all three. | openaps_openaps | train | py |
6497db0ac1abf68419bead6890f2dc41fe2bb552 | diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/provider/package/apt.rb
+++ b/lib/chef/provider/package/apt.rb
@@ -118,6 +118,9 @@ class Chef
private
+ # Runs command via shell_out with magic environment to disable
+ # interactive prompts. Command is run with default localization rather
+ # than forcing locale to "C", so command output may not be stable.
def run_noninteractive(command)
shell_out!(command, :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil })
end | Add inline doc for private apt package method | chef_chef | train | rb |
976505120924875f9173a2dc5262b3624f593030 | diff --git a/files/filebrowser_ajax.php b/files/filebrowser_ajax.php
index <HASH>..<HASH> 100755
--- a/files/filebrowser_ajax.php
+++ b/files/filebrowser_ajax.php
@@ -31,6 +31,7 @@ require_once($CFG->libdir.'/filelib.php');
$action = optional_param('action', 'list', PARAM_ALPHA);
+$PAGE->set_context(get_system_context());
require_login();
echo $OUTPUT->header(); // send headers | "MDL-<I>, added set_context" | moodle_moodle | train | php |
3663e4cba448d99d6287bb0f41e0e8731bdb8826 | diff --git a/src/main/java/com/github/davidcarboni/restolino/api/ApiConfiguration.java b/src/main/java/com/github/davidcarboni/restolino/api/ApiConfiguration.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/github/davidcarboni/restolino/api/ApiConfiguration.java
+++ b/src/main/java/com/github/davidcarboni/restolino/api/ApiConfiguration.java
@@ -484,7 +484,7 @@ public class ApiConfiguration {
private static Object invoke(HttpServletRequest request, HttpServletResponse response, Object handler, Method method, Class<?> requestMessage) throws Exception {
Object result = null;
- log.info("Invoking method " + method.getName() + " on " + handler.getClass().getSimpleName());
+ log.info("Invoking method {} on {}", method.getName(), handler.getClass().getSimpleName());
// + " for request message "
// + requestMessage);
if (requestMessage != null) { | Use placeholders instead of string concatenation to defer string creation and only build the string if logging is enabled. | davidcarboni_restolino | train | java |
6ca546730c85b7ec7428d4b2cdf6374d6e74e940 | diff --git a/core/modules.js b/core/modules.js
index <HASH>..<HASH> 100644
--- a/core/modules.js
+++ b/core/modules.js
@@ -34,9 +34,6 @@
});
}
- // TODO: use Espruino.Core.Env.getData().info.builtin_modules
- var BUILT_IN_MODULES = ["http","fs","CC3000","WIZnet"]; // TODO: get these from board.js (hopefully)
-
/** Find any instances of require(...) in the code string and return a list */
var getModulesRequired = function(code) {
var modules = [];
@@ -52,7 +49,11 @@
} else if (state==2 && (tok.type=="STRING")) {
state=0;
var module = tok.value;
- if (BUILT_IN_MODULES.indexOf(module)<0 && modules.indexOf(module)<0)
+ var d = Espruino.Core.Env.getData();
+ var built_in = false;
+ if ("info" in d && "builtin_modules" in d.info)
+ built_in = d.info.builtin_modules.indexOf(module)>=0;
+ if (!built_in && modules.indexOf(module)<0)
modules.push(module);
} else
state = 0; | now automatically figure out which modules we have based on board | espruino_EspruinoTools | train | js |
aa70c5586e8f9dddd3a58c55a5a882d88deeb883 | diff --git a/authomatic/core.py b/authomatic/core.py
index <HASH>..<HASH> 100644
--- a/authomatic/core.py
+++ b/authomatic/core.py
@@ -905,10 +905,8 @@ class Credentials(ReprMixin):
'To deserialize credentials you need to specify a unique '
'integer under the "id" key in the config for each provider!')
- provider_id = int(split[0])
-
# Get provider config by short name.
- provider_name = id_to_name(config, provider_id)
+ provider_name = id_to_name(config, int(split[0]))
cfg = config.get(provider_name)
# Get the provider class. | Don't use method name as variable. | authomatic_authomatic | train | py |
2d9c05b9309833631544eccb67978812930167a9 | diff --git a/group/autogroup.php b/group/autogroup.php
index <HASH>..<HASH> 100644
--- a/group/autogroup.php
+++ b/group/autogroup.php
@@ -42,7 +42,6 @@ if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
require_login($course);
$context = context_course::instance($courseid);
-$systemcontext = context_system::instance();
require_capability('moodle/course:managegroups', $context);
$returnurl = $CFG->wwwroot.'/group/index.php?id='.$course->id;
diff --git a/message/edit.php b/message/edit.php
index <HASH>..<HASH> 100644
--- a/message/edit.php
+++ b/message/edit.php
@@ -61,7 +61,6 @@ if (!$user = $DB->get_record('user', array('id' => $userid))) {
$systemcontext = context_system::instance();
$personalcontext = context_user::instance($user->id);
-$coursecontext = context_course::instance($course->id);
$PAGE->set_context($personalcontext);
$PAGE->set_pagelayout('course'); | MDL-<I> libraries: Remove unused context calls | moodle_moodle | train | php,php |
1ee534f2e86188551a4a836cfb0c4e34a7d3d25b | diff --git a/intranet/apps/eighth/context_processors.py b/intranet/apps/eighth/context_processors.py
index <HASH>..<HASH> 100644
--- a/intranet/apps/eighth/context_processors.py
+++ b/intranet/apps/eighth/context_processors.py
@@ -3,7 +3,13 @@ from .utils import get_start_date
def start_date(request):
- """Add the start date to the context for eighth admin views."""
+ """ Add the start date to the context for eighth admins.
+
+ Returns:
+ The start date if an eighth_admin, an empty dictionary
+ otherwise.
+
+ """
if request.user and request.user.is_authenticated and request.user.is_eighth_admin:
return {"admin_start_date": get_start_date(request)}
@@ -12,12 +18,24 @@ def start_date(request):
def enable_waitlist(request):
- """Add whether the waitlist is enabled to the context"""
+ """ Add whether the waitlist is enabled to the context.
+
+ Returns:
+ bool: Whether the waitlist is enabled.
+
+ """
+
return {"waitlist_enabled": settings.ENABLE_WAITLIST}
def absence_count(request):
- """Add the absence count to the context for students."""
+ """ Add the absence count to the context for students.
+
+ Returns:
+ Number of absences that a student has if
+ a student, an empty dictionary otherwise.
+
+ """
if request.user and request.user.is_authenticated and request.user.is_student:
absence_info = request.user.absence_info() | doc(eighth): add docstrings for eighth context
processors | tjcsl_ion | train | py |
00a5c2aab76cfcbd84b9f6c6d49b577a2ab7e2df | diff --git a/pypodio2/areas.py b/pypodio2/areas.py
index <HASH>..<HASH> 100644
--- a/pypodio2/areas.py
+++ b/pypodio2/areas.py
@@ -521,3 +521,8 @@ class Files(Area):
attributes = {'filename': filename,
'source': filedata}
return self.transport.POST(url='/file/v2/', body=attributes, type='multipart/form-data')
+
+ def copy(self, file_id):
+ """Copy a file to generate a new file_id"""
+
+ return self.transport.POST(url='/file/%s/copy' % file_id) | Adding an api method to generate a copy of the current file | podio_podio-py | train | py |
9858baa9c17d1fcdb6d2cf7de857f96ea6d510f5 | diff --git a/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js b/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js
+++ b/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js
@@ -625,7 +625,7 @@ define(["orion/Deferred", "orion/xhr", "orion/URL-shim", "orion/operation"], fun
"Accept": "application/json",
"Orion-Version": "1"
},
- timeout: 15000
+ timeout: 60000
}).then(function(result) {
return result.response ? JSON.parse(result.response) : {};
}).then(function(result) { | Increase the timeout of file search on Orion file system implementation for now till we have a better solution for the Lucene search speed. | eclipse_orion.client | train | js |
f95cd47c2f20571284fd4c6eec4e9b6074c1aef9 | diff --git a/pygmsh/built_in/spline.py b/pygmsh/built_in/spline.py
index <HASH>..<HASH> 100644
--- a/pygmsh/built_in/spline.py
+++ b/pygmsh/built_in/spline.py
@@ -10,7 +10,7 @@ class Spline(LineBase):
for c in points:
assert isinstance(c, Point)
- assert len(control_points) > 1
+ assert len(points) > 1
self.points = points | Spline has points not the control_points of Bspline #<I> | nschloe_pygmsh | train | py |
da5e4d77a4d09e2b3de0056fa435c2efb310293a | diff --git a/lib/omnibus/ohai.rb b/lib/omnibus/ohai.rb
index <HASH>..<HASH> 100644
--- a/lib/omnibus/ohai.rb
+++ b/lib/omnibus/ohai.rb
@@ -20,15 +20,7 @@ module Omnibus
class Ohai
class << self
def method_missing(m, *args, &block)
- if respond_to_missing?(m)
- ohai.send(m, *args, &block)
- else
- super
- end
- end
-
- def respond_to_missing?(m, include_private = false)
- ohai.respond_to_missing?(m, include_private) || ohai.attribute?(m)
+ ohai.send(m, *args, &block)
end
private | Just fucking delegate everything to Ohai | chef_omnibus | train | rb |
1ee5799c828dce84df39124d55be8ef9850578e8 | diff --git a/src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java b/src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java
index <HASH>..<HASH> 100644
--- a/src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java
+++ b/src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java
@@ -132,7 +132,7 @@ public class ProcessControl {
}
if (!stopped) {
-// logger.severe(""+runtime.getName()+" NOT exited, thats why we destroy");
+ logger.severe(""+runtime.getName()+" NOT exited, thats why we destroy");
process.destroy();
}
} | flapdoodle Redis service start cannot start up process on Windows
* added debug output for task killing | flapdoodle-oss_de.flapdoodle.embed.process | train | java |
ad16b76a1f5b5f540f02ab1acff4f6a1716128c1 | diff --git a/lib/index_shotgun.rb b/lib/index_shotgun.rb
index <HASH>..<HASH> 100644
--- a/lib/index_shotgun.rb
+++ b/lib/index_shotgun.rb
@@ -7,13 +7,3 @@ module IndexShotgun
end
require "index_shotgun/railtie" if defined?(Rails)
-
-begin
- require "mysql2/version"
-
- if Gem::Version.create(Mysql2::VERSION) >= Gem::Version.create("0.4.0") &&
- ActiveRecord.version < Gem::Version.create("4.2.5")
- raise "Requirements activerecord gem v4.2.5+ when using mysql2 gem v0.4.0+"
- end
-rescue LoadError # rubocop:disable Lint/HandleExceptions
-end | Rails <I> is already droppped | sue445_index_shotgun | train | rb |
a4b6deadf7cd81b1579966bc8c34e9eb0486137a | diff --git a/flux-link.js b/flux-link.js
index <HASH>..<HASH> 100644
--- a/flux-link.js
+++ b/flux-link.js
@@ -39,8 +39,8 @@ function mkenv(env, log) {
abort_after : null,
$log : log
},
- $throw : cf_throw,
- $catch : cf_catch
+ $throw : _.bind(cf_throw, env),
+ $catch : _.bind(cf_catch, env)
});
} | Added instance binding for and to allow them to be passed as callbacks correctly. | gmalysa_flux-link | train | js |
adcddc6d18884def0864e420200df1f2c7ce5cde | diff --git a/hystrix/settings.go b/hystrix/settings.go
index <HASH>..<HASH> 100644
--- a/hystrix/settings.go
+++ b/hystrix/settings.go
@@ -5,7 +5,7 @@ import (
"time"
)
-const (
+var (
// DefaultTimeout is how long to wait for command to complete, in milliseconds
DefaultTimeout = 1000
// DefaultMaxConcurrent is how many commands of the same type can run at the same time | Make hystrix Default values writeable
This allows an app to override the default settings when it starts up. | afex_hystrix-go | train | go |
aa371e2dd0215ba55fa7426edbe356c16a0caaba | diff --git a/integration/shared/isolated/create_shared_domain_test.go b/integration/shared/isolated/create_shared_domain_test.go
index <HASH>..<HASH> 100644
--- a/integration/shared/isolated/create_shared_domain_test.go
+++ b/integration/shared/isolated/create_shared_domain_test.go
@@ -233,7 +233,20 @@ var _ = Describe("create-shared-domain command", func() {
Eventually(session).Should(Exit(1))
})
- When("With router-group flag", func() {
+ When("with --internal flag", func() {
+ BeforeEach(func() {
+ helpers.SkipIfVersionLessThan(ccversion.MinVersionInternalDomainV2)
+ })
+
+ It("should fail and return an unauthorized message", func() {
+ session := helpers.CF("create-shared-domain", domainName, "--internal")
+ Eventually(session).Should(Say("FAILED"))
+ Eventually(session.Err).Should(Say("You are not authorized to perform the requested action"))
+ Eventually(session).Should(Exit(1))
+ })
+ })
+
+ When("with --router-group flag", func() {
BeforeEach(func() {
helpers.SkipIfNoRoutingAPI()
}) | Added integration test for --internal flag of create-shared-domain
command
[#<I>] | cloudfoundry_cli | train | go |
fec8bb4fee4d552a5c012bb9d574bea0795c1c54 | diff --git a/kitnirc/contrib/admintools.py b/kitnirc/contrib/admintools.py
index <HASH>..<HASH> 100644
--- a/kitnirc/contrib/admintools.py
+++ b/kitnirc/contrib/admintools.py
@@ -76,6 +76,9 @@ class AdminModule(Module):
client.reply(recipient, actor, "Okay.")
elif result is False:
client.reply(recipient, actor, "Sorry, try again.")
+
+ # Suprress further handling of the PRIVMSG event.
+ return True
def join(self, client, args):
if not args: | Suppress handling of PRIVMSG events after an admintools command. | ayust_kitnirc | train | py |
8d1c94b21071721402e18171ed1c6b1c84a945fc | diff --git a/test/functional/connections_stepdown.test.js b/test/functional/connections_stepdown.test.js
index <HASH>..<HASH> 100644
--- a/test/functional/connections_stepdown.test.js
+++ b/test/functional/connections_stepdown.test.js
@@ -135,14 +135,14 @@ describe('Connections survive primary step down', function () {
});
}
- it('Not Master - Keep Connection Pool', {
+ it('Not Primary - Keep Connection Pool', {
metadata: { requires: { mongodb: '>=4.2.0', topology: 'replicaset' } },
test: function () {
return runStepownScenario(10107, expectPoolWasNotCleared);
}
});
- it('Not Master - Reset Connection Pool', {
+ it('Not Primary - Reset Connection Pool', {
metadata: { requires: { mongodb: '4.0.x', topology: 'replicaset' } },
test: function () {
return runStepownScenario(10107, expectPoolWasCleared); | refactor(NODE-<I>):Update tests with oppressive language in their description | mongodb_node-mongodb-native | train | js |
5f373304975e7dc8cf91e2ed2858596a8c195659 | diff --git a/src/Repository/Doctrine/ORMRepository.php b/src/Repository/Doctrine/ORMRepository.php
index <HASH>..<HASH> 100644
--- a/src/Repository/Doctrine/ORMRepository.php
+++ b/src/Repository/Doctrine/ORMRepository.php
@@ -182,7 +182,9 @@ class ORMRepository implements
$criteriaParams = $criteria;
$criteria = Criteria::create();
- $criteria->where($criteriaParams);
+ foreach ($criteriaParams as $name => $value) {
+ $criteria->andWhere($criteria->expr()->eq($name, $value));
+ }
}
$queryBuilder = $this->getQueryBuilder($criteria); | Fixed the findOneBy method for when no criteria is passed. | polderknowledge_entityservice | train | php |
3531a46ed9bb0b4f869667ae8c0e96d5f08e070b | diff --git a/src/Router.php b/src/Router.php
index <HASH>..<HASH> 100644
--- a/src/Router.php
+++ b/src/Router.php
@@ -254,12 +254,18 @@ final class Router
// Drop input & mark fields.
$match = array_slice($match, 1, -1);
- // Replace conditional replacements.
+ // Handle conditional replacements.
foreach ($calls as $i => $call) {
$rep = grep($call, '~{(\w+)}~');
- if ($rep && isset($match[$rep])) {
- $calls[$i] = str_replace('{' . $rep . '}', $match[$rep], $call);
- $usedArgs[$match[$rep]] = 1; // Tick.
+ if ($rep) {
+ if (isset($match[$rep])) {
+ // Replace & tick ("-" for camel-case).
+ $calls[$i] = str_replace('{' . $rep . '}', $match[$rep] . '-', $call);
+ $usedArgs[$match[$rep]] = 1;
+ } else {
+ // Remove non-found replacements from call.
+ $calls[$i] = str_replace('{' . $rep . '}', '', $call);
+ }
}
} | Router: fix conditional replacements. | froq_froq | train | php |
c4218db22f7fb12da00e41f028d7ee5f80ec6f15 | diff --git a/src/ossos-pipeline/ossos/storage.py b/src/ossos-pipeline/ossos/storage.py
index <HASH>..<HASH> 100644
--- a/src/ossos-pipeline/ossos/storage.py
+++ b/src/ossos-pipeline/ossos/storage.py
@@ -382,9 +382,10 @@ def set_property(node_uri, property_name, property_value, ossos_base=True):
node = vospace.getNode(node_uri)
property_uri = tag_uri(property_name) if ossos_base else property_name
- # First clear any existing value
- node.props[property_uri] = None
- vospace.addProps(node)
+ # If there is an existing value, clear it first
+ if property_uri in node.props:
+ node.props[property_uri] = None
+ vospace.addProps(node)
node.props[property_uri] = property_value
vospace.addProps(node) | Only do the extra call to clear the property if the node already has that
property. | OSSOS_MOP | train | py |
b7e983a0a4d35767df4f20c713ef836f7cce76db | diff --git a/src/Saft/Addition/ARC2/Store/ARC2.php b/src/Saft/Addition/ARC2/Store/ARC2.php
index <HASH>..<HASH> 100644
--- a/src/Saft/Addition/ARC2/Store/ARC2.php
+++ b/src/Saft/Addition/ARC2/Store/ARC2.php
@@ -315,7 +315,9 @@ class ARC2 extends AbstractSparqlStore
// collect graph URI's
while ($row = $result->fetch_assoc()) {
- $graphs[$row['graphUri']] = $this->nodeFactory->createNamedNode($row['graphUri']);
+ if (NodeUtils::simpleCheckURI($row['graphUri'])) {
+ $graphs[$row['graphUri']] = $this->nodeFactory->createNamedNode($row['graphUri']);
+ }
}
return $graphs; | ARC2: Add further check in getGraphs to avoid errors if no graph was found | SaftIng_Saft | train | php |
c33f6cfadb0216e3a684e4f7572939ac8d5b6b6b | diff --git a/atlassian/bitbucket/cloud/repositories/branchRestrictions.py b/atlassian/bitbucket/cloud/repositories/branchRestrictions.py
index <HASH>..<HASH> 100644
--- a/atlassian/bitbucket/cloud/repositories/branchRestrictions.py
+++ b/atlassian/bitbucket/cloud/repositories/branchRestrictions.py
@@ -145,14 +145,14 @@ class BranchRestriction(BitbucketCloudBase):
return self.get_data("kind")
@property
- def branch_match_kindstring(self):
- """The branch restriction match kindstring"""
- return self.get_data("branch_match_kindstring")
+ def branch_match_kind(self):
+ """The branch restriction match kind"""
+ return self.get_data("branch_match_kind")
@property
- def branch_typestring(self):
- """The branch restriction typestring"""
- return self.get_data("branch_typestring")
+ def branch_type(self):
+ """The branch restriction type"""
+ return self.get_data("branch_type")
@property
def pattern(self): | fix 'string' typo (#<I>)
Both 'branch_type' and 'branch_match_kind' contained a typo adding 'string' which prevented them from working as intended. | atlassian-api_atlassian-python-api | train | py |
780010c33594ca30e4e5138faaed7a709063eb2a | diff --git a/guides/bug_report_templates/action_controller_gem.rb b/guides/bug_report_templates/action_controller_gem.rb
index <HASH>..<HASH> 100644
--- a/guides/bug_report_templates/action_controller_gem.rb
+++ b/guides/bug_report_templates/action_controller_gem.rb
@@ -16,6 +16,7 @@ require "action_controller/railtie"
class TestApp < Rails::Application
config.root = __dir__
+ config.hosts << "example.org"
config.session_store :cookie_store, key: "cookie_store_key"
secrets.secret_key_base = "secret_key_base" | Fixed ActionController Gem bug report by adding allowed hosts config | rails_rails | train | rb |
4bea0fa8e1095400d4aa6839cde3bcb99ffffe67 | diff --git a/namer/plural_namer.go b/namer/plural_namer.go
index <HASH>..<HASH> 100644
--- a/namer/plural_namer.go
+++ b/namer/plural_namer.go
@@ -59,7 +59,7 @@ func (r *pluralNamer) Name(t *types.Type) string {
return r.finalize(plural)
}
if len(singular) < 2 {
- return r.finalize(plural)
+ return r.finalize(singular)
}
switch rune(singular[len(singular)-1]) {
@@ -87,7 +87,7 @@ func (r *pluralNamer) Name(t *types.Type) string {
plural = sPlural(singular)
}
case 'f':
- plural = vesPlural(singular)
+ plural = vesPlural(singular)
default:
plural = sPlural(singular)
} | fixes, returns an empty string when the name length is less than 2 | kubernetes_gengo | train | go |
2767622383863b23d8f00358245068a2f6d22c1c | diff --git a/src/qjax.js b/src/qjax.js
index <HASH>..<HASH> 100644
--- a/src/qjax.js
+++ b/src/qjax.js
@@ -15,13 +15,13 @@
, defaultHeaders = {
contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
, Accept: {
- '*' : 'text/javascript, text/html, application/xml,' +
- ' text/xml, */*'
- , xml : 'application/xml, text/xml'
- , html : 'text/html'
- , text : 'text/plain'
- , json : 'application/json, text/javascript'
- , js : 'application/javascript, text/javascript'
+ '*' : 'text/javascript, text/html, application/xml,' +
+ ' text/xml, */*'
+ , xml : 'application/xml, text/xml'
+ , html : 'text/html'
+ , text : 'text/plain'
+ , json : 'application/json, text/javascript'
+ , script : 'application/javascript, text/javascript'
}
, requestedWith: xmlHttpRequest
} | and this is why i need to mock xhr | geowa4_pajamas | train | js |
ff565879723f4f797339131db7738b1bec19d150 | diff --git a/pygtkhelpers/proxy.py b/pygtkhelpers/proxy.py
index <HASH>..<HASH> 100644
--- a/pygtkhelpers/proxy.py
+++ b/pygtkhelpers/proxy.py
@@ -129,6 +129,7 @@ class StringListProxy(GObjectProxy):
def set_widget_value(self, value):
self.widget.value = value
+
class GtkRangeProxy(GObjectProxy):
signal_name = 'value-changed'
@@ -139,6 +140,25 @@ class GtkRangeProxy(GObjectProxy):
self.widget.set_value(value)
+class GtkFileChooserButtonProxy(GObjectProxy):
+ signal_name = 'selection-changed'
+
+ def get_widget_value(self):
+ if self.widget.get_select_multiple():
+ return self.widget.get_filenames()
+ else:
+ return self.widget.get_filename()
+
+ def set_widget_value(self, value):
+ if self.widget.get_select_multiple():
+ self.widget.unselect_all()
+ for filename in value:
+ self.widget.select_file(filename)
+ else:
+ self.widget.set_filename(value)
+
+
+
class GtkComboBoxProxy(GObjectProxy):
signal_name = 'changed' | Added a file chooser button proxy | sci-bots_pygtkhelpers | train | py |
a9d077fef78f141a8ddc885a7f92837d5ee29d75 | diff --git a/aafig/sphinxcontrib/aafig.py b/aafig/sphinxcontrib/aafig.py
index <HASH>..<HASH> 100644
--- a/aafig/sphinxcontrib/aafig.py
+++ b/aafig/sphinxcontrib/aafig.py
@@ -131,7 +131,10 @@ def render_aafig_images(app, doctree):
# FIXME: find some way to avoid this hack in aafigure
if extra:
(width, height) = [x.split('"')[1] for x in extra.split()]
- (img['width'], img['height']) = (width, height)
+ if not img.has_key('width'):
+ img['width'] = width
+ if not img.has_key('height'):
+ img['height'] = height
def render_aafigure(app, text, options): | aafig: Don't override width and height for SVG images
If width or height options are already present in the figure, don't override
them with the width and height provided by the aafigure visitor. | sphinx-contrib_paverutils | train | py |
f258bb08c5efd60ac4b9561e69e8f4f967949a3c | diff --git a/tests/test_parser.py b/tests/test_parser.py
index <HASH>..<HASH> 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -172,6 +172,19 @@ class WordTokenizeTestCase(unittest.TestCase):
tokenize_whitespace=True
)) == [('around',), (' ',), ('the',), (' ',), ('world', )]
+ def test_tokenize_punctuation_and_whitespace(self):
+ assert list(textparser.word_tokenize(
+ text='who, where, what, when, why?',
+ retain_punctuation=True,
+ tokenize_whitespace=True
+ )) == [
+ ('who',), (',',), (' ',),
+ ('where',), (',',), (' ',),
+ ('what',), (',',), (' ',),
+ ('when',), (',',), (' ',),
+ ('why',), ('?',),
+ ]
+
class TestNullStemmer(unittest.TestCase):
def test_repr(self): | Add test coverage over combination of whitespace + punctuation | MichaelAquilina_hashedindex | train | py |
742b869821bc50f8ffb3180ce38de2b14da99aeb | diff --git a/src/FreeDSx/Socket/Socket.php b/src/FreeDSx/Socket/Socket.php
index <HASH>..<HASH> 100644
--- a/src/FreeDSx/Socket/Socket.php
+++ b/src/FreeDSx/Socket/Socket.php
@@ -161,7 +161,7 @@ class Socket
*/
public function isConnected() : bool
{
- return \is_resource($this->socket);
+ return $this->socket !== null && !@\feof($this->socket);
}
/**
diff --git a/tests/spec/FreeDSx/Socket/SocketSpec.php b/tests/spec/FreeDSx/Socket/SocketSpec.php
index <HASH>..<HASH> 100644
--- a/tests/spec/FreeDSx/Socket/SocketSpec.php
+++ b/tests/spec/FreeDSx/Socket/SocketSpec.php
@@ -56,4 +56,13 @@ class SocketSpec extends ObjectBehavior
{
$this::udp('8.8.8.8', ['port' => 53])->getOptions()->shouldHaveKeyWithValue('buffer_size', 65507);
}
+
+ function it_should_tell_whether_or_not_it_is_connected()
+ {
+ $this->beConstructedThrough('tcp', ['www.google.com', ['port' => 80]]);
+
+ $this->isConnected()->shouldBeEqualTo(true);
+ $this->close();
+ $this->isConnected()->shouldBeEqualTo(false);
+ }
} | Correctly determine if a socket is connected or not. | FreeDSx_Socket | train | php,php |
b4840e278881a020ba606fd041ee3e2a491467d9 | diff --git a/stats/src/main/java/com/proofpoint/stats/MeterStat.java b/stats/src/main/java/com/proofpoint/stats/MeterStat.java
index <HASH>..<HASH> 100644
--- a/stats/src/main/java/com/proofpoint/stats/MeterStat.java
+++ b/stats/src/main/java/com/proofpoint/stats/MeterStat.java
@@ -57,7 +57,7 @@ public class MeterStat
oneMinute.update(value);
fiveMinute.update(value);
fifteenMinute.update(value);
- sum.incrementAndGet();
+ sum.addAndGet(value);
}
@Managed | fix sum computation (it was just counting) | airlift_airlift | train | java |
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.