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 |
|---|---|---|---|---|---|
e51b7d8ffc90294cca1bb47ae821fc8c834960b6 | diff --git a/shared/actions/chat/inbox.js b/shared/actions/chat/inbox.js
index <HASH>..<HASH> 100644
--- a/shared/actions/chat/inbox.js
+++ b/shared/actions/chat/inbox.js
@@ -279,7 +279,8 @@ function* _chatInboxFailedSubSaga(params) {
// Mark the conversation as read, to avoid a state where there's a
// badged conversation that can't be unbadged by clicking on it.
const {maxMsgid} = error.remoteConv.readerInfo
- if (maxMsgid) {
+ const selectedConversation = yield select(Constants.getSelectedConversation)
+ if (maxMsgid && selectedConversation === conversationIDKey) {
yield call(ChatTypes.localMarkAsReadLocalRpcPromise, {
param: {
conversationID: convID, | Only unbadge errors if they're for the selected conversation | keybase_client | train | js |
bc1e95879f2ff79165bad8677f39888853453aa4 | diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/platform/query_helpers_spec.rb
+++ b/spec/unit/platform/query_helpers_spec.rb
@@ -53,3 +53,25 @@ describe 'Chef::Platform#supports_dsc?' do
end
end
end
+
+describe 'Chef::Platform#supports_dsc_invoke_resource?' do
+ it 'returns false if powershell is not present' do
+ node = Chef::Node.new
+ expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
+ end
+
+ ['1.0', '2.0', '3.0', '4.0', '5.0.10017.9'].each do |version|
+ it "returns false for Powershell #{version}" do
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = version
+ expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
+ end
+ end
+
+ it "returns true for Powershell 5.0.10018.0" do
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
+ expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_truthy
+ end
+end
+ | Added spec for supports_dsc_invoke_resource? | chef_chef | train | rb |
773316f34dd3aead7ae6675568dbc29244a4e79f | diff --git a/lib/knapsack/adapters/minitest_adapter.rb b/lib/knapsack/adapters/minitest_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/knapsack/adapters/minitest_adapter.rb
+++ b/lib/knapsack/adapters/minitest_adapter.rb
@@ -59,6 +59,7 @@ module Knapsack
method_object = obj.method(test_method_name)
full_test_path = method_object.source_location.first
test_path = full_test_path.gsub(@@parent_of_test_dir, '.')
+ # test_path will look like ./test/dir/unit_test.rb
test_path
end
end | Add comment how test path will look like | ArturT_knapsack | train | rb |
aa4e235e68669e72f4c287e605ebead53a875275 | diff --git a/lib/beta_builder/deployment_strategies/web.rb b/lib/beta_builder/deployment_strategies/web.rb
index <HASH>..<HASH> 100644
--- a/lib/beta_builder/deployment_strategies/web.rb
+++ b/lib/beta_builder/deployment_strategies/web.rb
@@ -18,7 +18,7 @@ module BetaBuilder
end
def prepare
- plist = CFPropertyList::List.new(:file => "pkg/Payload/#{@configuration.app_name}.app/Info.plist")
+ plist = CFPropertyList::List.new(:file => "#{@configuration.built_app_path}/Info.plist")
plist_data = CFPropertyList.native_types(plist.value)
File.open("pkg/dist/manifest.plist", "w") do |io|
io << %{ | Get these out of the built location, not the deploy payload section. | olarivain_xcodebuilder | train | rb |
426f6708f1eca502b0526cd77068aa4d0e2d2d63 | diff --git a/tasks/port-pick.js b/tasks/port-pick.js
index <HASH>..<HASH> 100644
--- a/tasks/port-pick.js
+++ b/tasks/port-pick.js
@@ -65,7 +65,7 @@ module.exports = function(grunt) {
function(callback){
if(pp.usePorts && pp.usePorts.length > 0) {
var foundPort = pp.usePorts.shift()
- pp.first = foundPort + 1
+ pp.first = parseInt(foundPort) + 1
used.push(foundPort)
grunt.config.set('port-pick-used', used.join(','))
callback(foundPort)
@@ -81,7 +81,7 @@ module.exports = function(grunt) {
// If we use a port, increment so that it isn't used again
if(foundPort !== false) {
- pp.first = foundPort + 1
+ pp.first = parseInt(foundPort) + 1
used.push(foundPort)
grunt.config.set('port-pick-used', used.join(','))
} | Properly handle ports as strings
Some ports can be strings when parsing port data from the command line. This prevents 1 from being appended to the port string and properly adds it to the port number. | devaos_grunt-port-pick | train | js |
4db0e0b545b5c13354445d91fedb20c743ac357a | diff --git a/src/BinaryReader.php b/src/BinaryReader.php
index <HASH>..<HASH> 100644
--- a/src/BinaryReader.php
+++ b/src/BinaryReader.php
@@ -99,7 +99,7 @@ class BinaryReader
}
/**
- * @return int
+ * @return string
*/
public function getEndian()
{ | Scrutinizer Auto-Fixes
This patch was automatically generated as part of the following inspection:
<URL> | mdurrant_php-binary-reader | train | php |
f12e2a41fabe03048c8facdf31b1840fc4d7efd1 | diff --git a/theanets/layers.py b/theanets/layers.py
index <HASH>..<HASH> 100644
--- a/theanets/layers.py
+++ b/theanets/layers.py
@@ -1396,6 +1396,11 @@ class Bidirectional(Layer):
self.params = [self.forward.params, self.backward.params]
super(Bidirectional, self).__init__(size=size, name=name, **kwargs)
+ @property
+ def num_params(self):
+ '''Total number of learnable parameters in this layer.'''
+ return self.forward.num_params + self.backward.num_params
+
def transform(self, inputs):
'''Transform the inputs for this layer into an output for the layer. | Override num_params for bidirectional layers. | lmjohns3_theanets | train | py |
a39ce7fdcf5e7aa432917e86c4a244b742fa587f | diff --git a/Controller/PageLayoutController.php b/Controller/PageLayoutController.php
index <HASH>..<HASH> 100644
--- a/Controller/PageLayoutController.php
+++ b/Controller/PageLayoutController.php
@@ -57,11 +57,12 @@ class PageLayoutController extends Controller
* @param string $region
* @param string|bool $cssClass
* @param array $params
+ * @param array $blockSpecificParams
* @param string $template
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function region( $layoutId, $region, $cssClass = false, $params = array(), $template = null )
+ public function region( $layoutId, $region, $cssClass = false, $params = array(), $blockSpecificParams = array(), $template = null )
{
$response = new Response();
$response->setPublic()->setSharedMaxAge( 300 );
@@ -81,7 +82,8 @@ class PageLayoutController extends Controller
'zone' => $zone,
'region' => $region,
'css_class' => $cssClass,
- 'params' => $params
+ 'params' => $params,
+ 'blockSpecificParams' => $blockSpecificParams
),
$response
); | Add possibility to define block specific params in region controller | netgen_site-bundle | train | php |
03014b9db310d82bee35adee2630f426b73c142f | diff --git a/src/Modal.js b/src/Modal.js
index <HASH>..<HASH> 100644
--- a/src/Modal.js
+++ b/src/Modal.js
@@ -41,14 +41,14 @@ export default class ReactModal2 extends React.Component {
componentDidMount() {
if (ExecutionEnvironment.canUseDOM) {
setFocusOn(ReactModal2.getApplicationElement(), this.refs.modal);
- document.addEventListener('keydown', this.handleDocumentKeydown.bind(this));
+ document.addEventListener('keydown', this.handleDocumentKeydown);
}
}
componentWillUnmount() {
if (ExecutionEnvironment.canUseDOM) {
resetFocus(ReactModal2.getApplicationElement());
- document.removeEventListener('keydown', this.handleDocumentKeydown.bind(this));
+ document.removeEventListener('keydown', this.handleDocumentKeydown);
}
} | Remove unnecessary `bind` on `keydown` handler | cloudflare_react-modal2 | train | js |
63a0abb0a5863e6cbb19919eb7f5438b8711e142 | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -6,7 +6,3 @@ const fs = require('fs');
// .pipe(fs.createWriteStream('ring.mp3'));
snekfetch.get('https://httpbin.org/redirect/1').then(console.log);
-
-
-snekfetch.get('https://discordapp.com/assets/b9411af07f154a6fef543e7e442e4da9.mp3')
- .pipe(fs.createWriteStream('ring.mp3')); | add sync requests for memes not real usage | devsnek_snekfetch | train | js |
9a37bc112a0f1a12ccb0a87b0bf605c105729c3e | diff --git a/test/Gitlab/Tests/IntegrationTest.php b/test/Gitlab/Tests/IntegrationTest.php
index <HASH>..<HASH> 100644
--- a/test/Gitlab/Tests/IntegrationTest.php
+++ b/test/Gitlab/Tests/IntegrationTest.php
@@ -16,7 +16,7 @@ class IntegrationTest extends TestCase
->repositories()
->contributors(5315609);
- $this->assertIsArray($response);
+ $this->assertInternalType('array', $response);
$this->assertTrue(isset($response[2]));
$this->assertTrue(isset($response[2]['name']));
} | Fixed tests on PHP <I> and <I> | m4tthumphrey_php-gitlab-api | train | php |
80b2aff957a5569826fabd9c1959885385f6a637 | diff --git a/spec/status_message_spec.rb b/spec/status_message_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/status_message_spec.rb
+++ b/spec/status_message_spec.rb
@@ -193,9 +193,9 @@ module SadPanda
expect(status_message.emotion.class).to eql(String)
end
- context "when status_message == 'I am paralyzed by happinesss' " do
+ context "when status_message == 'I am happy' " do
it "polarity is greater than zero" do
- status_message = SadPanda::StatusMessage.new "I am paralyzed by happinesss"
+ status_message = SadPanda::StatusMessage.new "I am happy"
expect(status_message.polarity).to be > 0
end
end
@@ -217,7 +217,7 @@ module SadPanda
context "when status_message == 'I am terrified' " do
it "polarity is less than zero" do
- status_message = SadPanda::StatusMessage.new "I am terrified"
+ status_message = SadPanda::StatusMessage.new "I am fearful"
expect(status_message.polarity).to be < 0
end
end | Add tests to spec/status_message_spec.rb | mattThousand_sad_panda | train | rb |
64e49726cd9ef7912a8017ccc668563568a5418c | diff --git a/mod/mod.go b/mod/mod.go
index <HASH>..<HASH> 100644
--- a/mod/mod.go
+++ b/mod/mod.go
@@ -3,6 +3,7 @@ package mod
import (
"net/http"
+ "path"
"github.com/coreos/etcd/mod/dashboard"
"github.com/gorilla/mux"
@@ -10,9 +11,16 @@ import (
var ServeMux *http.Handler
+func addSlash(w http.ResponseWriter, req *http.Request) {
+ http.Redirect(w, req, path.Join("mod", req.URL.Path) + "/", 302)
+ return
+}
+
func HttpHandler() (handler http.Handler) {
modMux := mux.NewRouter()
+ modMux.HandleFunc("/dashboard", addSlash)
modMux.PathPrefix("/dashboard/").
Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler()))
+
return modMux
} | fix(mod): redirect dashboard to /dashboard | etcd-io_etcd | train | go |
498785221b73228078ca689209b8942f80e96fd6 | diff --git a/View/View.php b/View/View.php
index <HASH>..<HASH> 100644
--- a/View/View.php
+++ b/View/View.php
@@ -51,7 +51,7 @@ class View
* @param int $statusCode
* @param array $headers
*
- * @return \FOS\RestBundle\View\View
+ * @return static
*/
public static function create($data = null, $statusCode = null, array $headers = array())
{
@@ -66,7 +66,7 @@ class View
* @param int $statusCode
* @param array $headers
*
- * @return View
+ * @return static
*/
public static function createRedirect($url, $statusCode = Codes::HTTP_FOUND, array $headers = array())
{
@@ -85,7 +85,7 @@ class View
* @param int $statusCode
* @param array $headers
*
- * @return View
+ * @return static
*/
public static function createRouteRedirect(
$route, | Change docblock return value to 'static'
When creating a new instance using the 'static' keyword but the
docblock uses the class name, autocomplete can't figure out the late
static binding. Changing this to 'static' fixes this. | FriendsOfSymfony_FOSRestBundle | train | php |
1cec860503d8a9cb5d2b488880bb2ab5b210fc02 | diff --git a/closure/goog/testing/events/events_test.js b/closure/goog/testing/events/events_test.js
index <HASH>..<HASH> 100644
--- a/closure/goog/testing/events/events_test.js
+++ b/closure/goog/testing/events/events_test.js
@@ -374,7 +374,8 @@ function testKeySequenceCancellingKeyup() {
function testKeySequenceWithEscapeKey() {
assertTrue(goog.testing.events.fireKeySequence(
root, goog.events.KeyCodes.ESC));
- if (goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('525')) {
+ if (goog.userAgent.EDGE ||
+ (goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('525'))) {
assertEventTypes(['keydown', 'keyup']);
} else {
assertEventTypes(['keydown', 'keypress', 'keyup']); | Fix events_test for Edge. It purposely does not fire keypress. See events/keycodes.js:<I>
-------------
Created by MOE: <URL> | google_closure-library | train | js |
a9005c6fad376fc68755c675dc24facc551bb119 | diff --git a/tasks/hb2.js b/tasks/hb2.js
index <HASH>..<HASH> 100644
--- a/tasks/hb2.js
+++ b/tasks/hb2.js
@@ -279,8 +279,8 @@ const normalizeWinPath = (filePath) => {
const prepareTemplateDataForIndexr = () => {
const sortedTemplates = [];
const blacklistedTemplates = [
- path.join(config.global.cwd, config.global.src, 'index.hbs'),
- path.join(config.global.cwd, config.global.src, 'browserSupport.hbs')
+ normalizeWinPath(path.join(config.global.cwd, config.global.src, 'index.hbs')),
+ normalizeWinPath(path.join(config.global.cwd, config.global.src, 'browserSupport.hbs'))
];
for (let template in templates) { | fixed win path bug in template blacklist | biotope_biotope-build | train | js |
4b72cfd958de5f6c18a4e39589967ad98cd4ed8e | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -86,7 +86,7 @@ if stale_egg_info.exists():
# 2. once modified, run: `make deps_table_update` to update src/transformers/dependency_versions_table.py
_deps = [
"Pillow",
- "black>=20.8b1",
+ "black==20.8b1",
"cookiecutter==1.7.2",
"dataclasses",
"datasets", | Pin black to <I>.b1 | huggingface_pytorch-pretrained-BERT | train | py |
223047033208e0cbbd1ea80a450767dd40d7b5e1 | diff --git a/src/BEAR/Package/Provide/TemplateEngine/Twig/TwigAdapter.php b/src/BEAR/Package/Provide/TemplateEngine/Twig/TwigAdapter.php
index <HASH>..<HASH> 100644
--- a/src/BEAR/Package/Provide/TemplateEngine/Twig/TwigAdapter.php
+++ b/src/BEAR/Package/Provide/TemplateEngine/Twig/TwigAdapter.php
@@ -10,6 +10,9 @@ namespace BEAR\Package\Provide\TemplateEngine\Twig;
use BEAR\Package\Provide\TemplateEngine\AdapterTrait;
use BEAR\Sunday\Extension\TemplateEngine\TemplateEngineAdapterInterface;
use Twig_Environment;
+use Ray\Di\Di\Inject;
+use Ray\Di\Di\Named;
+use Ray\Di\Di\PostConstruct;
/**
* Smarty adapter | Add use statements for annotation class to TwigAdapter | bearsunday_BEAR.Package | train | php |
5e4471a9524c2a0ed0ad5d9e65ce7633e059b40f | diff --git a/src/Symfony/Component/Validator/Constraints/ExpressionLanguageSyntaxValidator.php b/src/Symfony/Component/Validator/Constraints/ExpressionLanguageSyntaxValidator.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Validator/Constraints/ExpressionLanguageSyntaxValidator.php
+++ b/src/Symfony/Component/Validator/Constraints/ExpressionLanguageSyntaxValidator.php
@@ -27,6 +27,10 @@ class ExpressionLanguageSyntaxValidator extends ConstraintValidator
public function __construct(ExpressionLanguage $expressionLanguage = null)
{
+ if (!class_exists(ExpressionLanguage::class)) {
+ throw new \LogicException(sprintf('The "%s" class requires the "ExpressionLanguage" component. Try running "composer require symfony/expression-language".', self::class));
+ }
+
$this->expressionLanguage = $expressionLanguage;
} | Throw error with debug message when ExpressionLanguage Component is not installed | symfony_symfony | train | php |
2a853dc86cbc70ea2e0b38e960e55ba4d7dd5bbc | diff --git a/angularFire.js b/angularFire.js
index <HASH>..<HASH> 100644
--- a/angularFire.js
+++ b/angularFire.js
@@ -33,7 +33,7 @@ AngularFire.prototype = {
deferred = false;
}
self._remoteValue = ret;
- if (snap && snap.val()) {
+ if (snap && snap.val() != undefined) {
var val = snap.val();
if (typeof val != typeof ret) {
self._log("Error: type mismatch"); | Another instance where we mean undefined, not false | firebase_angularfire | train | js |
d53975a6e1206e1101cfdb64ab3b5aadde0c5c31 | diff --git a/lib/preflight/profile.rb b/lib/preflight/profile.rb
index <HASH>..<HASH> 100644
--- a/lib/preflight/profile.rb
+++ b/lib/preflight/profile.rb
@@ -43,8 +43,6 @@ module Preflight
else
raise ArgumentError, "input must be a string with a filename or an IO object"
end
- rescue PDF::Reader::EncryptedPDFError
- ["Can't preflight an encrypted PDF"]
end
def rule(*args)
@@ -61,8 +59,11 @@ module Preflight
def check_io(io)
PDF::Reader.open(io) do |reader|
+ raise PDF::Reader::EncryptedPDFError if reader.objects.encrypted?
check_pages(reader) + check_hash(reader)
end
+ rescue PDF::Reader::EncryptedPDFError
+ ["Can't preflight an encrypted PDF"]
end
def instance_rules
diff --git a/spec/profiles/pdfx1a_spec.rb b/spec/profiles/pdfx1a_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/profiles/pdfx1a_spec.rb
+++ b/spec/profiles/pdfx1a_spec.rb
@@ -26,7 +26,7 @@ describe Preflight::Profiles::PDFX1A do
messages.empty?.should_not be_true
end
- it "correctly detect encrypted files" do
+ it "correctly detect encrypted files with no user password" do
filename = pdf_spec_file("encrypted")
preflight = Preflight::Profiles::PDFX1A.new
messages = preflight.check(filename) | fix detection of encrypted files with a blank user password | yob_pdf-preflight | train | rb,rb |
e6202bc629ae95ae35983a0561561bae9aeb7683 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -31,6 +31,6 @@ setup(
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries :: Python Modules',
- 'Topic :: Testing',
+ 'Topic :: Software Development :: Testing',
'Development Status :: 4 - Beta'],
) | FIX: Correct bad classifier in setup.py | bskinn_stdio-mgr | train | py |
47484d5a71e9ea52f854ec7f3d03ec28ba77ad62 | diff --git a/decidim-meetings/spec/system/meeting_registrations_spec.rb b/decidim-meetings/spec/system/meeting_registrations_spec.rb
index <HASH>..<HASH> 100644
--- a/decidim-meetings/spec/system/meeting_registrations_spec.rb
+++ b/decidim-meetings/spec/system/meeting_registrations_spec.rb
@@ -211,7 +211,7 @@ describe "Meeting registrations", type: :system do
expect(page).to have_content("successfully")
- expect(page).to have_css(".button", text: "GOING")
+ expect(page).to have_text("You have signed up for this meeting")
expect(page).to have_text("19 slots remaining")
expect(page).to have_text("Stop following")
expect(page).to have_text("ATTENDING PARTICIPANTS") | Fix broken test on meetings after merging PR without rebase (#<I>) | decidim_decidim | train | rb |
c0b5f076dfe8869bdb0fef702b159b9e55ea567b | diff --git a/extensions/bokeh_magic.py b/extensions/bokeh_magic.py
index <HASH>..<HASH> 100644
--- a/extensions/bokeh_magic.py
+++ b/extensions/bokeh_magic.py
@@ -12,6 +12,7 @@
from IPython.core.magic import (Magics, magics_class, line_magic)
from IPython.testing.skipdoctest import skip_doctest
+#from IPython.core.error import UsageError
from bokeh.plotting import (output_notebook, figure, hold, show)
#-----------------------------------------------------------------------------
@@ -58,8 +59,15 @@ class BokehMagics(Magics):
ip = get_ipython()
# Register a function for calling after code execution.
- ip.register_post_execute(show)
- # TODO: discuss about cells no cantaining plots objects.
+ ip.register_post_execute(self.notebook_show)
+
+ def notebook_show(self):
+ try:
+ show()
+ except IndexError:
+ # no plot object in the current cell gives us IndexError
+ print "Nothing to show!" + \
+ " Please, create a plot object before executing the cell."
def load_ipython_extension(ip): | Handled detection of missing plots in cells to avoid traceback whe show is called. | bokeh_bokeh | train | py |
9bd94b6940d0fe909f69a8bc6bc53ad89e751795 | diff --git a/lib/matestack/ui/core/engine.rb b/lib/matestack/ui/core/engine.rb
index <HASH>..<HASH> 100644
--- a/lib/matestack/ui/core/engine.rb
+++ b/lib/matestack/ui/core/engine.rb
@@ -10,6 +10,16 @@ module Matestack
# end
# Rails.configuration.autoload_paths << Dir.glob(File.join(Rails.root, 'config/matestack/**/*.rb'))
# require_dependency "#{Rails.root}/config/matestack-ui-core"
+
+ components_path = "#{Rails.root}/app/matestack/register_components"
+ if File.exist?("#{components_path}.rb")
+ # the other dependencies need to be loaded otherwise require_dependency crashes silently
+ # we don't need to require_dependency them because they don't need reloading
+ # anyhow, they should probably be required somewhere else before this anyhow?
+ require 'matestack/ui/core/dsl'
+ require 'matestack/ui/core/component/registry'
+ require_dependency "#{Rails.root}/app/matestack/register_components"
+ end
end
config.to_prepare &method(:activate).to_proc | Sketch of auto requiring a central register_components file in rails
Tested it quickly with the dummy app and seemed to work.
Should probably make name configurable, definitely needs to
be documented and maybe a better name :) | basemate_matestack-ui-core | train | rb |
29477e18f81671a181f758a57581d6827c7a8e9c | diff --git a/activejdbc/src/main/java/org/javalite/activejdbc/Model.java b/activejdbc/src/main/java/org/javalite/activejdbc/Model.java
index <HASH>..<HASH> 100644
--- a/activejdbc/src/main/java/org/javalite/activejdbc/Model.java
+++ b/activejdbc/src/main/java/org/javalite/activejdbc/Model.java
@@ -103,11 +103,6 @@ public abstract class Model extends CallbackSupport implements Externalizable {
value = attributesMap.get(attrName.toUpperCase());
}
if (value != null) {
- //it is necessary to cache contents of a clob, because if a clob instance itself is cached, and accessed later,
- //it will not be able to connect back to that same connection from which it came.
- //This is only important for cached models. This will allocate a ton of memory if Clobs are large.
- //Should the Blob behavior be the same?
- //TODO: write about this in future tutorial
if (value instanceof Clob && getMetaModelLocal().cached()) {
this.attributes.put(attrName.toLowerCase(), Convert.toString(value));
}else { | activejdbc-<I> #<I> - Remove outdated TODO about documenting CLOB interaction with Cached models | javalite_activejdbc | train | java |
f85650e8875e9fa6fca956d79a0d2b917e0d7078 | diff --git a/addon/components/dropzone-widget/component.js b/addon/components/dropzone-widget/component.js
index <HASH>..<HASH> 100644
--- a/addon/components/dropzone-widget/component.js
+++ b/addon/components/dropzone-widget/component.js
@@ -1,4 +1,6 @@
import Ember from 'ember';
+import config from 'ember-get-config';
+
import layout from './template';
/**
@@ -39,10 +41,13 @@ export default Ember.Component.extend({
// Set osf session header
let headers = {};
- this.get('session').authorize('authorizer:osf-token', (headerName, content) => {
+
+ let authType = config['ember-simple-auth'].authorizer;
+ this.get('session').authorize(authType, (headerName, content) => {
headers[headerName] = content;
});
dropzoneOptions.headers = headers;
+ dropzoneOptions.withCredentials = (config.authorizationType === 'cookie');
// Attach preUpload to addedfile event
drop.on('addedfile', file => { | Support cookie auth in dropzone widget
Replace hardcoded auth type with configurable settings and required ajax config
[ci skip]
[#PREP-<I>] | CenterForOpenScience_ember-osf | train | js |
4acc8c8be1971112be45e0feb7fb7eddbfc9d247 | diff --git a/src/platforms/web/runtime/directives/model.js b/src/platforms/web/runtime/directives/model.js
index <HASH>..<HASH> 100644
--- a/src/platforms/web/runtime/directives/model.js
+++ b/src/platforms/web/runtime/directives/model.js
@@ -3,9 +3,11 @@
* properties to Elements.
*/
-import { looseEqual, looseIndexOf } from 'shared/util'
+import { looseEqual, looseIndexOf, makeMap } from 'shared/util'
import { warn, isAndroid, isIE9, isIE, isEdge } from 'core/util/index'
+const isTextInputType = makeMap('text,password,search,email,tel,url')
+
/* istanbul ignore if */
if (isIE9) {
// http://www.matts411.com/post/internet-explorer-9-oninput/
@@ -28,7 +30,7 @@ export default {
if (isIE || isEdge) {
setTimeout(cb, 0)
}
- } else if (vnode.tag === 'textarea' || el.type === 'text' || el.type === 'password') {
+ } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
el._vModifiers = binding.modifiers
if (!binding.modifiers.lazy) {
// Safari < 10.2 & UIWebView doesn't fire compositionend when | fix(v-model): use consistent behavior during IME composition for other text-like input types (fix #<I>) | IOriens_wxml-transpiler | train | js |
71caedf7dfe527d6f583b2d3165581f727223de4 | diff --git a/src/settings.py b/src/settings.py
index <HASH>..<HASH> 100755
--- a/src/settings.py
+++ b/src/settings.py
@@ -107,4 +107,7 @@ INTERNAL_IPS = ('127.0.0.1',)
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
-}
\ No newline at end of file
+}
+
+import unittest2
+unittest2.TestLoader.testMethodPrefix = "should" | changed test method prefix to 'should' | madisona_django-contact-form | train | py |
8e089fe63bc3768f6724f97175555be3b76d05f8 | diff --git a/framework/Routing/Router.php b/framework/Routing/Router.php
index <HASH>..<HASH> 100644
--- a/framework/Routing/Router.php
+++ b/framework/Routing/Router.php
@@ -596,6 +596,12 @@ class Router implements RouterContract
$newRoute->setDynamic(true);
}
+ // If the base is secure
+ if (false !== $controllerRoute->getSecure()) {
+ // Set the route to dynamic
+ $newRoute->setSecure(true);
+ }
+
// Add the route to the array
$routes[] = $newRoute;
} | Fixing controller base secure setting not being applied to action routes. | valkyrjaio_valkyrja | train | php |
33147481b7e2726ce92421211f235fd95baf5e9f | diff --git a/abydos/phonetic/_double_metaphone.py b/abydos/phonetic/_double_metaphone.py
index <HASH>..<HASH> 100644
--- a/abydos/phonetic/_double_metaphone.py
+++ b/abydos/phonetic/_double_metaphone.py
@@ -232,7 +232,7 @@ class DoubleMetaphone(_Phonetic):
current = 0
length = len(word)
if length < 1:
- return ''
+ return ','
last = length - 1
word = word.upper() | DM should always return 2 values, even if both are empty | chrislit_abydos | train | py |
d4f17af1a8187f2c4bdcfd74a93c89583d7eea6d | diff --git a/lib/ichiban/scripts.rb b/lib/ichiban/scripts.rb
index <HASH>..<HASH> 100644
--- a/lib/ichiban/scripts.rb
+++ b/lib/ichiban/scripts.rb
@@ -64,8 +64,10 @@ module Ichiban
)
)
compiler.ivars = {:_current_path => web_path}.merge(ivars)
- html = compiler.compile_to_str
- File.open(File.join(Ichiban.project_root, 'compiled', dest_path), 'w') do |f|
+ html = compiler.compile_to_str
+ abs_dest_path = File.join(Ichiban.project_root, 'compiled', dest_path)
+ FileUtils.mkdir_p File.dirname(abs_dest_path)
+ File.open(abs_dest_path, 'w') do |f|
f << html
end
Ichiban.logger.compilation(
diff --git a/test/scripts_test.rb b/test/scripts_test.rb
index <HASH>..<HASH> 100644
--- a/test/scripts_test.rb
+++ b/test/scripts_test.rb
@@ -63,4 +63,8 @@ class TestScripts < MiniTest::Unit::TestCase
assert_compiled 'thomas-jefferson.html'
assert_compiled 'george-washington.html'
end
+
+ def test_makes_folders_as_needed
+ skip
+ end
end
\ No newline at end of file | Added mkdir_p to Script#generate | jarrett_ichiban | train | rb,rb |
4a0f40ec2d3eeed6d37400f2e1aef1d403c374aa | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -115,6 +115,8 @@ def run_setup(exts):
"spacy.en": ["*.pxd", "data/pos/*",
"data/wordnet/*", "data/tokenizer/*",
"data/vocab/lexemes.bin",
+ "data/vocab/serializer.json",
+ "data/vocab/oov_prob",
"data/vocab/strings.txt"],
"spacy.syntax": ["*.pxd"]},
ext_modules=exts, | * Ensure data is packaged in vocab | explosion_spaCy | train | py |
1277224db92096dc9c202d533e1600bb749d9f6a | diff --git a/app/models/Node.java b/app/models/Node.java
index <HASH>..<HASH> 100644
--- a/app/models/Node.java
+++ b/app/models/Node.java
@@ -391,7 +391,9 @@ public class Node extends ClusterEntity {
.path("/system/metrics/namespace/{0}", namespace)
.expect(200, 404)
.execute();
-
+ if (response == null) {
+ return Maps.newHashMap();
+ }
return response.getMetrics();
} | don't NPE on missing metric | Graylog2_graylog2-server | train | java |
5874ac05cd55bc1e2bac1cddee1c4ee20ec1f4e5 | diff --git a/lxd/network/driver_ovn.go b/lxd/network/driver_ovn.go
index <HASH>..<HASH> 100644
--- a/lxd/network/driver_ovn.go
+++ b/lxd/network/driver_ovn.go
@@ -277,7 +277,7 @@ func (n *ovn) Validate(config map[string]string) error {
}
// If NAT disabled, parse the external subnets that are being requested.
- var externalSubnets []*net.IPNet
+ var externalSubnets []*net.IPNet // Subnets to check for conflicts with other networks/NICs.
for _, keyPrefix := range []string{"ipv4", "ipv6"} {
addressKey := fmt.Sprintf("%s.address", keyPrefix)
if !shared.IsTrue(config[fmt.Sprintf("%s.nat", keyPrefix)]) && validate.IsOneOf("", "none", "auto")(config[addressKey]) != nil {
@@ -286,6 +286,7 @@ func (n *ovn) Validate(config map[string]string) error {
return errors.Wrapf(err, "Failed parsing %q", addressKey)
}
+ // Add to list to check for conflicts.
externalSubnets = append(externalSubnets, ipNet)
}
} | lxd/network/driver/ovn: Improve comments in Validate | lxc_lxd | train | go |
30dbb21a43f625cd32ce9f2086c3d48ec8303cf7 | diff --git a/spec/mongoid/contextual/aggregable/mongo_spec.rb b/spec/mongoid/contextual/aggregable/mongo_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/mongoid/contextual/aggregable/mongo_spec.rb
+++ b/spec/mongoid/contextual/aggregable/mongo_spec.rb
@@ -110,6 +110,56 @@ describe Mongoid::Contextual::Aggregable::Mongo do
end
end
+ context "when the field sometimes exists" do
+ let!(:oasis) do
+ Band.create(name: "Oasis", likes: 50)
+ end
+
+ let!(:radiohead) do
+ Band.create(name: "Radiohead")
+ end
+
+ context "and the field doesn't exist on the last document" do
+ let(:criteria) do
+ Band.all
+ end
+
+ let(:context) do
+ Mongoid::Contextual::Mongo.new(criteria)
+ end
+
+ let(:aggregates) do
+ context.aggregates(:likes)
+ end
+
+ it "returns a min" do
+ aggregates["min"].should eq(50)
+ end
+ end
+
+ context "and the field doesn't exist on the before-last document" do
+ let!(:u2) do
+ Band.create(name: "U2", likes: 100)
+ end
+
+ let(:criteria) do
+ Band.all
+ end
+
+ let(:context) do
+ Mongoid::Contextual::Mongo.new(criteria)
+ end
+
+ let(:aggregates) do
+ context.aggregates(:likes)
+ end
+
+ it "returns a min" do
+ aggregates["min"].should eq(50)
+ end
+ end
+ end
+
context "when there are no matching documents" do
let(:criteria) do | Add specs to exhibit strange behavior when aggregating on field that doesn't always exist | mongodb_mongoid | train | rb |
fd319adb9a934ded81616cb11c657d6f2b648940 | diff --git a/phono3py/api_jointdos.py b/phono3py/api_jointdos.py
index <HASH>..<HASH> 100644
--- a/phono3py/api_jointdos.py
+++ b/phono3py/api_jointdos.py
@@ -268,7 +268,11 @@ class Phono3pyJointDos:
self._jdos.temperature = temperature
for ib, freq_indices in enumerate(batches):
- print(f"{ib + 1}/{len(batches)}: {freq_indices}", flush=True)
+ if self._log_level:
+ print(
+ f"{ib + 1}/{len(batches)}: {freq_indices + 1}",
+ flush=True,
+ )
self._jdos.frequency_points = self._frequency_points[
freq_indices
] | Minor update of JDOS for stdout | atztogo_phono3py | train | py |
f423174d0b60468022c96a7e4d90a829671b815f | diff --git a/core/src/main/java/jenkins/util/JSONSignatureValidator.java b/core/src/main/java/jenkins/util/JSONSignatureValidator.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/jenkins/util/JSONSignatureValidator.java
+++ b/core/src/main/java/jenkins/util/JSONSignatureValidator.java
@@ -77,8 +77,11 @@ public class JSONSignatureValidator {
Set<TrustAnchor> anchors = new HashSet<TrustAnchor>(); // CertificateUtil.getDefaultRootCAs();
Jenkins j = Jenkins.getInstance();
for (String cert : (Set<String>) j.servletContext.getResourcePaths("/WEB-INF/update-center-rootCAs")) {
- if (cert.endsWith(".txt")) continue; // skip text files that are meant to be documentation
+ if (cert.endsWith("/") || cert.endsWith(".txt")) {
+ continue; // skip directories also any text files that are meant to be documentation
+ }
InputStream in = j.servletContext.getResourceAsStream(cert);
+ if (in == null) continue; // our test for paths ending in / should prevent this from happening
Certificate certificate;
try {
certificate = cf.generateCertificate(in); | Additional safety as an addendum to <I>b4bf<I>ad<I>eb<I>de3f0cdb<I>a<I>fd1b<I> | jenkinsci_jenkins | train | java |
212c1ee32c6ec7692f7492388e46145c44de7fbc | diff --git a/chef/lib/chef/platform.rb b/chef/lib/chef/platform.rb
index <HASH>..<HASH> 100644
--- a/chef/lib/chef/platform.rb
+++ b/chef/lib/chef/platform.rb
@@ -130,6 +130,7 @@ class Chef
pmap = Chef::Platform.find(platform, version)
rtkey = resource_type
if resource_type.kind_of?(Chef::Resource)
+ return resource_type.provider if resource_type.provider
rtkey = resource_type.resource_name.to_sym
end
if pmap.has_key?(rtkey) | If we have a specific provider for a resource, always use it. | chef_chef | train | rb |
9831652b7e4c91574f9edfc7ca008cca4e41839a | diff --git a/generator/src/lib/parsers.py b/generator/src/lib/parsers.py
index <HASH>..<HASH> 100644
--- a/generator/src/lib/parsers.py
+++ b/generator/src/lib/parsers.py
@@ -74,7 +74,10 @@ class SwaggerURLParser(object):
if response.status_code != 200:
Printer.raiseError("[HTTP %s] Could not access %s" % (response.status_code, schema_url))
- data = response.json()
+ try:
+ data = response.json()
+ except:
+ Printer.raiseError("Could not load properly json from %s" % schema_url)
if SWAGGER_APIS not in data:
Printer.raiseError("No apis information found at %s" % schema_url)
@@ -112,7 +115,11 @@ class SwaggerURLParser(object):
if response.status_code != 200:
Printer.raiseError("[HTTP %s] An error occured while retrieving %s at %s" % (response.status_code, resource_name, resource_path))
- results[resource_name] = response.json()
+ try:
+ results[resource_name] = response.json()
+ except:
+ Printer.raiseError("Could not load properly json from %s" % resource_path)
+
results[resource_name]['package'] = package | Added try/except to prevent malformed json | nuagenetworks_monolithe | train | py |
7c4383b12d1c2e3bd20e7dfaadf501a74a935d1c | diff --git a/rejected.py b/rejected.py
index <HASH>..<HASH> 100755
--- a/rejected.py
+++ b/rejected.py
@@ -384,12 +384,12 @@ class MasterControlProgram:
# Make sure the thread is still alive, otherwise remove it and move on
if not binding['threads'][x].isAlive():
- logging.error( 'MCP: Encountered a dead thread "%s"' % thread.getName() )
+ logging.error( 'MCP: Encountered a dead thread, removing.' )
dead_threads.append(x)
# Remove dead threads
for list_offset in dead_threads:
- logging.error( 'MCP: Removing the dead thread %s from the stack' % thread.getName() )
+ logging.error( 'MCP: Removing the dead thread from the stack' )
binding['threads'].pop(list_offset)
# If we don't have any consumer threads, remove the binding | Fix a bug in how we document dead threads | gmr_rejected | train | py |
13cd633d6e73a3ed343ba552764c15834fa61c65 | diff --git a/jicimagelib/image.py b/jicimagelib/image.py
index <HASH>..<HASH> 100644
--- a/jicimagelib/image.py
+++ b/jicimagelib/image.py
@@ -218,10 +218,6 @@ class ImageProxy(object):
def image(self):
"""Return image as numpy.ndarray."""
return Image.from_file(self.fpath)
-# tif = TIFF.open(self.fpath, 'r')
-# ar = tif.read_image()
-# tif.close()
-# return ar
class ImageCollection(list):
"""Class for storing related images.""" | Removed lines that were commented out. | JIC-CSB_jicimagelib | train | py |
dffa19354f3e55f8a4701c8ff24166ccdfc90174 | diff --git a/public/js/content.js b/public/js/content.js
index <HASH>..<HASH> 100644
--- a/public/js/content.js
+++ b/public/js/content.js
@@ -1,5 +1,4 @@
apos.widgetPlayers.facebook = function($el) {
-
// N.B. Even though this is a player, it's not getting refreshed
// once it's been created. Hrmmm.
@@ -7,10 +6,6 @@ apos.widgetPlayers.facebook = function($el) {
pageUrl = data.pageUrl;
$.getJSON(
- // Note the trailing ? is significant. It tells jQuery to automatically
- // create a JSONP callback function and obtain the result via a cross-domain
- // script tag so we can talk to twitter in older browsers without a
- // security error
'/apos-facebook/feed',
{
limit: (data.limit || 5),
@@ -132,9 +127,14 @@ apos.widgetPlayers.facebook = function($el) {
$posts.append($post);
});
removeTemplate();
+ apos.widgetPlayers.facebook.afterLoad($el, posts);
};
init();
}
);
}
+
+apos.widgetPlayers.facebook.afterLoad = function($el, posts){
+ //You can do whatever you want here.
+} | Updated to new afterLoader style | apostrophecms-legacy_apostrophe-facebook | train | js |
a0762ae03173c3e0d16924cc90c0a484a8d07ad5 | diff --git a/scripts/release_config.js b/scripts/release_config.js
index <HASH>..<HASH> 100644
--- a/scripts/release_config.js
+++ b/scripts/release_config.js
@@ -7,7 +7,7 @@ const _ = require("lodash")
const packagePath = path.join(__dirname, "../package.json")
const changeLogPath = path.join(__dirname, "../CHANGELOG.md")
-const parserPath = path.join(__dirname, "../lib/parser.js")
+const parserPath = path.join(__dirname, "../lib/regexp-to-ast.js")
const pkgJson = jf.readFileSync(packagePath)
const changeLogString = fs.readFileSync(changeLogPath, "utf8").toString() | Fix release script for new file name. | bd82_regexp-to-ast | train | js |
b1d98f7c9bf4a7adbf8051d691970a1bca86a478 | diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb
index <HASH>..<HASH> 100644
--- a/lib/capybara/session.rb
+++ b/lib/capybara/session.rb
@@ -331,7 +331,7 @@ module Capybara
new_scope = args.first.respond_to?(:to_capybara_node) ? args.first.to_capybara_node : find(*args)
begin
scopes.push(new_scope)
- yield
+ yield if block_given?
ensure
scopes.pop
end
@@ -413,7 +413,7 @@ module Capybara
def within_frame(*args)
switch_to_frame(_find_frame(*args))
begin
- yield
+ yield if block_given?
ensure
switch_to_frame(:parent)
end
@@ -514,7 +514,7 @@ module Capybara
end
begin
- yield
+ yield if block_given?
ensure
_switch_to_window(original) unless original == window_or_proc
end | within_* methods don't yield if no block given | teamcapybara_capybara | train | rb |
94fc61749913790b84e70563ebe0cf211a2b5dca | diff --git a/src/createDispatcher.js b/src/createDispatcher.js
index <HASH>..<HASH> 100644
--- a/src/createDispatcher.js
+++ b/src/createDispatcher.js
@@ -38,15 +38,7 @@ export default function createDispatcher(opts = {}) {
const cache = []
const state = []
- let scheduler
- switch (opts.scheduler) {
- case Scheduler.asap:
- case Scheduler.queue: {
- scheduler = opts.scheduler
- break
- }
- default: scheduler = Scheduler.asap
- }
+ const scheduler = opts.scheduler || Scheduler.asap
const logging = parseOpts(opts.logging)
if (logging.agendas) { | Allow any kind of Rx Scheduler | kitten_fluorine | train | js |
d8d946b2ad73db0001bcb2ab217aed405c263f60 | diff --git a/src/viewer/AusGlobeViewer.js b/src/viewer/AusGlobeViewer.js
index <HASH>..<HASH> 100644
--- a/src/viewer/AusGlobeViewer.js
+++ b/src/viewer/AusGlobeViewer.js
@@ -359,6 +359,12 @@ DrawExtentHelper.prototype.handleRegionStart = function (movement) {
this._mouseHandler.setInputAction(function (movement) {
that.handleRegionInter(movement);
}, ScreenSpaceEventType.MOUSE_MOVE, KeyboardEventModifier.SHIFT);
+ this._mouseHandler.setInputAction(function (movement) {
+ that.handleRegionStop(movement);
+ }, ScreenSpaceEventType.LEFT_UP);
+ this._mouseHandler.setInputAction(function (movement) {
+ that.handleRegionInter(movement);
+ }, ScreenSpaceEventType.MOUSE_MOVE);
}
}; | Fix hang during shift-drag-zooming.
Fixes #<I>. | TerriaJS_terriajs | train | js |
07ce413ce8dbb1476de5d34c2d1b8816d6aaf88c | diff --git a/ui/app/mixins/window-resizable.js b/ui/app/mixins/window-resizable.js
index <HASH>..<HASH> 100644
--- a/ui/app/mixins/window-resizable.js
+++ b/ui/app/mixins/window-resizable.js
@@ -2,7 +2,6 @@ import Mixin from '@ember/object/mixin';
import { run } from '@ember/runloop';
import { assert } from '@ember/debug';
import { on } from '@ember/object/evented';
-import $ from 'jquery';
export default Mixin.create({
windowResizeHandler() {
@@ -12,11 +11,11 @@ export default Mixin.create({
setupWindowResize: on('didInsertElement', function() {
run.scheduleOnce('afterRender', this, () => {
this.set('_windowResizeHandler', this.windowResizeHandler.bind(this));
- $(window).on('resize', this._windowResizeHandler);
+ window.addEventListener('resize', this._windowResizeHandler);
});
}),
removeWindowResize: on('willDestroyElement', function() {
- $(window).off('resize', this._windowResizeHandler);
+ window.removeEventListener('resize', this._windowResizeHandler);
}),
}); | Remove jquery from the window resize helper | hashicorp_nomad | train | js |
0ce67420500e62637e5aa0dfcd438d1ace407e3f | diff --git a/pytablewriter/writer/text/_markdown.py b/pytablewriter/writer/text/_markdown.py
index <HASH>..<HASH> 100644
--- a/pytablewriter/writer/text/_markdown.py
+++ b/pytablewriter/writer/text/_markdown.py
@@ -31,7 +31,7 @@ class MarkdownTableWriter(IndentationTextTableWriter):
return True
def __init__(self, **kwargs) -> None:
- self.__flavor = ""
+ self.__flavor = kwargs.pop("flavor", "").casefold()
super().__init__(**kwargs) | Made it possible to set flavor as a keyword argument of MarkdownTableWriter constructor | thombashi_pytablewriter | train | py |
b36164c7c78f345b97522565592625b310b39913 | diff --git a/src/rosasurfer/dao/PersistableObject.php b/src/rosasurfer/dao/PersistableObject.php
index <HASH>..<HASH> 100644
--- a/src/rosasurfer/dao/PersistableObject.php
+++ b/src/rosasurfer/dao/PersistableObject.php
@@ -102,7 +102,7 @@ abstract class PersistableObject extends Object {
* @return string - version
*/
protected function touch() {
- return $this->version = date('Y-m-d H:i:s');
+ return $this->version = gmDate('Y-m-d H:i:s');
} | initialize $version with GMT instead of local time | rosasurfer_ministruts | train | php |
0481ef25372200d55e4c7c561c7ea8d8ca156481 | diff --git a/core/file-tree/index.js b/core/file-tree/index.js
index <HASH>..<HASH> 100644
--- a/core/file-tree/index.js
+++ b/core/file-tree/index.js
@@ -221,7 +221,7 @@ var updateFileTree = module.exports.updateFileTree = function (data, unflattenDa
}, config.busyTimeout);
} else {
var prevData = {};
- var dataStoragePath = global.opts.core.api.specsData;
+ var dataStoragePath = path.join(global.pathToApp, global.opts.core.api.specsData);
callback = typeof callback === 'function' ? callback : function(){};
if (unflattenData) { | improve dataStoragePath resolving | sourcejs_Source | train | js |
3de7d3435de1af0d2e142185b12553aacc58fc42 | diff --git a/ev3dev/motor.py b/ev3dev/motor.py
index <HASH>..<HASH> 100644
--- a/ev3dev/motor.py
+++ b/ev3dev/motor.py
@@ -726,12 +726,20 @@ class Motor(Device):
return self.wait(lambda state: s not in state, timeout)
def _set_position_rotations(self, speed_pct, rotations):
+
+ # +/- speed is used to control direction, rotations must be positive
+ assert rotations >= 0, "rotations is %s, must be >= 0" % rotations
+
if speed_pct > 0:
self.position_sp = self.position + int(rotations * self.count_per_rot)
else:
self.position_sp = self.position - int(rotations * self.count_per_rot)
def _set_position_degrees(self, speed_pct, degrees):
+
+ # +/- speed is used to control direction, degrees must be positive
+ assert degrees >= 0, "degrees is %s, must be >= 0" % degrees
+
if speed_pct > 0:
self.position_sp = self.position + int((degrees * self.count_per_rot)/360)
else: | motor: assert to validate rotations and degrees | ev3dev_ev3dev-lang-python | train | py |
813f7f3c0f05889c90f3f49c990a88639972a0b9 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -9,10 +9,10 @@ _PACKAGES = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
_INSTALL_REQUIRES = [
'pylint>=1.3',
'pylint-celery>=0.3',
- 'pylint-django>=0.5',
- 'pylint-plugin-utils>=0.2.1',
+ 'pylint-django>=0.5.4',
+ 'pylint-plugin-utils>=0.2.2',
'pylint-common>=0.2.1',
- 'requirements-detector>=0.2.2',
+ 'requirements-detector>=0.3',
'setoptconf>=0.2.0',
'dodgy>=0.1.5',
'pyyaml', | Increasing required version of some dependencies | PyCQA_prospector | train | py |
b95cb2ece3e18640092b7be8f7732a427b7664e7 | diff --git a/src/JwtAuthGuard.php b/src/JwtAuthGuard.php
index <HASH>..<HASH> 100644
--- a/src/JwtAuthGuard.php
+++ b/src/JwtAuthGuard.php
@@ -2,7 +2,7 @@
namespace Irazasyed\JwtAuthGuard;
-use Tymon\JWTAuth\JWT;
+use Tymon\JWTAuth\JWTAuth;
use Illuminate\Http\Request;
use Illuminate\Auth\GuardHelpers;
use Illuminate\Contracts\Auth\Guard;
@@ -23,7 +23,7 @@ class JwtAuthGuard implements Guard
/**
* The JWT instance.
*
- * @var \Tymon\JWTAuth\JWT
+ * @var \Tymon\JWTAuth\JWTAuth
*/
protected $jwt;
@@ -37,11 +37,11 @@ class JwtAuthGuard implements Guard
/**
* Create a new authentication guard.
*
- * @param \Tymon\JWTAuth\JWT $jwt
+ * @param \Tymon\JWTAuth\JWTAuth $jwt
* @param \Illuminate\Contracts\Auth\UserProvider $provider
* @param \Illuminate\Http\Request $request
*/
- public function __construct(JWT $jwt, UserProvider $provider, Request $request)
+ public function __construct(JWTAuth $jwt, UserProvider $provider, Request $request)
{
$this->jwt = $jwt;
$this->provider = $provider; | Change dependency from JWT to JWTAuth to work with newer version | irazasyed_jwt-auth-guard | train | php |
15bbb28865fa1a259e4d61b85604dea1c5f2f249 | diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
index <HASH>..<HASH> 100644
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -1440,7 +1440,7 @@ class GroupBy(_GroupBy):
def rolling(self, *args, **kwargs):
"""
Return a rolling grouper, providing rolling
- functionaility per group
+ functionality per group
"""
from pandas.core.window import RollingGroupby
@@ -1451,7 +1451,7 @@ class GroupBy(_GroupBy):
def expanding(self, *args, **kwargs):
"""
Return an expanding grouper, providing expanding
- functionaility per group
+ functionality per group
"""
from pandas.core.window import ExpandingGroupby | DOC: small typo fix (#<I>) | pandas-dev_pandas | train | py |
cb14614c4bb4361611f269117e4eb7239923c0f2 | diff --git a/tests/unit/components/sl-chart-test.js b/tests/unit/components/sl-chart-test.js
index <HASH>..<HASH> 100755
--- a/tests/unit/components/sl-chart-test.js
+++ b/tests/unit/components/sl-chart-test.js
@@ -116,7 +116,7 @@ test( '"Options" property needs to be an object', function( assert ) {
try {
this.subject({
options: "string",
- series: testOptions
+ series: testSeries
});
} catch( error ) {
assertionThrown = true; | fixed wrong proptery assignment in unit tests | softlayer_sl-ember-components | train | js |
a48956e887ee6568d51d00ef5b00e9f6cdfd8e96 | diff --git a/middleware/protect.js b/middleware/protect.js
index <HASH>..<HASH> 100644
--- a/middleware/protect.js
+++ b/middleware/protect.js
@@ -6,7 +6,7 @@ function forceLogin(keycloak, request, response) {
var port = headerHost[1] || '';
var protocol = request.protocol;
- var redirectUrl = protocol + '://' + host + ( port === '' ? '' : ':' + port ) + request.url + '?auth_callback=1';
+ var redirectUrl = protocol + '://' + host + ( port === '' ? '' : ':' + port ) + request.originalUrl + '?auth_callback=1';
if ( request.session ) {
request.session.auth_redirect_uri = redirectUrl; | Changed redirect URL to use originalUrl instead of url as it was stripping the baseUrl | keycloak_keycloak-nodejs-connect | train | js |
035d1108375434d6a6bd909fa87c397231a81723 | diff --git a/discord/gateway.py b/discord/gateway.py
index <HASH>..<HASH> 100644
--- a/discord/gateway.py
+++ b/discord/gateway.py
@@ -293,10 +293,10 @@ class DiscordWebSocket:
def is_ratelimited(self):
return self._rate_limiter.is_ratelimited()
- def log_receive(self, data, /):
+ def debug_log_receive(self, data, /):
self._dispatch('socket_raw_receive', data)
- def empty_log_receive(self, _, /):
+ def log_receive(self, _, /):
pass
@classmethod
@@ -326,7 +326,7 @@ class DiscordWebSocket:
if client._enable_debug_events:
ws.send = ws.debug_send
- ws.log_receive = ws.empty_log_receive
+ ws.log_receive = ws.debug_log_receive
client._connection._update_references(ws) | Fix debug event toggle not triggering for raw receive | Rapptz_discord.py | train | py |
c15e90b9e3873b8729c330a81e98b11208433152 | diff --git a/src/Devture/Bundle/UserBundle/ServicesProvider.php b/src/Devture/Bundle/UserBundle/ServicesProvider.php
index <HASH>..<HASH> 100644
--- a/src/Devture/Bundle/UserBundle/ServicesProvider.php
+++ b/src/Devture/Bundle/UserBundle/ServicesProvider.php
@@ -158,7 +158,10 @@ class ServicesProvider implements ServiceProviderInterface {
$app->before(array($app['devture_user.access_control'], 'enforceProtection'));
$app->after($app['devture_user.listener.conditional_session_extender']);
- $app['twig.loader.filesystem']->addPath(dirname(__FILE__) . '/Resources/views/');
+ //Also register the templates path at a custom namespace, to allow templates overriding+extending.
+ $app['twig.loader.filesystem']->addPath(__DIR__ . '/Resources/views/');
+ $app['twig.loader.filesystem']->addPath(__DIR__ . '/Resources/views/', 'DevtureUserBundle');
+
$app['twig']->addExtension($app['devture_user.twig.user_extension']);
if (isset($app['console'])) { | Register templates at a custom namespace too
This makes it possible for a person to override a template
(by putting a directory on the path that matches it)
and to allow that same template to extend the original by doing:
{% extends '@DevtureUserBundle/DevtureUserBundle/template.html.twig' %}
That's a solution to the so-called: "Overriding a Template that also extends itself" problem | devture_silex-user-bundle | train | php |
b0adb138e72f8fb9db3b1a6c404116ee5a22a2e3 | diff --git a/glances/outputs/static/js/services/favicon.js b/glances/outputs/static/js/services/favicon.js
index <HASH>..<HASH> 100644
--- a/glances/outputs/static/js/services/favicon.js
+++ b/glances/outputs/static/js/services/favicon.js
@@ -1,13 +1,11 @@
import angular from "angular";
-import Favico from 'favico.js';
-
-export default angular.module('glancesApp').service('favicoService', favicoService);
+import Favico from "favico.js";
function favicoService () {
var favico = new Favico({
- animation: 'none'
+ animation: "none"
});
this.badge = function (nb) {
@@ -17,4 +15,6 @@ function favicoService () {
this.reset = function () {
favico.reset();
};
-}
\ No newline at end of file
+}
+
+export default angular.module("glancesApp").service("favicoService", favicoService); | on favicon.js, move the export default to the end and update simple quote to double quote | nicolargo_glances | train | js |
fb38ce76b7acaeaa180773b4eaf23c2cacb6ac27 | diff --git a/test/core/reporters/raw-env.js b/test/core/reporters/raw-env.js
index <HASH>..<HASH> 100644
--- a/test/core/reporters/raw-env.js
+++ b/test/core/reporters/raw-env.js
@@ -1,4 +1,3 @@
-/*global helpers */
describe('reporters - raw-env', function() {
'use strict';
@@ -133,9 +132,12 @@ describe('reporters - raw-env', function() {
if (err) {
return done(err);
}
- var env = helpers.getEnvironmentData();
assert.deepEqual(results.raw, rawResults);
- assert.deepEqual(results.env, env);
+ assert.isNotNull(results.env);
+ assert.isNotNull(results.env.url);
+ assert.isNotNull(results.env.timestamp);
+ assert.isNotNull(results.env.testEnvironement);
+ assert.isNotNull(results.env.testRunner);
done();
});
}); | test: fix flakey test (#<I>)
* test: fix flakey test
* copy test from v1 reporter | dequelabs_axe-core | train | js |
56e709e7545f8e3702a9633677b6dd62c13d493f | diff --git a/tang/src/main/java/com/microsoft/tang/StaticConfiguration.java b/tang/src/main/java/com/microsoft/tang/StaticConfiguration.java
index <HASH>..<HASH> 100644
--- a/tang/src/main/java/com/microsoft/tang/StaticConfiguration.java
+++ b/tang/src/main/java/com/microsoft/tang/StaticConfiguration.java
@@ -90,14 +90,25 @@ final public class StaticConfiguration {
public static final class BindNamedParameter implements BindInterface {
final Class<? extends Name<?>> name;
final String value;
+ final Class<?> impl;
public <T> BindNamedParameter(Class<? extends Name<T>> name, String value) {
this.name = name;
this.value = value;
+ this.impl = null;
+ }
+ public <T> BindNamedParameter(Class<? extends Name<T>> name, Class<T> impl) {
+ this.name = name;
+ this.impl = impl;
+ this.value = null;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void configure(ConfigurationBuilder cb) throws BindException {
- cb.bindNamedParameter((Class)name, value);
+ if(value != null) {
+ cb.bindNamedParameter((Class)name, value);
+ } else {
+ cb.bindNamedParameter((Class)name, (Class)impl);
+ }
}
}
public static final class BindConstructor implements BindInterface { | add static configuration constructor for named instances | apache_reef | train | java |
5a67b175f05962a50a225e94a1e8e2f9cdaf8831 | diff --git a/slimgen.py b/slimgen.py
index <HASH>..<HASH> 100755
--- a/slimgen.py
+++ b/slimgen.py
@@ -46,10 +46,12 @@ aba_map = {
def aba_trips(node_d):
output = []
parent = 'MBA:' + str(node_d['id']) # FIXME HRM what happens if we want to change ABA: OH LOOK
- for key, edge in aba_map.items():
+ for key, edge in sorted(aba_map.items()):
value = node_d[key]
if not value:
continue
+ elif key == 'safe_name' and value == node_d['name']:
+ continue # don't duplicate labels as synonyms
output.append( (parent, edge, value) )
return output | updated mbaslim gen to skip syns that match labs | tgbugs_pyontutils | train | py |
a82d06d3fbdd3c91f1929013dd0c77524f9d2f80 | diff --git a/pkg/apis/kops/validation/validation.go b/pkg/apis/kops/validation/validation.go
index <HASH>..<HASH> 100644
--- a/pkg/apis/kops/validation/validation.go
+++ b/pkg/apis/kops/validation/validation.go
@@ -1048,9 +1048,8 @@ func validateExternalPolicies(role string, policies []string, fldPath *field.Pat
func validateEtcdClusterSpec(spec kops.EtcdClusterSpec, c *kops.Cluster, fieldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
- if spec.Name == "" {
- allErrs = append(allErrs, field.Required(fieldPath.Child("name"), "etcdCluster did not have name"))
- }
+ allErrs = append(allErrs, IsValidValue(fieldPath.Child("name"), &spec.Name, []string{"cilium", "main", "events"})...)
+
if spec.Provider != "" {
value := string(spec.Provider)
allErrs = append(allErrs, IsValidValue(fieldPath.Child("provider"), &value, []string{string(kops.EtcdProviderTypeManager)})...) | Prevent creation of unsupported etcd clusters | kubernetes_kops | train | go |
3c96dc8d8c9b583db1ee8cff991a35ab6aea7875 | diff --git a/src/Page.php b/src/Page.php
index <HASH>..<HASH> 100755
--- a/src/Page.php
+++ b/src/Page.php
@@ -315,7 +315,8 @@ class Page extends Navigation implements PageInterface
*/
public function addBadge($value, \Closure $closure = null)
{
- $this->badge = app(BadgeInterface::class, [$value]);
+ $this->badge = app(BadgeInterface::class);
+ $this->badge->setValue($value);
if (is_callable($closure)) {
call_user_func($closure, $this->badge); | laravel <I> support | KodiComponents_Navigation | train | php |
d181885ed2387df558b311334a567f77ad773526 | diff --git a/lib/simple_calendar/view_helpers.rb b/lib/simple_calendar/view_helpers.rb
index <HASH>..<HASH> 100644
--- a/lib/simple_calendar/view_helpers.rb
+++ b/lib/simple_calendar/view_helpers.rb
@@ -38,9 +38,10 @@ module SimpleCalendar
end
def draw_calendar(selected_month, month, current_date)
+
tags = []
- content_tag(:table) do
+ content_tag(:table, :class => "table table-bordered table-striped") do
tags << content_tag(:thead, content_tag(:tr, I18n.t("date.abbr_day_names").collect { |name| content_tag :th, name}.join.html_safe))
@@ -55,13 +56,14 @@ module SimpleCalendar
content_tag(:td, :class => "day") do
content_tag(:div, :class => (Date.today == current_date ? "today" : nil)) do
+
date.day.to_s
- end #content_tag :div
+ end #content_tag :div
end #content_tag :td
- end.join.html_safe #week.collect
+ end.join.html_safe
end #content_tag :tr
- end.join.html_safe #month.collect
+ end.join.html_safe
end #content_tag :tbody
tags.join.html_safe
end #content_tag :table | added a few classes for twitterbootsrap | excid3_simple_calendar | train | rb |
8f3dae338c45136d29b4ba42aa4e035ebb5090d7 | diff --git a/structr-ui/src/main/java/org/structr/web/entity/mail/MailTemplate.java b/structr-ui/src/main/java/org/structr/web/entity/mail/MailTemplate.java
index <HASH>..<HASH> 100644
--- a/structr-ui/src/main/java/org/structr/web/entity/mail/MailTemplate.java
+++ b/structr-ui/src/main/java/org/structr/web/entity/mail/MailTemplate.java
@@ -51,7 +51,7 @@ public class MailTemplate extends AbstractNode {
public static final Property<String> locale = new StringProperty("locale");
public static final org.structr.common.View uiView = new org.structr.common.View(NewsTickerItem.class, PropertyView.Ui,
- type, name, text
+ type, name, text, locale
);
public static final org.structr.common.View publicView = new org.structr.common.View(NewsTickerItem.class, PropertyView.Public, | added locale Property to uiView | structr_structr | train | java |
1a6d4a2fc2cd2faee67ca177dae78c83d5ec300a | diff --git a/src/geo/ui/overlays-view.js b/src/geo/ui/overlays-view.js
index <HASH>..<HASH> 100644
--- a/src/geo/ui/overlays-view.js
+++ b/src/geo/ui/overlays-view.js
@@ -28,9 +28,7 @@ var OverlaysView = View.extend({
visView: this._visView
});
- this._visModel.on('change:loading', this._toggleLoaderOverlay, this);
-
- this._overlaysCollection.on('add remove change', this.render, this);
+ this._initBinds();
this.$el.append(overlayContainerTemplate());
},
@@ -41,6 +39,11 @@ var OverlaysView = View.extend({
return this;
},
+ _initBinds: function () {
+ this.listenTo(this._visModel, 'change:loading', this._toggleLoaderOverlay, this);
+ this.listenTo(this._overlaysCollection, 'add remove change', this.render, this);
+ },
+
_clearOverlays: function () {
while (this._overlayViews.length !== 0) {
this._overlayViews.pop().clean(); | Extract events to _initBinds | CartoDB_carto.js | train | js |
4fc8feeadfce274eb5bd0740dd2a5eac2debd1b0 | diff --git a/main.go b/main.go
index <HASH>..<HASH> 100644
--- a/main.go
+++ b/main.go
@@ -13,7 +13,7 @@ import (
type jsonOutput struct {
LayerCount int
- Vulnerabilities []clair.Vulnerability
+ Vulnerabilities map[string][]clair.Vulnerability
}
var priorities = []string{"Unknown", "Negligible", "Low", "Medium", "High", "Critical", "Defcon1"}
@@ -86,7 +86,9 @@ func main() {
os.Exit(1)
}
- var output = jsonOutput{}
+ output := jsonOutput{
+ Vulnerabilities: make(map[string][]clair.Vulnerability),
+ }
if len(image.FsLayers) == 0 {
fmt.Fprintf(os.Stderr, "Can't pull fsLayers\n")
@@ -105,7 +107,9 @@ func main() {
highSevNumber := len(store["High"]) + len(store["Critical"]) + len(store["Defcon1"])
if useJSONOutput {
- output.Vulnerabilities = vs
+ iteratePriorities(clairOutput, func(sev string) {
+ output.Vulnerabilities[sev] = store[sev]
+ })
enc := json.NewEncoder(os.Stdout)
enc.Encode(output)
} else { | support filtering vulnerabilities for json output | optiopay_klar | train | go |
2f4401a578c5b2175ecb301033bff7b7736fdc37 | diff --git a/bxml/__init__.py b/bxml/__init__.py
index <HASH>..<HASH> 100644
--- a/bxml/__init__.py
+++ b/bxml/__init__.py
@@ -1,2 +1,10 @@
+
import os
+from bl.dict import Dict
+from .xml import XML
+
+NS = Dict(**{
+ "bl": "http:blackearth.us/xml",
+})
+
JARS = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'jars')
\ No newline at end of file | include NS in bxml init | BlackEarth_bxml | train | py |
ae2c49b33f92e84040895301ff7547e46380ddf0 | diff --git a/ignite/metrics/frequency.py b/ignite/metrics/frequency.py
index <HASH>..<HASH> 100644
--- a/ignite/metrics/frequency.py
+++ b/ignite/metrics/frequency.py
@@ -15,7 +15,7 @@ class Frequency(Metric):
.. code-block:: python
# Compute number of tokens processed
- wps_metric = Frequency(output_transformer=lambda x: x['ntokens'])
+ wps_metric = Frequency(output_transform=lambda x: x['ntokens'])
wps_metric.attach(trainer, name='wps')
# Logging with TQDM
ProgressBar(persist=True).attach(trainer, metric_names=['wps']) | Update frequency.py (#<I>) | pytorch_ignite | train | py |
b2851a5e4bf5b7e5f66a19bcaef076305bdc6b8b | diff --git a/src/s2repoze/plugins/sp.py b/src/s2repoze/plugins/sp.py
index <HASH>..<HASH> 100644
--- a/src/s2repoze/plugins/sp.py
+++ b/src/s2repoze/plugins/sp.py
@@ -90,7 +90,7 @@ class SAML2Plugin(FormPluginBase):
self.outstanding_queries = shelve.open(sid_store, writeback=True)
else:
self.outstanding_queries = {}
- self.iam = platform.uname()
+ self.iam = platform.node()
def _pick_idp(self, environ, came_from):
""" | Should have used one or the other, ended up somewhere inbetween fixed that | IdentityPython_pysaml2 | train | py |
7dbbd0a22aefa16f189aeeb788dca67fd21c6e32 | diff --git a/lib/mongoid_nested_set/base.rb b/lib/mongoid_nested_set/base.rb
index <HASH>..<HASH> 100644
--- a/lib/mongoid_nested_set/base.rb
+++ b/lib/mongoid_nested_set/base.rb
@@ -94,7 +94,9 @@ module Mongoid
scope :leaves, lambda {
where("this.#{quoted_right_field_name} - this.#{quoted_left_field_name} == 1").asc(left_field_name)
}
- scope :with_depth, proc {|level| where(:depth => level).asc(left_field_name)}
+ scope :with_depth, lambda { |level|
+ where(:depth => level).asc(left_field_name)
+ }
define_callbacks :move, :terminator => "result == false"
end | Changed a proc to a lambda | thinkwell_mongoid_nested_set | train | rb |
ecbca9eb171b9a1f978b9676595db1dac181fa90 | diff --git a/pkg/apiserver/api_installer.go b/pkg/apiserver/api_installer.go
index <HASH>..<HASH> 100644
--- a/pkg/apiserver/api_installer.go
+++ b/pkg/apiserver/api_installer.go
@@ -320,9 +320,11 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
actions = appendIf(actions, action{"CONNECT", itemPath, nameParams, namer}, isConnecter)
actions = appendIf(actions, action{"CONNECT", itemPath + "/{path:*}", nameParams, namer}, isConnecter && connectSubpath)
- // list across namespace.
+ // list or post across namespace.
+ // TODO: more strongly type whether a resource allows these actions on "all namespaces" (bulk delete)
namer = scopeNaming{scope, a.group.Linker, gpath.Join(a.prefix, itemPath), true}
actions = appendIf(actions, action{"LIST", resource, params, namer}, isLister)
+ actions = appendIf(actions, action{"POST", resource, params, namer}, isCreater)
actions = appendIf(actions, action{"WATCHLIST", "watch/" + resource, params, namer}, allowWatchList)
} else { | Allow v1beta3 to POST events to all namespaces
A namespaced resource that supports ALL may allow creation
on the root (all namespaces) collection, thus adding POST
here.
We need to better formalize the definition of calls on namespaced
resources at the root scope, so Storage objects that do not support
that call pattern can do so at definition time and reject those
calls. | kubernetes_kubernetes | train | go |
2bba86f75d193ec9fcc9c86cbd656b133edba545 | diff --git a/packages/vaex-core/vaex/column.py b/packages/vaex-core/vaex/column.py
index <HASH>..<HASH> 100644
--- a/packages/vaex-core/vaex/column.py
+++ b/packages/vaex-core/vaex/column.py
@@ -74,9 +74,10 @@ class ColumnIndexed(Column):
self.dtype = self.df.dtype(name)
self.shape = (len(indices),)
self.masked = masked
- max_index = self.indices.max()
- if not np.ma.is_masked(max_index):
- assert max_index < self.df._length_original
+ # this check is too expensive
+ # max_index = self.indices.max()
+ # if not np.ma.is_masked(max_index):
+ # assert max_index < self.df._length_original
@staticmethod
def index(df, column, name, indices, direct_indices_map=None, masked=False): | perf(core): don't check the index on the indexed column | vaexio_vaex | train | py |
4403dfd5ebb2c5f78516c7a317ce5983ccbae975 | diff --git a/lib/plugins/sustainable/index.js b/lib/plugins/sustainable/index.js
index <HASH>..<HASH> 100644
--- a/lib/plugins/sustainable/index.js
+++ b/lib/plugins/sustainable/index.js
@@ -76,9 +76,6 @@ module.exports = {
'data',
'url2green.json'
);
- const greenDomainList = await tgwf.hosting.loadJSON(
- greenDomainJSONpath
- );
let hostingGreenCheck;
if (this.sustainableOptions.disableHosting === true) {
@@ -87,7 +84,10 @@ module.exports = {
hostingGreenCheck =
this.sustainableOptions.useGreenWebHostingAPI === true
? await tgwf.hosting.check(listOfDomains)
- : await tgwf.hosting.check(listOfDomains, greenDomainList);
+ : await tgwf.hosting.check(
+ listOfDomains,
+ await tgwf.hosting.loadJSON(greenDomainJSONpath)
+ );
}
const CO2 = new tgwf.co2();
const co2PerDomain = CO2.perDomain(message.data, hostingGreenCheck); | Only load the domain JSON when needed. (#<I>) | sitespeedio_sitespeed.io | train | js |
bc94d136ac6811fcbbfa0c1106b562f75f17131c | diff --git a/action/Request.php b/action/Request.php
index <HASH>..<HASH> 100644
--- a/action/Request.php
+++ b/action/Request.php
@@ -259,7 +259,7 @@ class Request extends \lithium\net\http\Request {
}
return false;
case 'SERVER_ADDR':
- if ($this->_env['SERVER_ADDR'] == '') {
+ if (empty($this->_env['SERVER_ADDR']) && !empty($this->_env['LOCAL_ADDR'])) {
return $this->_env['LOCAL_ADDR'];
}
return $this->_env['SERVER_ADDR']; | Updated to check if LOCAL_ADDR is set in the case that SERVER_ADDR isn't available. Present in IIS <I> | UnionOfRAD_lithium | train | php |
3792bc7df8f08cc68eb6acb841a9f2db9cb57095 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ except ImportError:
setup(
name='apns2',
- version='0.1.3',
+ version='0.2.0',
packages=['apns2'],
install_requires=dependencies,
url='https://github.com/Pr0Ger/PyAPNs2', | version bump -> <I> | Pr0Ger_PyAPNs2 | train | py |
a6abe1f6fca3b5d6a12ffe0fe51bd0fd8880bb57 | diff --git a/rdopkg/utils/cmd.py b/rdopkg/utils/cmd.py
index <HASH>..<HASH> 100644
--- a/rdopkg/utils/cmd.py
+++ b/rdopkg/utils/cmd.py
@@ -54,7 +54,9 @@ def run(cmd, *params, **kwargs):
print_output = kwargs.get('print_output', False)
env = kwargs.get('env', None)
- cmd = [cmd] + list(params)
+ cmd = [cmd]
+ cmd.extend(p if isinstance(p, six.string_types) else six.text_type(p)
+ for p in params)
cmd_str = ' '.join(cmd)
if log_cmd: | Fix #<I>: pkgenv fails with TypeError
When we run rdopkg pkgenv we get:
TypeError: sequence item 7: expected string or Unicode, int found
That happens because one of the params to the command is an integer,
which will fail on the join method call.
This patch ensure that all the params are strings.
Change-Id: Id<I>dc6d<I>c1e2b<I>d<I>af<I>dc<I> | softwarefactory-project_rdopkg | train | py |
75698ff6e64d0d4bd2ae4c992304eb85e10ee495 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -7,13 +7,13 @@ with open('README.rst', 'r', 'utf-8') as f:
setup(
name = 'requests-aws4auth',
packages = ['requests-aws4auth'],
- version = '0.2',
+ version = '0.3',
description = 'Amazon Web Services version 4 authentication for the Python requests module',
long_description = readme,
author = 'Sam Washington',
author_email = 'samwashington@aethris.net',
url = 'https://github.com/sam-washington/requests-aws4auth',
- download_url = 'https://github.com/sam-washington/requests-aws4auth/tarball/0.2',
+ download_url = 'https://github.com/sam-washington/requests-aws4auth/tarball/0.3',
license = 'MIT License',
keywords = ['requests', 'auth', 'authentication', 'amazon', 'amazon web services' 'aws' 's3', 'amazon s3', 'web', 'REST', 'REST API', 'HTTP'],
classifiers = [ | Updated setup.py for <I> | sam-washington_requests-aws4auth | train | py |
afa5d40a2b9ebea8e7485c0686a96957a8c1f883 | diff --git a/app/controllers/subject_types_controller.rb b/app/controllers/subject_types_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/subject_types_controller.rb
+++ b/app/controllers/subject_types_controller.rb
@@ -1,6 +1,5 @@
class SubjectTypesController < InheritedResources::Base
respond_to :html, :xml
- before_filter :check_client_ip_address
def update
@subject_type = SubjectType.find(params[:id]) | removed check_client_ip_address | next-l_enju_subject | train | rb |
1a5d10d613b8973a75f44397378d769c79a71171 | diff --git a/lib/Form/Processor/ContentTypeFormProcessor.php b/lib/Form/Processor/ContentTypeFormProcessor.php
index <HASH>..<HASH> 100644
--- a/lib/Form/Processor/ContentTypeFormProcessor.php
+++ b/lib/Form/Processor/ContentTypeFormProcessor.php
@@ -167,9 +167,9 @@ class ContentTypeFormProcessor implements EventSubscriberInterface
*/
private function resolveNewFieldDefinitionIdentifier(
ContentTypeDraft $contentTypeDraft,
- int $startIndex,
- string $fieldTypeIdentifier
- ): string {
+ $startIndex,
+ $fieldTypeIdentifier
+ ) {
$fieldDefinitionIdentifiers = array_column($contentTypeDraft->getFieldDefinitions(), 'identifier');
do { | [PHP] Fixes compatibility issues with PHP <I> caused by 5ed6bb8 | ezsystems_repository-forms | train | php |
fe527c7235753611ebbd6407545dafab00d3c066 | diff --git a/lib/auth.strategies/oauth/oauth.js b/lib/auth.strategies/oauth/oauth.js
index <HASH>..<HASH> 100644
--- a/lib/auth.strategies/oauth/oauth.js
+++ b/lib/auth.strategies/oauth/oauth.js
@@ -39,7 +39,7 @@ module.exports= function(options) {
my['authorize_url']= options['authorize_url'] || '/oauth/authorize';
my['access_token_url']= options['access_token_url'] || '/oauth/access_token';
my['oauth_protocol']= options['oauth_protocol'] || 'http';
- my['realm']= options['realm'] || 'realm';
+ my['realm']= options['realm'] || 'oauth';
my['realm']= my['realm'].replace("\"","\\\"");
my['authenticate_provider']= options['authenticate_provider']; | Change default realm for OAuth to 'oauth'
The documentation comment says the default realm is 'oauth', but the
default code was setting it to the string 'realm'. To harmonize the
two, I used the more descriptive 'oauth'. | ciaranj_connect-auth | train | js |
efeecabee8c03b28a33f06e2d2e142985954eab1 | diff --git a/tasks/run.js b/tasks/run.js
index <HASH>..<HASH> 100644
--- a/tasks/run.js
+++ b/tasks/run.js
@@ -60,7 +60,7 @@ function makeTask(grunt) {
return;
}
- if (!opts.itterable && _.find(process.argv, 'run')) {
+ if (!opts.itterable && _.contains(process.argv, 'run')) {
grunt.log.warn('Skipping run:' + this.target + ' since it not itterable. Call it directly or from another task.');
return;
} | _.find doesn't do what I thought | spalger_grunt-run | train | js |
fb44356354ddbda00e7d0ff6e645d8fede754f81 | diff --git a/openxc/src/main/java/com/openxc/measurements/SteeringWheelAngle.java b/openxc/src/main/java/com/openxc/measurements/SteeringWheelAngle.java
index <HASH>..<HASH> 100644
--- a/openxc/src/main/java/com/openxc/measurements/SteeringWheelAngle.java
+++ b/openxc/src/main/java/com/openxc/measurements/SteeringWheelAngle.java
@@ -12,7 +12,7 @@ import com.openxc.util.Range;
public class SteeringWheelAngle extends Measurement<Degree>
implements VehicleMeasurement {
private final static Range<Degree> RANGE =
- new Range<Degree>(new Degree(-400), new Degree(400));
+ new Range<Degree>(new Degree(-508), new Degree(508));
public final static String ID = "steering_wheel_angle";
public SteeringWheelAngle() { } | Define a wider range for the steering wheel angle. | openxc_openxc-android | train | java |
7a52cad1284f0947cbc35cf9f2f48d0b432a720e | diff --git a/server/workers/pe_deep_sim.py b/server/workers/pe_deep_sim.py
index <HASH>..<HASH> 100644
--- a/server/workers/pe_deep_sim.py
+++ b/server/workers/pe_deep_sim.py
@@ -10,7 +10,7 @@ def plugin_info():
class PEDeepSim():
def __init__(self):
- self.c = zerorpc.Client()
+ self.c = zerorpc.Client(timeout=300)
self.c.connect("tcp://127.0.0.1:4242")
def execute(self, input_data): | just increasing the timeout; hopefully when batch jobs go to generators all timeouts can be removed
Former-commit-id: d<I>bb<I>c<I>aa<I>f<I>c<I>cda8a<I>a<I> | SuperCowPowers_workbench | train | py |
a40213968586e58156749b3c87552cf7eacf9eea | diff --git a/lib/mongo/uri.rb b/lib/mongo/uri.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo/uri.rb
+++ b/lib/mongo/uri.rb
@@ -155,7 +155,7 @@ module Mongo
UNIX = /\/.+.sock?/
# server Regex: capturing, matches host and port server or unix server
- serverS = /((?:(?:#{HOSTPORT}|#{UNIX}),?)+)/
+ SERVERS = /((?:(?:#{HOSTPORT}|#{UNIX}),?)+)/
# Database Regex: matches anything but the characters that cannot
# be part of any MongoDB database name.
@@ -166,7 +166,7 @@ module Mongo
OPTIONS = /(?:\?(?:(.+=.+)&?)+)*/
# Complete URI Regex: matches all of the combined components
- URI = /#{SCHEME}#{CREDENTIALS}#{serverS}#{DATABASE}#{OPTIONS}/
+ URI = /#{SCHEME}#{CREDENTIALS}#{SERVERS}#{DATABASE}#{OPTIONS}/
# Hash for storing map of URI option parameters to conversion strategies
OPTION_MAP = {} | Fix find-and-replace oversight in uri parser | mongodb_mongo-ruby-driver | train | rb |
1cb31093ddf37ca509bc02a2ed0f246a2a42f7f4 | diff --git a/go/client/ui.go b/go/client/ui.go
index <HASH>..<HASH> 100644
--- a/go/client/ui.go
+++ b/go/client/ui.go
@@ -483,8 +483,8 @@ func NewLoginUI(t libkb.TerminalUI, noPrompt bool) LoginUI {
}
func (l LoginUI) GetEmailOrUsername(_ context.Context, _ int) (string, error) {
- return PromptWithChecker(PromptDescriptorLoginUsername, l.parent, "Your keybase username or email", false,
- libkb.CheckEmailOrUsername)
+ return PromptWithChecker(PromptDescriptorLoginUsername, l.parent, "Your keybase username", false,
+ libkb.CheckUsername)
}
func (l LoginUI) PromptRevokePaperKeys(_ context.Context, arg keybase1.PromptRevokePaperKeysArg) (bool, error) { | Change GetEmailOrUsername prompt to just username
This is temporary, but for now, only allowing login via
username. The Checker changed to just username as well.
No protocol changes.
CORE-<I> addresses fixing this so that login via email
address works again. | keybase_client | train | go |
bfab7201b36a9c26d788da92f0233959c176fbc5 | diff --git a/server/storage/rethinkdb_models.go b/server/storage/rethinkdb_models.go
index <HASH>..<HASH> 100644
--- a/server/storage/rethinkdb_models.go
+++ b/server/storage/rethinkdb_models.go
@@ -12,7 +12,7 @@ const (
)
var (
- // TufFilesRethinkTable is the table definition of notary server's TUF metadata files
+ // TUFFilesRethinkTable is the table definition of notary server's TUF metadata files
TUFFilesRethinkTable = rethinkdb.Table{
Name: RDBTUFFile{}.TableName(),
PrimaryKey: "gun_role_version", | Changed the comment inconsistency that caused last circleci build to fail | theupdateframework_notary | train | go |
64065db2c45a3fcb8ba3b94059ff249141645e6d | diff --git a/pyArango/tests/tests.py b/pyArango/tests/tests.py
index <HASH>..<HASH> 100644
--- a/pyArango/tests/tests.py
+++ b/pyArango/tests/tests.py
@@ -789,7 +789,6 @@ class pyArangoTests(unittest.TestCase):
TTLInd2 = pers.ensureTTLIndex(["name3"], 897345)
self.assertTrue(TTLInd.infos["id"] != hashInd.infos["id"])
-
ftInd = pers.ensureFulltextIndex(["Description"])
ftInd.delete()
ftInd2 = pers.ensureFulltextIndex(["Description"]) | whitespace change, maybe travis triggers this time? | ArangoDB-Community_pyArango | train | py |
5a84a666857c389048f86f2d879a375f8578231d | diff --git a/spinoff/contrib/filetransfer/fileref.py b/spinoff/contrib/filetransfer/fileref.py
index <HASH>..<HASH> 100644
--- a/spinoff/contrib/filetransfer/fileref.py
+++ b/spinoff/contrib/filetransfer/fileref.py
@@ -55,7 +55,7 @@ class FileRef(object):
os.path.exists(dst_path) and
reasonable_get_mtime(dst_path) == self.mtime and
os.path.getsize(dst_path) == self.size):
- return
+ return dst_path
ret = None
# local | Made FileRef.fetch be consistent about returning the path of the downloaded (or cached) file | eallik_spinoff | train | py |
8c9bb7a215c2add07c378860dd5ef4e1198fe3da | diff --git a/pkg/services/sqlstore/playlist_test.go b/pkg/services/sqlstore/playlist_test.go
index <HASH>..<HASH> 100644
--- a/pkg/services/sqlstore/playlist_test.go
+++ b/pkg/services/sqlstore/playlist_test.go
@@ -3,7 +3,6 @@
package sqlstore
import (
- "fmt"
"testing"
"github.com/grafana/grafana/pkg/models"
@@ -61,8 +60,10 @@ func TestPlaylistDataAccess(t *testing.T) {
}
for _, tc := range testCases {
- err := DeletePlaylist(&tc.cmd)
- require.EqualError(t, err, models.ErrCommandValidationFailed.Error(), fmt.Sprintf("expected command validation error for %q", tc.desc))
+ t.Run(tc.desc, func(t *testing.T) {
+ err := DeletePlaylist(&tc.cmd)
+ require.EqualError(t, err, models.ErrCommandValidationFailed.Error())
+ })
}
})
} | playlist: Improve test (#<I>)
* playlist: Improve test | grafana_grafana | train | go |
28f63046d1ccac006740b65f6a62570f79bcdd50 | diff --git a/src/Obj.js b/src/Obj.js
index <HASH>..<HASH> 100644
--- a/src/Obj.js
+++ b/src/Obj.js
@@ -60,7 +60,26 @@ function keepObjectUpdated(src, dest = {}) {
return dest;
}
-function observedAssign(args) {
+// Combine objects a la `Object.assign`, but also for subobjects.
+function nestedAssign(...args) {
+ return args.reduce(
+ (ret, arg) => {
+ keys(arg).forEach(
+ k => {
+ var val = arg[k];
+ if (k in ret && typeof ret[k] === 'object' && val &&typeof val === 'object') {
+ Object.assign(ret[k], val);
+ } else {
+ ret[k] = val;
+ }
+ });
+ return ret;
+ },
+ {}
+ );
+}
+
+function observingAssign(args) {
} | Initial work on nestedAssign. | rtm_upward | train | js |
1d4185b844dd22718562fcfe77d3ad785aa2c8fa | diff --git a/src/Composer/DependencyResolver/SolverProblemsException.php b/src/Composer/DependencyResolver/SolverProblemsException.php
index <HASH>..<HASH> 100644
--- a/src/Composer/DependencyResolver/SolverProblemsException.php
+++ b/src/Composer/DependencyResolver/SolverProblemsException.php
@@ -66,6 +66,10 @@ class SolverProblemsException extends \RuntimeException
$text .= "\nUse the option --with-all-dependencies to allow updates and removals for packages currently locked to specific versions.";
}
+ if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match') && strpos($text, '- ocramius/package-versions')) {
+ $text .= "\n<warning>ocramius/package-versions only provides support for Composer 2 in 1.8+, which requires PHP 7.4.</warning>\nIf you can not upgrade PHP you can require <info>composer/package-versions-deprecated</info> to resolve this with PHP 7.0+.\n";
+ }
+
// TODO remove before 2.0 final
if (!class_exists('PHPUnit\Framework\TestCase', false)) {
if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match')) { | Recommend ocramius/package-versions fork if needed to solve dependencies | composer_composer | train | php |
24b9110a629053c0517563a4ae3ed7f2033c2c28 | diff --git a/src/main.js b/src/main.js
index <HASH>..<HASH> 100644
--- a/src/main.js
+++ b/src/main.js
@@ -64,10 +64,15 @@ var request = function (method, url, data, contentType, headers) {
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
- if (xhr.status >= 200 && xhr.status < 300) {
- resolve(xhr.responseText ? JSON.parse(xhr.responseText) : null);
- } else {
- reject(xhr.responseText ? JSON.parse(xhr.responseText) : null);
+ try {
+ var response = xhr.responseText ? JSON.parse(xhr.responseText) : null;
+ if (xhr.status >= 200 && xhr.status < 300) {
+ resolve(response);
+ } else {
+ reject(response);
+ }
+ } catch (e) {
+ reject(e);
}
} | Fixed uncaught exception on parsing non-JSON AJAX response | formsy_formsy-react | train | js |
4ea051aeb3df0fa0f6212d8dff5e4e6f9e6a682c | diff --git a/lib/mongo/collection/view/readable.rb b/lib/mongo/collection/view/readable.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo/collection/view/readable.rb
+++ b/lib/mongo/collection/view/readable.rb
@@ -137,7 +137,9 @@ module Mongo
cmd[:hint] = options[:hint] if options[:hint]
cmd[:limit] = options[:limit] if options[:limit]
cmd[:maxTimeMS] = options[:max_time_ms] if options[:max_time_ms]
- database.command(cmd, options).n
+ read_with_retry do
+ database.command(cmd, options).n
+ end
end
# Get a list of distinct values for a specific field.
@@ -160,7 +162,9 @@ module Mongo
:key => field_name.to_s,
:query => selector }
cmd[:maxTimeMS] = options[:max_time_ms] if options[:max_time_ms]
- database.command(cmd, options).first['values']
+ read_with_retry do
+ database.command(cmd, options).first['values']
+ end
end
# The index that MongoDB will be forced to use for the query. | Retry for count and distinct commands if there is a connection error. | mongodb_mongo-ruby-driver | train | rb |
bf0c1a84637ae17c24400644cf459fc72921ed90 | diff --git a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
index <HASH>..<HASH> 100644
--- a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
+++ b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
@@ -251,6 +251,8 @@ public class SolidityFunctionWrapper extends Generator {
private Iterable<FieldSpec> buildFuncNameConstants(List<MethodSpec> methodSpecs) {
List<FieldSpec> fields = new ArrayList<>();
Set<String> fieldNames = new HashSet<>();
+ fieldNames.add(Contract.FUNC_DEPLOY);
+
for (MethodSpec method : methodSpecs) {
if (!fieldNames.contains(method.name)) {
FieldSpec field = FieldSpec.builder(String.class, | prevent duplication of FUNC_DEPLOY | web3j_web3j | train | java |
9143d9f886d98857a8b256e6e35d00e3f3adda1b | diff --git a/lib/honey_format/columns.rb b/lib/honey_format/columns.rb
index <HASH>..<HASH> 100644
--- a/lib/honey_format/columns.rb
+++ b/lib/honey_format/columns.rb
@@ -23,10 +23,8 @@ module HoneyFormat
def build_columns(header, valid)
header.map do |column|
- Sanitize.string!(column)
- validate_column_presence!(column)
-
column = @converter.call(column)
+ validate_column_presence!(column)
validate_column_name!(column, valid)
column | Remove unneeded call to Sanitize::string! | buren_honey_format | train | rb |
bda476c7098a54548558b1c060a8d4661f0daa81 | diff --git a/src/extension/Connection.php b/src/extension/Connection.php
index <HASH>..<HASH> 100644
--- a/src/extension/Connection.php
+++ b/src/extension/Connection.php
@@ -56,7 +56,7 @@ interface ConnectionInterface extends Helper\AccessableInterface {
*
* @return Expression
*/
- public function expression( string $definition, $context = null ): Expression;
+ public function expression( string $definition, $context = [] ): Expression;
/**
* Execute statement(s) on the database
@@ -228,7 +228,7 @@ abstract class Connection implements ConnectionInterface {
const CHARACTER_DATA_NAME = '!';
//
- public function expression( string $definition, $context = null ): Expression {
+ public function expression( string $definition, $context = [] ): Expression {
return new Expression( $this, $definition, $context );
}
//
diff --git a/src/extension/Expression.php b/src/extension/Expression.php
index <HASH>..<HASH> 100644
--- a/src/extension/Expression.php
+++ b/src/extension/Expression.php
@@ -26,7 +26,7 @@ class Expression {
* @param string $definition
* @param array|null $context
*/
- public function __construct( ConnectionInterface $connection, string $definition, $context = null ) {
+ public function __construct( ConnectionInterface $connection, string $definition, $context = [] ) {
$this->_connection = $connection;
$this->_definition = $definition; | Fix a minor bug when the `Expression`'s context `null` by default (but it's can't be) | spoom-php_sql | train | php,php |
07ff5b2d801e7511626095886d88a220a8156081 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,6 @@
# coding: utf-8
-from distutils.core import setup
+from setuptools import setup
+from setuptools import find_packages
setup(name='yandex.translate',
@@ -10,7 +11,7 @@ setup(name='yandex.translate',
license="DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE",
keywords="yandex yandex-translate translate",
url="https://github.com/tyrannosaurus/python-yandex-translate",
- packages=['yandex_translate'],
+ packages=find_packages(),
package_dir={'yandex_translate': 'yandex_translate'},
provides=['yandex_translate'],
classifiers=[ | Upgrade setup script to use Setuptools/Distribute. | dveselov_python-yandex-translate | 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.