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
b43d7bf66b7a855483dfbe1db46164b05b07c9a9
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php @@ -182,7 +182,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase array('mo', 'MoFileLoader'), array('po', 'PoFileLoader'), array('php', 'PhpFileLoader'), - array('ts', 'QtTranslationsLoader'), + array('ts', 'QtFileLoader'), array('xlf', 'XliffFileLoader'), array('yml', 'YamlFileLoader'), );
[Translation] fixed a unit test
symfony_symfony
train
php
e65f05715c27217610c93e38635dd04c9bc9f90b
diff --git a/host/logbuf/logbuf.go b/host/logbuf/logbuf.go index <HASH>..<HASH> 100644 --- a/host/logbuf/logbuf.go +++ b/host/logbuf/logbuf.go @@ -51,16 +51,14 @@ func NewLog(l *lumberjack.Logger) *Log { l.Rotate() // force creating a log file straight away log := &Log{ l: l, - buf: make(map[int]*Data), - closed: false, + closed: make(chan struct{}), } return log } type Log struct { l *lumberjack.Logger - buf map[int]*Data - closed bool + closed chan struct{} } // Watch stream for new log events and transmit them. @@ -160,10 +158,7 @@ outer: ch <- data case <-done: break outer - case <-time.After(200 * time.Millisecond): - if !l.closed { - continue - } + case <-l.closed: break outer } } @@ -172,6 +167,6 @@ outer: } func (l *Log) Close() error { - l.closed = true + close(l.closed) return l.l.Close() }
host/logbuf: Fix race on closed flag
flynn_flynn
train
go
1251abece41e3f6ea6504490b168798f23b1f87f
diff --git a/lib/yap/shell/evaluation.rb b/lib/yap/shell/evaluation.rb index <HASH>..<HASH> 100644 --- a/lib/yap/shell/evaluation.rb +++ b/lib/yap/shell/evaluation.rb @@ -314,12 +314,14 @@ module Yap::Shell def process_ArgumentNode(node) if node.single_quoted? - "'#{node.lvalue}'" + debug_visit(node, 'single quoted argument, performing no expansion') + ["'#{node.lvalue}'"] elsif node.double_quoted? - variable_expand(node.lvalue) + debug_visit(node, 'double quoted argument, performing variable expansion') + [variable_expand(node.lvalue)] else - # TODO: refactor so this doesn't require a call to join. - shell_expand(node.lvalue, escape_directory_expansions: false).join(' ') + debug_visit(node, 'unquoted argument, performing shell expansion') + shell_expand(node.lvalue, escape_directory_expansions: false) end end
Consistently return an array for process_ArgumentNode. This resolves an issue where "ls *.gem" was failing when "ls" was assigned as an alias, e.g.: "alias ls='ls -G'"
zdennis_yap-shell-core
train
rb
e09228909ef01df7bd6e94a7a66232be60ff85ee
diff --git a/pylru.py b/pylru.py index <HASH>..<HASH> 100644 --- a/pylru.py +++ b/pylru.py @@ -299,13 +299,9 @@ class WriteThroughCacheManager(object): return False def __getitem__(self, key): - # First we try the cache. If successful we just return the value. If - # not we catch KeyError and ignore it since that just means the key - # was not in the cache. - try: + # Try the cache first. If successful we can just return the value. + if key in self.cache: return self.cache[key] - except KeyError: - pass # It wasn't in the cache. Look it up in the store, add the entry to # the cache, and return the value. @@ -391,13 +387,9 @@ class WriteBackCacheManager(object): return False def __getitem__(self, key): - # First we try the cache. If successful we just return the value. If - # not we catch KeyError and ignore it since that just means the key - # was not in the cache. - try: + # Try the cache first. If successful we can just return the value. + if key in self.cache: return self.cache[key] - except KeyError: - pass # It wasn't in the cache. Look it up in the store, add the entry to # the cache, and return the value.
Simplified logic of a couple __getitem__ implementations.
jlhutch_pylru
train
py
94106e3a242039e866771d237c54b042ecdf3b31
diff --git a/Neos.Flow/Classes/Validation/ValidatorResolver.php b/Neos.Flow/Classes/Validation/ValidatorResolver.php index <HASH>..<HASH> 100644 --- a/Neos.Flow/Classes/Validation/ValidatorResolver.php +++ b/Neos.Flow/Classes/Validation/ValidatorResolver.php @@ -309,7 +309,10 @@ class ValidatorResolver if ($this->reflectionService->isPropertyAnnotatedWith($targetClassName, $classPropertyName, Flow\IgnoreValidation::class)) { continue; } - if ($classSchema !== null && $classSchema->isPropertyTransient($classPropertyName) && $validationGroups === ['Persistence', 'Default']) { + if ($classSchema !== null + && $classSchema->hasProperty($classPropertyName) + && $classSchema->isPropertyTransient($classPropertyName) + && $validationGroups === ['Persistence', 'Default']) { continue; }
BUGFIX: Only check properties existing in schema
neos_flow-development-collection
train
php
b65ed608604492d605df2d62cd4c5050e2a8d508
diff --git a/fetch.js b/fetch.js index <HASH>..<HASH> 100644 --- a/fetch.js +++ b/fetch.js @@ -547,9 +547,15 @@ export function fetch(input, init) { } } - request.headers.forEach(function(value, name) { - xhr.setRequestHeader(name, value) - }) + if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) { + Object.getOwnPropertyNames(init.headers).forEach(function(name) { + xhr.setRequestHeader(name, normalizeValue(init.headers[name])) + }) + } else { + request.headers.forEach(function(value, name) { + xhr.setRequestHeader(name, value) + }) + } if (request.signal) { request.signal.addEventListener('abort', abortXhr)
If headers are passed in via a Record then do not normalise the header names as part of the request
github_fetch
train
js
e69a78149ab94377b47e877b6d9076214995b0e1
diff --git a/lib/openapi3_parser/node_factory/object.rb b/lib/openapi3_parser/node_factory/object.rb index <HASH>..<HASH> 100644 --- a/lib/openapi3_parser/node_factory/object.rb +++ b/lib/openapi3_parser/node_factory/object.rb @@ -61,7 +61,7 @@ module Openapi3Parser def validate_input(error_collection) super(error_collection) - validator = Validator.new(processed_input, self) + validator = Validator.new(context.input, self) error_collection.tap { |ec| ec.append(*validator.errors) } end diff --git a/lib/openapi3_parser/node_factory/object/node_builder.rb b/lib/openapi3_parser/node_factory/object/node_builder.rb index <HASH>..<HASH> 100644 --- a/lib/openapi3_parser/node_factory/object/node_builder.rb +++ b/lib/openapi3_parser/node_factory/object/node_builder.rb @@ -65,7 +65,7 @@ module Openapi3Parser def check_validation_errors(name, field_config) field_context = context.next_namespace(name) - errors = field_config.validation_errors(input[name], factory) + errors = field_config.validation_errors(field_context.input, factory) return unless errors.any? raise Openapi3Parser::Error,
Don't use processed_input for validation It's much easier to validate with more primitive collections
kevindew_openapi3_parser
train
rb,rb
b0c27402da5522db7d8e1b65c81a28b3a19500b0
diff --git a/pyinfra/modules/virtualenv.py b/pyinfra/modules/virtualenv.py index <HASH>..<HASH> 100644 --- a/pyinfra/modules/virtualenv.py +++ b/pyinfra/modules/virtualenv.py @@ -30,8 +30,7 @@ def virtualenv( if present is False and host.fact.directory(path): # Ensure deletion of unwanted virtualenv # no 'yield from' in python 2.7 - for cmd in files.directory(state, host, path, present=False): - yield cmd + yield files.directory(state, host, path, present=False) elif present and not host.fact.directory(path): # Create missing virtualenv
Fix relying on pyinfra generator unroll
Fizzadar_pyinfra
train
py
9f8acad16c6f8a7dcd980bfd8cf192c3faeaed8c
diff --git a/vendor/plugins/dataset/lib/dataset.rb b/vendor/plugins/dataset/lib/dataset.rb index <HASH>..<HASH> 100644 --- a/vendor/plugins/dataset/lib/dataset.rb +++ b/vendor/plugins/dataset/lib/dataset.rb @@ -1,5 +1,5 @@ -require 'activesupport' -require 'activerecord' +require 'active_support' +require 'active_record' require 'dataset/version' require 'dataset/instance_methods'
get rid of deprecation warnings when running specs
radiant_radiant
train
rb
8f34fea75cf19f137035a23c8e34cec967fbbe19
diff --git a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/LibraryBuilder.java b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/LibraryBuilder.java index <HASH>..<HASH> 100644 --- a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/LibraryBuilder.java +++ b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/LibraryBuilder.java @@ -1013,8 +1013,8 @@ public class LibraryBuilder { fun = (FunctionRef)resolveCall(fun.getLibraryName(), fun.getName(), invocation, false, false); if (fun != null) { if ("System".equals(invocation.getResolution().getOperator().getLibraryName())) { - fun = buildFunctionRef(libraryName, functionName, paramList); // Rebuild the fun from the original arguments, otherwise it will resolve with conversions in place - Expression systemFunction = systemFunctionResolver.resolveSystemFunction(fun); + FunctionRef systemFun = buildFunctionRef(libraryName, functionName, paramList); // Rebuild the fun from the original arguments, otherwise it will resolve with conversions in place + Expression systemFunction = systemFunctionResolver.resolveSystemFunction(systemFun); if (systemFunction != null) { return systemFunction; }
#<I>: Fixed an issue with ConvertsTo functions not resolving return type correctly.
cqframework_clinical_quality_language
train
java
1293fd83d26bf8305ac6ce306611c2fd6413faee
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -50,8 +50,10 @@ class NoisePeer extends stream.Duplex { this._handshake.send(null, (err, buf) => { if (err) return this.destroy(err) + this.rawStream.cork() // hack to put buf and header in the same packet this.rawStream.write(this._frame(buf)) // @mafintosh if (this._handshake.finished) return this._onhandshake() + this.rawStream.uncork() this._read() }) @@ -71,6 +73,7 @@ class NoisePeer extends stream.Duplex { } this.rawStream.write(this._frame(header)) // @mafintosh + this.rawStream.uncork() if (this._writePending) { this._write(this._writePending.data, null, this._writePending.cb)
Temporarily cork/uncork to force last handshake and header in same pack
emilbayes_noise-peer
train
js
c105a337c5ff802ec2b43f777d98277916bfaacc
diff --git a/allauth/socialaccount/views.py b/allauth/socialaccount/views.py index <HASH>..<HASH> 100644 --- a/allauth/socialaccount/views.py +++ b/allauth/socialaccount/views.py @@ -22,7 +22,7 @@ def signup(request, **kwargs): return HttpResponseRedirect(reverse(connections)) signup = request.session.get('socialaccount_signup') if not signup: - return HttpResponseRedirect(reverse(login)) + return HttpResponseRedirect(reverse('account_login')) form_class = kwargs.pop("form_class", SignupForm) template_name = kwargs.pop("template_name", 'socialaccount/signup.html')
Properly redirect to normal login when session is lost
pennersr_django-allauth
train
py
7c29e8881f67ba4c23ec2e8aa2e9418d9934dbc3
diff --git a/src/Symfony/Bundle/FrameworkBundle/RequestListener.php b/src/Symfony/Bundle/FrameworkBundle/RequestListener.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bundle/FrameworkBundle/RequestListener.php +++ b/src/Symfony/Bundle/FrameworkBundle/RequestListener.php @@ -103,7 +103,7 @@ class RequestListener $parameters = $this->router->match($request->getPathInfo()); if (null !== $this->logger) { - $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters))); + $this->logger->debug(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters))); } $request->attributes->add($parameters);
Changed log level of "Matched route ..." message from info to debug
symfony_symfony
train
php
8cf0922154058d5852a25a37265747c4681bcd6f
diff --git a/telemetry/telemetry/internal/backends/chrome/android_browser_backend.py b/telemetry/telemetry/internal/backends/chrome/android_browser_backend.py index <HASH>..<HASH> 100644 --- a/telemetry/telemetry/internal/backends/chrome/android_browser_backend.py +++ b/telemetry/telemetry/internal/backends/chrome/android_browser_backend.py @@ -203,9 +203,9 @@ class AndroidBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): @exc_util.BestEffort def Close(self): - super(AndroidBrowserBackend, self).Close() if os.getenv('CHROME_PGO_PROFILING'): self.devtools_client.DumpProfilingDataOfAllProcesses(timeout=120) + super(AndroidBrowserBackend, self).Close() self._StopBrowser() if self._tmp_minidump_dir: shutil.rmtree(self._tmp_minidump_dir, ignore_errors=True)
[PGO] Dump all profiles prior to Close() Devtool client is closed prior to pgo profile dumping, causing a null reference to the client. This swaps the order such that the client remains active while dumping, before we close it off. Bug: chromium:<I> Change-Id: I7ee7ec3e6a<I>f<I>b<I>d<I>dd7c<I>eb<I>dc6 Reviewed-on: <URL>
catapult-project_catapult
train
py
ca6fc58f2aa983b57a9f228b5b301d4dba20667f
diff --git a/src/FormObject/Field/SelectOneField.php b/src/FormObject/Field/SelectOneField.php index <HASH>..<HASH> 100644 --- a/src/FormObject/Field/SelectOneField.php +++ b/src/FormObject/Field/SelectOneField.php @@ -64,6 +64,23 @@ class SelectOneField extends Field implements Selectable{ } public function isItemSelected(SelectableProxy $item){ + + if ($item->getKey() === '' && $this->value === null) { + return true; + } + + if ($item->getKey() === '0' && $this->value === null) { + return false; + } + + if ($item->getKey() === 0 && $this->value === null) { + return false; + } + + if ($item->getKey() === 0 && $this->value === '') { + return false; + } + return ($item->getKey() == $this->value); }
Added better casting of falsish values
mtils_formobject
train
php
56fba412496a739d08b2b88a5994bfb31426fbc0
diff --git a/core/src/main/java/net/time4j/PlainTime.java b/core/src/main/java/net/time4j/PlainTime.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/net/time4j/PlainTime.java +++ b/core/src/main/java/net/time4j/PlainTime.java @@ -3415,7 +3415,7 @@ public final class PlainTime } @Override - public ChronoEntity<?> preformat( + public ChronoValues preformat( PlainTime context, AttributeQuery attributes ) {
adjustment for changed ChronoMerger (3)
MenoData_Time4J
train
java
bef5bab4a1f2d61973d9cc92a5fdcfc5d7c8f60c
diff --git a/tile_generator/tile_metadata.py b/tile_generator/tile_metadata.py index <HASH>..<HASH> 100644 --- a/tile_generator/tile_metadata.py +++ b/tile_generator/tile_metadata.py @@ -701,8 +701,16 @@ class TileMetadata(object): errand = dict() if job.get('lifecycle') == 'errand': errand['name'] = job['name'] - if job.get('post_deploy'): post_deploy_errands.append(errand) - if job.get('pre_delete'): pre_delete_errands.append(errand) + if job.get('post_deploy'): + if job.get('type') == 'deploy-all': # deploy-all should run first. + post_deploy_errands.insert(0, errand) + else: + post_deploy_errands.append(errand) + if job.get('pre_delete'): # delete-all should run last. + if job.get('type') == 'delete-all': + pre_delete_errands.append(errand) + else: + pre_delete_errands.insert(0, errand) for template in job.get('templates', {}): errand = {'colocated': True} # TODO: This should all really be checked in Cerberus for validation!
Ensure ordering of deploy-all/delete-all errands. deploy-all should be the first post-deploy errand. delete-all should be the last pre-delete errand.
cf-platform-eng_tile-generator
train
py
f52626f3b157347d85a457419686c68bfaf91973
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index <HASH>..<HASH> 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.1.1 +current_version = 3.1.2 commit = True tag = True diff --git a/aquarius/__init__.py b/aquarius/__init__.py index <HASH>..<HASH> 100644 --- a/aquarius/__init__.py +++ b/aquarius/__init__.py @@ -9,5 +9,5 @@ __author__ = """OceanProtocol""" # fmt: off # bumpversion needs single quotes -__version__ = '3.1.1' +__version__ = '3.1.2' # fmt: on diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ install_requirements = [ "elasticsearch==7.15.0", "PyYAML==5.4.1", "pytz==2021.1", - "ocean-contracts==0.6.7", + "ocean-contracts==0.6.9", "web3==5.23.1", "jsonschema==3.2.0", "eciespy", @@ -95,7 +95,7 @@ setup( url="https://github.com/oceanprotocol/aquarius", # fmt: off # bumpversion needs single quotes - version='3.1.1', + version='3.1.2', # fmt: on zip_safe=False, )
Feature/support more networks (#<I>) add more supported networks
oceanprotocol_aquarius
train
cfg,py,py
473c9d6e4919dced64e1275d6d32ea385ff4c8ac
diff --git a/src/test/java/com/googlecode/lanterna/tutorial/Tutorial03.java b/src/test/java/com/googlecode/lanterna/tutorial/Tutorial03.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/googlecode/lanterna/tutorial/Tutorial03.java +++ b/src/test/java/com/googlecode/lanterna/tutorial/Tutorial03.java @@ -9,7 +9,6 @@ import com.googlecode.lanterna.screen.TerminalScreen; import com.googlecode.lanterna.terminal.DefaultTerminalFactory; import com.googlecode.lanterna.terminal.Terminal; -import javax.xml.soap.Text; import java.io.IOException; import java.util.Random;
Removing unused import (was put there by mistake)
mabe02_lanterna
train
java
18e96163f6976b82446446f8a71b358aa6b06e01
diff --git a/spec/helper.rb b/spec/helper.rb index <HASH>..<HASH> 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -11,46 +11,3 @@ end require 'bacon' puts "Ruby: #{ RUBY_VERSION }; Pry Theme: #{ PryTheme::VERSION }" - -class InputTester - def initialize(*actions) - @orig_actions = actions.dup - @actions = actions - end - - def readline(*) - @actions.shift - end - - def rewind - @actions = @orig_actions.dup - end -end - -def mock_pry(*args) - args.flatten! - binding = args.first.is_a?(Binding) ? args.shift : binding() - - input = InputTester.new(*args) - output = StringIO.new - - redirect_pry_io(input, output) do - binding.pry - end - - output.string -end - -def redirect_pry_io(new_in, new_out = StringIO.new) - old_in = Pry.input - old_out = Pry.output - - Pry.input = new_in - Pry.output = new_out - begin - yield - ensure - Pry.input = old_in - Pry.output = old_out - end -end
Remove old crufty testing APIs
kyrylo_pry-theme
train
rb
d100a1ff48d22e617926ea87f9bc58830d887736
diff --git a/spec/network_interface_spec.rb b/spec/network_interface_spec.rb index <HASH>..<HASH> 100644 --- a/spec/network_interface_spec.rb +++ b/spec/network_interface_spec.rb @@ -215,6 +215,12 @@ IP_OUT end end + describe '#gateway6' do + it 'returns the correct default gateway for IPv6 routing' do + expect(subj.gateway6).to eq('d:e:a:d:b:e:e:f') + end + end + describe "#start" do it "returns true on success" do expect(AwesomeSpawn).to receive(:run).with(*IFUP_ARGS).and_return(result("", 0))
Added spec for new gateway6 method
ManageIQ_linux_admin
train
rb
e51aedec8b2b4d2b3e192e2b5a4bbcaa546fe46a
diff --git a/src/main/groovy/org/ajoberstar/gradle/git/tasks/GitClone.java b/src/main/groovy/org/ajoberstar/gradle/git/tasks/GitClone.java index <HASH>..<HASH> 100644 --- a/src/main/groovy/org/ajoberstar/gradle/git/tasks/GitClone.java +++ b/src/main/groovy/org/ajoberstar/gradle/git/tasks/GitClone.java @@ -57,8 +57,9 @@ public class GitClone extends DefaultTask implements AuthenticationSupported { cmd.setCredentialsProvider(getCredentialsProvider()); cmd.setURI(getUri().toString()); cmd.setRemote(getRemote()); + cmd.setBare(getBare()); cmd.setNoCheckout(!getCheckout()); - cmd.setBranch(getBranch()); + cmd.setBranch("refs/heads/" + getBranch()); cmd.setBranchesToClone(getBranchesToClone()); cmd.setCloneAllBranches(getCloneAllBranches()); cmd.setDirectory(getDestinationDir());
Fixed branch specification for clone command.
ajoberstar_gradle-git
train
java
cf2a300646d9a1e25151dcba1f39a5e56db5279b
diff --git a/sources/lib/Tester/FoundationSessionAtoum.php b/sources/lib/Tester/FoundationSessionAtoum.php index <HASH>..<HASH> 100644 --- a/sources/lib/Tester/FoundationSessionAtoum.php +++ b/sources/lib/Tester/FoundationSessionAtoum.php @@ -28,7 +28,7 @@ use PommProject\Foundation\SessionBuilder; */ abstract class FoundationSessionAtoum extends VanillaSessionAtoum { - protected function createSessionBuilder($configuration) + protected function createSessionBuilder(array $configuration) { return new SessionBuilder($configuration); } diff --git a/sources/lib/Tester/VanillaSessionAtoum.php b/sources/lib/Tester/VanillaSessionAtoum.php index <HASH>..<HASH> 100644 --- a/sources/lib/Tester/VanillaSessionAtoum.php +++ b/sources/lib/Tester/VanillaSessionAtoum.php @@ -77,7 +77,7 @@ abstract class VanillaSessionAtoum extends Atoum * @param array $configuration * @return SessionBuilder */ - protected function createSessionBuilder($configuration) + protected function createSessionBuilder(array $configuration) { return new SessionBuilder($configuration); }
Session builder needs array in SessionAtoum classes.
pomm-project_Foundation
train
php,php
ec4cac3ce61f5ae25fc1942edbbc45eac8415ba0
diff --git a/holoviews/core/dimension.py b/holoviews/core/dimension.py index <HASH>..<HASH> 100644 --- a/holoviews/core/dimension.py +++ b/holoviews/core/dimension.py @@ -128,7 +128,8 @@ class LabelledData(param.Parameterized): """ LabelledData is a mix-in class designed to introduce the value and label parameters (and corresponding methods) to any class - containing data. + containing data. This class assumes that the core data contents + will be held in the attribute called 'data'. Used together, value and label is designed to allow a simple and flexible means of addressing data. For instance, if you are
Added clarification to LabelledData class docstring
pyviz_holoviews
train
py
a460ff8843c0749542af72c961456b126344583b
diff --git a/packages/node-krl-compiler/src/c/RuleSelect.js b/packages/node-krl-compiler/src/c/RuleSelect.js index <HASH>..<HASH> 100644 --- a/packages/node-krl-compiler/src/c/RuleSelect.js +++ b/packages/node-krl-compiler/src/c/RuleSelect.js @@ -145,26 +145,6 @@ module.exports = function(ast, comp, e){ var lisp = traverse(ast.event); var state_machine = evalEELisp(lisp, "start", "end"); - //add all the loop-back conditions - _.each(state_machine, function(arr, key){ - var away_paths = _.uniq(_.compact(_.map(arr, function(transition){ - var condition = transition[0]; - var next_state = transition[1]; - if(!_.isString(condition) && (next_state === key)){ - return;//ignore this - } - return condition; - }))); - - state_machine[key].push([ - [ - "not", - wrapInOr(away_paths) - ], - key - ]); - }); - return e("obj", { graph: e("json", graph), eventexprs: e("obj", eventexprs),
statemachine should remain on current state by default
Picolab_pico-engine
train
js
4e6366cd896d8fe93472701ef773de67961d6df7
diff --git a/tests/python/unittest/test_ndarray.py b/tests/python/unittest/test_ndarray.py index <HASH>..<HASH> 100644 --- a/tests/python/unittest/test_ndarray.py +++ b/tests/python/unittest/test_ndarray.py @@ -56,9 +56,9 @@ def check_with_uniform(uf, arg_shapes, dim=None, npuf=None, rmin=-10, type_list= if isinstance(out1, mx.nd.NDArray): out1 = out1.asnumpy() if dtype == np.float16: - assert_almost_equal(out1, out2, rtol=2e-3) + assert_almost_equal(out1, out2, rtol=2e-3, atol=1e-5) else: - assert_almost_equal(out1, out2) + assert_almost_equal(out1, out2, atol=1e-5) def random_ndarray(dim): shape = tuple(np.random.randint(1, int(1000**(1.0/dim)), size=dim))
set proper atol for check_with_uniform (#<I>)
apache_incubator-mxnet
train
py
44af210543184f753b4febc1e500b9be955853d6
diff --git a/django_extensions/management/commands/runscript.py b/django_extensions/management/commands/runscript.py index <HASH>..<HASH> 100644 --- a/django_extensions/management/commands/runscript.py +++ b/django_extensions/management/commands/runscript.py @@ -11,9 +11,6 @@ except NameError: class Command(BaseCommand): option_list = BaseCommand.option_list + ( - make_option('--verbosity', action='store', dest='verbosity', default='0', - type='choice', choices=['0', '1', '2'], - help='Verbosity level; 0=no output, 1=minimal output, 2=all output'), make_option('--fixtures', action='store_true', dest='infixtures', default=False, help='Only look in app.fixtures subdir'), make_option('--noscripts', action='store_true', dest='noscripts', default=False, @@ -88,3 +85,11 @@ class Command(BaseCommand): run_script(script) + +# Backwards compatibility for Django r9110 +if not [opt for opt in Command.option_list if opt.dest=='verbosity']: + Command.option_list += ( + make_option('--verbosity', '-v', action="store", dest="verbosity", + default='1', type='choice', choices=['0', '1', '2'], + help="Verbosity level; 0=minimal output, 1=normal output, 2=all output"), + )
missed verbosity patch for runscript thanks clintecker! fixes ticket #<I>
django-extensions_django-extensions
train
py
cc29518cce7f546ca6d4e129ab05b1485be583a1
diff --git a/lib/plugins/module-paths.js b/lib/plugins/module-paths.js index <HASH>..<HASH> 100644 --- a/lib/plugins/module-paths.js +++ b/lib/plugins/module-paths.js @@ -54,6 +54,14 @@ if (config.debugMode) { addDebugPlugins(paths); } +var nvmBin = env.NVM_BIN; +if (nvmBin && typeof nvmBin === 'string') { + nvmBin = formatPath(path.join(nvmBin, '../lib')); + if (paths.indexOf(nvmBin) == -1) { + paths.push(nvmBin); + } +} + if (appDataDir && paths.indexOf(appDataDir) == -1) { paths.push(appDataDir); }
refactor: load plugins from nvm path
avwo_whistle
train
js
33a849d132f44ae75bfca1d5ea7a6aa1fb810edb
diff --git a/fireplace/__init__.py b/fireplace/__init__.py index <HASH>..<HASH> 100644 --- a/fireplace/__init__.py +++ b/fireplace/__init__.py @@ -1,3 +1,5 @@ +import pkg_resources + __author__ = "Jerome Leclanche" __email__ = "jerome@leclan.ch" -__version__ = "0.1" +__version__ = pkg_resources.require("fireplace")[0].version
Get version from pkg_resources
jleclanche_fireplace
train
py
7b014ca4b2f6944d61f0922308ab93b822d5b2ac
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -61,7 +61,7 @@ module.exports.SRC_USAFE_INLINE = "'unsafe-inline'"; /** Allows unsafe dynamic code evaluation such as JavaScript eval() */ module.exports.SRC_UNSAFE_EVAL = "'unsafe-eval'"; /** Allows loading resources via the data scheme (e.g. Base64 encoded images). */ -module.exports.SRC_DATA = "data"; +module.exports.SRC_DATA = "data:"; /** Wildcard, allows anything. */ module.exports.SRC_ANY = "*"; /** Allows loading resources only over HTTPS on any domain. */
fixed data uri constant A ':' was missing
erdtman_content-security-policy
train
js
a73a2ccd9facb4d719204e18beb9f7ce1a5e8bca
diff --git a/malcolm/modules/scanning/parts/scanrunnerpart.py b/malcolm/modules/scanning/parts/scanrunnerpart.py index <HASH>..<HASH> 100644 --- a/malcolm/modules/scanning/parts/scanrunnerpart.py +++ b/malcolm/modules/scanning/parts/scanrunnerpart.py @@ -209,7 +209,8 @@ class ScanRunnerPart(builtin.parts.ChildPart): entry['generators'] = generators compound_generator = CompoundGenerator.from_dict(entry) if compound_generator.duration <= 0.0: - raise ValueError("Negative generator duration - is it missing from the YAML?") + raise ValueError( + "Negative generator duration - is it missing from the YAML?") return compound_generator def parse_scan(self, entry):
ScanRunnerPart: fixing line lengths
dls-controls_pymalcolm
train
py
6ff1180edc0343053bebcb66e3dc11fc83024f18
diff --git a/lib/relational-util.js b/lib/relational-util.js index <HASH>..<HASH> 100644 --- a/lib/relational-util.js +++ b/lib/relational-util.js @@ -48,7 +48,7 @@ module.exports.makeentp = function (ent) { } else if (_.isArray(ent[field])) { type[field] = ARRAY_TYPE; - entp[field] = JSON.stringify(ent[field]) + entp[field] = ent[field] } else if (_.isObject(ent[field])) { type[field] = OBJECT_TYPE; @@ -95,7 +95,7 @@ module.exports.makeent = function (ent, row) { entp[field] = parseIfJSON(row[field]) } else if (senecatype[field] == ARRAY_TYPE) { - entp[field] = parseIfJSON(row[field]) + entp[field] = row[field] } else if (senecatype[field] == DATE_TYPE) { entp[field] = new Date(row[field]) @@ -122,4 +122,3 @@ module.exports.tablename = function (entity) { return (canon.base ? canon.base + '_' : '') + canon.name } -
PostgreSQL supports arrays, this plugin should not stringily them.
senecajs_seneca-postgres-store
train
js
c1e575ff911c614741cc3b37542ba54f816328e3
diff --git a/lib/devpipeline_core/sanitizer.py b/lib/devpipeline_core/sanitizer.py index <HASH>..<HASH> 100644 --- a/lib/devpipeline_core/sanitizer.py +++ b/lib/devpipeline_core/sanitizer.py @@ -8,19 +8,17 @@ import devpipeline_core.plugin def _sanitize_empty_depends(configuration, error_fn): - for component_name in configuration.components(): - component = configuration.get(component_name) + for name, component in configuration.items(): for dep in component.get_list("depends"): if not dep: - error_fn("Empty dependency in {}".format(component_name)) + error_fn("Empty dependency in {}".format(name)) _IMPLICIT_PATTERN = re.compile(R'\$\{([a-z_\-0-9\.]+):.+\}') def _sanitize_implicit_depends(configuration, error_fn): - for component_name in configuration.components(): - component = configuration.get(component_name) + for name, component in configuration.items(): component_deps = component.get_list("depends") for key in component: val = component.get(key, raw=True) @@ -30,7 +28,7 @@ def _sanitize_implicit_depends(configuration, error_fn): if dep not in component_deps: error_fn( "{}:{} has an implicit dependency on {}".format( - component_name, key, dep)) + name, key, dep)) _SANITIZERS = devpipeline_core.plugin.query_plugins(
Fix #5 - Use dictionary-like interface to access component configurations
dev-pipeline_dev-pipeline-core
train
py
52c3a494d62db7119a5d0cdb46601b73939c81b1
diff --git a/pysat/tests/test_instruments.py b/pysat/tests/test_instruments.py index <HASH>..<HASH> 100644 --- a/pysat/tests/test_instruments.py +++ b/pysat/tests/test_instruments.py @@ -1,11 +1,18 @@ import pytest +# Make sure to import your instrument library here import pysat +# Import the test classes from pysat from pysat.tests.instrument_test_class import generate_instrument_list from pysat.tests.instrument_test_class import InstTestClass +# Developers for instrument libraries should update the following line to +# point to their own library package +# e.g., +# instruments = generate_instrument_list(package=mypackage.instruments) instruments = generate_instrument_list(package=pysat.instruments) +# The following lines apply the custom instrument lists to each type of test method_list = [func for func in dir(InstTestClass) if callable(getattr(InstTestClass, func))] # Search tests for iteration via pytestmark, update instrument list @@ -31,6 +38,10 @@ class TestInstruments(InstTestClass): def setup(self): """Runs before every method to create a clean testing setup.""" + # Developers for instrument libraries should update the following line + # to point to their own library package + # e.g., + # self.package = mypackage.instruments self.package = pysat.instruments def teardown(self):
DOC: update comments in test scripts
rstoneback_pysat
train
py
37a7f37cf829cbe3b272e54291813cd7abd5a646
diff --git a/src/com/google/javascript/jscomp/GlobalTypeInfo.java b/src/com/google/javascript/jscomp/GlobalTypeInfo.java index <HASH>..<HASH> 100644 --- a/src/com/google/javascript/jscomp/GlobalTypeInfo.java +++ b/src/com/google/javascript/jscomp/GlobalTypeInfo.java @@ -117,7 +117,9 @@ class GlobalTypeInfo implements CompilerPass, TypeIRegistry { DiagnosticType.warning( "JSC_NTI_COULD_NOT_INFER_CONST_TYPE", "All constants must be typed. The compiler could not infer the type " - + "of this constant. Please use an explicit type annotation."); + + "of this constant. Please use an explicit type annotation. " + + "For more information, see:\n" + + "https://github.com/google/closure-compiler/wiki/Using-NTI-(new-type-inference)#warnings-about-uninferred-constants"); static final DiagnosticType MISPLACED_CONST_ANNOTATION = DiagnosticType.warning(
[NTI] Link to the explanation of uninferred-const warnings in the error message. ------------- Created by MOE: <URL>
google_closure-compiler
train
java
cb4fe1df7a0ee30d22b4dbb87dfe5182cbdaf649
diff --git a/conway.py b/conway.py index <HASH>..<HASH> 100755 --- a/conway.py +++ b/conway.py @@ -57,7 +57,11 @@ def colored_cells(term): elif num_colors >= 8: funcs = term.on_red, term.on_green, term.on_blue else: - funcs = (term.reverse,) * 3 + # For black and white, use the checkerboard cursor from the vt100 + # alternate charset: + return (term.reverse(' '), + term.smacs + term.reverse('a') + term.rmacs, + term.smacs + 'a' + term.rmacs) # Wrap spaces in whatever pretty colors we chose: return [f(' ') for f in funcs]
Demonstrate the use of the vt<I> alternate charset when in B&W mode.
erikrose_conway
train
py
7d994471718f0b77457de4cfe3aa3e94ea125b55
diff --git a/drools-core/src/main/java/org/drools/rule/builder/dialect/asm/GeneratorHelper.java b/drools-core/src/main/java/org/drools/rule/builder/dialect/asm/GeneratorHelper.java index <HASH>..<HASH> 100644 --- a/drools-core/src/main/java/org/drools/rule/builder/dialect/asm/GeneratorHelper.java +++ b/drools-core/src/main/java/org/drools/rule/builder/dialect/asm/GeneratorHelper.java @@ -112,7 +112,7 @@ public final class GeneratorHelper { return createInvokerClassGenerator(className, stub, classLoader, getTypeResolver(stub, workingMemory, classLoader)); } - static ClassGenerator createInvokerClassGenerator(final String className, + public static ClassGenerator createInvokerClassGenerator(final String className, final InvokerDataProvider data, final CompositeClassLoader classLoader, final TypeResolver typeResolver) {
Resolve split-packages: Make methods/classes public to prevent compile errors
kiegroup_drools
train
java
34cab590f9f18804b101a44c17e05480d90b28c4
diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -195,7 +195,7 @@ class Collection implements ArrayAccess, ArrayableInterface, Countable, Iterator */ public function get($key, $default = null) { - if (array_key_exists($key, $this->items)) + if ($this->offsetExists($key)) { return $this->items[$key]; } @@ -251,7 +251,7 @@ class Collection implements ArrayAccess, ArrayableInterface, Countable, Iterator */ public function has($key) { - return array_key_exists($key, $this->items); + return $this->offsetExists($key); } /**
[<I>] Collection - DDRYs up the code a little more
laravel_framework
train
php
b0454b874eb648a5bb630578170b17a227d91e04
diff --git a/audio/audio.go b/audio/audio.go index <HASH>..<HASH> 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -190,8 +190,8 @@ type Context struct { players *players driver *driver.Player sampleRate int - frames int - writtenBytes int + frames int64 + writtenBytes int64 } var ( @@ -247,7 +247,7 @@ func (c *Context) Update() error { } c.frames++ bytesPerFrame := c.sampleRate * bytesPerSample * channelNum / ebiten.FPS - l := (c.frames * bytesPerFrame) - c.writtenBytes + l := (c.frames * int64(bytesPerFrame)) - c.writtenBytes l &= mask c.writtenBytes += l buf := make([]byte, l) diff --git a/internal/loop/run.go b/internal/loop/run.go index <HASH>..<HASH> 100644 --- a/internal/loop/run.go +++ b/internal/loop/run.go @@ -32,7 +32,7 @@ type runContext struct { fps int currentFPS float64 runningSlowly bool - frames int + frames int64 lastUpdated int64 lastFPSUpdated int64 m sync.RWMutex
Fix frame counters to int<I> (#<I>)
hajimehoshi_ebiten
train
go,go
bb1b5529653aed57e2c39dd8c1f23e3924b5e400
diff --git a/tests/NavigationTest.php b/tests/NavigationTest.php index <HASH>..<HASH> 100644 --- a/tests/NavigationTest.php +++ b/tests/NavigationTest.php @@ -19,6 +19,8 @@ class NavigationTest extends TestCase $collection = (new Collection())->push($menu, 'main'); $this->assertEquals($navigation->getMenu('main'), $menu); + $this->assertEquals($navigation->get('main'), $menu); + $this->assertEquals($navigation->menu('main'), $menu); $this->assertEquals($navigation->getMenus()->values(), $collection->values()); }
Test alias methods in a menu
hnhdigital-os_laravel-navigation-builder
train
php
63551f6477b55df4e2ecfad788f095390bfd567a
diff --git a/src/MigrationTool/SqlMigrationTool.php b/src/MigrationTool/SqlMigrationTool.php index <HASH>..<HASH> 100644 --- a/src/MigrationTool/SqlMigrationTool.php +++ b/src/MigrationTool/SqlMigrationTool.php @@ -47,7 +47,7 @@ abstract class SqlMigrationTool extends AbstractMigrationTool protected function createMigrationTable() { /** @noinspection SqlNoDataSourceInspection,SqlDialectInspection */ - if (false === $this->phpDataObject()->exec("SELECT null FROM {$this->migrationTableName()} LIMIT 1")) { + if (false === $this->phpDataObject()->prepare("SELECT null FROM {$this->migrationTableName()} LIMIT 1")) { /** @noinspection SqlNoDataSourceInspection,SqlDialectInspection */ $result = $this->phpDataObject()->exec( "CREATE TABLE IF NOT EXISTS {$this->migrationTableName()}" .
Fixed general error: <I> Cannot execute queries while other unbuffered queries are active.
petrknap_php-migrationtool
train
php
1f4875837d522afb95ec8a4cf2462b0cd17126f1
diff --git a/lib/scoped_search/rails_helper.rb b/lib/scoped_search/rails_helper.rb index <HASH>..<HASH> 100644 --- a/lib/scoped_search/rails_helper.rb +++ b/lib/scoped_search/rails_helper.rb @@ -219,5 +219,7 @@ module ScopedSearch auto_complete_field_jquery(method, url, completion_options) end + deprecate :auto_complete_field_tag_jquery, :auto_complete_field_tag, :auto_complete_result + end end
depracating javascript in helper method used in pre-assets pipe-line code.
wvanbergen_scoped_search
train
rb
8561bd0f3e6bfd7c8d01bc57cbcc3dca3cf33fc4
diff --git a/exchangelib/items.py b/exchangelib/items.py index <HASH>..<HASH> 100644 --- a/exchangelib/items.py +++ b/exchangelib/items.py @@ -130,7 +130,7 @@ class Item(EWSElement): EffectiveRightsField('effective_rights', field_uri='item:EffectiveRights', is_read_only=True), CharField('last_modified_name', field_uri='item:LastModifiedName', is_read_only=True), DateTimeField('last_modified_time', field_uri='item:LastModifiedTime', is_read_only=True), - BooleanField('is_associated', field_uri='item:IsAssociated', is_read_only=True), + BooleanField('is_associated', field_uri='item:IsAssociated', is_read_only=True, supported_from=EXCHANGE_2010), # These two URIFields throw ErrorInternalServerError # URIField('web_client_read_form_query_string', field_uri='calendar:WebClientReadFormQueryString', # is_read_only=True, supported_from=EXCHANGE_2010),
'is_associated' is not supported on Exchange<I>
ecederstrand_exchangelib
train
py
e43c6b13508a12e4e355a0afaadf08c1668665fe
diff --git a/scripts/performance/perf_processes.py b/scripts/performance/perf_processes.py index <HASH>..<HASH> 100644 --- a/scripts/performance/perf_processes.py +++ b/scripts/performance/perf_processes.py @@ -639,7 +639,6 @@ class LoadClient: except Exception as ex: print("{} run_test error {}".format(self._name, ex)) self._loop.stop() - raise ex self.gen_reqs()
Remove raise ex to be able to exit
hyperledger_indy-node
train
py
128acfbbc3ebd748db6d744c0b2fad543c3cf233
diff --git a/buzz/__init__.py b/buzz/__init__.py index <HASH>..<HASH> 100644 --- a/buzz/__init__.py +++ b/buzz/__init__.py @@ -1,6 +1,7 @@ import contextlib import inspect import os +import sys import textwrap @@ -79,7 +80,7 @@ class Buzz(Exception): final_message = cls.sanitize_errstr(final_message) if on_error is not None: on_error(err, final_message) - raise cls(final_message) + raise cls(final_message).with_traceback(sys.exc_info()[2]) finally: if do_finally is not None: do_finally()
Issue #<I>: Added traceback to handle_errors
dusktreader_py-buzz
train
py
2cdb00981416a5f7ebbf4856bc42a72d90c4726e
diff --git a/lib/survey_gizmo/configuration.rb b/lib/survey_gizmo/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/survey_gizmo/configuration.rb +++ b/lib/survey_gizmo/configuration.rb @@ -65,7 +65,7 @@ module SurveyGizmo tries: 4, on: [ Errno::ETIMEDOUT, - Faraday::Error::ClientError, + Faraday::ClientError, Net::ReadTimeout, SurveyGizmo::BadResponseError, SurveyGizmo::RateLimitExceededError
Fix faraday_middleware deprecation error Turns into an exception at <I>
jarthod_survey-gizmo-ruby
train
rb
f41e9ad45c3bc0ab042e9e1c034e0c65f345f67e
diff --git a/src/Bkwld/Decoy/Input/Files.php b/src/Bkwld/Decoy/Input/Files.php index <HASH>..<HASH> 100644 --- a/src/Bkwld/Decoy/Input/Files.php +++ b/src/Bkwld/Decoy/Input/Files.php @@ -109,7 +109,7 @@ class Files { // If the validation rules include a request to encode a video, add it to the encoding queue if (Str::contains($item::$rules[$field], 'video:encode') && method_exists($item, 'encodeOnSave')) { - $item->encodeOnSave(app('decoy')->convertToArraySyntax($field)); + $item->encodeOnSave($this->column($field)); } }
Storing the model attribtue instead of the input field in the DB I think this is more scalable and more relational
BKWLD_decoy
train
php
3f8fe9acbd10822def9e5dce942d47c7109be971
diff --git a/tasks/github_releaser.js b/tasks/github_releaser.js index <HASH>..<HASH> 100644 --- a/tasks/github_releaser.js +++ b/tasks/github_releaser.js @@ -121,9 +121,10 @@ module.exports = function(grunt) { }); async.map(src, uploadAsset, function(err, result){ - if(err) return showError('Some files are failed to upload'); + if(err) return showError('Some files failed to upload'); - grunt.log.oklns('Uploade complete'); + grunt.log.oklns('Upload complete'); + done(); }); });
fix lack of a `done` function call and some typos
dolbyzerr_grunt-github-releaser
train
js
1adfde4f0d6a8b1499d9f587a437d8539805393e
diff --git a/injector.py b/injector.py index <HASH>..<HASH> 100644 --- a/injector.py +++ b/injector.py @@ -62,12 +62,7 @@ def reraise(original, exception, maximum_frames=1): frames = inspect.getinnerframes(tb) if len(frames) > maximum_frames: exception = original - try: - raise exception.with_traceback(tb) - except AttributeError: - # This syntax is not a valid Python 3 syntax so we have - # to work around that - exec('raise exception.__class__, exception, tb') + raise exception.with_traceback(tb) class Error(Exception):
Remove another Python 2 fallback, not needed anymore
alecthomas_injector
train
py
e1103a0bfe9d1942db89525e3a1e84ef8c330655
diff --git a/packages/components/bolt-image/src/image.js b/packages/components/bolt-image/src/image.js index <HASH>..<HASH> 100644 --- a/packages/components/bolt-image/src/image.js +++ b/packages/components/bolt-image/src/image.js @@ -15,7 +15,7 @@ import { ifDefined } from 'lit-html/directives/if-defined'; import Ajv from 'ajv'; import imageStyles from './image.scss'; -import ratioStyles from '../../bolt-ratio/src/ratio.scss'; +import ratioStyles from '@bolt/components-ratio/src/ratio.scss'; import schema from '../image.schema.yml';
refactor: update path to ratio styles
bolt-design-system_bolt
train
js
0693ce66304d5cda6349b7e338f8166f8259a4e2
diff --git a/flask_cors.py b/flask_cors.py index <HASH>..<HASH> 100644 --- a/flask_cors.py +++ b/flask_cors.py @@ -121,6 +121,8 @@ def cross_origin(*args, **kwargs): resp = make_response(f(*args, **kwargs)) _set_cors_headers(resp, options) + resp._FLASK_CORS_EVALUATED = True # Mark response as evaluated + return resp # If True, intercept OPTIONS requests by modifying the view function @@ -224,6 +226,18 @@ class CORS(object): def _set_cors_headers(resp, options): + ''' + Performs the actual evaluation of Flas-CORS options and actually + modifies the response object. + + This function is used both in the decorator and the after_request + callback + ''' + + # If CORS has already been evaluated via the decorator, skip + if hasattr(resp, '_FLASK_CORS_EVALUATED'): + return resp + request_origin = request.headers.get('Origin', None) wildcard = options.get('origins') == '*' # If the Origin header is not present terminate this set of steps.
Ensures CORS options are not evaluated twice
corydolphin_flask-cors
train
py
866ce8cc440f9fdbbb064f6959b1685ccc3d50f4
diff --git a/pkg/storage/etcd/etcd_helper_test.go b/pkg/storage/etcd/etcd_helper_test.go index <HASH>..<HASH> 100644 --- a/pkg/storage/etcd/etcd_helper_test.go +++ b/pkg/storage/etcd/etcd_helper_test.go @@ -41,8 +41,6 @@ import ( storagetesting "k8s.io/kubernetes/pkg/storage/testing" ) -const validEtcdVersion = "etcd 2.0.9" - func testScheme(t *testing.T) (*runtime.Scheme, runtime.Codec) { scheme := runtime.NewScheme() scheme.Log(t)
delete unused variable in etcd_help_test.go
kubernetes_kubernetes
train
go
b64c9e8f6f2e2d3a2ddd47b6b79f2b7effeda05a
diff --git a/lib/rbarman/backup.rb b/lib/rbarman/backup.rb index <HASH>..<HASH> 100644 --- a/lib/rbarman/backup.rb +++ b/lib/rbarman/backup.rb @@ -237,7 +237,13 @@ module RBarman def missing_wal_files missing = Array.new needed_wal_files.each do |needed| - existing = @wal_files.select { |f| f == needed }.first + existing = nil + @wal_files.each do |f| + if f == needed + existing = f + break + end + end missing << needed unless existing end WalFiles.new(missing) diff --git a/lib/rbarman/version.rb b/lib/rbarman/version.rb index <HASH>..<HASH> 100644 --- a/lib/rbarman/version.rb +++ b/lib/rbarman/version.rb @@ -1,3 +1,3 @@ module RBarman - VERSION = "0.0.10" + VERSION = "0.0.11" end
improve speed by replacing Array#select with iterating over existing wal files and break from loop if needed wal file is found
sauspiel_rbarman
train
rb,rb
35d4bf973298a0b3175fb54376297a65e5a1aca2
diff --git a/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java b/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java index <HASH>..<HASH> 100644 --- a/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java +++ b/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java @@ -79,11 +79,12 @@ public @interface Enhancement { * be used to narrow down the set of <em>expected types</em> to types that use * any bean defining annotation. * <p> - * Defaults to the {@linkplain BeanDefiningAnnotations set of bean defining annotations}. + * Defaults to an empty array, so that the set of <em>expected types</em> is not + * narrowed down in any way. * * @return types of annotations that must be present on the <em>expected types</em> */ - Class<? extends Annotation>[] withAnnotations() default BeanDefiningAnnotations.class; + Class<? extends Annotation>[] withAnnotations() default {}; /** * Marker annotation type that, for the purpose of {@link Enhancement#withAnnotations()},
Change @Enhancement#withAnnotations default value to empty array Previously, the default value of `@Enhancement#withAnnotations` was the `BeanDefiningAnnotations.class` marker type. To align with Portable Extensions, which don't have any annotation restriction by default, this commit changes the default value to an empty array.
cdi-spec_cdi
train
java
8a1e1e4a04a0d814c234938509fb47d0ff2c5771
diff --git a/src/phpFastCache/Core/DriverAbstract.php b/src/phpFastCache/Core/DriverAbstract.php index <HASH>..<HASH> 100644 --- a/src/phpFastCache/Core/DriverAbstract.php +++ b/src/phpFastCache/Core/DriverAbstract.php @@ -33,6 +33,36 @@ abstract class DriverAbstract implements DriverInterface public $instant; /** + * Use for __destruct() + * @var array + */ + public static $memory = array( + + ); + + + /** + * @return array + */ + public static function getMemory() + { + return self::$memory; + } + + /** + * @param array $memory + */ + public static function setMemory($memory) + { + self::$memory = $memory; + } + + public function __destruct() { + $storage = $this->config['storage']; + + } + + /** * @param $keyword * @return string */
Memory Static for __destruct
PHPSocialNetwork_phpfastcache
train
php
e8b7895ca7a4b8e2770717dac3ab126b5812185c
diff --git a/tests/Operation/AggregateFunctionalTest.php b/tests/Operation/AggregateFunctionalTest.php index <HASH>..<HASH> 100644 --- a/tests/Operation/AggregateFunctionalTest.php +++ b/tests/Operation/AggregateFunctionalTest.php @@ -217,7 +217,17 @@ class AggregateFunctionalTest extends FunctionalTestCase $results = iterator_to_array($operation->execute($this->getPrimaryServer())); $this->assertCount(1, $results); - $this->assertObjectHasAttribute('stages', current($results)); + $result = current($results); + + if ($this->isShardedCluster()) { + $this->assertObjectHasAttribute('shards', $result); + + foreach ($result->shards as $shard) { + $this->assertObjectHasAttribute('stages', $shard); + } + } else { + $this->assertObjectHasAttribute('stages', $result); + } }, function(array $event) { $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
Adapt aggregate explain checks to new response format
mongodb_mongo-php-library
train
php
e70839d5da62d7a57fed82cdeec745d3663ed81b
diff --git a/application/modules/g/views/helpers/HtmlLink.php b/application/modules/g/views/helpers/HtmlLink.php index <HASH>..<HASH> 100755 --- a/application/modules/g/views/helpers/HtmlLink.php +++ b/application/modules/g/views/helpers/HtmlLink.php @@ -24,7 +24,7 @@ class G_View_Helper_HtmlLink extends Zend_View_Helper_HtmlElement { $url = call_user_func_array(array($this->view, 'url'), $url); } else { $urlAttribs = parse_url($url); - if (empty($urlAttribs['scheme'])) { + if (empty($urlAttribs['scheme']) && substr($url, 0, 2) !== '//') { $url = $this->view->baseUrl($url); } }
-n Allow // for protocol-agnostic links
grrr-amsterdam_garp3
train
php
c4441a79b432ca5bd86ba9952d4dd496e32bdeab
diff --git a/karma.conf.js b/karma.conf.js index <HASH>..<HASH> 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -21,7 +21,6 @@ module.exports = function(config) { //'bower_components/jquery/dist/jquery.js', 'node_modules/should/should.js', 'test/**/*.js', - 'test/**/*.jsx', ], @@ -34,11 +33,9 @@ module.exports = function(config) { // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { './test/**/*.js': ['webpack'], - './test/**/*.jsx': ['webpack'], }, webpack: { - // cache: true, module: { loaders: [ { loader: 'babel' }, @@ -63,7 +60,6 @@ module.exports = function(config) { // hot: true, quiet: true, noInfo: true, - watchDelay: 300, }, // webpackPort: 8080, // Defaults to config.port + 1
removed warnings in karma warnings
akiran_react-slick
train
js
941308d3704a0b576ea2aa0681cab0939c989637
diff --git a/enrol/manual/enrol.php b/enrol/manual/enrol.php index <HASH>..<HASH> 100644 --- a/enrol/manual/enrol.php +++ b/enrol/manual/enrol.php @@ -353,6 +353,10 @@ function cron() { // Notify teachers/students about students who's enrolment are going to expire global $CFG; + if (empty($CFG->lastexpirynotify)) { + $CFG->lastexpirynotify = 0; + } + if ($CFG->lastexpirynotify < date('Ymd') && ($courses = get_records_select('course', 'enrolperiod > 0 AND expirynotify > 0 AND expirythreshold > 0'))) { $site = get_site(); $admin = get_admin();
Fix for undefined property notice when cron.php is run.
moodle_moodle
train
php
65660a999efdb020bfe00c2a54e9d3cf05a02427
diff --git a/lib/swag_dev/project/sham/tasks/doc/watch.rb b/lib/swag_dev/project/sham/tasks/doc/watch.rb index <HASH>..<HASH> 100644 --- a/lib/swag_dev/project/sham/tasks/doc/watch.rb +++ b/lib/swag_dev/project/sham/tasks/doc/watch.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'swag_dev/project/sham' require 'swag_dev/project/sham/tasks/doc' SwagDev::Project::Sham.define('tasks/doc/watch') do |c| @@ -7,10 +8,10 @@ SwagDev::Project::Sham.define('tasks/doc/watch') do |c| { listen_options: { only: %r{\.rb$}, - ignore: SwagDev.project - .sham!('tasks/doc') - .ignored_patterns - .map { |pattern| %r{#{pattern}} } + ignore: SwagDev::Project::Sham + .sham!('tasks/doc') + .ignored_patterns + .map { |pattern| %r{#{pattern}} } } } end
tasks/doc/watch (sham) minor changes
SwagDevOps_kamaze-project
train
rb
3e88aba57ff35e45d570534c65e7b386ee4627e9
diff --git a/lib/sensu/config.rb b/lib/sensu/config.rb index <HASH>..<HASH> 100644 --- a/lib/sensu/config.rb +++ b/lib/sensu/config.rb @@ -55,8 +55,10 @@ module Sensu end @logger.subscribe(Cabin::Outputs::EmStdlibLogger.new(ruby_logger)) @logger.level = @options[:verbose] ? :debug : :info - Signal.trap('USR1') do - @logger.level = @logger.level == :info ? :debug : :info + if Signal.list.include?('USR1') + Signal.trap('USR1') do + @logger.level = @logger.level == :info ? :debug : :info + end end @logger end
[fix-log-level-toggle] ensure ruby is aware of SIGUSR1, supporting windows ;)
sensu_sensu
train
rb
1da96d0e74b4cd15f9247e403fdbfa88d8c5b31b
diff --git a/lxd/db/operations.go b/lxd/db/operations.go index <HASH>..<HASH> 100644 --- a/lxd/db/operations.go +++ b/lxd/db/operations.go @@ -30,8 +30,8 @@ func (c *ClusterTx) GetLocalOperationsUUIDs() ([]string, error) { return query.SelectStrings(c.tx, stmt, c.nodeID) } -// OperationNodes returns a list of nodes that have running operations -func (c *ClusterTx) OperationNodes(project string) ([]string, error) { +// GetNodesWithRunningOperations returns a list of nodes that have running operations +func (c *ClusterTx) GetNodesWithRunningOperations(project string) ([]string, error) { stmt := ` SELECT DISTINCT nodes.address FROM operations diff --git a/lxd/operations.go b/lxd/operations.go index <HASH>..<HASH> 100644 --- a/lxd/operations.go +++ b/lxd/operations.go @@ -247,7 +247,7 @@ func operationsGet(d *Daemon, r *http.Request) response.Response { err = d.cluster.Transaction(func(tx *db.ClusterTx) error { var err error - nodes, err = tx.OperationNodes(project) + nodes, err = tx.GetNodesWithRunningOperations(project) if err != nil { return err }
lxd/db: Rename OperationNodes to GetNodesWithRunningOperations
lxc_lxd
train
go,go
b5d1f674abf050391529190d3b4b5ced8e5474d8
diff --git a/metrics.go b/metrics.go index <HASH>..<HASH> 100644 --- a/metrics.go +++ b/metrics.go @@ -144,7 +144,7 @@ func (m *metrics) registerInstance() { m.err(err) return } - resp.Body.Close() + defer resp.Body.Close() if resp.StatusCode < http.StatusOK || resp.StatusCode > http.StatusMultipleChoices { m.warn(fmt.Errorf("%s return %d", u.String(), resp.StatusCode)) @@ -173,7 +173,7 @@ func (m *metrics) sendMetrics() { m.err(err) return } - resp.Body.Close() + defer resp.Body.Close() if resp.StatusCode == http.StatusNotFound { m.warn(fmt.Errorf("%s return 404, stopping metrics", u.String()))
metrics: defer closing http response bodies In order to avoid potential surprises if the response bodies are read, defer the closing of the body.
Unleash_unleash-client-go
train
go
6be1eeaa926ad87ebff6c8379fad795eeba64536
diff --git a/test/functional/property-list.test.js b/test/functional/property-list.test.js index <HASH>..<HASH> 100644 --- a/test/functional/property-list.test.js +++ b/test/functional/property-list.test.js @@ -1,5 +1,4 @@ var expect = require('expect.js'), - fixtures = require('../fixtures'), PropertyList = require('../../lib/index.js').PropertyList, Item = require('../../lib/index.js').Item,
Fixed listing issue with PropertyList functional test spec
postmanlabs_postman-collection
train
js
d1641db702da0d487661a1393f6936f35fd824c0
diff --git a/packages/metascraper-audio/index.js b/packages/metascraper-audio/index.js index <HASH>..<HASH> 100644 --- a/packages/metascraper-audio/index.js +++ b/packages/metascraper-audio/index.js @@ -62,6 +62,7 @@ module.exports = () => ({ // Duplicated logic to the rule above //TODO: figure out a way to apply ALL audio rules to an iframe instead of // duplicating the rules in an iframe variant + if ($('iframe').length === 0) return const dom = await loadIframe(url, $.html()) const $2 = cheerio.load(dom.document.body.innerHTML) return $filter($2, $2('a'), el => audio(el.attr('href')))
fix: don't wait when there are no iframes
microlinkhq_metascraper
train
js
045a5d79a69cc2eca491356646fd15b7220a9609
diff --git a/cmd/juju/storage/poollist_test.go b/cmd/juju/storage/poollist_test.go index <HASH>..<HASH> 100644 --- a/cmd/juju/storage/poollist_test.go +++ b/cmd/juju/storage/poollist_test.go @@ -127,6 +127,9 @@ func (s *poolListSuite) assertUnmarshalledOutput(c *gc.C, unmarshall unmarshalle expected := s.expect(c, []string{providerA, providerB}, []string{nameABC, nameXYZ}) + // This comparison cannot rely on gc.DeepEquals as + // json.Unmarshal unmarshalls the number as a float64, + // rather than an int s.assertSamePoolInfos(c, result, expected) } @@ -138,6 +141,8 @@ func (s poolListSuite) assertSamePoolInfos(c *gc.C, one, two map[string]storage. for ka, va := range a { vb, okb := b[ka] c.Assert(okb, jc.IsTrue) + // As some types may have been unmarshalled incorrectly, for example + // int versus float64, compare values' string representations c.Assert(fmt.Sprintf("%v", va), jc.DeepEquals, fmt.Sprintf("%v", vb)) } }
Added comment about the reasons for custom comparison because of the unmarhsalled types confusion.
juju_juju
train
go
17a264a3df6d691a3f9ac77fe0463eb6513e3bf9
diff --git a/decidim-core/app/jobs/decidim/data_portability_export_job.rb b/decidim-core/app/jobs/decidim/data_portability_export_job.rb index <HASH>..<HASH> 100644 --- a/decidim-core/app/jobs/decidim/data_portability_export_job.rb +++ b/decidim-core/app/jobs/decidim/data_portability_export_job.rb @@ -10,7 +10,7 @@ module Decidim password = SecureRandom.urlsafe_base64 generate_zip_file(user, path, password, export_format) - save_or_upload_file(path) + save_or_upload_file(user, path) ExportMailer.data_portability_export(user, filename, password).deliver_later end @@ -22,8 +22,8 @@ module Decidim end # Saves to file system or uploads to storage service depending on the configuration. - def save_or_upload_file(path) - DataPortabilityUploader.new.store!(File.open(path, "rb")) + def save_or_upload_file(user, path) + DataPortabilityUploader.new(user).store!(File.open(path, "rb")) end end end
fixing error caused by Missing Organization (#<I>)
decidim_decidim
train
rb
7fe11973c4be03f83c945dff949875bb6672fc29
diff --git a/wtframework/wtf/_devtools_/filetemplates/_default_yaml_.py b/wtframework/wtf/_devtools_/filetemplates/_default_yaml_.py index <HASH>..<HASH> 100644 --- a/wtframework/wtf/_devtools_/filetemplates/_default_yaml_.py +++ b/wtframework/wtf/_devtools_/filetemplates/_default_yaml_.py @@ -29,8 +29,9 @@ selenium: shutdown_hook: true # Set to true, to reuse the same browser. Set to false, to use a fresh browser - # instance each time. If set to a number, this would determine whether the browser - # session should be discarded after a certain time peroid. + # instance each time. Setting it to false is generally better for more consistent + # results, but will incur the startup time for the browser to start up for each + # test. # Default is 'true' reusebrowser: true
Fix comment describing the reuse browser setting. Issue #<I>
wiredrive_wtframework
train
py
45f1b0dc37c36cb2ac99c03937de692837ea8541
diff --git a/tests/test_regression.py b/tests/test_regression.py index <HASH>..<HASH> 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -17,6 +17,8 @@ and compares the output to the reference. from __future__ import print_function +from nose.tools import assert_equal, assert_raises + import contextlib import difflib import os @@ -147,13 +149,10 @@ def compare(output, reference): out_file = _open_if_needed(output) ref_file = _open_if_needed(reference) with out_file, ref_file: - out_content = out_file.readlines() - ref_content = ref_file.readlines() - diff = list(difflib.context_diff(out_content, ref_content)) - if diff: - #for line in diff: - # print(line, end='') - raise AssertionError('The two files are not identical.') + for out_line, ref_line in zip(out_file, ref_file): + assert_equal(out_line, ref_line) + assert_raises(StopIteration, next, out_file) + assert_raises(StopIteration, next, ref_file) def run_and_compare(arguments, ref_gro, ref_stdout, ref_stderr):
Refactor file comparison in regression tests The new way is faster as it fails at the first different line between the file of interest and the reference. It also allows easier debugging as it now displays the first different line in both files. The tests now rely on nosetests.
Tsjerk_Insane
train
py
c98f3f3df9c47f0019c74cf5b92e41ee734f9810
diff --git a/gtfspy/networks.py b/gtfspy/networks.py index <HASH>..<HASH> 100644 --- a/gtfspy/networks.py +++ b/gtfspy/networks.py @@ -274,7 +274,7 @@ def temporal_network(gtfs, }, inplace=True ) - events_df.drop('seq', 1, inplace=True) + # events_df.drop('seq', 1, inplace=True) return events_df # def cluster_network_stops(stop_to_stop_net, distance):
Add stop sequence number (seq) to temporal network extracts
CxAalto_gtfspy
train
py
ec16252734300eee12e3410edaa5441a68eebeed
diff --git a/notes/delete.php b/notes/delete.php index <HASH>..<HASH> 100644 --- a/notes/delete.php +++ b/notes/delete.php @@ -41,7 +41,7 @@ if (empty($CFG->enablenotes)) { if (data_submitted() && confirm_sesskey()) { //if data was submitted and is valid, then delete note $returnurl = $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&amp;user=' . $note->userid; - if (!note_delete($noteid)) { + if (!note_delete($note)) { print_error('cannotdeletepost', 'notes', $returnurl); } redirect($returnurl);
MDL-<I> notes: passing an object rather than an id to avoid debugging message
moodle_moodle
train
php
43ef114a9baa5004a2647be4e8964d7e06ef2180
diff --git a/script/packagecloud.rb b/script/packagecloud.rb index <HASH>..<HASH> 100644 --- a/script/packagecloud.rb +++ b/script/packagecloud.rb @@ -8,9 +8,13 @@ end require "json" +packagecloud_ruby_minimum_version = "1.0.4" begin + gem "packagecloud-ruby", ">=#{packagecloud_ruby_minimum_version}" require "packagecloud" + puts "Using packagecloud-ruby:#{Gem.loaded_specs["packagecloud-ruby"].version}" rescue LoadError + puts "Requires packagecloud-ruby >=#{packagecloud_ruby_minimum_version}" puts %(gem install packagecloud-ruby) exit 1 end
Enforced a minimum gem version of <I> for packagecloud-ruby (<I> is the current bare minimum). Avoids issues such as encountered in #<I>. Installation of the gem is still typically done outside of the script and with sudo access for centralized installation.
git-lfs_git-lfs
train
rb
108f6312d6d5c7dac88226f4168117d9fa2c1914
diff --git a/src/main/java/com/jnape/palatable/lambda/functions/builtin/fn2/Eq.java b/src/main/java/com/jnape/palatable/lambda/functions/builtin/fn2/Eq.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/jnape/palatable/lambda/functions/builtin/fn2/Eq.java +++ b/src/main/java/com/jnape/palatable/lambda/functions/builtin/fn2/Eq.java @@ -1,7 +1,7 @@ package com.jnape.palatable.lambda.functions.builtin.fn2; -import com.jnape.palatable.lambda.functions.Fn1; import com.jnape.palatable.lambda.functions.specialized.BiPredicate; +import com.jnape.palatable.lambda.functions.specialized.Predicate; /** * Type-safe equality in function form; uses {@link Object#equals}, not <code>==</code>. @@ -22,7 +22,7 @@ public final class Eq<A> implements BiPredicate<A, A> { return new Eq<>(); } - public static <A> Fn1<A, Boolean> eq(A x) { + public static <A> Predicate<A> eq(A x) { return Eq.<A>eq().apply(x); }
Eq partialed static factory should be typed to Predicate
palatable_lambda
train
java
4a93cd44bf16f1d21ee4d678f8a8c897c97dc0b5
diff --git a/LiSE/LiSE/engine.py b/LiSE/LiSE/engine.py index <HASH>..<HASH> 100644 --- a/LiSE/LiSE/engine.py +++ b/LiSE/LiSE/engine.py @@ -176,7 +176,7 @@ class AbstractEngine(object): dict: listify_dict, JSONReWrapper: listify_dict, self.char_cls: lambda obj: ["character", obj.name], - self.thing_cls: lambda obj: ["thing", obj.character.name, obj.name, self.listify(obj.location.name), self.listify(obj.next_location.name), obj['arrival_time'], obj['next_arrival_time']], + self.thing_cls: lambda obj: ["thing", obj.character.name, obj.name, self.listify(obj.location.name), self.listify(obj.next_location.name if obj.next_location else None), obj['arrival_time'], obj['next_arrival_time']], self.place_cls: lambda obj: ["place", obj.character.name, obj.name], self.portal_cls: lambda obj: [ "portal", obj.character.name, obj.orig, obj.dest],
Tolerate null next_location when serializing Thing
LogicalDash_LiSE
train
py
586b23bd4d345bc09a4bb9ada9d9508b92c491a5
diff --git a/spec/unit/lib/mailgun_spec.rb b/spec/unit/lib/mailgun_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/lib/mailgun_spec.rb +++ b/spec/unit/lib/mailgun_spec.rb @@ -1,7 +1,13 @@ require 'spec_helper' -#Check if require 'active_resource' passes -#Check if require 'rest-client' passes +describe "Root library loading" do + before { allow(self).to receive(:require) { true }} + it "shoud be loaded once" do + expect(self).to receive(:require).with('active_resource').once + expect(self).to receive(:require).with('rest-client').once + load "lib/howitzer/utils/email/mailgun.rb" + end +end describe "Check mailgun" do
tests for loaded libraries in mailgun_spec.rb
strongqa_howitzer
train
rb
fb550d5be24812fd7bebe0014e8035c60487665b
diff --git a/test/shared/index.js b/test/shared/index.js index <HASH>..<HASH> 100644 --- a/test/shared/index.js +++ b/test/shared/index.js @@ -44,7 +44,7 @@ exports.test = function(name) { cons[name](path, locals, function(err, html){ if (err) return done(err); html.should.equal('<p>Tobi</p>'); - calls.should.equal(2); + calls.should.equal(name === 'atpl' ? 4 : 2); done(); }); });
something is going on internally with atpl that's different than other template engines so making the test different
jonschlinkert_engines
train
js
9b354fd9aa9c5a15ec9b23c80dad677bb6430820
diff --git a/packages/vuetify/src/components/VTextField/VTextField.js b/packages/vuetify/src/components/VTextField/VTextField.js index <HASH>..<HASH> 100644 --- a/packages/vuetify/src/components/VTextField/VTextField.js +++ b/packages/vuetify/src/components/VTextField/VTextField.js @@ -110,7 +110,7 @@ export default VInput.extend({ return this.lazyValue }, set (val) { - if (this.mask) { + if (this.mask && val !== this.lazyValue) { this.lazyValue = this.unmaskText(this.maskText(this.unmaskText(val))) this.setSelectionRange() } else {
fix(vtextfield): check input change before mask logic (#<I>) In IE <I> input elements with placeholders triggers unnecessary "input" events. It causes bugs when using mask property. This commit checks if there is an actual change in input before calling other methods implementing mask logic. Example: See Fixes #<I>, Fixes #<I>
vuetifyjs_vuetify
train
js
64da603d09687d425576fb95ff5e6c4199a83690
diff --git a/lib/fog/openstack/requests/compute/create_security_group.rb b/lib/fog/openstack/requests/compute/create_security_group.rb index <HASH>..<HASH> 100644 --- a/lib/fog/openstack/requests/compute/create_security_group.rb +++ b/lib/fog/openstack/requests/compute/create_security_group.rb @@ -23,6 +23,7 @@ module Fog class Mock def create_security_group(name, description) + Fog::Identity.new(:provider => 'OpenStack') tenant_id = Fog::Identity::OpenStack::Mock.data[current_tenant][:tenants].keys.first security_group_id = Fog::Mock.random_numbers(2).to_i self.data[:security_groups][security_group_id] = { diff --git a/lib/tasks/test_task.rb b/lib/tasks/test_task.rb index <HASH>..<HASH> 100644 --- a/lib/tasks/test_task.rb +++ b/lib/tasks/test_task.rb @@ -8,7 +8,7 @@ module Fog def initialize desc "Run the mocked tests" task :test do - Rake::Task[:mock_tests].invoke + ::Rake::Task[:mock_tests].invoke end task :mock_tests do
[openstack] Fix Test There seems to be a difference in results coming from these two: export FOG_MOCK=true && bundle exec shindont +openstack FOG_MOCK=true shindo tests/openstack/requests/compute/security_group_tests.rb
fog_fog
train
rb,rb
e229506dab25fc8cbbead0491ee400b7b7cf5e35
diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php index <HASH>..<HASH> 100755 --- a/grade/edit/tree/lib.php +++ b/grade/edit/tree/lib.php @@ -377,6 +377,8 @@ class grade_edit_tree { } } + //Trim's trailing zeros. Used on the 'categories and items' page for grade items settings like aggregation co-efficient + //Grader report has its own decimal place settings so they are handled elsewhere function format_number($number) { return rtrim(rtrim(format_float($number, 4),'0'),'.'); }
gradebook MDL-<I> added a comment above a function to make its purpose more clear
moodle_moodle
train
php
fb1f1d45af945fe8e1ef1884d2118565e8386217
diff --git a/src/main/java/spark/webserver/MatcherFilter.java b/src/main/java/spark/webserver/MatcherFilter.java index <HASH>..<HASH> 100755 --- a/src/main/java/spark/webserver/MatcherFilter.java +++ b/src/main/java/spark/webserver/MatcherFilter.java @@ -17,6 +17,7 @@ package spark.webserver; import java.io.IOException; +import java.util.Collections; import java.util.List; import java.util.zip.GZIPOutputStream; @@ -239,8 +240,10 @@ public class MatcherFilter implements Filter { if (httpResponse.getContentType() == null) { httpResponse.setContentType("text/html; charset=utf-8"); } + boolean acceptsGzip = Collections.list(httpRequest.getHeaders("Accept-Encoding")).stream().anyMatch(s -> s.contains("gzip")); + //gzip compression support - if(httpResponse.getHeaders("Content-Encoding").contains("gzip")) + if(acceptsGzip && httpResponse.getHeaders("Content-Encoding").contains("gzip")) { try(GZIPOutputStream gzipOut = new GZIPOutputStream(httpResponse.getOutputStream())) {
Re-add check that client supports gzip I forgot to re-add the check to make sure the client supports gzip compression
perwendel_spark
train
java
8180711a33eacb9bdce0be407102635a170028a4
diff --git a/tests/test_buku.py b/tests/test_buku.py index <HASH>..<HASH> 100644 --- a/tests/test_buku.py +++ b/tests/test_buku.py @@ -553,6 +553,16 @@ def test_sigint_handler(capsys): ['http://example.com/page1.txt', (('', 1, 0))], ['about:new_page', (('', 0, 1))], ['chrome://version/', (('', 0, 1))], + ['chrome://version/', (('', 0, 1))], + ['http://4pda.ru/forum/index.php?showtopic=182463&st=1640#entry6044923', None], + [ + 'https://www.google.ru/search?' + 'newwindow=1&safe=off&q=xkbcomp+alt+gr&' + 'oq=xkbcomp+alt+gr&' + 'gs_l=serp.3..33i21.28976559.28977886.0.' + '28978017.6.6.0.0.0.0.167.668.0j5.5.0....0...1c.1.64.' + 'serp..1.2.311.06cSKPTLo18', None + ], ] ) def test_network_handler_with_url(url, exp_res):
chg: test: add url for test title fetch
jarun_Buku
train
py
c025ce294ba1baf194fba17ff4f0d25ef9ce3229
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,14 @@ import os import subprocess import stat import glob +try: + # setuptools (which is needed by py2app) monkey-patches the + # distutils.core.Command class. + # So we need to import it before importing the distutils core + import setuptools +except ImportError: + # ignore when setuptools is not installed + pass from distutils.core import setup, Extension from distutils.command.install_lib import install_lib from distutils.command.build_ext import build_ext @@ -45,7 +53,7 @@ from distutils.dir_util import remove_tree, copy_tree from distutils.file_util import write_file from distutils import util, log try: - # Note that py2exe monkey-patches the distutils.core.Distribution class + # py2exe monkey-patches the distutils.core.Distribution class # So we need to import it before importing the Distribution class import py2exe except ImportError:
Import setuptools for its monkey-patching.
wummel_linkchecker
train
py
7b03b76f3701584ece9e41875acd719a1a251907
diff --git a/lib/bel/language.rb b/lib/bel/language.rb index <HASH>..<HASH> 100644 --- a/lib/bel/language.rb +++ b/lib/bel/language.rb @@ -113,6 +113,14 @@ module BEL end alias_method :eql?, :'==' + + def to_sym + @short_form + end + + def to_s + @long_form.to_s + end end class Term
added to_s / to_sym to Function
OpenBEL_bel.rb
train
rb
23d65d31f2f877c5fb8ef1ef87f7bb55086a13a1
diff --git a/cursor.js b/cursor.js index <HASH>..<HASH> 100644 --- a/cursor.js +++ b/cursor.js @@ -539,6 +539,10 @@ var nextFunction = function(self, callback) { // Topology is not connected, save the call in the provided store to be // Executed at some point when the handler deems it's reconnected if(!self.topology.isConnected(self.options) && self.disconnectHandler != null) { + if (self.topology.isDestroyed()) { + // Topology was destroyed, so don't try to wait for it to reconnect + return callback(new MongoError('Topology was destroyed')); + } return self.disconnectHandler.addObjectAndMethod('cursor', self, 'next', [callback], callback); }
fix: fire callback when topology was destroyed
mongodb_node-mongodb-native
train
js
e22d94cc3d4180ef0ff811e4c52b355fe4b0daf7
diff --git a/lib/installer.js b/lib/installer.js index <HASH>..<HASH> 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -198,6 +198,7 @@ exports.promptAdminUser = function (callback) { var result = {}; result.name = 'admin'; result.password = 'travis-ci'; + console.log(result); return callback(null, result); } else { prompt.get({
add debugging This commit was sponsored by The Hoodie Firm with support from NLnet: <URL>
hoodiehq_hoodie-server
train
js
ff0b7b218e53d0b6028c84978dad5be60d2da195
diff --git a/lib/agent/providers/network/index.js b/lib/agent/providers/network/index.js index <HASH>..<HASH> 100644 --- a/lib/agent/providers/network/index.js +++ b/lib/agent/providers/network/index.js @@ -161,7 +161,17 @@ exp.get_access_points_list = function(callback){ if (err || !nic_name) return callback(new Error(err || 'No wireless adapter found.')); - os_functions.access_points_list(nic_name, callback); + os_functions.access_points_list(nic_name, function(err, list){ + if (err || !list) + return callback(err || new Error('No access points found.')) + + // sort them from the nearest to the farthest + list.sort(function(a, b){ + return a.signal_strength > b.signal_strength; + }); + + return callback(null, list); + }); }); }; @@ -214,11 +224,6 @@ exp.get_open_access_points_list = function(callback){ if (open_aps.length === 0) return callback(null, []); - // sort them from the nearest to the farthest - open_aps.sort(function(a, b){ - return a.signal_strength > b.signal_strength; - }); - callback(null, open_aps); });
Network get_access_points_list: sort APs by proximity.
prey_prey-node-client
train
js
89584a7d9b86b5735e4ba363b55d51bd9f552408
diff --git a/lib/adapters/http/http.js b/lib/adapters/http/http.js index <HASH>..<HASH> 100644 --- a/lib/adapters/http/http.js +++ b/lib/adapters/http/http.js @@ -623,9 +623,6 @@ function HttpPouch(opts, callback) { var body; var method = 'GET'; - // TODO I don't see conflicts as a valid parameter for a - // _all_docs request - // (see http://wiki.apache.org/couchdb/HTTP_Document_API#all_docs) if (opts.conflicts) { params.push('conflicts=true'); }
(#<I>) - Remove outdated comment
pouchdb_pouchdb
train
js
dff1c4b50ebb563e15a9b910900ebdda4aa6ff83
diff --git a/lib/evalhook/tree_processor.rb b/lib/evalhook/tree_processor.rb index <HASH>..<HASH> 100644 --- a/lib/evalhook/tree_processor.rb +++ b/lib/evalhook/tree_processor.rb @@ -195,6 +195,24 @@ module EvalHook s(tree[0],tree[1],tree[2],process(tree[3])) end + def process_super(tree) + + receiver = s(:self) + + args1 = s(:arglist, s(:lit, @last_method_name), s(:call, nil, :binding, s(:arglist))) + args2 = s(:arglist, hook_handler_reference) + + firstcall = s(:call, receiver, :local_hooked_method, args1) + secondcall = s(:call, firstcall, :set_hook_handler, args2) + + superclass_call_tree = s(:call, s(:call, s(:self), :class, s(:arglist)), :superclass, s(:arglist)) + thirdcall = s(:call,secondcall,:set_class,s(:arglist, superclass_call_tree)) + + # pass the args passed to super + s(:call, thirdcall, :call, s(:arglist, *tree[1..-1])) + + end + def process_zsuper(tree) receiver = s(:self)
<I> test pass: implemented processing of node of type super
tario_evalhook
train
rb
bad4c2103d4cd56bb3ef57c76fc58e1360762389
diff --git a/plugins/provisioners/docker/installer.rb b/plugins/provisioners/docker/installer.rb index <HASH>..<HASH> 100644 --- a/plugins/provisioners/docker/installer.rb +++ b/plugins/provisioners/docker/installer.rb @@ -14,13 +14,13 @@ module VagrantPlugins return end - @machine.ui.detail(I18n.t("vagrant.docker_installing")) - @machine.guest.capability(:docker_install) + if !@machine.guest.capability(:docker_installed) + @machine.ui.detail(I18n.t("vagrant.docker_installing")) + @machine.guest.capability(:docker_install) + end if !@machine.guest.capability(:docker_installed) - if !@machine.guest.capability(:docker_installed) - raise DockerError, :install_failed - end + raise DockerError, :install_failed end if @machine.guest.capability?(:docker_configure_vagrant_user)
Only install Docker if it is not already installed
hashicorp_vagrant
train
rb
9bc21ea775745c81799d0305de23693eed990498
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -5,10 +5,10 @@ import gulpCssScss from './' test('converts CSS to Scss', t => { t.plan(2) - var cssScssStream = gulpCssScss(); + const cssScssStream = gulpCssScss(); - var actual = ':root {\n --blue: blue;\n}\n\n.some-class {\n color: var(--blue);\n}\n\n'; - var expected = '\n// Converted Variables\n\n$blue: blue !default;\n\n// Custom Media Query Variables\n\n\n.some-class {\n color: $blue;\n}\n\n'; + const actual = ':root {\n --blue: blue;\n}\n\n.some-class {\n color: var(--blue);\n}\n\n'; + const expected = '\n// Converted Variables\n\n$blue: blue !default;\n\n// Custom Media Query Variables\n\n\n.some-class {\n color: $blue;\n}\n\n'; cssScssStream.once('data', file => { t.same(file.relative, 'default.scss');
Use const in place of var
johno_gulp-css-scss
train
js
190dc5d4905cdc7fd91a098570e84b56e7034e13
diff --git a/pmagpy/pmag.py b/pmagpy/pmag.py index <HASH>..<HASH> 100755 --- a/pmagpy/pmag.py +++ b/pmagpy/pmag.py @@ -2482,7 +2482,7 @@ def dodirot_V(di_block, Dbar, Ibar): di_block = di_block.transpose() data = np.array([di_block[0], di_block[1], DipDir, Dip]).transpose() drot, irot = dotilt_V(data) - drot = (drot-180.) % 360. # + #drot = (drot-180.) % 360. # return np.column_stack((drot, irot))
modified: pmagpy/pmag.py
PmagPy_PmagPy
train
py
36ec4fad2a8f61ca19e2aac38942c175cea4a9c3
diff --git a/smart_open/tests/test_smart_open.py b/smart_open/tests/test_smart_open.py index <HASH>..<HASH> 100644 --- a/smart_open/tests/test_smart_open.py +++ b/smart_open/tests/test_smart_open.py @@ -102,7 +102,7 @@ class SmartOpenReadTest(unittest.TestCase): smart_open_object = smart_open.HdfsOpenRead(smart_open.ParseUri("hdfs:///tmp/test.txt")) smart_open_object.__iter__() # called with the correct params? - mock_subprocess.Popen.assert_called_with(["hadoop", "fs", "-cat", "/tmp/test.txt"], stdout=mock_subprocess.PIPE) + mock_subprocess.Popen.assert_called_with(["hdfs", "dfs", "-cat", "/tmp/test.txt"], stdout=mock_subprocess.PIPE) @mock.patch('smart_open.smart_open_lib.boto')
modified "hdfs" test
RaRe-Technologies_smart_open
train
py
d083e4db37cd9c1a039ee9b43745612230a1e788
diff --git a/lib/swag_dev/project/tools/git/hooks/base_hook.rb b/lib/swag_dev/project/tools/git/hooks/base_hook.rb index <HASH>..<HASH> 100644 --- a/lib/swag_dev/project/tools/git/hooks/base_hook.rb +++ b/lib/swag_dev/project/tools/git/hooks/base_hook.rb @@ -1,12 +1,18 @@ # frozen_string_literal: true require_relative '../hooks' +require_relative '../../../concern/cli/with_exit_on_failure' + +# rubocop:disable Style/Documentation class SwagDev::Project::Tools::Git::Hooks class BaseHook + include SwagDev::Project::Concern::Cli::WithExitOnFailure end end +# rubocop:enable Style/Documentation + # Base Hook class SwagDev::Project::Tools::Git::Hooks::BaseHook # @param [SwagDev::Project::Tools::Git] repository
git/hooks/base_hook (tools) with_exit_on_failure included
SwagDevOps_kamaze-project
train
rb
84f2965621942195fa6298e3ac442a2b0e5e80eb
diff --git a/src/extensions/renderer/canvas/index.js b/src/extensions/renderer/canvas/index.js index <HASH>..<HASH> 100644 --- a/src/extensions/renderer/canvas/index.js +++ b/src/extensions/renderer/canvas/index.js @@ -94,6 +94,25 @@ function CanvasRenderer( options ){ // then keep cached ele texture } else { r.data.eleTxrCache.invalidateElement( ele ); + + // NB this block of code should not be ported to 3.3 (unstable branch). + // - This check is unneccesary in 3.3 as caches will be stored without respect to opacity. + // - This fix may result in lowered performance for compound graphs. + // - Ref : Opacity of child node is not updated for certain zoom levels after parent opacity is overriden #2078 + if( ele.isParent() && de['style'] ){ + var op1 = rs.prevParentOpacity; + var op2 = ele.pstyle('opacity').pfValue; + + rs.prevParentOpacity = op2; + + if( op1 !== op2 ){ + var descs = ele.descendants(); + + for( var j = 0; j < descs.length; j++ ){ + r.data.eleTxrCache.invalidateElement( descs[j] ); + } + } + } } }
For each 'style' dirty event, w.r.t. the element texture cache, manually diff the parent opacity. Invalidate the descendants when the diff is non-empty. Ref : Opacity of child node is not updated for certain zoom levels after parent opacity is overriden #<I>
cytoscape_cytoscape.js
train
js
748e27f6657340de7f7ab7fde1b57aabe5d9ff5f
diff --git a/tests/integration/components/sl-modal-test.js b/tests/integration/components/sl-modal-test.js index <HASH>..<HASH> 100755 --- a/tests/integration/components/sl-modal-test.js +++ b/tests/integration/components/sl-modal-test.js @@ -35,25 +35,6 @@ const template = hbs` `; moduleForComponent( 'sl-modal', 'Integration | Component | sl modal', { - - beforeEach() { - this.hideModal = true; - }, - - /** - * Hide modal after each test, - * this will prevent the bootstrap overlay from sticking around. - * The hideModal property can be overridden in a test. - **/ - afterEach() { - if ( this.hideModal ) { - if ( this.$( '>:first-child' ) ) { - this.$( '>:first-child' ).modal( 'hide' ); - Ember.$( '>:first-child' ).find( '.modal-backdrop' ).remove(); - } - } - }, - integration: true });
between test clean up code no longer needed, each test should be clean
softlayer_sl-ember-components
train
js
e9a3e0a2af409cae3d894b14136c26f075e53131
diff --git a/concrete/src/Updater/Migrations/Migrations/Version20180119000000.php b/concrete/src/Updater/Migrations/Migrations/Version20180119000000.php index <HASH>..<HASH> 100644 --- a/concrete/src/Updater/Migrations/Migrations/Version20180119000000.php +++ b/concrete/src/Updater/Migrations/Migrations/Version20180119000000.php @@ -3,6 +3,9 @@ namespace Concrete\Core\Updater\Migrations\Migrations; use Concrete\Core\Entity\Calendar\CalendarEventVersion; +use Concrete\Core\Entity\Express\Entity as ExpressEntity; +use Concrete\Core\Entity\Express\Form as ExpressForm; +use Concrete\Core\Entity\Package; use Concrete\Core\Updater\Migrations\AbstractMigration; use Concrete\Core\Updater\Migrations\DirectSchemaUpgraderInterface; @@ -17,6 +20,9 @@ class Version20180119000000 extends AbstractMigration implements DirectSchemaUpg { $this->refreshEntities([ CalendarEventVersion::class, + ExpressEntity::class, + ExpressForm::class, + Package::class, ]); $this->refreshDatabaseTables([ 'Workflows',
Be sure that foreign keys in ExpressEntities table exist
concrete5_concrete5
train
php
c14c63d63c936f3879573b4c3a4cdf8160ee5484
diff --git a/values_test.go b/values_test.go index <HASH>..<HASH> 100644 --- a/values_test.go +++ b/values_test.go @@ -1095,11 +1095,11 @@ func TestRowDecode(t *testing.T) { expected []interface{} }{ { - "select row(1, 'cat', '2015-01-01 08:12:42'::timestamptz)", + "select row(1, 'cat', '2015-01-01 08:12:42-00'::timestamptz)", []interface{}{ int32(1), "cat", - time.Date(2015, 1, 1, 8, 12, 42, 0, time.Local), + time.Date(2015, 1, 1, 8, 12, 42, 0, time.UTC).Local(), }, }, }
Fix test failure when DB and client are not in the same time zone Explicitly set the time zone to UTC in the database and in the test expectation. Then compare the two times in the client-local time zone.
jackc_pgx
train
go
4a590e8c39e0d3890ddf0847e58a8cf45e35b12e
diff --git a/packages/wpcom.js/lib/post.js b/packages/wpcom.js/lib/post.js index <HASH>..<HASH> 100644 --- a/packages/wpcom.js/lib/post.js +++ b/packages/wpcom.js/lib/post.js @@ -39,7 +39,7 @@ Post.prototype.get = function(id, params, fn){ * @api public */ -Post.prototype.getBySlug = function(slug, params, fn){ +Post.prototype.getbyslug = function(slug, params, fn){ var set = { site: this.wpcom.site._id, post_slug: slug }; this.wpcom.req.send('post.get_by_slug', set, params, fn); };
post: no more camelCase in method
Automattic_wp-calypso
train
js
c290d939e4c086fb765341e482388f774328afad
diff --git a/src/strategy.js b/src/strategy.js index <HASH>..<HASH> 100644 --- a/src/strategy.js +++ b/src/strategy.js @@ -26,6 +26,7 @@ var lookup = require('./utils').lookup; * - `usernameProp` property name/path where the username is found, defaults to `'username'` * - `passwordProp` property name/path where the password is found, defaults to `'password'` * - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`) + * - `allowEmptyPasswords` when `true`, it will allow the password to be an empty string (default: `false`) * * Examples: *
Add a comment in the code about the `allowEmptyPasswords` option
JamesMGreene_passport-json
train
js
8cb74c682f24f9f008555cbc9e1311823301bc08
diff --git a/src/Commands/InstallerCommand.php b/src/Commands/InstallerCommand.php index <HASH>..<HASH> 100644 --- a/src/Commands/InstallerCommand.php +++ b/src/Commands/InstallerCommand.php @@ -308,6 +308,9 @@ STEP $this->info('Starting publishing vendor assets.'); $this->call('vendor:publish'); $this->info('Publishing vendor assets finished.'); + + // Reload config + $this->laravel['Illuminate\Foundation\Bootstrap\LoadConfiguration']->bootstrap($this->laravel); } /**
Added config refresh after publishing, so errors are avoided during installation using CLI commands.
laraflock_dashboard
train
php