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
a855d4ddf6b622e4fef51a1fcbe7f96f584675e6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ license: GNU-GPL2 from setuptools import setup setup(name='pyprofiler', - version='37', + version='38', description='Profiler utility for python, graphical and textual, whole program or segments', url='https://github.com/erikdejonge/pyprofiler', author='Erik de Jonge',
pip Thursday <I> April <I> (week:<I> day:<I>), <I>:<I>:<I>
erikdejonge_pyprofiler
train
py
48e04b0d8068af322c36d53c2f4861fa297e6cf4
diff --git a/src/gform-app/cms/createValueFactory.js b/src/gform-app/cms/createValueFactory.js index <HASH>..<HASH> 100644 --- a/src/gform-app/cms/createValueFactory.js +++ b/src/gform-app/cms/createValueFactory.js @@ -18,7 +18,7 @@ define([], function () { }, createPartial: function (templateStore) { var template = this._createTemplate(); - template.group.attributes.push(this._createNameAttribute()); + //template.group.attributes.push(this._createNameAttribute()); return template; },
partial does not need to have a name
stemey_gform-app
train
js
307d5c5a0d6234ae2515e60e03c1cbf8e91ff06d
diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js index <HASH>..<HASH> 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js @@ -93,7 +93,7 @@ function replace(path, node, scope, remaps) { let ownBinding = scope.getBindingIdentifier(node.name); if (ownBinding === remap.binding) { - node.name = remap.uid; + scope.rename(node.name, remap.uid); } else { // scope already has it's own binding that doesn't // match the one we have a stored replacement for
rename scope bindings during block scope transform
babel_babel
train
js
dde4ca18e546091acb3fb190f562905b9d1a026c
diff --git a/pymatgen/io/core.py b/pymatgen/io/core.py index <HASH>..<HASH> 100644 --- a/pymatgen/io/core.py +++ b/pymatgen/io/core.py @@ -46,9 +46,9 @@ class InputFile(MSONable): with open(filename, "wt") as f: f.write(self.__str__()) - @staticmethod + @classmethod @abc.abstractmethod - def from_string(contents): + def from_string(cls, contents: str): """ Create an InputFile object from a string
InputFile: from_string as classmethod
materialsproject_pymatgen
train
py
1286d38db9a7846ebaf9d0a8b87ea1a51a5cbf78
diff --git a/setuptools/tests/config/downloads/__init__.py b/setuptools/tests/config/downloads/__init__.py index <HASH>..<HASH> 100644 --- a/setuptools/tests/config/downloads/__init__.py +++ b/setuptools/tests/config/downloads/__init__.py @@ -1,5 +1,7 @@ import re +import time from pathlib import Path +from urllib.error import HTTPError from urllib.request import urlopen __all__ = ["DOWNLOAD_DIR", "retrieve_file", "output_file", "urls_from_file"] @@ -21,14 +23,18 @@ def output_file(url: str, download_dir: Path = DOWNLOAD_DIR): return Path(download_dir, re.sub(r"[^\-_\.\w\d]+", "_", file_name)) -def retrieve_file(url: str, download_dir: Path = DOWNLOAD_DIR): +def retrieve_file(url: str, download_dir: Path = DOWNLOAD_DIR, wait: float = 5): path = output_file(url, download_dir) if path.exists(): print(f"Skipping {url} (already exists: {path})") else: download_dir.mkdir(exist_ok=True, parents=True) print(f"Downloading {url} to {path}") - download(url, path) + try: + download(url, path) + except HTTPError: + time.sleep(wait) # wait a few seconds and try again. + download(url, path) return path
Try to rescue the download backing off a few seconds
pypa_setuptools
train
py
e30b9748a31f736cda806fc7354dd69924ba0b9c
diff --git a/test/db/hsqldb.rb b/test/db/hsqldb.rb index <HASH>..<HASH> 100644 --- a/test/db/hsqldb.rb +++ b/test/db/hsqldb.rb @@ -7,6 +7,7 @@ ActiveRecord::Base.establish_connection(config) at_exit { # Clean up hsqldb when done - Dir['test.db*'].each {|f| File.delete(f)} - File.delete('hsqldb-testdb.log') rescue nil #can't delete on windows + require "fileutils" + Dir['test.db*'].each {|f| FileUtils.rm_rf(f)} + FileUtils.rm_rf('hsqldb-testdb.log') rescue nil #can't delete on windows }
Small tweak to the way hsqldb is cleaned up to be compatible with <I>
jruby_activerecord-jdbc-adapter
train
rb
b22f146f6445d62e340c3b75ff971d7baf76c6c7
diff --git a/lib/vcap/request.rb b/lib/vcap/request.rb index <HASH>..<HASH> 100644 --- a/lib/vcap/request.rb +++ b/lib/vcap/request.rb @@ -8,8 +8,7 @@ module VCAP end def current_id - Thread.current[:vcap_request_id] or - raise 'No request id is set' + Thread.current[:vcap_request_id] end end end diff --git a/spec/unit/request_spec.rb b/spec/unit/request_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/request_spec.rb +++ b/spec/unit/request_spec.rb @@ -22,10 +22,8 @@ module VCAP end context "when it hasn't been set" do - it 'raises an exception' do - expect { - described_class.current_id - }.to raise_error('No request id is set') + it 'returns nil' do + described_class.current_id.should be_nil end end end
Don't raise exception when request id is unset [#<I>]
cloudfoundry_vcap-common
train
rb,rb
ffa75f08979c742a6ddad1197d992181bd1308ea
diff --git a/lib/memfs/file.rb b/lib/memfs/file.rb index <HASH>..<HASH> 100644 --- a/lib/memfs/file.rb +++ b/lib/memfs/file.rb @@ -337,11 +337,7 @@ module MemFs end def world_writable? - if (entry.mode & Fake::Entry::OWRITE).nonzero? - entry.mode - else - nil - end + entry.mode if (entry.mode & Fake::Entry::OWRITE).nonzero? end def sticky?
Simplifying Stat.world_writable?
simonc_memfs
train
rb
d750c186a3000eab327f6fce91767a38ff168d6e
diff --git a/tests/frontend/org/voltdb/canonicalddl/TestCanonicalDDLThroughSQLcmd.java b/tests/frontend/org/voltdb/canonicalddl/TestCanonicalDDLThroughSQLcmd.java index <HASH>..<HASH> 100644 --- a/tests/frontend/org/voltdb/canonicalddl/TestCanonicalDDLThroughSQLcmd.java +++ b/tests/frontend/org/voltdb/canonicalddl/TestCanonicalDDLThroughSQLcmd.java @@ -145,7 +145,7 @@ public class TestCanonicalDDLThroughSQLcmd extends AdhocDDLTestBase { private int callSQLcmd(String ddl, boolean fastModeDDL) throws Exception { String commandPath = "bin/sqlcmd"; - final long timeout = 300000; // 300,000 millis -- give up after 5 minutes of trying. + final long timeout = 600000; // 600,000 millis -- give up after 10 minutes of trying. File f = new File("ddl.sql"); f.deleteOnExit(); @@ -173,7 +173,7 @@ public class TestCanonicalDDLThroughSQLcmd extends AdhocDDLTestBase { long elapsedtime = 0; long pollcount = 0; do { - Thread.sleep(1000); + Thread.sleep(2000); try { int exitValue = process.exitValue(); // Only verbosely report the successful exit after verbosely reporting a delay.
testCanonicalDDLRoundtrip waits longer for success
VoltDB_voltdb
train
java
6050de05282ee9fccbd12ac7145f206f62e66454
diff --git a/v3/buildpacks_test.go b/v3/buildpacks_test.go index <HASH>..<HASH> 100644 --- a/v3/buildpacks_test.go +++ b/v3/buildpacks_test.go @@ -63,11 +63,11 @@ var _ = Describe("buildpack", func() { }) It("Stages with a user specified github buildpack", func() { - StageBuildpackPackage(packageGuid, "http://github.com/cloudfoundry/go-buildpack") + StageBuildpackPackage(packageGuid, "http://github.com/cloudfoundry/ruby-buildpack") Eventually(func() *Session { return FetchRecentLogs(appGuid, token, config) - }, 3*time.Minute, 10*time.Second).Should(Say("Godep")) + }, 3*time.Minute, 10*time.Second).Should(Say("Compiling Ruby/Rack")) }) It("uses buildpack cache for staging", func() {
Use correct buildpack for pushing dora
cloudfoundry_cf-acceptance-tests
train
go
b234a8adb9b7f094655e26ad43356f2cdffc6cb7
diff --git a/collab/CollabClient.js b/collab/CollabClient.js index <HASH>..<HASH> 100644 --- a/collab/CollabClient.js +++ b/collab/CollabClient.js @@ -41,9 +41,9 @@ class CollabClient extends EventEmitter { */ _onMessage(msg) { if (msg.scope === this.scope) { - this.emit('message', msg) - } else { - console.info('Message ignored. Not sent in hub scope', msg) + this.emit('message', msg); + } else if (msg.scope !== '_internal') { + console.info('Message ignored. Not sent in hub scope', msg); } }
Don't warn about the `{type: "highfive", scope: "_internal"}` message This message is sent by the `CollabServer`. This change simply removes the distracting console warning every <I>s. I'm not sure that this is the best way to deal with this long term.
substance_substance
train
js
96cfdc3d572f79efba92a7b0dccc5e4fdcab08ff
diff --git a/lib/AuthHelper.php b/lib/AuthHelper.php index <HASH>..<HASH> 100644 --- a/lib/AuthHelper.php +++ b/lib/AuthHelper.php @@ -28,8 +28,11 @@ class AuthHelper else { $protocol = 'http'; } + + $url = $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $url = false !== ($qsPos = strpos($url, '?')) ? substr($url, 0, $qsPos) : $url; // remove query params - return "$protocol://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + return $url; } /**
Remove query params from current url
phpclassic_php-shopify
train
php
07837a41e18c7d818b32002513ef21ddb3f7e2c2
diff --git a/ella/db/models.py b/ella/db/models.py index <HASH>..<HASH> 100644 --- a/ella/db/models.py +++ b/ella/db/models.py @@ -35,21 +35,15 @@ class Publishable(Model): current_site = Site.objects.get_current() - try: - # TODO: what if have got multiple listings on one site? - placements = get_cached_list( - Placement, - target_ct=ContentType.objects.get_for_model(self.__class__), - target_id=self.pk, - category__site=current_site, + # TODO: what if have got multiple listings on one site? + placements = get_cached_list( + Placement, + target_ct=ContentType.objects.get_for_model(self.__class__), + target_id=self.pk, + category__site=current_site, ) - if len(placements): - self._main_placement = placements[0] - else: - self._main_placement = None - return self._main_placement - except Placement.DoesNotExist: - self._main_placement = None + if placements: + return placements[0] try: # TODO - check and if we don't have category, take the only placement that exists in current site @@ -59,7 +53,6 @@ class Publishable(Model): target_id=self.pk, category=self.category_id ) - return self._main_placement except Placement.DoesNotExist: self._main_placement = None
Updated publishable.main_placement to work for placements on other sites git-svn-id: <URL>
ella_ella
train
py
c1ecc9c9b9e8f42fdf0b0a5da2ae57aec561928b
diff --git a/extensions/gii/generators/crud/Generator.php b/extensions/gii/generators/crud/Generator.php index <HASH>..<HASH> 100644 --- a/extensions/gii/generators/crud/Generator.php +++ b/extensions/gii/generators/crud/Generator.php @@ -67,7 +67,7 @@ class Generator extends \yii\gii\Generator [['modelClass'], 'validateClass', 'params' => ['extends' => BaseActiveRecord::className()]], [['baseControllerClass'], 'validateClass', 'params' => ['extends' => Controller::className()]], [['controllerClass'], 'match', 'pattern' => '/Controller$/', 'message' => 'Controller class name must be suffixed with "Controller".'], - [['controllerClass'], 'match', 'pattern' => '/[A-Z0-9][^\\]+Controller$/', 'message' => 'Controller class name must start with an uppercase letter.'], + [['controllerClass'], 'match', 'pattern' => '/(^|\\\\)[A-Z0-9][^\\\\]+Controller$/', 'message' => 'Controller class name must start with an uppercase letter.'], [['controllerClass', 'searchModelClass'], 'validateNewClass'], [['indexWidgetType'], 'in', 'range' => ['grid', 'list']], [['modelClass'], 'validateModelClass'],
Fixed regex-escaping in crudgenerator
yiisoft_yii-core
train
php
65fe7db8b36b4c306d7f9a4a8f0836564eecf7c4
diff --git a/src/Manager.php b/src/Manager.php index <HASH>..<HASH> 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -51,7 +51,7 @@ class Manager extends Plugin $boundModel = call_user_func_array( [$className, "findFirst"], [ - $parameters + $parameters, ] ); @@ -105,7 +105,7 @@ class Manager extends Plugin $count = call_user_func_array( [$className, "count"], [ - $parameters + $parameters, ] ); @@ -193,7 +193,7 @@ class Manager extends Plugin return [ "conditions" => $conditions, - "bind" => $bind + "bind" => $bind, ]; } }
Added trailing commas to arrays
SidRoberts_phalcon-boundmodels
train
php
3be7fca768303f8e293e89f2869bb7c1d70ca741
diff --git a/lib/negroku/cli.rb b/lib/negroku/cli.rb index <HASH>..<HASH> 100644 --- a/lib/negroku/cli.rb +++ b/lib/negroku/cli.rb @@ -3,7 +3,7 @@ require 'capistrano/setup' require 'capistrano/deploy' # Load applications deploy config if it exists -require './config/deploy' if File.exists? "./config/deploy" +require './config/deploy' if File.exists? "./config/deploy.rb" require 'gli' require 'inquirer'
fix(): load deploy.rb file when file exist
platanus_negroku
train
rb
bd00a91f29c795ea28eb9446e15a64b6ff923f0a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ except ImportError: from setup_libuv import libuv_build_ext, libuv_sdist -__version__ = "0.10.1" +__version__ = "0.11.0-dev" setup(name = "pyuv", version = __version__,
Set version to <I>-dev on master
saghul_pyuv
train
py
8d7f5195df193c1ded5bf0879ad241faeada85db
diff --git a/app/helpers/tenon/tenon_helper.rb b/app/helpers/tenon/tenon_helper.rb index <HASH>..<HASH> 100644 --- a/app/helpers/tenon/tenon_helper.rb +++ b/app/helpers/tenon/tenon_helper.rb @@ -61,17 +61,6 @@ module Tenon end end - # form row helper for boolean published block - def publish_box(f, object) - if can?(:publish, object) - content = [ - f.check_box(:published, class: 'tn-checkbox-right'), - f.super_label(:published, 'Published?') - ].join(' ').html_safe - content_tag(:div, content, class: 'form-group inline') - end - end - def i18n_language_nav(table) if Tenon.config.languages && I18nLookup.fields[:tables][table] render 'tenon/shared/i18n_language_nav'
remove the published boolean form helper
factore_tenon
train
rb
10e81b4b3fe4216d4c1b0f66ce1fedaf56ac9954
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ except (IOError, ImportError) as e: setup( name='cutil', packages=['cutil'], - version='2.6.6', + version='2.6.7', description='A collection of useful functions', long_description=long_description, author='Eddy Hintze', @@ -26,7 +26,7 @@ setup( "Topic :: Utilities", ], install_requires=['hashids', - 'psycopg2-binary', + 'psycopg2', 'pytz', ] )
Just use psycopg2 and not the binary
xtream1101_cutil
train
py
2a8d8590f1ee9e42e839e4cd948d5d2f69d44c76
diff --git a/application/geomajas-gwt-example/src/main/java/org/geomajas/example/gwt/client/samples/editing/EditLineLayerSample.java b/application/geomajas-gwt-example/src/main/java/org/geomajas/example/gwt/client/samples/editing/EditLineLayerSample.java index <HASH>..<HASH> 100644 --- a/application/geomajas-gwt-example/src/main/java/org/geomajas/example/gwt/client/samples/editing/EditLineLayerSample.java +++ b/application/geomajas-gwt-example/src/main/java/org/geomajas/example/gwt/client/samples/editing/EditLineLayerSample.java @@ -103,7 +103,7 @@ public class EditLineLayerSample extends SamplePanel { } public String[] getConfigurationFiles() { - return new String[] { "WEB-INF/editing/mapEditLineLayer.xml", "WEB-INF/layerGoogleSat.xml", + return new String[] { "WEB-INF/mapEditLineLayer.xml", "WEB-INF/layerGoogleSat.xml", "WEB-INF/layerRoadsTrl020.xml" }; }
GWTSHOW-<I> : View Source on edit line layer sample is broken
geomajas_geomajas-project-client-gwt2
train
java
d292e75b746bc98359e5c0ac5cdec80cbec991be
diff --git a/packages/components/bolt-carousel/__tests__/carousel.js b/packages/components/bolt-carousel/__tests__/carousel.js index <HASH>..<HASH> 100644 --- a/packages/components/bolt-carousel/__tests__/carousel.js +++ b/packages/components/bolt-carousel/__tests__/carousel.js @@ -9,7 +9,7 @@ import { const { readYamlFileSync } = require('@bolt/build-tools/utils/yaml'); const { join } = require('path'); -const timeout = 60000; +const timeout = 120000; const viewportSizes = [ {
test: retest carousel Jest tests with increased timeout
bolt-design-system_bolt
train
js
2d2e147c521231a81801c9acb00530869c3254f8
diff --git a/spec/features/bitpay_plugin_spec.rb b/spec/features/bitpay_plugin_spec.rb index <HASH>..<HASH> 100644 --- a/spec/features/bitpay_plugin_spec.rb +++ b/spec/features/bitpay_plugin_spec.rb @@ -39,7 +39,7 @@ feature "Bitpay Plugin", js: true, type: :feature do end - scenario "can display invoice" do + xscenario "can display invoice" do user = create(:user_with_addreses) shipping_method = create(:free_shipping_method, name: "Satoshi Post") product = create(:base_product, name: "BitPay T-Shirt")
Disable false positive integration test until corrected
bitpay_spree-bitpay
train
rb
fb751475194f245033db2646f1092f646f4c8f4b
diff --git a/app/assets/javascripts/admin/views/forms/markdown_composer.js b/app/assets/javascripts/admin/views/forms/markdown_composer.js index <HASH>..<HASH> 100644 --- a/app/assets/javascripts/admin/views/forms/markdown_composer.js +++ b/app/assets/javascripts/admin/views/forms/markdown_composer.js @@ -41,6 +41,7 @@ var MarkdownComposerViewController = Backbone.View.extend({ $("body").removeClass("-modal-open"); this.$fullscreenButtonLabel.html("Fullscreen"); this.$fullscreenButtonIcon.removeClass("icon-compress").addClass("icon-arrows-alt"); + this.$textarea.focus(); } },
Focus the composer after collapsing
Threespot_tolaria
train
js
d8d2be315ca384b9f4d282b6a46195f5b6dd7a1c
diff --git a/twitcher/middleware.py b/twitcher/middleware.py index <HASH>..<HASH> 100644 --- a/twitcher/middleware.py +++ b/twitcher/middleware.py @@ -1,6 +1,6 @@ from webob import Request -from twitcher.owsexceptions import OWSServiceNotAllowed +from twitcher.owsexceptions import OWSException, OWSServiceNotAllowed from twitcher.owsrequest import OWSRequest import logging @@ -27,8 +27,13 @@ class OWSSecurityMiddleware(object): self.request = Request(environ) self.ows_request = OWSRequest(self.request) if self.is_route_path_protected(): - self.validate_ows_service() - self.validate_ows_request() + try: + self.validate_ows_service() + self.validate_ows_request() + except OWSException as e: + return e(environ, start_response) + except Exception,e: + return [e] else: logger.warn('unprotected access')
fixed usage of owsexceptions in middleware
bird-house_twitcher
train
py
2e290c3b3ed6ea01b833cb7e2500daf29630680a
diff --git a/lib/octopress-deploy.rb b/lib/octopress-deploy.rb index <HASH>..<HASH> 100644 --- a/lib/octopress-deploy.rb +++ b/lib/octopress-deploy.rb @@ -87,12 +87,12 @@ FILE if !File.exist?(gitignore) || Pathname.new(gitignore).read.match(/#{@options[:config_file]}/i).nil? if ask_bool("Do you want to add #{@options[:config_file]} to your .gitignore?") - append_gitignore + gitignore_config_file end end end - def self.append_gitignore + def self.gitignore_config_file File.open('.gitignore', 'ab') { |f| f.write(@options[:config_file]) } end
append_gitignore is now renamed to gitignore_config_file because @parkr cares about people understanding code.
octopress_deploy
train
rb
b1e8536bf5bed0033eaadfde5575d2079665bee1
diff --git a/service/routes/public/authorization.js b/service/routes/public/authorization.js index <HASH>..<HASH> 100644 --- a/service/routes/public/authorization.js +++ b/service/routes/public/authorization.js @@ -11,10 +11,11 @@ exports.register = function (server, options, next) { server.route({ method: 'GET', - path: '/authorization/check/{userId}/{action}/{resource*}', + path: '/authorization/access/{userId}/{action}/{resource*}', handler: function (request, reply) { const { organizationId } = request.udaru const { resource, action, userId } = request.params + const params = { userId, action, @@ -39,7 +40,7 @@ exports.register = function (server, options, next) { } }, description: 'Authorize user action against a resource', - notes: 'The GET /authorization/check/{userId}/{action}/{resource} endpoint returns is a user can perform and action\non a resource\n', + notes: 'The GET /authorization/check/{userId}/{action}/{resource} endpoint returns if a user can perform and action\non a resource\n', tags: ['api', 'service', 'authorization'] } })
renamed check to access as authoriztion endpoint
nearform_udaru
train
js
959db30ddd39bb61affe26bd88676d62f9e759fd
diff --git a/html5lib/constants.py b/html5lib/constants.py index <HASH>..<HASH> 100644 --- a/html5lib/constants.py +++ b/html5lib/constants.py @@ -467,6 +467,7 @@ booleanAttributes = { "details": frozenset(("open",)), "datagrid": frozenset(("multiple", "disabled")), "command": frozenset(("hidden", "disabled", "checked", "default")), + "hr": frozenset(("noshade")), "menu": frozenset(("autosubmit",)), "fieldset": frozenset(("disabled", "readonly")), "option": frozenset(("disabled", "readonly", "selected")),
Add @noshade as a boolean attribute. Fixes #<I>. Thanks to fantasai for the patch.
html5lib_html5lib-python
train
py
7027b75b7a0872d6e5a4dcb9df26aeb37953d04c
diff --git a/test/utils.py b/test/utils.py index <HASH>..<HASH> 100644 --- a/test/utils.py +++ b/test/utils.py @@ -547,6 +547,7 @@ class VtGate(object): '-log_dir', environment.vtlogroot, '-srv_topo_cache_ttl', cache_ttl, '-tablet_protocol', protocols_flavor().tabletconn_protocol(), + '-stderrthreshold', get_log_level(), ] if l2vtgates: args.extend([
test: utils.py: Set -stderrthreshold for vtgate. After this change, test runs with -v will show the vtgate Go logs.
vitessio_vitess
train
py
459ea2bcfe19c8d49aa6bb0717a2000ae0f5f225
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -292,6 +292,19 @@ function testSuite(Model){ childO.arr.push("a"); assert.throws(function(){ childO.arr.push(false); }, /TypeError/, "child array model catches push calls"); assert.throws(function(){ childO.arr[0] = 1; }, /TypeError/, "child array model catches set index"); + + var N = Model({ x: Number, y: [Number] }).defaults({ x: 5, y: 7 }); + Arr = Model.Array(N); + a = Arr([ { x:9 } ]); + assert.ok(a[0] instanceof N, "test automatic model casting with array init 1/2") + assert.equal(a[0].x * a[0].y, 63, "test automatic model casting with array init 2/2") + a.push({ x: 3 }); + assert.ok(a[1] instanceof N, "test automatic model casting with array mutator method 1/2") + assert.equal(a[1].x * a[1].y, 21, "test automatic model casting with array mutator method 2/2") + a[0] = { x: 10 }; + assert.ok(a[0] instanceof N, "test automatic model casting with array set index 1/2") + assert.equal(a[0].x * a[0].y, 70, "test automatic model casting with array set index 2/2"); + }); QUnit.test("Function models", function(assert){
added tests for automatic casting on arrays
sylvainpolletvillard_ObjectModel
train
js
1d5ca7117ab8debbc1074a827260daa8f2fccff0
diff --git a/src/Deployer/Task/DeployTasks.php b/src/Deployer/Task/DeployTasks.php index <HASH>..<HASH> 100644 --- a/src/Deployer/Task/DeployTasks.php +++ b/src/Deployer/Task/DeployTasks.php @@ -16,6 +16,7 @@ class DeployTasks extends TaskAbstract { const TASK_INITIALIZE = 'deploy:initialize'; const TASK_ROLLBACK = 'rollback'; // Overwriting the existing one + const TASK_LINKCACHETOOL = 'link:cachetool'; public static function register() {
[FIX] Add missing TASK for deploytask
netz98_n98-deployer
train
php
6c2ad8ea6dadfecb3b9f120d314668c696589236
diff --git a/src/test/java/de/codecentric/jbehave/junit/monitoring/LoggerTest.java b/src/test/java/de/codecentric/jbehave/junit/monitoring/LoggerTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/de/codecentric/jbehave/junit/monitoring/LoggerTest.java +++ b/src/test/java/de/codecentric/jbehave/junit/monitoring/LoggerTest.java @@ -21,6 +21,7 @@ public class LoggerTest { @Before public void setup() { + System.clearProperty(Logger.PROP_JJM_LOGLEVEL); logger = new Logger(); MockitoAnnotations.initMocks(this); logger.logStream = stream;
Test was failing at first. Apparently in some random test order (from infinitest?), the system property was set to a value that enabled logging. Now unsetting the property in the test setup.
valfirst_jbehave-junit-runner
train
java
e8678b38acc898f0756fdf8875d6661c3020b87f
diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index <HASH>..<HASH> 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -1831,7 +1831,7 @@ class Model extends Overloadable { )); } - if ($db->delete($this)) { + if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) { if (!empty($this->belongsTo)) { $this->updateCounterCache($keys[$this->alias]); }
Adding specific conditions to model->delete's call to dbo->delete. This helps fix a race condition where dbo->defaultConditions could cause additional data loss. Fixes #<I>
cakephp_cakephp
train
php
a855707c63a067233b464d465374c056adfa8efe
diff --git a/cmd/pulsectl/plugin.go b/cmd/pulsectl/plugin.go index <HASH>..<HASH> 100644 --- a/cmd/pulsectl/plugin.go +++ b/cmd/pulsectl/plugin.go @@ -46,6 +46,7 @@ func unloadPlugin(ctx *cli.Context) { r := pClient.UnloadPlugin(pName, pVer) if r.Err != nil { fmt.Printf("Error unloading plugin:\n%v\n", r.Err.Error()) + os.Exit(1) } fmt.Println("Plugin unloaded")
Add exit call when error thrown unloading plugin
intelsdi-x_snap
train
go
b49d8aecac66b2eaf0fa898555ca61a9d54703b8
diff --git a/src/components/colorlegend/colorlegend.js b/src/components/colorlegend/colorlegend.js index <HASH>..<HASH> 100644 --- a/src/components/colorlegend/colorlegend.js +++ b/src/components/colorlegend/colorlegend.js @@ -147,6 +147,7 @@ var ColorLegend = Component.extend({ //Hide rainbow element if showing minimap or if color is discrete //TODO: indocators-properties are incorrectly used here. this.rainbowEl.classed("vzb-hidden", canShowMap || this.colorModel.use !== "indicator"); + this.rainbowLegendEl.classed("vzb-hidden", canShowMap || this.colorModel.use !== "indicator"); //Hide minimap if no data to draw it this.minimapEl.classed("vzb-hidden", !canShowMap);
Fixed color anchors appearing when color is a property #<I>
vizabi_vizabi
train
js
0f1177987fb6ecc9dcbcc9d02d071e3ddab430d9
diff --git a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalySTLTransform.java b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalySTLTransform.java index <HASH>..<HASH> 100644 --- a/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalySTLTransform.java +++ b/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalySTLTransform.java @@ -38,8 +38,6 @@ import com.salesforce.dva.argus.system.SystemAssert; import java.util.*; -import com.sun.org.apache.xerces.internal.util.SynchronizedSymbolTable; -import org.apache.commons.math3.distribution.*; /** * Created by vmuruganantham on 7/13/16.
Remove unused vendor specific imports. (#<I>)
salesforce_Argus
train
java
1022f69da4ee5d2511045402e3c4bbf40595b0d5
diff --git a/libkbfs/cr_actions.go b/libkbfs/cr_actions.go index <HASH>..<HASH> 100644 --- a/libkbfs/cr_actions.go +++ b/libkbfs/cr_actions.go @@ -658,14 +658,22 @@ func (dua *dropUnmergedAction) updateOps(unmergedMostRecent BlockPointer, unmergedMostRecent) } + found := false for i, op := range unmergedChain.ops { if op == dua.op { unmergedChain.ops = append(unmergedChain.ops[:i], unmergedChain.ops[i+1:]...) + found = true break } } + // Return early if this chain didn't contain the op; no need to + // invert on the merged chain in that case. + if !found { + return nil + } + invertedOp := invertOpForLocalNotifications(dua.op) err := prependOpsToChain(mergedMostRecent, mergedChains, invertedOp) if err != nil {
cr: when dropping an action, only invert locally on one chain Some actions get their updates applied on both the parent and the node itself, and we don't want the inversions appearing multiple times. Issue: KBFS-<I>
keybase_client
train
go
ecb56565a162d106dbc9722270b6f346ef3b69a7
diff --git a/spec/support/macros/deprecation.rb b/spec/support/macros/deprecation.rb index <HASH>..<HASH> 100644 --- a/spec/support/macros/deprecation.rb +++ b/spec/support/macros/deprecation.rb @@ -1,18 +1,9 @@ require "active_support" -module SilenceDeprecation - def silence_deprecation(example) - cached_silenced = FactoryBot::Deprecation.silenced - FactoryBot::Deprecation.silenced = true - example.run - FactoryBot::Deprecation.silenced = cached_silenced - end -end - RSpec.configure do |config| - config.include SilenceDeprecation - config.around :example, silence_deprecation: true do |example| - silence_deprecation(example) + with_temporary_assignment(FactoryBot::Deprecation, :silenced, true) do + example.run + end end end
Use temporary assignment helper to silence deprecations in specs
thoughtbot_factory_bot
train
rb
67741b768697f18990bdbffc7f3649b56e2b4563
diff --git a/process/plugin/plugin.go b/process/plugin/plugin.go index <HASH>..<HASH> 100644 --- a/process/plugin/plugin.go +++ b/process/plugin/plugin.go @@ -140,7 +140,7 @@ func (p Plugin) Launch(proc charm.Process) (ProcDetails, error) { // Destroy runs the given plugin, passing it the "destroy" command, with the id of the // process to destroy as an argument. // -// <plugin> destroy <id> +// <plugin> destroy <id> func (p Plugin) Destroy(id string) error { _, err := p.run("destroy", id) return errors.Trace(err)
don't mix tabs and spaces!
juju_juju
train
go
6c289df07779367ca0f174b7775a76478c640e06
diff --git a/filesystem/disk/disk.go b/filesystem/disk/disk.go index <HASH>..<HASH> 100644 --- a/filesystem/disk/disk.go +++ b/filesystem/disk/disk.go @@ -4,11 +4,10 @@ import "os" // IsExist return true if file or directory exists func IsExist(path string) bool { - _, err := os.Stat(path) - if err != nil && os.IsNotExist(err) { - return false + if _, err := os.Stat(path); err == nil { + return true } - return true + return false } // IsDir return true if directory exists
fix/refactor disk IsExist
goatcms_goatcore
train
go
d34004f72722a5a02af978d112fe34339d39347f
diff --git a/phy/plot/_vispy_utils.py b/phy/plot/_vispy_utils.py index <HASH>..<HASH> 100644 --- a/phy/plot/_vispy_utils.py +++ b/phy/plot/_vispy_utils.py @@ -210,19 +210,17 @@ class BaseSpikeVisual(_BakeVisual): def cluster_colors(self, value): self._cluster_colors = _as_array(value) assert len(self._cluster_colors) == self.n_clusters - self.set_to_bake('color') + self.set_to_bake('cluster_color') # Data baking # ------------------------------------------------------------------------- - # TODO: rename to _bake_cluster_color - - def _bake_color(self): + def _bake_cluster_color(self): u_cluster_color = self.cluster_colors.reshape((1, self.n_clusters, -1)) u_cluster_color = (u_cluster_color * 255).astype(np.uint8) # TODO: more efficient to update the data from an existing texture self.program['u_cluster_color'] = gloo.Texture2D(u_cluster_color) - debug("bake color", u_cluster_color.shape) + debug("bake cluster color", u_cluster_color.shape) #------------------------------------------------------------------------------
Renamed color bake to cluster color.
kwikteam_phy
train
py
90bd351b8be5e98fa840461384c65154332a960e
diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index <HASH>..<HASH> 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -29,7 +29,9 @@ abstract class ArchiveDownloader extends FileDownloader public function download(PackageInterface $package, $path, PackageInterface $prevPackage = null, $output = true) { $res = parent::download($package, $path, $prevPackage, $output); - if (is_dir($path) && !$this->filesystem->isDirEmpty($path)) { + + // if not downgrading and the dir already exists it seems we have an inconsistent state in the vendor dir and the user should fix it + if (!$prevPackage && is_dir($path) && !$this->filesystem->isDirEmpty($path)) { throw new IrrecoverableDownloadException('Expected empty path to extract '.$package.' into but directory exists: '.$path); }
Allow downgrades to go through even though the target dir for archive extraction exists
composer_composer
train
php
b2876d9b126fa30a17f9459511a6293c37a2802b
diff --git a/tests/dlkit/json_/test_utilities.py b/tests/dlkit/json_/test_utilities.py index <HASH>..<HASH> 100644 --- a/tests/dlkit/json_/test_utilities.py +++ b/tests/dlkit/json_/test_utilities.py @@ -4,6 +4,7 @@ import codecs import glob import json import os +import shutil import unittest from dlkit.json_.utilities import MyIterator,\ @@ -112,7 +113,7 @@ class TestJSONClientValidated(unittest.TestCase): @classmethod def tearDownClass(cls): - pass + shutil.rmtree(cls._get_test_store_path(cls.mgr._provider_manager._runtime)) def test_can_save_json_file(self): test_doc = {'_id': '123', 'foo': 'bar'}
clean up after json client tests
mitsei_dlkit
train
py
103b2a9bcc404434dcc75678de07645d1c6cf67f
diff --git a/src/browser/extension/inject/pageScript.js b/src/browser/extension/inject/pageScript.js index <HASH>..<HASH> 100644 --- a/src/browser/extension/inject/pageScript.js +++ b/src/browser/extension/inject/pageScript.js @@ -82,7 +82,7 @@ window.devToolsExtension = function(next) { doChange(); timeout.last = Date.now(); } - else timeout.id = setTimeout(doChange, timeoutValue); + else timeout.id = setTimeout(() => { doChange(); timeout.last = Date.now(); }, timeoutValue); } }
Prevent relaying store changes consecutively
zalmoxisus_redux-devtools-extension
train
js
c0ab8871c4e5d187e5998325b9515bf304d4d25e
diff --git a/app/assets/javascripts/lentil/addfancybox.js b/app/assets/javascripts/lentil/addfancybox.js index <HASH>..<HASH> 100644 --- a/app/assets/javascripts/lentil/addfancybox.js +++ b/app/assets/javascripts/lentil/addfancybox.js @@ -81,6 +81,7 @@ function addfancybox() { autoSize : true, fitToView: true, minWidth : 250, + scrolling : 'no', type: 'html', helpers : { title : { type : 'inside' }, @@ -91,7 +92,7 @@ function addfancybox() { var img = $(this.element).children(".instagram-img"); if($(img).attr("data-media-type") === "video") { - this.content = '<video class="fancybox-video" controls="controls" height="100%" width="90%" src="' + this.href + '" oncanplay="$.fancybox.update()"></video>'; + this.content = '<video class="fancybox-video" controls="controls" height="100%" width="100%" src="' + this.href + '" oncanplay="$.fancybox.update()"></video>'; } else { this.content = '<img class="fancybox-img" src="' + this.href + '" onload="$.fancybox.update()"/>'; }
Disable scrolling, fix issue for small video modals
NCSU-Libraries_lentil
train
js
28f65e1f5e5d681f2e2bd5cd5d7ec7bc88816f6e
diff --git a/trace/opentracing.go b/trace/opentracing.go index <HASH>..<HASH> 100644 --- a/trace/opentracing.go +++ b/trace/opentracing.go @@ -163,6 +163,8 @@ type Span struct { *Trace + recordErr error + // These are currently ignored logLines []opentracinglog.Field } @@ -196,7 +198,7 @@ func (s *Span) FinishWithOptions(opts opentracing.FinishOptions) { // TODO remove the name tag from the slice of tags - s.Record(s.Name, s.Tags) + s.recordErr = s.Record(s.Name, s.Tags) } func (s *Span) Context() opentracing.SpanContext { diff --git a/trace/trace.go b/trace/trace.go index <HASH>..<HASH> 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -203,11 +203,7 @@ func (t *Trace) Record(name string, tags map[string]string) error { span := t.SSFSpan() span.Tags[NameKey] = name - err := sendSample(span) - if err != nil { - logrus.WithError(err).Error("Error submitting sample") - } - return err + return sendSample(span) } func (t *Trace) Error(err error) {
Remove logged error with record * We already return the error value, so there's no need to log it as * well
stripe_veneur
train
go,go
78aad3de23d85871d3341e27495105d9220a2664
diff --git a/mtgsdk/querybuilder.py b/mtgsdk/querybuilder.py index <HASH>..<HASH> 100644 --- a/mtgsdk/querybuilder.py +++ b/mtgsdk/querybuilder.py @@ -89,7 +89,38 @@ class QueryBuilder(object): break return list + + def iter(self): + """Gets all resources, automating paging through data + Returns: + iterable of object: Iterable of resource objects + """ + + page = 1 + fetch_all = True + url = "{}/{}".format(__endpoint__, self.type.RESOURCE) + + if 'page' in self.params: + page = self.params['page'] + fetch_all = False + + while True: + response = RestClient.get(url, self.params)[self.type.RESOURCE] + if len(response) > 0: + for item in response: + yield self.type(item) + + if not fetch_all: + break + else: + page += 1 + self.where(page=page) + else: + break + + return + def array(self): """Get all resources and return the result as an array
Iterable query Now has an iter function for better memory usage.
MagicTheGathering_mtg-sdk-python
train
py
9bd0c7da2e8533422d5bc9c26cd9011a4a3bd4dc
diff --git a/spec/unit/parser/functions/lookup_spec.rb b/spec/unit/parser/functions/lookup_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/parser/functions/lookup_spec.rb +++ b/spec/unit/parser/functions/lookup_spec.rb @@ -3,6 +3,10 @@ require 'puppet/pops' require 'stringio' describe "lookup function" do + before(:each) do + Puppet[:binder] = true + end + it "must be called with at least a name to lookup" do scope = scope_with_injections_from(bound(bindings))
(#<I>) Fix failing lookup function test (missing setting of --binder) The lookup function test was missing because the setting --binder was missing, and lookup only works when this feature is turned on).
puppetlabs_puppet
train
rb
83915ec01bddc50334d5b52a2a994450e5352593
diff --git a/pronto/parser/owl.py b/pronto/parser/owl.py index <HASH>..<HASH> 100644 --- a/pronto/parser/owl.py +++ b/pronto/parser/owl.py @@ -148,6 +148,9 @@ class OwlXMLTreeParser(OwlXMLParser): for elem in itertools.islice(rawterm.iter(), 1, None): basename = elem.tag.split('}', 1)[-1] + if elem.text is not None: + elem.text = elem.text.strip() + if elem.text: _rawterms[-1][basename].append(elem.text) elif elem.get(RDF_RESOURCE) is not None:
Prevent OwlXMLTreeParser from adding empty data to Term.other
althonos_pronto
train
py
8ef300cce3550e8f2c27cd8fc299c598d5d65764
diff --git a/lib/veritas/algebra/rename.rb b/lib/veritas/algebra/rename.rb index <HASH>..<HASH> 100644 --- a/lib/veritas/algebra/rename.rb +++ b/lib/veritas/algebra/rename.rb @@ -14,9 +14,7 @@ module Veritas end def each(&block) - operand.each do |tuple| - yield Tuple.new(header, tuple.to_ary) - end + operand.each { |tuple| yield Tuple.new(header, tuple.to_ary) } self end
Minor simplification of Rename#each
dkubb_axiom
train
rb
3d0dfad7ad8f2fdbe17a92f52f9a6b2c10701e12
diff --git a/bt/algos.py b/bt/algos.py index <HASH>..<HASH> 100644 --- a/bt/algos.py +++ b/bt/algos.py @@ -172,10 +172,12 @@ class SelectAll(Algo): class SelectHasData(Algo): - def __init__(self, min_count, - lookback=pd.DateOffset(months=3)): + def __init__(self, lookback=pd.DateOffset(months=3), + min_count=None): super(SelectHasData, self).__init__() self.lookback = lookback + if min_count is None: + min_count = bt.finance.get_num_days_required(lookback) self.min_count = min_count def __call__(self, target):
added default value for min_count in SelectHasData
pmorissette_bt
train
py
12e91ac381246fef5183150aba7478d5a1825e5d
diff --git a/src/foremast/autoscaling_policy/create_policy.py b/src/foremast/autoscaling_policy/create_policy.py index <HASH>..<HASH> 100644 --- a/src/foremast/autoscaling_policy/create_policy.py +++ b/src/foremast/autoscaling_policy/create_policy.py @@ -161,7 +161,7 @@ class AutoScalingPolicy: "serverGroupName": server_group, "credentials": self.env, "region": self.region, - "provider": "{{ provider }}", + "provider": "aws", "type": "deleteScalingPolicy", "user": "foremast-autoscaling-policy" }]
fix: fixed provider in autoscaling policy
foremast_foremast
train
py
46f407853014144407b6c2ec7ccc76bf67958d93
diff --git a/cache_test.go b/cache_test.go index <HASH>..<HASH> 100644 --- a/cache_test.go +++ b/cache_test.go @@ -1555,7 +1555,7 @@ func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) { tc := New(exp, 0) keys := make([]string, n) for i := 0; i < n; i++ { - k := "foo" + strconv.Itoa(n) + k := "foo" + strconv.Itoa(i) keys[i] = k tc.Set(k, "bar", DefaultExpiration) } diff --git a/sharded_test.go b/sharded_test.go index <HASH>..<HASH> 100644 --- a/sharded_test.go +++ b/sharded_test.go @@ -65,7 +65,7 @@ func benchmarkShardedCacheGetManyConcurrent(b *testing.B, exp time.Duration) { tsc := unexportedNewSharded(exp, 0, 20) keys := make([]string, n) for i := 0; i < n; i++ { - k := "foo" + strconv.Itoa(n) + k := "foo" + strconv.Itoa(i) keys[i] = k tsc.Set(k, "bar", DefaultExpiration) }
Fix incorrect key in concurrent benchmarks Fixes #<I>
patrickmn_go-cache
train
go,go
fbc0c917c8f11e3e1779a9fb05fc61ad41bf147d
diff --git a/src/lightncandy.php b/src/lightncandy.php index <HASH>..<HASH> 100644 --- a/src/lightncandy.php +++ b/src/lightncandy.php @@ -66,8 +66,8 @@ class LightnCandy { const FLAG_BESTPERFORMANCE = 16384; // FLAG_ECHO const FLAG_JS = 24; // FLAG_JSTRUE + FLAG_JSOBJECT const FLAG_MUSTACHE = 40239104; // FLAG_ERROR_SKIPPARTIAL + FLAG_MUSTACHESP + FLAG_MUSTACHELOOKUP + FLAG_MUSTACHEPAIN + FLAG_MUSTACHESEC - const FLAG_HANDLEBARS = 25173984; // FLAG_THIS + FLAG_WITH + FLAG_PARENT + FLAG_JSQUOTE + FLAG_ADVARNAME + FLAG_SPACECTL + FLAG_NAMEDARG + FLAG_SPVARS + FLAG_SLASH + FLAG_ELSE - const FLAG_HANDLEBARSJS = 25174008; // FLAG_JS + FLAG_HANDLEBARS + const FLAG_HANDLEBARS = 25305056; // FLAG_THIS + FLAG_WITH + FLAG_PARENT + FLAG_JSQUOTE + FLAG_ADVARNAME + FLAG_SPACECTL + FLAG_NAMEDARG + FLAG_SPVARS + FLAG_SLASH + FLAG_ELSE + FLAG_MUSTACHESP + const FLAG_HANDLEBARSJS = 25305080; // FLAG_JS + FLAG_HANDLEBARS const FLAG_INSTANCE = 98304; // FLAG_PROPERTY + FLAG_METHOD // RegExps
align with handlebars.js (it now handle spacing)
zordius_lightncandy
train
php
e6e47fcf221741e91776fdc6efa71683dd87ed4c
diff --git a/cube.py b/cube.py index <HASH>..<HASH> 100755 --- a/cube.py +++ b/cube.py @@ -54,7 +54,7 @@ _Square = namedtuple("Square", ["face", "index", "colour"]) _Square.type = "Square" -class Square: +class Square(object): """ Square(colour, face, index), implements a square (sticker) on a cube. @@ -117,7 +117,7 @@ class Square: -class Face: +class Face(object): """ Face(face, colour_or_list_of_squares), implements a face on a cube. @@ -170,7 +170,7 @@ class Face: -class Cube: +class Cube(object): """ Cube([face * 6 L,U,F,D,R,B]), implements a whole cube.
Square, Face, Cube superclass = object
adrianliaw_PyCuber
train
py
a23d0f87d68ab35ab97f79a85611254447c5222f
diff --git a/tasks/jade.js b/tasks/jade.js index <HASH>..<HASH> 100644 --- a/tasks/jade.js +++ b/tasks/jade.js @@ -60,9 +60,19 @@ module.exports = function(grunt) { try { var jade = require('jade'); + + if (options.filters) { + // have custom filters Object.keys(options.filters).forEach(function(filter) { - jade.filters[filter] = options.filters[filter]; + if (typeof data === 'function') { + // have custom options + jade.filters[filter] = options.filters[filter].bind({jade: jade, locals: data()}); + } else { + // have no custom options + jade.filters[filter] = options.filters[filter].bind({jade: jade }); + } + }); } compiled = jade.compile(src, options);
added implementation for advanced filters #<I>
gruntjs_grunt-contrib-pug
train
js
400844ce46c3f9cda32d131277f7e87d46634dba
diff --git a/src/ui/controls/class-display-text.php b/src/ui/controls/class-display-text.php index <HASH>..<HASH> 100644 --- a/src/ui/controls/class-display-text.php +++ b/src/ui/controls/class-display-text.php @@ -75,7 +75,7 @@ class Display_Text extends Abstract_Control { * * @type string $input_type HTML input type ('checkbox' etc.). Required. * @type string $tab_id Tab ID. Required. - * @type string $section Section ID. Required. + * @type string $section Optional. Section ID. Default Tab ID. * @type array $elements The HTML elements to display (including the outer tag). Required. * @type string|null $short Optional. Short label. Default null. * @type bool $inline_help Optional. Display help inline. Default false. @@ -85,7 +85,7 @@ class Display_Text extends Abstract_Control { * } */ protected function __construct( Options $options, $options_key, $id, array $args ) { - $args = $this->prepare_args( $args, [ 'elements', 'section' ] ); + $args = $this->prepare_args( $args, [ 'elements' ] ); $this->elements = $args['elements']; parent::__construct( $options, $options_key, $id, $args['tab_id'], $args['section'], '', $args['short'], null, null, false, $args['attributes'], $args['outer_attributes'], $args['settings_args'] );
Make "section" optional for Display_Text control as well
mundschenk-at_wp-settings-ui
train
php
e4f710108918babc76ff9127f87761b28e57ad96
diff --git a/src/java/org/apache/cassandra/io/util/FileUtils.java b/src/java/org/apache/cassandra/io/util/FileUtils.java index <HASH>..<HASH> 100644 --- a/src/java/org/apache/cassandra/io/util/FileUtils.java +++ b/src/java/org/apache/cassandra/io/util/FileUtils.java @@ -148,23 +148,6 @@ public class FileUtils return f.delete(); } - public static boolean delete(List<String> files) - { - boolean bVal = true; - for ( int i = 0; i < files.size(); ++i ) - { - String file = files.get(i); - bVal = delete(file); - if (bVal) - { - if (logger.isDebugEnabled()) - logger.debug("Deleted file {}", file); - files.remove(i); - } - } - return bVal; - } - public static void delete(File[] files) { for ( File file : files )
Remove dead (and buggy: removes only half the files) code
Stratio_stratio-cassandra
train
java
a4e26b9a908f0751c5a792e30bbe228a5dcc1a75
diff --git a/salt/state.py b/salt/state.py index <HASH>..<HASH> 100644 --- a/salt/state.py +++ b/salt/state.py @@ -2606,7 +2606,10 @@ class BaseHighState(object): ) if found == 0: - log.error('No contents found in top file') + log.error('No contents found in top file. Please verify ' + 'that the \'file_roots\' specified in \'etc/master\' are ' + 'accessible: {0}'.format(repr(self.state.opts['file_roots'])) + ) # Search initial top files for includes for saltenv, ctops in six.iteritems(tops):
Provide useful hints for error "No contents found" Without extensive experience with salt, the following error is confusing: [ERROR ] No contents found in top file. Make this error more intelligible by providing hints about where to look [ERROR ] No contents found in top file. Please verify that the 'file_roots' specified in 'etc/master' are accessible: {'base': ['/home/eradman/hg/salT']}
saltstack_salt
train
py
4852e0ada177ffa915203392133d6f56cafc313f
diff --git a/classes/indexqueue/class.tx_solr_indexqueue_recordmonitor.php b/classes/indexqueue/class.tx_solr_indexqueue_recordmonitor.php index <HASH>..<HASH> 100644 --- a/classes/indexqueue/class.tx_solr_indexqueue_recordmonitor.php +++ b/classes/indexqueue/class.tx_solr_indexqueue_recordmonitor.php @@ -159,6 +159,11 @@ class tx_solr_indexqueue_RecordMonitor { $recordUid = $uid; $recordPageId = 0; + // #typo3-60 can't load configuration for records stored on page 0 + if ($table == 'sys_file') { + return; + } + if ($status == 'new') { $recordUid = $tceMain->substNEWwithIDs[$recordUid]; }
[BUGFIX] Crash on change of sys_file Fixes: #<I> Change-Id: If<I>a0fc9d3fd8bb<I>bc6bf3a1d0ada<I>b
TYPO3-Solr_ext-solr
train
php
2fe785ed350f65cef85edc68035e169e8ddad52d
diff --git a/common/config.go b/common/config.go index <HASH>..<HASH> 100644 --- a/common/config.go +++ b/common/config.go @@ -161,14 +161,6 @@ func DownloadableURL(original string) (string, error) { // Make sure it is lowercased url.Scheme = strings.ToLower(url.Scheme) - // This is to work around issue #5927. This can safely be removed once - // we distribute with a version of Go that fixes that bug. - // - // See: https://code.google.com/p/go/issues/detail?id=5927 - if url.Path != "" && url.Path[0] != '/' { - url.Path = "/" + url.Path - } - // Verify that the scheme is something we support in our common downloader. supported := []string{"file", "http", "https"} found := false
common: remove dead code The referenced bug was fixed in Go <I>, and Packer requires Go <I>+.
hashicorp_packer
train
go
43887d8949ae288c5a521f9394909d87278fdb3e
diff --git a/searchtweets/_version.py b/searchtweets/_version.py index <HASH>..<HASH> 100644 --- a/searchtweets/_version.py +++ b/searchtweets/_version.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2018 Twitter, Inc. +# Copyright 2020 Twitter, Inc. # Licensed under the MIT License # https://opensource.org/licenses/MIT -VERSION = "1.7.4" +VERSION = "1.7.5"
bumping for update of HTTP error handling
twitterdev_search-tweets-python
train
py
4d54141cfd838c2fb2db3669ff9264c1b2b156ba
diff --git a/cmd/juju/commands/repl.go b/cmd/juju/commands/repl.go index <HASH>..<HASH> 100644 --- a/cmd/juju/commands/repl.go +++ b/cmd/juju/commands/repl.go @@ -55,7 +55,7 @@ Type "q" or ^D or ^C to quit. var ( quitCommands = set.NewStrings("q", "quit", "exit") - noControllerCommands = set.NewStrings("bootstrap", "register") + noControllerCommands = set.NewStrings("help", "bootstrap", "register") ) const (
Add "help" to the list of REPL commands that don't need a controller
juju_juju
train
go
fc1005be26b68166a0114615a20717072a2ddec1
diff --git a/src-test/async/publish-timeout.js b/src-test/async/publish-timeout.js index <HASH>..<HASH> 100644 --- a/src-test/async/publish-timeout.js +++ b/src-test/async/publish-timeout.js @@ -1,6 +1,8 @@ /* * Test cases for Hub.publish timeouts. +THIS TEST CASE KILLS CHROME! + AsyncTestCase("publish-timeout", { tearDown: function() { @@ -13,7 +15,7 @@ AsyncTestCase("publish-timeout", { }); queue.call(function(pool) { var time = new Date().getTime(); - Hub.publish("a", "b").then(function() { + Hub.publish("a/b").then(function() { fail("Unexpected success callback"); }, pool.add(function(error) { assertObject(error); diff --git a/src-test/prototype.js b/src-test/prototype.js index <HASH>..<HASH> 100644 --- a/src-test/prototype.js +++ b/src-test/prototype.js @@ -1,6 +1,6 @@ /* * Test cases for prototype scoped peers. - */ + TestCase("prototype", { tearDown: function() { @@ -35,4 +35,4 @@ TestCase("prototype", { assert(fn.called); } -}); \ No newline at end of file +}); */ \ No newline at end of file
Fixed bug in publish-timeout test case, but it still kills Chrome. Commented out peer prototype tests for now.
mantoni_hub.js
train
js,js
a169646ad6e216cd1fb26ae7072f600bdecb1612
diff --git a/lib/node_tracers.js b/lib/node_tracers.js index <HASH>..<HASH> 100644 --- a/lib/node_tracers.js +++ b/lib/node_tracers.js @@ -215,7 +215,7 @@ RawZipkinTracer.prototype._sendTrace = function(tuple) { var trace = tuple[0], annotations = tuple[1]; async.waterfall([ - formatters.formatForZipkin.bind(null, trace, annotations), + formatters.formatForZipkin.bind(trace, annotations, null), this.scribeClient.send.bind(this, this.category) ], function(err) {}); }; diff --git a/lib/trace.js b/lib/trace.js index <HASH>..<HASH> 100644 --- a/lib/trace.js +++ b/lib/trace.js @@ -73,10 +73,8 @@ }); if (has(options, 'tracers') && options.tracers){ - console.log("options tracers:"+JSON.stringify(options.tracers)); self._tracers = options.tracers; } else { - console.log("tracers:"+JSON.stringify(tracers.getTracers())); self._tracers = tracers.getTracers(); } };
change to node_tracers using zipkin formatting
tryfer_node-tryfer
train
js,js
5a4603f634779f1ef55be00443dd0518ec814be5
diff --git a/spark-spi/src/main/java/spark/spi/SolutionSet.java b/spark-spi/src/main/java/spark/spi/SolutionSet.java index <HASH>..<HASH> 100644 --- a/spark-spi/src/main/java/spark/spi/SolutionSet.java +++ b/spark-spi/src/main/java/spark/spi/SolutionSet.java @@ -84,7 +84,7 @@ public class SolutionSet extends BaseResults implements Solutions { @Override public boolean next() { cursor++; - return cursor < (data.size() - 1); + return cursor < data.size(); } @Override @@ -111,7 +111,7 @@ public class SolutionSet extends BaseResults implements Solutions { private class SolutionIterator implements Iterator<Map<String,RDFNode>> { - int iterCursor = 0; + int iterCursor = -1; @Override public boolean hasNext() {
Fix a couple of off-by-one errors in the default SolutionSet implementation.
revelytix_spark
train
java
243e6e4b2a53253d5ca734415564c419c5632f12
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index <HASH>..<HASH> 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -22,7 +22,7 @@ module RenderTestCases def test_render_without_options e = assert_raises(ArgumentError) { @view.render() } - assert_match "You invoked render but did not give any of :partial, :template, :inline, :file or :text option.", e.message + assert_match(/You invoked render but did not give any of (.+) option./, e.message) end def test_render_file
Fix a fragile test on `action_view/render` This test were assuming that the list of render options will always be the same. Fixing that so this doesn't break when we add/remove render option in the future.
rails_rails
train
rb
52c75e32cb8519abcd23fcb5f468e0ef714d4fbc
diff --git a/lib/espresso-runner.js b/lib/espresso-runner.js index <HASH>..<HASH> 100644 --- a/lib/espresso-runner.js +++ b/lib/espresso-runner.js @@ -26,7 +26,12 @@ class EspressoRunner { } this[req] = opts[req]; } - this.jwproxy = new JWProxy({server: this.host, port: this.systemPort, base: ''}); + this.jwproxy = new JWProxy({ + server: this.host, + port: this.systemPort, + base: '', + keepAlive: true, + }); this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy); this.modServerPath = path.resolve(this.tmpDir, `${TEST_APK_PKG}_${version}_${this.appPackage}.apk`);
feat: Enable keep-alive mode for server connections (#<I>)
appium_appium-espresso-driver
train
js
da247654371664fb906ad286053c63e6fc2f5b5a
diff --git a/python/mxnet/gluon/block.py b/python/mxnet/gluon/block.py index <HASH>..<HASH> 100644 --- a/python/mxnet/gluon/block.py +++ b/python/mxnet/gluon/block.py @@ -742,18 +742,16 @@ class Block: if g.stype == 'row_sparse': ndarray.zeros_like(g, out=g) else: - arrays[g.ctx].append(g) + if is_np_array(): + arrays[g.ctx].append(g.as_nd_ndarray()) + else: + arrays[g.ctx].append(g) if len(arrays) == 0: return - if is_np_array(): - for arr in arrays.values(): - for ele in arr: - ele[()] = 0 - else: - for arr in arrays.values(): - ndarray.reset_arrays(*arr, num_arrays=len(arr)) + for arr in arrays.values(): + ndarray.reset_arrays(*arr, num_arrays=len(arr)) def reset_ctx(self, ctx): """Re-assign all Parameters to other contexts.
Use multi-tensor zeroing for resetting grads (#<I>)
apache_incubator-mxnet
train
py
b47ca4f76152fd488e6a123febd11311ea10e9d0
diff --git a/lib/fog/core/errors.rb b/lib/fog/core/errors.rb index <HASH>..<HASH> 100644 --- a/lib/fog/core/errors.rb +++ b/lib/fog/core/errors.rb @@ -68,6 +68,9 @@ An alternate file may be used by placing its path in the FOG_RC environment vari :vsphere_server: :vsphere_username: :vsphere_password: + :libvirt_username: + :libvirt_password: + :libvirt_uri: # # End of Fog Credentials File #######################################################
Added libvirt options to credentials error
fog_fog
train
rb
7550b628bfb294576adedfd0f6650ad68e6dcd2f
diff --git a/python/ray/rllib/es/es.py b/python/ray/rllib/es/es.py index <HASH>..<HASH> 100644 --- a/python/ray/rllib/es/es.py +++ b/python/ray/rllib/es/es.py @@ -124,13 +124,13 @@ class Worker(object): [np.sign(rewards_pos).sum(), np.sign(rewards_neg).sum()]) lengths.append([lengths_pos, lengths_neg]) - return Result( - noise_indices=noise_indices, - noisy_returns=returns, - sign_noisy_returns=sign_returns, - noisy_lengths=lengths, - eval_returns=eval_returns, - eval_lengths=eval_lengths) + return Result( + noise_indices=noise_indices, + noisy_returns=returns, + sign_noisy_returns=sign_returns, + noisy_lengths=lengths, + eval_returns=eval_returns, + eval_lengths=eval_lengths) class ESAgent(Agent):
fix indentation for ES (#<I>)
ray-project_ray
train
py
9546f18ebca1bda4a63c7ea7989bc32c83c9c86b
diff --git a/plugins/database/mongodb/connection_producer.go b/plugins/database/mongodb/connection_producer.go index <HASH>..<HASH> 100644 --- a/plugins/database/mongodb/connection_producer.go +++ b/plugins/database/mongodb/connection_producer.go @@ -132,8 +132,7 @@ func createClient(ctx context.Context, connURL string, clientOptions *options.Cl clientOptions.SetSocketTimeout(1 * time.Minute) clientOptions.SetConnectTimeout(1 * time.Minute) - opts := clientOptions.ApplyURI(connURL) - client, err = mongo.Connect(ctx, opts) + client, err = mongo.Connect(ctx, options.MergeClientOptions(options.Client().ApplyURI(connURL), clientOptions)) if err != nil { return nil, err }
Merge writeOpts and tlsAuthOpts after call to ApplyURI (#<I>)
hashicorp_vault
train
go
6b0b256a07c55df11bcda80189cfff9b529cc5a1
diff --git a/pubsub/google/cloud/pubsub_v1/subscriber/policy/thread.py b/pubsub/google/cloud/pubsub_v1/subscriber/policy/thread.py index <HASH>..<HASH> 100644 --- a/pubsub/google/cloud/pubsub_v1/subscriber/policy/thread.py +++ b/pubsub/google/cloud/pubsub_v1/subscriber/policy/thread.py @@ -61,7 +61,7 @@ class Policy(base.BasePolicy): # Create a queue for keeping track of shared state. if queue is None: queue = Queue() - self._request_queue = Queue() + self._request_queue = queue # Call the superclass constructor. super(Policy, self).__init__(
Use queue if provided in kwargs (#<I>) Fix for a new Queue being instantiated regardless of whether a queue is passed in or not.
googleapis_google-cloud-python
train
py
716414d54f1c90de0e20803819b935a8b2dabf9e
diff --git a/src/main/java/org/telegram/mtproto/MTProto.java b/src/main/java/org/telegram/mtproto/MTProto.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/telegram/mtproto/MTProto.java +++ b/src/main/java/org/telegram/mtproto/MTProto.java @@ -542,18 +542,20 @@ public class MTProto { return null; } -// if (TimeOverlord.getInstance().getTimeAccuracy() < 10) { -// long time = (messageId >> 32); -// long serverTime = TimeOverlord.getInstance().getServerTime(); -// -// if (serverTime + 30 < time) { -// return null; -// } -// -// if (time < serverTime - 300) { -// return null; -// } -// } + if (TimeOverlord.getInstance().getTimeAccuracy() < 10) { + long time = (messageId >> 32); + long serverTime = TimeOverlord.getInstance().getServerTime(); + + if (serverTime + 30 < time) { + Logger.w(TAG, "Ignored message: " + time + " with server time: " + serverTime); + return null; + } + + if (time < serverTime - 300) { + Logger.w(TAG, "Ignored message: " + time + " with server time: " + serverTime); + return null; + } + } return new MTMessage(messageId, mes_seq, message); }
Restored time checking with logging
telegram-s_telegram-mt
train
java
f0f3fabaa33e9b0050048b568e75060d785ddf0f
diff --git a/umis/umis.py b/umis/umis.py index <HASH>..<HASH> 100644 --- a/umis/umis.py +++ b/umis/umis.py @@ -391,7 +391,7 @@ def tagcount(sam, out, genemap, output_evidence_table, positional, minevidence, buf = StringIO() for key in evidence: line = '{},{}\n'.format(key, evidence[key]) - buf.write(unicode(line), "utf-8") + buf.write(unicode(line, "utf-8")) buf.seek(0) evidence_table = pd.read_csv(buf)
Fix typo in handling unicode This appears to be a misplaced end parenthesis from: <I>d6ad<I>eb<I>a<I>a<I>a<I>d<I>e<I>a2
vals_umis
train
py
d7777bb910d9d5eac40849cc27993676ed0da7f6
diff --git a/airflow/api_connexion/endpoints/dag_run_endpoint.py b/airflow/api_connexion/endpoints/dag_run_endpoint.py index <HASH>..<HASH> 100644 --- a/airflow/api_connexion/endpoints/dag_run_endpoint.py +++ b/airflow/api_connexion/endpoints/dag_run_endpoint.py @@ -102,7 +102,7 @@ def get_dag_run(*, dag_id: str, dag_run_id: str, session: Session = NEW_SESSION) def get_upstream_dataset_events( *, dag_id: str, dag_run_id: str, session: Session = NEW_SESSION ) -> APIResponse: - """Get a DAG Run.""" + """If dag run is dataset-triggered, return the dataset events that triggered it.""" dag_run: Optional[DagRun] = ( session.query(DagRun) .filter( @@ -123,7 +123,6 @@ def get_upstream_dataset_events( def _get_upstream_dataset_events(*, dag_run: DagRun, session: Session) -> List["DagRun"]: - """If dag run is dataset-triggered, return the dataset events that triggered it.""" if not dag_run.run_type == DagRunType.DATASET_TRIGGERED: return []
fix comments (#<I>)
apache_airflow
train
py
845239b9323ab29d8fd3542d3de97b1ff3046d77
diff --git a/src/CmsAdmin/Resource/web/js/form.js b/src/CmsAdmin/Resource/web/js/form.js index <HASH>..<HASH> 100644 --- a/src/CmsAdmin/Resource/web/js/form.js +++ b/src/CmsAdmin/Resource/web/js/form.js @@ -63,10 +63,11 @@ $(document).ready(function () { }); //on focus na submit - $('input[type="submit"]').on('click', function () { + $('input[type="submit"]').on('focus', function () { + var submitBtn = $(this); setTimeout(function () { - $(this).closest('form').trigger('submit'); - }, 500); + submitBtn.closest('form').trigger('submit'); + }, 3000); }); //pola do przeciwdziałania robotom bez JS
Submit.onfocus -> Form.submit
milejko_mmi-cms
train
js
09f11d46b4f45dd1e7921a1d2f5aefab182cd973
diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py index <HASH>..<HASH> 100644 --- a/IPython/html/widgets/widget.py +++ b/IPython/html/widgets/widget.py @@ -149,12 +149,7 @@ class Widget(LoggingConfigurable): self.send_state(key=name) def _handle_displayed(self, **kwargs): - """Called when a view has been displayed for this widget instance - - Parameters - ---------- - [view_name]: unicode (optional kwarg) - Name of the view that was displayed.""" + """Called when a view has been displayed for this widget instance""" for handler in self._display_callbacks: if callable(handler): argspec = inspect.getargspec(handler) @@ -169,8 +164,6 @@ class Widget(LoggingConfigurable): handler() elif nargs == 1: handler(self) - elif nargs == 2: - handler(self, kwargs.get('view_name', None)) else: handler(self, **kwargs) @@ -256,7 +249,6 @@ class Widget(LoggingConfigurable): Can have a signature of: - callback() - callback(sender) - - callback(sender, view_name) - callback(sender, **kwargs) kwargs from display call passed through without modification. remove: bool
remove 3rd callback type from on_displayed
jupyter-widgets_ipywidgets
train
py
fed666a5b67d75c11ff2799eeb7f8fa39259c133
diff --git a/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go b/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go index <HASH>..<HASH> 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go +++ b/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go @@ -74,7 +74,7 @@ func resourceDigitalOceanSSHKeyRead(d *schema.ResourceData, meta interface{}) er if err != nil { // If the key is somehow already destroyed, mark as // successfully gone - if resp.StatusCode == 404 { + if resp != nil && resp.StatusCode == 404 { d.SetId("") return nil }
provider/digitalocean: Check for nil response This applies the same fix to `digitalocean_ssh_key` as #<I> applies to droplets. Fixes #<I>. The report there gives weight to my theory that this occurs when there are transport issues.
hashicorp_terraform
train
go
7614ccb5f5fc897605d008d4fb67867c087cb6de
diff --git a/lib/facemock/version.rb b/lib/facemock/version.rb index <HASH>..<HASH> 100644 --- a/lib/facemock/version.rb +++ b/lib/facemock/version.rb @@ -1,3 +1,3 @@ module Facemock - VERSION = "0.0.3" + VERSION = "0.0.4" end diff --git a/spec/facemock_spec.rb b/spec/facemock_spec.rb index <HASH>..<HASH> 100644 --- a/spec/facemock_spec.rb +++ b/spec/facemock_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Facemock do - let(:version) { "0.0.3" } + let(:version) { "0.0.4" } let(:db_name) { ".test" } describe 'VERSION' do
:arrow_up: Upgrade version to <I>
ogawatti_facemock
train
rb,rb
6d061b70b1b12ed690c9d499596bf95eb5943fdc
diff --git a/src/Component.php b/src/Component.php index <HASH>..<HASH> 100644 --- a/src/Component.php +++ b/src/Component.php @@ -5,6 +5,7 @@ namespace mito\sentry; use Closure; use mito\sentry\assets\RavenAsset; use Yii; +use yii\base\Exception; use yii\base\InvalidConfigException; use yii\helpers\ArrayHelper; use yii\helpers\Json; @@ -117,10 +118,21 @@ class Component extends \yii\base\Component */ private function registerAssets() { - if ($this->jsNotifier && Yii::$app instanceof \yii\web\Application) { + if ($this->jsNotifier === false){ + return; + } + + if(!Yii::$app instanceof \yii\web\Application) { + return; + } + + try { $view = Yii::$app->getView(); RavenAsset::register($view); $view->registerJs('Raven.config(' . Json::encode($this->publicDsn) . ', ' . Json::encode($this->jsOptions) . ').install();', View::POS_HEAD); + } catch (Exception $e) { + // initialize Sentry component even if unable to register the assets + // (eg. the assets folder is not writable by the webserver user) } }
register component even if unable to register assets
hellowearemito_yii2-sentry
train
php
bf0fce6ea818759b76d3682771a6c92b7fef30e6
diff --git a/lib/platformexploit.rb b/lib/platformexploit.rb index <HASH>..<HASH> 100644 --- a/lib/platformexploit.rb +++ b/lib/platformexploit.rb @@ -31,8 +31,12 @@ module Ronin super(advisory) @targets = [] - params << Param.new('target','default target index',0) - params << Param.new('custom_target','custom target to use',nil) + params.add_param('target','default target index',0) + params.add_param('custom_target','custom target to use') + end + + def add_target(target) + @targets << target end def get_target
* Use the add_param method for adding parameters. * Added the 'add_target' method to the Target class.
ronin-ruby_ronin
train
rb
a6bb41e802159b86aface966454ffb5928005708
diff --git a/thefuck/system/win32.py b/thefuck/system/win32.py index <HASH>..<HASH> 100644 --- a/thefuck/system/win32.py +++ b/thefuck/system/win32.py @@ -1,5 +1,4 @@ import os -import sys import msvcrt import win_unicode_console from .. import const @@ -12,20 +11,18 @@ def init_output(): def get_key(): - ch = msvcrt.getch() - if ch in (b'\x00', b'\xe0'): # arrow or function key prefix? - ch = msvcrt.getch() # second call returns the actual key code + ch = msvcrt.getwch() + if ch in ('\x00', '\xe0'): # arrow or function key prefix? + ch = msvcrt.getwch() # second call returns the actual key code if ch in const.KEY_MAPPING: return const.KEY_MAPPING[ch] - if ch == b'H': + if ch == 'H': return const.KEY_UP - if ch == b'P': + if ch == 'P': return const.KEY_DOWN - encoding = (sys.stdout.encoding - or os.environ.get('PYTHONIOENCODING', 'utf-8')) - return ch.decode(encoding) + return ch def open_command(arg):
Fix Win<I> get_key (#<I>) PR #<I> moved the arrow and cancel key codes to `const.py`. However, the move also changed the codes from byte arrays to strings, which broke the use of `msvcrt.getch()` for Windows. The fix is to use `msvcrt.getwch()` so the key is a Unicode character, matching the Unix implementation.
nvbn_thefuck
train
py
7d6049a1c03102050a4b3e9f0fc335a209124605
diff --git a/tests/helper.py b/tests/helper.py index <HASH>..<HASH> 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -184,7 +184,7 @@ if __name__ == '__main__': print('Starting ...') import signalfd signalfd.sigprocmask(signalfd.SIG_BLOCK, [signal.SIGCHLD]) - fd = signalfd.signalfd(0, [signal.SIGCHLD], signalfd.SFD_NONBLOCK|signalfd.SFD_CLOEXEC) + fd = signalfd.signalfd(-1, [signal.SIGCHLD], signalfd.SFD_NONBLOCK|signalfd.SFD_CLOEXEC) for i in range(1000): print('Forking %s:' % i) pid = os.fork()
Dooh! Was setting up signalfd the wrong way.
ionelmc_python-manhole
train
py
d227af1edd5366df91f96193ddff3ff43d54b4f4
diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -409,7 +409,7 @@ func (srv *Server) ImagePull(name, tag, endpoint string, out io.Writer, sf *util remote := name parts := strings.Split(name, "/") if len(parts) > 2 { - remote = fmt.Sprintf("src/%s", strings.Join(parts, "%2F")) + remote = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/"))) } if err := srv.pullRepository(r, out, name, remote, tag, sf); err != nil { return err @@ -496,7 +496,7 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri srvName := name parts := strings.Split(name, "/") if len(parts) > 2 { - srvName = fmt.Sprintf("src/%s", strings.Join(parts, "%2F")) + srvName = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/"))) } repoData, err := r.PushImageJSONIndex(srvName, imgList, false)
Escape remote names on repo push/pull
moby_moby
train
go
d22ef6e8af9d5b7cac6fd369c782dedf65e3d711
diff --git a/generators/cleanup.js b/generators/cleanup.js index <HASH>..<HASH> 100644 --- a/generators/cleanup.js +++ b/generators/cleanup.js @@ -221,11 +221,13 @@ function cleanupOldServerFiles(generator, javaDir, testDir, mainResourceDir, tes generator.removeFile(`${testDir}web/rest/ClientForwardControllerIT.java`); } if (generator.isJhipsterVersionLessThan('6.6.1')) { - generator.removeFile(`${javaDir}security/oauth2/JwtAuthorityExtractor.java`); generator.removeFile(`${javaDir}web/rest/errors/EmailNotFoundException.java`); generator.removeFile(`${javaDir}config/DefaultProfileUtil.java`); generator.removeFolder(`${javaDir}service/util`); } + if (generator.isJhipsterVersionLessThan('6.8.0')) { + generator.removeFile(`${javaDir}security/oauth2/JwtAuthorityExtractor.java`); + } } /**
Move clean file 'JwtAuthorityExtractor' for older version than <I>
jhipster_generator-jhipster
train
js
81eda5bb5d9b18421d04224454360df28889e944
diff --git a/cmd/jujud/machine.go b/cmd/jujud/machine.go index <HASH>..<HASH> 100644 --- a/cmd/jujud/machine.go +++ b/cmd/jujud/machine.go @@ -172,9 +172,14 @@ func (a *MachineAgent) APIWorker(ensureStateWorker func()) (worker.Worker, error runner.StartWorker("logger", func() (worker.Worker, error) { return workerlogger.NewLogger(st.Logger(), agentConfig), nil }) - runner.StartWorker("authenticationworker", func() (worker.Worker, error) { - return authenticationworker.NewWorker(st.KeyUpdater(), agentConfig), nil - }) + + // If not a local provider, start the worker to manage SSH keys. + providerType := agentConfig.Value(agent.ProviderType) + if providerType != provider.Local && providerType != provider.Null { + runner.StartWorker("authenticationworker", func() (worker.Worker, error) { + return authenticationworker.NewWorker(st.KeyUpdater(), agentConfig), nil + }) + } // Perform the operations needed to set up hosting for containers. if err := a.setupContainerSupport(runner, st, entity); err != nil {
Do not start auth worker for local provider
juju_juju
train
go
a633cdc2edf5f5e13c006d3d2ceaf6eebf191577
diff --git a/src/main/java/org/sikuli/slides/processing/Relationship.java b/src/main/java/org/sikuli/slides/processing/Relationship.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/sikuli/slides/processing/Relationship.java +++ b/src/main/java/org/sikuli/slides/processing/Relationship.java @@ -24,7 +24,7 @@ import org.sikuli.slides.utils.Constants; public class Relationship extends DefaultHandler { private String relationshipXMLFile; - private String imageFileName; + private String mediaFileName; private String relationshipID; public Relationship(String fileName){ @@ -33,7 +33,7 @@ public class Relationship extends DefaultHandler { public String getImageFileName(String relationshipID){ this.relationshipID=relationshipID; parseDocument(); - return imageFileName; + return mediaFileName; } private void parseDocument(){ @@ -61,7 +61,7 @@ public class Relationship extends DefaultHandler { if (qName.equalsIgnoreCase("Relationship")) { // get the image location if(relationshipID.equals(attributes.getValue("Id"))){ - imageFileName=new File(attributes.getValue("Target")).getName(); + mediaFileName=new File(attributes.getValue("Target")).getName(); } } }
refactor to get any media file
sikuli_sikuli-slides
train
java
104e88456e6e0dceeaee3bd8fd9828d194655f4b
diff --git a/openhtf/core/phase_executor.py b/openhtf/core/phase_executor.py index <HASH>..<HASH> 100644 --- a/openhtf/core/phase_executor.py +++ b/openhtf/core/phase_executor.py @@ -131,6 +131,7 @@ class PhaseExecutorThread(threads.KillableThread): once it is known (_phase_execution_outcome is None until then), and it will be a PhaseExecutionOutcome instance. """ + daemon = True def __init__(self, phase_desc, test_state): super(PhaseExecutorThread, self).__init__( diff --git a/openhtf/core/test_executor.py b/openhtf/core/test_executor.py index <HASH>..<HASH> 100644 --- a/openhtf/core/test_executor.py +++ b/openhtf/core/test_executor.py @@ -47,6 +47,7 @@ class TestStopError(Exception): # pylint: disable=too-many-instance-attributes class TestExecutor(threads.KillableThread): """Encompasses the execution of a single test.""" + daemon = True def __init__(self, test_descriptor, execution_uid, test_start, teardown_function=None):
Make PhaseExecutorThread and TestExecutor daemon threads (#<I>)
google_openhtf
train
py,py
3264e5dcd296218ae41c668a77220c31a2b51069
diff --git a/lib/autokey/scripting/engine.py b/lib/autokey/scripting/engine.py index <HASH>..<HASH> 100644 --- a/lib/autokey/scripting/engine.py +++ b/lib/autokey/scripting/engine.py @@ -99,7 +99,8 @@ class Engine: temporary=False): """ Create a new text phrase inside the given folder. Use C{engine.get_folder(folder_name)} to retrieve the folder - you wish to create the Phrase in. + you wish to create the Phrase in. If the folder is a temporary + one, the phrase will be created as temporary. The first three arguments (folder, name and contents) are required. All further arguments are optional and considered to be keyword-argument only. Do not rely on the order of the optional arguments. @@ -172,6 +173,8 @@ class Engine: It can be used for _really_ advanced use cases, where further customizations are desired. Use at your own risk. No guarantees are made about the object’s structure. Read the AutoKey source code for details. """ + if folder.temporary: + temporary = True # TODO: The validation should be done by some controller functions in the model base classes. if abbreviations: if isinstance(abbreviations, str):
Phrases created in temporary folders are made temporary
autokey_autokey
train
py
f7987be849d8466d7121c3ef57dd306473f374be
diff --git a/components/SeoPatternHelper.php b/components/SeoPatternHelper.php index <HASH>..<HASH> 100644 --- a/components/SeoPatternHelper.php +++ b/components/SeoPatternHelper.php @@ -46,6 +46,16 @@ class SeoPatternHelper { const SEPARATOR_PATTERN_KEY = 'sep'; /** + * Global view separator parameter key name. + */ + const SEPARATOR_VIEW_PARAMETER_KEY = 'titleSeparator'; + + /** + * Default separator value. + */ + const SEPARATOR_DEFAULT = '-'; + + /** * Pattern delimeter for represents that its pattern or not static text. */ const PATTERN_DELIMETER = '%%'; @@ -271,7 +281,8 @@ class SeoPatternHelper { * @return mixed|string */ public static function retrieveSeparator() { - return '-'; + $separatorViewParamKey = self::SEPARATOR_VIEW_PARAMETER_KEY; + return (ArrayHelper::keyExists($separatorViewParamKey, Yii::$app->view->params)) ? Yii::$app->view->params[$separatorViewParamKey] : self::SEPARATOR_DEFAULT; } /* *********************** SANITIZIED FUNCTIONS ************************** */
add feature to change separator by setting view param
agilov_yii2-seo-behavior
train
php
58e7c485934665d9c15d8e15441247d0354a577e
diff --git a/tests/unit_tests/test_utils/test_handlers.py b/tests/unit_tests/test_utils/test_handlers.py index <HASH>..<HASH> 100644 --- a/tests/unit_tests/test_utils/test_handlers.py +++ b/tests/unit_tests/test_utils/test_handlers.py @@ -90,7 +90,8 @@ class TestHandlers(SetMeUp): c = h.Repeater( self.counter, self.year, self.month, end_repeat=end_repeat, event=event - ).repeat_reverse(start, end) - self.assertEqual(len(c), 2) - self.assertEqual(c[30], [('event', event.pk)]) - self.assertEqual(c[31], [('event', event.pk)]) + ) + c.repeat_reverse(start, end) + self.assertEqual(len(c.count), 2) + self.assertEqual(c.count[30], [('event', event.pk)]) + self.assertEqual(c.count[31], [('event', event.pk)])
fixed broken test in test_handlers.
wreckage_django-happenings
train
py
37149c9fc2c85d82e7135839e39f395f4505bfc9
diff --git a/bin/php/checkdbfiles.php b/bin/php/checkdbfiles.php index <HASH>..<HASH> 100755 --- a/bin/php/checkdbfiles.php +++ b/bin/php/checkdbfiles.php @@ -132,9 +132,16 @@ $versions47 = array( 'unstable' => array( array( '4.6.0', '4.7.0alpha1' ), ); $versions50 = array( 'unstable' => array( array( '4.7.0', '5.0.0alpha1' ), + array( '5.0.0alpha1', '5.0.0' ), ), 'unstable_subdir' => 'unstable', - 'stable' => array( array( '4.6.0', '4.7.0' ) ), + 'stable' => array( array( '4.7.0', '5.0.0' ) ), + ); + +// Note: DB updates are kept in base sql file regardless of state as of 5.1 +$versions51 = array( 'unstable' => array( ), + 'unstable_subdir' => 'unstable', + 'stable' => array( array( '5.0.0', '5.1.0' ) ), ); @@ -146,6 +153,7 @@ $versions['4.5'] = $versions45; $versions['4.6'] = $versions46; $versions['4.7'] = $versions47; $versions['5.0'] = $versions50; +$versions['5.1'] = $versions51; $fileList = array(); $missingFileList = array();
Fix a minor mistake in <I>a<I>cd<I>c<I>ec6fc2c0c4ba
ezsystems_ezpublish-legacy
train
php
ad9c9d96a3f51e157f65ea19f0957eabda0dea87
diff --git a/tangy-form-item.js b/tangy-form-item.js index <HASH>..<HASH> 100644 --- a/tangy-form-item.js +++ b/tangy-form-item.js @@ -720,7 +720,16 @@ export class TangyFormItem extends PolymerElement { this .querySelectorAll('[name]') .forEach(input => inputs.push(input.getModProps && window.useShrinker ? input.getModProps() : input.getProps())) + let score = 0 this.inputs = inputs + const tangyFormItem = this.querySelector('[name]').parentElement; + if(tangyFormItem.hasAttribute('scoring-section')){ + const scoreEl = document.createElement('tangy-input') + scoreEl.name = `${tangyFormItem.getAttribute('id')}_score` + scoreEl.value = score + this.inputs = [...inputs, scoreEl.getModProps && window.useShrinker ? scoreEl.getModProps() : scoreEl.getProps()] + } + const selections = tangyFormItem.getAttribute('scoring-fields') || [] if (window.devtools && window.devtools.open) { console.table(this.inputs.map(input => { return {name: input.name, value: input.value} })) }
feat(scoring-fields): Add Scoring Functionality Part of Tangerine-Community/tangy-form-editor#<I> Refs Tangerine-Community/Tangerine#<I>
Tangerine-Community_tangy-form
train
js
c0e9a3fb7312b49e31431e692924c351e28dfb3a
diff --git a/lib/u2f/u2f.rb b/lib/u2f/u2f.rb index <HASH>..<HASH> 100644 --- a/lib/u2f/u2f.rb +++ b/lib/u2f/u2f.rb @@ -95,10 +95,14 @@ module U2F # Convert a binary public key to PEM format def self.public_key_pem(key) fail PublicKeyDecodeError unless key.length == 65 || key[0] == "\x04" - - der = "\x30\x59\x30\x13\x06\x07\x2a\x86\x48\xce\x3d\x02\x01".force_encoding('ASCII-8BIT') << - "\x06\x08\x2a\x86\x48\xce\x3d\x03\x01\x07\x03\x42".force_encoding('ASCII-8BIT') << - "\0".force_encoding('ASCII-8BIT') << key + # http://tools.ietf.org/html/rfc5480 + der = OpenSSL::ASN1::Sequence([ + OpenSSL::ASN1::Sequence([ + OpenSSL::ASN1::ObjectId('1.2.840.10045.2.1'), # id-ecPublicKey + OpenSSL::ASN1::ObjectId('1.2.840.10045.3.1.7') # secp256r1 + ]), + OpenSSL::ASN1::BitString(key) + ]).to_der pem = "-----BEGIN PUBLIC KEY-----\r\n" + Base64.strict_encode64(der).scan(/.{1,64}/).join("\r\n") +
Get rid of hard coded bytes for generating PEM from private key
castle_ruby-u2f
train
rb
658d8e0889507ec156a1747283319a40e002a561
diff --git a/lib/veewee/provider/core/helper/web.rb b/lib/veewee/provider/core/helper/web.rb index <HASH>..<HASH> 100644 --- a/lib/veewee/provider/core/helper/web.rb +++ b/lib/veewee/provider/core/helper/web.rb @@ -26,8 +26,8 @@ module Veewee content=displayfile.read() response.body=content #If we shut too fast it might not get the complete file - sleep 2 - @server.shutdown + # sleep 2 + # @server.shutdown end end @@ -58,8 +58,8 @@ module Veewee :Logger => webrick_logger, :AccessLog => webrick_logger ) - env.logger.debug("mounting file /#{filename}") - s.mount("/#{filename}", Veewee::Provider::Core::Helper::Servlet::FileServlet,File.join(web_dir,filename),env) + env.logger.debug("mounting file #{filename}") + s.mount("#{filename}", Veewee::Provider::Core::Helper::Servlet::FileServlet,File.join(web_dir,filename),env) trap("INT"){ s.shutdown env.ui.info "Stopping webserver"
Leave the web thread running until we shut down, and mount it a bit more pragmatically (full paths only)
jedi4ever_veewee
train
rb
13276a3f4a0f02a7e3a06e4fd8ab9301391de9a0
diff --git a/lxd/cluster/gateway.go b/lxd/cluster/gateway.go index <HASH>..<HASH> 100644 --- a/lxd/cluster/gateway.go +++ b/lxd/cluster/gateway.go @@ -195,15 +195,15 @@ func (g *Gateway) HandlerFuncs(heartbeatHandler HeartbeatHandler, trustedCerts f if r.Method == "PUT" { if g.shutdownCtx.Err() != nil { logger.Warn("Rejecting heartbeat request as shutting down") - http.Error(w, "503 shutting down", http.StatusServiceUnavailable) + http.Error(w, "503 Shutting down", http.StatusServiceUnavailable) return } var heartbeatData APIHeartbeat err := json.NewDecoder(r.Body).Decode(&heartbeatData) if err != nil { - logger.Error("Error decoding heartbeat body", log.Ctx{"err": err}) - http.Error(w, "400 invalid heartbeat payload", http.StatusBadRequest) + logger.Error("Failed decoding heartbeat", log.Ctx{"err": err}) + http.Error(w, "400 Failed decoding heartbeat", http.StatusBadRequest) return }
lxd/cluster/gateway: Error message and log improvements
lxc_lxd
train
go
3e029fcde02a84c9d831acd8747691aaed083463
diff --git a/src/options/block-indent.js b/src/options/block-indent.js index <HASH>..<HASH> 100644 --- a/src/options/block-indent.js +++ b/src/options/block-indent.js @@ -45,7 +45,7 @@ let option = { var spaces = whitespaceNode.content.replace(/\n[ \t]+/gm, '\n'); if (spaces === '') { - ast.remove(i); + ast.removeChild(i); } else { whitespaceNode.content = spaces; }
Fix ast.remove is not a function error This PR fixes an error that occurs when `"eof-newline": false,` as reported and solved here: <URL>
csscomb_csscomb.js
train
js
b27ba5ef59ae48b9eb6a34b1106a9fde843314e7
diff --git a/lib/browser.js b/lib/browser.js index <HASH>..<HASH> 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -25,7 +25,13 @@ function W3CWebSocket(uri, protocols) { */ return native_instance; } - +if (NativeWebSocket) { + ["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function(prop) { + Object.defineProperty(W3CWebSocket, prop, { + get: function() { return NativeWebSocket[prop]; } + }); + }); +} /** * Module exports.
add readyState constants to browser `w3cwebsocket` Now the exposed `w3cwebsocket` export mirrors the native WebSocket more closely. I hit this bug when moving previously native code to use this wrapper, the server-sde code was fine, but the client-side code failed because `WebSocket.OPEN` was `undefined`.
theturtle32_WebSocket-Node
train
js
6481793854a0a2eb7c5c9611fa2331c651e9f0ef
diff --git a/src/BootstrapChannelClient.js b/src/BootstrapChannelClient.js index <HASH>..<HASH> 100644 --- a/src/BootstrapChannelClient.js +++ b/src/BootstrapChannelClient.js @@ -61,7 +61,7 @@ class BootstrapChannelClient { } send(id,type,data){ - u.log(this.chord, "BSTRAP: SENDING "+type); + u.log(this.chord, "BSTRAP: SENDING "); switch(type){ case msg_types.MSG_SDP_OFFER: diff --git a/src/BootstrapChannelServer.js b/src/BootstrapChannelServer.js index <HASH>..<HASH> 100644 --- a/src/BootstrapChannelServer.js +++ b/src/BootstrapChannelServer.js @@ -72,7 +72,7 @@ class BootstrapChannelServer{ } send(id,type,data){ - u.log(this.chord, "Send instruction given to server bootstrap: "+type); + u.log(this.chord, "Send instruction given to server bootstrap"); let obj = { type: null,
I cannot print a Symbol. Aww phooey!
FelixMcFelix_conductor-chord
train
js,js
8a0765e9faa143e435dd2c54ea7eb870276fb966
diff --git a/statsd/statsd_test.go b/statsd/statsd_test.go index <HASH>..<HASH> 100644 --- a/statsd/statsd_test.go +++ b/statsd/statsd_test.go @@ -1,26 +1,32 @@ package statsd import ( - "io" "testing" "time" "github.com/stretchr/testify/assert" ) -type statsdWriterWrapper struct { - io.WriteCloser -} +type statsdWriterWrapper struct{} func (statsdWriterWrapper) SetWriteTimeout(time.Duration) error { return nil } +func (statsdWriterWrapper) Close() error { + return nil +} + +func (statsdWriterWrapper) Write(p []byte) (n int, err error) { + return 0, nil +} + func TestCustomWriterBufferConfiguration(t *testing.T) { client, err := NewWithWriter(statsdWriterWrapper{}) if err != nil { t.Fatal(err) } + defer client.Close() assert.Equal(t, OptimalUDPPayloadSize, client.bufferPool.bufferMaxSize) assert.Equal(t, DefaultUDPBufferPoolSize, cap(client.bufferPool.pool))
Fix race condition in the test The race only happen when also runnin the benchmark which leave enough time to the un-closed client to flush
DataDog_datadog-go
train
go