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
7ee9ec8738dfb7e0c76b8c077abfc24bff910331
diff --git a/src/PostgresqlArrayFieldBehavior.php b/src/PostgresqlArrayFieldBehavior.php index <HASH>..<HASH> 100644 --- a/src/PostgresqlArrayFieldBehavior.php +++ b/src/PostgresqlArrayFieldBehavior.php @@ -52,7 +52,9 @@ class PostgresqlArrayFieldBehavior extends Behavior public function events() { return [ + ActiveRecord::EVENT_INIT => '_loadArray', ActiveRecord::EVENT_AFTER_FIND => '_loadArray', + ActiveRecord::EVENT_BEFORE_INSERT => '_saveArray', ActiveRecord::EVENT_BEFORE_UPDATE => '_saveArray' ]; }
Behavior must be also attached to EVENT_INIT and EVENT_BEFORE_INSERT events
kossmoss_yii2-postgresql-array-field
train
php
b385b8ba9d30b1ed3f40530558dda8e974be5da5
diff --git a/core/wisdom-api/src/main/java/org/wisdom/api/http/RenderableException.java b/core/wisdom-api/src/main/java/org/wisdom/api/http/RenderableException.java index <HASH>..<HASH> 100644 --- a/core/wisdom-api/src/main/java/org/wisdom/api/http/RenderableException.java +++ b/core/wisdom-api/src/main/java/org/wisdom/api/http/RenderableException.java @@ -29,6 +29,6 @@ public class RenderableException extends Exception { } public RenderableException(String message, Exception cause) { - super(cause); + super(message, cause); } }
Small fix in RenderableException (message not passed to parent exception)
wisdom-framework_wisdom
train
java
3656f06e35dac681b736644692bc04534a5dd932
diff --git a/fabfile.py b/fabfile.py index <HASH>..<HASH> 100644 --- a/fabfile.py +++ b/fabfile.py @@ -122,7 +122,7 @@ def clean(): def test(): with virtualenv(VENV_DIR): with lcd(path.dirname(__file__)): - local('py.test -x --models spacy/tests') + local('py.test -x spacy/tests') def train(json_dir=None, dev_loc=None, model_dir=None):
* Don't use models in fab test
explosion_spaCy
train
py
dbec1576ee0ba33670d3181286bebb6a6bf32c60
diff --git a/src/RecordsTransformer.php b/src/RecordsTransformer.php index <HASH>..<HASH> 100644 --- a/src/RecordsTransformer.php +++ b/src/RecordsTransformer.php @@ -132,14 +132,17 @@ class RecordsTransformer /** * Decides whether provided column value is a carbon date instance. * - * @param mmixed Column value + * @param mixed Column value * * @return bool */ protected function isCarbonInstance($columnValue) { return is_object($columnValue) && - $columnValue instanceof \Illuminate\Support\Carbon + ( + $columnValue instanceof \Carbon\Carbon || + $columnValue instanceof \Illuminate\Support\Carbon + ) ; }
Additional check for Carbon\Carbon instance in RecordsTransformer
freshbitsweb_laratables
train
php
746e616ea586ed4622cd14eea34134554f40cd72
diff --git a/lib/vestal_versions.rb b/lib/vestal_versions.rb index <HASH>..<HASH> 100644 --- a/lib/vestal_versions.rb +++ b/lib/vestal_versions.rb @@ -75,6 +75,8 @@ module VestalVersions # itself. If an array is given and any element evaluates as +true+, the version creation will # be skipped. def versioned(options = {}, &block) + return if versioned? + include Options include Changes include Creation diff --git a/lib/vestal_versions/versioned.rb b/lib/vestal_versions/versioned.rb index <HASH>..<HASH> 100644 --- a/lib/vestal_versions/versioned.rb +++ b/lib/vestal_versions/versioned.rb @@ -12,13 +12,13 @@ module VestalVersions # Overrides the +versioned+ method to first define the +versioned?+ class method before # deferring to the original +versioned+. def versioned_with_flag(*args) + versioned_without_flag(*args) + class << self def versioned? true end end - - versioned_without_flag(*args) end # For all ActiveRecord::Base models that do not call the +versioned+ method, the +versioned?+
Protected against the versioned method being called twice on a model.
laserlemon_vestal_versions
train
rb,rb
a87b62edfb3d19d77f2d561fe0f44e505921e647
diff --git a/can/constructor-hydrate/constructor-hydrate.js b/can/constructor-hydrate/constructor-hydrate.js index <HASH>..<HASH> 100644 --- a/can/constructor-hydrate/constructor-hydrate.js +++ b/can/constructor-hydrate/constructor-hydrate.js @@ -95,6 +95,6 @@ var constructorHydrateBehavior = connect.behavior("can-connect/can/construct-hyd module.exports = validate(constructorHydrateBehavior, [ //!steal-remove-start - 'Map', 'instanceStore', 'hydrateInstance' + 'Map', 'List', 'instanceStore', 'hydrateInstance' //!steal-remove-end ]); \ No newline at end of file
Add missing 'List' prop expected by constructor-hydrate
canjs_can-connect
train
js
0a648caabf90e6b155711b835ecb3c95c6976ea3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import os from setuptools import setup, find_packages -version = '1.0.0a5' +version = '1.0.0' def read_file(name): return open(os.path.join(os.path.dirname(__file__),
bumped version to a stable number (<I>) because (as of buildout version <I>) only final releases of buildout itself and extensions are installed.
stefanfoulis_djangoprojectrecipe
train
py
8afeba412df31a3b280e63efb170b338872d6727
diff --git a/bot.py b/bot.py index <HASH>..<HASH> 100755 --- a/bot.py +++ b/bot.py @@ -136,8 +136,8 @@ class IrcBot(SingleServerIRCBot): logging.info("Connected to server %s" % self.config['core']['host']) self.handler.connection = c self.handler.channels = self.channels - self.handler.get_admins(c) self.handler.workers = workers.Workers(self.handler) + self.handler.get_admins(c) c.join(self.config['core']['channel']) c.join(self.config['core']['ctrlchan'], self.config['auth']['ctrlkey']) extrachans = self.config['core']['extrachans'] diff --git a/handler.py b/handler.py index <HASH>..<HASH> 100644 --- a/handler.py +++ b/handler.py @@ -127,8 +127,10 @@ class BotHandler(): def get_admins(self, c): """Check verification for all admins.""" + i = 0 for a in self.admins: - c.send_raw('NS ACC %s' % a) + self.workers.defer(i, c.send_raw, 'NS ACC %s' % a) + i += 1 def abusecheck(self, send, nick, target, limit, cmd): """ Rate-limits commands.
don't flood nickserv -- fix #<I>
tjcsl_cslbot
train
py,py
5793ba1b13cff6ceff91a40f16eff6e3f3a2b4a0
diff --git a/src/Mongolina/MongoEventStore.php b/src/Mongolina/MongoEventStore.php index <HASH>..<HASH> 100644 --- a/src/Mongolina/MongoEventStore.php +++ b/src/Mongolina/MongoEventStore.php @@ -201,5 +201,28 @@ class MongoEventStore implements EventStore $document[MongoEventStore::EVENTS][$index] = $updater($eventSubDocument); break; } + $this->collection->replaceOne(['events.id' => $eventId], $document); + } + + public function deleteEvent($eventId) + { + $document = $this->collection->findOne(['events.id' => $eventId]); + if (!$document) { + return; + } + if(count($document[MongoEventStore::EVENTS]) === 1){ + $this->collection->deleteOne(['events.id' => $eventId]); + } + else{ + foreach ($document[MongoEventStore::EVENTS] as $index => $eventSubDocument) { + if ($eventSubDocument['id'] !== $eventId) { + continue; + } + unset($document[MongoEventStore::EVENTS][$index]); + break; + } + $document[MongoEventStore::EVENTS] = array_values($document[MongoEventStore::EVENTS]); + $this->collection->replaceOne(['events.id' => $eventId], $document); + } } } \ No newline at end of file
added \Mongolina\MongoEventStore::deleteEvent
xprt64_mongolina
train
php
a5d9fbe2b0d14a84325e87629a785eda72f7d9f4
diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index <HASH>..<HASH> 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -113,7 +113,7 @@ class TestDeprecatedCall(object): pass msg = 'Did not produce DeprecationWarning or PendingDeprecationWarning' - with pytest.raises(AssertionError, matches=msg): + with pytest.raises(AssertionError, match=msg): if mode == 'call': pytest.deprecated_call(f) else:
Change pytest.raises to use match instead of matches
pytest-dev_pytest
train
py
6cec024f73fa68cf2af4ba0d71671a58df1f6d2a
diff --git a/betfairlightweight/__init__.py b/betfairlightweight/__init__.py index <HASH>..<HASH> 100644 --- a/betfairlightweight/__init__.py +++ b/betfairlightweight/__init__.py @@ -6,7 +6,7 @@ from .streaming import StreamListener from . import filters __title__ = 'betfairlightweight' -__version__ = '1.6.2' +__version__ = '1.6.3' __author__ = 'Liam Pauling' # Set default logging handler to avoid "No handler found" warnings. diff --git a/requirements.txt b/requirements.txt index <HASH>..<HASH> 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +setuptools==39.2.0 requests==2.18.4 enum34 ; python_version < '3.4' ciso8601==2.0.0 diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ from setuptools import setup INSTALL_REQUIRES = [ + 'setuptools==39.2.0', 'requests==2.18.4', 'ciso8601==2.0.0', 'ujson==1.35',
version bump appveyor py<I> setuptools bug with ciso fix (attempt 1)
liampauling_betfair
train
py,txt,py
713bb72b16d781173e1ebf27b6dcf6ccf13fd4b3
diff --git a/src/Factory.php b/src/Factory.php index <HASH>..<HASH> 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -203,6 +203,28 @@ class Factory } /** + * Returns the group name for this factory defintion + * + * @param string $model + * @return string + */ + private function getGroup($model) + { + return current(explode(':', $model)); + } + + /** + * Returns the model without the group prefix + * + * @param string $model + * @return string + */ + private function getModelWithoutGroup($model) + { + return str_replace($this->getGroup($model) . ':', null, $model); + } + + /** * Save our object to the db, and keep track of it. * * @param object $object The model instance.
Helper methods for getting group and model without group
thephpleague_factory-muffin
train
php
f35d5252bdde8a43fe3c41f3989d21bb8e566b00
diff --git a/src/Validation/Provider.php b/src/Validation/Provider.php index <HASH>..<HASH> 100644 --- a/src/Validation/Provider.php +++ b/src/Validation/Provider.php @@ -25,9 +25,14 @@ use Fuel\Validation\RuleProvider\FromArray; class Provider extends FromArray { - public function __construct() + public function __construct($labelKey = null, $ruleKey = 'rules') { - parent::__construct(true); + if ($labelKey === null) + { + $labelKey = true; + } + + parent::__construct($labelKey, $ruleKey); } /**
Fixes a mistake in not allowing custom keys.
fuelphp_fieldset
train
php
144940290c666b99f1f31985932e06a156f6a557
diff --git a/lib/__init__.py b/lib/__init__.py index <HASH>..<HASH> 100644 --- a/lib/__init__.py +++ b/lib/__init__.py @@ -64,7 +64,7 @@ try: except: __svn_version__ = 'Unable to determine SVN revision' -__version__ = '4.0.6dev11337' +__version__ = '4.0.6dev11411' # End Version Information --------------------------------------------- # Pointer to the included Python class for WCS-based coordinate transformations diff --git a/lib/wcs_functions.py b/lib/wcs_functions.py index <HASH>..<HASH> 100644 --- a/lib/wcs_functions.py +++ b/lib/wcs_functions.py @@ -481,6 +481,7 @@ def createWCSObject(output,default_wcs,imageObjectList): outwcs.default_wcs = default_wcs outwcs.wcs = default_wcs.copy() outwcs.final_wcs = default_wcs.copy() + outwcs.single_wcs = default_wcs.copy() outwcs.updateContextImage(imageObjectList[0].createContext)
The createWCSObject() function in betadrizzle.wcs_functions was revised to create a default single_wcs instance for use in the single drizzle step when no user specified WCS updates are provided. WJH git-svn-id: <URL>
spacetelescope_drizzlepac
train
py,py
5c980396cdfb66582397dd0baee9c663c7cac70f
diff --git a/lib/engineyard/cli/ui.rb b/lib/engineyard/cli/ui.rb index <HASH>..<HASH> 100644 --- a/lib/engineyard/cli/ui.rb +++ b/lib/engineyard/cli/ui.rb @@ -68,7 +68,9 @@ module EY def ask(message, password = false) begin - if password + if not $stdin.tty? + Prompter.ask(message) + elsif password Prompter.ask(message) {|q| q.echo = "*" } else Prompter.ask(message) {|q| q.readline = true }
Re-add .tty check (not tricky enough to prevent test from needing it, yet...)
engineyard_engineyard
train
rb
9f6ff08f19b2d229404ec56a4cd4f6f4c24cb2cf
diff --git a/autopep8.py b/autopep8.py index <HASH>..<HASH> 100755 --- a/autopep8.py +++ b/autopep8.py @@ -1338,6 +1338,10 @@ def _execute_pep8(pep8_options, source): return checker.report.full_error_results() +def _remove_leading_and_normalize(line, newline): + return line.lstrip().rstrip(CR + LF) + newline + + class Reindenter(object): """Reindents badly-indented code to uniformly use four-space indentation. @@ -1364,7 +1368,8 @@ class Reindenter(object): else: # Only expand leading tabs. self.lines.append(_get_indentation(line).expandtabs() + - line.strip() + self.newline) + _remove_leading_and_normalize(line, + self.newline)) self.lines.insert(0, None) self.index = 1 # index into self.lines of next line
Avoid touching trailing whitespace in Reindenter
hhatto_autopep8
train
py
29ec3db30dae27221332acaecd213222c3407236
diff --git a/lib/closure_tree/acts_as_tree.rb b/lib/closure_tree/acts_as_tree.rb index <HASH>..<HASH> 100644 --- a/lib/closure_tree/acts_as_tree.rb +++ b/lib/closure_tree/acts_as_tree.rb @@ -40,6 +40,9 @@ module ClosureTree self.attributes == comparison_object.attributes end alias :eql? :== + def hash + attributes.hash + end RUBY self.hierarchy_class.table_name = hierarchy_table_name diff --git a/spec/tag_spec.rb b/spec/tag_spec.rb index <HASH>..<HASH> 100644 --- a/spec/tag_spec.rb +++ b/spec/tag_spec.rb @@ -130,6 +130,15 @@ shared_examples_for "Tag (1)" do TagHierarchy.find_all_by_ancestor_id(@root.id).should == root_hiers TagHierarchy.find_all_by_descendant_id(@root.id).should == root_hiers end + + it "should have different hash codes for each hierarchy model" do + hashes = TagHierarchy.all.map(&:hash) + hashes.should =~ hashes.uniq + end + + it "should return the same hash code for equal hierarchy models" do + TagHierarchy.first.hash.should == TagHierarchy.first.hash + end end it "performs as the readme says it does" do
Fix issue #<I> by adding a proper hierarchy model hash implementation.
ClosureTree_closure_tree
train
rb,rb
5f4a9394a556f31132db8f4191f3a85e89762692
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ except (IOError, ImportError, RuntimeError): long_description = 'Tools for manipulating and parsing vcf files' setup(name='vcftoolbox', - version='1.2.1', + version='1.2.2', description='Tools for manipulating and parsing vcf files', author = 'Mans Magnusson', author_email = 'mans.magnusson@scilifelab.se',
Bumped version to <I>
moonso_vcftoolbox
train
py
312721f47466e42b3369b4b124bac80ccfad7ab1
diff --git a/versionner.py b/versionner.py index <HASH>..<HASH> 100755 --- a/versionner.py +++ b/versionner.py @@ -425,10 +425,10 @@ def git_tag(version, params): cmd.extend(params) p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE) - p.communicate(timeout=DEFAULT_GIT_TAG_TIMEOUT) + (stdout, stderr) = p.communicate(timeout=DEFAULT_GIT_TAG_TIMEOUT) if p.returncode: - raise RuntimeError('Can\'t create git tag %s' % version) + raise RuntimeError('Can\'t create git tag %s. Process exited with code %d and message: %s' % (version, p.returncode, stderr)) def main():
message about failed git command now contains stderr and return code
msztolcman_versionner
train
py
6c1439e12576955941d5214f7d528102b4248301
diff --git a/client/lib/abtest/active-tests.js b/client/lib/abtest/active-tests.js index <HASH>..<HASH> 100644 --- a/client/lib/abtest/active-tests.js +++ b/client/lib/abtest/active-tests.js @@ -151,5 +151,6 @@ export default { }, defaultVariation: 'control', localeTargets: 'any', + localeExceptions: [ 'en' ], }, };
Use the new localeExceptions for the new test
Automattic_wp-calypso
train
js
560517689c3cf18736bcfe39c34985ddd001a2ca
diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -69,9 +69,11 @@ module ActiveRecord foreign_table = parent_table foreign_klass = parent.base_klass + scope_chain_iter = reflection.scope_chain.reverse_each + # The chain starts with the target table, but we want to end with it here (makes # more sense in this context), so we reverse - chain.reverse.each_with_index do |reflection, i| + chain.reverse_each do |reflection| table = tables.shift case reflection.source_macro @@ -97,7 +99,7 @@ module ActiveRecord constraint = build_constraint(reflection, table, key, foreign_table, foreign_key) - scope_chain_items = scope_chain[i].map do |item| + scope_chain_items = scope_chain_iter.next.map do |item| if item.is_a?(Relation) item else @@ -170,11 +172,6 @@ module ActiveRecord def aliased_table_name table.table_alias || table.name end - - def scope_chain - @scope_chain ||= reflection.scope_chain.reverse - end - end end end
cache the scope chain on the stack and eliminate `i`
rails_rails
train
rb
5f7c643d3f1d45433c85f8ff8a1e9e57f3f78682
diff --git a/holoviews/core/element.py b/holoviews/core/element.py index <HASH>..<HASH> 100644 --- a/holoviews/core/element.py +++ b/holoviews/core/element.py @@ -326,7 +326,7 @@ class HoloMap(UniformNdMapping): N separate Maps. """ if not issubclass(self.type, CompositeOverlay): - return self.clone(self.items()) + return None, self.clone(self.items()) item_maps = OrderedDict() for k, overlay in self.items():
Fixed bug in HoloMap.split_overlay where keys were not being returned
pyviz_holoviews
train
py
9a9310df107107b4e0dfaa6283e4b1d0cdc0d8f2
diff --git a/namesys/namesys_test.go b/namesys/namesys_test.go index <HASH>..<HASH> 100644 --- a/namesys/namesys_test.go +++ b/namesys/namesys_test.go @@ -15,6 +15,7 @@ import ( ci "github.com/libp2p/go-libp2p-crypto" peer "github.com/libp2p/go-libp2p-peer" pstoremem "github.com/libp2p/go-libp2p-peerstore/pstoremem" + record "github.com/libp2p/go-libp2p-record" ) type mockResolver struct { @@ -97,7 +98,10 @@ func TestPublishWithCache0(t *testing.T) { t.Fatal(err) } - routing := offroute.NewOfflineRouter(dst, ipns.Validator{KeyBook: ps}) + routing := offroute.NewOfflineRouter(dst, record.NamespacedValidator{ + "ipns": ipns.Validator{KeyBook: ps}, + "pk": record.PublicKeyValidator{}, + }) nsys := NewNameSystem(routing, dst, 0) p, err := path.ParsePath(unixfs.EmptyDirNode().Cid().String())
test: fix namesys test License: MIT
ipfs_go-ipfs
train
go
fc0e24260e779dcc1b756679a658fa8095443fe0
diff --git a/dev/tests.py b/dev/tests.py index <HASH>..<HASH> 100644 --- a/dev/tests.py +++ b/dev/tests.py @@ -81,7 +81,7 @@ def run(matcher=None, repeat=1): suite.addTest(test) result = unittest.TextTestRunner(stream=stream, verbosity=verbosity).run(suite) - if len(result.errors) > 0: + if len(result.errors) > 0 or len(result.failures) > 0: if repeat > 1: print(stream.getvalue()) return False
Fix issue with tests return value not always being correct
wbond_oscrypto
train
py
914220291995cf0865cbfd8c9a881f19d84b76e9
diff --git a/hypermap/aggregator/models.py b/hypermap/aggregator/models.py index <HASH>..<HASH> 100644 --- a/hypermap/aggregator/models.py +++ b/hypermap/aggregator/models.py @@ -1244,7 +1244,7 @@ def endpointlist_post_save(instance, *args, **kwargs): """ Used to process the lines of the endpoint list. """ - with open(instance.upload, mode='rb') as f: + with open(instance.upload.file.name, mode='rb') as f: lines = f.readlines() for url in lines: if len(url) > 255:
Fixed correct access to endpoint file that was broken in a previous commit
cga-harvard_Hypermap-Registry
train
py
35c52716149c10fd860465fa6d7b3d9a077d4b38
diff --git a/Texture2D.js b/Texture2D.js index <HASH>..<HASH> 100644 --- a/Texture2D.js +++ b/Texture2D.js @@ -32,15 +32,15 @@ function Texture2D(ctx, data, width, height, options) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); if (format == gl.DEPTH_COMPONENT && !ctx.isSupported(ctx.CAPS_DEPTH_TEXTURE)) { - throw new Error('TextureCube - Depth Texture format is not supported'); + throw new Error('Texture2D - Depth Texture format is not supported'); } if (dataType == gl.FLOAT && !ctx.isSupported(ctx.CAPS_TEXTURE_FLOAT)) { - throw new Error('TextureCube - Float type is not supported'); + throw new Error('Texture2D - Float type is not supported'); } if (dataType == gl.HALF_FLOAT && !ctx.isSupported(ctx.CAPS_TEXTURE_HALF_FLOAT)) { - throw new Error('TextureCube - Half Float type is not supported'); + throw new Error('Texture2D - Half Float type is not supported'); } this.update(data, width, height, options);
Texture2D fixed typo in comments
pex-gl_pex-context
train
js
fef7ddbe33b5867dcdeb85428a7ff0a0e345438c
diff --git a/abilian/services/indexing/service.py b/abilian/services/indexing/service.py index <HASH>..<HASH> 100644 --- a/abilian/services/indexing/service.py +++ b/abilian/services/indexing/service.py @@ -225,7 +225,7 @@ class WhooshIndexService(Service): filter_q = wq.Or([wq.Term('allowed_roles_and_users', role) for role in roles]) if 'filter' in search_args: - filter_q = wq.And(search_args['filter'], filter_q) + filter_q = wq.And([search_args['filter'], filter_q]) search_args['filter'] = filter_q object_types = set(object_types) @@ -245,7 +245,7 @@ class WhooshIndexService(Service): filter_q = wq.Or([wq.Term('object_type', t) for t in object_types]) if 'filter' in search_args: - filter_q = wq.And(search_args['filter'], filter_q) + filter_q = wq.And([search_args['filter'], filter_q]) search_args['filter'] = filter_q if facet_by_type:
indexing search: fix filters concat
abilian_abilian-core
train
py
3d5a6e2111583cba367fd36f687474cc0f4a01f4
diff --git a/test/test_helper.rb b/test/test_helper.rb index <HASH>..<HASH> 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -19,6 +19,7 @@ class ActiveSupport::TestCase def setup reset_config + reset_locale stub_paperclip end @@ -48,6 +49,11 @@ class ActiveSupport::TestCase ComfortableMexicanSofa::HttpAuth.password = 'password' end + def reset_locale + I18n.default_locale = :en + I18n.locale = :en + end + # Example usage: # assert_has_errors_on @record, :field_1, :field_2 def assert_has_errors_on(record, *fields) @@ -106,6 +112,7 @@ class ActionDispatch::IntegrationTest def setup host! 'test.host' reset_config + reset_locale stub_paperclip end
making sure locale is properly reset in tests
comfy_comfortable-mexican-sofa
train
rb
df846e4dc4baa1357818b0a4845960632dc5e121
diff --git a/xwiki-rendering-macros/xwiki-rendering-macro-ctsreport/src/main/java/org/xwiki/rendering/internal/macro/ctsreport/Result.java b/xwiki-rendering-macros/xwiki-rendering-macro-ctsreport/src/main/java/org/xwiki/rendering/internal/macro/ctsreport/Result.java index <HASH>..<HASH> 100644 --- a/xwiki-rendering-macros/xwiki-rendering-macro-ctsreport/src/main/java/org/xwiki/rendering/internal/macro/ctsreport/Result.java +++ b/xwiki-rendering-macros/xwiki-rendering-macro-ctsreport/src/main/java/org/xwiki/rendering/internal/macro/ctsreport/Result.java @@ -59,15 +59,12 @@ public class Result @Override public boolean equals(Object object) { - if (object == null) { + if (object == null || object.getClass() != getClass()) { return false; } if (object == this) { return true; } - if (object.getClass() != getClass()) { - return false; - } Result rhs = (Result) object; return new EqualsBuilder() .append(this.syntaxId, rhs.syntaxId)
[codestyle] Reduce the number of returns Reduce the number of returns of this method 4, down to the maximum allowed 3
xwiki_xwiki-rendering
train
java
91b5f2f37804896a7e3fac716c0a9083a7b7a52a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( packages=find_packages(), include_all_package_data=True, install_requires=[ - 'Django==1.10.5', + 'Django==1.11.22', 'dj-database-url==0.4.2', 'psycopg2==2.7.3.1', 'djangorestframework==3.9.1',
Upgrade to django <I>
praekeltfoundation_seed-auth-api
train
py
33edf64f0f0e77d2851ee01b67603dd5a1808cff
diff --git a/session.go b/session.go index <HASH>..<HASH> 100644 --- a/session.go +++ b/session.go @@ -49,8 +49,9 @@ var ( // Session holds a facebook session with an access token. // Session should be created by App.Session or App.SessionFromSignedRequest. type Session struct { - HttpClient HttpClient - Version string // facebook versioning. + HttpClient HttpClient + Version string // facebook versioning. + RFC3339Timestamps bool // set to true to send date_format=Y-m-d\TH:i:s.vP on every request which will cause RFC3339 style timestamps to be returned accessToken string // facebook access token. can be empty. app *App @@ -338,6 +339,10 @@ func (session *Session) graph(path string, method Method, params Params) (res Re // overwrite method as we always use post params["method"] = method + if session.RFC3339Timestamps { + params["date_format"] = `Y-m-d\TH:i:s.vP` + } + // get graph api url. if session.isVideoPost(path, method) { graphURL = session.getURL("graph_video", path, nil)
Add RFC<I>Timestamps flag to set date_format on every request
huandu_facebook
train
go
ba440302b3de8af543ec8a0388891361f92ba1a2
diff --git a/src/chui/deletableList.js b/src/chui/deletableList.js index <HASH>..<HASH> 100644 --- a/src/chui/deletableList.js +++ b/src/chui/deletableList.js @@ -81,11 +81,11 @@ } }); $(list).on('singletap', '.deletion-indicator', function() { - if ($(this).closest('li')[0].classList.contains('selected')) { - $(this).closest('li').removeClass('selected'); + if ($(this).parent('li').hasClass('selected')) { + $(this).parent('li').removeClass('selected'); return; } else { - $(this).closest('li').addClass('selected'); + $(this).parent('li').addClass('selected'); } });
Fixed bug in Deletable List. Fixed issue where sometimes deletable lists became unelectable after multiple attempts to select and deselect items.
chocolatechip-ui_chocolatechipui
train
js
18eb1976e29c3ed462580e74df8f3e32c01a82d4
diff --git a/tests/test_fits_image.py b/tests/test_fits_image.py index <HASH>..<HASH> 100644 --- a/tests/test_fits_image.py +++ b/tests/test_fits_image.py @@ -5,7 +5,7 @@ from AegeanTools import fits_image as fi from astropy.io import fits import logging import numpy as np -from numpy.testing import assert_raises +from numpy.testing import assert_raises, assert_array_almost_equal __author__ = 'Paul Hancock' __date__ = '' @@ -113,6 +113,21 @@ def test_init(): assert_raises(Exception, fi.FitsImage, hdu) +def test_get_background_rms(): + filename = 'tests/test_files/1904-66_SIN.fits' + hdu = fits.open(filename) + hdu[0].data = np.empty((40, 40)) + im = fi.FitsImage(hdu) + assert im.get_background_rms() > 0 + + +def test_pix2sky_sky2pix(): + filename = 'tests/test_files/1904-66_SIN.fits' + hdu = fits.open(filename) + im = fi.FitsImage(hdu) + ra, dec = im.pix2sky([0, 0]) + x, y = im.sky2pix([ra, dec]) + assert_array_almost_equal([0, 0], [x, y])
test get_background_rms, pix2sky and sky2pix
PaulHancock_Aegean
train
py
40e070352798ecc7219a89c9625c7499138859ed
diff --git a/src/CmsBundle/Validator/Constraints/Password.php b/src/CmsBundle/Validator/Constraints/Password.php index <HASH>..<HASH> 100644 --- a/src/CmsBundle/Validator/Constraints/Password.php +++ b/src/CmsBundle/Validator/Constraints/Password.php @@ -9,5 +9,5 @@ use Symfony\Component\Validator\Constraint; */ class Password extends Constraint { - public $message = 'Password must contain at least 1 nummeric, 1 capital and 1 lowercase.'; + public $message = 'Password must contain at least 1 nummeric, 1 capital and 1 lowercase character and must be at least 8 characters long.'; }
Defined a better message for the password validator
Opifer_Cms
train
php
3b017856f72ac6711bfbbce2d6edd9c8b49923c1
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index <HASH>..<HASH> 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -587,6 +587,8 @@ class MigrationTest < ActiveRecord::TestCase if current_adapter?(:Mysql2Adapter, :PostgreSQLAdapter) def test_out_of_range_limit_should_raise + Person.connection.drop_table :test_integer_limits, if_exists: true + e = assert_raise(ActiveRecord::ActiveRecordError, "integer limit didn't raise") do Person.connection.create_table :test_integer_limits, :force => true do |t| t.column :bigone, :integer, :limit => 10 @@ -602,6 +604,8 @@ class MigrationTest < ActiveRecord::TestCase end end end + ensure + Person.connection.drop_table :test_integer_limits, if_exists: true end end
Make sure we don't change the global state in the tests We are creating the table but not deleting after the test.
rails_rails
train
rb
ff5db77b8532927d4bcca1744643de60a6ca267d
diff --git a/asks/sessions.py b/asks/sessions.py index <HASH>..<HASH> 100644 --- a/asks/sessions.py +++ b/asks/sessions.py @@ -73,7 +73,7 @@ class BaseSession(metaclass=ABCMeta): ''' sock = await connect_tcp(location[0], location[1], - ssl_context=self.ssl_context or ssl.create_default_context(), + ssl_context=self.ssl_context, bind_host=self.source_address, autostart_tls=True, tls_standard_compatible=False)
Let anyio take care of choosing the default SSL context anyio already accepts ssl_context=None and chooses a good default, so we can just let it do that.
theelous3_asks
train
py
a0761eb2ea6577375c3d834214df1421fa27579f
diff --git a/plugins/providers/virtualbox/driver/version_5_1.rb b/plugins/providers/virtualbox/driver/version_5_1.rb index <HASH>..<HASH> 100644 --- a/plugins/providers/virtualbox/driver/version_5_1.rb +++ b/plugins/providers/virtualbox/driver/version_5_1.rb @@ -6,7 +6,7 @@ module VagrantPlugins # Driver for VirtualBox 5.1.x class Version_5_1 < Version_5_0 def initialize(uuid) - super() + super @logger = Log4r::Logger.new("vagrant::provider::virtualbox_5_1") end
Allow initialization argument to be used in parent
hashicorp_vagrant
train
rb
6865bbc32ce4df3878a6d6d8b127a2fa573d661e
diff --git a/pyinfra/modules/git.py b/pyinfra/modules/git.py index <HASH>..<HASH> 100644 --- a/pyinfra/modules/git.py +++ b/pyinfra/modules/git.py @@ -10,7 +10,7 @@ from pyinfra.api import operation @operation def repo(source, target, branch='master', pull=True, rebase=False): - '''Manage git repositories.''' + '''Manage git repositories. Note: branch switching not implemented yet''' is_repo = host.directory(path.join(target, '.git')) command_prefix = 'cd {0} && git'.format(target) commands = []
Add comment about git.repo not being branch aware (yet)
Fizzadar_pyinfra
train
py
13acb657fe702d757f9c986fb80948f035a253a8
diff --git a/pkg/router/controller/host_admitter.go b/pkg/router/controller/host_admitter.go index <HASH>..<HASH> 100644 --- a/pkg/router/controller/host_admitter.go +++ b/pkg/router/controller/host_admitter.go @@ -123,7 +123,7 @@ func (p *HostAdmitter) HandleEndpoints(eventType watch.EventType, endpoints *kap // HandleRoute processes watch events on the Route resource. func (p *HostAdmitter) HandleRoute(eventType watch.EventType, route *routeapi.Route) error { if err := p.admitter(route); err != nil { - glog.Errorf("Route %s not admitted: %s", routeNameKey(route), err.Error()) + glog.V(4).Infof("Route %s not admitted: %s", routeNameKey(route), err.Error()) p.recorder.RecordRouteRejection(route, "RouteNotAdmitted", err.Error()) return err }
Change rejected routes error message to verbose logging Instead of printing an error message when a route is invalid, print a log error with verbose loglevel. Fixes: rhbz#<I> Remove wrongly imported library Fix import format
openshift_origin
train
go
ea6d9f15ccc488ba5205c5e9bee4f6bd90af757e
diff --git a/tests/test_graph_api.py b/tests/test_graph_api.py index <HASH>..<HASH> 100644 --- a/tests/test_graph_api.py +++ b/tests/test_graph_api.py @@ -4,6 +4,7 @@ import random import json from mock import patch, call, Mock as mock from nose.tools import * +from requests.exceptions import ConnectionError from facepy import GraphAPI @@ -341,3 +342,11 @@ def test_batch_with_errors(): for item in batch: assert isinstance(item, Exception) assert_equal(requests[0], item.request) + +@with_setup(mock, unmock) +def test_query_transport_error(): + graph = GraphAPI('<access token>') + + mock_request.side_effect = ConnectionError('Max retries exceeded with url: /') + + assert_raises(GraphAPI.HTTPError, graph.get, 'me')
Add test for GraphAPI query transport errors
jgorset_facepy
train
py
e1d507c7fb541d29d57d152f40e3a539e70781d0
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -15,10 +15,6 @@ module ActiveRecord end def merge(r) - if r.klass != @klass - raise ArgumentError, "Cannot merge a #{r.klass.name}(##{r.klass.object_id}) relation with #{@klass.name}(##{@klass.object_id}) relation" - end - merged_relation = spawn return merged_relation unless r diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index <HASH>..<HASH> 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -420,10 +420,6 @@ class RelationTest < ActiveRecord::TestCase end end - def test_invalid_merge - assert_raises(ArgumentError) { Post.scoped & Developer.scoped } - end - def test_count posts = Post.scoped
Dont check for class equaity when merging relations
rails_rails
train
rb,rb
4575e0002bcaa49267ff3104c5fec332602bfb88
diff --git a/src/components/body/ScrollerDirective.js b/src/components/body/ScrollerDirective.js index <HASH>..<HASH> 100644 --- a/src/components/body/ScrollerDirective.js +++ b/src/components/body/ScrollerDirective.js @@ -23,9 +23,14 @@ export function ScrollerDirective($timeout){ }; function update(){ + if(lastScrollX !== ctrl.options.internal.offsetX){ + $scope.$apply(() => { + ctrl.options.internal.offsetX = lastScrollX; + }); + } + $scope.$applyAsync(() => { ctrl.options.internal.offsetY = lastScrollY; - ctrl.options.internal.offsetX = lastScrollX; ctrl.updatePage(); if(ctrl.options.scrollbarV){ @@ -43,12 +48,16 @@ export function ScrollerDirective($timeout){ } }; - $elm.parent().on('scroll', function(ev) { + parent.on('scroll', function(ev) { lastScrollY = this.scrollTop; lastScrollX = this.scrollLeft; requestTick(); }); + $scope.$on('$destroy', () => { + parent.off('scroll'); + }); + $scope.scrollerStyles = function(){ if(ctrl.options.scrollbarV){ return {
(perf): fix memory leak on scroll tear down, remove duplicate elm find, apply offsetX faster and only when needed
swimlane_angular-data-table
train
js
2ce857ffe81e151667853db0d4711c428ce659d8
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,8 @@ REQUIREMENTS = [ 'django', 'django-compressor', ] -__VERSION__ = '1.3' +__VERSION__ = read_relative_file('VERSION').strip() + params = dict( name=NAME,
Computes current VERSION info based on current VERSION file content.
peopledoc_django-pimpmytheme
train
py
d805733c1b774c0b549a329a03b20ee3c8ff98b8
diff --git a/src/commands/MigrationCommand.php b/src/commands/MigrationCommand.php index <HASH>..<HASH> 100644 --- a/src/commands/MigrationCommand.php +++ b/src/commands/MigrationCommand.php @@ -36,7 +36,7 @@ class MigrationCommand extends Command { $this->laravel->view->addNamespace('entrust', substr(__DIR__, 0, -8).'views'); - $rolesTable = Config::get('entrust::roles_table'); + $rolesTable = Config::get('entrust.roles_table'); $roleUserTable = Config::get('entrust.role_user_table'); $permissionsTable = Config::get('entrust.permissions_table'); $permissionRoleTable = Config::get('entrust.permission_role_table');
Committed too fast. Typo.
Zizaco_entrust
train
php
ee815f0c5ef74a96bbe3fe2ea25b904b36b5d80a
diff --git a/lib/linters/attribute_quotes.js b/lib/linters/attribute_quotes.js index <HASH>..<HASH> 100644 --- a/lib/linters/attribute_quotes.js +++ b/lib/linters/attribute_quotes.js @@ -1,6 +1,6 @@ 'use strict'; -var parser = require('postcss-selector-parser'); +const parser = require('postcss-selector-parser'); module.exports = { name: 'attributeQuotes', @@ -8,25 +8,22 @@ module.exports = { message: 'Attribute selectors should use quotes.', lint: function attributeQuotesLinter (config, node) { - var results = []; - var self = this; - if (!node.selector) { return; } - parser(function (selectors) { - selectors.walkAttributes(function (selector) { - var column; + const results = []; + parser((selectors) => { + selectors.walkAttributes((selector) => { if (selector.operator && !selector.quoted) { - column = node.source.start.column + selector.source.start.column + const column = node.source.start.column + selector.source.start.column + selector.attribute.length + selector.operator.length; results.push({ column: column, line: selector.source.start.line, - message: self.message + message: this.message }); } });
Rewrite attributeQuotes to ES6
lesshint_lesshint
train
js
b7c0c6ff17a7ef09ab237217726b17b6a4dd0bff
diff --git a/lib/install_template.rb b/lib/install_template.rb index <HASH>..<HASH> 100644 --- a/lib/install_template.rb +++ b/lib/install_template.rb @@ -66,7 +66,7 @@ end ['bin', 'lib', 'template', 'scripts'].each do |dir| this_dir = File.join(version_dir, dir) Library.ensure_dir!(this_dir) - Dir.foreach(dir).each do |filename| + Dir.foreach(dir) do |filename| path = File.join(dir, filename) if File.file?(path) Library.system_or_error("cp %s %s" % [path, this_dir]) @@ -79,7 +79,7 @@ end aliased_bin_dir = File.join(lib_dir, "schema-evolution-manager", "bin") Dir.chdir(bin_dir) do - Dir.foreach(aliased_bin_dir).each do |filename| + Dir.foreach(aliased_bin_dir) do |filename| path = File.join(aliased_bin_dir, filename) if File.file?(path) Library.system_or_error("rm -f %s && ln -s %s" % [filename, path])
Fix bug in copy of files in a dir
mbryzek_schema-evolution-manager
train
rb
dd5095c0acad947f302aa1ccc9499ee2594f6dad
diff --git a/classes/Tools/ToolsManager.php b/classes/Tools/ToolsManager.php index <HASH>..<HASH> 100644 --- a/classes/Tools/ToolsManager.php +++ b/classes/Tools/ToolsManager.php @@ -12,6 +12,7 @@ namespace ILAB\MediaCloud\Tools; +use ILAB\MediaCloud\Utilities\NoticeManager; use ILAB\MediaCloud\Utilities\View; if (!defined( 'ABSPATH')) { header( 'Location: /'); die; } @@ -69,6 +70,11 @@ class ToolsManager return $links; }); + + $maxTime = ini_get('max_execution_time'); + if (($maxTime > 0) && ($maxTime < 90)) { + NoticeManager::instance()->displayAdminNotice('warning',"The <code>max_execution_time</code> is set to a value that might be too low ($maxTime). You should set it to about 90 seconds. Additionally, if you are using Nginx or Apache, you may need to set the respective <code>fastcgi_read_timeout</code>, <code>request_terminate_timeout</code> or <code>TimeOut</code> settings too.", true,'ilab-media-tools-extime-notice'); + } } //endregion
Warning re: max execution time.
Interfacelab_ilab-media-tools
train
php
c797c301f3964e15d5178047ce8f0d6d31d5bd2d
diff --git a/ignite/engine/__init__.py b/ignite/engine/__init__.py index <HASH>..<HASH> 100644 --- a/ignite/engine/__init__.py +++ b/ignite/engine/__init__.py @@ -33,7 +33,7 @@ __all__ = [ def _prepare_batch( batch: Sequence[torch.Tensor], device: Optional[Union[str, torch.device]] = None, non_blocking: bool = False ) -> Tuple[Union[torch.Tensor, Sequence, Mapping, str, bytes], ...]: - """Prepare batch for training: pass to a device with options.""" + """Prepare batch for training or evaluation: pass to a device with options.""" x, y = batch return ( convert_tensor(x, device=device, non_blocking=non_blocking),
Fix typo (#<I>) Closes #<I>
pytorch_ignite
train
py
b35361d9659ec901f5ed16ebb465bf0246d3b7cc
diff --git a/src/test/java/org/mariadb/jdbc/MariaDbPoolDataSourceTest.java b/src/test/java/org/mariadb/jdbc/MariaDbPoolDataSourceTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/mariadb/jdbc/MariaDbPoolDataSourceTest.java +++ b/src/test/java/org/mariadb/jdbc/MariaDbPoolDataSourceTest.java @@ -476,7 +476,9 @@ public class MariaDbPoolDataSourceTest extends BaseTest { @Test public void ensureClosed() throws Throwable { Assume.assumeTrue( - System.getenv("MAXSCALE_TEST_DISABLE") == null && System.getenv("SKYSQL_HA") == null); + System.getenv("MAXSCALE_TEST_DISABLE") == null + && System.getenv("SKYSQL_HA") == null + && System.getenv("SKYSQL") == null); Thread.sleep(500); // ensure that previous close are effective int initialConnection = getCurrentConnections();
[misc] SkySQL test stability improvement Multiple CI simultaneous tests can falsify the results
MariaDB_mariadb-connector-j
train
java
424b46de1b20bf85abf54ca5cc432da9593855f2
diff --git a/_pytest/mark.py b/_pytest/mark.py index <HASH>..<HASH> 100644 --- a/_pytest/mark.py +++ b/_pytest/mark.py @@ -169,7 +169,7 @@ class MarkGenerator: """ Factory for :class:`MarkDecorator` objects - exposed as a ``pytest.mark`` singleton instance. Example:: - import py + import pytest @pytest.mark.slowtest def test_function(): pass
Fix a typo in the docstring for mark.MarkGenerator
vmalloc_dessert
train
py
51def2751d6056f9a1820c55f0ce98ec9e8b5149
diff --git a/DependencyInjection/DarvinImageExtension.php b/DependencyInjection/DarvinImageExtension.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/DarvinImageExtension.php +++ b/DependencyInjection/DarvinImageExtension.php @@ -29,7 +29,7 @@ class DarvinImageExtension extends Extension implements PrependExtensionInterfac */ public function load(array $configs, ContainerBuilder $container): void { - (new ConfigInjector())->inject($this->processConfiguration(new Configuration(), $configs), $container, $this->getAlias()); + (new ConfigInjector($container))->inject($this->processConfiguration(new Configuration(), $configs), $this->getAlias()); (new ConfigLoader($container, __DIR__.'/../Resources/config'))->load([ 'archive/twig_extension',
Pass container to config injector's constructor.
DarvinStudio_DarvinImageBundle
train
php
440a5850df2fc873506d54912afb575d9278afe7
diff --git a/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/master/master.go b/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/master/master.go index <HASH>..<HASH> 100644 --- a/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/master/master.go +++ b/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/master/master.go @@ -685,7 +685,7 @@ func (m *Master) api_v1beta3() *apiserver.APIGroupVersion { func (m *Master) api_v1() *apiserver.APIGroupVersion { storage := make(map[string]rest.Storage) for k, v := range m.storage { - if k == "minions" { + if k == "minions" || k == "minions/status" { continue } storage[strings.ToLower(k)] = v
UPSTREAM: disable minions/status in v1 Kube api
openshift_origin
train
go
91f1bd4da15517f408ac2e6610cf6398d337601c
diff --git a/src/Process/ProcessFactory.php b/src/Process/ProcessFactory.php index <HASH>..<HASH> 100644 --- a/src/Process/ProcessFactory.php +++ b/src/Process/ProcessFactory.php @@ -14,14 +14,6 @@ final class ProcessFactory { public static function fromArguments(ProcessArgumentsCollection $arguments): Process { - // @todo Remove backward compatibility layer as soon as Symfony Process accepts an array (3.3+). - // From then on, you can simply pass `$arguments->getValues()` directly as the first constructor argument. - $commandlineArgs = array_map(function ($argument) { - return ProcessUtils::escapeArgument((string) $argument); - }, $arguments->getValues()); - - $commandline = implode(' ', $commandlineArgs); - - return new Process($commandline); + return new Process($arguments->getValues()); } }
Remove Old Compatibility Layer for Pre-5.x Symfony Process
phpro_grumphp
train
php
b853d1a0d086406cb5bbf23ea41987719cefd1a9
diff --git a/lib/solargraph/language_server/message/text_document/on_type_formatting.rb b/lib/solargraph/language_server/message/text_document/on_type_formatting.rb index <HASH>..<HASH> 100644 --- a/lib/solargraph/language_server/message/text_document/on_type_formatting.rb +++ b/lib/solargraph/language_server/message/text_document/on_type_formatting.rb @@ -4,7 +4,6 @@ module Solargraph module TextDocument class OnTypeFormatting < Base def process - STDERR.puts src = host.read(params['textDocument']['uri']) offset = src.get_offset(params['position']['line'], params['position']['character']) if src.string_at?(offset-1) and params['ch'] == '{' and src.code[offset-2,2] == '#{'
Removed extraneous output.
castwide_solargraph
train
rb
7d316436be0913919187bd8c51646b865bee2251
diff --git a/config/bootstrap.php b/config/bootstrap.php index <HASH>..<HASH> 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -1,5 +1,11 @@ <?php +use Cake\Core\Configure; use Cake\Event\EventManager; use Search\Events\SearchViewMenuListener; +/* +dashboards columns + */ +Configure::write('Search.dashboard.columns', ['Left Side', 'Right Side']); + EventManager::instance()->on(new SearchViewMenuListener());
define dashboard columns through Configuration (task #<I>)
QoboLtd_cakephp-search
train
php
0d0b81e5bde6927766968a60d109cf91fc97e46f
diff --git a/salt/fileserver/s3fs.py b/salt/fileserver/s3fs.py index <HASH>..<HASH> 100644 --- a/salt/fileserver/s3fs.py +++ b/salt/fileserver/s3fs.py @@ -325,6 +325,10 @@ def _refresh_buckets_cache_file(cache_file): for bucket_name in buckets: s3_meta = __get_s3_meta(bucket_name) + # s3 query returned noting + if not s3_meta: + continue + # grab only the files/dirs bucket_files[bucket_name] = filter(lambda k: 'Key' in k, s3_meta) @@ -335,6 +339,10 @@ def _refresh_buckets_cache_file(cache_file): for bucket_name in _get_buckets(): s3_meta = __get_s3_meta(bucket_name) + # s3 query returned noting + if not s3_meta: + continue + # pull out the environment dirs (eg. the root dirs) files = filter(lambda k: 'Key' in k, s3_meta) envs = map(lambda k: (os.path.dirname(k['Key']).split('/', 1))[0], files)
Fixed bug when S3 can't be found or denied auth
saltstack_salt
train
py
89899f2ab45061e0328831c18fc6f98b25273145
diff --git a/lib/Asset.php b/lib/Asset.php index <HASH>..<HASH> 100644 --- a/lib/Asset.php +++ b/lib/Asset.php @@ -57,14 +57,17 @@ class Asset extends Base } /** - * Returns the concat URL for list of files + * Returns the Minify concat URL for list of files * * @param array $files * @return string + * @link https://github.com/mrclay/minify */ public function concat(array $files) { - return $this->concatUrl . '?b=' . trim($this->baseUrl, '/') .'&f=' . implode(',', $files); + $baseUrl = trim($this->baseUrl, '/'); + $url = $this->concatUrl . '?f=' . implode(',', $files); + return $baseUrl ? $url . '&b=' . trim($this->baseUrl, '/') : $url; } /**
allow empty base url for concating files
twinh_wei
train
php
1b14d9748486908d9a9daeb557d1ef03e8231379
diff --git a/libcontainer/configs/config.go b/libcontainer/configs/config.go index <HASH>..<HASH> 100644 --- a/libcontainer/configs/config.go +++ b/libcontainer/configs/config.go @@ -83,9 +83,6 @@ type Syscall struct { Args []*Arg `json:"args"` } -// TODO Windows. Many of these fields should be factored out into those parts -// which are common across platforms, and those which are platform specific. - // Config defines configuration options for executing a process inside a contained environment. type Config struct { // NoPivotRoot will use MS_MOVE and a chroot to jail the process into the container's rootfs
libct/configs: rm Windows TODO It's clear at this point that runc won't support Windows.
opencontainers_runc
train
go
ad451af849bae0b8c6514a0320fe0b778a29c3a2
diff --git a/spec/chewy/type/adapter/active_record_spec.rb b/spec/chewy/type/adapter/active_record_spec.rb index <HASH>..<HASH> 100644 --- a/spec/chewy/type/adapter/active_record_spec.rb +++ b/spec/chewy/type/adapter/active_record_spec.rb @@ -104,6 +104,7 @@ describe Chewy::Type::Adapter::ActiveRecord do specify { import(cities, deleted).should == [{index: cities, delete: deleted}] } specify { import(cities.map(&:id), deleted.map(&:id)) .should == [{index: cities, delete: deleted}] } + specify { import(City.order(:id)).should == [{index: cities, delete: deleted}] } end context 'custom primary_key' do
Additional spec to prove delete_from_index? works with scopes
toptal_chewy
train
rb
a81aee73c99e27a4ded86c382f51ee23c6abcbca
diff --git a/src/org/mozilla/javascript/Undefined.java b/src/org/mozilla/javascript/Undefined.java index <HASH>..<HASH> 100644 --- a/src/org/mozilla/javascript/Undefined.java +++ b/src/org/mozilla/javascript/Undefined.java @@ -130,10 +130,6 @@ public class Undefined implements Scriptable, Serializable throw reportError(); } - public boolean instanceOf(Scriptable prototype) { - return false; - } - private RuntimeException reportError() { return Context.reportRuntimeError0("msg.undefined"); }
Removal of unnecessary instanceOf: Scriptable does not have such method and Undefined does not need to override it.
mozilla_rhino
train
java
d6d8eb380d8615701a0ca437c14b042e1654b496
diff --git a/callbacks.go b/callbacks.go index <HASH>..<HASH> 100644 --- a/callbacks.go +++ b/callbacks.go @@ -88,7 +88,7 @@ func afterUpdate(scope *gorm.Scope) { // if no localized records exist, localize it if scope.NewDB().Table(scope.TableName()).Where(query, locale, scope.PrimaryKeyValue()).Count(&count); count == 0 { - scope.DB().Create(scope.Value) + scope.DB().RowsAffected = scope.DB().Create(scope.Value).RowsAffected } } } else if syncColumns := syncColumns(scope); len(syncColumns) > 0 { // is global
Update RowsAffected if created localized record
qor_l10n
train
go
e9ab7375ff82f895b90ccc6384d38b490170c18c
diff --git a/core/CronArchive.php b/core/CronArchive.php index <HASH>..<HASH> 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -1237,7 +1237,7 @@ class CronArchive { $timezones = $this->getTimezonesHavingNewDay(); $websiteDayHasFinishedSinceLastRun = APISitesManager::getInstance()->getSitesIdFromTimezones($timezones); - $websiteDayHasFinishedSinceLastRun = array_diff($websiteDayHasFinishedSinceLastRun, $websiteIds); + $websiteDayHasFinishedSinceLastRun = array_intersect($websiteDayHasFinishedSinceLastRun, $websiteIds); $this->websiteDayHasFinishedSinceLastRun = $websiteDayHasFinishedSinceLastRun; if (count($websiteDayHasFinishedSinceLastRun) > 0) {
refs #<I> make sure to actually store all siteIds that have finished since last run
matomo-org_matomo
train
php
4ec559221f22fc6638c2e0a1044a4c3f9cb41f7d
diff --git a/src/Command.php b/src/Command.php index <HASH>..<HASH> 100644 --- a/src/Command.php +++ b/src/Command.php @@ -37,7 +37,10 @@ class Command public function getOutputFile() { - $ext = 'txt'; + switch ($this->configFile) { + case 'hocr': $ext = 'hocr'; break; + default: $ext = 'txt'; + } return "{$this->outputFile}.{$ext}"; } diff --git a/tests/Unit/OutputFileTest.php b/tests/Unit/OutputFileTest.php index <HASH>..<HASH> 100644 --- a/tests/Unit/OutputFileTest.php +++ b/tests/Unit/OutputFileTest.php @@ -18,4 +18,11 @@ class OutputFileTest extends TestCase $this->assertEquals($expected, $this->cmd->getOutputFile()); } } + + public function testHocr() + { + $this->cmd->configFile = 'hocr'; + $expected = '/path/to/output/file.hocr'; + $this->assertEquals($expected, $this->cmd->getOutputFile()); + } }
Set correct extension for hOCR output files
thiagoalessio_tesseract-ocr-for-php
train
php,php
1cca3e072429e82dc10962080670cb215726e638
diff --git a/src/Endpoints/Zones.php b/src/Endpoints/Zones.php index <HASH>..<HASH> 100644 --- a/src/Endpoints/Zones.php +++ b/src/Endpoints/Zones.php @@ -164,10 +164,14 @@ class Zones implements API throw new EndpointException('No files or tags to purge.'); } - $options = [ - 'files' => $files, - 'tags' => $tags - ]; + $options = []; + if (!is_null($files)) { + $options['files'] = $files; + } + + if (!is_null($tags)) { + $options['tags'] = $tags; + } $user = $this->adapter->delete('zones/' . $zoneID . '/purge_cache', $options);
fix: Cloudflare Api doesn't like empty tags
cloudflare_cloudflare-php
train
php
c104a93adf0e3c4063efd92fc2ba2b92f0a9b9ea
diff --git a/src/Transit/Transformer/Image/AbstractImageTransformer.php b/src/Transit/Transformer/Image/AbstractImageTransformer.php index <HASH>..<HASH> 100644 --- a/src/Transit/Transformer/Image/AbstractImageTransformer.php +++ b/src/Transit/Transformer/Image/AbstractImageTransformer.php @@ -49,21 +49,25 @@ abstract class AbstractImageTransformer extends AbstractTransformer { // Create an image to work with switch ($mimeType) { case 'image/gif': - $sourceImage = imagecreatefromgif($sourcePath); + $sourceImage = @imagecreatefromgif($sourcePath); break; case 'image/png': - $sourceImage = imagecreatefrompng($sourcePath); + $sourceImage = @imagecreatefrompng($sourcePath); break; case 'image/jpg': case 'image/jpeg': case 'image/pjpeg': - $sourceImage = imagecreatefromjpeg($sourcePath); + $sourceImage = @imagecreatefromjpeg($sourcePath); break; default: - throw new DomainException(sprintf('%s can not be transformed', $mimeType)); + $sourceImage = false; break; } + if (!$sourceImage) { + throw new DomainException(sprintf('%s can not be transformed', $mimeType)); + } + // Gather options $options = $options + array( 'width' => null, @@ -141,4 +145,4 @@ abstract class AbstractImageTransformer extends AbstractTransformer { return new File($targetPath); } -} \ No newline at end of file +}
Handle errors from imagecreatefrom* functions where the extension does not match the files mimeType
ljgpartners_transit
train
php
a000c034393252497614e143d6a722ef2bece305
diff --git a/src/org/opencms/search/galleries/CmsGallerySearchIndex.java b/src/org/opencms/search/galleries/CmsGallerySearchIndex.java index <HASH>..<HASH> 100644 --- a/src/org/opencms/search/galleries/CmsGallerySearchIndex.java +++ b/src/org/opencms/search/galleries/CmsGallerySearchIndex.java @@ -290,7 +290,12 @@ public class CmsGallerySearchIndex extends CmsSearchIndex { if (params.getGalleries() != null) { folders.addAll(params.getGalleries()); } - filter = appendPathFilter(searchCms, filter, folders); + + if (!folders.isEmpty()) { + // appendPathFilter has some annoying default behavior for empty folder lists which conflicts with + // the scope filter logic below + filter = appendPathFilter(searchCms, filter, folders); + } // append category filter filter = appendCategoryFilter(searchCms, filter, params.getCategories());
Fixed search filtering for the search scope 'Everything'.
alkacon_opencms-core
train
java
61f92f8bc5fa0b486fc56f249fa23f1102e79759
diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index <HASH>..<HASH> 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -331,7 +331,7 @@ module ActionView locals = locals.grep(/\A@?(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/) # Double assign to suppress the dreaded 'assigned but unused variable' warning - locals.each_with_object("".dup) { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" } + locals.each_with_object("".dup) { |key, code| code << "#{key} = local_assigns[:#{key}]; #{key} = #{key};" } end def method_name
double assign is no longer an effective workaround for unused variable warning `def a() x = x = 1; end` warns since Ruby <I> (r<I>)
rails_rails
train
rb
929619afe8ca0ab042cec7384c126ccf1c407176
diff --git a/src/Creative/InLine/Linear.php b/src/Creative/InLine/Linear.php index <HASH>..<HASH> 100755 --- a/src/Creative/InLine/Linear.php +++ b/src/Creative/InLine/Linear.php @@ -12,7 +12,6 @@ namespace Sokil\Vast\Creative\InLine; use Sokil\Vast\Creative\AbstractLinearCreative; - use Sokil\Vast\Creative\InLine\Linear\ClosedCaptionFile; use Sokil\Vast\Creative\InLine\Linear\MediaFile; use Sokil\Vast\Creative\InLine\Linear\AdParameters;
- Remove empty line from Linear.php
sokil_php-vast
train
php
a2b3fd93e1e5cb084f3944973339fabf2b90c5d3
diff --git a/src/share/classes/com/sun/tools/javap/AnnotationWriter.java b/src/share/classes/com/sun/tools/javap/AnnotationWriter.java index <HASH>..<HASH> 100644 --- a/src/share/classes/com/sun/tools/javap/AnnotationWriter.java +++ b/src/share/classes/com/sun/tools/javap/AnnotationWriter.java @@ -112,7 +112,7 @@ public class AnnotationWriter extends BasicWriter { for (int i = 0; i < pos.lvarOffset.length; ++i) { if (i != 0) print("; "); if (showOffsets) { - print(", start_pc="); + print("start_pc="); print(pos.lvarOffset[i]); } print(", length="); @@ -124,6 +124,7 @@ public class AnnotationWriter extends BasicWriter { break; // method receiver case METHOD_RECEIVER: + case METHOD_RECEIVER_GENERIC_OR_ARRAY: // Do nothing break; // type parameter @@ -161,9 +162,9 @@ public class AnnotationWriter extends BasicWriter { break; // exception parameter case EXCEPTION_PARAMETER: - // TODO: how do we separate which of the types it is on? - System.out.println("Handle exception parameters!"); - break; + // TODO: how do we separate which of the types it is on? + System.out.println("Handle exception parameters!"); + break; // method parameter case METHOD_PARAMETER: case METHOD_PARAMETER_GENERIC_OR_ARRAY:
Handle METHOD_RECEIVER_GENERIC_OR_ARRAY. Remove a spurious comma in the output.
wmdietl_jsr308-langtools
train
java
86a7dfb176e97f5458b96e9c9389a8a26171e4a1
diff --git a/lib/helpers.js b/lib/helpers.js index <HASH>..<HASH> 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -21,28 +21,27 @@ module.exports = { function copy(object) { var objectCopy; - if ( object && object.constructor === Object ) { - objectCopy = {}; - - for ( var property in object ) { - if ( object.hasOwnProperty(property) ) { - objectCopy[property] = copy(object[property]); - } - } - + if ( Object(object) !== object || object instanceof Function ) { + objectCopy = object; } else if ( Array.isArray(object) ) { objectCopy = []; object.forEach( function (item, index, array) { objectCopy[index] = copy(item); }); + } else if ( object ) { + objectCopy = Object.assign({}, object); + for ( var property in objectCopy ) { + if ( Object(objectCopy[property]) !== objectCopy[property] || objectCopy[property] instanceof Function) { + objectCopy[property] = copy(objectCopy[property]); + } + } } else { objectCopy = object; } return objectCopy; - }
Fixed copy() to handle arrays and nested objects properly
jaysylvester_citizen
train
js
7569fcb76837e8763e2e992b2b217b0c61b6ea63
diff --git a/models/classes/security/xsrf/CsrfValidatorTrait.php b/models/classes/security/xsrf/CsrfValidatorTrait.php index <HASH>..<HASH> 100644 --- a/models/classes/security/xsrf/CsrfValidatorTrait.php +++ b/models/classes/security/xsrf/CsrfValidatorTrait.php @@ -23,6 +23,7 @@ use common_Exception; use common_exception_Error; use common_exception_Unauthorized; use common_session_SessionManager; +use oat\oatbox\service\ServiceManager; /** * Trait that can be used to validate a CSRF token (using the X-CSRF-Token header) @@ -58,7 +59,7 @@ trait CsrfValidatorTrait } /** @var TokenService $tokenService */ - $tokenService = $this->getServiceLocator()->get(TokenService::SERVICE_ID); + $tokenService = ServiceManager::getServiceManager()->get(TokenService::SERVICE_ID); $newToken = null; try {
Changed the way the token service is retrieved
oat-sa_tao-core
train
php
a46018c50d4879e55e91c3be1767f7c9be08257c
diff --git a/lib/pagseguro/request.rb b/lib/pagseguro/request.rb index <HASH>..<HASH> 100644 --- a/lib/pagseguro/request.rb +++ b/lib/pagseguro/request.rb @@ -47,6 +47,8 @@ module PagSeguro def extended_data(data) if data[:credentials] + data.merge!(credentials_object(data)) + elsif PagSeguro.app_id && PagSeguro.app_key data.merge!(application_credentials(data)) else data.merge!(account_credentials(data)) @@ -71,12 +73,21 @@ module PagSeguro } end - def application_credentials(data) + def credentials_object(data) credentials = data.delete(:credentials) + app_credentials = { appId: credentials.app_id, appKey: credentials.app_key } + if credentials.authorization_code + app_credentials.merge!(authorizationCode: credentials.authorization_code) + end + + app_credentials + end + + def application_credentials(data) { - appId: credentials.app_id, - appKey: credentials.app_key - }.merge(authorizationCode: credentials.authorization_code) if credentials. authorization_code + appId: PagSeguro.app_id, + appKey: PagSeguro.app_key + } end def account_credentials(data)
Selects which credentials will be used in request, based on object received
pagseguro_ruby
train
rb
1f05373081a85c1cc23c89a241cbb335e2ea7485
diff --git a/salt/utils/http.py b/salt/utils/http.py index <HASH>..<HASH> 100644 --- a/salt/utils/http.py +++ b/salt/utils/http.py @@ -17,7 +17,6 @@ import io import zlib import gzip import re -from urlparse import urlparse import ssl try: @@ -62,7 +61,7 @@ import salt.ext.six.moves.http_client import salt.ext.six.moves.http_cookiejar import salt.ext.six.moves.urllib.request as urllib_request from salt.ext.six.moves.urllib.error import URLError -from salt.ext.six.moves.urllib.parse import splitquery +from salt.ext.six.moves.urllib.parse import splitquery, urlparse from salt.ext.six.moves.urllib.parse import urlencode as _urlencode # pylint: enable=import-error,no-name-in-module
Fix forward-commit from earlier versions
saltstack_salt
train
py
ec4c464b6300b84dea6e5f6c57875f0e67171aa9
diff --git a/domain/src/main/java/org/jboss/as/services/net/ManagedServerSocketBinding.java b/domain/src/main/java/org/jboss/as/services/net/ManagedServerSocketBinding.java index <HASH>..<HASH> 100644 --- a/domain/src/main/java/org/jboss/as/services/net/ManagedServerSocketBinding.java +++ b/domain/src/main/java/org/jboss/as/services/net/ManagedServerSocketBinding.java @@ -42,7 +42,7 @@ class ManagedServerSocketBinding extends ServerSocket implements ManagedBinding } public InetSocketAddress getBindAddress() { - return InetSocketAddress.class.cast(getLocalPort()); + return InetSocketAddress.class.cast(getLocalSocketAddress()); } public void bind(SocketAddress endpoint, int backlog) throws IOException {
sneak in a small bugfix, before i forget...
wildfly_wildfly
train
java
934d8897abbaf37a398995728b4d4f63ec6beea8
diff --git a/src/sap.m/src/sap/m/GenericTile.js b/src/sap.m/src/sap/m/GenericTile.js index <HASH>..<HASH> 100644 --- a/src/sap.m/src/sap/m/GenericTile.js +++ b/src/sap.m/src/sap/m/GenericTile.js @@ -72,6 +72,8 @@ sap.ui.define(['jquery.sap.global', './library', 'sap/ui/core/Control', 'sap/m/T "tileContent" : {type : "sap.m.TileContent", multiple : true}, /** * An icon or image to be displayed in the control. + * This aggregation is deprecated since version 1.36.0, to display an icon or image use sap.m.TileContent control instead. + * @deprecated Since version 1.36.0. This aggregation is deprecated, use sap.m.TileContent control to display an icon instead. */ "icon" : {type : "sap.ui.core.Control", multiple : false}, /**
[FIX] sap.m.GenericTile: Icon aggregation deprecated Change-Id: I<I>b<I>b<I>c<I>d<I>dabee<I>dc<I>
SAP_openui5
train
js
ee6b3810c5892aa5e70e676cf47a35e3ac1c70d6
diff --git a/test/Classify.test.js b/test/Classify.test.js index <HASH>..<HASH> 100644 --- a/test/Classify.test.js +++ b/test/Classify.test.js @@ -188,6 +188,18 @@ requirejs(['Trinity/Classify'], function (Classify) { someMethod: function () {}, otherMethod: function () {}, Statics : { + weirdStaticMethod : function () {} + } + }); + }).to.throw(Error); + + + expect(function(){ + return Classify({ + Implements: SomeInterface, + someMethod: function () {}, + otherMethod: function () {}, + Statics : { staticMethod : function () {} } });
Added test to verify static methods implementation
IndigoUnited_js-dejavu
train
js
bae7da8877c7923ec1803f73a2a47fd8910da0b5
diff --git a/src/com/xtremelabs/robolectric/AndroidTranslator.java b/src/com/xtremelabs/robolectric/AndroidTranslator.java index <HASH>..<HASH> 100644 --- a/src/com/xtremelabs/robolectric/AndroidTranslator.java +++ b/src/com/xtremelabs/robolectric/AndroidTranslator.java @@ -351,11 +351,7 @@ public class AndroidTranslator implements Translator { cacheJarDir.mkdirs(); } - if (file.exists()) { - jarOutputStream = new JarOutputStream(new FileOutputStream(file, true)); - } else { - jarOutputStream = new JarOutputStream(new FileOutputStream(file), manifest); - } + jarOutputStream = new JarOutputStream(new FileOutputStream(file), manifest); for (Map.Entry<String, byte[]> entry : modifiedClasses.entrySet()) { String key = entry.getKey(); jarOutputStream.putNextEntry(new JarEntry(key.replace('.', '/') + ".class"));
The cache jar is overwritten every time. It does not make sense to append to the cache jar since the jar file code is not smart enough to replace duplicate entries.
robolectric_robolectric
train
java
57558d8b82001df0a75db909c1b89f1b96f583ad
diff --git a/meshio/_ply.py b/meshio/_ply.py index <HASH>..<HASH> 100644 --- a/meshio/_ply.py +++ b/meshio/_ply.py @@ -26,7 +26,7 @@ numpy_to_ply_dtype = {numpy.dtype(v): k for k, v in ply_to_numpy_dtype.items()} def read(filename): - with open(filename) as f: + with open(filename, "rb") as f: mesh = read_buffer(f) return mesh @@ -34,7 +34,7 @@ def read(filename): def _fast_forward(f): # fast forward to the next significant line while True: - line = f.readline().strip() + line = f.readline().decode("utf-8").strip() if line and line[:7] != "comment": break return line @@ -42,7 +42,7 @@ def _fast_forward(f): def read_buffer(f): # assert that the first line reads `ply` - line = f.readline() + line = f.readline().decode("utf-8") assert line.strip() == "ply" line = _fast_forward(f) @@ -96,7 +96,7 @@ def read_buffer(f): # the faces must be read line-by-line for k in range(num_faces): - line = f.readline().strip() + line = f.readline().decode("utf-8").strip() data = line.split() if k == 0: # initialize the cell data arrays
ply: open file as binary
nschloe_meshio
train
py
2408835ca75b958df4fce94ea89d768a33f58b00
diff --git a/src/sync.js b/src/sync.js index <HASH>..<HASH> 100644 --- a/src/sync.js +++ b/src/sync.js @@ -2,7 +2,7 @@ import { Map } from 'immutable'; import { dataFns } from './utils/data_utils'; const { get, set } = dataFns(["sync"]); -import { getEntity, read, subscribe, swap, updateEntity } from './store/index'; +import { getEntity, observe, read, swap, updateEntity } from './store/index'; export default (m, key, opts) => { @@ -76,14 +76,9 @@ const process = (m, id) => { }, m); } -export const go = (id) => { - subscribe("sync-loop-" + id, (key, oldState, newState) => { - // TODO: this should be handled somewhere else - let m = getEntity(newState, "lock", id); - const oldM = getEntity(oldState, "lock", id); - if (m != oldM) { - setTimeout(() => swap(updateEntity, "lock", id, process, id), 0); - } +export const go = id => { + observe("sync", id, m => { + setTimeout(() => swap(updateEntity, "lock", id, process, id), 0); }); }
Use observe instead of subscribe for sync
auth0_lock
train
js
d9f176927adc5c136adfbfa5ac9d608f2ab6cdd7
diff --git a/IPAddress/src/inet.ipaddr/inet/ipaddr/Address.java b/IPAddress/src/inet.ipaddr/inet/ipaddr/Address.java index <HASH>..<HASH> 100644 --- a/IPAddress/src/inet.ipaddr/inet/ipaddr/Address.java +++ b/IPAddress/src/inet.ipaddr/inet/ipaddr/Address.java @@ -25,12 +25,12 @@ import java.util.stream.Stream; import inet.ipaddr.AddressComparator.CountComparator; import inet.ipaddr.AddressComparator.ValueComparator; -import inet.ipaddr.format.AddressDivisionSeries; import inet.ipaddr.format.util.AddressComponentSpliterator; import inet.ipaddr.ipv4.IPv4AddressNetwork; import inet.ipaddr.ipv6.IPv6AddressNetwork; import inet.ipaddr.mac.MACAddressNetwork; +//TODO I think you need an isIPAddress or isIPv4/6() in here and maybe toIPAddress(), to allow others to avoid casting /** * An address, or a collection of multiple addresses. Each segment can represent a single value or a range of values. * <p> @@ -351,11 +351,6 @@ public abstract class Address implements AddressSegmentSeries { } @Override - public int isMore(AddressDivisionSeries other) { - return getSection().isMore(other); - } - - @Override public byte[] getBytes() { return getSection().getBytes(); }
overridding isMore not necessary
seancfoley_IPAddress
train
java
70144bd0a9ecab9f1e11f421f4afced200036c29
diff --git a/generators/app/templates/gulp_tasks/systemjs.js b/generators/app/templates/gulp_tasks/systemjs.js index <HASH>..<HASH> 100644 --- a/generators/app/templates/gulp_tasks/systemjs.js +++ b/generators/app/templates/gulp_tasks/systemjs.js @@ -10,7 +10,17 @@ gulp.task('systemjs:html', updateIndexHtml); function systemjs(done) { const builder = new Builder('./', 'jspm.config.js'); - + builder.config({ + paths: { + "github:*": "jspm_packages/github/*", + "npm:*": "jspm_packages/npm/*" + }, + packageConfigPaths: [ + 'npm:@*/*.json', + 'npm:*.json', + 'github:*/*.json' + ] + }); builder.buildStatic( <%- entry %>, conf.path.tmp('index.js')
Add jspm_packages paths to builder config
FountainJS_generator-fountain-systemjs
train
js
c73210054e4585abdf45eff7c045882b5387e475
diff --git a/src/Http/Response.php b/src/Http/Response.php index <HASH>..<HASH> 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -46,13 +46,15 @@ class Response /** * @param string $key * - * @return string + * @return null|string */ public function getHeader($key) { if (array_key_exists($key, $this->headers)) { return $this->headers[$key]; } + + return null; } /**
getHeader returns null now if it is does not exist
eduvpn_vpn-lib-common
train
php
b05c218018656a2a7fe81fb842c2c024c35f3952
diff --git a/packages/node_modules/@webex/plugin-meetings/src/metrics/index.js b/packages/node_modules/@webex/plugin-meetings/src/metrics/index.js index <HASH>..<HASH> 100644 --- a/packages/node_modules/@webex/plugin-meetings/src/metrics/index.js +++ b/packages/node_modules/@webex/plugin-meetings/src/metrics/index.js @@ -82,7 +82,7 @@ class Metrics { let {meeting} = options; if (this.keys.indexOf(event) === -1) { - LoggerProxy.logger.error(`Metrics: Event ${event} doesnt exist in dictionary`); + LoggerProxy.logger.error(`Metrics->postEvent: Event ${event} doesn't exist in dictionary`); } if (!meeting && meetingId) { @@ -105,7 +105,7 @@ class Metrics { } else { - LoggerProxy.logger.error('Metrics->postEvent: Meeting object not defined'); + LoggerProxy.logger.info(`Metrics->postEvent: Event received for meetingId:${meetingId}, but meeting not found in collection.`); } }
feat(meetings): change to postEvent info message A mercury event could come in after the meeting object has been destroyed. This case is known and should not throw an error.
webex_spark-js-sdk
train
js
f43cd966fea92a1977f0e2d72bbf0acbb73963b5
diff --git a/lib/rhapsody/router/modelRouter/filterRelationship.js b/lib/rhapsody/router/modelRouter/filterRelationship.js index <HASH>..<HASH> 100644 --- a/lib/rhapsody/router/modelRouter/filterRelationship.js +++ b/lib/rhapsody/router/modelRouter/filterRelationship.js @@ -1,6 +1,7 @@ 'use strict'; -var DataCollection = require('data-collection'); +var DataCollection = require('data-collection'), + _ = require('lodash'); /** * Given a array of relationship data and the HTTP query, filters it @@ -9,6 +10,10 @@ var DataCollection = require('data-collection'); * @return {Array} */ module.exports = function filterRelationship(data, httpQuery) { + if(!_.isArray(data)) { + return data; + } + if(httpQuery.limit || httpQuery.offset || httpQuery.orderby || httpQuery.order) { var collection = new DataCollection(data), query = collection.query();
Fix bug in relationships via REST API.
rhapsodyjs_RhapsodyJS
train
js
6c1f22250384b04c9dc874784c0d7898549130dd
diff --git a/SyliusCartEvents.php b/SyliusCartEvents.php index <HASH>..<HASH> 100644 --- a/SyliusCartEvents.php +++ b/SyliusCartEvents.php @@ -23,8 +23,4 @@ final class SyliusCartEvents const ITEM_ADD_INITIALIZE = 'sylius.cart_item.add.initialize'; const ITEM_ADD_COMPLETED = 'sylius.cart_item.add.completed'; const ITEM_ADD_ERROR = 'sylius.cart_item.add.error'; - - const ITEM_REMOVE_INITIALIZE = 'sylius.cart_item.remove.initialize'; - const ITEM_REMOVE_COMPLETED = 'sylius.cart_item.remove.completed'; - const ITEM_REMOVE_ERROR = 'sylius.cart_item.remove.error'; }
[CartItem] Refactor removing cart item from cart
Sylius_Cart
train
php
6c3380137cb35dd9946b6f8ff52c272ca6a633e3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -6,8 +6,14 @@ import codecs # shamelessly copied from VoroPy def read(fname): - return codecs.open(os.path.join(os.path.dirname(__file__), fname), - encoding='utf-8').read() + try: + content = codecs.open( + os.path.join(os.path.dirname(__file__), fname), + encoding='utf-8' + ).read() + except Exception: + content = '' + return content from krypy import __version__
update read function from pynosh
andrenarchy_krypy
train
py
b3216334cb5a353a959b33e43ad5d1f8e397754d
diff --git a/spec/integration/workers/forking_spec.rb b/spec/integration/workers/forking_spec.rb index <HASH>..<HASH> 100644 --- a/spec/integration/workers/forking_spec.rb +++ b/spec/integration/workers/forking_spec.rb @@ -159,6 +159,7 @@ module Qless def self.bloat_memory(original_mem, target_multiple) current_mem = original_mem target = original_mem * target_multiple + print "\nCurrent: #{current_mem} / Target: #{target} " while current_mem < target SecureRandom.hex( @@ -167,11 +168,21 @@ module Qless (target - current_mem) * 100 ).to_sym # symbols are never GC'd. + print '.' current_mem = Qless.current_memory_usage_in_kb end + puts "Final: #{current_mem}" current_mem end + + def self.print(msg) + super if ENV['DEBUG'] + end + + def self.puts(msg) + super if ENV['DEBUG'] + end end stub_const("JobRecord", Struct.new(:pid, :before_mem, :after_mem)) @@ -186,7 +197,7 @@ module Qless run_worker_concurrently_with(worker) do 3.times do - _, result = client.redis.brpop('mem_usage', timeout: 5) + _, result = client.redis.brpop('mem_usage', timeout: 20) job_records << Marshal.load(result) end end
Add optional debugging info for this spec, and increase timeout. Travis needs more time for this spec.
seomoz_qless
train
rb
307c654fdfb0b55fc0e0febdcf95a78568053445
diff --git a/src/Behat/Behat/Console/Command/BehatCommand.php b/src/Behat/Behat/Console/Command/BehatCommand.php index <HASH>..<HASH> 100644 --- a/src/Behat/Behat/Console/Command/BehatCommand.php +++ b/src/Behat/Behat/Console/Command/BehatCommand.php @@ -279,10 +279,13 @@ class BehatCommand extends Command $input->getOption('lang') ?: $container->getParameter('behat.formatter.language') ); if ($input->getOption('colors')) { + $output->setDecorated(true); $formatter->setParameter('decorated', true); } elseif ($input->getOption('no-colors')) { + $output->setDecorated(false); $formatter->setParameter('decorated', false); } elseif (null !== ($decorated = $container->getParameter('behat.formatter.decorated'))) { + $output->setDecorated($decorated); $formatter->setParameter('decorated', $decorated); } else { $formatter->setParameter('decorated', $output->isDecorated());
support --[no-]colors by core output too
Behat_Behat
train
php
c180d2cf08f27329a0a321d93cb7b81132e2935a
diff --git a/sshd-shell-spring-boot-starter/src/main/java/sshd/shell/springboot/autoconfiguration/SshdShellProperties.java b/sshd-shell-spring-boot-starter/src/main/java/sshd/shell/springboot/autoconfiguration/SshdShellProperties.java index <HASH>..<HASH> 100644 --- a/sshd-shell-spring-boot-starter/src/main/java/sshd/shell/springboot/autoconfiguration/SshdShellProperties.java +++ b/sshd-shell-spring-boot-starter/src/main/java/sshd/shell/springboot/autoconfiguration/SshdShellProperties.java @@ -33,6 +33,28 @@ public class SshdShellProperties { AUTH_PROVIDER } + private final FileTransfer filetransfer = new FileTransfer(); + + @lombok.Data + public static class FileTransfer { + + private boolean enabled = false; + } + + private final Filesystem filesystem = new Filesystem(); + + @lombok.Data + public static class Filesystem { + + private final Base base = new Base(); + + @lombok.Data + public static class Base { + + private String dir = System.getProperty("user.home"); + } + } + private final Shell shell = new Shell(); @lombok.Data
Added new fields into SshdShellProperties for ftp
anand1st_sshd-shell-spring-boot
train
java
28c8de7e145c1d202d111a423b7a06b3aadd60ce
diff --git a/client/lib/upgrades/actions/purchases.js b/client/lib/upgrades/actions/purchases.js index <HASH>..<HASH> 100644 --- a/client/lib/upgrades/actions/purchases.js +++ b/client/lib/upgrades/actions/purchases.js @@ -47,8 +47,7 @@ function cancelPrivateRegistration( purchaseId, onComplete ) { Dispatcher.handleServerAction( { type: ActionTypes.PURCHASES_PRIVATE_REGISTRATION_CANCEL_FAILED, purchaseId, - error: i18n.translate( 'There was a problem canceling this private registration. ' + - 'Please try again later or contact support.' ) + error: error.message || i18n.translate( 'There was a problem canceling this private registration. Please try again later or contact support.' ) } ); }
Purchases: Retrieve the error message returned by the API in the cancel private registration action
Automattic_wp-calypso
train
js
cde5717736f6d81357c2fb32315c33887986ebca
diff --git a/Tests/Entity/Schemas/Primitives/ArrayPrimitiveTraitTest.php b/Tests/Entity/Schemas/Primitives/ArrayPrimitiveTraitTest.php index <HASH>..<HASH> 100644 --- a/Tests/Entity/Schemas/Primitives/ArrayPrimitiveTraitTest.php +++ b/Tests/Entity/Schemas/Primitives/ArrayPrimitiveTraitTest.php @@ -7,7 +7,6 @@ namespace Epfremmer\SwaggerBundle\Tests\Entity\Schemas\Primitives; use Doctrine\Common\Collections\ArrayCollection; -use Epfremmer\SwaggerBundle\Entity\Schemas\ObjectSchema; use Epfremmer\SwaggerBundle\Entity\Schemas\Primitives\ArrayPrimitive; use JMS\Serializer\Serializer; use JMS\Serializer\SerializerBuilder;
Added initial ArrayPrimitive Trait test
epfremmer_swagger-php
train
php
7ee0266a66f447cb5f253f8f147e104f183a4aa4
diff --git a/.storybook/config.js b/.storybook/config.js index <HASH>..<HASH> 100644 --- a/.storybook/config.js +++ b/.storybook/config.js @@ -38,7 +38,6 @@ configure(() => { require('../src/components/ripple/stories'); require('../src/components/button/stories'); require('../src/components/spinner/stories'); - require('../src/components/switch/stories'); require('../src/components/progress/stories'); require('../src/components/fab/stories'); require('../src/components/checkbox/stories');
Removed the story of the switch from the storybook config
HenriBeck_materialize-react
train
js
a9a3a66149050545620472f37f05818465df4586
diff --git a/src/API/Management/Clients.php b/src/API/Management/Clients.php index <HASH>..<HASH> 100644 --- a/src/API/Management/Clients.php +++ b/src/API/Management/Clients.php @@ -14,7 +14,6 @@ namespace Auth0\SDK\API\Management; */ class Clients extends GenericResource { - /** * Get all Clients by page. * diff --git a/tests/API/BasicCrudTest.php b/tests/API/BasicCrudTest.php index <HASH>..<HASH> 100644 --- a/tests/API/BasicCrudTest.php +++ b/tests/API/BasicCrudTest.php @@ -19,6 +19,7 @@ abstract class BasicCrudTest extends ApiTests protected $env; /** +<<<<<<< HEAD * API client to test. * * @var mixed @@ -33,6 +34,8 @@ abstract class BasicCrudTest extends ApiTests protected $id_name = 'id'; /** +======= +>>>>>>> Clients endpoint pagination and improvements * Should all results be searched for the created entity? * * @var bool
Clients endpoint pagination and improvements Add pagination to getAll method via page and per_page parameters. Add application type to getAll method via app_type parameter and app_type constants. Change apiClient fluent methods to explicit. Add validation for required 'name' parameter in create method. Add docblocks throughout Clients. Add additional testing for Clients and BasicCrudTest.
auth0_auth0-PHP
train
php,php
d0fb814980df46982960e8b47cff37d5ae74d100
diff --git a/src/java/com/github/jsdossier/NominalType.java b/src/java/com/github/jsdossier/NominalType.java index <HASH>..<HASH> 100644 --- a/src/java/com/github/jsdossier/NominalType.java +++ b/src/java/com/github/jsdossier/NominalType.java @@ -220,7 +220,7 @@ public final class NominalType implements StaticTypedScope<JSType> { @Nullable public <T> T getAttribute(String key, Class<T> type) { Object value = attributes.get(key); - checkArgument(value == null || type.isInstance(type), + checkArgument(value == null || type.isInstance(value), "Attribute %s is a %s, not a %s", key, value == null ? null : value.getClass().getName(), type.getName());
Fix an error uncovered by error prone in the latest version of bazel
jleyba_js-dossier
train
java
ff33a554ef2c24c1710238b69942fe51e70d89da
diff --git a/github/messages.go b/github/messages.go index <HASH>..<HASH> 100644 --- a/github/messages.go +++ b/github/messages.go @@ -255,14 +255,14 @@ func ValidateSignature(signature string, payload, secretToken []byte) error { // WebHookType returns the event type of webhook request r. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/hooks/#webhook-headers +// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types func WebHookType(r *http.Request) string { return r.Header.Get(EventTypeHeader) } // DeliveryID returns the unique delivery ID of webhook request r. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/hooks/#webhook-headers +// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types func DeliveryID(r *http.Request) string { return r.Header.Get(DeliveryIDHeader) }
Fix comment references to webhook types (#<I>)
google_go-github
train
go
6f743e236a49df03dd579933e2360a3304b55c5b
diff --git a/tests/Testing/TestResponseTest.php b/tests/Testing/TestResponseTest.php index <HASH>..<HASH> 100644 --- a/tests/Testing/TestResponseTest.php +++ b/tests/Testing/TestResponseTest.php @@ -1669,6 +1669,20 @@ class TestResponseTest extends TestCase $response->assertSessionHasErrors(['foo']); } + public function testAssertSessionHas() + { + app()->instance('session.store', $store = new Store('test-session', new ArraySessionHandler(1))); + + $store->put('foo', 'value'); + $store->put('bar', 'value'); + + $response = TestResponse::fromBaseResponse(new Response()); + + $response->assertSessionHas('foo'); + $response->assertSessionHas('bar'); + $response->assertSessionHas(['foo', 'bar']); + } + public function testGetEncryptedCookie() { $container = Container::getInstance();
[9.x] Add tests for assertSessionHas in TestResponse (#<I>)
laravel_framework
train
php
813bc31a6be0c106d06149985cbb9c072798e594
diff --git a/lib/runner/index.js b/lib/runner/index.js index <HASH>..<HASH> 100644 --- a/lib/runner/index.js +++ b/lib/runner/index.js @@ -66,7 +66,7 @@ _.extend(Runner, { */ normaliseIterationData: function (data, length) { !_.isArray(data) && (data = [{}]); - ((length < 1) || !_.isFinite(length)) && (length = 1); + ((length < 1) || !_.isFinite(length)) && (length = data.length); // if the iteration count is greater than the length of data, we repeat the last item in data. here, we are // using a for-loop so that we do not have excessive spatial complexity
Resolved iteration count, iteration data conflict
postmanlabs_postman-runtime
train
js
c61ae70ececceccf7cf84040803d8cd62541f37c
diff --git a/web/static/logview/config.js b/web/static/logview/config.js index <HASH>..<HASH> 100644 --- a/web/static/logview/config.js +++ b/web/static/logview/config.js @@ -10,6 +10,7 @@ function (Settings) { /** @scratch /configuration/config.js/2 * === Parameters */ + var portString = window.location.port == "" ? "" : ":" + window.location.port; return new Settings({ /** @scratch /configuration/config.js/5 @@ -21,7 +22,7 @@ function (Settings) { * kibana installed on. You probably want to set it to the FQDN of your * elasticsearch host */ - elasticsearch: "http://"+window.location.hostname+":" + window.location.port + "/elastic", + elasticsearch: "https://" + window.location.hostname + portString + "/elastic", /** @scratch /configuration/config.js/5 * ==== default_route
fix issue with kibana config when using https
control-center_serviced
train
js
481a92cb4111ebc1b7d4de5eeff84f570e4ba5dd
diff --git a/daemon/daemon.go b/daemon/daemon.go index <HASH>..<HASH> 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -271,6 +271,7 @@ func (daemon *Daemon) restore() error { } } + c.Lock() if c.RemovalInProgress { // We probably crashed in the middle of a removal, reset // the flag. @@ -281,10 +282,11 @@ func (daemon *Daemon) restore() error { // be removed. So we put the container in the "dead" // state and leave further processing up to them. logrus.Debugf("Resetting RemovalInProgress flag from %v", c.ID) - c.ResetRemovalInProgress() - c.SetDead() + c.RemovalInProgress = false + c.Dead = true c.ToDisk() } + c.Unlock() }(c) } wg.Wait()
Grab a lock to read container.RemovalInProgress
moby_moby
train
go
1c78f03121d0474b2b7aa7ab881ddccbc4325d5e
diff --git a/ghost/admin/helpers/index.js b/ghost/admin/helpers/index.js index <HASH>..<HASH> 100644 --- a/ghost/admin/helpers/index.js +++ b/ghost/admin/helpers/index.js @@ -29,7 +29,7 @@ return date; }); - Handlebars.registerHelper('adminUrl', function () { + Handlebars.registerHelper('admin_url', function () { return Ghost.paths.subdir + '/ghost'; });
Renamed client-side admin url helper fixes #<I> - includes test
TryGhost_Ghost
train
js