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
e34208a5e4d30b93176f858b122ff3ce3d1e2c42
diff --git a/mongoctl/mongoctl.py b/mongoctl/mongoctl.py index <HASH>..<HASH> 100644 --- a/mongoctl/mongoctl.py +++ b/mongoctl/mongoctl.py @@ -760,7 +760,8 @@ def mongo_stop_server(server, pid, force=False): ############################################################################### def force_stop_server(server, pid, try_mongo_force=True): success = False - if try_mongo_force: + # try mongo force stop if server is still online + if server.is_online() and try_mongo_force: success = mongo_stop_server(server, pid, force=True) if not success or not try_mongo_force:
Stop: Try mongo force stop only when the server is still online
mongolab_mongoctl
train
py
c5c527038d8d9fef7763f22538e626e8e217f641
diff --git a/src/Listener/GenerateSitemap.php b/src/Listener/GenerateSitemap.php index <HASH>..<HASH> 100644 --- a/src/Listener/GenerateSitemap.php +++ b/src/Listener/GenerateSitemap.php @@ -2,6 +2,8 @@ namespace Terabin\Sitemap\Listener; +use Flarum\Event\DiscussionWasHidden; +use Flarum\Event\DiscussionWasRestored; use Illuminate\Contracts\Events\Dispatcher; use Flarum\Event\DiscussionWasStarted; use Flarum\Event\DiscussionWasDeleted; @@ -30,6 +32,8 @@ class GenerateSitemap public function subscribe(Dispatcher $events) { $events->listen(DiscussionWasStarted::class, [$this, 'UpdateSitemap']); + $events->listen(DiscussionWasRestored::class, [$this, 'UpdateSitemap']); + $events->listen(DiscussionWasHidden::class, [$this, 'UpdateSitemap']); $events->listen(DiscussionWasDeleted::class, [$this, 'UpdateSitemap']); }
Update sitemap on hide and restore events
terabin_flarum-ext-sitemap
train
php
5d35d5a557cebddd326bc3dd8a2826b0963d05d9
diff --git a/host/analysis/plotting/plotting.py b/host/analysis/plotting/plotting.py index <HASH>..<HASH> 100644 --- a/host/analysis/plotting/plotting.py +++ b/host/analysis/plotting/plotting.py @@ -670,8 +670,6 @@ def create_1d_hist(hist, title=None, x_axis_title=None, y_axis_title=None, bins= else: x_max = math.ceil(hist.max()) hist_bins = int(x_max - x_min) + 1 if bins is None else bins - if hist_bins > int(x_max - x_min) + 1: - hist_bins = int(x_max - x_min) + 1 if hist_bins > 1: bin_width = (x_max - x_min) / (hist_bins - 1.0) else:
ENH: remove buggy code to avoid over-binning
SiLab-Bonn_pyBAR
train
py
9f9c366154d8d1e3e82af85214ec3378f8745ecf
diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js index <HASH>..<HASH> 100644 --- a/lib/OpenLayers/Tile.js +++ b/lib/OpenLayers/Tile.js @@ -83,7 +83,7 @@ OpenLayers.Tile.prototype = { redraw = true; } - OpenLayers.Util.clearArray(this); + this.clear(); this.bounds = bounds.clone(); this.position = position.clone(); if (redraw) { @@ -121,3 +121,4 @@ OpenLayers.Tile.prototype = { CLASS_NAME: "OpenLayers.Tile" }; + diff --git a/lib/OpenLayers/Tile/WFS.js b/lib/OpenLayers/Tile/WFS.js index <HASH>..<HASH> 100644 --- a/lib/OpenLayers/Tile/WFS.js +++ b/lib/OpenLayers/Tile/WFS.js @@ -58,7 +58,7 @@ OpenLayers.Tile.WFS.prototype = */ draw:function() { if (this.drawn) { - OpenLayers.Util.clearArray(this); + this.clear(); } OpenLayers.Tile.prototype.draw.apply(this, arguments); if (this.layer.displayOutsideMaxExtent || (this.layer.maxExtent && @@ -131,3 +131,4 @@ OpenLayers.Tile.WFS.prototype = } ); +
Apply patch for #<I> - fixing tile.clear() calls that were mistakenly replaced with OpenLayers.Util.clearArray() at r<I> git-svn-id: <URL>
openlayers_openlayers
train
js,js
836c33ba49a706c69121636d45359cdd42d52833
diff --git a/zounds/learn/embedding.py b/zounds/learn/embedding.py index <HASH>..<HASH> 100644 --- a/zounds/learn/embedding.py +++ b/zounds/learn/embedding.py @@ -1,14 +1,10 @@ from random import choice - import numpy as np -import torch -from torch import nn -from torch.optim import Adam - from util import to_var - class TripletEmbeddingTrainer(object): + + """ Learn an embedding by applying the triplet loss to anchor examples, negative examples, and deformed or adjacent examples, akin to: @@ -58,6 +54,7 @@ class TripletEmbeddingTrainer(object): yield epoch, batch def _apply_network_and_normalize(self, x): + import torch """ Pass x through the network, and give the output unit norm, as specified by section 4.2 of https://arxiv.org/pdf/1711.02209.pdf @@ -66,6 +63,9 @@ class TripletEmbeddingTrainer(object): return x / torch.norm(x, dim=1).view(-1, 1) def train(self, data): + from torch import nn + from torch.optim import Adam + # TODO: Why is this necessary? data = data['scaled']
Since pytorch isn't officially a dependency yet, imports happen within methods
JohnVinyard_zounds
train
py
023fc88660fdd5503904073163b9b747df9064e8
diff --git a/tests/SlotMachine/PageTest.php b/tests/SlotMachine/PageTest.php index <HASH>..<HASH> 100644 --- a/tests/SlotMachine/PageTest.php +++ b/tests/SlotMachine/PageTest.php @@ -270,4 +270,16 @@ class PageTest extends \PHPUnit_Framework_TestCase $this->assertEquals('I like cake', $page->get('quote')); } + + /** + * @covers SlotMachine\Page::createSlot + */ + public function testCreateSlot() + { + $page = new Page(self::$config); + $page->createSlot('hello', array('key' => 'a', 'cards' => array('salut', 'ciao'))); + + $this->assertInstanceOf('\SlotMachine\Slot', $page['hello']); + $this->assertEquals('ciao', $page->get('hello', 1)); + } }
Create test coverage on Page::createSlot
archfizz_slotmachine
train
php
8b1a83855371d1008bfb5730bdac06caf5500fba
diff --git a/src/express.js b/src/express.js index <HASH>..<HASH> 100644 --- a/src/express.js +++ b/src/express.js @@ -802,8 +802,7 @@ Collection.prototype.express = function(app, auth) { /* * /api/NAME */ - - console.log('adding route: ' + name); + Tyr.info('adding route: ' + name); let r = app.route('/api/' + name); r.all(auth);
feat: log express routes using internal log setup
tyranid-org_tyranid
train
js
8345c61c059596f3baf827a0b81d7039607820a1
diff --git a/lib/notifications/model.rb b/lib/notifications/model.rb index <HASH>..<HASH> 100644 --- a/lib/notifications/model.rb +++ b/lib/notifications/model.rb @@ -8,9 +8,9 @@ module Notifications belongs_to :actor, class_name: Notifications.config.user_class belongs_to :user, class_name: Notifications.config.user_class - belongs_to :target, polymorphic: true - belongs_to :second_target, polymorphic: true - belongs_to :third_target, polymorphic: true + belongs_to :target, polymorphic: true, optional: true + belongs_to :second_target, polymorphic: true, optional: true + belongs_to :third_target, polymorphic: true, optional: true scope :unread, -> { where(read_at: nil) } end
Make `belongs_to :class` optional (comply with Rails 5) (#9)
rails-engine_notifications
train
rb
17096036326d62e7e25368ff1247e708fa077cb1
diff --git a/raven/utils/stacks.py b/raven/utils/stacks.py index <HASH>..<HASH> 100644 --- a/raven/utils/stacks.py +++ b/raven/utils/stacks.py @@ -103,8 +103,10 @@ def iter_traceback_frames(tb): def iter_stack_frames(frames=None): if not frames: frames = inspect.stack()[1:] - for frame_crud in frames: - yield frame_crud[0] + for frame in (f[0] for f in frames): + if frame.f_locals.get('__traceback_hide__'): + continue + yield frame def get_stack_info(frames): results = []
Support __traceback_hide__ on stacks
elastic_apm-agent-python
train
py
30d4c189e80c3981f7042bbb01a17fdd4415d7c3
diff --git a/lib/gettext_i18n_rails/tasks.rb b/lib/gettext_i18n_rails/tasks.rb index <HASH>..<HASH> 100644 --- a/lib/gettext_i18n_rails/tasks.rb +++ b/lib/gettext_i18n_rails/tasks.rb @@ -69,7 +69,7 @@ namespace :gettext do storage_file = 'locale/model_attributes.rb' puts "writing model translations to: #{storage_file}" - ignore_tables = [/^sitemap_/, /_versions$/, 'schema_migrations', 'sessions'] + ignore_tables = [/^sitemap_/, /_versions$/, 'schema_migrations', 'sessions', 'delayed_jobs'] GettextI18nRails.store_model_attributes( :to => storage_file, :ignore_columns => [/_id$/, 'id', 'type', 'created_at', 'updated_at'],
add delayed jobs to the default ignored tables
grosser_gettext_i18n_rails
train
rb
25d16046c2f5fa3c28965efb113ca79c2e60bb0c
diff --git a/src/message.js b/src/message.js index <HASH>..<HASH> 100644 --- a/src/message.js +++ b/src/message.js @@ -320,6 +320,9 @@ Message.prototype.sign = function(privateKeys=[], signature=null) { onePassSig.hashAlgorithm = config.prefer_hash_algorithm; onePassSig.publicKeyAlgorithm = sigPacket.publicKeyAlgorithm; onePassSig.signingKeyId = sigPacket.issuerKeyId; + if (!privateKeys.length && i === 0) { + onePassSig.flags = 1; + } packetlist.push(onePassSig); } }
add one pass in case where no priv keys are passed in for signing
openpgpjs_openpgpjs
train
js
77dda04228f4361aea076989ac31ed80f7aacac9
diff --git a/src/engine/runtime.js b/src/engine/runtime.js index <HASH>..<HASH> 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -1561,7 +1561,13 @@ class Runtime extends EventEmitter { * @param {!string} monitorId ID of the monitor to remove. */ requestRemoveMonitor (monitorId) { - this._monitorState = this._monitorState.delete(monitorId); + // this._monitorState = this._monitorState.delete(monitorId); + // TODO is this performant? + if (this._monitorState.has(monitorId)) { + this._monitorState = this._monitorState.set( + monitorId, this._monitorState.get(monitorId).merge({visible: false}) + ); + } } /**
Set visible: false instead of deleting state in requestRemoveMonitor This potentially has performance implications, to be investigated later.
LLK_scratch-vm
train
js
279c24f034a4ff15968fecf492d74ae37eed6605
diff --git a/src/Propel/Generator/Builder/Om/ObjectBuilder.php b/src/Propel/Generator/Builder/Om/ObjectBuilder.php index <HASH>..<HASH> 100644 --- a/src/Propel/Generator/Builder/Om/ObjectBuilder.php +++ b/src/Propel/Generator/Builder/Om/ObjectBuilder.php @@ -1017,6 +1017,7 @@ abstract class ".$this->getUnqualifiedClassName().$parentClass." implements Acti { $name = self::getBooleanAccessorName($column); if (in_array($name, ClassTools::getPropelReservedMethods())) { + //TODO: Issue a warning telling the user to use default accessors return; // Skip boolean accessors for reserved names } $this->addDefaultAccessorComment($script, $column);
skip-reserved-methods: Added a warning TODO
propelorm_Propel2
train
php
7e901cd08b8c924c493a32af051ec1373823d9f3
diff --git a/src/tsd/GraphHandler.java b/src/tsd/GraphHandler.java index <HASH>..<HASH> 100644 --- a/src/tsd/GraphHandler.java +++ b/src/tsd/GraphHandler.java @@ -716,11 +716,14 @@ final class GraphHandler implements HttpRpc { * or -1 if there was no query string parameter named {@code paramname}. * @throws BadRequestException if the date is invalid. */ - private long getQueryStringDate(final HttpQuery query, - final String paramname) { + private static long getQueryStringDate(final HttpQuery query, + final String paramname) { final String date = query.getQueryStringParam(paramname); if (date == null) { return -1; + } else if (date.endsWith("-ago")) { + return (System.currentTimeMillis() / 1000 + - parseDuration(date.substring(0, date.length() - 4))); } try { final SimpleDateFormat fmt = new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss");
Allow relative time specification ("1d-ago") in HTTP queries. This makes it easier to build dashboards. Change-Id: Id<I>b7a<I>f5d<I>bf<I>a5f6c9aae2e<I>
OpenTSDB_opentsdb
train
java
98af86a1abd72e0a8254a75d7c42fb2ebf7602ea
diff --git a/pymongo/message.py b/pymongo/message.py index <HASH>..<HASH> 100644 --- a/pymongo/message.py +++ b/pymongo/message.py @@ -232,6 +232,20 @@ class _CursorAddress(tuple): """The namespace this cursor.""" return self.__namespace + def __hash__(self): + # Two _CursorAddress instances with different namespaces + # must not hash the same. + return (self + (self.__namespace,)).__hash__() + + def __eq__(self, other): + if isinstance(other, _CursorAddress): + return (tuple(self) == tuple(other) + and self.namespace == other.namespace) + return NotImplemented + + def __ne__(self, other): + return not self == other + def __last_error(namespace, args): """Data to send to do a lastError.
PYTHON-<I> - Fix an issue with killCursors handling
mongodb_mongo-python-driver
train
py
f5d3313210461aecbb199a48d63e48f92596853c
diff --git a/cmd/admin-handlers-users-race_test.go b/cmd/admin-handlers-users-race_test.go index <HASH>..<HASH> 100644 --- a/cmd/admin-handlers-users-race_test.go +++ b/cmd/admin-handlers-users-race_test.go @@ -73,7 +73,7 @@ func TestIAMInternalIDPConcurrencyServerSuite(t *testing.T) { } func (s *TestSuiteIAM) TestDeleteUserRace(c *check) { - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second) defer cancel() bucket := getRandomBucketName()
Increase context timeout for IAM concurrency test (#<I>) - This should reduce failures in Windows CI
minio_minio
train
go
4af827e9f8b6d2308c6c662190cf1b3eceb6faf0
diff --git a/src/Illuminate/Notifications/Messages/MailMessage.php b/src/Illuminate/Notifications/Messages/MailMessage.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Notifications/Messages/MailMessage.php +++ b/src/Illuminate/Notifications/Messages/MailMessage.php @@ -333,7 +333,10 @@ class MailMessage extends SimpleMessage implements Renderable { if (isset($this->view) || isset($this->textView)) { return Container::getInstance()->make('mailer')->render( - [$this->view, $this->textView], + [ + 'html' => $this->view, + 'text' => $this->textView, + ], $this->data() ); }
Fix rendering plain text only notifications (#<I>)
laravel_framework
train
php
bead5f1da943879da2b08c975b4600feb97e8a70
diff --git a/lib/cruftfiles-ajax.php b/lib/cruftfiles-ajax.php index <HASH>..<HASH> 100644 --- a/lib/cruftfiles-ajax.php +++ b/lib/cruftfiles-ajax.php @@ -143,6 +143,16 @@ function seravo_ajax_list_cruft_files() { $crufts = array_merge($crufts, $cruft_found); } } + + $crufts = array_filter($crufts, function( $item ) use ( $crufts ) { + foreach ( $crufts as $substring ) { + if ( strpos($item, $substring) === 0 && $item !== $substring ) { + return false; + } + } + return true; + }); + $crufts = array_unique($crufts); set_transient('cruft_files_found', $crufts, 600);
Fix cruftfileremover information retrieval This commit fixes how the cruftremover shows file size information and removes subdirectories and files from the listings.
Seravo_seravo-plugin
train
php
5d775fa248297f1aa5749a4f63ed342520c0f0e6
diff --git a/src/controllers/StartController.php b/src/controllers/StartController.php index <HASH>..<HASH> 100644 --- a/src/controllers/StartController.php +++ b/src/controllers/StartController.php @@ -13,7 +13,7 @@ namespace hidev\controllers; use hidev\base\File; use Yii; -use yii\base\InvalidConfigException; +use yii\base\InvalidParamException; /** * Start goal. @@ -76,7 +76,7 @@ class StartController extends CommonController /** * Chdirs to project's root by looking for config file in the current directory and up. - * @throws InvalidConfigException when failed to find + * @throws InvalidParamException when failed to find * @return string path to the root directory of hidev project */ protected function findDir() @@ -88,6 +88,6 @@ class StartController extends CommonController } chdir('..'); } - throw new InvalidConfigException('Not a hidev project (or any of the parent directories). Use `hidev init` to initialize hidev project.'); + throw new InvalidParamException("Not a hidev project (or any of the parent directories).\nUse `hidev init` to initialize hidev project."); } }
fixed error showing when not a hidev project
hiqdev_hidev
train
php
8c57b0924d18a523161eb454b542d54acae6ee18
diff --git a/tensorforce/models/model.py b/tensorforce/models/model.py index <HASH>..<HASH> 100755 --- a/tensorforce/models/model.py +++ b/tensorforce/models/model.py @@ -1239,7 +1239,7 @@ class Model(object): # feed_dict = {self.terminal_input: (terminal,), self.reward_input: (reward,)} self.is_observe = True - episode = self.monitored_session.raw_session().run(fetches=fetches, feed_dict=feed_dict) + episode = self.monitored_session.run(fetches=fetches, feed_dict=feed_dict) self.is_observe = False return episode
Make ps not build a model (which it doesn't need). Fix dqn json files (update_mode and other fixes). Added utility function to utils to get the dependencies for a given tensor.
tensorforce_tensorforce
train
py
ae2e199ce1ffde4aedc91df190d600b9eece7a6f
diff --git a/lib/python/vdm/server/HTTPListener.py b/lib/python/vdm/server/HTTPListener.py index <HASH>..<HASH> 100644 --- a/lib/python/vdm/server/HTTPListener.py +++ b/lib/python/vdm/server/HTTPListener.py @@ -582,7 +582,8 @@ def make_configuration_file(): def sync_configuration(): headers = {'content-type': 'application/json'} - url = 'http://' + __IP__ + ':' + str(__PORT__) + '/api/1.0/vdm/configuration/' + url = 'http://%s:%u/api/1.0/vdm/configuration/' % \ + (__IP__,str(__PORT__)) response = requests.post(url, headers=headers) return response
VDM-<I>: changed way of building url string as commented in pull request
VoltDB_voltdb
train
py
531dcb84094420ffaf878e4c1a8e8b61513407e4
diff --git a/admin_honeypot/admin.py b/admin_honeypot/admin.py index <HASH>..<HASH> 100644 --- a/admin_honeypot/admin.py +++ b/admin_honeypot/admin.py @@ -10,7 +10,8 @@ class LoginAttemptAdmin(admin.ModelAdmin): def get_actions(self, request): actions = super(LoginAttemptAdmin, self).get_actions(request) - del actions['delete_selected'] + if 'delete_selected' in actions: + del actions['delete_selected'] return actions def get_session_key(self, instance):
Check that the delete_selected action is present before trying to remove it.
dmpayton_django-admin-honeypot
train
py
ca141fd4d57c79a02d48209952db822a18c69225
diff --git a/plugin/deskmanager/deskmanager/src/main/java/org/geomajas/plugin/deskmanager/servlet/mvc/ShapeFileUploadController.java b/plugin/deskmanager/deskmanager/src/main/java/org/geomajas/plugin/deskmanager/servlet/mvc/ShapeFileUploadController.java index <HASH>..<HASH> 100644 --- a/plugin/deskmanager/deskmanager/src/main/java/org/geomajas/plugin/deskmanager/servlet/mvc/ShapeFileUploadController.java +++ b/plugin/deskmanager/deskmanager/src/main/java/org/geomajas/plugin/deskmanager/servlet/mvc/ShapeFileUploadController.java @@ -158,8 +158,10 @@ public class ShapeFileUploadController { while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); - copyInputStream(zipFile.getInputStream(entry), new BufferedOutputStream(new FileOutputStream(tmpDir - + "/" + entry.getName()))); + if (!entry.getName().contains("__MACOSX")) { + copyInputStream(zipFile.getInputStream(entry), new BufferedOutputStream(new FileOutputStream(tmpDir + + "/" + entry.getName()))); + } } zipFile.close();
GBE-<I> Shapefile upload fails with zipfile created on Mac
geomajas_geomajas-project-server
train
java
128f1a3ced9ea5e87423a2c1fc9e771cfe90b596
diff --git a/utils/slither_format/slither_format.py b/utils/slither_format/slither_format.py index <HASH>..<HASH> 100644 --- a/utils/slither_format/slither_format.py +++ b/utils/slither_format/slither_format.py @@ -93,7 +93,8 @@ def apply_patches(slither, patches): else: out_file_str += in_file_str[:int(patches[file][i]['start'])] out_file_str += patches[file][i]['new_string'] - out_file_str += in_file_str[int(patches[file][i]['end']):] + if (i == (len(patches[file]) - 1)): + out_file_str += in_file_str[int(patches[file][i]['end']):] out_file = open(_in_file+".format",'w') out_file.write(out_file_str) out_file.close()
Fixes uninitialised variable bugh! Manifests when patch count is zero.
crytic_slither
train
py
4459fdc6048d8c90087b58b7197eb41034843d6c
diff --git a/view.js b/view.js index <HASH>..<HASH> 100644 --- a/view.js +++ b/view.js @@ -129,7 +129,7 @@ var View = Backbone.View.extend({ render: function() { _.result(this, 'unobserve'); - var data = _.extend({}, this.data, _.result(this.state, 'toJSON'), _.result(this.model, 'toJSON')); + var data = _.extend({}, app.context, this.data, _.result(this.state, 'toJSON'), _.result(this.model, 'toJSON')); this.renderTemplate(data).ready(_.filter(arguments, _.isFunction));
Merge app.context with all other data for template rendering.
thecodebureau_ridge
train
js
a72f185bf84970d7dbb176d845426618a4179b0f
diff --git a/tempy/tempy.py b/tempy/tempy.py index <HASH>..<HASH> 100644 --- a/tempy/tempy.py +++ b/tempy/tempy.py @@ -93,7 +93,7 @@ class DOMElement: def __isub__(self, other): """removes the child.""" if other not in self: - raise ValueError(f'Subtraction impossible. {other} is not in {self}') + raise ValueError('Subtraction impossible. {o} is not in {s}'.format(o=other, s=self)) return self.pop(other._own_index) def __mul__(self, n):
f-strings are for fun not yet for master
Hrabal_TemPy
train
py
5da1ad622ef37eb5acaa48213482f91359aba9f1
diff --git a/angr/path.py b/angr/path.py index <HASH>..<HASH> 100644 --- a/angr/path.py +++ b/angr/path.py @@ -1,4 +1,5 @@ from os import urandom +import os import copy import sys import logging @@ -734,7 +735,10 @@ class Path(object): if where_object is None: return "<Path with %d runs (at 0x%x)>" % (self.length, self.addr) else: - return "<Path with %d runs (at 0x%x : %s)>" % (self.length, self.addr, where_object.binary) + return "<Path with %d runs (at 0x%x : %s)>" % (self.length, + self.addr, + os.path.basename(where_object.binary) + ) class ErroredPath(Path):
Path: only display basename of each binary in __repr__().
angr_angr
train
py
3b6d4d09a30cf5263961bd4ff754f26deef4f354
diff --git a/src/main/java/com/spotify/docker/client/messages/Info.java b/src/main/java/com/spotify/docker/client/messages/Info.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/spotify/docker/client/messages/Info.java +++ b/src/main/java/com/spotify/docker/client/messages/Info.java @@ -275,13 +275,17 @@ public abstract class Info { @JsonProperty("Volumes") public abstract ImmutableList<String> volumes(); - @JsonProperty("Networks") + /** + * Return the value of the `network` json path + * todo this method should be renamed to network + */ + @JsonProperty("Network") public abstract ImmutableList<String> networks(); @JsonCreator static Plugins create( @JsonProperty("Volumes") final List<String> volumes, - @JsonProperty("Networks") final List<String> networks) { + @JsonProperty("Network") final List<String> networks) { final ImmutableList<String> volumesT = volumes == null ? ImmutableList.<String>of() : ImmutableList.copyOf(volumes); final ImmutableList<String> networksT =
Fix typo in the JSON field name Rename the Networks to Network in order to deserialize the docker info response. We are not changing the Java API in order to follow the name of the field because it will add a breaking change. We can always perform that action later on with a follow up commit.
spotify_docker-client
train
java
ad4912d6012849eb900ac74fe05d1d3e368883c9
diff --git a/superset/assets/src/explore/AdhocFilter.js b/superset/assets/src/explore/AdhocFilter.js index <HASH>..<HASH> 100644 --- a/superset/assets/src/explore/AdhocFilter.js +++ b/superset/assets/src/explore/AdhocFilter.js @@ -45,7 +45,8 @@ export default class AdhocFilter { this.clause = adhocFilter.clause; this.sqlExpression = null; } else if (this.expressionType === EXPRESSION_TYPES.SQL) { - this.sqlExpression = adhocFilter.sqlExpression || + this.sqlExpression = typeof adhocFilter.sqlExpression === 'string' ? + adhocFilter.sqlExpression : translateToSql(adhocFilter, { useSimple: true }); this.clause = adhocFilter.clause; this.subject = null;
Allowing sqlExpression to be blank
apache_incubator-superset
train
js
a50e440cf1d6381b41471fe6fbcf8f761cd38e21
diff --git a/server/export.js b/server/export.js index <HASH>..<HASH> 100644 --- a/server/export.js +++ b/server/export.js @@ -9,9 +9,9 @@ import { renderToHTML } from './render' import { getAvailableChunks } from './utils' import { printAndExit } from '../lib/utils' -export default async function (dir, options) { +export default async function (dir, options, configuration) { dir = resolve(dir) - const config = getConfig(dir) + const config = configuration || getConfig(dir) const nextDir = join(dir, config.distDir) log(` using build directory: ${nextDir}`)
Pass conf to export function (#<I>) * Pass conf to export function * conf -> configuration
zeit_next.js
train
js
17986f5a4c3e4f774fa6f6c7e0d2227ed2750144
diff --git a/src/module-elasticsuite-tracker/Model/ResourceModel/EventQueue.php b/src/module-elasticsuite-tracker/Model/ResourceModel/EventQueue.php index <HASH>..<HASH> 100644 --- a/src/module-elasticsuite-tracker/Model/ResourceModel/EventQueue.php +++ b/src/module-elasticsuite-tracker/Model/ResourceModel/EventQueue.php @@ -79,7 +79,12 @@ class EventQueue extends AbstractDb $eventData = $this->getConnection()->fetchAll($select); foreach ($eventData as &$currentEvent) { - $currentEvent = array_merge($currentEvent, $this->jsonSerializer->unserialize($currentEvent['data'])); + try { + $currentEventData = $this->jsonSerializer->unserialize($currentEvent['data']); + } catch (\InvalidArgumentException $e) { + $currentEventData = []; + } + $currentEvent = array_merge($currentEvent, $currentEventData); unset($currentEvent['data']); }
Preventing indexing cron failure on bad json data usefull if DB storage table was populated with external data.
Smile-SA_elasticsuite
train
php
a06510eb81308c37512f7bb2d91436d76cfa60fa
diff --git a/src/Providers/ServiceProvider.php b/src/Providers/ServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Providers/ServiceProvider.php +++ b/src/Providers/ServiceProvider.php @@ -8,14 +8,14 @@ use Route; use FondBot\Contracts\Events\MessageSent; use FondBot\Listeners\MessageSentListener; use Illuminate\Contracts\Events\Dispatcher; -use FondBot\Contracts\Providers\ChannelServiceProvider; use FondBot\Contracts\Events\MessageReceived; use FondBot\Listeners\MessageReceivedListener; use FondBot\Contracts\Database\Entities\Channel; -use FondBot\Contracts\Providers\ConversationServiceProvider; use FondBot\Contracts\Database\Services\ChannelService; use FondBot\Contracts\Database\Services\MessageService; +use FondBot\Contracts\Providers\ChannelServiceProvider; use FondBot\Contracts\Database\Services\ParticipantService; +use FondBot\Contracts\Providers\ConversationServiceProvider; use Illuminate\Support\ServiceProvider as BaseServiceProvider; class ServiceProvider extends BaseServiceProvider
Move ServiceProviders to Contracts
fondbot_framework
train
php
0fb79bc1c55db7e13eb4ce987256b87f751d3d01
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -14,10 +14,11 @@ module.exports = function (plopfilePath) { const plop = plopBase(); const runner = generatorRunner(plop); - plopfilePath = path.resolve(plopfilePath); - - plop.setPlopfilePath(plopfilePath); - require(plopfilePath)(plop); + if (plopfilePath) { + plopfilePath = path.resolve(plopfilePath); + plop.setPlopfilePath(plopfilePath); + require(plopfilePath)(plop); + } ///// // external API for node-plop @@ -31,6 +32,7 @@ module.exports = function (plopfilePath) { runPrompts: () => runner.runGeneratorPrompts(genObject) }); }, + setGenerator: plop.setGenerator, runActions: runner.runGeneratorActions, runPrompts: runner.runGeneratorPrompts };
Make plop file optional, and expose plop.setGenerator() function to allow dynamic creation of generator configs.
amwmedia_node-plop
train
js
9a60ababfc93eb10816b66440eb1fb18941f6b6f
diff --git a/pymatgen/analysis/structure_analyzer.py b/pymatgen/analysis/structure_analyzer.py index <HASH>..<HASH> 100644 --- a/pymatgen/analysis/structure_analyzer.py +++ b/pymatgen/analysis/structure_analyzer.py @@ -4,6 +4,7 @@ from __future__ import division, unicode_literals +import warnings import six import ruamel.yaml as yaml import os @@ -52,6 +53,9 @@ class VoronoiCoordFinder(object): def __init__(self, structure, target=None, cutoff=10.0, allow_pathological=False): + warnings.warn("VoronoiCoordFinder will be moved to local_env.py" + " with pymatgen >= 2018") + self._structure = structure self.cutoff = cutoff self.allow_pathological = allow_pathological @@ -159,6 +163,9 @@ class JMolCoordFinder: radii table values """ + warnings.warn("JMolCoordFinder will be moved to local_env.py" + " with pymatgen >= 2018") + # load elemental radii table bonds_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "bonds_jmol_ob.yaml")
Added deprecation warnings to structure_analyzer.py
materialsproject_pymatgen
train
py
eed3b96bde8a05232599c967177dead748ea6f1d
diff --git a/tests/EntityTest.php b/tests/EntityTest.php index <HASH>..<HASH> 100644 --- a/tests/EntityTest.php +++ b/tests/EntityTest.php @@ -110,6 +110,11 @@ class EntityTest extends TestCase $this->performEntityTest(\Picqer\Financials\Exact\DocumentAttachment::class); } + public function testEmployeeEntity() + { + $this->performEntityTest(\Picqer\Financials\Exact\Employee::class); + } + public function testGeneralJournalEntity() { $this->performEntityTest(\Picqer\Financials\Exact\GeneralJournalEntry::class); @@ -390,16 +395,25 @@ class EntityTest extends TestCase $this->performEntityTest(\Picqer\Financials\Exact\Project::class); } + public function testProjectWBSByProject() + { + $this->performEntityTest(\Picqer\Financials\Exact\ProjectWBSByProject::class); + } + public function testShopOrder() { $this->performEntityTest(\Picqer\Financials\Exact\ShopOrder::class); } - + + public function testTimeTransactionEntity() + { + $this->performEntityTest(\Picqer\Financials\Exact\TimeTransaction::class); + } + public function testUser() { $this->performEntityTest(\Picqer\Financials\Exact\User::class); } - public function testShopOrderMaterialPlan() {
Added tests for Employee, ProjectWBSByProject and TimeTransaction entities
picqer_exact-php-client
train
php
2d94df01708ccec90bebf7a24e85dbc1bb2af8e0
diff --git a/webpsupport/src/main/java/com/facebook/webpsupport/WebpBitmapFactoryImpl.java b/webpsupport/src/main/java/com/facebook/webpsupport/WebpBitmapFactoryImpl.java index <HASH>..<HASH> 100644 --- a/webpsupport/src/main/java/com/facebook/webpsupport/WebpBitmapFactoryImpl.java +++ b/webpsupport/src/main/java/com/facebook/webpsupport/WebpBitmapFactoryImpl.java @@ -37,6 +37,7 @@ public class WebpBitmapFactoryImpl implements WebpBitmapFactory { private static final int HEADER_SIZE = 20; private static final int IN_TEMP_BUFFER_SIZE = 8*1024; + private static final byte[] DEFAULT_TEMP_STORAGE = new byte[IN_TEMP_BUFFER_SIZE]; public static final boolean IN_BITMAP_SUPPORTED = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; @@ -480,7 +481,7 @@ public class WebpBitmapFactoryImpl implements WebpBitmapFactory { if (options != null && options.inTempStorage != null) { return options.inTempStorage; } else { - return new byte[IN_TEMP_BUFFER_SIZE]; + return DEFAULT_TEMP_STORAGE; } }
Enable webp back with single temp storage
facebook_fresco
train
java
ac5fb5530114b43970c36ce62fb7f85f3e8d7d01
diff --git a/cmd/rqlite/execute.go b/cmd/rqlite/execute.go index <HASH>..<HASH> 100644 --- a/cmd/rqlite/execute.go +++ b/cmd/rqlite/execute.go @@ -81,7 +81,7 @@ func executeWithClient(ctx *cli.Context, client *http.Client, argv *argT, timer } if resp.StatusCode != http.StatusOK { - return fmt.Errorf("server responded with: %s", resp.Status) + return fmt.Errorf("server responded with %s: %s", resp.Status, response) } // Parse response and write results diff --git a/cmd/rqlite/query.go b/cmd/rqlite/query.go index <HASH>..<HASH> 100644 --- a/cmd/rqlite/query.go +++ b/cmd/rqlite/query.go @@ -135,7 +135,7 @@ func queryWithClient(ctx *cli.Context, client *http.Client, argv *argT, timer bo } if resp.StatusCode != http.StatusOK { - return fmt.Errorf("server responded with: %s", resp.Status) + return fmt.Errorf("server responded with %s: %s", resp.Status, response) } // Parse response and write results
Display HTTP response body on <I>
rqlite_rqlite
train
go,go
9912af72ae533269f1e303fa395c4756de1885fb
diff --git a/js/adyen.encrypt.js b/js/adyen.encrypt.js index <HASH>..<HASH> 100644 --- a/js/adyen.encrypt.js +++ b/js/adyen.encrypt.js @@ -1128,7 +1128,7 @@ if (handlers.luhnHandler && handlers.cvcHandler && elementsByName.number && elementsByName.cvc) { handlers.luhnHandler.chain(function(ev) { - handlers.cvcHandler({target:elementsByName.cvc, originalEvent: ev, type : (ev|{}).type, isInitializing : (ev||{}).isInitializing}) + handlers.cvcHandler({target:elementsByName.cvc, originalEvent: ev, type : (ev||{}).type, isInitializing : (ev||{}).isInitializing}) }); } },
Fix typo in 'or' operator
Adyen_adyen-cse-web
train
js
255574be8c77dd89fc7f36dd331074c74fca7788
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,7 @@ var pumpify = require('pumpify') var exec = require('ssh-exec') var execspawn = require('execspawn') var debug = require('debug')('transport-stream') -var debugStream = require('debug-stream')(function (out) { debug('buffer', {length: out.length, data: out}) }) +var debugStream = require('debug-stream') var destroy = function () { this.destroy() @@ -94,7 +94,9 @@ module.exports = function (opts) { var cmd = opts && opts.command return function (transport) { - return pumpify(getTransport(), debugStream()) + var transportStream = getTransport() + if (!process.env.DEBUG) return transportStream + else return pumpify(debugStream(debugLogger('out')), transportStream, debugStream(debugLogger('in'))) function getTransport () { if (!transport) throw new Error('Transport required') @@ -117,3 +119,9 @@ module.exports = function (opts) { } } } + +function debugLogger (prefix) { + return function (buf) { + debug(prefix, {length: buf.length, data: buf}) + } +}
only instrument if DEBUG, and instrument on incoming and outgoing
mafintosh_transport-stream
train
js
e2e1cdb336ec89b26fcd22116510c2d5eee6924e
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java index <HASH>..<HASH> 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorService.java @@ -63,7 +63,7 @@ public class TraceableExecutorService implements ExecutorService { @Override public void execute(Runnable command) { - this.delegate.submit(ContextUtil.isContextInCreation(this.beanFactory) ? command + this.delegate.execute(ContextUtil.isContextInCreation(this.beanFactory) ? command : new TraceRunnable(tracing(), spanNamer(), command, this.spanName)); }
Fix TraceableExecutorService (#<I>) TraceableExecutorService swallows Exception because `execute` submits a Runnable and ignores the Future's result. It should call the delegates `execute` method instead of the `submit`.
spring-cloud_spring-cloud-sleuth
train
java
90a765130badd895910a32abb33a62428290c145
diff --git a/src/JwtAuthentication/RequestPathRule.php b/src/JwtAuthentication/RequestPathRule.php index <HASH>..<HASH> 100644 --- a/src/JwtAuthentication/RequestPathRule.php +++ b/src/JwtAuthentication/RequestPathRule.php @@ -18,7 +18,8 @@ namespace Slim\Middleware\JwtAuthentication; class RequestPathRule implements RuleInterface { protected $options = array( - "path" => "/" + "path" => "/", + "passthrough" => array() ); public function __construct($options = array()) @@ -28,8 +29,16 @@ class RequestPathRule implements RuleInterface public function __invoke(\Slim\Slim $app) { + /* If request path is matches passthrough should not authenticate. */ + foreach ($this->options["passthrough"] as $passthrough) { + $passthrough = rtrim($passthrough, "/"); + if (!!preg_match("@{$passthrough}(/.*)?$@", $app->request->getPath())) { + return false; + } + } + + /* Otherwise check if path matches and we should authenticate. */ $path = rtrim($this->options["path"], "/"); - $regex = "@{$path}(/.*)?$@"; - return !!preg_match($regex, $app->request->getPath()); + return !!preg_match("@{$path}(/.*)?$@", $app->request->getPath()); } }
Possibility to passthrough paths which otherwise would authenticate $app->add(new JwtAuthentication([ "secret" => getenv("JWT_SECRET"), "rules" => [ new RequestPathRule([ "path" => "/", "passthrough" => ["/token"] ]) ] ]));
tuupola_slim-jwt-auth
train
php
3c57c234a736ac67e018f724803c879f0791466f
diff --git a/src/plugin.js b/src/plugin.js index <HASH>..<HASH> 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -537,6 +537,7 @@ class VR extends Plugin { window.addEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_, true); this.initialized_ = true; + this.trigger('initialized'); } addCardboardButton_() {
feat: Add an initialization event that triggers after init() is finished (#<I>)
videojs_videojs-vr
train
js
868c6597c3321dcfcd4641490461039a658d7c94
diff --git a/httpagentparser/__init__.py b/httpagentparser/__init__.py index <HASH>..<HASH> 100644 --- a/httpagentparser/__init__.py +++ b/httpagentparser/__init__.py @@ -242,8 +242,13 @@ class Android(Dist): look_for = 'Android' def getVersion(self, agent): - return agent.split('Android')[-1].split(';')[0].strip() - + if "Mobile Safari" in agent: + deviceType = "Phone" + else: + deviceType = "Tablet" + aVersion = agent.split('Android')[-1].split(';')[0].strip() + return deviceType + " " + aVersion + class WebOS(Dist): look_for = 'hpwOS'
Android phone / tablet differentiation Added a check to differentiate between Android phones and tablets.
shon_httpagentparser
train
py
62d9632d04f2f1fbee6ad852d355339c81fb145f
diff --git a/spec/operators/retry-spec.js b/spec/operators/retry-spec.js index <HASH>..<HASH> 100644 --- a/spec/operators/retry-spec.js +++ b/spec/operators/retry-spec.js @@ -78,20 +78,24 @@ describe('Observable.prototype.retry()', function () { it('should handle an empty source', function () { var source = cold('|'); + var subs = '(^!)'; var expected = '|'; var result = source.retry(); expectObservable(result).toBe(expected); + expectSubscriptions(source.subscriptions).toBe(subs); }); it('should handle a never source', function () { var source = cold('-'); + var subs = '^'; var expected = '-'; var result = source.retry(); expectObservable(result).toBe(expected); + expectSubscriptions(source.subscriptions).toBe(subs); }); it('should return a never observable given an async just-throw source and no count', function () {
test(retry): improve subscription assertions on retry tests
ReactiveX_rxjs
train
js
7719b30ce141622fd8b833859e7ec6ed70033958
diff --git a/src/interfaces/Whip_MessagePresenter.php b/src/interfaces/Whip_MessagePresenter.php index <HASH>..<HASH> 100644 --- a/src/interfaces/Whip_MessagePresenter.php +++ b/src/interfaces/Whip_MessagePresenter.php @@ -1,6 +1,8 @@ <?php - +/** + * Interface Whip_MessagePresenter. + */ interface Whip_MessagePresenter { /**
Documentation: add perfunctory class docblocks
Yoast_whip
train
php
7d27cb557b1042152bb4488f6bd06e420f93249f
diff --git a/selectron.js b/selectron.js index <HASH>..<HASH> 100644 --- a/selectron.js +++ b/selectron.js @@ -284,7 +284,6 @@ module.exports = { return $block.text().length === 0 || off === count($block[0]) - count($block.children('UL,OL')[0]); }, - /** * Get Positions of start and end caret of current selection * @@ -313,13 +312,25 @@ module.exports = { * @param {Node} node - The node to select */ select: function(node) { - var children = node.offspring(); - var first = children[0]; - var last = children[children.length - 1]; - this.set({ - start: { ref: first, offset: 0, isAtStart: true }, - end: { ref: last, offset: last.textContent.length, isAtStart: last.textContent.length === 0 } - }); + var textNodes = node.nodeType === 3 ? [ node ] : descendants(node, 3); + + if(textNodes.length === 0) { + this.set({ ref: node, offset: 0 }); + } else { + var first = _.first(textNodes), + last = _.last(textNodes); + + this.set({ + start: { + ref: first, + offset: 0 + }, + end: { + ref: last, + offset: last.textContent.length, + } + }); + } }, /**
Reimplemented select() method. Which sets the current selection to contain the node (will select the elements text nodes, and will thus not FULLY contain the node.
lohfu_spytext
train
js
7dc8d71494f186478fce8d65b725b5b7f5104a08
diff --git a/src/Illuminate/Translation/Translator.php b/src/Illuminate/Translation/Translator.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Translation/Translator.php +++ b/src/Illuminate/Translation/Translator.php @@ -40,6 +40,13 @@ class Translator extends NamespacedItemResolver implements TranslatorInterface protected $loaded = []; /** + * The message selector. + * + * @var \Symfony\Component\Translation\MessageSelector + */ + protected $selector; + + /** * Create a new translator instance. * * @param \Illuminate\Translation\LoaderInterface $loader
Declare $selector property.
laravel_framework
train
php
af321f82c389124c82d0ab30f76aedb9de4a31fc
diff --git a/lib/components/prometheusmetrics.js b/lib/components/prometheusmetrics.js index <HASH>..<HASH> 100644 --- a/lib/components/prometheusmetrics.js +++ b/lib/components/prometheusmetrics.js @@ -56,10 +56,11 @@ */ function PrometheusMetrics() { // Only attempt to load these dependencies if metrics are enabled - this._client = require("prom-client"); + var client = this._client = require("prom-client"); - // requires prom-client 9.0.0 or above - this._client.collectDefaultMetrics(); + // prom-client 9.0.0 has to be asked explicitly; previous versions would + // do this by default + if (client.collectDefaultMetrics) client.collectDefaultMetrics(); this._collectors = []; // executed in order this._counters = {}; // counter metrics keyed by name
Only call collectDefaultMetrics() if the function exists; so the code still works on older versions
matrix-org_matrix-appservice-bridge
train
js
28c19048d52cb57d50e4a92b92069e14efd065f7
diff --git a/packages/mdc-textfield/addon/components/mdc-textfield-input.js b/packages/mdc-textfield/addon/components/mdc-textfield-input.js index <HASH>..<HASH> 100644 --- a/packages/mdc-textfield/addon/components/mdc-textfield-input.js +++ b/packages/mdc-textfield/addon/components/mdc-textfield-input.js @@ -52,8 +52,13 @@ export default TextField.extend({ let nextInput = getNextSibling (this.element, 'input'); if (isPresent (nextInput)) { + // Move the focus to the next element. nextInput.focus (); } + else { + // Take the focus of the current element. + this.element.blur (); + } } } });
fix: take focus off current input if there is no next input
onehilltech_ember-cli-mdc
train
js
78a8dafd5a1d77463c6c835ed3834447132a6ff4
diff --git a/Tests/Functionnal/src/Acme/AppBundle/Entity/Character.php b/Tests/Functionnal/src/Acme/AppBundle/Entity/Character.php index <HASH>..<HASH> 100644 --- a/Tests/Functionnal/src/Acme/AppBundle/Entity/Character.php +++ b/Tests/Functionnal/src/Acme/AppBundle/Entity/Character.php @@ -5,6 +5,7 @@ namespace Acme\AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Victoire\Bundle\CoreBundle\Annotations as VIC; +use Victoire\Bundle\UserBundle\Model\User; /** * Character. @@ -64,6 +65,12 @@ class Character protected $slug; /** + * @var User + * @ORM\ManyToOne(targetEntity="Victoire\Bundle\UserBundle\Entity\User") + */ + protected $author; + + /** * Get id. * * @return int @@ -144,4 +151,20 @@ class Character return $this; } + + /** + * @return User + */ + public function getAuthor() + { + return $this->author; + } + + /** + * @param User $author + */ + public function setAuthor($author) + { + $this->author = $author; + } }
Jedi can have an author (used to test role criteria)
Victoire_victoire
train
php
3a684c82f1d7bd87d16d2fe43b41fdec7764a978
diff --git a/scripts/prepublish.js b/scripts/prepublish.js index <HASH>..<HASH> 100644 --- a/scripts/prepublish.js +++ b/scripts/prepublish.js @@ -83,6 +83,7 @@ function applyPatches() { shell.sed('-i', '#include "zookeeper_log.h"', '#include "zookeeper_log.h"\n#include "winport.h"\n', `${destination}/zk_log.c`); shell.sed('-i', '#include "zookeeper.h"', '#include "winport.h"\n#include "zookeeper.h"\n', `${destination}/zk_adaptor.h`); shell.sed('-i', '#include "zk_adaptor.h"', '#include "zk_adaptor.h"\n#include "winport.h"\n', `${destination}/zookeeper.c`); + shell.sed('-i', 'if (buff == &zh->primer_buffer && rc == buff->len - 1) ++rc;', 'if (buff == &zh->primer_buffer && buff->curr_offset + rc == buff->len + sizeof(buff->len) - 1) ++rc;', `${destination}/zookeeper.c`); if (!env.isVerbose) { const cmakeFile = 'CMakeLists.txt';
WIP: zookeeper-<I>
yfinkelstein_node-zookeeper
train
js
7ff47a248d813b619e00da5f40f777e99dfa62e6
diff --git a/lib/effective_pages/engine.rb b/lib/effective_pages/engine.rb index <HASH>..<HASH> 100644 --- a/lib/effective_pages/engine.rb +++ b/lib/effective_pages/engine.rb @@ -20,9 +20,7 @@ module EffectivePages # ActiveAdmin (optional) # This prepends the load path so someone can override the assets.rb if they want. initializer 'effective_pages.active_admin' do - if defined?(ActiveAdmin) - ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"] - end + ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"] end end diff --git a/lib/effective_pages/version.rb b/lib/effective_pages/version.rb index <HASH>..<HASH> 100644 --- a/lib/effective_pages/version.rb +++ b/lib/effective_pages/version.rb @@ -1,3 +1,3 @@ module EffectivePages - VERSION = "0.1.1" + VERSION = "0.1.2" end
Hopefully load Pages tab into ActiveAdmin properly
code-and-effect_effective_pages
train
rb,rb
aa1b96c100c7ba8db060d21594a7d617820c6874
diff --git a/gtk/gtk.go b/gtk/gtk.go index <HASH>..<HASH> 100644 --- a/gtk/gtk.go +++ b/gtk/gtk.go @@ -7038,6 +7038,8 @@ func cast(c *C.GObject) (glib.IObject, error) { g = wrapOrientable(obj) case "GtkProgressBar": g = wrapProgressBar(obj) + case "GtkRadioButton": + g = wrapRadioButton(obj) case "GtkRange": g = wrapRange(obj) case "GtkScrollbar":
Add RadioButton to cast() for Builder support.
gotk3_gotk3
train
go
e6d3762bc37068ba9d48d80843bf7692ab9cf562
diff --git a/server/server_test.go b/server/server_test.go index <HASH>..<HASH> 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -12,7 +12,7 @@ import ( ) func TestRunBadCerts(t *testing.T) { - err := Run(context.Background(), &config.Configuration{config.ServerConf{}}) + err := Run(context.Background(), &config.Configuration{Server: config.ServerConf{}}) if err == nil { t.Fatal("Passed empty certs, Run should have failed") }
circleci's go vet is producing different output to mine... this should fix for circle
theupdateframework_notary
train
go
119e0047e880cbad382ef5063905452cb9c5e2f2
diff --git a/lib/jekyll/entry_filter.rb b/lib/jekyll/entry_filter.rb index <HASH>..<HASH> 100644 --- a/lib/jekyll/entry_filter.rb +++ b/lib/jekyll/entry_filter.rb @@ -89,12 +89,12 @@ module Jekyll # Check if an entry matches a specific pattern. # Returns true if path matches against any glob pattern, else false. def glob_include?(enumerator, entry) - entry_with_source = site.in_source_dir(entry) + entry_with_source = File.join(site.source, entry) enumerator.any? do |pattern| case pattern when String - pattern_with_source = site.in_source_dir(pattern) + pattern_with_source = File.join(site.source, pattern) File.fnmatch?(pattern_with_source, entry_with_source) || entry_with_source.start_with?(pattern_with_source)
Don't sanitize pattern or entry string
jekyll_jekyll
train
rb
c045560cb0580d232e592b0e5bbc3e1ce33eebaf
diff --git a/tests/functional/regressions/test_issue78.py b/tests/functional/regressions/test_issue78.py index <HASH>..<HASH> 100644 --- a/tests/functional/regressions/test_issue78.py +++ b/tests/functional/regressions/test_issue78.py @@ -147,10 +147,9 @@ def test_issue78_quickcheck_no_obj_processors_called_for_references(): assert ['a1','a2','a3'] == test_list # only references to A: --> obj proc not called - test_list=[] global_repo_provider.add_model(m1) m2 = mm.model_from_str(''' B b1 -> a1 B b2 -> a2 B b3 -> a3 ''') - assert [] == test_list + assert ['a1','a2','a3'] == test_list # unchanged...
changed plausibility test to be sure the new list does not harm...
textX_textX
train
py
f7b9cb009fdca23af503f3a68284ac21ac28d0c9
diff --git a/server/build/webpack.js b/server/build/webpack.js index <HASH>..<HASH> 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -86,6 +86,7 @@ export default async function createCompiler (dir, { dev = false, quiet = false let mainBabelOptions = { babelrc: false, + cacheDirectory: true, sourceMaps: dev ? 'both' : false, presets: [ require.resolve('./babel/preset') @@ -127,6 +128,7 @@ export default async function createCompiler (dir, { dev = false, quiet = false include: nextPagesDir, query: { babelrc: false, + cacheDirectory: true, sourceMaps: dev ? 'both' : false, plugins: [ [
Add cacheDirectory support for babel-loader. (#<I>) This will improve the initial babel compilation specially for larger projects.
zeit_next.js
train
js
6ba5ae84e3133d8ac4b106836d84ad2f5628d760
diff --git a/stream.py b/stream.py index <HASH>..<HASH> 100644 --- a/stream.py +++ b/stream.py @@ -33,6 +33,13 @@ __version__ = '0.5' __author__ = 'Anh Hai Trinh' __email__ = 'moc.liamg@hnirt.iah.hna:otliam'[::-1] __all__ = [ + 'seq', + 'gseq', + 'repeatcall', + 'chaincall', + 'attr', + 'method', + 'cond', 'Stream', 'take', 'takeall', @@ -51,12 +58,6 @@ __all__ = [ 'tee', 'prepend', 'flatten', - 'seq', - 'gseq', - 'repeatcall', - 'chaincall', - 'attr', - 'method', ] import itertools @@ -139,7 +140,7 @@ def method(m, *args, **kwargs): def cond(predicate, consequence, alternative=None): """ - Function replacement for if-else to use in expressions. + Functional replacement for if-else to use in expressions. >>> x = 2 >>> cond(x % 2 == 0, "even", "odd")
Add cond to __all__
aht_stream.py
train
py
ea1a614ba367a390d23daca767da50198d046acc
diff --git a/src/Url.php b/src/Url.php index <HASH>..<HASH> 100644 --- a/src/Url.php +++ b/src/Url.php @@ -716,10 +716,6 @@ class Url implements UrlInterface */ private static function myValidateQueryString($queryString, &$error) { - if ($queryString === null) { - return true; - } - if (preg_match('/[^0-9a-zA-Z._~!\$&\'()*\+,;=:@\[\]\/\?%-]/', $queryString, $matches)) { $error = 'Query string "' . $queryString . '" contains invalid character "' . $matches[0] . '".'; @@ -739,10 +735,6 @@ class Url implements UrlInterface */ private static function myValidateFragment($fragment, &$error) { - if ($fragment === null) { - return true; - } - if (preg_match('/[^0-9a-zA-Z._~!\$&\'()*\+,;=:@\[\]\/\?%-]/', $fragment, $matches)) { $error = 'Fragment "' . $fragment . '" contains invalid character "' . $matches[0] . '".';
Remove unnecessary null check in myValidateQueryString and myValidateFragment methods in Url
themichaelhall_datatypes
train
php
13179297afee27aa7b1a37587a8c459cf2d5ff3c
diff --git a/go-to-protobuf/protobuf/cmd.go b/go-to-protobuf/protobuf/cmd.go index <HASH>..<HASH> 100644 --- a/go-to-protobuf/protobuf/cmd.go +++ b/go-to-protobuf/protobuf/cmd.go @@ -125,9 +125,6 @@ func Run(g *Generator) { protobufNames := NewProtobufNamer() outputPackages := generator.Packages{} for _, d := range strings.Split(g.Packages, ",") { - if strings.Contains(d, "-") { - log.Fatalf("Package names must be valid protobuf package identifiers, which allow only [a-z0-9_]: %s", d) - } generateAllTypes, outputPackage := true, true switch { case strings.HasPrefix(d, "+"): @@ -137,6 +134,9 @@ func Run(g *Generator) { d = d[1:] outputPackage = false } + if strings.Contains(d, "-") { + log.Fatalf("Package names must be valid protobuf package identifiers, which allow only [a-z0-9_]: %s", d) + } name := protoSafePackage(d) parts := strings.SplitN(d, "=", 2) if len(parts) > 1 {
Name check for go-to-protobuf in wrong spot
kubernetes_gengo
train
go
08ab220f60fbdfb3fe2aff624a2977063c5aa587
diff --git a/src/main/java/com/github/to2mbn/jmccc/auth/CharacterSelector.java b/src/main/java/com/github/to2mbn/jmccc/auth/CharacterSelector.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/github/to2mbn/jmccc/auth/CharacterSelector.java +++ b/src/main/java/com/github/to2mbn/jmccc/auth/CharacterSelector.java @@ -6,13 +6,14 @@ import com.github.to2mbn.jyal.GameProfile; public interface CharacterSelector { /** - * Selects a character from the given characters. + * Selects one of the given characters to login. * <p> - * If this method returns <code>null</code>, an {@link AuthenticationException} will occur. + * This method will be called during the authentication. An {@link AuthenticationException} will occur if this + * method returns <code>null</code>. * - * @param selected the default character that mojang specified - * @param availableProfiles all the available characters - * @return the character to select + * @param selected the default character + * @param availableProfiles the available characters + * @return the character to login */ GameProfile select(GameProfile selected, GameProfile[] availableProfiles);
update javadoc for CharacterSelector
to2mbn_JMCCC
train
java
22acba3e679072662f0a91145e5386485e5b4b37
diff --git a/lib/locabulary/item.rb b/lib/locabulary/item.rb index <HASH>..<HASH> 100644 --- a/lib/locabulary/item.rb +++ b/lib/locabulary/item.rb @@ -57,6 +57,11 @@ module Locabulary end alias as_json to_h + def to_persistence_format_for_fedora + return term_uri unless term_uri.to_s.strip == '' + term_label + end + private attr_writer(*ATTRIBUTE_NAMES) diff --git a/spec/lib/locabulary/item_spec.rb b/spec/lib/locabulary/item_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/locabulary/item_spec.rb +++ b/spec/lib/locabulary/item_spec.rb @@ -20,4 +20,15 @@ RSpec.describe Locabulary::Item do end its(:as_json) { should be_a(Hash) } + + context '#to_persistence_format_for_fedora' do + it 'is the term_label if no term_uri is given' do + subject = described_class.new(term_label: 'Hello') + subject.to_persistence_format_for_fedora == 'Hello' + end + it 'is the term_uri if one is given' do + subject = described_class.new(term_label: 'Hello', term_uri: 'http://goodbye.com') + subject.to_persistence_format_for_fedora == 'http://goodbye.com' + end + end end
Adding clarification regarding what we persist There has been ambiguity concerning what value we choose to persist in Fedora. I'm making a method to encode that logic.
ndlib_locabulary
train
rb,rb
97eb2f99f5ea8c6ae26f2de0a6e7807776f0b581
diff --git a/src/authority/admin.py b/src/authority/admin.py index <HASH>..<HASH> 100644 --- a/src/authority/admin.py +++ b/src/authority/admin.py @@ -6,6 +6,7 @@ from django.utils.text import capfirst, truncate_words from authority.models import Permission from authority.widgets import GenericForeignKeyRawIdWidget +from autority import get_choices_for class PermissionInline(generic.GenericTabularInline): model = Permission @@ -14,7 +15,7 @@ class PermissionInline(generic.GenericTabularInline): def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'codename': - perm_choices = permissions.get_choices_for(self.parent_model) + perm_choices = get_choices_for(self.parent_model) kwargs['label'] = _('permission') kwargs['widget'] = forms.Select(choices=perm_choices) return db_field.formfield(**kwargs)
Fixes issue #3 - make the admin work again after API changes
jazzband_django-authority
train
py
bdf24846b2705e79aa71730757bd04a01746d53c
diff --git a/lib/html-proofer/configuration.rb b/lib/html-proofer/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/html-proofer/configuration.rb +++ b/lib/html-proofer/configuration.rb @@ -78,7 +78,7 @@ module HTMLProofer return {} if config.strip.empty? begin - JSON.parse(config) + JSON.parse(config, { symbolize_names: true }) rescue StandardError raise ArgumentError, "Option '#{option_name} did not contain valid JSON." end
Ensure config keys are symbolized when parsing JSON from CLI.
gjtorikian_html-proofer
train
rb
9589dfc820df88bf2c78d982a5c4930c1295bec2
diff --git a/example/users/admin.py b/example/users/admin.py index <HASH>..<HASH> 100644 --- a/example/users/admin.py +++ b/example/users/admin.py @@ -1,3 +1,4 @@ +from django.contrib import admin from django.contrib.auth.admin import UserAdmin from example.users.models import User
import admin in example so it works with dj<I>
jazzband_django-authority
train
py
2e8a9550d0dd1b91017ac17e358c4aa3d85e49f0
diff --git a/lib/Container.js b/lib/Container.js index <HASH>..<HASH> 100755 --- a/lib/Container.js +++ b/lib/Container.js @@ -310,10 +310,10 @@ Container.prototype.constructService = function constructService(id, isOptional, if (definition.isObject) { svc = definition.class; } else if(definition.constructorMethod) { - svc = new definition.class[definition.constructorMethod](); + svc = Object.create(definition.class[definition.constructorMethod].prototype); definition.class[definition.constructorMethod].apply(svc, arguments); } else { - svc = new definition.class(); + svc = Object.create(definition.class.prototype); definition.class.apply(svc, arguments); }
Based on comments by Mctigger, update service construction so constructor is only called once - Use Object.create() to copy the target class' prototype before applying its constructor
linkshare_service-container
train
js
c35af843f0a087a9b2dcf5b30fda340448bc37c3
diff --git a/topology/topology.go b/topology/topology.go index <HASH>..<HASH> 100644 --- a/topology/topology.go +++ b/topology/topology.go @@ -132,7 +132,7 @@ func AddOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, met } } - m := OwnershipMetadata + m := graph.Metadata{"RelationType": OwnershipLink} for k, v := range metadata { m[k] = v }
topology: don't alter OwnershipMetadata pseudo constant
skydive-project_skydive
train
go
8aece33006a00a0bd62f302c299e11704716d8b6
diff --git a/lib/instana/config.rb b/lib/instana/config.rb index <HASH>..<HASH> 100644 --- a/lib/instana/config.rb +++ b/lib/instana/config.rb @@ -40,6 +40,8 @@ module Instana @config[:nethttp] = { :enabled => true } @config[:'rest-client'] = { :enabled => true } @config[:grpc] = { :enabled => true } + @config[:sidekiq_client] = { :enabled => true } + @config[:sidekiq_worker] = { :enabled => true } end def [](key)
Add Sidekiq client & worker to Instana config
instana_ruby-sensor
train
rb
d08412bebe8000728753317c8f4ea94f7d58c578
diff --git a/lib/databases.js b/lib/databases.js index <HASH>..<HASH> 100644 --- a/lib/databases.js +++ b/lib/databases.js @@ -98,9 +98,9 @@ exports.DatabasesAPI = function (hoodie) { * Creates a new database */ - database.add = function (name, callback) { + database.add = function (name, callback, _retried) { var opt = {data: ''}; - var url = '/' + encodeURIComponent(name); + var url = '/' + encodeURIComponent(name) + '/'; var db = database(name); async.series([ @@ -109,7 +109,14 @@ exports.DatabasesAPI = function (hoodie) { db.revokePublicReadAccess ], function (err) { - return callback(err, err ? null: db); + if (err && err.error === 'file_exists' && !_retried) { + // couchdb gives this response in error in some circumstances, + // retry before reporting back with error + return database.add(name, callback, true); + } + else { + return callback(err, err ? null: db); + } }); };
retry db creation if first request returns <I> file_exists error * * * This commit was sponsored by The Hoodie Firm. You can hire The Hoodie Firm: <URL>
hoodiehq-archive_hoodie-plugins-api
train
js
88a6ce3fbf98919c17db134496a33cab4d0eaed5
diff --git a/test/functional/runner/index.js b/test/functional/runner/index.js index <HASH>..<HASH> 100644 --- a/test/functional/runner/index.js +++ b/test/functional/runner/index.js @@ -462,6 +462,8 @@ function resolveOperationArgs(operationName, operationArgs, context) { return result; } +const CURSOR_COMMANDS = new Set(['find', 'aggregate', 'listIndexes']); + /** * * @param {Object} operation the operation definition from the spec test @@ -549,7 +551,8 @@ function testOperation(operation, obj, context, options) { } let opPromise; - if (operationName === 'find' || operationName === 'aggregate') { + + if (CURSOR_COMMANDS.has(operationName)) { // `find` creates a cursor, so we need to call `toArray` on it const cursor = obj[operationName].apply(obj, args); opPromise = cursor.toArray();
test: start to collect a list of operations that return a cursor
mongodb_node-mongodb-native
train
js
665404e098ebe72ed3360e5151e94c014aeed09f
diff --git a/lib/que/rake_tasks.rb b/lib/que/rake_tasks.rb index <HASH>..<HASH> 100644 --- a/lib/que/rake_tasks.rb +++ b/lib/que/rake_tasks.rb @@ -9,16 +9,14 @@ namespace :que do # When changing how signals are caught, be sure to test the behavior with # the rake task in que/tasks/safe_shutdown.rb. - stop = false - - %w(INT TERM KILL).each do |signal| - trap signal do - puts "Caught SIG#{signal}, stopping Que..." - Que.stop! - stop = true - end + at_exit do + puts "Stopping Que..." + Que.stop! end + stop = false + trap('INT'){stop = true} + loop do sleep 0.01 break if stop diff --git a/tasks/safe_shutdown.rb b/tasks/safe_shutdown.rb index <HASH>..<HASH> 100644 --- a/tasks/safe_shutdown.rb +++ b/tasks/safe_shutdown.rb @@ -47,17 +47,15 @@ task :safe_shutdown do puts "kill -#{signal} #{Process.pid}" end - # Put signal trappers to test the behavior of here: - stop = false - - %w(INT TERM KILL).each do |signal| - trap signal do - puts "Caught SIG#{signal}, stopping Que..." - Que.stop! - stop = true - end + # Put exit behavior to test the behavior of here: + at_exit do + puts "Stopping Que..." + Que.stop! end + stop = false + trap('INT'){stop = true} + loop do sleep 0.01 break if stop
Stop Que in an at_exit block - don't trap signal unnecessarily.
chanks_que
train
rb,rb
6a041527dc4acd99ae5e533f0df25ca9e2aa1b30
diff --git a/gemini.py b/gemini.py index <HASH>..<HASH> 100644 --- a/gemini.py +++ b/gemini.py @@ -18,20 +18,27 @@ Config file definition: { "one": { "host": "http://one", (# REQUIRED) - "proxy": None + "proxy": null }, "other": { "host": "http://other", (# REQUIRED) - "proxy": None + "proxy": null }, "input": { - "format": "yaml", + "format": "plain", (see `Input format`) "encoding": "utf8" }, "output": { "encoding": "utf8" } } + +Input format: + # Correspond to following format. + * plain + * apache + * yaml + * csv """ import codecs
(Refs #<I>) Fix Usage and so on
tadashi-aikawa_jumeaux
train
py
7fa91f822b1ede2a5153c0a0bb18f982ab848ee8
diff --git a/src/Events/Error.php b/src/Events/Error.php index <HASH>..<HASH> 100644 --- a/src/Events/Error.php +++ b/src/Events/Error.php @@ -58,7 +58,7 @@ class Error extends EventBean implements \JsonSerializable { foreach( $this->throwable->getTrace() as $trace ) { $item = [ - 'function' => $trace['function'] + 'function' => $trace['function'] ?? '(closure)' ]; if( isset( $trace['line'] ) === true ) { $item['lineno'] = $trace['line'];
A stacktrace may not have a function to reference
philkra_elastic-apm-php-agent
train
php
49c0a2dbed343baf8ae169b18e90ed0a99f06646
diff --git a/sebastian/midi/write_midi.py b/sebastian/midi/write_midi.py index <HASH>..<HASH> 100755 --- a/sebastian/midi/write_midi.py +++ b/sebastian/midi/write_midi.py @@ -43,7 +43,7 @@ class SMF: def write(self , out - , title = 'untitled' + , title = "untitled" , time_signature = (4, 2, 24, 8) # (2cd arg is power of 2) , key_signature = (0, 0) # C , tempo = 500000 # in microseconds per quarter note @@ -194,4 +194,4 @@ if __name__ == "__main__": ] ]) - write("test.mid", [test], title='mysong') + write("test.mid", [test], title="mysong")
Replaced single quotes in write_midi.py with double quotes.
jtauber_sebastian
train
py
158b7da02d6f47107337a2c6bd07de152a3b6559
diff --git a/secretsyml/secretsyml_test.go b/secretsyml/secretsyml_test.go index <HASH>..<HASH> 100644 --- a/secretsyml/secretsyml_test.go +++ b/secretsyml/secretsyml_test.go @@ -16,6 +16,7 @@ PRIVATE_KEY_FILE: !file:var $env/aws/ec2/private_key PRIVATE_KEY_FILE2: !var:file $env/aws/ec2/private_key SOME_FILE: !file my content RAILS_ENV: $env +SOME_ESCAPING_VAR: FOO$$BAR FLOAT: 27.1111 INT: 27 BOOL: true` @@ -46,6 +47,11 @@ BOOL: true` So(spec.IsFile(), ShouldBeFalse) So(spec.IsLiteral(), ShouldBeTrue) + spec = parsed["SOME_ESCAPING_VAR"] + So(spec.IsVar(), ShouldBeFalse) + So(spec.IsLiteral(), ShouldBeTrue) + So(spec.Path, ShouldEqual, "FOO$BAR") + spec, found := parsed["FLOAT"] So(found, ShouldBeTrue) So(spec.IsLiteral(), ShouldBeTrue)
Added a test for an escaped '$' variable literal This was needed for clarification of use and to verify that we didn't have a problem reported in <URL>
cyberark_summon
train
go
c0e6235a572c83e6f4d3677c24724742e9e76947
diff --git a/aws/resource_aws_iam_access_key.go b/aws/resource_aws_iam_access_key.go index <HASH>..<HASH> 100644 --- a/aws/resource_aws_iam_access_key.go +++ b/aws/resource_aws_iam_access_key.go @@ -122,7 +122,7 @@ func resourceAwsIamAccessKeyRead(d *schema.ResourceData, meta interface{}) error d.SetId("") return nil } - return fmt.Errorf("Error reading IAM acces key: %s", err) + return fmt.Errorf("Error reading IAM access key: %s", err) } for _, key := range getResp.AccessKeyMetadata {
typo fix: 'access' -> 'acces'
terraform-providers_terraform-provider-aws
train
go
a8463a4920fe10795cf5c57407d88bd8b35a49a2
diff --git a/lib/plugin.js b/lib/plugin.js index <HASH>..<HASH> 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -124,6 +124,10 @@ function streamlineCall(t, scope, state, node, method, index1, index2, returnArr var callee = node.callee; var object, property; if (t.isMemberExpression(callee)) { + // Ugly hack to get proper resolution of _.wait, _.sleep, etc. inside .ts files + if (is_(callee.object) && /\.ts$/.test(state.file.opts.filename)) { + callee.object.name = '_streamlineRuntime._' + } object = callee.object; property = callee.computed ? callee.property : t.stringLiteral(callee.property.name); } else {
quick fix for Sage/streamlinejs#<I> - _.xxx calls incorrectly transpiled
Sage_babel-plugin-streamline
train
js
0295c9d9e7ed36bb884bb8d6773e314e560742a5
diff --git a/ftfy/__init__.py b/ftfy/__init__.py index <HASH>..<HASH> 100644 --- a/ftfy/__init__.py +++ b/ftfy/__init__.py @@ -269,7 +269,7 @@ def fix_text_segment(text, if remove_terminal_escapes: text = fixes.remove_terminal_escapes(text) if fix_encoding: - text = fixes.fix_text_encoding(text) + text = fixes.fix_encoding(text) if fix_latin_ligatures: text = fixes.fix_latin_ligatures(text) if fix_character_width:
fix_text_encoding is depreciated According to fixes.py (lines <I>-<I>), fix_text_encoding is depreciated for fix_encoding
LuminosoInsight_python-ftfy
train
py
745e8a6ae7d618551fb4d66566c9e04f42b76b6a
diff --git a/openquake/db/models.py b/openquake/db/models.py index <HASH>..<HASH> 100644 --- a/openquake/db/models.py +++ b/openquake/db/models.py @@ -17,6 +17,7 @@ # version 3 along with OpenQuake. If not, see # <http://www.gnu.org/licenses/lgpl-3.0.txt> for a copy of the LGPLv3 License. +#pylint: disable C0302 ''' Model representations of the OpenQuake DB tables. diff --git a/openquake/job/config.py b/openquake/job/config.py index <HASH>..<HASH> 100644 --- a/openquake/job/config.py +++ b/openquake/job/config.py @@ -161,7 +161,7 @@ class HazardMandatoryParamsValidator(MandatoryParamsValidator): super( HazardMandatoryParamsValidator, self).__init__(sections, params) self.section_of_interest = HAZARD_SECTION - self.mandatory_params = ["DEPTHTO1PT0KMPERSEC", "VS30_TYPE"] + self.mandatory_params = [DEPTHTO1PT0KMPERSEC, VS30_TYPE] class ComputationTypeValidator(object):
take care of review comments Former-commit-id: <I>d4e3a<I>bde<I>f<I>e<I>fa<I>
gem_oq-engine
train
py,py
de6eb6c59b69dff76b0ec548c3682e7afcceb9ef
diff --git a/opal/corelib/runtime.js b/opal/corelib/runtime.js index <HASH>..<HASH> 100644 --- a/opal/corelib/runtime.js +++ b/opal/corelib/runtime.js @@ -181,11 +181,11 @@ */ function boot_class_object(superklass, alloc) { // - var mtor = function() {}; - mtor.prototype = superklass.constructor.prototype; + var singleton_class = function() {}; + singleton_class.prototype = superklass.constructor.prototype; function OpalClass() {} - OpalClass.prototype = new mtor(); + OpalClass.prototype = new singleton_class(); var klass = new OpalClass(); @@ -376,12 +376,12 @@ // Boot the actual (meta?) classes of core classes function boot_makemeta(id, constructor, superklass) { - var mtor = function() {}; - mtor.prototype = superklass.prototype; - mtor.displayName = id; + var singleton_class = function() {}; + singleton_class.prototype = superklass.prototype; + singleton_class.displayName = id; function OpalClass() {} - OpalClass.prototype = new mtor(); + OpalClass.prototype = new singleton_class(); var klass = new OpalClass();
Make clear that that’s the singleton class proto
opal_opal
train
js
92fb81b2e109023193af7d0f7f21911781286267
diff --git a/cloudfoundry-client-spring/src/test/java/org/cloudfoundry/client/spring/v2/serviceplans/SpringServicePlansTest.java b/cloudfoundry-client-spring/src/test/java/org/cloudfoundry/client/spring/v2/serviceplans/SpringServicePlansTest.java index <HASH>..<HASH> 100644 --- a/cloudfoundry-client-spring/src/test/java/org/cloudfoundry/client/spring/v2/serviceplans/SpringServicePlansTest.java +++ b/cloudfoundry-client-spring/src/test/java/org/cloudfoundry/client/spring/v2/serviceplans/SpringServicePlansTest.java @@ -17,7 +17,6 @@ package org.cloudfoundry.client.spring.v2.serviceplans; import org.cloudfoundry.client.spring.AbstractApiTest; -import org.cloudfoundry.client.spring.AbstractRestTest; import org.cloudfoundry.client.v2.Resource; import org.cloudfoundry.client.v2.serviceinstances.ServiceInstanceEntity; import org.cloudfoundry.client.v2.serviceinstances.ServiceInstanceResource;
Polishing [#<I>][resolves #<I>]
cloudfoundry_cf-java-client
train
java
906cd1da17461c8a71ecefb68462db7628224fd2
diff --git a/lib/ping-sys.js b/lib/ping-sys.js index <HASH>..<HASH> 100755 --- a/lib/ping-sys.js +++ b/lib/ping-sys.js @@ -1,3 +1,5 @@ +'use strict'; + /** * LICENSE MIT * (C) Daniel Zelisko @@ -8,14 +10,13 @@ * */ -//system library -var sys = require('util'), - cp = require('child_process'), - os = require('os'); - // Promise implementation var ping = require('./ping-promise'); +// TODO: +// 1. Port round trip time to this callback +// 2. However, it may breaks backward compatability +// 3. Need discussion /** * Callback after probing given host * @callback probeCallback
Add TODO comment and fix warning from eslint
danielzzz_node-ping
train
js
7644f73e386258c37b030c34d6825ef4db4e2437
diff --git a/chess/__init__.py b/chess/__init__.py index <HASH>..<HASH> 100644 --- a/chess/__init__.py +++ b/chess/__init__.py @@ -3210,13 +3210,12 @@ class Board(BaseBoard): checker = msb(checkers) if BB_SQUARES[checker] == checkers: # Capture or block a single checker. - target = (BB_BETWEEN[king][checker] | checkers) & to_mask - for move in self.generate_pseudo_legal_moves(~self.kings & from_mask, target): - if not self.is_en_passant(move): - yield move - for move in self.generate_pseudo_legal_ep(from_mask, to_mask): - yield move + target = BB_BETWEEN[king][checker] | checkers + if self.ep_square: + target |= BB_SQUARES[self.ep_square] + for move in self.generate_pseudo_legal_moves(~self.kings & from_mask, target & to_mask): + yield move def generate_legal_moves(self, from_mask=BB_ALL, to_mask=BB_ALL): if self.is_variant_end():
Slightly optimize _generate_evasions
niklasf_python-chess
train
py
5e11178a95addafee7ecf856699ce8b0121b93da
diff --git a/src/Illuminate/Routing/PendingResourceRegistration.php b/src/Illuminate/Routing/PendingResourceRegistration.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Routing/PendingResourceRegistration.php +++ b/src/Illuminate/Routing/PendingResourceRegistration.php @@ -2,8 +2,12 @@ namespace Illuminate\Routing; +use Illuminate\Support\Traits\Macroable; + class PendingResourceRegistration { + use Macroable; + /** * The resource registrar. *
Make PendingResourceRegistration macroable (#<I>) * Make PendingResourceRegistration macroable * code style
laravel_framework
train
php
cce777a8633fa74cf145bd04576b4ffc3a1afabd
diff --git a/lib/webhook.js b/lib/webhook.js index <HASH>..<HASH> 100644 --- a/lib/webhook.js +++ b/lib/webhook.js @@ -119,7 +119,7 @@ module.exports = function(authCallback, callback) { body += chunk; }); - req.on('end', function() { + return req.on('end', function() { parseString(body, { explicitArray: false }, function(err, xml) { if (err || !xml || !xml.methodCall || !xml.methodCall.methodName) { return res
Bugfix: Added missing return statement Without return, it will always call next() proceed all other handlers, which is not what we want.
b00giZm_express-ifttt-webhook
train
js
44e04e5f7deef5c32275f896f7d8e67a82b8844d
diff --git a/classes/Gems/Snippets/Tracker/TokenStatusLegenda.php b/classes/Gems/Snippets/Tracker/TokenStatusLegenda.php index <HASH>..<HASH> 100644 --- a/classes/Gems/Snippets/Tracker/TokenStatusLegenda.php +++ b/classes/Gems/Snippets/Tracker/TokenStatusLegenda.php @@ -70,10 +70,12 @@ class Gems_Snippets_Tracker_TokenStatusLegenda extends \MUtil_Snippets_SnippetAb $table->setRepeater($repeater); $table->throw($this->_('Legend')); - $table->td($repeater->key)->class = array( + $cell = $table->td(); + $cell->class = array( 'round', \MUtil_Lazy::method($tUtil, 'getStatusClass', $repeater->key) ); + $cell->span($repeater->key); $table->td($repeater->value); return $table;
added a span to the table cells of the token status legend
GemsTracker_gemstracker-library
train
php
897979ecbeebea4d6c06f0570cc2c773616b25d4
diff --git a/hearthstone/dbf.py b/hearthstone/dbf.py index <HASH>..<HASH> 100644 --- a/hearthstone/dbf.py +++ b/hearthstone/dbf.py @@ -52,7 +52,7 @@ class Dbf: for column in self._xml.findall("Column"): self.columns[column.attrib["name"]] = column.attrib["type"] - self.records = (self._deserialize_record(e) for e in self._xml.findall("Record")) + self.records = [self._deserialize_record(e) for e in self._xml.findall("Record")] def _to_xml(self): root = ElementTree.Element("Dbf")
dbf: Ensure Dbf.records is always a list, never a generator
HearthSim_python-hearthstone
train
py
b94c45a7f4c70603f12aa1d47a325a37036fd3ba
diff --git a/hashing.go b/hashing.go index <HASH>..<HASH> 100644 --- a/hashing.go +++ b/hashing.go @@ -4,7 +4,7 @@ import ( "crypto/sha256" "crypto/subtle" - "code.google.com/p/go.crypto/bcrypt" + "golang.org/x/crypto/bcrypt" "io" )
Updated import path to bcrypt
xyproto_permissionbolt
train
go
7b5c65de3b7eac862ac4a88181afba63f4385dab
diff --git a/optaplanner-examples/src/main/java/org/optaplanner/examples/common/persistence/XStreamSolutionDao.java b/optaplanner-examples/src/main/java/org/optaplanner/examples/common/persistence/XStreamSolutionDao.java index <HASH>..<HASH> 100644 --- a/optaplanner-examples/src/main/java/org/optaplanner/examples/common/persistence/XStreamSolutionDao.java +++ b/optaplanner-examples/src/main/java/org/optaplanner/examples/common/persistence/XStreamSolutionDao.java @@ -27,9 +27,9 @@ public abstract class XStreamSolutionDao implements SolutionDao { protected final transient Logger logger = LoggerFactory.getLogger(getClass()); - private XStreamProblemIO xStreamProblemIO; - private String dirName; - private File dataDir; + protected XStreamProblemIO xStreamProblemIO; + protected String dirName; + protected File dataDir; public XStreamSolutionDao(String dirName, Class... xstreamAnnotations) { this.dirName = dirName;
examples: make XStreamSolutionDao's fields protected instead of private
kiegroup_optaplanner
train
java
244b2b7ddbc93e0d19c93b5c02881696160cdb34
diff --git a/tests/test.bulk_docs.js b/tests/test.bulk_docs.js index <HASH>..<HASH> 100644 --- a/tests/test.bulk_docs.js +++ b/tests/test.bulk_docs.js @@ -9,6 +9,13 @@ } }); + var authors = [ + {name: 'Dale Harvey', commits: 253}, + {name: 'Mikeal Rogers', commits: 42}, + {name: 'Johannes J. Schmidt', commits: 13}, + {name: 'Randall Leeds', commits: 9} + ]; + asyncTest('Testing bulk docs', function() { initTestDB(this.name, function(err, db) { var docs = makeDocs(5); @@ -91,4 +98,17 @@ }); }); + asyncTest('Test multiple bulkdocs', function() { + initTestDB(this.name, function(err, db) { + db.bulkDocs({docs: authors}, function (err, res) { + db.bulkDocs({docs: authors}, function (err, res) { + db.allDocs(function(err, result) { + ok(result.total_rows === 8, 'correct number of results'); + start(); + }); + }); + }); + }); + }); + }); \ No newline at end of file
Add test for failing multiple bulk docs (issue #<I>)
pouchdb_pouchdb
train
js
55e9b57ab663b6e4b39952cbea5dc84727bc754d
diff --git a/Schema/Blueprint.php b/Schema/Blueprint.php index <HASH>..<HASH> 100755 --- a/Schema/Blueprint.php +++ b/Schema/Blueprint.php @@ -414,9 +414,13 @@ class Blueprint * * @return void */ - public function dropMorphs($name) + public function dropMorphs($name, $indexName = null) { $this->dropColumn("{$name}_type", "{$name}_id"); + + $indexName = $indexName ?: $this->createIndexName('index', ["{$name}_type", "{$name}_id"]); + + $this->dropIndex($indexName); } /**
Added drop index to dropMorphs
illuminate_database
train
php
a525997a18752be8a055c29ee570cc141318d506
diff --git a/trainer.py b/trainer.py index <HASH>..<HASH> 100644 --- a/trainer.py +++ b/trainer.py @@ -33,6 +33,7 @@ class Trainer: self.account = User(int(r['account'])) update = r['update'] self.update = Update(update['id']) + self.level = Level().from_xp(update['xp']) self.statistics = r['statistics'] if self.statistics is False: self.account = None @@ -45,11 +46,7 @@ class Trainer: def __str__(self): return "Username: {0.username}, Level: {1}".format(self, Level().from_xp(self.update.xp).level) - - @classmethod - def level(cls): - return Level().get_by_xp(cls.update['xp']) - + @classmethod def all_updates(cls): """Get a list of all update objects by trainer in date order of newest first"""
Simplified level code on Trainer object
TrainerDex_TrainerDex.py
train
py
16145e02649644174b595ea804458b224b206249
diff --git a/spec/pycall/import_spec.rb b/spec/pycall/import_spec.rb index <HASH>..<HASH> 100644 --- a/spec/pycall/import_spec.rb +++ b/spec/pycall/import_spec.rb @@ -30,16 +30,16 @@ module PyCall context 'the as: argument is not given' do it 'raises ArgumentError' do expect { - mod.pyimport 'concurrent.futures' - }.to raise_error(ArgumentError, /concurrent\.futures is not a valid module variable name/) + mod.pyimport 'multiprocessing.pool' + }.to raise_error(ArgumentError, /multiprocessing\.pool is not a valid module variable name/) end end context 'the as: argument is given' do it 'defines a method with the specified name by as: argument' do - expect(mod).not_to be_respond_to(:futures) - mod.pyimport 'concurrent.futures', as: 'futures' - expect(mod.futures).to be_kind_of(PyObject) + expect(mod).not_to be_respond_to(:pool) + mod.pyimport 'multiprocessing.pool', as: 'pool' + expect(mod.pool).to be_kind_of(PyObject) end end end
Do not use concurrent module in spec file
mrkn_pycall.rb
train
rb
bbc4c090fbbfa0d5bc70d2b4aa4639e3198da4c9
diff --git a/js/plugins/hit.js b/js/plugins/hit.js index <HASH>..<HASH> 100644 --- a/js/plugins/hit.js +++ b/js/plugins/hit.js @@ -29,14 +29,12 @@ Flotr.addPlugin('hit', { function e(s) { _.each(_.keys(flotr.graphTypes), function (type) { - if (s[type] && s[type].show) { - try { + if (s[type] && s[type].show && this[type][method]) { if (!_.isUndefined(args)) this[type][method].apply(this[type], args); else this[type][method].apply(this[type]); success = true; - } catch (e) {} } }, this); }
Remove try catch block, check instead for method.
HumbleSoftware_Flotr2
train
js
0c2100ff1ea2cb345a9739642232bbe7cdd096c4
diff --git a/settings.py b/settings.py index <HASH>..<HASH> 100644 --- a/settings.py +++ b/settings.py @@ -48,7 +48,7 @@ MIDDLEWARE = ( 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + # 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware',
:bug: :white_check_mark: more settings fixes after merge
drf-forms_drf-schema-adapter
train
py
4071d918c149a05437b0ae4d0ab7f6353805e5c9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( packages=['internetarchive'], entry_points=dict( console_scripts=[ - 'internetarchive = bin.internetarchive_cli:main', + 'internetarchive = internetarchive.internetarchive_cli:main', ] ), url='https://github.com/jjjake/ia-wrapper',
Modified entry_points to reflect package restructuring.
jjjake_internetarchive
train
py
d8488bc74da79beea3ca9a01ffc28c6735217976
diff --git a/lib/promise.js b/lib/promise.js index <HASH>..<HASH> 100644 --- a/lib/promise.js +++ b/lib/promise.js @@ -5,6 +5,7 @@ const { deprecationLog } = require('./helper'); /** * @extends Promise + * @deprecated */ class ZkPromise extends Promise { /**
fix: set deprecated for entire legacy Promise class
yfinkelstein_node-zookeeper
train
js
5a4cc97bf32ff3ba75da6a41f157594d8d5f8c9c
diff --git a/test/integration/adapters/http/find.test.js b/test/integration/adapters/http/find.test.js index <HASH>..<HASH> 100644 --- a/test/integration/adapters/http/find.test.js +++ b/test/integration/adapters/http/find.test.js @@ -41,9 +41,13 @@ describe('DSHttpAdapter.find(resourceConfig, id, options)', function () { }); it('should use default configs', function () { - $httpBackend.expectGET('api/posts/1?test=test').respond(200, p1); + $httpBackend.expectGET('api/posts/1?test=test', { + Authorization: 'test', + Accept: 'application/json, text/plain, */*' + }).respond(200, p1); DSHttpAdapter.defaults.$httpConfig.params = { test: 'test' }; + DSHttpAdapter.defaults.$httpConfig.headers = { Authorization: 'test' }; DSHttpAdapter.find({ baseUrl: 'api', @@ -61,5 +65,6 @@ describe('DSHttpAdapter.find(resourceConfig, id, options)', function () { $httpBackend.flush(); delete DSHttpAdapter.defaults.$httpConfig.params; + delete DSHttpAdapter.defaults.$httpConfig.headers; }); });
Enhanced test to verify default headers are used. #<I>.
js-data_js-data-angular
train
js
0a0497aba6d89af7b85c25132f777badb65e56b8
diff --git a/tests/cases/storage/cache/adapter/FileTest.php b/tests/cases/storage/cache/adapter/FileTest.php index <HASH>..<HASH> 100644 --- a/tests/cases/storage/cache/adapter/FileTest.php +++ b/tests/cases/storage/cache/adapter/FileTest.php @@ -41,9 +41,15 @@ class FileTest extends \lithium\test\Unit { } public function tearDown() { + $resources = Libraries::get(true, 'resources'); + $paths = array("{$resources}/tmp/cache", "{$resources}/tmp/cache/templates"); + if ($this->_hasEmpty) { - touch(Libraries::get(true, 'resources') . "/tmp/cache/empty"); - touch(Libraries::get(true, 'resources') . "/tmp/cache/templates/empty"); + foreach ($paths as $path) { + if (is_dir($path) && is_writable($path)) { + touch("/{$resources}/empty"); + } + } } unset($this->File); }
When restoring directories in test runs, only touch empty files if the parent directory exists and is writeable.
UnionOfRAD_lithium
train
php
f6d3e8722db71b4b3d0e462b4ca417f0667b5f50
diff --git a/lib/json_schema/reference_expander.rb b/lib/json_schema/reference_expander.rb index <HASH>..<HASH> 100644 --- a/lib/json_schema/reference_expander.rb +++ b/lib/json_schema/reference_expander.rb @@ -42,6 +42,8 @@ module JsonSchema def add_reference(schema) uri = URI.parse(schema.uri) + return if (stored_schema = lookup_reference(uri)) && stored_schema.pointer != schema.pointer + if uri.absolute? @store.add_schema(schema) else
do not update DocumentStore when pointers are different
brandur_json_schema
train
rb