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
dc0e20e5c8c1668e8441bda81bb4162ee478f133
diff --git a/Classes/Netlogix/JsonApiOrg/Property/TypeConverter/SchemaResource/ResourceConverter.php b/Classes/Netlogix/JsonApiOrg/Property/TypeConverter/SchemaResource/ResourceConverter.php index <HASH>..<HASH> 100644 --- a/Classes/Netlogix/JsonApiOrg/Property/TypeConverter/SchemaResource/ResourceConverter.php +++ b/Classes/Netlogix/JsonApiOrg/Property/TypeConverter/SchemaResource/ResourceConverter.php @@ -84,11 +84,11 @@ class ResourceConverter extends AbstractTypeConverter $source['type'] = $this->exposableTypeMap->getType($typeIdentifier); } - $arguments = []; if (array_key_exists('id', $source)) { - $arguments['__identity'] = $source['id']; + $arguments = $source['id']; + } else { + $arguments = []; } - $payload = $this->propertyMapper->convert($arguments, $this->exposableTypeMap->getClassName($source['type'])); $resourceInformation = $this->resourceMapper->findResourceInformation($payload);
ResourceConverter should rely on strings instead of identity array
netlogix_jsonapiorg
train
php
508339d5acedc776b9ce613db6e8a715c44f37e9
diff --git a/lib/uv-rays/connection.rb b/lib/uv-rays/connection.rb index <HASH>..<HASH> 100644 --- a/lib/uv-rays/connection.rb +++ b/lib/uv-rays/connection.rb @@ -14,7 +14,7 @@ module UV tcp.start_read end else - tcp.reactor.lookup(server).then( + tcp.reactor.lookup(server, wait: false).then( proc { |result| UV.try_connect(tcp, handler, result[0][0], port) },
(connection) to use promises by default this is now a co-routine
cotag_uv-rays
train
rb
fc22ae65350933a0f42fd186301710b7ffaf0212
diff --git a/inlineplz/linters/__init__.py b/inlineplz/linters/__init__.py index <HASH>..<HASH> 100644 --- a/inlineplz/linters/__init__.py +++ b/inlineplz/linters/__init__.py @@ -88,6 +88,7 @@ TRUSTED_INSTALL = [ [sys.executable, '-m', 'pip', 'install', '-e', '.'], [sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'], [sys.executable, '-m', 'pip', 'install', '-r', 'requirements_dev.txt'], + [sys.executable, '-m', 'pip', 'install', '-r', 'requirements-dev.txt'], ['pipenv', 'install'] ]
install requirements-dev (#<I>)
guykisel_inline-plz
train
py
a6e03bf88bcf46a09f41f550e48c774276522523
diff --git a/src/Task/GitHubTasks.php b/src/Task/GitHubTasks.php index <HASH>..<HASH> 100644 --- a/src/Task/GitHubTasks.php +++ b/src/Task/GitHubTasks.php @@ -3,7 +3,6 @@ namespace Droath\ProjectX\Task; use Droath\RoboGitHub\Task\loadTasks as loadGitHubTasks; -use Robo\Common\IO; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Question\ChoiceQuestion; @@ -12,7 +11,6 @@ use Symfony\Component\Console\Question\ChoiceQuestion; */ class GitHubTasks extends GitHubTaskBase { - use IO; use loadGitHubTasks; /**
GH-<I>: Fix PHP strict warning in Github tasks.
droath_project-x
train
php
4ebd0e9b73a6cbc1d02e5562e7f79aaab2137f80
diff --git a/babelapi/data_type.py b/babelapi/data_type.py index <HASH>..<HASH> 100644 --- a/babelapi/data_type.py +++ b/babelapi/data_type.py @@ -788,3 +788,5 @@ def is_timestamp_type(data_type): return isinstance(data_type, Timestamp) def is_union_type(data_type): return isinstance(data_type, Union) +def is_numeric_type(data_type): + return is_integer_type(data_type) or is_float_type(data_type) diff --git a/babelapi/generator/generator.py b/babelapi/generator/generator.py index <HASH>..<HASH> 100644 --- a/babelapi/generator/generator.py +++ b/babelapi/generator/generator.py @@ -77,6 +77,19 @@ class Generator(object): self.cur_indent -= dent @contextmanager + def block(self, header='', dent=None, delim=('{','}')): + if header: + self.emit_line('{} {}'.format(header, delim[0])) + else: + self.emit_line(delim[0]) + self.emit_empty_line() + + with self.indent(dent): + yield + + self.emit_line(delim[1]) + + @contextmanager def indent_to_cur_col(self): """ For the duration of the context manager, indentation will be set to the
Add some utility functions to babel Reviewed By: kelkabany
dropbox_stone
train
py,py
3916f167c57241793700db866f94cb80bc75ddb7
diff --git a/chess/engine.py b/chess/engine.py index <HASH>..<HASH> 100644 --- a/chess/engine.py +++ b/chess/engine.py @@ -60,18 +60,7 @@ except ImportError: return loop.run_until_complete(main) finally: try: - pending = _all_tasks(loop) - loop.run_until_complete(asyncio.gather(*pending, return_exceptions=True)) - for task in pending: - if task.cancelled(): - continue - if task.exception() is not None: - loop.call_exception_handler({ - "message": "unhandled exception during chess.engine._run() shutdown", - "exception": task.exception(), - "task": task, - }) - + loop.run_until_complete(asyncio.gather(*_all_tasks(loop), return_exceptions=True)) loop.run_until_complete(loop.shutdown_asyncgens()) finally: asyncio.set_event_loop(None)
Python <I>: Ignore exceptions from pending tasks
niklasf_python-chess
train
py
e7465e24ffc9e0841cc31aad5e0a83b9c84f132e
diff --git a/src/TableColumn/Delete.php b/src/TableColumn/Delete.php index <HASH>..<HASH> 100644 --- a/src/TableColumn/Delete.php +++ b/src/TableColumn/Delete.php @@ -20,15 +20,16 @@ class Delete extends Generic $this->table->app->terminate($reload->renderJSON()); }); + } + + public function getDataCellTemplate(\atk4\data\Field $f = null) + { $this->table->on('click', 'a.'.$this->short_name)->atkAjaxec([ 'uri' => $this->vp->getURL(), 'uri_options' => [$this->name => $this->table->jsRow()->data('id')], 'confirm' => (new \atk4\ui\jQuery())->attr('title'), ]); - } - public function getDataCellTemplate(\atk4\data\Field $f = null) - { return $this->app->getTag( 'a', ['href' => '#', 'title' => 'Delete {$'.$this->table->model->title_field.'}?', 'class' => $this->short_name],
perform on execution later, as it relies on table's url()
atk4_ui
train
php
087dc13965076ffca70170e241a2e209df31fe75
diff --git a/internal/http/server.go b/internal/http/server.go index <HASH>..<HASH> 100644 --- a/internal/http/server.go +++ b/internal/http/server.go @@ -90,7 +90,7 @@ func (srv *Server) Start(ctx context.Context) (err error) { if atomic.LoadUint32(&srv.inShutdown) != 0 { // To indicate disable keep-alives w.Header().Set("Connection", "close") - w.WriteHeader(http.StatusForbidden) + w.WriteHeader(http.StatusServiceUnavailable) w.Write([]byte(http.ErrServerClosed.Error())) w.(http.Flusher).Flush() return
fix: server in shutdown should return <I> instead of <I> (#<I>) various situations where the client is retrying the request server going through shutdown might incorrectly send <I> which is a non-retriable error, this PR allows for clients when they retry an attempt to go to another healthy pod or server in a distributed cluster - assuming it is a properly load-balanced setup.
minio_minio
train
go
d685b675fa2126970971db7307b73f3965ea7ed1
diff --git a/src/java/voldemort/serialization/avro/versioned/AvroVersionedGenericSerializer.java b/src/java/voldemort/serialization/avro/versioned/AvroVersionedGenericSerializer.java index <HASH>..<HASH> 100644 --- a/src/java/voldemort/serialization/avro/versioned/AvroVersionedGenericSerializer.java +++ b/src/java/voldemort/serialization/avro/versioned/AvroVersionedGenericSerializer.java @@ -81,7 +81,11 @@ public class AvroVersionedGenericSerializer implements Serializer<Object> { datumWriter = new GenericDatumWriter<Object>(typeDef); datumWriter.write(object, encoder); encoder.flush(); - } catch(ArrayIndexOutOfBoundsException aIOBE) { + } catch(SerializationException sE) { + throw sE; + } catch(IOException e) { + throw new SerializationException(e); + } catch(Exception aIOBE) { // probably the object sent to us was not created using the latest // schema @@ -92,10 +96,6 @@ public class AvroVersionedGenericSerializer implements Serializer<Object> { Integer writerVersion = getSchemaVersion(writer); return toBytes(object, writer, writerVersion); - } catch(IOException e) { - throw new SerializationException(e); - } catch(SerializationException sE) { - throw sE; } finally { SerializationUtils.close(output); }
fixed try catch in versioned avro serializer
voldemort_voldemort
train
java
26ee9038b342a012acfc8bd61fdf537faa60a968
diff --git a/karma.conf.js b/karma.conf.js index <HASH>..<HASH> 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -38,6 +38,9 @@ module.exports = function (config) { logLevel: 'INFO', + // Default is 1000 but we can run into rate limit issues so bump it up to 10k + pollingTimeout: 10000, + // run the bundle through the webpack and sourcemap plugins preprocessors: { 'test/!(requirejs).test.js': ['webpack']
Stay within Browserstack rate limits BrowserStack dev recommended we increase the time between polls for test status to decrease the number of API calls we make.
rollbar_rollbar.js
train
js
1e624f523bf6178eb4088fb12ec39bb6b2d1e92f
diff --git a/Jakefile.js b/Jakefile.js index <HASH>..<HASH> 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -172,7 +172,7 @@ task('test', ['lint:spec'], function () { }, {async: true}) var pkg = new jake.PackageTask('EpicEditor', 'v' + VERSION, function () { - var fileList = [ 'epiceditor'] + var fileList = [ 'epiceditor', 'epiceditor/*', 'epiceditor/*/*', 'epiceditor/*/*/*'] this.packageDir = "docs/downloads" this.packageFiles.include(fileList); this.needZip = true; @@ -196,4 +196,4 @@ task('ascii', [], function () { " EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE \n" console.log(colorize(epicAscii, 'yellow')) console.log(colorize('EpicEditor - An Embeddable JavaScript Markdown Editor', 'yellow')) -}) \ No newline at end of file +})
hack for Jake traversal handling in pkg task
OscarGodson_EpicEditor
train
js
1223e3865960ee47bd2ff9fed0d7f8876e451f16
diff --git a/pervert/models.py b/pervert/models.py index <HASH>..<HASH> 100644 --- a/pervert/models.py +++ b/pervert/models.py @@ -99,8 +99,24 @@ class Editor(Model): def get_uuid(): return uuid.uuid4().hex +class UUIDField(CharField): + + def __init__(self, *args, **kwargs): + kwargs["max_length"] = 32 + kwargs["db_index"] = True + kwargs["primary_key"] = True + kwargs["default"] = get_uuid + super(UUIDField, self).__init__(*args, **kwargs) + + def contribute_to_class(self, cls, name): + assert not cls._meta.has_auto_field + super(UUIDField, self).contribute_to_class(cls, name) + cls._meta.has_auto_field = True + cls._meta.auto_field = self + class AbstractPervert(Model): + """ uid = CharField( max_length = 32, default = get_uuid, @@ -109,6 +125,9 @@ class AbstractPervert(Model): verbose_name = "unique ID", primary_key = True ) + """ + + uid = UUIDField() class Meta: abstract = True
Fix bug that threw an error when saving a form with inlines, had to create a UUIDField for that.
boronine_discipline
train
py
1058a8e3f1d55c33b2c56b8ac192f8ed856a4fe0
diff --git a/cmd/influxd/upgrade/upgrade.go b/cmd/influxd/upgrade/upgrade.go index <HASH>..<HASH> 100644 --- a/cmd/influxd/upgrade/upgrade.go +++ b/cmd/influxd/upgrade/upgrade.go @@ -357,8 +357,10 @@ func runUpgradeE(*cobra.Command, []string) error { options.source.walDir = v1Config.Data.WALDir options.source.dbURL = v1Config.dbURL() } else { - // Otherwise, assume a standard directory layout. + // Otherwise, assume a standard directory layout + // and the default port on localhost. options.source.populateDirs() + options.source.dbURL = (&configV1{}).dbURL() } err = validatePaths(&options.source, &options.target) @@ -453,7 +455,10 @@ func runUpgradeE(*cobra.Command, []string) error { ) } - log.Info("Upgrade successfully completed. Start service now") + log.Info( + "Upgrade successfully completed. Start the influxd service now, then log in", + zap.String("login_url", options.source.dbURL), + ) return nil }
fix(upgrade): add DB URL to log message at end up upgrade (#<I>)
influxdata_influxdb
train
go
a20bab4c95d45973dd4050f70a34053cd1df94c0
diff --git a/src/js/TextFields/TextField.js b/src/js/TextFields/TextField.js index <HASH>..<HASH> 100644 --- a/src/js/TextFields/TextField.js +++ b/src/js/TextFields/TextField.js @@ -403,16 +403,6 @@ export default class TextField extends PureComponent { }; } - componentWillMount() { - const { value, defaultValue, resize } = this.props; - const v = typeof value !== 'undefined' ? value : defaultValue; - if (!resize || typeof document === 'undefined' || !v) { - return; - } - - this.setState({ width: this._calcWidth(v) }); - } - componentDidMount() { const { value, defaultValue, resize } = this.props; const v = typeof value !== 'undefined' ? value : defaultValue;
Removed the calcWidth in willMount for TextField There is no point in doing the willMount checl for resizing width and should wait until fully mounted to have access to the DOM nodes anyways.
mlaursen_react-md
train
js
3bca5caa5c0cfec3156c3b576948184a4a820bb3
diff --git a/GEOparse/GEOparse.py b/GEOparse/GEOparse.py index <HASH>..<HASH> 100755 --- a/GEOparse/GEOparse.py +++ b/GEOparse/GEOparse.py @@ -305,7 +305,13 @@ def parse_GDS_columns(lines, subsets): subset_ids = defaultdict(dict) for subsetname, subset in iteritems(subsets): for expid in subset.metadata["sample_id"][0].split(","): - pass + try: + subset_type = subset.get_type() + subset_ids[subset_type][expid] = \ + subset.metadata['description'][0] + except Exception as err: + logger.error("Error processing subsets: %s for subset %s" % ( + subset.get_type(), subsetname)) return df.join(DataFrame(subset_ids))
fix: #<I> Roll back to subset type check
guma44_GEOparse
train
py
88058c7a3e5b351f9721fa268c486cd5d5aa040d
diff --git a/lib/ews/connection.rb b/lib/ews/connection.rb index <HASH>..<HASH> 100644 --- a/lib/ews/connection.rb +++ b/lib/ews/connection.rb @@ -26,6 +26,8 @@ class Viewpoint::EWS::Connection # @example https://<site>/ews/Exchange.asmx # @param [Hash] opts Misc config options (mostly for developement) # @option opts [Fixnum] :ssl_verify_mode + # @option opts [Fixnum] :receive_timeout override the default receive timeout + # seconds # @option opts [Array] :trust_ca an array of hashed dir paths or a file def initialize(endpoint, opts = {}) @log = Logging.logger[self.class.name.to_s.to_sym] @@ -39,6 +41,7 @@ class Viewpoint::EWS::Connection @httpcli.ssl_config.verify_mode = opts[:ssl_verify_mode] if opts[:ssl_verify_mode] # Up the keep-alive so we don't have to do the NTLM dance as often. @httpcli.keep_alive_timeout = 60 + @httpcli.receive_timeout = opts[:receive_timeout] if opts[:receive_timeout] @endpoint = endpoint end
Add ability to override HTTPClient#receive_timeout
WinRb_Viewpoint
train
rb
6e4861120e515095d9a3d52fb0fc4265cc14ad0b
diff --git a/php/WP_CLI/Runner.php b/php/WP_CLI/Runner.php index <HASH>..<HASH> 100644 --- a/php/WP_CLI/Runner.php +++ b/php/WP_CLI/Runner.php @@ -421,8 +421,7 @@ class Runner { $pre_cmd = getenv( 'WP_CLI_SSH_PRE_CMD' ); if ( $pre_cmd ) { - $message = WP_CLI::colorize( "%yWP_CLI_SSH_PRE_CMD found, executing the following command(s) on the remote machine:%n\n" ) - . WP_CLI::colorize( '%Y' ) . $pre_cmd . WP_CLI::colorize( '%n' ); + $message = WP_CLI::warning( "WP_CLI_SSH_PRE_CMD found, executing the following command(s) on the remote machine:\n $pre_cmd" ); WP_CLI::log( $message );
Use warning instead of colorize to fix warning output
wp-cli_wp-cli
train
php
85f30ccb3096e177a24f191b1c5f613d3a2c0eb7
diff --git a/structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java b/structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java index <HASH>..<HASH> 100644 --- a/structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java +++ b/structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java @@ -192,7 +192,11 @@ public class GraphObjectModificationState implements ModificationEvent { } } - updateCache(); + // only update cache if key, prev and new values are null + // because that's when a relationship has been created / removed + if (key == null && previousValue == null && newValue == null) { + updateCache(); + } } public void delete(boolean passive) {
Modified GraphObjectModificationState to clear permission path cache only on actual changes to the path.
structr_structr
train
java
bb4c6f2d931858389e3f8518242f50f46e349dce
diff --git a/DrdPlus/Codes/Properties/CharacteristicForGameCode.php b/DrdPlus/Codes/Properties/CharacteristicForGameCode.php index <HASH>..<HASH> 100644 --- a/DrdPlus/Codes/Properties/CharacteristicForGameCode.php +++ b/DrdPlus/Codes/Properties/CharacteristicForGameCode.php @@ -14,7 +14,7 @@ class CharacteristicForGameCode extends AbstractCode const SHOOTING = CombatCharacteristicCode::SHOOTING; const ATTACK_NUMBER = 'attack_number'; - const DEFENSE_AGAINST_SHOOTING = 'defense_against_shooting'; + const DEFENSE_NUMBER_AGAINST_SHOOTING = 'defense_number_against_shooting'; const DEFENSE_NUMBER = 'defense_number'; const ENCOUNTER_RANGE = 'encounter_range'; const FIGHT = 'fight'; @@ -32,7 +32,7 @@ class CharacteristicForGameCode extends AbstractCode self::DEFENSE, self::SHOOTING, self::ATTACK_NUMBER, - self::DEFENSE_AGAINST_SHOOTING, + self::DEFENSE_NUMBER_AGAINST_SHOOTING, self::DEFENSE_NUMBER, self::ENCOUNTER_RANGE, self::FIGHT,
fix: Defense number against shooting renamed
drdplusinfo_drdplus-codes
train
php
957f37b0b0c324a1336ed25d7770c7e174a49f9e
diff --git a/docs/Router.js b/docs/Router.js index <HASH>..<HASH> 100644 --- a/docs/Router.js +++ b/docs/Router.js @@ -244,7 +244,7 @@ const RoutersContainer = withRouter(({ history, location, ...props }) => { <Switch> {getRoutes()} </Switch> - <ScrollToTop showUnder={160} style={{ bottom: 20 }}> + <ScrollToTop showUnder={160} style={{ bottom: 20, zIndex: 999 }}> <div className={`${prefixCls}-totop`}></div> </ScrollToTop> </div>
doc: Change scroll to top style.
uiwjs_uiw
train
js
89c5abe834f61f2aa2a8c30ddfdb585e5da44a51
diff --git a/code/CMSBatchAction.php b/code/CMSBatchAction.php index <HASH>..<HASH> 100644 --- a/code/CMSBatchAction.php +++ b/code/CMSBatchAction.php @@ -76,7 +76,7 @@ abstract class CMSBatchAction ); } - return Convert::raw2json($status); + return json_encode($status); } /** diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index <HASH>..<HASH> 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -316,7 +316,7 @@ class LeftAndMain extends Controller implements PermissionProvider $combinedClientConfig['environment'] = Director::get_environment_type(); $combinedClientConfig['debugging'] = LeftAndMain::config()->uninherited('client_debugging'); - return Convert::raw2json($combinedClientConfig); + return json_encode($combinedClientConfig); } /** @@ -525,7 +525,7 @@ class LeftAndMain extends Controller implements PermissionProvider $data = array_merge($data, $extraData); } - $response = new HTTPResponse(Convert::raw2json($data)); + $response = new HTTPResponse(json_encode($data)); $response->addHeader('Content-Type', 'application/json'); return $response; }
FIX Replace usage of Convert JSON methods with json_encode and json_decode
silverstripe_silverstripe-admin
train
php,php
c670d31c747e41754559a163a80ddcb44d0b9b7b
diff --git a/d1_common_python/src/d1_common/__init__.py b/d1_common_python/src/d1_common/__init__.py index <HASH>..<HASH> 100644 --- a/d1_common_python/src/d1_common/__init__.py +++ b/d1_common_python/src/d1_common/__init__.py @@ -20,7 +20,7 @@ '''Shared code for DataONE Python libraries ''' -__version__ = "1.1.2" +__version__ = "1.1.2RC1" __all__ = [ 'const',
Updated version number to show that this is an RC.
DataONEorg_d1_python
train
py
c492f35a70450ba99cb1412eb1a145a0f4141809
diff --git a/lib/scripts/directive.js b/lib/scripts/directive.js index <HASH>..<HASH> 100644 --- a/lib/scripts/directive.js +++ b/lib/scripts/directive.js @@ -76,7 +76,6 @@ if (!$scope.colorMouse && !$scope.hueMouse && !$scope.opacityMouse && $scope.find(event.target).length === 0) { $scope.log('Color Picker: Document Click Event'); $scope.hide(); - $scope.$apply(); // mouse event on color grid } else if ($scope.colorMouse) { $scope.colorUp(event);
Don't trigger digest cycle as $scope.hide already triggers one
ruhley_angular-color-picker
train
js
f2e47c35def0e3804246a49a44cf3d7bcd407571
diff --git a/bridgesupport.js b/bridgesupport.js index <HASH>..<HASH> 100644 --- a/bridgesupport.js +++ b/bridgesupport.js @@ -122,10 +122,9 @@ function bridgesupport (fw, _global) { case 'constant': (function (name, type) { _global.__defineGetter__(name, function () { - var ptr = fw.lib.get(name) + var ptr = fw.lib.get(name) // TODO: Cache the pointer after the 1st call ptr._type = '^' + type var val = ptr.deref() - delete _global[name] return _global[name] = val }); })(node.attributes.name, getType(node));
The Constant getter cannot be cached after 1 call. The value can and probably will change throughout the lifetime of the program, and if the NULL pointer is cached for NSApp, and then a NSApplication is created, then we're fucked. That's what I ran into...
TooTallNate_NodObjC
train
js
41654ffdad84a1e379e0fc140b66b306ce3c0bff
diff --git a/machina/apps/forum/views.py b/machina/apps/forum/views.py index <HASH>..<HASH> 100644 --- a/machina/apps/forum/views.py +++ b/machina/apps/forum/views.py @@ -54,7 +54,8 @@ class ForumView(PermissionRequiredMixin, ListView): def get_queryset(self): self.forum = self.get_forum() - qs = self.forum.topics.exclude(type=Topic.TYPE_CHOICES.topic_announce).select_related('poster') + qs = self.forum.topics.exclude(type=Topic.TYPE_CHOICES.topic_announce).exclude(approved=False) \ + .select_related('poster') return qs def get_controlled_object(self):
ForumView updated to hide topics that are not approved
ellmetha_django-machina
train
py
cbb647cce05838854d3280f9290fff644dcdf052
diff --git a/leaflet-ajax.js b/leaflet-ajax.js index <HASH>..<HASH> 100644 --- a/leaflet-ajax.js +++ b/leaflet-ajax.js @@ -37,7 +37,7 @@ L.GeoJSON.AJAX=L.GeoJSON.extend({ request.open("GET",url); var _this=this; request.onreadystatechange = function(){ - if (request.readyState === 4 && request.status === 200 && request.getResponseHeader("Content-Type") === "application/json"){ + if (request.readyState === 4 && request.status === 200 ){ response = JSON.parse(request.responseText); _this.addData(response); }
geojson isn't always served with the json mime/type
calvinmetcalf_leaflet-ajax
train
js
7dcc55ff31a840d18a327983fd053ce6a8bf7eb3
diff --git a/openquake/baselib/performance.py b/openquake/baselib/performance.py index <HASH>..<HASH> 100644 --- a/openquake/baselib/performance.py +++ b/openquake/baselib/performance.py @@ -23,6 +23,7 @@ import getpass import operator import itertools from datetime import datetime +from decorator import decorator import psutil import numpy try: @@ -316,6 +317,23 @@ class Monitor(object): return '<%s>' % msg +def vectorize_arg(idx): + """ + Vectorize a function efficientlyif the argument with index `idx` contains + many repetitions. + """ + def caller(func, *args): + args = list(args) + uniq, inv = numpy.unique(args[idx], return_inverse=True) + res = [] + for arg in uniq: + args[idx] = arg + res.append(func(*args)) + return numpy.array(res)[inv] + + return decorator(caller) + + # numba helpers if numba:
Added decorator vectorize_arg
gem_oq-engine
train
py
ec4a2d2d47699e48b7af55e5ab36f6eae1052486
diff --git a/androlog/src/main/java/de/akquinet/android/androlog/Log.java b/androlog/src/main/java/de/akquinet/android/androlog/Log.java index <HASH>..<HASH> 100644 --- a/androlog/src/main/java/de/akquinet/android/androlog/Log.java +++ b/androlog/src/main/java/de/akquinet/android/androlog/Log.java @@ -1116,7 +1116,7 @@ public class Log { if (tag != null && result == null) { int index = tag.lastIndexOf("."); while (result == null && index > -1) { - result = logLevels.get(tag.substring(0, index - 1)); + result = logLevels.get(tag.substring(0, index)); index = tag.lastIndexOf(".", index - 1); } }
Misplaced -1. Sry.
akquinet_androlog
train
java
6710986bdc9303d73071efd1f000f51c36a6f923
diff --git a/system/Validation/Rules.php b/system/Validation/Rules.php index <HASH>..<HASH> 100644 --- a/system/Validation/Rules.php +++ b/system/Validation/Rules.php @@ -422,13 +422,13 @@ class Rules // Still here? Then we fail this test if // any of the fields are not present in $data - foreach ($fields as $field) { + foreach ($fields as $field) + { if ( - (strpos($field, '.') !== false && - empty(dot_array_search($field, $data))) || - (strpos($field, '.') === false && - (!array_key_exists($field, $data) || empty($data[$field]))) - ) { + (strpos($field, '.') !== false && empty(dot_array_search($field, $data))) || + (strpos($field, '.') === false && (! array_key_exists($field, $data) || empty($data[$field]))) + ) + { return false; } }
Update system/Validation/Rules.php
codeigniter4_CodeIgniter4
train
php
21f0d6d1c71f748a768102f3a66b4867f4aaf080
diff --git a/lib/puppet/functions/match.rb b/lib/puppet/functions/match.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/functions/match.rb +++ b/lib/puppet/functions/match.rb @@ -30,6 +30,7 @@ # ~~~ ruby # $matches = ["abc123","def456"].match(/([a-z]+)([1-9]+)/) # # $matches contains [[abc123, abc, 123], [def456, def, 456]] +# ~~~ # # @since 4.0.0 # diff --git a/lib/puppet/parser/functions/match.rb b/lib/puppet/parser/functions/match.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/parser/functions/match.rb +++ b/lib/puppet/parser/functions/match.rb @@ -34,6 +34,7 @@ $matches = "abc123".match(/([a-z]+)([1-9]+)/) ~~~ ruby $matches = ["abc123","def456"].match(/([a-z]+)([1-9]+)/) # $matches contains [[abc123, abc, 123], [def456, def, 456]] +~~~ - Since 4.0.0 DOC
(docs) Fix markup typo in the match function An unclosed code block was messing up the formatting in the function reference.
puppetlabs_puppet
train
rb,rb
e0a706f56605305276dac8d8a5860eab3240ecf5
diff --git a/src/FileUploadsUtils.php b/src/FileUploadsUtils.php index <HASH>..<HASH> 100644 --- a/src/FileUploadsUtils.php +++ b/src/FileUploadsUtils.php @@ -243,7 +243,7 @@ class FileUploadsUtils ); if ($this->_fileStorageAssociation->save($fileStorEnt)) { - $this->_createThumbnails($fileStorEnt); + $this->createThumbnails($fileStorEnt); return $fileStorEnt; } @@ -334,7 +334,7 @@ class FileUploadsUtils * @param \Cake\ORM\Entity $entity File Entity * @return void */ - protected function _createThumbnails(Entity $entity) + public function createThumbnails(Entity $entity) { $this->_handleThumbnails($entity, 'ImageVersion.createVersion'); }
set method as public (task #<I>)
QoboLtd_cakephp-csv-migrations
train
php
97bfc5625cb133fb562830b5b3d33a81b02f61ad
diff --git a/stomp/__main__.py b/stomp/__main__.py index <HASH>..<HASH> 100644 --- a/stomp/__main__.py +++ b/stomp/__main__.py @@ -48,6 +48,7 @@ class StompCLI(Cmd, ConnectionListener): self.verbose = verbose self.user = user self.passcode = passcode + self.__quit = False if ver == '1.0': self.conn = StompConnection10([(host, port)], wait_on_receipt=True) elif ver == '1.1': @@ -65,7 +66,6 @@ class StompCLI(Cmd, ConnectionListener): self.version = ver self.__subscriptions = {} self.__subscription_id = 1 - self.__quit = False def __print_async(self, frame_type, headers, body): """
Avoid AttributeError in CLI when connecting fails due to wrong authentication
jasonrbriggs_stomp.py
train
py
c451e58b5b46d8692fa5bf906f036131dce81289
diff --git a/algolia/analytics/responses_ab_testing.go b/algolia/analytics/responses_ab_testing.go index <HASH>..<HASH> 100644 --- a/algolia/analytics/responses_ab_testing.go +++ b/algolia/analytics/responses_ab_testing.go @@ -36,6 +36,7 @@ type ABTestResponse struct { ClickSignificance float64 `json:"clickSignificance"` ConversionSignificance float64 `json:"conversionSignificance"` CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` EndAt time.Time `json:"endAt"` Name string `json:"name"` Status string `json:"status"` @@ -57,5 +58,5 @@ type VariantResponse struct { TrackedSearchCount int `json:"trackedSearchCount"` TrafficPercentage int `json:"trafficPercentage"` UserCount int `json:"userCount"` - CustomSearchParameters *search.QueryParams `json:"customSearchParameters"` + CustomSearchParameters *search.QueryParams `json:"customSearchParameters,omitempty"` }
fix(analytics): add UpdatedAt field to ABTestResponse (#<I>)
algolia_algoliasearch-client-go
train
go
5eb2df82d91578531ffa5c647cfb1dd23783c0a7
diff --git a/bcbio/variation/freebayes.py b/bcbio/variation/freebayes.py index <HASH>..<HASH> 100644 --- a/bcbio/variation/freebayes.py +++ b/bcbio/variation/freebayes.py @@ -22,5 +22,14 @@ def run_freebayes(align_bam, ref_file, config, dbsnp=None, region=None, "-b", align_bam, "-v", tx_out_file, "-f", ref_file] if region: cl.extend(["-r", region]) - subprocess.check_call(cl) + try: + subprocess.check_call(cl) + # XXX Temporary, work around freebayes issue; need to recall these regions + # later so this is an ugly silent fix. Will need to grep for 'freebayes failed' + # https://github.com/ekg/freebayes/issues/22 + except subprocess.CalledProcessError: + with open(tx_out_file, "w") as out_handle: + out_handle.write("##fileformat=VCFv4.1\n" + "## No variants; freebayes failed\n" + "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n") return out_file
Temporary workaround to skip chromosome calls with freebayes errors
bcbio_bcbio-nextgen
train
py
5012f00f9678a6517fd574dc9e1f5a7b155f3cad
diff --git a/lib/enyo/lib/git.js b/lib/enyo/lib/git.js index <HASH>..<HASH> 100644 --- a/lib/enyo/lib/git.js +++ b/lib/enyo/lib/git.js @@ -44,7 +44,7 @@ function update (dest, target, lib) { cli('updating %s and checking out %s', lib, target); return repo.remote_fetchAsync('origin').then(function () { return checkout(dest, target, lib).then(function () { - return repo.pullAsync().then(null, function (e) { + return repo.pullAsync('origin', target).then(null, function (e) { return reject('failed to merge remote for %s: %s', lib, e.message); }); });
ensure that it is actually pulling the correct target and merging when possible
enyojs_enyo-dev
train
js
28520915675765e8494de27a206f00d2f92610b2
diff --git a/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java b/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java +++ b/src/test/java/com/relayrides/pushy/apns/ApnsClientTest.java @@ -95,7 +95,7 @@ public class ApnsClientTest { @Before public void setUp() throws Exception { this.server = new MockApnsServer(EVENT_LOOP_GROUP); - this.server.start(PORT).await().isSuccess(); + this.server.start(PORT).await(); this.client = new ApnsClient<SimpleApnsPushNotification>( ApnsClientTest.getSslContextForTestClient(SINGLE_TOPIC_CLIENT_CERTIFICATE, SINGLE_TOPIC_CLIENT_PRIVATE_KEY), @@ -106,8 +106,8 @@ public class ApnsClientTest { @After public void tearDown() throws Exception { - this.client.disconnect().await().isSuccess(); - this.server.shutdown().await().isSuccess(); + this.client.disconnect().await(); + this.server.shutdown().await(); } @AfterClass
Removed some spurious calls to `isSuccess()`.
relayrides_pushy
train
java
3aea56321f057435bb16eb497531429c7a857c4e
diff --git a/lib/booking_locations/location.rb b/lib/booking_locations/location.rb index <HASH>..<HASH> 100644 --- a/lib/booking_locations/location.rb +++ b/lib/booking_locations/location.rb @@ -52,7 +52,8 @@ module BookingLocations end def name_for(location_id) - location_for(location_id).name + found = location_for(location_id) + found ? found.name : '' end end end diff --git a/spec/location_spec.rb b/spec/location_spec.rb index <HASH>..<HASH> 100644 --- a/spec/location_spec.rb +++ b/spec/location_spec.rb @@ -84,6 +84,12 @@ RSpec.describe BookingLocations::Location do expect(subject.name_for('1d7c72fc-0c74-4418-8099-e1a4e704cb01')).to eq('Child CAB') end end + + context 'with a non-existent location ID' do + it 'returns an empty string' do + expect(subject.name_for('deadbeef-dead-beef-beef-deadbeefdead')).to eq('') + end + end end describe '#guider_name_for' do
Guard against location names This can happen when the requesting application has a reference to an outdated location.
guidance-guarantee-programme_booking_locations
train
rb,rb
820a9e6804f8e955597d81eced85dd8d15577000
diff --git a/src/Plugin.php b/src/Plugin.php index <HASH>..<HASH> 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -24,8 +24,8 @@ use Composer\Script\ScriptEvents; */ class Plugin implements PluginInterface, EventSubscriberInterface { - private const EXTRA_OPTION_NAME = 'config-plugin'; - private const EXTRA_DEV_OPTION_NAME = 'config-plugin-dev'; + const EXTRA_OPTION_NAME = 'config-plugin'; + const EXTRA_DEV_OPTION_NAME = 'config-plugin-dev'; /** * @var Package[] the array of active composer packages
Update Plugin.php to fix error in <I>
hiqdev_composer-config-plugin
train
php
3d6c5aa31b42b6db6da9ed86509601c8e97e77f6
diff --git a/tag.go b/tag.go index <HASH>..<HASH> 100644 --- a/tag.go +++ b/tag.go @@ -216,6 +216,9 @@ func (t Tag) FormFrames() ([]byte, error) { frames.Reset() for id, f := range t.frames { + if id == "" { + return nil, errors.New("Uncorrect ID in frames") + } frameBody, err := f.Bytes() if err != nil { return nil, err @@ -237,6 +240,9 @@ func (t Tag) FormSequences() ([]byte, error) { frames.Reset() for id, s := range t.sequences { + if id == "" { + return nil, errors.New("Uncorrect ID in sequences") + } for _, f := range s.Frames() { frameBody, err := f.Bytes() if err != nil {
Add errors with uncorrect ids in frames/sequences
bogem_id3v2
train
go
b0a049b4b14b0de900bd4f3e0e75eacfef99f7f6
diff --git a/lib/ticket_evolution/core/connection.rb b/lib/ticket_evolution/core/connection.rb index <HASH>..<HASH> 100644 --- a/lib/ticket_evolution/core/connection.rb +++ b/lib/ticket_evolution/core/connection.rb @@ -40,7 +40,7 @@ module TicketEvolution @url ||= [].tap do |parts| parts << TicketEvolution::Connection.protocol parts << "://api." - parts << "#{@config[:mode]}." unless @config[:mode] == :production + parts << "#{@config[:mode]}." if @config[:mode].present? && @config[:mode].to_sym != :production parts << TicketEvolution::Connection.url_base end.join end diff --git a/spec/lib/ticket_evolution/core/connection_spec.rb b/spec/lib/ticket_evolution/core/connection_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/ticket_evolution/core/connection_spec.rb +++ b/spec/lib/ticket_evolution/core/connection_spec.rb @@ -122,6 +122,12 @@ describe TicketEvolution::Connection do end describe "#url" do + context "mode is blank" do + subject { klass.new(valid_options.merge({:mode => nil}))} + + its(:url) { should == "https://api.ticketevolution.com" } + end + context "production" do subject { klass.new(valid_options.merge({:mode => :production}))}
a blank mode doesn't generate a 'api..ticketevo.com' URL
ticketevolution_ticketevolution-ruby
train
rb,rb
aa1fc4011d9b4a0dca4eef265cd9165fdacdae07
diff --git a/components/docked-panel-ng/docked-panel-ng.js b/components/docked-panel-ng/docked-panel-ng.js index <HASH>..<HASH> 100644 --- a/components/docked-panel-ng/docked-panel-ng.js +++ b/components/docked-panel-ng/docked-panel-ng.js @@ -155,8 +155,10 @@ angularModule.directive('rgDockedPanel', function rgDockedPanelDirective($parse) window.removeEventListener('resize', _onResize); }); - saveInitialPos(); - checkPanelPosition(); + scheduleRAF(() => { + saveInitialPos(); + checkPanelPosition(); + })(); }); }
RG-<I> wait for render before getting initial panel position
JetBrains_ring-ui
train
js
5a3e680d46b9f4b3d2f29d879918601afc414a8b
diff --git a/src/CLIResultPrinter.php b/src/CLIResultPrinter.php index <HASH>..<HASH> 100644 --- a/src/CLIResultPrinter.php +++ b/src/CLIResultPrinter.php @@ -74,7 +74,7 @@ class CLIResultPrinter implements ResultPrinterInterface foreach ($context->getErrors() as $error) { $this->output->writeln( sprintf( - '> <fg=red>%s</fg=red>', + '> <fg=red>[Error] %s</fg=red>', $error->getText() ) );
Adding [Error] to the printContext output.
sstalle_php7cc
train
php
29d61bbc1184b97eb1c01d4d675ae5ddfd853ec3
diff --git a/src/controllers/CrudController.js b/src/controllers/CrudController.js index <HASH>..<HASH> 100644 --- a/src/controllers/CrudController.js +++ b/src/controllers/CrudController.js @@ -74,7 +74,7 @@ export default class CrudController { } }); remove.map(index => this[model].splice(index, 1)); - } else if (this[model] instanceof Model) { + } else if (this[model] instanceof Model && this[model].$dirty) { promises.push(this[this.$mapping[model]].save(this[model]).then(() => { done++; this.progress = (done / promises.length) * 100;
this, too, only if dirty
monomelodies_monad
train
js
a292be09ab6f6dcfb19ffccedb25e86205437889
diff --git a/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java b/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java +++ b/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java @@ -264,7 +264,7 @@ public class TreeTableRenderer extends DataRenderer { boolean hasPaginator = tt.isPaginator(); if (!(root instanceof TreeNode)) { - throw new FacesException("treeTable's value must be an instance of org.primefaces.model.TreeNode"); + throw new FacesException("treeTable's value must be an instance of " + TreeNode.class.getName()); } if (hasPaginator) {
Fix #<I> - dynamically get the full-qualified name of TreeNode
primefaces_primefaces
train
java
a3d0ae6cc51459f4207c24d2231eb54ce37d79b7
diff --git a/poem-jvm/src/javascript/movi/api/shape.js b/poem-jvm/src/javascript/movi/api/shape.js index <HASH>..<HASH> 100644 --- a/poem-jvm/src/javascript/movi/api/shape.js +++ b/poem-jvm/src/javascript/movi/api/shape.js @@ -120,8 +120,8 @@ MOVI.namespace("model"); this.childShapes = {}; // reset childShapes map // create shape object for each child and append to childShapes map - for(key in childSh) { - var child = childSh[key]; + for(var i = 0; i<childSh.length; i++) { + var child = childSh[i]; var subclass = _getSubclassForJSONObj(child, stencilset); child = new subclass(child, stencilset, this); this.childShapes[child.resourceId] = child;
Fixed bug that occurs when prototype was used along with the MOVI API git-svn-id: <URL>
kiegroup_jbpm-designer
train
js
1902883207d22a9f3450b786c5c2a20ef5b043cb
diff --git a/autotest/mc_tests.py b/autotest/mc_tests.py index <HASH>..<HASH> 100644 --- a/autotest/mc_tests.py +++ b/autotest/mc_tests.py @@ -131,7 +131,7 @@ def from_dataframe_test(): pstc = Pst(pst) par = pstc.parameter_data - par.sort_values(by=parnme,ascending=False,inplace=True) + par.sort_values(by="parnme",ascending=False,inplace=True) cov = Cov.from_parameter_data(pstc) pe = ParameterEnsemble.from_gaussian_draw(pst=mc.pst,cov=cov) @@ -684,8 +684,8 @@ if __name__ == "__main__": #gaussian_draw_test() #parfile_test() # write_regul_test() - # from_dataframe_test() + from_dataframe_test() # ensemble_seed_test() # pnulpar_test() # enforce_test() - add_base_test() \ No newline at end of file + #add_base_test() \ No newline at end of file
bug fix in mc_test
jtwhite79_pyemu
train
py
33d1e340fd74fd62aed7cfa4397137ae2beef5b6
diff --git a/src/Router/index.js b/src/Router/index.js index <HASH>..<HASH> 100644 --- a/src/Router/index.js +++ b/src/Router/index.js @@ -682,7 +682,7 @@ Router.prototype = { * @return {Boolean} */ isPublicFolder(url) { - return url.startsWith('/public') || + return url.startsWith('/public/') || url == '/robots.txt' || url == '/favicon.ico'; }
change check if is public route to only match routes inside /public/ not /publications
wejs_we-core
train
js
aebbb67b9160731919b245654682c942be6ee43f
diff --git a/runtime/world.js b/runtime/world.js index <HASH>..<HASH> 100755 --- a/runtime/world.js +++ b/runtime/world.js @@ -47,7 +47,8 @@ function getDriverInstance() { case 'electron': { driver = new ElectronDriver(); - } break; + } + break; case 'chrome': { driver = new ChromeDriver(); @@ -223,18 +224,15 @@ module.exports = function () { return driver.close().then(function () { return driver.quit(); - }) - }).then(function () { - // If the test was aborted before eyes.close was called ends the test as aborted. - return eyes.abortIfNotClosed(); - }); + }).then(function () { + // If the test was aborted before eyes.close was called ends the test as aborted. + return eyes.abortIfNotClosed(); + }); + }) } return driver.close().then(function () { return driver.quit(); - }).then(function () { - // If the test was aborted before eyes.close was called ends the test as aborted. - return eyes.abortIfNotClosed(); - }); + }) }); };
Fix issue with promises in world.js only uses the abort method when test fails .
john-doherty_selenium-cucumber-js
train
js
5dc56b2aa8728632c5644fb7573da75ca1fb9266
diff --git a/lib/et-orbi.rb b/lib/et-orbi.rb index <HASH>..<HASH> 100644 --- a/lib/et-orbi.rb +++ b/lib/et-orbi.rb @@ -137,13 +137,16 @@ p [ :get_tzone, :o, o ] return nil unless o.is_a?(String) s = unalias(o) +tzis = (s.match(/\AWET/) rescue nil) ? 'WET' : s p [ :get_tzone, :s, s, 0, get_offset_tzone(s) ] p [ :get_tzone, :s, s, 1, get_x_offset_tzone(s) ] p [ :get_tzone, :s, s, 2, begin; ::TZInfo::Timezone.get(s); rescue => r; r.to_s; end ] +p [ :get_tzone, :s, tzis, 2.1, begin; ::TZInfo::Timezone.get(tzis); rescue => r; r.to_s; end ] get_offset_tzone(s) || get_x_offset_tzone(s) || - (::TZInfo::Timezone.get(s) rescue nil) + (::TZInfo::Timezone.get(tzis) rescue nil) + #(::TZInfo::Timezone.get(s) rescue nil) end def render_nozone_time(seconds)
Try to truncate "WET-1WEST" to "WET"
floraison_et-orbi
train
rb
67e23072d98b243bbd7940efa5f220d47a4d375c
diff --git a/salt/modules/pip.py b/salt/modules/pip.py index <HASH>..<HASH> 100644 --- a/salt/modules/pip.py +++ b/salt/modules/pip.py @@ -935,7 +935,7 @@ def upgrade(bin_env=None, if bin_env and os.path.isdir(bin_env): cmd_kwargs['env'] = {'VIRTUAL_ENV': bin_env} errors = False - for pkg in old: + for pkg in list_upgrades(bin_env=bin_env, user=user, cwd=cwd): result = __salt__['cmd.run_all'](' '.join(cmd+[pkg]), **cmd_kwargs) if result['retcode'] != 0: errors = True
ENH: Updated modules.pip.upgrade function to only upgrade packages which are out-of-date
saltstack_salt
train
py
b591670478f29fa33ca869848937986e0f7e064a
diff --git a/controller/frontend/src/Controller/Frontend/Basket/Standard.php b/controller/frontend/src/Controller/Frontend/Basket/Standard.php index <HASH>..<HASH> 100644 --- a/controller/frontend/src/Controller/Frontend/Basket/Standard.php +++ b/controller/frontend/src/Controller/Frontend/Basket/Standard.php @@ -338,7 +338,7 @@ class Standard } - $provider = $manager->getProvider( $item, $code ); + $provider = $manager->getProvider( $item, $codeItem->getCode() ); if( $provider->isAvailable( $this->get() ) !== true ) { throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) );
Only use coupon code from database (case sensitive)
aimeos_ai-controller-frontend
train
php
53cff3fcebd1e177d04129dc131523635bc45d3d
diff --git a/sqlite3.go b/sqlite3.go index <HASH>..<HASH> 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -913,7 +913,7 @@ func (c *SQLiteConn) begin(ctx context.Context) (driver.Tx, error) { // - rwc // - memory // -// shared +// cache // SQLite Shared-Cache Mode // https://www.sqlite.org/sharedcache.html // Values: @@ -1910,7 +1910,7 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result resultCh <- result{r, err} }() select { - case rv := <- resultCh: + case rv := <-resultCh: return rv.r, rv.err case <-ctx.Done(): select { @@ -2011,7 +2011,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error { resultCh <- rc.nextSyncLocked(dest) }() select { - case err := <- resultCh: + case err := <-resultCh: return err case <-rc.ctx.Done(): select {
fix typo in doc comment (#<I>)
xeodou_go-sqlcipher
train
go
0b2ea658342f9ac9b4796cd2b471b568cd2ddb2f
diff --git a/src/main/java/org/jheaps/tree/DaryTreeAddressableHeap.java b/src/main/java/org/jheaps/tree/DaryTreeAddressableHeap.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jheaps/tree/DaryTreeAddressableHeap.java +++ b/src/main/java/org/jheaps/tree/DaryTreeAddressableHeap.java @@ -63,32 +63,32 @@ public class DaryTreeAddressableHeap<K, V> implements AddressableHeap<K, V>, Ser * * @serial */ - private final Comparator<? super K> comparator; + protected final Comparator<? super K> comparator; /** * Size of the heap */ - private long size; + protected long size; /** * Root node of the heap */ - private Node root; + protected Node root; /** * Branching factor. Always a power of two. */ - private final int d; + protected final int d; /** * Base 2 logarithm of branching factor. */ - private final int log2d; + protected final int log2d; /** * Auxiliary for swapping children. */ - private Node[] aux; + protected Node[] aux; /** * Constructs a new, empty heap, using the natural ordering of its keys.
Changed access to protected for DaryTreeAddressableHeap
d-michail_jheaps
train
java
b95f7307cccb101e62ac009abb500be99f11657c
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -221,9 +221,15 @@ module.exports = (function () { teardown: function (connectionName, cb) { var closeConnection = function (connectionName) { var connection = me.connections[connectionName]; - if (connection.conn) connection.conn.close(function (err) { - if (err) console.error(err); - }); + if(connection) + if (connection.conn && typeof connection.conn.close == 'function') + connection.conn.close(function (err) { + if (err) console.error(err); + }); + else + connection.close(function (err) { + if (err) console.error(err); + }); delete me.connections[connectionName]; };
tearDown method verifies whether object instance has close method before attemptint to invoke connection.close() .Resolved Issue: <URL>
IbuildingsItaly_sails-db2
train
js
a61b52f91e005fd9ca472415adf43171b433ac43
diff --git a/cassandra/cluster.py b/cassandra/cluster.py index <HASH>..<HASH> 100644 --- a/cassandra/cluster.py +++ b/cassandra/cluster.py @@ -44,6 +44,11 @@ try: except ImportError: from cassandra.io.asyncorereactor import AsyncoreConnection as DefaultConnection # NOQA +# Forces load of utf8 encoding module to avoid deadlock that occurs +# if code that is being imported tries to import the module in a seperate +# thread. +# See http://bugs.python.org/issue10923 +"".encode('utf8') log = logging.getLogger(__name__)
Fixed deadlock that occurs in a certain import scenario. When user code imports code that initiates a new connection, it could cause a deadlock when String.encode was called in a seperate thread (e.g. when reading messages from the cassandra server). See <URL>
datastax_python-driver
train
py
61dab3693b3681b3ddbaf58a7e9e11392a540a7a
diff --git a/src/arcrest/web/_base.py b/src/arcrest/web/_base.py index <HASH>..<HASH> 100644 --- a/src/arcrest/web/_base.py +++ b/src/arcrest/web/_base.py @@ -265,7 +265,7 @@ class BaseWebOperations(object): else: read = "" for data in self._chunk(response=resp, size=4096): - read += data.decode('ascii') + read += data.decode('utf') del data try: return json.loads(read.strip()) diff --git a/src/arcresthelper/publishingtools.py b/src/arcresthelper/publishingtools.py index <HASH>..<HASH> 100644 --- a/src/arcresthelper/publishingtools.py +++ b/src/arcresthelper/publishingtools.py @@ -2731,7 +2731,7 @@ class publishingtools(securityhandlerhelper): fURL = efs_config['URL'] if fURL is None: print("Item and layer not found or URL not in config") - continue + return None if 'DeleteInfo' in efs_config: if str(efs_config['DeleteInfo']['Delete']).upper() == "TRUE": resItm['DeleteDetails'] = fst.DeleteFeaturesFromFeatureLayer(url=fURL, sql=efs_config['DeleteInfo']['DeleteSQL'],chunksize=cs)
resolved bug in arcresthelper/publishingtools.py change decode from ASCII to UTF for encode response from a post to support non acsii codes
Esri_ArcREST
train
py,py
26e2b864c0fd4080487f6108f017a405ed1ae1ea
diff --git a/api/index.php b/api/index.php index <HASH>..<HASH> 100644 --- a/api/index.php +++ b/api/index.php @@ -362,7 +362,7 @@ $app->group('/push', function() use ($app) { /** * POST /push/registration */ - $app->post('/registration', function() { + $app->post('/registration', function() use ($app) { $data = $app->request->post('d') ?: $app->request->post('data') ?: $app->request->post(); return models\PushRegistration::create(array_merge($data, array('app_id' => $app->key->app_id))); }); @@ -370,7 +370,7 @@ $app->group('/push', function() use ($app) { /** * DELETE /push/registration */ - $app->delete('/registration', function() { + $app->delete('/registration', function() use ($app) { $data = $app->request->post('d') ?: $app->request->post('data') ?: $app->request->post(); return models\PushRegistration::create(array_merge($data, array('app_id' => $app->key->app_id))); });
minor fix at POST push/registration route. #<I>
doubleleft_hook
train
php
6e738ee3de3721eb57af5db70a7ca3f2786e3dc6
diff --git a/Classes/JavascriptManager.php b/Classes/JavascriptManager.php index <HASH>..<HASH> 100644 --- a/Classes/JavascriptManager.php +++ b/Classes/JavascriptManager.php @@ -24,6 +24,7 @@ namespace ApacheSolrForTypo3\Solr; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -37,30 +38,35 @@ class JavascriptManager const POSITION_HEADER = 'header'; const POSITION_FOOTER = 'footer'; const POSITION_NONE = 'none'; + /** * Javascript files to load. * * @var array */ protected static $files = []; + /** * Raw script snippets to load. * * @var array */ protected static $snippets = []; + /** * Javascript file configuration. * - * @var array + * @var TypoScriptConfiguration */ protected $configuration; + /** * Where to insert the JS, either header or footer * * @var string */ protected $javascriptInsertPosition; + /** * JavaScript tags to add to the page for the current instance *
[TASK] Fix scrutinizer issues in JavascriptManager
TYPO3-Solr_ext-solr
train
php
13e00df17999857013983051da26a0e15d6f23a5
diff --git a/activerecord/lib/active_record/no_touching.rb b/activerecord/lib/active_record/no_touching.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/no_touching.rb +++ b/activerecord/lib/active_record/no_touching.rb @@ -43,6 +43,13 @@ module ActiveRecord end end + # Returns +true+ if the class has +no_touching+ set, +false+ otherwise. + # + # Project.no_touching do + # Project.first.no_touching? # true + # Message.first.no_touching? # false + # end + # def no_touching? NoTouching.applied_to?(self.class) end
Add example for no_touching? in active_record/no_touching for api docs [ci skip] There was no example code for ActiveRecord::NoTouching#no_touching?. This PR adds an example for the API docs.
rails_rails
train
rb
3684451c5fc84c1ff35d976059caa129016521a8
diff --git a/gcloud_requests/requests_connection.py b/gcloud_requests/requests_connection.py index <HASH>..<HASH> 100644 --- a/gcloud_requests/requests_connection.py +++ b/gcloud_requests/requests_connection.py @@ -9,7 +9,7 @@ from gcloud.logging.connection import Connection as GCloudLoggingConnection from gcloud.pubsub.connection import Connection as GCloudPubSubConnection from gcloud.storage.connection import Connection as GCloudStorageConnection from google.rpc import status_pb2 -from requests.packages.urllib3 import Retry +from requests.packages.urllib3.util.retry import Retry from threading import local from . import logger
Use fully qualified urllib3 Retry import See shazow/urllib3#<I> for what is happening here
LeadPages_gcloud_requests
train
py
70761a6fd340662d9f1bc1e305c6af46728afd39
diff --git a/runtime/src/com4j/Variant.java b/runtime/src/com4j/Variant.java index <HASH>..<HASH> 100644 --- a/runtime/src/com4j/Variant.java +++ b/runtime/src/com4j/Variant.java @@ -763,6 +763,7 @@ public final class Variant extends Number { * Represents the special variant instance used for * missing parameters. */ + public static final Variant MISSING = new Variant(); /** * Generates a new Variant object, representing the VARIANT MISSING
Is this removal by accident? This is an incompatible change git-svn-id: <URL>
kohsuke_com4j
train
java
eda2ef6113426aeb34e554ade645e4debca90049
diff --git a/src/Resource.js b/src/Resource.js index <HASH>..<HASH> 100644 --- a/src/Resource.js +++ b/src/Resource.js @@ -16,6 +16,7 @@ var EventEmitter = require('eventemitter3'), * @param [options.loadType=Resource.LOAD_TYPE.XHR] {Resource.LOAD_TYPE} How should this resource be loaded? * @param [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] {Resource.XHR_RESPONSE_TYPE} How should the data being * loaded be interpreted when using XHR? + * @param [options.extra] {object} Extra info for middleware. */ function Resource(name, url, options) { EventEmitter.call(this); @@ -79,6 +80,13 @@ function Resource(name, url, options) { this.xhrType = options.xhrType; /** + * Extra info for middleware + * + * @member {object} + */ + this.extra = options.extra || {}; + + /** * The error that occurred while loading (if any). * * @member {Error}
Sometimes middleware needs extra info to parse the file. Required for retina and compressed textures support in pixi.js
englercj_resource-loader
train
js
14ebef70cb35edba58576901fce343fbe9f1514b
diff --git a/js/crypto.js b/js/crypto.js index <HASH>..<HASH> 100644 --- a/js/crypto.js +++ b/js/crypto.js @@ -87,9 +87,9 @@ window.textsecure.crypto = new function() { priv[0] |= 0x0001; //TODO: fscking type conversion - return new Promise.resolve({ pubKey: prependVersion(toArrayBuffer(curve25519(priv))), privKey: privKey}); + return Promise.resolve({ pubKey: prependVersion(toArrayBuffer(curve25519(priv))), privKey: privKey}); } - + } var privToPub = function(privKey, isIdentity) { return testing_only.privToPub(privKey, isIdentity); } diff --git a/js/webcrypto.js b/js/webcrypto.js index <HASH>..<HASH> 100644 --- a/js/webcrypto.js +++ b/js/webcrypto.js @@ -73,7 +73,7 @@ window.crypto.subtle = (function() { function promise(implementation) { var args = Array.prototype.slice.call(arguments); args.shift(); - return new Promise.resolve(toArrayBuffer(implementation.apply(this, args))); + return Promise.resolve(toArrayBuffer(implementation.apply(this, args))); } // public interface functions
fixed 'TypeError: Promise.resolve is not a constructor' in Firefox
ForstaLabs_librelay-node
train
js,js
fc7fbf7e07d9939d2b1162adef5625cb5f79a04d
diff --git a/marshal.go b/marshal.go index <HASH>..<HASH> 100644 --- a/marshal.go +++ b/marshal.go @@ -1323,7 +1323,16 @@ func marshalUDT(info TypeInfo, value interface{}) ([]byte, error) { if !f.IsValid() { return nil, marshalErrorf("cannot marshal %T into %s", value, info) } else if f.Kind() == reflect.Ptr { - f = f.Elem() + if f.IsNil() { + n := -1 + buf = append(buf, byte(n>>24), + byte(n>>16), + byte(n>>8), + byte(n)) + continue + } else { + f = f.Elem() + } } data, err := Marshal(e.Type, f.Interface())
Encode the UDT field as null if the struct value is nil. Fixes #<I>.
gocql_gocql
train
go
d5adc9e4330c10c07ad89b6fb301ed446e7717a9
diff --git a/src/Configuration/Options.php b/src/Configuration/Options.php index <HASH>..<HASH> 100644 --- a/src/Configuration/Options.php +++ b/src/Configuration/Options.php @@ -31,7 +31,7 @@ class Options /** * @var bool */ - private $shouldSkipConstructor; + private $shouldSkipConstructor = false; /** * @var PropertyAccessorInterface
Provide a default value for the skipping of the constructor
mark-gerarts_automapper-plus
train
php
51076695b61baa82dfa9d1669a05321983d83f25
diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java index <HASH>..<HASH> 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OSQLSynchQuery.java @@ -84,6 +84,8 @@ public class OSQLSynchQuery<T extends Object> extends OSQLAsynchQuery<T> impleme result.add((T) r); } + ((OResultSet) result).setCompleted(); + if (!result.isEmpty()) { previousQueryParams = new HashMap<Object, Object>(queryParams); final ORID lastRid = ((OIdentifiable) result.get(result.size() - 1)).getIdentity();
Fixed issue when query was frozen on sharding
orientechnologies_orientdb
train
java
b8962cfdced36943e536cdd425fee6a9084a443e
diff --git a/reader.go b/reader.go index <HASH>..<HASH> 100644 --- a/reader.go +++ b/reader.go @@ -541,7 +541,7 @@ func handleError(q *Reader, c *nsqConn, errMsg string) { break } err := q.ConnectToNSQ(addr) - if err != nil { + if err != nil && err != ErrAlreadyConnected { log.Printf("ERROR: failed to connect to %s - %s", addr, err.Error()) continue
handleError() loops if already connected
nsqio_go-nsq
train
go
1119744389a49a50d659bc867ef98a64962457c1
diff --git a/Tpg/ExtjsBundle/Tests/testrunner.js b/Tpg/ExtjsBundle/Tests/testrunner.js index <HASH>..<HASH> 100644 --- a/Tpg/ExtjsBundle/Tests/testrunner.js +++ b/Tpg/ExtjsBundle/Tests/testrunner.js @@ -13,7 +13,7 @@ var system = require('system'); * @param timeOutMillis the max amount of time to wait. If not specified, 3 sec is used. */ function waitFor(testFx, onReady, timeOutMillis) { - var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3001, //< Default Max Timeout is 3s + var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 30001, //< Default Max Timeout is 3s start = new Date().getTime(), condition = false, interval = setInterval(function() {
Increase the timeout value for the waitFor function.
AmsTaFFix_extjs-bundle
train
js
7578dd2e25025450025b096251d5dd7530b9ebe1
diff --git a/lmj/nn/trainer.py b/lmj/nn/trainer.py index <HASH>..<HASH> 100644 --- a/lmj/nn/trainer.py +++ b/lmj/nn/trainer.py @@ -62,6 +62,8 @@ class Trainer(object): best_iter = i best_params = [p.get_value().copy() for p in self.params] fmt += ' *' + else: + self.validation_stagnant() self.finish_iteration() except KeyboardInterrupt: logging.info('interrupted !') @@ -76,6 +78,9 @@ class Trainer(object): def finish_iteration(self): pass + def validation_stagnant(self): + pass + def evaluate(self, test_set): return np.mean([self.f_eval(*i) for i in test_set], axis=0) @@ -118,7 +123,7 @@ class SGD(Trainer): def learning_rate(self): return self.f_rate()[0] - def finish_iteration(self): + def validation_stagnant(self): self.f_finish()
During SGD training, only reduce the learning rate when validation fails to make an improvement.
lmjohns3_theanets
train
py
d1fa444bfb8fe2762777da8485fe5e0e2545701e
diff --git a/src/PerrysLambda/ArrayBase.php b/src/PerrysLambda/ArrayBase.php index <HASH>..<HASH> 100644 --- a/src/PerrysLambda/ArrayBase.php +++ b/src/PerrysLambda/ArrayBase.php @@ -15,7 +15,7 @@ use PerrysLambda\IFieldConverter; * Base class for array-like types */ abstract class ArrayBase extends Property - implements \ArrayAccess, \SeekableIterator, IArrayable, ICloneable + implements \ArrayAccess, \SeekableIterator, IArrayable, ICloneable, \Countable { /** @@ -381,7 +381,7 @@ abstract class ArrayBase extends Property { return count($this->__data); } - + /** * Check for field by its name * @param mixed $field @@ -1161,6 +1161,18 @@ abstract class ArrayBase extends Property { $this->__iteratorindex = $position; } + + + // Countable --------------------------------------------------------------- + + + /** + * \Countable implementation + */ + public function count() + { + return $this->length(); + } }
Implement Countable interface into ArrayBase
perryflynn_PerrysLambda
train
php
a41324ce7544af03d12adeab5b732f48b20988d3
diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index <HASH>..<HASH> 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -687,12 +687,12 @@ module Fluent::Plugin def convert(s) if @need_enc - s.encode(@encoding, @from_encoding) + s.encode!(@encoding, @from_encoding) else s end rescue - s.encode(@encoding, @from_encoding, :invalid => :replace, :undef => :replace) + s.encode!(@encoding, @from_encoding, :invalid => :replace, :undef => :replace) end def next_line
in_tail: Use encode! instead of encode to improve the performance
fluent_fluentd
train
rb
29d0fbcb001779bbd100a1233a24d9489036413e
diff --git a/common/src/main/java/com/turn/ttorrent/common/TorrentGeneralMetadata.java b/common/src/main/java/com/turn/ttorrent/common/TorrentGeneralMetadata.java index <HASH>..<HASH> 100644 --- a/common/src/main/java/com/turn/ttorrent/common/TorrentGeneralMetadata.java +++ b/common/src/main/java/com/turn/ttorrent/common/TorrentGeneralMetadata.java @@ -56,4 +56,9 @@ public interface TorrentGeneralMetadata { */ boolean isPrivate(); + /** + * @return SHA-1 hash of info dictionary + */ + String getHexInfoHash(); + }
added getHexInfoHash method to torrent general metadata interface.
mpetazzoni_ttorrent
train
java
a9face7185d0e310882b2be1e14ac1662f8eec71
diff --git a/db/db.py b/db/db.py index <HASH>..<HASH> 100644 --- a/db/db.py +++ b/db/db.py @@ -1235,7 +1235,7 @@ class DB(object): sys.stderr.write("Refreshing schema. Please wait...") if self.schemas is not None and isinstance(self.schemas, list) and 'schema_specified' in self._query_templates['system']: schemas_str = ','.join([repr(schema) for schema in self.schemas]) - q = self._query_templates['system']['schema_specified'] % str(self.schemas) + q = self._query_templates['system']['schema_specified'] % schemas_str elif exclude_system_tables==True: q = self._query_templates['system']['schema_no_system'] else:
Fix for schema_specified case in refresh_schema
yhat_db.py
train
py
94a69153207e72a86e2c946288fdafb4b4716bdd
diff --git a/pysoa/client/client.py b/pysoa/client/client.py index <HASH>..<HASH> 100644 --- a/pysoa/client/client.py +++ b/pysoa/client/client.py @@ -358,11 +358,12 @@ class Client(object): context['correlation_id'] = correlation_id elif 'correlation_id' not in context: context['correlation_id'] = six.u(uuid.uuid1().hex) - # Optionally add switches - if switches is not None: - context['switches'] = list(switches) - elif 'switches' not in context: - context['switches'] = [] + # Switches can come from three different places, so merge them + # and ensure that they are unique + switches = set(switches or []) + if context_extra: + switches |= set(context_extra.pop('switches', [])) + context['switches'] = list(set(context.get('switches', [])) | switches) # Add any extra stuff if context_extra: context.update(context_extra)
Ensure that switches from Client.context are correctly merged with the switches passed to each request.
eventbrite_pysoa
train
py
1cf0d33f1d5bf8f71bab0b49d1fa37116c38a86d
diff --git a/paramiko/server.py b/paramiko/server.py index <HASH>..<HASH> 100644 --- a/paramiko/server.py +++ b/paramiko/server.py @@ -179,6 +179,35 @@ class ServerInterface (object): @rtype: int """ return AUTH_FAILED + + def check_global_request(self, kind, msg): + """ + Handle a global request of the given C{kind}. This method is called + in server mode and client mode, whenever the remote host makes a global + request. If there are any arguments to the request, they will be in + C{msg}. + + There aren't any useful global requests defined, aside from port + forwarding, so usually this type of request is an extension to the + protocol. + + If the request was successful and you would like to return contextual + data to the remote host, return a tuple. Items in the tuple will be + sent back with the successful result. (Note that the items in the + tuple can only be strings, ints, longs, or bools.) + + The default implementation always returns C{False}, indicating that it + does not support any global requests. + + @param kind: the kind of global request being made. + @type kind: str + @param msg: any extra arguments to the request. + @type msg: L{Message} + @return: C{True} or a tuple of data if the request was granted; + C{False} otherwise. + @rtype: bool + """ + return False ### Channel requests
[project @ Arch-1:<EMAIL><I>-public%secsh--dev--<I>--patch-<I>] oops (continued) er, part 2 of that.
bitprophet_ssh
train
py
9d43a83fa80230b801691438355045b8b81e7c1d
diff --git a/kuyruk/worker.py b/kuyruk/worker.py index <HASH>..<HASH> 100644 --- a/kuyruk/worker.py +++ b/kuyruk/worker.py @@ -106,12 +106,13 @@ class Worker: try: signals.worker_start.send(self.kuyruk, worker=self) self._consume_messages() - signals.worker_shutdown.send(self.kuyruk, worker=self) finally: self.shutdown_pending.set() for t in self._threads: t.join() + signals.worker_shutdown.send(self.kuyruk, worker=self) + logger.debug("End run worker") def _consume_messages(self) -> None:
always send worker_shutdown signal
cenkalti_kuyruk
train
py
e146b01e63afc643bfc66704addef311899bc0f2
diff --git a/grip/browser.py b/grip/browser.py index <HASH>..<HASH> 100644 --- a/grip/browser.py +++ b/grip/browser.py @@ -1,5 +1,6 @@ import socket import webbrowser +import time def is_server_running(host, port): @@ -8,7 +9,8 @@ def is_server_running(host, port): host and port. """ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - return not sock.connect_ex((host, port)) == 0 + rc = sock.connect_ex((host, port)) + return rc == 0 def wait_for_server(host, port): @@ -20,7 +22,7 @@ def wait_for_server(host, port): the Flask server. """ while not is_server_running(host, port): - pass + time.sleep(0.1) def start_browser(url):
Stop browser opening consuming all the sockets
joeyespo_grip
train
py
c4d46bca8a4cf68abcc8357a9d471a5c18cd6f36
diff --git a/mongorest/resource.py b/mongorest/resource.py index <HASH>..<HASH> 100644 --- a/mongorest/resource.py +++ b/mongorest/resource.py @@ -3,19 +3,17 @@ import six from werkzeug.routing import Map, Rule -from werkzeug.wrappers import Response from .collection import Collection -from .utils import deserialize from .wsgi import WSGIWrapper __all__ = [ 'Resource', - 'ListResourceMixin', - 'CreateResourceMixin', - 'RetrieveResourceMixin', - 'UpdateResourceMixin', - 'DeleteResourceMixin', + # 'ListResourceMixin', + # 'CreateResourceMixin', + # 'RetrieveResourceMixin', + # 'UpdateResourceMixin', + # 'DeleteResourceMixin', ]
removing mixins cause they need fixing
lvieirajr_mongorest
train
py
4f2571a4086f85405aa896c4adaa060d9330e0ec
diff --git a/lib/devise/rails/routes.rb b/lib/devise/rails/routes.rb index <HASH>..<HASH> 100644 --- a/lib/devise/rails/routes.rb +++ b/lib/devise/rails/routes.rb @@ -94,10 +94,24 @@ module ActionDispatch::Routing # # devise_for :users, path: 'accounts' # - # * singular: setup the singular name for the given resource. This is used as the instance variable - # name in controller, as the name in routes and the scope given to warden. + # * singular: setup the singular name for the given resource. This is used as the helper methods + # names in controller ("authenticate_#{singular}!", "#{singular}_signed_in?", "current_#{singular}" + # and "#{singular}_session"), as the scope name in routes and as the scope given to warden. # - # devise_for :users, singular: :user + # devise_for :admins, singular: :manager + # + # devise_scope :manager do + # ... + # end + # + # class ManagerController < ApplicationController + # before_filter authenticate_manager! + # + # def show + # @manager = current_manager + # ... + # end + # end # # * path_names: configure different path names to overwrite defaults :sign_in, :sign_out, :sign_up, # :password, :confirmation, :unlock.
[ci skip] Write how to use `singular` option of `ActionDispatch::Routing::Mapper#devise_for` * Replace "the instance variable name in controller" with "the helper methods names in controller". Devise dose not define instance variable for controllers but define helper methods for controllers. * Replace "the name in routes" with "the scope name in routes". `singular` is used as an argument of `devise_scope`. * Add sample codes of routing and controller.
plataformatec_devise
train
rb
3c0a3dddcc1b336fd30048e6a138436874ebda76
diff --git a/lib/main.js b/lib/main.js index <HASH>..<HASH> 100644 --- a/lib/main.js +++ b/lib/main.js @@ -222,7 +222,7 @@ function sendAction(cmd, type, msg, options) { }) .buffer("dataPacketType", 1) .tap(function (vars) { - var responseType = parseUtil.int8(vars.dataPacketType); + var responseType = parseUtil.int8(vars.dataPacketType) & 0x0F; if (responseType !== 10) { errorString = "Invalid response (expecting SEXP)";
Mask response type with 0x0F. See #<I>.
albertosantini_node-rio
train
js
78084a9ea25c3c1b6736ceceb1d2d6ca507d705a
diff --git a/tests/MockTest.php b/tests/MockTest.php index <HASH>..<HASH> 100644 --- a/tests/MockTest.php +++ b/tests/MockTest.php @@ -63,4 +63,17 @@ class MockTest extends PHPUnit_Framework_TestCase { $this->assertEquals($result, 'hello["world"]'); $server->close(); } + public function testMissingMethod2() { + $service = new Service(); + $service->addMissingMethod(function (string $name, array $args, Context $context): string { + return $name . json_encode($args) . $context->remoteAddress['address']; + }); + $server = new MockServer('testMissingMethod2'); + $service->bind($server); + $client = new Client(['mock://testMissingMethod2']); + $proxy = $client->useService(); + $result = $proxy->hello('world'); + $this->assertEquals($result, 'hello["world"]testMissingMethod2'); + $server->close(); + } } \ No newline at end of file
Added testMissingMethod2
hprose_hprose-php
train
php
3c54f2079206178652080dc9c5ed4e58b7854072
diff --git a/gwpy/data/array.py b/gwpy/data/array.py index <HASH>..<HASH> 100644 --- a/gwpy/data/array.py +++ b/gwpy/data/array.py @@ -165,6 +165,17 @@ class Array(Quantity): prefixstr, arrstr, indent, metadata) # ------------------------------------------- + # Pickle helpers + + def dumps(self, order='C'): + return super(Quantity, self).dumps() + dumps.__doc__ = numpy.ndarray.dumps.__doc__ + + def tostring(self, order='C'): + return super(Quantity, self).tostring() + tostring.__doc__ = numpy.ndarray.tostring.__doc__ + + # ------------------------------------------- # array methods def median(self, axis=None, out=None, overwrite_input=False):
Array: override dumps and tostring to enable pickling
gwpy_gwpy
train
py
6bb47e9a449a0058ffd9c8bd1605116ec1ff5472
diff --git a/examples/create_invite_link.py b/examples/create_invite_link.py index <HASH>..<HASH> 100644 --- a/examples/create_invite_link.py +++ b/examples/create_invite_link.py @@ -1,7 +1,7 @@ -import telebot, threading +import telebot from time import sleep, time -from telebot import InlineKeyboardMarkup as ikm #Only for creating Inline Buttons, not necessary for creating Invite Links -from telebot import InlineKeyboardButton as ikb #Only for creating Inline Buttons, not necessary for creating Invite Links +from telebot.types import InlineKeyboardMarkup as ikm #Only for creating Inline Buttons, not necessary for creating Invite Links +from telebot.types import InlineKeyboardButton as ikb #Only for creating Inline Buttons, not necessary for creating Invite Links Token = "api_token" #Your Bot Access Token Group_ID = -1234567890 #Group ID for which invite link is to be created
Update create_invite_link.py Added .types while importing inline markup keyboards (fix) Removed threading import since message is not to be deleted
eternnoir_pyTelegramBotAPI
train
py
8e44c6674fe749932fe40e23e78aa4e1d4fea268
diff --git a/lib/stripe_mock/api/client.rb b/lib/stripe_mock/api/client.rb index <HASH>..<HASH> 100644 --- a/lib/stripe_mock/api/client.rb +++ b/lib/stripe_mock/api/client.rb @@ -3,8 +3,10 @@ module StripeMock def self.client; @client; end def self.start_client(port=4999) + return @client unless @client.nil? + alias_stripe_method :request, StripeMock.method(:redirect_to_mock_server) - @client = Client.new(port) + @client = StripeMock::Client.new(port) @state = 'remote' @client end diff --git a/spec/server_spec.rb b/spec/server_spec.rb index <HASH>..<HASH> 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -73,6 +73,12 @@ describe 'StripeMock Server' do end + it "doesn't create multiple clients" do + result = StripeMock.start_client + expect(result.__id__).to eq(@client.__id__) + end + + it "raises an error when client is stopped" do expect(@client).to be_a StripeMock::Client expect(@client.state).to eq('ready')
Don't create new clients when calling start_client multiple times
rebelidealist_stripe-ruby-mock
train
rb,rb
deed02d83da7968f312aaede30a94350a0f8a8be
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -292,12 +292,3 @@ test.skip('skip test with `.skip()`', function (t) { t.end(); }); }); - -test.skip('throwing in a test should emit the error', function (t) { - ava(function (a) { - throw new Error('unicorn'); - }).run(function (err) { - t.is(err.message, 'unicornn'); - t.end(); - }); -});
we shouldn't catch thrown user errors this also aligns with `tape` behaviour
andywer_ava-ts
train
js
dfac8a5a72fe34208fa37a163b9e0cbe7d004516
diff --git a/azurerm/internal/services/dns/dns_zone_data_source.go b/azurerm/internal/services/dns/dns_zone_data_source.go index <HASH>..<HASH> 100644 --- a/azurerm/internal/services/dns/dns_zone_data_source.go +++ b/azurerm/internal/services/dns/dns_zone_data_source.go @@ -90,7 +90,11 @@ func dataSourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error { resp = *zone } + if resp.ID == nil || *resp.ID == "" { + return fmt.Errorf("failed reading ID for DNS Zone %q (Resource Group %q)", name, resourceGroup) + } d.SetId(*resp.ID) + d.Set("name", name) d.Set("resource_group_name", resourceGroup)
added nil and empty check for id
terraform-providers_terraform-provider-azurerm
train
go
6c841ca01bfd01c5027a025bafbec0b1aeceef99
diff --git a/lib/event_sourcery/event_store/event_builder.rb b/lib/event_sourcery/event_store/event_builder.rb index <HASH>..<HASH> 100644 --- a/lib/event_sourcery/event_store/event_builder.rb +++ b/lib/event_sourcery/event_store/event_builder.rb @@ -1,13 +1,12 @@ module EventSourcery module EventStore class EventBuilder - def initialize(event_type_serializer:) @event_type_serializer = event_type_serializer end def build(event_data) - @event_type_serializer.deserialize(event_data[:type]).new(event_data) + @event_type_serializer.deserialize(event_data.fetch(:type)).new(event_data) end end end
Type is a requirement so use fetch
envato_event_sourcery
train
rb
384b46ed1a8cd38e2b1099196d998686cbccf83d
diff --git a/lib/unitwise/scale.rb b/lib/unitwise/scale.rb index <HASH>..<HASH> 100644 --- a/lib/unitwise/scale.rb +++ b/lib/unitwise/scale.rb @@ -94,6 +94,10 @@ module Unitwise end memoize :simplified_value + def expression + unit.expression + end + # Convert to a simple string representing the scale. # @api public def to_s diff --git a/test/unitwise/measurement_test.rb b/test/unitwise/measurement_test.rb index <HASH>..<HASH> 100644 --- a/test/unitwise/measurement_test.rb +++ b/test/unitwise/measurement_test.rb @@ -13,7 +13,7 @@ describe Unitwise::Measurement do describe "#convert_to" do it "must convert to a similar unit code" do - mph.convert_to('km/h').value.must_almost_equal 96.56063 + mph.convert_to('km/h').value.must_almost_equal(96.56063) end it "must raise an error if the units aren't similar" do lambda { mph.convert_to('N') }.must_raise Unitwise::ConversionError @@ -33,6 +33,9 @@ describe Unitwise::Measurement do it "must convert derived units to special units" do r.convert_to("Cel").value.must_almost_equal(0) end + it "must convert to a unit of another measurement" do + mph.convert_to(kmh).value.must_almost_equal(96.56064) + end end describe "#*" do
May now convert measurements to units of other measurements.
joshwlewis_unitwise
train
rb,rb
bcaa59a6ac3492fa71f13015e80a94e435dc1099
diff --git a/lib/helper/WebDriverIO.js b/lib/helper/WebDriverIO.js index <HASH>..<HASH> 100644 --- a/lib/helper/WebDriverIO.js +++ b/lib/helper/WebDriverIO.js @@ -170,7 +170,7 @@ class WebDriverIO extends Helper { // set defaults this.options = { - waitforTimeout: 1000, // ms + waitForTimeout: 1000, // ms desiredCapabilities: {}, restart: true }; @@ -180,7 +180,7 @@ class WebDriverIO extends Helper { this.options.baseUrl = this.options.url || this.options.baseUrl; this.options.desiredCapabilities.browserName = this.options.browser || this.options.desiredCapabilities.browserName; - this.options.waitforTimeout /= 1000; // convert to seconds + this.options.waitForTimeout /= 1000; // convert to seconds if (!this.options.url || !this.options.browser) {
Fix typo in webdriverio config timeout (#<I>)
Codeception_CodeceptJS
train
js
a53f843a9c0f9e3029b990c7cb39c3429efa42dd
diff --git a/closure/goog/labs/useragent/util.js b/closure/goog/labs/useragent/util.js index <HASH>..<HASH> 100644 --- a/closure/goog/labs/useragent/util.js +++ b/closure/goog/labs/useragent/util.js @@ -12,12 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -/** - * @fileoverview Utilities used by goog.labs.userAgent tools. These functions - * should not be used outside of goog.labs.userAgent.*. - * - * @author nnaze@google.com (Nathan Naze) - */ goog.provide('goog.labs.userAgent.util');
RELNOTES: n/a ------------- Created by MOE: <URL>
google_closure-library
train
js
2ae1c02b5d34ee72b0feb21d45265783843cc389
diff --git a/src/test/java/strman/StrmanTest.java b/src/test/java/strman/StrmanTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/strman/StrmanTest.java +++ b/src/test/java/strman/StrmanTest.java @@ -942,4 +942,10 @@ public class StrmanTest { public void isEnclosedBetween_shouldThrowIllegalArgumentExceptionWhenEncloserIsNull() throws Exception { assertThat(isEnclosedBetween("shekhar", null), is(false)); } + + @Test + public void words_shouldConvertTextToWords() throws Exception { + final String line = "This is a string, with words!"; + assertThat(words(line), is(new String[]{"This", "is", "a", "string", "with", "words"})); + } } \ No newline at end of file
Resolved #<I>
shekhargulati_strman-java
train
java
41bb429a2c3daf973104bb8334926bd51916750b
diff --git a/bug_test.go b/bug_test.go index <HASH>..<HASH> 100644 --- a/bug_test.go +++ b/bug_test.go @@ -574,15 +574,8 @@ func Test_issue80(t *testing.T) { 14018689590001, 140186895900001, 1401868959000001, - 1401868959000001.5, - 14018689590000001, - 140186895900000001, - 1401868959000000001, - 14018689590000000001, - 140186895900000000001, - 140186895900000000001.5 ]); - `, "[1401868959,14018689591,140186895901,1401868959001,14018689590001,140186895900001,1401868959000001,1.4018689590000015e+15,14018689590000001,140186895900000001,1401868959000000001,1.401868959e+19,1.401868959e+20,1.401868959e+20]") + `, "[1401868959,14018689591,140186895901,1401868959001,14018689590001,140186895900001,1401868959000001]") }) }
Fix Test_issue<I> on Go <I> An upstream change (<URL>) makes the Go encoder to be more compliant with the ES6 standard. Ironically, this change causes Test_issue<I> to fail on the larger number ranges. To make this test work on both Go <I> and Go <I>, we delete the larger value tests, which are arguably locking in the wrong behavior.
robertkrimen_otto
train
go
7b77b36ddb8a72ad084cfed6c3f20e8982db4fa1
diff --git a/packages/cli/src/link/ios/getTargets.js b/packages/cli/src/link/ios/getTargets.js index <HASH>..<HASH> 100644 --- a/packages/cli/src/link/ios/getTargets.js +++ b/packages/cli/src/link/ios/getTargets.js @@ -40,4 +40,4 @@ export default function getTargets(project) { false, }; }); -}; +}
fix: make prettier happy (#<I>)
react-native-community_cli
train
js
6b687db6c04c8ad46c3eb818b27c2fcf3b8296aa
diff --git a/lnetatmo.py b/lnetatmo.py index <HASH>..<HASH> 100644 --- a/lnetatmo.py +++ b/lnetatmo.py @@ -320,10 +320,10 @@ class WeatherStationData: self.stations = { d['station_name'] : d for d in self.rawData } self.homes = { d['home_name'] : d["station_name"] for d in self.rawData } # Keeping the old behavior for default station name - if station and station not in self.stations: raise NoDevice("No station with name %s" % station) - self.default_station = station or list(self.stations.keys())[0] if home and home not in self.homes : raise NoHome("No home with name %s" % home) self.default_home = home or list(self.homes.keys())[0] + if station and station not in self.stations: raise NoDevice("No station with name %s" % station) + self.default_station = station or [v["station_name"] for k,v in self.stations.items() if v["home_name"] == self.default_home][0] self.modules = dict() self.default_station_data = self.stationByName(self.default_station) if 'modules' in self.default_station_data:
[Fix] #<I> wrong default station selected for multi-homes setup
philippelt_netatmo-api-python
train
py
f25271ee22e4fd54789f909de1e974f4f466eb70
diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index <HASH>..<HASH> 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -107,6 +107,7 @@ class Compiler $this->addFile($phar, $file, false); } $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/symfony/console/Resources/bin/hiddeninput.exe'), false); + $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/symfony/polyfill-mbstring/Resources/mb_convert_variables.php8'), false); $finder = new Finder(); $finder->files()
Add missing file to v1 phar
composer_composer
train
php
99be4fee4ef646d906e55915b68018e3320dd635
diff --git a/confidence.py b/confidence.py index <HASH>..<HASH> 100644 --- a/confidence.py +++ b/confidence.py @@ -227,7 +227,8 @@ def loadf(*fnames, default=_NoDefault): if default is _NoDefault or path.exists(fname): # (attempt to) open fname if it exists OR if we're expected to raise an error on a missing file with open(fname, 'r') as fp: - return yaml.load(fp.read()) + # default to empty dict, yaml.load will return None for an empty document + return yaml.load(fp.read()) or {} else: return default
Default to empty dict for falsy yaml sources
HolmesNL_confidence
train
py
c815ec18e0d551a1d9ddc961fda642b28db11af8
diff --git a/tests/test-timber-post.php b/tests/test-timber-post.php index <HASH>..<HASH> 100644 --- a/tests/test-timber-post.php +++ b/tests/test-timber-post.php @@ -20,6 +20,17 @@ $this->assertEquals($firstPost->next()->ID, $nextPost->ID); } + function testPrev(){ + $posts = array(); + for($i = 0; $i<2; $i++){ + $posts[] = $this->factory->post->create(); + sleep(1); + } + $lastPost = new TimberPost($posts[1]); + $prevPost = new TimberPost($posts[0]); + $this->assertEquals($lastPost->prev()->ID, $prevPost->ID); + } + function testNextWithDraftAndFallover(){ $posts = array(); for($i = 0; $i<3; $i++){
wrote test for TimberPost::prev
timber_timber
train
php
c4c7ce568c1c4db69bed859700b3ec0eba2548a2
diff --git a/file_system.go b/file_system.go index <HASH>..<HASH> 100644 --- a/file_system.go +++ b/file_system.go @@ -218,9 +218,12 @@ type FileSystem interface { // // * (http://goo.gl/IQkWZa) sys_fsync calls do_fsync, calls vfs_fsync, calls // vfs_fsync_range. + // // * (http://goo.gl/5L2SMy) vfs_fsync_range calls f_op->fsync. // - // Note that this is also called by fdatasync(2) (cf. http://goo.gl/01R7rF). + // Note that this is also called by fdatasync(2) (cf. http://goo.gl/01R7rF), + // and may be called for msync(2) with the MS_SYNC flag (see the notes on + // FlushFile). // // See also: FlushFile, which may perform a similar purpose when closing a // file (but which is not used in "real" file systems).
Added a callout to msync for SyncFile.
jacobsa_fuse
train
go
36b3128847392a60b170b8103de097189b2cc981
diff --git a/resources/lang/ja-JP/cachet.php b/resources/lang/ja-JP/cachet.php index <HASH>..<HASH> 100644 --- a/resources/lang/ja-JP/cachet.php +++ b/resources/lang/ja-JP/cachet.php @@ -53,9 +53,9 @@ return [ // Service Status 'service' => [ - 'good' => '[0,1]正常に稼動しています|[2,Inf]全システムが正常に稼動しています', - 'bad' => '[0,1]問題が発生しています|[2,Inf]一部システムにて問題が発生しています', - 'major' => '[0, 1]システムで大きな問題が発生 |[2、*]いくつかのシステムの主要な問題が発生しています。', + 'good' => '全システムが正常に稼動しています', + 'bad' => '[0,1]問題が発生しています|[2,*]一部システムに問題が発生しています', + 'major' => '[0,1]システムに大きな問題が発生|[2,*]いくつかのシステムに大きな問題が発生しています。', ], 'api' => [
New translations cachet.php (Japanese)
CachetHQ_Cachet
train
php
6e8c715ee3a2d192867ae2fc1351648a6cb085c3
diff --git a/test/youtube-dl/video_test.rb b/test/youtube-dl/video_test.rb index <HASH>..<HASH> 100644 --- a/test/youtube-dl/video_test.rb +++ b/test/youtube-dl/video_test.rb @@ -7,22 +7,22 @@ describe YoutubeDL::Video do end it 'should download videos without options' do - YoutubeDL.download TEST_URL + YoutubeDL::Video.download TEST_URL assert_equal 1, Dir.glob(TEST_GLOB).length end it 'should download videos with options' do - YoutubeDL.download TEST_URL, output: TEST_FILENAME, format: TEST_FORMAT + YoutubeDL::Video.download TEST_URL, output: TEST_FILENAME, format: TEST_FORMAT assert File.exist? TEST_FILENAME end it 'should download multiple videos without options' do - YoutubeDL.download [TEST_URL, TEST_URL2] + YoutubeDL::Video.download [TEST_URL, TEST_URL2] assert_equal 2, Dir.glob(TEST_GLOB).length end it 'should download multiple videos with options' do - YoutubeDL.download [TEST_URL, TEST_URL2], output: 'test_%(title)s-%(id)s.%(ext)s' + YoutubeDL::Video.download [TEST_URL, TEST_URL2], output: 'test_%(title)s-%(id)s.%(ext)s' assert_equal 2, Dir.glob('test_' + TEST_GLOB).length end end @@ -33,7 +33,7 @@ describe YoutubeDL::Video do end it 'should download videos, exactly like .download' do - YoutubeDL.get TEST_URL + YoutubeDL::Video.get TEST_URL assert_equal Dir.glob(TEST_GLOB).length, 1 end end
Changed Video test to actually test Video and not just the YoutubeDL module.
layer8x_youtube-dl.rb
train
rb