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
dbe062993a9868eb71e30cb382ce4da02406d59d
diff --git a/src/Zerg/DataSet.php b/src/Zerg/DataSet.php index <HASH>..<HASH> 100644 --- a/src/Zerg/DataSet.php +++ b/src/Zerg/DataSet.php @@ -48,13 +48,13 @@ class DataSet implements \ArrayAccess, \Iterator */ public function setData(array $data) { - $this->data = (array) $data; + $this->data = $data; } /** * Move into a level. * - * @param string $level The level to move into. + * @param string|int $level The level to move into. */ public function push($level) { @@ -72,8 +72,8 @@ class DataSet implements \ArrayAccess, \Iterator /** * Set a value in the current level. * - * @param string $name The name of the value to add. - * @param string $value The value to add. + * @param string|int $name The name of the value to add. + * @param mixed $value The value to add. */ public function setValue($name, $value) { @@ -94,7 +94,7 @@ class DataSet implements \ArrayAccess, \Iterator /** * Get a value by name from the current level. * - * @param string $name The name of the value to retrieve. + * @param string|int $name The name of the value to retrieve. * @return mixed The found value. Returns null if the value cannot be found. */ public function getValue($name)
fix docs and remove unnecessary casting
klermonte_zerg
train
php
1121ad08502bd1a76887f44df06ba5539866283c
diff --git a/event.go b/event.go index <HASH>..<HASH> 100644 --- a/event.go +++ b/event.go @@ -151,7 +151,7 @@ func NewEntry(id EventID, e Event) Entry { return Entry{ EventID: id, Schema: e.Schema(), - Time: time.Now(), + Time: time.Now().In(time.UTC), Host: host, Deploy: deploy, PID: pid, diff --git a/event_test.go b/event_test.go index <HASH>..<HASH> 100644 --- a/event_test.go +++ b/event_test.go @@ -198,6 +198,10 @@ func TestNewEntry(t *testing.T) { t.Errorf("Unexpectedly old timestamp: %v", e.Time) } + if e.Time.Location() != time.UTC { + t.Errorf("Unexpectedly non-UTC timestamp: %v", e.Time) + } + if e.Host == "" { t.Errorf("Blank hostname for meta data") }
Always use UTC for timestamps.
codahale_lunk
train
go,go
2dd0cd36828f47b667414bbc4a002fbfdb8b28be
diff --git a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java b/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java index <HASH>..<HASH> 100644 --- a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java +++ b/draggablepanel/src/main/java/com/github/pedrovgs/DraggableListener.java @@ -20,12 +20,12 @@ package com.github.pedrovgs; */ public interface DraggableListener { - public void onMaximized(); + void onMaximized(); - public void onMinimized(); + void onMinimized(); - public void onClosedToLeft(); + void onClosedToLeft(); - public void onClosedToRight(); + void onClosedToRight(); }
Remove public modifier from DraggableListener interface
pedrovgs_DraggablePanel
train
java
1ab314ad7052c7ed14a314ef896820caafb3389d
diff --git a/nunaliit2-js/src/main/js/nunaliit2/n2.mapAndControls.js b/nunaliit2-js/src/main/js/nunaliit2/n2.mapAndControls.js index <HASH>..<HASH> 100644 --- a/nunaliit2-js/src/main/js/nunaliit2/n2.mapAndControls.js +++ b/nunaliit2-js/src/main/js/nunaliit2/n2.mapAndControls.js @@ -4808,7 +4808,15 @@ var MapAndControls = $n2.Class({ * This is called when the map has moved. */ _mapMoved: function(){ + var _this = this; + + if( this.mapWasMoved ) return; + this.mapWasMoved = true; + setTimeout(function(){ + _this.mapWasMoved = false; + _this._refreshSimplifiedGeometries(); + },200); }, /*
nunaliit2-js: In map and controls, refresh simplified geometries when map is moved. Issue #<I>
GCRC_nunaliit
train
js
f5bb106543d019fa90c227c7f4fc6113d12617ee
diff --git a/alerta/app/auth.py b/alerta/app/auth.py index <HASH>..<HASH> 100644 --- a/alerta/app/auth.py +++ b/alerta/app/auth.py @@ -121,7 +121,10 @@ def google(): r = requests.get(people_api_url, headers=headers) profile = json.loads(r.text) - token = create_token(profile['sub'], profile['name'], profile['email'], provider='google') + try: + token = create_token(profile['sub'], profile['name'], profile['email'], provider='google') + except KeyError: + return jsonify(status="error", message="Google+ API is not enabled for this Client ID") return jsonify(token=token)
catch exception when Google+ API is not enabled
alerta_alerta
train
py
6501613cba7dcf6c6fdbaa32d0f554b811642ee7
diff --git a/indra/explanation/paths_graph.py b/indra/explanation/paths_graph.py index <HASH>..<HASH> 100644 --- a/indra/explanation/paths_graph.py +++ b/indra/explanation/paths_graph.py @@ -288,8 +288,7 @@ def sample_single_path(pg, source, target, signed=False, target_polarity=0, out_edges = pg.out_edges(current_node, data=True) else: out_edges = pg.out_edges(current_node) - if sys.version_info.major == 3: - out_edges = sorted(out_edges) + out_edges.sort() if out_edges: if weighted: weights = [t[2]['weight'] for t in out_edges]
Change to useing .sort() to accomodate py2.
sorgerlab_indra
train
py
11698a69c2129aaa4a7b7bc001f5414d25f3148d
diff --git a/web2/htdocs/js/lib.js b/web2/htdocs/js/lib.js index <HASH>..<HASH> 100644 --- a/web2/htdocs/js/lib.js +++ b/web2/htdocs/js/lib.js @@ -290,6 +290,16 @@ })(); // }}} + /*************************************************** + website() - Return the base URL of this SHIELD, per document.location + ***************************************************/ + exported.website = function () { // {{{ + return document.location.toString().replace(/#.*/, '').replace(/\/$/, ''); + } + // }}} + + + /*************************************************** $(...).serializeObject()
Put website() function back into js code authentication provider configuration could not be shown in the UI because this function was missing. It's back now.
starkandwayne_shield
train
js
82f18c3213c0f64be1cf9e2f4d6d19fd0f427b75
diff --git a/keanu-python/tests/test_net.py b/keanu-python/tests/test_net.py index <HASH>..<HASH> 100644 --- a/keanu-python/tests/test_net.py +++ b/keanu-python/tests/test_net.py @@ -24,7 +24,7 @@ def test_construct_bayes_net() -> None: ("get_observed_vertices", False, True, True, True), ("get_continuous_latent_vertices", True, False, True, False), ("get_discrete_latent_vertices", True, False, False, True)]) -def test_can_get_vertices_from_bayes_net(get_method, latent, observed, continuous, discrete) -> None: +def test_can_get_vertices_from_bayes_net(get_method: str, latent: bool, observed: bool, continuous: bool, discrete: bool) -> None: gamma = Gamma(1., 1.) gamma.observe(0.5)
annotate a test in test_net which I missed
improbable-research_keanu
train
py
9877cf329c78233886903445c8a386f5004f40ae
diff --git a/scripts/search-job-messages.py b/scripts/search-job-messages.py index <HASH>..<HASH> 100644 --- a/scripts/search-job-messages.py +++ b/scripts/search-job-messages.py @@ -1,7 +1,7 @@ # Submits search job, waits for completion, then prints and emails _messages_ # (as opposed to records). Pass the query via stdin. # -# cat query.sumoql | python search-job.py <accessId> <accessKey> \ +# cat query.sumoql | python search-job-messages.py <accessId> <accessKey> \ # <fromDate> <toDate> <timeZone> # # Note: fromDate and toDate must be either ISO 8601 date-times or epoch @@ -9,7 +9,7 @@ # # Example: # -# cat query.sumoql | python search-job.py <accessId> <accessKey> \ +# cat query.sumoql | python search-job-messages.py <accessId> <accessKey> \ # 1408643380441 1408649380441 PST import json
renamed file in example search-job.py -> search-job-messages.py
SumoLogic_sumologic-python-sdk
train
py
7905d13f53c88cef056289e11df93ed234daf35e
diff --git a/huey/bin/huey_consumer.py b/huey/bin/huey_consumer.py index <HASH>..<HASH> 100755 --- a/huey/bin/huey_consumer.py +++ b/huey/bin/huey_consumer.py @@ -91,7 +91,7 @@ def load_huey(path): raise -if __name__ == '__main__': +def consumer_main(): parser = get_option_parser() options, args = parser.parse_args() @@ -115,3 +115,7 @@ if __name__ == '__main__': options.scheduler_interval, options.periodic_task_interval) consumer.run() + + +if __name__ == '__main__': + consumer_main() diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -24,5 +24,9 @@ setup( 'Framework :: Django', ], test_suite='runtests.runtests', - scripts = ['huey/bin/huey_consumer.py'], + entry_points={ + 'console_scripts': [ + 'huey_consumer = huey.bin.huey_consumer:consumer_main' + ] + } )
Change how heuy_consumer is started This fixes #<I> The logic behind this is that other programs that would like to reuse huey can now do: from huey.bin.huey_consumer import consumer_main and thus include consumer main as a sub command. Also, setuptools takes care of properly instaling scripts in windows and virtual environments.
coleifer_huey
train
py,py
bb89e949e88d5e2a0c2c56ebb27e990164fa96dc
diff --git a/pyrogram/client/methods/messages/send_dice.py b/pyrogram/client/methods/messages/send_dice.py index <HASH>..<HASH> 100644 --- a/pyrogram/client/methods/messages/send_dice.py +++ b/pyrogram/client/methods/messages/send_dice.py @@ -38,7 +38,7 @@ class SendDice(BaseClient): "pyrogram.ForceReply" ] = None ) -> Union["pyrogram.Message", None]: - """Send a dice. + """Send a dice with a random value from 1 to 6. Parameters: chat_id (``int`` | ``str``): @@ -47,8 +47,8 @@ class SendDice(BaseClient): For a contact that exists in your Telegram address book you can use his phone number (str). emoji (``str``, *optional*): - Emoji on which the dice throw animation is based. Currently, must be one of "🎲" or "🎯". - Defauts to "🎲". + Emoji on which the dice throw animation is based. Currently, must be one of "🎲", "🎯" or "🏀". + Defaults to "🎲". disable_notification (``bool``, *optional*): Sends the message silently. @@ -75,6 +75,9 @@ class SendDice(BaseClient): # Send a dart app.send_dice("pyrogramlounge", "🎯") + + # Send a basketball + app.send_dice("pyrogramlounge", "🏀") """ r = self.send(
Update send_dice: add basketball "dice"
pyrogram_pyrogram
train
py
295796d9991d81107e11d8fd6bee43fd3e1c4f49
diff --git a/geopackage-sdk/src/main/java/mil/nga/geopackage/user/UserCursor.java b/geopackage-sdk/src/main/java/mil/nga/geopackage/user/UserCursor.java index <HASH>..<HASH> 100644 --- a/geopackage-sdk/src/main/java/mil/nga/geopackage/user/UserCursor.java +++ b/geopackage-sdk/src/main/java/mil/nga/geopackage/user/UserCursor.java @@ -233,6 +233,9 @@ public abstract class UserCursor<TColumn extends UserColumn, TTable extends User // If requery has not been performed, a requery dao has been set, and there are invalid positions if (invalidCursor == null && dao != null && hasInvalidPositions()) { + // Close the original cursor when performing an invalid cursor query + super.close(); + // Set the blob columns to return as null List<TColumn> blobColumns = dao.getTable().columnsOfType(GeoPackageDataType.BLOB); String[] columnsAs = dao.buildColumnsAsNull(blobColumns);
close the user cursor when performing the invalid rows cursor query
ngageoint_geopackage-android
train
java
49a5b408c9e23b937e93f6355b7b0a49a4a23184
diff --git a/activesupport/lib/active_support/file_evented_update_checker.rb b/activesupport/lib/active_support/file_evented_update_checker.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/file_evented_update_checker.rb +++ b/activesupport/lib/active_support/file_evented_update_checker.rb @@ -1,6 +1,8 @@ require 'listen' require 'set' require 'pathname' +require 'thread' +require 'concurrent/atomic/atomic_boolean' module ActiveSupport class FileEventedUpdateChecker #:nodoc: all @@ -14,22 +16,24 @@ module ActiveSupport end @block = block - @updated = false + @updated = Concurrent::AtomicBoolean.new(false) @lcsp = @ph.longest_common_subpath(@dirs.keys) if (dtw = directories_to_watch).any? Listen.to(*dtw, &method(:changed)).start end + + @mutex = Mutex.new end def updated? - @updated + @updated.true? end def execute @block.call ensure - @updated = false + @updated.make_false end def execute_if_updated @@ -42,8 +46,10 @@ module ActiveSupport private def changed(modified, added, removed) - unless updated? - @updated = (modified + added + removed).any? { |f| watching?(f) } + @mutex.synchronize do + unless updated? + @updated.value = (modified + added + removed).any? { |f| watching?(f) } + end end end
make the @updated flag atomic in the evented monitor listen is calling us from its own thread, we need to synchronize reads and writes to this flag.
rails_rails
train
rb
9480cf8dda68bbe9005b27daeb70273b4375e0a1
diff --git a/examples/arrays.js b/examples/arrays.js index <HASH>..<HASH> 100644 --- a/examples/arrays.js +++ b/examples/arrays.js @@ -21,9 +21,9 @@ console.log($.nullArray(10)); console.log($.range(5)); -/* creating a pre-initialized array with values ranging from x to y) +/* creating a pre-initialized array with values ranging from x to y) */ -console.log($.range(2.7)); +console.log($.range(2,7)); /* finding only the even numbers in an array */
Update example writing mistake & forgotten comments
ansuz_ansuzjs
train
js
a3bbe160fc748dc5095b3a9cdc75e98659153f82
diff --git a/salt/modules/saltcheck.py b/salt/modules/saltcheck.py index <HASH>..<HASH> 100644 --- a/salt/modules/saltcheck.py +++ b/salt/modules/saltcheck.py @@ -52,7 +52,7 @@ import os import time import yaml try: - # import salt.utils + import salt.utils import salt.client import salt.exceptions except ImportError:
uncommented salt.utils import
saltstack_salt
train
py
acf839f89ecc695fbbf930ee989698a33d1ff623
diff --git a/saunter/testcase/webdriver.py b/saunter/testcase/webdriver.py index <HASH>..<HASH> 100644 --- a/saunter/testcase/webdriver.py +++ b/saunter/testcase/webdriver.py @@ -69,6 +69,7 @@ class SaunterTestCase(BaseTestCase): """ self.verificationErrors = [] self.cf = saunter.ConfigWrapper.ConfigWrapper().config + self.config = self.cf if self.cf.getboolean("SauceLabs", "ondemand"): desired_capabilities = { "platform": self.cf.get("SauceLabs", "os"),
no idea why i used .cf rather than .config as that is what i always try to type
Element-34_py.saunter
train
py
2f3a9cd76c0a77af6b225896d1e66632917c6e1a
diff --git a/lib/travis/notification/publisher/redis.rb b/lib/travis/notification/publisher/redis.rb index <HASH>..<HASH> 100644 --- a/lib/travis/notification/publisher/redis.rb +++ b/lib/travis/notification/publisher/redis.rb @@ -15,7 +15,8 @@ module Travis def publish(event) payload = MultiJson.encode(event) - list = 'events:' << event[:uuid] + # list = 'events:' << event[:uuid] + lit = 'events' redis.publish list, payload
publish instrumentation events to redis "events" for now, got issues with pattern matching?
travis-ci_travis-core
train
rb
91b3550ab8e47b36e5904fa7f2a4465f2a298c78
diff --git a/code/GridFieldOrderableRows.php b/code/GridFieldOrderableRows.php index <HASH>..<HASH> 100755 --- a/code/GridFieldOrderableRows.php +++ b/code/GridFieldOrderableRows.php @@ -45,6 +45,7 @@ class GridFieldOrderableRows extends RequestHandler implements * @param string $sortField */ public function __construct($sortField = 'Sort') { + parent::__construct(); $this->sortField = $sortField; } @@ -351,6 +352,8 @@ class GridFieldOrderableRows extends RequestHandler implements )); } } + + $this->extend('onAfterReorderItems', $list); } protected function populateSortValues(DataList $list) {
Add extension hook after re-ordering items
symbiote_silverstripe-gridfieldextensions
train
php
99c3c4979b0eb906b8c4c532897928268b11d83b
diff --git a/django_countries/fields.py b/django_countries/fields.py index <HASH>..<HASH> 100644 --- a/django_countries/fields.py +++ b/django_countries/fields.py @@ -103,6 +103,8 @@ class Country(object): flag_url = settings.COUNTRIES_FLAG_URL url = flag_url.format( code_upper=self.code, code=self.code.lower()) + if not url: + return '' url = urlparse.urljoin(settings.STATIC_URL, url) return self.maybe_escape(url) diff --git a/django_countries/tests/test_fields.py b/django_countries/tests/test_fields.py index <HASH>..<HASH> 100644 --- a/django_countries/tests/test_fields.py +++ b/django_countries/tests/test_fields.py @@ -8,7 +8,7 @@ from django.utils import translation from django.utils.encoding import force_text try: from unittest import skipIf -except: +except ImportError: from django.utils.unittest import skipIf from django_countries import fields, countries @@ -216,6 +216,10 @@ class TestCountryObject(TestCase): country = fields.Country(code='XX') self.assertEqual(country.numeric_padded, None) + def test_empty_flag_url(self): + country = fields.Country(code='XX', flag_url='') + self.assertEqual(country.flag, '') + class TestModelForm(TestCase):
If empty flag_url is given to a Country object, flag should be blank
SmileyChris_django-countries
train
py,py
80ccba4361e6b57ecda2663aa019ae09d75a04d4
diff --git a/test_howdoi.py b/test_howdoi.py index <HASH>..<HASH> 100644 --- a/test_howdoi.py +++ b/test_howdoi.py @@ -54,8 +54,7 @@ class HowdoiTestCase(unittest.TestCase): first_answer = self.call_howdoi(query) second_answer = self.call_howdoi(query + ' -a') self.assertNotEqual(first_answer, second_answer) - self.assertIn("Answer from http://stackoverflow.com", - second_answer) + self.assertTrue("Answer from http://stackoverflow.com" in second_answer) def test_multiple_answers(self): query = self.queries[0]
Fix for test in Python <I>
gleitz_howdoi
train
py
12e19bd01841b796d70bd7becb2f35e4d15bda48
diff --git a/examples/as_example1.js b/examples/as_example1.js index <HASH>..<HASH> 100644 --- a/examples/as_example1.js +++ b/examples/as_example1.js @@ -44,11 +44,11 @@ function echo(context, req, head, body, callback) { server.listen(4040, '127.0.0.1', onListening); function onListening() { - client = client.makeSubChannel({ + var clientChan = client.makeSubChannel({ serviceName: 'server', peers: [server.hostPort] }); - tchannelJSON.send(client.request({ + tchannelJSON.send(clientChan.request({ headers: { cn: 'client' },
Trivial rename in examples
uber_tchannel-node
train
js
0ce557c661e87c6f6b523d26517653855a57e3d2
diff --git a/lib/bandcamp/methodical.rb b/lib/bandcamp/methodical.rb index <HASH>..<HASH> 100644 --- a/lib/bandcamp/methodical.rb +++ b/lib/bandcamp/methodical.rb @@ -1,13 +1,15 @@ -module Methodical +module BandCamp + module Methodical - def to_methods hash - eigenclass = class << self; self; end - hash.each_pair do |key, val| - eigenclass.instance_eval { attr_reader key.to_sym } - instance_variable_set("@#{key}".to_sym, val) + def to_methods hash + eigenclass = class << self; self; end + hash.each_pair do |key, val| + eigenclass.instance_eval { attr_reader key.to_sym } + instance_variable_set("@#{key}".to_sym, val) + end end - end - private :to_methods + private :to_methods + end end
Moved mixin into the BandCamp namespace.
sleepycat_bandcamp_api
train
rb
3c3e84e119fc1fa972e41235c6d48f2f520a898c
diff --git a/khard/address_book.py b/khard/address_book.py index <HASH>..<HASH> 100644 --- a/khard/address_book.py +++ b/khard/address_book.py @@ -67,13 +67,7 @@ class AddressBook(metaclass=abc.ABCMeta): :returns: the length of the shortes unequal initial substrings :rtype: int """ - sum = 0 - for char1, char2 in zip(uid1, uid2): - if char1 == char2: - sum += 1 - else: - break - return sum + return len(os.path.commonprefix((uid1, uid2))) def _search_all(self, query): """Search in all fields for contacts matching query.
Use stdlib to compare uids The os.path library provides a function to compare prefixes that can be used instead of the custom code.
scheibler_khard
train
py
efd4695076f51ff28a90c85d01ef2f3ee68e0460
diff --git a/lib/endpoint/overrides/deprecations.js b/lib/endpoint/overrides/deprecations.js index <HASH>..<HASH> 100644 --- a/lib/endpoint/overrides/deprecations.js +++ b/lib/endpoint/overrides/deprecations.js @@ -17,7 +17,7 @@ function deprecations (endpoints) { if (searchIssuesAndPullRequests) { const deprecated = Object.assign({}, searchIssuesAndPullRequests) deprecated.name = 'Search issues' - deprecated.idName = 'search' + deprecated.idName = 'issues' deprecated.deprecated = { date: '2018-12-27', message: '"Search issues" has been renamed to "Search issues and pull requests"',
build: idName search-issues -> issues (again :)
octokit_routes
train
js
8d56adf0f2043461a4b85a65981707121af3ecfb
diff --git a/sunevents-node.js b/sunevents-node.js index <HASH>..<HASH> 100644 --- a/sunevents-node.js +++ b/sunevents-node.js @@ -44,7 +44,7 @@ module.exports = function(RED) { node.events.on("sunevent", function(event, date) { var msg = {}; msg.topic = event; - msg.payload = {event: event, date: date}; + msg.payload = date; node.log(util.format("Injecting event %s for %s", event, date)); // send out the message to the rest of the workspace.
Changed payload to be a String containing the date time stamp of the sun event.
freakent_node-red-contrib-sunevents
train
js
ce4d149bf5a9afc791e50f0b88ca21b786b04c64
diff --git a/lib/nat/service.go b/lib/nat/service.go index <HASH>..<HASH> 100644 --- a/lib/nat/service.go +++ b/lib/nat/service.go @@ -85,7 +85,10 @@ func (s *Service) serve(ctx context.Context) { case <-timer.C: case <-s.processScheduled: if !timer.Stop() { - <-timer.C + select { + case <-timer.C: + default: + } } case <-ctx.Done(): timer.Stop()
lib/nat: Don't hang on draining timer chan (fixes #<I>) (#<I>)
syncthing_syncthing
train
go
e44e8c42053b7f9fd01934f523c897ee9dd4d262
diff --git a/lib/wlang/dialect/dispatching.rb b/lib/wlang/dialect/dispatching.rb index <HASH>..<HASH> 100644 --- a/lib/wlang/dialect/dispatching.rb +++ b/lib/wlang/dialect/dispatching.rb @@ -46,7 +46,8 @@ module WLang define_method(methname) do |buf, fns| args, rest = normalize_tag_fns(fns, arity) buf << code.bind(self).call(*args) - flush_trailing_fns(buf, rest) + flush_trailing_fns(buf, rest) unless rest.empty? + buf end dispatching_map[symbols] = ['', methname] else
Avoid unnecessary call to flush_trailing_fns
blambeau_wlang
train
rb
13dfe6efff151cbfc04c250933e2cacb5f531b18
diff --git a/theanets/graph.py b/theanets/graph.py index <HASH>..<HASH> 100644 --- a/theanets/graph.py +++ b/theanets/graph.py @@ -366,8 +366,8 @@ class Network(object): def add(s): h.update(str(s).encode('utf-8')) h = hashlib.md5() - # Use ordereddict to avoid creating different graphs with the save kwargs but different orders. - # See discussion at https://groups.google.com/forum/#!topic/theanets/nL6Nis29B7Q + # See discussions + # https://groups.google.com/forum/#!topic/theanets/nL6Nis29B7Q add(sorted(kwargs.items(), key=lambda x: x[0])) for l in self.layers: add('{}{}{}'.format(l.__class__.__name__, l.name, l.size))
shorten line length to pass the test
lmjohns3_theanets
train
py
a9fdf111d6c9d6d95f8f18c3ae66b1747981aab8
diff --git a/riak/client/__init__.py b/riak/client/__init__.py index <HASH>..<HASH> 100644 --- a/riak/client/__init__.py +++ b/riak/client/__init__.py @@ -38,6 +38,14 @@ from riak.util import deprecateQuorumAccessors from riak.util import lazy_property +def default_encoder(obj): + """ + Default encoder for JSON datatypes, which returns UTF-8 encoded + json instead of the default bloated \uXXXX escaped ASCII strings. + """ + return json.dumps(obj, ensure_ascii=False).encode("utf-8") + + @deprecateQuorumAccessors class RiakClient(RiakMapReduceChain, RiakClientOperations): """ @@ -91,8 +99,8 @@ class RiakClient(RiakMapReduceChain, RiakClientOperations): self._http_pool = RiakHttpPool(self, **transport_options) self._pb_pool = RiakPbcPool(self, **transport_options) - self._encoders = {'application/json': json.dumps, - 'text/json': json.dumps} + self._encoders = {'application/json': default_encoder, + 'text/json': default_encoder} self._decoders = {'application/json': json.loads, 'text/json': json.loads} self._buckets = WeakValueDictionary()
Switching JSON encoding to UTF-8. By default, python's JSON encoder will escape all non-ASCII characters, using a sequence of 6 bytes, for the sake of legacy non-UTF-8 compatible clients. This is a significant overhead in the case of non-ASCII string and can be reduced by using a modern encoding.
basho_riak-python-client
train
py
3f14e0a970effbaa83bf4fd809c92a15650723c2
diff --git a/browser/scrollTo.js b/browser/scrollTo.js index <HASH>..<HASH> 100644 --- a/browser/scrollTo.js +++ b/browser/scrollTo.js @@ -1,4 +1,5 @@ sb.include('effect'); +sb.include('browser.getScrollPosition'); /** @Name: sb.browser.scrollTo @Author: Paul Visco
added required include for getScrollPosition
surebert_surebert-framework
train
js
5f61e2f8ec4e362952bed5b37fe4ab7c3095c987
diff --git a/mapclassify.py b/mapclassify.py index <HASH>..<HASH> 100644 --- a/mapclassify.py +++ b/mapclassify.py @@ -55,7 +55,7 @@ def quantile(y,k=4): >>> Note that if there are enough ties that the quantile values repeat, we - collapse to psuedo quantiles in which case the number of classes will be + collapse to pseudo quantiles in which case the number of classes will be less than k >>> x=[1.0]*100 diff --git a/moran.py b/moran.py index <HASH>..<HASH> 100644 --- a/moran.py +++ b/moran.py @@ -84,8 +84,18 @@ class Moran: -0.012987012987012988 >>> mi.p_norm 0.00027147862770937614 - >>> - + + SIDS example replicating OpenGeoda + + >>> w=pysal.open("../examples/sids2.gal").read() + >>> f=pysal.open("../examples/sids2.dbf") + >>> SIDR=np.array(f.by_col("SIDR74")) + >>> mi=pysal.Moran(SIDR,w) + >>> mi.I + 0.24772519320480135 + >>> mi.p_norm + 0.0001158330781489969 + """ def __init__(self,y,w,transformation="r",permutations=PERMUTATIONS): self.y=y
- fix histogram logic bug in weights init - added more examples to replicate GeoDa
pysal_mapclassify
train
py,py
46b8148e88a5c16c192626a3e133948bd6bb6915
diff --git a/packages/selenium-ide/src/neo/playback/playback-tree/command-node.js b/packages/selenium-ide/src/neo/playback/playback-tree/command-node.js index <HASH>..<HASH> 100644 --- a/packages/selenium-ide/src/neo/playback/playback-tree/command-node.js +++ b/packages/selenium-ide/src/neo/playback/playback-tree/command-node.js @@ -53,7 +53,7 @@ export class CommandNode { next: this.next }; } else if (result.result === "success") { - this._incrementTimesVisited(); + if (ControlFlowCommandChecks.isLoop(this.command)) this.timesVisited++; return { result: "success", next: this.isControlFlow() ? result.next : this.next @@ -115,10 +115,6 @@ export class CommandNode { }); } - _incrementTimesVisited() { - if (ControlFlowCommandChecks.isLoop(this.command)) this.timesVisited++; - } - _isRetryLimit() { let limit = 1000; let value = Math.floor(+this.command.value);
Inlined conditional incrementing of `timesVisited` since it's only needed in one place now.
SeleniumHQ_selenium-ide
train
js
9ed7dbc3602df5493cb14c983058886bc53c1f79
diff --git a/src/SwiftMailer/Transport/FileTransport.php b/src/SwiftMailer/Transport/FileTransport.php index <HASH>..<HASH> 100644 --- a/src/SwiftMailer/Transport/FileTransport.php +++ b/src/SwiftMailer/Transport/FileTransport.php @@ -120,7 +120,7 @@ class FileTransport implements Swift_Transport protected function doSend(Swift_Mime_Message $message, &$failedRecipients = null) { $body = $message->toString(); - $fileName = $this->path.'/'.date('Y-m-d H:i:s'); + $fileName = $this->path.'/'.date('Y-m-d H_i_s'); for ($i = 0; $i < $this->retryLimit; ++$i) { /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */
Use "_" separator for time as ":" does not work on Windows
geekdevs_swift-mailer-extensions
train
php
bb612237191b7205625ffc36e3b4b2e24ce80985
diff --git a/onnx/backend/test/runner/__init__.py b/onnx/backend/test/runner/__init__.py index <HASH>..<HASH> 100644 --- a/onnx/backend/test/runner/__init__.py +++ b/onnx/backend/test/runner/__init__.py @@ -8,6 +8,7 @@ import functools import glob import os import re +import shutil import tarfile import tempfile import unittest @@ -151,7 +152,16 @@ class Runner(object): models_dir = os.getenv('ONNX_MODELS', os.path.join(onnx_home, 'models')) model_dir = os.path.join(models_dir, model_test.model_name) - if not os.path.exists(model_dir): + if not os.path.exists(os.path.join(model_dir, 'model.onnx')): + if os.path.exists(model_dir): + bi = 0 + while True: + dest = '{}.old.{}'.format(model_dir, bi) + if os.path.exists(dest): + bi += 1 + continue + shutil.move(model_dir, dest) + break os.makedirs(model_dir) url = 'https://s3.amazonaws.com/download.onnx/models/{}.tar.gz'.format( model_test.model_name)
Change the cached model checking logic (#<I>) * Change the cached model checking logic * Move the old folder, instead of deleting
onnx_onnx
train
py
35d570d0dda600b3ae05f82a24cdddb79ab84fc8
diff --git a/hug/test.py b/hug/test.py index <HASH>..<HASH> 100644 --- a/hug/test.py +++ b/hug/test.py @@ -26,7 +26,8 @@ import json from hug.run import server from hug import output_format from functools import partial -from unittest.mock import patch +from unittest import mock +from collections import namedtuple def call(method, api_module, url, body='', headers=None, **params): @@ -57,8 +58,11 @@ for method in HTTP_METHODS: def cli(method, **arguments): '''Simulates testing a hug cli method from the command line''' - with patch('argparse.ArgumentParser.parse_args', lambda self: arguments): + test_arguments = mock.Mock() + test_arguments.__dict__ = arguments + with mock.patch('argparse.ArgumentParser.parse_args', lambda self: test_arguments): + old_output = method.cli.output to_return = [] - with patch('__main__.method.cli.output', lambda data: to_return.append(data)): - method.cli() - return to_return and to_return[0] or None + method.cli() + method.cli.output = old_output + return to_return and to_return[0] or None
Fix how arguments are passed in when testing clis
hugapi_hug
train
py
928cc6bb4ef8b257f4529fb009399158157c015c
diff --git a/test/extended/authorization/rbac/groups_default_rules.go b/test/extended/authorization/rbac/groups_default_rules.go index <HASH>..<HASH> 100644 --- a/test/extended/authorization/rbac/groups_default_rules.go +++ b/test/extended/authorization/rbac/groups_default_rules.go @@ -114,7 +114,7 @@ var ( // These custom resources are used to extend console functionality // The console team is working on eliminating this exception in the near future - rbacv1helpers.NewRule(read...).Groups(consoleGroup).Resources("consoleclidownloads", "consolelinks", "consoleexternalloglinks", "consolenotifications").RuleOrDie(), + rbacv1helpers.NewRule(read...).Groups(consoleGroup).Resources("consoleclidownloads", "consolelinks", "consoleexternalloglinks", "consolenotifications", "consoleyamlsamples").RuleOrDie(), // TODO: remove when openshift-apiserver has removed these rbacv1helpers.NewRule("get").URLs(
Add consoleyamlsamples to list of console resource exceptions
openshift_origin
train
go
2a6d18686c9065e415b8fcdcf60d336811880b9a
diff --git a/src/types/__tests__/run-tests.test.js b/src/types/__tests__/run-tests.test.js index <HASH>..<HASH> 100644 --- a/src/types/__tests__/run-tests.test.js +++ b/src/types/__tests__/run-tests.test.js @@ -18,6 +18,7 @@ test('TypeScript', async () => { const cleanedMessage = err.message .replace(/src\/types\//gm, '') .replace(/error TS\d+: /gm, '') + .replace(/\(\d+,\d+\)/gm, '') expect(cleanedMessage).toMatchSnapshot('rejected') } })
Remove lines from TypeScript snapshots (cherry picked from commit b<I>f8f<I>f1c<I>e<I>a8d<I>dabb<I>) # Conflicts: # src/types/__tests__/__snapshots__/run-tests.test.js.snap
zerobias_effector
train
js
58931c7f8cdc96b278ce2709126f97f6657dd489
diff --git a/go/engine/pgp_update_test.go b/go/engine/pgp_update_test.go index <HASH>..<HASH> 100644 --- a/go/engine/pgp_update_test.go +++ b/go/engine/pgp_update_test.go @@ -109,6 +109,7 @@ func TestPGPUpdateMultiKey(t *testing.T) { // Generate a second PGP sibkey. arg := PGPKeyImportEngineArg{ AllowMulti: true, + DoExport: true, Gen: &libkb.PGPGenArg{ PrimaryBits: 768, SubkeyBits: 768,
In TestPGPUpdateMultiKey, actually do the updates Previously, this test just checked that the arguments were interpreted correctly. Since the generated keys were never exported to the local keyring, the update did nothing. Since the process of updating PGP keys is a little more complicated now, and a little more security-conscious, it's useful to test the whole thing.
keybase_client
train
go
f74bb74fb48216a6739c38abf9feb608ac69f837
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/TestingListener.java b/flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/TestingListener.java index <HASH>..<HASH> 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/TestingListener.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/TestingListener.java @@ -51,11 +51,11 @@ public class TestingListener implements LeaderRetrievalListener { long start = System.currentTimeMillis(); long curTimeout; - while ( + synchronized (lock) { + while ( exception == null && - (address == null || address.equals(oldAddress)) && - (curTimeout = timeout - System.currentTimeMillis() + start) > 0) { - synchronized (lock) { + (address == null || address.equals(oldAddress)) && + (curTimeout = timeout - System.currentTimeMillis() + start) > 0) { try { lock.wait(curTimeout); } catch (InterruptedException e) {
[FLINK-<I>] [tests] Perform TestingListener#waitForNewLeader under lock Performin TestingListener#waitForNewLeader under the lock which is also hold when updating the leader information makes sure that leader changes won't go unnoticed. This led before to failing test cases due to timeouts. This closes #<I>.
apache_flink
train
java
4dbcdf54a0785772334048bdd4b4ded580b2a907
diff --git a/src/lib/core/property.php b/src/lib/core/property.php index <HASH>..<HASH> 100644 --- a/src/lib/core/property.php +++ b/src/lib/core/property.php @@ -167,6 +167,8 @@ function papi_get_property_meta_value( $id, $slug, $type = 'post' ) { } else { $type = papi_get_meta_type( $type ); $value = get_metadata( $type, $id, unpapify( $slug ), true ); + // Backward compatibility, slugs can contain `papi` prefix. + $value = papi_is_empty( $value ) ? get_metadata( $type, $id, $slug, true ) : $value; } if ( papi_is_empty( $value ) ) {
Add backward compatibility for property meta saved with prefix
wp-papi_papi
train
php
091a113981da01bfc0e8a5d87bbb2f845e7be1a5
diff --git a/contribs/gmf/src/print/component.js b/contribs/gmf/src/print/component.js index <HASH>..<HASH> 100644 --- a/contribs/gmf/src/print/component.js +++ b/contribs/gmf/src/print/component.js @@ -779,12 +779,8 @@ export class PrintController { this.updateCustomFields_(); - const hasLegend = this.layoutInfo.attributes.includes('legend'); - if (hasLegend) { - this.fieldValues.legend = this.fieldValues.legend; - } else { - delete this.fieldValues.legend; - } + this.layoutInfo.legend = this.layoutInfo.attributes.includes('legend') ? + this.fieldValues['legend'] !== false : undefined; this.layoutInfo.scales = clientInfo.scales || []; this.layoutInfo.dpis = clientInfo.dpiSuggestions || [];
Revert regression in gmf print component
camptocamp_ngeo
train
js
bd6f7bd75ee9077cdd39274c9415a90b013127a5
diff --git a/tests/Embera/Provider/HuluTest.php b/tests/Embera/Provider/HuluTest.php index <HASH>..<HASH> 100644 --- a/tests/Embera/Provider/HuluTest.php +++ b/tests/Embera/Provider/HuluTest.php @@ -34,6 +34,11 @@ final class HuluTest extends ProviderTester public function testProvider() { + $travis = (bool) getenv('ONTRAVIS'); + if ($travis) { + $this->markTestIncomplete('Disabling this provider since it seems to have problems with the endpoint (OnSizzle).'); + } + $this->validateProvider('Hulu', [ 'width' => 480, 'height' => 270]); } } diff --git a/tests/Embera/Provider/SoundsgoodTest.php b/tests/Embera/Provider/SoundsgoodTest.php index <HASH>..<HASH> 100644 --- a/tests/Embera/Provider/SoundsgoodTest.php +++ b/tests/Embera/Provider/SoundsgoodTest.php @@ -21,7 +21,6 @@ final class SoundsgoodTest extends ProviderTester { protected $tasks = [ 'valid_urls' => [ - 'https://play.soundsgood.co/playlist/chill-new-songwriters-2019-indie-rock-folk-and-soul', 'https://play.soundsgood.co/playlist/if-12-2019', 'https://play.soundsgood.co/playlist/19-avril-2015', ],
Fixed Soundsgood tests - Hulu is having problems right now.
mpratt_Embera
train
php,php
2b7afc9c3b8ca8ac935577568eae08cd5d9331ee
diff --git a/salt/output/virt_query.py b/salt/output/virt_query.py index <HASH>..<HASH> 100644 --- a/salt/output/virt_query.py +++ b/salt/output/virt_query.py @@ -30,7 +30,7 @@ def output(data): id_, vm_data['graphics']['port']) if 'disks' in vm_data: - for disk, d_data in list(vm_data['disks'].items()): + for disk, d_data in vm_data['disks'].items(): out += ' Disk - {0}:\n'.format(disk) out += ' Size: {0}\n'.format(d_data['disk size']) out += ' File: {0}\n'.format(d_data['file'])
Removing lists and change back to earlier
saltstack_salt
train
py
dbfd17f32e7f2da1f749c0a0e30c44544d4c6375
diff --git a/src/WindowsAzure/ServiceRuntime/RoleEnvironment.php b/src/WindowsAzure/ServiceRuntime/RoleEnvironment.php index <HASH>..<HASH> 100644 --- a/src/WindowsAzure/ServiceRuntime/RoleEnvironment.php +++ b/src/WindowsAzure/ServiceRuntime/RoleEnvironment.php @@ -181,6 +181,8 @@ class RoleEnvironment /** * Tracks role environment changes raising events as necessary. * + * This method is blocking and can/should be called in a separate fork. + * * @static * * @return none
#<I>: Adding comment in the listener methods for trackchanges method
Azure_azure-sdk-for-php
train
php
99f6d1e79c99a6fb4dbabad4e380025f54d641ba
diff --git a/aws/resource_aws_acm_certificate.go b/aws/resource_aws_acm_certificate.go index <HASH>..<HASH> 100644 --- a/aws/resource_aws_acm_certificate.go +++ b/aws/resource_aws_acm_certificate.go @@ -292,6 +292,10 @@ func convertValidationOptions(certificate *acm.CertificateDetail) ([]map[string] var emailValidationResult []string if *certificate.Type == acm.CertificateTypeAmazonIssued { + if len(certificate.DomainValidationOptions) == 0 { + log.Printf("[DEBUG] No validation options need to retry.") + return nil, nil, fmt.Errorf("No validation options need to retry.") + } for _, o := range certificate.DomainValidationOptions { if o.ResourceRecord != nil { validationOption := map[string]interface{}{
Retry ACM certificate domain validation when the DomainValidationOptions array is completely empty.
terraform-providers_terraform-provider-aws
train
go
1a8bb8526d14b123e198a93896999390fd88be15
diff --git a/source/Core/oxwidgetcontrol.php b/source/Core/oxwidgetcontrol.php index <HASH>..<HASH> 100644 --- a/source/Core/oxwidgetcontrol.php +++ b/source/Core/oxwidgetcontrol.php @@ -101,18 +101,14 @@ class oxWidgetControl extends oxShopControl // if exists views chain, initializing these view at first if (is_array($aViewsChain) && !empty($aViewsChain)) { - foreach ($aViewsChain as $sParentClassName) { if ($sParentClassName != $sClass && !in_array(strtolower($sParentClassName), $aActiveViewsNames)) { // creating parent view object - if (strtolower($sParentClassName) == 'oxubase') { - $oViewObject = oxNew('oxubase'); - $oConfig->setActiveView($oViewObject); - } else { - $oViewObject = oxNew($sParentClassName); - $oViewObject->setClassName($sParentClassName); - $oConfig->setActiveView($oViewObject); + $oViewObject = oxNew($sParentClassName); + if (strtolower($sParentClassName) != 'oxubase') { + $oViewObject->setClassName($sParentClassName); } + $oConfig->setActiveView($oViewObject); } } }
try to simplify view chain code Removed duplicate code in classname is oxubase, the only diff. left is the setClassName call.
OXID-eSales_oxideshop_ce
train
php
c40fe1dede3ee569d5f0df4c95e38a89956720b6
diff --git a/internetarchive/cli/ia_upload.py b/internetarchive/cli/ia_upload.py index <HASH>..<HASH> 100755 --- a/internetarchive/cli/ia_upload.py +++ b/internetarchive/cli/ia_upload.py @@ -83,6 +83,7 @@ def _upload_files(item, files, upload_kwargs, prev_identifier=None, archive_sess def main(argv, session): args = docopt(__doc__, argv=argv) + ERRORS = False # Validate args. s = Schema({ @@ -172,7 +173,6 @@ def main(argv, session): session = ArchiveSession() spreadsheet = csv.DictReader(open(args['--spreadsheet'], 'rU')) prev_identifier = None - errors = False for row in spreadsheet: local_file = row['file'] identifier = row['identifier'] @@ -189,8 +189,8 @@ def main(argv, session): r = _upload_files(item, local_file, upload_kwargs, prev_identifier, session) for _r in r: if (not _r) or (not _r.ok): - errors = True + ERRORS = True prev_identifier = identifier - if errors: + if ERRORS: sys.exit(1)
made ERRORS global to address UnboundLocalError bug.
jjjake_internetarchive
train
py
e02d22aa4f0ebb768f93b939b67853ad3d9c2087
diff --git a/_pytest/python.py b/_pytest/python.py index <HASH>..<HASH> 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -228,7 +228,10 @@ class Module(pytest.File, PyCollectorMixin): self.ihook.pytest_pycollect_before_module_import(mod=self) # we assume we are only called once per module try: - mod = self.fspath.pyimport(ensuresyspath=True) + try: + mod = self.fspath.pyimport(ensuresyspath=True) + finally: + self.ihook.pytest_pycollect_after_module_import(mod=self) except SyntaxError: excinfo = py.code.ExceptionInfo() raise self.CollectError(excinfo.getrepr(style="short")) @@ -243,8 +246,6 @@ class Module(pytest.File, PyCollectorMixin): "HINT: use a unique basename for your test file modules" % e.args ) - finally: - self.ihook.pytest_pycollect_after_module_import(mod=self) #print "imported test module", mod self.config.pluginmanager.consider_module(mod) return mod
expand try/except/finally which py<I> does't like
vmalloc_dessert
train
py
0f020d60e5b24079abc727fc0882d0452a504c7b
diff --git a/Notifications/ResetPassword.php b/Notifications/ResetPassword.php index <HASH>..<HASH> 100644 --- a/Notifications/ResetPassword.php +++ b/Notifications/ResetPassword.php @@ -59,7 +59,7 @@ class ResetPassword extends Notification return (new MailMessage) ->subject(Lang::get('Reset Password Notification')) ->line(Lang::get('You are receiving this email because we received a password reset request for your account.')) - ->action(Lang::get('Reset Password'), url(config('app.url').route('password.reset', ['token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset()], false))) + ->action(Lang::get('Reset Password'), url(route('password.reset', ['token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset()], false))) ->line(Lang::get('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')])) ->line(Lang::get('If you did not request a password reset, no further action is required.')); }
Use the router for absolute urls (#<I>)
illuminate_auth
train
php
7f63b4f1e598a799f2d05c25e281f5d119aea4fe
diff --git a/lib/flipflop/facade.rb b/lib/flipflop/facade.rb index <HASH>..<HASH> 100644 --- a/lib/flipflop/facade.rb +++ b/lib/flipflop/facade.rb @@ -1,3 +1,5 @@ +require "forwardable" + module Flipflop module Facade extend Forwardable 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 @@ -140,9 +140,9 @@ class TestApp Rails.application.config.i18n.enforce_available_locales = false Rails.application.config.autoloader = :classic # Disable Zeitwerk in Rails 6+ - active_record_options = Rails.application.config.active_record - if active_record_options.respond_to?(:sqlite3=) and active_record_options.sqlite3.nil? - active_record_options.sqlite3 = ActiveSupport::OrderedOptions.new + if ActiveRecord::Base.respond_to?(:sqlite3=) + # Avoid Rails 6+ deprecation warning + Rails.application.config.active_record.sqlite3 = ActiveSupport::OrderedOptions.new end if defined?(ActionView::Railtie::NULL_OPTION)
Fixes for older Rails versions.
voormedia_flipflop
train
rb,rb
7e7706a0f2a4d01fc1f3c5baa9bd52959062cc84
diff --git a/spec/jobs/import_url_job_spec.rb b/spec/jobs/import_url_job_spec.rb index <HASH>..<HASH> 100644 --- a/spec/jobs/import_url_job_spec.rb +++ b/spec/jobs/import_url_job_spec.rb @@ -29,9 +29,18 @@ RSpec.describe ImportUrlJob do end context 'after running the job' do + let!(:tmpdir) { Rails.root.join("tmp/spec/#{Process.pid}") } + before do file_set.id = 'abc123' allow(file_set).to receive(:reload) + + FileUtils.mkdir_p(tmpdir) + allow(Dir).to receive(:mktmpdir).and_return(tmpdir) + end + + after do + FileUtils.remove_entry(tmpdir) end it 'creates the content and updates the associated operation' do @@ -39,6 +48,11 @@ RSpec.describe ImportUrlJob do described_class.perform_now(file_set, operation) expect(operation).to be_success end + + it 'leaves the temp directory in place' do + described_class.perform_now(file_set, operation) + expect(File.exist?(File.join(tmpdir, file_hash))).to be true + end end context "when a batch update job is running too" do
Add test to make sure ImportUrlJob leaves its temp directory/file(s) in place.
samvera_hyrax
train
rb
dfc19c090707bcc59a38f941ba55c2fc4f027ff3
diff --git a/src/Dev/FixtureBlueprint.php b/src/Dev/FixtureBlueprint.php index <HASH>..<HASH> 100644 --- a/src/Dev/FixtureBlueprint.php +++ b/src/Dev/FixtureBlueprint.php @@ -207,7 +207,7 @@ class FixtureBlueprint extends BaseBlueprint // Mutate Class (if required): - $this->mutateClass($object, $identifier, $data); + $object = $this->mutateClass($object, $identifier, $data); // Write Object to Database: @@ -255,6 +255,10 @@ class FixtureBlueprint extends BaseBlueprint { $objects = DataList::create($this->getClass()); + if (!$objects->exists()) { + $objects = DataList::create($this->getBaseClass()); + } + if (is_array($filter)) { $objects = $objects->filter($filter); }
Fixed a bug with class mutation in fixtures
praxisnetau_silverware
train
php
b7297993890567b4ecc1aacd04c51ba8ddc31fc4
diff --git a/src/search/FindInFiles.js b/src/search/FindInFiles.js index <HASH>..<HASH> 100644 --- a/src/search/FindInFiles.js +++ b/src/search/FindInFiles.js @@ -795,7 +795,7 @@ define(function (require, exports, module) { var addPromise; if (entry.isDirectory) { - if (!added || !removed) { + if (!added || !removed || (!added.length && !removed.length)) { // If the added or removed sets are null, must redo the search for the entire subtree - we // don't know which child files/folders may have been added or removed. _removeSearchResultsForEntry(entry);
Fix: Find in Files results don't update to reflect external changes unless file is open
adobe_brackets
train
js
ab709373026876f124a4ffad71570f2cd552710a
diff --git a/pymatbridge/version.py b/pymatbridge/version.py index <HASH>..<HASH> 100644 --- a/pymatbridge/version.py +++ b/pymatbridge/version.py @@ -87,7 +87,14 @@ MICRO = _version_micro VERSION = __version__ PACKAGES = ['pymatbridge'] PACKAGE_DATA = {"pymatbridge": ["matlab/matlabserver.m", "matlab/messenger.*", - "matlab/usrprog/*.m", "matlab/util/*.m", + "matlab/usrprog/*", "matlab/util/*.m", + "matlab/util/json_tool/*.m", + "matlab/util/json_tool/json_v0.2.2/.gitignore", + "matlab/util/json_tool/json_v0.2.2/LICENSE", + "matlab/util/json_tool/json_v0.2.2/README.md", + "matlab/util/json_tool/json_v0.2.2/test/*", + "matlab/util/json_tool/json_v0.2.2/+json/*.m", + "matlab/util/json_tool/json_v0.2.2/+json/java/*", "tests/*.py", "examples/*.ipynb"]} REQUIRES = []
Added json tool folder to installation
arokem_python-matlab-bridge
train
py
0c590f93d914461b0e0ee91de7c45c4a37c3c84e
diff --git a/cacheback/utils.py b/cacheback/utils.py index <HASH>..<HASH> 100644 --- a/cacheback/utils.py +++ b/cacheback/utils.py @@ -1,4 +1,5 @@ import logging +import warnings from django.conf import settings from django.core import signals @@ -24,6 +25,14 @@ except ImportError as exc: logger = logging.getLogger('cacheback') +class RemovedInCacheback13Warning(DeprecationWarning): + pass + + +def warn_deprecation(message, exc=RemovedInCacheback13Warning): + warnings.warn(message, exc) + + def get_cache(backend, **kwargs): """ Compatibilty wrapper for getting Django's cache backend instance
Add helper to easy raise warnings for deprecated imports/calls.
codeinthehole_django-cacheback
train
py
b2293a2e5bfa195c822ebcb27e85b201f7389576
diff --git a/python/ccxt/base/exchange.py b/python/ccxt/base/exchange.py index <HASH>..<HASH> 100644 --- a/python/ccxt/base/exchange.py +++ b/python/ccxt/base/exchange.py @@ -1533,6 +1533,15 @@ class Exchange(object): else: raise NotSupported(self.id + ' fetchDepositAddress not supported yet') + def parse_funding_rate(self, contract, market=None): + raise NotSupported(self.id + "parse_funding_rate has not been implemented") + + def parse_funding_rates(self, response, market=None, timeframe='1m', since=None, limit=None): + parsed = [self.parse_funding_rate(res, market) for res in response] + sorted = self.sort_by(parsed, 0) + tail = since is None + return self.filter_by_since_limit(sorted, since, limit, 0, tail) + def parse_ohlcv(self, ohlcv, market=None): if isinstance(ohlcv, list): return [
Added parse_funding_rate and parse_funding_rates to python exchange base
ccxt_ccxt
train
py
abdf37afb8339f6d3d3208c4efda092bb9463d88
diff --git a/tests/TypeParseTest.php b/tests/TypeParseTest.php index <HASH>..<HASH> 100644 --- a/tests/TypeParseTest.php +++ b/tests/TypeParseTest.php @@ -732,8 +732,8 @@ class TypeParseTest extends TestCase public function testCombineLiteralStringWithClassString() { $this->assertSame( - 'string', - (string)Type::parseString('"array"|class-string') + 'class-string|string(array)', + Type::parseString('"array"|class-string')->getId() ); } @@ -743,8 +743,8 @@ class TypeParseTest extends TestCase public function testCombineLiteralClassStringWithClassString() { $this->assertSame( - 'class-string', - (string)Type::parseString('A::class|class-string') + 'A::class|class-string', + Type::parseString('A::class|class-string')->getId() ); }
Add workarounds for class-string tests
vimeo_psalm
train
php
0836806bd34959c4ea377e56ba1ceb9fdbce65e5
diff --git a/src/assets/PriceEstimator.php b/src/assets/PriceEstimator.php index <HASH>..<HASH> 100644 --- a/src/assets/PriceEstimator.php +++ b/src/assets/PriceEstimator.php @@ -23,7 +23,7 @@ class PriceEstimator extends AssetBundle /** * @var string */ - public $sourcePath = __DIR__; + public $sourcePath = __DIR__ . '/PriceEstimator'; /** * @var array
fixed asset path (#<I>)
hiqdev_hipanel-module-finance
train
php
5554c09e1e8710e801fed2e63b2db8976362a309
diff --git a/lib/appbundler/app.rb b/lib/appbundler/app.rb index <HASH>..<HASH> 100644 --- a/lib/appbundler/app.rb +++ b/lib/appbundler/app.rb @@ -47,6 +47,10 @@ module Appbundler ret end + SHITLIST = [ + "github_changelog_generator", + ] + def write_merged_lockfiles(without: []) # just return we don't have an external lockfile return if app_dir == File.dirname(gemfile_lock) @@ -58,6 +62,7 @@ module Appbundler locked_gems = {} gemfile_lock_specs.each do |s| + next if SHITLIST.include?(s.name) # we use the fact that all the gems from the Gemfile.lock have been preinstalled to skip gems that aren't for our platform. spec = safe_resolve_local_gem(s) next if spec.nil? @@ -80,6 +85,7 @@ module Appbundler t.puts "# GEMS FROM GEMFILE:" requested_dependencies(without).each do |dep| + next if SHITLIST.include?(dep.name) if locked_gems[dep.name] t.puts locked_gems[dep.name] else @@ -93,6 +99,7 @@ module Appbundler t.puts "# GEMS FROM LOCKFILE: " locked_gems.each do |name, line| + next if SHITLIST.include?(name) next if seen_gems[name] t.puts line end
avoid github-changelog-generator issues this is a bit of a hack to ship ChefDK <I> because this gem infects and breaks everything in the world.
chef_appbundler
train
rb
c1b5981e872427ee0ca5d41d6afc7a0f8bebb051
diff --git a/webapps/ui/cockpit/client/scripts/navigation/controllers/cam-header-views-ctrl.js b/webapps/ui/cockpit/client/scripts/navigation/controllers/cam-header-views-ctrl.js index <HASH>..<HASH> 100644 --- a/webapps/ui/cockpit/client/scripts/navigation/controllers/cam-header-views-ctrl.js +++ b/webapps/ui/cockpit/client/scripts/navigation/controllers/cam-header-views-ctrl.js @@ -1,10 +1,6 @@ 'use strict'; function checkActive(plugin, path) { - var checked = plugin.id; - if (checked === 'processes') { - checked = 'process'; - } return path.indexOf(plugin.id) > -1; }
refactor(navigation): remove dead code Related to CAM-<I>
camunda_camunda-bpm-platform
train
js
19adad829fe31f9856c6ac3b6006eeb0bb651dbc
diff --git a/is-native-implemented.js b/is-native-implemented.js index <HASH>..<HASH> 100644 --- a/is-native-implemented.js +++ b/is-native-implemented.js @@ -1,10 +1,8 @@ -// Exports true if environment provides native `WeakMap` implementation, -// whatever that is. +// Exports true if environment provides native `WeakMap` implementation, whatever that is. 'use strict'; module.exports = (function () { - if (typeof WeakMap === 'undefined') return false; - return (Object.prototype.toString.call(WeakMap.prototype) === - '[object WeakMap]'); + if (typeof WeakMap !== 'function') return false; + return (Object.prototype.toString.call(new WeakMap()) === '[object WeakMap]'); }());
Fix native detection So it's not affected by V8 bug: <URL>
medikoo_es6-weak-map
train
js
f5602802ff92260847c62eb2b5cbe5f61c724a36
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ /* -List.js 1.1.1 +List.js 1.2 By Jonny Strömberg (www.jonnystromberg.com, www.listjs.com) */ (function( window, undefined ) {
Update version in index.js Update version from <I> to <I> in index.js.
javve_list.js
train
js
2ad3380ae5789892498965b93ff1ab442f7040a1
diff --git a/src/frontend/commands/BlockController.php b/src/frontend/commands/BlockController.php index <HASH>..<HASH> 100644 --- a/src/frontend/commands/BlockController.php +++ b/src/frontend/commands/BlockController.php @@ -143,6 +143,8 @@ class BlockController extends \luya\console\Command 'link' => 'Generats a linkable internal or external resource (use Link Injector!)', 'cms-page' => 'Returns CMS page selection tree (only when cms is registered).', 'slug' => 'Slugified input field which allows only lower chars and - for url rules.', + 'radio' => 'Generate radio inputs which allows to select and return a single value.', + 'multiple-inputs' => 'Nesting all types inside an array.' ]; } @@ -169,7 +171,8 @@ class BlockController extends \luya\console\Command 'link' => 'self::TYPE_LINK', 'cms-page' => 'self::TYPE_CMS_PAGE', 'slug' => 'self::TYPE_SLUG', - 'radios' => 'self::TYPE_RADIOS', + 'radio' => 'self::TYPE_RADIO', + 'multiple-inpus' => 'self::TYPE_MULTIPLE_INPUTS', ]; }
added multiple inputs to block command. #<I>
luyadev_luya-module-cms
train
php
2a368a9192bbfc76731d4197fb3628ec0b23f7df
diff --git a/anyconfig/backend/tests/xml.py b/anyconfig/backend/tests/xml.py index <HASH>..<HASH> 100644 --- a/anyconfig/backend/tests/xml.py +++ b/anyconfig/backend/tests/xml.py @@ -57,7 +57,7 @@ CNF_0_S = """\ class Test_00(unittest.TestCase): - def test__namespaces_from_file(self): + def test_10__namespaces_from_file(self): ref = {"http://example.com/ns/config": '', "http://example.com/ns/config/val": "val"} xmlfile = anyconfig.compat.StringIO(XML_W_NS_S)
refactor: rename test methods to keep the order in .backend.tests.xml.Test_<I>
ssato_python-anyconfig
train
py
428669aeb2f721c2d439e08814b4dd2a62f790aa
diff --git a/src/test/java/com/metamx/http/client/io/AppendableByteArrayInputStreamTest.java b/src/test/java/com/metamx/http/client/io/AppendableByteArrayInputStreamTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/metamx/http/client/io/AppendableByteArrayInputStreamTest.java +++ b/src/test/java/com/metamx/http/client/io/AppendableByteArrayInputStreamTest.java @@ -210,7 +210,7 @@ public class AppendableByteArrayInputStreamTest { try { byte[] readBytes = new byte[10]; - in.read(readBytes); + while (in.read(readBytes) != -1); return readBytes; } catch (IOException e) {
Read until EOF (which shouldn't happen...)
metamx_http-client
train
java
55ccae9fb86ff6bff5136993fafd19c3973d4d94
diff --git a/js/bitmart.js b/js/bitmart.js index <HASH>..<HASH> 100644 --- a/js/bitmart.js +++ b/js/bitmart.js @@ -436,7 +436,7 @@ module.exports = class bitmart extends Exchange { const pricePrecision = this.safeInteger (market, 'price_max_precision'); const precision = { 'amount': this.safeNumber (market, 'base_min_size'), - 'price': parseFloat (this.decimalToPrecision (Math.pow (10, -pricePrecision), ROUND, 10)), + 'price': parseFloat (this.decimalToPrecision (Math.pow (10, -pricePrecision), ROUND, 12)), }; const minBuyCost = this.safeNumber (market, 'min_buy_amount'); const minSellCost = this.safeNumber (market, 'min_sell_amount');
For some markets (BABYDOGE/USDT and etc) with price_max_precision > <I> price precision calculated as 0. P.S. BABYDOGE/USDT price precision is <I>. Max precision for all markets is <I>.
ccxt_ccxt
train
js
ccd6805140ac65f63641485e913e2ce2fb8f8942
diff --git a/pkg/kubelet/pod_workers.go b/pkg/kubelet/pod_workers.go index <HASH>..<HASH> 100644 --- a/pkg/kubelet/pod_workers.go +++ b/pkg/kubelet/pod_workers.go @@ -34,7 +34,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/events" "k8s.io/kubernetes/pkg/kubelet/eviction" "k8s.io/kubernetes/pkg/kubelet/metrics" - kubelettypes "k8s.io/kubernetes/pkg/kubelet/types" kubetypes "k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/util/queue" ) @@ -665,7 +664,7 @@ func (p *podWorkers) UpdatePod(options UpdatePodOptions) { options.KillPodOptions.PodTerminationGracePeriodSecondsOverride = &gracePeriod // if a static pod comes through, start tracking it explicitly (cleared by the pod worker loop) - if kubelettypes.IsStaticPod(pod) { + if kubetypes.IsStaticPod(pod) { p.terminatingStaticPodFullnames[kubecontainer.GetPodFullName(pod)] = struct{}{} }
fix kubelet/types is imported more than once
kubernetes_kubernetes
train
go
4d33ec646e4ab9ed96337feee59556cc8562688a
diff --git a/src/pymoca/backends/casadi/api.py b/src/pymoca/backends/casadi/api.py index <HASH>..<HASH> 100644 --- a/src/pymoca/backends/casadi/api.py +++ b/src/pymoca/backends/casadi/api.py @@ -280,14 +280,19 @@ def transfer_model(model_folder: str, model_name: str, compiler_options=None): codegen = compiler_options.get('codegen', False) if cache or codegen: - # Until CasADi supports pickling MXFunctions, caching implies expanding to SX. + # Until CasADi supports pickling MXFunctions, caching implies + # expanding to SX. We only raise a warning when we have to (re)compile + # the model though. + raise_expand_warning = False if cache and not compiler_options.get('expand_mx', False): - logger.warning("Caching implies expanding to SX. Setting 'expand_mx' to True.") compiler_options['expand_mx'] = True + raise_expand_warning = True try: return _load_model(model_folder, model_name, compiler_options) except (FileNotFoundError, InvalidCacheError): + if raise_expand_warning: + logger.warning("Caching implies expanding to SX. Setting 'expand_mx' to True.") model = _compile_model(model_folder, model_name, compiler_options) _save_model(model_folder, model_name, model, cache, codegen) return model
Only raise "cache needs expand_mx" warning if compiling
pymoca_pymoca
train
py
60913f42ac2858009c739a003a9ff795efc6007a
diff --git a/src/codegeneration/SuperTransformer.js b/src/codegeneration/SuperTransformer.js index <HASH>..<HASH> 100644 --- a/src/codegeneration/SuperTransformer.js +++ b/src/codegeneration/SuperTransformer.js @@ -110,7 +110,7 @@ export class SuperTransformer extends ParseTreeTransformer { // We should never get to these if ClassTransformer is doing its job. transformGetAccessor(tree) { return tree; } transformSetAccessor(tree) { return tree; } - transformPropertyMethodAssignMent(tree) { return tree; } + transformPropertyMethodAssignment(tree) { return tree; } /** * @param {CallExpression} tree
fix a typo in SuperTransformer
google_traceur-compiler
train
js
7a87671ecb236119e9264c9a91b05365fd26a185
diff --git a/lib/itunes/version.rb b/lib/itunes/version.rb index <HASH>..<HASH> 100644 --- a/lib/itunes/version.rb +++ b/lib/itunes/version.rb @@ -1,3 +1,3 @@ module ITunes - VERSION = '0.4.0' + VERSION = '0.4.1' end
rubygems error pushing <I>, bumping to <I>
dewski_itunes
train
rb
4e0133359baa7aa3a166f6365a1246afe33d1f76
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -104,6 +104,7 @@ function matchSnapshot(chai, utils) { var dirty = false; if (!update && !snapshotState.update && snapshot) { if (obj !== snapshot.code) { + addSnapshot(path, context.index, lang === undefined ? null : lang, snapshot.code, dirty); throw new chai.AssertionError("Received value does not match stored snapshot.", { actual: obj, expected: snapshot.code,
Fix bug with missing visited flags when test fails
localvoid_chai-karma-snapshot
train
js
d493ae9f18eaef62439c0d8945e34b0058f8b387
diff --git a/client/js/s3/uploader.js b/client/js/s3/uploader.js index <HASH>..<HASH> 100644 --- a/client/js/s3/uploader.js +++ b/client/js/s3/uploader.js @@ -18,9 +18,6 @@ qq.s3.FineUploader = function(o) { // Inherit instance data from FineUploader, which should in turn inherit from s3.FineUploaderBasic. qq.FineUploader.call(this, options, "s3"); - // Replace any default options with user defined ones - qq.extend(this._options, options, true); - if (!qq.supportedFeatures.ajaxUploading && options.request.successRedirectEndpoint === undefined) { this._options.element.innerHTML = "<div>You MUST set the <code>successRedirectEndpoint</code> property " + "of the <code>request</code> option since this browser does not support the File API!</div>"
fix(client/js/s3/uploader.js): Fix overwrite of instance values set by parent uploader in S3 FU mode
FineUploader_fine-uploader
train
js
dbffd4413220ec2d9ed59b4fb281824b0c0aa891
diff --git a/test_piplicenses.py b/test_piplicenses.py index <HASH>..<HASH> 100644 --- a/test_piplicenses.py +++ b/test_piplicenses.py @@ -604,13 +604,12 @@ def test_allow_only(monkeypatch): assert '' == mocked_stdout.printed assert 'license MIT License not in allow-only licenses was found for ' \ - 'package attrs 🐍🐓🐿️:20.3.0' in mocked_stderr.printed + 'package' in mocked_stderr.printed def test_fail_on(monkeypatch): licenses = ( "MIT License", - "BSD License", ) allow_only_args = ['--fail-on={}'.format(";".join(licenses))] mocked_stdout = MockStdStream() @@ -623,4 +622,4 @@ def test_fail_on(monkeypatch): assert '' == mocked_stdout.printed assert 'fail-on license MIT License was found for ' \ - 'package attrs 🐍🐓🐿️:20.3.0' in mocked_stderr.printed + 'package' in mocked_stderr.printed
Fix test to prevent flakiness The tests assumed an ordering of the dependencies which worked on my machine but failed on the CI machines. So I've removed the package name from the assertion. Limiting the fail_on test to a single license should also prevent issues with ordering.
raimon49_pip-licenses
train
py
075a667eee57aa7f9189042fcd6f2c23dd07f240
diff --git a/fc/__init__.py b/fc/__init__.py index <HASH>..<HASH> 100644 --- a/fc/__init__.py +++ b/fc/__init__.py @@ -1,7 +1,7 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html -__version__ = '0.7' +__version__ = '0.7.1' import io import excel_io
Increased version number to <I>
taborlab_FlowCal
train
py
1c7738314a065ee627011be158b39434683d0874
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup( license='BSD', author='Tim van der Linden', tests_require=['pytest'], - install_requires=['WTForms>=2.0.1'], + install_requires=['WTForms>=2.0.1', 'WebOb>=1.4'], cmdclass={'test': PyTest}, author_email='tim@shisaa.jp', description='Simple wrapper to add "dynamic" (sets of) fields to an already instantiated WTForms form.', diff --git a/wtforms_dynamic_fields/__init__.py b/wtforms_dynamic_fields/__init__.py index <HASH>..<HASH> 100644 --- a/wtforms_dynamic_fields/__init__.py +++ b/wtforms_dynamic_fields/__init__.py @@ -1 +1,3 @@ +from wtforms_dynamic_fields import WTFormsDynamicFields + __version__ = '0.1a1'
Added WebOb dependency and made the module class availabe at top level.
Timusan_wtforms-dynamic-fields
train
py,py
2acb279140e1b0f21d2561911842b5696bbe042c
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/provider/mount/mount_spec.rb +++ b/spec/unit/provider/mount/mount_spec.rb @@ -107,7 +107,7 @@ describe Chef::Provider::Mount::Mount do expect { @provider.load_current_resource(); @provider.mountable? }.to raise_error(Chef::Exceptions::Mount) end - %w{tmpfs fuse cgroup}.each do |fstype| + %w{tmpfs fuse cgroup vboxsf zfs}.each do |fstype| it "does not expect the device to exist for #{fstype}" do @new_resource.fstype(fstype) @new_resource.device("whatever")
linux mount spec - skip device detection for zfs (and vboxsf)
chef_chef
train
rb
c58d3db3ef2d443f59236e6b84c7584cdd2025a5
diff --git a/polymodels/__init__.py b/polymodels/__init__.py index <HASH>..<HASH> 100644 --- a/polymodels/__init__.py +++ b/polymodels/__init__.py @@ -2,6 +2,6 @@ from __future__ import unicode_literals from django.utils.version import get_version -VERSION = (1, 4, 4, 'alpha', 0) +VERSION = (1, 4, 4, 'final', 0) __version__ = get_version(VERSION)
Bumped version number to <I>.
charettes_django-polymodels
train
py
1b19fd93473d07e709eadd88a705fe574b791fee
diff --git a/src/dbFunctions.js b/src/dbFunctions.js index <HASH>..<HASH> 100644 --- a/src/dbFunctions.js +++ b/src/dbFunctions.js @@ -447,11 +447,12 @@ var self = module.exports = { var dbRequest = "INSERT INTO USRFLWINFL (FLWRID, INFLID) VALUES (" + userID + "," + influencerID + ");"; databaseClient.query(dbRequest, (err, dbResult) => { - var dbResults = dbResult; - if (dbResults != undefined && dbResults["rowCount"] == 1) { + + if (dbResult != undefined) { + var dbResults = dbResult; dbResults["createSuccess"] = true; } else { - dbResults = {}; + var dbResults = err; dbResults["createSuccess"] = false; } callback(dbResults);
Fixed a bug in dbFunctions, add_follow_influencers
pumpumba_Influsion-back-end
train
js
e6b57b926ad144afdeef85331757539eb92627dc
diff --git a/astrobase/plotbase.py b/astrobase/plotbase.py index <HASH>..<HASH> 100644 --- a/astrobase/plotbase.py +++ b/astrobase/plotbase.py @@ -892,7 +892,7 @@ def make_checkplot(lspinfo, # bump the ylim of the LSP plot so that the overplotted finder and # objectinfo can fit in this axes plot lspylim = axes[0].get_ylim() - axes[0].set_ylim(lspylim[0], lspylim[1]+0.75*lspylim[1]) + axes[0].set_ylim(lspylim[0], lspylim[1]+0.75*(lspylim[1]-lspylim[0])) # get the stamp try:
checkplot has nicer LSP offset for objectinfo
waqasbhatti_astrobase
train
py
5e9619556d4d3403a314dba0aa0975b0ed5c7205
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,16 @@ +import io + from distutils.core import setup setup( name='txZMQ', - version=open('VERSION').read().strip(), + version=io.open('VERSION', encoding='utf-8').read().strip(), packages=['txzmq', 'txzmq.test'], license='GPLv2', author='Andrey Smirnov', author_email='me@smira.ru', url='https://github.com/smira/txZMQ', description='Twisted bindings for ZeroMQ', - long_description=open('README.rst').read(), + long_description=io.open('README.rst', encoding='utf-8').read(), install_requires=["Twisted>=10.0", "pyzmq>=13"], )
Use io.open when reading UTF-8 encoded file for Python3 compatibility. This way both Python2 and Python3 can use setup.py to handle the package.
smira_txZMQ
train
py
1acf7d40bed636be2fb3a677263e5768f2afea09
diff --git a/ghost/members-api/index.js b/ghost/members-api/index.js index <HASH>..<HASH> 100644 --- a/ghost/members-api/index.js +++ b/ghost/members-api/index.js @@ -202,14 +202,17 @@ module.exports = function MembersApi({ }); } } + let extraPayload = {}; if (!allowSelfSignup) { const member = await users.get({email}); if (member) { - Object.assign(payload, _.pick(body, ['oldEmail'])); + extraPayload = _.pick(req.body, ['oldEmail']); + Object.assign(payload, extraPayload); await sendEmailWithMagicLink({email, requestedType: emailType, payload}); } } else { - Object.assign(payload, _.pick(body, ['labels', 'name', 'oldEmail'])); + extraPayload = _.pick(req.body, ['labels', 'name', 'oldEmail']); + Object.assign(payload, extraPayload); await sendEmailWithMagicLink({email, requestedType: emailType, payload}); } res.writeHead(201);
🐛 Fixed incorrect payload creation for magic link token no issue - The extra payload added to magic link token included `name`, `labels` and `oldEmail` - Refactor in commit [here](<URL>) changed the `body` variable assignment causing the payload objection creation to not include the extra data from request body - Updates `body` to `req.body` to use correct data from request
TryGhost_Ghost
train
js
0abb1df7f68dbb5d1145b75bb90c80f22b56582f
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -47,6 +47,8 @@ def setup_package(): url="http://www.statgen.org", license="GPL", packages=["pyplink"], + package_data={"pyplink.tests": ["data/test_data.*"], }, + test_suite="pyplink.tests.test_suite", install_requires=["numpy >= 1.8.2", "pandas >= 0.14.1"], classifiers=["Operating System :: Linux", "Programming Language :: Python",
Added the test suite to the setup.py
lemieuxl_pyplink
train
py
2598dcebbea37cd8b5fed338c0a975f927af1489
diff --git a/presto-main/src/main/java/com/facebook/presto/operator/PartitionedLookupSourceFactory.java b/presto-main/src/main/java/com/facebook/presto/operator/PartitionedLookupSourceFactory.java index <HASH>..<HASH> 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/PartitionedLookupSourceFactory.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/PartitionedLookupSourceFactory.java @@ -151,6 +151,7 @@ public final class PartitionedLookupSourceFactory { lock.writeLock().lock(); try { + checkState(!destroyed.isDone(), "already destroyed"); if (lookupSourceSupplier != null) { return immediateFuture(new SpillAwareLookupSourceProvider()); }
Add minor state check to PartitionedLookupSourceFactory PartitionedLookupSourceFactory#createLookupSourceProvider() should be called before the factory is destroyed. Otherwise, the returned future will never complete.
prestodb_presto
train
java
ea6a57e927189b75d647f252f05efd4ac4d87ffa
diff --git a/src/structures/MessagePayload.js b/src/structures/MessagePayload.js index <HASH>..<HASH> 100644 --- a/src/structures/MessagePayload.js +++ b/src/structures/MessagePayload.js @@ -209,7 +209,7 @@ class MessagePayload { /** * Resolves a single file into an object sendable to the API. * @param {BufferResolvable|Stream|FileOptions|MessageAttachment} fileLike Something that could be resolved to a file - * @returns {MessageFile} + * @returns {Promise<MessageFile>} */ static async resolveFile(fileLike) { let attachment;
docs(MessagePayload): Correct return type of `resolveFile()` (#<I>)
discordjs_discord.js
train
js
8c9dcbe8710a425abee860affbd8951cf19609e1
diff --git a/tests/test_constructor.py b/tests/test_constructor.py index <HASH>..<HASH> 100644 --- a/tests/test_constructor.py +++ b/tests/test_constructor.py @@ -4,12 +4,12 @@ from mastodon.Mastodon import MastodonIllegalArgumentError def test_constructor_from_filenames(tmpdir): client = tmpdir.join('client') - client.write_text('foo\nbar\n', 'UTF-8') + client.write_text(u'foo\nbar\n', 'UTF-8') access = tmpdir.join('access') - access.write_text('baz\n', 'UTF-8') + access.write_text(u'baz\n', 'UTF-8') api = Mastodon( str(client), - access_token = str(access)) + access_token=str(access)) assert api.client_id == 'foo' assert api.client_secret == 'bar' assert api.access_token == 'baz'
shouting!!!!!! ahhh python 2 is bad
halcy_Mastodon.py
train
py
34b60da8ebe4662e8e59d814e7214839ed6e82a9
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,11 +55,10 @@ author = 'Robin Thomas' # built documents. # import os.path -import re with open(os.path.join(os.path.dirname(__file__), '../VERSION'), 'r') as f: # The full version, including alpha/beta/rc tags. - release = f.read().strip() + version = f.read().strip() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.
corrected version reference in sphinx docs
robin900_gspread-dataframe
train
py
cb57992de5f55a4ce33181a893ad5b93e6ab396d
diff --git a/lib/topologies/mongos.js b/lib/topologies/mongos.js index <HASH>..<HASH> 100644 --- a/lib/topologies/mongos.js +++ b/lib/topologies/mongos.js @@ -807,17 +807,17 @@ Mongos.prototype.command = function(ns, cmd, options, callback) { // Pick a proxy var server = pickProxy(self); - // No server returned we had an error - if(server == null) { - return callback(new MongoError('no mongos proxy available')); - } - // Topology is not connected, save the call in the provided store to be // Executed at some point when the handler deems it's reconnected if((server == null || !server.isConnected()) && this.s.disconnectHandler != null) { return this.s.disconnectHandler.add('command', ns, cmd, options, callback); } + // No server returned we had an error + if(server == null) { + return callback(new MongoError('no mongos proxy available')); + } + // Execute the command server.command(ns, cmd, options, callback); }
fixed command execution issue for mongos
mongodb-js_mongodb-core
train
js
217188ce649fd810c77cdb6bb822101c71fcc89e
diff --git a/lib/web/files.go b/lib/web/files.go index <HASH>..<HASH> 100644 --- a/lib/web/files.go +++ b/lib/web/files.go @@ -49,6 +49,7 @@ type fileTransferRequest struct { func (h *Handler) transferFile(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *SessionContext, site reversetunnel.RemoteSite) (interface{}, error) { query := r.URL.Query() req := fileTransferRequest{ + cluster: p.ByName("site"), login: p.ByName("login"), namespace: p.ByName("namespace"), server: p.ByName("server"),
Pass site name along in fileTransferRequest.
gravitational_teleport
train
go
f774f6ee94a5a18d46e1953f850887a8b675c3bd
diff --git a/apio/managers/installer.py b/apio/managers/installer.py index <HASH>..<HASH> 100644 --- a/apio/managers/installer.py +++ b/apio/managers/installer.py @@ -240,23 +240,24 @@ class Installer(object): releases = api_request('{}/releases'.format(name), organization) if req_version: + if force: + return req_version # Find required version via @ return self._find_required_version( - releases, tag_name, req_version, spec, force) + releases, tag_name, req_version, spec) else: # Find latest version release return self._find_latest_version( releases, tag_name, req_version, spec) - def _find_required_version(self, releases, tag_name, req_version, spec, - force): + def _find_required_version(self, releases, tag_name, req_version, spec): version = self._check_sem_version(req_version, spec) for release in releases: prerelease = 'prerelease' in release and release.get('prerelease') if 'tag_name' in release: tag = tag_name.replace('%V', req_version) if tag == release.get('tag_name'): - if prerelease and not force: + if prerelease: click.secho( 'Warning: ' + req_version + ' is' + ' a pre-release.\n' +
Elevate force tag for install command
FPGAwars_apio
train
py
45d01dbbe27d80a9199790291080e65e72ae022c
diff --git a/cli/lib/cli/commands/base.rb b/cli/lib/cli/commands/base.rb index <HASH>..<HASH> 100644 --- a/cli/lib/cli/commands/base.rb +++ b/cli/lib/cli/commands/base.rb @@ -1,6 +1,5 @@ require "yaml" require "terminal-table/import" -require "blobstore_client" module Bosh::Cli module Command @@ -23,10 +22,6 @@ module Bosh::Cli @director ||= Bosh::Cli::Director.new(target, username, password) end - def blobstore - @blobstore ||= init_blobstore - end - def logged_in? username && password end
Removed unused stuff from base command
cloudfoundry_bosh
train
rb
1044f68b8acf6cfe694dcb632adfe3208d65deb8
diff --git a/tensorflow_datasets/translate/wmt19.py b/tensorflow_datasets/translate/wmt19.py index <HASH>..<HASH> 100644 --- a/tensorflow_datasets/translate/wmt19.py +++ b/tensorflow_datasets/translate/wmt19.py @@ -42,7 +42,7 @@ class Wmt19Translate(wmt.WmtTranslate): url=_URL, citation=_CITATION, language_pair=(l1, l2), - version="0.0.1") + version="0.0.2") for l1, l2 in _LANGUAGE_PAIRS ]
Increment WMT<I> version since a missing subset was added to RU-EN (commoncrawl). PiperOrigin-RevId: <I>
tensorflow_datasets
train
py
c490a88bfe4b2a59d2c8e914ac56ffa4d3119179
diff --git a/category/models.py b/category/models.py index <HASH>..<HASH> 100644 --- a/category/models.py +++ b/category/models.py @@ -35,7 +35,7 @@ class Category(models.Model): ) def __unicode__(self): - return self.title + return self.subtitle if self.subtitle else self.title class Meta: ordering = ('title',)
use subtitle as unicode if available
praekelt_django-category
train
py
defc12367572f404219fe1919ccf542353604069
diff --git a/registration/models.py b/registration/models.py index <HASH>..<HASH> 100644 --- a/registration/models.py +++ b/registration/models.py @@ -151,7 +151,7 @@ class RegistrationProfile(models.Model): pass def __str__(self): - return "User profile for %s" % self.user.username + return "Registration information for %s" % self.user.username def activation_key_expired(self): """
Tweak RegistrationProfile.__str__ to be a bit more informative
ubernostrum_django-registration
train
py
4f928dafb37c555c72f052f7cdcc41fd54258f2b
diff --git a/advanced_filters/forms.py b/advanced_filters/forms.py index <HASH>..<HASH> 100644 --- a/advanced_filters/forms.py +++ b/advanced_filters/forms.py @@ -56,7 +56,7 @@ class AdvancedFilterQueryForm(CleanWhiteSpacesMixin, forms.Form): ("lt", _("Less Than")), ("gt", _("Greater Than")), ("lte", _("Less Than or Equal To")), - ("gte", _("Less Than or Equal To")), + ("gte", _("Greater Than or Equal To")), ) FIELD_CHOICES = (
Fixed labeling error with 'Greater Than or Equal To'
modlinltd_django-advanced-filters
train
py
b6160341810d2b61956ce7b0b078f5b18f21bbb2
diff --git a/pygccxml/declarations/scopedef.py b/pygccxml/declarations/scopedef.py index <HASH>..<HASH> 100644 --- a/pygccxml/declarations/scopedef.py +++ b/pygccxml/declarations/scopedef.py @@ -246,7 +246,6 @@ class scopedef_t(declaration.declaration_t): """implementation details""" types = [] bases = list(decl.__class__.__bases__) - visited = set() if 'pygccxml' in decl.__class__.__module__: types.append(decl.__class__) while bases: @@ -257,8 +256,6 @@ class scopedef_t(declaration.declaration_t): continue if base is elaborated_info.elaborated_info: continue - if base in visited: - continue if 'pygccxml' not in base.__module__: continue types.append(base)
Remove unused code path The set is never updated, so that the continue can never be called in the loop. There seem to be no purpose for this code path, it is probably some legacy code that did not get cleaned up.
gccxml_pygccxml
train
py
8e46c48e17e602e31e6ec5a0a292828b40da08f4
diff --git a/albumentations/augmentations/functional.py b/albumentations/augmentations/functional.py index <HASH>..<HASH> 100644 --- a/albumentations/augmentations/functional.py +++ b/albumentations/augmentations/functional.py @@ -328,7 +328,7 @@ def optical_distortion(img, k=0, dx=0, dy=0, interpolation=cv2.INTER_LINEAR, bor x = x.astype(np.float32) - width / 2 - dx y = y.astype(np.float32) - height / 2 - dy theta = np.arctan2(y, x) - d = (x * x + y * y) ** 0.5 + d = (x * x + y * y + 1e-8) ** 0.5 r = d * (1 + k * d * d) map_x = r * np.cos(theta) + width / 2 + dx map_y = r * np.sin(theta) + height / 2 + dy
Apparently, when computing sum of squares we get a very small number that in occasion cases triggers a runtime warning "RuntimeWarning: invalid value encountered in sqrt". This commit adds tiny positive number to ensure a sum will be positive.
albu_albumentations
train
py
3a423472a3b01cf7ccb4eed87d2a6f5f8a91ce3c
diff --git a/zinnia/urls/authors.py b/zinnia/urls/authors.py index <HASH>..<HASH> 100644 --- a/zinnia/urls/authors.py +++ b/zinnia/urls/authors.py @@ -12,10 +12,10 @@ urlpatterns = patterns( url(r'^$', AuthorList.as_view(), name='zinnia_author_list'), - url(r'^(?P<username>[.+-@\w]+)/$', - AuthorDetail.as_view(), - name='zinnia_author_detail'), url(_(r'^(?P<username>[.+-@\w]+)/page/(?P<page>\d+)/$'), AuthorDetail.as_view(), name='zinnia_author_detail_paginated'), + url(r'^(?P<username>[.+-@\w]+)/$', + AuthorDetail.as_view(), + name='zinnia_author_detail'), )
Proper username resolution This re r'^(?P<username>[.+-@\w]+)/$' resolve username as the whole last part of URL. Mean this: If URL is "/blog/authors/someusername/page/<I>/" than username is "someusername/page/<I>/" Placing paginated view URL before UNpaginated will fix the problem.
Fantomas42_django-blog-zinnia
train
py
4e16d2d712ec3fb8cfb94abdb0443e5c1b7d15f5
diff --git a/app.js b/app.js index <HASH>..<HASH> 100644 --- a/app.js +++ b/app.js @@ -1,2 +1,2 @@ require('./index')(); -console.log(new Date().toLocaleString()) +console.log(new Date().toLocaleString());
refactor: fix eslint
avwo_whistle
train
js
c8288687c9eaac92e59d5d7902cfcffbb35369cb
diff --git a/contribs/gmf/src/print/component.js b/contribs/gmf/src/print/component.js index <HASH>..<HASH> 100644 --- a/contribs/gmf/src/print/component.js +++ b/contribs/gmf/src/print/component.js @@ -670,7 +670,7 @@ class Controller { togglePrintPanel_(active) { if (active) { if (!this.capabilities_) { - this.getCapabilities_(); + this.getCapabilities_(this.gmfAuthenticationService_.getRolesIds().join(',')); } this.capabilities_.then((resp) => { // make sure the panel is still open @@ -703,17 +703,15 @@ class Controller { /** * Gets the print capabilities. - * @param {number|null=} opt_roleId The role id. + * @param {string} roleId The roles ids. * @private */ - getCapabilities_(opt_roleId) { + getCapabilities_(roleId) { this.capabilities_ = this.ngeoPrint_.getCapabilities( /** @type {angular.IRequestShortcutConfig} */ ({ withCredentials: true, - params: opt_roleId ? { - 'role': opt_roleId, - 'cache_version': this.cacheVersion_ - } : { + params: { + 'role': roleId, 'cache_version': this.cacheVersion_ } }));
Always add a role id in print get capabilities
camptocamp_ngeo
train
js
17844c61b5ba8a2fd6974923abea7b0202fb80dc
diff --git a/calendar-bundle/src/Resources/contao/dca/tl_calendar_events.php b/calendar-bundle/src/Resources/contao/dca/tl_calendar_events.php index <HASH>..<HASH> 100644 --- a/calendar-bundle/src/Resources/contao/dca/tl_calendar_events.php +++ b/calendar-bundle/src/Resources/contao/dca/tl_calendar_events.php @@ -311,7 +311,7 @@ $GLOBALS['TL_DCA']['tl_calendar_events'] = array 'inputType' => 'imageSize', 'options' => System::getImageSizes(), 'reference' => &$GLOBALS['TL_LANG']['MSC'], - 'eval' => array('rgxp'=>'digit', 'nospace'=>true, 'helpwizard'=>true, 'tl_class'=>'w50'), + 'eval' => array('rgxp'=>'natural', 'includeBlankOption'=>true, 'nospace'=>true, 'helpwizard'=>true, 'tl_class'=>'w50'), 'sql' => "varchar(64) NOT NULL default ''" ), 'imagemargin' => array
[Calendar] Add an empty option to the image size select menu (see #<I>)
contao_contao
train
php