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
085c3e5a9053229a7196b25feb89678ccd11be8f
diff --git a/addon/components/materialize-input.js b/addon/components/materialize-input.js index <HASH>..<HASH> 100644 --- a/addon/components/materialize-input.js +++ b/addon/components/materialize-input.js @@ -4,7 +4,7 @@ import layout from '../templates/components/materialize-input'; export default MaterializeInputField.extend({ layout: layout, - type: '', + type: 'text', didInsertElement: function() { this._super(); // make sure the label moves when a value is bound. @@ -12,10 +12,5 @@ export default MaterializeInputField.extend({ if (Ember.isPresent(this.get('value')) && !labelSelector.hasClass('active')) { labelSelector.addClass('active'); } - - //If no type is set as parameter use "text" as default - if(Ember.isEmpty(this.get('type'))) { - this.set('type', 'text'); - } } });
Refactor: default type-property is text
mike-north_ember-cli-materialize
train
js
a4cb70ff772a09b135752754c1cf27709f84e7b4
diff --git a/lib/image_processor.js b/lib/image_processor.js index <HASH>..<HASH> 100644 --- a/lib/image_processor.js +++ b/lib/image_processor.js @@ -43,8 +43,11 @@ module.exports = class ImageProcessor{ var x = parseInt(data[3], 10) - 1; var y = parseInt(data[4], 10) - 1; + if(width === 0 && height === 0) { + return false; + } + if (width === 0 || height === 0) { - // precaution: never use 0x0 images width = 1; height = 1; x = 0;
Avoid crop erase image when 0x0 dims
gluckgames_pixi-packer
train
js
8ac420b53da836af129895e5a58425a922b121e8
diff --git a/src/patch.js b/src/patch.js index <HASH>..<HASH> 100644 --- a/src/patch.js +++ b/src/patch.js @@ -2,11 +2,14 @@ import createNode from './createNode'; import setAttribute from './setAttribute'; function patch(node, curr, prev, index) { - const child = node.childNodes[index || 0]; + const child = + node.childNodes[index || 0] || + node.childNodes[node.childNodes.length - 1]; + if (!prev && curr) { node.appendChild(createNode(curr)); } else if (!curr) { - if (child) node.removeChild(child); + node.removeChild(child); } else if ( typeof curr !== typeof prev || (typeof curr === 'string' && curr !== prev) ||
bug in patch when removing multiple items from dom at once
fwilkerson_muve
train
js
33db79a5ad4c755cf7b744119f9172dd7a15c049
diff --git a/git_repo/services/service.py b/git_repo/services/service.py index <HASH>..<HASH> 100644 --- a/git_repo/services/service.py +++ b/git_repo/services/service.py @@ -171,7 +171,7 @@ class RepositoryService: self.fqdn = c.get('fqdn', self.fqdn) self.scheme = c.get('scheme', 'https') - self.port = c.get('port', '443') + self.port = c.get('port', None) self.default_create_private = c.get('default-create-private', 'n').lower() in CONFIG_TRUE self.ssh_url = c.get('ssh-url', self.fqdn)
🚒 makes port default to <I> when scheme is HTTP fixes #<I>
guyzmo_git-repo
train
py
2532460475f6c1b82ff21fb59b5db009cf1581d5
diff --git a/app/src/js/modules/fields/geolocation.js b/app/src/js/modules/fields/geolocation.js index <HASH>..<HASH> 100644 --- a/app/src/js/modules/fields/geolocation.js +++ b/app/src/js/modules/fields/geolocation.js @@ -176,7 +176,7 @@ }); // Update location when typed into address field. - field.address.bind('propertychange input', function () { + field.address.on('propertychange input', function () { clearTimeout(field.timeout); field.timeout = setTimeout(function () { var address = field.address.val();
Use on isntead of bind
bolt_bolt
train
js
3165ac6ae5f6e37f13bbefc8ca456a82d7dbb5eb
diff --git a/lib/dom-inventory.js b/lib/dom-inventory.js index <HASH>..<HASH> 100644 --- a/lib/dom-inventory.js +++ b/lib/dom-inventory.js @@ -9,6 +9,7 @@ DomInventory.prototype.transform = function(ast) { var walker = new this.syntax.Walker(); const htmlElements = new Set(); const classes = new Set(); + const ids = new Set(); walker.visit(ast, function(node) { if (node.type === 'ElementNode') { @@ -17,6 +18,10 @@ DomInventory.prototype.transform = function(ast) { if (attr.name === 'class') { attr.value.chars.split(' ').forEach(className => classes.add(className)); } + + if (attr.name === 'id') { + ids.add(attr.value.chars); + } }); } }); @@ -25,6 +30,7 @@ DomInventory.prototype.transform = function(ast) { setItemSync('ember-dom-inventory:htmlElements', Array.from(htmlElements)); setItemSync('ember-dom-inventory:htmlClasses', Array.from(classes)); + setItemSync('ember-dom-inventory:htmlIds', Array.from(ids)); return ast; };
Track the attr ids used within an app
fauxton_ember-dom-inventory
train
js
dcfb691f5fd35a8134a4f6d9da6fc3303214a99d
diff --git a/thanatos/__init__.py b/thanatos/__init__.py index <HASH>..<HASH> 100644 --- a/thanatos/__init__.py +++ b/thanatos/__init__.py @@ -6,6 +6,6 @@ from thanatos import database from thanatos import questions from thanatos import utils -__version__ = '0.0.0' +__version__ = '0.0.1' _log = logging.getLogger('thanatos') \ No newline at end of file
Incrementing version for first tag
evetrivia_thanatos
train
py
aace0c1131290093949f56b7a1f5b631694b1c6d
diff --git a/mautrix/util/async_db/database.py b/mautrix/util/async_db/database.py index <HASH>..<HASH> 100644 --- a/mautrix/util/async_db/database.py +++ b/mautrix/util/async_db/database.py @@ -101,7 +101,8 @@ class Database(ABC): await self._check_foreign_tables() if self.owner_name: await self._check_owner() - await self.upgrade_table.upgrade(self) + if self.upgrade_table and len(self.upgrade_table.upgrades) > 0: + await self.upgrade_table.upgrade(self) async def _check_foreign_tables(self) -> None: if await self.table_exists("state_groups_state"):
Don't run upgrades if there are none
tulir_mautrix-python
train
py
9f368ca101d30bc61f05d033c671d3013817dcfa
diff --git a/lib/merb-core/dispatch/dispatcher.rb b/lib/merb-core/dispatch/dispatcher.rb index <HASH>..<HASH> 100644 --- a/lib/merb-core/dispatch/dispatcher.rb +++ b/lib/merb-core/dispatch/dispatcher.rb @@ -63,7 +63,7 @@ class Merb::Dispatcher begin klass = Object.full_const_get(cnt) rescue NameError => e - Merb.logger.warn!("Controller class not found: #{e.message}") + Merb.logger.warn!("Controller class not found for controller #{controller_name}: #{e.message}") raise Merb::ControllerExceptions::NotFound end
Log namespaced controller name when it's class is not found.
wycats_merb
train
rb
cacb276ff9380a1e2b4f287966dec3a781e9fe9e
diff --git a/glog.go b/glog.go index <HASH>..<HASH> 100644 --- a/glog.go +++ b/glog.go @@ -498,9 +498,7 @@ func (l *Log) SetAlsoLogToStderr(f bool) { // SetV sets the log level for V logs func (l *Log) SetV(v Level) { - l.mu.Lock() - defer l.mu.Unlock() - l.verbosity = v + l.verbosity.set(v) } // SetStderrThreshold sets the threshold for which logs at or above which go to stderr @@ -546,7 +544,7 @@ func (l *Log) setVState(verbosity Level, filter []modulePat, setFilter bool) { // Turn verbosity off so V will not fire while we are in transition. l.verbosity.set(0) // Ditto for filter length. - l.filterLength = 0 + atomic.StoreInt32(&l.filterLength, 0) // Set the new filters and wipe the pc->Level map if the filter has changed. if setFilter {
logging race fixes - Fix some races reported by "go test -race" on some experimental packages I had. The basic fix is that values used as atomic integers should always use the atomic Load/Store methods. - Get rid of unnecessary locks, the values were being protected by atomic Load/Store, not by a mutex
cosnicolaou_llog
train
go
9977220ae851ca3f303eb26fd65c7a774f1205fb
diff --git a/enrol/imsenterprise/lib.php b/enrol/imsenterprise/lib.php index <HASH>..<HASH> 100644 --- a/enrol/imsenterprise/lib.php +++ b/enrol/imsenterprise/lib.php @@ -400,7 +400,7 @@ function process_group_tag($tagcontents) { // Insert default names for teachers/students, from the current language // Handle course categorisation (taken from the group.org.orgunit field if present) - if (strlen($group->category)>0) { + if (!empty($group->category)) { // If the category is defined and exists in Moodle, we want to store it in that one if ($catid = $DB->get_field('course_categories', 'id', array('name'=>$group->category))) { $course->category = $catid;
MDL-<I> enrol_imsenterprise: fix error when category not defined thanks to Henrik Thorn for the fix
moodle_moodle
train
php
4637b402e3e7d64ea81a7df1eb580e3b5f27c484
diff --git a/lib/notifyor/version.rb b/lib/notifyor/version.rb index <HASH>..<HASH> 100644 --- a/lib/notifyor/version.rb +++ b/lib/notifyor/version.rb @@ -1,3 +1,3 @@ module Notifyor - VERSION = "0.4.1" + VERSION = "0.4.2" end
Bumped version to <I>
ndea_notifyor
train
rb
3e9c8317dba3b1e0592965b4fda3251afca01dea
diff --git a/example/client/main.go b/example/client/main.go index <HASH>..<HASH> 100644 --- a/example/client/main.go +++ b/example/client/main.go @@ -31,10 +31,12 @@ func main() { versions = append([]protocol.VersionNumber{protocol.VersionTLS}, versions...) } + roundTripper := &h2quic.RoundTripper{ + QuicConfig: &quic.Config{Versions: versions}, + } + defer roundTripper.Close() hclient := &http.Client{ - Transport: &h2quic.RoundTripper{ - QuicConfig: &quic.Config{Versions: versions}, - }, + Transport: roundTripper, } var wg sync.WaitGroup
close the h2quic.RoundTripper in the example client While it's not necessary, it's best practice to close the RoundTripper. That way, QUIC can do a proper connection shutdown.
lucas-clemente_quic-go
train
go
3df4d8d8b80f56a2960755c75be51ce855d38bef
diff --git a/core-parent/util/src/test/java/fr/javatronic/damapping/util/FluentIterableTest.java b/core-parent/util/src/test/java/fr/javatronic/damapping/util/FluentIterableTest.java index <HASH>..<HASH> 100644 --- a/core-parent/util/src/test/java/fr/javatronic/damapping/util/FluentIterableTest.java +++ b/core-parent/util/src/test/java/fr/javatronic/damapping/util/FluentIterableTest.java @@ -100,7 +100,7 @@ public class FluentIterableTest { .transform(MULTIPLY_BY_TWO_FUNCTION) .transform(APPEND_COLON_FUNCTION) .toSet() - ).containsExactly("2:", "4:", "6:"); + ).containsOnly("2:", "4:", "6:"); } public void ordering_of_filters_matters() throws Exception {
[#<I>] fix unit test broken in Java 8 order of elements should not be tested when writing an assertion on a Set
lesaint_damapping
train
java
10304a228d2b31a52c3e2e0efd83190f4d1d5e28
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_view/template/error.rb +++ b/actionpack/lib/action_view/template/error.rb @@ -94,7 +94,7 @@ module ActionView "#{indent}#{line_counter}: #{line}\n" end - extract.encode! if extract.respond_to?(:encode!) + extract.force_encoding("UTF-8") if extract.respond_to?(:encode!) extract end diff --git a/railties/test/application/middleware/exceptions_test.rb b/railties/test/application/middleware/exceptions_test.rb index <HASH>..<HASH> 100644 --- a/railties/test/application/middleware/exceptions_test.rb +++ b/railties/test/application/middleware/exceptions_test.rb @@ -99,7 +99,7 @@ module ApplicationTests app_file 'app/views/foo/index.html.erb', <<-ERB <% raise 'boooom' %> - ✓ + ✓測試テスト시험 ERB app_file 'config/routes.rb', <<-RUBY @@ -110,6 +110,7 @@ module ApplicationTests post '/foo', :utf8 => '✓' assert_match(/boooom/, last_response.body) + assert_match(/測試テスト시험/, last_response.body) end end end
don't encode an UTF-8 encoded template
rails_rails
train
rb,rb
3f2f42cc9ce0c50354025c19fabe6b62d2d03cba
diff --git a/packages_es6/ember-runtime/tests/controllers/item_controller_class_test.js b/packages_es6/ember-runtime/tests/controllers/item_controller_class_test.js index <HASH>..<HASH> 100644 --- a/packages_es6/ember-runtime/tests/controllers/item_controller_class_test.js +++ b/packages_es6/ember-runtime/tests/controllers/item_controller_class_test.js @@ -287,7 +287,7 @@ test("target and parentController are set to the concrete parentController", fun equal(itemController.get('parentController'), parent); equal(itemController.get('target'), parent); - Ember.run(function() { + run(function() { parent.destroy(); virtual.destroy(); }); @@ -326,7 +326,7 @@ test("`itemController`'s life cycle should be entangled with its parent controll var tywinController = arrayController.objectAtContent(0), jaimeController = arrayController.objectAtContent(1); - Ember.run(arrayController, 'destroy'); + run(arrayController, 'destroy'); equal(tywinController.get('isDestroyed'), true); equal(jaimeController.get('isDestroyed'), true);
Remove global Ember.run reference from itemControllers.
emberjs_ember.js
train
js
7ad9301636d448a69db7bb95a06ac58a0608e67e
diff --git a/src/basis/dom/wrapper.js b/src/basis/dom/wrapper.js index <HASH>..<HASH> 100644 --- a/src/basis/dom/wrapper.js +++ b/src/basis/dom/wrapper.js @@ -681,7 +681,7 @@ this.childNodesState = Object(stateCode); this.childNodesState.data = data; - this.emit_stateChanged(oldState); + this.emit_childNodesStateChanged(oldState); } },
fix wrong event type emit in setChildNodesState
basisjs_basisjs
train
js
8263b93f8cdb59e0bff599797b0016661e80ea8a
diff --git a/cmd/login_cloud.go b/cmd/login_cloud.go index <HASH>..<HASH> 100644 --- a/cmd/login_cloud.go +++ b/cmd/login_cloud.go @@ -69,7 +69,7 @@ This will set the default token used when just "k6 run -o cloud" is passed.`, } if res.Token == "" { - return errors.New("Your account has no API token, please generate one: \"https://app.loadimpact.com/account/token\".") + return errors.New(`Your account has no API token, please generate one: "https://app.loadimpact.com/account/token".`) } conf.Token = res.Token
Use backticks instead of quotes"
loadimpact_k6
train
go
caa8bd25477d79419f1cec200dee7d97f2901c7c
diff --git a/addon/components/sl-panel.js b/addon/components/sl-panel.js index <HASH>..<HASH> 100755 --- a/addon/components/sl-panel.js +++ b/addon/components/sl-panel.js @@ -18,7 +18,6 @@ export default Ember.Component.extend({ /** @type {String[]} */ classNameBindings: [ - 'loading:sl-loading', 'themeClassName' ], diff --git a/tests/integration/components/sl-panel-test.js b/tests/integration/components/sl-panel-test.js index <HASH>..<HASH> 100755 --- a/tests/integration/components/sl-panel-test.js +++ b/tests/integration/components/sl-panel-test.js @@ -58,8 +58,8 @@ test( 'Loading state applies class name', function( assert ) { ` ); assert.ok( - this.$( '>:first-child' ).hasClass( 'sl-loading' ), - 'Rendered component has class "sl-loading"' + this.$( '>:first-child' ).find( '> .panel-body' ).hasClass( 'sl-loading' ), + 'Rendered component body has class "sl-loading"' ); });
Closes softlayer/sl-ember-components#<I>
softlayer_sl-ember-components
train
js,js
1dc41768213331ae339ef4b8d956fe97de9330cf
diff --git a/src/main/java/nl/hsac/fitnesse/fixture/slim/web/NgBrowserTest.java b/src/main/java/nl/hsac/fitnesse/fixture/slim/web/NgBrowserTest.java index <HASH>..<HASH> 100644 --- a/src/main/java/nl/hsac/fitnesse/fixture/slim/web/NgBrowserTest.java +++ b/src/main/java/nl/hsac/fitnesse/fixture/slim/web/NgBrowserTest.java @@ -134,7 +134,6 @@ public class NgBrowserTest extends BrowserTest { } public int numberOf(String repeater) { - waitForAngularRequestsToFinish(); return findRepeaterRows(repeater).size(); }
No need for explicit wait, this is already done
fhoeben_hsac-fitnesse-fixtures
train
java
3d30cea0cccd5688424c023bedf49e1ca8b53b08
diff --git a/source/org/jasig/portal/StylesheetSet.java b/source/org/jasig/portal/StylesheetSet.java index <HASH>..<HASH> 100644 --- a/source/org/jasig/portal/StylesheetSet.java +++ b/source/org/jasig/portal/StylesheetSet.java @@ -78,7 +78,9 @@ public class StylesheetSet extends SAXFilterImpl StylesheetSet dummy=new StylesheetSet (); parser.setDocumentHandler (dummy); URL url=expandSystemId (uri); - if (url!=null) parser.parse (new org.xml.sax.InputSource (url.openStream ())); + java.io.InputStream is=url.openStream(); + if (url!=null) parser.parse (new org.xml.sax.InputSource (is)); + is.close(); this.title_table=dummy.getTitleTable (); } catch (Exception e)
fixed so the uri stream is now closed git-svn-id: <URL>
Jasig_uPortal
train
java
be0a1c92be303872c9736f972335cfd6e5fd8274
diff --git a/bin/copy-assets.js b/bin/copy-assets.js index <HASH>..<HASH> 100644 --- a/bin/copy-assets.js +++ b/bin/copy-assets.js @@ -233,7 +233,7 @@ function start() { } console.log("[copy-assets] make webpack bundles"); - makeBundle({ + return makeBundle({ outputPath: path.join(mcPath, bundlePath), projectPath, watch, @@ -299,6 +299,6 @@ if (process.argv[1] == __filename) { updateAssets = assets; watch = _watch mcPath = mc - start(); + return start(); } } diff --git a/bin/copy.js b/bin/copy.js index <HASH>..<HASH> 100644 --- a/bin/copy.js +++ b/bin/copy.js @@ -15,5 +15,9 @@ const assets = args.assets console.log(`Copying Files to ${mc} with params: `, {watch, assets, symlink}) -copyAssets({ assets, mc, watch, symlink}) -copyModules({ mc, watch }) +async function start() { + await copyAssets({ assets, mc, watch, symlink}) + await copyModules({ mc, watch }) +} + +start();
[releases] fix timing issue with bin/copy (#<I>)
firefox-devtools_debugger
train
js,js
12f883e20d96f82588a8806559a0dd9b55b3e001
diff --git a/gdown/cli.py b/gdown/cli.py index <HASH>..<HASH> 100644 --- a/gdown/cli.py +++ b/gdown/cli.py @@ -60,7 +60,7 @@ def main(): parser.add_argument( "url_or_id", help="url or file/folder id (with --id) to download from" ) - parser.add_argument("-O", "--output", help="output filename") + parser.add_argument("-O", "--output", help="output file name / path") parser.add_argument( "-q", "--quiet", action="store_true", help="suppress standard output" ) @@ -130,9 +130,11 @@ def main(): if args.folder: download_folder( url=url, + output=args.output, quiet=args.quiet, proxy=args.proxy, speed=args.speed, + use_cookies=not args.no_cookies, ) return
Add support for directory structure in CLI
wkentaro_gdown
train
py
a8f62fd7e8bd907fbfb5f87df863e8279debb295
diff --git a/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/publisher/GenericPublisher.java b/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/publisher/GenericPublisher.java index <HASH>..<HASH> 100644 --- a/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/publisher/GenericPublisher.java +++ b/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/publisher/GenericPublisher.java @@ -175,9 +175,7 @@ public class GenericPublisher implements MessagePublisher { for (Message message : messages) { publishMessage(message, deliveryOptions, channel); } - LOGGER.info("Committing transaction"); commitTransaction(); - LOGGER.info("Transaction committed"); } catch (IOException e) { rollbackTransaction(); throw e;
Removed redundant logging of transaction commits.
awin_rabbiteasy
train
java
a33674202350cbccdfe3ca6be7dd93a1e22ce3ad
diff --git a/waldur_core/server/base_settings.py b/waldur_core/server/base_settings.py index <HASH>..<HASH> 100644 --- a/waldur_core/server/base_settings.py +++ b/waldur_core/server/base_settings.py @@ -293,6 +293,7 @@ WALDUR_CORE_PUBLIC_SETTINGS = [ 'OWNERS_CAN_MANAGE_OWNERS', 'COMPANY_TYPES', 'NATIVE_NAME_ENABLED', + 'ONLY_STAFF_MANAGES_SERVICES', ] for ext in WaldurExtension.get_extensions():
Expose WALDUR_CORE.ONLY_STAFF_MANAGES_SERVICES configuration via public endpoint [WAL-<I>] It is needed in HomePort in order to toggle visibility of actions.
opennode_waldur-core
train
py
693d8c9dab831905fc3dc268cec3e1156eb121d2
diff --git a/confidence.py b/confidence.py index <HASH>..<HASH> 100644 --- a/confidence.py +++ b/confidence.py @@ -3,6 +3,7 @@ from enum import IntEnum from functools import partial from itertools import chain, product from os import environ, path +import re import yaml @@ -321,8 +322,13 @@ def read_envvars(name, extension): if not values: return NotConfigured - # treat _'s as separators, FOO_NS_KEY=bar resulting in {'ns': {'key': 'bar'}} - return Configuration(values, separator='_') + def dotted(name): + # replace 'regular' underscores (those between alphanumeric characters) with dots first + name = re.sub(r'([0-9A-Za-z])_([0-9A-Za-z])', r'\1.\2', name) + # unescape double underscores back to a single one + return re.sub(r'__', '_', name) + + return Configuration({dotted(name): value for name, value in values.items()}) def read_envvar_file(name, extension):
Enable escaping underscores in envvars Environment variable NAME_FOO__BAR_KEY would result in c.foo_bar.key containing the configured value.
HolmesNL_confidence
train
py
d5d9c5e58381d2d7ba92ed4c8c6c6c4e5a8d0a9b
diff --git a/abstract.js b/abstract.js index <HASH>..<HASH> 100644 --- a/abstract.js +++ b/abstract.js @@ -113,7 +113,12 @@ ee(Object.defineProperties(PersistenceDriver.prototype, assign({ return this._getRaw(id).finally(this._onOperationEnd); }), _getRawObject: d(function (ownerId, keyPaths) { - return this.__getRawObject(ownerId, keyPaths).invoke('sort', byStamp); + return this.onWriteDrain(function () { + ++this._writeLock; + return this.__getRawObject(ownerId, keyPaths).invoke('sort', byStamp).finally(function () { + --this._writeLock; + }.bind(this)); + }.bind(this)); }), getObject: d(function (ownerId/*, options*/) { var keyPaths, options = arguments[1];
Wrap _getRawObject with write lock
medikoo_dbjs-persistence
train
js
90d49afce4e6cb138efe2a49b6a6a3b198e2828d
diff --git a/src/lokijs.js b/src/lokijs.js index <HASH>..<HASH> 100644 --- a/src/lokijs.js +++ b/src/lokijs.js @@ -2798,24 +2798,21 @@ return; } - if (this.sortFunction) { - this.resultset.sort(this.sortFunction); - } - - if (this.sortCriteria) { - this.resultset.compoundsort(this.sortCriteria); - } - - if (!this.options.persistent) { + if (this.sortDirty) { + if (this.sortFunction) { + this.resultset.sort(this.sortFunction); + } else if (this.sortCriteria) { + this.resultset.compoundsort(this.sortCriteria); + } + this.sortDirty = false; - this.emit('rebuild', this); - return; } - // persistent view, rebuild local resultdata array - this.resultdata = this.resultset.data(); - this.resultsdirty = false; - this.sortDirty = false; + if (this.options.persistent) { + // persistent view, rebuild local resultdata array + this.resultdata = this.resultset.data(); + this.resultsdirty = false; + } this.emit('rebuild', this); };
Refactoring the logic of performSortPhase() a little bit
techfort_LokiJS
train
js
6f67a252083dddf8baefb0a59009787c65640b09
diff --git a/Kwf/Component/Events/ViewCache.php b/Kwf/Component/Events/ViewCache.php index <HASH>..<HASH> 100644 --- a/Kwf/Component/Events/ViewCache.php +++ b/Kwf/Component/Events/ViewCache.php @@ -77,7 +77,6 @@ class Kwf_Component_Events_ViewCache extends Kwf_Component_Events public function onRowUpdatesFinished(Kwf_Component_Event_Row_UpdatesFinished $event) { if ($this->_updates) { - $select = new Kwf_Model_Select(); $or = array(); foreach ($this->_updates as $key => $values) { if ($key === 'db_id') { @@ -109,7 +108,14 @@ class Kwf_Component_Events_ViewCache extends Kwf_Component_Events $or[] = new Kwf_Model_Select_Expr_And($and); } } - $select->where(new Kwf_Model_Select_Expr_Or($or)); + $select = new Kwf_Model_Select(); + $select->where($or[0]); + unset($or[0]); + foreach ($or as $i) { + $s = new Kwf_Model_Select(); + $s->where($i); + $select->union($s); + } Kwf_Component_Cache::getInstance()->deleteViewCache($select); $this->_updates = array(); }
use union instead of or: add massive performance improvement when clearing view cache under special circumstances speeds up clearing view cache by a factor of <I> when: - many view cache entries (<I>k+) - many ors (1k+) because deleting cache recursively Reason is that this crappy mysql does a full table scan when using ORs, but doesn't when doing the same with UNION SELECT
koala-framework_koala-framework
train
php
d82052b2f7f895de8d3c1d183e62a0bcb9b8f379
diff --git a/resolver_test.go b/resolver_test.go index <HASH>..<HASH> 100644 --- a/resolver_test.go +++ b/resolver_test.go @@ -149,6 +149,7 @@ func TestHerokuMulti(t *testing.T) { } func TestBlueOvenA(t *testing.T) { + t.Skip("DNS changed 2018-11, so disabling this.") r := New(0) rrs, err := r.ResolveErr("blueoven.com", "A") st.Expect(t, err, nil) @@ -157,6 +158,7 @@ func TestBlueOvenA(t *testing.T) { } func TestBlueOvenAny(t *testing.T) { + t.Skip("DNS changed 2018-11, so disabling this.") r := New(0) rrs, err := r.ResolveErr("blueoven.com", "") st.Expect(t, err, nil) @@ -165,6 +167,7 @@ func TestBlueOvenAny(t *testing.T) { } func TestBlueOvenMulti(t *testing.T) { + t.Skip("DNS changed 2018-11, so disabling this.") r := New(0) _, err := r.ResolveErr("blueoven.com", "A") st.Expect(t, err, nil)
Disable blueoven.com test Something changed in their DNS.
domainr_dnsr
train
go
a76ee1f38b75926179df3224995a72e5def4493e
diff --git a/js/rainbow.js b/js/rainbow.js index <HASH>..<HASH> 100644 --- a/js/rainbow.js +++ b/js/rainbow.js @@ -625,7 +625,7 @@ Rainbow.extend([ 'matches': { 1: 'keyword' }, - 'pattern': /\b(and|array|as|bool(ean)?|catch|char|class|const|def|delete|die|do(uble)?|echo|else(if)?|exit|extends|finally|float|for(each)?|function|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|pub(lic|lished)|re(al|source|turn)|self|short|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while|xor)(?=\(|\b)/g + 'pattern': /\b(and|array|as|bool(ean)?|catch|char|class|const|def|delete|die|do(uble)?|echo|else(if)?|exit|extends|finally|float|for(each)?|function|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/g }, { 'name': 'constant.language',
Remove a few generic regex patterns
ccampbell_rainbow
train
js
a0b6bda30d5451184d526d8c0b5047cfb567f0bb
diff --git a/src/Controller/PageController.php b/src/Controller/PageController.php index <HASH>..<HASH> 100644 --- a/src/Controller/PageController.php +++ b/src/Controller/PageController.php @@ -344,7 +344,7 @@ class PageController extends AbstractActionController $idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', '')); $melisKey = $this->params()->fromRoute('melisKey', ''); $melisTree = $this->getServiceManager()->get('MelisEngineTree'); - $children = $melisTree->getPageChildren($idPage)->count(); + $children = count($melisTree->getPageChildren($idPage)); $view = new ViewModel(); $view->idPage = $idPage; $view->melisKey = $melisKey;
PageController counting resullt issue
melisplatform_melis-cms
train
php
6d162bd11047b2e5196da426a426980d747fd389
diff --git a/src/output-website/album.js b/src/output-website/album.js index <HASH>..<HASH> 100644 --- a/src/output-website/album.js +++ b/src/output-website/album.js @@ -34,8 +34,8 @@ function Album(opts) { Album.prototype.finalize = function(options) { options = _.defaults(options, { - sortAlbumsBy: 'date', - sortMediaBy: 'date' + sortAlbums: 'date', + sortMedia: 'date' }); // is this the top-level album? this.home = this.depth === 0; @@ -86,8 +86,8 @@ Album.prototype.calculateSummary = function() { }; Album.prototype.sort = function(options) { - this.files = _.sortBy(this.files, SORT_MEDIA_BY[options.sortMediaBy]); - this.albums = _.sortBy(this.albums, SORT_ALBUMS_BY[options.sortAlbumsBy]); + this.files = _.sortBy(this.files, SORT_MEDIA_BY[options.sortMedia]); + this.albums = _.sortBy(this.albums, SORT_ALBUMS_BY[options.sortAlbums]); this.albums.forEach(function(nested) { nested.sort(options); });
Fix sorting of albums & media
thumbsup_thumbsup
train
js
fc6ea7e67555aa66222a22c187ade5fbe32a243a
diff --git a/salt/state.py b/salt/state.py index <HASH>..<HASH> 100644 --- a/salt/state.py +++ b/salt/state.py @@ -200,9 +200,9 @@ class Compiler(object): # Is this is a short state? It needs to be padded! if '.' in high[name]: comps = high[name].split('.') - if len(comps) > 2: + if len(comps) >= 2: # Merge the comps - comps[1] == '.'.join(comps[1:len(comps)]) + comps[1] = '.'.join(comps[1:len(comps)]) high[name] = { #'__sls__': template, #'__env__': None, @@ -224,9 +224,9 @@ class Compiler(object): continue if '.' in key: comps = key.split('.') - if len(comps) > 2: + if len(comps) >= 2: # Merge the comps - comps[1] == '.'.join(comps[1:len(comps)]) + comps[1] = '.'.join(comps[1:len(comps)]) # Salt doesn't support state files such as: # # /etc/redis/redis.conf:
fix error in reactor system padding issue with compiler
saltstack_salt
train
py
6d9ca65bd0419086c31435d45d5f62b9d8a8f95d
diff --git a/lib/server.js b/lib/server.js index <HASH>..<HASH> 100644 --- a/lib/server.js +++ b/lib/server.js @@ -239,7 +239,7 @@ function createSocket(options) { // Traverses the given data to check if it contains binary. Even if one of properties of // the given data is binary, it can't be serialized by JSON. var hasBinary = traverse(data).reduce(function(hasBuffer, e) { - return hasBuffer || Buffer.isBuffer(e); + return hasBuffer || Buffer.isBuffer(e) || ArrayBuffer.isView(e); }, false); // If the given data contains binary, serializes an event object to // [MessagePack](http://msgpack.org). Otherwise, use JSON. diff --git a/lib/socket.js b/lib/socket.js index <HASH>..<HASH> 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -350,7 +350,7 @@ module.exports = function(uri, options) { // Traverses the given data to check if it contains binary. Even if one of properties of // the given data is binary, it can't be serialized by JSON. var hasBinary = traverse(data).reduce(function(hasBuffer, e) { - return hasBuffer || Buffer.isBuffer(e); + return hasBuffer || Buffer.isBuffer(e) || ArrayBuffer.isView(e); }, false); // If the given data contains binary, serializes an event object to // [MessagePack](http://msgpack.org). Otherwise, use JSON.
Accept typed arrays in send method Fixes #<I>
cettia_cettia-protocol
train
js,js
ef3d5f1d9ad31e187d463ed9fe9072f0a6129196
diff --git a/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBDataHandler.java b/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBDataHandler.java index <HASH>..<HASH> 100644 --- a/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBDataHandler.java +++ b/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBDataHandler.java @@ -216,11 +216,15 @@ final class MongoDBDataHandler private void setColumnValue(DBObject document, Object entity, Attribute column) { Object value = document.get(((AbstractAttribute) column).getJPAColumnName()); +// BasicDBList if (value != null) { if (column.getJavaType().isAssignableFrom(Map.class)) { PropertyAccessorHelper.set(entity, (Field) column.getJavaMember(), ((BasicDBObject) value).toMap()); + } else if(value instanceof BasicDBList) + { + PropertyAccessorHelper.set(entity, (Field) column.getJavaMember(), ((List) value)); } else {
Added a fix to support List.
Impetus_Kundera
train
java
4592e15498c8e72c92ed50b485c3b0e3988303ce
diff --git a/pypeerassets/transactions.py b/pypeerassets/transactions.py index <HASH>..<HASH> 100644 --- a/pypeerassets/transactions.py +++ b/pypeerassets/transactions.py @@ -93,7 +93,7 @@ def pack_uint64(i): return struct.pack('<L', lower) + struct.pack('<L', upper) -def monosig_script(address): +def monosig_script(address: str) -> bytes: '''returns a mono-signature output script''' hash160 = get_hash160(address)
transactions: monosig_script type hints
PeerAssets_pypeerassets
train
py
96c17db7c00a2890376869a5b1dad79f6d455e1c
diff --git a/lib/starter/markdown.rb b/lib/starter/markdown.rb index <HASH>..<HASH> 100644 --- a/lib/starter/markdown.rb +++ b/lib/starter/markdown.rb @@ -80,6 +80,21 @@ module Starter end end + def gfm_toc(string) + toc = [] + string.each_line do |line| + regex = %r{^(\#{1,8})\s+(.+)$} + if match = regex.match(line) + _all, hashes, text = match.to_a + depth = hashes.size - 1 + text = text.strip + anchor = text.downcase.gsub(/[\s]+/, "-").tr(":`", "") + puts anchor.inspect + toc << (" " * depth) + "* [#{text}](##{anchor})" + end + end + toc.join("\n") + "\n\n" + string + end end
junk method for making a TOC from markdown
pandastrike_starter
train
rb
cf8d0360df508ecef2466bec92691f73b7365ea9
diff --git a/src/ResourceMap.php b/src/ResourceMap.php index <HASH>..<HASH> 100644 --- a/src/ResourceMap.php +++ b/src/ResourceMap.php @@ -259,7 +259,7 @@ class ResourceMap } // Add class to classes array - $this->classes[] = $class; + $this->classes[$path] = $class; return false; }
Added storing a path to class in classes collection
samsonos_php_core
train
php
226cbc066572dcc0be4d0f74bdb05a014797de61
diff --git a/js/src/method.js b/js/src/method.js index <HASH>..<HASH> 100644 --- a/js/src/method.js +++ b/js/src/method.js @@ -2,11 +2,8 @@ define(function() { var $ = { - // Simplified query selector - // - // - $.id - // - $.tag - // - $.qsa + // Simplified query selectors which return the node list + // in an array id: function( selector, context ) { return ( context || document ).getElementById( selector ) }, @@ -23,13 +20,15 @@ var ) }, - // Create a new document fragment or element with/without - // classes + // Create a document fragment, a text node with text + // or an element with/without classes create: function( elem, clazz ) { var elem = '!' === elem ? document.createDocumentFragment() : - document.createElement( elem ) + '' === elem ? + document.createTextNode( clazz ) : + document.createElement( elem ) ; try { @@ -52,7 +51,7 @@ var return node.parentNode.removeChild( node ) }, - // Set attributes all in once with object + // Set attributes all in once with an object setAttr: function( target, attr ) { var len = attr.length
short for `createTextNode`
ethantw_Han
train
js
6bfef447789d0f84eb06d37abbc717642483e67c
diff --git a/docs/source/conf.py b/docs/source/conf.py index <HASH>..<HASH> 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -55,7 +55,7 @@ repo_name = u"dtool_irods" # built documents. # # The short X.Y version. -version = u"0.5.2" +version = u"0.6.0" # The full version, including alpha/beta/rc tags. release = version diff --git a/dtool_irods/__init__.py b/dtool_irods/__init__.py index <HASH>..<HASH> 100644 --- a/dtool_irods/__init__.py +++ b/dtool_irods/__init__.py @@ -4,7 +4,7 @@ import sys import logging from subprocess import Popen, PIPE -__version__ = "0.5.2" +__version__ = "0.6.0" logger = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup url = "https://github.com/jic-dtool/dtool-irods" -version = "0.5.2" +version = "0.6.0" readme = open('README.rst').read() setup(
Update version number to <I>
jic-dtool_dtool-irods
train
py,py,py
18138fa4c781b05ff4f091135644963a1024cad9
diff --git a/system/Common.php b/system/Common.php index <HASH>..<HASH> 100644 --- a/system/Common.php +++ b/system/Common.php @@ -813,11 +813,6 @@ if (! function_exists('old')) { return $default; } - // If the result was serialized array or string, then unserialize it for use... - if (is_string($value) && (strpos($value, 'a:') === 0 || strpos($value, 's:') === 0)) { - $value = unserialize($value); - } - return $escape === false ? $value : esc($value, $escape); } } diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index <HASH>..<HASH> 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -300,7 +300,7 @@ final class CommonFunctionsTest extends CIUnitTestCase $_GET = ['foo' => 'bar']; $_POST = [ 'bar' => 'baz', - 'zibble' => serialize('fritz'), + 'zibble' => 'fritz', ]; $response = new RedirectResponse(new App());
fix: remove unserialize() in old() I can't think of any use cases.
codeigniter4_CodeIgniter4
train
php,php
a81a6fe23cf5e864cdb56584f43ca9a05732c00e
diff --git a/salt/states/user.py b/salt/states/user.py index <HASH>..<HASH> 100644 --- a/salt/states/user.py +++ b/salt/states/user.py @@ -67,7 +67,7 @@ def _changes(name, workphone='', homephone='', loginclass=None, - date=0, + date=None, mindays=0, maxdays=999999, inactdays=0, @@ -134,7 +134,7 @@ def _changes(name, change['passwd'] = password if empty_password and lshad['passwd'] != '': change['empty_password'] = True - if date and date is not 0 and lshad['lstchg'] != date: + if date is not None and lshad['lstchg'] != date: change['date'] = date if mindays and mindays is not 0 and lshad['min'] != mindays: change['mindays'] = mindays @@ -675,7 +675,7 @@ def present(name, 'empty password'.format(name) ret['result'] = False ret['changes']['password'] = '' - if date: + if date is not None: __salt__['shadow.set_date'](name, date) spost = __salt__['shadow.info'](name) if spost['lstchg'] != date:
fix #<I>; allow for date param to be 0
saltstack_salt
train
py
3c54e856ac9ff983ca0d12973f6f0a1b45b359f7
diff --git a/lib/binary_parser/built_in_template/uint.rb b/lib/binary_parser/built_in_template/uint.rb index <HASH>..<HASH> 100755 --- a/lib/binary_parser/built_in_template/uint.rb +++ b/lib/binary_parser/built_in_template/uint.rb @@ -5,7 +5,7 @@ module BinaryParser include Comparable def content_description - self.to_i.to_s + "#{self.to_i.to_s} (0x#{self.to_i.to_s(16)})" end def to_s(base=10)
let content_description of UInt be with Hex-num
sawaken_ruby-binary-parser
train
rb
f8d950d00451293d4cd2a773d3cba03e7cbbfb30
diff --git a/src/request/import/ImportWords.js b/src/request/import/ImportWords.js index <HASH>..<HASH> 100644 --- a/src/request/import/ImportWords.js +++ b/src/request/import/ImportWords.js @@ -135,7 +135,7 @@ class ImportWords { 'earth', 'sketch', 'motor', 'short', 'make', 'exact', 'diary', 'broccoli', 'frost', 'disorder', 'pave', 'wrestle', - 'broken', 'mercy', 'crime', 'car', + 'broken', 'mercy', 'crime', 'dismiss', ], [ 'spare', 'ribbon', 'onion', 'drift',
Fix demo words Broke them in #<I>.
nimiq_keyguard-next
train
js
05b53e3a88f91d6ab952b0abca96c687afe62653
diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js index <HASH>..<HASH> 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/main.js +++ b/server/sonar-web/src/main/js/components/source-viewer/main.js @@ -46,7 +46,7 @@ define([ className: 'source-viewer', template: Templates['source-viewer'], - ISSUES_LIMIT: 100, + ISSUES_LIMIT: 3000, LINES_LIMIT: 1000, TOTAL_LINES_LIMIT: 3000, LINES_AROUND: 500, @@ -85,7 +85,6 @@ define([ this.issueViews = []; this.loadSourceBeforeThrottled = _.throttle(this.loadSourceBefore, 1000); this.loadSourceAfterThrottled = _.throttle(this.loadSourceAfter, 1000); - this.scrollTimer = null; this.highlightedLine = null; this.listenTo(this, 'loaded', this.onLoaded); }, @@ -279,7 +278,7 @@ define([ resolved: false, s: 'FILE_LINE', asc: true, - ignorePaging: true + ps: this.ISSUES_LIMIT } }; return this.issues.fetch(options).done(function () {
SONAR-<I> limit number of issues loaded in source viewer
SonarSource_sonarqube
train
js
c664ac1630f142edc51af33524c54543998f0e4d
diff --git a/src/gateways/Gateway.php b/src/gateways/Gateway.php index <HASH>..<HASH> 100644 --- a/src/gateways/Gateway.php +++ b/src/gateways/Gateway.php @@ -681,10 +681,16 @@ class Gateway extends BaseGateway */ public function refund(Transaction $transaction, $amount): RequestResponseInterface { + $currency = Commerce::getInstance()->getCurrencies()->getCurrencyByIso($transaction->paymentCurrency); + + if (!$currency) { + throw new NotSupportedException('The currency “'.$transaction->paymentCurrency.'” is not supported!'); + } + try { $request = [ 'charge' => $transaction->reference, - 'amount' => $amount + 'amount' => $amount * (10 ** $currency->minorUnit), ]; $refund = Refund::create($request);
Refunds should be in cents
craftcms_commerce-stripe
train
php
7cc6f119bdbea0a9760e94e63c092db97e35f8fa
diff --git a/test/reducersSpec.js b/test/reducersSpec.js index <HASH>..<HASH> 100644 --- a/test/reducersSpec.js +++ b/test/reducersSpec.js @@ -1,5 +1,5 @@ import * as Actions from '../app/actions'; -import { newId, nodes, lastId, copyNode } from '../app/reducers'; +import { newId, nodes, lastId, copyNode } from '../app/reducers/nodes'; import chai from 'chai'; import R from 'ramda';
fix(tests): fix path to nodes reducer
xodio_xod
train
js
4ff9d1ebb781d9e3d2c00e0b1e9453742b746cb0
diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -117,6 +117,12 @@ func NewFromConfig(conf Config) (ret Server, err error) { } func (s *Server) HandlePacket(packet []byte) { + if len(packet) == 0 { + // a lot of clients send packets that accidentally have a trailing + // newline, it's easier to just let them be + return + } + if bytes.HasPrefix(packet, []byte{'_', 'e', '{'}) { event, err := ParseEvent(packet) if err != nil {
Ignore empty packets Typically caused by trailing newlines. We don't get much out of fixing the clients that generate these, and they generate a lot of log/sentry noise, so let's just politely ignore them.
stripe_veneur
train
go
376dfcb63068f7c7395701b948d95bd8f9e76116
diff --git a/core-bundle/src/Cors/WebsiteRootsConfigProvider.php b/core-bundle/src/Cors/WebsiteRootsConfigProvider.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Cors/WebsiteRootsConfigProvider.php +++ b/core-bundle/src/Cors/WebsiteRootsConfigProvider.php @@ -11,6 +11,7 @@ namespace Contao\CoreBundle\Cors; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Exception\ConnectionException; use Nelmio\CorsBundle\Options\ProviderInterface; use Symfony\Component\HttpFoundation\Request; @@ -79,6 +80,10 @@ class WebsiteRootsConfigProvider implements ProviderInterface */ private function canRunDbQuery() { - return $this->connection->isConnected() && $this->connection->getSchemaManager()->tablesExist(['tl_page']); + try { + return $this->connection->isConnected() && $this->connection->getSchemaManager()->tablesExist(['tl_page']); + } catch (ConnectionException $e) { + return false; + } } }
[Core] Wrap the tableExists() call into a try-catch block (see #<I>).
contao_contao
train
php
56a4eb022d47104b098e9052299e3e81a2663bfd
diff --git a/tds/src/main/java/thredds/server/opendap/OpendapServlet.java b/tds/src/main/java/thredds/server/opendap/OpendapServlet.java index <HASH>..<HASH> 100644 --- a/tds/src/main/java/thredds/server/opendap/OpendapServlet.java +++ b/tds/src/main/java/thredds/server/opendap/OpendapServlet.java @@ -852,6 +852,7 @@ public class OpendapServlet extends javax.servlet.http.HttpServlet { private void sendErrorResponse(HttpServletResponse response, int errorCode, String errorMessage) throws IOException { log.info(UsageLog.closingMessageForRequestContext(errorCode, -1)); response.setStatus(errorCode); + response.setHeader( "Content-Description", "dods-error" ); response.setContentType("text/plain"); PrintWriter pw = new PrintWriter(response.getOutputStream());
Fix OPeNDAP error responses to have "dods-error" value in the "Content-Description" header.
Unidata_thredds
train
java
389d92a28bb366b10e98be457ed7ca5d56425a7f
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,9 +54,10 @@ copyright = u'2014, Tevin Zhang' # built documents. # # The short X.Y version. -version = '0.1' +import mongu +version = mongu.__version__ # The full version, including alpha/beta/rc tags. -release = '0.1' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.
make version in documentation same as mongu.py
tevino_mongu
train
py
166fb6617b8b4f12d8d1ff3836cdefa70d6e02da
diff --git a/pyani/scripts/parsers/anib_parser.py b/pyani/scripts/parsers/anib_parser.py index <HASH>..<HASH> 100644 --- a/pyani/scripts/parsers/anib_parser.py +++ b/pyani/scripts/parsers/anib_parser.py @@ -44,6 +44,7 @@ THE SOFTWARE. from argparse import ArgumentDefaultsHelpFormatter +from pyani import pyani_config from pyani.scripts import subcommands @@ -52,4 +53,29 @@ def build(subps, parents=None): parser = subps.add_parser( "anib", parents=parents, formatter_class=ArgumentDefaultsHelpFormatter ) + # Required positional arguments: input and output directories + parser.add_argument( + action="store", dest="indir", default=None, help="input genome directory" + ) + parser.add_argument( + action="store", + dest="outdir", + default=None, + help="output analysis results directory", + ) + # Optional arguments + parser.add_argument( + "--dbpath", + action="store", + dest="dbpath", + default=".pyani/pyanidb", + help="path to pyani database", + ) + parser.add_argument( + "--nucmer_exe", + dest="nucmer_exe", + action="store", + default=pyani_config.NUCMER_DEFAULT, + help="path to NUCmer executable", + ) parser.set_defaults(func=subcommands.subcmd_anib)
update pyani CLI parser for anib subcommand
widdowquinn_pyani
train
py
21cab7866ce895e75f492ea47d7a3882ffad73c7
diff --git a/addon/components/inputs/when.js b/addon/components/inputs/when.js index <HASH>..<HASH> 100644 --- a/addon/components/inputs/when.js +++ b/addon/components/inputs/when.js @@ -54,6 +54,7 @@ export default AbstractInput.extend({ /** * The date format to be used in the date-time-picker * @param {Object} cellConfig - contains the dateFormat "string" property (a valid moment format) + * @see {@link https://momentjs.com/docs/#/displaying/format} * @returns {String} the date format */ dateFormat (cellConfig) { @@ -65,6 +66,7 @@ export default AbstractInput.extend({ /** * The time format to be used in the date-time-picker * @param {Object} cellConfig - contains the timeFormat "string" property (a valid moment format) + * @see {@link https://momentjs.com/docs/#/displaying/format} * @returns {String} the time format */ timeFormat (cellConfig) { @@ -76,6 +78,7 @@ export default AbstractInput.extend({ /** * The date time format to be used for formating the value sent to the bunsen model * @param {Object} cellConfig - contains the dateTimeFormat "string" property (a valid moment format) + * @see {@link https://momentjs.com/docs/#/displaying/format} * @returns {String} the date time format */ dateTimeFormat (cellConfig) {
added link to valid date formats for docBlock header
ciena-frost_ember-frost-bunsen
train
js
3dc5ba5fac4fd7c804b8b15c1f0a98d0c045aa7e
diff --git a/lib/dynamoid/document.rb b/lib/dynamoid/document.rb index <HASH>..<HASH> 100644 --- a/lib/dynamoid/document.rb +++ b/lib/dynamoid/document.rb @@ -138,13 +138,11 @@ module Dynamoid #:nodoc: @associations ||= {} @attributes_before_type_cast ||= {} - attrs_with_defaults = self.class.attributes.reduce({}) do |res, (attribute, options)| + attrs_with_defaults = self.class.attributes.each_with_object({}) do |(attribute, options), res| if attrs.key?(attribute) - res.merge(attribute => attrs[attribute]) + res[attribute] = attrs[attribute] elsif options.key?(:default) - res.merge(attribute => evaluate_default_value(options[:default])) - else - res + res[attribute] = evaluate_default_value(options[:default]) end end
Allocate only one hash to initialize the attributes of the document
Dynamoid_dynamoid
train
rb
7cd7a7d047829508e969076380965ff16590cffd
diff --git a/src/wa_kat/settings.py b/src/wa_kat/settings.py index <HASH>..<HASH> 100755 --- a/src/wa_kat/settings.py +++ b/src/wa_kat/settings.py @@ -148,11 +148,15 @@ def _read_from_paths(): def _apply_settings(): + """ + Read variables from the possible paths. Assert that constraints are set. + """ _substitute_globals( json.loads(_read_from_paths()) ) - _assert_constraints() + if not os.environ.get('READTHEDOCS'): + _assert_constraints() _apply_settings()
#<I>: Do not assert coinstraints in case of READTHEDOCS env var is set.
WebarchivCZ_WA-KAT
train
py
76c7aa7082e5533441e464d1355d398996288686
diff --git a/pachyderm/alice/utils.py b/pachyderm/alice/utils.py index <HASH>..<HASH> 100644 --- a/pachyderm/alice/utils.py +++ b/pachyderm/alice/utils.py @@ -118,10 +118,13 @@ def copy_from_alien(inputfile: Union[Path, str], outputfile: Union[Path, str]) - # Create the output location logger.info(f"Copying {inputfile} to {outputfile}") outputfile.parent.mkdir(mode = 0o755, exist_ok = True, parents = True) - subprocess.run( + process = subprocess.run( ["alien_cp", f"alien://{inputfile}", str(outputfile)], - stdout = subprocess.PIPE, stderr = subprocess.PIPE, check = True + stdout = subprocess.PIPE, stderr = subprocess.PIPE ) + if process.returncode: + # Process failed. Return false so we can try again. + return False # Check that the file was copied successfully. if outputfile.exists():
Improve supported for failed copying from AliEn
raymondEhlers_pachyderm
train
py
bf34a3b4864f56382a8591abd8bef2124fe85360
diff --git a/dictionaries/PropertyMap.php b/dictionaries/PropertyMap.php index <HASH>..<HASH> 100644 --- a/dictionaries/PropertyMap.php +++ b/dictionaries/PropertyMap.php @@ -186,8 +186,11 @@ return [ 'documentElement' => 'DOMElement', 'documentURI' => 'string', 'encoding' => 'string', + 'firstElementChild' => 'DOMElement|null', 'formatOutput' => 'bool', + 'childElementCount' => 'int', 'implementation' => 'DOMImplementation', + 'lastElementChild' => 'DOMElement|null', 'preserveWhiteSpace' => 'bool', 'recover' => 'bool', 'resolveExternals' => 'bool', @@ -316,6 +319,11 @@ return [ 'schemaTypeInfo' => 'bool', 'tagName' => 'string', 'attributes' => 'DOMNamedNodeMap<DOMAttr>', + 'childElementCount' => 'int', + 'firstElementChild' => 'DOMElement|null', + 'lastElementChild' => 'DOMElement|null', + 'nextElementSibling' => 'DOMElement|null', + 'previousElementSibling' => 'DOMElement|null', ], 'tidynode' => [ 'value' => 'string',
DOMParentNode and DOMChildNode stubs (php 8) are missing #<I>
vimeo_psalm
train
php
11a8e9a4b3a0f7e7e7a6aadc9c2061768a1a02a6
diff --git a/src/main/java/cz/jiripinkas/jsitemapgenerator/WebPage.java b/src/main/java/cz/jiripinkas/jsitemapgenerator/WebPage.java index <HASH>..<HASH> 100644 --- a/src/main/java/cz/jiripinkas/jsitemapgenerator/WebPage.java +++ b/src/main/java/cz/jiripinkas/jsitemapgenerator/WebPage.java @@ -13,12 +13,27 @@ public class WebPage implements Comparable<WebPage> { private Date lastMod; private ChangeFreq changeFreq; private Double priority; - private static final double MIN_PRIORITY = 0.0, MAX_PRIORITY = 1.0; + private static final double MIN_PRIORITY = 0.0; + private static final double MAX_PRIORITY = 1.0; private String shortDescription; private String shortName; private List<Image> images; + /** + * Method for creating WebPage only with name + * (this can be useful for really simple sitemaps + * or with combination of default settings + * set on SitemapGenerator) + * @param name Name + * @return WebPage instance + */ + public static WebPage of(String name) { + WebPage webPage = new WebPage(); + webPage.setName(name); + return webPage; + } + public WebPage addImage(Image image) { if (images == null) { images = new ArrayList<>();
added easiest method of creating WebPage: WebPage.of(name)
jirkapinkas_jsitemapgenerator
train
java
bcc72d067e12c577f8549a40d1e2a55a562cadc5
diff --git a/src/core/const.js b/src/core/const.js index <HASH>..<HASH> 100644 --- a/src/core/const.js +++ b/src/core/const.js @@ -10,6 +10,13 @@ var constants = require('../../lib/pixi/src/core/const'); constants.VERSION = require('../../package.json').version; /** + * String of the current PIXI version + * @constant + * @property {string} PIXI_VERSION + */ +constants.PIXI_VERSION = require('../../lib/pixi/package.json').version; + +/** * Constant to identify the Audio Type. * * @static diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,14 @@ -var core = require('./core'); +var core = require('./core'), + CONST = require('./core/const'); //TODO: Add here addons core.Scene = require('./display/Scene'); +//Add Constants to the main object +for(var key in CONST){ + core[key] = CONST[key]; +} + +//TODO: Add class system + module.exports = core; \ No newline at end of file
add PIXI_VERSION in constants, and add all constants to the main namespace)
Nazariglez_perenquen
train
js,js
c94d2a623ebbadd6cf92f0d6dd80e321aaa82186
diff --git a/src/main/java/il/ac/bgu/cs/bp/bpjs/model/BThreadSyncSnapshot.java b/src/main/java/il/ac/bgu/cs/bp/bpjs/model/BThreadSyncSnapshot.java index <HASH>..<HASH> 100644 --- a/src/main/java/il/ac/bgu/cs/bp/bpjs/model/BThreadSyncSnapshot.java +++ b/src/main/java/il/ac/bgu/cs/bp/bpjs/model/BThreadSyncSnapshot.java @@ -188,6 +188,9 @@ public class BThreadSyncSnapshot implements Serializable { final int prime = 31; int result = 1; result = prime * result + Objects.hashCode(name.hashCode()); + if (continuation != null) { + result += getContinuationProgramState().hashCode(); + } return result; }
Bugfix, if we have a continuation, calculate the hash of the ContinuationProgramState.
bThink-BGU_BPjs
train
java
2fd86f5cfaad6048b0a60a0db7e9a35945348f4b
diff --git a/Tests/Liip/Drupal/Modules/Registry/Lucene/ElasticsearchTest.php b/Tests/Liip/Drupal/Modules/Registry/Lucene/ElasticsearchTest.php index <HASH>..<HASH> 100644 --- a/Tests/Liip/Drupal/Modules/Registry/Lucene/ElasticsearchTest.php +++ b/Tests/Liip/Drupal/Modules/Registry/Lucene/ElasticsearchTest.php @@ -38,6 +38,19 @@ class ElasticsearchTest extends RegistryTestCase } /** + * @covers \Liip\Drupal\Modules\Registry\Lucene\Elasticsearch::validateOptions + */ + public function testValidateElasticDependency() + { + $registry = $this->getProxyBuilder('\Liip\Drupal\Modules\Registry\Lucene\Elasticsearch') + ->disableOriginalConstructor() + ->setMethods(array('validateElasticaDependency')) + ->getProxy(); + + $this->assertNull($registry->validateElasticaDependency()); + } + + /** * @covers \Liip\Drupal\Modules\Registry\Lucene\Elasticsearch::validateElasticaDependency */ public function testInvalidateElasticaDependency()
Tested: added a verification to determine if the mandatory elasticsearch library is available and can be loaded.
liip_LiipDrupalRegistryModule
train
php
fe9ac58af1dc3ada5d27e66153d7d657880ec922
diff --git a/src/main/java/org/umlgraph/doclet/ClassGraph.java b/src/main/java/org/umlgraph/doclet/ClassGraph.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/umlgraph/doclet/ClassGraph.java +++ b/src/main/java/org/umlgraph/doclet/ClassGraph.java @@ -860,7 +860,16 @@ class ClassGraph { printInferredDependencies(c); } } - + + /** Returns an array representing the imported classes of c. + * Disables the deprecation warning, which is output, because the + * imported classed are an implementation detail. + */ + @SuppressWarnings( "deprecation" ) + ClassDoc[] importedClasses(ClassDoc c) { + return c.importedClasses(); + } + /** * Prints dependencies recovered from the methods of a class. A * dependency is inferred only if another relation between the two @@ -898,11 +907,11 @@ class ClassGraph { if(tv.bounds().length > 0 ) types.addAll(Arrays.asList(tv.bounds())); } - + // and finally check for explicitly imported classes (this // assumes there are no unused imports...) if (opt.useImports) - types.addAll(Arrays.asList(c.importedClasses())); + types.addAll(Arrays.asList(importedClasses(c))); // compute dependencies for (Type type : types) {
Disable importedClasses deprecation warning In our case an attempt to get the imported classes is justified. Although they are an implementation detail, we document the implementation.
dspinellis_UMLGraph
train
java
e681a5ad20c695ad728fbe14f965c92eb7e6578b
diff --git a/src/Model/Environment.php b/src/Model/Environment.php index <HASH>..<HASH> 100644 --- a/src/Model/Environment.php +++ b/src/Model/Environment.php @@ -391,11 +391,21 @@ class Environment extends Resource implements HasActivitiesInterface /** * Create a backup of the environment. * + * @param bool $unsafeAllowInconsistent + * Whether to allow performing an inconsistent backup (default: false). + * If true, this leaves the environment running and open to connections + * during the backup. So it reduces downtime, at the risk of backing up + * data in an inconsistent state. + * * @return Activity */ - public function backup() + public function backup($unsafeAllowInconsistent = false) { - return $this->runLongOperation('backup'); + $params = []; + if ($unsafeAllowInconsistent) { + $params['safe'] = false; + } + return $this->runLongOperation('backup', 'post', $params); } /**
Add $unsafeAllowInconsistent flag to Environment::backup()
platformsh_platformsh-client-php
train
php
a00108bb9f04d259537ccaf12247419a440274a0
diff --git a/raiden/tests/unit/test_channelstate.py b/raiden/tests/unit/test_channelstate.py index <HASH>..<HASH> 100644 --- a/raiden/tests/unit/test_channelstate.py +++ b/raiden/tests/unit/test_channelstate.py @@ -1453,7 +1453,6 @@ def test_channelstate_unlock_unlocked_onchain(): iteration = channel.handle_channel_settled( channel_state, settle_state_change, - settle_block_number, ) assert search_for_item(iteration.events, ContractSendChannelBatchUnlock, {}) is not None diff --git a/raiden/transfer/channel.py b/raiden/transfer/channel.py index <HASH>..<HASH> 100644 --- a/raiden/transfer/channel.py +++ b/raiden/transfer/channel.py @@ -1867,7 +1867,6 @@ def handle_channel_updated_transfer( def handle_channel_settled( channel_state: NettingChannelState, state_change: ContractReceiveChannelSettled, - block_number: BlockNumber, # pylint: disable=unused-argument ) -> TransitionResult[Optional[NettingChannelState]]: events: List[Event] = list() @@ -1993,7 +1992,6 @@ def state_transition( iteration = handle_channel_settled( channel_state, state_change, - block_number, ) elif type(state_change) == ContractReceiveChannelNewBalance: assert isinstance(state_change, ContractReceiveChannelNewBalance), MYPY_ANNOTATION
Remove block_number param from handle_channel_settled
raiden-network_raiden
train
py,py
fb4a015a8ab79c9b25d8ab4582c7cff5208267e3
diff --git a/generators/docker-compose/index.js b/generators/docker-compose/index.js index <HASH>..<HASH> 100644 --- a/generators/docker-compose/index.js +++ b/generators/docker-compose/index.js @@ -195,7 +195,7 @@ module.exports = yeoman.generators.Base.extend({ var runCommand = 'mvn package docker:build'; } else { var imagePath = this.destinationPath(this.directoryPath + this.appsFolders[i] + '/build/docker/' + _.kebabCase(this.appConfigs[i].baseName) + '-0.0.1-SNAPSHOT.war'); - var runCommand = 'gradle bootRepackage buildDocker'; + var runCommand = './gradlew bootRepackage buildDocker'; } if (!shelljs.test('-f', imagePath)) {
updating gradle command with ./gradlew [ci skip]
jhipster_generator-jhipster
train
js
56db369e699dc30495a96361fd937946ddb52157
diff --git a/nap-www/napwww/model/napmodel.py b/nap-www/napwww/model/napmodel.py index <HASH>..<HASH> 100644 --- a/nap-www/napwww/model/napmodel.py +++ b/nap-www/napwww/model/napmodel.py @@ -326,7 +326,7 @@ class Prefix(NapModel): result = dict() result['result'] = [] result['search_options'] = search_result['search_options'] - for prefix in result['prefix_list']: + for prefix in search_result['prefix_list']: p = Prefix.from_dict(prefix) result['result'].append(p)
Fix bug in search_prefix function Broken since fix of #<I>.
SpriteLink_NIPAP
train
py
5ac9b61077ed1fcb5989b090dba79a0ef70fd2e7
diff --git a/lib/oxidized/model/hpebladesystem.rb b/lib/oxidized/model/hpebladesystem.rb index <HASH>..<HASH> 100644 --- a/lib/oxidized/model/hpebladesystem.rb +++ b/lib/oxidized/model/hpebladesystem.rb @@ -4,10 +4,10 @@ class HPEBladeSystem < Oxidized::Model prompt /.*> / comment '# ' - expect /^\s*--More--\s+.*$/ do |data, re| - send ' ' - data.sub re, '' - end + #expect /^\s*--More--\s+.*$/ do |data, re| + # send ' ' + # data.sub re, '' + #end cmd :all do |cfg| cfg = cfg.delete("\r").each_line.to_a[0..-1].map{|line|line.rstrip}.join("\n") + "\n" @@ -40,6 +40,7 @@ class HPEBladeSystem < Oxidized::Model end cmd 'show network' do |cfg| + cfg.gsub! /Last Update:.*$/i, '' comment cfg end @@ -78,6 +79,7 @@ class HPEBladeSystem < Oxidized::Model end cfg :telnet, :ssh do + post_login "set script mode on" pre_logout "exit" end end
Update hpebladesystem.rb - disable Last Update from NTP in Show Network, because it produced a new version with every backup (show network) - disable parsing of "----More----", it is better to user "Script Mode" (cfg :telnet, :ssh) -> post_login
ytti_oxidized
train
rb
12d113434d3ca6251c7d77bdc5bacff65b3736b6
diff --git a/src/Vinelab/Auth/Social/Providers/Facebook.php b/src/Vinelab/Auth/Social/Providers/Facebook.php index <HASH>..<HASH> 100644 --- a/src/Vinelab/Auth/Social/Providers/Facebook.php +++ b/src/Vinelab/Auth/Social/Providers/Facebook.php @@ -128,8 +128,6 @@ class Facebook extends Provider { * URL to which we should be * redirecting to. * - * @todo use the built-in settings() method - * for retrieval. * * @return string */ @@ -138,9 +136,9 @@ class Facebook extends Provider { $url = $this->settings['authentication_url']; $params = [ - 'client_id' => $this->settings['api_key'], - 'redirect_uri' => $this->settings['redirect_uri'], - 'scope' => $this->settings['permissions'], + 'client_id' => $this->settings('api_key'), + 'redirect_uri' => $this->settings('redirect_uri'), + 'scope' => $this->settings('permissions'), 'state' => $state ];
use the built-in settings method to load settings
Vinelab_social-auth
train
php
3f9fc40774e0711d15635dfba98e927ee0502127
diff --git a/Kwf/Assets/Effects.php b/Kwf/Assets/Effects.php index <HASH>..<HASH> 100644 --- a/Kwf/Assets/Effects.php +++ b/Kwf/Assets/Effects.php @@ -60,7 +60,9 @@ class Kwf_Assets_Effects foreach ($pixels as $k=>$i) { if ($k % 4 == 0) { //first on is red //set it to 0xEE - $pixels[$k] = 0xEE; + if ($pixels[$k] < 0xEE) { + $pixels[$k] = 0xEE; + } } } $im->importImagePixels(0, 0,
don't make it less red, avoid white getting blue
koala-framework_koala-framework
train
php
abd8d73f1eab9b61b10dcdafaece99705cf9b169
diff --git a/src/amcrest/http.py b/src/amcrest/http.py index <HASH>..<HASH> 100644 --- a/src/amcrest/http.py +++ b/src/amcrest/http.py @@ -81,7 +81,7 @@ class Http(System, Network, MotionDetection, Snapshot, req = requests.get(url, auth=auth) req.raise_for_status() - except requests.exceptions.HTTPError: + except requests.HTTPError: # if 401, then try new digest method self._authentication = 'digest' auth = requests.auth.HTTPDigestAuth(self._user, self._password) @@ -156,7 +156,7 @@ class Http(System, Network, MotionDetection, Snapshot, ) resp.raise_for_status() break - except requests.exceptions.HTTPError as error: + except requests.HTTPError as error: _LOGGER.debug("Trying again due error %s", error) continue
Added fix so that correct exception is caught, thus allowing HttpDigestAuth method to be attempted (#<I>)
tchellomello_python-amcrest
train
py
3cb95264dff572434ed72977d78f16ab4fe1dc83
diff --git a/postgres.go b/postgres.go index <HASH>..<HASH> 100644 --- a/postgres.go +++ b/postgres.go @@ -5,6 +5,7 @@ import ( "database/sql/driver" "fmt" "reflect" + "strings" "time" "github.com/lib/pq/hstore" @@ -52,13 +53,31 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string return "hstore" } default: - if _, ok := value.Interface().([]byte); ok { + if isByteArray(value) { + if isUUID(value) { + return "uuid" + } return "bytea" } } panic(fmt.Sprintf("invalid sql type %s (%s) for postgres", value.Type().Name(), value.Kind().String())) } +var byteType = reflect.TypeOf(uint8(0)) + +func isByteArray(value reflect.Value) bool { + return value.Kind() == reflect.Array && value.Type().Elem() == byteType +} + +func isUUID(value reflect.Value) bool { + if value.Type().Len() != 16 { + return false + } + typename := value.Type().Name() + lower := strings.ToLower(typename) + return "uuid" == lower || "guid" == lower +} + func (s postgres) ReturningStr(tableName, key string) string { return fmt.Sprintf("RETURNING %v.%v", tableName, key) }
add binary UUID support to postgres Check if the value is a byte array of <I> bytes and its type is named "uuid" or "guid", and if so, use postgres `uuid` type.
jinzhu_gorm
train
go
5b5c385cd84ca6394fd5161c82cd955a81b0126f
diff --git a/lib/googleapi.php b/lib/googleapi.php index <HASH>..<HASH> 100644 --- a/lib/googleapi.php +++ b/lib/googleapi.php @@ -305,7 +305,7 @@ class google_docs { 'url' => "{$gdoc->link[0]->attributes()->href}", 'source' => $source, 'date' => usertime(strtotime($gdoc->updated)), - 'thumbnail' => $CFG->pixpath.'/f/'.mimeinfo('icon32', $title) + 'thumbnail' => $CFG->wwwroot.'/pix/f/'.mimeinfo('icon32', $title) ); } }
"MDL-<I>, fixed undefined ->pixpath in google docs plugin"
moodle_moodle
train
php
c3cdecdc78b9e1072eaa03e1ead05f28ffd1b21a
diff --git a/manifest.php b/manifest.php index <HASH>..<HASH> 100755 --- a/manifest.php +++ b/manifest.php @@ -30,7 +30,7 @@ return array( 'label' => 'Tao base', 'description' => 'TAO meta-extension', 'license' => 'GPL-2.0', - 'version' => '7.12.0', + 'version' => '7.12.1', 'author' => 'Open Assessment Technologies, CRP Henri Tudor', 'requires' => array( 'generis' => '>=3.0.1', diff --git a/scripts/update/Updater.php b/scripts/update/Updater.php index <HASH>..<HASH> 100644 --- a/scripts/update/Updater.php +++ b/scripts/update/Updater.php @@ -563,7 +563,7 @@ class Updater extends \common_ext_ExtensionUpdater { $this->setVersion('6.1.0'); } - $this->skip('6.1.0', '7.12.0'); + $this->skip('6.1.0', '7.12.1'); } private function migrateFsAccess() {
Bump to version <I>
oat-sa_tao-core
train
php,php
2497684181e131be5616e36bf9cdc6d3da7db290
diff --git a/types.go b/types.go index <HASH>..<HASH> 100644 --- a/types.go +++ b/types.go @@ -613,22 +613,31 @@ type Contact struct { // Location contains information about a place. type Location struct { + // Longitude as defined by sender Longitude float64 `json:"longitude"` - Latitude float64 `json:"latitude"` + // Latitude as defined by sender + Latitude float64 `json:"latitude"` } // Venue contains information about a venue, including its Location. type Venue struct { - Location Location `json:"location"` - Title string `json:"title"` - Address string `json:"address"` - FoursquareID string `json:"foursquare_id"` // optional + // Location venue location + Location Location `json:"location"` + // Title name of the venue + Title string `json:"title"` + // Address of the venue + Address string `json:"address"` + // FoursquareID foursquare identifier of the venue + // optional + FoursquareID string `json:"foursquare_id"` } // UserProfilePhotos contains a set of user profile photos. type UserProfilePhotos struct { - TotalCount int `json:"total_count"` - Photos [][]PhotoSize `json:"photos"` + // TotalCount total number of profile pictures the target user has + TotalCount int `json:"total_count"` + // Photos requested profile pictures (in up to 4 sizes each) + Photos [][]PhotoSize `json:"photos"` } // File contains information about a file to download from Telegram.
Add location, venue and user profile photos type documentation
go-telegram-bot-api_telegram-bot-api
train
go
623c67f82759f75b20834aa82085593d553c6ec6
diff --git a/tests/test_register.py b/tests/test_register.py index <HASH>..<HASH> 100644 --- a/tests/test_register.py +++ b/tests/test_register.py @@ -137,7 +137,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): # let's see what the server received : we should # have 2 similar requests - self.assertTrue(self.conn.reqs, 2) + self.assertEqual(len(self.conn.reqs), 2) req1 = dict(self.conn.reqs[0].headers) req2 = dict(self.conn.reqs[1].headers) @@ -169,7 +169,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): del register_module.input # we should have send a request - self.assertTrue(self.conn.reqs, 1) + self.assertEqual(len(self.conn.reqs), 1) req = self.conn.reqs[0] headers = dict(req.headers) self.assertEqual(headers['Content-length'], '608') @@ -187,7 +187,7 @@ class RegisterTestCase(PyPIRCCommandTestCase): del register_module.input # we should have send a request - self.assertTrue(self.conn.reqs, 1) + self.assertEqual(len(self.conn.reqs), 1) req = self.conn.reqs[0] headers = dict(req.headers) self.assertEqual(headers['Content-length'], '290')
Fix improper tests in RegisterTestCase
pypa_setuptools
train
py
e69d48b4ad960a8c2289856f3247f75734ced32d
diff --git a/clients/unshaded/src/main/java/tachyon/client/block/LocalBlockOutStream.java b/clients/unshaded/src/main/java/tachyon/client/block/LocalBlockOutStream.java index <HASH>..<HASH> 100644 --- a/clients/unshaded/src/main/java/tachyon/client/block/LocalBlockOutStream.java +++ b/clients/unshaded/src/main/java/tachyon/client/block/LocalBlockOutStream.java @@ -67,6 +67,7 @@ public final class LocalBlockOutStream extends BufferedBlockOutStream { RandomAccessFile localFile = mCloser.register(new RandomAccessFile(blockPath, "rw")); mLocalFileChannel = mCloser.register(localFile.getChannel()); // Change the permission of the temporary file in order that the worker can move it. + FileUtils.changeLocalFileToFullPermission(blockPath); LOG.info("LocalBlockOutStream created new file block, block path: {}", blockPath); } catch (IOException ioe) { mContext.releaseWorkerClient(mWorkerClient);
Allowing worker to move files created by the client.
Alluxio_alluxio
train
java
d31f9a59a5b9f9602b2edbac53a780a868eaebe0
diff --git a/lib/vagrant.rb b/lib/vagrant.rb index <HASH>..<HASH> 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -18,9 +18,6 @@ end # Add our patches to net-ssh require "vagrant/patches/net-ssh" -# Add our patches to fake_ftp -require "vagrant/patches/fake_ftp" - require "optparse" module Vagrant diff --git a/test/unit/base.rb b/test/unit/base.rb index <HASH>..<HASH> 100644 --- a/test/unit/base.rb +++ b/test/unit/base.rb @@ -10,6 +10,9 @@ require "rspec/its" require "vagrant" require "vagrant/util/platform" +# Include patches for fake ftp +require "vagrant/patches/fake_ftp" + # Add the test directory to the load path $:.unshift File.expand_path("../../", __FILE__)
Only patch fake_ftp when running tests The fake_ftp patches should only be applied when running tests. Since the library is a development dependency only, it will not be available for loading from a release.
hashicorp_vagrant
train
rb,rb
5f08a24269a2cb885aeabaf399fb8fbd615cb4d0
diff --git a/runtime.js b/runtime.js index <HASH>..<HASH> 100644 --- a/runtime.js +++ b/runtime.js @@ -480,7 +480,7 @@ (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && - arg < finallyEntry.finallyLoc) { + arg <= finallyEntry.finallyLoc) { // Ignore the finally entry if control is not jumping to a // location outside the try/catch block. finallyEntry = null;
Make jump target comparison inclusive (<=) rather than strict (<). This is important because jumping to the very end of the try block is typically the same as jumping to the very beginning of the finally block if there is no catch handler. As the comment indicates, the finally block should only be triggered if the jump target falls *outside* the region governed by the finally block. Fixes #<I>.
facebook_regenerator
train
js
133a5b639a05f5d245d527f81a8ba3fd48d7991e
diff --git a/src/AnalyticsClient.php b/src/AnalyticsClient.php index <HASH>..<HASH> 100644 --- a/src/AnalyticsClient.php +++ b/src/AnalyticsClient.php @@ -110,7 +110,7 @@ final class AnalyticsClient throw new AlgoliaException('Cannot retrieve ABTest because the abtestID is invalid.'); } - return $this->api->write('POST', api_path('/2/abtests/%s', $abTestID), array(), $requestOptions); + return $this->api->write('POST', api_path('/2/abtests/%s/stop', $abTestID), array(), $requestOptions); } /**
Add missing part of the url for stopABTest() method (#<I>)
algolia_algoliasearch-client-php
train
php
8c6623a856be2c37896d258879736b18fac4e3b2
diff --git a/gwpy/segments/flag.py b/gwpy/segments/flag.py index <HASH>..<HASH> 100644 --- a/gwpy/segments/flag.py +++ b/gwpy/segments/flag.py @@ -1161,9 +1161,9 @@ class DataQualityDict(OrderedDict): Returns ------- flagdict : `DataQualityDict` - a new `DataQualityDict` of `DataQualityFlag` entries with ``active`` - and ``known`` segments seeded from the XML tables in the given - file. + a new `DataQualityDict` of `DataQualityFlag` entries with + ``active`` and ``known`` segments seeded from the XML tables + in the given file. Notes -----"""
DataQualityFlag.read: docstring tweak [ci skip]
gwpy_gwpy
train
py
5c53fcb816d9f1c096f2d3aba179f1719879eb9d
diff --git a/eventsourcing/application.py b/eventsourcing/application.py index <HASH>..<HASH> 100644 --- a/eventsourcing/application.py +++ b/eventsourcing/application.py @@ -223,6 +223,10 @@ class Repository: version: Optional[int] = None, projector_func: ProjectorFunctionType[Aggregate] = mutate_aggregate, ) -> Aggregate: + """ + Reconstructs an :class:`~eventsourcing.domain.Aggregate` for a + given ID from stored events, optionally at a particular version. + """ if self.cache and version is None: try: # Look for aggregate in the cache. @@ -260,10 +264,6 @@ class Repository: version: Optional[int] = None, projector_func: ProjectorFunctionType[Aggregate] = mutate_aggregate, ) -> Aggregate: - """ - Reconstructs an :class:`~eventsourcing.domain.Aggregate` for a - given ID from stored events, optionally at a particular version. - """ gt: Optional[int] = None if self.snapshot_store is not None:
Moved Repository doc string to "public" get() method, where it originally was before _reconstruct_aggregate() was extracted when caching was added. This also fixes the docs, which no longer included this method, causing a few links to be broken.
johnbywater_eventsourcing
train
py
68e4cc0ae774976599b07110c2d47526242b507d
diff --git a/spec/validated_object_spec.rb b/spec/validated_object_spec.rb index <HASH>..<HASH> 100644 --- a/spec/validated_object_spec.rb +++ b/spec/validated_object_spec.rb @@ -21,6 +21,16 @@ describe ValidatedObject do }.to raise_error(ArgumentError) end + it 'supports readonly attributes' do + class ImmutableApple < ValidatedObject::Base + attr_reader :diameter + validates :diameter, type: Float + end + + apple = ImmutableApple.new(diameter: 4.0) + expect( apple.diameter ).to eq 4.0 + end + context 'TypeValidator' do it 'verifies a valid type' do small_apple = Apple.new diameter: 2.0
chore: failing test for readonly attributes
public-law_validated_object
train
rb
5c9e95b4922ebb4a8b69a916f53608674eb27680
diff --git a/src/Klein/ServiceProvider.php b/src/Klein/ServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Klein/ServiceProvider.php +++ b/src/Klein/ServiceProvider.php @@ -136,11 +136,10 @@ class ServiceProvider public function startSession() { if (session_id() === '') { - if (!session_start()) { - return false; - } + // Attempt to start a session + session_start(); - $this->session_id = session_id(); + $this->session_id = session_id() ?: false; } return $this->session_id;
Fixing the error flow of the `startSession()` method in the ServiceProvider class, since session_start() pretty much NEVER returns false....
klein_klein.php
train
php
a69de787fa5b433e6080bfa8853cfeee903378c0
diff --git a/packages/core/parcel-bundler/src/assets/VueAsset.js b/packages/core/parcel-bundler/src/assets/VueAsset.js index <HASH>..<HASH> 100644 --- a/packages/core/parcel-bundler/src/assets/VueAsset.js +++ b/packages/core/parcel-bundler/src/assets/VueAsset.js @@ -2,6 +2,7 @@ const Asset = require('../Asset'); const localRequire = require('../utils/localRequire'); const md5 = require('../utils/md5'); const {minify} = require('terser'); +const t = require('@babel/types'); class VueAsset extends Asset { constructor(name, options) { @@ -72,10 +73,10 @@ class VueAsset extends Asset { // TODO: make it possible to process this code with the normal scope hoister if (this.options.scopeHoist) { - optsVar = `$${this.id}$export$default`; + optsVar = `$${t.toIdentifier(this.id)}$export$default`; if (!js.includes(optsVar)) { - optsVar = `$${this.id}$exports`; + optsVar = `$${t.toIdentifier(this.id)}$exports`; if (!js.includes(optsVar)) { supplemental += ` var ${optsVar} = {};
For scope hoisting, Asset IDs cannot contain + or / (base<I>) (#<I>)
parcel-bundler_parcel
train
js
454e539aa4a16483d18d8a348ef83f498c43b6c0
diff --git a/src/python/turicreate/toolkits/audio_analysis/audio_analysis.py b/src/python/turicreate/toolkits/audio_analysis/audio_analysis.py index <HASH>..<HASH> 100644 --- a/src/python/turicreate/toolkits/audio_analysis/audio_analysis.py +++ b/src/python/turicreate/toolkits/audio_analysis/audio_analysis.py @@ -62,6 +62,8 @@ def load_audio( """ from scipy.io import wavfile as _wavfile + path = _tc.util._make_internal_url(path) + all_wav_files = [] if _fnmatch(path, "*.wav"): # single file diff --git a/src/python/turicreate/toolkits/image_analysis/image_analysis.py b/src/python/turicreate/toolkits/image_analysis/image_analysis.py index <HASH>..<HASH> 100644 --- a/src/python/turicreate/toolkits/image_analysis/image_analysis.py +++ b/src/python/turicreate/toolkits/image_analysis/image_analysis.py @@ -62,7 +62,9 @@ def load_images( ... recursive=True) """ from ... import extensions as _extensions + from ...util import _make_internal_url + url = _make_internal_url(url) return _extensions.load_images( url, format, with_path, recursive, ignore_failure, random_order )
Use make URLs internal for load_audio and load_images (#<I>)
apple_turicreate
train
py,py
a4bb2a3fdf18ef67dd555d6904e334f48528301f
diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index <HASH>..<HASH> 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -162,7 +162,7 @@ class SendVideo(Scaffold): app.send_video("me", "video.mp4", caption="recording") # Send self-destructing video - app.send_photo("me", "video.mp4", ttl_seconds=10) + app.send_video("me", "video.mp4", ttl_seconds=10) # Keep track of the progress while uploading def progress(current, total):
Fix typo in send_video examples (#<I>)
pyrogram_pyrogram
train
py
b846557759060a777fc7c9d493358d73241e70d5
diff --git a/provision/docker/flatten.go b/provision/docker/flatten.go index <HASH>..<HASH> 100644 --- a/provision/docker/flatten.go +++ b/provision/docker/flatten.go @@ -8,10 +8,12 @@ package docker import ( "bytes" + "fmt" "github.com/dotcloud/docker" dcli "github.com/fsouza/go-dockerclient" "github.com/globocom/tsuru/log" "github.com/globocom/tsuru/provision" + "os" ) func needsFlatten(a provision.App) bool { @@ -39,6 +41,10 @@ func flatten(imageID string) error { log.Errorf("Flatten: Caugh error while exporting container %s: %s", c.ID, err.Error()) return err } + // code to debug import issue + f, _ := os.Create(fmt.Sprintf("/tmp/container-%s", c.ID)) + f.Write(buf.Bytes()) + f.Close() out := &bytes.Buffer{} opts := dcli.ImportImageOptions{Repository: imageID, Source: "-"} if err := dockerCluster().ImportImage(opts, buf, out); err != nil {
provision/docker/flatten.go: writing exported tar in file for debug purposes
tsuru_tsuru
train
go
6b7bf3cf19327885120b8e253847907b3072a2e3
diff --git a/src/ui/js/ch.Zoom.js b/src/ui/js/ch.Zoom.js index <HASH>..<HASH> 100644 --- a/src/ui/js/ch.Zoom.js +++ b/src/ui/js/ch.Zoom.js @@ -247,7 +247,7 @@ */ zoomed = (function () { // Define the content source - var $img = that.source = $("<img src=\"" + that.element.href + "\">"); + var $img = that.source = $("<img src=\"" + that.element.href + "\">").insertAfter(original.$image); // Grab some data when zoomed image loads $img.onImagesLoads(function () {
GH-<I> Zoom: append the zoomed image after the original image, to get its size
mercadolibre_chico
train
js
2970dab3944e3b37578fa193503aae4217c62e59
diff --git a/src/Illuminate/Foundation/Testing/TestResponse.php b/src/Illuminate/Foundation/Testing/TestResponse.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Foundation/Testing/TestResponse.php +++ b/src/Illuminate/Foundation/Testing/TestResponse.php @@ -657,9 +657,13 @@ class TestResponse ); if (! is_int($key)) { - PHPUnit::assertStringContainsString( - $value, - $jsonErrors[$key], + foreach (Arr::wrap($jsonErrors[$key]) as $jsonErrorMessage) { + if (Str::contains($jsonErrorMessage, $value)) { + return $this; + } + } + + PHPUnit::fail( "Failed to find a validation error in the response for key and message: '$key' => '$value'".PHP_EOL.PHP_EOL.$errorMessage ); }
improve support for arrays on assertJsonValidationErrors
laravel_framework
train
php
6ea944a3505d9bd74db2dedf9037c8c566d63539
diff --git a/testing/path/test_local.py b/testing/path/test_local.py index <HASH>..<HASH> 100644 --- a/testing/path/test_local.py +++ b/testing/path/test_local.py @@ -186,6 +186,7 @@ class TestLocalPath(common.CommonFSTests): assert l3.strpath == wc.strpath assert not hasattr(l3, 'commit') + @py.test.mark.xfail(run=False, reason="unreliable est for long filenames") def test_long_filenames(self, tmpdir): if sys.platform == "win32": py.test.skip("win32: work around needed for path length limit")
don't run too-long-filename test --HG-- branch : trunk
vmalloc_dessert
train
py
446237930e4fd09effaf9b87cf3b3b0731817f97
diff --git a/tests/DBA/LogEntryTest.php b/tests/DBA/LogEntryTest.php index <HASH>..<HASH> 100644 --- a/tests/DBA/LogEntryTest.php +++ b/tests/DBA/LogEntryTest.php @@ -60,6 +60,16 @@ class LogEntryTest extends PHPUnit_Framework_TestCase $statement = 'SELECT * FROM user WHERE name = ?'; $entry = new LogEntry($data, $statement); $entry->finish(); - $this->assertContains("SELECT * FROM user WHERE name = 'value'", (string)$entry); + $this->assertContains("SELECT * FROM user WHERE name = 'value'", (string) $entry); + } + + public function testToStringMany() + { + $ids = range(1, 12); + $users = \Test\Model\User::select()->in('id', $ids)->all(); + $log = DBA::getLog(); + $last = end($log); + $expected = "0.000s SELECT * FROM `user` WHERE id IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12')\n"; + $this->assertEquals($expected, (string) $last); } }
Add test for LogEntry::__toString() with many named values
nochso_ORM2
train
php
19b8f648d2a7b18de7bf6446367e6001b53a7681
diff --git a/pyrogram/client/methods/messages/send_message.py b/pyrogram/client/methods/messages/send_message.py index <HASH>..<HASH> 100644 --- a/pyrogram/client/methods/messages/send_message.py +++ b/pyrogram/client/methods/messages/send_message.py @@ -88,10 +88,18 @@ class SendMessage(BaseClient): ) if isinstance(r, types.UpdateShortSentMessage): + peer = self.resolve_peer(chat_id) + + peer_id = ( + peer.user_id + if isinstance(peer, types.InputPeerUser) + else -peer.chat_id + ) + return pyrogram.Message( message_id=r.id, chat=pyrogram.Chat( - id=list(self.resolve_peer(chat_id).__dict__.values())[0], + id=peer_id, type="private", client=self ),
Fix bad behaviours for Python <<I> Pyrogram was relying on dict keys being "ordered" (keys keeping insertion order).
pyrogram_pyrogram
train
py
e8b3c3c338f1d46a56bc9c88c058211892e71f5e
diff --git a/rar.go b/rar.go index <HASH>..<HASH> 100644 --- a/rar.go +++ b/rar.go @@ -1,6 +1,7 @@ package archiver import ( + "bytes" "fmt" "io" "os" @@ -20,8 +21,25 @@ func init() { type rarFormat struct{} func (rarFormat) Match(filename string) bool { - // TODO: read file header to identify the format - return strings.HasSuffix(strings.ToLower(filename), ".rar") + return strings.HasSuffix(strings.ToLower(filename), ".rar") || isRar(filename) +} + +// isRar checks the file has the RAR 1.5 or 5.0 format signature by reading its +// beginning bytes and matching it +func isRar(rarPath string) bool { + f, err := os.Open(rarPath) + if err != nil { + return false + } + defer f.Close() + + buf := make([]byte, 8) + if n, err := f.Read(buf); err != nil || n < 8 { + return false + } + + return bytes.Equal(buf[:7], []byte("Rar!\x1a\x07\x00")) || // ver 1.5 + bytes.Equal(buf, []byte("Rar!\x1a\x07\x01\x00")) // ver 5.0 } // Make makes a .rar archive, but this is not implemented because
Identify .rar file by reading file header
mholt_archiver
train
go
1ef8bba0e63121855ea3aa5cbf55d057b4103593
diff --git a/tests/test_unicorn.py b/tests/test_unicorn.py index <HASH>..<HASH> 100644 --- a/tests/test_unicorn.py +++ b/tests/test_unicorn.py @@ -128,8 +128,8 @@ def _compare_paths(pu, pn): def run_similarity(binpath, depth): b = angr.Project(os.path.join(test_location, binpath)) - s_unicorn = b.factory.entry_state(add_options=so.unicorn, remove_options={so.LAZY_SOLVES}) # unicorn - s_normal = b.factory.entry_state(add_options={so.INITIALIZE_ZERO_REGISTERS}, remove_options={so.LAZY_SOLVES}) # normal + s_unicorn = b.factory.entry_state(add_options=so.unicorn, remove_options={so.LAZY_SOLVES, so.TRACK_MEMORY_MAPPING}) # unicorn + s_normal = b.factory.entry_state(add_options={so.INITIALIZE_ZERO_REGISTERS}, remove_options={so.LAZY_SOLVES, so.TRACK_MEMORY_MAPPING}) # normal p_unicorn = b.factory.path(s_unicorn) p_normal = b.factory.path(s_normal) pg = b.factory.path_group(p_unicorn)
use the new option to disable memory map tracking
angr_angr
train
py
2f326bf2f9d32eef910d3f42365d1360618fc904
diff --git a/upload/system/helper/general.php b/upload/system/helper/general.php index <HASH>..<HASH> 100644 --- a/upload/system/helper/general.php +++ b/upload/system/helper/general.php @@ -3,12 +3,6 @@ function oc_setcookie(string $key, string $value, $option = []) { if (version_compare(phpversion(), '7.3.0', '>=')) { // PHP needs to update their setcookie function. - if (isset($option['max-age'])) { - $option['expires'] = $option['max-age']; - - unset($option['max-age']); - } - setcookie($key, $value, $option); } else { $string = '';
removed max age as its not supported by many browsers
opencart_opencart
train
php
92623e2435401db4f80eaf5e3e804c13ac776c0d
diff --git a/drools-core/src/main/java/org/drools/core/SessionConfigurationImpl.java b/drools-core/src/main/java/org/drools/core/SessionConfigurationImpl.java index <HASH>..<HASH> 100644 --- a/drools-core/src/main/java/org/drools/core/SessionConfigurationImpl.java +++ b/drools-core/src/main/java/org/drools/core/SessionConfigurationImpl.java @@ -173,7 +173,7 @@ public class SessionConfigurationImpl extends SessionConfiguration { QueryListenerOption.STANDARD.getAsString() ) ) ); setTimerJobFactoryType(TimerJobFactoryType.resolveTimerJobFactoryType(this.chainedProperties.getProperty(TimerJobFactoryOption.PROPERTY_NAME, - TimerJobFactoryType.TRACKABLE.getId()))); + TimerJobFactoryType.THREAD_SAFE_TRACKABLE.getId()))); } public SessionConfigurationImpl addDefaultProperties(Properties properties) {
[DROOLS-<I>] set ThreadSafeTrackableTimeJobFactoryManager as default option (#<I>)
kiegroup_drools
train
java
9b1f48023414859eb277c32b0e42fe3efcea29c1
diff --git a/identify/extensions.py b/identify/extensions.py index <HASH>..<HASH> 100644 --- a/identify/extensions.py +++ b/identify/extensions.py @@ -142,6 +142,7 @@ EXTENSIONS = { 'rs': {'text', 'rust'}, 'rst': {'text', 'rst'}, 's': {'text', 'asm'}, + 'sass': {'text', 'sass'}, 'sbt': {'text', 'sbt', 'scala'}, 'sc': {'text', 'scala'}, 'scala': {'text', 'scala'},
Add 'sass' files extension
chriskuehl_identify
train
py
6660904a72b4c87ad9dbb9d8b1a69006c69e5eac
diff --git a/smtp_client.js b/smtp_client.js index <HASH>..<HASH> 100644 --- a/smtp_client.js +++ b/smtp_client.js @@ -275,8 +275,9 @@ exports.get_client_plugin = function (plugin, connection, config, callback) { pool.acquire(function (err, smtp_client) { smtp_client.call_next = function (retval, msg) { if (this.next) { - this.next(retval, msg); + var next = this.next; delete this.next; + next(retval, msg); } };
Fixed condition where next could be called recursively.
haraka_Haraka
train
js
68dbad8770def3497011ccf32b0158ce76611169
diff --git a/lib/quickbooks/model/employee.rb b/lib/quickbooks/model/employee.rb index <HASH>..<HASH> 100644 --- a/lib/quickbooks/model/employee.rb +++ b/lib/quickbooks/model/employee.rb @@ -27,7 +27,7 @@ module Quickbooks xml_accessor :primary_phone, :from => 'PrimaryPhone', :as => TelephoneNumber xml_accessor :mobile_phone, :from => 'Mobile', :as => TelephoneNumber xml_accessor :primary_email_address, :from => 'PrimaryEmailAddr', :as => EmailAddress - xml_accessor :number, :from => 'EmployeeNumber', :as => Integer + xml_accessor :number, :from => 'EmployeeNumber' xml_accessor :ssn, :from => 'SSN' xml_accessor :address, :from => 'PrimaryAddr', :as => PhysicalAddress xml_accessor :billable?, :from => 'BillableTime'
EmployeeNumber can be a string
ruckus_quickbooks-ruby
train
rb