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
595dd6f694a1fa764a4c830fe8f20b05594307a6
diff --git a/gala/integrate/timespec.py b/gala/integrate/timespec.py index <HASH>..<HASH> 100644 --- a/gala/integrate/timespec.py +++ b/gala/integrate/timespec.py @@ -65,7 +65,8 @@ def parse_time_specification(units, dt=None, n_steps=None, nsteps=None, if t1 is None: t1 = 0. - times = parse_time_specification(units, dt=np.ones(n_steps+1)*dt, t1=t1) + times = parse_time_specification(units, dt=np.ones(n_steps+1)*dt, + t1=t1) # dt, t1, t2 : (numeric, numeric, numeric) elif dt is not None and t1 is not None and t2 is not None: if t2 < t1 and dt < 0: @@ -109,4 +110,4 @@ def parse_time_specification(units, dt=None, n_steps=None, nsteps=None, else: raise ValueError("Invalid options. See docstring.") - return times + return times.astype(np.float64)
convert to float<I> because thats what c needs
adrn_gala
train
py
e7c05a265e6e83cf256f4fd7eb457e1455bb9041
diff --git a/pkg/oc/cli/cmd/export.go b/pkg/oc/cli/cmd/export.go index <HASH>..<HASH> 100644 --- a/pkg/oc/cli/cmd/export.go +++ b/pkg/oc/cli/cmd/export.go @@ -110,8 +110,17 @@ func RunExport(f *clientcmd.Factory, exporter Exporter, in io.Reader, out io.Wri return err } - mapper, typer := f.Object() - b := f.NewBuilder(true). + builder, err := f.NewUnstructuredBuilder(true) + if err != nil { + return err + } + + mapper, typer, err := f.UnstructuredObject() + if err != nil { + return err + } + + b := builder. NamespaceParam(cmdNamespace).DefaultNamespace().AllNamespaces(allNamespaces). FilenameParam(explicit, &resource.FilenameOptions{Recursive: false, Filenames: filenames}). SelectorParam(selector).
use unstructured builder - oc export
openshift_origin
train
go
00f19ac43a973626e90ed72a0dfdbbf1a43dbf28
diff --git a/lib/celluloid/zmq/sockets.rb b/lib/celluloid/zmq/sockets.rb index <HASH>..<HASH> 100644 --- a/lib/celluloid/zmq/sockets.rb +++ b/lib/celluloid/zmq/sockets.rb @@ -78,21 +78,14 @@ module Celluloid # Writable 0MQ sockets have a send method module WritableSocket # Send a message to the socket - def send(message) - unless ::ZMQ::Util.resultcode_ok? @socket.send_string message + def send(*messages) + unless ::ZMQ::Util.resultcode_ok? @socket.send_strings messages.flatten raise IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}" end message end alias_method :<<, :send - - def send_multiple(messages) - unless ::ZMQ::Util.resultcode_ok? @socket.send_strings(messages) - raise IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}" - end - messages - end end # ReqSockets are the counterpart of RepSockets (REQ/REP)
add a splat arg to send Now you can do send(messages) instead of send_multiple(messages)
celluloid_celluloid-zmq
train
rb
5eb54be4ab42ef4186cfa854de4dcf888533672e
diff --git a/qds_sdk/connection.py b/qds_sdk/connection.py index <HASH>..<HASH> 100644 --- a/qds_sdk/connection.py +++ b/qds_sdk/connection.py @@ -5,6 +5,7 @@ import ssl import json import pkg_resources from requests.adapters import HTTPAdapter +from datetime import datetime try: from requests.packages.urllib3.poolmanager import PoolManager except ImportError: @@ -130,7 +131,13 @@ class Connection: if 200 <= code < 400: return - + + if 'X-Qubole-Trace-Id' in response.headers: + now = datetime.now() + time = now.strftime('%Y-%m-%d %H:%M:%S') + format_list = [time,response.headers['X-Qubole-Trace-Id']] + sys.stderr.write("[{}] Request ID is: {}. Please share it with Qubole Support team for any assistance".format(*format_list) + "\n") + if code == 400: sys.stderr.write(response.text + "\n") raise BadRequest(response)
SDK-<I>: Added support for Qubole-trace-Id (#<I>) Added support for Qubole-trace-Id
qubole_qds-sdk-py
train
py
64f6c1ecd478e8d9edc2e6d54d651481dc3b25ce
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,6 @@ require 'dropbox_api' require 'support/vcr' +require 'tempfile' require File.expand_path('../support/dropbox_scaffold_builder', __FILE__) ENV["DROPBOX_OAUTH_BEARER"] ||= "MOCK_AUTHORIZATION_BEARER"
Require tempfile in specs.
Jesus_dropbox_api
train
rb
bc05372caf992079639f6d24c4ff28b42e9aef7c
diff --git a/lib/active_scaffold.rb b/lib/active_scaffold.rb index <HASH>..<HASH> 100644 --- a/lib/active_scaffold.rb +++ b/lib/active_scaffold.rb @@ -67,7 +67,9 @@ module ActiveScaffold frontends_path = File.join(RAILS_ROOT, 'vendor', 'plugins', ActiveScaffold::Config::Core.plugin_directory, 'frontends') paths = self.active_scaffold_config.inherited_view_paths.clone - paths << File.join(RAILS_ROOT, 'app', 'views', 'active_scaffold_overrides') + ActionController::Base.view_paths.each do |dir| + paths << File.join(dir,"active_scaffold_overrides") if File.exists?(File.join(dir,"active_scaffold_overrides")) + end paths << File.join(frontends_path, active_scaffold_config.frontend, 'views') if active_scaffold_config.frontend.to_sym != :default paths << File.join(frontends_path, 'default', 'views') self.generic_view_paths = paths @@ -136,4 +138,4 @@ module ActiveScaffold !active_scaffold_config.nil? end end -end \ No newline at end of file +end
Fixes bug where template overrides are ignored when placed in Engines plugins. Patch iterates over ActionController::Base.view_paths looking for active_scaffold_overrides directories, and adding those to the generic_view_paths.
activescaffold_active_scaffold
train
rb
dccdf626496cf74d3ccd08c3dd974d105059f925
diff --git a/perft.py b/perft.py index <HASH>..<HASH> 100755 --- a/perft.py +++ b/perft.py @@ -60,7 +60,6 @@ def debug_perft(board, depth): continue assert move in board.legal_moves - assert move in list(board.legal_moves) board.push(move) count += debug_perft(board, depth - 1)
Remove already covered debug perft
niklasf_python-chess
train
py
c33734f61345e6249b68a9ad9b27223bf7a7fe34
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -40,13 +40,32 @@ module.exports = function (dir) { var scanComponents = function () { var files = wrench.readdirSyncRecursive(dir) , blackListedComponentNames = ['.DS_Store', 'README.md'] - , dirs = _.unique(_.map(files, function (file) { - return file.split('/')[0] - })) + , dirs = _.unique(_.compact(_.map(files, function (filePath) { + var file = path.basename(filePath) + + if (file === 'index.js' || file === 'index.css') + return path.dirname(filePath) + else + return false + }))) , components = _.map(dirs, function (component) { + var pathParts = component.split('/') + , name = '' + , section = '' + + if (pathParts.length > 1) { + name = path.basename(component) + section = _.initial(pathParts).join('/') + } + else { + name = component + } + return { - name: component - , pascal: change.pascal(component) + name: name + , section: section + , path: component + , pascal: change.pascal(name) , readme: exists(component, 'README.md') , example: exists(component, 'example') , test: exists(component, 'test.js')
Allow parsing a dir that has sub-dirs
Techwraith_ribcage-docs
train
js
609a70506de4a17b166d3d0c1d6c47aed36d2780
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,17 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- + +import io + +from setuptools import setup -from distutils.core import setup setup(name='django-messagegroups', version='0.4.4', description='Render grouped messages with the Django messaging framework', - long_description=open('README.rst').read(), + long_description=io.open('README.rst').read(), author='Danilo Bargen', - author_email='gezuru@gmail.ch', + author_email='mail@dbrgn.ch', url='https://github.com/dbrgn/django-messagegroups', license='MIT', packages=['messagegroups', 'messagegroups.templatetags'],
Switched setup.py to setuptools
dbrgn_django-messagegroups
train
py
4fa87ad73144217de67899d2624a6f78d0c0bd1a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ pandoc.core.PANDOC_PATH = "pandoc" doc = pandoc.Document() doc.markdown = open('README.md','r').read() setup(name='Crawl', - version='0.1', + version='0.2', url='https://github.com/OiNutter/crawl', download_url='https://nodeload.github.com/OiNutter/crawl/legacy.tar.gz/master', description='Python tool for finding files in a set of paths. Based on the Hike ruby gem',
Bumped to version <I>
OiNutter_crawl
train
py
d18f6a5ad72e10992deee972828a0e3584e967e9
diff --git a/clb/client_test.go b/clb/client_test.go index <HASH>..<HASH> 100644 --- a/clb/client_test.go +++ b/clb/client_test.go @@ -10,6 +10,26 @@ import ( var _ = fmt.Print // For debugging; delete when done. var _ = log.Print // For debugging; delete when done. +func Example() { + srvName := "foo.service.fliglio.com" + c := NewRoundRobinClb("8.8.8.8", "53") + address, err := c.GetAddress(srvName) + if err != nil { + fmt.Print(err) + } + + if address.Port == 8001 { + fmt.Printf("%s", address) + } else { + address2, err := c.GetAddress(srvName) + if err != nil { + fmt.Print(err) + } + fmt.Printf("%s", address2) + } + // Output: 0.1.2.3:8001 +} + func doStuff(c LoadBalancer) error { srvName := "foo.service.fliglio.com" _, err := c.GetAddress(srvName)
style(tests): rearranging tests
benschw_srv-lb
train
go
484ebc40d1ebfea8757966405128b5d358afc4a3
diff --git a/main.js b/main.js index <HASH>..<HASH> 100755 --- a/main.js +++ b/main.js @@ -39,13 +39,11 @@ function squeeze(iterator,prevYd,resolver,s){ }catch(e){ error = e; } stack = prevStack; - prevYd.end(); if(error) return resolver.reject(error); if(result.done) return resolver.accept(result.value); prevYd = getYielded(result.value); - prevYd.start(); } } @@ -77,7 +75,6 @@ function walkIt(generator,args,thisArg,s){ resolver = new Resolver(); prevYd = getYielded(result.value); - prevYd.start(); squeeze(it,prevYd,resolver,s);
Now using latest version of y-resolver (no 'start' / 'end')
manvalls_y-walk
train
js
59d94177a87d63f4141849ea66a63345c2e9f0d4
diff --git a/LiSE/LiSE/allegedb/__init__.py b/LiSE/LiSE/allegedb/__init__.py index <HASH>..<HASH> 100644 --- a/LiSE/LiSE/allegedb/__init__.py +++ b/LiSE/LiSE/allegedb/__init__.py @@ -793,10 +793,11 @@ class ORM: either case, begin a transaction. :arg dbstring: rfc1738 URL for a database connection. Unless it - begins with "sqlite:///", SQLAlchemy will be required. :arg alchemy: - Set to ``False`` to use the precompiled SQLite queries even if - SQLAlchemy is available. :arg connect_args: Dictionary of keyword - arguments to be used for the database connection. + begins with "sqlite:///", SQLAlchemy will be required. + + :arg alchemy: Set to ``False`` to use the precompiled SQLite queries + even if SQLAlchemy is available. :arg connect_args: Dictionary of + keyword arguments to be used for the database connection. """ self.world_lock = RLock()
Fix erroneously paragraph-filled docstring
LogicalDash_LiSE
train
py
16ea2e13ffab14157fdbd0ab1c679146901073bf
diff --git a/resources/views/fields/upload.blade.php b/resources/views/fields/upload.blade.php index <HASH>..<HASH> 100644 --- a/resources/views/fields/upload.blade.php +++ b/resources/views/fields/upload.blade.php @@ -80,7 +80,7 @@ <div class="form-group"> <label>{{ __('Description') }}</label> <textarea class="form-control no-resize" - data-upload-target="upload.description" + data-upload-target="description" placeholder="{{ __('Description') }}" maxlength="255" rows="3"></textarea>
Fix upload description target (#<I>)
orchidsoftware_platform
train
php
080eb060faa54bb7b7fbef3d274bd30f7794253c
diff --git a/src/collapsible/collapsible.js b/src/collapsible/collapsible.js index <HASH>..<HASH> 100644 --- a/src/collapsible/collapsible.js +++ b/src/collapsible/collapsible.js @@ -1,5 +1,6 @@ import {customAttribute, bindable, bindingMode, inject} from 'aurelia-framework'; import { getBooleanFromAttributeValue } from '../common/attributes'; +import { CssClassSetter } from '../common/cssClassSetter'; @customAttribute('md-collapsible') @bindable({ name: 'accordion', defaultValue: false }) @@ -8,11 +9,18 @@ import { getBooleanFromAttributeValue } from '../common/attributes'; export class MdCollapsible { constructor(element) { this.element = element; + this.classSetter = new CssClassSetter(this.element); } attached() { + this.classSetter.addClasses('collapsible'); this.refresh(); } + + detached() { + this.classSetter.removeClasses('collapsible'); + } + refresh() { let accordion = getBooleanFromAttributeValue(this.accordion); if (accordion) {
refactor(collapsible): changed collapsible to set css classes
aurelia-ui-toolkits_aurelia-materialize-bridge
train
js
2aae2fcd69577a51bad1b6922024d74984135344
diff --git a/src/helpers.php b/src/helpers.php index <HASH>..<HASH> 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -3,7 +3,6 @@ use Spatie\Fractal\FractalFunctionHelper; if (! function_exists('fractal')) { - function fractal() { $fractalFunctionHelper = new FractalFunctionHelper(func_get_args());
Applied fixes from StyleCI (#<I>)
spatie_laravel-fractal
train
php
ab9a6c0743c939cc747c9cf68f807af36d0b73cb
diff --git a/lib/assets/HTML.js b/lib/assets/HTML.js index <HASH>..<HASH> 100644 --- a/lib/assets/HTML.js +++ b/lib/assets/HTML.js @@ -23,7 +23,13 @@ _.extend(HTML.prototype, { getParseTree: memoizeAsyncAccessor('parseTree', function (cb) { var that = this; this.getOriginalSrc(error.passToFunction(cb, function (src) { - cb(null, jsdom.jsdom(src, undefined, {features: {ProcessExternalResources: [], FetchExternalResources: []}})); + var parseTree = jsdom.jsdom(src, undefined, {features: {ProcessExternalResources: [], FetchExternalResources: []}}); + // Jsdom (or its HTML parser) doesn't strip the newline after the <!DOCTYPE> for some reason. + // Issue reported here: https://github.com/tmpvar/jsdom/issues/160 + if (parseTree.firstChild && parseTree.firstChild.nodeName === '#text' && parseTree.firstChild.nodeValue === "\n") { + parseTree.removeChild(parseTree.firstChild); + } + cb(null, parseTree); })); }),
Jsdom (or its HTML parser) doesn't strip the newline after the <!DOCTYPE> for some reason. Added workaround.
assetgraph_assetgraph
train
js
f9114922faf5be8a4d5e70a774e672a67250baec
diff --git a/src/EasyAdminBundle.php b/src/EasyAdminBundle.php index <HASH>..<HASH> 100644 --- a/src/EasyAdminBundle.php +++ b/src/EasyAdminBundle.php @@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; */ class EasyAdminBundle extends Bundle { - const VERSION = '1.17.12-DEV'; + const VERSION = '1.17.12'; public function build(ContainerBuilder $container) {
Prepared the <I> release
EasyCorp_EasyAdminBundle
train
php
23d27e08b94a01e513f29653e160d0da211e9b2e
diff --git a/testing/mgo.go b/testing/mgo.go index <HASH>..<HASH> 100644 --- a/testing/mgo.go +++ b/testing/mgo.go @@ -33,7 +33,7 @@ func StartMgoServer() (server *exec.Cmd, dbdir string) { if err != nil { panic(fmt.Errorf("cannot create temporary directory: %v", err)) } - mgoport := strconv.Itoa(FindTCPPort()) + mgoport := strconv.Itoa(FindTCPPort()) mgoargs := []string{ "--dbpath", dbdir, "--bind_ip", "localhost", diff --git a/testing/zk_test.go b/testing/zk_test.go index <HASH>..<HASH> 100644 --- a/testing/zk_test.go +++ b/testing/zk_test.go @@ -8,9 +8,9 @@ import ( stdtesting "testing" ) -type S struct{} +type Z struct{} -var _ = Suite(S{}) +var _ = Suite(Z{}) func TestT(t *stdtesting.T) { TestingT(t) @@ -24,7 +24,7 @@ func (f testt) Fatalf(format string, args ...interface{}) { var allPerms = zk.WorldACL(zk.PERM_ALL) -func (S) TestStartAndClean(c *C) { +func (Z) TestStartAndClean(c *C) { srv := testing.StartZkServer() defer srv.Destroy()
testing: s/S/Z/g in zk_test.go
juju_juju
train
go,go
ca46e74acc50c5be616383ddb27ec901d8337607
diff --git a/lib/searchkick/relation.rb b/lib/searchkick/relation.rb index <HASH>..<HASH> 100644 --- a/lib/searchkick/relation.rb +++ b/lib/searchkick/relation.rb @@ -30,16 +30,19 @@ module Searchkick self end + # experimental def limit(value) clone.limit!(value) end + # experimental def limit!(value) check_loaded @options[:limit] = value self end + # experimental def offset(value = NO_DEFAULT_VALUE) # TODO remove in Searchkick 6 if value == NO_DEFAULT_VALUE @@ -49,22 +52,26 @@ module Searchkick end end + # experimental def offset!(value) check_loaded @options[:offset] = value self end + # experimental def page(value) clone.page!(value) end + # experimental def page!(value) check_loaded @options[:page] = value self end + # experimental def per_page(value = NO_DEFAULT_VALUE) # TODO remove in Searchkick 6 if value == NO_DEFAULT_VALUE @@ -74,16 +81,19 @@ module Searchkick end end + # experimental def per_page!(value) check_loaded @options[:per_page] = value self end + # experimental def only(*keys) Relation.new(@model, @term, **@options.slice(*keys)) end + # experimental def except(*keys) Relation.new(@model, @term, **@options.except(*keys)) end
Mark methods as experimental [skip ci]
ankane_searchkick
train
rb
3100638ea57b32e2fc863458dc2211f1db3653c4
diff --git a/src/main/java/net/pwall/json/JSON.java b/src/main/java/net/pwall/json/JSON.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/pwall/json/JSON.java +++ b/src/main/java/net/pwall/json/JSON.java @@ -25,6 +25,7 @@ package net.pwall.json; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -164,9 +165,13 @@ public class JSON { }; /** - * Private constructor to prevent instantiation. + * Private constructor to prevent instantiation. Attempts to instantiate the class via + * reflection will cause an {@link IllegalAccessException}. + * + * @throws IllegalAccessException in all cases */ - private JSON() { + private JSON() throws IllegalAccessException { + throw new IllegalAccessException("Attempt to instantiate JSON"); } /** @@ -238,6 +243,8 @@ public class JSON { * @throws IOException on any I/O errors */ public static JSONValue parse(Reader rdr) throws IOException { + if (!(rdr instanceof BufferedReader)) + rdr = new BufferedReader(rdr); StringBuilder sb = new StringBuilder(); for (;;) { int i = rdr.read();
Changed to use BufferedReader if not already supplied
pwall567_jsonutil
train
java
1a71bd5d56df9e73a675b8b3d6b56c358cd8131c
diff --git a/eZ/Bundle/EzPublishRestBundle/DependencyInjection/EzPublishRestExtension.php b/eZ/Bundle/EzPublishRestBundle/DependencyInjection/EzPublishRestExtension.php index <HASH>..<HASH> 100644 --- a/eZ/Bundle/EzPublishRestBundle/DependencyInjection/EzPublishRestExtension.php +++ b/eZ/Bundle/EzPublishRestBundle/DependencyInjection/EzPublishRestExtension.php @@ -50,5 +50,13 @@ class EzPublishRestExtension extends Extension implements PrependExtensionInterf $container->prependExtensionConfig('nelmio_cors', $config); $container->addResource(new FileResource($file)); } + + $this->prependRouterConfiguration($container); + } + + private function prependRouterConfiguration(ContainerBuilder $container) + { + $config = ['router' => ['default_router' => ['non_siteaccess_aware_routes' => ['ezpublish_rest_']]]]; + $container->prependExtensionConfig('ezpublish', $config); } }
[REST] Made routes non-siteaccess-aware
ezsystems_ezpublish-kernel
train
php
a203a7b544bc55639b80828522f8ba903a1fef0a
diff --git a/lib/pseudohiki/markdownformat.rb b/lib/pseudohiki/markdownformat.rb index <HASH>..<HASH> 100644 --- a/lib/pseudohiki/markdownformat.rb +++ b/lib/pseudohiki/markdownformat.rb @@ -75,7 +75,7 @@ module PseudoHiki def format(tree) formatter = get_plain - @formatter[LinkNode].id_conv_table = prepare_id_conv_table(tree) if @options.gfm_style + prepare_id_conv_table(tree) if @options.gfm_style tree.accept(formatter).join end @@ -112,6 +112,7 @@ module PseudoHiki table[node_id] = heading_to_gfm_id(heading) end end + @formatter[LinkNode].id_conv_table = table end end
the assignment to @formatter[LinkNode].id_conv_table is now done in #prepare_id_conv_table()
nico-hn_PseudoHikiParser
train
rb
476c095fc698986f394c1ca15e5e85d883d50154
diff --git a/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcTagKey.java b/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcTagKey.java index <HASH>..<HASH> 100644 --- a/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcTagKey.java +++ b/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcTagKey.java @@ -165,12 +165,10 @@ public enum IpcTagKey { serverPort("ipc.server.port"), /** - * HTTP status code. - * - * @deprecated Use {@link #statusDetail} instead. This value will be removed in - * January of 2019. + * HTTP status code. In most cases it is preferred to use {@link #statusDetail} instead. + * This tag key is optionally used to include the HTTP status code when the status detail + * is overridden with application specific values. */ - @Deprecated httpStatus("http.status"), /**
remove deprecation of `http.status` (#<I>) Zuul team wants to be able to use this still so they can have application specific details while retaining the actual HTTP status code.
Netflix_spectator
train
java
4bb6cad3c9d324f499ab2d9df9986b343d30f33b
diff --git a/plugins/Dashboard/templates/widgetMenu.js b/plugins/Dashboard/templates/widgetMenu.js index <HASH>..<HASH> 100644 --- a/plugins/Dashboard/templates/widgetMenu.js +++ b/plugins/Dashboard/templates/widgetMenu.js @@ -11,7 +11,7 @@ function widgetsHelper() /** * Returns the available widgets fetched via AJAX (if not already done) - * + * * @return {object} object containing available widgets */ widgetsHelper.getAvailableWidgets = function () @@ -286,7 +286,7 @@ widgetsHelper.getEmptyWidgetHtml = function (uniqueId, widgetName) } // delay widget preview a few millisconds - /*$('li:not(.'+settings.unavailableClass+')', widgetList).on('mouseenter', function(){ + $('li:not(.'+settings.unavailableClass+')', widgetList).on('mouseenter', function(){ var widgetUniqueId = $(this).attr('uniqueid'); clearTimeout(widgetPreview); widgetPreviewTimer = setTimeout(function() { @@ -295,7 +295,7 @@ widgetsHelper.getEmptyWidgetHtml = function (uniqueId, widgetName) showPreview(widgetUniqueId); }, 400); - });*/ + }); // clear timeout after mouse has left $('li:not(.'+settings.unavailableClass+')', widgetList).on('mouseleave', function(){
re-enabled widget preview
matomo-org_matomo
train
js
eacaf10612bd9122a0b7c0771c466160f30791d8
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java index <HASH>..<HASH> 100644 --- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java +++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java @@ -154,7 +154,7 @@ public class HadoopGraphProvider extends AbstractGraphProvider { } else if (graphData.equals(LoadGraphWith.GraphData.CREW)) { ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-crew" + type)); } else if (graphData.equals(LoadGraphWith.GraphData.SINK)) { - ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-sink." + type)); + ((HadoopGraph) g).configuration().setInputLocation(PATHS.get("tinkerpop-sink" + type)); } else { throw new RuntimeException("Could not load graph with " + graphData); }
TINKERPOP-<I> Fixed path to kitchen sink graph for hadoop
apache_tinkerpop
train
java
1bfc443cbb4c990c1ca868eed0f40421a433fc3f
diff --git a/penn/studyspaces.py b/penn/studyspaces.py index <HASH>..<HASH> 100644 --- a/penn/studyspaces.py +++ b/penn/studyspaces.py @@ -131,7 +131,8 @@ class StudySpaces(object): room["image"] = "https:" + room["image"] # convert html descriptions to text if "description" in room: - room["description"] = BeautifulSoup(room["description"].replace('\xa0', ' '), "html.parser").text.strip() + description = room["description"].replace(u'\xa0', u' ') + room["description"] = BeautifulSoup(description, "html.parser").text.strip() # remove extra fields if "formid" in room: del room["formid"]
fix unicode issue for python 2
pennlabs_penn-sdk-python
train
py
d9988d12f94e2b421505e698bf1db030137a3cb0
diff --git a/homu/main.py b/homu/main.py index <HASH>..<HASH> 100644 --- a/homu/main.py +++ b/homu/main.py @@ -589,7 +589,10 @@ def main(): logger.info('Done!') - queue_handler = lambda: process_queue(states, repos, repo_cfgs, logger, buildbot_slots, db) + queue_handler_lock = Lock() + def queue_handler(): + with queue_handler_lock: + return process_queue(states, repos, repo_cfgs, logger, buildbot_slots, db) from . import server Thread(target=server.start, args=[cfg, states, queue_handler, repo_cfgs, repos, logger, buildbot_slots, my_username, db, repo_labels, mergeable_que]).start()
Wrap process_queue() in a lock
barosl_homu
train
py
e69c4035f224760b1165e9c272eadea2079e3d5a
diff --git a/carrot/messaging.py b/carrot/messaging.py index <HASH>..<HASH> 100644 --- a/carrot/messaging.py +++ b/carrot/messaging.py @@ -106,6 +106,8 @@ class Consumer(object): if not self.channel.connection: self.channel = self.build_channel() raw_message = self.channel.basic_get(self.queue) + if not raw_message: + return None return Message(raw_message, channel=self.channel) def process_next(self):
Return None instead of empty carrot.messaging.Message when there is no message waiting.
ask_carrot
train
py
75984132fa21f7b014f3a703bacd19fa05e726b1
diff --git a/DependencyInjection/Compiler/ServiceRepositoryCompilerPass.php b/DependencyInjection/Compiler/ServiceRepositoryCompilerPass.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Compiler/ServiceRepositoryCompilerPass.php +++ b/DependencyInjection/Compiler/ServiceRepositoryCompilerPass.php @@ -29,6 +29,11 @@ final class ServiceRepositoryCompilerPass implements CompilerPassInterface public function process(ContainerBuilder $container) { + // when ORM is not enabled + if (!$container->hasDefinition('doctrine.orm.container_repository_factory')) { + return; + } + $locatorDef = $container->getDefinition('doctrine.orm.container_repository_factory'); $repoServiceIds = array_keys($container->findTaggedServiceIds(self::REPOSITORY_SERVICE_TAG));
fixed ServiceRepositoryCompilerPass when ORM is disabled
doctrine_DoctrineBundle
train
php
b2fbf34b0015fc1c2a794c90c4485fec8991dfa0
diff --git a/agent/lib/agent.rb b/agent/lib/agent.rb index <HASH>..<HASH> 100644 --- a/agent/lib/agent.rb +++ b/agent/lib/agent.rb @@ -22,7 +22,7 @@ class Agent end attr_accessor :manager_ip, :manager_port - attr_accessor :agent_uuid, :agent_ip, :agent_root, :agent_mac + attr_accessor :uuid, :agent_ip, :agent_root, :mac_address def self.create(use_config = true) agent = load_config() if use_config @@ -38,10 +38,10 @@ class Agent @manager_ip = '192.168.80.99' @manager_port = 3000 - @agent_uuid = create_uuid() + @uuid = create_uuid() @agent_ip = '192.168.80.99' - @agent_mac = get_mac_address() + @mac_address = get_mac_address() create_keypair() end
renamed uuid & mac address attributes
chetan_bixby-agent
train
rb
e1352006c1536279fcaf09eb6da16c3eda75fbf4
diff --git a/src/Jenssegers/Date/Date.php b/src/Jenssegers/Date/Date.php index <HASH>..<HASH> 100644 --- a/src/Jenssegers/Date/Date.php +++ b/src/Jenssegers/Date/Date.php @@ -35,12 +35,18 @@ class Date extends Carbon { */ public function __construct($time = null, $timezone = null) { - // Create Date from timestamp + // Create Date from timestamp. if (is_int($time)) { $time = "@$time"; } + // Get default timezone from app config. + if (is_null($timezone) and class_exists('Illuminate\Support\Facades\Config')) + { + $timezone = \Config::get('app.timezone'); + } + parent::__construct($time, $timezone); }
Use laravel timezone as default
jenssegers_date
train
php
37fba5748af44bb6bf22649153238e283b5fe055
diff --git a/workbench/server/data_store.py b/workbench/server/data_store.py index <HASH>..<HASH> 100644 --- a/workbench/server/data_store.py +++ b/workbench/server/data_store.py @@ -88,7 +88,7 @@ class DataStore(object): sample_info['import_time'] = datetime.datetime.utcnow() sample_info['type_tag'] = type_tag sample_info['tags'] = [type_tag] - sample_info['tags'].append(tags) + sample_info['tags'] += tags # Random customer for now import random
fix a bug in the way tags were combined
SuperCowPowers_workbench
train
py
e9d4adca677643f7f1ac7e619f5a3964dfa4fcd9
diff --git a/eZ/Publish/API/Repository/Tests/Stubs/URLWildcardServiceStub.php b/eZ/Publish/API/Repository/Tests/Stubs/URLWildcardServiceStub.php index <HASH>..<HASH> 100644 --- a/eZ/Publish/API/Repository/Tests/Stubs/URLWildcardServiceStub.php +++ b/eZ/Publish/API/Repository/Tests/Stubs/URLWildcardServiceStub.php @@ -1,6 +1,6 @@ <?php /** - * File containing the TrashServiceStub class + * File containing the URLWildcardServiceStub class * * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
Fixed: Invalid class name in the file comment.
ezsystems_ezpublish-kernel
train
php
c3e7ba367135817c482a9d376700ee2599281ef6
diff --git a/discord/message.py b/discord/message.py index <HASH>..<HASH> 100644 --- a/discord/message.py +++ b/discord/message.py @@ -62,6 +62,8 @@ class Message(object): The :class:`Channel` that the message was sent from. Could be a :class:`PrivateChannel` if it's a private message. In :issue:`very rare cases <21>` this could be a :class:`Object` instead. + + For the sake of convenience, this :class:`Object` instance has an attribute ``is_private`` set to ``True``. .. attribute:: server The :class:`Server` that the message belongs to. If not applicable (i.e. a PM) then it's None instead. @@ -157,7 +159,8 @@ class Message(object): self.server = None if self.channel is None: if channel_id is not None: - self.channel = Object(channel_id) + self.channel = Object(id=channel_id) + self.channel.is_private = True return if not self.channel.is_private:
Message.channel's Object instance has an is_private attribute now. This was to allow for basic checks such as message.channel.is_private to succeed at the very least. It is a very small mitigation and not perfect since it doesn't have every attribute that PrivateChannel itself has. However you could retrieve the user info through the Message.author attribute.
Rapptz_discord.py
train
py
f49d34ee427795f699011cb14967cc0c19a74d13
diff --git a/api/src/main/java/btrplace/model/Attributes.java b/api/src/main/java/btrplace/model/Attributes.java index <HASH>..<HASH> 100644 --- a/api/src/main/java/btrplace/model/Attributes.java +++ b/api/src/main/java/btrplace/model/Attributes.java @@ -169,4 +169,11 @@ public interface Attributes extends Cloneable { * Remove all the attributes. */ void clear(); + + /** + * Remove all the attributes of a given element. + * + * @param e the element + */ + void clear(Element e); } diff --git a/api/src/main/java/btrplace/model/DefaultAttributes.java b/api/src/main/java/btrplace/model/DefaultAttributes.java index <HASH>..<HASH> 100644 --- a/api/src/main/java/btrplace/model/DefaultAttributes.java +++ b/api/src/main/java/btrplace/model/DefaultAttributes.java @@ -251,4 +251,13 @@ public class DefaultAttributes implements Attributes, Cloneable { return put(e, k, v); } + + @Override + public void clear(Element e) { + if (e instanceof VM) { + this.vmAttrs.remove(e); + } else if (e instanceof Node) { + this.nodeAttrs.remove(e); + } + } }
New method to remove all the attributes of a given element.
btrplace_scheduler
train
java,java
818f4798f994397eafc7e7c1958b633b6b7bcb64
diff --git a/src/mongo/delegates/MongoTripodTables.class.php b/src/mongo/delegates/MongoTripodTables.class.php index <HASH>..<HASH> 100644 --- a/src/mongo/delegates/MongoTripodTables.class.php +++ b/src/mongo/delegates/MongoTripodTables.class.php @@ -44,7 +44,7 @@ class MongoTripodTables extends MongoTripodBase implements SplObserver ); public static $arithmeticOperators = array( - "+", "-", "*", "/", "%", "**" + "+", "-", "*", "/", "%" ); /**
Remove "**" from arithmetic operators
talis_tripod-php
train
php
2063e59a696aedfdea2bf75834b3b563e42bbb16
diff --git a/kernel/content/translate.php b/kernel/content/translate.php index <HASH>..<HASH> 100644 --- a/kernel/content/translate.php +++ b/kernel/content/translate.php @@ -59,14 +59,6 @@ if ( $Module->isCurrentAction( 'EditObject' ) ) 'unordered_parameters' => null ); } -if ( $Module->isCurrentAction( 'EditArray' ) ) -{ - $redirection = array( 'view' => 'edit', - 'parameters' => array( $ObjectID, $EditVersion, $EditLanguage ), - 'unordered_parameters' => null ); -} - - $translateToLanguage = false; $activeTranslation = false; $activeTranslationLocale = false; @@ -218,7 +210,7 @@ if ( $activeTranslation ) } // Custom Action Code End - $storeActions = array( 'Store', 'EditObject', 'AddLanguage', 'RemoveLanguage', 'EditLanguage', 'EditArray', 'TranslateArray' ); + $storeActions = array( 'Store', 'EditObject', 'AddLanguage', 'RemoveLanguage', 'EditLanguage' ); $inputValidated = true; $storeRequired = in_array( $Module->currentAction(), $storeActions );
- Admin: removed more bogus code (which I forgot to remove within the last commit). git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@<I> a<I>eee8c-daba-<I>-acae-fa<I>f<I>
ezsystems_ezpublish-legacy
train
php
2714d508afcfd436154229a8bca8fb037f8dfd23
diff --git a/core-bundle/src/Resources/contao/classes/Backend.php b/core-bundle/src/Resources/contao/classes/Backend.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Resources/contao/classes/Backend.php +++ b/core-bundle/src/Resources/contao/classes/Backend.php @@ -105,14 +105,22 @@ abstract class Backend extends \Controller return $lang; } - // Fallback to the short tag (e.g. "de" instead of "de_CH") if (($short = substr($GLOBALS['TL_LANGUAGE'], 0, 2)) != $lang) { + // Try the short tag, e.g. "de" instead of "de_CH" if (file_exists(TL_ROOT . '/assets/tinymce4/langs/' . $short . '.js')) { return $short; } } + elseif (($long = $short . '_' . strtoupper($short)) != $lang) + { + // Try the long tag, e.g. "fr_FR" instead of "fr" (see #6952) + if (file_exists(TL_ROOT . '/assets/tinymce4/langs/' . $long . '.js')) + { + return $long; + } + } // Fallback to English return 'en';
[Core] Try all locale variations when loading TinyMCE (see #<I>)
contao_contao
train
php
38eb2ef620f98f29613a30624917bb0a1e4f224e
diff --git a/SerialsSolutions/Summon/Base.php b/SerialsSolutions/Summon/Base.php index <HASH>..<HASH> 100644 --- a/SerialsSolutions/Summon/Base.php +++ b/SerialsSolutions/Summon/Base.php @@ -27,6 +27,7 @@ * @link http://api.summon.serialssolutions.com/help/api/ API Documentation */ require_once dirname(__FILE__) . '/Exception.php'; +require_once dirname(__FILE__) . '/Query.php'; /** * Summon REST API Interface (abstract base class)
Included Query.php in Base.php as it is used in function query()
summon_Summon.php
train
php
8eac8f58c52848eb5c0c226786c53d3e651ac3b8
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,7 @@ This is a pure Python library. py_modules=['imagesize'], test_suite='test', python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + install_requires=['requests',], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers',
Update to handle in-memory filelike objects
shibukawa_imagesize_py
train
py
538e4c092ec5607120d76d4f6fd45bc1ad29e0d2
diff --git a/src/Native5/Services/Rules/RemoteRulesService.php b/src/Native5/Services/Rules/RemoteRulesService.php index <HASH>..<HASH> 100644 --- a/src/Native5/Services/Rules/RemoteRulesService.php +++ b/src/Native5/Services/Rules/RemoteRulesService.php @@ -57,7 +57,7 @@ class RemoteRulesService extends ApiClient public function findByPattern($rulePattern) { $logger = $GLOBALS['logger']; $path = 'rules/'; - $request = $this->_remoteServer->get($path, array('Content-Type'=>'application/json', $rulePattern)); + $request = $this->_remoteServer->get($path, array(), array('pattern'=>urlencode($rulePattern))); try { $response = $request->send(); if ($response->getStatusCode() !== 200) {
Fixed Remote Rules Service sending GET request
native5_native5-sdk-services-php
train
php
727b7d85b471880685ad09139e13827f6bccbbb8
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ setup( 'Topic :: System :: Monitoring', ], install_requires=[ - 'urwid>=1.3.1', - 'psutil>=5.2.0', + 'urwid>=2.0.1', + 'psutil>=5.6.0', ], )
Update dependecies in setup file
amanusk_s-tui
train
py
c816ff39965939d6240b3fdd3950d2491e35ee5f
diff --git a/test/tests.rb b/test/tests.rb index <HASH>..<HASH> 100755 --- a/test/tests.rb +++ b/test/tests.rb @@ -375,7 +375,8 @@ class Juice < ::Test::Unit::TestCase end def test_non_str_hash_compat json = Oj.dump({ 1 => true, 0 => false }, :mode => :compat) - assert_equal(%{{"1":true,"0":false}}, json) + h = Oj.load(json, :mode => :strict) + assert_equal({ "1" => true, "0" => false }, h) end def test_non_str_hash_object Oj.default_options = { :mode => :object }
In compat mode non-String keys are converted to Strings instead of raising and error. (issue #<I>)
ohler55_oj
train
rb
af0ddc53f25bc9c3d9cc887dffe893defd0251f5
diff --git a/metric_tank/handler.go b/metric_tank/handler.go index <HASH>..<HASH> 100644 --- a/metric_tank/handler.go +++ b/metric_tank/handler.go @@ -50,7 +50,8 @@ func (h *Handler) HandleMessage(m *nsq.Message) error { continue } if metric.Id == "" { - log.Fatal(3, "empty metric.Id - fix your datastream") + log.Error(3, "empty metric.Id - fix your datastream") + continue } if metric.Time == 0 { log.Warn("invalid metric. metric.Time is 0. %s", metric.Id)
log error and skip metric without id rather than panic
grafana_metrictank
train
go
732469f3651ea25fd6572e16bda193ac50946e03
diff --git a/abilian/application.py b/abilian/application.py index <HASH>..<HASH> 100644 --- a/abilian/application.py +++ b/abilian/application.py @@ -7,7 +7,7 @@ import yaml import logging from werkzeug.datastructures import ImmutableDict -from flask import Flask, g, request, current_app +from flask import Flask, g, request, current_app, has_app_context from flask.helpers import locked_cached_property import jinja2 @@ -101,7 +101,11 @@ class Application(Flask, ServiceManager, PluginManager): # Must come after all entity classes have been declared. # Inherited from ServiceManager. Will need some configuration love later. if not self.config.get('TESTING', False): - self.start_services() + if has_app_context(): + self.start_services() + else: + with self.app_context(): + self.start_services() def make_config(self, instance_relative=False): config = Flask.make_config(self, instance_relative)
start_services must be run within an application context
abilian_abilian-core
train
py
c8983ea54515bd05d8f456e6b8600793b27768ad
diff --git a/cobe/model.py b/cobe/model.py index <HASH>..<HASH> 100644 --- a/cobe/model.py +++ b/cobe/model.py @@ -149,15 +149,14 @@ class Model(object): token_ids = map(self.tokens.get_id, tokens) key = self._tokens_count_key(token_ids) - count = 0 - if len(token_ids) in self.orders: # If this ngram is a length we train, get the counts from # the database and counts log. - count = varint.decode_one(self.kv.Get(key, default='\0')) + count = varint.decode_one(self.kv.Get(key, default="\0")) else: # Otherwise, get this ngram's count by adding up all the # other ngrams that have it as a prefix. + count = 0 for key, value in self._prefix_items(key): count += varint.decode_one(value)
Minor reorganization in ngram_count
pteichman_cobe
train
py
a06695e9aa807a23854d51a1ad84e70f4184b51d
diff --git a/mods/page_revisions.js b/mods/page_revisions.js index <HASH>..<HASH> 100644 --- a/mods/page_revisions.js +++ b/mods/page_revisions.js @@ -191,7 +191,7 @@ PRS.prototype.fetchAndStoreMWRevision = function (restbase, req) { // revision, forbid its retrieval, cf. // https://phabricator.wikimedia.org/T76165#1030962 if (restrictions && restrictions.length > 0) { - return Promise.reject(new rbUtil.HTTPError({ + throw new rbUtil.HTTPError({ status: 403, body: { type: 'access_denied#revision', @@ -199,7 +199,7 @@ PRS.prototype.fetchAndStoreMWRevision = function (restbase, req) { description: 'Access is restricted for revision ' + apiRev.revid, restrictions: restrictions } - })); + }); } // no restrictions, continue rp.revision = apiRev.revid + ''; @@ -340,7 +340,14 @@ PRS.prototype.getRevision = function(restbase, req) { limit: 1 } }) - .then(self._checkRevReturn) + .then(function(res) { + // check the return + self._checkRevReturn(res); + // and get the revision info for the + // page now that we have the title + rp.title = res.body.items[0].title; + return self.getTitleRevision(restbase, req); + }) .catch(function(e) { if (e.status !== 404) { throw e;
Get the full revision info with getRevision() Until now, if getRevision() is called and the revision info is in storage, only secondary-index projected fields would be retrieved (in this case restrictions), which was inconsistent with data obtained through getTitleRevision(). This commit issues a second call to fetch the complete information with getTitleRevision().
wikimedia_restbase
train
js
f9fec8b3df5e1afccdc5e2dcfa74609e455ea9b7
diff --git a/lib/jsonapi/operation.rb b/lib/jsonapi/operation.rb index <HASH>..<HASH> 100644 --- a/lib/jsonapi/operation.rb +++ b/lib/jsonapi/operation.rb @@ -16,10 +16,10 @@ module JSONAPI attr_reader :filters, :include_directives, :sort_criteria, :paginator def initialize(resource_klass, options = {}) - @filters = options.fetch(:filters, nil) - @include_directives = options.fetch(:include_directives, nil) - @sort_criteria = options.fetch(:sort_criteria, nil) - @paginator = options.fetch(:paginator, nil) + @filters = options[:filters] + @include_directives = options[:include_directives] + @sort_criteria = options[:sort_criteria] + @paginator = options[:paginator] super(resource_klass, false) end
Simplify extracting options that may be nil.
cerebris_jsonapi-resources
train
rb
8b5f63c518ec8d156959505d073fc21560f2e654
diff --git a/lib/stronger_parameters/constraints/string_constraint.rb b/lib/stronger_parameters/constraints/string_constraint.rb index <HASH>..<HASH> 100644 --- a/lib/stronger_parameters/constraints/string_constraint.rb +++ b/lib/stronger_parameters/constraints/string_constraint.rb @@ -12,6 +12,8 @@ module StrongerParameters if v.is_a?(String) if maximum_length && v.bytesize > maximum_length return InvalidValue.new(v, "can not be longer than #{maximum_length} bytes") + elsif !v.valid_encoding? + return InvalidValue.new(v, 'must have valid encoding') end return v diff --git a/test/string_constraints_test.rb b/test/string_constraints_test.rb index <HASH>..<HASH> 100644 --- a/test/string_constraints_test.rb +++ b/test/string_constraints_test.rb @@ -9,6 +9,7 @@ describe 'string parameter constraints' do rejects Date.today rejects Time.now rejects nil + rejects "\xA1" it 'rejects strings that are too long' do assert_rejects(:value) { params(:value => '123').permit(:value => ActionController::Parameters.string(:max_length => 2)) }
String constraint with valid encoding At times an invalid encoded string can get through stronger_parameters and without force encoding it, it would fail on any string operation. This change forces all strings to be valid encoding.
zendesk_stronger_parameters
train
rb,rb
7096c818f40df493842c1e0f0ef31008080d11ca
diff --git a/yotta/test_subcommand.py b/yotta/test_subcommand.py index <HASH>..<HASH> 100644 --- a/yotta/test_subcommand.py +++ b/yotta/test_subcommand.py @@ -47,7 +47,7 @@ def findCTests(builddir, recurse_yotta_modules=False): # seems to be to parse the CTestTestfile.cmake files, which kinda sucks, # but works... Patches welcome. tests = [] - add_test_re = re.compile('add_test\\([^" ]*\s*"(.*)"\\)') + add_test_re = re.compile('add_test\\([^" ]*\s*"(.*)"\\)', flags=re.IGNORECASE) for root, dirs, files in os.walk(builddir, topdown=True): if not recurse_yotta_modules: dirs = [d for d in dirs if d != 'ym'] @@ -55,7 +55,7 @@ def findCTests(builddir, recurse_yotta_modules=False): with open(os.path.join(root, 'CTestTestfile.cmake'), 'r') as ctestf: dir_tests = [] for line in ctestf: - if line.startswith('add_test'): + if line.lower().startswith('add_test'): match = add_test_re.search(line) if match: dir_tests.append(match.group(1))
Case-insensitive parsing of CMake add_test() commands from CMakeTest files
ARMmbed_yotta
train
py
cee26cb02cd3c9138881101c56b748639fc3c21b
diff --git a/moreLess.js b/moreLess.js index <HASH>..<HASH> 100644 --- a/moreLess.js +++ b/moreLess.js @@ -87,22 +87,33 @@ } ); var isTab = false; + var isShift = false; $( document ).keydown( function( e ) { var keyCode = e.keyCode || e.which; - if( keyCode === 9 ) { - isTab = true; - } else { - isTab = false; - } + isTab = keyCode === 9; + isShift = e.shiftKey; } ); me._$moreless.focusin( function( event ) { if( ! me._$moreless.hasClass( 'vui-moreless-more' ) && isTab ) { - me._$moreless.get( 0 ).scrollTop = 0; - me._$morelink.focus(); - isTab = false; + me._$moreless.get(0).scrollTop = 0; + + if (isShift) { + var previousElements = me._$moreless.parent().prevAll().find(':tabbable').get().reverse(); + + if (previousElements.length > 0) { + previousElements[0].focus(); + } + + isShift = false; + + } else { + me._$morelink.focus(); + } + + isTab = false; } });
Updating focus behavior in case when control is collapsed
Brightspace_jquery-valence-ui-more-less
train
js
28540a21f91167bb702a52861246bf71bd7ebaa6
diff --git a/src/main/java/net/dv8tion/jda/handle/VoiceChangeHandler.java b/src/main/java/net/dv8tion/jda/handle/VoiceChangeHandler.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/dv8tion/jda/handle/VoiceChangeHandler.java +++ b/src/main/java/net/dv8tion/jda/handle/VoiceChangeHandler.java @@ -81,6 +81,15 @@ public class VoiceChangeHandler extends SocketHandler } } + //TODO: Implement event for changing of session id? Might be important... + if (!content.isNull("session_id")) + status.setSessionId(content.getString("session_id")); + else + status.setSessionId(null); + + //TODO: Implement event for changing of suppressed value? Only occurs when entering an AFK room. Maybe important... + status.setSuppressed(content.getBoolean("suppress")); + boolean isSelfMute = !content.isNull("self_mute") && content.getBoolean("self_mute"); if (isSelfMute != status.isMuted()) {
Fixed VoiceStatus's sessionId and suppressed not being updated in VoiceChangeHandler
DV8FromTheWorld_JDA
train
java
9db57b6cf2910c1b3010276e37a28ba6c014f3e7
diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/token/SQLToken.java b/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/token/SQLToken.java index <HASH>..<HASH> 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/token/SQLToken.java +++ b/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/token/SQLToken.java @@ -34,8 +34,6 @@ public abstract class SQLToken implements Comparable<SQLToken> { private final int startIndex; - private final int stopIndex; - @Override public final int compareTo(final SQLToken sqlToken) { return startIndex - sqlToken.getStartIndex();
delete private final int stopIndex;
apache_incubator-shardingsphere
train
java
1063e70cd7628866383c6d9f776db6a56e2510a3
diff --git a/src/main/java/reactor/netty/http/server/HAProxyMessageReader.java b/src/main/java/reactor/netty/http/server/HAProxyMessageReader.java index <HASH>..<HASH> 100644 --- a/src/main/java/reactor/netty/http/server/HAProxyMessageReader.java +++ b/src/main/java/reactor/netty/http/server/HAProxyMessageReader.java @@ -60,6 +60,8 @@ final class HAProxyMessageReader extends ChannelInboundHandlerAdapter { .set(remoteAddress); } + proxyMessage.release(); + ctx.channel() .pipeline() .remove(this);
HAProxyMessage should be released to avoid memory leak.
reactor_reactor-netty
train
java
c0fad9e32bb0d4f108e5ddabb5dc18289c13322c
diff --git a/src/main/java/com/github/noraui/data/gherkin/InputGherkinDataProvider.java b/src/main/java/com/github/noraui/data/gherkin/InputGherkinDataProvider.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/github/noraui/data/gherkin/InputGherkinDataProvider.java +++ b/src/main/java/com/github/noraui/data/gherkin/InputGherkinDataProvider.java @@ -125,7 +125,7 @@ public class InputGherkinDataProvider extends CommonDataProvider implements Data columns = new ArrayList<>(); if (examples.length > 1) { final String[] cols = examples[0].split("\\|", -1); - System.arraycopy(cols, 0, columns, 0, cols.length); + System.arraycopy(cols, 1, columns, 0, cols.length -1); } else { throw new EmptyDataFileContentException( Messages.getMessage(EmptyDataFileContentException.EMPTY_DATA_FILE_CONTENT_ERROR_MESSAGE));
fix wrong Sonar refactore
NoraUi_NoraUi
train
java
252bfb2e2046adf3e01a084167ddb14aa74ded51
diff --git a/doc/tutorials/auction/src/com/auctionexample/Loader.java b/doc/tutorials/auction/src/com/auctionexample/Loader.java index <HASH>..<HASH> 100644 --- a/doc/tutorials/auction/src/com/auctionexample/Loader.java +++ b/doc/tutorials/auction/src/com/auctionexample/Loader.java @@ -79,9 +79,9 @@ class Loader { */ static ArrayList<Integer> loadItems() throws InterruptedException, IOException { ArrayList<Integer> itemIds = new ArrayList<Integer>(); - String userHome = System.getProperty("user.home"); + URL url = Loader.class.getResource("datafiles/items1.txt"); String []myOptions = { - "--inputfile="+ userHome + "/workspace/voltdb/doc/tutorials/auction/src/com/auctionexample/datafiles/items.txt", + "--inputfile="+ url.getPath(), "--procedurename=InsertIntoItem", //"--reportdir=" + reportdir, //"--tablename=InsertIntoItem",
rewrite to make the path clear
VoltDB_voltdb
train
java
1565d811429d2fa5bd2c21703a7aebed6c1372bc
diff --git a/lib/yard/tags/directives.rb b/lib/yard/tags/directives.rb index <HASH>..<HASH> 100644 --- a/lib/yard/tags/directives.rb +++ b/lib/yard/tags/directives.rb @@ -67,6 +67,7 @@ module YARD def expand(macro_data) return if attach? && class_method? + return if new? && (!handler || handler.statement.source.empty?) call_params = [] caller_method = nil full_source = '' diff --git a/spec/tags/directives_spec.rb b/spec/tags/directives_spec.rb index <HASH>..<HASH> 100644 --- a/spec/tags/directives_spec.rb +++ b/spec/tags/directives_spec.rb @@ -61,6 +61,10 @@ describe YARD::Tags::MacroDirective do tag_parse("@!macro foo").text.should == 'foo' end + it "should not expand new macro if docstring is unattached" do + tag_parse("@!macro [new] foo\n foo").text.should_not == 'foo' + end + it "should allow multiple macros to be expanded" do tag_parse("@!macro [new] foo\n foo") tag_parse("@!macro bar\n bar")
Don't expand new unattached macros
lsegal_yard
train
rb,rb
99686f35bd501390a7c2743a8d3e0214cddb63d1
diff --git a/src/tests/unit/dao/DAOTest.php b/src/tests/unit/dao/DAOTest.php index <HASH>..<HASH> 100644 --- a/src/tests/unit/dao/DAOTest.php +++ b/src/tests/unit/dao/DAOTest.php @@ -26,7 +26,7 @@ class DAOTest extends BaseTest { $this->_startCache (); $this->_startDatabase ( $this->dao ); $this->dao->prepareGetById ( "orga", Organization::class ); - $this->dao->prepareGetOne ( "oneOrga", Organization::class ); + $this->dao->prepareGetOne ( "oneOrga", Organization::class, 'id= ?' ); $this->dao->prepareGetAll ( "orgas", Organization::class ); } @@ -43,7 +43,7 @@ class DAOTest extends BaseTest { $this->assertInstanceOf ( Organization::class, $orga ); $this->assertEquals ( "Conservatoire National des Arts et Métiers:lecnam.net", $orga->fullname ); - $orga = $this->dao->executePrepared ( 'oneOrga', 1 ); + $orga = $this->dao->executePrepared ( 'oneOrga', [ 1 ] ); $this->assertInstanceOf ( Organization::class, $orga ); $this->assertEquals ( "Conservatoire National des Arts et Métiers:lecnam.net", $orga->fullname );
[ci-tests] fix prepared pb
phpMv_ubiquity
train
php
1ea7fa277c2f1cf8969032f4df240c7b509ab63a
diff --git a/sub/client.go b/sub/client.go index <HASH>..<HASH> 100644 --- a/sub/client.go +++ b/sub/client.go @@ -130,7 +130,9 @@ func (c Client) Update(id string, params *stripe.SubParams) (*stripe.Sub, error) body.Add("coupon", params.Coupon) } - if params.TrialEnd > 0 { + if params.TrialEndNow { + body.Add("trial_end", "now") + } else if params.TrialEnd > 0 { body.Add("trial_end", strconv.FormatInt(params.TrialEnd, 10)) }
Support special `now` value for trial end on subscription update This was previously accepted on subscription creations, but not updates. The docs on update indicate that it can be used in both places: > Unix timestamp representing the end of the trial period the customer > will get before being charged for the first time. If set, trial_end > will override the default trial period of the plan the customer is > being subscribed to. The special value now can be provided to end the > customer's trial immediately.
stripe_stripe-go
train
go
a456cbaab6cb3c5b87606444f9330145a3d3eda1
diff --git a/src/main/java/com/theisenp/vicarious/VicariousFactory.java b/src/main/java/com/theisenp/vicarious/VicariousFactory.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/theisenp/vicarious/VicariousFactory.java +++ b/src/main/java/com/theisenp/vicarious/VicariousFactory.java @@ -1,5 +1,6 @@ package com.theisenp.vicarious; +import com.theisenp.vicarious.logger.TweetLogger; import com.theisenp.vicarious.modifier.TweetModifier; import com.theisenp.vicarious.provider.TweetProvider; import com.theisenp.vicarious.publisher.TweetPublisher; @@ -26,4 +27,9 @@ public interface VicariousFactory { * @return An instance of {@link TweetPublisher} */ public TweetPublisher getTweetPublisher(); + + /** + * @return An optional instance of {@link TweetLogger} + */ + public TweetLogger getTweetLogger(); }
Added TweetLogger to VicatiousFactory interface
theisenp_vicarious
train
java
20a0d27e60f4ff63708faf89c5e1b981a25d0a38
diff --git a/lib/haml/railtie.rb b/lib/haml/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/haml/railtie.rb +++ b/lib/haml/railtie.rb @@ -10,7 +10,8 @@ if defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on require 'haml/template/options' autoload(:Sass, 'sass/rails_shim') ActiveSupport.on_load(:before_initialize) do - Sass # resolve autoload + # resolve autoload if it looks like they're using Sass without options + Sass if File.exist?(File.join(Rails.root, 'public/stylesheets/sass')) ActiveSupport.on_load(:action_view) do Haml.init_rails(binding) end
Only print a warning in Rails 3 if public/stylesheets/sass exists.
haml_haml
train
rb
a3a1c7aacb038e0c8ba7c1165e84b5714f2eb1de
diff --git a/pyArango/collection.py b/pyArango/collection.py index <HASH>..<HASH> 100644 --- a/pyArango/collection.py +++ b/pyArango/collection.py @@ -1,6 +1,7 @@ import json import types from future.utils import with_metaclass +from . import consts as CONST from .document import Document, Edge from .theExceptions import ValidationError, SchemaViolation, CreationError, UpdateError, DeletionError, InvalidDocument
We need the CONST to be defined if we use it later on.
ArangoDB-Community_pyArango
train
py
0e53342d6fab4146a14f14137877d35a7084edcd
diff --git a/languagetool-language-modules/sk/src/main/java/org/languagetool/language/Slovak.java b/languagetool-language-modules/sk/src/main/java/org/languagetool/language/Slovak.java index <HASH>..<HASH> 100644 --- a/languagetool-language-modules/sk/src/main/java/org/languagetool/language/Slovak.java +++ b/languagetool-language-modules/sk/src/main/java/org/languagetool/language/Slovak.java @@ -127,9 +127,4 @@ public class Slovak extends Language { return ruleFileNames; } - @Override - public LanguageMaintainedState getMaintainedState() { - return LanguageMaintainedState.ActivelyMaintained; - } - }
[sk] marking Slovak as unmaintained, as discussed with Zdenko Podobný
languagetool-org_languagetool
train
java
2f0b117580a4a546fa67e1c0b6e9fd8dd9f6c016
diff --git a/sharding-core/src/main/java/org/apache/shardingsphere/core/rule/TableRule.java b/sharding-core/src/main/java/org/apache/shardingsphere/core/rule/TableRule.java index <HASH>..<HASH> 100644 --- a/sharding-core/src/main/java/org/apache/shardingsphere/core/rule/TableRule.java +++ b/sharding-core/src/main/java/org/apache/shardingsphere/core/rule/TableRule.java @@ -230,8 +230,12 @@ public final class TableRule { */ public Collection<String> getAllShardingColumns() { Collection<String> result = new LinkedList<>(); - result.addAll(databaseShardingStrategy.getShardingColumns()); - result.addAll(tableShardingStrategy.getShardingColumns()); + if (null != databaseShardingStrategy) { + result.addAll(databaseShardingStrategy.getShardingColumns()); + } + if (null != tableShardingStrategy) { + result.addAll(tableShardingStrategy.getShardingColumns()); + } return result; } }
judge null == shardingStrategy
apache_incubator-shardingsphere
train
java
b7b0d1d38d363c073e8c40ada44e42e496c29a3e
diff --git a/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java b/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java +++ b/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java @@ -244,6 +244,18 @@ public class DefaultUsageFormatter implements IUsageFormatter { * @param indent the indentation */ public void appendCommands(StringBuilder out, int indentCount, int descriptionIndent, String indent) { + boolean hasOnlyHiddenCommands = true; + for (Map.Entry<JCommander.ProgramName, JCommander> commands : commander.getRawCommands().entrySet()) { + Object arg = commands.getValue().getObjects().get(0); + Parameters p = arg.getClass().getAnnotation(Parameters.class); + + if (p == null || !p.hidden()) + hasOnlyHiddenCommands = false; + } + + if (hasOnlyHiddenCommands) + return; + out.append(indent + " Commands:\n"); // The magic value 3 is the number of spaces between the name of the option and its description
usage() hides 'Comments:' header when only hidden commands exist
cbeust_jcommander
train
java
b656c8f7eb03b892e61f0de0f208abc243ffd1ce
diff --git a/lib/zendesk_apps_support/validations/requirements.rb b/lib/zendesk_apps_support/validations/requirements.rb index <HASH>..<HASH> 100644 --- a/lib/zendesk_apps_support/validations/requirements.rb +++ b/lib/zendesk_apps_support/validations/requirements.rb @@ -55,7 +55,7 @@ module ZendeskAppsSupport def invalid_custom_fields(requirements) user_fields = requirements['user_fields'] organization_fields = requirements['organization_fields'] - custom_fields = user_fields.merge(organization_fields) + custom_fields = {}.merge(user_fields).merge(organization_fields) return unless custom_fields [].tap do |errors| custom_fields.each do |identifier, fields|
Ensure custom_fields is never nil
zendesk_zendesk_apps_support
train
rb
c5589825acb87ef3009c800b3febf6e5a868809c
diff --git a/lib/parse/client.rb b/lib/parse/client.rb index <HASH>..<HASH> 100644 --- a/lib/parse/client.rb +++ b/lib/parse/client.rb @@ -110,7 +110,7 @@ module Parse raise rescue ParseProtocolError => e if num_tries <= max_retries - sleep 1 if e.code == Protocol::ERROR_EXCEEDED_BURST_LIMIT + sleep 60 if e.code == Protocol::ERROR_EXCEEDED_BURST_LIMIT retry if [Protocol::ERROR_EXCEEDED_BURST_LIMIT, Protocol::ERROR_TIMEOUT].include?(e.code) end raise
sleep 1m on rate limit Conflicts: lib/parse/client.rb
adelevie_parse-ruby-client
train
rb
f055696473d95c7c06236af481d6f2df801b21cf
diff --git a/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java b/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java index <HASH>..<HASH> 100755 --- a/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java +++ b/redisson/src/main/java/org/redisson/connection/SentinelConnectionManager.java @@ -444,7 +444,7 @@ public class SentinelConnectionManager extends MasterSlaveConnectionManager { return; } - Set<RedisURI> currentSlaves = new HashSet<>(slavesMap.size()); + Set<RedisURI> currentSlaves = Collections.newSetFromMap(new ConcurrentHashMap<>(slavesMap.size())); AsyncCountDownLatch latch = new AsyncCountDownLatch(); for (Map<String, String> map : slavesMap) { if (map.isEmpty()) {
Fixed - race condition during hostname resolution in sentinel mode which may cause slave shutdown. #<I>
redisson_redisson
train
java
37a55720ce9732a6ff5afee5496ca38da93941b9
diff --git a/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/ui/alfresco/AlfrescoProcessInstanceTableItem.java b/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/ui/alfresco/AlfrescoProcessInstanceTableItem.java index <HASH>..<HASH> 100644 --- a/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/ui/alfresco/AlfrescoProcessInstanceTableItem.java +++ b/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/ui/alfresco/AlfrescoProcessInstanceTableItem.java @@ -53,10 +53,8 @@ class AlfrescoProcessInstanceTableItem extends PropertysetItem implements Compar } }); - HorizontalLayout actionLayout = new HorizontalLayout(); - actionLayout.addComponent(new Embedded(null, Images.MAGNIFIER_16)); - actionLayout.addComponent(viewProcessInstanceButton); - addItemProperty(PROPERTY_ACTIONS, new ObjectProperty<Component>(actionLayout)); + viewProcessInstanceButton.setIcon(Images.MAGNIFIER_16); + addItemProperty(PROPERTY_ACTIONS, new ObjectProperty<Component>(viewProcessInstanceButton)); } public int compareTo(AlfrescoProcessInstanceTableItem other) {
ACT-<I>: small ui fix: centralized actions column
camunda_camunda-bpm-platform
train
java
b1acebb654995b8bf584587fb96b42c4adb70291
diff --git a/lib/Daemon_MasterThread.class.php b/lib/Daemon_MasterThread.class.php index <HASH>..<HASH> 100644 --- a/lib/Daemon_MasterThread.class.php +++ b/lib/Daemon_MasterThread.class.php @@ -31,6 +31,8 @@ class Daemon_MasterThread extends Thread { $this->fileWatcher = new FileWatcher; $this->workers = new ThreadCollection; + $this->collections['workers'] = $this->workers; + Daemon::$appResolver = require Daemon::$config->path->value; $this->IPCManager = Daemon::$appResolver->getInstanceByAppName('IPCManager');
Daemon_MasterThread.class.php: fixed $workers.
kakserpom_phpdaemon
train
php
bb7ac94e33faa35387199e08ec95008a8248d432
diff --git a/lib/garage/docs/application.rb b/lib/garage/docs/application.rb index <HASH>..<HASH> 100644 --- a/lib/garage/docs/application.rb +++ b/lib/garage/docs/application.rb @@ -26,11 +26,15 @@ module Garage attr_reader :pathname def self.renderer - @renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(with_toc_data: true), fenced_code_blocks: true) + @renderer ||= Redcarpet::Markdown.new( + Redcarpet::Render::HTML.new(with_toc_data: true), + fenced_code_blocks: true, + no_intra_emphasis: true + ) end def self.toc_renderer - @toc_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC) + @toc_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC, no_intra_emphasis: true) end def initialize(pathname)
Change redcarpet option: disable emphasis
cookpad_garage
train
rb
6d724c22cf7e6095096ba8d554a6281ef0173abc
diff --git a/azure-functions-maven-plugin/src/main/java/com/microsoft/azure/maven/function/RunMojo.java b/azure-functions-maven-plugin/src/main/java/com/microsoft/azure/maven/function/RunMojo.java index <HASH>..<HASH> 100644 --- a/azure-functions-maven-plugin/src/main/java/com/microsoft/azure/maven/function/RunMojo.java +++ b/azure-functions-maven-plugin/src/main/java/com/microsoft/azure/maven/function/RunMojo.java @@ -23,7 +23,7 @@ import java.io.File; */ @Mojo(name = "run") public class RunMojo extends AbstractFunctionMojo { - protected static final String FUNC_CMD = "func"; + protected static final String FUNC_CMD = "func -v"; protected static final String FUNC_HOST_START_CMD = "func host start"; protected static final String RUN_FUNCTIONS_FAILURE = "Failed to run Azure Functions. Please checkout console output."; protected static final String RUNTIME_NOT_FOUND = "Azure Functions Core Tools not found. " +
Fix func validation will stuck with latest core tools
Microsoft_azure-maven-plugins
train
java
79029c5d845e3dc77c6e368cc6fd417ca5b608d1
diff --git a/jbehave-core/src/main/java/org/jbehave/core/reporters/FreemarkerViewGenerator.java b/jbehave-core/src/main/java/org/jbehave/core/reporters/FreemarkerViewGenerator.java index <HASH>..<HASH> 100644 --- a/jbehave-core/src/main/java/org/jbehave/core/reporters/FreemarkerViewGenerator.java +++ b/jbehave-core/src/main/java/org/jbehave/core/reporters/FreemarkerViewGenerator.java @@ -64,9 +64,14 @@ public class FreemarkerViewGenerator implements ViewGenerator { private final Configuration configuration; private Properties viewProperties; private List<Report> reports = new ArrayList<Report>(); - private StoryNameResolver nameResolver = new UnderscoredToCapitalized(); + private final StoryNameResolver nameResolver; public FreemarkerViewGenerator() { + this(new UnderscoredToCapitalized()); + } + + public FreemarkerViewGenerator(StoryNameResolver nameResolver) { + this.nameResolver = nameResolver; this.configuration = configure(); } @@ -304,7 +309,7 @@ public class FreemarkerViewGenerator implements ViewGenerator { totals.put(key, total); } } - return new Report("totals", new HashMap<String, File>(), totals); + return new Report("Totals", new HashMap<String, File>(), totals); } public List<Report> getReports() {
Allowed the StoryNameResolver to be passed into the FreemarkerViewGenerator.
jbehave_jbehave-core
train
java
5bb88f594ecaa61590173a1e89f56b761ac72ce2
diff --git a/spec/gphoto2/camera_spec.rb b/spec/gphoto2/camera_spec.rb index <HASH>..<HASH> 100644 --- a/spec/gphoto2/camera_spec.rb +++ b/spec/gphoto2/camera_spec.rb @@ -129,15 +129,21 @@ module GPhoto2 allow(camera).to receive_message_chain(:abilities, :[]).and_return(operations) end + context 'when the camera has the ability to perform an operation' do + it 'returns true' do + expect(camera.can?(:capture_image)).to be(true) + end + end + context 'when the camera does not have the ability perform an operation' do - it 'return false' do + it 'returns false' do expect(camera.can?(:capture_audio)).to be(false) end end - context 'when the camera does have the ability to perform an operation' do - it 'returns true' do - expect(camera.can?(:capture_image)).to be(true) + context 'an invalid operation is given' do + it 'returns false' do + expect(camera.can?(:dance)).to be(false) end end end
Add test to check invalid camera operation for Camera#can?
zaeleus_ffi-gphoto2
train
rb
5d6448e1f0f3207897ee3822728611dff0ef1d4c
diff --git a/src/species/formFiller.js b/src/species/formFiller.js index <HASH>..<HASH> 100644 --- a/src/species/formFiller.js +++ b/src/species/formFiller.js @@ -85,7 +85,9 @@ define(function(require) { do { // Find a random element within all selectors - element = config.randomizer.pick(document.querySelectorAll(elementTypes.join(','))); + var elements = document.querySelectorAll(elementTypes.join(',')); + if (elements.length === 0) return false; + element = config.randomizer.pick(elements); nbTries++; if (nbTries > config.maxNbTries) return false; } while (!element || !config.canFillElement(element));
Fix formFiller gremlin when no form element is present Closes #<I>
marmelab_gremlins.js
train
js
f02f451668ad9bfe752a0b76d5d7b8f9929177fd
diff --git a/core/ledger/util/couchdb/couchdb_test.go b/core/ledger/util/couchdb/couchdb_test.go index <HASH>..<HASH> 100644 --- a/core/ledger/util/couchdb/couchdb_test.go +++ b/core/ledger/util/couchdb/couchdb_test.go @@ -613,7 +613,7 @@ func TestDBRequestTimeout(t *testing.T) { defer cleanup(database) //create an impossibly short timeout - impossibleTimeout := time.Microsecond * 1 + impossibleTimeout := time.Nanosecond //create a new instance and database object with a timeout that will fail //Also use a maxRetriesOnStartup=3 to reduce the number of retries
Reduce TestDBRequestTimeout timeout value (#<I>) Unit tests for a PR recently failed when a DB request with a very small timeout seems to have completed successfully. While a microsecond is an impossibly short period of time for an http request, a nanosecond is a thousand times shorter. (It's also the smallest time.Duration we can specify.) This modifies the test timeout to a Nanosecond to make impossible things even less likely. FAB-<I>
hyperledger_fabric
train
go
715d89f577ef37da8f3b423f3d493472107e80c0
diff --git a/modules/clipboard.js b/modules/clipboard.js index <HASH>..<HASH> 100644 --- a/modules/clipboard.js +++ b/modules/clipboard.js @@ -116,7 +116,6 @@ class Clipboard extends Module { if (e.defaultPrevented) return; let range = this.quill.getSelection(); let delta = new Delta().retain(range.index).delete(range.length); - let types = e.clipboardData ? e.clipboardData.types : null; let bodyTop = document.body.scrollTop; this.container.focus(); setTimeout(() => {
Remove unused types variable (#<I>) Remove unused types variable
quilljs_quill
train
js
c2ba493b3b6cf6a2be0e3dea244f10e448104bd0
diff --git a/ext/zookeeper_base.rb b/ext/zookeeper_base.rb index <HASH>..<HASH> 100644 --- a/ext/zookeeper_base.rb +++ b/ext/zookeeper_base.rb @@ -143,7 +143,8 @@ class ZookeeperBase raise Exceptions::NotConnected unless connected? if forked? raise InheritedConnectionError, <<-EOS.gsub(/(?:^|\n)\s*/, ' ').strip - You tried to use a connection inherited from another process [#{@pid}] + You tried to use a connection inherited from another process + (original pid: #{original_pid}, your pid: #{Process.pid}) You need to call reopen() after forking EOS end
fix the error message for InheritedConnectionError forgot to *use* the attr_accessor after I changed things...
zk-ruby_zookeeper
train
rb
a6d35c0fd785bae135034502b1d07ed626aebde5
diff --git a/lib/rbkb/extends/enumerable.rb b/lib/rbkb/extends/enumerable.rb index <HASH>..<HASH> 100644 --- a/lib/rbkb/extends/enumerable.rb +++ b/lib/rbkb/extends/enumerable.rb @@ -6,4 +6,22 @@ module Enumerable n.each_recursive(&block) if Enumerable === n end end + + def sum + return self.inject(0){|accum, i| accum + i } + end + + def mean + return self.sum / self.length.to_f + end + + def sample_variance + m = self.mean + sum = self.inject(0){|accum, i| accum + (i - m) ** 2 } + return sum / (self.length - 1).to_f + end + + def standard_deviation + return Math.sqrt(self.sample_variance) + end end diff --git a/lib/rbkb/version.rb b/lib/rbkb/version.rb index <HASH>..<HASH> 100644 --- a/lib/rbkb/version.rb +++ b/lib/rbkb/version.rb @@ -1,3 +1,3 @@ module Rbkb - VERSION = "0.7.1" + VERSION = "0.7.2" end
add enumerable sum,mean, and standard_deviation
emonti_rbkb
train
rb,rb
f8b20f1435a67d2e1fbf510939b8ddd7d4a75a5d
diff --git a/glue/segmentsUtils.py b/glue/segmentsUtils.py index <HASH>..<HASH> 100644 --- a/glue/segmentsUtils.py +++ b/glue/segmentsUtils.py @@ -76,7 +76,10 @@ def fromfilenames(filenames, coltype=int): pattern = re.compile(r"-([\d.]+)-([\d.]+)\.[\w_+#]+\Z") l = segments.segmentlist() for name in filenames: + if name.endswith('.gz'): + name = name.rstrip('.gz') [(s, d)] = pattern.findall(name.strip()) + s = coltype(s) d = coltype(d) l.append(segments.segment(s, s + d))
allow fromfilenames function to accept xml filenames with .gz extension. Not nice work but it works for now. Ideally it should be for any type of files
gwastro_pycbc-glue
train
py
49082d094c25a15a26367b39239766bafacb3c60
diff --git a/packages/ember-runtime/lib/mixins/array.js b/packages/ember-runtime/lib/mixins/array.js index <HASH>..<HASH> 100644 --- a/packages/ember-runtime/lib/mixins/array.js +++ b/packages/ember-runtime/lib/mixins/array.js @@ -149,7 +149,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot @method slice @param {Integer} beginIndex (Optional) index to begin slicing from. - @param {Integer} endIndex (Optional) index to end the slice at. + @param {Integer} endIndex (Optional) index to end the slice at (but not included). @return {Array} New array with specified slice */ slice: function(beginIndex, endIndex) {
Clarifies that the endIndex for slice isn't included. Other JS references clarify this and I found myself tripping on it today since it wasn't obvious.
emberjs_ember.js
train
js
b23807b1205666e49c9c9aa96e94b7c1b184ad84
diff --git a/lib/jim/installer.rb b/lib/jim/installer.rb index <HASH>..<HASH> 100644 --- a/lib/jim/installer.rb +++ b/lib/jim/installer.rb @@ -55,7 +55,7 @@ module Jim installed_paths = [] sub_options = options.merge({ :name => nil, - :version => nil, + :version => nil, :parent_version => version, :package_json => package_json.merge("name" => nil) }) @@ -122,6 +122,8 @@ module Jim @package_json = @options[:package_json] || {} package_json_path = if fetched_path.directory? fetched_path + 'package.json' + elsif options[:shallow] && fetch_path.file? + fetch_path.dirname + 'package.json' else fetched_path.dirname + 'package.json' end
Shallow Install (used for vendor) gets correct versions from package.json
quirkey_jim
train
rb
395b0ff400abf75d7ff9802856bc4608612ce262
diff --git a/src/com/google/javascript/jscomp/ModuleRenaming.java b/src/com/google/javascript/jscomp/ModuleRenaming.java index <HASH>..<HASH> 100644 --- a/src/com/google/javascript/jscomp/ModuleRenaming.java +++ b/src/com/google/javascript/jscomp/ModuleRenaming.java @@ -15,6 +15,7 @@ */ package com.google.javascript.jscomp; +import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import com.google.common.base.Joiner; @@ -62,7 +63,7 @@ final class ModuleRenaming { return ClosureRewriteModule.getBinaryModuleNamespace(googNamespace); case GOOG_PROVIDE: case LEGACY_GOOG_MODULE: - return googNamespace; + return checkNotNull(googNamespace); case ES6_MODULE: case COMMON_JS: return moduleMetadata.path().toModuleName();
Fix crash during module rewriting due to invalid compiler state ------------- Created by MOE: <URL>
google_closure-compiler
train
java
fc197cae916b2073d01fbc129d4d56fb0ada2465
diff --git a/niworkflows/interfaces/bids.py b/niworkflows/interfaces/bids.py index <HASH>..<HASH> 100644 --- a/niworkflows/interfaces/bids.py +++ b/niworkflows/interfaces/bids.py @@ -222,9 +222,12 @@ class BIDSDataGrabber(SimpleInterface): def __init__(self, *args, **kwargs): anat_only = kwargs.pop("anat_only") + anat_derivatives = kwargs.pop("anat_derivatives") super(BIDSDataGrabber, self).__init__(*args, **kwargs) if anat_only is not None: self._require_funcs = not anat_only + if anat_derivatives is not None: + self._require_t1w = not anat_derivatives def _run_interface(self, runtime): bids_dict = self.inputs.subject_data @@ -232,7 +235,7 @@ class BIDSDataGrabber(SimpleInterface): self._results["out_dict"] = bids_dict self._results.update(bids_dict) - if not bids_dict["t1w"]: + if self._require_t1w and not bids_dict['t1w']: raise FileNotFoundError( "No T1w images found for subject sub-{}".format(self.inputs.subject_id) )
skip t1w file existence check if anat_derivatives are provided
poldracklab_niworkflows
train
py
4a6b4f4157550a38966040014c17068c393e3685
diff --git a/tests/AgentTest.php b/tests/AgentTest.php index <HASH>..<HASH> 100644 --- a/tests/AgentTest.php +++ b/tests/AgentTest.php @@ -14,6 +14,9 @@ use Psr\Log\NullLogger; use Inet\Inventory\Agent; use Inet\Inventory\Facter\ArrayFacter; +/** + * @group real-client + */ class AgentTest extends ClientTestCase { protected $account_name = 'Test Corp.'; diff --git a/tests/RealClientTest.php b/tests/RealClientTest.php index <HASH>..<HASH> 100644 --- a/tests/RealClientTest.php +++ b/tests/RealClientTest.php @@ -6,7 +6,7 @@ use Guzzle\Service\Client as GClient; use Guzzle\Service\Description\ServiceDescription; /** - * @group inventory + * @group real-client */ class RealClientTest extends MockClientTest {
Specify tests which requires an inventory server. Exclude thoses tests with --exclude-group real-client.
inetprocess_libinventoryclient
train
php,php
d4de58750fd8c4b48b2c227e1ed50114a6668a2c
diff --git a/lib/elftools/elf_file.rb b/lib/elftools/elf_file.rb index <HASH>..<HASH> 100644 --- a/lib/elftools/elf_file.rb +++ b/lib/elftools/elf_file.rb @@ -21,6 +21,8 @@ module ELFTools # #=> #<ELFTools::ELFFile:0x00564b106c32a0 @elf_class=64, @endian=:little, @stream=#<File:/bin/cat>> def initialize(stream) @stream = stream + # always set binmode if stream is an IO object. + @stream.binmode if @stream.respond_to?(:binmode) identify # fetch the most basic information end diff --git a/spec/elf_file_spec.rb b/spec/elf_file_spec.rb index <HASH>..<HASH> 100644 --- a/spec/elf_file_spec.rb +++ b/spec/elf_file_spec.rb @@ -130,6 +130,7 @@ describe ELFTools::ELFFile do describe 'patches' do it 'dup' do out = Tempfile.new('elftools') + out.binmode @elf.save(out.path) expect(out.read.force_encoding('ascii-8bit')).to eq IO.binread(@filepath) out.close @@ -137,6 +138,7 @@ describe ELFTools::ELFFile do it 'patch header' do out = Tempfile.new('elftools') + out.binmode # prevent effect other tests elf = ELFTools::ELFFile.new(File.open(@filepath)) expect(elf.machine).to eq 'Advanced Micro Devices X86-64'
fix appveyor (#3)
david942j_rbelftools
train
rb,rb
9b9404756ff5fb59b2f7ea19a9e00d32bd30e439
diff --git a/visidata/__init__.py b/visidata/__init__.py index <HASH>..<HASH> 100644 --- a/visidata/__init__.py +++ b/visidata/__init__.py @@ -29,6 +29,7 @@ from .transpose import * from .diff import * from .vimkeys import * +from .utils import * from .loaders.csv import * from .loaders.json import * diff --git a/visidata/vdtui.py b/visidata/vdtui.py index <HASH>..<HASH> 100755 --- a/visidata/vdtui.py +++ b/visidata/vdtui.py @@ -298,12 +298,10 @@ vdtype(int, '#', '{:d}') vdtype(float, '%', '{:.02f}') vdtype(len, '#') -def joinSheetnames(*sheetnames): - 'Concatenate sheet names in a standard way' - return '_'.join(str(x) for x in sheetnames) +### def error(s): - 'Raise an expected exception.' + 'Log an error and raise an exception.' status(s, priority=2) raise ExpectedException(s)
[vdtui refactor] joinSheetnames to utils.py
saulpw_visidata
train
py,py
d7169bd1bd1b80b234a39431ec5048fae55c41b2
diff --git a/bosh-stemcell/spec/stemcells/centos_spec.rb b/bosh-stemcell/spec/stemcells/centos_spec.rb index <HASH>..<HASH> 100644 --- a/bosh-stemcell/spec/stemcells/centos_spec.rb +++ b/bosh-stemcell/spec/stemcells/centos_spec.rb @@ -146,15 +146,15 @@ describe 'CentOs Stemcell' do context 'installed by system-aws-network' do describe file('/etc/sysconfig/network') do - it { should be_file } - it { should contain 'NETWORKING=yes' } + xit { should be_file } + xit { should contain 'NETWORKING=yes' } end describe file('/etc/sysconfig/network-scripts/ifcfg-eth0') do - it { should be_file } - it { should contain 'DEVICE=eth0' } - it { should contain 'BOOTPROTO=dhcp' } - it { should contain 'ONBOOT=yes' } + xit { should be_file } + xit { should contain 'DEVICE=eth0' } + xit { should contain 'BOOTPROTO=dhcp' } + xit { should contain 'ONBOOT=yes' } end end end
Make new CentOS network server specs pending.
cloudfoundry_bosh
train
rb
62b58785d3f80a9241717cda1483c5e82344757e
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -150,7 +150,7 @@ describe('favicon()', function(){ }); it('should understand If-None-Match', function(done){ - request(server.listen()) + request(server) .get('/favicon.ico') .expect(200, function(err, res){ if (err) return done(err); @@ -188,7 +188,7 @@ describe('favicon()', function(){ }); it('should cache for second request', function(done){ - request(server.listen()) + request(server) .get('/favicon.ico') .expect(200, function(err){ if (err) return done(err); @@ -224,7 +224,7 @@ describe('favicon()', function(){ it('should retry reading file after error', function(done){ readFile.setNextError(new Error('oh no')); - request(server.listen()) + request(server) .get('/favicon.ico') .expect(500, 'oh no', function(err){ if (err) return done(err);
tests: remove listen for newer supertest
expressjs_serve-favicon
train
js
391d3773ea54f9229528a1429bb3c78cc8344628
diff --git a/common/read.go b/common/read.go index <HASH>..<HASH> 100644 --- a/common/read.go +++ b/common/read.go @@ -27,16 +27,18 @@ var ( atomSpecials = string([]rune{listStart, listEnd, literalStart, sp, '%', '*'}) + quotedSpecials + respSpecials ) -type parseError error +type parseError struct { + error +} func newParseError(text string) error { - return parseError(errors.New(text)) + return &parseError{errors.New(text)} } // IsParseError returns true if the provided error is a parse error produced by // Reader. func IsParseError(err error) bool { - _, ok := err.(parseError) + _, ok := err.(*parseError) return ok }
common: parseError is now a struct, interfaces are not working for this purpose
emersion_go-imap
train
go
2ea9aedc25f02835e5593b4f2cf5128e51cf17fc
diff --git a/scripts/preinstall.js b/scripts/preinstall.js index <HASH>..<HASH> 100644 --- a/scripts/preinstall.js +++ b/scripts/preinstall.js @@ -53,7 +53,7 @@ function handleError(err) { if (process.platform === "win32") { var LIB_URL = - "https://github.com/nteract/libzmq-win/releases/download/v2.0.0/libzmq-" + + "https://github.com/nteract/libzmq-win/releases/download/v2.1.0/libzmq-" + ZMQ + "-" + process.arch +
Upgraded download URL since new release on nteract's repository
zeromq_zeromq.js
train
js
c5a91d6fcbf19be997f2bfa5c74a37034f0d19d1
diff --git a/src/asset/AssetLoader.php b/src/asset/AssetLoader.php index <HASH>..<HASH> 100644 --- a/src/asset/AssetLoader.php +++ b/src/asset/AssetLoader.php @@ -14,6 +14,7 @@ class AssetLoader { case 'text/x-php': case 'text/plain': return $this->loadAsText($fileName); + case 'application/xml': case 'text/xml': case 'text/html': return $this->loadAsAsset($fileName); }
Add application/xml mime type
templado_engine
train
php
66298f9205989ae4d07e54ef2ed61cb915833537
diff --git a/test/unit/sandbox-libraries/lodash3.test.js b/test/unit/sandbox-libraries/lodash3.test.js index <HASH>..<HASH> 100644 --- a/test/unit/sandbox-libraries/lodash3.test.js +++ b/test/unit/sandbox-libraries/lodash3.test.js @@ -25,7 +25,7 @@ describe('sandbox library - lodash3', function () { it('should be the correct version (avoid lodash4 conflict)', function (done) { context.execute(` var assert = require('assert'); - assert.strictEqual(_ && _.VERSION, '3.10.1', '_.VERSION must be 3.10.1'); + assert.strictEqual(_ && _.VERSION, '3.10.2', '_.VERSION must be 3.10.2'); `, done); });
Test: update lodash3 to version <I>
postmanlabs_postman-sandbox
train
js
dd3a79eead4f01094c2c3003de717affc11fdc3c
diff --git a/src/util/Options.js b/src/util/Options.js index <HASH>..<HASH> 100644 --- a/src/util/Options.js +++ b/src/util/Options.js @@ -35,7 +35,7 @@ * (e.g. recommended shard count, shard count of the ShardingManager) * @property {CacheFactory} [makeCache] Function to create a cache. * You can use your own function, or the {@link Options} class to customize the Collection used for the cache. - * <warn>Overriding the cache used in `GuildManager`, `ChannelManager`, 'GuildChannelManager', `RoleManager`, + * <warn>Overriding the cache used in `GuildManager`, `ChannelManager`, `GuildChannelManager`, `RoleManager`, * and `PermissionOverwriteManager` is unsupported and **will** break functionality</warn> * @property {number} [messageCacheLifetime=0] DEPRECATED: Use `makeCache` with a `LimitedCollection` instead. * How long a message should stay in the cache until it is considered sweepable (in seconds, 0 for forever)
docs: typo in ClientOptions (#<I>)
discordjs_discord.js
train
js
ad7563736f5735b0a373b9c127b86871441554e6
diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -581,7 +581,13 @@ class CakeRequest implements ArrayAccess { * * Allows for custom detectors on the request parameters. * - * e.g `addDetector('post', array('param' => 'requested', 'value' => 1)` + * e.g `addDetector('requested', array('param' => 'requested', 'value' => 1)` + * + * You can also make parameter detectors that accept multiple values + * using the `options` key. This is useful when you want to check + * if a request parameter is in a list of options. + * + * `addDetector('extension', array('param' => 'ext', 'options' => array('pdf', 'csv'))` * * @param string $name The name of the detector. * @param array $options The options for the detector definition. See above.
Expand doc blocks for CakeRequest::addDetector.
cakephp_cakephp
train
php
23ace84f38c26340a6bc2f7abaef9abaa2aecb63
diff --git a/lib/chef/encrypted_attribute/encrypted_mash/version1.rb b/lib/chef/encrypted_attribute/encrypted_mash/version1.rb index <HASH>..<HASH> 100644 --- a/lib/chef/encrypted_attribute/encrypted_mash/version1.rb +++ b/lib/chef/encrypted_attribute/encrypted_mash/version1.rb @@ -148,7 +148,7 @@ class Chef rescue OpenSSL::Digest::DigestError, OpenSSL::HMACError, RuntimeError => e # RuntimeError is raised for unsupported algorithms - raise MessageAuthenticationFailure, "#{e.class.name}: #{e}" + raise MessageAuthenticationFailure, "#{e.class}: #{e}" end def hmac_matches?(orig_hmac, data, algo = HMAC_ALGORITHM) @@ -158,8 +158,7 @@ class Chef orig_hmac['data'] == new_hmac rescue OpenSSL::Digest::DigestError, OpenSSL::HMACError, RuntimeError => e - # RuntimeError is raised for unsupported algorithms - raise MessageAuthenticationFailure, "#{e.class.name}: #{e}" + raise MessageAuthenticationFailure, "#{e.class}: #{e}" end end end
EncryptedMash::Version1: Simplify rescue duplicated code
zuazo_chef-encrypted-attributes
train
rb
32f24c4657638c16dc290e8327ea10844be2b825
diff --git a/src/ItemsCarousel/ItemsCarouselBase.js b/src/ItemsCarousel/ItemsCarouselBase.js index <HASH>..<HASH> 100644 --- a/src/ItemsCarousel/ItemsCarouselBase.js +++ b/src/ItemsCarousel/ItemsCarouselBase.js @@ -244,7 +244,10 @@ ItemsCarouselBase.propTypes = { isPlaceholderMode: PropTypes.bool.isRequired, // Props coming from withContainerWidth containerWidth: PropTypes.number.isRequired, - measureRef: PropTypes.object.isRequired, + measureRef: PropTypes.oneOfType([ + PropTypes.func, // for legacy refs + PropTypes.shape({ current: PropTypes.object }) + ]).isRequired, // Props coming from withSwipe touchRelativeX: PropTypes.number.isRequired, onWrapperTouchStart: PropTypes.func,
fix: warning of wrong measureRef type for legacy refs
bitriddler_react-items-carousel
train
js
470229449015c0cb123710d24ed6124c9ce40668
diff --git a/lib/watir-webdriver/locators/button_locator.rb b/lib/watir-webdriver/locators/button_locator.rb index <HASH>..<HASH> 100644 --- a/lib/watir-webdriver/locators/button_locator.rb +++ b/lib/watir-webdriver/locators/button_locator.rb @@ -48,7 +48,7 @@ module Watir end end - def matches_selector?(rx_selector, element) + def matches_selector?(element, rx_selector) rx_selector = rx_selector.dup [:value, :caption].each do |key| diff --git a/lib/watir-webdriver/locators/text_field_locator.rb b/lib/watir-webdriver/locators/text_field_locator.rb index <HASH>..<HASH> 100644 --- a/lib/watir-webdriver/locators/text_field_locator.rb +++ b/lib/watir-webdriver/locators/text_field_locator.rb @@ -41,7 +41,7 @@ module Watir end end - def matches_selector?(rx_selector, element) + def matches_selector?(element, rx_selector) rx_selector = rx_selector.dup [:text, :value, :label].each do |key|
Fix order of arguments for matches_selector? in other locators.
watir_watir
train
rb,rb
a90b0f0afd2ee7b1e86467b874f26ed1809af723
diff --git a/test/integration/read.js b/test/integration/read.js index <HASH>..<HASH> 100644 --- a/test/integration/read.js +++ b/test/integration/read.js @@ -1167,6 +1167,23 @@ module.exports = function (createFn, setup, dismantle) { done() }) }) + + it('GET /Customer/count 200 - ignores sort', (done) => { + request.get({ + url: `${testUrl}/api/v1/Customer/count`, + qs: { + sort: { + _id: 1 + } + }, + json: true + }, (err, res, body) => { + assert.ok(!err) + assert.equal(res.statusCode, 200) + assert.equal(body.count, 3) + done() + }) + }) }) describe('shallow', () => {
chore(test): sort arg on count query
florianholzapfel_express-restify-mongoose
train
js