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
96abf9f59ebd350cc9a70034b4d30279e6ae04e4
diff --git a/integration-cli/docker_cli_exec_unix_test.go b/integration-cli/docker_cli_exec_unix_test.go index <HASH>..<HASH> 100644 --- a/integration-cli/docker_cli_exec_unix_test.go +++ b/integration-cli/docker_cli_exec_unix_test.go @@ -33,7 +33,9 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) { select { case err := <-ch: c.Assert(err, checker.IsNil) - output := b.String() + bs := b.Bytes() + bs = bytes.Trim(bs, "\x00") + output := string(bs[:]) c.Assert(strings.TrimSpace(output), checker.Equals, "hello") case <-time.After(5 * time.Second): c.Fatal("timed out running docker exec")
Fix flaky test case of `TestExecInteractiveStdinClose` This issue has been reported by issue #<I>. The purpose of this test case is for the regression test of #<I>, so we only need to make sure the essential of the testing is still in the way to check that while not disturbed by some testing noises, which is exactly what this PR want to do.
moby_moby
train
go
9b82ac025bf0bd7af2fbb3867330b70b0a737f4b
diff --git a/addons/after/slack_addon/__init__.py b/addons/after/slack_addon/__init__.py index <HASH>..<HASH> 100644 --- a/addons/after/slack_addon/__init__.py +++ b/addons/after/slack_addon/__init__.py @@ -52,7 +52,7 @@ def exec(report: Report, config_dict: dict, output_summary: OutputSummary): for c in config.conditions: # type: Condition p = SlackPayload.from_dict({ - "text": c.payload.message_format.format(report), + "text": c.payload.message_format.format(report.to_dict()), "channel": c.payload.channel, "username": c.payload.username, "icon_emoji": c.payload.icon_emoji,
:skull: Fix bug that message format on slack_addon is not working
tadashi-aikawa_jumeaux
train
py
4c34a8aef155743ffc13891913ab1e2276fbb8ae
diff --git a/ui/js/models/repository.js b/ui/js/models/repository.js index <HASH>..<HASH> 100644 --- a/ui/js/models/repository.js +++ b/ui/js/models/repository.js @@ -100,7 +100,7 @@ treeherder.factory('ThRepositoryModel', [ _.each(data, addRepoAsUnwatched); var storedWatched = JSON.parse(sessionStorage.getItem("thWatchedRepos")); - if (_.isArray(storedWatched)) { + if (_.isArray(storedWatched) && _.contains(storedWatched, name)) { _.each(storedWatched, function (repo) { watchRepo(repo); });
Bug <I> - speed up repo switching by fixing error
mozilla_treeherder
train
js
fb1223ef8a5b223399fbeaf20e562abe7e828714
diff --git a/generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php b/generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php index <HASH>..<HASH> 100644 --- a/generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php +++ b/generator/classes/propel/engine/builder/om/php5/PHP5ComplexObjectBuilder.php @@ -362,7 +362,7 @@ class PHP5ComplexObjectBuilder extends PHP5BasicObjectBuilder { * @return void * @throws PropelException */ - public function set".$this->getFKPhpNameAffix($fk, $plural = false)."(\$v) + public function set".$this->getFKPhpNameAffix($fk, $plural = false)."($className \$v = null) {"; foreach ($fk->getLocalColumns() as $columnName) { $column = $table->getColumn($columnName);
Added type hint with null option to FK mutator
propelorm_Propel
train
php
b57fb4a8ae7e07646fbc3ee192a94f60e09fcd2a
diff --git a/Tests/Auth/OpenID/Nonce.php b/Tests/Auth/OpenID/Nonce.php index <HASH>..<HASH> 100644 --- a/Tests/Auth/OpenID/Nonce.php +++ b/Tests/Auth/OpenID/Nonce.php @@ -25,6 +25,7 @@ class Tests_Auth_OpenID_Nonce extends PHPUnit_TestSuite { $this->addTestSuite('Tests_Auth_OpenID_NonceTests'); $this->makeSplitTests(); $this->makeCheckTimestampTests(); + $this->setName('Tests_Auth_OpenID_Nonce'); } function makeSplitTests()
[project @ Set the name for the Nonce test suite so test output is easier to understand]
openid_php-openid
train
php
de624d6390b919ba4f6793ffcd067602a084c991
diff --git a/flask_appbuilder/api/__init__.py b/flask_appbuilder/api/__init__.py index <HASH>..<HASH> 100644 --- a/flask_appbuilder/api/__init__.py +++ b/flask_appbuilder/api/__init__.py @@ -375,7 +375,7 @@ class BaseApi(object): self.appbuilder = appbuilder # If endpoint name is not provided, get it from the class name self.endpoint = endpoint or self.__class__.__name__ - self.resource_name = self.resource_name or self.__class__.__name__ + self.resource_name = self.resource_name or self.__class__.__name__.lower() if self.route_base is None: self.route_base = "/api/{}/{}".format(
[api] Fix, default resource name must be lower case (#<I>)
dpgaspar_Flask-AppBuilder
train
py
687341cd7d42074cc6a1ce932fc447c5a514fcd8
diff --git a/stompServer.js b/stompServer.js index <HASH>..<HASH> 100644 --- a/stompServer.js +++ b/stompServer.js @@ -52,6 +52,8 @@ var StompServer = function (config) { client: 0, server: 0 }; + + this.activeWebSocket = null; this.socket = new WebSocketServer({ server: this.conf.server, @@ -67,7 +69,9 @@ var StompServer = function (config) { * @property {string} sessionId */ this.socket.on('connection', function (ws) { + this.activeWebSocket = ws; ws.sessionId = StompUtils.genId(); + this.emit('connecting', ws.sessionId); this.conf.debug('Connect', ws.sessionId);
Saving active WebSocket for future use
4ib3r_StompBrokerJS
train
js
2013edb53b2ec0ec03063d215a919db721df93a1
diff --git a/DetectsLostConnections.php b/DetectsLostConnections.php index <HASH>..<HASH> 100644 --- a/DetectsLostConnections.php +++ b/DetectsLostConnections.php @@ -42,6 +42,7 @@ trait DetectsLostConnections 'Login timeout expired', 'Connection refused', 'running with the --read-only option so it cannot execute this statement', + 'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.', ]); } }
Add 'The connection is broken and recovery is not possible.' thrown by Microsoft ODBC Driver to the list of causedByLostConnection error messages (#<I>)
illuminate_database
train
php
c0ffa2af576498c8c842d7329882db73c07ad16a
diff --git a/centinel/client.py b/centinel/client.py index <HASH>..<HASH> 100644 --- a/centinel/client.py +++ b/centinel/client.py @@ -36,7 +36,7 @@ class Client(): return os.path.join(self.config['dirs']['data_dir'], input_file) def load_input_file(self, name): - input_file = self.get_input_file("%s.txt" %(name)) + input_file = self.get_input_file(name) if not os.path.isfile(input_file): logging.error("Input file not found %s" % (input_file))
removed the extention added for debugging purposes
iclab_centinel
train
py
5b6e46a163b93b49d9847be57da4e1f2290597bf
diff --git a/public/js/ruleset.js b/public/js/ruleset.js index <HASH>..<HASH> 100644 --- a/public/js/ruleset.js +++ b/public/js/ruleset.js @@ -119,7 +119,14 @@ $.getJSON("/api/db-dump", function(db_dump){ location.reload(); } else { $("pre#feedback").html("Registering..."); - var src = "ruleset "+rid+" {\n}"; + var src = "ruleset "+rid+" {\n" + + " meta {\n" + + " shares __testing\n" + + " }\n" + + " global {\n" + + " __testing = { \"queries\": [ { \"name\": \"__testing\" } ] }\n" + + " }\n" + + "}\n"; $.getJSON("/api/ruleset/register",{"src":src},function(result){ location.hash = rid; location.reload();
fully meta __testing for generated ruleset from rid
Picolab_pico-engine
train
js
ac14bdda296f6b0dc57fa3b1e60f02f7ba49ec2b
diff --git a/testrail/api.py b/testrail/api.py index <HASH>..<HASH> 100644 --- a/testrail/api.py +++ b/testrail/api.py @@ -175,17 +175,21 @@ class API(object): @classmethod def flush_cache(cls): - """ Set all cache objects to refresh + """ Set all cache objects to refresh the next time they are accessed """ + def clear_ts(cache): + if 'ts' in cache: + cache['ts'] = None + for val in cache.values(): + if isinstance(val, dict): + clear_ts(val) + + for cache in cls._shared_state.values(): if not isinstance(cache, dict): continue - elif 'ts' in cache: - cache['ts'] = None - - for project in cache.values(): - if isinstance(project, dict) and 'ts' in project: - project['ts'] = None + else: + clear_ts(cache) def set_project_id(self, project_id): self._project_id = project_id
Refactor flush_cache to recursively clear cache (#<I>) - Update flush_cache to recursively clear the cache values found in the API's _shared_state cache - Closes #<I>
travispavek_testrail-python
train
py
65859d66d311d432fbb73ad30f1a37e4acd8e8ce
diff --git a/src/createGenericSelect/index.js b/src/createGenericSelect/index.js index <HASH>..<HASH> 100644 --- a/src/createGenericSelect/index.js +++ b/src/createGenericSelect/index.js @@ -778,8 +778,9 @@ class InnerComp extends Component { const records = (Array.isArray(valOrVals) ? valOrVals : [valOrVals] - ).map(({ value }) => { - return entitiesById[value]; + ).map(val => { + const { value, userCreated } = val; + return userCreated ? val : entitiesById[value]; }); handleSelection(records); }
allowing generic select to work with userCreated creatable=true values
TeselaGen_teselagen-react-components
train
js
8bb1add7af02ada8162767acf80bdcb105dc947c
diff --git a/app/assets/javascripts/extractors.js b/app/assets/javascripts/extractors.js index <HASH>..<HASH> 100644 --- a/app/assets/javascripts/extractors.js +++ b/app/assets/javascripts/extractors.js @@ -36,7 +36,7 @@ $(document).ready(function() { $.ajax({ url: appPrefixed('/a/tools/regex_test'), data: { - "string":$("#xtrc-example").text(), + "string":URI.encode($("#xtrc-example").text()), "regex":$("#regex_value").val() }, success: function(matchResult) {
URI encode the regex test string to avoid wrong test results. If the regex test message contained a "%<I>", the test result was off because of encoding problems. Fixes Graylog2/graylog2-server#<I>
Graylog2_graylog2-server
train
js
d4ee7a420f65c0ef0685130deb34c590dbb5b6f1
diff --git a/packages/components/bolt-tabs/src/TabPanel/index.js b/packages/components/bolt-tabs/src/TabPanel/index.js index <HASH>..<HASH> 100644 --- a/packages/components/bolt-tabs/src/TabPanel/index.js +++ b/packages/components/bolt-tabs/src/TabPanel/index.js @@ -55,8 +55,8 @@ class TabPanel extends withContext(BoltElement) { updated(changedProperties) { super.updated && super.updated(changedProperties); changedProperties.forEach((oldValue, propName) => { - if (propName === 'selectedTab') { - // Keep selected attr in sync with context, triggers re-render + if (propName === 'selectedTab' || propName === 'panels') { + // Triger if either `selectedTab` or `panels` updates to keep selected attr in sync with context, triggers re-render if (!this.selected && this.panelIndex === this.selectedTab - 1) { this.setSelectedTab(); }
DS-<I>: Fix `selected` attr not getting set on initial load
bolt-design-system_bolt
train
js
04fd671b1fededc8e8a7c8a701947d116740629c
diff --git a/source/application/models/oxarticle.php b/source/application/models/oxarticle.php index <HASH>..<HASH> 100644 --- a/source/application/models/oxarticle.php +++ b/source/application/models/oxarticle.php @@ -531,6 +531,17 @@ class oxArticle extends oxI18n implements oxIArticle, oxIUrl } /** + * Checks whether object is in list or not + * It's needed for oxArticle so that it can pass this to widgets + + * @return bool + */ + public function isInList() + { + return $this->_isInList(); + } + + /** * Resets static cache array, or removes a single entry if specified * * @param string $sOxId
Added public method isInList() to return protected value. Required if we want to tell widget that he is in list.
OXID-eSales_oxideshop_ce
train
php
704b3f86c9e22deb2903c87ab1db65cde71d9ffe
diff --git a/lib/wed/wed.js b/lib/wed/wed.js index <HASH>..<HASH> 100644 --- a/lib/wed/wed.js +++ b/lib/wed/wed.js @@ -1365,6 +1365,9 @@ Editor.prototype.toDataNode = function (node) { Editor.prototype._caretChangeEmitter = function (ev) { + if (ev === undefined) + ev = {which: undefined, type: undefined, target: undefined}; + // We need this rigmarole because on Chrome 28 the caret won't be // set to its new position on a "mouseup" or "click" event until // *after* the event handler has run!!! @@ -1375,9 +1378,6 @@ Editor.prototype._caretChangeEmitter = function (ev) { }; Editor.prototype._caretChangeEmitterTimeout = function (ev) { - if (ev === undefined) - ev = {which: undefined, type: undefined, target: undefined}; - if (ev.type === "mouseup") { // Clicking always remove a fake caret element. this._$fake_caret.remove();
Setting ev must be done before calling the timeout function.
mangalam-research_wed
train
js
127850e7106ade846a3a3e528f52414c682a3113
diff --git a/lib/codemirror.js b/lib/codemirror.js index <HASH>..<HASH> 100644 --- a/lib/codemirror.js +++ b/lib/codemirror.js @@ -2555,10 +2555,12 @@ function prepareMeasureForLine(cm, line) { var lineN = lineNo(line); var view = findViewForLine(cm, lineN); - if (view && !view.text) + if (view && !view.text) { view = null; - else if (view && view.changes) + } else if (view && view.changes) { updateLineForChanges(cm, view, lineN, getDimensions(cm)); + cm.curOp.forceUpdate = true; + } if (!view) view = updateExternalMeasurement(cm, line);
Force display update when measuring during operation redrew a line When something is redraw, we definitely need to do the consistency- ensuring that is done by a display update. Issue #<I>
codemirror_CodeMirror
train
js
cc2b8f4a7e67dc2d50f235789788696522b451ae
diff --git a/lib/reveal-ck/builders/copy_reveal_js.rb b/lib/reveal-ck/builders/copy_reveal_js.rb index <HASH>..<HASH> 100644 --- a/lib/reveal-ck/builders/copy_reveal_js.rb +++ b/lib/reveal-ck/builders/copy_reveal_js.rb @@ -16,12 +16,12 @@ module RevealCK @output_dir = retrieve(:output_dir, args) @application = retrieve(:application, args) @things_to_create = Set.new - analyze + setup end private - def analyze + def setup files = RevealJsFiles.new(revealjs_dir: revealjs_dir) files.all.each do |file| analyze_file(file) diff --git a/lib/reveal-ck/builders/copy_user_files.rb b/lib/reveal-ck/builders/copy_user_files.rb index <HASH>..<HASH> 100644 --- a/lib/reveal-ck/builders/copy_user_files.rb +++ b/lib/reveal-ck/builders/copy_user_files.rb @@ -17,12 +17,12 @@ module RevealCK @output_dir = retrieve(:output_dir, args) @application = retrieve(:application, args) @things_to_create = Set.new - analyze + setup end private - def analyze + def setup files = UserFiles.new(user_files_dir: user_files_dir) files.all.each do |file| analyze_file(file) unless File.directory?(file)
[rebuilding-with-rake] Standardized on 'setup'
jedcn_reveal-ck
train
rb,rb
b8df273eac47636feef82758e437f8019995e6db
diff --git a/trimesh/path/exchange/svg_io.py b/trimesh/path/exchange/svg_io.py index <HASH>..<HASH> 100644 --- a/trimesh/path/exchange/svg_io.py +++ b/trimesh/path/exchange/svg_io.py @@ -595,7 +595,11 @@ def _deep_same(original, other): # but otherwise types should be identical if isinstance(original, np.ndarray): assert isinstance(other, (list, np.ndarray)) + elif util.is_string(original): + # handle python 2+3 unicode vs str + assert util.is_string(other) else: + # otherwise they should be the same type assert isinstance(original, type(other)) if isinstance(original, (str, bytes)):
hotfix python2 testing issue
mikedh_trimesh
train
py
0586cb49c610e356a7adf38183cdc90f0c7cfa46
diff --git a/grease-info.user.js b/grease-info.user.js index <HASH>..<HASH> 100644 --- a/grease-info.user.js +++ b/grease-info.user.js @@ -27,15 +27,12 @@ var url, jsraw, info, parsedInfo; var draw = function(){ // console.log(info); - if(!$("#additional-info").length){ - $("#script-content").append( - '<div id="additional-info">\ - <h3>Author\'s Description</h3>\ - <div></div>\ - </div>' - ); - } - + $("#script-content").append( + '<div id="additional-info">\ + <h3>Author\'s Description</h3>\ + <div></div>\ + </div>' + ); $("#additional-info>div").html(parsedInfo); }; @@ -67,7 +64,7 @@ var getJS = function(){ }; var checkJS = function(){ - if(!$(".install-link").length){ + if(!$(".install-link").length || $("#additional-info").length){ return; } url = $(".install-link").prop("href");
change behavior, only init if additional-info doesnt exist
eight04_bbs-reader
train
js
2b0936271c4a259df5809bfeadb8faf9deb9038e
diff --git a/etcd/etcd_test.go b/etcd/etcd_test.go index <HASH>..<HASH> 100644 --- a/etcd/etcd_test.go +++ b/etcd/etcd_test.go @@ -351,6 +351,7 @@ func TestSingleNodeRecovery(t *testing.T) { c.DataDir = dataDir e, h, _ = buildServer(t, c, id) + waitLeader([]*Server{e}) w, err = e.p.Watch(key, false, false, ev.Index()) if err != nil { t.Fatal(err)
server: fix 2nd watch timeout in TestSingleNodeRecovery When recovering from data dir, the node needs election timeout to elect itself to be the leader.
etcd-io_etcd
train
go
c209b31944e5b444e90f4a3fc8469be97ba9d0a1
diff --git a/lib/savon/builder.rb b/lib/savon/builder.rb index <HASH>..<HASH> 100644 --- a/lib/savon/builder.rb +++ b/lib/savon/builder.rb @@ -37,7 +37,11 @@ module Savon def build_document tag(builder, :Envelope, namespaces_with_globals) do |xml| tag(xml, :Header, header_attributes) { xml << header.to_s } unless header.empty? - tag(xml, :Body, body_attributes) { xml.tag!(*namespaced_message_tag) { xml << message.to_s } } + if @globals[:no_message_tag] + tag(xml, :Body, body_attributes) { xml << message.to_s } + else + tag(xml, :Body, body_attributes) { xml.tag!(*namespaced_message_tag) { xml << message.to_s } } + end end end
Support no_message_tag option This option indicates that the user does not want to encapsulate the message in a 'message tag'.
savonrb_savon
train
rb
3a37fe5df9c467f06393bcc6056a6442f7b1330b
diff --git a/salt/cloud/clouds/digital_ocean.py b/salt/cloud/clouds/digital_ocean.py index <HASH>..<HASH> 100644 --- a/salt/cloud/clouds/digital_ocean.py +++ b/salt/cloud/clouds/digital_ocean.py @@ -477,7 +477,6 @@ def create(vm_): log.debug('Found public IP address to use for ssh minion bootstrapping: {0}'.format(vm_['ssh_host'])) vm_['key_filename'] = key_filename - vm_['ssh_host'] = ip_address ret = __utils__['cloud.bootstrap'](vm_, __opts__) ret.update(data)
merge error overwrites correct ssh_host with stale data in ip_address (#<I>)
saltstack_salt
train
py
2465941fdf1f7649d30d98138b03ab60c35c75d2
diff --git a/tests/databases/pgsql/PgSQLTest.php b/tests/databases/pgsql/PgSQLTest.php index <HASH>..<HASH> 100644 --- a/tests/databases/pgsql/PgSQLTest.php +++ b/tests/databases/pgsql/PgSQLTest.php @@ -22,6 +22,13 @@ class PgTest extends DBTest { public function setUp() { + + // If the database isn't installed, skip the tests + if ( ! class_exists("PgSQL")) + { + $this->markTestSkipped(); + } + // Attempt to connect, if there is a test config file if (is_file(QBASE_DIR . "test_config.json")) {
Skip Postgres tests if the class isn't loaded
aviat4ion_Query
train
php
31cc3c3ee82bbac073fb516d3333621156e9871d
diff --git a/core/src/main/java/net/cpollet/jixture/fixtures/Fixture.java b/core/src/main/java/net/cpollet/jixture/fixtures/Fixture.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/net/cpollet/jixture/fixtures/Fixture.java +++ b/core/src/main/java/net/cpollet/jixture/fixtures/Fixture.java @@ -22,7 +22,7 @@ import java.util.List; /** * @author Christophe Pollet */ -public interface Fixture<T> { +public interface Fixture<T> extends TransformableFixture { Fixture addObjects(T... objects); List<T> getObjects();
Reverted Fixture hierarchy (temp)
cpollet_jixture
train
java
538722114d67addafdbe38b8da262e64562dd8bc
diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -1125,9 +1125,11 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa */ protected function updateTimestamps() { + $time = $this->freshTimestamp(); + if ( ! $this->isDirty(static::UPDATED_AT)) { - $this->setUpdatedAt($time = $this->freshTimestamp()); + $this->setUpdatedAt($this->freshTimestamp()); } if ( ! $this->exists and ! $this->isDirty(static::CREATED_AT))
Fix timestamp bug in Eloquent models.
laravel_framework
train
php
3869ca25c9e0e26edde3a157991b9b52d6a44372
diff --git a/guacamole/src/main/webapp/app/client/services/clipboardService.js b/guacamole/src/main/webapp/app/client/services/clipboardService.js index <HASH>..<HASH> 100644 --- a/guacamole/src/main/webapp/app/client/services/clipboardService.js +++ b/guacamole/src/main/webapp/app/client/services/clipboardService.js @@ -119,7 +119,7 @@ angular.module('client').factory('clipboardService', ['$injector', else deferred.reject(); - }, 10); + }, 100); return deferred.promise; }; @@ -133,8 +133,8 @@ angular.module('client').factory('clipboardService', ['$injector', // Fire clipboard event if the data has changed if (data !== lastClipboardEvent) { - $rootScope.$broadcast('guacClipboard', 'text/plain', data); - lastClipboardEvent = data; + $rootScope.$broadcast('guacClipboard', 'text/plain', data); + lastClipboardEvent = data; } });
GUAC-<I>: Increase size of timing window when waiting for clipboard to settle.
glyptodon_guacamole-client
train
js
22988428f5bf9c68d6402bcc812a090f644d032a
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -55,7 +55,7 @@ describe('node-serialize', function () { }); it('should serialize a Document node', function () { - var node = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html'); + var node = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null); assert.equal('<html></html>', serialize(node)); });
test: force doctype to `null`
webmodules_dom-serialize
train
js
b0da1be3d03afd22b9da5031c4fff8691c3819c5
diff --git a/pandas/io/parquet.py b/pandas/io/parquet.py index <HASH>..<HASH> 100644 --- a/pandas/io/parquet.py +++ b/pandas/io/parquet.py @@ -267,6 +267,10 @@ def read_parquet(path, engine="auto", columns=None, **kwargs): URL schemes include http, ftp, s3, and file. For file URLs, a host is expected. A local file could be: ``file://localhost/path/to/table.parquet``. + A file URL can also be a path to a directory that contains multiple + partitioned parquet files. Both pyarrow and fastparquet support + paths to directories as well as file URLs. A directory path could be: + ``file://localhost/path/to/tables`` If you want to pass in a path object, pandas accepts any ``os.PathLike``.
<I> clarify that read parquet accepts a directory path (#<I>)
pandas-dev_pandas
train
py
39c739161dbba575f2642d7046beaeb84ea7913c
diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb index <HASH>..<HASH> 100644 --- a/actioncable/lib/action_cable/connection/subscriptions.rb +++ b/actioncable/lib/action_cable/connection/subscriptions.rb @@ -19,7 +19,7 @@ module ActionCable logger.error "Received unrecognized command in #{data.inspect}" end rescue Exception => e - logger.error "Could not execute command from #{data.inspect}) [#{e.class} - #{e.message}]: #{e.backtrace.first(5).join(" | ")}" + logger.error "Could not execute command from (#{data.inspect}) [#{e.class} - #{e.message}]: #{e.backtrace.first(5).join(" | ")}" end def add(data)
Fix missing bracket. Fix missing left bracket in exception message.
rails_rails
train
rb
2c6c453d3a27b15ead4f45f56a64003469cdaa97
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js b/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js +++ b/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js @@ -549,7 +549,7 @@ define([ // this test is reverse engineered as a way to figure out when a file entry is a directory. // The File API in HTML5 doesn't specify a way to check explicitly (when this code was written). // see http://www.w3.org/TR/FileAPI/#file - if (!file.length && (!file.type || file.type === "")) { + if (!file.size && !file.type) { if(explorer.registry) { explorer.registry.getService("orion.page.message").setProgressResult( //$NON-NLS-0$ {Severity: "Error", Message: i18nUtil.formatMessage(messages["Did not drop ${0}. Folder drop is not supported in this browser."], file.name)}); //$NON-NLS-1$ //$NON-NLS-0$
Bug <I> - Drop file broken on IE when the file "type" is not known
eclipse_orion.client
train
js
b547beb79f483201155e12642c4dd093a7ba2a68
diff --git a/presto-main/src/main/java/com/facebook/presto/type/RealOperators.java b/presto-main/src/main/java/com/facebook/presto/type/RealOperators.java index <HASH>..<HASH> 100644 --- a/presto-main/src/main/java/com/facebook/presto/type/RealOperators.java +++ b/presto-main/src/main/java/com/facebook/presto/type/RealOperators.java @@ -165,7 +165,7 @@ public final class RealOperators @SqlType(StandardTypes.BIGINT) public static long hashCode(@SqlType(StandardTypes.REAL) long value) { - return AbstractIntType.hash((int) value); + return AbstractIntType.hash(floatToIntBits(intBitsToFloat((int) value))); } @ScalarOperator(XX_HASH_64)
Fix hash_code operator for real type Make the hash_code operator consistent with the hash method defined in real type.
prestodb_presto
train
java
c148f62c2f109d653667ee63e080d41e67b40067
diff --git a/code/ShoppingCart.php b/code/ShoppingCart.php index <HASH>..<HASH> 100644 --- a/code/ShoppingCart.php +++ b/code/ShoppingCart.php @@ -60,6 +60,18 @@ class ShoppingCart{ } /** + * Set the current cart + */ + function setCurrent(Order $cart){ + if(!$cart->IsCart()){ + trigger_error("Passed Order object is not cart status", E_ERROR); + } + $this->order = $cart; + Session::set(self::$cartid_session_name, $cart->ID); + return $this; + } + + /** * Helper that only allows orders to be started internally. */ protected function findOrMake(){
API: Added setCurrent to ShoppingCart. This paves the way for setting pre-created carts for customers etc.
silvershop_silvershop-core
train
php
152c9ec278b7b1f9125d8e6e44b24d87e42e9b55
diff --git a/helpers/class.PhpTools.php b/helpers/class.PhpTools.php index <HASH>..<HASH> 100755 --- a/helpers/class.PhpTools.php +++ b/helpers/class.PhpTools.php @@ -53,9 +53,10 @@ class helpers_PhpTools { if ($tokens[$j] === '{') { if (!isset($tokens[$i+2][1])) { error_log($file.' does not contain a valid class definition'); - break; + break(2); } else { $class = $tokens[$i+2][1]; + break(2); } } }
Break after finding first class for php <I> compatibility
oat-sa_generis
train
php
1ba28d1354848fd422603efa343b145bae5c5fdf
diff --git a/lib/acts_as_tenant/configuration.rb b/lib/acts_as_tenant/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/acts_as_tenant/configuration.rb +++ b/lib/acts_as_tenant/configuration.rb @@ -16,11 +16,15 @@ module ActsAsTenant end class Configuration - attr_writer :require_tenant + attr_writer :require_tenant, :pkey def require_tenant @require_tenant ||= false end + + def pkey + @pkey ||= :id + end end end diff --git a/lib/acts_as_tenant/model_extensions.rb b/lib/acts_as_tenant/model_extensions.rb index <HASH>..<HASH> 100644 --- a/lib/acts_as_tenant/model_extensions.rb +++ b/lib/acts_as_tenant/model_extensions.rb @@ -23,7 +23,7 @@ module ActsAsTenant end def self.pkey - :id + ActsAsTenant.configuration.pkey end def self.polymorphic_type
Added pkey as configuration option (#<I>) * added pkey to configs * made model_extensions to read pkey from configurations
ErwinM_acts_as_tenant
train
rb,rb
5f077cd9c78a82958de0e806f36d36c30aa13eea
diff --git a/test/closed-channel.js b/test/closed-channel.js index <HASH>..<HASH> 100644 --- a/test/closed-channel.js +++ b/test/closed-channel.js @@ -40,15 +40,11 @@ test('write a buffer from 0 -> 1', function(t) { }); test('close the underlying data channel and attempt to write', function(t) { - t.plan(3); + t.plan(2); dcs[0].close(); streams[1].once('end', t.pass.bind(t, 'stream ended')); - streams[0].once('error', function(err) { - t.ok(err instanceof Error, 'got valid error'); - }); - t.doesNotThrow(function() { streams[0].write(new Buffer('hello')); }); -}); \ No newline at end of file +});
Channel no longer errors when the channel is closed, so do not test for it
rtc-io_rtc-dcstream
train
js
d484e648064813f489b5ab943e05210761f4bdac
diff --git a/src/helpers.js b/src/helpers.js index <HASH>..<HASH> 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -9,11 +9,6 @@ import {Monkey, MonkeyDefinition} from './monkey'; import type from './type'; -/** - * Noop function - */ -const noop = Function.prototype; - const hasOwnProp = {}.hasOwnProperty; /** @@ -312,7 +307,7 @@ function freezer(deep, o) { l; for (i = 0, l = o.length; i < l; i++) - freezer(true, o[i]); + deepFreeze(o[i]); } else { let p, @@ -330,20 +325,13 @@ function freezer(deep, o) { Object.isFrozen(p)) continue; - freezer(true, p); + deepFreeze(p); } } } -/** - * Exporting both `freeze` and `deepFreeze` functions. - * Note that if the engine does not support `Object.freeze` then this will - * export noop functions instead. - */ -const isFreezeSupported = (typeof Object.freeze === 'function'); - -const freeze = isFreezeSupported ? freezer.bind(null, false) : noop, - deepFreeze = isFreezeSupported ? freezer.bind(null, true) : noop; +const freeze = freezer.bind(null, false), + deepFreeze = freezer.bind(null, true); export {freeze, deepFreeze};
Removed check on Object.freeze function All major browsers support Object.freeze out of the box.
Yomguithereal_baobab
train
js
12fcc7c1bc81c08a32ecae70922dcdd2c6dbceb3
diff --git a/tests/test_Apex.py b/tests/test_Apex.py index <HASH>..<HASH> 100644 --- a/tests/test_Apex.py +++ b/tests/test_Apex.py @@ -311,7 +311,7 @@ def test_convert_qd2apex(): def test_convert_qd2apex_at_equator(): - """Test the quasi-dipole to apex conversion at the magnetic equator """ + """Test the quasi-dipole to apex conversion at the magnetic equator""" apex_out = Apex(date=2000, refh=80) elat, elon = apex_out.convert(lat=0.0, lon=0, source='qd', dest='apex', height=120.0)
Update test_Apex.py removing trailing whitespace to satisfy codacy
aburrell_apexpy
train
py
66b528dc0f3aa81c726bf928c01377ba9b048df0
diff --git a/src/Components/Condition.php b/src/Components/Condition.php index <HASH>..<HASH> 100644 --- a/src/Components/Condition.php +++ b/src/Components/Condition.php @@ -43,6 +43,7 @@ class Condition extends Component 'EXISTS' => 1, 'IF' => 1, 'IN' => 1, + 'INTERVAL' => 1, 'IS' => 1, 'LIKE' => 1, 'MATCH' => 1,
Condition: Allow keyword INTERVAL.
phpmyadmin_sql-parser
train
php
15af6c4e87e14648b409e4c693fdb82cf31c4493
diff --git a/test/rackspace/storage/authentication-test.js b/test/rackspace/storage/authentication-test.js index <HASH>..<HASH> 100644 --- a/test/rackspace/storage/authentication-test.js +++ b/test/rackspace/storage/authentication-test.js @@ -12,6 +12,10 @@ var vows = require('vows'), var testData = {}, client = helpers.createClient('rackspace', 'storage'); +if (process.env.NOCK) { + return; +} + vows.describe('pkgcloud/rackspace/storage/authentication').addBatch({ "The pkgcloud Rackspace storage client": { "should have core methods defined": macros.shouldHaveCreds(client),
[fix] More unmocked Rackspace tests
pkgcloud_pkgcloud
train
js
5937184db70a624e899de7009ccc8aa53d8ea338
diff --git a/plugin/pkg/scheduler/core/generic_scheduler.go b/plugin/pkg/scheduler/core/generic_scheduler.go index <HASH>..<HASH> 100644 --- a/plugin/pkg/scheduler/core/generic_scheduler.go +++ b/plugin/pkg/scheduler/core/generic_scheduler.go @@ -127,6 +127,12 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister } trace.Step("Prioritizing") + + // When only one node after predicate, just use it. + if len(filteredNodes) == 1 { + return filteredNodes[0].Name, nil + } + metaPrioritiesInterface := g.priorityMetaProducer(pod, g.cachedNodeInfoMap) priorityList, err := PrioritizeNodes(pod, g.cachedNodeInfoMap, metaPrioritiesInterface, g.prioritizers, filteredNodes, g.extenders) if err != nil {
When only one node after predicate, just return it
kubernetes_kubernetes
train
go
01ade0ff38f83dad404c7970d272b0b1800e2507
diff --git a/logging/src/main/java/org/jboss/as/logging/validators/LogLevelValidator.java b/logging/src/main/java/org/jboss/as/logging/validators/LogLevelValidator.java index <HASH>..<HASH> 100644 --- a/logging/src/main/java/org/jboss/as/logging/validators/LogLevelValidator.java +++ b/logging/src/main/java/org/jboss/as/logging/validators/LogLevelValidator.java @@ -57,6 +57,7 @@ public final class LogLevelValidator extends ModelTypeValidator implements Allow org.jboss.logmanager.Level.FINEST, org.jboss.logmanager.Level.INFO, org.jboss.logmanager.Level.OFF, + org.jboss.logmanager.Level.SEVERE, org.jboss.logmanager.Level.TRACE, org.jboss.logmanager.Level.WARN, org.jboss.logmanager.Level.WARNING
[WFLY-<I>] Add SEVERE logging level to the valid list of levels.
wildfly_wildfly
train
java
ff22944dd6ccc43426f6b53695e6605f22e61a57
diff --git a/pyxel/cli.py b/pyxel/cli.py index <HASH>..<HASH> 100644 --- a/pyxel/cli.py +++ b/pyxel/cli.py @@ -5,6 +5,7 @@ import shutil import sys import tempfile import zipfile +import multiprocessing import pyxel import pyxel.editor @@ -67,7 +68,10 @@ def _play_pyxel_app(pyxel_app_file): os.path.dirname(setting_file), f.read() ) sys.path.append(os.path.dirname(startup_script_file)) - runpy.run_path(startup_script_file) + p = multiprocessing.Process(target=runpy.run_path, + args=(startup_script_file,)) + p.start() + p.join() return print(f"file not found: '{pyxel.APP_STARTUP_SCRIPT_FILE}'")
Fix PermissionError to delete tempdirectory (#<I>)
kitao_pyxel
train
py
1e3b4cd30c9f7b9b758ccd9110dc15d867184e53
diff --git a/src/Provider/TranslationServiceProvider.php b/src/Provider/TranslationServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Provider/TranslationServiceProvider.php +++ b/src/Provider/TranslationServiceProvider.php @@ -40,8 +40,8 @@ class TranslationServiceProvider implements ServiceProviderInterface * Adds all resources that belong to a locale * * @param Application $app - * @param string $locale - * @param string $territory + * @param string $locale + * @param string $territory */ private function addResources(Application $app, $locale) {
PSR2 pass on Bolt\Provider
bolt_bolt
train
php
fc0a872bd8be607615adbff3ed16af5a6c6194ee
diff --git a/pingu/corpus/grabber/signal.py b/pingu/corpus/grabber/signal.py index <HASH>..<HASH> 100644 --- a/pingu/corpus/grabber/signal.py +++ b/pingu/corpus/grabber/signal.py @@ -93,7 +93,9 @@ class FramedSignalGrabber(object): label_lists = self.corpus.label_lists[self.label_list_idx] - for utterance in self.corpus.utterances.values(): + for utterance_idx in sorted(self.corpus.utterances.keys()): + utterance = self.corpus.utterances[utterance_idx] + if utterance.idx in label_lists.keys(): # Get matrix with audio data of the file that contains the utterance
iterate through sorted utterances in grabber
ynop_audiomate
train
py
1c780619b242a5460c2c3060d9788fa5320a5c3c
diff --git a/tests/test_backend/test_alpaca.py b/tests/test_backend/test_alpaca.py index <HASH>..<HASH> 100644 --- a/tests/test_backend/test_alpaca.py +++ b/tests/test_backend/test_alpaca.py @@ -297,7 +297,7 @@ def historic_agg_data(size, *args, **kwargs): 'h': 'high', 'l': 'low', 'v': 'volume', - 't': 'timestamp'}, + 'd': 'day'}, 'ticks': [{'o': 220.25, 'c': 222.98, 'h': 223.49,
Fix Polygon test data (again)
alpacahq_pylivetrader
train
py
956296a74c701fee79d8eed898ce64da02c983de
diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/util/rdoc/generators/puppet_generator.rb +++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb @@ -88,6 +88,12 @@ module Generators @modules = {} @allclasses = {} + # remove unknown toplevels + # it can happen that RDoc triggers a different parser for some files (ie .c, .cc or .h) + # in this case RDoc generates a RDoc::TopLevel which we do not support in this generator + # So let's make sure we don't generate html for those. + @toplevels = @toplevels.select { |tl| tl.is_a? RDoc::PuppetTopLevel } + # build the modules, classes and per modules classes and define list @toplevels.each do |toplevel| next unless toplevel.document_self
Fix #<I> - Do not generate doc for standard RDoc parser generated object RDoc has some standard parsers for .c,.cc or fortran files (don't ask why). Unfortunately our html generator doesn't support the data structures generated by those parsers and we were bombing on unknown methods. This patch makes sure we generate html only for our own top level objects.
puppetlabs_puppet
train
rb
c245b1f45e1ca02f7fda74be33db1113c55166c5
diff --git a/paypal/countries.py b/paypal/countries.py index <HASH>..<HASH> 100644 --- a/paypal/countries.py +++ b/paypal/countries.py @@ -5,7 +5,7 @@ http://xml.coverpages.org/country3166.html A tuple of tuples of country codes and their full names. There are a few helper functions provided if you'd rather not use the dict directly. Examples provided -in the t_countries.py unit tests. +in the test_countries.py unit tests. """ COUNTRY_TUPLES = ( @@ -287,4 +287,4 @@ def get_name_from_abbrev(abbrev, case_sensitive=False): if country_code == code: return full_name - raise KeyError('No country with that country code.') \ No newline at end of file + raise KeyError('No country with that country code.')
typo in docstring: t_countries.py => test_countries.py
gtaylor_paypal-python
train
py
e4df4dd774f5a1271688e12a2a11d0d6776a43ff
diff --git a/skiplist/iterator.go b/skiplist/iterator.go index <HASH>..<HASH> 100644 --- a/skiplist/iterator.go +++ b/skiplist/iterator.go @@ -24,14 +24,12 @@ func (it *Iterator) SeekFirst() { it.valid = true } -func (it *Iterator) Seek(itm Item) { +func (it *Iterator) Seek(itm Item) bool { it.valid = true found := it.s.findPath(itm, it.cmp, it.buf) it.prev = it.buf.preds[0] it.curr = it.buf.succs[0] - if !found { - it.valid = false - } + return found } func (it *Iterator) Valid() bool {
skiplist: Add isFound return value for iterator.Seek()
t3rm1n4l_nitro
train
go
2c4a7fed227c3f81cfc45381bde0f9ff36b12ae5
diff --git a/contextMenu.js b/contextMenu.js index <HASH>..<HASH> 100644 --- a/contextMenu.js +++ b/contextMenu.js @@ -510,7 +510,7 @@ } function removeAllContextMenus(e) { - $document.find('body').off('mousedown', removeOnOutsideClickEvent); + $document.find('body').off('mousedown touchstart', removeOnOutsideClickEvent); $document.off('scroll', removeOnScrollEvent); $(_clickedElement).removeClass('context'); removeContextMenus(); @@ -579,7 +579,7 @@ } // Remove if the user clicks outside - $document.find('body').on('mousedown', removeOnOutsideClickEvent); + $document.find('body').on('mousedown touchstart', removeOnOutsideClickEvent); // Remove the menu when the scroll moves $document.on('scroll', removeOnScrollEvent);
Add ability to close menu on touch devices
Templarian_ui.bootstrap.contextMenu
train
js
56d1e7912c6c16985b7f23ff3a56591ab8349c6a
diff --git a/jira/version.py b/jira/version.py index <HASH>..<HASH> 100644 --- a/jira/version.py +++ b/jira/version.py @@ -2,4 +2,4 @@ # 1) we don't load dependencies by storing it in __init__.py # 2) we can import it in setup.py for the same reason # 3) we can import it into the jira module -__version__ = '0.8' +__version__ = '0.9'
- bump to version <I> for summit release
pycontribs_jira
train
py
c0983c5fb60c43626aeb80f8e310cb7915b7e6dc
diff --git a/js/src/services/ApiService.js b/js/src/services/ApiService.js index <HASH>..<HASH> 100644 --- a/js/src/services/ApiService.js +++ b/js/src/services/ApiService.js @@ -179,7 +179,7 @@ class ApiService { 'padding':'4px', 'width': '100%', 'height': '100%', - 'position': 'absolute', + 'position': 'fixed', 'top': 0, 'bottom': 0, 'z-index': '100000',
minor fix Fix positioning when window is scroll down prior to display error window.
atk4_ui
train
js
e9bc973a8ad6269dc86e1175e3d519e6e0f17405
diff --git a/basil/TL/Visa.py b/basil/TL/Visa.py index <HASH>..<HASH> 100644 --- a/basil/TL/Visa.py +++ b/basil/TL/Visa.py @@ -14,9 +14,8 @@ class Visa(TransferLayer): '''Transfer layer for a Virtual Instrument Software Architecture (VISA) provided by pyVisa. Several interfaces are available (GPIB, RS232, USB, Ethernet). To be able to use pyVisa without - the proprietary NI-VISA driver a pyVisa backend pyVisa-py is used. - GPIB under linux is not supported via pyVisa-py right now and linux-gpib does not - compile on modern kernels right now. Thus no GPIB linux support on modern systems. + the proprietary NI-VISA driver a pyVisa backend pyVisa-py can be used. + GPIB under linux is not supported via pyVisa-py right now. ''' def __init__(self, conf): @@ -28,7 +27,7 @@ class Visa(TransferLayer): Initialize the device. Parameters of visa.ResourceManager().open_resource() ''' - backend = self._init.pop('backend', '') + backend = self._init.pop('backend', 'National Instruments') rm = visa.ResourceManager(backend) try: logging.info('BASIL VISA TL with %s backend found the following devices: %s', backend, rm.list_resources())
MAINT: show National instruments as std. backend MAINT: simplify description
SiLab-Bonn_basil
train
py
a821f0e2d39c623fd7cc6d2a091b031860736736
diff --git a/src/main/java/org/redisson/pubsub/PublishSubscribe.java b/src/main/java/org/redisson/pubsub/PublishSubscribe.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/redisson/pubsub/PublishSubscribe.java +++ b/src/main/java/org/redisson/pubsub/PublishSubscribe.java @@ -39,13 +39,7 @@ abstract class PublishSubscribe<E extends PubSubEntry<E>> { // just an assertion boolean removed = entries.remove(entryName) == entry; if (removed) { - PubSubConnectionEntry e = connectionManager.getPubSubEntry(channelName); - e.lock(); - try { - connectionManager.unsubscribe(channelName); - } finally { - e.unlock(); - } + connectionManager.unsubscribe(channelName); } } }
unnecessary lock removed. #<I>
redisson_redisson
train
java
2b615d556490098381156e4eef262699c1590367
diff --git a/lib/rapidash/client.rb b/lib/rapidash/client.rb index <HASH>..<HASH> 100644 --- a/lib/rapidash/client.rb +++ b/lib/rapidash/client.rb @@ -51,7 +51,7 @@ module Rapidash # # Returns String of set format def encode_request_with(format) - format.to_sym! + format = format.to_s.to_sym unless [:url_encoded, :multipart, :json].include?(format) raise ArgumentError, 'you must pass one of :url_encoded, :multipart or :json to encode_request_with' diff --git a/spec/rapidash/client_spec.rb b/spec/rapidash/client_spec.rb index <HASH>..<HASH> 100644 --- a/spec/rapidash/client_spec.rb +++ b/spec/rapidash/client_spec.rb @@ -94,6 +94,20 @@ describe Rapidash::Client do end end + describe ".encode_request_with" do + let(:klass) { test_client.class } + + it "should set encoder for valid argument" do + klass.encode_request_with(:json) + expect(klass.encoder).to eq :json + end + + it "should raise exception for invalid argument" do + expect { + klass.encode_request_with(:wibble) + }.to raise_exception(ArgumentError) + end + end describe ".get" do it "should call request" do
Specs for encode_request_with
Gazler_rapidash
train
rb,rb
ce80f432b1c2fb3476c291bad79d4f758346eb21
diff --git a/test/integration/setup.js b/test/integration/setup.js index <HASH>..<HASH> 100644 --- a/test/integration/setup.js +++ b/test/integration/setup.js @@ -1,3 +1,4 @@ +var _ = require('lodash') var async = require('async') var mongoose = require('mongoose') var Schema = mongoose.Schema @@ -74,7 +75,16 @@ module.exports = function () { points: Number }) - function initialize (callback) { + function initialize (opts, callback) { + if (_.isFunction(opts)) { + callback = opts + opts = {} + } + + _.defaults(opts, { + connect: true + }) + if (!mongoose.models.Customer) { mongoose.model('Customer', CustomerSchema) } @@ -95,7 +105,11 @@ module.exports = function () { mongoose.model('Account', AccountSchema) } - mongoose.connect('mongodb://localhost/database', callback) + if (opts.connect) { + mongoose.connect('mongodb://localhost/database', callback) + } else if (_.isFunction(callback)) { + callback() + } } function reset (callback) {
chore(test): option to init with connecting
florianholzapfel_express-restify-mongoose
train
js
b82a41dfbe0a7d9d1bd5e83ec7cd06bb36ef4cda
diff --git a/src/test/java/stormpot/PoolTest.java b/src/test/java/stormpot/PoolTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/stormpot/PoolTest.java +++ b/src/test/java/stormpot/PoolTest.java @@ -1360,6 +1360,28 @@ public class PoolTest { // must complete before the test timeout: shutdown(pool).await(); } + + /** + * Calling shutdown on a pool while being interrupted must still start the + * shut-down procedure. + * We test for this by initiating the shut-down procedure on a pool while + * being interrupted. Then we clear our interrupted flag and await the + * completion of the shut-down procedure. The procedure must complete within + * the test timeout. If it does not, then that is taken as evidence that + * the procedure did NOT start, and so the test fails. + * @param fixture + * @throws InterruptedException + */ + @Test(timeout = 300) + @Theory public void + mustBeAbleToShutDownEvenIfInterrupted(PoolFixture fixture) + throws InterruptedException { + Pool pool = fixture.initPool(config); + Thread.currentThread().interrupt(); + Completion completion = shutdown(pool); + Thread.interrupted(); // clear interrupted flag + completion.await(); // must complete before test timeout + } // TODO test for resilience against spurious wake-ups? // NOTE: When adding, removing or modifying tests, also remember to update
it must be possible to initiate the shut down procedure while being interrupted.
chrisvest_stormpot
train
java
c65a338ed37eb36aae739f1fe36b9ccdd764ddb3
diff --git a/java/server/src/org/openqa/grid/web/servlet/HubStatusServlet.java b/java/server/src/org/openqa/grid/web/servlet/HubStatusServlet.java index <HASH>..<HASH> 100644 --- a/java/server/src/org/openqa/grid/web/servlet/HubStatusServlet.java +++ b/java/server/src/org/openqa/grid/web/servlet/HubStatusServlet.java @@ -134,24 +134,16 @@ public class HubStatusServlet extends RegistryBasedServlet { } private JsonObject getSlotCounts() { - int freeSlots = 0; int totalSlots = 0; + int usedSlots = 0; for (RemoteProxy proxy : getRegistry().getAllProxies()) { - for (TestSlot slot : proxy.getTestSlots()) { - if (slot.getSession() == null) { - freeSlots += 1; - } - - totalSlots += 1; - } + totalSlots += Math.min(proxy.getMaxNumberOfConcurrentTestSessions(), proxy.getTestSlots().size()); + usedSlots += proxy.getTotalUsed(); } - JsonObject result = new JsonObject(); - - result.addProperty("free", freeSlots); + result.addProperty("free", totalSlots - usedSlots); result.addProperty("total", totalSlots); - return result; }
Updating getSlotCounts to use sessions allowed (#<I>) * Updating getSlotCounts to use sessions allowed Switching getSlotCounts to use the concurrent sessions when counting the total slots. Old method would count all browser options so the free/total counts could be much higher than was actually available. * fixup! Updating getSlotCounts to use small between maxSessions and slots * fixup! Updating getSlotCounts to use sessions allowed
SeleniumHQ_selenium
train
java
d87ee157c0bcf91efb02a48c1aa896d97e1484c3
diff --git a/lib/jsdom/level3/xpath.js b/lib/jsdom/level3/xpath.js index <HASH>..<HASH> 100644 --- a/lib/jsdom/level3/xpath.js +++ b/lib/jsdom/level3/xpath.js @@ -1127,14 +1127,14 @@ function comparisonHelper(test, x, y, isNumericComparison) { } } return false; - } else if ('object' === typeof x) { + } else if ('object' === typeof x && x.nodes && x.nodes.length) { for (var i = 0; i < x.nodes.length; ++i) { var xi = coersion({nodes:[x.nodes[i]]}), yc = coersion(y); if (test(xi, yc)) return true; } return false; - } else if ('object' === typeof y) { + } else if ('object' === typeof y && x.nodes && x.nodes.length) { for (var i = 0; i < x.nodes.length; ++i) { var yi = coersion({nodes:[y.nodes[i]]}), xc = coersion(x); if (test(xc, yi))
fixed a test by adding some error checking
jsdom_jsdom
train
js
b8103427e57e206b2e83d453dbeda8a23801a9fe
diff --git a/tests/BotTest.php b/tests/BotTest.php index <HASH>..<HASH> 100644 --- a/tests/BotTest.php +++ b/tests/BotTest.php @@ -56,6 +56,18 @@ class BotTest extends PHPUnit_Framework_TestCase $bot->logout(); } + /** @test */ + public function isLoggedIn() + { + $request = Mockery::mock(Request::class)->shouldReceive('isLoggedIn')->andReturn(true)->getMock(); + + $providersContainer = new ProvidersContainer($request, new Response()); + + $bot = new Bot($providersContainer); + + $this->assertTrue($bot->isLoggedIn()); + } + /** * @param string $providerName * @param MockInterface $providerMock
upd: tests for Bot class (full coverage)
seregazhuk_php-pinterest-bot
train
php
61d4a11761e8f38056e810e45bfe57a18d368668
diff --git a/lib/components/narrative/default/default-itinerary.js b/lib/components/narrative/default/default-itinerary.js index <HASH>..<HASH> 100644 --- a/lib/components/narrative/default/default-itinerary.js +++ b/lib/components/narrative/default/default-itinerary.js @@ -222,7 +222,7 @@ class DefaultItinerary extends NarrativeItinerary { // Picking 0 ensures that if multiple flex legs with // different phone numbers, the first leg is prioritized phone = itinerary.legs - .map((leg) => leg.pickupBookingInfo.contactInfo.phoneNumber) + .map((leg) => leg.pickupBookingInfo?.contactInfo?.phoneNumber) .filter((number) => !!number)[0] } return (
refactor(default-itinerary): don't crash on missing bookingInfo
opentripplanner_otp-react-redux
train
js
ab9d8567fba13519592d1578ab1546033abdee70
diff --git a/tests/models/_teacher_forcing_logits.py b/tests/models/_teacher_forcing_logits.py index <HASH>..<HASH> 100644 --- a/tests/models/_teacher_forcing_logits.py +++ b/tests/models/_teacher_forcing_logits.py @@ -2,6 +2,8 @@ ''' def test_method_get_teacher_forced_logits_for_encoder_decoder_model(): + """ Tests if get_teacher_forced_logits() works for encoder-decoder models. + """ import torch import numpy as np from transformers import AutoTokenizer, AutoModelForSeq2SeqLM @@ -32,6 +34,8 @@ def test_method_get_teacher_forced_logits_for_encoder_decoder_model(): assert not np.isnan(np.sum(logits)) def test_method_get_teacher_forced_logits_for_decoder_model(): + """ Tests if get_teacher_forced_logits() works for decoder only models. + """ import torch import numpy as np from transformers import AutoTokenizer, AutoModelForCausalLM
Added comments to test file _teacher_forsing_logits.py
slundberg_shap
train
py
b6410b9fc829449b5fb5d46b1da0381e81e933a0
diff --git a/lib/kpeg.rb b/lib/kpeg.rb index <HASH>..<HASH> 100644 --- a/lib/kpeg.rb +++ b/lib/kpeg.rb @@ -47,13 +47,20 @@ module KPeg def initialize(node, arg) @node = node if arg.kind_of? String + @matches = nil @string = arg else @matches = arg + @string = nil end end - attr_reader :node, :string, :matches + attr_reader :node, :string + + def matches + return @matches if @matches + return [] + end end class LiteralString
Handle #matches for a string match better
evanphx_kpeg
train
rb
4c24a120c37bb568e5ffc85bf6504c699ae2335c
diff --git a/lib/ronin/ui/console.rb b/lib/ronin/ui/console.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/ui/console.rb +++ b/lib/ronin/ui/console.rb @@ -24,7 +24,6 @@ require 'ronin/config' require 'irb' -require 'irb/completion' module Ronin module UI @@ -38,6 +37,9 @@ module Ronin # Default backtrace depth. BACKTRACE_LIMIT = 5 + # Default completion mode. + COMPLETION = true + # # Returns the default Console prompt style, defaults to +PROMPT+. # @@ -84,6 +86,25 @@ module Ronin end # + # Returns the default Console tab-completion mode, defaults to + # +COMPLETION+. + # + def Console.completion + @@ronin_console_completion ||= COMPLETION + end + + # + # Sets the default Console tab-completion mode to the specified + # _mode_. + # + # Console.completion = false + # # => false + # + def Console.completion=(mode) + @@ronin_console_completion = mode + end + + # # Returns the Array of files to require when the Console starts. # def Console.auto_load @@ -117,6 +138,8 @@ module Ronin require 'ronin/environment' require 'ronin/platform' + require 'irb/completion' if Ronin::UI::Console.completion + Ronin::UI::Console.auto_load.each do |path| require path end
Have 'irb/completion' loaded within the IRB context, if Console.completion is set.
ronin-ruby_ronin
train
rb
12407705afa29dabd8c2959a5dab088d38145d7f
diff --git a/lib/moodlelib.php b/lib/moodlelib.php index <HASH>..<HASH> 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1064,6 +1064,10 @@ function get_directory_list($rootdir, $excludefile="", $descend=true) { $dirs = array(); + if (!is_dir($rootdir)) { + return $dirs; + } + if (!$dir = opendir($rootdir)) { return $dirs; }
Check for existence of directory as well to avoid PHP warnings
moodle_moodle
train
php
79096608b46dfb6f448249ffa8e8b8ad3ca995f0
diff --git a/spec/lib/client_spec.rb b/spec/lib/client_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/client_spec.rb +++ b/spec/lib/client_spec.rb @@ -182,6 +182,13 @@ describe Wikipedia::Client, '.find page (Edsger_Dijkstra)' do expect(@page.image_thumburls(100)).to include('https://upload.wikimedia.org/wikipedia' + image) end end + + it 'should collect the main image thumburl' do + @client.follow_redirects = true + @page = @client.find('Edsger Dijkstra') + image = '/commons/thumb/d/d9/Edsger_Wybe_Dijkstra.jpg/150px-Edsger_Wybe_Dijkstra.jpg' + expect(@page.main_image_thumburl).to include('https://upload.wikimedia.org/wikipedia' + image) + end end describe Wikipedia::Client, '.find page (Rails) at jp' do
Add unit test for main_image_thumburl
kenpratt_wikipedia-client
train
rb
10a422dbdca77af9b3574342feaf28ecb500a050
diff --git a/ActiveRecord.php b/ActiveRecord.php index <HASH>..<HASH> 100644 --- a/ActiveRecord.php +++ b/ActiveRecord.php @@ -70,6 +70,7 @@ class ActiveRecord extends BaseActiveRecord /** * @inheritdoc + * @return ActiveQuery the newly created [[ActiveQuery]] instance. */ public static function find() {
improved IDE autocompletion for AR::find() [ci skip]
yiisoft_yii2-elasticsearch
train
php
20ff5078554d31aaac1383217e593dcce553dbce
diff --git a/spec/javascripts/editor.spec.js b/spec/javascripts/editor.spec.js index <HASH>..<HASH> 100644 --- a/spec/javascripts/editor.spec.js +++ b/spec/javascripts/editor.spec.js @@ -3,6 +3,7 @@ describe("a SirTrevor.Editor instance", function(){ var editor, editor_with_options, element = $("<textarea>"); beforeEach(function (){ + SirTrevor.instances = []; editor = new SirTrevor.Editor(); @@ -21,7 +22,7 @@ describe("a SirTrevor.Editor instance", function(){ afterEach(function (){ delete editor; - editor_with_options = null; + delete editor_with_options; }); it("should fail if no element is passed", function() { @@ -118,4 +119,4 @@ describe("a SirTrevor.Editor instance", function(){ expect(instance.blockTypes.Image).toBe(true); }) }); -}); \ No newline at end of file +});
Resets Sir Trevor instances on each run.
madebymany_sir-trevor-js
train
js
95f0f00c778ea503b94dd07c2eec91f2b5b5bb43
diff --git a/lib/axios.js b/lib/axios.js index <HASH>..<HASH> 100644 --- a/lib/axios.js +++ b/lib/axios.js @@ -6,6 +6,13 @@ var dispatchRequest = require('./core/dispatchRequest'); var InterceptorManager = require('./core/InterceptorManager'); var axios = module.exports = function (config) { + // Allow for axios('example/url') + if (typeof config === 'string') { + config = { + url: config + }; + } + config = utils.merge({ method: 'get', headers: {}, diff --git a/test/specs/requests.spec.js b/test/specs/requests.spec.js index <HASH>..<HASH> 100644 --- a/test/specs/requests.spec.js +++ b/test/specs/requests.spec.js @@ -9,6 +9,19 @@ describe('requests', function () { jasmine.Ajax.uninstall(); }); + it('should treat single string arg as url', function (done) { + var request; + + axios('/foo'); + + setTimeout(function () { + request = jasmine.Ajax.requests.mostRecent(); + + expect(request.url).toBe('/foo'); + done(); + }, 0); + }); + it('should make an http request', function (done) { var request;
Fixing axios to treat single string argument as URL closes #<I>
axios_axios
train
js,js
e0cdee7d2bceaa099dfdf7491255c9d22bac8b15
diff --git a/telemetry/telemetry/core/memory_cache_http_server.py b/telemetry/telemetry/core/memory_cache_http_server.py index <HASH>..<HASH> 100644 --- a/telemetry/telemetry/core/memory_cache_http_server.py +++ b/telemetry/telemetry/core/memory_cache_http_server.py @@ -21,7 +21,7 @@ class MemoryCacheHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): """Serve a GET request.""" resource_range = self.SendHead() - if not resource_range.resource: + if not resource_range or not resource_range.resource: return response = resource_range.resource['response'] @@ -163,9 +163,11 @@ class MemoryCacheHTTPServer(SocketServer.ThreadingMixIn, 'response': response, 'zipped': zipped } - if file_path.endswith('/index.html'): + + index = os.path.sep + 'index.html' + if file_path.endswith(index): self.resource_map[ - file_path[:-len('/index.html')]] = self.resource_map[file_path] + file_path[:-len(index)]] = self.resource_map[file_path] def Main():
[Telemetry] Fix 2 bugs in memory_cache_http_server. (1) SendHead may return None. So we need to check for a None resource_range in addition to a None resource_range.response. This was causing stacks in the server, but as far as I can tell, didn't actually affect anything. (2) Make index.html work on windows. We must check for the right path sep. BUG=None TEST=morejs page cycler on windows NOTRY=True Review URL: <URL>
catapult-project_catapult
train
py
908fa28af51ef8f57cb9de8d5d55fd4747439c10
diff --git a/src/Orchestra/Story/StoryServiceProvider.php b/src/Orchestra/Story/StoryServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Orchestra/Story/StoryServiceProvider.php +++ b/src/Orchestra/Story/StoryServiceProvider.php @@ -22,7 +22,7 @@ class StoryServiceProvider extends ServiceProvider */ protected function registerStoryTeller() { - $this->app['orchestra.story'] = $this->app->share(function ($app) { + $this->app->bindShared('orchestra.story', function ($app) { return new Storyteller($app); }); } @@ -34,7 +34,7 @@ class StoryServiceProvider extends ServiceProvider */ protected function registerFormatManager() { - $this->app['orchestra.story.format'] = $this->app->share(function ($app) { + $this->app->bindShared('orchestra.story.format', function ($app) { return new FormatManager($app); }); }
Update to use bindShared.
orchestral_story
train
php
d21c79a9efc332217497b221e587333e7086ae9c
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js +++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js @@ -423,8 +423,11 @@ define([ } else { // context menu was triggered on sidebar itself, // clear previous selections - this.selection.setSelections(null); - navHandler.refreshSelection(true, true); + var triggerX = event.offsetX === undefined ? event.layerX : event.offsetX; + if (triggerX > 0) { // X coordinate should be greater than 0 if mouse right button was used + this.selection.setSelections(null); + navHandler.refreshSelection(true, true); + } } } }.bind(this);
Bug <I> - Do not modify navigator selection if context menu was triggered via keyboard button --
eclipse_orion.client
train
js
71a9d1d64fb8d3e4dacae1d9e1957f209098c061
diff --git a/hacking/checks/imports.py b/hacking/checks/imports.py index <HASH>..<HASH> 100644 --- a/hacking/checks/imports.py +++ b/hacking/checks/imports.py @@ -11,6 +11,7 @@ # under the License. import imp +import inspect import os import re import sys @@ -100,7 +101,20 @@ def hacking_import_rules(logical_line, physical_line, filename, noqa): else: # NOTE(imelnikov): we imported the thing; if it was module, # it must be there: - return mod in sys.modules + if mod in sys.modules: + return True + else: + # NOTE(dhellmann): If the thing isn't there under + # its own name, look to see if it is a module + # redirection import in one of the oslo libraries + # where we are moving things out of the namespace + # package. + pack_name, _sep, mod_name = mod.rpartition('.') + if pack_name in sys.modules: + the_mod = getattr(sys.modules[pack_name], mod_name, + None) + return inspect.ismodule(the_mod) + return False return True def is_module(mod):
Allow import redirections When we move modules out of namespace packages we set up redirects to import the new module under the old name. Python's import machinery doesn't detect those things as modules, and the names don't show up in sys.modules. However, if we look at what we actually got when we did the import we can see that it is a module. Change-Id: I4b<I>d<I>b6d<I>b<I>cbe<I>b<I>cfed<I>d8a
openstack_hacking
train
py
e9baa5f954c5189014304f47c4dc47ac44b835e0
diff --git a/photutils/psf/epsf.py b/photutils/psf/epsf.py index <HASH>..<HASH> 100644 --- a/photutils/psf/epsf.py +++ b/photutils/psf/epsf.py @@ -1,7 +1,8 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides tools to build and fit an effective PSF (ePSF) -based on Anderson and King (2000; PASP 112, 1360). +based on Anderson and King (2000; PASP 112, 1360) and Anderson (2016), +ISR WFC3 2016-12. """ import copy @@ -233,7 +234,9 @@ class EPSFBuilder: Class to build an effective PSF (ePSF). See `Anderson and King (2000; PASP 112, 1360) - <http://adsabs.harvard.edu/abs/2000PASP..112.1360A>`_ for details. + <http://adsabs.harvard.edu/abs/2000PASP..112.1360A>`_ and + `Anderson (2016), ISR WFC3 2016-12 + <www.stsci.edu/hst/wfc3/documents/ISRs/WFC3-2016-12.pdf>`_ for details. Parameters ----------
Added updated reference to ePSF builder, to cite where additional changes since AK<I> came from
astropy_photutils
train
py
77883e995fe8ef1a4dbd9f94af27677089b9a722
diff --git a/src/main/resources/META-INF/resources/primefaces/core/core.ajax.js b/src/main/resources/META-INF/resources/primefaces/core/core.ajax.js index <HASH>..<HASH> 100644 --- a/src/main/resources/META-INF/resources/primefaces/core/core.ajax.js +++ b/src/main/resources/META-INF/resources/primefaces/core/core.ajax.js @@ -538,6 +538,12 @@ if (!PrimeFaces.ajax) { var jqXhr = $.ajax(xhrOptions) .fail(function(xhr, status, errorThrown) { + var location = xhr.getResponseHeader("Location"); + if (xhr.status == 401 && location) { + PrimeFaces.debug('Unauthorized status received. Redirecting to ' + location); + window.location = location; + return; + } if(cfg.onerror) { cfg.onerror.call(this, xhr, status, errorThrown); }
unauthorized ajax request redirect
primefaces_primefaces
train
js
c6438519d530bc7c06c4da3f52863b0e68621600
diff --git a/grunt/tasks/connectIf.js b/grunt/tasks/connectIf.js index <HASH>..<HASH> 100644 --- a/grunt/tasks/connectIf.js +++ b/grunt/tasks/connectIf.js @@ -14,7 +14,7 @@ module.exports = function (grunt) { } http.get("http://localhost:" + configuration.serve.httpPort + "/package.json", function (res) { - run(200 !== res.statusCode); + run(res.statusCode !== 200); }).on("error", function () { run(true); });
!yoda style (#<I>)
ArnaudBuchholz_gpf-js
train
js
ae601c5be22d54bfbd14a230b58a0c1c2ec2b6d8
diff --git a/contao/html/js/vanillaGeneral.js b/contao/html/js/vanillaGeneral.js index <HASH>..<HASH> 100644 --- a/contao/html/js/vanillaGeneral.js +++ b/contao/html/js/vanillaGeneral.js @@ -144,7 +144,11 @@ function GeneralTableDnD() // Check if we have a prev element or the top. if (prevElement == null) { - insertAfter = 0; + var topId = id.split('::'); + if(topId !== null) + { + insertAfter = topId[0] + '::0'; + } } else {
Fix drag/drop sorting to top position (once again...).
contao-community-alliance_dc-general
train
js
af43606de85162e1e834b8c972a50111753947fe
diff --git a/java/src/com/google/template/soy/data/SoyProtoValue.java b/java/src/com/google/template/soy/data/SoyProtoValue.java index <HASH>..<HASH> 100644 --- a/java/src/com/google/template/soy/data/SoyProtoValue.java +++ b/java/src/com/google/template/soy/data/SoyProtoValue.java @@ -331,7 +331,8 @@ public final class SoyProtoValue extends SoyAbstractValue implements SoyLegacyOb String.format( "Accessing a proto of type %s as a %s is deprecated. Add static types to fix." + "\n\t%s", - fullName, type, locationKey)); + fullName, type, locationKey), + new Exception("bad proto access @" + locationKey)); } return Flags.allowReflectiveProtoAccess(); }
Make sure to log stack traces in tofu warning messages to increase visibility. Otherwise people won't notice these errors and since they generally cause issues in the tofu migration we should increase visibility. GITHUB_BREAKING_CHANGES=none ------------- Created by MOE: <URL>
google_closure-templates
train
java
6baf639181c393e3ff15f65b9d33f3fc1d9b1692
diff --git a/pycanvas/course.py b/pycanvas/course.py index <HASH>..<HASH> 100644 --- a/pycanvas/course.py +++ b/pycanvas/course.py @@ -5,7 +5,7 @@ from paginated_list import PaginatedList class Course(CanvasObject): - def __str__(self): + def __str__(self): # pragma: no cover return "%s %s %s" % (self.id, self.course_code, self.name) def conclude(self): diff --git a/pycanvas/quiz.py b/pycanvas/quiz.py index <HASH>..<HASH> 100644 --- a/pycanvas/quiz.py +++ b/pycanvas/quiz.py @@ -4,7 +4,7 @@ from util import combine_kwargs class Quiz(CanvasObject): - def __str__(self): + def __str__(self): # pragma: no cover return "id %s, title: %s" % ( self.id, self.title
added # pragma: no cover to __str__ methods
ucfopen_canvasapi
train
py,py
d23621dda9c8d7d864102883054dacfa6fb927c5
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,3 +17,6 @@ end def test_latency ENV["TEST_LATENCY"].to_f end + +# Crash loud in tests! +Thread.abort_on_exception = true \ No newline at end of file
Don't silent exceptions inside threads
guard_listen
train
rb
25cb3b45e62fe6b7ddcd7a67154ca77d91c631e8
diff --git a/flask_unchained/bundles/graphene/object_types.py b/flask_unchained/bundles/graphene/object_types.py index <HASH>..<HASH> 100644 --- a/flask_unchained/bundles/graphene/object_types.py +++ b/flask_unchained/bundles/graphene/object_types.py @@ -6,6 +6,7 @@ from graphene.utils.subclass_with_meta import ( from graphene_sqlalchemy import SQLAlchemyObjectType as _SQLAObjectType from graphene_sqlalchemy.types import ( SQLAlchemyObjectTypeOptions as _SQLAObjectTypeOptions) +from sqlalchemy.orm import class_mapper class SQLAlchemyObjectTypeOptions(_SQLAObjectTypeOptions): @@ -97,6 +98,10 @@ class SQLAlchemyObjectType(_SQLAObjectType): if unchained._models_initialized: model = unchained.sqlalchemy_bundle.models[model.__name__] + # graphene has a horrible habbit of eating exceptions and this is one + # place where it does, so we preempt it (if this fails it should throw) + class_mapper(model) + return super().__init_subclass_with_meta__( model=model, registry=registry, skip_registry=skip_registry, only_fields=only_fields, exclude_fields=exclude_fields,
fix bug where graphene would eat exceptions about miss-configured sqlalchemy models
briancappello_flask-unchained
train
py
dc84e9445c9f8bce7b1aed378154701f5dcbcb6d
diff --git a/lib/quartz_torrent/reactor.rb b/lib/quartz_torrent/reactor.rb index <HASH>..<HASH> 100644 --- a/lib/quartz_torrent/reactor.rb +++ b/lib/quartz_torrent/reactor.rb @@ -345,6 +345,7 @@ module QuartzTorrent @useErrorhandler = true @readRateLimit = nil @writeRateLimit = nil + raise "IO passed to IOInfo initialize may not be nil" if io.nil? end attr_accessor :io attr_accessor :metainfo @@ -415,7 +416,9 @@ module QuartzTorrent @stopped end - # Create a TCP connection to the specified host + # Create a TCP connection to the specified host. + # Note that this method may raise exceptions. For example 'Too many open files' might be raised if + # the process is using too many file descriptors def connect(addr, port, metainfo, timeout = nil) ioInfo = startConnection(port, addr, metainfo) @ioInfo[ioInfo.io] = ioInfo @@ -650,6 +653,10 @@ module QuartzTorrent end @currentIoInfo = @ioInfo[io] + + # The IOInfo associated with this io could have been closed by the timer handler processed above. + next if @currentIoInfo.nil? + if @currentIoInfo.state == :listening @logger.debug "eventloop: calling handleAccept for IO metainfo=#{@currentIoInfo.metainfo}" if @logger # Replace the currentIoInfo with the accepted socket
Fixed bug with nil IO in reactor.
jeffwilliams_quartz-torrent
train
rb
7e08c95fd8b4d6d0229928cd83b271091bbf2b17
diff --git a/theme/styles.php b/theme/styles.php index <HASH>..<HASH> 100644 --- a/theme/styles.php +++ b/theme/styles.php @@ -83,7 +83,7 @@ require("$CFG->dirroot/lib/setup.php"); $theme = theme_config::load($themename); if ($type === 'editor') { - $files = $theme->editor_css_files(); + $cssfiles = $theme->editor_css_files(); css_store_css($theme, $candidatesheet, $cssfiles); } else { $css = $theme->css_files();
MDL-<I> csslib: third param passed to css_store_css fixed
moodle_moodle
train
php
3c9551eea6484cf03cf96f888d437a788456aa03
diff --git a/stanza/resources/common.py b/stanza/resources/common.py index <HASH>..<HASH> 100644 --- a/stanza/resources/common.py +++ b/stanza/resources/common.py @@ -10,6 +10,7 @@ import os from pathlib import Path import requests import shutil +import tempfile import zipfile from tqdm.auto import tqdm @@ -120,14 +121,18 @@ def request_file(url, path, proxies=None, md5=None, raise_for_status=False, log_ A complete wrapper over download_file() that also make sure the directory of `path` exists, and that a file matching the md5 value does not exist. """ - ensure_dir(Path(path).parent) + basedir = Path(path).parent + ensure_dir(basedir) if file_exists(path, md5): if log_info: logger.info(f'File exists: {path}') else: logger.debug(f'File exists: {path}') return - download_file(url, path, proxies, raise_for_status) + with tempfile.TemporaryDirectory(dir=basedir) as temp: + temppath = os.path.join(temp, os.path.split(path)[-1]) + download_file(url, temppath, proxies, raise_for_status) + os.replace(temppath, path) assert_file_exists(path, md5) def sort_processors(processor_list):
Download files to a tempdir created underneath the expected destination, then use os.replace to move the files (atomically if supported by the file system). The goal is to ensure that two processes downloading the same file don't clobber each other with partially downloaded junk. <URL>
stanfordnlp_stanza
train
py
a32a798bd754fb0d8b9ee9159d4d1e8591e1b5e8
diff --git a/lib/videojs-hlsjs.js b/lib/videojs-hlsjs.js index <HASH>..<HASH> 100644 --- a/lib/videojs-hlsjs.js +++ b/lib/videojs-hlsjs.js @@ -87,11 +87,9 @@ }; Hlsjs.canPlaySource = function(source) { - if (Html5.canPlaySource(source)) { - return false; - } else { - return Hls.isSupported(); - } + return !Html5.canPlaySource(source) + && (source.type && /^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(source.type)) + && Hls.isSupported(); }; Component.registerComponent('Hlsjs', Hlsjs);
Updated Hlsjs.canPlaySource to take source.type into account
SRGSSR_videojs-hlsjs
train
js
03aa1c0127ebdece9e05fb2e9189d87927f97603
diff --git a/lib/yard/code_objects/base.rb b/lib/yard/code_objects/base.rb index <HASH>..<HASH> 100644 --- a/lib/yard/code_objects/base.rb +++ b/lib/yard/code_objects/base.rb @@ -170,7 +170,7 @@ module YARD if name.to_s[0,2] == NSEP name = name.to_s[2..-1] namespace = Registry.root - elsif name =~ /(?:#{NSEPQ}|#{ISEPQ}|#{CSEPQ})([^#{NSEPQ}#{ISEPQ}#{CSEPQ}]+)$/ + elsif name =~ /(?:#{NSEPQ})([^:]+)$/ return new(Proxy.new(namespace, $`), $1, *args, &block) end
No longer support 'Foo.bar' or 'Foo#bar' syntax as name argument to Base.new It was never used in YARD's codebase, and makes initialization very complex.
lsegal_yard
train
rb
573376017215da4ecd33108ddd552558c1a69cee
diff --git a/lib/cucumber-runner.js b/lib/cucumber-runner.js index <HASH>..<HASH> 100644 --- a/lib/cucumber-runner.js +++ b/lib/cucumber-runner.js @@ -2,6 +2,7 @@ var path = require('path') var objectAssign = require('object-assign') var nightwatch = require.main.require('nightwatch') var client +var timeout function World () { objectAssign(this, client.api) @@ -11,6 +12,12 @@ function bootstrap (options) { var cliRunner var clientManager + if (options) timeout = options.timeout; + + if(this.World && timeout) { + this.setDefaultTimeout(timeout); + } + if (this.BeforeFeatures && this.AfterFeatures) { this.BeforeFeatures(function (event, done) { cliRunner = nightwatch.CliRunner(process.argv)
[ISSUE-<I>] fix cucumber after timeout
mucsi96_nightwatch-cucumber
train
js
53d076e0f12717095db5551c497c0ffdf4ba3342
diff --git a/lib/connection.js b/lib/connection.js index <HASH>..<HASH> 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -467,9 +467,10 @@ class Connection extends EventEmitter { // this.compressedSequenceId = 0; // this.sequenceId = 0; if (this.config.debug) { + const commandName = cmd.constructor.name; // eslint-disable-next-line no-console - console.log('Add command: ' + arguments.callee.caller.name); - cmd._commandName = arguments.callee.caller.name; + console.log('Add command: ' + commandName); + cmd._commandName = commandName; } if (!this._command) { this._command = cmd;
fix(debug): remove usage of callee
sidorares_node-mysql2
train
js
7b401bfcbd0b2ab2c878bba115b41a984781d6dc
diff --git a/docs/source/conf.py b/docs/source/conf.py index <HASH>..<HASH> 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -79,7 +79,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the
fixing the sphinx_rtd_theme theme for rtd
jay-johnson_network-pipeline
train
py
5aebd698579649f076276c70ab33e2f34634ad3e
diff --git a/testutil/daemon/ops.go b/testutil/daemon/ops.go index <HASH>..<HASH> 100644 --- a/testutil/daemon/ops.go +++ b/testutil/daemon/ops.go @@ -26,7 +26,6 @@ func WithTestLogger(t testing.TB) func(*Daemon) { // WithExperimental sets the daemon in experimental mode func WithExperimental(d *Daemon) { d.experimental = true - d.init = true } // WithInit sets the daemon init
testutil: fix WithExperimental also setting "init" Looks like this was overlooked in the review of the PR that added this; e<I>b<I>e<I>e<I>c<I>d<I>f<I>e6d There is a separate option for `WithInit`, so this option should not automatically enable it when starting a daemon with experimental enabled.
moby_moby
train
go
b7efce7359d05de644beac7f533067a62217e54e
diff --git a/src/Session/JwtCookieSessionStorage.php b/src/Session/JwtCookieSessionStorage.php index <HASH>..<HASH> 100644 --- a/src/Session/JwtCookieSessionStorage.php +++ b/src/Session/JwtCookieSessionStorage.php @@ -98,7 +98,9 @@ class JwtCookieSessionStorage implements SessionStorageInterface { * {@inheritdoc} */ public function regenerate($destroy = false, $lifetime = null) { - $this->cookieLifetime = $lifetime; + if (null !== $lifetime) { + ini_set('session.cookie_lifetime', $lifetime); + } if ($destroy) { $this->metadataBag->stampNew(); @@ -162,7 +164,7 @@ class JwtCookieSessionStorage implements SessionStorageInterface { */ protected function setCookie($cookieData) { if (!headers_sent()) { - setcookie($this->cookieName, $cookieData, $this->cookieLifetime, "/", $this->cookieDomain); + setcookie($this->cookieName, $cookieData, $this->metadataBag->getLifetime(), '/', $this->cookieDomain); } } @@ -184,7 +186,6 @@ class JwtCookieSessionStorage implements SessionStorageInterface { protected $secret; protected $cookieDomain; protected $values; - protected $cookieLifetime = null; /** * Array of SessionBagInterface.
Setting lifetime to match metadatabag (which is based on ini session.cookie_lifetime).
gmo_common
train
php
ca9679a86e7360fcdbad3016971d93691cab7828
diff --git a/src/Client.php b/src/Client.php index <HASH>..<HASH> 100644 --- a/src/Client.php +++ b/src/Client.php @@ -320,7 +320,12 @@ class Client return $value; } - public function detectAddressByIp(string $ip): Address + /** + * @param string $ip + * @return null|Address + * @throws Exception + */ + public function detectAddressByIp($ip) { $request = new Request('get', $this->baseUrlGeolocation . '?ip=' . $ip, [ 'Accept' => 'application/json', @@ -331,10 +336,18 @@ class Client $result = json_decode($response->getBody(), true); + if (json_last_error() !== JSON_ERROR_NONE) { + throw new RuntimeException('Error parsing response: ' . json_last_error_msg()); + } + if (!array_key_exists('location', $result)) { throw new Exception('Required key "location" is missing'); } + if (null === $result['location']) { + return null; + } + if (!array_key_exists('data', $result['location'])) { throw new Exception('Required key "data" is missing'); }
Fixed accidentally added PHP7 stuff; Fixed null response
gietos_dadata
train
php
160f7111834fef119f311366a64e7acc67d078cf
diff --git a/google-cloud-pubsub/lib/google/cloud/pubsub/subscriber/inventory.rb b/google-cloud-pubsub/lib/google/cloud/pubsub/subscriber/inventory.rb index <HASH>..<HASH> 100644 --- a/google-cloud-pubsub/lib/google/cloud/pubsub/subscriber/inventory.rb +++ b/google-cloud-pubsub/lib/google/cloud/pubsub/subscriber/inventory.rb @@ -40,7 +40,8 @@ module Google end def add *ack_ids - ack_ids.flatten!.compact! + ack_ids.flatten! + ack_ids.compact! return if ack_ids.empty? synchronize do @@ -50,7 +51,8 @@ module Google end def remove *ack_ids - ack_ids.flatten!.compact! + ack_ids.flatten! + ack_ids.compact! return if ack_ids.empty? synchronize do
fix(pubsub): Fix Subscriber Inventory bug Remove chaining mutation methods in Subscriber Inventory because the mutation methods returned nil instead of self when no change was made. [pr #<I>]
googleapis_google-cloud-ruby
train
rb
0184147c56136ec4b2ea11e5f7bb55e2f11d06b1
diff --git a/javascript/selenium-core/scripts/selenium-browserbot.js b/javascript/selenium-core/scripts/selenium-browserbot.js index <HASH>..<HASH> 100644 --- a/javascript/selenium-core/scripts/selenium-browserbot.js +++ b/javascript/selenium-core/scripts/selenium-browserbot.js @@ -2349,10 +2349,10 @@ IEBrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads = function(wind var pageUnloadDetector = function() { self.pageUnloading = true; }; - if (win.addEventListener) { - win.addEventListener('beforeunload', pageUnloadDetector, true); + if (windowObject.addEventListener) { + windowObject.addEventListener('beforeunload', pageUnloadDetector, true); } else { - win.attachEvent('onbeforeunload', pageUnloadDetector); + windowObject.attachEvent('onbeforeunload', pageUnloadDetector); } BrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads.call(this, windowObject); };
Fixing copy-paste bug introduced in the previous commit
SeleniumHQ_selenium
train
js
354e94049e2cf6cc8c7a1ce62b629a8e25ae401a
diff --git a/src/Import_Command.php b/src/Import_Command.php index <HASH>..<HASH> 100644 --- a/src/Import_Command.php +++ b/src/Import_Command.php @@ -58,7 +58,9 @@ class Import_Command extends WP_CLI_Command { $files = glob( rtrim( $arg, '/' ) . '/*.{wxr,xml}', GLOB_BRACE ); $new_args = array_merge( $new_args, $files ); } else { - $new_args[] = $arg; + if ( file_exists( $arg ) ) { + $new_args[] = $arg; + } } } $args = $new_args;
fixes non-existent directories from ending up in list of files to import Discovered that if you type a directory to import incorrectly, is_dir will return false but the incorrect directory will end up in the new_args array of files to import. This adds an additional condition to ensure the file exists.
wp-cli_import-command
train
php
a378b292960b700910937bd69b9fd1ce81d16f7c
diff --git a/c7n/ipaddress.py b/c7n/ipaddress.py index <HASH>..<HASH> 100644 --- a/c7n/ipaddress.py +++ b/c7n/ipaddress.py @@ -1113,7 +1113,8 @@ class _BaseNetwork(_IPAddressBase): try: # Always false if one is v4 and the other is v6. if a._version != b._version: - raise TypeError("%s and %s are not of the same version" (a, b)) + raise TypeError( + "%s and %s are not of the same version" % (a, b)) return (b.network_address <= a.network_address and b.broadcast_address >= a.broadcast_address) except AttributeError:
core - vendored ipaddress use <I> compatible interpolation (#<I>)
cloud-custodian_cloud-custodian
train
py
e341e5ef698637acff9132b076fa8db9cbb438ed
diff --git a/themes/colors/header.php b/themes/colors/header.php index <HASH>..<HASH> 100644 --- a/themes/colors/header.php +++ b/themes/colors/header.php @@ -247,13 +247,13 @@ echo '</tr>', '</td>'; if(empty($SEARCH_SPIDER)) { echo '<td class="toplinks_right">', - '<div align="', $TEXT_DIRECTION=="ltr"?"left":"right", '">', - 'color_theme_dropdown()', - '</div>', + '<div align="', $TEXT_DIRECTION=="rtl"?"left":"right", '">'; + echo color_theme_dropdown(); + echo '</div>', '</td>'; } -echo '<tr>', - '</table>'; + echo '<tr>', + '</table>'; } ?> <!-- end menu section --> <!-- begin content section -->
Consolidate toplinks into header script
fisharebest_webtrees
train
php
8d17c2a5091f43c5bdb4b279ede49edd0f924e37
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -40,8 +40,6 @@ setup(name='ramses', tests_require=requires, test_suite="ramses", entry_points="""\ - [console_scripts] - ramses.scaffold_test = ramses.scripts.scaffold_test:main [pyramid.scaffold] ramses_starter = ramses.scaffolds:RamsesStarterTemplate """)
Dont expose scaffold_test in scripts
ramses-tech_ramses
train
py
99b41217259832dd2a558cc0399049d50841b597
diff --git a/common.go b/common.go index <HASH>..<HASH> 100644 --- a/common.go +++ b/common.go @@ -93,7 +93,8 @@ func Number(num []byte) []byte { end-- } } - for i, c := range num { + for i := 0; i < len(num); i++ { + c := num[i] if c == '.' { dot = i } else if c == 'e' || c == 'E' { diff --git a/svg/svg.go b/svg/svg.go index <HASH>..<HASH> 100644 --- a/svg/svg.go +++ b/svg/svg.go @@ -245,7 +245,8 @@ func shortenPathData(b []byte) []byte { prevDigitRequiresSpace := true j := 0 start := 0 - for i, c := range b { + for i := 0; i < len(b); i++ { + c := b[i] if c == ' ' || c == ',' || c == '\t' || c == '\n' || c == '\r' { if start != 0 { j += copy(b[j:], b[start:i])
Revert some bad for i -> for range conversions
tdewolff_minify
train
go,go
ba0179b5850ba1d8accfa7301f483733c1378b60
diff --git a/pyes/es.py b/pyes/es.py index <HASH>..<HASH> 100644 --- a/pyes/es.py +++ b/pyes/es.py @@ -448,7 +448,7 @@ class ES(object): path = self._make_path(parts) return self._send_request('GET', path) - def index(self, doc, index, doc_type, id=None, force_insert=False, bulk=False, querystring_args=None): + def index(self, doc, index, doc_type, id=None, parent=None, force_insert=False, bulk=False, querystring_args=None): """ Index a typed JSON document into a specific index and make it searchable. """ @@ -462,6 +462,8 @@ class ES(object): if force_insert: optype = "create" cmd = { optype : { "_index" : index, "_type" : doc_type}} + if parent: + cmd[optype]['_parent'] = parent if id: cmd[optype]['_id'] = id self.bulk_data.write(json.dumps(cmd, cls=self.encoder)) @@ -477,6 +479,9 @@ class ES(object): if force_insert: querystring_args['opType'] = 'create' + + if parent: + querystring_args['parent'] = parent if id is None: request_method = 'POST'
Added a parent argument to the index method Generate the necessary parameters to index the parent in non-bulk and bulk modes (previously there was no way to accomplish this in bulk mode)
aparo_pyes
train
py