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 |
|---|---|---|---|---|---|
9362251270082c659d302684bf76389ca56ab842 | diff --git a/code/libraries/koowa/database/adapter/mysqli.php b/code/libraries/koowa/database/adapter/mysqli.php
index <HASH>..<HASH> 100644
--- a/code/libraries/koowa/database/adapter/mysqli.php
+++ b/code/libraries/koowa/database/adapter/mysqli.php
@@ -168,8 +168,8 @@ class KDatabaseAdapterMysqli extends KDatabaseAdapterAbstract
* @return boolean
*/
public function active()
- {
- return is_resource($this->_connection) && $this->_connection->ping();
+ {
+ return is_object($this->_connection) && @$this->_connection->ping();
}
/** | Supress errors generated by ping method. | joomlatools_joomlatools-framework | train | php |
80d8c180466c3229318950504267f9a628b6ff64 | diff --git a/src/GrumPHP/Console/Command/ConfigureCommand.php b/src/GrumPHP/Console/Command/ConfigureCommand.php
index <HASH>..<HASH> 100644
--- a/src/GrumPHP/Console/Command/ConfigureCommand.php
+++ b/src/GrumPHP/Console/Command/ConfigureCommand.php
@@ -246,9 +246,12 @@ class ConfigureCommand extends Command
protected function getAvailableTasks()
{
$tasks = array(
- '1' => 'phpcs',
- '2' => 'phpspec',
- '3' => 'phpunit',
+ '1' => 'behat',
+ '2' => 'blacklist',
+ '3' => 'phpcs',
+ '4' => 'phpcsfixer',
+ '5' => 'phpspec',
+ '6' => 'phpunit',
);
return $tasks;
} | Add all basic tasks to the configure command. | phpro_grumphp | train | php |
b6f31c27ef14aaabd99cce4028c436e2a6ecee2d | diff --git a/imutils/face_utils/facealigner.py b/imutils/face_utils/facealigner.py
index <HASH>..<HASH> 100644
--- a/imutils/face_utils/facealigner.py
+++ b/imutils/face_utils/facealigner.py
@@ -1,5 +1,6 @@
# import the necessary packages
-from .helpers import FACIAL_LANDMARKS_IDXS
+from .helpers import FACIAL_LANDMARKS_68_IDXS
+from .helpers import FACIAL_LANDMARKS_5_IDXS
from .helpers import shape_to_np
import numpy as np
import cv2 | Added support for Dlib’s 5-point facial landmark detector | jrosebr1_imutils | train | py |
5ada0bdab29135193f68029f2f8e27595847f932 | diff --git a/nano.js b/nano.js
index <HASH>..<HASH> 100644
--- a/nano.js
+++ b/nano.js
@@ -49,6 +49,9 @@ module.exports = exports = nano = function database_module(cfg) {
if(cfg.proxy) {
request = request.defaults({proxy: cfg.proxy}); // proxy support
}
+ if(!cfg.jar) {
+ request = request.defaults({jar: false}); // use cookie jar
+ }
if(!cfg.url) {
console.error("bad cfg: using default=" + default_url);
cfg = {url: default_url}; // if everything else fails, use default
@@ -104,6 +107,11 @@ module.exports = exports = nano = function database_module(cfg) {
, status_code
, parsed
, rh;
+
+ if (opts.jar) {
+ req.jar = opts.jar;
+ }
+
if(opts.path) {
req.uri += "/" + opts.path;
} | Add ability to enable / disable cookie jar (global or per request) | cloudant_nodejs-cloudant | train | js |
71048e9b3b67d864e6d03eac3db9993277d02893 | diff --git a/rope/base/fscommands.py b/rope/base/fscommands.py
index <HASH>..<HASH> 100644
--- a/rope/base/fscommands.py
+++ b/rope/base/fscommands.py
@@ -203,20 +203,21 @@ def read_str_coding(source):
return _find_coding(source[:second])
-def _find_coding(first_two_lines):
+def _find_coding(text):
coding = 'coding'
try:
- start = first_two_lines.index(coding) + len(coding)
- while start < len(first_two_lines):
- if first_two_lines[start] not in '=: \t':
- break
+ start = text.index(coding) + len(coding)
+ if text[start] not in '=:':
+ return
+ start += 1
+ while start < len(text) and text[start].isspace():
start += 1
end = start
- while end < len(first_two_lines):
- c = first_two_lines[end]
+ while end < len(text):
+ c = text[end]
if not c.isalnum() and c not in '-_':
break
end += 1
- return first_two_lines[start:end]
+ return text[start:end]
except ValueError:
pass | fscommands: better encoding extraction in _find_coding() | python-rope_rope | train | py |
b8e2800aa6887fddc2ca2e2ba9c890ffa8448e92 | diff --git a/monolithe/specifications/repositorymanager.py b/monolithe/specifications/repositorymanager.py
index <HASH>..<HASH> 100644
--- a/monolithe/specifications/repositorymanager.py
+++ b/monolithe/specifications/repositorymanager.py
@@ -148,7 +148,7 @@ class RepositoryManager (object):
path = os.path.normpath("%s/%s" % (self._repository_path, "monolithe.ini"))
try:
data = base64.b64decode(self._repo.get_file_contents(path, ref=branch).content)
- string_buffer = io.StringIO(data)
+ string_buffer = StringIO.StringIO(data)
monolithe_config_parser = configparser.ConfigParser()
monolithe_config_parser.readfp(string_buffer)
return monolithe_config_parser | do not use io, there are some bugs with future | nuagenetworks_monolithe | train | py |
c6e75ac3e5099a32e5ff0bbc087c1458246ff8b4 | diff --git a/lib/jsonapi/link_builder.rb b/lib/jsonapi/link_builder.rb
index <HASH>..<HASH> 100644
--- a/lib/jsonapi/link_builder.rb
+++ b/lib/jsonapi/link_builder.rb
@@ -127,12 +127,11 @@ module JSONAPI
end
def resource_path(source)
- url = "#{resources_path(source.class)}"
-
- unless source.class.singleton?
- url = "#{url}/#{source.id}"
+ if source.class.singleton?
+ resources_path(source.class)
+ else
+ "#{resources_path(source.class)}/#{source.id}"
end
- url
end
def resource_url(source) | Optimize resource_path generation to reduce string allocations | cerebris_jsonapi-resources | train | rb |
9032c2a7df6af08ea5e9d556c98516e3d3f9ec87 | diff --git a/awslimitchecker/services/lambdafunc.py b/awslimitchecker/services/lambdafunc.py
index <HASH>..<HASH> 100644
--- a/awslimitchecker/services/lambdafunc.py
+++ b/awslimitchecker/services/lambdafunc.py
@@ -117,16 +117,16 @@ class _LambdaService(_AwsService):
return
self.connect()
lims = self.conn.get_account_settings()['AccountLimit']
- self.limits['Code Size Unzipped (MiB)']._set_api_limit(
- (lims['CodeSizeUnzipped']/1048576))
- self.limits['Code Size Zipped (MiB)']._set_api_limit(
- (lims['CodeSizeZipped']/1048576))
self.limits['Total Code Size (GiB)']._set_api_limit(
(lims['TotalCodeSize']/1048576/1024))
+ self.limits['Code Size Unzipped (MiB)']._set_api_limit(
+ (lims['CodeSizeUnzipped']/1048576))
self.limits['Unreserved Concurrent Executions']._set_api_limit(
lims['UnreservedConcurrentExecutions'])
self.limits['Concurrent Executions']._set_api_limit(
lims['ConcurrentExecutions'])
+ self.limits['Code Size Zipped (MiB)']._set_api_limit(
+ (lims['CodeSizeZipped']/1048576))
def _construct_limits(self):
self.limits = {} | PR #<I> - make order match between _construct_limits and _update_limits_from_api because I'm horribly pedantic | jantman_awslimitchecker | train | py |
f73412bde045d5d85e1ddb334a56dcd836f5fada | diff --git a/tests/Concise/Matcher/BooleanTest.php b/tests/Concise/Matcher/BooleanTest.php
index <HASH>..<HASH> 100644
--- a/tests/Concise/Matcher/BooleanTest.php
+++ b/tests/Concise/Matcher/BooleanTest.php
@@ -22,4 +22,21 @@ class BooleanTest extends AbstractMatcherTestCase
'b is false'
);
}
+
+ public function failedMessages()
+ {
+ return array(
+ array('false', array(), 'Failed'),
+ array('? is true', array(false), 'Value is not true.'),
+ array('? is false', array(true), 'Value is not false.'),
+ );
+ }
+
+ /**
+ * @dataProvider failedMessages
+ */
+ public function testFailedMessageForFalse($syntax, $args, $message)
+ {
+ $this->assertEquals($message, $this->matcher->match($syntax, $args));
+ }
} | Failed messages for boolean matchers | elliotchance_concise | train | php |
d5498a390935ed5ffa31398cf56cff6f68bd6b29 | diff --git a/chess/pgn.py b/chess/pgn.py
index <HASH>..<HASH> 100644
--- a/chess/pgn.py
+++ b/chess/pgn.py
@@ -1354,10 +1354,10 @@ def read_game(handle: TextIO, *, Visitor: Any = GameBuilder) -> Any:
By using text mode, the parser does not need to handle encodings. It is the
caller's responsibility to open the file with the correct encoding.
- PGN files are usually ASCII or UTF-8 encoded. So, the following should
- cover most relevant cases (ASCII, UTF-8, UTF-8 with BOM).
+ PGN files are usually ASCII or UTF-8 encoded, sometimes with BOM (which
+ this parser automatically ignores).
- >>> pgn = open("data/pgn/kasparov-deep-blue-1997.pgn", encoding="utf-8-sig")
+ >>> pgn = open("data/pgn/kasparov-deep-blue-1997.pgn", encoding="utf-8")
Use :class:`~io.StringIO` to parse games from a string. | User does not have to handle BOM anymore | niklasf_python-chess | train | py |
aa28a8b4f1a72d86130cf2ee8ffbc81d4f3c5aab | diff --git a/lib/snapshot/collector.rb b/lib/snapshot/collector.rb
index <HASH>..<HASH> 100644
--- a/lib/snapshot/collector.rb
+++ b/lib/snapshot/collector.rb
@@ -20,7 +20,8 @@ module Snapshot
language_folder = File.join(Snapshot.config[:output_directory], language)
FileUtils.mkdir_p(language_folder)
- output_path = File.join(language_folder, [device_type, name].join("-") + ".png")
+ device_name = device_type.gsub(" ", "")
+ output_path = File.join(language_folder, [device_name, name].join("-") + ".png")
from_path = File.join(attachments_path, filename)
if $verbose
Helper.log.info "Copying file '#{from_path}' to '#{output_path}'...".green | Updated naming of screenshots to not have spaces | fastlane_fastlane | train | rb |
7f60882f945ee593fb8789f21cc8a113c57bef39 | diff --git a/test_project/test_project/urls.py b/test_project/test_project/urls.py
index <HASH>..<HASH> 100644
--- a/test_project/test_project/urls.py
+++ b/test_project/test_project/urls.py
@@ -1,5 +1,6 @@
import time
+from django.conf import settings
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
@@ -16,6 +17,8 @@ class SleepView(generic.TemplateView):
return super(SleepView, self).get(request, *args, **kwargs)
urlpatterns = patterns('',
+ url(r'^favicon\.ico$', generic.RedirectView.as_view(
+ url=settings.STATIC_URL + '/favicon.ico')),
url(r'^$', generic.TemplateView.as_view(template_name='home.html')),
url(r'^sleep/$', login_required(
SleepView.as_view(template_name='home.html')), name='sleep'), | Get rid of the annoying 'Not Found: /favicon.ico' during test | yourlabs_django-session-security | train | py |
e6510a854b10faf9c31d48eb5a4908d1612865df | diff --git a/pydle/async.py b/pydle/async.py
index <HASH>..<HASH> 100644
--- a/pydle/async.py
+++ b/pydle/async.py
@@ -104,7 +104,7 @@ class EventLoop:
self.run_thread = None
self.handlers = {}
self.future_timeout = FUTURE_TIMEOUT
- self._registered_events = False
+ self._registered_events = set()
self._future_timeouts = {}
self._timeout_id = 0
self._timeout_handles = {}
@@ -175,7 +175,7 @@ class EventLoop:
def _update_events(self, fd):
- if self._registered_events:
+ if fd in self._registered_events:
self.io_loop.remove_handler(fd)
events = 0
@@ -184,7 +184,7 @@ class EventLoop:
events |= ident
self.io_loop.add_handler(fd, self._do_on_event, events)
- self._registered_events = True
+ self._registered_events.add(fd)
def _do_on_event(self, fd, events):
if fd not in self.handlers: | Fix issue with tracking event loop handler registration per FD. | Shizmob_pydle | train | py |
e594e07e8c7e4c629da5a2fedfaed0d7730a0b23 | diff --git a/lib/jaysus/base.rb b/lib/jaysus/base.rb
index <HASH>..<HASH> 100644
--- a/lib/jaysus/base.rb
+++ b/lib/jaysus/base.rb
@@ -170,6 +170,18 @@ module Jaysus
"#{send(self.class.model_base.primary_key)}"
end
+ def to_json
+ {}.tap do |outer_hash|
+ outer_hash[self.class.store_file_dir_name.singularize] = {}.tap do |inner_hash|
+ self.class.model_base.attributes.each do |attribute|
+ if self.send(attribute).present?
+ inner_hash[attribute] = self.send(attribute)
+ end
+ end
+ end
+ end.to_json
+ end
+
def persisted?
store_file.exist?
end | overload to_json to only provide methods if they exist | paulca_jaysus | train | rb |
ec8ba5ab3c11ca5100f1f85e41ae22d3944b8838 | diff --git a/lib/wed/wed.js b/lib/wed/wed.js
index <HASH>..<HASH> 100644
--- a/lib/wed/wed.js
+++ b/lib/wed/wed.js
@@ -559,6 +559,11 @@ Editor.prototype._postInitialize = log.wrap(function () {
this.decorator.startListening(this.$gui_root);
+ // Drag and drop not supported.
+ this.$gui_root.on("dragenter", false);
+ this.$gui_root.on("dragover", false);
+ this.$gui_root.on("drop", false);
+
this.$gui_root.on('wed-global-keydown',
this._globalKeydownHandler.bind(this)); | Turn off drag and drop in the editing area. | mangalam-research_wed | train | js |
51253b0f8bf1b224b289a6c3f8160b137b47c251 | diff --git a/spyderlib/widgets/externalshell/monitor.py b/spyderlib/widgets/externalshell/monitor.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/externalshell/monitor.py
+++ b/spyderlib/widgets/externalshell/monitor.py
@@ -23,7 +23,7 @@ from spyderlib.baseconfig import get_conf_path, get_supported_types, DEBUG
from spyderlib.py3compat import getcwd, is_text_string, pickle, _thread
-SUPPORTED_TYPES = get_supported_types()
+SUPPORTED_TYPES = {}
LOG_FILENAME = get_conf_path('monitor.log')
@@ -48,6 +48,9 @@ def get_remote_data(data, settings, mode, more_excluded_names=None):
* more_excluded_names: additional excluded names (list)
"""
from spyderlib.widgets.dicteditorutils import globalsfilter
+ global SUPPORTED_TYPES
+ if not SUPPORTED_TYPES:
+ SUPPORTED_TYPES = get_supported_types()
assert mode in list(SUPPORTED_TYPES.keys())
excluded_names = settings['excluded_names']
if more_excluded_names is not None: | External Console: Prevent pandas from being imported too early when creating a console
- This was making pandas to set an incorrect encoding for the console
- See this SO question for the problem: <URL> | spyder-ide_spyder | train | py |
9b9ebc8b5537cb4184836ac8e3db8d1618c38b59 | diff --git a/lib/sdl.rb b/lib/sdl.rb
index <HASH>..<HASH> 100644
--- a/lib/sdl.rb
+++ b/lib/sdl.rb
@@ -23,7 +23,7 @@ end
module SDL
- VERSION = "1.2.0"
+ VERSION = "1.3.0"
class PixelFormat | change constant SDL::VERSION | ohai_rubysdl | train | rb |
d49b041c3adccad014ac387e9d9411ec8a98523f | diff --git a/lib/chefspec/policyfile.rb b/lib/chefspec/policyfile.rb
index <HASH>..<HASH> 100644
--- a/lib/chefspec/policyfile.rb
+++ b/lib/chefspec/policyfile.rb
@@ -23,7 +23,6 @@ module ChefSpec
#
def setup!
policyfile_path = File.join(Dir.pwd, 'Policyfile.rb')
- cbdir = File.join(@tmpdir, 'cookbooks')
installer = ChefDK::PolicyfileServices::Install.new(
policyfile: policyfile_path,
@@ -40,7 +39,12 @@ module ChefSpec
FileUtils.rm_rf(@tmpdir)
exporter.run
- ::RSpec.configure { |config| config.cookbook_path = cbdir }
+ ::RSpec.configure do |config|
+ config.cookbook_path = [
+ File.join(@tmpdir, 'cookbooks'),
+ File.join(@tmpdir, 'cookbook_artifacts')
+ ]
+ end
end
# | Use both cookbooks and cookbook_artifacts as cookbook_dir in policyfile integration to support newer versions of chef-dk. | chefspec_chefspec | train | rb |
b491e261c8bc82dd96002272c5771c223357dc6e | diff --git a/js/cw/unittest.js b/js/cw/unittest.js
index <HASH>..<HASH> 100644
--- a/js/cw/unittest.js
+++ b/js/cw/unittest.js
@@ -615,7 +615,11 @@ cw.UnitTest.TestCase = function(methodName) {};
* Test cases subclass cw.UnitTest.TestCase with cw.Class.
*/
cw.Class.subclass(cw.UnitTest, 'TestCase', true/*overwriteOkay*/).pmethods({
- '__init__': function(methodName) {
+ '__init__':
+ /**
+ * @this {cw.UnitTest.TestCase}
+ */
+ function(methodName) {
/**
* @type {string}
* @private | js/cw/unittest.js: fix compiler warnings about 'global this' | ludiosarchive_Coreweb | train | js |
afccf1e5f88b385db278c4a2d4385566e758a627 | diff --git a/tests/test_cli.py b/tests/test_cli.py
index <HASH>..<HASH> 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -11,12 +11,14 @@ class TestCli(unittest.TestCase):
self.captured_output = io.StringIO()
sys.stdout = self.captured_output
+ def tearDown(self):
+ sys.stdout = sys.__stdout__ # Reset redirect.
+
def test_show_version(self):
sys.argv = ["hrun", "-V"]
with self.assertRaises(SystemExit) as cm:
main()
- sys.stdout = sys.__stdout__ # Reset redirect.
self.assertEqual(cm.exception.code, 0)
@@ -28,7 +30,6 @@ class TestCli(unittest.TestCase):
with self.assertRaises(SystemExit) as cm:
main()
- sys.stdout = sys.__stdout__ # Reset redirect.
self.assertEqual(cm.exception.code, 0) | test: Reset redirect in teardown | HttpRunner_HttpRunner | train | py |
c534b9733ec0600a38bbb669c865d73f5b9e3ec5 | diff --git a/lib/locomotive/coal/resources/concerns/request.rb b/lib/locomotive/coal/resources/concerns/request.rb
index <HASH>..<HASH> 100644
--- a/lib/locomotive/coal/resources/concerns/request.rb
+++ b/lib/locomotive/coal/resources/concerns/request.rb
@@ -51,7 +51,7 @@ module Locomotive::Coal::Resources
parameters = parameters.merge(auth_token: credentials[:token]) if _token
_connection.send(action, endpoint) do |request|
- request.headers = _request_headers(parameters)
+ request.headers.merge!(_request_headers(parameters))
if %i(post put).include?(action)
request.body = _encode_parameters(parameters)
@@ -77,7 +77,7 @@ module Locomotive::Coal::Resources
@_connection ||= Faraday.new(url: "#{uri.scheme}://#{uri.host}:#{uri.port}") do |faraday|
faraday.request :multipart
faraday.request :url_encoded # form-encode POST params
- faraday.basic_auth uri.userinfo.values if uri.userinfo
+ faraday.basic_auth *uri.userinfo.split(':') if uri.userinfo
faraday.use FaradayMiddleware::ParseJson, content_type: /\bjson$/ | Fixed adding of faraday basic_auth param, fixed request headers | locomotivecms_coal | train | rb |
3dcfcc53d751f808aeffaae61b5aa68d7e851aba | diff --git a/sprd/model/Delivery.js b/sprd/model/Delivery.js
index <HASH>..<HASH> 100644
--- a/sprd/model/Delivery.js
+++ b/sprd/model/Delivery.js
@@ -97,9 +97,15 @@ define(["sprd/data/SprdModel", "js/data/Entity", "sprd/entity/Address", "sprd/mo
errorCode: "atLeast8Digits",
regEx: /(.*\d.*){8}/
}),
+ new RegExValidator({
+ field: "email",
+ errorCode: 'emailError',
+ regEx: /^[^.@]+@[^.]{1,64}\.[^.]+$/
+ }),
new LengthValidator({
field: "email",
- maxLength: 30
+ errorCode: 'emailError',
+ maxLength: 255
}),
new LengthValidator({
field: "phone", | DEV-<I> - Email field limited to <I> chars in new checkout | spreadshirt_rAppid.js-sprd | train | js |
f6bfe0885a6f57673b6a9a29396f71ae2d9dc79a | diff --git a/config/styleguide.config.js b/config/styleguide.config.js
index <HASH>..<HASH> 100644
--- a/config/styleguide.config.js
+++ b/config/styleguide.config.js
@@ -6,7 +6,9 @@ const toggle = (newComponentPath, oldComponentPath) => (
process.env.NODE_ENV === 'production' ? oldComponentPath : newComponentPath
)
-const compact = array => array.filter(element => element !== undefined)
+const compact = array => ( // eslint-disable-line no-unused-vars
+ array.filter(element => element !== undefined)
+)
module.exports = {
@@ -135,11 +137,11 @@ module.exports = {
{
name: 'Links',
components() {
- return compact([
- toggle(path.resolve('src/components/Link/Link.jsx')),
- toggle(path.resolve('src/components/Link/ChevronLink/ChevronLink.jsx')),
- toggle(path.resolve('src/components/Link/ButtonLink/ButtonLink.jsx'))
- ])
+ return [
+ path.resolve('src/components/Link/Link.jsx'),
+ path.resolve('src/components/Link/ChevronLink/ChevronLink.jsx'),
+ path.resolve('src/components/Link/ButtonLink/ButtonLink.jsx')
+ ]
}
},
{ | feat(link): untoggle display of Link Components for staging and production | telus_tds-core | train | js |
b38f7a5cb07fc700d36111f6596376a6b0a0c1cd | diff --git a/src/Subfission/Cas/CasManager.php b/src/Subfission/Cas/CasManager.php
index <HASH>..<HASH> 100644
--- a/src/Subfission/Cas/CasManager.php
+++ b/src/Subfission/Cas/CasManager.php
@@ -203,7 +203,7 @@ class CasManager {
*/
public function isAuthenticated()
{
- return phpCAS::isAuthenticated();
+ return $this->config['cas_masquerade'] ? true : phpCAS::isAuthenticated();
}
/** | Fixing bug referenced by issue #<I> (#<I>) | subfission_cas | train | php |
b61c2c198b40ef0ecfcc78fdaab73e54f90bcebc | diff --git a/crypto/rsautil/rsautil.go b/crypto/rsautil/rsautil.go
index <HASH>..<HASH> 100644
--- a/crypto/rsautil/rsautil.go
+++ b/crypto/rsautil/rsautil.go
@@ -1,7 +1,7 @@
package rsautil
import (
- "crypto/md5"
+ "crypto/md5" // #nosec G501
"crypto/rand"
"crypto/rsa"
"encoding/base64"
diff --git a/encoding/base10/base10.go b/encoding/base10/base10.go
index <HASH>..<HASH> 100644
--- a/encoding/base10/base10.go
+++ b/encoding/base10/base10.go
@@ -2,7 +2,7 @@
package base10
import (
- "crypto/md5"
+ "crypto/md5" // #nosec G501
"math/big"
)
diff --git a/encoding/base36/base36.go b/encoding/base36/base36.go
index <HASH>..<HASH> 100644
--- a/encoding/base36/base36.go
+++ b/encoding/base36/base36.go
@@ -2,7 +2,7 @@
package base36
import (
- "crypto/md5"
+ "crypto/md5" // #nosec G501
"encoding/hex"
"fmt"
"strings" | lint: golangci: add point includes for `gosec.G<I>` | grokify_gotilla | train | go,go,go |
cb928fd582bd2ceb5db572bf841dd04fbfa00556 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -4,8 +4,16 @@ module.exports = function (statusCode) {
statusCode || (statusCode = 301);
return function (req, res, next) {
- var routes = req.app.routes[req.method.toLowerCase()],
- url, pathname, search, match;
+ var method = req.method.toLowerCase(),
+ hasSlash, match, pathname, routes, slash, url;
+
+ // Skip when the request is neither a GET or HEAD.
+ if (!(method === 'get' || method === 'head')) {
+ next();
+ return;
+ }
+
+ routes = req.app.routes[method];
// Skip when no routes for the request method.
if (!routes) { | Only attempt to handle GET and HEAD requests
The way in which this middleware is attempting to handle requests by
sending "blind" redirect responses only makes sense when the original
request is either a GET or HEAD. | ericf_express-slash | train | js |
2f806acc927ac334541f77455b3a51a879649aeb | diff --git a/engineio/client.py b/engineio/client.py
index <HASH>..<HASH> 100644
--- a/engineio/client.py
+++ b/engineio/client.py
@@ -335,8 +335,8 @@ class Client(object):
"""Establish or upgrade to a WebSocket connection with the server."""
if websocket is None: # pragma: no cover
# not installed
- self.logger.warning('websocket-client package not installed, only '
- 'polling transport is available')
+ self.logger.error('websocket-client package not installed, only '
+ 'polling transport is available')
return False
websocket_url = self._get_engineio_url(url, engineio_path, 'websocket')
if self.sid: | Report missing websocket client as an error in log (Fixes <URL>) | miguelgrinberg_python-engineio | train | py |
95b69d70e83facb55b4970de32fd49e00e173419 | diff --git a/duradmin/src/main/webapp/js/spaces-manager.js b/duradmin/src/main/webapp/js/spaces-manager.js
index <HASH>..<HASH> 100644
--- a/duradmin/src/main/webapp/js/spaces-manager.js
+++ b/duradmin/src/main/webapp/js/spaces-manager.js
@@ -1173,7 +1173,7 @@ $(function() {
}).fail(function() {
if (retrieveSpace.status == 404) {
alert(params.spaceId + " does not exist.");
- this._detailManager.showEmpty();
+ that._detailManager.showEmpty();
}
}); | Fixes a minor null pointer exception. | duracloud_duracloud | train | js |
c2ec8b27ca070a3f8cb1e80b1e3c860d75be1422 | diff --git a/dvc/repo/experiments/run.py b/dvc/repo/experiments/run.py
index <HASH>..<HASH> 100644
--- a/dvc/repo/experiments/run.py
+++ b/dvc/repo/experiments/run.py
@@ -63,4 +63,6 @@ def run(
)
except UnchangedExperimentError:
# If experiment contains no changes, just run regular repro
+ kwargs.pop("queue", None)
+ kwargs.pop("checkpoint_resume", None)
return {None: repo.reproduce(target=target, **kwargs)} | exp: fix bug where repro with run-cached stages may fail (#<I>) | iterative_dvc | train | py |
0cd4b0591a74067f51b37f390113f4636f47997a | diff --git a/simple_settings/core.py b/simple_settings/core.py
index <HASH>..<HASH> 100644
--- a/simple_settings/core.py
+++ b/simple_settings/core.py
@@ -70,7 +70,7 @@ class _Settings(object):
strategy = self._get_strategy_by_file(settings_file)
if not strategy:
raise RuntimeError(
- 'Invalid setting file [{}]'.format(settings_file)
+ 'Invalid settings file [{}]'.format(settings_file)
)
settings = strategy.load_settings_file(settings_file)
self._dict.update(settings) | fix a simple typo in core file | drgarcia1986_simple-settings | train | py |
2ddf1310a7de8a40734e0090c487b9b694212679 | diff --git a/src/oidcmsg/configure.py b/src/oidcmsg/configure.py
index <HASH>..<HASH> 100644
--- a/src/oidcmsg/configure.py
+++ b/src/oidcmsg/configure.py
@@ -105,12 +105,12 @@ class Base(dict):
return default
def __setattr__(self, key, value):
- if key in self and self.key:
+ if key in self and self.key is not None:
raise KeyError('{} has already been set'.format(key))
super(Base, self).__setitem__(key, value)
def __setitem__(self, key, value):
- if key in self:
+ if key in self and self.key is not None:
raise KeyError('{} has already been set'.format(key))
super(Base, self).__setitem__(key, value) | Allow an attribute to be set to None before being assigning a value. | openid_JWTConnect-Python-OidcMsg | train | py |
2bd5eb9d7c765a9d36dbab9e0640cfcaafac1f28 | diff --git a/docs/session.go b/docs/session.go
index <HASH>..<HASH> 100644
--- a/docs/session.go
+++ b/docs/session.go
@@ -53,7 +53,7 @@ func NewSession(authConfig *AuthConfig, factory *requestdecorator.RequestFactory
if err != nil {
return nil, err
}
- if info.Standalone {
+ if info.Standalone && authConfig != nil && factory != nil {
logrus.Debugf("Endpoint %s is eligible for private registry. Enabling decorator.", r.indexEndpoint.String())
dec := requestdecorator.NewAuthDecorator(authConfig.Username, authConfig.Password)
factory.AddDecorator(dec) | What if authConfig or factory is Null? | docker_distribution | train | go |
44f92b9b9f6607408a25901acef9e61f09df1f30 | diff --git a/devassistant/assistants/commands.py b/devassistant/assistants/commands.py
index <HASH>..<HASH> 100644
--- a/devassistant/assistants/commands.py
+++ b/devassistant/assistants/commands.py
@@ -103,7 +103,8 @@ class GitHubCommand(object):
if reponame in map(lambda x: x.name, user.get_repos()):
raise exceptions.RunException('Repository already exists on GiHub.')
else:
- user.create_repo(reponame)
+ new_repo = user.create_repo(reponame)
+ logger.info('Your new repository: {0}'.format(new_repo.html_url))
except github.GithubException as e:
raise exceptions.RunException('GitHub error: {0}'.format(e)) | Output GH repo name after creation | devassistant_devassistant | train | py |
c2d03550c8a062bf49f23e773264d21c88f230fa | diff --git a/chef/lib/chef/provider/service/redhat.rb b/chef/lib/chef/provider/service/redhat.rb
index <HASH>..<HASH> 100644
--- a/chef/lib/chef/provider/service/redhat.rb
+++ b/chef/lib/chef/provider/service/redhat.rb
@@ -49,11 +49,11 @@ class Chef
end
def enable_service()
- run_command(:command => "/sbin/chkconfig --add #{@new_resource.service_name}")
+ run_command(:command => "/sbin/chkconfig #{@new_resource.service_name} on")
end
def disable_service()
- run_command(:command => "/sbin/chkconfig --del #{@new_resource.service_name}")
+ run_command(:command => "/sbin/chkconfig #{@new_resource.service_name} off")
end
end | Use accepted method to enable/disable services. This will withstand package
upgrades. | chef_chef | train | rb |
1c12c4b290a63380c543374ea54da613787927c2 | diff --git a/java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java b/java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java
index <HASH>..<HASH> 100644
--- a/java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java
+++ b/java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java
@@ -131,7 +131,8 @@ public class FirefoxDriver extends RemoteWebDriver {
Objects.requireNonNull(options, "No options to construct executor from");
DriverService.Builder<?, ?> builder;
- if (options.isLegacy()) {
+ if (! Boolean.parseBoolean(System.getProperty(DRIVER_USE_MARIONETTE, "true"))
+ || options.isLegacy()) {
builder = XpiDriverService.builder()
.withBinary(options.getBinary())
.withProfile(Optional.ofNullable(options.getProfile()).orElse(new FirefoxProfile())); | Restoring ability to use system property to force legacy mode or marionette. If we want to delete it we should deprecate it first. | SeleniumHQ_selenium | train | java |
26c64778f7c0dd2210f796b5f1377aac18c0e6a4 | diff --git a/src/PhpTokenizer.php b/src/PhpTokenizer.php
index <HASH>..<HASH> 100644
--- a/src/PhpTokenizer.php
+++ b/src/PhpTokenizer.php
@@ -148,7 +148,6 @@ class PhpTokenizer implements TokenStreamProviderInterface {
T_CONTINUE => TokenKind::ContinueKeyword,
T_DECLARE => TokenKind::DeclareKeyword,
T_DEFAULT => TokenKind::DefaultKeyword,
- T_EXIT => TokenKind::DieKeyword,
T_DO => TokenKind::DoKeyword,
T_ECHO => TokenKind::EchoKeyword,
T_ELSE => TokenKind::ElseKeyword,
@@ -267,8 +266,6 @@ class PhpTokenizer implements TokenStreamProviderInterface {
T_DNUMBER => TokenKind::FloatingLiteralToken,
- T_CONSTANT_ENCAPSED_STRING => TokenKind::StringLiteralToken,
-
T_OPEN_TAG => TokenKind::ScriptSectionStartTag,
T_OPEN_TAG_WITH_ECHO => TokenKind::ScriptSectionStartTag,
T_CLOSE_TAG => TokenKind::ScriptSectionEndTag, | Remove duplicate array keys from PhpTokenizer.php
Detected via static analysis
When there are duplicate array keys, the last entry takes precedence
(e.g. the removed T_EXIT line had the wrong value) | Microsoft_tolerant-php-parser | train | php |
2192d1dd952b67d76c98b9427d65edfd72929102 | diff --git a/monodeploy.config.js b/monodeploy.config.js
index <HASH>..<HASH> 100644
--- a/monodeploy.config.js
+++ b/monodeploy.config.js
@@ -2,7 +2,7 @@
module.exports = {
access: 'infer',
autoCommit: false,
- changelogFilename: './CHANGELOG.md',
+ changelogFilename: 'CHANGELOG.md',
// changesetFilename: 'needed?',
changesetIgnorePatterns: ['**/*.test.js', '**/*.spec.{js,ts}', '**/*.{md,mdx}', '**/yarn.lock'],
conventionalChangelogConfig: 'conventional-changelog-conventionalcommits', | refactor: updates changelog path | Availity_availity-workflow | train | js |
ebb250fcad9758d392cfc28f35d892acc89b23ed | diff --git a/test/util/fonts/getCssRulesByProperty.js b/test/util/fonts/getCssRulesByProperty.js
index <HASH>..<HASH> 100644
--- a/test/util/fonts/getCssRulesByProperty.js
+++ b/test/util/fonts/getCssRulesByProperty.js
@@ -112,7 +112,16 @@ describe('util/fonts/getCssRulesByProperty', function () {
});
describe('shorthand font-property', function () {
- it('register the longhand value from a shorthand', function () {
+ it('should ignore invalid shorthands', function () {
+ var result = getRules(['font-family', 'font-size'], 'h1 { font: 15px; }');
+
+ expect(result, 'to exhaustively satisfy', {
+ 'font-family': [],
+ 'font-size': []
+ });
+ });
+
+ it('register the longhand value from a valid shorthand', function () {
var result = getRules(['font-family', 'font-size'], 'h1 { font: 15px serif; }');
expect(result, 'to exhaustively satisfy', { | Add test for dealing with invalid font shorthands | assetgraph_assetgraph | train | js |
1eb292397f04629b735d451ed89d25fa0fdee972 | diff --git a/src/SQL/SQLStatement.php b/src/SQL/SQLStatement.php
index <HASH>..<HASH> 100644
--- a/src/SQL/SQLStatement.php
+++ b/src/SQL/SQLStatement.php
@@ -181,6 +181,12 @@ class SQLStatement
$join = new Join();
$closure($join);
+ if ($table instanceof Closure) {
+ $expr = new Expression();
+ $table($expr);
+ $table = $expr;
+ }
+
if (!is_array($table)) {
$table = array($table);
}
@@ -308,6 +314,14 @@ class SQLStatement
public function addOrder(array $columns, string $order, string $nulls = null)
{
+ foreach ($columns as &$column) {
+ if ($column instanceof Closure) {
+ $expr = new Expression();
+ $column($expr);
+ $column = $expr;
+ }
+ }
+
$order = strtoupper($order);
if ($order !== 'ASC' && $order !== 'DESC') { | Add support for closures in joins and orderBy | opis_database | train | php |
2036eaf3c9f6a23fb942c4f29969c8f88726f168 | diff --git a/src/FormElement/Checkbox.php b/src/FormElement/Checkbox.php
index <HASH>..<HASH> 100644
--- a/src/FormElement/Checkbox.php
+++ b/src/FormElement/Checkbox.php
@@ -14,9 +14,7 @@ class Checkbox extends AbstractFormElement
protected function attachDefaultValidators(InputInterface $input, DOMElement $element)
{
// Make sure the submitted value is the same as the original
- if ($element->hasAttribute('checked')) {
- $input->getValidatorChain()
- ->attach(new Validator\Identical($element->getAttribute('value')));
- }
+ $input->getValidatorChain()
+ ->attach(new Validator\Identical($element->getAttribute('value')));
}
} | Checkbox should always check the submitted value | xtreamwayz_html-form-validator | train | php |
f890bc9a1605b35b3abfdec837b0c48441e5ec7d | diff --git a/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/placeholder/EncryptUpdateItemColumnPlaceholder.java b/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/placeholder/EncryptUpdateItemColumnPlaceholder.java
index <HASH>..<HASH> 100644
--- a/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/placeholder/EncryptUpdateItemColumnPlaceholder.java
+++ b/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/placeholder/EncryptUpdateItemColumnPlaceholder.java
@@ -58,7 +58,6 @@ public final class EncryptUpdateItemColumnPlaceholder implements ShardingPlaceho
}
@Override
- @SuppressWarnings("all")
public String toString() {
if (Strings.isNullOrEmpty(assistedColumnName)) {
return -1 != parameterMarkerIndex ? String.format("%s = ?", columnName) : String.format("%s = %s", columnName, toStringForColumnValue(columnValue)); | delete @SuppressWarnings("all") | apache_incubator-shardingsphere | train | java |
edaaa2225d4445ddc639a0663640e71c9b0535bd | diff --git a/php/quail.php b/php/quail.php
index <HASH>..<HASH> 100644
--- a/php/quail.php
+++ b/php/quail.php
@@ -163,7 +163,7 @@ class QuailTest {
}
function reportSingleSelector($selector) {
- foreach(pq($selector) as $object) {
+ foreach($this->q($selector) as $object) {
$this->objects[] = pq($object);
}
} | Added case-insensitivity to main selector. | quailjs_quail | train | php |
5eaf043b18c044b0c9a517a359296390e6e73ac6 | diff --git a/core/src/ons/platform.js b/core/src/ons/platform.js
index <HASH>..<HASH> 100644
--- a/core/src/ons/platform.js
+++ b/core/src/ons/platform.js
@@ -116,8 +116,6 @@ class Platform {
window.screen.width === 812 && window.screen.height === 375 || // X, XS landscape
window.screen.width === 414 && window.screen.height === 896 || // XS Max, XR portrait
window.screen.width === 896 && window.screen.height === 414 || // XS Max, XR landscape
- window.screen.width === 360 && window.screen.height === 780 || // 12 Mini portrait
- window.screen.width === 780 && window.screen.height === 360 || // 12 Mini landscape
window.screen.width === 390 && window.screen.height === 844 || // 12, 12 Pro portrait
window.screen.width === 844 && window.screen.height === 390 || // 12, 12 Pro landscape
window.screen.width === 428 && window.screen.height === 926 || // 12 Pro Max portrait | fix(platform): Remove incorrect sizes for <I> Mini in `isIPhoneX`
The screen dimensions of the iPhone <I> Mini are <I> and <I>, but we were
checking for <I> and <I>. | OnsenUI_OnsenUI | train | js |
4b8abc06ecf1898391716d24e261183e190baa10 | diff --git a/src/Administration/Resources/app/administration/test/e2e/cypress/integration/catalogue/sw-category/create.spec.js b/src/Administration/Resources/app/administration/test/e2e/cypress/integration/catalogue/sw-category/create.spec.js
index <HASH>..<HASH> 100644
--- a/src/Administration/Resources/app/administration/test/e2e/cypress/integration/catalogue/sw-category/create.spec.js
+++ b/src/Administration/Resources/app/administration/test/e2e/cypress/integration/catalogue/sw-category/create.spec.js
@@ -108,7 +108,7 @@ describe('Category: Create several categories', () => {
});
});
- it('@base @catalogue: create a subcategory', () => {
+ it('@base @catalogue @package: create a subcategory', () => {
const page = new CategoryPageObject();
// Request we want to wait for later | NEXT-<I> - Added @package tag to create a subcategory in create.spec.js | shopware_platform | train | js |
82f8780f40ed8a2bdacb0c0299f9b219a4363cd4 | diff --git a/tests/config.js b/tests/config.js
index <HASH>..<HASH> 100644
--- a/tests/config.js
+++ b/tests/config.js
@@ -8,6 +8,7 @@ var testPages = [
, 'specs/extensible'
, 'specs/extensible/plugin-debug'
+ , 'specs/misc/bootstrap-async'
, 'specs/misc/data-api'
, 'specs/misc/ie-cache'
, 'specs/misc/utf8-in-gbk' | Add test specs for async bootstrap | seajs_seajs | train | js |
2c6a048d55569ded1f5f5a624453d88937a23bba | diff --git a/src/Image/Transformation/Canvas.php b/src/Image/Transformation/Canvas.php
index <HASH>..<HASH> 100644
--- a/src/Image/Transformation/Canvas.php
+++ b/src/Image/Transformation/Canvas.php
@@ -70,7 +70,7 @@ class Canvas extends Transformation implements InputSizeConstraint {
$this->imagick->newImage($width, $height, $bg);
$this->imagick->setImageFormat($original->getImageFormat());
- $this->imagick->setImageColorspace($original->getImageColorspace());
+ $this->imagick->transformImageColorspace($original->getImageColorspace());
$originalGeometry = $original->getImageGeometry(); | Use the correct method to properly set the colorspace of the canvas
Resolves #<I> | imbo_imbo | train | php |
70de6a63c1d8975a62b4f8138d6b0abeb785df6f | diff --git a/jenkins/plugin/src/main/java/com/hp/octane/plugins/jenkins/bridge/BridgesService.java b/jenkins/plugin/src/main/java/com/hp/octane/plugins/jenkins/bridge/BridgesService.java
index <HASH>..<HASH> 100644
--- a/jenkins/plugin/src/main/java/com/hp/octane/plugins/jenkins/bridge/BridgesService.java
+++ b/jenkins/plugin/src/main/java/com/hp/octane/plugins/jenkins/bridge/BridgesService.java
@@ -16,7 +16,7 @@ import java.util.List;
/**
* Created by gullery on 05/08/2015.
- * <p/>
+ * <p>
* Bridge Service meant to provide an abridged connectivity functionality
* The only APIs to be exposed is the basic management of abridged clients
*/ | tech: fixing the java doc format | hpsa_hpe-application-automation-tools-plugin | train | java |
83d4def03f38411d9b3550126662ffadaa2287ee | diff --git a/collections_extended/range_map.py b/collections_extended/range_map.py
index <HASH>..<HASH> 100644
--- a/collections_extended/range_map.py
+++ b/collections_extended/range_map.py
@@ -168,12 +168,14 @@ class RangeMap(Container):
start_index -= 1
start = prev_key
if stop is None:
- stop = _last
new_keys = [start]
stop_index = len(self._ordered_keys)
else:
stop_index = bisect_left(self._ordered_keys, stop)
- new_keys = [start, stop]
+ if stop_index != len(self._ordered_keys) and self._ordered_keys[stop_index] == stop:
+ new_keys = [start]
+ else:
+ new_keys = [start, stop]
self._key_mapping[stop] = self.__getitem(stop)
for key in self._ordered_keys[start_index:stop_index]:
del self._key_mapping[key] | test_delitem_consecutive test passes. | mlenzen_collections-extended | train | py |
82ecd6de19e289f15e6cfb09d250c4a617b256da | diff --git a/src/dataviews/histogram-dataview-model.js b/src/dataviews/histogram-dataview-model.js
index <HASH>..<HASH> 100644
--- a/src/dataviews/histogram-dataview-model.js
+++ b/src/dataviews/histogram-dataview-model.js
@@ -60,7 +60,7 @@ module.exports = DataviewModelBase.extend({
this._updateURLBinding();
// When original data gets fetched
- this._originalData.bind('sync', this._onDataChanged, this);
+ this._originalData.bind('change:data', this._onSynced, this);
this._originalData.once('change:data', this._updateBindings, this);
this.on('change:column', this._onColumnChanged, this);
@@ -280,7 +280,7 @@ module.exports = DataviewModelBase.extend({
this._originalData.setUrl(this.get('url'));
},
- _onDataChanged: function (model) {
+ _onSynced: function (model) {
this.set({
aggregation: model.get('aggregation'),
bins: model.get('bins'), | Revert sync to change:data | CartoDB_carto.js | train | js |
f5217bf8414b957297a9f1ce506d32616b349fd1 | diff --git a/core-bundle/contao/library/Contao/Image.php b/core-bundle/contao/library/Contao/Image.php
index <HASH>..<HASH> 100644
--- a/core-bundle/contao/library/Contao/Image.php
+++ b/core-bundle/contao/library/Contao/Image.php
@@ -354,10 +354,13 @@ class Image
break;
}
- // Resizing will most likely fail if there is no viewBox attribute
+ // Set the viewBox attribute from the original dimensions
if (!$svgElement->hasAttribute('viewBox'))
{
- \System::log('Image "' . $image . '" does not have a "viewBox" attribute', __METHOD__, TL_ERROR);
+ $origWidth = $svgElement->getAttribute('width');
+ $origHeight = $svgElement->getAttribute('height');
+
+ $svgElement->setAttribute('viewBox', '0 0 ' . intval($origWidth) . ' ' . intval($origHeight));
}
$svgElement->setAttribute('width', $width . 'px'); | [Core] Add the "viewBox" attribute if not present (see #<I>) | contao_contao | train | php |
6b388ee07e5f0d24e687b4fdc3f3c7a4a9231f48 | diff --git a/archunit/src/main/java/com/tngtech/archunit/core/domain/JavaClass.java b/archunit/src/main/java/com/tngtech/archunit/core/domain/JavaClass.java
index <HASH>..<HASH> 100644
--- a/archunit/src/main/java/com/tngtech/archunit/core/domain/JavaClass.java
+++ b/archunit/src/main/java/com/tngtech/archunit/core/domain/JavaClass.java
@@ -761,7 +761,7 @@ public class JavaClass implements HasName.AndFullName, HasAnnotations, HasModifi
}
/**
- * @return {@link JavaAnnotation} of all imported classes that have the type of this class.
+ * @return All imported {@link JavaAnnotation JavaAnnotations} that have the annotation type of this class.
*/
@PublicAPI(usage = ACCESS)
public Set<JavaAnnotation> getAnnotationsWithTypeOfSelf() { | Review: Unify Javadoc
Issue: #<I> | TNG_ArchUnit | train | java |
cc5662283f508b1053159c36e21ade51920ccf40 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -25,11 +25,11 @@ class TestCommand(Command):
suite = unittest.TestSuite()
if self.test == '*':
print('Running all tests')
- import test
- for tst in test.__all__:
- suite.addTests(unittest.TestLoader().loadTestsFromName('test.%s' % tst))
+ import stomp.test
+ for tst in stomp.test.__all__:
+ suite.addTests(unittest.TestLoader().loadTestsFromName('stomp.test.%s' % tst))
else:
- suite = unittest.TestLoader().loadTestsFromName('test.%s' % self.test)
+ suite = unittest.TestLoader().loadTestsFromName('stomp.test.%s' % self.test)
unittest.TextTestRunner(verbosity=2).run(suite) | fix for running unit tests in py versions < 3 | jasonrbriggs_stomp.py | train | py |
b295febd6279f1243aa90e238d719ff46623bce1 | diff --git a/tracer/tracer.py b/tracer/tracer.py
index <HASH>..<HASH> 100644
--- a/tracer/tracer.py
+++ b/tracer/tracer.py
@@ -742,7 +742,8 @@ class Tracer(object):
args,
stdin=subprocess.PIPE,
stdout=stdout_f,
- stderr=devnull)
+ stderr=devnull,
+ env=os.environ)
_, _ = p.communicate(self.input)
else:
l.info("tracing as pov file")
@@ -751,7 +752,8 @@ class Tracer(object):
args,
stdin=in_s,
stdout=stdout_f,
- stderr=devnull)
+ stderr=devnull,
+ env=os.environ)
for write in self.pov_file.writes:
out_s.send(write)
time.sleep(.01) | Patched in environment variable support for the call to qemu. This allows the caller to do things like set LD_PRELOAD before tracing. In some cases this is required in order to run the target binary | angr_angr | train | py |
954b922f8513e3cfdb3bf4e6a9272675f012d9a7 | diff --git a/lib/jasmine_rails/runner.rb b/lib/jasmine_rails/runner.rb
index <HASH>..<HASH> 100644
--- a/lib/jasmine_rails/runner.rb
+++ b/lib/jasmine_rails/runner.rb
@@ -7,6 +7,8 @@ module JasmineRails
# raises an exception if any errors are encountered while running the testsuite
def run(spec_filter = nil)
override_rails_config do
+ require 'phantomjs'
+
include_offline_asset_paths_helper
html = get_spec_runner(spec_filter)
runner_path = JasmineRails.tmp_dir.join('runner.html') | Fixes the fact the gem was never required | searls_jasmine-rails | train | rb |
74749972d3ac526c665875ab617dec641cace19d | diff --git a/valohai_yaml/validation.py b/valohai_yaml/validation.py
index <HASH>..<HASH> 100644
--- a/valohai_yaml/validation.py
+++ b/valohai_yaml/validation.py
@@ -34,11 +34,9 @@ class LocalRefResolver(RefResolver):
def resolve_from_url(self, url):
local_match = self.local_scope_re.match(url)
if local_match:
- local_filename = os.path.join(SCHEMATA_DIRECTORY, local_match.group(1))
- with open(local_filename, 'r', encoding='utf-8') as infp:
- schema = json.load(infp)
- self.store[url] = schema
- return schema
+ schema = get_schema(name=local_match.group(1))
+ self.store[url] = schema
+ return schema
raise NotImplementedError('remote URL resolution is not supported for security reasons') # pragma: no cover | Use `get_schema` in the resolver too | valohai_valohai-yaml | train | py |
0f0e66663879104aa40caed6e718037e5102d553 | diff --git a/src/helper/Links.php b/src/helper/Links.php
index <HASH>..<HASH> 100644
--- a/src/helper/Links.php
+++ b/src/helper/Links.php
@@ -35,7 +35,9 @@ class Links extends AbstractHelper
public function add(array $attribs = array())
{
$attr = $this->attribs($attribs);
- $this->links[] = "<link$attr />";
+ if( strlen( $attr ) > 0 ) {
+ $this->links[] = "<link $attr/>";
+ }
}
public function get() | if there is no $attr , then no need of <link /> | auraphp_Aura.View | train | php |
e5ded3a9d1698c9c653b7e262edd51c23b7e51a4 | diff --git a/request-server.go b/request-server.go
index <HASH>..<HASH> 100644
--- a/request-server.go
+++ b/request-server.go
@@ -174,6 +174,15 @@ func (rs *RequestServer) packetWorker(
request = NewRequest("Stat", request.Filepath)
rpkt = request.call(rs.Handlers, pkt)
}
+ case *sshFxpExtendedPacket:
+ switch expkt := pkt.SpecificPacket.(type) {
+ default:
+ rpkt = statusFromError(pkt, ErrSshFxOpUnsupported)
+ case *sshFxpExtendedPacketPosixRename:
+ request := NewRequest("Rename", expkt.Oldpath)
+ request.Target = expkt.Newpath
+ rpkt = request.call(rs.Handlers, pkt)
+ }
case hasHandle:
handle := pkt.getHandle()
request, ok := rs.getRequest(handle)
@@ -187,7 +196,7 @@ func (rs *RequestServer) packetWorker(
rpkt = request.call(rs.Handlers, pkt)
request.close()
default:
- return errors.Errorf("unexpected packet type %T", pkt)
+ rpkt = statusFromError(pkt, ErrSshFxOpUnsupported)
}
rs.pktMgr.readyPacket( | sftp: support rename extension for server
Previously if a client makes an unsupported operation,
like a POSIX rename, it would exit the server.
Both support POSIX rename, and do not abort the connection
if there is an unsupported operation is made by the client. | pkg_sftp | train | go |
3ccb8882f049e53650953d8622333b1957941d96 | diff --git a/generators/dbh-constants.js b/generators/dbh-constants.js
index <HASH>..<HASH> 100644
--- a/generators/dbh-constants.js
+++ b/generators/dbh-constants.js
@@ -11,8 +11,8 @@ const constants = {
filesWithNamingStrategy: [
'./pom.xml',
'./src/main/resources/config/application.yml',
- './src/test/resources/config/application.yml',
- './gradle/liquibase.gradle',
+ './src/test/resources/config/application.yml'/*,
+ './gradle/liquibase.gradle',*/
], | Comment out ref to gradle file while refactoring search&replace | bastienmichaux_generator-jhipster-db-helper | train | js |
147476a039ec8a22945b461a0b8659bb8a0754cd | diff --git a/internal/service/networkfirewall/logging_configuration_test.go b/internal/service/networkfirewall/logging_configuration_test.go
index <HASH>..<HASH> 100644
--- a/internal/service/networkfirewall/logging_configuration_test.go
+++ b/internal/service/networkfirewall/logging_configuration_test.go
@@ -745,13 +745,17 @@ func testAccNetworkFirewallLoggingConfigurationS3BucketDependencyConfig(rName st
return fmt.Sprintf(`
resource "aws_s3_bucket" "test" {
bucket = %q
- acl = "private"
force_destroy = true
lifecycle {
create_before_destroy = true
}
}
+
+resource "aws_s3_bucket_acl" "test" {
+ bucket = aws_s3_bucket.test.id
+ acl = "private"
+}
`, rName)
}
@@ -839,10 +843,14 @@ EOF
resource "aws_s3_bucket" "logs" {
bucket = %[1]q
- acl = "private"
force_destroy = true
}
+resource "aws_s3_bucket_acl" "logs_acl" {
+ bucket = aws_s3_bucket.logs.id
+ acl = "private"
+}
+
resource "aws_kinesis_firehose_delivery_stream" "test" {
depends_on = [aws_iam_role_policy.test]
name = %[2]q | tests/networkfirewall: update to aws_s3_bucket_acl | terraform-providers_terraform-provider-aws | train | go |
2747f907cb5804601cefe4179c7c6bb9b9d71260 | diff --git a/peer.py b/peer.py
index <HASH>..<HASH> 100644
--- a/peer.py
+++ b/peer.py
@@ -77,10 +77,6 @@ from .constants import (
)
-_ReceivedMsgCallbackType = Callable[
- ['BasePeer', protocol.Command, protocol._DecodedMsgType], None]
-
-
async def handshake(remote: Node,
privkey: datatypes.PrivateKey,
peer_class: 'Type[BasePeer]',
@@ -259,6 +255,12 @@ class BasePeer:
if finished_callback is not None:
finished_callback(self)
+ def is_finished(self) -> bool:
+ return self._finished.is_set()
+
+ async def wait_until_finished(self) -> bool:
+ return await self._finished.wait()
+
def close(self):
"""Close this peer's reader/writer streams. | p2p: New Peer methods to check if it's finished | ethereum_asyncio-cancel-token | train | py |
41243f482780809163e51009b15bc53485bfa849 | diff --git a/source/lib/workbook/builder.js b/source/lib/workbook/builder.js
index <HASH>..<HASH> 100644
--- a/source/lib/workbook/builder.js
+++ b/source/lib/workbook/builder.js
@@ -19,10 +19,14 @@ let addRootContentTypesXML = (promiseObj) => {
let contentTypesAdded = [];
promiseObj.wb.sheets.forEach((s, i) => {
if (s.drawingCollection.length > 0) {
+ let extensionsAdded = [];
s.drawingCollection.drawings.forEach((d) => {
- let typeRef = d.contentType + '.' + d.extension;
- if (contentTypesAdded.indexOf(typeRef) < 0) {
- xml.ele('Default').att('ContentType', d.contentType).att('Extension', d.extension);
+ if (extensionsAdded.indexOf(d.extension) < 0) {
+ let typeRef = d.contentType + '.' + d.extension;
+ if (contentTypesAdded.indexOf(typeRef) < 0) {
+ xml.ele('Default').att('ContentType', d.contentType).att('Extension', d.extension);
+ }
+ extensionsAdded.push(d.extension);
}
});
} | fixed issue where workbook would fail to open if more than one image with the same extension had been added | natergj_excel4node | train | js |
1ecea41f03c03e5584f1d28e1be8950c5576ba73 | diff --git a/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java b/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java
index <HASH>..<HASH> 100644
--- a/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java
+++ b/src/test/java/net/snowflake/client/jdbc/ConnectionIT.java
@@ -166,14 +166,15 @@ public class ConnectionIT extends BaseJDBCTest {
@Test
public void testDataCompletenessInLowMemory() throws Exception {
try (Connection connection = getConnection()) {
- for (int i = 0; i < 10; i++) {
+ for (int i = 0; i < 6; i++) {
int resultSize = 1000000 + i;
Statement statement = connection.createStatement();
statement.execute("ALTER SESSION SET CLIENT_MEMORY_LIMIT=10");
ResultSet resultSet =
statement.executeQuery(
- "SELECT * FROM \"SNOWFLAKE_SAMPLE_DATA\".\"TPCDS_SF100TCL\".\"CUSTOMER_ADDRESS\" limit "
- + resultSize);
+ "select randstr(80, random()) from table(generator(rowcount => "
+ + resultSize
+ + "))");
int size = 0;
while (resultSet.next()) { | Fix testDataCompletenessInLowMemory test on jenkins (#<I>) | snowflakedb_snowflake-jdbc | train | java |
3e2181184b846435a685cd7267a68172ac494a99 | diff --git a/tests/AlgoliaSearch/Tests/SearchFacetTest.php b/tests/AlgoliaSearch/Tests/SearchFacetTest.php
index <HASH>..<HASH> 100644
--- a/tests/AlgoliaSearch/Tests/SearchFacetTest.php
+++ b/tests/AlgoliaSearch/Tests/SearchFacetTest.php
@@ -75,8 +75,9 @@ class SearchFacetTest extends AlgoliaSearchTestCase
)
);
- $this->index->setSettings($settings);
+ $settingsTask = $this->index->setSettings($settings);
$task = $this->index->addObjects($objects);
+ $this->index->waitTask($settingsTask['taskID']);
$this->index->waitTask($task['taskID']);
# Straightforward search. | test(facets): Add waitTask for setSettings | algolia_algoliasearch-client-php | train | php |
3a1ce455e825be10ed01ebdd9a26a2524bb2acae | diff --git a/command/agent/command.go b/command/agent/command.go
index <HASH>..<HASH> 100644
--- a/command/agent/command.go
+++ b/command/agent/command.go
@@ -241,6 +241,12 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer) *Agent {
serfConfig.QuiescentPeriod = time.Second
serfConfig.UserCoalescePeriod = 3 * time.Second
serfConfig.UserQuiescentPeriod = time.Second
+ if config.ReconnectInterval != 0 {
+ serfConfig.ReconnectInterval = config.ReconnectInterval
+ }
+ if config.ReconnectTimeout != 0 {
+ serfConfig.ReconnectTimeout = config.ReconnectTimeout
+ }
// Start Serf
c.Ui.Output("Starting Serf agent...") | agent: Actually pass-through the reconnect configs | hashicorp_serf | train | go |
01769a15753e9163be2900fdbe50121f4d0e1ac5 | diff --git a/lib/nydp/version.rb b/lib/nydp/version.rb
index <HASH>..<HASH> 100644
--- a/lib/nydp/version.rb
+++ b/lib/nydp/version.rb
@@ -1,3 +1,3 @@
module Nydp
- VERSION = "0.2.1"
+ VERSION = "0.2.2"
end | version: bump to <I> | conanite_nydp | train | rb |
523cf3e71a7009c986713e32ca689f8bdd2a378d | diff --git a/app/index.js b/app/index.js
index <HASH>..<HASH> 100644
--- a/app/index.js
+++ b/app/index.js
@@ -62,16 +62,14 @@ function Generator(args, options, config) {
}
util.inherits(Generator, BBBGenerator);
-util.inherits(Generator, InitGenerator);
/**
* Command prompt questions
+ * Note: Directly extend these functions on the generator prototype as Yeoman run every
+ * attached method (e.g.: `.hasOwnProperty()`)
*/
-Generator.prototype.askFor = function askFor() {
- InitGenerator.prototype.askFor.call(this);
-};
-
+Generator.prototype.askFor = InitGenerator.prototype.askFor;
Generator.prototype.saveConfig = InitGenerator.prototype.saveConfig;
/** | Simplify inheriting Init generator methods in the app generator | backbone-boilerplate_generator-bbb | train | js |
481d9b429102a61b91609a1374280b18b70f2021 | diff --git a/pkg_test.go b/pkg_test.go
index <HASH>..<HASH> 100644
--- a/pkg_test.go
+++ b/pkg_test.go
@@ -241,7 +241,7 @@ func TestLevel(t *testing.T) {
func TestSettings(t *testing.T) {
RegisterDurationFunc(func(d time.Duration) string {
- return fmt.Sprintf("%ds", d.Seconds())
+ return fmt.Sprintf("%gs", d.Seconds())
})
SetTimeFormat(time.RFC1123) | get <I>% go vet | go-playground_log | train | go |
9644d4329b74b6e84337822df7408a9cb22ecb23 | diff --git a/integration/pvtdata/pvtdata_test.go b/integration/pvtdata/pvtdata_test.go
index <HASH>..<HASH> 100644
--- a/integration/pvtdata/pvtdata_test.go
+++ b/integration/pvtdata/pvtdata_test.go
@@ -68,16 +68,16 @@ var _ bool = Describe("PrivateData", func() {
testCleanup(network, process)
})
- Describe("Dissemination when pulling is disabled", func() {
+ Describe("Dissemination when pulling and reconciliation are disabled", func() {
BeforeEach(func() {
By("setting up the network")
network = initThreeOrgsSetup(true)
- By("setting the pull retry threshold to 0 on all peers")
- // set pull retry threshold to 0
+ By("setting the pull retry threshold to 0 and disabling reconciliation on all peers")
for _, p := range network.Peers {
core := network.ReadPeerConfig(p)
core.Peer.Gossip.PvtData.PullRetryThreshold = 0
+ core.Peer.Gossip.PvtData.ReconciliationEnabled = false
network.WritePeerConfig(p, core)
} | [FAB-<I>] Fix CI flake due to unexpected pvtdata reconciliation
In private data dissemination test, a test flake may happen if
unexpected pvtdata reconciliation is triggered (timing issue)
so that additional peers receive the private data. | hyperledger_fabric | train | go |
dc9acf3a3dc49142963dc456333b118e80929a4b | diff --git a/ctz_go1.9.go b/ctz_go1.9.go
index <HASH>..<HASH> 100644
--- a/ctz_go1.9.go
+++ b/ctz_go1.9.go
@@ -1,3 +1,5 @@
+// +build go1.9
+
package roaring
import "math/bits"
diff --git a/popcnt_go1.9.go b/popcnt_go1.9.go
index <HASH>..<HASH> 100644
--- a/popcnt_go1.9.go
+++ b/popcnt_go1.9.go
@@ -1,3 +1,5 @@
+// +build go1.9
+
package roaring
import "math/bits" | Attempt to fix build constraints for _go<I>.go files | RoaringBitmap_roaring | train | go,go |
c7dc3539566dac1fbc82661b432ee26c4731548a | diff --git a/spec/compiler.js b/spec/compiler.js
index <HASH>..<HASH> 100644
--- a/spec/compiler.js
+++ b/spec/compiler.js
@@ -38,6 +38,22 @@ describe('compiler', function() {
}, Error, 'You must pass a string or Handlebars AST to Handlebars.compile. You passed [object Object]');
});
+ it('should include the location in the error (row and column)', function() {
+ try {
+ Handlebars.compile(' \n {{#if}}\n{{/def}}')();
+ equal(true, false, 'Statement must throw exception. This line should not be executed.');
+ } catch (err) {
+ equal(err.message, 'if doesn\'t match def - 2:5', 'Checking error message');
+ if (Object.getOwnPropertyDescriptor(err, 'column').writable) {
+ // In Safari 8, the column-property is read-only. This means that even if it is set with defineProperty,
+ // its value won't change (https://github.com/jquery/esprima/issues/1290#issuecomment-132455482)
+ // Since this was neither working in Handlebars 3 nor in 4.0.5, we only check the column for other browsers.
+ equal(err.column, 5, 'Checking error column');
+ }
+ equal(err.lineNumber, 2, 'Checking error row');
+ }
+ });
+
it('can utilize AST instance', function() {
equal(Handlebars.compile({
type: 'Program', | Testcase to verify that compile-errors have a column-property
Related to #<I>
The test ensures that the property is there, because it is important to
some people. | wycats_handlebars.js | train | js |
5fe44441b0da7e820bc9cf2c128a96de1c8a026e | diff --git a/tests/unit/test_dwave_sampler.py b/tests/unit/test_dwave_sampler.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_dwave_sampler.py
+++ b/tests/unit/test_dwave_sampler.py
@@ -143,12 +143,10 @@ class TestDwaveSampler(unittest.TestCase):
self.assertEqual(len(w), 0)
MockClient.reset_mock()
- sampler = DWaveSampler(solver_features={'qpu': True})
- MockClient.from_config.assert_called_once_with(solver={'qpu': True})
+ solver = {'qpu': True, 'num_qubits__gt': 1000}
+ sampler = DWaveSampler(solver_features=solver)
+ MockClient.from_config.assert_called_once_with(solver=solver)
- MockClient.reset_mock()
- sampler = DWaveSampler(solver_features={'software': True})
- MockClient.from_config.assert_called_once_with(solver={'software': True})
def test_sample_ising_variables(self): | Simplify dwave sample deprecation test | dwavesystems_dwave-system | train | py |
36104f544b00740599ff602efbc7c7089bba1118 | diff --git a/internal/service/ds/shared_directory.go b/internal/service/ds/shared_directory.go
index <HASH>..<HASH> 100644
--- a/internal/service/ds/shared_directory.go
+++ b/internal/service/ds/shared_directory.go
@@ -153,7 +153,6 @@ func resourceSharedDirectoryDelete(ctx context.Context, d *schema.ResourceData,
UnshareTarget: expandUnshareTarget(d.Get("target").([]interface{})[0].(map[string]interface{})),
}
- // TODO: this takes forever and is not correctly waiting for unshare
log.Printf("[DEBUG] Unsharing Directory Service Directory: %s", input)
output, err := conn.UnshareDirectoryWithContext(ctx, &input) | ds/shared_directory: Remove comment | terraform-providers_terraform-provider-aws | train | go |
38f6007f4a329bfba74acf353250ff2e2b14f288 | diff --git a/spec/lib/guard/rspec/command_spec.rb b/spec/lib/guard/rspec/command_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/guard/rspec/command_spec.rb
+++ b/spec/lib/guard/rspec/command_spec.rb
@@ -52,7 +52,7 @@ describe Guard::RSpec::Command do
end
context "with cmd_additional_args" do
- let(:options) { { cmd: 'rspec', cmd_additional_args: '-f progress' } }
+ let(:options) { { cmd: "rspec", cmd_additional_args: "-f progress" } }
it "uses them" do
expect(command).to match %r{-f progress} | Change quotes to appease Hound. | guard_guard-rspec | train | rb |
74a03cc1412f887fafcf62739734ab434979c09b | diff --git a/lib/i18n/locale/fallbacks.rb b/lib/i18n/locale/fallbacks.rb
index <HASH>..<HASH> 100644
--- a/lib/i18n/locale/fallbacks.rb
+++ b/lib/i18n/locale/fallbacks.rb
@@ -66,6 +66,7 @@ module I18n
def [](locale)
raise InvalidLocale.new(locale) if locale.nil?
+ raise Disabled.new('fallback#[]') if locale == false
locale = locale.to_sym
super || store(locale, compute(locale))
end
diff --git a/test/locale/fallbacks_test.rb b/test/locale/fallbacks_test.rb
index <HASH>..<HASH> 100644
--- a/test/locale/fallbacks_test.rb
+++ b/test/locale/fallbacks_test.rb
@@ -130,4 +130,12 @@ class I18nFallbacksComputationTest < I18n::TestCase
@fallbacks.map(:no => :nb, :nb => :no)
assert_equal [:nb, :no, :"en-US", :en], @fallbacks[:nb]
end
+
+ # Test I18n::Disabled is raised correctly when locale is false during fallback
+
+ test "with locale equals false" do
+ assert_raise I18n::Disabled do
+ @fallbacks[false]
+ end
+ end
end | Raise disabled during boot inside fallback | ruby-i18n_i18n | train | rb,rb |
9fa13a2b17b6cd54a438f02490ac49827994ee77 | diff --git a/randomized-runner/src/main/java/com/carrotsearch/randomizedtesting/ThreadLeakControl.java b/randomized-runner/src/main/java/com/carrotsearch/randomizedtesting/ThreadLeakControl.java
index <HASH>..<HASH> 100644
--- a/randomized-runner/src/main/java/com/carrotsearch/randomizedtesting/ThreadLeakControl.java
+++ b/randomized-runner/src/main/java/com/carrotsearch/randomizedtesting/ThreadLeakControl.java
@@ -284,6 +284,11 @@ class ThreadLeakControl {
if (t.getName().equals("JFR request timer")) {
return true;
}
+
+ // Explicit check for MacOSX AWT-AppKit
+ if (t.getName().equals("AWT-AppKit")) {
+ return true;
+ }
final List<StackTraceElement> stack = new ArrayList<StackTraceElement>(Arrays.asList(t.getStackTrace()));
Collections.reverse(stack); | Added macosx system thread. | randomizedtesting_randomizedtesting | train | java |
ffbd3b819fecce6d278c679aabb2887ad043522c | diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-atomikos/src/main/java/smoketest/atomikos/SampleAtomikosApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-atomikos/src/main/java/smoketest/atomikos/SampleAtomikosApplication.java
index <HASH>..<HASH> 100644
--- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-atomikos/src/main/java/smoketest/atomikos/SampleAtomikosApplication.java
+++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jta-atomikos/src/main/java/smoketest/atomikos/SampleAtomikosApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. | Update copyright year of changed file
See gh-<I> | spring-projects_spring-boot | train | java |
531d1beaee6fde3dc498f26d45dcfdc9a6079c9c | diff --git a/examples/manage-shorty.py b/examples/manage-shorty.py
index <HASH>..<HASH> 100755
--- a/examples/manage-shorty.py
+++ b/examples/manage-shorty.py
@@ -1,9 +1,12 @@
#!/usr/bin/env python
+import os
+import tempfile
from werkzeug import script
def make_app():
from shorty.application import Shorty
- return Shorty('sqlite:////tmp/shorty.db')
+ filename = os.path.join(tempfile.gettempdir(), "shorty.db")
+ return Shorty('sqlite:///{0}'.format(filename))
def make_shell():
from shorty import models, utils | Fixed DB path so that shorty runs on Windows | pallets_werkzeug | train | py |
71bb2790e6c78799ea756fb7685539c1e91e501b | diff --git a/tests/AesCtrTest.php b/tests/AesCtrTest.php
index <HASH>..<HASH> 100644
--- a/tests/AesCtrTest.php
+++ b/tests/AesCtrTest.php
@@ -1,7 +1,7 @@
<?php
use Dcrypt\Aes;
use Dcrypt\Mcrypt;
-class AesTest extends PHPUnit_Framework_TestCase
+class AesCtrTest extends PHPUnit_Framework_TestCase
{
public function testPbkdf() | Update AesCtrTest.php | mmeyer2k_dcrypt | train | php |
81289cf3fc15e72c3b4e25895a2533ceb804bdab | diff --git a/s3backup/sync.py b/s3backup/sync.py
index <HASH>..<HASH> 100644
--- a/s3backup/sync.py
+++ b/s3backup/sync.py
@@ -209,7 +209,7 @@ def get_actions(client_1, client_2):
client_1_actions = client_1.get_actions(all_keys)
client_2_actions = client_2.get_actions(all_keys)
- for key in all_keys:
+ for key in sorted(all_keys):
yield key, client_1_actions[key], client_2_actions[key] | Order keys before they are called for easier debugging | MichaelAquilina_S4 | train | py |
c9235d7ae5dfeed465562b0756d8dd24187506bc | diff --git a/src/GitHub_Updater/Base.php b/src/GitHub_Updater/Base.php
index <HASH>..<HASH> 100644
--- a/src/GitHub_Updater/Base.php
+++ b/src/GitHub_Updater/Base.php
@@ -674,15 +674,17 @@ class Base {
? array_slice( $rollback, 0, 1 )
: array_splice( $rollback, 0, $num_rollbacks, true );
- /**
- * Filter release asset rollbacks.
- * Must return an array.
- *
- * @since 9.9.2
- */
- $release_asset_rollback = apply_filters( 'github_updater_release_asset_rollback', $rollback, $file );
- if ( ! empty( $release_asset_rollback ) && is_array( $release_asset_rollback ) ) {
- $rollback = $release_asset_rollback;
+ if ( $data['release_asset'] ) {
+ /**
+ * Filter release asset rollbacks.
+ * Must return an array.
+ *
+ * @since 9.9.2
+ */
+ $release_asset_rollback = apply_filters( 'github_updater_release_asset_rollback', $rollback, $file );
+ if ( ! empty( $release_asset_rollback ) && is_array( $release_asset_rollback ) ) {
+ $rollback = $release_asset_rollback;
+ }
}
foreach ( $rollback as $tag ) { | only run if a release asset needed | afragen_github-updater | train | php |
5edd8dc619878bb4aee07d5bf3bbbf7a64f8b16d | diff --git a/src/geshi/vbnet.php b/src/geshi/vbnet.php
index <HASH>..<HASH> 100644
--- a/src/geshi/vbnet.php
+++ b/src/geshi/vbnet.php
@@ -167,7 +167,7 @@
0 => 'color: #FF0000;'
),
'METHODS' => array(
- 0 => 'color: #0000FF;'
+ 1 => 'color: #0000FF;'
),
'SYMBOLS' => array(
0 => 'color: #008000;' | Fixed my stupid oops with vbnet. | GeSHi_geshi-1.0 | train | php |
3863d09d62cc38bb10a7becdde4da7123f25f3eb | diff --git a/latools/helpers/plot.py b/latools/helpers/plot.py
index <HASH>..<HASH> 100644
--- a/latools/helpers/plot.py
+++ b/latools/helpers/plot.py
@@ -509,16 +509,15 @@ def autorange_plot(t, sig, gwin=7, swin=None, win=30,
-------
fig, axes
"""
- if swin is None:
- swin = gwin // 2
-
- sigs = fastsmooth(sig, swin)
+ if swin is not None:
+ sigs = fastsmooth(sig, swin)
+ else:
+ sigs = sig
# perform autorange calculations
# bins = 50
- bins = sig.size // nbin
- kde_x = np.linspace(sig.min(), sig.max(), bins)
+ kde_x = np.linspace(sig.min(), sig.max(), nbin)
kde = gaussian_kde(sigs)
yd = kde.pdf(kde_x) | bring autorange_plot in line with autorange | oscarbranson_latools | train | py |
fc9cdcb095324ea7b44042353d80f6d351e7e3ef | diff --git a/lib/mwlib/src/MW/Mail/Zend.php b/lib/mwlib/src/MW/Mail/Zend.php
index <HASH>..<HASH> 100644
--- a/lib/mwlib/src/MW/Mail/Zend.php
+++ b/lib/mwlib/src/MW/Mail/Zend.php
@@ -62,6 +62,6 @@ class MW_Mail_Zend implements MW_Mail_Interface
public function __clone()
{
$this->_object = clone $this->_object;
- $this->_transport = clone $this->_transport;
+ $this->_transport = ( isset( $this->_transport ) ? clone $this->_transport : null );
}
} | Tests for Zend transport object before trying to clone | Arcavias_arcavias-core | train | php |
753bb8ae0648d1dedb8d05ecbd4e96c9c2d12108 | diff --git a/src/main/org/openscience/cdk/smiles/SmilesGenerator.java b/src/main/org/openscience/cdk/smiles/SmilesGenerator.java
index <HASH>..<HASH> 100644
--- a/src/main/org/openscience/cdk/smiles/SmilesGenerator.java
+++ b/src/main/org/openscience/cdk/smiles/SmilesGenerator.java
@@ -71,7 +71,8 @@ public final class SmilesGenerator {
private final CDKToBeam converter;
/**
- * Create the SMILES generator.
+ * Create the generic SMILES generator.
+ * @see #generic()
*/
public SmilesGenerator() {
this(false, false, false);
@@ -109,13 +110,14 @@ public final class SmilesGenerator {
}
/**
- * Create a generator for arbitrary SMILES. Arbitrary SMILES are
+ * Create a generator for generic SMILES. Generic SMILES are
* non-canonical and useful for storing information when it is not used
- * as an index (i.e. unique keys).
+ * as an index (i.e. unique keys). The generated SMILES is dependant on
+ * the input order of the atoms.
*
* @return a new arbitrary SMILES generator
*/
- public static SmilesGenerator arbitary() {
+ public static SmilesGenerator generic() {
return new SmilesGenerator(false, false, false);
} | Rename arbitrary to generic - correct description. | cdk_cdk | train | java |
f6c455cea90dad43e597cff44f915423e3c746b0 | diff --git a/src/js/select2/dropdown/closeOnSelect.js b/src/js/select2/dropdown/closeOnSelect.js
index <HASH>..<HASH> 100644
--- a/src/js/select2/dropdown/closeOnSelect.js
+++ b/src/js/select2/dropdown/closeOnSelect.js
@@ -21,7 +21,7 @@ define([
var originalEvent = evt.originalEvent;
// Don't close if the control key is being held
- if (originalEvent && originalEvent.ctrlKey) {
+ if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {
return;
} | Do not close on select if Ctrl or Meta (Cmd) keys are being held as described in #<I> (#<I>)
Fixes #<I> | select2_select2 | train | js |
d79696cb2882ccfb147fe65a5697391f26181909 | diff --git a/src/Listener/CoroutineCompleteListener.php b/src/Listener/CoroutineCompleteListener.php
index <HASH>..<HASH> 100644
--- a/src/Listener/CoroutineCompleteListener.php
+++ b/src/Listener/CoroutineCompleteListener.php
@@ -32,7 +32,7 @@ class CoroutineCompleteListener implements EventHandlerInterface
public function handle(EventInterface $event): void
{
if (!Context::getWaitGroup()->isWait()) {
- $this->coroutineComplelete();
+ $this->coroutineComplete();
return;
} | up: remove throw container exception doc from server | swoft-cloud_swoft-framework | train | php |
ea9d24185760ac4a95e3e452ed04a734823648a4 | diff --git a/knxip/core.py b/knxip/core.py
index <HASH>..<HASH> 100644
--- a/knxip/core.py
+++ b/knxip/core.py
@@ -91,7 +91,8 @@ class KNXException(Exception):
E_TUNNELING_LAYER: "tunneling layer error",
}
- return super().__str__() + msg.get(self.errorcode, "unknown error code")
+ return super().__str__() + " "+msg.get(self.errorcode,
+ "unknown error code")
class KNXMessage(object): | - Formating of the KNXException text | open-homeautomation_pknx | train | py |
5a5dbe32661c4e4cf4c7b7114f8550c09a618cbe | diff --git a/Kwf/Util/ClearCache.php b/Kwf/Util/ClearCache.php
index <HASH>..<HASH> 100644
--- a/Kwf/Util/ClearCache.php
+++ b/Kwf/Util/ClearCache.php
@@ -59,7 +59,7 @@ class Kwf_Util_ClearCache
}
$tables = Zend_Registry::get('db')->fetchCol('SHOW TABLES');
foreach ($tables as $table) {
- if (substr($table, 0, 6) == 'cache_' && $table != 'cache_component') {
+ if (substr($table, 0, 6) == 'cache_') {
$ret[] = $table;
}
}
@@ -306,6 +306,13 @@ class Kwf_Util_ClearCache
if (in_array($t, $types) ||
(in_array('component', $types) && substr($t, 0, 15) == 'cache_component')
) {
+ if ($t == 'cache_component') {
+ $cnt = Zend_Registry::get('db')->query("SELECT COUNT(*) FROM $t")->fetchColumn();
+ if ($cnt > 1000) {
+ if ($output) echo "skipped: $t (won't delete $cnt entries, use clear-view-cache to clear)\n";
+ continue;
+ }
+ }
Zend_Registry::get('db')->query("TRUNCATE TABLE $t");
if ($output) echo "cleared db: $t\n";
} | clear view cache if less than <I> entries exist
for easier development | koala-framework_koala-framework | train | php |
0e288dc7412b936eac3c485f6b37d1a6a5cd60c1 | diff --git a/gossipsub.go b/gossipsub.go
index <HASH>..<HASH> 100644
--- a/gossipsub.go
+++ b/gossipsub.go
@@ -248,10 +248,11 @@ func (gs *GossipSubRouter) Leave(topic string) {
return
}
+ delete(gs.mesh, topic)
+
for p := range gmap {
gs.sendPrune(p, topic)
}
- delete(gs.mesh, topic)
}
func (gs *GossipSubRouter) sendGraft(p peer.ID, topic string) {
@@ -417,7 +418,7 @@ func (gs *GossipSubRouter) heartbeat() {
}
}
- // do we need more peers
+ // do we need more peers?
if len(peers) < GossipSubD {
ineed := GossipSubD - len(peers)
plst := gs.getPeers(topic, func(p peer.ID) bool { | delete mesh before sending prunes on leave | libp2p_go-libp2p-pubsub | train | go |
cf571038d24ef0c01d7d07ff6196057e55bb0c81 | diff --git a/lib/parser.js b/lib/parser.js
index <HASH>..<HASH> 100644
--- a/lib/parser.js
+++ b/lib/parser.js
@@ -54,6 +54,7 @@ var headings = {
'prts?': 'partNumber',
'manuf#': 'partNumber',
'ma?n?fr part.*': 'partNumber',
+ 'manu\\.? p/?n': 'partNumber',
mfpn: 'partNumber',
'mfg.?part.*': 'partNumber',
'retail\\.? part no\\.?': 'retailerPart',
diff --git a/src/parser.js b/src/parser.js
index <HASH>..<HASH> 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -51,6 +51,7 @@ const headings = {
'prts?': 'partNumber',
'manuf#': 'partNumber',
'ma?n?fr part.*': 'partNumber',
+ 'manu\\.? p/?n': 'partNumber',
mfpn: 'partNumber',
'mfg.?part.*': 'partNumber',
'retail\\.? part no\\.?': 'retailerPart', | Add an alias for "manuf. p/n" | kitspace_npm-1-click-bom | train | js,js |
ba7b0e04cbf4b5d8b17eae054b023988f5393d8f | diff --git a/examples/vdom-bench/main.js b/examples/vdom-bench/main.js
index <HASH>..<HASH> 100644
--- a/examples/vdom-bench/main.js
+++ b/examples/vdom-bench/main.js
@@ -14,11 +14,6 @@
},
tag: 'div',
isComponent: false,
- hasAttrs: false,
- hasHooks: false,
- hasEvents: false,
- hasClassName: false,
- hasStyle: false,
isSVG: false,
lazy: false,
eventKeys: null,
@@ -39,11 +34,6 @@
className: null,
style: null,
isComponent: false,
- hasAttrs: false,
- hasHooks: false,
- hasEvents: false,
- hasStyle: false,
- hasClassName: false,
isSVG: false,
eventKeys: null,
attrKeys: null, | removed some bp related code from vdom bench | infernojs_inferno | train | js |
4b44ae74f1c1bea9061422d775778233b95b2c7d | diff --git a/angr/exploration_techniques/crash_monitor.py b/angr/exploration_techniques/crash_monitor.py
index <HASH>..<HASH> 100644
--- a/angr/exploration_techniques/crash_monitor.py
+++ b/angr/exploration_techniques/crash_monitor.py
@@ -112,16 +112,23 @@ class CrashMonitor(ExplorationTechnique):
state.add_constraints(var == concrete_vals[0])
# then we step again up to the crashing instruction
- p_block = state.block()
+ inst_addrs = state.block().instruction_addrs
+ inst_cnt = len(inst_addrs)
+
+ if inst_cnt == 0:
+ insts = 0
+ elif self._crash_addr in inst_addrs:
+ insts = inst_addrs.index(self._crash_addr)
+ else:
+ insts = inst_cnt - 1
- inst_cnt = len(p_block.instruction_addrs)
- insts = 0 if inst_cnt == 0 else inst_cnt - 1
succs = state.step(num_inst=insts).flat_successors
if len(succs) > 0:
if len(succs) > 1:
succs = [s for s in succs if s.se.satisfiable()]
state = succs[0]
+ self._last_state = state
# remove the preconstraints
l.debug("removing preconstraints") | Fix instruction count in crashing block step | angr_angr | train | py |
35ca3d44eac25225fd0f2a685f93376941141ac8 | diff --git a/src/js/base/module/Buttons.js b/src/js/base/module/Buttons.js
index <HASH>..<HASH> 100644
--- a/src/js/base/module/Buttons.js
+++ b/src/js/base/module/Buttons.js
@@ -561,7 +561,7 @@ export default class Buttons {
$catcher.css({
width: this.options.insertTableMaxSize.col + 'em',
height: this.options.insertTableMaxSize.row + 'em',
- }).mousedown(this.context.createInvokeHandler('editor.insertTable'))
+ }).mouseup(this.context.createInvokeHandler('editor.insertTable'))
.on('mousemove', this.tableMoveHandler.bind(this));
},
}).render();
diff --git a/src/js/lite/ui.js b/src/js/lite/ui.js
index <HASH>..<HASH> 100644
--- a/src/js/lite/ui.js
+++ b/src/js/lite/ui.js
@@ -250,7 +250,7 @@ const tableDropdownButton = function(opt) {
width: opt.col + 'em',
height: opt.row + 'em',
})
- .mousedown(opt.itemClick)
+ .mouseup(opt.itemClick)
.mousemove(function(e) {
tableMoveHandler(e, opt.col, opt.row);
}); | dimension-picker insertTable on mouseup | summernote_summernote | train | js,js |
5d19ca4b7d79ca6452139eedf8c6b19e2b039fe7 | diff --git a/src/Kernel/Application.php b/src/Kernel/Application.php
index <HASH>..<HASH> 100755
--- a/src/Kernel/Application.php
+++ b/src/Kernel/Application.php
@@ -2,12 +2,9 @@
namespace Encore\Kernel;
-use Encore\Testing\Testing;
use Encore\Container\Container;
-use Encore\Config\Loader;
use Symfony\Component\Debug\Debug;
-use Illuminate\Filesystem\Filesystem;
-use Illuminate\Config\Repository as Config;
+use Encore\Config\ServiceProvider as ConfigServiceProvider;
class Application extends Container
{
@@ -55,9 +52,7 @@ class Application extends Container
public function boot()
{
- $config = new Config(new Loader(new Filesystem, $this->appPath.'/config', $this->getOS()), $this->mode);
-
- $this->bind('config', $config);
+ $this->addProvider(new ConfigServiceProvider($this));
// Register service providers
foreach ($config->get('app.providers') as $provider) { | Config is now a service provider | encorephp_kernel | train | php |
968a0d8f0242d398279defb7d86b034e4f2dbb43 | diff --git a/src/java/com/samskivert/jdbc/depot/PersistenceContext.java b/src/java/com/samskivert/jdbc/depot/PersistenceContext.java
index <HASH>..<HASH> 100644
--- a/src/java/com/samskivert/jdbc/depot/PersistenceContext.java
+++ b/src/java/com/samskivert/jdbc/depot/PersistenceContext.java
@@ -416,8 +416,9 @@ public class PersistenceContext
if (bin != null) {
for (Object key : bin.enumerateKeys()) {
CacheAdapter.CachedValue<T> element = bin.lookup((Serializable) key);
- if (element != null) {
- filter.visitCacheEntry(this, cacheId, (Serializable) key, element.getValue());
+ T value;
+ if (element != null && (value = element.getValue()) != null) {
+ filter.visitCacheEntry(this, cacheId, (Serializable) key, value);
}
}
} | I'm assuming it's valid for a CachedValue to exist but have a null value as we
properly ignore those elsewhere, so we should ignore them when traversing the
cache as well.
git-svn-id: <URL> | samskivert_samskivert | train | java |
3e98179cfdc150b0c973f05e0f29b4b849c148b0 | diff --git a/Form/Type/AvatarUploadType.php b/Form/Type/AvatarUploadType.php
index <HASH>..<HASH> 100755
--- a/Form/Type/AvatarUploadType.php
+++ b/Form/Type/AvatarUploadType.php
@@ -5,6 +5,7 @@ namespace CampaignChain\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -17,6 +18,6 @@ class AvatarUploadType extends AbstractType
public function getParent()
{
- return "text";
+ return TextType::class;
}
}
\ No newline at end of file
diff --git a/Form/Type/DateTimePickerType.php b/Form/Type/DateTimePickerType.php
index <HASH>..<HASH> 100755
--- a/Form/Type/DateTimePickerType.php
+++ b/Form/Type/DateTimePickerType.php
@@ -84,7 +84,7 @@ class DateTimePickerType extends AbstractType
public function getParent()
{
- return 'collot_datetime';
+ return \SC\DatetimepickerBundle\Form\Type\DatetimeType::class;
}
public function getBlockPrefix() | CampaignChain/campaignchain#<I> Upgrade to Symfony 3.x | CampaignChain_core | train | php,php |
c90a88bfb7e52b514ccd20cc8ddada85ff6aa21e | diff --git a/mod/workshop/allocation/manual/lib.php b/mod/workshop/allocation/manual/lib.php
index <HASH>..<HASH> 100644
--- a/mod/workshop/allocation/manual/lib.php
+++ b/mod/workshop/allocation/manual/lib.php
@@ -357,11 +357,25 @@ class workshop_manual_allocator implements workshop_allocator {
* @see workshop_manual_allocator::ui()
*/
class workshopallocation_manual_allocations implements renderable {
+
+ /** @var array of stdClass, indexed by userid, properties userid, submissionid, (array)reviewedby, (array)reviewerof */
public $allocations;
+
+ /** @var array of stdClass contains the data needed to display the user name and picture */
public $userinfo;
+
+ /* var array of stdClass potential authors */
public $authors;
+
+ /* var array of stdClass potential reviewers */
public $reviewers;
+
+ /* var int the id of the user to highlight as the author */
public $hlauthorid;
+
+ /* var int the id of the user to highlight as the reviewer */
public $hlreviewerid;
+
+ /* var bool should the selfassessment be allowed */
public $selfassessment;
} | MDL-<I> improving the docs for workshopallocation_manual_allocations class | moodle_moodle | train | php |
238d589f6e6b9b84edc706c53bcf63e03f77886c | diff --git a/examples/tp/tm_high_order.py b/examples/tp/tm_high_order.py
index <HASH>..<HASH> 100644
--- a/examples/tp/tm_high_order.py
+++ b/examples/tp/tm_high_order.py
@@ -40,8 +40,8 @@ def accuracy(current, predicted):
Computes the accuracy of the TM at time-step t based on the prediction
at time-step t-1 and the current active columns at time-step t.
- @param curr (array) binary vector containing current active columns
- @param pred (array) binary vector containing predicted active columns
+ @param current (array) binary vector containing current active columns
+ @param predicted (array) binary vector containing predicted active columns
@return acc (float) prediction accuracy of the TM at time-step t
"""
@@ -80,9 +80,9 @@ def showPredictions():
"""
Shows predictions of the TM when presented with the characters A, B, C, D, X, and
Y without any contextual information, that is, not embedded within a sequence.
- """
- tm.reset()
+ """
for k in range(6):
+ tm.reset()
print "--- " + "ABCDXY"[k] + " ---"
tm.compute(set(seqT[k][:].nonzero()[0].tolist()), learn=False)
activeColumnsIndices = [tm.columnForCell(i) for i in tm.getActiveCells()] | Corrections to examples in tm_high_order.py | numenta_nupic | train | py |
434fa14f3d25febd29ae3783bbe7bca6f6d4856f | diff --git a/walker_test.go b/walker_test.go
index <HASH>..<HASH> 100644
--- a/walker_test.go
+++ b/walker_test.go
@@ -9,6 +9,24 @@ import (
"github.com/stretchr/testify/assert"
)
+func TestWalkReturnsCorrectlyPopulatedWalker(t *testing.T) {
+ mock, err := newFtpMock(t, "127.0.0.1")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer mock.Close()
+
+ c, cErr := Connect(mock.Addr())
+ if cErr != nil {
+ t.Fatal(err)
+ }
+
+ w := c.Walk("root")
+
+ assert.Equal(t, "root/", w.root)
+ assert.Equal(t, &c, &w.serverConn)
+}
+
func TestFieldsReturnCorrectData(t *testing.T) {
w := Walker{
cur: item{ | Added test to check the creation of the walker is | jlaffaye_ftp | train | go |
59b0a8ea06879e453abffc4eeb758054b8e3c9c7 | diff --git a/grimoire/arthur.py b/grimoire/arthur.py
index <HASH>..<HASH> 100755
--- a/grimoire/arthur.py
+++ b/grimoire/arthur.py
@@ -86,7 +86,9 @@ def feed_backend(url, clean, fetch_cache, backend_name, backend_params,
if backend:
logging.error("Error feeding ocean from %s (%s): %s" %
(backend_name, backend.origin, ex))
- traceback.print_exc()
+ # don't propagete ... it makes blackbird fails
+ # TODO: manage it in p2o
+ # traceback.print_exc()
else:
logging.error("Error feeding ocean %s" % ex) | [arthur] Don't propogate exception not managed yet in p2o. Makes cauldron.io fails. | chaoss_grimoirelab-elk | train | py |
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.