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
|
---|---|---|---|---|---|
731e6c9a4f048266ac087c59447139b59be4715e | diff --git a/lib/classy_enum/version.rb b/lib/classy_enum/version.rb
index <HASH>..<HASH> 100644
--- a/lib/classy_enum/version.rb
+++ b/lib/classy_enum/version.rb
@@ -1,3 +1,3 @@
module ClassyEnum
- VERSION = "2.0.3"
+ VERSION = "2.1.0"
end | Bumping to v <I> | beerlington_classy_enum | train | rb |
591e64c89d1a56c824ba5f47bc84721f5c3452fc | diff --git a/kundera-core/src/main/java/com/impetus/kundera/query/QueryHandlerException.java b/kundera-core/src/main/java/com/impetus/kundera/query/QueryHandlerException.java
index <HASH>..<HASH> 100644
--- a/kundera-core/src/main/java/com/impetus/kundera/query/QueryHandlerException.java
+++ b/kundera-core/src/main/java/com/impetus/kundera/query/QueryHandlerException.java
@@ -52,4 +52,12 @@ public class QueryHandlerException extends RuntimeException
super(paramThrowable);
}
+ /**
+ * @param paramThrowable
+ */
+ public QueryHandlerException(String paramString, Throwable paramThrowable)
+ {
+ super(paramString, paramThrowable);
+ }
+
} | Added a new constructor in QueryHandlerException.java | Impetus_Kundera | train | java |
44c8d6fe091f87fe94ed047b672c51656dda8420 | diff --git a/bundles/as3/lib/sprout/as3/version.rb b/bundles/as3/lib/sprout/as3/version.rb
index <HASH>..<HASH> 100644
--- a/bundles/as3/lib/sprout/as3/version.rb
+++ b/bundles/as3/lib/sprout/as3/version.rb
@@ -3,7 +3,7 @@ module Sprout # :nodoc:
module VERSION #:nodoc:
MAJOR = 1
MINOR = 0
- TINY = 29
+ TINY = 30
STRING = [MAJOR, MINOR, TINY].join('.')
MAJOR_MINOR = [MAJOR, MINOR].join('.')
diff --git a/bundles/as3/lib/sprout/tasks/mxmlc_debug.rb b/bundles/as3/lib/sprout/tasks/mxmlc_debug.rb
index <HASH>..<HASH> 100644
--- a/bundles/as3/lib/sprout/tasks/mxmlc_debug.rb
+++ b/bundles/as3/lib/sprout/tasks/mxmlc_debug.rb
@@ -22,6 +22,8 @@ module Sprout # :nodoc:
def initialize(args, &block)
super
+ t = define_outer_task
+
mxmlc output do |t|
configure_mxmlc t
configure_mxmlc_application t
@@ -30,7 +32,6 @@ module Sprout # :nodoc:
define_player
- t = define_outer_task
t.prerequisites << output
t.prerequisites << player_task_name
end | Fixed debug task rake description support | lukebayes_project-sprouts | train | rb,rb |
81f9600ef8009b083e74c20eb6724353a3921708 | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -50,15 +50,18 @@ describe('scripts manager', function () {
done(new Error('should have failed'))
}
- scriptsManager2.execute({}, { execModulePath: path.join(__dirname, 'scripts', 'script.js') }, function (err, res) {
- if (err) {
- scriptsManager2.kill()
- return done(err)
- }
+ // seems we need to wait a bit until it is restarted fully?
+ setTimeout(function () {
+ scriptsManager2.execute({}, { execModulePath: path.join(__dirname, 'scripts', 'script.js') }, function (err, res) {
+ if (err) {
+ scriptsManager2.kill()
+ return done(err)
+ }
- scriptsManager2.kill()
- done()
- })
+ scriptsManager2.kill()
+ done()
+ })
+ }, 100)
})
})
}) | wait a bit until recycle in test | pofider_node-script-manager | train | js |
f4b72cdb742dab7e81f6d53a4e5c17fe4f6c4c18 | diff --git a/question/questiontypes/multianswer/questiontype.php b/question/questiontypes/multianswer/questiontype.php
index <HASH>..<HASH> 100644
--- a/question/questiontypes/multianswer/questiontype.php
+++ b/question/questiontypes/multianswer/questiontype.php
@@ -198,7 +198,7 @@ class quiz_embedded_cloze_qtype extends quiz_default_questiontype {
$nameprefix = $question->name_prefix;
// For this question type, we better print the image on top:
- quiz_print_possible_question_image($question, $cmoptions->course);
+ echo get_question_image($question, $cmoptions->course);
$qtextremaining = format_text($question->questiontext,
$question->questiontextformat,
@@ -330,6 +330,7 @@ class quiz_embedded_cloze_qtype extends quiz_default_questiontype {
// Print the final piece of question text:
echo $qtextremaining;
+ $this->print_question_submit_buttons($question, $state, $cmoptions, $options);
}
function grade_responses(&$question, &$state, $cmoptions) { | Made to work with the new templating system. | moodle_moodle | train | php |
a90f0024f8bd2ffe880534a15574d7327add9bcc | diff --git a/src/chisel/__init__.py b/src/chisel/__init__.py
index <HASH>..<HASH> 100644
--- a/src/chisel/__init__.py
+++ b/src/chisel/__init__.py
@@ -6,7 +6,7 @@ Chisel is a light-weight Python WSGI application framework with tools for buildi
well-tested, schema-validated JSON web APIs.
"""
-__version__ = '0.9.105'
+__version__ = '0.9.106'
from .action import \
Action, \ | chisel <I> | craigahobbs_chisel | train | py |
d44df69b23fc007369eec05bad9924f6415069d5 | diff --git a/admin/roles/lib.php b/admin/roles/lib.php
index <HASH>..<HASH> 100644
--- a/admin/roles/lib.php
+++ b/admin/roles/lib.php
@@ -1507,15 +1507,16 @@ class admins_potential_selector extends user_selector_base {
}
public function find_users($search) {
- global $DB;
+ global $CFG, $DB;
list($wherecondition, $params) = $this->search_sql($search, '');
$fields = 'SELECT ' . $this->required_fields_sql('');
$countfields = 'SELECT COUNT(1)';
$sql = " FROM {user}
- WHERE $wherecondition";
+ WHERE $wherecondition AND mnethostid = :localmnet";
$order = ' ORDER BY lastname ASC, firstname ASC';
+ $params['localmnet'] = $CFG->mnet_localhost_id; // it could be dangerous to make remote users admins and also this could lead to other problems
$availableusers = $DB->get_records_sql($fields . $sql . $order, $params); | MDL-<I> only local users can be admins - more security and fewer "lost admin account" problems | moodle_moodle | train | php |
07aeeab9ec499d354ed307ab8f1b97d09dd2d186 | diff --git a/lib/geocoder/request.rb b/lib/geocoder/request.rb
index <HASH>..<HASH> 100644
--- a/lib/geocoder/request.rb
+++ b/lib/geocoder/request.rb
@@ -78,8 +78,5 @@ module Geocoder
end
end
-if defined?(ActionDispatch::Request)
- ActionDispatch::Request.__send__(:include, Geocoder::Request)
-elsif defined?(Rack::Request)
- Rack::Request.__send__(:include, Geocoder::Request)
-end
+ActionDispatch::Request.__send__(:include, Geocoder::Request) if defined?(ActionDispatch::Request)
+Rack::Request.__send__(:include, Geocoder::Request) if defined?(Rack::Request) | always add geocoder to Rack::Request if defined (#<I>) | alexreisner_geocoder | train | rb |
c7503864b9a7777d385e89713030005b000b64e6 | diff --git a/app/controllers/alchemy/admin/users_controller.rb b/app/controllers/alchemy/admin/users_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/alchemy/admin/users_controller.rb
+++ b/app/controllers/alchemy/admin/users_controller.rb
@@ -23,6 +23,10 @@ module Alchemy
@users = users.page(params[:page] || 1).per(per_page_value_for_screen_size).order(sort_order)
end
+ def new
+ @user = User.new(send_credentials: true)
+ end
+
def create
@user = User.create(user_params)
render_errors_or_redirect( | Set User#send_credentials checkbox to checked in Admin::Users#new | AlchemyCMS_alchemy_cms | train | rb |
033ddd95c297ca653563c7c75aef0ac6f3bc7310 | diff --git a/liquid_tags/b64img.py b/liquid_tags/b64img.py
index <HASH>..<HASH> 100644
--- a/liquid_tags/b64img.py
+++ b/liquid_tags/b64img.py
@@ -24,7 +24,10 @@ Output
"""
import re
import base64
-import urllib2
+try:
+ import urllib.request as urllib2
+except ImportError:
+ import urllib2
from .mdx_liquid_tags import LiquidTags
import six | Add support for python3 in liquid_tags/b<I>img.py
The following error occured when used with python3
ImportError: No module named 'urllib2' | getpelican_pelican-plugins | train | py |
ed73c6c754093c67a9a9ae796f9d0c0fd1c8fa47 | diff --git a/src/router.js b/src/router.js
index <HASH>..<HASH> 100644
--- a/src/router.js
+++ b/src/router.js
@@ -71,10 +71,13 @@ export default class Router {
await this.ctx.route.dispose()
}
+ const currentUrl = Router.canonicalizePath(location.pathname + location.search + location.hash)
+ const { search, hash } = Router.parseUrl(currentUrl)
+
history[push ? 'pushState' : 'replaceState'](
history.state,
document.title,
- this.config.base + path
+ this.config.base + path + search + hash
)
this.ctx = new Context({
@@ -212,14 +215,18 @@ export default class Router {
return path.replace(new RegExp('/?#?!?/?'), '/')
}
- static getPath(url) {
+ static parseUrl(url) {
const parser = document.createElement('a')
const b = ko.router.config.base.toLowerCase()
if (b && url.toLowerCase().indexOf(b) === 0) {
url = url.replace(new RegExp(b, 'i'), '') || '/'
}
parser.href = Router.canonicalizePath(url)
- return parser.pathname
+ return parser
+ }
+
+ static getPath(url) {
+ return Router.parseUrl(url).pathname
}
static sameOrigin(href) { | Don't wipe out querystring or hash | Profiscience_ko-component-router | train | js |
d1e975e0844f87b3313c7d4fdb14a0443ad768eb | diff --git a/lib/tetra/project_initer.rb b/lib/tetra/project_initer.rb
index <HASH>..<HASH> 100644
--- a/lib/tetra/project_initer.rb
+++ b/lib/tetra/project_initer.rb
@@ -81,7 +81,7 @@ module Tetra
Tetra::Tar.new
end
- Dir.glob("*").each { |f| FileUtils.rm_rf(f) }
+ Dir.glob(File.join("src", "*")).each { |f| FileUtils.rm_rf(f) }
unarchiver.decompress(file, "src")
commit_sources(message, true)
end | Bugfix: don't delete *, delete src/*! | moio_tetra | train | rb |
992e26c042b598457e1496a7695d37d611716b61 | diff --git a/lib/lingohub/commands/help.rb b/lib/lingohub/commands/help.rb
index <HASH>..<HASH> 100644
--- a/lib/lingohub/commands/help.rb
+++ b/lib/lingohub/commands/help.rb
@@ -46,7 +46,7 @@ module Lingohub::Command
group.command 'project:info --project <name>', 'show project info, like web url and number of translations'
group.command 'project:open --project <name>', 'open the project in a web browser'
group.command 'project:rename <oldname> <newname>', 'rename the project'
- group.command 'project:destroy --project <name>', 'destroy the project permanently'
+ group.command 'project:archive --project <name>', 'archive the project'
group.space
end
diff --git a/lib/lingohub/commands/project.rb b/lib/lingohub/commands/project.rb
index <HASH>..<HASH> 100644
--- a/lib/lingohub/commands/project.rb
+++ b/lib/lingohub/commands/project.rb
@@ -50,7 +50,7 @@ module Lingohub::Command
Launchy.open project.weburl
end
- def destroy
+ def archive
display "=== #{project.title}"
display "Web URL: #{project.weburl}"
display "Owner: #{project.owner}" | renamed 'destroy' to 'archive' | lingohub_lingohub_ruby | train | rb,rb |
2c27cc009056d22e3072e8ebf518092b471d3877 | diff --git a/internal/ackhandler/sent_packet_handler.go b/internal/ackhandler/sent_packet_handler.go
index <HASH>..<HASH> 100644
--- a/internal/ackhandler/sent_packet_handler.go
+++ b/internal/ackhandler/sent_packet_handler.go
@@ -15,8 +15,8 @@ import (
const (
// Maximum reordering in time space before time based loss detection considers a packet lost.
- // In fraction of an RTT.
- timeReorderingFraction = 1.0 / 8
+ // Specified as an RTT multiplier.
+ timeThreshold = 9.0 / 8
// Timer granularity. The timer will not be set to a value smaller than granularity.
granularity = time.Millisecond
)
@@ -340,7 +340,7 @@ func (h *sentPacketHandler) detectLostPackets(
pnSpace := h.getPacketNumberSpace(encLevel)
maxRTT := float64(utils.MaxDuration(h.rttStats.LatestRTT(), h.rttStats.SmoothedRTT()))
- lossDelay := time.Duration((1.0 + timeReorderingFraction) * maxRTT)
+ lossDelay := time.Duration(timeThreshold * maxRTT)
var lostPackets []*Packet
pnSpace.history.Iterate(func(packet *Packet) (bool, error) { | rename the reordering threshold constant in the sent packet handler | lucas-clemente_quic-go | train | go |
d1879429aecf06b8fda60a343b245738ae113bb7 | diff --git a/column/api/controller/credential_controller.py b/column/api/controller/credential_controller.py
index <HASH>..<HASH> 100644
--- a/column/api/controller/credential_controller.py
+++ b/column/api/controller/credential_controller.py
@@ -1,5 +1,6 @@
# Copyright (c) 2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
+
import json
import logging | Update credential_controller.py | vmware_column | train | py |
209122347cbec2380694a11274cb90e7555c9802 | diff --git a/scripts/webpack/webpack.common.js b/scripts/webpack/webpack.common.js
index <HASH>..<HASH> 100644
--- a/scripts/webpack/webpack.common.js
+++ b/scripts/webpack/webpack.common.js
@@ -41,14 +41,7 @@ module.exports = {
// we want to have same Prism object in core and in grafana/ui
prismjs: require.resolve('prismjs'),
},
- modules: [
- 'node_modules',
- // we need full path to root node_modules for grafana-enterprise symlink to work
- path.resolve('node_modules'),
- '.yarn',
- path.resolve('.yarn'),
- path.resolve('public'),
- ],
+ modules: ['node_modules', path.resolve('public')],
fallback: {
buffer: false,
fs: false,
@@ -57,6 +50,7 @@ module.exports = {
https: false,
string_decoder: false,
},
+ symlinks: false,
},
ignoreWarnings: [/export .* was not found in/],
stats: { | Chore: Fix broken enterprise builds (#<I>) | grafana_grafana | train | js |
849113b45f070d51bbed5bc48544ff1675f448d8 | diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Foundation/Application.php
+++ b/src/Illuminate/Foundation/Application.php
@@ -1143,6 +1143,16 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
parent::flush();
$this->loadedProviders = [];
+ $this->bootingCallbacks = [];
+ $this->bootedCallbacks = [];
+ $this->middlewares = [];
+ $this->serviceProviders = [];
+ $this->deferredServices = [];
+ $this->reboundCallbacks = [];
+ $this->resolvingCallbacks = [];
+ $this->afterResolvingCallbacks = [];
+ $this->globalResolvingCallbacks = [];
+ $this->buildStack = [];
}
/** | [testcase] Flush application resources in application flush (#<I>) | laravel_framework | train | php |
9faea45579d5db85a453fdca8f38f97d98aa532d | diff --git a/python/python2/simplerandom/iterators/test.py b/python/python2/simplerandom/iterators/test.py
index <HASH>..<HASH> 100644
--- a/python/python2/simplerandom/iterators/test.py
+++ b/python/python2/simplerandom/iterators/test.py
@@ -72,12 +72,11 @@ class MWC64Test(unittest.TestCase):
def test_seed_with_MSbit_set(self):
"""Test MWC64 with MS-bit of mwc_c seed set.
- This failed an earlier version of the Cython code (0.7.0) when
- built with Cython 0.14.
+ This caused an exception an earlier version of the Cython code (0.7.0)
+ when built with Cython 0.14.
"""
- mwc64 = sri.RandomMWC64Iterator(2**31, 0)
- k = mwc64.next()
- self.assertEqual(k, 2**31)
+ mwc64 = sri.RandomMWC64Iterator(2**31, 1)
+ mwc64.next()
def runtests(): | Fix test_seed_with_MSbit_set unit test, now that 0 seed value is modified in MWC<I>. | cmcqueen_simplerandom | train | py |
9aa0ceb97584be6d5b27dc71a2ecde2d43b41183 | diff --git a/stylelint-prettier.js b/stylelint-prettier.js
index <HASH>..<HASH> 100644
--- a/stylelint-prettier.js
+++ b/stylelint-prettier.js
@@ -29,6 +29,12 @@ module.exports = stylelint.createPlugin(
return;
}
+ // Stylelint can handle css-in-js, in which it formats object literals.
+ // We don't want to run these extracts of JS through prettier
+ if (root.source.lang === 'object-literal') {
+ return;
+ }
+
const stylelintPrettierOptions = omitStylelintSpecificOptions(options);
if (!prettier) { | Add an extra check to run away from object-literal syntax | prettier_stylelint-prettier | train | js |
86f6a1aa4dc2d2e7c87c2320ab93b2bdd7929ce2 | diff --git a/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/EnglishConfusionProbabilityRule.java b/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/EnglishConfusionProbabilityRule.java
index <HASH>..<HASH> 100644
--- a/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/EnglishConfusionProbabilityRule.java
+++ b/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/EnglishConfusionProbabilityRule.java
@@ -22,7 +22,6 @@ import org.languagetool.Language;
import org.languagetool.languagemodel.LanguageModel;
import org.languagetool.rules.ngrams.ConfusionProbabilityRule;
import org.languagetool.rules.Example;
-import org.languagetool.tokenizers.WordTokenizer;
import java.util.ResourceBundle;
@@ -31,8 +30,6 @@ import java.util.ResourceBundle;
*/
public class EnglishConfusionProbabilityRule extends ConfusionProbabilityRule {
- private final WordTokenizer tokenizer = new GoogleStyleWordTokenizer();
-
public EnglishConfusionProbabilityRule(ResourceBundle messages, LanguageModel languageModel, Language language) {
this(messages, languageModel, language, 3);
} | cleanup: remove unused member var | languagetool-org_languagetool | train | java |
ba7d2765f4b93a195dad29f9660f9473811aedb3 | diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php
index <HASH>..<HASH> 100644
--- a/Library/ClassDefinition.php
+++ b/Library/ClassDefinition.php
@@ -1342,7 +1342,8 @@ final class ClassDefinition
if ($richFormat || $method->hasParameters() || version_compare(PHP_VERSION, '8.0.0', '>=')) {
$codePrinter->output(
sprintf(
- "\tZEND_ME(%s_%s, %s, %s, %s)",
+ // TODO: Rename to ZEND_ME
+ "\tPHP_ME(%s_%s, %s, %s, %s)",
$this->getCNamespace(),
$this->getName(),
$method->getName(),
@@ -1353,7 +1354,8 @@ final class ClassDefinition
} else {
$codePrinter->output(
sprintf(
- "\tZEND_ME(%s_%s, %s, NULL, %s)",
+ // TODO: Rename to ZEND_ME
+ "\tPHP_ME(%s_%s, %s, NULL, %s)",
$this->getCNamespace(),
$this->getName(),
$method->getName(), | Revert rename of PHP_ME macros | phalcon_zephir | train | php |
2ad6ed721f0e3fd059174c3c2d07f7ea2e5d9d69 | diff --git a/spec/progne_tapera/enum_list_spec.rb b/spec/progne_tapera/enum_list_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/progne_tapera/enum_list_spec.rb
+++ b/spec/progne_tapera/enum_list_spec.rb
@@ -1,5 +1,4 @@
require 'spec_helper'
-require 'progne_tapera'
describe ProgneTapera::EnumList do | 1, Improve the Enum List spec. | topbitdu_progne_tapera | train | rb |
b057d9de71824106ebba83da0d229c9334c67af1 | diff --git a/tests/test_jsane.py b/tests/test_jsane.py
index <HASH>..<HASH> 100644
--- a/tests/test_jsane.py
+++ b/tests/test_jsane.py
@@ -6,7 +6,7 @@ import pep8
sys.path.insert(0, os.path.abspath(__file__ + "/../.."))
-from jsane import loads, dumps, JSaneException
+from jsane import loads, dumps, JSaneException, from_dict
from jsane.traversable import Traversable
@@ -57,6 +57,7 @@ class TestClass:
def test_wrapper(self):
assert loads(dumps(self.dict1)).r() == self.dict1
assert json.dumps(self.dict1) == dumps(self.dict1)
+ assert self.dict1["foo"] == from_dict(self.dict1).foo.r()
assert loads(dumps(self.dict1)), Traversable(self.dict1)
def test_access(self): | test: Add test for from_dict. | skorokithakis_jsane | train | py |
ef0dc103554be0c54d48e5bc028050423efb4594 | diff --git a/tests/support.py b/tests/support.py
index <HASH>..<HASH> 100644
--- a/tests/support.py
+++ b/tests/support.py
@@ -188,6 +188,9 @@ def fixup_build_ext(cmd):
cmd = build_ext(dist)
support.fixup_build_ext(cmd)
cmd.ensure_finalized()
+
+ Unlike most other Unix platforms, Mac OS X embeds absolute paths
+ to shared libraries into executables, so the fixup is not needed there.
"""
if os.name == 'nt':
cmd.debug = sys.executable.endswith('_d.exe')
@@ -199,5 +202,8 @@ def fixup_build_ext(cmd):
if runshared is None:
cmd.library_dirs = ['.']
else:
- name, equals, value = runshared.partition('=')
- cmd.library_dirs = value.split(os.pathsep)
+ if sys.platform == 'darwin':
+ cmd.library_dirs = []
+ else:
+ name, equals, value = runshared.partition('=')
+ cmd.library_dirs = value.split(os.pathsep) | Issue #<I>: Prevent test_distutils failures on OS X with --enable-shared. | pypa_setuptools | train | py |
0dfdc5b878ad9cef12516e9c5470c6bb4c609bf4 | diff --git a/tests/test_server.py b/tests/test_server.py
index <HASH>..<HASH> 100644
--- a/tests/test_server.py
+++ b/tests/test_server.py
@@ -89,6 +89,14 @@ def test_new_session(server: Server) -> None:
assert server.has_session("test_new_session")
+def test_new_session_no_name(server: Server) -> None:
+ """Server.new_session works with no name"""
+ mysession = server.new_session()
+ session_name = mysession.get("session_name")
+ assert session_name is not None
+ assert server.has_session(session_name)
+
+
def test_new_session_shell(server: Server) -> None:
"""Server.new_session creates and returns valid session running with
specified command""" | test: Server.new_session w/ no name | tmux-python_libtmux | train | py |
a256a24b8f5d729caf783aadcd445a0bc57b64c6 | diff --git a/Sniff.php b/Sniff.php
index <HASH>..<HASH> 100644
--- a/Sniff.php
+++ b/Sniff.php
@@ -38,8 +38,7 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
$testVersion = $this->getTestVersion();
if (is_null($testVersion)
- || (!is_null($testVersion)
- && version_compare($testVersion, $phpVersion) >= 0)
+ || version_compare($testVersion, $phpVersion) >= 0
) {
return true;
} else { | Removed redundant conditional in Sniff.php.
One condition of the if() statement checks for $testVersion is null, and the other includes a check that it isn't null. However, because they are ORed together, it is redundant to perform this checking in the second condition, as it will always be true (due to lazy-evaluation). | PHPCompatibility_PHPCompatibility | train | php |
cc1ada88938617573c83da784ecb068aff9e1ac9 | diff --git a/spyderlib/plugins/runconfig.py b/spyderlib/plugins/runconfig.py
index <HASH>..<HASH> 100644
--- a/spyderlib/plugins/runconfig.py
+++ b/spyderlib/plugins/runconfig.py
@@ -349,7 +349,7 @@ class RunConfigDialog(BaseRunConfigDialog):
self.add_widgets(combo_label, self.combo, 10, self.stack)
self.add_button_box(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
- self.setWindowTitle(_("Run configurations"))
+ self.setWindowTitle(_("Run Settings"))
def accept(self):
"""Reimplement Qt method""" | Run config dialog: Change its window title | spyder-ide_spyder | train | py |
541df18243550a51a7bf126f4c8ad06abe7aaad2 | diff --git a/lib/reporting.js b/lib/reporting.js
index <HASH>..<HASH> 100644
--- a/lib/reporting.js
+++ b/lib/reporting.js
@@ -171,7 +171,7 @@ module.exports = {
await endpoint.configureReporting('hvacThermostat', p);
},
thermostatRunningMode: async (endpoint, overrides) => {
- const p = payload('runningMode', 0, repInterval.HOUR, 0, overrides);
+ const p = payload('runningMode', 10, repInterval.HOUR, null, overrides);
await endpoint.configureReporting('hvacThermostat', p);
},
thermostatOcupancy: async (endpoint, overrides) => { | Fix thermostatRunningMode default reporting (#<I>)
Made a mistake when moving things from my external converter to lib/reporting.
runningMode is very much like systemMode, it just reflects the 'current' state e.g. heat/cool/off depending on if the system is operating or not, so we should use the same defaults. | Koenkk_zigbee-shepherd-converters | train | js |
4623e6b38f5027789564ee5624b3dceb042d0fe5 | diff --git a/upload/admin/controller/catalog/information.php b/upload/admin/controller/catalog/information.php
index <HASH>..<HASH> 100644
--- a/upload/admin/controller/catalog/information.php
+++ b/upload/admin/controller/catalog/information.php
@@ -125,7 +125,7 @@ class Information extends \Opencart\System\Engine\Controller {
}
if (isset($this->request->get['page'])) {
- $page = $this->request->get['page'];
+ $page = (int)$this->request->get['page'];
} else {
$page = 1;
} | Added integer on $page get request. | opencart_opencart | train | php |
3b74950f6d07a16423bf71bf53b65aeb5db8b5f2 | diff --git a/test/fatalerrors.js b/test/fatalerrors.js
index <HASH>..<HASH> 100644
--- a/test/fatalerrors.js
+++ b/test/fatalerrors.js
@@ -251,7 +251,10 @@ function restoreHttpError(opts, errorName, errorCode, done) {
const n = nock(url).head('/fakenockdb').reply(200);
// Simulate a 400 trying to write docs, 5 times because of default parallelism
// Provide a body function to handle the stream, but allow any body
- n.post('/fakenockdb/_bulk_docs', function(body) { return true; }).times(5).reply(400, { error: 'bad_request', reason: 'testing bad response' });
+ // Four of the mocks are optional because of parallelism 5 we can't guarantee that the exit will happen
+ // after all 5 requests, but we must get at least one of them
+ n.post('/fakenockdb/_bulk_docs', function(body) { return true; }).reply(400, { error: 'bad_request', reason: 'testing bad response' });
+ n.post('/fakenockdb/_bulk_docs', function(body) { return true; }).times(4).optionally().reply(400, { error: 'bad_request', reason: 'testing bad response' });
const q = u.p(params, { opts: { bufferSize: 1 }, expectedRestoreError: { name: 'HTTPFatalError', code: 40 } });
restoreHttpError(q, 'HTTPFatalError', 40, done);
}); | Correct multiple _bulk_docs error test
4 of the mock responses in the test must be optional because we
can't guarantee the timing of the exit compared to the 5 parallel
requests. | cloudant_couchbackup | train | js |
4b20498a87dc06455f7d1e9ddc24bbb62ff2d79b | diff --git a/src/views/index.blade.php b/src/views/index.blade.php
index <HASH>..<HASH> 100644
--- a/src/views/index.blade.php
+++ b/src/views/index.blade.php
@@ -274,14 +274,14 @@
});
$("#delete-folder").click(function(){
- if ($(".fa-folder-open").length > 0) {
+ if ($(".fa-folder-open").not("#folder_top > i").length > 0) {
bootbox.confirm("Are you sure you want to delete the folder "
- + $(".fa-folder-open").data('id')
+ + $(".fa-folder-open").not("#folder_top > i").data('id')
+ " and all of its contents?", function (result) {
if (result == true) {
window.location.href = '/laravel-filemanager/deletefolder?'
+ 'name='
- + $(".fa-folder-open").data('id');
+ + $(".fa-folder-open").not("#folder_top > i").data('id');
}
});
} | Correct (egregious) delete folder/contents typo | UniSharp_laravel-filemanager | train | php |
14d3ac3aeeca797ae2b399423b507531d38e601e | diff --git a/Resources/Private/JavaScript/Host/Containers/RightSideBar/Inspector/SecondaryInspector/index.js b/Resources/Private/JavaScript/Host/Containers/RightSideBar/Inspector/SecondaryInspector/index.js
index <HASH>..<HASH> 100644
--- a/Resources/Private/JavaScript/Host/Containers/RightSideBar/Inspector/SecondaryInspector/index.js
+++ b/Resources/Private/JavaScript/Host/Containers/RightSideBar/Inspector/SecondaryInspector/index.js
@@ -44,7 +44,7 @@ export default class SecondaryInspector extends Component {
<Portal isOpened={true}>
<div className={finalClassName}>
<Button
- style="cleanWithBorder"
+ style="clean"
className={style.close}
onClick={onClose}
> | CLEANUP: Remove button style reference which is not yet implemented | neos_neos-ui | train | js |
95b320e59f48129c4f5a20982a6157edb18ab906 | diff --git a/mod/forum/view.php b/mod/forum/view.php
index <HASH>..<HASH> 100644
--- a/mod/forum/view.php
+++ b/mod/forum/view.php
@@ -72,6 +72,12 @@
/// Print header.
+ /// Add ajax-related libs for ratings if required MDL-20119
+ $PAGE->requires->yui_lib('event');
+ $PAGE->requires->yui_lib('connection');
+ $PAGE->requires->yui_lib('json');
+ $PAGE->requires->js('mod/forum/rate_ajax.js');
+
$PAGE->set_title(format_string($forum->name));
$PAGE->set_heading(format_string($course->fullname));
echo $OUTPUT->header(); | forum rating ajax MDL-<I> Enable ajax to work on single-discussion forum (and blog forum) | moodle_moodle | train | php |
54f938e1145e69441f691659d7a5519ce462cf98 | diff --git a/ember-cli-build.js b/ember-cli-build.js
index <HASH>..<HASH> 100644
--- a/ember-cli-build.js
+++ b/ember-cli-build.js
@@ -32,8 +32,8 @@ module.exports = function(defaults) {
app.import('vendor/octicons/octicons/octicons.css');
app.import('bower_components/pouchdb-load/dist/pouchdb.load.js');
- if (EmberApp.env() === 'test') {
- app.import('bower_components/timekeeper/lib/timekeeper.js', { test: true });
+ if (EmberApp.env() !== 'production') {
+ app.import('bower_components/timekeeper/lib/timekeeper.js', { type: 'test' });
}
return app.toTree(); | Fix to run tests in development (e.g. from http://localhost:<I>/tests) | HospitalRun_hospitalrun-frontend | train | js |
418db328a00bd37ea71fbde73f7afe19dbadc95c | diff --git a/mod/assignment/type/online/assignment.class.php b/mod/assignment/type/online/assignment.class.php
index <HASH>..<HASH> 100644
--- a/mod/assignment/type/online/assignment.class.php
+++ b/mod/assignment/type/online/assignment.class.php
@@ -15,6 +15,7 @@ class assignment_online extends assignment_base {
global $USER;
$submission = $this->get_submission();
+
//Guest can not submit nor edit an assignment (bug: 4604)
if (isguest($USER->id)) {
$editable = null;
@@ -41,6 +42,7 @@ class assignment_online extends assignment_base {
if ($data = data_submitted()) { // No incoming data?
if ($editable && $this->update_submission($data)) {
//TODO fix log actions - needs db upgrade
+ $submission = $this->get_submission();
add_to_log($this->course->id, 'assignment', 'upload',
'view.php?a='.$this->assignment->id, $this->assignment->id, $this->cm->id);
$this->email_teachers($submission);
@@ -55,7 +57,6 @@ class assignment_online extends assignment_base {
}
print_simple_box_start('center', '70%', '', '', 'generalbox', 'online');
- $submission = $this->get_submission();
if ($editmode) {
$this->view_edit_form($submission);
} else { | Fixed: Bug #<I> - Assignment email lacks student name | moodle_moodle | train | php |
b453e83ef71bca6ef9571cfaae0f540ef97cc635 | diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,7 +1,7 @@
require 'pathname'
require 'rubygems'
-gem 'rspec', '~>1.1.12'
+gem 'rspec', '>=1.1.12'
require 'spec'
require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-validations' | Let dm-validations be tested with RSpec <I>.x as well as <I>.x | emmanuel_aequitas | train | rb |
82141366ce3e74ff2d035dd972e550c6357fbef4 | diff --git a/openquake/calculators/getters.py b/openquake/calculators/getters.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/getters.py
+++ b/openquake/calculators/getters.py
@@ -480,7 +480,7 @@ class RuptureGetter(object):
array = self.rup_array
for i, ridx in enumerate(array['id']):
rg = object.__new__(self.__class__)
- rg.rup_array = [array[i]]
+ rg.rup_array = array[i: i+1]
rg.grp_id = self.grp_id
rg.trt = self.trt
rg.samples = self.samples | Small cleanup [skip CI] | gem_oq-engine | train | py |
8bd7bacd1479eb68009e38ea816b1b30bd7b748a | diff --git a/mod/lesson/action/updatepage.php b/mod/lesson/action/updatepage.php
index <HASH>..<HASH> 100644
--- a/mod/lesson/action/updatepage.php
+++ b/mod/lesson/action/updatepage.php
@@ -103,7 +103,7 @@
$oldanswer->response = '';
}
$oldanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
- if ($lesson->custom) {
+ if (isset($form->score[$i])) {
$oldanswer->score = clean_param($form->score[$i], PARAM_INT);
}
if (!update_record("lesson_answers", $oldanswer)) {
@@ -128,7 +128,9 @@
$newanswer->response = trim($form->response[$i]);
}
$newanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
- $newanswer->score = clean_param($form->score[$i], PARAM_INT);
+ if (isset($form->score[$i])) {
+ $newanswer->score = clean_param($form->score[$i], PARAM_INT);
+ }
$newanswerid = insert_record("lesson_answers", $newanswer);
if (!$newanswerid) {
error("Update page: answer record not inserted"); | [Fixed] this page was shooting of warnings for unset variable score. Now checks to make sure score is set before using it. | moodle_moodle | train | php |
b5809fbb213505a148153d7eaf77046f7466bb6c | diff --git a/contrib/externs/api/gadgets/iframes.js b/contrib/externs/api/gadgets/iframes.js
index <HASH>..<HASH> 100644
--- a/contrib/externs/api/gadgets/iframes.js
+++ b/contrib/externs/api/gadgets/iframes.js
@@ -17,6 +17,7 @@
/**
* @fileoverview Externs file for the Iframes library.
* @externs
+ * @suppress {strictMissingProperties}
*/
diff --git a/contrib/externs/api/gadgets/plusone.js b/contrib/externs/api/gadgets/plusone.js
index <HASH>..<HASH> 100644
--- a/contrib/externs/api/gadgets/plusone.js
+++ b/contrib/externs/api/gadgets/plusone.js
@@ -22,6 +22,7 @@
*
* @see https://code.google.com/apis/+1button/#jsapi
* @externs
+ * @suppress {strictMissingProperties}
*/
/** | Add suppressions to externs files that are not compatible
with the new strict missing properites check.
-------------
Created by MOE: <URL> | google_closure-compiler | train | js,js |
8f87dda214847debbca7838e612710421e4da78e | diff --git a/src/Keboola/StorageApi/TableExporter.php b/src/Keboola/StorageApi/TableExporter.php
index <HASH>..<HASH> 100644
--- a/src/Keboola/StorageApi/TableExporter.php
+++ b/src/Keboola/StorageApi/TableExporter.php
@@ -101,7 +101,10 @@ class TableExporter
$s3Client->getObject(array(
'Bucket' => $fileInfo["s3Path"]["bucket"],
'Key' => $fileKey,
- 'SaveAs' => $filePath
+ 'SaveAs' => $filePath,
+ 'http' => [
+ 'decode_content' => false,
+ ],
));
}
@@ -170,7 +173,11 @@ class TableExporter
$s3Client->getObject(array(
'Bucket' => $fileInfo["s3Path"]["bucket"],
'Key' => $fileInfo["s3Path"]["key"],
- 'SaveAs' => $tmpFilePath
+ 'SaveAs' => $tmpFilePath,
+ 'http' => [
+ 'decode_content' => false,
+ ],
+
));
$fs->rename($tmpFilePath, $destination);
} | fix - don't automatically decode S3 file | keboola_storage-api-php-client | train | php |
5feda5e9a6849f5b8091eeba756a18994dfcf758 | diff --git a/src/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php b/src/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php
+++ b/src/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php
@@ -32,16 +32,16 @@ class ArrayAccessibleResourceBundle implements \ArrayAccess, \IteratorAggregate,
$this->bundleImpl = $bundleImpl;
}
- public function get($offset, $fallback = null)
+ public function get($offset)
{
- $value = $this->bundleImpl->get($offset, $fallback);
+ $value = $this->bundleImpl->get($offset);
return $value instanceof \ResourceBundle ? new static($value) : $value;
}
public function offsetExists($offset)
{
- return null !== $this->bundleImpl[$offset];
+ return null !== $this->bundleImpl->get($offset);
}
public function offsetGet($offset) | [Intl] Removed non-working $fallback argument from ArrayAccessibleResourceBundle | symfony_symfony | train | php |
18a095cf8cedcd8e615a6dd6d71634b2fe35bb70 | diff --git a/tests/test_msvc9compiler.py b/tests/test_msvc9compiler.py
index <HASH>..<HASH> 100644
--- a/tests/test_msvc9compiler.py
+++ b/tests/test_msvc9compiler.py
@@ -13,6 +13,10 @@ class msvc9compilerTestCase(unittest.TestCase):
if sys.platform != 'win32':
# this test is only for win32
return
+ from distutils.msvccompiler import get_build_version
+ if get_build_version() < 8.0:
+ # this test is only for MSVC8.0 or above
+ return
from distutils.msvc9compiler import query_vcvarsall
def _find_vcvarsall(version):
return None | Merged revisions <I> via svnmerge from
svn+ssh://<EMAIL>/python/trunk
........
r<I> | hirokazu.yamamoto | <I>-<I>-<I> <I>:<I>:<I> <I> | 2 lines
Issue #<I>: test_msvc9compiler failed on VC6/7.
Reviewed by Amaury Forgeot d'Arc.
........ | pypa_setuptools | train | py |
0ea8d1d479e3d7d4dfd729923766de161941363d | diff --git a/cmd/config-host-add.go b/cmd/config-host-add.go
index <HASH>..<HASH> 100644
--- a/cmd/config-host-add.go
+++ b/cmd/config-host-add.go
@@ -201,9 +201,9 @@ func probeS3Signature(accessKey, secretKey, url string) (string, *probe.Error) {
return s3Config.Signature, nil
}
-// buildS3Config constructs an S3 Config and does
+// BuildS3Config constructs an S3 Config and does
// signature auto-probe when needed.
-func buildS3Config(url, accessKey, secretKey, api, lookup string) (*Config, *probe.Error) {
+func BuildS3Config(url, accessKey, secretKey, api, lookup string) (*Config, *probe.Error) {
s3Config := newS3Config(url, &hostConfigV9{
AccessKey: accessKey,
@@ -278,7 +278,7 @@ func mainConfigHostAdd(ctx *cli.Context) error {
accessKey, secretKey := fetchHostKeys(args)
checkConfigHostAddSyntax(ctx, accessKey, secretKey)
- s3Config, err := buildS3Config(url, accessKey, secretKey, api, lookup)
+ s3Config, err := BuildS3Config(url, accessKey, secretKey, api, lookup)
fatalIf(err.Trace(ctx.Args()...), "Unable to initialize new config from the provided credentials.")
addHost(ctx.Args().Get(0), hostConfigV9{ | Make BuildS3Config public (#<I>) | minio_mc | train | go |
367177dee6e7ab1e7c7c5a2f3ed7b637f058e86b | diff --git a/bin/diversity.py b/bin/diversity.py
index <HASH>..<HASH> 100755
--- a/bin/diversity.py
+++ b/bin/diversity.py
@@ -193,12 +193,14 @@ def main():
err_msg = "\nError while processing the mapping file: {}\n"
sys.exit(err_msg.format(ioe))
+ # parse BIOM table
try:
biom_tbl = biom.load_table(args.biom_fp)
except Exception as ioe:
err_msg = "\nError loading BIOM table file: {}\n"
sys.exit(err_msg.format(ioe))
+ # group samples by category
if args.category not in header:
sys.exit("Category '{}' not found".format(args.category))
cat_idx = header.index(args.category) | Adds some explanatory comments to separate sections of main() in diversity.py. | smdabdoub_phylotoast | train | py |
4a369bc3176c7375aed7f45ae22d41ee3c077ce4 | diff --git a/Eloquent/Relations/HasManyThrough.php b/Eloquent/Relations/HasManyThrough.php
index <HASH>..<HASH> 100644
--- a/Eloquent/Relations/HasManyThrough.php
+++ b/Eloquent/Relations/HasManyThrough.php
@@ -308,6 +308,39 @@ class HasManyThrough extends Relation
}
/**
+ * Get the first related model record matching the attributes or instantiate it.
+ *
+ * @param array $attributes
+ * @return \Illuminate\Database\Eloquent\Model
+ */
+ public function firstOrNew(array $attributes)
+ {
+ if (is_null($instance = $this->where($attributes)->first())) {
+ $instance = $this->related->newInstance($attributes);
+ }
+
+ return $instance;
+ }
+
+ /**
+ * Create or update a related record matching the attributes, and fill it with values.
+ *
+ * @param array $attributes
+ * @param array $values
+ * @param array $joining
+ * @param bool $touch
+ * @return \Illuminate\Database\Eloquent\Model
+ */
+ public function updateOrCreate(array $attributes, array $values = [])
+ {
+ $instance = $this->firstOrNew($attributes);
+
+ $instance->fill($values)->save();
+
+ return $instance;
+ }
+
+ /**
* Execute the query as a "select" statement.
*
* @param array $columns | Use the relation query instance to perform updateOrCreate (#<I>) | illuminate_database | train | php |
e18b8d0a5cc6c0f18a1081c13de1ebb4592ba6e8 | diff --git a/src/components/dropdown/Dropdown.js b/src/components/dropdown/Dropdown.js
index <HASH>..<HASH> 100644
--- a/src/components/dropdown/Dropdown.js
+++ b/src/components/dropdown/Dropdown.js
@@ -633,7 +633,6 @@ export class Dropdown extends Component {
onOverlayEnter(callback) {
ZIndexUtils.set('overlay', this.overlayRef.current);
this.alignOverlay();
- this.scrollInView();
callback && callback();
} | Fixed #<I> - Dropdown scrolls top after reopened | primefaces_primereact | train | js |
0cfe30d86efcd3712c39080751dc6cb410375f29 | diff --git a/php/commands/transient.php b/php/commands/transient.php
index <HASH>..<HASH> 100644
--- a/php/commands/transient.php
+++ b/php/commands/transient.php
@@ -30,6 +30,8 @@ class Transient_Command extends WP_CLI_Command {
/**
* Get a transient value.
*
+ * ## OPTIONS
+ *
* <key>
* : Key for the transient.
*
@@ -72,6 +74,8 @@ class Transient_Command extends WP_CLI_Command {
/**
* Set a transient value. <expiration> is the time until expiration, in seconds.
*
+ * ## OPTIONS
+ *
* <key>
* : Key for the transient.
*
@@ -105,6 +109,8 @@ class Transient_Command extends WP_CLI_Command {
/**
* Delete a transient value.
*
+ * ## OPTIONS
+ *
* <key>
* : Key for the transient.
* | Add missing ## OPTIONS heading throughout | wp-cli_cache-command | train | php |
6c6e630a73434f351cead69f9aac56dbb96ca5d3 | diff --git a/qhue.py b/qhue.py
index <HASH>..<HASH> 100755
--- a/qhue.py
+++ b/qhue.py
@@ -35,10 +35,9 @@ class Resource(object):
return resp
def __getattr__(self, name):
- return Resource(self.url + "/" + name)
+ return Resource(self.url + "/" + str(name))
- def __getitem__(self, key):
- return Resource(self.url + "/" + str(key))
+ __getitem__ = __getattr__
class Bridge(Resource): | DRY up the code a tiny bit | quentinsf_qhue | train | py |
8dc10007954d98e67f21f5e4fd998f1b76a6e2eb | diff --git a/tinymce/models.py b/tinymce/models.py
index <HASH>..<HASH> 100644
--- a/tinymce/models.py
+++ b/tinymce/models.py
@@ -1,5 +1,5 @@
# coding: utf-8
-# Copyright (c) 2008 Joost Cassee
+# Copyright (c) 2008 Joost Cassee, 2016 Roman Miroshnychenko
# Licensed under the terms of the MIT License (see LICENSE.txt)
from __future__ import absolute_import
@@ -12,9 +12,17 @@ __all__ = ['HTMLField']
class HTMLField(models.TextField):
"""
- A text area field for HTML content.
+ A text area model field for HTML content.
It uses the TinyMCE 4 widget in forms.
+
+ Example::
+
+ from django.db.models import Model
+ form tinymce.models import HTMLField
+
+ class Foo(Model):
+ html_content = HTMLField('HTML content')
"""
def __init__(self, *args, **kwargs):
self.tinymce_profile = kwargs.pop('profile', None) | Adds docstrings for models | romanvm_django-tinymce4-lite | train | py |
1bee6a7e60b4ebb54cb07ea6238e98eeae890559 | diff --git a/source/org/jivesoftware/smack/XMPPConnection.java b/source/org/jivesoftware/smack/XMPPConnection.java
index <HASH>..<HASH> 100644
--- a/source/org/jivesoftware/smack/XMPPConnection.java
+++ b/source/org/jivesoftware/smack/XMPPConnection.java
@@ -309,13 +309,14 @@ public class XMPPConnection {
}
// We're done with the collector, so explicitly cancel it.
collector.cancel();
- // Set presence to online.
- packetWriter.sendPacket(new Presence(Presence.Type.AVAILABLE));
- // Finally, create the roster.
+ // Create the roster.
this.roster = new Roster(this);
roster.reload();
+ // Set presence to online.
+ packetWriter.sendPacket(new Presence(Presence.Type.AVAILABLE));
+
// Indicate that we're now authenticated.
authenticated = true; | Fixed bug where presence packets lost due to roster being created too late.
git-svn-id: <URL> | igniterealtime_Smack | train | java |
9fd4ad0e59422524dac51e64ec52a2eed119f36a | diff --git a/lib/mail_address/address.rb b/lib/mail_address/address.rb
index <HASH>..<HASH> 100644
--- a/lib/mail_address/address.rb
+++ b/lib/mail_address/address.rb
@@ -1,5 +1,3 @@
-require 'mail_address/parser'
-
module MailAddress
class Address
@@ -62,14 +60,14 @@ module MailAddress
def host
addr = @address || '';
i = addr.rindex('@')
- i >= 0 ? addr.substr(i + 1) : nil
+ i >= 0 ? addr[i + 1 .. -1] : nil
end
def user
addr = @address || '';
i = addr.rindex('@')
- i >= 0 ? addr.substr(0, i) : addr
+ i >= 0 ? addr[0 ... i] : addr
end
private | fix substr function
String class in Ruby has no substr method | kizashi1122_mail_address | train | rb |
0a414d68759966cea0331e6b7a34c7e549d12b9d | diff --git a/streamcorpus_pipeline/tests/test_clean_html.py b/streamcorpus_pipeline/tests/test_clean_html.py
index <HASH>..<HASH> 100644
--- a/streamcorpus_pipeline/tests/test_clean_html.py
+++ b/streamcorpus_pipeline/tests/test_clean_html.py
@@ -207,6 +207,15 @@ def test_force_neither_visible_nor_html():
force_clean_html({})(si, None)
+def test_force_already_has_clean_html():
+ # If a stream item has neither body.clean_visible nor body.clean_html,
+ # then something has gone wrong.
+ si = StreamItem(body=ContentItem(raw=TEST_STAGE_RAW, encoding='utf-8',
+ media_type='text/html',
+ clean_html='foo', clean_visible='foo'))
+ assert force_clean_html({})(si, None) is not None
+
+
def test_force_clean_html_from_visible():
# This gives a stream item on body.raw and body.clean_visible.
# force_clean_html should generate clean_html and also re-generate | Regression test for @johnrfrank's fix in ce6fb5. | trec-kba_streamcorpus-pipeline | train | py |
b6764b28bfd8188d13a67680dffed15b203c116d | diff --git a/eZ/Publish/MVC/SiteAccess/Tests/RouterTest.php b/eZ/Publish/MVC/SiteAccess/Tests/RouterTest.php
index <HASH>..<HASH> 100644
--- a/eZ/Publish/MVC/SiteAccess/Tests/RouterTest.php
+++ b/eZ/Publish/MVC/SiteAccess/Tests/RouterTest.php
@@ -58,6 +58,20 @@ class RouterTest extends PHPUnit_Framework_TestCase
$this->assertSame( $siteAccess, $sa->name );
}
+ /**
+ * @depends testConstruct
+ * @covers \eZ\Publish\MVC\SiteAccess\Router::match
+ */
+ public function testMatchWithEnv( $router )
+ {
+ $_ENV['EZPUBLISH_SITEACCESS'] = 'foobar_sa';
+ $sa = $router->match( new SimplifiedRequest() );
+ $this->assertInstanceOf( 'eZ\\Publish\\MVC\\SiteAccess', $sa );
+ $this->assertSame( $_ENV['EZPUBLISH_SITEACCESS'], $sa->name );
+ $this->assertSame( 'env', $sa->matchingType );
+ unset( $_ENV['EZPUBLISH_SITEACCESS'] );
+ }
+
public function matchProvider()
{
return array( | Added test for siteaccess matching with an environment variable | ezsystems_ezpublish-kernel | train | php |
ec3097a5b6b7e4533fd28e944a6ce343c109f390 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,7 @@ setup(
author_email='[email protected]',
url='https://github.com/awslabs/aws-sam-cli',
license='Apache License 2.0',
- packages=find_packages(exclude=('tests', 'docs')),
+ packages=find_packages(exclude=['tests.*', 'tests']),
keywords="AWS SAM CLI",
# Support Python 2.7 and 3.6 or greater
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*', | fix: Remove tests from .whl file (bdist_wheel) (#<I>) | awslabs_aws-sam-cli | train | py |
27090aafd475f4167ba9fde9b3b81d962b819294 | diff --git a/examples/platformer/js/screens/play.js b/examples/platformer/js/screens/play.js
index <HASH>..<HASH> 100644
--- a/examples/platformer/js/screens/play.js
+++ b/examples/platformer/js/screens/play.js
@@ -16,7 +16,7 @@ game.PlayScreen = me.ScreenObject.extend({
me.game.world.addChild(this.HUD);
// display if debugPanel is enabled or on mobile
- if ((me.plugins.debugPanel && me.plugins.debugPanel.panel.visible) || me.device.isMobile) {
+ if ((me.plugins.debugPanel && me.plugins.debugPanel.panel.visible) || me.device.touch) {
if (typeof this.virtualJoypad === "undefined") {
this.virtualJoypad = new game.HUD.VirtualJoypad();
}
@@ -37,7 +37,7 @@ game.PlayScreen = me.ScreenObject.extend({
// remove the joypad if initially added
if (this.virtualJoypad && me.game.world.hasChild(this.virtualJoypad)) {
- me.game.world.removeChild();
+ me.game.world.removeChild(this.virtualJoypad);
}
// stop some music | enable the virtual gamepad on any device with touch capabillty
+ bug fix in the onDestroyEvent function | melonjs_melonJS | train | js |
a4b5646e35adbde705bba19a8e982ad82febfc3f | diff --git a/spec/orm/active_record.rb b/spec/orm/active_record.rb
index <HASH>..<HASH> 100644
--- a/spec/orm/active_record.rb
+++ b/spec/orm/active_record.rb
@@ -1,7 +1,7 @@
require 'rails_admin/extensions/history/history'
require 'rails_admin/adapters/active_record'
-DatabaseCleaner.strategy = :transaction
+DatabaseCleaner.strategy = :truncation
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.drop_table(table) | DatabaseCleaner transaction strategy is not compatible with Rails <I>.rc1 yet | sferik_rails_admin | train | rb |
070dab5a17c594371a4ea5bb2c316b5b01e5ed2c | diff --git a/lib/transforms/registerRequireJsConfig.js b/lib/transforms/registerRequireJsConfig.js
index <HASH>..<HASH> 100644
--- a/lib/transforms/registerRequireJsConfig.js
+++ b/lib/transforms/registerRequireJsConfig.js
@@ -139,7 +139,7 @@ module.exports = function (options) {
javaScript.parseTree.body.forEach(function (topLevelStatement) {
if (topLevelStatement instanceof uglifyJs.AST_SimpleStatement &&
topLevelStatement.body instanceof uglifyJs.AST_Call &&
- topLevelStatement.body.expression instanceof uglifyJs.AST_PropAccess &&
+ topLevelStatement.body.expression instanceof uglifyJs.AST_Dot &&
topLevelStatement.body.expression.property === 'config' &&
topLevelStatement.body.expression.expression instanceof uglifyJs.AST_SymbolRef &&
topLevelStatement.body.expression.expression.name === 'require') { | registerRequireJs config: Don't attempt to support require['config'](...). | assetgraph_assetgraph | train | js |
bd43f830e6d7cd64689cbf44c7213f81687270ec | diff --git a/db/migrate/20130318171849_migrate_environment_default_content_view_to_version.rb b/db/migrate/20130318171849_migrate_environment_default_content_view_to_version.rb
index <HASH>..<HASH> 100644
--- a/db/migrate/20130318171849_migrate_environment_default_content_view_to_version.rb
+++ b/db/migrate/20130318171849_migrate_environment_default_content_view_to_version.rb
@@ -8,7 +8,7 @@ class MigrateEnvironmentDefaultContentViewToVersion < ActiveRecord::Migration
(org.environments + [org.library]).each do |env|
old_view = ContentView.where(:environment_default_id=>env.id).first
cve = old_view.content_view_environments.first
- version = old_view.version(env)
+ version = ContentViewVersion.find(old_view.version(env))
version.content_view = default_view
version.save! | fixed a ActiveRecord::ReadOnlyRecord error occuring during the migration when rails <I> is used and there's existing data in the db. | Katello_katello | train | rb |
45a6777094e1b2a5fabe348ab4bd16fe636ff8ba | diff --git a/runtime.go b/runtime.go
index <HASH>..<HASH> 100644
--- a/runtime.go
+++ b/runtime.go
@@ -1936,19 +1936,10 @@ func (r *Runtime) SetTimeSource(now Now) {
// New is an equivalent of the 'new' operator allowing to call it directly from Go.
func (r *Runtime) New(construct Value, args ...Value) (o *Object, err error) {
- defer func() {
- if x := recover(); x != nil {
- switch x := x.(type) {
- case *Exception:
- err = x
- case *InterruptedError:
- err = x
- default:
- panic(x)
- }
- }
- }()
- return r.builtin_new(r.toObject(construct), args), nil
+ err = tryFunc(func() {
+ o = r.builtin_new(r.toObject(construct), args)
+ })
+ return
}
// Callable represents a JavaScript function that can be called from Go. | Make sure (*Runtime).New() catches SyntaxError and other Values thrown | dop251_goja | train | go |
209265f47052443a90c9c9063d448c6b37370074 | diff --git a/src/com/lukehutch/fastclasspathscanner/FastClasspathScanner.java b/src/com/lukehutch/fastclasspathscanner/FastClasspathScanner.java
index <HASH>..<HASH> 100644
--- a/src/com/lukehutch/fastclasspathscanner/FastClasspathScanner.java
+++ b/src/com/lukehutch/fastclasspathscanner/FastClasspathScanner.java
@@ -970,6 +970,14 @@ public class FastClasspathScanner {
} else {
// Log.info("Skipping non-file/non-dir on classpath: " + file.getCanonicalPath());
}
+ for (FilePathMatcher fileMatcher : filePathMatchers) {
+ if (fileMatcher.pattern.matcher(pathElement).matches()) {
+ // If there's a match, open the file as a stream and call the match processor
+ try (InputStream inputStream = new FileInputStream(file)) {
+ fileMatcher.fileMatchProcessor.processMatch(pathElement, inputStream);
+ }
+ }
+ }
}
} catch (IOException e) {
throw new RuntimeException(e); | Scan toplevel path entries with FilePathMatchers too | classgraph_classgraph | train | java |
15d22f59114efc98afcceb539094f46d158b611e | diff --git a/lib/all-off.js b/lib/all-off.js
index <HASH>..<HASH> 100644
--- a/lib/all-off.js
+++ b/lib/all-off.js
@@ -1,7 +1,7 @@
'use strict';
var value = require('es5-ext/lib/Object/valid-value')
- , id = '- ee -';
+ , id = '- ee v0.2 -';
module.exports = function (emitter) {
var type, data;
diff --git a/lib/core.js b/lib/core.js
index <HASH>..<HASH> 100644
--- a/lib/core.js
+++ b/lib/core.js
@@ -13,7 +13,7 @@ var isArray = Array.isArray
, id, onceTag, pipeTag
, methods, descriptors, base;
-id = '- ee -';
+id = '- ee v0.2 -';
onceTag = '\u0001once';
on = function (type, listener) { | Change property id to reflect new version | medikoo_event-emitter | train | js,js |
449a34532d8d3fa03fdd21d7061bea71f9c198a8 | diff --git a/pykechain/models/scope2.py b/pykechain/models/scope2.py
index <HASH>..<HASH> 100644
--- a/pykechain/models/scope2.py
+++ b/pykechain/models/scope2.py
@@ -38,6 +38,19 @@ class Scope2(Scope):
else:
return None
+ @property
+ def options(self):
+ """Options of the Scope.
+
+ .. versionadded: 3.0
+ """
+ return self._json_data.get('scope_options')
+
+ @options.setter
+ def options(self, option_value):
+ self.edit(options=option_value)
+
+
def refresh(self, json=None, url=None, extra_params=None):
"""Refresh the object in place."""
from pykechain.client import API_EXTRA_PARAMS | added scope.options property on the scope object | KE-works_pykechain | train | py |
8544793c1cf82c77b1dbb1f1cce367994f6c6342 | diff --git a/lib/zss/socket.rb b/lib/zss/socket.rb
index <HASH>..<HASH> 100644
--- a/lib/zss/socket.rb
+++ b/lib/zss/socket.rb
@@ -36,7 +36,7 @@ module ZSS
end
rescue ::Timeout::Error
- log.debug("Request #{request.rid} exit with timeout after #{t}s")
+ log.info("Request #{request.rid} exit with timeout after #{t}s")
raise ZSS::Socket::TimeoutError, "call timeout after #{t}s"
end
end | changed socket timeout log message to info | micro-toolkit_zmq-service-suite-ruby | train | rb |
eb12108fb9156d9b5fdc653b394a6b3247fa1fc3 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,8 @@ install_requires = [
'zope.interface',
'repoze.who',
'pycrypto', # 'Crypto'
- 'pytz'
+ 'pytz',
+ 'pyOpenSSL'
]
tests_require = [ | Added requirement on pyOpenSSL | IdentityPython_pysaml2 | train | py |
d137e82ad1bc55c283a33ffaccd93e51bcb4c0f1 | diff --git a/examples/yaml-highlight/yaml_hl.py b/examples/yaml-highlight/yaml_hl.py
index <HASH>..<HASH> 100755
--- a/examples/yaml-highlight/yaml_hl.py
+++ b/examples/yaml-highlight/yaml_hl.py
@@ -37,7 +37,7 @@ yaml.add_path_resolver(u'tag:yaml.org,2002:pairs',
class YAMLHighlight:
def __init__(self, options):
- config = yaml.load(file(options.config, 'rb').read())
+ config = yaml.full_load(file(options.config, 'rb').read())
self.style = config[options.style]
if options.input:
self.input = file(options.input, 'rb') | Use full_load in yaml-highlight example (#<I>) | yaml_pyyaml | train | py |
65b5edebb9c5fa6122d57aad8204cee80b6f57bd | diff --git a/store/sub/git.go b/store/sub/git.go
index <HASH>..<HASH> 100644
--- a/store/sub/git.go
+++ b/store/sub/git.go
@@ -134,6 +134,9 @@ func (s *Store) GitVersion() semver.Version {
return v
}
svStr := strings.TrimPrefix(string(out), "git version ")
+ if p := strings.Fields(svStr); len(p) > 0 {
+ svStr = p[0]
+ }
sv, err := semver.ParseTolerant(svStr)
if err != nil {
if gd := os.Getenv("GOPASS_DEBUG"); gd != "" { | Trim any additional fields from git version (#<I>)
Fixes #<I> | gopasspw_gopass | train | go |
7d1ad29a1cb6849bc86a4831aff931f676953974 | diff --git a/_grunt-configs/watch.js b/_grunt-configs/watch.js
index <HASH>..<HASH> 100644
--- a/_grunt-configs/watch.js
+++ b/_grunt-configs/watch.js
@@ -28,18 +28,25 @@ module.exports.tasks = {
],
tasks: [
// 'jshint:project', // uncomment this line if you want to run linting checks on your JS as part of your watch build
+ 'bsReload:all',
'filesizegzip:js'
]
},
images : {
files: ['<%=config.img.srcDir%>/**/*.{svg,png,jpg,gif}'],
- tasks: ['newer:imagemin:images']
+ tasks: [
+ 'newer:imagemin:images',
+ 'bsReload:all'
+ ]
},
grunticon : {
files: ['<%=config.img.grunticonDir%>/**/*.{svg,png,jpg,gif}'],
- tasks: ['icons']
+ tasks: [
+ 'icons'
+ 'bsReload:all'
+ ]
},
grunt: { | Add `'bsReload:all'` to js, image & icon0based watch tasks
This fixes a bug with BrowserSync not reloading properly when these watch tasks are run | TryKickoff_kickoff | train | js |
cea4e63e2a11a644b881a26c6785e8e009b60151 | diff --git a/rapidoid-commons/src/main/java/org/rapidoid/datamodel/Results.java b/rapidoid-commons/src/main/java/org/rapidoid/datamodel/Results.java
index <HASH>..<HASH> 100644
--- a/rapidoid-commons/src/main/java/org/rapidoid/datamodel/Results.java
+++ b/rapidoid-commons/src/main/java/org/rapidoid/datamodel/Results.java
@@ -41,4 +41,6 @@ public interface Results<T> extends Iterable<T> {
long count();
+ boolean isSingle();
+
}
diff --git a/rapidoid-commons/src/main/java/org/rapidoid/datamodel/impl/ResultsImpl.java b/rapidoid-commons/src/main/java/org/rapidoid/datamodel/impl/ResultsImpl.java
index <HASH>..<HASH> 100644
--- a/rapidoid-commons/src/main/java/org/rapidoid/datamodel/impl/ResultsImpl.java
+++ b/rapidoid-commons/src/main/java/org/rapidoid/datamodel/impl/ResultsImpl.java
@@ -95,4 +95,16 @@ public class ResultsImpl<T> extends RapidoidThing implements Results<T> {
return count;
}
+
+ @Override
+ public boolean isSingle() {
+ long count = data().getCount();
+
+ if (count >= 0) {
+ return count == 1;
+
+ } else {
+ return retrievePage(0, 2).size() == 1;
+ }
+ }
} | Enriched the Results API. | rapidoid_rapidoid | train | java,java |
d42d19755c10d364a3be0be156b7fb602ffe02fd | diff --git a/js/cex.js b/js/cex.js
index <HASH>..<HASH> 100644
--- a/js/cex.js
+++ b/js/cex.js
@@ -816,7 +816,7 @@ module.exports = class cex extends Exchange {
'lastTradeTimestamp': undefined,
'status': status,
'symbol': symbol,
- 'type': undefined,
+ 'type': price === undefined ? 'market' : 'limit',
'side': side,
'price': price,
'cost': cost, | [cex] infer order type using price field | ccxt_ccxt | train | js |
d3304268d3046116d39ec3d54a8e319dce188f36 | diff --git a/python/pyspark/sql/session.py b/python/pyspark/sql/session.py
index <HASH>..<HASH> 100644
--- a/python/pyspark/sql/session.py
+++ b/python/pyspark/sql/session.py
@@ -43,7 +43,7 @@ def _monkey_patch_RDD(sparkSession):
This is a shorthand for ``spark.createDataFrame(rdd, schema, sampleRatio)``
:param schema: a :class:`pyspark.sql.types.StructType` or list of names of columns
- :param samplingRatio: the sample ratio of rows used for inferring
+ :param sampleRatio: the sample ratio of rows used for inferring
:return: a DataFrame
>>> rdd.toDF().collect() | [MINOR][PYTHON] Fix typo in a docsting of RDD.toDF
### What changes were proposed in this pull request?
Fixes typo in docsting of `toDF`
### Why are the changes needed?
The third argument of `toDF` is actually `sampleRatio`.
related discussion: <URL> | apache_spark | train | py |
13c984fded95f5cc970e2b028149006ffa8f3d5e | diff --git a/dftimewolf/lib/preflights/cloud_token.py b/dftimewolf/lib/preflights/cloud_token.py
index <HASH>..<HASH> 100644
--- a/dftimewolf/lib/preflights/cloud_token.py
+++ b/dftimewolf/lib/preflights/cloud_token.py
@@ -21,6 +21,9 @@ class GCPTokenCheck(module.PreflightModule):
project_name (str): the project we want to connect to.
"""
+ if not project_name:
+ return
+
gcloud_path = shutil.which('gcloud')
if gcloud_path is None:
self.ModuleError( | Skip checks if no project name specified. (#<I>) | log2timeline_dftimewolf | train | py |
402e6b0fbff7f62b0974e3e77a2ef9b2fb8e5d61 | diff --git a/interact.js b/interact.js
index <HASH>..<HASH> 100644
--- a/interact.js
+++ b/interact.js
@@ -5572,7 +5572,7 @@
= (object) interact
\*/
interact.stop = function (event) {
- for (var i = interactions.length - 1; i > 0; i--) {
+ for (var i = interactions.length - 1; i >= 0; i--) {
interactions[i].stop(event);
} | Fix one missed interaction element on stop triggered | taye_interact.js | train | js |
3fdd058a09b2637aeac12c3c9ebba7308c34d736 | diff --git a/.travis/complementary/reputation.py b/.travis/complementary/reputation.py
index <HASH>..<HASH> 100644
--- a/.travis/complementary/reputation.py
+++ b/.travis/complementary/reputation.py
@@ -6,7 +6,9 @@ import PyFunceble
import PyFunceble.cli
PyFunceble.cli.initiate_colorama(True)
-PyFunceble.load_config(generate_directory_structure=False,)
+PyFunceble.load_config(
+ generate_directory_structure=False, custom={"use_reputation_data": True}
+)
PyFunceble.output.Clean()
LIMIT = 10 | Fix issue with the download of the upstream data. | funilrys_PyFunceble | train | py |
99fa5da12a5a4d9a36a9acdad8566372381f5df5 | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -221,7 +221,7 @@ describe("Paths", function() {
it("should handle backslash-separated paths", function() {
return resolve(rollup.rollup({
entry: 'dir\\x.js',
- plugins: [hypothetical({ files: { './dir\\x.js': 'object.key = false;' } })]
+ plugins: [hypothetical({ files: { '.\\dir\\x.js': 'object.key = false;' } })]
}), { key: false });
}); | Don't mix slash styles outside of the mixed slash style test | Permutatrix_rollup-plugin-hypothetical | train | js |
fcc40bf4fbec515959ee5527941c669d17e43918 | diff --git a/intervals/interval.py b/intervals/interval.py
index <HASH>..<HASH> 100644
--- a/intervals/interval.py
+++ b/intervals/interval.py
@@ -85,10 +85,7 @@ class AbstractInterval(object):
Parse given args and assign lower and upper bound for this number
range.
- 1. Comma separated string argument
-
- ::
-
+ 1. Comma separated string argument::
>>> range = IntInterval('[23, 45]')
>>> range.lower
@@ -107,10 +104,7 @@ class AbstractInterval(object):
>>> range.upper_inc
False
- 2. Lists and tuples as an argument
-
- ::
-
+ 2. Lists and tuples as an argument::
>>> range = IntInterval([23, 45])
>>> range.lower
@@ -127,19 +121,13 @@ class AbstractInterval(object):
>>> range.closed
False
- 3. Integer argument
-
- ::
-
+ 3. Integer argument::
>>> range = IntInterval(34)
>>> range.lower == range.upper == 34
True
-
- 4. Object argument
-
- ::
+ 4. Object argument::
>>> range = IntInterval(IntInterval(20, 30))
>>> range.lower
@@ -215,7 +203,7 @@ class AbstractInterval(object):
"""
Return whether or not this object is an open interval.
- ::
+ Examples::
range = Interval('(23, 45)')
range.open # True
@@ -230,7 +218,7 @@ class AbstractInterval(object):
"""
Return whether or not this object is a closed interval.
- ::
+ Examples::
range = Interval('(23, 45)')
range.closed # False | Fix doublecolon usage in docstrings | kvesteri_intervals | train | py |
9643af776765ce8d802d101fedceb70444584381 | diff --git a/zappa/handler.py b/zappa/handler.py
index <HASH>..<HASH> 100644
--- a/zappa/handler.py
+++ b/zappa/handler.py
@@ -284,7 +284,8 @@ class LambdaHandler(object):
Support S3, SNS, DynamoDB and kinesis events
"""
if 's3' in record:
- return record['s3']['configurationId'].split(':')[-1]
+ if ':' in record['s3']['configurationId']:
+ return record['s3']['configurationId'].split(':')[-1]
arn = None
if 'Sns' in record:
@@ -297,6 +298,8 @@ class LambdaHandler(object):
arn = record['Sns'].get('TopicArn')
elif 'dynamodb' in record or 'kinesis' in record:
arn = record.get('eventSourceARN')
+ elif 's3' in record:
+ arn = record['s3']['bucket']['arn']
if arn:
return self.settings.AWS_EVENT_MAPPING.get(arn) | Add event mapping fall through for when the config id of s3 isn't the function name | Miserlou_Zappa | train | py |
1d522426801cc72913b95daecfe674a092fef88f | diff --git a/library/Rediska/Autoloader.php b/library/Rediska/Autoloader.php
index <HASH>..<HASH> 100644
--- a/library/Rediska/Autoloader.php
+++ b/library/Rediska/Autoloader.php
@@ -86,12 +86,7 @@ class Rediska_Autoloader
}
$path = self::getRediskaPath() . '/' . str_replace('_', '/', $className) . '.php';
-
- if (!file_exists($path)) {
- return false;
- }
-
- require_once $path;
+ return include $path;
}
/**
@@ -107,4 +102,4 @@ class Rediska_Autoloader
return self::$_rediskaPath;
}
-}
\ No newline at end of file
+} | * performance fix:
* avoid file_exists() for each request
* don't use require_once because:
* require parses each file
* if it fails, it fails hard
* no need for *_once, autoload takes care of that
* a soft 'include' keeps this autoloader chainable | shumkov_rediska | train | php |
15fa0379cfdf25e36d7fbe24e3ab9b8de5e97a09 | diff --git a/config.py b/config.py
index <HASH>..<HASH> 100644
--- a/config.py
+++ b/config.py
@@ -63,6 +63,7 @@ PACKAGES = [
]
PACKAGES_EXCLUDE = [
+ 'invenio.modules.archiver',
'invenio.modules.annotations',
'invenio.modules.communities',
'invenio.modules.pages', | archiver: initial port to new code structure
* Implements OIS archiver module using bagit. (addresses #<I>)
(addresses #<I>) | inveniosoftware_invenio-base | train | py |
c973038fa64108bb223ac6e5729ee7278759a11a | diff --git a/jquery.peity.js b/jquery.peity.js
index <HASH>..<HASH> 100644
--- a/jquery.peity.js
+++ b/jquery.peity.js
@@ -222,7 +222,7 @@
peity.register(
'donut',
- peity.defaults.pie,
+ $.extend(true, {}, peity.defaults.pie),
function(opts) {
if (!opts.innerRadius) opts.innerRadius = opts.radius * 0.5
peity.graphers.pie.call(this, opts) | Ensure donut defaults can be changed independently to pie defaults. | benpickles_peity | train | js |
24d81aa62436eec1f257d2adb4a56825eab1f3e6 | diff --git a/Di/Container.php b/Di/Container.php
index <HASH>..<HASH> 100644
--- a/Di/Container.php
+++ b/Di/Container.php
@@ -76,6 +76,11 @@ class Container implements ContainerInterface, \Psr\Container\ContainerInterface
$dependencies = [];
foreach ($parameters as $key => $value) {
if (is_string($key) && str_contains($key, '\\')) {
+ if (!is_string($value)) {
+ $dependencyId = "$class.dependencies.$key" . ($id === null || $id === $class ? '' : ".$id");
+ $this->set($dependencyId, $value);
+ $value = "@$dependencyId";
+ }
$dependencies[$key] = $value;
}
} | refactor ManaPHP\Di\Container | manaphp_framework | train | php |
6dbe6875355b7de5069de5aaaa2384d14d11c3be | diff --git a/deploy_stack.py b/deploy_stack.py
index <HASH>..<HASH> 100755
--- a/deploy_stack.py
+++ b/deploy_stack.py
@@ -130,7 +130,14 @@ def deploy_dummy_stack(env, charm_prefix):
done
cat /var/run/dummy-sink/token
""".format(timeout)
- result = env.client.get_juju_output(env, 'ssh', 'dummy-sink/0', get_token)
+ if 'manual-deploy-trusty-ppc64' in env.name:
+ result = subprocess.check_output(
+ ['ssh', '[email protected]',
+ '-o', 'UserKnownHostsFile /dev/null',
+ '-o', 'StrictHostKeyChecking no',
+ 'cat /var/run/dummy-sink/token'])
+ else:
+ result = env.client.get_juju_output(env, 'ssh', 'dummy-sink/0', get_token)
result = re.match(r'([^\n\r]*)\r?\n?', result).group(1)
if result != token:
raise ValueError('Token is %r' % result) | Added ssh hack to get token in manual ppc test. | juju_juju | train | py |
8d55d667d0251d0399a11dde56ebc7985f2f1ca8 | diff --git a/src/falcon_oas/oas/spec.py b/src/falcon_oas/oas/spec.py
index <HASH>..<HASH> 100644
--- a/src/falcon_oas/oas/spec.py
+++ b/src/falcon_oas/oas/spec.py
@@ -20,7 +20,7 @@ DEFAULT_SERVER = {'url': '/'}
def create_spec_from_dict(spec_dict, base_path=None):
deref_spec_dict = jsonref.JsonRef.replace_refs(spec_dict)
- return Spec(deref_spec_dict, base_path=base_path)
+ return Spec(copy.deepcopy(deref_spec_dict), base_path=base_path)
class Spec(object):
@@ -48,11 +48,8 @@ class Spec(object):
if media_type not in operation['requestBody']['content']:
raise UndocumentedMediaType()
- # Deepcopy operation to avoid JsonRef proxy access for performance
- result = copy.deepcopy(operation)
- result['parameters'] = list(
- self._iter_parameters(path_item.copy(), result)
- )
+ result = operation.copy()
+ result['parameters'] = list(self._iter_parameters(path_item, result))
result['security'] = get_security(
result, base_security=self._base_security
) | Fix thread unsafe errors for jsonref | grktsh_falcon-oas | train | py |
f94ad6d1a53b2bf1e07c9eea958a6bbe4c0218c1 | diff --git a/packages/insomnia-httpsnippet/src/targets/shell/curl.js b/packages/insomnia-httpsnippet/src/targets/shell/curl.js
index <HASH>..<HASH> 100755
--- a/packages/insomnia-httpsnippet/src/targets/shell/curl.js
+++ b/packages/insomnia-httpsnippet/src/targets/shell/curl.js
@@ -32,6 +32,13 @@ module.exports = function (source, options) {
// construct headers
Object.keys(source.headersObj).sort().forEach(function (key) {
+ var value = source.headersObj[key];
+
+ // Remove content-type header if it's multipart because curl will add it's own (with boundary)
+ if (key.toLowerCase() === 'content-type' && value.indexOf('multipart/') === 0) {
+ return;
+ }
+
var header = util.format('%s: %s', key, source.headersObj[key])
code.push('%s %s', opts.short ? '-H' : '--header', helpers.quote(header))
}) | Fix multipart boundary curl generation (Closes #<I>) | getinsomnia_insomnia | train | js |
6bbd0546f88e7d27c38805fb36bdd07453a870f7 | diff --git a/sdk/core/azure-core/samples/test_example_sansio.py b/sdk/core/azure-core/samples/test_example_sansio.py
index <HASH>..<HASH> 100644
--- a/sdk/core/azure-core/samples/test_example_sansio.py
+++ b/sdk/core/azure-core/samples/test_example_sansio.py
@@ -173,7 +173,7 @@ def example_on_exception():
request = HttpRequest("GET", "https://bing.com")
# [START on_exception]
try:
- response = policy.next.send(request)
+ response = policy.on_request(request)
except Exception:
if not policy.on_exception(request):
raise | fix example (#<I>) | Azure_azure-sdk-for-python | train | py |
9f9dff3e2111c50429312559b89512b6c7bd7dcd | diff --git a/src/main/java/org/minimalj/repository/sql/SqlRepository.java b/src/main/java/org/minimalj/repository/sql/SqlRepository.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/minimalj/repository/sql/SqlRepository.java
+++ b/src/main/java/org/minimalj/repository/sql/SqlRepository.java
@@ -457,7 +457,7 @@ public class SqlRepository implements TransactionalRepository {
public void execute(String query, Serializable... parameters) {
try (PreparedStatement preparedStatement = createStatement(getConnection(), query, parameters)) {
- preparedStatement.executeQuery();
+ preparedStatement.execute();
} catch (SQLException x) {
throw new LoggingRuntimeException(x, logger, "Couldn't execute query");
} | executeQuery for queries without result does not work for MS SQL | BrunoEberhard_minimal-j | train | java |
0f51218146af97d1b43f0d3e6f686f2eefcdb393 | diff --git a/src/rules.js b/src/rules.js
index <HASH>..<HASH> 100644
--- a/src/rules.js
+++ b/src/rules.js
@@ -1,7 +1,5 @@
-import os from 'os';
-
export default {
indent: 2,
eof: '\n',
- eol: os.EOL
+ eol: '\n'
}; | fix(rules): return to unix notation, close #<I> | Scrum_posthtml-beautify | train | js |
04862e8315bce7795952d10ff8700ae40143755a | diff --git a/lib/async.js b/lib/async.js
index <HASH>..<HASH> 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -1,5 +1,4 @@
var CallbackManager = require( './callbackmanager.js' );
-var forEach = require( './foreach.js' );
var Async = function ( options ) {
options = options || {};
var async = this;
diff --git a/test/index.js b/test/index.js
index <HASH>..<HASH> 100644
--- a/test/index.js
+++ b/test/index.js
@@ -121,15 +121,7 @@
console.log( "test4" );
next( );
}, 1000, next )
- } );
-
- var list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], contact = { id: 1, name: "Kevin", id: 2, name: "Caleb" };
- async.next.forEach( list, contact, function ( item, index, contact ) {
- var sql = "";
- mssql( sql, {}, function ( err, result ) {
- console.log( "I'm done with this one." );
- } );
- } );
+ } );
async.next.start( function testWrapup( data ) {
console.log( "Done" ); | Updated test code - pulled out forEach tests | kbscript_async-next | train | js,js |
2e2833c718b5e30c5b815ea1f4737f0808842646 | diff --git a/xds/internal/client/v3/client.go b/xds/internal/client/v3/client.go
index <HASH>..<HASH> 100644
--- a/xds/internal/client/v3/client.go
+++ b/xds/internal/client/v3/client.go
@@ -43,10 +43,10 @@ func init() {
var (
resourceTypeToURL = map[xdsclient.ResourceType]string{
- xdsclient.ListenerResource: version.V2ListenerURL,
- xdsclient.RouteConfigResource: version.V2RouteConfigURL,
- xdsclient.ClusterResource: version.V2ClusterURL,
- xdsclient.EndpointsResource: version.V2EndpointsURL,
+ xdsclient.ListenerResource: version.V3ListenerURL,
+ xdsclient.RouteConfigResource: version.V3RouteConfigURL,
+ xdsclient.ClusterResource: version.V3ClusterURL,
+ xdsclient.EndpointsResource: version.V3EndpointsURL,
}
) | xds: Fix resource type to URL mapping for v3 client. (#<I>) | grpc_grpc-go | train | go |
4f38bde01134a1de202de3d28b9d0bf92952cde5 | diff --git a/lib/writer.js b/lib/writer.js
index <HASH>..<HASH> 100644
--- a/lib/writer.js
+++ b/lib/writer.js
@@ -246,17 +246,7 @@ Writer.prototype._finish = function () {
? "utimes" : "lutimes"
if (utimes === "lutimes" && !fs[utimes]) {
- if (!fs.futimes) fs.ltimes = function (a, b, c, cb) { return cb() }
- else fs.lutimes = function (path, atime, mtime, cb) {
- var c = require("constants")
- fs.open(path, c.O_SYMLINK, function (er, fd) {
- if (er) return cb(er)
- fs.futimes(fd, atime, mtime, function (er) {
- if (er) return cb(er)
- fs.close(fd, cb)
- })
- })
- }
+ utimes = "utimes"
}
var curA = current.atime | Remove shim for lutimes, graceful-fs provides this now | npm_fstream | train | js |
deabfa5e15eae632873584d035c1e8420a5162c2 | diff --git a/graphicscontext.go b/graphicscontext.go
index <HASH>..<HASH> 100644
--- a/graphicscontext.go
+++ b/graphicscontext.go
@@ -78,6 +78,7 @@ func (c *graphicsContext) setSize(screenWidth, screenHeight, screenScale int) er
}
screen := &Image{framebuffer: screenF, texture: texture}
c.defaultRenderTarget = &Image{framebuffer: f, texture: nil}
+ c.defaultRenderTarget.Clear()
c.screen = screen
c.screenScale = screenScale
return nil | graphics: Clear the default render target just after initializing | hajimehoshi_ebiten | train | go |
b8de0b6296228e2a6c3968d5ea359cca81a6c14a | diff --git a/easybatch-jdbc/src/main/java/org/easybatch/jdbc/JdbcRecordWriter.java b/easybatch-jdbc/src/main/java/org/easybatch/jdbc/JdbcRecordWriter.java
index <HASH>..<HASH> 100644
--- a/easybatch-jdbc/src/main/java/org/easybatch/jdbc/JdbcRecordWriter.java
+++ b/easybatch-jdbc/src/main/java/org/easybatch/jdbc/JdbcRecordWriter.java
@@ -68,6 +68,7 @@ public class JdbcRecordWriter extends AbstractRecordWriter {
PreparedStatement preparedStatement = connection.prepareStatement(query);
preparedStatementProvider.prepareStatement(preparedStatement, record);
preparedStatement.executeUpdate();
+ preparedStatement.close();
} catch (SQLException e) {
throw new RecordWritingException("Unable to write record " + record + " to database", e);
} | Close preparedStatement after its execution
You should think in closing preparedStatement after preparedStatement.executeUpdate() this will avoid too many opened coursors in a huge batch insert transaction. | j-easy_easy-batch | train | java |
64fcdb47b7348b7b4334c78de2353a6072977b3f | diff --git a/anyconfig/backend/xml.py b/anyconfig/backend/xml.py
index <HASH>..<HASH> 100644
--- a/anyconfig/backend/xml.py
+++ b/anyconfig/backend/xml.py
@@ -1,9 +1,11 @@
#
-# Copyright (C) 2011 - 2017 Satoru SATOH <ssato @ redhat.com>
+# Copyright (C) 2011 - 2018 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# Some XML modules may be missing and Base.{load,dumps}_impl are not overriden:
# pylint: disable=import-error, duplicate-except
+# len(elem) is necessary to check that ET.Element object has children.
+# pylint: disable=len-as-condition
r"""XML backend:
- Format to support: XML, e.g. http://www.w3.org/TR/xml11/ | change: [xml] suppress pylint's warn, len-as-condition | ssato_python-anyconfig | train | py |
06616557ab4814fbecc22c8f4381c22820ee9203 | diff --git a/Controller/CrudController.php b/Controller/CrudController.php
index <HASH>..<HASH> 100644
--- a/Controller/CrudController.php
+++ b/Controller/CrudController.php
@@ -190,7 +190,12 @@ class CrudController extends Controller implements MenuItemInterface
$entity = $this->getEntity($id);
- $form = $this->createForm(new BaseType('index', $this->meta, $property), $entity);
+ $form = $this->createForm(new BaseType('index', $this->meta, $property), $entity, array(
+ 'validation_groups' => array(
+ 'Default',
+ 'UpdateProperty',
+ ),
+ ));
$originalValue = $form->createView()->children[$property]->vars['value']; | Set specific validation groups for property forms. | DarvinStudio_DarvinAdminBundle | train | php |
e13befa963323dfcd4b6d8e14b0f6980946b7e1b | diff --git a/lib/puppet/util/cacher.rb b/lib/puppet/util/cacher.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/util/cacher.rb
+++ b/lib/puppet/util/cacher.rb
@@ -116,6 +116,7 @@ module Puppet::Util::Cacher
end
def expired_by_ttl?(name)
+ return false unless self.class.respond_to?(:attr_ttl)
return false unless ttl = self.class.attr_ttl(name)
@ttl_timestamps ||= {}
diff --git a/spec/unit/util/cacher.rb b/spec/unit/util/cacher.rb
index <HASH>..<HASH> 100755
--- a/spec/unit/util/cacher.rb
+++ b/spec/unit/util/cacher.rb
@@ -149,6 +149,15 @@ describe Puppet::Util::Cacher do
lambda { klass.cached_attr(:myattr, :ttl => "yep") { Time.now } }.should raise_error(ArgumentError)
end
+ it "should not check for a ttl expiration if the class does not support that method" do
+ klass = Class.new do
+ extend Puppet::Util::Cacher
+ end
+
+ klass.metaclass.cached_attr(:myattr) { "eh" }
+ klass.myattr
+ end
+
it "should automatically expire cached attributes whose ttl has expired, even if no expirer is present" do
klass = Class.new do
def self.to_s | Fixing #<I> - fixing the tests broken by my attr_ttl code | puppetlabs_puppet | train | rb,rb |
2a9919ad2503df0af89fd6c16cc655d9ec559596 | diff --git a/src/Illuminate/Database/PDO/SqlServerDriver.php b/src/Illuminate/Database/PDO/SqlServerDriver.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Database/PDO/SqlServerDriver.php
+++ b/src/Illuminate/Database/PDO/SqlServerDriver.php
@@ -9,7 +9,7 @@ class SqlServerDriver extends AbstractSQLServerDriver
public function connect(array $params)
{
return new SqlServerConnection(
- new Connection($params)
+ new Connection($params['pdo'])
);
}
} | Fix PDO passing in SqlServerDriver (#<I>) | laravel_framework | train | php |
0a3a81800b0a5f4ff2fc9ff9fc731e1e9abd9de2 | diff --git a/led/ledcmd/edit_isolated.go b/led/ledcmd/edit_isolated.go
index <HASH>..<HASH> 100644
--- a/led/ledcmd/edit_isolated.go
+++ b/led/ledcmd/edit_isolated.go
@@ -120,9 +120,9 @@ func EditIsolated(ctx context.Context, authClient *http.Client, jd *job.Definiti
}
rawIsoClient := isolatedclient.NewClient(
- current.Server,
+ isoServerParams.Server,
isolatedclient.WithAuthClient(authClient),
- isolatedclient.WithNamespace(current.Namespace),
+ isolatedclient.WithNamespace(isoServerParams.Namespace),
isolatedclient.WithRetryFactory(retry.Default))
if dgst := current.GetDigest(); dgst != "" { | [led] Fix isolateclient creation.
Two CLs landing about the same time caused a bit of confusion :)
TBR=<EMAIL>, <EMAIL>
Bug: <I>
Change-Id: Idca9a1f<I>e<I>e5bc<I>bd1d<I>
Reviewed-on: <URL> | luci_luci-go | train | go |
37f9f6c58043a01df7bddc4c48fe8c6dc3e49125 | diff --git a/dingo/core/network/__init__.py b/dingo/core/network/__init__.py
index <HASH>..<HASH> 100644
--- a/dingo/core/network/__init__.py
+++ b/dingo/core/network/__init__.py
@@ -357,6 +357,7 @@ class GeneratorDingo:
def __init__(self, **kwargs):
self.id_db = kwargs.get('id_db', None)
+ self.name = kwargs.get('name', '')
self.geo_data = kwargs.get('geo_data', None)
self.mv_grid = kwargs.get('mv_grid', None)
self.lv_load_area = kwargs.get('lv_load_area', None) | add attr 'name' to GeneratorDingo
to allow storing name of conv. power plant | openego_ding0 | train | py |
2e00deefe684acf7885cb81e0e9c2eb50dababc9 | diff --git a/wasp_general/cli/curses_commands.py b/wasp_general/cli/curses_commands.py
index <HASH>..<HASH> 100644
--- a/wasp_general/cli/curses_commands.py
+++ b/wasp_general/cli/curses_commands.py
@@ -50,3 +50,14 @@ class WExitCommand(WCommand):
def _exec(self, *command_tokens):
self.__console.stop()
return WCommandResult('Exiting...')
+
+
+class WEmptyCommand(WCommand):
+
+ @verify_type(command_tokens=str)
+ def match(self, *command_tokens):
+ return len(command_tokens) == 0
+
+ @verify_type(command_tokens=str)
+ def _exec(self, *command_tokens):
+ return WCommandResult() | wasp_general/cli/curses_commands.py: WEmptyCommand added | a1ezzz_wasp-general | train | py |
26350cf9a0b7aa6a2dbdc42facddd95b54430d2f | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ tests_require = [
'pytest-flakes', # syntax validation
'pytest-capturelog', # log capture
'pytest-spec', # output formatting
- 'WebOb', # request mocking
+ 'WebCore', # request mocking
] | Switch to WebCore for testing. | marrow_web.dispatch.resource | train | py |
b27bc763fc72e02f8e93fe3d0ab9c1ce44a7a746 | diff --git a/jira/client.py b/jira/client.py
index <HASH>..<HASH> 100644
--- a/jira/client.py
+++ b/jira/client.py
@@ -127,8 +127,13 @@ class JIRA(object):
### Groups
# non-resource
- def groups(self, query, exclude=None):
- return self._get_json('groups/picker', params={'query': query, 'exclude': exclude})
+ def groups(self, query=None, exclude=None):
+ params = {}
+ if query is not None:
+ params['query'] = query
+ if exclude is not None:
+ params['exclude'] = exclude
+ return self._get_json('groups/picker', params=params)
### Issues | - support all-groups option | pycontribs_jira | 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.