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
1f04a3e7bcd17e720aea215abae97a25fbea2c4d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ """cookiecutter distutils configuration.""" from setuptools import setup -version = "2.0.0" +version = "2.0.3.dev0" with open('README.md', encoding='utf-8') as readme_file: readme = readme_file.read() @@ -34,7 +34,7 @@ setup( package_dir={'cookiecutter': 'cookiecutter'}, entry_points={'console_scripts': ['cookiecutter = cookiecutter.__main__:main']}, include_package_data=True, - python_requires='>=3.6', + python_requires='>=3.7', install_requires=requirements, license='BSD', zip_safe=False, @@ -46,10 +46,10 @@ setup( "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python",
update troove classifiers, version and required python version
audreyr_cookiecutter
train
py
87c9d6a9f5d28277e9d2dbc7cef6702f9196d735
diff --git a/lib/sinatra/showexceptions.rb b/lib/sinatra/showexceptions.rb index <HASH>..<HASH> 100644 --- a/lib/sinatra/showexceptions.rb +++ b/lib/sinatra/showexceptions.rb @@ -22,7 +22,7 @@ module Sinatra rescue Exception => e errors, env["rack.errors"] = env["rack.errors"], @@eats_errors - if respond_to?(:prefers_plain_text?) and prefers_plain_text?(env) + if prefers_plain_text?(env) content_type = "text/plain" body = [dump_exception(e)] else @@ -40,6 +40,10 @@ module Sinatra private + def prefers_plain_text?(env) + [/curl/].index{|item| item =~ env["HTTP_USER_AGENT"]} + end + def frame_class(frame) if frame.filename =~ /lib\/sinatra.*\.rb/ "framework"
Added plain text stack trace output if a cURL user agent is detected.
sinatra_sinatra
train
rb
0866d484b142eb4c7e305e21f4a00594135a66df
diff --git a/src/Illuminate/Database/DetectsLostConnections.php b/src/Illuminate/Database/DetectsLostConnections.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Database/DetectsLostConnections.php +++ b/src/Illuminate/Database/DetectsLostConnections.php @@ -42,6 +42,7 @@ trait DetectsLostConnections 'Login timeout expired', 'Connection refused', 'running with the --read-only option so it cannot execute this statement', + 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', ]); } }
Add 'The connection is broken and recovery is not possible.' thrown by Microsoft ODBC Driver to the list of causedByLostConnection error messages (#<I>)
laravel_framework
train
php
b1cd925c0f8c503932ef88d3b90e821d23402be9
diff --git a/src/main/java/org/msgpack/MessagePack.java b/src/main/java/org/msgpack/MessagePack.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/msgpack/MessagePack.java +++ b/src/main/java/org/msgpack/MessagePack.java @@ -47,7 +47,6 @@ public class MessagePack { registry = new TemplateRegistry(msgpack.registry); } - public Packer createPacker(OutputStream stream) { return new MessagePackPacker(this, stream); } @@ -180,9 +179,6 @@ public class MessagePack { registry.register(type); } - // TODO #MN - // public void forceRegister(Class<?> type); - public <T> void register(Class<T> type, Template<T> tmpl) { registry.register(type, tmpl); }
deleted dead codes in MessagePack.java
msgpack_msgpack-java
train
java
2088e635d1274a3ac4c5f76699c731a1a1a47d32
diff --git a/src/components/__tests__/pagination.js b/src/components/__tests__/pagination.js index <HASH>..<HASH> 100644 --- a/src/components/__tests__/pagination.js +++ b/src/components/__tests__/pagination.js @@ -89,3 +89,27 @@ test('it should be hidden if there are no results in the current context', () => expect(vm.$el.outerHTML).toMatchSnapshot(); }); + +test('it should emit a "page-change" event when page changes', () => { + const searchStore = { + page: 1, + totalPages: 20, + totalResults: 4000, + }; + const Component = Vue.extend(Pagination); + const vm = new Component({ + propsData: { + searchStore, + }, + }); + + const onPageChange = jest.fn(); + vm.$on('page-change', onPageChange); + + vm.$mount(); + + expect(onPageChange).not.toHaveBeenCalled(); + + vm.$el.getElementsByTagName('li')[3].getElementsByTagName('a')[0].click(); + expect(onPageChange).toHaveBeenCalledTimes(1); +});
test(pagination): test that page-change event is emitted
algolia_vue-instantsearch
train
js
e49b59897d02295022060cca8b4271fbcd523b8d
diff --git a/ipwhois/asn.py b/ipwhois/asn.py index <HASH>..<HASH> 100644 --- a/ipwhois/asn.py +++ b/ipwhois/asn.py @@ -600,7 +600,7 @@ class ASNOrigin: net_start (:obj:`int`): The starting point of the network (if parsing multiple networks). Defaults to None. net_end (:obj:`int`): The ending point of the network (if parsing - multiple ks). Defaults to None. + multiple networks). Defaults to None. field_list (:obj:`list`): If provided, a list of fields to parse: ['description', 'maintainer', 'updated', 'source'] If None, defaults to all fields.
docstring typo fix (#<I>)
secynic_ipwhois
train
py
18c71ab57c18e1c4ed2098eef10624dbbd6f7745
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index <HASH>..<HASH> 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -139,7 +139,7 @@ class Bot(GroupMixin, discord.Client): self.extra_events = {} self.cogs = {} self.extensions = {} - self.description = inspect.cleandoc(description) + self.description = inspect.cleandoc(description) if description else '' self.pm_help = pm_help if formatter is not None: if not isinstance(formatter, HelpFormatter):
[commands] Fix issue where Bot would raise if not given a description.
Rapptz_discord.py
train
py
4505818a47964a24bdfc42e58bb56f6a3b01d08c
diff --git a/jest.config.js b/jest.config.js index <HASH>..<HASH> 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,6 +4,7 @@ const commonConfig = { setupFilesAfterEnv: [ '<rootDir>/packages/cozy-stack-client/src/__tests__/setup.js' ], + watchPathIgnorePatterns: ['node_modules'], modulePathIgnorePatterns: ['<rootDir>/packages/.*/dist/'], transformIgnorePatterns: ['node_modules/(?!(cozy-ui))'], testEnvironment: 'jest-environment-jsdom-sixteen',
fix: Prevent Too many open files error Do not watch node_modules since there are too many files in there
cozy_cozy-client
train
js
f15882f507a7ac1296c4606e3e46f6bbfdf63a37
diff --git a/pkg/cmd/grafana-cli/commands/commands.go b/pkg/cmd/grafana-cli/commands/commands.go index <HASH>..<HASH> 100644 --- a/pkg/cmd/grafana-cli/commands/commands.go +++ b/pkg/cmd/grafana-cli/commands/commands.go @@ -57,7 +57,7 @@ func runPluginCommand(command func(commandLine utils.CommandLine) error) func(co return err } - logger.Info("\nRestart grafana after installing plugins . <service grafana-server restart>\n\n") + logger.Info("\nRestart Grafana after installing plugins. Refer to Grafana documentation for instructions if necessary.\n\n\n\n") return nil } }
Update logger message to be more generic (#<I>)
grafana_grafana
train
go
0fbcef60036482315d3b8e2785bdc6a72b74213d
diff --git a/Model/ContactTopic.php b/Model/ContactTopic.php index <HASH>..<HASH> 100644 --- a/Model/ContactTopic.php +++ b/Model/ContactTopic.php @@ -56,5 +56,4 @@ class ContactTopic implements ContactTopicInterface { return $this->title; } - -} \ No newline at end of file +} \ No newline at end of file diff --git a/Model/ContactTopicInterface.php b/Model/ContactTopicInterface.php index <HASH>..<HASH> 100644 --- a/Model/ContactTopicInterface.php +++ b/Model/ContactTopicInterface.php @@ -28,5 +28,4 @@ interface ContactTopicInterface * @param string $title */ public function setTitle($title); - } \ No newline at end of file diff --git a/spec/Sylius/Component/Contact/Model/ContactTopicSpec.php b/spec/Sylius/Component/Contact/Model/ContactTopicSpec.php index <HASH>..<HASH> 100644 --- a/spec/Sylius/Component/Contact/Model/ContactTopicSpec.php +++ b/spec/Sylius/Component/Contact/Model/ContactTopicSpec.php @@ -43,5 +43,4 @@ class ContactTopicSpec extends ObjectBehavior $this->setTitle('Title'); $this->getTitle()->shouldReturn('Title'); } - }
Removed new lines at the end of files
Sylius_Contact
train
php,php,php
41ce00c3e3a6bc6cfc337a44674014e1e4591ace
diff --git a/lib/tinymce/rails/helper.rb b/lib/tinymce/rails/helper.rb index <HASH>..<HASH> 100644 --- a/lib/tinymce/rails/helper.rb +++ b/lib/tinymce/rails/helper.rb @@ -59,5 +59,6 @@ module TinyMCE::Rails # Allow methods to be called as module functions: # e.g. TinyMCE::Rails.tinymce_javascript module_function :tinymce, :tinymce_javascript, :tinymce_configuration + public :tinymce, :tinymce_javascript, :tinymce_configuration end end
Ensure that helper methods are public
spohlenz_tinymce-rails
train
rb
0fe570370cd58b58597017eb7395651946e67693
diff --git a/compara/reconstruct.py b/compara/reconstruct.py index <HASH>..<HASH> 100644 --- a/compara/reconstruct.py +++ b/compara/reconstruct.py @@ -76,14 +76,17 @@ def fuse(args): logging.debug("Total families: {}, Gene members: {}"\ .format(len(families), len(allowed))) + # TODO: Use C++ implementation of BiGraph() when available + # For now just serialize this to the disk G = BiGraph() for bedfile in bedfiles: bed = Bed(bedfile, include=allowed) add_bed_to_graph(G, bed, families) - for path in G.iter_paths(): - m, oo = G.path(path) - print m + G.write(filename="graph.edges") + #for path in G.iter_paths(): + # m, oo = G.path(path) + # print m def adjgraph(args):
[compara] Write edges in reconstruct.fuse()
tanghaibao_jcvi
train
py
ffef548f7c141aaae451e251e174f12e3a8364ed
diff --git a/dxm/src/main/java/io/pcp/parfait/dxm/semantics/UnitMapping.java b/dxm/src/main/java/io/pcp/parfait/dxm/semantics/UnitMapping.java index <HASH>..<HASH> 100644 --- a/dxm/src/main/java/io/pcp/parfait/dxm/semantics/UnitMapping.java +++ b/dxm/src/main/java/io/pcp/parfait/dxm/semantics/UnitMapping.java @@ -76,7 +76,7 @@ public final class UnitMapping { return false; } Unit<?> divided = left.divide(right); - if (!divided.getDimension().equals(NONE)) { + if (!divided.getDimension().equals(Dimension.NONE)) { return false; } return divided.asType(Dimensionless.class).getConverterTo(ONE).equals(IDENTITY);
Resolve a type issue found by Coverity scanning We were using Unit.NONE instead of Dimension.NONE in one call site by accident. In practice not an issue, by good fortune, but may as well fix it up.
performancecopilot_parfait
train
java
87e9db9fd41d45018875b3459eb70b13c30f0108
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): setup( name="quilt", - version="2.5.0", + version="2.5.1", packages=find_packages(), description='Quilt is an open-source data frame registry', long_description=readme(), @@ -32,7 +32,7 @@ setup( author_email='contact@quiltdata.io', license='LICENSE', url='https://github.com/quiltdata/quilt', - download_url='https://github.com/quiltdata/quilt/releases/tag/2.5.0-beta', + download_url='https://github.com/quiltdata/quilt/releases/tag/2.5.1-beta', keywords='quilt quiltdata shareable data dataframe package platform pandas', install_requires=[ 'appdirs>=1.4.0',
Updating version to <I> (#<I>)
quiltdata_quilt
train
py
7c2e9d2432cf80190322b91b2f5d5cf782e368a3
diff --git a/confuse.py b/confuse.py index <HASH>..<HASH> 100644 --- a/confuse.py +++ b/confuse.py @@ -1246,7 +1246,7 @@ class Choice(Template): except ValueError: self.fail( u'must be one of {0}, not {1}'.format( - repr(c.value for c in self.choices), + repr([c.value for c in self.choices]), repr(value) ), view diff --git a/test/test_validation.py b/test/test_validation.py index <HASH>..<HASH> 100644 --- a/test/test_validation.py +++ b/test/test_validation.py @@ -90,6 +90,16 @@ class BuiltInValidatorTest(unittest.TestCase): res = config['foo'].as_choice(Foobar) self.assertEqual(res, Foobar.Foo) + @unittest.skipUnless(SUPPORTS_ENUM, + "enum not supported in this version of Python.") + def test_as_choice_with_enum_error(self): + class Foobar(enum.Enum): + Foo = 'bar' + + config = _root({'foo': 'foo'}) + with self.assertRaises(confuse.ConfigValueError): + config['foo'].as_choice(Foobar) + def test_as_number_float(self): config = _root({'f': 1.0}) config['f'].as_number()
fixed bug in exception message and added another test case
sampsyo_confuse
train
py,py
0e0bdb5ccaf3c99288d55c98ba7f807ec5fe300c
diff --git a/src/Factory/SwiftMessageFactory.php b/src/Factory/SwiftMessageFactory.php index <HASH>..<HASH> 100644 --- a/src/Factory/SwiftMessageFactory.php +++ b/src/Factory/SwiftMessageFactory.php @@ -23,6 +23,6 @@ class SwiftMessageFactory */ public function create() { - return \Swift_Message::newInstance(); + return new \Swift_Message(); } }
Update Swiftmailer to <I> as 2.x has security risks
damien-carcel_UserBundle
train
php
c77a79d0f09b423942e21f844dda7bcb81e59975
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -23,7 +23,7 @@ async function run(req, res, fn, onError) { const val = await fn(req, res) // return a non-null value -> send with 200 - if (null != val) { + if (null !== val && undefined !== val) { send(res, 200, val) } } catch (err) {
Use !== instead of != This seems to conflict with the project's styleguide.
zeit_micro
train
js
fe9439579ce444577d49ab2b76a1e6c1c6b43079
diff --git a/landez/tiles.py b/landez/tiles.py index <HASH>..<HASH> 100644 --- a/landez/tiles.py +++ b/landez/tiles.py @@ -242,12 +242,11 @@ class MBTilesBuilder(object): try: image = urllib.URLopener() image.retrieve(url, output) - break + return # Done. except IOError, e: logger.debug("Download error, retry (%s left). (%s)" % (r, e)) r -= 1 - if r == 0: - raise DownloadError + raise DownloadError def render_tile(self, output, z, x, y): """
Small refactor of retry loop
makinacorpus_landez
train
py
cf0ae578f54d4278875880ef81fb9a1cd8335d2f
diff --git a/test/cli-parse.js b/test/cli-parse.js index <HASH>..<HASH> 100644 --- a/test/cli-parse.js +++ b/test/cli-parse.js @@ -189,7 +189,7 @@ test('cli-parse: scripts arguments: *', async (t) => { t.end(); }); -test('cli-parse: scripts arguments: *', async (t) => { +test('cli-parse: scripts arguments: simple', async (t) => { const result = await cliParse(['one', '--', '--fix'], { 'one': 'redrun one:*', 'one:ls': 'ls', diff --git a/test/redrun.js b/test/redrun.js index <HASH>..<HASH> 100644 --- a/test/redrun.js +++ b/test/redrun.js @@ -198,7 +198,7 @@ test('parse redrun args: "--": npm run', async (t) => { t.end(); }); -test('parse redrun args: "--": npm run', async (t) => { +test('parse redrun args: "--": npm run: should not add quotes', async (t) => { const expect = 'nodemon -w lib --exec \'nyc tape test.js\''; const result = await redrun('watch-coverage', { 'watcher': 'nodemon -w lib --exec',
test(redrun) get rid of duplicates
coderaiser_redrun
train
js,js
27d9c7771499639cfaf6da32b4b02622492e315b
diff --git a/aiidalab_widgets_base/structures.py b/aiidalab_widgets_base/structures.py index <HASH>..<HASH> 100644 --- a/aiidalab_widgets_base/structures.py +++ b/aiidalab_widgets_base/structures.py @@ -259,12 +259,11 @@ class StructureUploadWidget(ipw.VBox): def _on_file_upload(self, change=None): """When file upload button is pressed.""" for fname, item in change['new'].items(): - fobj = io.BytesIO(item['content']) frmt = fname.split('.')[-1] if frmt == 'cif': - self.structure = CifData(file=fobj) + self.structure = CifData(file=io.BytesIO(item['content'])) else: - self.structure = get_ase_from_file(fobj, format=frmt) + self.structure = get_ase_from_file(io.StringIO(item['content'].decode()), format=frmt) self.file_upload.value.clear() break
Fix StructureUploadWidget (#<I>) Currently we are using different file readers for cif files and all the other file types. CifFile reader expect to recieve a bytes like object, while ASE reader expects a string-like. This PR introduces this distinction.
aiidalab_aiidalab-widgets-base
train
py
1db59132e095e3d5a7cf33175c9e96f82b4c9901
diff --git a/pystache/parsed.py b/pystache/parsed.py index <HASH>..<HASH> 100644 --- a/pystache/parsed.py +++ b/pystache/parsed.py @@ -37,7 +37,11 @@ class ParsedTemplate(object): Returns: a string of type unicode. """ - get_unicode = lambda val: val(context) if callable(val) else val + # We avoid use of the ternary operator for Python 2.4 support. + def get_unicode(val): + if callable(val): + return val(context) + return val parts = map(get_unicode, self._parse_tree) s = ''.join(parts)
Removed another use of the ternary operator for Python <I> support.
defunkt_pystache
train
py
b179fb5ed1e9539b35bc38386b3ef5ab41c800fc
diff --git a/test/middleware_stack_test.rb b/test/middleware_stack_test.rb index <HASH>..<HASH> 100644 --- a/test/middleware_stack_test.rb +++ b/test/middleware_stack_test.rb @@ -138,7 +138,8 @@ class MiddlewareStackTest < Faraday::TestCase err = assert_raises RuntimeError do @conn.get('/') end - assert_equal "missing dependency for MiddlewareStackTest::Broken: cannot load such file -- zomg/i_dont/exist", err.message + assert_match "missing dependency for MiddlewareStackTest::Broken: ", err.message + assert_match "zomg/i_dont/exist", err.message end private
don't try to predict exact load error messages for various rubies
lostisland_faraday
train
rb
ac4ff0776daf61582b8a3c134925c7baee5ccbe2
diff --git a/lib/sbsm/redirector.rb b/lib/sbsm/redirector.rb index <HASH>..<HASH> 100644 --- a/lib/sbsm/redirector.rb +++ b/lib/sbsm/redirector.rb @@ -14,7 +14,12 @@ module SBSM end end def redirect? - @state.direct_event && @request_method != 'GET' + #return @state.direct_event && @request_method != 'GET' + direct = @state.direct_event + if(direct.is_a?(Array)) + direct = direct.first + end + direct && ![direct, :sort].include?(event) end def to_html if(redirect?) diff --git a/lib/sbsm/validator.rb b/lib/sbsm/validator.rb index <HASH>..<HASH> 100644 --- a/lib/sbsm/validator.rb +++ b/lib/sbsm/validator.rb @@ -23,7 +23,6 @@ # Validator -- sbsm -- 15.11.2002 -- hwyss@ywesee.com require 'digest/md5' -require 'iconv' require 'rmail' require 'date' require 'drb/drb'
Redirector: redirect everything except the direct event and :sort
zdavatz_sbsm
train
rb,rb
49abfa367c0bcdad51b5be88c82a2babca5dcfd8
diff --git a/transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpConnector.java b/transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpConnector.java index <HASH>..<HASH> 100644 --- a/transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpConnector.java +++ b/transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpConnector.java @@ -446,8 +446,7 @@ public class HttpConnector extends AbstractBridgeConnector<DefaultHttpSession> { } } - private void doRedirectReceived(final IoSessionEx session, DefaultHttpSession httpSession, HttpMessage httpContent) - throws URISyntaxException { + private void doRedirectReceived(final IoSessionEx session, DefaultHttpSession httpSession, HttpMessage httpContent) { if (httpContent.isComplete()) { if (shouldFollowRedirects(httpSession)) { followRedirect(httpSession, session);
Removed unneeded throws from HttpConnector#doRedirectReceived
kaazing_gateway
train
java
34af011a12296b974f978cf642b082163855eb6f
diff --git a/core/src/main/java/com/savoirtech/eos/pattern/whiteboard/KeyedWhiteboard.java b/core/src/main/java/com/savoirtech/eos/pattern/whiteboard/KeyedWhiteboard.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/savoirtech/eos/pattern/whiteboard/KeyedWhiteboard.java +++ b/core/src/main/java/com/savoirtech/eos/pattern/whiteboard/KeyedWhiteboard.java @@ -64,13 +64,13 @@ public class KeyedWhiteboard<K, S> extends AbstractWhiteboard<S, K> { protected K addService(S service, ServiceProperties props) { K key = keyFunction.apply(service, props); if (key != null) { - S registered = serviceMap.computeIfAbsent(key, k -> service); - if (registered != service) { + if (serviceMap.putIfAbsent(key, service) != null) { getLogger().error("Duplicate key \"{}\" detected for service {}.", key, props.getServiceId()); - key = null; + return null; } + return key; } - return key; + return null; } /**
Fixing KeyedWhiteboard's duplicate detection logic.
savoirtech_eos
train
java
27b3d61e9d06f671348f0aecba91a5e2811fe4f5
diff --git a/shared/fetcher.js b/shared/fetcher.js index <HASH>..<HASH> 100644 --- a/shared/fetcher.js +++ b/shared/fetcher.js @@ -212,7 +212,9 @@ Fetcher.prototype.isMissingKeys = function(modelData, keys) { }; Fetcher.prototype.fetchFromApi = function(spec, callback) { - var model = this.getModelOrCollectionForSpec(spec); + var _fetcher = this + , model = this.getModelOrCollectionForSpec(spec) + ; model.fetch({ data: spec.params, success: function(model, body) { @@ -224,7 +226,7 @@ Fetcher.prototype.fetchFromApi = function(spec, callback) { body = resp.body; resp.body = typeof body === 'string' ? body.slice(0, 150) : body; respOutput = JSON.stringify(resp); - err = new Error("ERROR fetching model '" + this.modelUtils.modelName(model.constructor) + "' with options '" + JSON.stringify(options) + "'. Response: " + respOutput); + err = new Error("ERROR fetching model '" + _fetcher.modelUtils.modelName(model.constructor) + "' with options '" + JSON.stringify(options) + "'. Response: " + respOutput); err.status = resp.status; err.body = body; callback(err);
Another out-of-context-this left behind enemy lines.
rendrjs_rendr
train
js
f156ddb66e54ff7227d7c58de494e006357e0f39
diff --git a/ratings/models.py b/ratings/models.py index <HASH>..<HASH> 100644 --- a/ratings/models.py +++ b/ratings/models.py @@ -5,7 +5,7 @@ from django.db import models, IntegrityError from django.template.defaultfilters import slugify from django.utils.hashcompat import sha_constructor -from ratings.utils import get_content_object_field, is_gfk +from ratings.utils import get_content_object_field, is_gfk, recommended_items class RatedItemBase(models.Model): score = models.FloatField(default=0, db_index=True) @@ -197,6 +197,9 @@ class _RatingsDescriptor(object): def similar_items(self, item): return SimilarItem.objects.get_for_item(item) + def recommended_items(self, user): + return recommended_items(self.all(), user) + def order_by_rating(self, aggregator=models.Sum, descending=True): ordering = descending and '-score' or 'score' related_field = self.get_content_object_field()
Adding recommended items method to the RatingsDescriptor
django-de_django-simple-ratings
train
py
95f0fd96f0d4a90a398908224f37940e8c669d98
diff --git a/descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_G3R.java b/descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_G3R.java index <HASH>..<HASH> 100644 --- a/descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_G3R.java +++ b/descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_G3R.java @@ -52,7 +52,10 @@ import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; * This class calculates G3R proton descriptors used in neural networks for H1 * NMR shift {@cdk.cite AiresDeSousa2002}. It only applies to (explicit) hydrogen atoms, * requires aromaticity to be perceived (possibly done via a parameter), and - * needs 3D coordinates for all atoms. + * needs 3D coordinates for all atoms. This method only calculates values for + * protons bonded to specific types of rings or via non-rotatable bonds. + * From the original manuscript: "To account for axial and equatorial positions + * of protons bonded to cyclohexane-like rings, g3(r) was used" * * <table border="1"><caption>Parameters for this descriptor:</caption> * <tr>
Add a comment explaining this descriptor only applies to certain protons.
cdk_cdk
train
java
cd5a9f43b3d3aa72443e9d210533bc6e97d2060e
diff --git a/src/sap.ui.mdc/src/sap/ui/mdc/flexibility/PropertyInfoFlex.js b/src/sap.ui.mdc/src/sap/ui/mdc/flexibility/PropertyInfoFlex.js index <HASH>..<HASH> 100644 --- a/src/sap.ui.mdc/src/sap/ui/mdc/flexibility/PropertyInfoFlex.js +++ b/src/sap.ui.mdc/src/sap/ui/mdc/flexibility/PropertyInfoFlex.js @@ -2,8 +2,12 @@ * ! ${copyright} */ sap.ui.define([ - 'sap/base/util/merge' -], function(merge) { + "sap/base/util/merge", + "sap/ui/fl/changeHandler/Base" +], function ( + merge, + Base +) { "use strict"; /* @@ -58,6 +62,11 @@ sap.ui.define([ // Set revert data on the change oChange.setRevertData({ name: oChangeContent.name}); + } else { + return Base.markAsNotApplicable( + "Property " + oChangeContent.name + " already exists on control " + oModifier.getId(oControl), + /*bAsync*/true + ); } }); });
[INTERNAL][FIX] sap.ui.mdc: Mark changes as not applicable if property already exists Change-Id: I6b<I>f9fb1be8b2e<I>d5e<I>ae9a<I>faf6f<I>c BCP: <I>
SAP_openui5
train
js
d3860137fe236b9c8d92ef7be7147ac976b9c545
diff --git a/test/specs/scale.logarithmic.tests.js b/test/specs/scale.logarithmic.tests.js index <HASH>..<HASH> 100644 --- a/test/specs/scale.logarithmic.tests.js +++ b/test/specs/scale.logarithmic.tests.js @@ -749,7 +749,7 @@ describe('Logarithmic Scale tests', function() { } }); - expect(chart.scales.yScale1.getLabelForIndex(0, 2)).toBe(150); + expect(chart.scales.yScale0.getLabelForIndex(0, 2)).toBe(150); }); describe('when', function() {
Fix logarighmic test to use correct scale (#<I>)
chartjs_Chart.js
train
js
6fad103535ac845781338ee988bb0d6398f97559
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -4,8 +4,6 @@ from setuptools import setup with codecs_open('README.md', 'r', 'utf-8') as f: README = f.read() -with codecs_open('CHANGELOG.md', 'r', 'utf-8') as f: - CHANGELOG = f.read() setup( author='Beau Barker',
Remove unnecessary lines from setup.py
bcb_jsonrpcclient
train
py
473d276147b758be5225a4be998f553f1e31deb4
diff --git a/lib/Doctrine/Common/Cache/ChainCache.php b/lib/Doctrine/Common/Cache/ChainCache.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/Common/Cache/ChainCache.php +++ b/lib/Doctrine/Common/Cache/ChainCache.php @@ -15,6 +15,9 @@ class ChainCache extends CacheProvider /** @var CacheProvider[] */ private $cacheProviders = []; + /** @var int */ + private $defaultLifeTimeForDownstreamCacheProviders; + /** * @param CacheProvider[] $cacheProviders */ @@ -25,6 +28,11 @@ class ChainCache extends CacheProvider : array_values($cacheProviders); } + public function setDefaultLifeTimeForDownstreamCacheProviders(int $defaultLifeTimeForDownstreamCacheProviders) : void + { + $this->defaultLifeTimeForDownstreamCacheProviders = $defaultLifeTimeForDownstreamCacheProviders; + } + /** * {@inheritDoc} */ @@ -48,7 +56,7 @@ class ChainCache extends CacheProvider // We populate all the previous cache layers (that are assumed to be faster) for ($subKey = $key - 1; $subKey >= 0; $subKey--) { - $this->cacheProviders[$subKey]->doSave($id, $value); + $this->cacheProviders[$subKey]->doSave($id, $value, $this->defaultLifeTimeForDownstreamCacheProviders); } return $value;
Allow to indicate default TTL for downstream CacheProviders
doctrine_cache
train
php
e2c948782b942d79911cec09c8862de0948b31e4
diff --git a/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java b/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java index <HASH>..<HASH> 100755 --- a/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java +++ b/transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java @@ -1295,7 +1295,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements private void invokeFlush0(ChannelPromise promise) { Channel channel = channel(); if (!channel.isRegistered() && !channel.isActive()) { - promise.setFailure(new ClosedChannelException()); + promise.tryFailure(new ClosedChannelException()); return; }
Fix a problem where flush future is set more than once
netty_netty
train
java
b7549cf3169305e606fc8ba64d87cf718f7ac299
diff --git a/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java b/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java index <HASH>..<HASH> 100755 --- a/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java +++ b/h2o-algos/src/main/java/hex/tree/SharedTreeModel.java @@ -126,6 +126,20 @@ public abstract class SharedTreeModel<M extends SharedTreeModel<M,P,O>, P extend } // Override in subclasses to provide some top-level model-specific goodness + @Override protected boolean toJavaCheckTooBig() { + // If the number of leaves in a forest is more than N, don't try to render it in the browser as POJO code. + try { + if ((this._output._treeStats._num_trees * this._output._treeStats._mean_leaves) > 5000) { + return true; + } + } + catch (Exception ignore) { + // If we can't figure out the answer, assume it's too big. + return true; + } + + return false; + } @Override protected SB toJavaInit(SB sb, SB fileContext) { sb.nl(); sb.ip("public boolean isSupervised() { return true; }").nl();
Added a 'preview' flag to GET Model so the browser can tell the backend when it's requesting a java pojo. Don't render the full thing if it's huge and will kill the browser.
h2oai_h2o-3
train
java
77181e765ee9e75c9c50ea83d8836b70041d0e35
diff --git a/NavigationReactNative/src/android/app/src/main/java/com/navigation/reactnative/NavigationBarView.java b/NavigationReactNative/src/android/app/src/main/java/com/navigation/reactnative/NavigationBarView.java index <HASH>..<HASH> 100644 --- a/NavigationReactNative/src/android/app/src/main/java/com/navigation/reactnative/NavigationBarView.java +++ b/NavigationReactNative/src/android/app/src/main/java/com/navigation/reactnative/NavigationBarView.java @@ -50,6 +50,9 @@ public class NavigationBarView extends AppBarLayout { )); toolbar = new Toolbar(context); addView(toolbar, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + ((AppBarLayout.LayoutParams) toolbar.getLayoutParams()).setScrollFlags( + AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS + ); defaultTitleTextColor = getDefaultTitleTextColor(); defaultOverflowIcon = toolbar.getOverflowIcon();
Tested out scroll flags and they work!
grahammendick_navigation
train
java
02ddaad5d985186eed94dea4105a57fa21ba24db
diff --git a/docker/docker.go b/docker/docker.go index <HASH>..<HASH> 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -86,7 +86,9 @@ func main() { log.Fatal(err) } // Serve api - if err := eng.Job("serveapi", flHosts...).Run(); err != nil { + job := eng.Job("serveapi", flHosts...) + job.Setenv("Logging", true) + if err := job.Run(); err != nil { log.Fatal(err) } } else { diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -88,7 +88,8 @@ func (srv *Server) ListenAndServe(job *engine.Job) string { return "Invalid protocol format." } go func() { - chErrors <- ListenAndServe(protoAddrParts[0], protoAddrParts[1], srv, true) + // FIXME: merge Server.ListenAndServe with ListenAndServe + chErrors <- ListenAndServe(protoAddrParts[0], protoAddrParts[1], srv, job.GetenvBool("Logging")) }() } for i := 0; i < len(protoAddrs); i += 1 {
Engine: optional environment variable 'Logging' in 'serveapi'
moby_moby
train
go,go
5c74a486b766f65310173011efde191894d0144d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ author = "Chris Sinchok" author_email = "csinchok@theonion.com" license = "BSD" requires = [ - "Django>=1.8", + "Django>=1.8,<1.9", "django-betty-cropper>=0.2.0", "djangorestframework==3.1.1", "django-polymorphic==0.7.1",
We can't upgrade to Django==<I>, yet
theonion_django-bulbs
train
py
72eeeb4abfc8fd1bf3d35e09a070ada3fffdbcc0
diff --git a/src/resolvedpos.js b/src/resolvedpos.js index <HASH>..<HASH> 100644 --- a/src/resolvedpos.js +++ b/src/resolvedpos.js @@ -71,7 +71,7 @@ class ResolvedPos { // :: (?number) → number // The (absolute) position directly before the node at the given - // level, or, when `level` is `this.level + 1`, the original + // level, or, when `level` is `this.depth + 1`, the original // position. before(depth) { depth = this.resolveDepth(depth) @@ -81,7 +81,7 @@ class ResolvedPos { // :: (?number) → number // The (absolute) position directly after the node at the given - // level, or, when `level` is `this.level + 1`, the original + // level, or, when `level` is `this.depth + 1`, the original // position. after(depth) { depth = this.resolveDepth(depth)
Fix confused property name in doc comments
ProseMirror_prosemirror-model
train
js
7ef5c7087ce6da85134214655ab97022dda60f03
diff --git a/src/Zephyrus/Utilities/FileSystem/File.php b/src/Zephyrus/Utilities/FileSystem/File.php index <HASH>..<HASH> 100644 --- a/src/Zephyrus/Utilities/FileSystem/File.php +++ b/src/Zephyrus/Utilities/FileSystem/File.php @@ -197,6 +197,17 @@ class File extends FileSystemNode } /** + * Obtains the last access timestamp of the path/file defined in the constructor. If its a directory, it will + * automatically fetch the latest accessed time. + * + * @return int + */ + public function getLastAccessedTime(): int + { + return fileatime($this->path); + } + + /** * Updates the modification time of the file to the given timestamp or simply the current time if none is supplied. * * @param int|null $timestamp
Added method to get last access time of file
dadajuice_zephyrus
train
php
967c1879f41800c39314543173dd374415097e76
diff --git a/lib/dynamic_paperclip/attachment.rb b/lib/dynamic_paperclip/attachment.rb index <HASH>..<HASH> 100644 --- a/lib/dynamic_paperclip/attachment.rb +++ b/lib/dynamic_paperclip/attachment.rb @@ -42,7 +42,7 @@ module DynamicPaperclip url = url(style_name) - delimiter_char = url.match(/\?.+=/) ? '&' : '?' + delimiter_char = url.match(/\?/) ? '&' : '?' "#{url}#{delimiter_char}s=#{UrlSecurity.generate_hash(style_name)}" end @@ -64,4 +64,4 @@ module DynamicPaperclip @dynamic_styles[name.to_sym] = Paperclip::Style.new(name, StyleNaming.style_definition_from_dynamic_style_name(name), self) end end -end \ No newline at end of file +end
Fix to support the paperclip timestamp param which doesn't have a value.
room118solutions_dynamic_paperclip
train
rb
eca51b42ec5361b36183fa44356e0f1db9fbc896
diff --git a/lib/templates/client/service.js b/lib/templates/client/service.js index <HASH>..<HASH> 100644 --- a/lib/templates/client/service.js +++ b/lib/templates/client/service.js @@ -3,11 +3,11 @@ angular .module('mean.__pkgName__') - .factory(__pkgName__); + .factory(__class__); - __pkgName__.$inject = ['__class__']; + __class__.$inject = ['__class__']; - function __pkgName__(__class__) { + function __class__(__class__) { return { name: '__pkgName__' };
Updated to __class__ which seems to have proper capitalization
linnovate_mean-cli
train
js
5fb30308455b9935df5baec183e5883aab282e5d
diff --git a/asn1crypto/x509.py b/asn1crypto/x509.py index <HASH>..<HASH> 100644 --- a/asn1crypto/x509.py +++ b/asn1crypto/x509.py @@ -363,7 +363,7 @@ class RelativeDistinguishedName(SetOf): """ output = [] - values = self._get_values() + values = self._get_values(self) for key in sorted(values.keys()): output.append('%s: %s' % (key, values[key])) # Unit separator is used here since the normalization process for
Fix generating the hashable version of an x<I>.RelativeDistinguishedName
wbond_asn1crypto
train
py
f56903805a23241db141bb2696f107b9ce6f09de
diff --git a/pyjfuzz.py b/pyjfuzz.py index <HASH>..<HASH> 100644 --- a/pyjfuzz.py +++ b/pyjfuzz.py @@ -353,6 +353,11 @@ class JSONFactory: self.behavior[_kind] -= 0.1 else: self.behavior[_kind] = 0 + else: + if self.behavior[_kind]+0.1 <= 10: + self.behavior[_kind] += 0.1 + else: + self.behavior[_kind] = 10 def fuzz_behavior(self, kind): """
Added behavior based fuzzing & better performance
mseclab_PyJFuzz
train
py
bcf10c93993ea53fe31b35ae2d05817f933ae554
diff --git a/pyt/cfg.py b/pyt/cfg.py index <HASH>..<HASH> 100644 --- a/pyt/cfg.py +++ b/pyt/cfg.py @@ -600,8 +600,10 @@ class CFG(ast.NodeVisitor): for n, successor in zip(restore_nodes, restore_nodes[1:]): n.connect(successor) - self.nodes[-1].connect(restore_nodes[0]) - self.nodes.extend(restore_nodes) + if restore_nodes: + self.nodes[-1].connect(restore_nodes[0]) + self.nodes.extend(restore_nodes) + return restore_nodes def return_handler(self, node, function_nodes, restore_nodes):
Fixed if no nodes have to be restored
python-security_pyt
train
py
8a409f0eaa5dfab2bcee5901b305ec5894ffc0db
diff --git a/oort/cmdctrl.go b/oort/cmdctrl.go index <HASH>..<HASH> 100644 --- a/oort/cmdctrl.go +++ b/oort/cmdctrl.go @@ -69,6 +69,7 @@ func (o *Server) Start() error { o.ch = make(chan bool) o.backend.Start() go o.serve() + o.stopped = false return nil } @@ -85,9 +86,11 @@ func (o *Server) Restart() error { close(o.ch) o.waitGroup.Wait() o.backend.Stop() + o.stopped = true o.ch = make(chan bool) o.backend.Start() go o.serve() + o.stopped = false return nil } @@ -115,6 +118,7 @@ func (o *Server) Stop() error { close(o.ch) o.waitGroup.Wait() o.backend.Stop() + o.stopped = true return nil } @@ -131,6 +135,7 @@ func (o *Server) Exit() error { close(o.ch) o.waitGroup.Wait() o.backend.Stop() + o.stopped = true defer o.shutdownFinished() return nil }
Actually mark service as stopped/notstopped
pandemicsyn_oort
train
go
035f444a121162cfdbe6afa98cec047fc60e7b73
diff --git a/rest_social_auth/views.py b/rest_social_auth/views.py index <HASH>..<HASH> 100644 --- a/rest_social_auth/views.py +++ b/rest_social_auth/views.py @@ -114,8 +114,9 @@ class BaseSocialAuthView(GenericAPIView): return Response(resp_data.data) def get_object(self): + auth_data = self.request.auth_data.copy() user = self.request.user - manual_redirect_uri = self.request.auth_data.pop('redirect_uri', None) + manual_redirect_uri = auth_data.pop('redirect_uri', None) manual_redirect_uri = self.get_redirect_uri(manual_redirect_uri) if manual_redirect_uri: self.request.backend.redirect_uri = manual_redirect_uri
Fix for Queryset immutable error on making post from frontend
st4lk_django-rest-social-auth
train
py
06408934fe9e79982669d24cb751db8a17878771
diff --git a/class/AbstractMachine.php b/class/AbstractMachine.php index <HASH>..<HASH> 100644 --- a/class/AbstractMachine.php +++ b/class/AbstractMachine.php @@ -495,7 +495,7 @@ abstract class AbstractMachine * Invoke state machine transition. State machine is not instance of * this class, but it is represented by record in database. */ - public function invokeTransition(Reference $ref, $transition_name, $args, & $returns, $new_id_callback = null) + public function invokeTransition(Reference $ref, $transition_name, $args, & $returns, callable $new_id_callback = null) { $state = $ref->state; @@ -548,7 +548,9 @@ abstract class AbstractMachine // nop, just pass it back break; case self::RETURNS_NEW_ID: - $new_id_callback($ret); + if ($new_id_callback !== null) { + $new_id_callback($ret); + } break; default: throw new RuntimeException('Unknown semantics of the return value: '.$returns);
AbstractMachine: $new_id_callback must be callable
smalldb_libSmalldb
train
php
b37e23b5819abbc03049124bc3a29120f91aeb8c
diff --git a/scripts/release/build-experimental-typescript.js b/scripts/release/build-experimental-typescript.js index <HASH>..<HASH> 100755 --- a/scripts/release/build-experimental-typescript.js +++ b/scripts/release/build-experimental-typescript.js @@ -19,5 +19,11 @@ fs.writeFileSync( `export default '${newVersion}';\n` ); -shell.exec(`NODE_ENV=production VERSION=${newVersion} yarn build`); -shell.exec('yarn build:types'); +const results = [ + shell.exec(`NODE_ENV=production VERSION=${newVersion} yarn build`), + shell.exec('yarn build:types'), +]; + +if (results.some(({ code }) => code !== 0)) { + shell.exit(1); +}
fix(build): ensure build fails when types building fails (#<I>) * fix(build): ensure build fails when types building fails * Apply suggestions from code review
algolia_instantsearch.js
train
js
fb4fcd049ca0abcc2b627ec728392bc12657f5d6
diff --git a/src/effector/__tests__/forward.test.js b/src/effector/__tests__/forward.test.js index <HASH>..<HASH> 100644 --- a/src/effector/__tests__/forward.test.js +++ b/src/effector/__tests__/forward.test.js @@ -1,6 +1,6 @@ //@flow -import {forward, createEvent, createStore} from 'effector' +import {forward, createEvent, createStore, createNode} from 'effector' it('should forward data from one event to another', () => { const fn = jest.fn() @@ -25,6 +25,23 @@ it('should forward data from one event to another', () => { ]) }) +describe('raw nodes support', () => { + test('single ones', () => { + const from = createNode() + const to = createNode() + expect(() => { + forward({from, to}) + }).not.toThrow() + }) + test('arrays', () => { + const from = createNode() + const to = createNode() + expect(() => { + forward({from: [from], to: [to]}) + }).not.toThrow() + }) +}) + it('should stop forwarding after unsubscribe', () => { const fn = jest.fn() const source1 = createEvent<string>()
add tests for forward support for Node
zerobias_effector
train
js
8274ac2e5ad9248c4bd32a6808ad0f0ddad13de8
diff --git a/checkport_test.go b/checkport_test.go index <HASH>..<HASH> 100644 --- a/checkport_test.go +++ b/checkport_test.go @@ -23,12 +23,13 @@ import ( "testing" ) +// Tests for port availability logic written for server startup sequence. func TestCheckPortAvailability(t *testing.T) { tests := []struct { port int }{ - {9000}, - {10000}, + {getFreePort()}, + {getFreePort()}, } for _, test := range tests { // This test should pass if the ports are available
tests: Make sure we try tests on free ports. (#<I>) Fixes #<I>
minio_minio
train
go
408be40bdc8f174738774552914cc5ec98e501e7
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -262,10 +262,8 @@ Handler.prototype.getUsed = function(author, url, req, res, cb) { debug("user load", resource.key || resource.url, "with stall", opts.stall); page.load(resource.url, opts); h.processMw(page, resource, h.users, req, res); - page.wait('idle', next); - } else { - next(); } + next(); }); function next(err) { if (err) return cb(err); @@ -273,6 +271,7 @@ Handler.prototype.getUsed = function(author, url, req, res, cb) { resource.headers['Content-Type'] = 'text/html'; var page = resource.page; if (!page) return cb(new Error("resource.page is missing for\n" + resource.key)); + page.wait('idle'); resource.output(page, function(err, str) { Dom.pool.unlock(page, function(resource) { // breaks the link when the page is recycled
Always wait idle before outputing user page
kapouer_express-dom
train
js
1611fcc0f326b92aa575810fb88f9ba72aaa42c3
diff --git a/apps/loggregator.go b/apps/loggregator.go index <HASH>..<HASH> 100644 --- a/apps/loggregator.go +++ b/apps/loggregator.go @@ -73,7 +73,7 @@ var _ = AppsDescribe("loggregator", func() { It("exercises basic loggregator behavior", func() { Eventually(func() string { - return helpers.CurlApp(Config, appName, fmt.Sprintf("/log/sleep/%d", hundredthOfOneSecond)) + return helpers.CurlApp(Config, appName, fmt.Sprintf("/log/sleep/%d", 1000000)) }).Should(ContainSubstring("Muahaha")) Eventually(logs, Config.DefaultTimeoutDuration()*2).Should(Say("Muahaha"))
Fix the loggregator basic streaming logs test - Setting the app to log every 1/<I>th of a second appears to overload log-cache and prevents the CLI from being able to stream logs - This change may be reverted after talking to the CLI team to see if this is actually an issue that should be fixed in their codebase
cloudfoundry_cf-acceptance-tests
train
go
97d77ac07902b2a15cf561fd636fc1aa96d8067a
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -90,14 +90,18 @@ class Configuration implements ConfigurationInterface */ private function addApple($os) { - $this->root-> + $config = $this->root-> children()-> arrayNode($os)-> children()-> booleanNode("sandbox")->defaultFalse()->end()-> scalarNode("pem")->isRequired()->cannotBeEmpty()->end()-> scalarNode("passphrase")->defaultValue("")->end()-> - scalarNode('json_unescaped_unicode')->defaultFalse()->info('PHP >= 5.4.0 and each messaged must be UTF-8 encoding')->end()-> + scalarNode('json_unescaped_unicode')->defaultFalse(); + if (method_exists($config,'info')) { + $config = $config->info('PHP >= 5.4.0 and each messaged must be UTF-8 encoding'); + } + $config->end()-> end()-> end()-> end()
Test for existence of info method before calling it We get the benefits of <I> but retain compatibility with <I>
richsage_RMSPushNotificationsBundle
train
php
a9a0cb530cf6fcb379a44ff95ce15aeff401e609
diff --git a/examples/py/coinone-markets.py b/examples/py/coinone-markets.py index <HASH>..<HASH> 100644 --- a/examples/py/coinone-markets.py +++ b/examples/py/coinone-markets.py @@ -10,7 +10,7 @@ sys.path.append(root + '/python') import ccxt # noqa: E402 exchange = ccxt.coinone({ - 'enableRateLimit': true, + 'enableRateLimit': True, # 'verbose': True, # uncomment for verbose output })
Fix a typo in examples/py/coinone-markets.py
ccxt_ccxt
train
py
09ed0e911e530e9b907ac92f2892248b6af245fa
diff --git a/vcr/errors.py b/vcr/errors.py index <HASH>..<HASH> 100644 --- a/vcr/errors.py +++ b/vcr/errors.py @@ -1,5 +1,7 @@ class CannotOverwriteExistingCassetteException(Exception): def __init__(self, *args, **kwargs): + self.cassette = kwargs["cassette"] + self.failed_request = kwargs["failed_request"] message = self._get_message(kwargs["cassette"], kwargs["failed_request"]) super(CannotOverwriteExistingCassetteException, self).__init__(message)
Add cassette and failed request as properties of thrown CannotOverwriteCassetteException
kevin1024_vcrpy
train
py
872b62253fff3c8ce3401d70f580cfe39ccaf137
diff --git a/source/src/main/java/com/linkedin/uif/source/extractor/extract/QueryBasedExtractor.java b/source/src/main/java/com/linkedin/uif/source/extractor/extract/QueryBasedExtractor.java index <HASH>..<HASH> 100644 --- a/source/src/main/java/com/linkedin/uif/source/extractor/extract/QueryBasedExtractor.java +++ b/source/src/main/java/com/linkedin/uif/source/extractor/extract/QueryBasedExtractor.java @@ -247,6 +247,8 @@ public abstract class QueryBasedExtractor<S, D> implements Extractor<S, D>, Prot this.log.info("High water mark for the current run: " + currentRunHighWatermark); this.setRangePredicates(watermarkColumn, watermarkType, lwm, currentRunHighWatermark); + // If there are no records in the current run, updating high watermark of the current run to the max value of partition range + this.highWatermark = currentRunHighWatermark; } // if it is set to true, skip count calculation and set source count to -1
Updating high watermark of the current run to max value of partition range if there are no records in the current run RB=<I> R=stakiar A=stakiar
apache_incubator-gobblin
train
java
dca90a304a4c8f2c9e79f31b2f0146d630ce30ca
diff --git a/spatialist/raster.py b/spatialist/raster.py index <HASH>..<HASH> 100644 --- a/spatialist/raster.py +++ b/spatialist/raster.py @@ -63,8 +63,8 @@ class Raster(object): list_separate: bool treat a list of files as separate layers or otherwise as a single layer? The former is intended for single layers of a stack, the latter for tiles of a mosaic. - timestamps: list of str or None - the time information for each layer + timestamps: list[str] or function or None + the time information for each layer or a function converting band names to a :obj:`datetime.datetime` object """ def __init__(self, filename, list_separate=True, timestamps=None): @@ -106,10 +106,14 @@ class Raster(object): else: self.bandnames = ['band{}'.format(x) for x in range(1, self.bands + 1)] - if timestamps is not None: + if isinstance(timestamps, list): if len(timestamps) != len(self.bandnames): raise RuntimeError('the number of time stamps is different to the number of bands') - self.timestamps = timestamps + self.timestamps = timestamps + elif callable(timestamps): + self.timestamps = [timestamps(x) for x in self.bandnames] + else: + self.timestamps = None def __enter__(self): return self
[Raster] optionally pass a function as timestamps argument to convert bandnames to time stamps
johntruckenbrodt_spatialist
train
py
3505ef046d6e9340b3ee258f452e7e5ddbeb212b
diff --git a/system/src/Grav/Common/Data/Blueprint.php b/system/src/Grav/Common/Data/Blueprint.php index <HASH>..<HASH> 100644 --- a/system/src/Grav/Common/Data/Blueprint.php +++ b/system/src/Grav/Common/Data/Blueprint.php @@ -72,12 +72,15 @@ class Blueprint { // Initialize data $this->fields(); + + // Get language class + $language = self::getGrav()['language']; try { $this->validateArray($data, $this->nested); } catch (\RuntimeException $e) { - $language = self::getGrav()['language']; - throw new \RuntimeException(sprintf('<b>Validation failed:</b> %s', $language->translate($e->getMessage()))); + $message = sprintf($language->translate('FORM.VALIDATION_FAIL', null, true) . ' %s', $e->getMessage()); + throw new \RuntimeException($message); } }
Added a translation for "Validation failed:" text The English term "Validation failed:" was hard coded on line <I>. Instead, I created a translation and placed this at /system/languages/en.yaml. It will need to be translated into other languages by others.
getgrav_grav
train
php
e7a1f1a928bef5107798e3d349755935bef9455a
diff --git a/annis-service/src/main/java/annis/administration/SchemeFixer.java b/annis-service/src/main/java/annis/administration/SchemeFixer.java index <HASH>..<HASH> 100644 --- a/annis-service/src/main/java/annis/administration/SchemeFixer.java +++ b/annis-service/src/main/java/annis/administration/SchemeFixer.java @@ -94,6 +94,9 @@ public class SchemeFixer catch (SQLException ex) { log.error("Could not get the metadata for the database", ex); + } + finally + { if(result != null) { try
close resources in finally and not in the catch block
korpling_ANNIS
train
java
774c59ddcdcb462f1fb6c22aa82e05a4bcd302e8
diff --git a/utils/relationship.js b/utils/relationship.js index <HASH>..<HASH> 100644 --- a/utils/relationship.js +++ b/utils/relationship.js @@ -264,7 +264,7 @@ function relationshipToReference(entity, relationship, pathPrefix = []) { nameCapitalized: collection ? relationship.relationshipNameCapitalizedPlural : relationship.relationshipNameCapitalized, type: relationship.otherEntity.primaryKeyType, path: [...pathPrefix, name], - idReferences: relationship.otherEntity.idFields ? [relationship.otherEntity.idFields.map(field => field.reference)] : [], + idReferences: relationship.otherEntity.idFields ? relationship.otherEntity.idFields.map(field => field.reference) : [], valueReference: relationship.otherEntityField && relationship.otherEntityField.reference, }; return reference;
Fix idReferences.
jhipster_generator-jhipster
train
js
27dc48d6960a1d048803dc6c2375b6606c898fbe
diff --git a/test/integration/generated_regress_test.rb b/test/integration/generated_regress_test.rb index <HASH>..<HASH> 100644 --- a/test/integration/generated_regress_test.rb +++ b/test/integration/generated_regress_test.rb @@ -200,6 +200,13 @@ class GeneratedRegressTest < MiniTest::Spec end end + describe "#get_property" do + it "gets the 'float' property" do + @o[:some_float] = 3.14 + assert_equal 3.14, @o.get_property("float") + end + end + should "have a reference count of 1" do assert_equal 1, ref_count(@o) end
Add integration test for GObject::Object#get_property.
mvz_gir_ffi
train
rb
26eeed371759909fbec43ddb9134b09997b43658
diff --git a/tests/fastpath-test.js b/tests/fastpath-test.js index <HASH>..<HASH> 100644 --- a/tests/fastpath-test.js +++ b/tests/fastpath-test.js @@ -799,8 +799,6 @@ test('fastpath-tests', function (t) { } }, tr = fastpath(pattern); - - console.info('tr,', tr); t.deepEqual(tr.evaluate(obj), { results1: {foos: [ [ 1, 2, 3 ], [ 4, 5, 6 ], 12, 13.5, 11.8 ]}, results2: { strrings: [ 'la', 'boo' ] }}); t.end(); });
Implementation of evaluating nested pattern specs
pvenkatakrishnan_fastPath
train
js
775a565bbb2d43538bff8d1fd7585c1ce308d867
diff --git a/examples/clear-space.py b/examples/clear-space.py index <HASH>..<HASH> 100755 --- a/examples/clear-space.py +++ b/examples/clear-space.py @@ -104,7 +104,7 @@ def main(argv=None): print('Camera has %.1f%% free space' % ( 100.0 * float(si.freekbytes) / float(si.capacitykbytes))) free_space = si.freekbytes - if free_space >= target: + if free_space >= target or len(files) == 0: break camera.exit() return 0
Exit loop if no files left to delete
jim-easterbrook_python-gphoto2
train
py
bfc5e1e745afabeca4b6f1f94f2cb1db26214095
diff --git a/make/release.js b/make/release.js index <HASH>..<HASH> 100644 --- a/make/release.js +++ b/make/release.js @@ -166,7 +166,9 @@ inquirer.prompt([{ ).join("\n") ); fs.writeFileSync("README.md", readmeLines.join("\n")); + return noBuild ? 0 : spawnGrunt("jsdoc:public"); }) + .then(() => noBuild ? 0 : spawnGrunt("copy:publishVersionDoc")) .then(() => spawnGrunt("zip:platoHistory")) .then(() => testMode ? console.warn("No GIT publishing in test mode")
Doc is generated once README has been updated (#<I>)
ArnaudBuchholz_gpf-js
train
js
0c3b98ec23c1a7d0aa39cf9cd9b9ef0b8e31e240
diff --git a/lib/graphql/relay/mutation.rb b/lib/graphql/relay/mutation.rb index <HASH>..<HASH> 100644 --- a/lib/graphql/relay/mutation.rb +++ b/lib/graphql/relay/mutation.rb @@ -17,7 +17,7 @@ module GraphQL # input_field :name, !types.String # input_field :itemId, !types.ID # - # return_field :item, Item + # return_field :item, ItemType # # resolve -> (inputs, ctx) { # item = Item.find_by_id(inputs[:id])
return_field argument should be a Type, confusing in example
rmosolgo_graphql-ruby
train
rb
d0850f118e277f861ae4ce89cae5bb4b4eba5b40
diff --git a/lib/perfectqueue/multiprocess/child_process.rb b/lib/perfectqueue/multiprocess/child_process.rb index <HASH>..<HASH> 100644 --- a/lib/perfectqueue/multiprocess/child_process.rb +++ b/lib/perfectqueue/multiprocess/child_process.rb @@ -27,6 +27,7 @@ module PerfectQueue def initialize(runner, config, wpipe) @wpipe = wpipe @wpipe.sync = true + @request_per_child = 0 super(runner, config) @sig = install_signal_handlers end @@ -66,6 +67,22 @@ module PerfectQueue HEARTBEAT_PACKET = [0].pack('C') + # override + def restart(immediate, config) + @max_request_per_child = config[:max_request_per_child] || nil + super + end + + def process(task) + super + if @max_request_per_child + @request_per_child += 1 + if @request_per_child > @max_request_per_child + stop(false) + end + end + end + private def install_signal_handlers SignalQueue.start do |sig|
'process' type multiprocessor supports max_request_per_child option
treasure-data_perfectqueue
train
rb
ae73dbd340cd914ddff6cab9f5291314e69c9946
diff --git a/storage/rethinkdb/bootstrap.go b/storage/rethinkdb/bootstrap.go index <HASH>..<HASH> 100644 --- a/storage/rethinkdb/bootstrap.go +++ b/storage/rethinkdb/bootstrap.go @@ -47,6 +47,16 @@ func (t Table) wait(session *gorethink.Session, dbName string) error { resp.Close() } + if err != nil { + return err + } + + // also try waiting for all table indices + resp, err = t.term(dbName).IndexWait().Run(session) + + if resp != nil { + resp.Close() + } return err }
Wait for indexes in rethink table.wait
theupdateframework_notary
train
go
606b796a9bd49a4ff5fa7f6f44977db0c57e6803
diff --git a/fost_authn_debug/tests/test_middleware.py b/fost_authn_debug/tests/test_middleware.py index <HASH>..<HASH> 100644 --- a/fost_authn_debug/tests/test_middleware.py +++ b/fost_authn_debug/tests/test_middleware.py @@ -44,7 +44,7 @@ class InvalidHeader(TestCase): def _do_test(self, header, gets_user=False): self.request = MockRequest(header) - u = self.m.process_request(self.request) + self.m.process_request(self.request) self.assertEquals(hasattr(self.request, 'user'), gets_user) def test_no_authorization_header(self):
process_request doesn't return anything.
Felspar_django-fost-authn
train
py
c7873ebf2bdec713e9c73613af3a6e350e84be9d
diff --git a/lib/cantango/api/common.rb b/lib/cantango/api/common.rb index <HASH>..<HASH> 100644 --- a/lib/cantango/api/common.rb +++ b/lib/cantango/api/common.rb @@ -11,7 +11,7 @@ module CanTango::Api protected def execution_modes - CanTango.config.ability.modes.registered || [:no_cache] + CanTango.config.ability.modes || [:no_cache] end def config diff --git a/spec/cantango/api/can/account_spec.rb b/spec/cantango/api/can/account_spec.rb index <HASH>..<HASH> 100644 --- a/spec/cantango/api/can/account_spec.rb +++ b/spec/cantango/api/can/account_spec.rb @@ -41,6 +41,14 @@ describe CanTango::Api::Can::Account do specify do subject.current_account_ability(:user).modes.should == [:no_cache] end + + specify do + subject.current_account_ability(:user).rules.should_not be_empty + end + + specify do + subject.current_account_ability(:user).can?(:edit, Article).should be_true + end # user can edit Article, not Admin specify do
better can-account spec
kristianmandrup_cantango-api
train
rb,rb
edbc0d23b59dfeadd1397c621dd8b4ad6bd89e56
diff --git a/lib/parameters/parameters.rb b/lib/parameters/parameters.rb index <HASH>..<HASH> 100644 --- a/lib/parameters/parameters.rb +++ b/lib/parameters/parameters.rb @@ -25,7 +25,7 @@ module Parameters # def self.extended(object) each_param do |param| - object.params[param.name] = param.to_instance(self) + object.params[param.name] = param.to_instance(object) end end end
Pass the extending object to the new InstanceParam.
postmodern_parameters
train
rb
8f2dac0a4aba1cc58a6cd646b3989e0bd6a66f75
diff --git a/api/src/main/java/org/commonjava/indy/model/galley/CacheOnlyLocation.java b/api/src/main/java/org/commonjava/indy/model/galley/CacheOnlyLocation.java index <HASH>..<HASH> 100644 --- a/api/src/main/java/org/commonjava/indy/model/galley/CacheOnlyLocation.java +++ b/api/src/main/java/org/commonjava/indy/model/galley/CacheOnlyLocation.java @@ -68,7 +68,7 @@ public class CacheOnlyLocation @Override public boolean allowsStoring() { - return !repo.isReadonly(); + return repo != null && !repo.isReadonly(); } @Override
prevent NPE in CacheOnlyLocation allowsStoring
Commonjava_indy
train
java
6a3a5480687de721221ccde3084580881e9d0635
diff --git a/tasks/defs.js b/tasks/defs.js index <HASH>..<HASH> 100644 --- a/tasks/defs.js +++ b/tasks/defs.js @@ -18,7 +18,8 @@ module.exports = function (grunt) { 'Static scope analysis and transpilation of ES6 block scoped const and let variables, to ES3.', function () { - var validRun = true, + var filesNum = 0, + validRun = true, // Merge task-specific and/or target-specific options with these defaults. options = this.options(); @@ -54,6 +55,9 @@ module.exports = function (grunt) { }); function runDefs(srcPath, destPath, defsOptions) { + grunt.log.log('Generating"' + destPath + '" from "' + srcPath + '"...'); + filesNum++; + var defsOutput = defs(grunt.file.read(srcPath), defsOptions); // Write the destination file. @@ -70,11 +74,12 @@ module.exports = function (grunt) { // Write defs output to the target file. grunt.file.write(destPath, defsOutput.src); - // Print a success message. - grunt.log.ok('File "' + destPath + '" generated.'); return true; } + if (validRun) { + grunt.log.ok(filesNum + ' files successfully generated.'); + } return validRun; });
log currently generated file (and its source)
EE_grunt-defs
train
js
17a97751f9bccb85194cb2f24a5e952893aed652
diff --git a/chi.go b/chi.go index <HASH>..<HASH> 100644 --- a/chi.go +++ b/chi.go @@ -77,6 +77,10 @@ type Router interface { // NotFound defines a handler to respond whenever a route could // not be found. NotFound(h http.HandlerFunc) + + // MethodNotAllowed defines a handler to respond whenever a method is + // not allowed. + MethodNotAllowed(h http.HandlerFunc) } // Routes interface adds two methods for router traversal, which is also
Fix missing MethodNotAllowed in Router interface
go-chi_chi
train
go
df5dda2ee8824a7f3196bfb18ac4255ec55793b8
diff --git a/lib/codesake/dawn/engine.rb b/lib/codesake/dawn/engine.rb index <HASH>..<HASH> 100644 --- a/lib/codesake/dawn/engine.rb +++ b/lib/codesake/dawn/engine.rb @@ -217,15 +217,20 @@ module Codesake @vulnerabilities end - def is_vulnerable_to?(name) + def find_vulnerability_by_name(name) apply(name) unless is_applied?(name) - @vulnerabilities.each do |v| - return true if v[:name] == name + return v if v[:name] == name end - false + nil + end + + def is_vulnerable_to?(name) + return (find_vulnerability_by_name(name) != nil) end + + def has_reflected_xss? (@reflected_xss.count != 0) end
Added a find_vulnerability_by_name to retrieve a vulnerability and changed is_vulnerable_to? to use it
thesp0nge_dawnscanner
train
rb
a559de63dd8d8719e29ae334a172d43c26bcfc15
diff --git a/agent/consul/server_overview.go b/agent/consul/server_overview.go index <HASH>..<HASH> 100644 --- a/agent/consul/server_overview.go +++ b/agent/consul/server_overview.go @@ -170,13 +170,13 @@ func getCatalogOverview(catalog *structs.CatalogContents) *structs.CatalogSummar summarySort := func(slice []structs.HealthSummary) func(int, int) bool { return func(i, j int) bool { - if slice[i].Name < slice[j].Name { + if slice[i].PartitionOrEmpty() < slice[j].PartitionOrEmpty() { return true } if slice[i].NamespaceOrEmpty() < slice[j].NamespaceOrEmpty() { return true } - return slice[i].PartitionOrEmpty() < slice[j].PartitionOrEmpty() + return slice[i].Name < slice[j].Name } } sort.Slice(summary.Nodes, summarySort(summary.Nodes))
Sort by partition/ns/servicename instead of the reverse
hashicorp_consul
train
go
9520ab9c9252caecdc0651bc7b8ddfa9ab9e8f8c
diff --git a/proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnProctor.java b/proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnProctor.java index <HASH>..<HASH> 100644 --- a/proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnProctor.java +++ b/proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnProctor.java @@ -276,6 +276,6 @@ public class SvnProctor extends FileBasedProctorStore { @Override public String getName() { - return "SvnProctor"; + return SvnProctor.class.getName(); } }
PROC-<I>: use class name instead of a static string.
indeedeng_proctor
train
java
c364187d19107d51311188a7d7a2f897c2fb84f2
diff --git a/lib/sidekiq-spy/app.rb b/lib/sidekiq-spy/app.rb index <HASH>..<HASH> 100644 --- a/lib/sidekiq-spy/app.rb +++ b/lib/sidekiq-spy/app.rb @@ -50,6 +50,7 @@ module SidekiqSpy def configure_sidekiq Sidekiq.configure_client do |sidekiq_config| + sidekiq_config.logger = nil sidekiq_config.redis = { :url => config.url, :namespace => config.namespace,
Disable Sidekiq logger. Completely disable the Sidekiq logger; we have nowhere to display the log messages, anyway! ;)
tiredpixel_sidekiq-spy
train
rb
45c3cbe91140fc78165914cb4438aeb8b049b0da
diff --git a/core/server/src/main/java/alluxio/master/file/meta/Inode.java b/core/server/src/main/java/alluxio/master/file/meta/Inode.java index <HASH>..<HASH> 100644 --- a/core/server/src/main/java/alluxio/master/file/meta/Inode.java +++ b/core/server/src/main/java/alluxio/master/file/meta/Inode.java @@ -471,7 +471,7 @@ public abstract class Inode<T> implements JournalEntryRepresentable { protected Objects.ToStringHelper toStringHelper() { return Objects.toStringHelper(this).add("id", mId).add("name", mName).add("parentId", mParentId) .add("creationTimeMs", mCreationTimeMs).add("pinned", mPinned).add("deleted", mDeleted) - .add("ttl", mTtl).add("mTtlAction", mTtlAction) + .add("ttl", mTtl).add("TtlAction", mTtlAction) .add("directory", mDirectory).add("persistenceState", mPersistenceState) .add("lastModificationTimeMs", mLastModificationTimeMs).add("owner", mOwner) .add("group", mGroup).add("permission", mMode);
Rename mTtlAction to TtlAction
Alluxio_alluxio
train
java
36f9705d1c5c924cdc01a7040b8820345786a974
diff --git a/lxd/instance/drivers/load.go b/lxd/instance/drivers/load.go index <HASH>..<HASH> 100644 --- a/lxd/instance/drivers/load.go +++ b/lxd/instance/drivers/load.go @@ -66,7 +66,8 @@ func validDevices(state *state.State, cluster *db.Cluster, instanceType instance } // Check each device individually using the device package. - for name, config := range devices { + // Use instConf.localDevices so that the cloned config is passed into the driver, so it cannot modify it. + for name, config := range instConf.localDevices { err := device.Validate(instConf, state, name, config) if err != nil { return errors.Wrapf(err, "Device validation failed %q", name)
lxd/instance/drivers/load: Pass copy of device config to device.Validate Ensures a copy of the instance's device config is passed to device.Validate to ensure devices cannot modify the source config map. This way any internal modifications a device may make to its config map are not reflected outside of the device. This mirrors the existing usage of device.New().
lxc_lxd
train
go
fbf6aa65f83abd7c62310a7cc9cb6fd39077b109
diff --git a/linguist/apps.py b/linguist/apps.py index <HASH>..<HASH> 100644 --- a/linguist/apps.py +++ b/linguist/apps.py @@ -8,4 +8,3 @@ class LinguistConfig(AppConfig): def ready(self): super(LinguistConfig, self).ready() - self.module.autodiscover()
Remove autodiscover from linguist/apps.
ulule_django-linguist
train
py
2932a949ba3d8814a4aca1bb995e1bed68f9f12a
diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/AutoValueFinalMethodsTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/AutoValueFinalMethodsTest.java index <HASH>..<HASH> 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/AutoValueFinalMethodsTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/AutoValueFinalMethodsTest.java @@ -163,4 +163,29 @@ public class AutoValueFinalMethodsTest { "}") .doTest(); } + + @Test + public void testDiagnosticStringWithMultipleMethodMatches() { + compilationHelper + .addSourceLines( + "out/Test.java", + "import com.google.auto.value.AutoValue;", + "import com.google.auto.value.extension.memoized.Memoized;", + "@AutoValue", + "abstract class Test {", + " static Test create() {", + " return null;", + " }", + " @Override", + " // BUG: Diagnostic contains: Make equals, hashCode final in AutoValue classes", + " public boolean equals(Object obj) {", + " return true;", + " }", + " @Override", + " public int hashCode() {", + " return 1;", + " }", + "}") + .doTest(); + } }
Add test for Diagnostic String with multiple method matches for AutoValueFinalMethods check RELNOTES: N/A ------------- Created by MOE: <URL>
google_error-prone
train
java
48586eda4b1e16c573eace31c546d6e7ec866862
diff --git a/tests/FiniteStateMachine/VerifyLogTest.php b/tests/FiniteStateMachine/VerifyLogTest.php index <HASH>..<HASH> 100644 --- a/tests/FiniteStateMachine/VerifyLogTest.php +++ b/tests/FiniteStateMachine/VerifyLogTest.php @@ -263,23 +263,6 @@ class Fsm_VerifyLogTest extends FsmTestCase $this->assertExceptionMessage($stateSet, $log, 'index', $logRecordIndex); } - protected function _provideLogsWithSpecificValues($key, $values) - { - $argumentSets = array(); - $templateArgumentSets = $this->provideValidLogs(); - foreach ($values as $value) { - $templateArgumentSetIndex = rand(0, sizeof($templateArgumentSets) - 1); - $argumentSet = $templateArgumentSets[$templateArgumentSetIndex]; - $log = &$argumentSet['log']; - $logIndex = rand(0, sizeof($log) - 1); - $log[$logIndex][$key] = $value; - unset($log); - $argumentSet['logRecordIndex'] = $logIndex; - $argumentSets[] = $argumentSet; - } - return $argumentSets; - } - public function provideValidLogs() { $stateSet = $this->_getBillingStateSet();
#<I>: Fsm_VerifyLogTest::_provideLogsWithSpecificValues() has been eliminated
tourman_fsm
train
php
3e842559427746eb9051ce5ee3cd36caeff303a3
diff --git a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +++ b/activerecord/lib/active_record/attribute_methods/before_type_cast.rb @@ -13,7 +13,7 @@ module ActiveRecord # Returns a hash of attributes before typecasting and deserialization. def attributes_before_type_cast - Hash[attribute_names.map { |name| [name, read_attribute_before_type_cast(name)] }] + @attributes end private
attributes_before_type_cast are just the value of @attributes
rails_rails
train
rb
a01c9e0742425c7a68a09aedcc970f202bcdb0ef
diff --git a/lib/cloudstack-nagios/commands/system_vm.rb b/lib/cloudstack-nagios/commands/system_vm.rb index <HASH>..<HASH> 100644 --- a/lib/cloudstack-nagios/commands/system_vm.rb +++ b/lib/cloudstack-nagios/commands/system_vm.rb @@ -180,6 +180,30 @@ class SystemVm < CloudstackNagios::Base end end + desc "uptime", "return uptime" + def uptime + begin + host = systemvm_host + uptime_sec = 0 + on host do |h| + uptime_sec = capture('cat /proc/uptime').split[0].to_f + end + + if uptime_sec < options[:critical] + code = 2 + elsif uptime_sec < options[:warning] + code = 1 + else + code = 0 + end + + puts "UPTIME #{RETURN_CODES[code]} #{uptime_sec}s | uptime=#{uptime_sec}" + exit code + rescue => e + exit_with_failure(e) + end + end + desc "active_ftp", "make sure conntrack_ftp and nf_nat_ftp modules are loaded" def active_ftp begin
add feature check uptime (#6)
swisstxt_cloudstack-nagios
train
rb
268954629358ff540fa2dbef19a0fd88fa503515
diff --git a/spec/functional/mongoid/criterion/inclusion_spec.rb b/spec/functional/mongoid/criterion/inclusion_spec.rb index <HASH>..<HASH> 100644 --- a/spec/functional/mongoid/criterion/inclusion_spec.rb +++ b/spec/functional/mongoid/criterion/inclusion_spec.rb @@ -26,6 +26,36 @@ describe Mongoid::Criterion::Inclusion do describe "#any_in" do + context "when querying on foreign keys" do + + context "when not using object ids" do + + before(:all) do + Person.identity :type => String + end + + after(:all) do + Person.identity :type => BSON::ObjectId + end + + let!(:person) do + Person.create(:ssn => "123-11-1111") + end + + let!(:account) do + person.create_account(:name => "test") + end + + let(:from_db) do + Account.any_in(:person_id => [ person.id ]) + end + + it "returns the correct results" do + from_db.should eq([ account ]) + end + end + end + context "when chaining after a where" do let!(:person) do
Include provided spec with #<I> to show behaviour is correct. Closes #<I>.
mongodb_mongoid
train
rb
2aff1d8d273ca0ec329f80feb4f23eca97d2157d
diff --git a/src/uncss.js b/src/uncss.js index <HASH>..<HASH> 100644 --- a/src/uncss.js +++ b/src/uncss.js @@ -215,7 +215,7 @@ function init(files, options, callback) { options ); - process(options).then(([css, report]) => callback(null, css, report), callback); + return process(options).then(([css, report]) => callback(null, css, report), callback); } function processAsPostCss(options, pages) {
Return the promises to the caller (#<I>)
uncss_uncss
train
js
e989d8ffd0261a5263b9d91dc37efcb33f5d862c
diff --git a/azkaban-common/src/main/java/azkaban/project/ProjectManager.java b/azkaban-common/src/main/java/azkaban/project/ProjectManager.java index <HASH>..<HASH> 100644 --- a/azkaban-common/src/main/java/azkaban/project/ProjectManager.java +++ b/azkaban-common/src/main/java/azkaban/project/ProjectManager.java @@ -80,6 +80,7 @@ public class ProjectManager { // initialize itself. Props prop = new Props(props); prop.put(ValidatorConfigs.PROJECT_ARCHIVE_FILE_PATH, "initialize"); + new XmlValidatorManager(prop); loadAllProjects(); }
Validate the configurations of the validator plugins when the Azkaban web server starts.
azkaban_azkaban
train
java
d0a55852a48326ae0547a43c5a54cd3c33f3c5ed
diff --git a/src/org/zaproxy/zap/extension/api/API.java b/src/org/zaproxy/zap/extension/api/API.java index <HASH>..<HASH> 100644 --- a/src/org/zaproxy/zap/extension/api/API.java +++ b/src/org/zaproxy/zap/extension/api/API.java @@ -303,7 +303,7 @@ public class API { List<String> mandatoryParams = other.getMandatoryParamNames(); if (mandatoryParams != null) { for (String param : mandatoryParams) { - if (params.getString(param) == null || params.getString(param).length() == 0) { + if (!params.has(param) || params.getString(param).length() == 0) { throw new ApiException(ApiException.Type.MISSING_PARAMETER, param); } }
Issue <I> - JSONException while calling an API "other" without the required parameter(s) Changed to check if the parameter exists (instead of getting it).
zaproxy_zaproxy
train
java
c9756c8f930a0671097336a6c5dfc7f79410b8a3
diff --git a/js/ascendex.js b/js/ascendex.js index <HASH>..<HASH> 100644 --- a/js/ascendex.js +++ b/js/ascendex.js @@ -2295,7 +2295,6 @@ module.exports = class ascendex extends Exchange { 'notionalCap': this.safeNumber (bracket, 'positionNotionalUpperBound'), 'maintenanceMarginRatio': this.parseNumber (maintenanceMarginRatio), 'maxLeverage': this.parseNumber (Precise.stringDiv ('1', maintenanceMarginRatio)), - 'maintenanceAmount': undefined, 'info': bracket, }); }
removed maintenanceAmount from fetchLeverageTiers
ccxt_ccxt
train
js
e15549fca5e0edbb40a61b1b08329e6232672192
diff --git a/example/test-coverage.js b/example/test-coverage.js index <HASH>..<HASH> 100755 --- a/example/test-coverage.js +++ b/example/test-coverage.js @@ -20,5 +20,9 @@ exec(sprintf('NODE_PATH=lib-cov %s/bin/whiskey --tests %s/example/test-success-w process.exit(5); } + if (err && err.code !== 0) { + process.exit(5); + } + process.exit(0); });
Exit with non-zero if Whiskey exists with non-zero.
cloudkick_whiskey
train
js
540512ce26ad2eb9a9da6d6b7eed3b77e89d5639
diff --git a/tests/instancemethods_test.py b/tests/instancemethods_test.py index <HASH>..<HASH> 100644 --- a/tests/instancemethods_test.py +++ b/tests/instancemethods_test.py @@ -259,6 +259,22 @@ class TestEnsureStubsAreUsed: verifyStubbedInvocationsAreUsed(dog) + @pytest.mark.xfail(reason='Not implemented.') + def testPassIfVerifiedZeroInteractions(self): + dog = mock() + when(dog).waggle(1).thenReturn('Sure') + verifyZeroInteractions(dog) + + verifyStubbedInvocationsAreUsed(dog) + + @pytest.mark.xfail(reason='Not implemented.') + def testPassIfVerifiedNoMoreInteractions(self): + dog = mock() + when(dog).waggle(1).thenReturn('Sure') + verifyNoMoreInteractions(dog) + + verifyStubbedInvocationsAreUsed(dog) + def testWildacardCallSignatureOnStub(self): dog = mock() when(dog).waggle(Ellipsis).thenReturn('Sure')
Stash two xfail tests around `verifyStubbedInvocationsAreUsed`
kaste_mockito-python
train
py
05cf61c1a9043f6f37e89ac1dbd58d8fe779328b
diff --git a/dagobah/core/core.py b/dagobah/core/core.py index <HASH>..<HASH> 100644 --- a/dagobah/core/core.py +++ b/dagobah/core/core.py @@ -116,6 +116,9 @@ class Dagobah(object): for to_node in to_nodes: job.add_dependency(from_node, to_node) + if job_json.get('notes', None): + job.update_job_notes(job_json['notes']) + def commit(self, cascade=False): @@ -418,7 +421,7 @@ class Job(DAG): self.parent.commit(cascade=True) - def update_job_notes(self, job_name, notes): + def update_job_notes(self, notes): if not self.state.allow_edit_job: raise DagobahError('job cannot be edited in its current state') diff --git a/dagobah/daemon/api.py b/dagobah/daemon/api.py index <HASH>..<HASH> 100644 --- a/dagobah/daemon/api.py +++ b/dagobah/daemon/api.py @@ -368,7 +368,7 @@ def update_job_notes(): abort(400) job = dagobah.get_job(args['job_name']) - job.update_job_notes(args['job_name'], args['notes']) + job.update_job_notes(args['notes']) @app.route('/api/edit_task', methods=['POST'])
Fixing dagobahd restart error where notes were not re-loaded from the DB
thieman_dagobah
train
py,py
f4fdc769827b92d0a25d5103813e184eca415380
diff --git a/bin/tag.js b/bin/tag.js index <HASH>..<HASH> 100644 --- a/bin/tag.js +++ b/bin/tag.js @@ -24,7 +24,14 @@ module.exports = function (callback) { } exec('git push --tags', function (err) { - return callback(err); + if(err) { + return callback(err); + } + + exec('npm publish', function (err) { + return callback(err); + }); + }); }); };
npm publish after successful git tag
addthis_fluxthis
train
js
3368cf56616f9126dfd6636c59678378e2ae846e
diff --git a/datanommer.models/tests/test_model.py b/datanommer.models/tests/test_model.py index <HASH>..<HASH> 100644 --- a/datanommer.models/tests/test_model.py +++ b/datanommer.models/tests/test_model.py @@ -168,17 +168,22 @@ class TestModels(unittest.TestCase): def test_add_empty(self): datanommer.models.add(dict()) - @raises(KeyError) def test_add_missing_i(self): msg = copy.deepcopy(scm_message) del msg['i'] datanommer.models.add(msg) + dbmsg = datanommer.models.Message.query.first() + self.assertEqual(dbmsg.i, 0) - @raises(KeyError) def test_add_missing_timestamp(self): msg = copy.deepcopy(scm_message) del msg['timestamp'] datanommer.models.add(msg) + dbmsg = datanommer.models.Message.query.first() + timediff = datetime.datetime.now() - dbmsg.timestamp + # 10 seconds between adding the message and checking + # the timestamp should be more than enough. + self.assertTrue(timediff < datetime.timedelta(seconds=10)) def test_add_many_and_count_statements(self): statements = []
update tests to account for more flexible message formats Since we now supply defaults for some fedmsg-specific fields, tests that were previously expected to fail are now succeeding. Update the tests to be consistent with the way we now process messages.
fedora-infra_datanommer
train
py
a076345c68b20546f45dda0de7e25e7b947dc9ac
diff --git a/pymc/distributions.py b/pymc/distributions.py index <HASH>..<HASH> 100755 --- a/pymc/distributions.py +++ b/pymc/distributions.py @@ -202,11 +202,11 @@ def new_dist_class(*new_class_args): pv = [np.shape(value(v)) for v in parents.values()] biggest_parent = np.argmax([np.prod(v) for v in pv]) parents_shape = pv[biggest_parent] - + # Scalar parents can support any shape. if np.prod(parents_shape) <= 1: parents_shape = None - + else: parents_shape = None
Re-rendered metastability and mixing figures as pdfs git-svn-id: <URL>
pymc-devs_pymc
train
py
45348c119fd06b92f5e103b77465b87d1f7adedf
diff --git a/salt/grains/core.py b/salt/grains/core.py index <HASH>..<HASH> 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -1332,7 +1332,14 @@ def os_data(): if os.path.exists('/proc/1/cmdline'): with salt.utils.fopen('/proc/1/cmdline') as fhr: init_cmdline = fhr.read().replace('\x00', ' ').split() - init_bin = salt.utils.which(init_cmdline[0]) + try: + init_bin = salt.utils.which(init_cmdline[0]) + except IndexError: + # Emtpy init_cmdline + init_bin = None + log.warning( + "Unable to fetch data from /proc/1/cmdline" + ) if init_bin is not None and init_bin.endswith('bin/init'): supported_inits = (six.b('upstart'), six.b('sysvinit'), six.b('systemd')) edge_len = max(len(x) for x in supported_inits) - 1
Catch a possible error, especially trigered in unit tests
saltstack_salt
train
py
a5836e73ba42259103f122c3dde4d9b72786223a
diff --git a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityScheduler.java b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityScheduler.java index <HASH>..<HASH> 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityScheduler.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityScheduler.java @@ -471,7 +471,7 @@ public class SingularityScheduler { stateCache.getActiveTaskIds().remove(taskId); } - if (task.isPresent() && task.get().getTaskRequest().getRequest().isLoadBalanced()) { + if (task.isPresent() && task.get().getTaskRequest().getRequest().isLoadBalanced() || !task.isPresent()) { taskManager.createLBCleanupTask(taskId); }
still add to lb cleanup queue in the case where task is not found
HubSpot_Singularity
train
java
f9ae1d5e72d14343e057534f128deb5656e738d4
diff --git a/lib/gcli/types/date.js b/lib/gcli/types/date.js index <HASH>..<HASH> 100644 --- a/lib/gcli/types/date.js +++ b/lib/gcli/types/date.js @@ -111,9 +111,7 @@ DateType.prototype.decrement = function(value) { }; DateType.prototype.increment = function(value) { - console.log('increment!'); if (!this._isValidDate(value)) { - console.log('invalid anyway'); return this._getDefault(); } var newValue = new Date(value);
date-<I>: Remove two console.log used for debugging
joewalker_gcli
train
js
9ccd95e120961f505408ba234a52e77cd995cfc0
diff --git a/test/integration/imagechange_buildtrigger_test.go b/test/integration/imagechange_buildtrigger_test.go index <HASH>..<HASH> 100644 --- a/test/integration/imagechange_buildtrigger_test.go +++ b/test/integration/imagechange_buildtrigger_test.go @@ -1,6 +1,8 @@ package integration import ( + "testing" + authorizationapi "github.com/openshift/origin/pkg/authorization/api" buildapi "github.com/openshift/origin/pkg/build/api" "github.com/openshift/origin/pkg/client" @@ -12,7 +14,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" watchapi "k8s.io/apimachinery/pkg/watch" kapi "k8s.io/kubernetes/pkg/api" - "testing" ) const ( @@ -310,7 +311,7 @@ func runTest(t *testing.T, testname string, projectAdminClient *client.Client, i } event = <-buildWatch.ResultChan() if e, a := watchapi.Modified, event.Type; e != a { - t.Fatalf("expected watch event type %s, got %s", e, a) + t.Fatalf("expected watch event type %s, got %s: %#v", e, a, event.Object) } newBuild = event.Object.(*buildapi.Build) // Make sure the resolution of the build's docker image pushspec didn't mutate the persisted API object
Add logging to imagechange build trigger
openshift_origin
train
go
dfaa60155d2d7b20d5e9648feb59319c030856af
diff --git a/lxd/project/permissions.go b/lxd/project/permissions.go index <HASH>..<HASH> 100644 --- a/lxd/project/permissions.go +++ b/lxd/project/permissions.go @@ -134,6 +134,37 @@ func checkRestrictionsOnVolatileConfig(project *api.Project, instanceType instan return nil } +// AllowVolumeCreation returns an error if any project-specific limit or +// restriction is violated when creating a new custom volume in a project. +func AllowVolumeCreation(tx *db.ClusterTx, projectName string, req api.StorageVolumesPost) error { + info, err := fetchProject(tx, projectName, true) + if err != nil { + return err + } + + if info == nil { + return nil + } + + // If "limits.disk" is not set, there's nothing to do. + if info.Project.Config["limits.disk"] == "" { + return nil + } + + // Add the volume being created. + info.Volumes = append(info.Volumes, db.StorageVolumeArgs{ + Name: req.Name, + Config: req.Config, + }) + + err = checkRestrictionsAndAggregateLimits(tx, info) + if err != nil { + return err + } + + return nil +} + // Check that we would not violate the project limits or restrictions if we // were to commit the given instances and profiles. func checkRestrictionsAndAggregateLimits(tx *db.ClusterTx, info *projectInfo) error {
lxd/project: Add AllowVolumeCreation() to check limits upon volume creation
lxc_lxd
train
go