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
c143694c4e2e8c98c75310c5fbb41997cf71f20e
diff --git a/kv/session.go b/kv/session.go index <HASH>..<HASH> 100644 --- a/kv/session.go +++ b/kv/session.go @@ -113,6 +113,18 @@ func (s *Service) findSession(ctx context.Context, tx Tx, key string) (*influxdb ps = append(ps, p...) } ps = append(ps, influxdb.MePermissions(sn.UserID)...) + + // TODO(desa): this is super expensive, we should keep a list of a users maximal privileges somewhere + // we did this so that the oper token would be used in a users permissions. + af := influxdb.AuthorizationFilter{UserID: &sn.UserID} + as, err := s.findAuthorizations(ctx, tx, af) + if err != nil { + return nil, err + } + for _, a := range as { + ps = append(ps, a.Permissions...) + } + sn.Permissions = ps return sn, nil }
fix(kv): grant user union of their tokens and urms perms
influxdata_influxdb
train
go
b4693ce01b3d02275a7a475b30cc4c5cd5feb2cc
diff --git a/encoding/encoder_types.go b/encoding/encoder_types.go index <HASH>..<HASH> 100644 --- a/encoding/encoder_types.go +++ b/encoding/encoder_types.go @@ -2,6 +2,7 @@ package encoding import ( "encoding/base64" + "math" "reflect" "time" ) @@ -262,9 +263,17 @@ func newCondAddrEncoder(canAddrEnc, elseEnc encoderFunc) encoderFunc { func timePseudoTypeEncoder(v reflect.Value) interface{} { t := v.Interface().(time.Time) + timeVal := float64(t.UnixNano()) / float64(time.Second) + + // use seconds-since-epoch precision if time.Time `t` + // is before the oldest nanosecond time + if t.Before(time.Unix(0, math.MinInt64)) { + timeVal = float64(t.Unix()) + } + return map[string]interface{}{ "$reql_type$": "TIME", - "epoch_time": float64(t.UnixNano()) / 1000 / 1000 / 1000, //milliseconds + "epoch_time": timeVal, "timezone": "+00:00", } }
Drop millisecond precision if given value is too old It's an edge case but the result of `UnixNano()` '...is undefined if the Unix time in nanoseconds cannot be represented by an int<I>' (from docs), which means it won't work for dates older than <I>-<I>-<I>, which includes the zero Time (var t time.Time). I ran into this issue trying to retrieve a previously saved zero Time but was instead getting a date in <I>
rethinkdb_rethinkdb-go
train
go
5dea71d2195f58dab645f2cd4b9e512ede43bbf5
diff --git a/swarm.go b/swarm.go index <HASH>..<HASH> 100644 --- a/swarm.go +++ b/swarm.go @@ -286,6 +286,15 @@ func (s *Swarm) ConnectionsToPeer(p peer.ID) []*Conn { return wrapConns(ps.ConnsWithGroup(p, s.swarm.Conns())) } +func (s *Swarm) HaveConnsToPeer(p peer.ID) bool { + for _, c := range s.swarm.Conns() { + if c.InGroup(p) { + return true + } + } + return false +} + // Connections returns a slice of all connections. func (s *Swarm) Connections() []*Conn { return wrapConns(s.swarm.Conns()) diff --git a/swarm_net.go b/swarm_net.go index <HASH>..<HASH> 100644 --- a/swarm_net.go +++ b/swarm_net.go @@ -123,8 +123,7 @@ func (n *Network) InterfaceListenAddresses() ([]ma.Multiaddr, error) { // Connectedness returns a state signaling connection capabilities // For now only returns Connected || NotConnected. Expand into more later. func (n *Network) Connectedness(p peer.ID) inet.Connectedness { - c := n.Swarm().ConnectionsToPeer(p) - if len(c) > 0 { + if n.Swarm().HaveConnsToPeer(p) { return inet.Connected } return inet.NotConnected
swarm: add optimized method for checking connectedness to peer
libp2p_go-libp2p-swarm
train
go,go
6ed23c79384e948c83795ed57d1177c5f316420f
diff --git a/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java b/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java +++ b/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java @@ -305,4 +305,26 @@ public class Trie } } + /** + * 文本是否包含任何模式 + * + * @param text 待匹配的文本 + * @return 文本包含模式時回傳true + */ + public boolean hasKeyword(String text) + { + checkForConstructedFailureStates(); + + State currentState = this.rootState; + for (int i = 0; i < text.length(); ++i) + { + State nextState = getState(currentState, text.charAt(i)); + if(nextState != null && nextState != currentState) { + return true; + } + currentState = nextState; + } + return false; + } + }
add early abandoning keyword finding method for ac trie class
hankcs_HanLP
train
java
417e52cfd26a3a1ccb803f14c2ac04d6122c2985
diff --git a/testing/perf/select_benchmark.js b/testing/perf/select_benchmark.js index <HASH>..<HASH> 100644 --- a/testing/perf/select_benchmark.js +++ b/testing/perf/select_benchmark.js @@ -479,8 +479,8 @@ lf.testing.perf.SelectBenchmark.prototype.verifyProjectMixedColumns = goog.isDefAndNotNull(obj.salary) && goog.isDefAndNotNull(obj['avg_salary']) && goog.math.nearlyEquals( - obj.avgSalary, - this.dataGenerator_.employeeGroundTruth['avg_salary'], + obj['avg_salary'], + this.dataGenerator_.employeeGroundTruth.avgSalary, lf.testing.perf.SelectBenchmark.EPSILON_); }, this);
Fixing verification of SelectProjectMixedColumns test. It was failing due to a typo when dereferencing the result. ------------- Created by MOE: <URL>
google_lovefield
train
js
a1291f235e2c2e18597d459b7648b2c7140df774
diff --git a/malaffinity/malaffinity.py b/malaffinity/malaffinity.py index <HASH>..<HASH> 100644 --- a/malaffinity/malaffinity.py +++ b/malaffinity/malaffinity.py @@ -145,13 +145,6 @@ class MALAffinity: if not len(scores[key]) == 2: del scores[key] - # Handle cases where the shared scores are <= 10 so - # affinity can not be accurately calculated. - if len(scores) <= 10: - raise NoAffinityError("Shared rated anime count between " - "`{}` and `{}` is less than eleven" - .format(self._base_user, username)) - return scores def calculate_affinity(self, username): @@ -176,6 +169,13 @@ class MALAffinity: """ scores = self.comparison(username) + # Handle cases where the shared scores are <= 10 so + # affinity can not be accurately calculated. + if len(scores) <= 10: + raise NoAffinityError("Shared rated anime count between " + "`{}` and `{}` is less than eleven" + .format(self._base_user, username)) + # Sort multiple rows of scores into two arrays for calculations. # E.G. [1,2], [3,4], [5,6] to [1,3,5], [2,4,6] values = scores.values()
Move the "shared rated anime threshold" check to the `calculate_affinity` method Was misplaced, doesn't actually matter if shared rated is less than <I> if you're just doing a comparison. Now, it'll only raise that if shared rated is less than <I> and you're trying to calculate affinity.
erkghlerngm44_malaffinity
train
py
e0baa79af640b79c6ce5519e6f63b7c49f058597
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -68,8 +68,8 @@ setuptools.setup( 'windows-curses; sys_platform == "win32"', ), - # Needs support for unnumbered {} in format() - python_requires=">=2.7,!=3.0.*", + # Needs support for unnumbered {} in format() and argparse + python_requires=">=2.7,!=3.0.*,!=3.1.*", project_urls={ "GitHub repository": "https://github.com/ulfalizer/Kconfiglib", @@ -87,7 +87,6 @@ setuptools.setup( "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4",
Tweak python_requires to <I>/<I>+ Many of the utilities need argparse, which was added in <I>. Kconfiglib itself is compatible with <I>.
ulfalizer_Kconfiglib
train
py
bd2fc34ee3f0937dbe4dc1e6e470c1a989ec77ab
diff --git a/java/server/src/org/openqa/selenium/grid/config/ClassCreation.java b/java/server/src/org/openqa/selenium/grid/config/ClassCreation.java index <HASH>..<HASH> 100644 --- a/java/server/src/org/openqa/selenium/grid/config/ClassCreation.java +++ b/java/server/src/org/openqa/selenium/grid/config/ClassCreation.java @@ -14,8 +14,8 @@ class ClassCreation { try { // Use the context class loader since this is what the `--ext` // flag modifies. - Class<?> сlassClazz = Class.forName(clazz, true, Thread.currentThread().getContextClassLoader()); - Method create = сlassClazz.getMethod("create", org.openqa.selenium.grid.config.Config.class); + Class<?> classClazz = Class.forName(clazz, true, Thread.currentThread().getContextClassLoader()); + Method create = classClazz.getMethod("create", org.openqa.selenium.grid.config.Config.class); if (!Modifier.isStatic(create.getModifiers())) { throw new IllegalArgumentException(String.format(
[java] Fixing variable name (Cyrillic letter с looks exactly like Latin letter c)
SeleniumHQ_selenium
train
java
c215842d533d12e35f75665baac79e935dc29544
diff --git a/tensorboard/plugins/interactive_inference/witwidget/notebook/base.py b/tensorboard/plugins/interactive_inference/witwidget/notebook/base.py index <HASH>..<HASH> 100644 --- a/tensorboard/plugins/interactive_inference/witwidget/notebook/base.py +++ b/tensorboard/plugins/interactive_inference/witwidget/notebook/base.py @@ -85,10 +85,9 @@ class WitWidgetBase(object): if 'compare_adjust_attribution' in copied_config: del copied_config['compare_adjust_attribution'] + examples = copied_config.pop('examples') self.config = copied_config - self.set_examples(config['examples']) - del copied_config['examples'] - + self.set_examples(examples) # If using AI Platform for prediction, set the correct custom prediction # functions.
Fix set examples in jupyter (#<I>)
tensorflow_tensorboard
train
py
aef7eaf72e0e3129916b4870b74e92d17b617d96
diff --git a/src/RequestsLibrary/RequestsKeywords.py b/src/RequestsLibrary/RequestsKeywords.py index <HASH>..<HASH> 100644 --- a/src/RequestsLibrary/RequestsKeywords.py +++ b/src/RequestsLibrary/RequestsKeywords.py @@ -83,13 +83,7 @@ class RequestsKeywords(object): if isinstance(verify, bool): s.verify = verify elif isinstance(verify, unicode) or isinstance(verify, str): - if verify == 'True': - s.verify = True - elif verify == 'False': - s.verify = False - else: - # a CA bundle path - s.verify = verify + self.builtin.convert_to_boolean(verify) else: # not a Boolean nor a String s.verify = verify
use BuiltIn.convert_to_boolean to convert string into boolean
bulkan_robotframework-requests
train
py
582d12a19706b7ddb80a63866727f2b3376a9d9a
diff --git a/torchvision/utils.py b/torchvision/utils.py index <HASH>..<HASH> 100644 --- a/torchvision/utils.py +++ b/torchvision/utils.py @@ -189,7 +189,7 @@ def draw_bounding_boxes( if image.size(0) == 1: image = torch.tile(image, (3, 1, 1)) - ndarr = image.permute(1, 2, 0).numpy() + ndarr = image.permute(1, 2, 0).cpu().numpy() img_to_draw = Image.fromarray(ndarr) img_boxes = boxes.to(torch.int64).tolist()
Fix `draw_bounding_boxes` for tensors on GPU (#<I>)
pytorch_vision
train
py
d953fff487e85a296ff699c0ca4ef3286920e64d
diff --git a/test/allSpec.js b/test/allSpec.js index <HASH>..<HASH> 100644 --- a/test/allSpec.js +++ b/test/allSpec.js @@ -56,4 +56,19 @@ describe('all', function() { validators[2].should.not.have.been.called; }); + + it('always fails when prop value is missing and isRequired is used', function() { + const missingPropName = 'missing'; + const allValidator = all(...validators).isRequired; + const expectedErr = new Error( + `Required prop '${missingPropName}' was not specified in '${componentName}'.` + ); + + const result = allValidator(props, missingPropName, componentName); + expect(result.toString()).to.equal(expectedErr.toString()); // cannot compare values, as we got different Error instances here. + + validators[0].should.not.have.been.called; + validators[1].should.not.have.been.called; + validators[2].should.not.have.been.called; + }); });
added test for `all` - isRequired feature
react-bootstrap_react-prop-types
train
js
7b7fb8cd58b0d1be96dd71217403c19b734792e1
diff --git a/src/dashboard.js b/src/dashboard.js index <HASH>..<HASH> 100644 --- a/src/dashboard.js +++ b/src/dashboard.js @@ -114,20 +114,23 @@ }; /** - * Switches to account view aka "All" selection of instance selector + * Switches to account view aka "All" selection of instance selector or DisplayGroup view * + * @param {boolean} displayGroupId * @param {function} [onSuccess] * @param {function} [onError] * @returns {number} callId */ - this.switchToAccountView = function (onSuccess, onError) { + this.switchToView = function (displayGroupId, onSuccess, onError) { return this.method({ - name: 'switchToAccountView', + name: 'switchToView', + params: displayGroupId, successCallback: onSuccess, errorCallback: onError, }); }; + /** * Sets the primary action buttons for a page in the titlebar. *
Replace switchToAccountView with a generic switchToView
Enplug_dashboard-sdk
train
js
b3c057175a6eddf7a0fb233eef65384f50e4d5c9
diff --git a/classes/Gems/Default/RespondentExportAction.php b/classes/Gems/Default/RespondentExportAction.php index <HASH>..<HASH> 100644 --- a/classes/Gems/Default/RespondentExportAction.php +++ b/classes/Gems/Default/RespondentExportAction.php @@ -217,7 +217,9 @@ class Gems_Default_RespondentExportAction extends Gems_Controller_Action $this->_exportRespondent($respondentId); $this->escort->menu->setVisible(false); - $this->escort->layoutSwitch(); + if ($this->escort instanceof Gems_Project_Layout_MultiLayoutInterface) { + $this->escort->layoutSwitch(); + } $this->escort->postDispatch($this->getRequest()); $this->_helper->layout()->disableLayout();
layoutswitch is only for multi-layout projects
GemsTracker_gemstracker-library
train
php
77324df6a7c2ce146bbb6d4a027daae31b41693a
diff --git a/modules/authfacebook/lib/Auth/Source/Facebook.php b/modules/authfacebook/lib/Auth/Source/Facebook.php index <HASH>..<HASH> 100644 --- a/modules/authfacebook/lib/Auth/Source/Facebook.php +++ b/modules/authfacebook/lib/Auth/Source/Facebook.php @@ -90,9 +90,9 @@ class sspmod_authfacebook_Auth_Source_Facebook extends SimpleSAML_Auth_Source { $facebook = new sspmod_authfacebook_Facebook(array('appId' => $this->api_key, 'secret' => $this->secret), $state); $uid = $facebook->getUser(); - if (isset($uid)) { + if (isset($uid) && $uid) { try { - $info = $facebook->api("/me"); + $info = $facebook->api("/" . $uid); } catch (FacebookApiException $e) { throw new SimpleSAML_Error_AuthSource($this->authId, 'Error getting user profile.', $e); }
authfacebook: minor uid check fix.
simplesamlphp_saml2
train
php
8a5775e70cd61f57b8d7e9fc4e9e8fd1171aa715
diff --git a/src/js/CanvasContext.js b/src/js/CanvasContext.js index <HASH>..<HASH> 100644 --- a/src/js/CanvasContext.js +++ b/src/js/CanvasContext.js @@ -201,7 +201,7 @@ tabris.getContext = function(canvas, width, height) { if (!canvas._gc) { - canvas._gc = tabris.create("GC", {parent: canvas}); + canvas._gc = tabris.create("rwt.widgets.GC", {parent: canvas}); } if (!canvas._ctx) { canvas._ctx = tabris._nativeBridge.V8 ? new tabris.CanvasContext(canvas._gc) diff --git a/test/js/CanvasContext.spec.js b/test/js/CanvasContext.spec.js index <HASH>..<HASH> 100644 --- a/test/js/CanvasContext.spec.js +++ b/test/js/CanvasContext.spec.js @@ -41,6 +41,12 @@ describe("CanvasContext", function() { canvas = new tabris.Proxy(); }); + it("creates a native GC", function() { + tabris.getContext(canvas, 100, 200); + + expect(nativeBridge.calls({op: "create", type: "rwt.widgets.GC"}).length).toBe(1); + }); + it("creates and returns graphics context", function() { var ctx = tabris.getContext(canvas, 100, 200);
Fix Canvas creating GC without namespace prefix Removing the auto-prefixing of widget names with "rwt.widgets." broke the Canvas widget that created the GC without prefix. Change-Id: Ib<I>d1d<I>cd4b<I>ad<I>b7aa8f8beec3ad9bb
eclipsesource_tabris-js
train
js,js
4ebc74669e32d0e5ae879a2a7924679ab10a5f64
diff --git a/plugin/geomajas-layer-tms/tms/src/main/java/org/geomajas/layer/tms/TmsLayer.java b/plugin/geomajas-layer-tms/tms/src/main/java/org/geomajas/layer/tms/TmsLayer.java index <HASH>..<HASH> 100644 --- a/plugin/geomajas-layer-tms/tms/src/main/java/org/geomajas/layer/tms/TmsLayer.java +++ b/plugin/geomajas-layer-tms/tms/src/main/java/org/geomajas/layer/tms/TmsLayer.java @@ -251,7 +251,9 @@ public class TmsLayer implements RasterLayer { * * @param baseTmsUrl * The base URL for the TMS layer. + * @since 1.0.0 */ + @Api public void setBaseTmsUrl(String baseTmsUrl) { this.baseTmsUrl = baseTmsUrl; } @@ -271,7 +273,9 @@ public class TmsLayer implements RasterLayer { * * @param extension * The extension. Default value is "jpg". + * @since 1.0.0 */ + @Api public void setExtension(String extension) { this.extension = extension; }
TMS-8 mark setExtension() and setBaseTmsUrl() as @Api
geomajas_geomajas-project-client-gwt2
train
java
47f60be7e03bd399bafd4e9af6aaab2adef20ea0
diff --git a/lib/param_query.js b/lib/param_query.js index <HASH>..<HASH> 100644 --- a/lib/param_query.js +++ b/lib/param_query.js @@ -4,9 +4,16 @@ const spawnSync = require('child_process').spawnSync; const SSM = require( './ssm' ); +const PARAM_DEFAULTS = { + + Path: '/', + Recursive: true, + WithDecryption: true +}; + class ParameterQuery { - constructor( params = { Path: '/' } ) { + constructor( params = PARAM_DEFAULTS ) { this._params = Object.assign( {}, params ); }
updated defaults to use recursive and decryption
vandium-io_aws-param-store
train
js
5c5dd7b8420a31a2f46cfedd54442f84092bf04e
diff --git a/store/tikv/rawkv.go b/store/tikv/rawkv.go index <HASH>..<HASH> 100644 --- a/store/tikv/rawkv.go +++ b/store/tikv/rawkv.go @@ -291,7 +291,7 @@ func (c *RawKVClient) Scan(startKey, endKey []byte, limit int) (keys [][]byte, v return nil, nil, errors.Trace(ErrMaxScanLimitExceeded) } - for len(keys) < limit { + for len(keys) < limit && (len(endKey) == 0 || bytes.Compare(startKey, endKey) < 0) { req := tikvrpc.NewRequest(tikvrpc.CmdRawScan, &kvrpcpb.RawScanRequest{ StartKey: startKey, EndKey: endKey, @@ -334,7 +334,7 @@ func (c *RawKVClient) ReverseScan(startKey, endKey []byte, limit int) (keys [][] return nil, nil, errors.Trace(ErrMaxScanLimitExceeded) } - for len(keys) < limit { + for len(keys) < limit && bytes.Compare(startKey, endKey) > 0 { req := tikvrpc.NewRequest(tikvrpc.CmdRawScan, &kvrpcpb.RawScanRequest{ StartKey: startKey, EndKey: endKey,
tikv: fix RowKVClient scan method can't rightly break loop (#<I>)
pingcap_tidb
train
go
46e9a669660c29c41901d0383e94e290f3e5fe6d
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 @@ -39,6 +39,8 @@ function Editor() { // Call the constructor for our mixins SimpleEventEmitter.call(this); Conditioned.call(this); + + this._mode_data = {}; } oop.implement(Editor, SimpleEventEmitter); @@ -1815,6 +1817,13 @@ Editor.prototype.makeModal = function () { return ret; }; +Editor.prototype.getModeData = function (key) { + return this._mode_data[key]; +}; + +Editor.prototype.setModeData = function (key, value) { + this._mode_data[key] = value; +}; Editor.prototype.destroy = function () { if (this._destroyed)
Added support to set/get mode data.
mangalam-research_wed
train
js
907ad7cf3bf4d6c35a5ebb4cc78a8f1c2cc18163
diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index <HASH>..<HASH> 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -307,7 +307,7 @@ class Chef :group => Chef::Provider::Group::Usermod, :user => Chef::Provider::User::Solaris, }, - ">= 5.9" => { + "< 5.11" => { :service => Chef::Provider::Service::Solaris, :package => Chef::Provider::Package::Solaris, :cron => Chef::Provider::Cron::Solaris,
default to IPS packages on Solaris <I>+ This behavior was correct until 7fa1ea5 flipped the logic.
chef_chef
train
rb
794523ce1e71d23524b005415b38d7e8d7fa9cab
diff --git a/src/Codeception/Lib/Driver/Db.php b/src/Codeception/Lib/Driver/Db.php index <HASH>..<HASH> 100644 --- a/src/Codeception/Lib/Driver/Db.php +++ b/src/Codeception/Lib/Driver/Db.php @@ -150,7 +150,7 @@ class Db public function select($column, $table, array &$criteria) { $where = $criteria ? "where %s" : ''; - $query = "select %s from `%s` $where"; + $query = "select %s from %s $where"; $params = []; foreach ($criteria as $k => $v) { $k = $this->getQuotedName($k); @@ -162,7 +162,7 @@ class Db } $sparams = implode(' AND ', $params); - return sprintf($query, $column, $table, $sparams); + return sprintf($query, $column, $this->getQuotedName($table), $sparams); } public function deleteQuery($table, $id, $primaryKey = 'id')
Use getQuotedName() for escaping table name in DB Driver's select()
Codeception_base
train
php
0ad9eec48650491f5ec2e01c010be9987dac0a21
diff --git a/h2o-core/src/main/java/water/parser/ParseSetup.java b/h2o-core/src/main/java/water/parser/ParseSetup.java index <HASH>..<HASH> 100644 --- a/h2o-core/src/main/java/water/parser/ParseSetup.java +++ b/h2o-core/src/main/java/water/parser/ParseSetup.java @@ -485,6 +485,7 @@ public final class ParseSetup extends Iced { || n.endsWith("csv") || n.endsWith("xls") || n.endsWith("txt") + || n.endsWith("svm") || n.endsWith("arff")) { n = n.substring(0, dot); dot = n.lastIndexOf('.');
Adds svm as a file extension to the hex name cleanup.
h2oai_h2o-3
train
java
888fbec380d2e7f716ab8a865ccb5c9f1c478a6d
diff --git a/core/app/models/concerns/comable/checkout.rb b/core/app/models/concerns/comable/checkout.rb index <HASH>..<HASH> 100644 --- a/core/app/models/concerns/comable/checkout.rb +++ b/core/app/models/concerns/comable/checkout.rb @@ -37,8 +37,8 @@ module Comable end before_transition to: :completed, do: :complete! - after_transition to: :canceled, do: [:restock!, :payment_cancel!] - after_transition to: :resumed, do: [:unstock!, :payment_resume!] + before_transition to: :canceled, do: [:payment_cancel!, :restock!] + before_transition to: :resumed, do: [:payment_resume!, :unstock!] end end
Execute payment before the transition of Order
appirits_comable
train
rb
030d4032e2c6f7946489908b0dd3526adfc47ca8
diff --git a/txaws/ec2/tests/test_client.py b/txaws/ec2/tests/test_client.py index <HASH>..<HASH> 100644 --- a/txaws/ec2/tests/test_client.py +++ b/txaws/ec2/tests/test_client.py @@ -20,6 +20,7 @@ from txaws.credentials import AWSCredentials from txaws.ec2 import client from txaws.ec2 import model from txaws.ec2.exception import EC2Error +from txaws.exception import CredentialsNotFoundError from txaws.service import AWSServiceEndpoint, EC2_ENDPOINT_US from txaws.testing import payload from txaws.testing.base import TXAWSTestCase @@ -94,7 +95,7 @@ class EC2ClientTestCase(TXAWSTestCase): return ec2.describe_instances() def test_init_no_creds_non_available_errors(self): - self.assertRaises(ValueError, client.EC2Client) + self.assertRaises(CredentialsNotFoundError, client.EC2Client) def test_init_explicit_creds(self): creds = AWSCredentials("foo", "bar")
And the test I can't run locally.
twisted_txaws
train
py
ac8610d523d9db14c8798a8829fc019ad305392b
diff --git a/salt/grains/core.py b/salt/grains/core.py index <HASH>..<HASH> 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -863,14 +863,19 @@ def _windows_platform_data(): # location. For example: # 'Microsoft Windows Server 2008 R2 Standard |C:\\Windows|\\Device\\Harddisk0\\Partition2' osrelease = platform.release() - if salt.utils.win_osinfo.get_os_version_info()['ProductType'] > 1: - server = {'Vista': '2008', - '7': '2008R2', - '8': '2012', - '8.1': '2012R2', - '10': '2016'} + info = salt.utils.win_osinfo.get_os_version_info() + if info['ProductType'] > 1: + server = {'Vista': 'Server 2008', + '7': 'Server 2008 R2', + '8': 'Server 2012', + '8.1': 'Server 2012 R2', + '10': 'Server 2016'} osrelease = server[osrelease] + if info['ServicePackMajor'] > 0: + service_pack = ''.join('SP', info['ServicePackMajor']) + osrelease = ' '.join([osrelease, service_pack]) + grains = { 'osversion': osinfo.Version, 'osrelease': osrelease,
Add ServicePack to osrelease
saltstack_salt
train
py
5e7daea3634ddc90c7691df0c5535aef0ac4a3ed
diff --git a/lib/parser/juttle-parser.js b/lib/parser/juttle-parser.js index <HASH>..<HASH> 100644 --- a/lib/parser/juttle-parser.js +++ b/lib/parser/juttle-parser.js @@ -235,6 +235,17 @@ function parseSync(mainSource, options) { } } + function resolveImport(import_) { + try { + return options.moduleResolver(import_.modulename.value, import_.localname); + } catch (e) { + throw errors.compileError('RT-MODULE-NOT-FOUND', { + module: import_.modulename.value, + location: import_.location + }); + } + } + options = processOptions(options, defaultResolver); var asts = {}; @@ -248,19 +259,7 @@ function parseSync(mainSource, options) { asts[o.name] = ast; imports = extractImports(ast); _.each(imports, checkImportNode); - modules = imports.map(function(import_) { - try { - return options.moduleResolver( - import_.modulename.value, - import_.localname - ); - } catch (e) { - throw errors.compileError('RT-MODULE-NOT-FOUND', { - module: import_.modulename.value, - location: import_.location - }); - } - }); + modules = imports.map(resolveImport); _.each(modules, rec); }
parser.parseSync: Extract `resolveImport` This makes the code slightly more readable.
juttle_juttle
train
js
e2b527e4a81df00d0b5ff1567597f2c457f86e9b
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- import os from setuptools import setup, find_packages -from cmsplugin_bootstrap import __version__ +from cmsplugin_cascade import __version__ CLASSIFIERS = [ @@ -23,12 +23,12 @@ def read(fname): return os.popen('pandoc -t rst {0}'.format(readme_file)).read() setup( - name='djangocms-bootstrap', + name='djangocms-cascade', version=__version__, description='Collection of plugins for DjangoCMS', author='Jacob Rief', author_email='[email protected]', - url='https://github.com/jrief/djangocms-bootstrap', + url='https://github.com/jrief/djangocms-cascade', packages=find_packages(exclude=['examples', 'docs']), install_requires=[], license='LICENSE-MIT',
renamed bootstrap -> cascade
jrief_djangocms-cascade
train
py
fd802944f3a1097ecda62db2c6c013c7cce5ea0e
diff --git a/lib/rules.js b/lib/rules.js index <HASH>..<HASH> 100644 --- a/lib/rules.js +++ b/lib/rules.js @@ -92,6 +92,9 @@ var Rules = { value: "string", validate: function(s) { return function(v) { + if (v === null || v === undefined) { + return true; + } var regex = new RegExp(s); return regex.test(v); };
Allow null and undefined in pattern rule
shunjikonishi_api-first-spec
train
js
089df0a50f0b92508638e87aeb9ad33c6bf7ca95
diff --git a/src/virtual-machine.js b/src/virtual-machine.js index <HASH>..<HASH> 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -513,6 +513,9 @@ class VirtualMachine extends EventEmitter { storage.DataFormat.SVG, (new TextEncoder()).encode(svg) ); + // If we're in here, we've edited an svg in the vector editor, + // so the dataFormat should be 'svg' + costume.dataFormat = storage.DataFormat.SVG; this.emitTargetsUpdate(); }
Sounds get updated in storage and vm runtime when they are updated in the sound editor. The updateSvg function ensures that the costume that was edited has an updated dataFormat property in the vm runtime. This is specifically for when pngs get edited in the vector editor. Their file format should then get updated to svg.
LLK_scratch-vm
train
js
7905bbf24063b469de76bcd7e9282b7759aa3922
diff --git a/blocks/classes/external.php b/blocks/classes/external.php index <HASH>..<HASH> 100644 --- a/blocks/classes/external.php +++ b/blocks/classes/external.php @@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die; require_once("$CFG->libdir/externallib.php"); +require_once("$CFG->dirroot/my/lib.php"); /** * Blocks external functions
MDL-<I> blocks: add missing library require for constants. All the MY_PAGE_* constants used since <I>b<I> reside in another library. We should be explicit and include it, to avoid warnings.
moodle_moodle
train
php
f7fbda9a43866a2404d20e5e0f50c55ce72add4c
diff --git a/packages/simplebar/src/simplebar.js b/packages/simplebar/src/simplebar.js index <HASH>..<HASH> 100755 --- a/packages/simplebar/src/simplebar.js +++ b/packages/simplebar/src/simplebar.js @@ -750,8 +750,8 @@ export default class SimpleBar { this.el.classList.add(this.classNames.dragging); - document.addEventListener('mousemove', this.drag); - document.addEventListener('mouseup', this.onEndDrag); + document.addEventListener('mousemove', this.drag, true); + document.addEventListener('mouseup', this.onEndDrag, true); } /** @@ -811,8 +811,8 @@ export default class SimpleBar { this.el.classList.remove(this.classNames.dragging); - document.removeEventListener('mousemove', this.drag); - document.removeEventListener('mouseup', this.onEndDrag); + document.removeEventListener('mousemove', this.drag, true); + document.removeEventListener('mouseup', this.onEndDrag, true); }; /**
Set useCapture on document mousemove/mouseup handlers during drag A scrollbar drag continues even if the pointer moves off the scrollbar track while the mouse button is down. We want to block other elements’ mousemove/mouseup handlers from firing during this period.
Grsmto_simplebar
train
js
5521b5b80b9fa449bf099b32c1f1de62de01c229
diff --git a/src/components/__tests__/Button-test.js b/src/components/__tests__/Button-test.js index <HASH>..<HASH> 100644 --- a/src/components/__tests__/Button-test.js +++ b/src/components/__tests__/Button-test.js @@ -35,7 +35,7 @@ describe('Button', () => { }); it('should not pass down non element props being used elsewhere', () => { - const button = shallow(<Button isActive='foo' />); + const button = shallow(<Button actionText='foo' />); expect(button.html()).not.toContain('foo'); });
Use different prop in test to prevent prop type warning
mxenabled_mx-react-components
train
js
d29d017dce0df47f8c95eb77a304ca37a5f9f781
diff --git a/libkbfs/dir_rwchannels.go b/libkbfs/dir_rwchannels.go index <HASH>..<HASH> 100644 --- a/libkbfs/dir_rwchannels.go +++ b/libkbfs/dir_rwchannels.go @@ -40,3 +40,16 @@ func (d *DirRWChannels) GetDirChan(dir DirId) *util.RWChannel { return rwchan } } + +// Shutdown closes all RWChannels. This must be called at most once. +func (d *DirRWChannels) Shutdown() { + d.chansLock.Lock() + defer d.chansLock.Unlock() + chans := make([]chan struct{}, 0, len(d.chans)) + for _, rwchan := range d.chans { + chans = append(chans, rwchan.Shutdown()) + } + for _, donechan := range chans { + <-donechan + } +}
dir_rwchannels: add a Shutdown method, to shut down all channels
keybase_client
train
go
4a4fc12f491b5618529dc5f3a259b7a9a0bfa79b
diff --git a/src/Intervention/Image/Size.php b/src/Intervention/Image/Size.php index <HASH>..<HASH> 100644 --- a/src/Intervention/Image/Size.php +++ b/src/Intervention/Image/Size.php @@ -154,7 +154,7 @@ class Size } if ($constraint->isFixed(Constraint::ASPECTRATIO)) { - $h = intval(round($this->width / $constraint->getSize()->getRatio())); + $h = max(1, intval(round($this->width / $constraint->getSize()->getRatio()))); if ($constraint->isFixed(Constraint::UPSIZE)) { $this->height = ($h > $max_height) ? $max_height : $h; @@ -190,7 +190,7 @@ class Size } if ($constraint->isFixed(Constraint::ASPECTRATIO)) { - $w = intval(round($this->height * $constraint->getSize()->getRatio())); + $w = max(1, intval(round($this->height * $constraint->getSize()->getRatio()))); if ($constraint->isFixed(Constraint::UPSIZE)) { $this->width = ($w > $max_width) ? $max_width : $w;
Avoid 0px result dimensions when resizing images with extreme ratios
Intervention_image
train
php
ef72808f5e9715be91cefd9d3c8ffe05bdc3f9fb
diff --git a/src/Carbon/Carbon.php b/src/Carbon/Carbon.php index <HASH>..<HASH> 100644 --- a/src/Carbon/Carbon.php +++ b/src/Carbon/Carbon.php @@ -1201,7 +1201,7 @@ class Carbon extends DateTime */ public function isPast() { - return !$this->isFuture(); + return $this->lt(self::now($this->tz)); } /** diff --git a/tests/IsTest.php b/tests/IsTest.php index <HASH>..<HASH> 100644 --- a/tests/IsTest.php +++ b/tests/IsTest.php @@ -93,5 +93,6 @@ class IsTest extends TestFixture public function testIsPast() { $this->assertFalse(Carbon::now()->addSecond()->isPast()); + $this->assertFalse(Carbon::now()->isPast()); } }
Fixed issue with isPast() returning true for now()
briannesbitt_Carbon
train
php,php
64e049cc87ac7d40e2135a6d02e900e37b8cb9e4
diff --git a/origin/origin.py b/origin/origin.py index <HASH>..<HASH> 100644 --- a/origin/origin.py +++ b/origin/origin.py @@ -552,7 +552,7 @@ def cmd_auto(abfFile,cmd,args): OR.cjf_events_default_AP() ramp("RAMP","%s_%s"%(parentID,abf.ID)) - elif abf.protoComment.startswith("04-01-MTmon"): + elif "-MTmon" in abf.protoComment: log("looks like a memtest protocol where drugs are applied") OR.cjf_gs_set(phasic=True) LT("varTags")
all MTs get analyzed by sc auto
swharden_SWHLab
train
py
925ab3dbc0fc14d4921e619c68970945a85c4207
diff --git a/angel/test/test.py b/angel/test/test.py index <HASH>..<HASH> 100644 --- a/angel/test/test.py +++ b/angel/test/test.py @@ -185,7 +185,7 @@ class AngelListTestCase(unittest.TestCase): self.assertEqual(sorted(list(m_.iterkeys())), expected_message_keys) def test_press_id(self): - expected_keys = sorted(['title', 'url', 'created_at', 'updated_at', 'id', 'snippet', 'owner_type', 'posted_at', 'owner_id']) + expected_keys = sorted(['flags','image_url','title', 'url', 'created_at', 'updated_at', 'id', 'snippet', 'owner_type', 'posted_at', 'owner_id']) p_ = angel.get_press_by_id(990) self.assertEqual(sorted(list(p_.iterkeys())), expected_keys) self.assertEqual(int(p_['id']), 990)
updated test_press_id function to included glags an image url
bugra_angel-list
train
py
1d947e7ebd1a2aa40f4edaccc9c891c86f5e4ad6
diff --git a/lib/api_4_9.rb b/lib/api_4_9.rb index <HASH>..<HASH> 100644 --- a/lib/api_4_9.rb +++ b/lib/api_4_9.rb @@ -24,5 +24,15 @@ module Proj attach_function :pj_fwd3d, [ProjLPZ.by_value, :projPJ], ProjXYZ.by_value attach_function :pj_inv3d, [ProjXYZ.by_value, :projPJ], ProjLPZ.by_value attach_function :pj_transform, [:projPJ, :projPJ, :long, :int, :pointer, :pointer, :pointer], :bool + + if PROJ_VERSION < Gem::Version.new('5.0.0') + def proj_torad(value) + value * 0.017453292519943296 + end + + def proj_todeg(value) + value * 57.295779513082321 + end + end end end \ No newline at end of file
Backfill 2 missing functions in proj4.
cfis_proj4rb
train
rb
4ac7f52cd8737041997fe9cdfa5951ed8104ca80
diff --git a/.gitignore b/.gitignore index <HASH>..<HASH> 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules .DS_Store +*Stub.js diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,3 @@ -'use strict'; - var handlebars = require('handlebars'), read = require('fs').readFileSync, write = require('fs').writeFile; @@ -14,8 +12,8 @@ var handlebars = require('handlebars'), // }; module.exports = { - testGen: testGen -}; + testGen:testGen +} /** * Builds a unit test stubs for the response code of a path's operation diff --git a/test/minimal/test.js b/test/minimal/test.js index <HASH>..<HASH> 100644 --- a/test/minimal/test.js +++ b/test/minimal/test.js @@ -9,7 +9,8 @@ describe('minimal swagger', function(){ var output = testGen(swagger, { 'assertionFormat':'should', 'pathNames':[], - 'testmodule':'request' + 'testmodule':'request', + 'destination':'./test/minimal' }); assert.isArray(output);
fixed a bug with index.js
apigee-127_swagger-test-templates
train
gitignore,js,js
bab759f199c583d669975d5410e02a89a58e570f
diff --git a/buildbot/test/test_vc.py b/buildbot/test/test_vc.py index <HASH>..<HASH> 100644 --- a/buildbot/test/test_vc.py +++ b/buildbot/test/test_vc.py @@ -317,6 +317,11 @@ class BaseHelper: # specify. if type(command) not in (list, tuple): command = command.split(" ") + + # execute scripts through cmd.exe on windows, to avoid space in path issues + if sys.platform == 'win32' and command[0].lower().endswith('.cmd'): + command = [which('cmd.exe')[0], '/c', 'call'] + command + DEBUG = False if DEBUG: print "do %s" % command
(fixes #<I>) use 'call' with *.cmd on windows
buildbot_buildbot
train
py
f664cd48888f9155f9e0e881f5e78aa26d038bc4
diff --git a/tests/library/CM/Location/CliTest.php b/tests/library/CM/Location/CliTest.php index <HASH>..<HASH> 100644 --- a/tests/library/CM/Location/CliTest.php +++ b/tests/library/CM/Location/CliTest.php @@ -266,7 +266,7 @@ class CM_Location_CliTest extends CMTest_TestCase { public function testAddCountry() { $this->_import( array( - array('France', 'FR'), + array('United States', 'US'), ), array(), array(), @@ -283,8 +283,8 @@ class CM_Location_CliTest extends CMTest_TestCase { ); $this->_verify( array( - array('id' => 1, 'abbreviation' => 'FR', 'name' => 'France'), - array('id' => 2, 'abbreviation' => 'US', 'name' => 'United States'), + array('id' => 1, 'abbreviation' => 'US', 'name' => 'United States'), + array('id' => 2, 'abbreviation' => 'FR', 'name' => 'France'), ), array(), array(),
Tested that the original country ID is being kept
cargomedia_cm
train
php
057afdc1e6cadcb4102521edb604225da897965a
diff --git a/lib/generators/devise/install_generator.rb b/lib/generators/devise/install_generator.rb index <HASH>..<HASH> 100644 --- a/lib/generators/devise/install_generator.rb +++ b/lib/generators/devise/install_generator.rb @@ -11,7 +11,7 @@ module Devise source_root File.expand_path("../../templates", __FILE__) desc "Creates a Devise initializer and copy locale files to your application." - class_option :orm + class_option :orm, required: true def copy_initializer unless options[:orm]
Fix another thor deprecation warning in the install generator This one has been showing up when running tests: Deprecation warning: Expected string default value for '--orm'; got false (boolean). This will be rejected in the future unless you explicitly pass the options `check_default_type: false` or call `allow_incompatible_default_type!` in your code You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.
plataformatec_devise
train
rb
9c8a7f4308c3751c4ab3a01943619c45712ba265
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -202,7 +202,7 @@ module ActiveRecord # method. def while_preventing_writes(enabled = true, &block) if legacy_connection_handling - connection_handler.while_preventing_writes(enabled) + connection_handler.while_preventing_writes(enabled, &block) else connected_to(role: current_role, prevent_writes: enabled, &block) end
Fix `while_preventing_writes` for legacy version We need to pass the block along to the connection handler's `while_preventing_writes`.
rails_rails
train
rb
c3bc8e25c831be4a844569ee431ef4dda60115ee
diff --git a/okhttp/src/main/java/com/squareup/okhttp/internal/http/RouteSelector.java b/okhttp/src/main/java/com/squareup/okhttp/internal/http/RouteSelector.java index <HASH>..<HASH> 100644 --- a/okhttp/src/main/java/com/squareup/okhttp/internal/http/RouteSelector.java +++ b/okhttp/src/main/java/com/squareup/okhttp/internal/http/RouteSelector.java @@ -243,7 +243,7 @@ public final class RouteSelector { String socketHost; int socketPort; if (proxy.type() == Proxy.Type.DIRECT) { - socketHost = uri.getHost(); + socketHost = address.getUriHost(); socketPort = getEffectivePort(uri); } else { SocketAddress proxyAddress = proxy.address();
Be consistent about host names in RouteSelector. Use the host specified by the address, and not URI.getHost(). bug: <I> Change-Id: I2c<I>c2ce<I>dc<I>c8de6f<I>c0
square_okhttp
train
java
0c70547e82a26190453108795c36f19765da65d7
diff --git a/art/text_dic.py b/art/text_dic.py index <HASH>..<HASH> 100644 --- a/art/text_dic.py +++ b/art/text_dic.py @@ -209,6 +209,19 @@ text_dic={ | '--------------' | '----------------' ''', + "q":''' + .----------------. +| .--------------. | +| | ___ | | +| | .' '. | | +| | / .-. \ | | +| | | | | | | | +| | \ `-' \_ | | +| | `.___.\__| | | +| | | | +| '--------------' | + '----------------' +''', "r":''' .----------------. | .--------------. |
fix : q letter added to text_dic
sepandhaghighi_art
train
py
7d19d99dc2835d8f7988a1b1707bd11662633c70
diff --git a/submit/models.py b/submit/models.py index <HASH>..<HASH> 100644 --- a/submit/models.py +++ b/submit/models.py @@ -229,7 +229,7 @@ class Submission(models.Model): return True def can_reupload(self): # Re-upload should only be possible if the deadlines are not over, which is part of the withdrawal check - return (self.state in [self.TEST_COMPILE_FAILED, self.TEST_VALIDITY_FAILED]) and self.can_withdraw() + return (self.state in [self.TEST_COMPILE_FAILED, self.TEST_VALIDITY_FAILED, self.TEST_FULL_FAILED]) and self.can_withdraw() def is_withdrawn(self): return self.state == self.WITHDRAWN def is_closed(self):
Allow re-upload if validity test was fine
troeger_opensubmit
train
py
4fd94ce8142b61cbb485c0ffd6090f9322cda314
diff --git a/converters/toZigbee.js b/converters/toZigbee.js index <HASH>..<HASH> 100644 --- a/converters/toZigbee.js +++ b/converters/toZigbee.js @@ -1685,6 +1685,29 @@ const converters = { await endpoint.read('genAnalogInput', ['presentValue', 'description']); } }, + convertSet: async (entity, key, value, meta) => { + if (entity.clusters.hasOwnProperty('genLevelCtrl')) { + const value2 = parseInt(value); + if (isNaN(value2)) { + return; + } + const payload = {'currentLevel': value2}; + await entity.write('genLevelCtrl', payload); + return; + } + + if (entity.clusters.hasOwnProperty('genAnalogInput')) { + const value2 = parseFloat(value); + if (isNaN(value2)) { + return; + } + const payload = {'presentValue': value2}; + await entity.write('genAnalogInput', payload); + return; + } + + return; + }, }, // ubisys configuration / calibration converters
ptvo.switch: Added a converter for PWM outputs. (#<I>) * ptvo.switch: Added a converter for PWM outputs. * fix
Koenkk_zigbee-shepherd-converters
train
js
44d9e7438a149632e61d901c6fda85de72b55bdb
diff --git a/apiserver/facades/agent/instancemutater/lxdprofilewatcher.go b/apiserver/facades/agent/instancemutater/lxdprofilewatcher.go index <HASH>..<HASH> 100644 --- a/apiserver/facades/agent/instancemutater/lxdprofilewatcher.go +++ b/apiserver/facades/agent/instancemutater/lxdprofilewatcher.go @@ -553,13 +553,15 @@ func (w *machineLXDProfileWatcher) provisionedChange() error { if err != nil { return err } - instanceID, err := m.InstanceId() - if err != nil { + _, err = m.InstanceId() + if errors.IsNotProvisioned(err) { + logger.Debugf("machine-%s not provisioned yet", w.machine.Id()) + return nil + } else if err != nil { + logger.Criticalf("%q.provisionedChange error getting instanceID: %s", w.machine.Id(), err) return err } - if w.machine.Id() == string(instanceID) { - w.provisioned = true - } + w.provisioned = true logger.Debugf("notifying due to machine-%s now provisioned", w.machine.Id()) w.notify()
Check for NotProvisioned error. Returning any error from InstanceId is a bad idea, as the intention is to understand when a machine has been provisioned. If there is not InstanceID, a not provisioned error is returned, which is what provisionedChange cares able. Allow watcher to ignore NotProvisioned errors here.
juju_juju
train
go
1de19c0168701f0042ed7f3121d850d070378eb9
diff --git a/src/main/java/org/minimalj/backend/db/DbPersistence.java b/src/main/java/org/minimalj/backend/db/DbPersistence.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/minimalj/backend/db/DbPersistence.java +++ b/src/main/java/org/minimalj/backend/db/DbPersistence.java @@ -95,6 +95,9 @@ public class DbPersistence { return embeddedDataSource(null); } + // every JUnit test must have a fresh memory db + private static int memoryDbCount = 1; + public static DataSource embeddedDataSource(String file) { EmbeddedDataSource dataSource; try { @@ -104,7 +107,7 @@ public class DbPersistence { throw new IllegalStateException("Configuration error: Missing EmbeddedDataSource"); } - dataSource.setDatabaseName(file != null ? file : "memory:TempDB"); + dataSource.setDatabaseName(file != null ? file : "memory:TempDB" + (memoryDbCount++)); dataSource.setCreateDatabase("create"); return dataSource; }
DbPersistence: regression fix, tests were broken
BrunoEberhard_minimal-j
train
java
6f36ac36e6342170ad76914b06ea9e6c8b1a59e9
diff --git a/symphony/lib/toolkit/class.gateway.php b/symphony/lib/toolkit/class.gateway.php index <HASH>..<HASH> 100755 --- a/symphony/lib/toolkit/class.gateway.php +++ b/symphony/lib/toolkit/class.gateway.php @@ -65,7 +65,7 @@ $this->_scheme = $url_parsed['scheme']; } - $this->_port = 80; + $this->_port = NULL; if(isset($url_parsed['port'])){ $this->_port = $url_parsed['port']; } @@ -163,7 +163,7 @@ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, - "{$this->_scheme}://{$this->_host}" . (!is_null($this->_port) ? ':' . $this->_port : NULL) . $this->_path + sprintf("%s://%s%s%s", $this->_scheme, $this->_host, (!is_null($this->_port) ? ':' . $this->_port : NULL), $this->_path) ); curl_setopt($ch, CURLOPT_HEADER, $this->_returnHeaders); curl_setopt($ch, CURLOPT_USERAGENT, $this->_agent);
Gateway class will default the _port value to NULL rather than <I>. [Closes Issue #<I>]
symphonycms_symphony-2
train
php
4bd9b038f4d0321f8a2c2ae4244d6c63ebf113a9
diff --git a/lib/ronin/repository.rb b/lib/ronin/repository.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/repository.rb +++ b/lib/ronin/repository.rb @@ -610,30 +610,6 @@ module Ronin end # - # Runs a Ruby script in the `bin/` directory of the repository. - # - # @param [String] script - # The name of the script to run. - # - # @return [Boolean] - # Specifies the script was ran. - # - # @raise [RuntimeError] - # The script was not found in the `bin/` directory of the repository. - # - # @since 1.0.0 - # - def run(script) - script_path = @bin_dir.join(script) - - unless script_path.file? - raise("no such script #{script.dump} in Repository #{self}") - end - - load script_path - end - - # # Converts the repository to a String. # # @return [String]
Removed Repository.run for now.
ronin-ruby_ronin
train
rb
6b060e56667940176c234fb3fdc6ce8c6a02d5a1
diff --git a/tests/unit/test_matchers.py b/tests/unit/test_matchers.py index <HASH>..<HASH> 100644 --- a/tests/unit/test_matchers.py +++ b/tests/unit/test_matchers.py @@ -39,4 +39,4 @@ def test_metchers(): assert_matcher('method') assert_matcher('host') assert_matcher('port') - #assert_matcher('method') + assert_matcher('path') diff --git a/vcr/request.py b/vcr/request.py index <HASH>..<HASH> 100644 --- a/vcr/request.py +++ b/vcr/request.py @@ -24,6 +24,10 @@ class Request(object): return urlparse(self.uri).port @property + def path(self): + return urlparse(self.uri).path + + @property def url(self): return self.uri
Added path to Request with matcher and test
kevin1024_vcrpy
train
py,py
692cf43b24c855116617e95a7b8e8c852a3e7e4a
diff --git a/lib/load-grunt-configs.js b/lib/load-grunt-configs.js index <HASH>..<HASH> 100644 --- a/lib/load-grunt-configs.js +++ b/lib/load-grunt-configs.js @@ -31,7 +31,8 @@ module.exports = function(grunt, options){ taskconfig = taskconfig.tasks; }else{ var tasks = {}; - tasks[path.basename(filepath).replace(/\.+(js||json||coffee)$/, '')] = taskconfig; + var taskname = path.basename(filepath).replace(path.extname(filepath), ''); + tasks[taskname] = taskconfig; taskconfig = tasks; }
extracts taskname regardless of file extension
creynders_load-grunt-configs
train
js
511ef93a41d3b41272c768d2e9e03bf637e4c3a7
diff --git a/closure/goog/messaging/abstractchannel.js b/closure/goog/messaging/abstractchannel.js index <HASH>..<HASH> 100644 --- a/closure/goog/messaging/abstractchannel.js +++ b/closure/goog/messaging/abstractchannel.js @@ -203,7 +203,6 @@ goog.messaging.AbstractChannel.prototype.decodePayload = function( /** @override */ goog.messaging.AbstractChannel.prototype.disposeInternal = function() { goog.base(this, 'disposeInternal'); - goog.dispose(this.logger); delete this.logger; delete this.services_; delete this.defaultService_;
Don't attempt to dispose of a non-disposable logger. R=nweiz DELTA=1 (0 added, 1 deleted, 0 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=<I> git-svn-id: <URL>
google_closure-library
train
js
c84059ec5127536b4147bc02b7d2e86d87a4f0e5
diff --git a/lib/mshoplib/src/MShop/Locale/Item/Default.php b/lib/mshoplib/src/MShop/Locale/Item/Default.php index <HASH>..<HASH> 100644 --- a/lib/mshoplib/src/MShop/Locale/Item/Default.php +++ b/lib/mshoplib/src/MShop/Locale/Item/Default.php @@ -45,6 +45,15 @@ class MShop_Locale_Item_Default /** + * Clones internal objects of the locale item. + */ + public function __clone() + { + $this->_site = ( isset( $this->_site ) ? clone $this->_site : null ); + } + + + /** * Returns the site item object. * * @return MShop_Locale_Item_Site_Interface Site item object
Fixes cloning locale item by copying the inner site item object
Arcavias_arcavias-core
train
php
cd7a758acd764231c1c99c0f0b27eaeaaa444798
diff --git a/dht/dht.go b/dht/dht.go index <HASH>..<HASH> 100644 --- a/dht/dht.go +++ b/dht/dht.go @@ -626,7 +626,7 @@ func (s *Server) GetPeers(infoHash string) (ps *peerStream, err error) { done := make(chan struct{}) pending := 0 s.mu.Lock() - for _, n := range s.nodes { + for _, n := range s.closestGoodNodes(160, infoHash) { var t *transaction t, err = s.getPeers(n.addr, infoHash) if err != nil { @@ -727,13 +727,22 @@ func (s *Server) Bootstrap() (err error) { } s.mu.Lock() // log.Printf("now have %d nodes", len(s.nodes)) - if len(s.nodes) >= 8*160 { + if s.numGoodNodes() >= 160 { break } } return } +func (s *Server) numGoodNodes() (num int) { + for _, n := range s.nodes { + if n.Good() { + num++ + } + } + return +} + func (s *Server) NumNodes() int { s.mu.Lock() defer s.mu.Unlock()
dht: Message only the most likely peers
anacrolix_torrent
train
go
d0bb845fc5bd981b162b0b2640e4c4d0cecbd3bc
diff --git a/engine/core/src/main/java/org/datacleaner/connection/JdbcDatastore.java b/engine/core/src/main/java/org/datacleaner/connection/JdbcDatastore.java index <HASH>..<HASH> 100644 --- a/engine/core/src/main/java/org/datacleaner/connection/JdbcDatastore.java +++ b/engine/core/src/main/java/org/datacleaner/connection/JdbcDatastore.java @@ -265,6 +265,12 @@ public class JdbcDatastore extends UsageAwareDatastore<UpdateableDataContext> im return new DataSourceDatastoreConnection(dataSource, getTableTypes(), _catalogName, this); } else { final Connection connection = createConnection(); + try { + connection.setAutoCommit(false); + } catch (SQLException e) { + logger.error("Could not set autocommit false '{}'", _datasourceJndiUrl); + throw new IllegalStateException(e); + } final UpdateableDataContext dataContext = new JdbcDataContext(connection, getTableTypes(), _catalogName); return new UpdateableDatastoreConnectionImpl<UpdateableDataContext>(dataContext, this); }
fixes #<I>. fixed the exception for jtds driver in case of single connections
datacleaner_DataCleaner
train
java
eb6b483fc1bcb1792079f2db6483d0d810c52e5d
diff --git a/DependencyInjection/Driver/AbstractDriver.php b/DependencyInjection/Driver/AbstractDriver.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Driver/AbstractDriver.php +++ b/DependencyInjection/Driver/AbstractDriver.php @@ -122,18 +122,15 @@ abstract class AbstractDriver implements DriverInterface $definition = new Definition($factoryClass); + $definitionArgs = [$modelClass]; if (in_array(TranslatableFactoryInterface::class, class_implements($factoryClass))) { $decoratedDefinition = new Definition(Factory::class); - $decoratedDefinition->setArguments([$modelClass]); + $decoratedDefinition->setArguments($definitionArgs); - $definition->setArguments([$decoratedDefinition, new Reference('sylius_resource.translation.locale_provider')]); - - $container->setDefinition($metadata->getServiceId('factory'), $definition); - - return; + $definitionArgs = [$decoratedDefinition, new Reference('sylius_resource.translation.locale_provider')]; } - $definition->setArguments([$modelClass]); + $definition->setArguments($definitionArgs); $container->setDefinition($metadata->getServiceId('factory'), $definition); }
Refactor AbstractDriver addFactory method
Sylius_SyliusResourceBundle
train
php
b450e4e192a0833ddd2cee21cc553d21878c6d35
diff --git a/proselint/version.py b/proselint/version.py index <HASH>..<HASH> 100644 --- a/proselint/version.py +++ b/proselint/version.py @@ -1 +1,3 @@ +"""Wallace version number.""" + __version__ = "0.2.0"
Add a docstring to the version file
amperser_proselint
train
py
1adf48f0be9f34fb1a69ccf33487d1b5c0f45133
diff --git a/extensions/lib/shoebotit/ide_utils.py b/extensions/lib/shoebotit/ide_utils.py index <HASH>..<HASH> 100644 --- a/extensions/lib/shoebotit/ide_utils.py +++ b/extensions/lib/shoebotit/ide_utils.py @@ -56,7 +56,7 @@ class ShoebotProcess(object): def __init__(self, code, use_socketserver, show_varwindow, use_fullscreen, title, cwd=None, handle_stdout=None, handle_stderr=None, sbot=None): if sbot is None: sbot = 'sbot' - command = ['sbot', '-w', '-t%s' % title] + command = [sbot, '-w', '-t%s' % title] if use_socketserver: command.append('-s')
Virtualenv picker pref wasn't actually used..
shoebot_shoebot
train
py
4368520e92eac37a1fd31733b18c578296fdd91e
diff --git a/backends/dynamo.go b/backends/dynamo.go index <HASH>..<HASH> 100644 --- a/backends/dynamo.go +++ b/backends/dynamo.go @@ -221,6 +221,14 @@ func (self *DynamoBackend) cacheTable(name string) (*dal.Collection, error) { IdentityFieldType: self.toDalType(table.HashKeyType), } + collection.AddFields(dal.Field{ + Name: table.HashKey, + Identity: true, + Key: true, + Required: true, + Type: self.toDalType(table.HashKeyType), + }) + if rangeKey := table.RangeKey; rangeKey != `` { collection.AddFields(dal.Field{ Name: rangeKey,
backends: Adding Dynamo identity fields to schema generation
ghetzel_pivot
train
go
08c26499f3dc5ecfae141b6b7ce65cb2c3d5f519
diff --git a/src/rinoh/flowable.py b/src/rinoh/flowable.py index <HASH>..<HASH> 100644 --- a/src/rinoh/flowable.py +++ b/src/rinoh/flowable.py @@ -459,10 +459,11 @@ class GroupedFlowablesState(FlowableState): def next_flowable(self): try: - result = self.flowables[self._index] + result = self.flowables[self._index], self.first_flowable_state except IndexError: raise StopIteration self._index += 1 + self.first_flowable_state = None return result def prepend(self, first_flowable_state): @@ -545,16 +546,15 @@ class GroupedFlowables(Flowable): def _flow_with_next(self, state, container, descender, space_below=0, **kwargs): try: - flowable = state.next_flowable() + flowable, flowable_state = state.next_flowable() while flowable.is_hidden(container): - flowable = state.next_flowable() + flowable, flowable_state = state.next_flowable() except StopIteration: raise LastFlowableException(descender) flowable.parent = self with MaybeContainer(container) as maybe_container: max_flowable_width, top_to_baseline, descender = \ - flowable.flow(maybe_container, descender, - state=state.first_flowable_state, + flowable.flow(maybe_container, descender, state=flowable_state, space_below=space_below if state.at_end else 0, **kwargs) state.initial = False
GroupedFlowablesState.next_flowable(): also return flowable state
brechtm_rinohtype
train
py
68f85bf4b7c11b0d4be780f871152515947a2714
diff --git a/src/main/java/io/reactivex/Flowable.java b/src/main/java/io/reactivex/Flowable.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/reactivex/Flowable.java +++ b/src/main/java/io/reactivex/Flowable.java @@ -3478,7 +3478,7 @@ public abstract class Flowable<T> implements Publisher<T> { @BackpressureSupport(BackpressureKind.NONE) @SchedulerSupport(SchedulerSupport.NONE) - public final Observable<T> toNbpObservable() { + public final Observable<T> toObservable() { return Observable.fromPublisher(this); }
Correct method name for Flowable-->Observable. (#<I>)
ReactiveX_RxJava
train
java
f69dcdb39c7d31c101a07df7a33d6ee855e1cb9f
diff --git a/grimoire_elk/enriched/enrich.py b/grimoire_elk/enriched/enrich.py index <HASH>..<HASH> 100644 --- a/grimoire_elk/enriched/enrich.py +++ b/grimoire_elk/enriched/enrich.py @@ -357,7 +357,7 @@ class Enrich(ElasticItems): items = ocean_backend.fetch() - url = self.elastic.index_url + '/items/_bulk' + url = self.elastic.get_bulk_url() logger.debug("Adding items to {} (in {} packs)".format(self.elastic.anonymize_url(url), max_items)) @@ -481,22 +481,7 @@ class Enrich(ElasticItems): """ Custom analyzers for our indexes """ analyzers = ''' - { - "analysis" : { - "tokenizer" : { - "comma" : { - "type" : "pattern", - "pattern" : "," - } - }, - "analyzer" : { - "comma" : { - "type" : "custom", - "tokenizer" : "comma" - } - } - } - } + {} ''' return analyzers
[enriched-enrich] Update bulk endpoint for ODFE This code updates the bulk endpoint to correctly handle data for ODFE distro. Furthermore, analyzers setting are removed from the mappings.
chaoss_grimoirelab-elk
train
py
3cc3db06e07baa87850ad1fe5ee753d5620ccf59
diff --git a/lib/app.js b/lib/app.js index <HASH>..<HASH> 100644 --- a/lib/app.js +++ b/lib/app.js @@ -18,6 +18,7 @@ var apres = require('apres') , mongoStore = require('connect-mongo')(express) , routes = require('../routes') , websockets = require('./websockets') + , models = require('./models') , routes_admin = require('../routes/admin/index.js') , routes_jobs = require('../routes/jobs/index.js') @@ -84,11 +85,20 @@ var init = exports.init = function (config) { secret: config.session_secret, store: session_store, cookie: {maxAge: MONTH_IN_MILLISECONDS} })); + + app.use(function(req, res, next){ + res.locals.models = models; + next(); + }) + auth.setup(app); // app.use(passport) is included app.use(express.static(__dirname + '/../public', {maxAge: MONTH_IN_MILLISECONDS})); + apres.helpExpress(app); app.use(app.router); + + app.use(function(req, res, next) { var user_created_timestamp=0; if (req.user !== undefined) {
add models to locals() so they're available to plugins
Strider-CD_strider
train
js
975143c4dbb110bb1ce8baf4b21d9ade6ea4a166
diff --git a/src/main/java/org/primefaces/renderkit/InputRenderer.java b/src/main/java/org/primefaces/renderkit/InputRenderer.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/primefaces/renderkit/InputRenderer.java +++ b/src/main/java/org/primefaces/renderkit/InputRenderer.java @@ -73,7 +73,11 @@ public abstract class InputRenderer extends CoreRenderer { Collection collection = (Collection) value; for(Iterator it = collection.iterator(); it.hasNext();) { - selectItems.add(createSelectItem(context, uiSelectItems, it.next())); + Object item = it.next(); + if(item instanceof SelectItem) + selectItems.add((SelectItem) item); + else + selectItems.add(createSelectItem(context, uiSelectItems, item)); } } }
Fixed collection of selectitems issue
primefaces_primefaces
train
java
055e10632db5349db5b6eab146c9038176df64f8
diff --git a/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java b/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java index <HASH>..<HASH> 100644 --- a/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +++ b/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java @@ -97,8 +97,13 @@ public class NetRequest oSession.logout(); if ( code != IHttpConnection.HTTP_INTERNAL_ERROR ) + { buffer = readFully(is); - + + if ( code == IHttpConnection.HTTP_MOVED_TEMPORARILY || + code == IHttpConnection.HTTP_MOVED_PERMANENTLY ) + LOG.INFO("Response body: " + buffer.toString() ); + } }else { long len = m_connection.getLength();
Add logging body in case of moved_xxx server response
rhomobile_rhodes
train
java
784ddd5828cc98aebdbaf797964ede6ad91cffe8
diff --git a/checkers/utils.py b/checkers/utils.py index <HASH>..<HASH> 100644 --- a/checkers/utils.py +++ b/checkers/utils.py @@ -151,8 +151,10 @@ def is_defined_before(var_node): if ass_node.name == varname: return True elif isinstance(_node, astroid.With): - if not _node.expr.parent_of(var_node): - if _node.vars and _node.vars.name == varname: + for expr, vars in _node.items: + if expr.parent_of(var_node): + break + if vars and vars.name == varname: return True elif isinstance(_node, (astroid.Lambda, astroid.Function)): if _node.args.is_argument(varname):
Handle new astroid With nodes 'expr' and 'vars' have been replaced by an 'items' list.
PyCQA_pylint
train
py
30cd24d807891b24f569d0826dd83a0f4c26dfa2
diff --git a/system/Database/Seeder.php b/system/Database/Seeder.php index <HASH>..<HASH> 100644 --- a/system/Database/Seeder.php +++ b/system/Database/Seeder.php @@ -41,6 +41,7 @@ namespace CodeIgniter\Database; use CodeIgniter\CLI\CLI; use CodeIgniter\Config\BaseConfig; +use CodeIgniter\Database\Forge; /** * Class Seeder @@ -122,6 +123,8 @@ class Seeder } $this->db = & $db; + + $this->forge = \Config\Database::forge($this->DBGroup); } //--------------------------------------------------------------------
Bug: '' Property in Seeder Class Never Initialize #<I>
codeigniter4_CodeIgniter4
train
php
c97c866cd7ec606612a263c7eda2161c76ab3a99
diff --git a/lib/create-http-client.js b/lib/create-http-client.js index <HASH>..<HASH> 100644 --- a/lib/create-http-client.js +++ b/lib/create-http-client.js @@ -76,7 +76,7 @@ export default function createHttpClient (axios, options) { config.basePath = `/${config.basePath.split('/').filter(Boolean).join('/')}` } - const baseURL = `${protocol}://${hostname}:${port}${config.basePath}/spaces/${space}` + const baseURL = options.baseURL || `${protocol}://${hostname}:${port}${config.basePath}/spaces/${space}` config.headers['Authorization'] = 'Bearer ' + config.accessToken
fix(http-client): keep baseURL when passed as option
contentful_contentful-sdk-core
train
js
bb94c3575c0ee3eee68da896d824a1c0ee750d90
diff --git a/internal/jobcontainers/jobcontainer.go b/internal/jobcontainers/jobcontainer.go index <HASH>..<HASH> 100644 --- a/internal/jobcontainers/jobcontainer.go +++ b/internal/jobcontainers/jobcontainer.go @@ -218,7 +218,9 @@ func (c *JobContainer) CreateProcess(ctx context.Context, config interface{}) (_ Path: absPath, Args: splitArgs(commandLine), SysProcAttr: &syscall.SysProcAttr{ - CreationFlags: windows.CREATE_NEW_PROCESS_GROUP, + // CREATE_BREAKAWAY_FROM_JOB to make sure that we're not inheriting the job object (and by extension its limits) + // from whatever process is running this code. + CreationFlags: windows.CREATE_NEW_PROCESS_GROUP | windows.CREATE_BREAKAWAY_FROM_JOB, Token: syscall.Token(token), }, }
Set CREATE_BREAKAWAY_FROM_JOB flag for job container processes We don't want to inherit the job object of whatever process is running the job container code (the containerd-shim generally but this would apply for any process). Set the CREATE_BREAKAWAY_FROM_JOB flag on job container processes to prevent this from happening. The job object itself will also need to have the JOB_OBJECT_LIMIT_BREAKAWAY_OK limit set for this to take affect.
Microsoft_hcsshim
train
go
b25454632258fda8367947d0e5640585406d3b62
diff --git a/javamelody-core/src/main/java/net/bull/javamelody/SessionInformations.java b/javamelody-core/src/main/java/net/bull/javamelody/SessionInformations.java index <HASH>..<HASH> 100644 --- a/javamelody-core/src/main/java/net/bull/javamelody/SessionInformations.java +++ b/javamelody-core/src/main/java/net/bull/javamelody/SessionInformations.java @@ -141,7 +141,16 @@ class SessionInformations implements Serializable { remoteAddr = addr.toString(); } - final Object user = session.getAttribute(SESSION_REMOTE_USER); + Object user = session.getAttribute(SESSION_REMOTE_USER); + if (user == null) { + // si getRemoteUser() n'était pas renseigné, on essaye ACEGI_SECURITY_LAST_USERNAME + // (notamment pour Hudson/Jenkins) + user = session.getAttribute("ACEGI_SECURITY_LAST_USERNAME"); + if (user == null) { + // et sinon SPRING_SECURITY_LAST_USERNAME + user = session.getAttribute("SPRING_SECURITY_LAST_USERNAME"); + } + } if (user == null) { remoteUser = null; } else {
To display the username in the list of http sessions, look at ACEGI_SECURITY_LAST_USERNAME and SPRING_SECURITY_LAST_USERNAME if getRemoteUser() was null (In particular, for Jenkins/Hudson)
javamelody_javamelody
train
java
c7847bac01e4f5c67f7960d0eea85f4e32130315
diff --git a/tweepy/parsers.py b/tweepy/parsers.py index <HASH>..<HASH> 100644 --- a/tweepy/parsers.py +++ b/tweepy/parsers.py @@ -73,10 +73,15 @@ class ModelParser(JSONParser): else: cursors = None - if payload_list: - result = model.parse_list(api, json) - else: - result = model.parse(api, json) + try: + if payload_list: + result = model.parse_list(api, json) + else: + result = model.parse(api, json) + except KeyError: + raise TweepyException( + f"Unable to parse response payload: {json}" + ) from None if cursors: return result, cursors
Handle Twitter API errors with successful HTTP status codes
tweepy_tweepy
train
py
ca7739491009a52a2af4eea4c3751d7420f7603c
diff --git a/lib/coral_core/mixin/action/node.rb b/lib/coral_core/mixin/action/node.rb index <HASH>..<HASH> 100644 --- a/lib/coral_core/mixin/action/node.rb +++ b/lib/coral_core/mixin/action/node.rb @@ -30,7 +30,7 @@ module Node # Operations def node_exec - status = Coral.code.unknown_status + status = code.unknown_status # Load network if it exists network_config = extended_config(:network, { @@ -53,16 +53,16 @@ module Node nodes.each do |node| batch.add(node.name) do node.action(plugin_provider, settings) - Coral.code.success + code.success end end else # Reduce to single status - status = Coral.code.success + status = code.success batch.each do |name, code| - if code != Coral.code.success - status = Coral.code.batch_error + if code != code.success + status = code.batch_error break end end
Fixing return code issues in the node action mixin.
coralnexus_corl
train
rb
594c93416b23fb69a40269f1a7bc14b942313dfa
diff --git a/core/server/worker/src/main/java/alluxio/worker/block/evictor/EvictionPlan.java b/core/server/worker/src/main/java/alluxio/worker/block/evictor/EvictionPlan.java index <HASH>..<HASH> 100644 --- a/core/server/worker/src/main/java/alluxio/worker/block/evictor/EvictionPlan.java +++ b/core/server/worker/src/main/java/alluxio/worker/block/evictor/EvictionPlan.java @@ -39,8 +39,8 @@ public final class EvictionPlan { */ public EvictionPlan(List<BlockTransferInfo> toTransfer, List<Pair<Long, BlockStoreLocation>> toEvict) { - mToMove = Preconditions.checkNotNull(toTransfer); - mToEvict = Preconditions.checkNotNull(toEvict); + mToMove = Preconditions.checkNotNull(toTransfer, "toTransfer"); + mToEvict = Preconditions.checkNotNull(toEvict, "toEvict"); } /**
Supply the variable name to Preconditions.checkNotNull in alluxio.worker.block.evictor.EvictionPlan#EvictionPlan (#<I>)
Alluxio_alluxio
train
java
49179c6feeef96375ee1dfa20219b742be501942
diff --git a/pandasdmx/model.py b/pandasdmx/model.py index <HASH>..<HASH> 100644 --- a/pandasdmx/model.py +++ b/pandasdmx/model.py @@ -263,12 +263,6 @@ class Item(NameableArtefact): return self._reader._item_children(self) -class Structure(MaintainableArtefact): - # the groupings are added in subclasses as class attributes. - # This deviates from the info model - pass - - class StructureUsage(MaintainableArtefact): @property @@ -508,11 +502,11 @@ class Categorisation(MaintainableArtefact): Ref, self, offset='ref_source') -class DataflowDefinition(StructureUsage, Constrainable): +class DataflowDefinition(Constrainable, StructureUsage): pass -class ProvisionAgreement(StructureUsage, Constrainable): +class ProvisionAgreement(Constrainable, StructureUsage): pass @@ -530,7 +524,7 @@ class DataAttribute(Component): return self._reader.read_as_str('assignment_status', self) -class DataStructureDefinition(Structure, Constrainable): +class DataStructureDefinition(Constrainable, MaintainableArtefact): def __init__(self, *args, **kwargs): super(DataStructureDefinition, self).__init__(*args, **kwargs)
model: fix MRO for Constrainables, remove Structure class. It is not needed.
dr-leo_pandaSDMX
train
py
80544ab5faeb00876935f4ffd45fbedeb11ca2eb
diff --git a/angr/analyses/cfg.py b/angr/analyses/cfg.py index <HASH>..<HASH> 100644 --- a/angr/analyses/cfg.py +++ b/angr/analyses/cfg.py @@ -2712,7 +2712,7 @@ class CFG(Analysis, CFGBase): :return: None """ - for cfg_node in self._nodes: + for cfg_node in self._nodes.itervalues(): cfg_node.downsize() register_analysis(CFG, 'CFG')
typo fix in CFG.downsize()
angr_angr
train
py
798e460ce3f7a67f23aab0fa9e0c7200a0fa46ce
diff --git a/kettle/make_db.py b/kettle/make_db.py index <HASH>..<HASH> 100755 --- a/kettle/make_db.py +++ b/kettle/make_db.py @@ -66,7 +66,8 @@ class GCSClient: try: return resp.json() except json.decoder.JSONDecodeError: - logging.exception('Failed to decode request for %s', path) + logging.exception('Failed to decode request for %s', + urllib.parse.unquote(url)) return None return resp.text except requests.exceptions.RequestException: @@ -84,7 +85,7 @@ class GCSClient: """Get an object from GCS.""" bucket, path = self._parse_uri(path) return self._request(f'{bucket}/o/{urllib.parse.quote(path, "")}', - {'alt': 'media'}, as_json=as_json) + {}, as_json=as_json) def ls(self, path,
Fix Json decode failure in requesting bucket artifacts This seems to be caused by alt=media which I can not find docs on <URL>
kubernetes_test-infra
train
py
20886fb64dffbcb8c4b019faf720253392ac2f19
diff --git a/src/scripts/dataset/dataset.store.js b/src/scripts/dataset/dataset.store.js index <HASH>..<HASH> 100644 --- a/src/scripts/dataset/dataset.store.js +++ b/src/scripts/dataset/dataset.store.js @@ -431,8 +431,11 @@ let datasetStore = Reflux.createStore({ * Update README */ updateREADME(value, callback) { + let dataset = this.data.dataset; scitran.updateFileFromString('projects', this.data.dataset._id, 'README', value, '', [], (err, res) => { callback(err, res); + dataset.README = value; + this.update({dataset}); this.updateModified(); }); }, @@ -949,7 +952,7 @@ let datasetStore = Reflux.createStore({ callback({error: 'You cannot snapshot an invalid dataset. Please fix the errors and try again.'}); } else { let latestSnapshot = this.data.snapshots[1]; - if (latestSnapshot && (moment(project.modified).diff(moment(latestSnapshot.modified)) <= 0)) { + if (latestSnapshot && (moment(this.data.dataset.modified).diff(moment(latestSnapshot.modified)) <= 0)) { callback({error: 'No modifications have been made since the last snapshot was created. Please use the most recent snapshot.'}); } else { scitran.createSnapshot(datasetId, (err, res) => {
Ensure dataset can be snapshotted immediately after a readme modification
OpenNeuroOrg_openneuro
train
js
3e1b81dc9143094528f6500d4263f39b0ee0daa9
diff --git a/source/php/Editor.php b/source/php/Editor.php index <HASH>..<HASH> 100644 --- a/source/php/Editor.php +++ b/source/php/Editor.php @@ -343,7 +343,7 @@ class Editor extends \Modularity\Options continue; } - $retModules[$key]['modules'][$arrayIndex] = $modules[$moduleId]; + $retModules[$key]['modules'][$arrayIndex] = clone $modules[$moduleId]; // Get the post type name and append it to the module post data $retModules[$key]['modules'][$arrayIndex]->post_type_name = $available[$retModules[$key]['modules'][$arrayIndex]->post_type]['labels']['name'];
Fixes issue where modules shared settings if they had same content
helsingborg-stad_Modularity
train
php
effb3cad6fc07f58f427fda4663c1b2136c0d899
diff --git a/lib/command_lion/app.rb b/lib/command_lion/app.rb index <HASH>..<HASH> 100644 --- a/lib/command_lion/app.rb +++ b/lib/command_lion/app.rb @@ -173,6 +173,7 @@ module CommandLion if args.empty? args = Raw.arguments_to(cmd.flags.long, flags) end + return nil if args.nil? case cmd.type when :stdin args = STDIN.gets.strip
Slightly better args error catch when parsing arguments Should revise this strategy at some point.
picatz_command_lion
train
rb
6c52f6af83a1b0a0d55a21dce60d69821ae7e089
diff --git a/scopus/scopus_search.py b/scopus/scopus_search.py index <HASH>..<HASH> 100644 --- a/scopus/scopus_search.py +++ b/scopus/scopus_search.py @@ -1,4 +1,3 @@ -import warnings from collections import namedtuple from scopus.classes import Search @@ -7,19 +6,6 @@ from scopus.utils import listify class ScopusSearch(Search): @property - def EIDS(self): - """Outdated property, will be removed in a future release. Please use - get_eids() instead. For details see - https://scopus.readthedocs.io/en/latest/tips.html#migration-guide-to-0-x-to-1-x. - """ - text = "Outdated property, will be removed in a future release. "\ - "Please use get_eids() instead. For details see "\ - "https://scopus.readthedocs.io/en/latest/tips.html#"\ - "migration-guide-to-0-x-to-1-x." - warnings.warn(text, DeprecationWarning) - return self.get_eids() - - @property def results(self): """A list of namedtuples in the form (eid doi pii pubmed_id title subtype creator afid affilname affiliation_city affiliation_country
Remove deprecated attribute EIDS
scopus-api_scopus
train
py
bd632225bf60d3f831e28970812728d9b6a7f906
diff --git a/lib/Channel.js b/lib/Channel.js index <HASH>..<HASH> 100644 --- a/lib/Channel.js +++ b/lib/Channel.js @@ -390,6 +390,7 @@ Channel.PACKET_SIZE = PACKET_SIZE; function windowAdjust(self, amt) { amt = amt || MAX_WINDOW; + self.incoming.window += amt; return self._client._sshstream.channelWindowAdjust(self.outgoing.id, amt); }
Channel: add missing incoming window increment
mscdex_ssh2
train
js
bf0be69953674ff3295fe986f62131b0103a7d28
diff --git a/sdk/src/core/cc.searchService.js b/sdk/src/core/cc.searchService.js index <HASH>..<HASH> 100644 --- a/sdk/src/core/cc.searchService.js +++ b/sdk/src/core/cc.searchService.js @@ -38,7 +38,7 @@ cc.define('cc.SearchService', function(configService, $http, $q, applier){ url: endpoint, params: { q: createSearchCommand(normalizeUmlauts(searchStr)), - fetch: 'text, categoryUrlKey, categoryName, productUrlKey' + fetch: 'text, categoryUrlKey, categoryName, productUrlKey, productImageUrl' } }) .then(function(response){
feat(searchService): provide productImageUrl for results
sofa_sofa-couch-service
train
js
a8a09742458b16b526cc8b12eb0ee241827de28f
diff --git a/dpr/server.go b/dpr/server.go index <HASH>..<HASH> 100644 --- a/dpr/server.go +++ b/dpr/server.go @@ -79,7 +79,7 @@ func (server *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() log.Println(r.Method + " http://" + r.Host + r.URL.String()) res := server.newResource(r) - w.Header().Set("X-Docker-Registry-Version", "0.0.1") + w.Header().Set("X-Docker-Registry-Version", "0.6.0") w.Header().Add("X-Docker-Endpoints", r.Host) switch r.Method { case "PUT":
bumped docker registry version provided with requests
dynport_dgtk
train
go
80d4eeecf23a8b602ebda1ab6f71e4fd5e6cb7b7
diff --git a/src/Engines/QueryBuilderEngine.php b/src/Engines/QueryBuilderEngine.php index <HASH>..<HASH> 100644 --- a/src/Engines/QueryBuilderEngine.php +++ b/src/Engines/QueryBuilderEngine.php @@ -220,14 +220,14 @@ class QueryBuilderEngine extends BaseEngine implements DataTableEngineContract $column = $this->castColumn($column); if ($this->isCaseInsensitive()) { if ($this->request->isRegex($i)) { - $this->query->whereRaw('LOWER(' . $column . ') REGEXP ?', [Str::lower($keyword)]); + $this->query->whereRaw(' REGEXP_LIKE( LOWER('.$column.') , ?, \'i\' )', [$keyword]); } else { $this->query->whereRaw('LOWER(' . $column . ') LIKE ?', [Str::lower($keyword)]); } } else { $col = strstr($column, '(') ? $this->connection->raw($column) : $column; if ($this->request->isRegex($i)) { - $this->query->whereRaw($col . ' REGEXP ?', [$keyword]); + $this->query->whereRaw(' REGEXP_LIKE( '.$col.' , ? )', [$keyword]); } else { $this->query->whereRaw($col . ' LIKE ?', [$keyword]); }
Change how regex code is generated after a column search. Before this change, regex statements were generated with the MySQL operator 'REGEXP', which were leading to a Oracle error. Now it uses the Oracle Database SQL function 'REGEXP_LIKE', as written in the Oracle Database Online Documentation, <I>g Release 2 (<I>) .
yajra_laravel-datatables
train
php
6423f6ae85ddf0c50902e7ad61ec4f97efa2db73
diff --git a/mets.py b/mets.py index <HASH>..<HASH> 100644 --- a/mets.py +++ b/mets.py @@ -138,9 +138,7 @@ class MDRef(object): } if XPTR: attrib['XPTR'] = XPTR - el = etree.Element('mdRef', attrib=attrib) - - return el + return etree.Element('mdRef', attrib=attrib) class MDWrap(object):
MDRef: style nit
artefactual-labs_mets-reader-writer
train
py
a7c7420268b57f0bca6656a47c835b114472ef02
diff --git a/packages/build/css/glamor-to-css.js b/packages/build/css/glamor-to-css.js index <HASH>..<HASH> 100644 --- a/packages/build/css/glamor-to-css.js +++ b/packages/build/css/glamor-to-css.js @@ -4,9 +4,9 @@ const jsToCss = require('./js-to-css.js') function glamorToCss(obj) { return ( - convertKeyframes(filterKeyframes(obj)) + - convertAnimations(filterAnimationFunctions(obj)) + - convertCssWithGlamor(filterNonKeyframes(obj)) + convertKeyframes(filterKeyframes(obj.default)) + + convertAnimations(filterAnimationFunctions(obj.default)) + + convertCssWithGlamor(filterNonKeyframes(obj.default)) ) }
fix(build): handle esm styles in cjs-based css build
pluralsight_design-system
train
js
955c10e4eb70e657dc5cdd2a0bc4810cb14ba1bf
diff --git a/custodian/qchem/handlers.py b/custodian/qchem/handlers.py index <HASH>..<HASH> 100644 --- a/custodian/qchem/handlers.py +++ b/custodian/qchem/handlers.py @@ -80,6 +80,8 @@ class QChemErrorHandler(ErrorHandler, MSONable): actions.append(act) else: return {"errors": self.errors, "actions": None} + elif e == "Geometry optimization failed": + pass self.qcinp.write_file(self.input_file) return {"errors": self.errors, "actions": actions} @@ -146,6 +148,14 @@ class QChemErrorHandler(ErrorHandler, MSONable): self.fix_step.set_scf_initial_guess("gwh") else: raise ValueError("fix method " + method + "is not supported") + strategy_text = "<SCF Fix Strategy>" + strategy_text += json.dumps(strategy, indent=4, sort_keys=TRue) + strategy_text += "</SCF Fix Strategy>" + if len(old_strategy_text) > 0: + comments = scf_pattern.sub(strategy_text, comments) + else: + comments = strategy_text + self.fix_step.params["comments"] = comments return method def backup(self):
append SCF fix strategy to the comments section of QChem input file
materialsproject_custodian
train
py
4548bfb7a90e91314a8c10eecdfee22756a9d6b4
diff --git a/pypika/__init__.py b/pypika/__init__.py index <HASH>..<HASH> 100644 --- a/pypika/__init__.py +++ b/pypika/__init__.py @@ -68,4 +68,4 @@ from .utils import ( __author__ = "Timothy Heys" __email__ = "[email protected]" -__version__ = "0.9.4" +__version__ = "0.10.0"
Bumped version to <I>
kayak_pypika
train
py
7a13db089b974dbd1059e9a2ba6b963cea7775ab
diff --git a/spec/unit/scheduler_spec.rb b/spec/unit/scheduler_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/scheduler_spec.rb +++ b/spec/unit/scheduler_spec.rb @@ -428,7 +428,7 @@ describe 'Flor unit' do r = @unit.launch( %q{ trap point: 'signal', name: 's0', payload: 'event' - def msg; trace "s0:$(msg.payload.ret)" + def msg \ trace "s0:$(msg.payload.ret)" stall _ }, wait: '0_1 receive')
Fix scheduler vs signal spec
floraison_flor
train
rb
379356d9a1c070c3a8bfd550b90c9a20fd284555
diff --git a/spec/cztop/poller_spec.rb b/spec/cztop/poller_spec.rb index <HASH>..<HASH> 100644 --- a/spec/cztop/poller_spec.rb +++ b/spec/cztop/poller_spec.rb @@ -415,7 +415,7 @@ describe CZTop::Poller::ZPoller do end context "with unknown socket" do - it "raises" do + it "raises", skip: zmq_version?("4.2") do assert_raises(ArgumentError) { poller.remove(reader2) } end end
zpoller_remove(unknown_socket) only raises in <I>
paddor_cztop
train
rb
899e2a0e123737600dea2a41a591197f1e078a05
diff --git a/connect_check_dummy.go b/connect_check_dummy.go index <HASH>..<HASH> 100644 --- a/connect_check_dummy.go +++ b/connect_check_dummy.go @@ -2,8 +2,6 @@ package clickhouse -import "net" - -func connCheck(conn net.Conn) error { +func (conn *connect) connCheck() error { return nil }
fix: connCheck signature for unsupported OS
kshvakov_clickhouse
train
go
2630a15ca433ba6e849068d5cbd51fc95d972c42
diff --git a/src/meta_tags.js b/src/meta_tags.js index <HASH>..<HASH> 100644 --- a/src/meta_tags.js +++ b/src/meta_tags.js @@ -53,7 +53,14 @@ class MetaTags extends Component { this.lastChildStr = childStr; - let childNodes = Array.prototype.slice.call(this.temporaryElement.querySelector('.react-head-temp').children); + const tempHead = this.temporaryElement.querySelector('.react-head-temp'); + + // .react-head-temp might not exist when triggered from async action + if (tempHead === null) { + return; + } + + let childNodes = Array.prototype.slice.call(tempHead.children); const head = document.head; const headHtml = head.innerHTML;
Fix type error in handleChildrens() (#<I>) * fix type error in handleChildrens() * return early when querySelector fails
s-yadav_react-meta-tags
train
js
d146c882ecc1c6676d08640fd942da91e8a215fe
diff --git a/helios-testing/src/main/java/com/spotify/helios/testing/TemporaryJobs.java b/helios-testing/src/main/java/com/spotify/helios/testing/TemporaryJobs.java index <HASH>..<HASH> 100644 --- a/helios-testing/src/main/java/com/spotify/helios/testing/TemporaryJobs.java +++ b/helios-testing/src/main/java/com/spotify/helios/testing/TemporaryJobs.java @@ -210,7 +210,9 @@ public class TemporaryJobs implements TestRule { public TemporaryJobBuilder job() { return new TemporaryJobBuilder(deployer, jobPrefixFile.prefix()) .hostFilter(defaultHostFilter) - .env("SPOTIFY_POD", prefix() + ".local"); + // TODO (dano): these spotify specific environment variables should go somewhere else + .env("SPOTIFY_POD", prefix() + ".local") + .env("SPOTIFY_DOMAIN", prefix() + ".local"); } /**
helios-testing: add SPOTIFY_DOMAIN env var Internal users need this as their containers use SPOTIFY_DOMAIN for service discovery.
spotify_helios
train
java
61da9ccfc21af5c763fd1fe63ddee36d570e0e45
diff --git a/tests/risk_job_unittest.py b/tests/risk_job_unittest.py index <HASH>..<HASH> 100644 --- a/tests/risk_job_unittest.py +++ b/tests/risk_job_unittest.py @@ -239,7 +239,7 @@ class RiskJobGeneralTestCase(unittest.TestCase): """ job_config_file = helpers.smoketest_file('simplecase/config.gem') - test_job = job.Job.from_file(job_config_file, 'xml') + test_job = helpers.job_from_file(job_config_file) expected_sites = [ shapes.Site(-118.077721, 33.852034),
Avoid using the database in a test located in tests/*
gem_oq-engine
train
py
b8235929c1d6dab771722d6dd72a1a838a998b66
diff --git a/test/wd-query.js b/test/wd-query.js index <HASH>..<HASH> 100644 --- a/test/wd-query.js +++ b/test/wd-query.js @@ -7,7 +7,7 @@ test('wd query: display help', t => { }) test('wd query -p [prop] -o [obj] -t [limit]', t => { - return execa.shell('./bin/wd query -p P31 -o Q44559 --limit 5') + return execa.shell('./bin/wd query -p P31 -o Q44559 --limit 100') .then(res => { t.is(res.stdout.split('Q47304').length, 2) })
wd-query test: lower the chance of failing test
maxlath_wikidata-cli
train
js
8c8349e5570f2ab056abd0717db68aa273e28899
diff --git a/spec/handlers/class_condition_handler_spec.rb b/spec/handlers/class_condition_handler_spec.rb index <HASH>..<HASH> 100644 --- a/spec/handlers/class_condition_handler_spec.rb +++ b/spec/handlers/class_condition_handler_spec.rb @@ -21,4 +21,4 @@ describe "YARD::Handlers::Ruby::#{RUBY18 ? "Legacy::" : ""}ClassConditionHandler it "should not parse conditionals inside methods" do Registry.at('A#i').should be_nil end -end \ No newline at end of file +end if RUBY19 \ No newline at end of file
ClassConditionHandler is currently only implemented for Ruby <I>, ignore specs under <I>
lsegal_yard
train
rb
bd96bd845b15f79f34dff31f108cdc73388b892c
diff --git a/imagen/ndmapping.py b/imagen/ndmapping.py index <HASH>..<HASH> 100644 --- a/imagen/ndmapping.py +++ b/imagen/ndmapping.py @@ -70,6 +70,7 @@ class NdIndexableMapping(param.Parameterized): super(NdIndexableMapping, self).__init__(metadata=metadata, **kwargs) self.ndim = len(self.dimension_labels) + self._next_ind = 0 if isinstance(initial_items, map_type): self.update(initial_items) @@ -202,6 +203,24 @@ class NdIndexableMapping(param.Parameterized): return default + def __iter__(self): + return self + + + def next(self): + """ + Implements the iterable interface, returning the keys in the + same way as a normal Python dictionary. + """ + if self._next_ind < len(self): + key = self.keys()[self._next_ind] + self._next_ind += 1 + return key + else: + self._next_ind = 0 + raise StopIteration + + def __contains__(self, key): return key in self.keys()
Added iterable interface to NdMapping objects
pyviz_imagen
train
py