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
|
---|---|---|---|---|---|
a686ca1262311a7867272028242c5cb0c9e7add7 | diff --git a/test/test_kohlschuetter.py b/test/test_kohlschuetter.py
index <HASH>..<HASH> 100644
--- a/test/test_kohlschuetter.py
+++ b/test/test_kohlschuetter.py
@@ -48,7 +48,6 @@ class TestBlockifier(KohlschuetterUnitBase):
also handles case where lxml returns None for the tree"""
# this raises an error in parsing
- self.assertRaises(etree.XMLSyntaxError, etree.fromstring, '', etree.HTMLParser(recover=True))
self.assertRaises(BlockifyError, Blockifier.blockify, '')
# this returns None in lxml | Remove newly failing lxml assertion | dragnet-org_dragnet | train | py |
9070b0a7421fa8f4042c0aea1377048c57a0194d | diff --git a/image_scraper/utils.py b/image_scraper/utils.py
index <HASH>..<HASH> 100644
--- a/image_scraper/utils.py
+++ b/image_scraper/utils.py
@@ -99,7 +99,7 @@ class ImageScraper(object):
startLength = self.proxyUrl.find("://") + 3
print("Using proxy: " + self.proxyUrl[:startLength] + self.proxyUrl[startLength:] + "\n")
proxies = {
- self.proxyUrl[:(startLength - 3)] : self.proxyUrl[startLength:]
+ self.proxyUrl[:(startLength - 3)] : self.proxyUrl
}
try:
@@ -153,7 +153,7 @@ class ImageScraper(object):
if self.proxyUrl:
startLength = self.proxyUrl.find("://") + 3
proxies = {
- self.proxyUrl[:(startLength - 3)] : self.proxyUrl[startLength:]
+ self.proxyUrl[:(startLength - 3)] : self.proxyUrl
}
img_request = requests.request('get', img_url, stream=True, proxies=proxies) | :racehorse: Added proxy support | sananth12_ImageScraper | train | py |
9bb8dd5ae38cf3d3a1ffc33c7b9ea760d4c6a8d5 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
#!/usr/bin/python3
-from setuptools import setup
+from setuptools import setup, find_packages
setup(
name="dev-pipeline-git",
@@ -8,7 +8,7 @@ setup(
package_dir={
"": "lib"
},
- packages=['devpipeline_git'],
+ packages=find_packages("lib"),
install_requires=[
'dev-pipeline-core >= 0.2.0' | Use find_packages instead of being explicit | dev-pipeline_dev-pipeline-git | train | py |
56e00ab55eef65c40689321f6f1dfc6a70fe2f25 | diff --git a/gcsproxy/listing_proxy_test.go b/gcsproxy/listing_proxy_test.go
index <HASH>..<HASH> 100644
--- a/gcsproxy/listing_proxy_test.go
+++ b/gcsproxy/listing_proxy_test.go
@@ -166,7 +166,24 @@ func (t *ListingProxyTest) List_BucketReturnsIllegalObjectName() {
}
func (t *ListingProxyTest) List_BucketReturnsIllegalDirectoryName() {
- AssertTrue(false, "TODO")
+ badListing := &storage.Objects{
+ Prefixes: []string{
+ path.Join(t.dirName, "foo/"),
+ path.Join(t.dirName, "bar"),
+ path.Join(t.dirName, "baz/"),
+ },
+ }
+
+ // Bucket.ListObjects
+ ExpectCall(t.bucket, "ListObjects")(Any(), Any()).
+ WillOnce(oglemock.Return(badListing, nil))
+
+ // List
+ _, _, err := t.lp.List()
+
+ AssertNe(nil, err)
+ ExpectThat(err, Error(HasSubstr("directory name")))
+ ExpectThat(err, Error(HasSubstr(badListing.Prefixes[1])))
}
func (t *ListingProxyTest) List_EmptyResult() { | ListingProxyTest.List_BucketReturnsIllegalDirectoryName | jacobsa_timeutil | train | go |
dabc85d1ba7919c7ea29edaf0839575cf1ebee79 | diff --git a/src/transformers/integrations.py b/src/transformers/integrations.py
index <HASH>..<HASH> 100644
--- a/src/transformers/integrations.py
+++ b/src/transformers/integrations.py
@@ -124,8 +124,7 @@ def run_hp_search_ray(trainer, n_trials: int, direction: str, **kwargs) -> BestR
metrics = trainer.evaluate()
trainer.objective = trainer.compute_objective(metrics)
trainer._tune_save_checkpoint()
- ray.tune.report(objective=trainer.objective)
- return trainer.objective
+ ray.tune.report(objective=trainer.objective, **metrics, done=True)
# The model and TensorBoard writer do not pickle so we have to remove them (if they exists)
# while doing the ray hp search. | Report Tune metrics in final evaluation (#<I>) | huggingface_pytorch-pretrained-BERT | train | py |
bf7d836a323b7d9f41e297132c0f361f80a21411 | diff --git a/lib/unexpected-sinon.js b/lib/unexpected-sinon.js
index <HASH>..<HASH> 100644
--- a/lib/unexpected-sinon.js
+++ b/lib/unexpected-sinon.js
@@ -133,7 +133,9 @@
var onCall = spy.onCall && spy.onCall(spy.behaviors.length);
return onCall;
};
- for (var propertyName in spy) {
+ var propertyNames = Object.getOwnPropertyNames(spy);
+ for (var i = 0; i < propertyNames.length; i += 1) {
+ var propertyName = propertyNames[i];
if (
spy.hasOwnProperty(propertyName) &&
propertyName !== 'behaviors' && | Don't rely on spy/stub/... properties being enumerable
They aren't as of sinonjs/sinon#<I>, which landed in sinon <I>
Fixes #<I> | unexpectedjs_unexpected-sinon | train | js |
05dbafc72e91adc8f0c3896844ef84e594523a34 | diff --git a/lib/rubocop/node_pattern.rb b/lib/rubocop/node_pattern.rb
index <HASH>..<HASH> 100644
--- a/lib/rubocop/node_pattern.rb
+++ b/lib/rubocop/node_pattern.rb
@@ -135,9 +135,11 @@ module RuboCop
end
def run(node_var)
- tokens = @string.scan(TOKEN)
- tokens.reject! { |token| token =~ /\A[\s,]+\Z/ } # drop whitespace
+ tokens =
+ @string.scan(TOKEN).reject { |token| token =~ /\A#{SEPARATORS}\Z/ }
+
@match_code = compile_expr(tokens, node_var, false)
+
fail_due_to('unbalanced pattern') unless tokens.empty?
end
diff --git a/spec/rubocop/node_pattern_spec.rb b/spec/rubocop/node_pattern_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/rubocop/node_pattern_spec.rb
+++ b/spec/rubocop/node_pattern_spec.rb
@@ -912,11 +912,10 @@ describe RuboCop::NodePattern do
end
describe 'commas' do
- # commas are just whitespace
context 'with commas randomly strewn around' do
let(:pattern) { ',,(,send,, ,int,:+, int ), ' }
let(:ruby) { '1 + 2' }
- it_behaves_like :matching
+ it_behaves_like :invalid
end
end | Drop support for extra commas in node patterns (part 2)
Work started in #<I>. However, node patterns would still allow commas,
due to another hard coded instance of the regexp that is now extracted
into `NodePattern::Compiler::SEPARATORS`. | rubocop-hq_rubocop | train | rb,rb |
86a274a7eed37acb45f43c5e695e2bd6dce1b7d8 | diff --git a/public/app/core/services/backend_srv.js b/public/app/core/services/backend_srv.js
index <HASH>..<HASH> 100644
--- a/public/app/core/services/backend_srv.js
+++ b/public/app/core/services/backend_srv.js
@@ -105,6 +105,13 @@ function (angular, _, coreModule, config) {
});
}
+ //populate error obj on Internal Error
+ if (_.isString(err.data) && err.status === 500 && !err.data) {
+ err.data = {
+ error: err.statusText
+ };
+ }
+
// for Prometheus
if (!err.data.message && _.isString(err.data.error)) {
err.data.message = err.data.error; | feat(backendsrv): improves error response handling
datasourceRequests that could not reach the destination threw
invalid errors due to missing property. This fixes gives the user
a better error message.
closes #<I> | grafana_grafana | train | js |
0b042b26810ae557f91fddc01caff56790f26530 | diff --git a/lib/6to5/transformation/transformers/es6/classes.js b/lib/6to5/transformation/transformers/es6/classes.js
index <HASH>..<HASH> 100644
--- a/lib/6to5/transformation/transformers/es6/classes.js
+++ b/lib/6to5/transformation/transformers/es6/classes.js
@@ -207,7 +207,7 @@ ClassTransformer.prototype.buildBody = function () {
};
/**
- * Push a method to it's respective mutatorMap.
+ * Push a method to its respective mutatorMap.
*
* @param {Node} node MethodDefinition
*/ | Use the posessive form of "its", not a contraction of "it is". | babel_babel | train | js |
da71ed767068496487c7bd2f7d7d80a392c6e4ee | diff --git a/src/test/java/com/treetank/cache/TransactionLogCacheTest.java b/src/test/java/com/treetank/cache/TransactionLogCacheTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/treetank/cache/TransactionLogCacheTest.java
+++ b/src/test/java/com/treetank/cache/TransactionLogCacheTest.java
@@ -3,6 +3,7 @@ package com.treetank.cache;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -45,7 +46,7 @@ public class TransactionLogCacheTest {
cache.clear();
}
- @Test
+ @After
public void tearDown() {
TestHelper.closeEverything();
} | fixed bug in transactionlogtest, wrong annotation was set
git-svn-id: <URL> | sebastiangraf_treetank | train | java |
996ff372c92479320267eb1bb6a44ba4824bd3b4 | diff --git a/lib/ansiblelint/__init__.py b/lib/ansiblelint/__init__.py
index <HASH>..<HASH> 100644
--- a/lib/ansiblelint/__init__.py
+++ b/lib/ansiblelint/__init__.py
@@ -125,7 +125,7 @@ class RulesCollection(object):
return matches
for rule in self.rules:
- if not tags or not set(rule.tags + [rule.id]).isdisjoint(tags):
+ if not tags or not set(rule.tags).union([rule.id]).isdisjoint(tags):
rule_definition = set(rule.tags)
rule_definition.add(rule.id)
if set(rule_definition).isdisjoint(skip_list): | Fix tags set creation in certain cases
In some circumstances the rule id can't be added to the list.
By using union on sets, this problem is avoided | ansible_ansible-lint | train | py |
4b1a18ace985246f4332961b199276b2741182e9 | diff --git a/scenarios/kubernetes_e2e.py b/scenarios/kubernetes_e2e.py
index <HASH>..<HASH> 100755
--- a/scenarios/kubernetes_e2e.py
+++ b/scenarios/kubernetes_e2e.py
@@ -398,7 +398,7 @@ def create_parser():
parser.add_argument(
'--soak-test', action='store_true', help='If the test is a soak test job')
parser.add_argument(
- '--tag', default='v20170310-72232020', help='Use a specific kubekins-e2e tag if set')
+ '--tag', default='v20170314-bb0669b0', help='Use a specific kubekins-e2e tag if set')
parser.add_argument(
'--test', default='true', help='If we need to set --test in e2e.go')
parser.add_argument( | Update kubetest to <I>-bb<I>b0 | kubernetes_test-infra | train | py |
2e28838d2b48c62ad282adb235d45cc9fcbff441 | diff --git a/hawtio-system/src/main/java/io/hawt/system/Authenticator.java b/hawtio-system/src/main/java/io/hawt/system/Authenticator.java
index <HASH>..<HASH> 100644
--- a/hawtio-system/src/main/java/io/hawt/system/Authenticator.java
+++ b/hawtio-system/src/main/java/io/hawt/system/Authenticator.java
@@ -194,7 +194,7 @@ public class Authenticator {
} else if (callback instanceof PasswordCallback) {
((PasswordCallback) callback).setPassword(password.toCharArray());
} else {
- LOG.warn("Unsupported callback class [" + callback.getClass().getName() + "]");
+ LOG.debug("Unknown callback class [" + callback.getClass().getName() + "]");
}
}
} | This log doesn't need to be at the WARN level | hawtio_hawtio | train | java |
8267fee5e80fa82bb424929bb6ed396468a868b1 | diff --git a/treenode/admin.py b/treenode/admin.py
index <HASH>..<HASH> 100644
--- a/treenode/admin.py
+++ b/treenode/admin.py
@@ -58,6 +58,11 @@ class TreeNodeModelAdmin(admin.ModelAdmin):
return base_list_display
+ def get_queryset(self, request):
+ qs = super(TreeNodeModelAdmin, self).get_queryset(request)
+ qs = qs.select_related('tn_parent')
+ return qs
+
def _use_treenode_display_mode(self, request, obj):
querystring = (request.GET.urlencode() or '')
return len(querystring) <= 2 | Reduced admin list display queries count. | fabiocaccamo_django-treenode | train | py |
cebbf289ca405a71ba3b8fc005671ff9ebbbe5b7 | diff --git a/folder.go b/folder.go
index <HASH>..<HASH> 100644
--- a/folder.go
+++ b/folder.go
@@ -32,7 +32,7 @@ func (f Folder) Reference() types.ManagedObjectReference {
func (f Folder) Children(c *Client) ([]Reference, error) {
var mf mo.Folder
- err := c.Properties(f.Reference(), []string{"childType", "childEntity"}, &mf)
+ err := c.Properties(f.Reference(), []string{"childEntity"}, &mf)
if err != nil {
return nil, err
}
@@ -43,9 +43,9 @@ func (f Folder) Children(c *Client) ([]Reference, error) {
// A folder contains managed entities, all of which are listed below.
switch e.Type {
case "Folder":
- rs = append(rs, Folder{e})
+ rs = append(rs, Folder{ManagedObjectReference: e})
case "Datacenter":
- rs = append(rs, Datacenter{e})
+ rs = append(rs, Datacenter{ManagedObjectReference: e})
case "VirtualMachine":
panic("TODO")
case "VirtualApp": | Retrieve only childEntity property for folder | vmware_govmomi | train | go |
bef43ea825f5fdc865ce1942a046cd0a1fc63aeb | diff --git a/lib/codemirror.js b/lib/codemirror.js
index <HASH>..<HASH> 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -5392,7 +5392,7 @@
for (var i = newBreaks.length - 1; i >= 0; i--)
replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length))
});
- option("specialChars", /[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function(cm, val, old) {
+ option("specialChars", /[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function(cm, val, old) {
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
if (old != CodeMirror.Init) cm.refresh();
}); | Include all ASCII control codes in specialChars
* \x1a-\x1f were missing though it looks like the intention was to cover all below \x<I> (space)
* added \x7f which is usually considered non-printable
* removed \t which was already covered in \x<I>-\x<I> as \x<I> | codemirror_CodeMirror | train | js |
816408657d3c45bcd58df7d06269bfcfeb95ce65 | diff --git a/SoftLayer/managers/storage_utils.py b/SoftLayer/managers/storage_utils.py
index <HASH>..<HASH> 100644
--- a/SoftLayer/managers/storage_utils.py
+++ b/SoftLayer/managers/storage_utils.py
@@ -660,14 +660,14 @@ def prepare_replicant_order_object(manager, snapshot_schedule, location,
"""
# Ensure the primary volume and snapshot space are not set for cancellation
if 'billingItem' not in volume\
- or volume['billingItem']['cancellationDate'] != '':
+ or volume['billingItem'].get('cancellationDate'):
raise exceptions.SoftLayerError(
'This volume is set for cancellation; '
'unable to order replicant volume')
for child in volume['billingItem']['activeChildren']:
if child['categoryCode'] == 'storage_snapshot_space'\
- and child['cancellationDate'] != '':
+ and child.get('cancellationDate'):
raise exceptions.SoftLayerError(
'The snapshot space for this volume is set for '
'cancellation; unable to order replicant volume') | <I> Fix checking against literal empty string | softlayer_softlayer-python | train | py |
706008a7aaea2661c70dab2e1f12cae7822c44f3 | diff --git a/lib/berkshelf/locations/hg.rb b/lib/berkshelf/locations/hg.rb
index <HASH>..<HASH> 100644
--- a/lib/berkshelf/locations/hg.rb
+++ b/lib/berkshelf/locations/hg.rb
@@ -51,9 +51,8 @@ module Berkshelf
# Download the cookbook from the remote hg repository
#
- # @return [CachedCookbook]
+ # @return void
def install
-
if cached?
# Update and checkout the correct ref
Dir.chdir(cache_path) do
@@ -73,7 +72,6 @@ module Berkshelf
@revision ||= hg %|id -i|
end
-
# Gab the path where we should copy from (since it might be relative to
# the root).
copy_path = rel ? cache_path.join(rel) : cache_path
@@ -92,7 +90,6 @@ module Berkshelf
# Copy whatever is in the current cache over to the store
FileUtils.cp_r(copy_path, install_path)
-
ensure
# Remove the .hg directory to save storage space
@@ -138,7 +135,6 @@ module Berkshelf
out
end
-
# Determine if this revision is installed.
#
# @return [Boolean]
@@ -146,7 +142,6 @@ module Berkshelf
revision && install_path.exist?
end
-
private
# Perform a mercurial command. | Silly josh with his extraneous newlines | berkshelf_berkshelf-hg | train | rb |
4fc7686b236c3893b0624ecce668f132ad8c983e | diff --git a/models/lobby/lobby_requirement.go b/models/lobby/lobby_requirement.go
index <HASH>..<HASH> 100644
--- a/models/lobby/lobby_requirement.go
+++ b/models/lobby/lobby_requirement.go
@@ -70,7 +70,6 @@ func (l *Lobby) FitsRequirements(player *player.Player, slot int) (bool, error)
//update player info only if the number of hours needed > the number of hours
//passed since player info was last updated
player.UpdatePlayerInfo()
- player.Save()
}
if player.GameHours < req.Hours { | FitsRequirements: Don't save player on UpdatePlayerInfo | TF2Stadium_Helen | train | go |
2a01fd5f2ee8982c6fe413d3404edb856c07c3d9 | diff --git a/src/matchArray.js b/src/matchArray.js
index <HASH>..<HASH> 100644
--- a/src/matchArray.js
+++ b/src/matchArray.js
@@ -17,7 +17,7 @@ module.exports = (currentMatch, subjectToMatch) => {
.slice(0, matchArgs.length - 1)
.every((arg, index) => matchOnSubArg(arg, subjectToMatch[index]))
- if (deepEqual(matchArgs[matchArgs.length - 1].value, []) && matchAllSubArgs) {
+ if (matchAllSubArgs && deepEqual(matchArgs[matchArgs.length - 1].value, [])) {
return option.Some(subjectToMatch[0])
} | Flip args on match array validation
It's better to check first the value that already was evaluated. | z-pattern-matching_z | train | js |
5f62f183a30b2c0a76941fa2bc5d87825983a838 | diff --git a/src/dct.js b/src/dct.js
index <HASH>..<HASH> 100644
--- a/src/dct.js
+++ b/src/dct.js
@@ -7,7 +7,7 @@
* tool to understand the Mel-scale and its related coefficients used in
* human speech analysis.
\*===========================================================================*/
-cosMap = null;
+var cosMap = null;
// Builds a cosine map for the given input size. This allows multiple input sizes to be memoized automagically
// if you want to run the DCT over and over. | Assign cosMap as undefined variables in strict mode (and ES6) throw errors | vail-systems_node-dct | train | js |
e12b7fecd2362518f617671fcbd047503f6a3d5a | diff --git a/src/Project.php b/src/Project.php
index <HASH>..<HASH> 100644
--- a/src/Project.php
+++ b/src/Project.php
@@ -39,19 +39,32 @@ class Project
/**
*
+ * The Composer 'installed' data.
+ *
+ * @var array
+ *
+ */
+ protected $installed;
+
+ /**
+ *
* Constructor.
*
* @param string $base The base directory.
*
* @param array $env A copy of $_ENV.
*
+ * @param array $installed A decoded version of the Composer 'installed'
+ * data.
+ *
*/
- public function __construct($base, array $env)
+ public function __construct($base, array $env, $installed)
{
$this->base = rtrim($base, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$this->mode = isset($env['AURA_CONFIG_MODE'])
? $env['AURA_CONFIG_MODE']
: 'default';
+ $this->installed = $installed;
}
/**
@@ -90,6 +103,18 @@ class Project
/**
*
+ * Returns the Composer 'installed' data.
+ *
+ * @return array
+ *
+ */
+ public function getInstalled()
+ {
+ return $this->installed;
+ }
+
+ /**
+ *
* Gets the base path, along with an optional subdirectory path.
*
* @param string $sub An optional subdirectory path. | retain Composer 'installed' data in the project info | auraphp_Aura.Project_Kernel | train | php |
879de676ffcf61a34df040efc5479d555e2cf977 | diff --git a/packages/card/index.js b/packages/card/index.js
index <HASH>..<HASH> 100644
--- a/packages/card/index.js
+++ b/packages/card/index.js
@@ -1,3 +1,5 @@
-const React = require('./dist/react')
+const css = require('./css')
+const react = require('./react')
+const vars = require('./vars')
-module.exports = { React }
+module.exports = { css, react, vars } | refactor(card): remember to update index for new css/vars imports | pluralsight_design-system | train | js |
5b9ff8c6970fd8a5f79285262992356f56a1749e | diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/metastore/CachingHiveMetastore.java b/presto-hive/src/main/java/com/facebook/presto/hive/metastore/CachingHiveMetastore.java
index <HASH>..<HASH> 100644
--- a/presto-hive/src/main/java/com/facebook/presto/hive/metastore/CachingHiveMetastore.java
+++ b/presto-hive/src/main/java/com/facebook/presto/hive/metastore/CachingHiveMetastore.java
@@ -614,7 +614,7 @@ public class CachingHiveMetastore
{
CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder();
if (expiresAfterWriteMillis.isPresent()) {
- cacheBuilder = cacheBuilder.expireAfterAccess(expiresAfterWriteMillis.getAsLong(), MILLISECONDS);
+ cacheBuilder = cacheBuilder.expireAfterWrite(expiresAfterWriteMillis.getAsLong(), MILLISECONDS);
}
if (refreshMillis.isPresent()) {
cacheBuilder = cacheBuilder.refreshAfterWrite(refreshMillis.getAsLong(), MILLISECONDS); | Use expireAfterWrite in Hive metastore cache
The original code was using expireAfterAccess, which was a typo and was
introduced in the PR that added per-transaction cache for Hive metastore. | prestodb_presto | train | java |
895ed0215f8627f1f35f4df148de7a89b5135d4e | diff --git a/spec/module_spec.rb b/spec/module_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/module_spec.rb
+++ b/spec/module_spec.rb
@@ -223,10 +223,7 @@ describe EtOrbi do
current = EtOrbi.get_tzone(:local)
- class ::Time
- alias _original_zone zone
- def zone; "中国标准时间"; end
- end
+ Time._zone = '中国标准时间'
# expect(
# EtOrbi.get_tzone(:current)
@@ -252,9 +249,7 @@ describe EtOrbi do
ensure
- class ::Time
- def zone; _original_zone; end
- end
+ Time._zone = nil
end
expect(
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
@@ -78,6 +78,19 @@ class Time
"dst:#{self.isdst}"
].join(' ')
end
+
+ #
+ # tools to "inject" a zone string at will
+
+ alias _original_zone zone
+
+ def zone
+ self.class._zone || _original_zone
+ end
+
+ class << self
+ attr_accessor :_zone
+ end
end
class SpecActiveSupportTimeZone | Inject arbitrary zone name at spec_helper.rb level | floraison_et-orbi | train | rb,rb |
dc38258ff508fada62d80d2ccc755aed07b8695c | diff --git a/lib/chef/knife/azure_base.rb b/lib/chef/knife/azure_base.rb
index <HASH>..<HASH> 100755
--- a/lib/chef/knife/azure_base.rb
+++ b/lib/chef/knife/azure_base.rb
@@ -74,7 +74,7 @@ class Chef
:azure_host_name => locate_config_value(:azure_host_name),
:verify_ssl_cert => locate_config_value(:verify_ssl_cert)
)
- end
+ end
end
def locate_config_value(key)
@@ -94,7 +94,7 @@ class Chef
keys.each do |k|
pretty_key = k.to_s.gsub(/_/, ' ').gsub(/\w+/){ |w| (w =~ /(ssh)|(aws)/i) ? w.upcase : w.capitalize }
if locate_config_value(k).nil?
- errors << "You did not provide a valid '#{pretty_key}' value."
+ errors << "You did not provide a valid '#{pretty_key}' value. Please set knife[:#{k}] in your knife.rb or pass as option"
end
end | Better hints for the user incase of a missing param | chef_knife-azure | train | rb |
e7933c1b664db7cbaafa5c5ee148eafa69377633 | diff --git a/TYPO3.Flow/Scripts/flow.php b/TYPO3.Flow/Scripts/flow.php
index <HASH>..<HASH> 100644
--- a/TYPO3.Flow/Scripts/flow.php
+++ b/TYPO3.Flow/Scripts/flow.php
@@ -23,6 +23,12 @@ if (isset($argv[1]) && ($argv[1] === 'typo3.flow:core:setfilepermissions' || $ar
if (DIRECTORY_SEPARATOR !== '/') {
exit('The core:setfilepermissions command is only available on UNIX platforms.' . PHP_EOL);
}
+
+ $filePermissions = decoct(fileperms(__DIR__ . '/setfilepermissions.sh') & 0777);
+ if ($filePermissions !== '700'){
+ chmod(__DIR__ . '/setfilepermissions.sh', 0700);
+ }
+
array_shift($argv);
array_shift($argv);
$returnValue = 0; | [TASK] Add permissions check for setfilepermissions.sh
Using the setfilepermissions.sh script fails due to wrong file permissions left by the composer installation (missing executable bit). Added the checking of the file's permissions, and correcting the file's permissions if needed. Mode <I> is set as the setfilepermissions.sh script sets it's own permissions to that mode. | neos_flow-development-collection | train | php |
c4550c28142c8d01897fff3846c8d25df0a114c8 | diff --git a/src/styles/points/points.js b/src/styles/points/points.js
index <HASH>..<HASH> 100755
--- a/src/styles/points/points.js
+++ b/src/styles/points/points.js
@@ -192,7 +192,7 @@ Object.assign(Points, {
quad: [ Utils.scaleInt16(size[0], 256), Utils.scaleInt16(size[1], 256) ],
quad_scale: Utils.scaleInt16(1, 256),
offset: Vector.mult(offset, Utils.device_pixel_ratio),
- angle: Utils.scaleInt16(Utils.radToDeg(angle), 360),
+ angle: Utils.scaleInt16(angle, 360),
texcoord_scale: this.texcoord_scale,
texcoord_normalize: 65535
}
diff --git a/src/styles/text/text.js b/src/styles/text/text.js
index <HASH>..<HASH> 100644
--- a/src/styles/text/text.js
+++ b/src/styles/text/text.js
@@ -490,9 +490,9 @@ Object.assign(TextStyle, {
let label = style.labels[i];
this.buildQuad(
- [label.position],
- label.size.texture_text_size,
- label.angle || 0, vertex_data,
+ [label.position],
+ label.size.texture_text_size,
+ Utils.radToDeg(label.angle) || 0, vertex_data,
vertex_template, label.options.offset
);
} | point angle is degrees in scene file, radians in internal label calc | tangrams_tangram | train | js,js |
08d7f5d778c8b38c92fdea521e3e69a8b2d344fa | diff --git a/src/providers/discord.js b/src/providers/discord.js
index <HASH>..<HASH> 100644
--- a/src/providers/discord.js
+++ b/src/providers/discord.js
@@ -8,7 +8,7 @@ export default (options) => {
params: { grant_type: 'authorization_code' },
accessTokenUrl: 'https://discord.com/api/oauth2/token',
authorizationUrl:
- 'https://discord.com/api/oauth2/authorize?response_type=code&prompt=consent',
+ 'https://discord.com/api/oauth2/authorize?response_type=code&prompt=none',
profileUrl: 'https://discord.com/api/users/@me',
profile: (profile) => {
return { | Set Discord to Prompt = None (#<I>)
* Update discord.js
* Migrating from discordapp.com to discord.com | iaincollins_next-auth | train | js |
44080a3860ce80167213ca5ec9bdd3fefb512c85 | diff --git a/validator/testcases/jetpack.py b/validator/testcases/jetpack.py
index <HASH>..<HASH> 100644
--- a/validator/testcases/jetpack.py
+++ b/validator/testcases/jetpack.py
@@ -53,6 +53,8 @@ def inspect_jetpack(err, xpi_package, allow_old_sdk=False):
err.save_resource('pretested_files', [])
if is_old_jetpack(xpi_package):
+ if err.get_resource('is_compat_test'):
+ return
err.error(
err_id=('jetpack', 'inspect_jetpack',
'cfx'), | Ignore cfx compat test during bulk validation | mozilla_amo-validator | train | py |
7449bf1dee11668199a974ff8fbefbc44499df41 | diff --git a/flask_slither/resources.py b/flask_slither/resources.py
index <HASH>..<HASH> 100644
--- a/flask_slither/resources.py
+++ b/flask_slither/resources.py
@@ -168,13 +168,13 @@ class BaseResource(MethodView):
final.update(projection)
return None if final == {} else final
- def _get_collection(self):
+ def _get_collection(self, **kwargs):
current_app.logger.debug("GETting collection")
documents = []
try:
query = {} if 'where' not in request.args else \
json_util.loads(request.args.get('where'))
- query.update(self.access_limits())
+ query.update(self.access_limits(**kwargs))
cursor = current_app.db[self.collection] \
.find(query, self._get_projection())
if 'sort' in request.args:
@@ -284,7 +284,7 @@ class BaseResource(MethodView):
else:
return self._prep_response(status=409)
else:
- response = self._get_collection()
+ response = self._get_collection(**kwargs)
return self._prep_response(response) | get_collection is passed **kwargs as it should | gevious_flask_slither | train | py |
1b30c807d15bef59d9108f3169699dc526404a16 | diff --git a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java
index <HASH>..<HASH> 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/sm/control/OperationControlCallback.java
@@ -159,7 +159,7 @@ public abstract class OperationControlCallback extends OperationCallbackBase<Pay
if (e.getCause() instanceof OperationException) {
return (OperationException) e.getCause();
}
- logger.warn("Operation failed for accountId='{}' accountExternalKey='{}' error='{}'", paymentStateContext.getAccount().getExternalKey(), e.getMessage());
+ logger.warn("Operation failed for accountId='{}' accountExternalKey='{}' error='{}'", paymentStateContext.getAccount().getId(), paymentStateContext.getAccount().getExternalKey(), e.getMessage());
return new OperationException(e, getOperationResultOnException(paymentStateContext));
} | payment: fix logging message in OperationControlCallback | killbill_killbill | train | java |
fa59ac99e451d739310fd65394d3efcb896c6070 | diff --git a/routes/admin/not-authenticated/account-login/page.js b/routes/admin/not-authenticated/account-login/page.js
index <HASH>..<HASH> 100644
--- a/routes/admin/not-authenticated/account-login/page.js
+++ b/routes/admin/not-authenticated/account-login/page.js
@@ -108,20 +108,6 @@ class LoginPage extends Component {
)}
</Button>
</FormRedux>
-
- <p className='white center'>
- <FormattedMessage
- id='page--account-login.ask-register'
- defaultMessage='Ainda não é cadastrado?'
- />
- <br />
- <Link to={paths.createAccount()}>
- <FormattedMessage
- id='page--account-login.cta-signup'
- defaultMessage='Clique para criar uma conta.'
- />
- </Link>
- </p>
</div>
)
} | feature(login): Remove from login page register link | nossas_bonde-client | train | js |
fd5b280e53a772aa1f68a1ad3c9ec0eb876d8c69 | diff --git a/examples/Clock/ClockDS.py b/examples/Clock/ClockDS.py
index <HASH>..<HASH> 100644
--- a/examples/Clock/ClockDS.py
+++ b/examples/Clock/ClockDS.py
@@ -39,8 +39,7 @@ class Clock(Device):
@attribute(dtype='DevEnum', enum_labels=get_enum_labels(Noon))
def noon(self):
time_struct = time.gmtime(time.time())
- result = Noon.AM if time_struct.tm_hour < 12 else Noon.PM
- return int(result)
+ return Noon.AM if time_struct.tm_hour < 12 else Noon.PM
@command(dtype_in=float, dtype_out=str)
def ctime(self, seconds): | Remove casting in ClockDS enum example
The enum can be used directly - no need to cast it to an int before
returning. | tango-controls_pytango | train | py |
3a5b9a2b06637c0d0938342d4dfbdd6a0192ae91 | diff --git a/src/deep-security/lib/Token.js b/src/deep-security/lib/Token.js
index <HASH>..<HASH> 100644
--- a/src/deep-security/lib/Token.js
+++ b/src/deep-security/lib/Token.js
@@ -147,13 +147,11 @@ export class Token {
this._credentials = new AWS.CognitoIdentityCredentials(cognitoParams);
- AWS.config.credentials = this._credentials;
-
if (this.identityId) {
// trying to load old credentials from CognitoSync
this._credsManager.loadCredentials(this.identityId, (error, credentials) => {
if (!error && credentials && this.validCredentials(credentials)) {
- callback(null, this._credentials = credentials);
+ callback(null, AWS.config.credentials = this._credentials = credentials);
return;
} else {
this._refreshCredentials(this._credentials, callback);
@@ -184,6 +182,8 @@ export class Token {
return;
}
+ AWS.config.credentials = this._credentials;
+
// @todo - save credentials in background not to affect page load time
this._credsManager.saveCredentials(credentials, (error, record) => {
if (error) { | #<I> - Fix credentials assignment to AWS.config.credentials | MitocGroup_deep-framework | train | js |
f6f10b710d09867950c162171bc01f8d47fe3416 | diff --git a/lib/i18n/backend/cache.rb b/lib/i18n/backend/cache.rb
index <HASH>..<HASH> 100644
--- a/lib/i18n/backend/cache.rb
+++ b/lib/i18n/backend/cache.rb
@@ -68,7 +68,7 @@ module I18n
# Also, in Ruby < 1.8.7 {}.hash != {}.hash
# (see http://paulbarry.com/articles/2009/09/14/why-rails-3-will-require-ruby-1-8-7)
# If args.inspect does not work for you for some reason, patches are very welcome :)
- hash = RUBY_VERSION >= "1.8.7" ? options.hash : options.inspect
+ hash = RUBY_VERSION >= "1.8.7" ? options.hash : options.inspect.hash
keys = ['i18n', I18n.cache_namespace, locale, key.hash, hash]
keys.join('|')
end | For those using < <I>, prevent the key becoming too large (for example for memcached) by tasking the hash of inspect string. | ruby-i18n_i18n | train | rb |
aa11a364dcfa267212965abf5fb280eae0811bd4 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2,7 +2,7 @@ var lib = require('./mappersmith')
var _process, defaultGateway
// Prevents webpack to load the nodejs processs polyfill
-try { _process = eval('typeof process === "object" ? process : null') } catch (e) {}
+try { _process = eval('typeof process === "object" ? process : undefined') } catch (e) {}
if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
diff --git a/src/utils.js b/src/utils.js
index <HASH>..<HASH> 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -13,7 +13,7 @@ if (typeof window !== 'undefined' && window !== null) {
}
let _process, getNanoSeconds, loadTime;
-try { _process = eval('typeof process === "object" ? process : null') } catch (e) {}
+try { _process = eval('typeof process === "object" ? process : undefined') } catch (e) {}
const hasProcessHrtime = () => {
return (typeof _process !== 'undefined' && _process !== null) && _process.hrtime | Switch null with undefined on process evaluation | tulios_mappersmith | train | js,js |
2940015f7ac23add40e930cdf3a71e6e1907dfa3 | diff --git a/externs/html5.js b/externs/html5.js
index <HASH>..<HASH> 100644
--- a/externs/html5.js
+++ b/externs/html5.js
@@ -1192,6 +1192,7 @@ HTMLInputElement.prototype.stepUp = function(opt_n) {};
/**
* @constructor
* @extends {HTMLElement}
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement
*/
function HTMLMediaElement() {}
@@ -1261,13 +1262,22 @@ HTMLMediaElement.prototype.readyState;
/** @type {boolean} */
HTMLMediaElement.prototype.seeking;
-/** @type {number} */
+/**
+ * The current time, in seconds.
+ * @type {number}
+ */
HTMLMediaElement.prototype.currentTime;
-/** @type {number} */
+/**
+ * The start time, in seconds.
+ * @type {number}
+ */
HTMLMediaElement.prototype.startTime;
-/** @type {number} */
+/**
+ * The length of the media in seconds.
+ * @type {number}
+ */
HTMLMediaElement.prototype.duration;
/** @type {boolean} */
@@ -1307,7 +1317,10 @@ HTMLMediaElement.prototype.pause = function() {};
/** @type {boolean} */
HTMLMediaElement.prototype.controls;
-/** @type {number} */
+/**
+ * The audio volume, from 0.0 (silent) to 1.0 (loudest).
+ * @type {number}
+ */
HTMLMediaElement.prototype.volume;
/** @type {boolean} */ | Add some documentation for properties in HTMLMediaElement.
In particular, clarify that times are in seconds, not milliseconds.
-------------
Created by MOE: <URL> | google_closure-compiler | train | js |
73b94494529e95a813074ee476e7b10e91837a2f | diff --git a/ue4cli/UnrealManagerBase.py b/ue4cli/UnrealManagerBase.py
index <HASH>..<HASH> 100644
--- a/ue4cli/UnrealManagerBase.py
+++ b/ue4cli/UnrealManagerBase.py
@@ -150,7 +150,7 @@ class UnrealManagerBase(object):
try:
return self.getPluginDescriptor(dir)
except:
- raise UnrealManagerException('could not detect an Unreal project or plugin in the current directory')
+ raise UnrealManagerException('could not detect an Unreal project or plugin in the directory "{}"'.format(dir))
def isProject(self, descriptor):
""" | Report directory path when descriptor detection fails | adamrehn_ue4cli | train | py |
dbf638bb2c1911f3433e11f2e4149c74f5f0cedf | diff --git a/gshell-io/src/main/java/org/sonatype/gshell/io/InputPipe.java b/gshell-io/src/main/java/org/sonatype/gshell/io/InputPipe.java
index <HASH>..<HASH> 100644
--- a/gshell-io/src/main/java/org/sonatype/gshell/io/InputPipe.java
+++ b/gshell-io/src/main/java/org/sonatype/gshell/io/InputPipe.java
@@ -100,27 +100,36 @@ public class InputPipe
startSignal.countDown();
while (running) {
- int c = read();
+ try {
+ int c = read();
+
+ switch (c) {
+ case -1:
+ queue.put(c);
+ return;
- switch (c) {
- case -1:
- queue.put(c);
- return;
+ case 3:
+ interrupt = interruptHandler.interrupt();
+ break;
- case 3:
- interrupt = interruptHandler.interrupt();
- break;
+ case 4:
+ running = interruptHandler.stop();
+ break;
+ }
- case 4:
- running = interruptHandler.stop();
- break;
+ queue.put(c);
}
+ catch (IOException e) {
+ log.warn("Pipe read error", e);
- queue.put(c);
+ // HACK: Reset the terminal
+ term.restore();
+ term.init();
+ }
}
}
catch (Throwable t) {
- log.error("Pipe read failed", t);
+ log.error("Pipe read failure", t);
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
} | Handle cases that show up when CTRL-Z is used to suspend the shell, causing the pipe to fail. Also need to reset the terminal. | jdillon_gshell | train | java |
029c354316304bf5c03f5ee0abd2f57d907f7324 | diff --git a/server/storage/mvcc/index.go b/server/storage/mvcc/index.go
index <HASH>..<HASH> 100644
--- a/server/storage/mvcc/index.go
+++ b/server/storage/mvcc/index.go
@@ -257,8 +257,14 @@ func (ti *treeIndex) Equal(bi index) bool {
equal := true
ti.tree.Ascend(func(item btree.Item) bool {
- aki := item.(*keyIndex)
- bki := b.tree.Get(item).(*keyIndex)
+ var aki, bki *keyIndex
+ var ok bool
+ if aki, ok = item.(*keyIndex); !ok {
+ return false
+ }
+ if bki, ok = b.tree.Get(item).(*keyIndex); !ok {
+ return false
+ }
if !aki.equal(bki) {
equal = false
return false | server/storage/mvcc: fix oss-fuzz issue <I> | etcd-io_etcd | train | go |
84f5d157ae1bf9d453ac6667c7aa901f0ece46ed | diff --git a/fireplace/game.py b/fireplace/game.py
index <HASH>..<HASH> 100644
--- a/fireplace/game.py
+++ b/fireplace/game.py
@@ -164,13 +164,13 @@ class Game(Entity):
return ret
- def toss_coin(self):
- outcome = random.randint(0, 1)
- # player who wins the outcome is the index
- winner = self.players[outcome]
- loser = winner.opponent
- logging.info("Tossing the coin... %s wins!" % (winner))
- return winner, loser
+ def pick_first_player(self):
+ """
+ Picks and returns first player, second player
+ In the default implementation, the first player is always
+ "Player 0". Use CoinRules to decide it randomly.
+ """
+ return self.players[0], self.players[1]
def refresh_auras(self):
for aura in self.auras:
@@ -178,7 +178,7 @@ class Game(Entity):
def start(self):
logging.info("Starting game: %r" % (self))
- self.player1, self.player2 = self.toss_coin()
+ self.player1, self.player2 = self.pick_first_player()
self.manager.new_entity(self.player1)
self.manager.new_entity(self.player2)
self.current_player = self.player1 | Simplify Game.toss_coin() logic and rename it to pick_first_player() | jleclanche_fireplace | train | py |
fb9322737a07728c790c5be4c05f5319f4ab4672 | diff --git a/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb b/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
+++ b/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
@@ -131,7 +131,7 @@ module ActiveRecord
def record_changed_lobs
@changed_lob_columns = self.class.lob_columns.select do |col|
- (self.class.serialized_attributes.keys.include?(col.name) || self.send(:"#{col.name}_changed?")) && !self.class.readonly_attributes.to_a.include?(col.name)
+ self.attribute_changed?(col.name) && !self.class.readonly_attributes.to_a.include?(col.name)
end
end
end | Remove call to deprecated `serialized_attributes`.
According to <URL>
it should be no longer necessary to check whether the attribute is serialized.
Note: this change is probably incompatible with rails prior <I>. | rsim_oracle-enhanced | train | rb |
3fb0f697300900f745e9e39c9e08d529e248f59b | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,25 @@ from setuptools import setup
from setuptools.command.install import install as orig_install
+try:
+ from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
+
+ class bdist_wheel(_bdist_wheel):
+
+ def finalize_options(self):
+ _bdist_wheel.finalize_options(self)
+ # Mark us as not a pure python package
+ self.root_is_pure = False
+
+ def get_tag(self):
+ python, abi, plat = _bdist_wheel.get_tag(self)
+ # We don't contain any python source
+ python, abi = 'py2.py3', 'none'
+ return python, abi, plat
+except ImportError:
+ bdist_wheel = None
+
+
class ExeDistribution(Distribution):
c_executables = ()
@@ -99,6 +118,7 @@ setup(
),
],
cmdclass={
+ 'bdist_wheel': bdist_wheel,
'build': build,
'build_cexe': build_cexe,
'install': install, | dumb-init is not a pure python package | Yelp_dumb-init | train | py |
445c8e006731cf65843bb7de281aeef5becd4d4c | diff --git a/stats/cloud/client.go b/stats/cloud/client.go
index <HASH>..<HASH> 100644
--- a/stats/cloud/client.go
+++ b/stats/cloud/client.go
@@ -117,7 +117,9 @@ func (c *Client) Do(req *http.Request, v interface{}) error {
func (c *Client) do(req *http.Request, v interface{}, attempt int) (retry bool, err error) {
req.Header.Set("Content-Type", "application/json")
- req.Header.Set("Authorization", fmt.Sprintf("Token %s", c.token))
+ if c.token != "" {
+ req.Header.Set("Authorization", fmt.Sprintf("Token %s", c.token))
+ }
req.Header.Set("User-Agent", "k6cloud/"+c.version)
resp, err := c.client.Do(req) | Fix: anonymous users running the `cloud` collector will not send the `Authorization` header | loadimpact_k6 | train | go |
d8f74411d2872a599d568cbd0f1a59029b54e183 | diff --git a/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java b/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java
index <HASH>..<HASH> 100644
--- a/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java
+++ b/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java
@@ -225,7 +225,7 @@ public class PrestoConnection
public int getTransactionIsolation()
throws SQLException
{
- throw new UnsupportedOperationException("getTransactionIsolation");
+ return TRANSACTION_NONE;
}
@Override | Implement PrestoConnection.getTransactionIsolation
Resolves #<I> | prestodb_presto | train | java |
af0f84f839411c166588bd9c5f0da72d2cae4107 | diff --git a/src/components/multiselect/MultiSelect.js b/src/components/multiselect/MultiSelect.js
index <HASH>..<HASH> 100644
--- a/src/components/multiselect/MultiSelect.js
+++ b/src/components/multiselect/MultiSelect.js
@@ -396,12 +396,11 @@ export class MultiSelect extends Component {
callback && callback();
}
- onOverlayEntered(callback) {
+ onOverlayEntered() {
this.bindDocumentClickListener();
this.bindScrollListener();
this.bindResizeListener();
- callback && callback();
this.props.onShow && this.props.onShow();
} | Fixed #<I> - MultiSelect with transitionOptions property throws an exception | primefaces_primereact | train | js |
ae9a5bfdc8a8dea49487f4ede8a84654fcb76f0f | diff --git a/lib/WebDriverTargetLocator.php b/lib/WebDriverTargetLocator.php
index <HASH>..<HASH> 100644
--- a/lib/WebDriverTargetLocator.php
+++ b/lib/WebDriverTargetLocator.php
@@ -41,10 +41,18 @@ class WebDriverTargetLocator {
/**
* Switch to the iframe by its id or name.
*
+ * @param WebDriverElement|string $frame The WebDriverElement,
+ the id or the name of the frame.
* @return WebDriver The driver focused on the given frame.
*/
- public function frame($id_or_name) {
- $params = array('id' => (string)$id_or_name);
+ public function frame($frame) {
+ if ($frame instanceof WebDriverElement) {
+ $id = array('ELEMENT' => $frame->getID());
+ } else {
+ $id = (string)$frame;
+ }
+
+ $params = array('id' => $id);
$this->executor->execute('focusFrame', $params);
return $this->driver; | [switchTo] switch to frame by WebDriverElement
Allow switching to a frame by the WebDriverElement.
Sample:
$frame_element = $driver->findElement($by);
$driver->switchTo()->frame($frame_element); | facebook_php-webdriver | train | php |
a82caec5212d05c5188e6c4ecf580ea7c0222d05 | diff --git a/src/resource.php b/src/resource.php
index <HASH>..<HASH> 100644
--- a/src/resource.php
+++ b/src/resource.php
@@ -204,6 +204,10 @@ public function fill_data($values) {
* @todo allow to add collections as well
*/
public function add_relation($key, $relation, $skip_include=false) {
+ if (isset($this->primary_relationships[$key]) && $relation instanceof \alsvanzelf\jsonapi\resource == false) {
+ throw new \Exception('can not add a relation twice, unless using a resource object');
+ }
+
if ($relation instanceof \alsvanzelf\jsonapi\resource) {
// add whole resources as included resource, while keeping the relationship
if ($relation->has_data() && $skip_include == false) {
@@ -214,6 +218,12 @@ public function add_relation($key, $relation, $skip_include=false) {
$relation_type = $relation->get_type();
$relation_id = $relation->get_id() ?: null;
+ if (isset($this->primary_relationships[$key])) {
+ $this->primary_relationships[$key]['data']['id'] = array($this->primary_relationships[$key]['data']['id']);
+ $this->primary_relationships[$key]['data']['id'][] = $relation_id;
+ return;
+ }
+
$relation = array(
'links' => array(
'self' => $base_url.'/relationships/'.$relation_type, | modify add_relation method for handle multi same relation | lode_jsonapi | train | php |
4e87f54f2bfdd11782ac73e4a4e15e5f3098a429 | diff --git a/test/entity_test.rb b/test/entity_test.rb
index <HASH>..<HASH> 100644
--- a/test/entity_test.rb
+++ b/test/entity_test.rb
@@ -91,6 +91,13 @@ module XCDM
"Author", inverseName: "article", inverseEntity: "Author" }], e.relationships
end
+ def test_has_one_should_not_plural
+ e.has_one 'address'
+ assert_equal [{ optional: "YES", deletionRule: "Nullify", syncable: "YES",
+ name: "address", minCount: "1", maxCount: "1", destinationEntity:
+ "Address", inverseName: "article", inverseEntity: "Address" }], e.relationships
+ end
+
def test_belongs_to
e.belongs_to 'author'
assert_equal [{ optional: "YES", deletionRule: "Nullify", syncable: "YES", | Added test for entities that end 's' and has_one
The reason for this test is that release <I> has a bug where if you an
entity with the name 'Address' and another entity 'has_one :address',
the relationship is not properly handled.
In other words, if you run this test for verson <I>, it fails. On
master, it succeeds. So this test is simply to prevent regression.
I believe the fix to this was simply when the code updated the version
of ActiveSupport. | infinitered_ruby-xcdm | train | rb |
c1a1ec6b372c4c9d13d386affe9da7117309614a | diff --git a/tests/google/requests/storage/bucket_tests.rb b/tests/google/requests/storage/bucket_tests.rb
index <HASH>..<HASH> 100644
--- a/tests/google/requests/storage/bucket_tests.rb
+++ b/tests/google/requests/storage/bucket_tests.rb
@@ -16,8 +16,7 @@ Shindo.tests('Fog::Storage[:google] | bucket requests', ["google"]) do
'DisplayName' => String,
'ID' => String
},
- 'Size' => Integer,
- 'StorageClass' => String
+ 'Size' => Integer
}]
} | [google|storage] update expected format to remove StorageClass | fog_fog | train | rb |
1ccaa20bb97900594cf666ee10987e7a411a4444 | diff --git a/bot/api/api.py b/bot/api/api.py
index <HASH>..<HASH> 100644
--- a/bot/api/api.py
+++ b/bot/api/api.py
@@ -11,7 +11,7 @@ class Api:
def send_message(self, message: Message, **params):
message_params = message.data.copy()
message_params.update(params)
- return self.telegram_api.sendMessage(**message_params)
+ return self.sendMessage(**message_params)
def get_pending_updates(self):
there_are_pending_updates = True
@@ -22,7 +22,7 @@ class Api:
yield update
def get_updates(self, timeout=45):
- updates = self.telegram_api.getUpdates(offset=self.__get_updates_offset(), timeout=timeout)
+ updates = self.getUpdates(offset=self.__get_updates_offset(), timeout=timeout)
for update in updates:
self.__set_updates_offset(update.update_id)
yield update | Remove direct access to telegram_api from api.py to pass through hook | alvarogzp_telegram-bot-framework | train | py |
bdb8512522018894b3128c993af8908587619b9e | diff --git a/command/node_status.go b/command/node_status.go
index <HASH>..<HASH> 100644
--- a/command/node_status.go
+++ b/command/node_status.go
@@ -12,7 +12,7 @@ type NodeStatusCommand struct {
func (c *NodeStatusCommand) Help() string {
helpText := `
-Usage: nomad node-status [options] [node]
+Usage: nomad node-status [options] <node>
Display status information about a given node. The list of nodes
returned includes only nodes which jobs may be scheduled to, and
diff --git a/command/status.go b/command/status.go
index <HASH>..<HASH> 100644
--- a/command/status.go
+++ b/command/status.go
@@ -18,7 +18,7 @@ type StatusCommand struct {
func (c *StatusCommand) Help() string {
helpText := `
-Usage: nomad status [options] [job]
+Usage: nomad status [options] <job>
Display status information about jobs. If no job ID is given,
a list of all known jobs will be dumped. | standardize on <> for required flags | hashicorp_nomad | train | go,go |
0276f987a2e10469d099690713f65512a6d9fc67 | diff --git a/test/com/google/javascript/jscomp/SymbolTableTest.java b/test/com/google/javascript/jscomp/SymbolTableTest.java
index <HASH>..<HASH> 100644
--- a/test/com/google/javascript/jscomp/SymbolTableTest.java
+++ b/test/com/google/javascript/jscomp/SymbolTableTest.java
@@ -1421,7 +1421,7 @@ public final class SymbolTableTest extends TestCase {
// Add window so that it triggers logic that defines all global externs on window.
// See DeclaredGlobalExternsOnWindow.java pass.
String externs = lines("/** @externs */", "var window", "var foo;");
- String mainCode = lines("foo;", "window.foo;");
+ String mainCode = lines("foo = 2;", "window.foo = 1;");
SymbolTable table = createSymbolTable(mainCode, externs);
Map<String, Integer> refsPerFile = new HashMap<>(); | Fix flakiness of SymbolTableTest.
The flakiness caused by window.foo; being declared both in externs and main code and compiler doesn't know which one is declaration and which one is "usage" and depending on the order of processing they both might be used as declaration.
By changing test to use "window.foo = 1;" the compiler will treat it as usage. And that's how that variable is going to be used in actual code anyway.
-------------
Created by MOE: <URL> | google_closure-compiler | train | java |
57d2ce95381cd713745b1557973ab61f63d03e4f | diff --git a/instaloader/structures.py b/instaloader/structures.py
index <HASH>..<HASH> 100644
--- a/instaloader/structures.py
+++ b/instaloader/structures.py
@@ -134,6 +134,12 @@ class Post:
pic_json = self._context.get_json("p/{0}/".format(self.shortcode), params={})
self._full_metadata_dict = pic_json['entry_data']['PostPage'][0]['graphql']['shortcode_media']
self._rhx_gis_str = pic_json.get('rhx_gis')
+ if self._full_metadata_dict is None:
+ # issue #449
+ self._context.error("Fetching Post metadata failed (issue #449). "
+ "The following data has been returned:\n"
+ + json.dumps(pic_json['entry_data'], indent=2))
+ raise BadResponseException("Fetching Post metadata failed.")
if self.shortcode != self._full_metadata_dict['shortcode']:
self._node.update(self._full_metadata_dict)
raise PostChangedException | Alleviate #<I> by catching bad metadata response
Instead of ungracefully failing with a TypeError, the Post is now skipped with
an error message containing the invalid JSON. | instaloader_instaloader | train | py |
874fd0725cb6252a280d29d52238b2c862e07d07 | diff --git a/deltas/__init__.py b/deltas/__init__.py
index <HASH>..<HASH> 100644
--- a/deltas/__init__.py
+++ b/deltas/__init__.py
@@ -8,7 +8,7 @@ from .tokenizers import (Token, Tokenizer, RegexTokenizer, text_split,
from .segmenters import (Segmenter, Segment, MatchableSegment,
ParagraphsSentencesAndWhitespace)
-__version__ = "0.3.7"
+__version__ = "0.3.8"
__all__ = [apply,
Operation, Insert, Delete, Equal,
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ def requirements(fname):
setup(
name = "deltas",
- version = "0.3.7",
+ version = "0.3.8",
author = "Aaron Halfaker",
author_email = "[email protected]",
description = "An experimental diff library for generating " + \ | Increments version to <I> | halfak_deltas | train | py,py |
2f9a9eff1b9ae563ebf6f31b2715dfeefa9158c6 | diff --git a/tests/Platform/Domains/Addon/Features/UninstallAddonTest.php b/tests/Platform/Domains/Addon/Features/UninstallAddonTest.php
index <HASH>..<HASH> 100644
--- a/tests/Platform/Domains/Addon/Features/UninstallAddonTest.php
+++ b/tests/Platform/Domains/Addon/Features/UninstallAddonTest.php
@@ -18,4 +18,14 @@ class UninstallAddonTest extends TestCase
$this->assertDatabaseMissing('sv_addons', ['slug' => 'superv.addons.sample']);
}
-}
\ No newline at end of file
+
+ function test__rollback_migrations()
+ {
+ $this->setUpAddon(null, null);
+ $this->assertEquals(3, \DB::table('migrations')->where('addon', 'superv.addons.sample')->count());
+
+ UninstallAddonJob::dispatch('superv.addons.sample');
+
+ $this->assertEquals(0, \DB::table('migrations')->where('addon', 'superv.addons.sample')->count());
+ }
+} | Add test to check rolling back migrations | superv_platform | train | php |
3e6a0ab4d098f992d3f97a8627eb091663112ede | diff --git a/quantecon/tests/test_lqcontrol.py b/quantecon/tests/test_lqcontrol.py
index <HASH>..<HASH> 100644
--- a/quantecon/tests/test_lqcontrol.py
+++ b/quantecon/tests/test_lqcontrol.py
@@ -68,8 +68,8 @@ class TestLQControl(unittest.TestCase):
x_seq, u_seq, w_seq = lq_mat.compute_sequence(x0)
- assert_allclose(np.sum(u_seq), .95 * np.sum(x0), rtol=1e-4)
- assert_allclose(x_seq[:, -1], np.zeros_like(x0), rtol=1e-4)
+ assert_allclose(np.sum(u_seq), .95 * np.sum(x0), atol=1e-3)
+ assert_allclose(x_seq[:, -1], np.zeros_like(x0), atol=1e-3)
def test_stationary_mat(self):
@@ -83,8 +83,8 @@ class TestLQControl(unittest.TestCase):
val_func_lq = np.dot(x0, P).dot(x0)
val_func_answer = x0[0]**2
- assert_allclose(f_answer, F, rtol=1e-4)
- assert_allclose(val_func_lq, val_func_answer, rtol=1e-4)
+ assert_allclose(f_answer, F, atol=1e-3)
+ assert_allclose(val_func_lq, val_func_answer, atol=1e-3) | TEST: Lower tolerance on the compute stationary matrices. | QuantEcon_QuantEcon.py | train | py |
4d930b7fea0eaa1220fb3722a9d76d56e199a50f | diff --git a/system_tests/pubsub.py b/system_tests/pubsub.py
index <HASH>..<HASH> 100644
--- a/system_tests/pubsub.py
+++ b/system_tests/pubsub.py
@@ -267,7 +267,8 @@ class TestPubsub(unittest.TestCase):
def _no_topic(instance):
return instance.topic is None
- retry = RetryInstanceState(_no_topic, max_tries=6)
+ # Wait for the topic to clear: up to 63 seconds (2 ** 8 - 1)
+ retry = RetryInstanceState(_no_topic, max_tries=7)
retry(orphaned.reload)()
self.assertTrue(orphaned.topic is None) | Wait even longer for orphaned subscr topic to clear.
See #<I>. | googleapis_google-cloud-python | train | py |
6902ed80e350260b7e6b9e0e2ffd63137c75f973 | diff --git a/server/index.js b/server/index.js
index <HASH>..<HASH> 100644
--- a/server/index.js
+++ b/server/index.js
@@ -152,11 +152,11 @@ function staticFn(req, res) {
function execute(socket, command, cwd) {
const cmd = command.cmd;
- const env = command.env;
+ const env = Object.assign({}, command.env, process.env);
const spawn = spawnify(cmd, {
- cwd: cwd(),
- env: env
+ env,
+ cwd: cwd()
});
socket.on('kill', kill); | fix(index) execute: old env variables droped by new ones | cloudcmd_console-io | train | js |
5d4bb9c2e0b67717fca80db0dd09ea40c6029713 | diff --git a/lib/Cake/Event/CakeEventManager.php b/lib/Cake/Event/CakeEventManager.php
index <HASH>..<HASH> 100644
--- a/lib/Cake/Event/CakeEventManager.php
+++ b/lib/Cake/Event/CakeEventManager.php
@@ -222,7 +222,7 @@ class CakeEventManager {
* Dispatches a new event to all configured listeners
*
* @param string|CakeEvent $event the event key name or instance of CakeEvent
- * @return void
+ * @return CakeEvent
*/
public function dispatch($event) {
if (is_string($event)) {
@@ -231,7 +231,7 @@ class CakeEventManager {
$listeners = $this->listeners($event->name());
if (empty($listeners)) {
- return;
+ return $event;
}
foreach ($listeners as $listener) {
@@ -250,6 +250,7 @@ class CakeEventManager {
$event->result = $result;
}
}
+ return $event;
}
/** | Make dispatch return CakeEvent - resolves #<I> | cakephp_cakephp | train | php |
b106b91a541e617aa11aba4188574197a2533213 | diff --git a/lib/fs_utils/generate.js b/lib/fs_utils/generate.js
index <HASH>..<HASH> 100644
--- a/lib/fs_utils/generate.js
+++ b/lib/fs_utils/generate.js
@@ -192,12 +192,15 @@ const generate = (path, sourceFiles, config, optimizers) => {
return Promise.reject(error);
})
.then(data => {
- common.writeFile(path, data.code);
- return data;
+ return common.writeFile(path, data.code).then(() => {
+ return data;
+ });
})
.then(data => {
if (withMaps) {
- common.writeFile(mapPath, data.map.toString());
+ return common.writeFile(mapPath, data.map.toString()).then(() => {
+ return data;
+ });
}
return data;
}); | We have to return the 'write' promise, else the callbacks are called before the files are actually written | brunch_brunch | train | js |
0e5477dcf2e6fc48cbf42fc484ae121db442e6eb | diff --git a/app/controllers/rails_i18nterface/translate_controller.rb b/app/controllers/rails_i18nterface/translate_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/rails_i18nterface/translate_controller.rb
+++ b/app/controllers/rails_i18nterface/translate_controller.rb
@@ -22,8 +22,8 @@ module RailsI18nterface
def export
locale = params[:locale].to_sym
- #keys = {locale => I18n.backend.send(:translations)[locale]}
- keys = {locale => {}}
+ keys = {locale => I18n.backend.send(:translations)[locale]}
+ #keys = {locale => {}}
Translation.where(:locale => @to_locale).each { |translation|
next if translation.value == ''
next if !translation.value | export ALL translations, even from old yaml | mose_rails-i18nterface | train | rb |
8fd0a3a5f6a478f319763f999aaf5d8531c52b1d | diff --git a/spectrum.js b/spectrum.js
index <HASH>..<HASH> 100644
--- a/spectrum.js
+++ b/spectrum.js
@@ -249,7 +249,7 @@
if (opts.palette) {
palette = opts.palette.slice(0);
- paletteArray = $.isArray(palette[0]) ? palette : [palette];
+ paletteArray = Array.isArray(palette[0]) ? palette : [palette];
paletteLookup = {};
for (var i = 0; i < paletteArray.length; i++) {
for (var j = 0; j < paletteArray[i].length; j++) {
@@ -321,14 +321,14 @@
}
// Prevent clicks from bubbling up to document. This would cause it to be hidden.
- container.click(stopPropagation);
+ container.on("click", stopPropagation);
// Handle user typed input
- textInput.change(setFromTextInput);
+ textInput.on("change", setFromTextInput);
textInput.on("paste", function () {
setTimeout(setFromTextInput, 1);
});
- textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
+ textInput.on("keydown", function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
cancelButton.text(opts.cancelText);
cancelButton.on("click.spectrum", function (e) { | Replace deprecated jQuery methods
Fixes these warnings from jquery-migrate:
JQMIGRATE: jQuery.isArray is deprecated; use Array.isArray
JQMIGRATE: jQuery.fn.click() event shorthand is deprecated
JQMIGRATE: jQuery.fn.change() event shorthand is deprecated
JQMIGRATE: jQuery.fn.keydown() event shorthand is deprecated | bgrins_spectrum | train | js |
399681ce4c02f56562fd6cf1fc972805c40e29d6 | diff --git a/cmsplugin_cascade/generic/mixins.py b/cmsplugin_cascade/generic/mixins.py
index <HASH>..<HASH> 100644
--- a/cmsplugin_cascade/generic/mixins.py
+++ b/cmsplugin_cascade/generic/mixins.py
@@ -40,14 +40,14 @@ class SectionModelMixin(object):
if id_attr:
return '{bookmark_prefix}{0}'.format(id_attr, **CMSPLUGIN_CASCADE)
- def delete(self):
+ def delete(self, *args, **kwargs):
try:
self.placeholder.page.cascadepage.glossary['element_ids'].pop(str(self.pk))
except (AttributeError, KeyError, ObjectDoesNotExist):
pass
else:
self.placeholder.page.cascadepage.save()
- super(SectionModelMixin, self).delete()
+ super(SectionModelMixin, self).delete(*args, **kwargs)
class SectionMixin(object): | bypass args and kwargs | jrief_djangocms-cascade | train | py |
50bbe8c4d126b8f7bfe594ca74e88ad682e0288d | diff --git a/src/hamster/lib/__init__.py b/src/hamster/lib/__init__.py
index <HASH>..<HASH> 100644
--- a/src/hamster/lib/__init__.py
+++ b/src/hamster/lib/__init__.py
@@ -264,7 +264,7 @@ def parse_fact(text, phase=None, res=None, date=None):
date = dt.datetime.strptime(fragment, DATE_FMT).date()
remaining_text = remove_fragment(text, fragment)
except ValueError:
- date = now.date()
+ date = datetime_to_hamsterday(now)
remaining_text = text
return parse_fact(remaining_text, "start_time", res, date) | take the current hamster day as default date | projecthamster_hamster | train | py |
18bc77c35940c74845e2d2bc6770350b72ceba35 | diff --git a/command/state/state.go b/command/state/state.go
index <HASH>..<HASH> 100644
--- a/command/state/state.go
+++ b/command/state/state.go
@@ -16,7 +16,7 @@ import (
)
const (
- LockThreshold = 250 * time.Millisecond
+ LockThreshold = 400 * time.Millisecond
LockMessage = "Acquiring state lock. This may take a few moments..."
UnlockMessage = "Releasing state lock. This may take a few moments..." | command/state: up the threshold for showing lock info | hashicorp_terraform | train | go |
3e5fe45417a0d594a378b1f5bb3997a911722ce5 | diff --git a/network/stats.go b/network/stats.go
index <HASH>..<HASH> 100644
--- a/network/stats.go
+++ b/network/stats.go
@@ -44,11 +44,8 @@ func GetStats(networkState *NetworkState) (NetworkStats, error) {
func readSysfsNetworkStats(ethInterface string) (map[string]uint64, error) {
out := make(map[string]uint64)
- fullPath, err := filepath.Abs(filepath.Join("/sys/class/net", ethInterface, "statistics/"))
- if err != nil {
- return out, nil
- }
- err = filepath.Walk(fullPath, func(path string, _ os.FileInfo, _ error) error {
+ fullPath := filepath.Join("/sys/class/net", ethInterface, "statistics/")
+ err := filepath.Walk(fullPath, func(path string, _ os.FileInfo, _ error) error {
// skip fullPath.
if path == fullPath {
return nil | Further refactoring.
Docker-DCO-<I>- | opencontainers_runc | train | go |
12ac5b9c5bda6418841e5e4e233d2516333c5b25 | diff --git a/salt/fileserver/__init__.py b/salt/fileserver/__init__.py
index <HASH>..<HASH> 100644
--- a/salt/fileserver/__init__.py
+++ b/salt/fileserver/__init__.py
@@ -532,3 +532,26 @@ class Fileserver(object):
(x, y) for x, y in ret.items() if x.startswith(prefix)
])
return ret
+
+
+class FSChan(object):
+ '''
+ A class that mimics the transport channels allowing for local access to
+ to the fileserver class class structure
+ '''
+ def __init__(self, opts, **kwargs):
+ self.opts = opts
+ self.kwargs = kwargs
+ self.fs = Fileserver(self.opts)
+
+ def send(self, load, tries=None, timeout=None):
+ '''
+ Emulate the channel send method, the tries and timeout are not used
+ '''
+ if 'cmd' not in load:
+ log.error('Malformed request: {0}'.format(load))
+ return {}
+ if not hasattr(self.fs, load['cmd']):
+ log.error('Malformed request: {0}'.format(load))
+ return {}
+ return getattr(self.fs, load['cmd'])(load) | Add initial FSChan object
This object will allow us to replace a channel in the file client
with a local channel that just uses the file server class | saltstack_salt | train | py |
a346f0a75db01fef3eb228889c148ef03f602a3c | diff --git a/src/GameQ/Filters/Stripcolors.php b/src/GameQ/Filters/Stripcolors.php
index <HASH>..<HASH> 100644
--- a/src/GameQ/Filters/Stripcolors.php
+++ b/src/GameQ/Filters/Stripcolors.php
@@ -33,6 +33,8 @@ class Stripcolors extends Base
/**
* Apply this filter
*
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ *
* @param array $result
* @param \GameQ\Server $server
*
@@ -62,6 +64,9 @@ class Stripcolors extends Base
case 'gamespy2':
array_walk_recursive($result, [$this, 'stripUnreal']);
break;
+ case 'source':
+ array_walk_recursive($result, [$this, 'stripSource']);
+ break;
}
/*$data['filtered'][ $server->id() ] = $result;
@@ -97,4 +102,14 @@ class Stripcolors extends Base
{
$string = preg_replace('/\x1b.../', '', $string);
}
+
+ /**
+ * Strip color codes from Source based games
+ *
+ * @param string $string
+ */
+ protected function stripSource(&$string)
+ {
+ $string = strip_tags($string);
+ }
} | Source based games support (#<I>)
* Source based games support
Remove HTML tags.
Example:
Before - [RU/EU] <color=#ffe<I>>HURTWORLD ❷</color>
After - [RU/EU] HURTWORLD ❷
* Change line endings
* PHPMD being annoying. | Austinb_GameQ | train | php |
6b2a2ce08d3b945a6f8cf93bf0f5bab8137ab5e1 | diff --git a/entry_types/scrolled/package/spec/support/stories.js b/entry_types/scrolled/package/spec/support/stories.js
index <HASH>..<HASH> 100644
--- a/entry_types/scrolled/package/spec/support/stories.js
+++ b/entry_types/scrolled/package/spec/support/stories.js
@@ -268,7 +268,7 @@ export function examplePositionedElement({sectionId, position, caption}) {
typeName: 'inlineImage',
configuration: {
position,
- id: filePermaId('imageFiles', 'turtle'),
+ id: null,
caption
}
} | Use empty inline images in appearance stories
Prevent big images from loading to slowly and thus not showing up in
snapshots causing false positives on Percy.
REDMINE-<I> | codevise_pageflow | train | js |
f7a7597ecf5329c6a3fe3b157567825fbb99bdfa | diff --git a/lib/transform/get-deps.js b/lib/transform/get-deps.js
index <HASH>..<HASH> 100644
--- a/lib/transform/get-deps.js
+++ b/lib/transform/get-deps.js
@@ -26,6 +26,7 @@ module.exports = function(config, writer) {
if(args.length === 1 && args[0].type === 'Literal') {
var req = args[0].value
+ if(/.*\/$/g.test(req)) req = req + 'index.js' //require('./lib/')
if(config.map && config.map[req]) req = config.map[req]
var dep = Module({base: file.base , requiredAs: req }) | resolving require when pointing to dir (dirname/index.js) | damianbaar_re-define | train | js |
fe23306a01599bc6200f1497f1c444c7bbb14706 | diff --git a/tests/test_gui.py b/tests/test_gui.py
index <HASH>..<HASH> 100644
--- a/tests/test_gui.py
+++ b/tests/test_gui.py
@@ -30,3 +30,6 @@ class TestGui (unittest.TestCase):
window = LinkCheckerMain()
window.show()
QtTest.QTest.mouseClick(window.controlButton, QtCore.Qt.LeftButton)
+ window.close()
+ del window
+ del app | Close GUI test window and delete instances to be sure QT deallocation routines are run. | wummel_linkchecker | train | py |
a4b3e61935d32af3f54b4adda012a9362112d829 | diff --git a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java
index <HASH>..<HASH> 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadata.java
@@ -120,6 +120,7 @@ public interface HasMetadata extends KubernetesResource {
: Pluralize.toPlural(getSingular(clazz)));
}
+ @JsonIgnore
default String getPlural() {
return getPlural(getClass());
}
@@ -139,6 +140,7 @@ public interface HasMetadata extends KubernetesResource {
.toLowerCase(Locale.ROOT);
}
+ @JsonIgnore
default String getSingular() {
return getSingular(getClass());
} | fix: do not include getSingular/Plural in serialization | fabric8io_kubernetes-client | train | java |
48e65f5743a0e335653007afc59e3aea623ec32a | diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index <HASH>..<HASH> 100644
--- a/test/psych/test_string.rb
+++ b/test/psych/test_string.rb
@@ -68,7 +68,7 @@ module Psych
def test_literal_when_inner_and_final_line_break
str = "Lorem ipsum\ndolor\n"
yaml = Psych.dump str, line_width: 12
- assert_match /---\s*|\n(.*\n){2}\Z/, yaml
+ assert_match /---\s*\|\n(.*\n){2}\Z/, yaml
assert_equal str, Psych.load(yaml)
end
@@ -76,7 +76,7 @@ module Psych
def test_literal_strip_when_inner_line_break_and_no_final_line_break
str = "Lorem ipsum\ndolor"
yaml = Psych.dump str, line_width: 12
- assert_match /---\s*|-\n(.*\n){2}\Z/, yaml
+ assert_match /---\s*\|-\n(.*\n){2}\Z/, yaml
assert_equal str, Psych.load(yaml)
end | Fix assertion regexps
`|' is a meta character, so needs to be escaped. | ruby_psych | train | rb |
b398c472184b78ac6e8e6997addd08f72a8ce2cc | diff --git a/langserver/hover.go b/langserver/hover.go
index <HASH>..<HASH> 100644
--- a/langserver/hover.go
+++ b/langserver/hover.go
@@ -336,11 +336,9 @@ func (h *LangHandler) handleHoverGodef(ctx context.Context, conn jsonrpc2.JSONRP
return nil, fmt.Errorf("failed to find doc object for %s", target)
}
- contents, node := fmtDocObject(fset, docObject, target)
- r := rangeForNode(fset, node)
+ contents, _ := fmtDocObject(fset, docObject, target)
return &lsp.Hover{
Contents: contents,
- Range: &r,
}, nil
} | hover: Do not return range for godef (#<I>)
The optional range returned should be the range of the token the user is
hovering over. Instead we are returning the range of the definition. It isn't
trivial to return the correct range, so rather lets return nothing at all
which is more correct. | sourcegraph_go-langserver | train | go |
b01599e7b9cbb54a85b23d0ac1c4a23862a60e3f | diff --git a/editor/models/file.js b/editor/models/file.js
index <HASH>..<HASH> 100644
--- a/editor/models/file.js
+++ b/editor/models/file.js
@@ -95,6 +95,7 @@ define([
'path': path
})
.then(function(file) {
+ that.del("buffer", { silent: true });
return that.set(file);
})
.thenResolve(that); | After stat call on File model remove buffer state | CodeboxIDE_codebox | train | js |
3a829fac7bb722a0984d81b063d7ef124a0ca988 | diff --git a/langserver/langserver_test.go b/langserver/langserver_test.go
index <HASH>..<HASH> 100644
--- a/langserver/langserver_test.go
+++ b/langserver/langserver_test.go
@@ -1216,8 +1216,8 @@ func lspTests(t testing.TB, ctx context.Context, fs *AtomicFS, c *jsonrpc2.Conn,
// Run the tests.
for pos, want := range wantGodefDefinition {
- if strings.HasPrefix(want, "/goroot/") {
- want = strings.Replace(want, "/goroot/", utils.UriToPath(utils.PathToURI(build.Default.GOROOT)), 1)
+ if strings.HasPrefix(want, "/goroot") {
+ want = strings.Replace(want, "/goroot", path.Clean(utils.UriToPath(utils.PathToURI(build.Default.GOROOT))), 1)
}
tbRun(t, fmt.Sprintf("godef-definition-%s", strings.Replace(pos, "/", "-", -1)), func(t testing.TB) {
definitionTest(t, ctx, c, utils.PathToURI(tmpRootPath), pos, want, tmpDir) | fix failing goroot test if GOROOT does not have a trailing slash | sourcegraph_go-langserver | train | go |
c2b02fc4b3ab6288a578e01ab51f5e124ba146d0 | diff --git a/src/Console/Commands/CoreInstallCommand.php b/src/Console/Commands/CoreInstallCommand.php
index <HASH>..<HASH> 100644
--- a/src/Console/Commands/CoreInstallCommand.php
+++ b/src/Console/Commands/CoreInstallCommand.php
@@ -31,7 +31,9 @@ class CoreInstallCommand extends Command
{
$this->alert($this->description);
- $this->call('cortex:publish', ['--force' => $this->option('force'), '--resource' => $this->option('resource') ?: ['config']]);
+ // Publish assets only if explicitly required, otherwise skip for clean installation
+ ! $this->option('resource') || $this->call('cortex:publish', ['--force' => $this->option('force'), '--resource' => $this->option('resource')]);
+
$this->call('cortex:migrate', ['--force' => $this->option('force')]);
$this->call('cortex:seed'); | Publish assets only if explicitly required, otherwise skip for clean installation | rinvex_cortex-foundation | train | php |
00c1828a12c245e839eae1de85098b2750effbfe | diff --git a/smbclient/_pool.py b/smbclient/_pool.py
index <HASH>..<HASH> 100644
--- a/smbclient/_pool.py
+++ b/smbclient/_pool.py
@@ -206,7 +206,7 @@ def delete_session(server, port=445, connection_cache=None):
:param port: The port used for the server.
:param connection_cache: Connection cache to be used with
"""
- connection_key = "%s:%s" % (server, port)
+ connection_key = "%s:%s" % (server.lower(), port)
if connection_cache is None:
connection_cache = _SMB_CONNECTIONS | Consistent connection_key naming (#<I>)
The naming of the connection_key isn't consistent between register_session and delete_session | jborean93_smbprotocol | train | py |
98fa224ec62032cc9a65b214213bc1ca6e895db0 | diff --git a/liquibase-integration-tests/src/test/java/liquibase/lockservice/LockServiceExecuteTest.java b/liquibase-integration-tests/src/test/java/liquibase/lockservice/LockServiceExecuteTest.java
index <HASH>..<HASH> 100644
--- a/liquibase-integration-tests/src/test/java/liquibase/lockservice/LockServiceExecuteTest.java
+++ b/liquibase-integration-tests/src/test/java/liquibase/lockservice/LockServiceExecuteTest.java
@@ -76,6 +76,12 @@ public class LockServiceExecuteTest {
fixupLockTables();
}
+
+ @Test
+ public void nothing() {
+
+ }
+
//todo: failing on build server: re-enable
// @Test
// public void waitForLock_twoConnections() throws Exception { | trying to get tests to pass on build server.
git-svn-id: <URL> | liquibase_liquibase | train | java |
1f5ffad385089bfcc761d5938d45f97e4a39100b | diff --git a/mbuild/examples/test_examples.py b/mbuild/examples/test_examples.py
index <HASH>..<HASH> 100644
--- a/mbuild/examples/test_examples.py
+++ b/mbuild/examples/test_examples.py
@@ -47,8 +47,8 @@ def run_notebook(nb):
if cell.cell_type != 'code':
continue
kc.execute(cell.source)
- # wait for finish, maximum 20s
- reply = shell.get_msg(timeout=20)['content']
+ # wait for finish, maximum 60s
+ reply = shell.get_msg(timeout=60)['content']
if reply['status'] == 'error':
failures += 1
print("\nFAILURE:") | Increase timeout for examples tests to <I> seconds | mosdef-hub_mbuild | train | py |
9442ff78d940bcb562740b80bab25583ef47c09e | diff --git a/js/modules/k6/http/http.go b/js/modules/k6/http/http.go
index <HASH>..<HASH> 100644
--- a/js/modules/k6/http/http.go
+++ b/js/modules/k6/http/http.go
@@ -23,7 +23,6 @@ package http
import (
"bytes"
"context"
- "encoding/json"
"fmt"
"io"
"net" | Accidentally merged in an unused import | loadimpact_k6 | train | go |
5337b19f8f5e2f3f20d198992d324d969c469aa7 | diff --git a/Response.php b/Response.php
index <HASH>..<HASH> 100644
--- a/Response.php
+++ b/Response.php
@@ -18,19 +18,17 @@ class Response extends EventEmitter implements WritableStreamInterface
{
$this->conn = $conn;
- $that = $this;
-
- $this->conn->on('end', function () use ($that) {
- $that->close();
+ $this->conn->on('end', function () {
+ $this->close();
});
- $this->conn->on('error', function ($error) use ($that) {
- $that->emit('error', array($error, $that));
- $that->close();
+ $this->conn->on('error', function ($error) {
+ $this->emit('error', array($error, $this));
+ $this->close();
});
- $this->conn->on('drain', function () use ($that) {
- $that->emit('drain');
+ $this->conn->on('drain', function () {
+ $this->emit('drain');
});
} | Clean up annoying <I> $that = $this | reactphp_http | train | php |
78aed5beed0e8758a17b589a7fd0c96f50e4a6dd | diff --git a/tunnel/default.go b/tunnel/default.go
index <HASH>..<HASH> 100644
--- a/tunnel/default.go
+++ b/tunnel/default.go
@@ -201,15 +201,15 @@ func (t *tun) announce(channel, session string, link *link) {
}
// manage monitors outbound links and attempts to reconnect to the failed ones
-func (t *tun) manage() {
- reconnect := time.NewTicker(ReconnectTime)
- defer reconnect.Stop()
+func (t *tun) manage(reconnect time.Duration) {
+ r := time.NewTicker(reconnect)
+ defer r.Stop()
for {
select {
case <-t.closed:
return
- case <-reconnect.C:
+ case <-r.C:
t.manageLinks()
}
}
@@ -862,8 +862,11 @@ func (t *tun) setupLink(node string) (*link, error) {
// create a new link
link := newLink(c)
+
// set link id to remote side
+ link.Lock()
link.id = c.Remote()
+ link.Unlock()
// send the first connect message
if err := t.sendMsg("connect", link); err != nil {
@@ -984,7 +987,7 @@ func (t *tun) Connect() error {
t.setupLinks()
// manage the links
- go t.manage()
+ go t.manage(ReconnectTime)
return nil
} | Fixed tunnel race conditions. (#<I>) | micro_go-micro | train | go |
944ff60bc54862dc034989732485f1776375e3aa | diff --git a/stemcell/repo.go b/stemcell/repo.go
index <HASH>..<HASH> 100644
--- a/stemcell/repo.go
+++ b/stemcell/repo.go
@@ -22,10 +22,6 @@ func NewRepo(configService bmconfig.DeploymentConfigService) repo {
}
}
-// Save extracts the stemcell archive,
-// parses the stemcell manifest,
-// and stores the stemcell archive in the repo.
-// The repo stemcell record is indexed by name & sha1 (as specified by the manifest).
func (r repo) Save(stemcell Stemcell, cid CID) error {
config, err := r.configService.Load()
if err != nil { | Remove lying comment
The repo doesn't extract and save the stemcell; it is provided the Stemcell
struct which is a representation of the already-extracted stemcell.
repo.Save only saves the record of the already-extracted stemcell in the local
filesystem. | cloudfoundry_bosh-cli | train | go |
b3f513132242331325cccb333c1d34a4b4da887c | diff --git a/mtools/mplotqueries/mplotqueries.py b/mtools/mplotqueries/mplotqueries.py
index <HASH>..<HASH> 100755
--- a/mtools/mplotqueries/mplotqueries.py
+++ b/mtools/mplotqueries/mplotqueries.py
@@ -105,7 +105,7 @@ class MPlotQueriesTool(LogFileTool):
self.args['group'] = 'filename'
plot_instance = self.plot_types[self.args['type']](args=self.args, unknown_args=self.unknown_args)
-
+
for logfile in self.logfiles:
start = None
@@ -115,6 +115,9 @@ class MPlotQueriesTool(LogFileTool):
if not start:
start = logline.datetime
+ if logline.datetime:
+ end = logline.datetime
+
if multiple_files:
# amend logline object with filename for group by filename
logline.filename = logfile.name
@@ -140,8 +143,6 @@ class MPlotQueriesTool(LogFileTool):
line_accepted = True
plot_instance.add_line(logline)
- end = logline.datetime
-
# store start and end for each logfile
self.logfile_ranges.append( (start, end) ) | fix for mplotqueries to not fail if the last line is empty. | rueckstiess_mtools | train | py |
516de5647aef5903e7ced676bd018a1dbdfe9cb2 | diff --git a/kubetest/kops.go b/kubetest/kops.go
index <HASH>..<HASH> 100644
--- a/kubetest/kops.go
+++ b/kubetest/kops.go
@@ -470,7 +470,7 @@ func (k kops) Up() error {
}
// TODO: Once this gets support for N checks in a row, it can replace the above node readiness check
- if err := control.FinishRunning(exec.Command(k.path, "validate", "cluster", k.cluster, "--wait", "5m")); err != nil {
+ if err := control.FinishRunning(exec.Command(k.path, "validate", "cluster", k.cluster, "--wait", "15m")); err != nil {
return fmt.Errorf("kops validate cluster failed: %v", err)
} | Update kubetest/kops.go | kubernetes_test-infra | train | go |
0f74f5f340b41482dfc292c100032e3f37fe8225 | diff --git a/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java b/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java
index <HASH>..<HASH> 100644
--- a/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java
+++ b/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java
@@ -461,7 +461,7 @@ public abstract class AbstractCluster extends Cluster {
* @return the provider
*/
protected ProviderInfo selectPinpointProvider(String targetIP, List<ProviderInfo> providerInfos) {
- ProviderInfo tp = ProviderHelper.toProviderInfo(targetIP);
+ ProviderInfo tp = convertToProviderInfo(targetIP);
// 存在注册中心provider才会遍历
if (CommonUtils.isNotEmpty(providerInfos)) {
for (ProviderInfo providerInfo : providerInfos) {
@@ -476,6 +476,10 @@ public abstract class AbstractCluster extends Cluster {
return tp;
}
+ protected ProviderInfo convertToProviderInfo(String targetIP) {
+ return ProviderHelper.toProviderInfo(targetIP);
+ }
+
/**
* 找不到可用的服务列表的异常
* | refactor:extract method in AbstractCluster (#<I>)
* refactor:extract method | alipay_sofa-rpc | train | java |
f8d40b86a4e731875329946c834816700b0a3111 | diff --git a/htmresearch/frameworks/layers/l2_l4_inference.py b/htmresearch/frameworks/layers/l2_l4_inference.py
index <HASH>..<HASH> 100644
--- a/htmresearch/frameworks/layers/l2_l4_inference.py
+++ b/htmresearch/frameworks/layers/l2_l4_inference.py
@@ -131,6 +131,7 @@ class L4L2Experiment(object):
inputSize=1024,
numInputBits=20,
externalInputSize=1024,
+ numExternalInputBits=20,
L2Overrides=None,
L4RegionType="py.ExtendedTMRegion",
L4Overrides=None,
@@ -162,6 +163,9 @@ class L4L2Experiment(object):
@param externalInputSize (int)
Size of the lateral input to L4 regions
+ @param numExternalInputBits (int)
+ Number of ON bits in the external input patterns
+
@param L2Overrides (dict)
Parameters to override in the L2 region
@@ -219,7 +223,7 @@ class L4L2Experiment(object):
"sensorInputSize": inputSize,
"L4RegionType": L4RegionType,
"L4Params": self.getDefaultL4Params(L4RegionType, inputSize,
- numInputBits),
+ numExternalInputBits),
"L2Params": self.getDefaultL2Params(inputSize, numInputBits),
} | set default L4 params based on number of ON bits in external input | numenta_htmresearch | train | py |
bc53574e9e97da790da967f42c0a355ac5b41e87 | diff --git a/dist/keo.js b/dist/keo.js
index <HASH>..<HASH> 100644
--- a/dist/keo.js
+++ b/dist/keo.js
@@ -148,7 +148,7 @@ function runTimeout(fun) {
return setTimeout(fun, 0);
}
try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
+ // when when somebody has screwed with setTimeout but no I.E. madness
return cachedSetTimeout(fun, 0);
} catch (e) {
try {
@@ -171,7 +171,7 @@ function runClearTimeout(marker) {
return clearTimeout(marker);
}
try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
+ // when when somebody has screwed with setTimeout but no I.E. madness
return cachedClearTimeout(marker);
} catch (e) {
try {
@@ -4121,4 +4121,4 @@ module.exports = require("axios");
module.exports = require("react-dom");
/***/ })
-/******/ ]);
\ No newline at end of file
+/******/ ]); | docs: Fix simple typo, maddness -> madness
There is a small typo in dist/keo.js.
Should read `madness` rather than `maddness`. | Wildhoney_Keo | train | js |
2e4f6129f60298642a762c2dced215516a89a0ca | diff --git a/lib/OpenLayers/Control/LayerSwitcher.js b/lib/OpenLayers/Control/LayerSwitcher.js
index <HASH>..<HASH> 100644
--- a/lib/OpenLayers/Control/LayerSwitcher.js
+++ b/lib/OpenLayers/Control/LayerSwitcher.js
@@ -22,10 +22,10 @@ OpenLayers.Control.LayerSwitcher.prototype =
Object.extend( new OpenLayers.Control(), {
/** @type String */
- activeColor: OpenLayers.Control.LayerSwitcher.ACTIVE_COLOR,
+ activeColor: "",
/** @type String */
- nonActiveColor: OpenLayers.Control.LayerSwitcher.NONACTIVE_COLOR,
+ nonActiveColor: "",
/**
@@ -33,6 +33,8 @@ OpenLayers.Control.LayerSwitcher.prototype =
*/
initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
+ this.activeColor = OpenLayers.Control.LayerSwitcher.ACTIVE_COLOR;
+ this.nonActiveColor = OpenLayers.Control.LayerSwitcher.NONACTIVE_COLOR;
},
/** | forgot that these declarations are still only statically initialized. even though the chance of somebody *modifying* one of these strings (rather than just replacing it) is rather low... we might as well do things the right way
git-svn-id: <URL> | openlayers_openlayers | train | js |
a2dbf7f65ae6dda153a0174dea3f05051bb6db84 | diff --git a/spec/unit/hooks_spec.rb b/spec/unit/hooks_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/hooks_spec.rb
+++ b/spec/unit/hooks_spec.rb
@@ -94,6 +94,7 @@ describe 'Flor unit' do
it 'may filter on point:/p:' do
+begin
ms0 = []
@unit.hook(point: 'execute') { |m| ms0 << Flor.dup(m); [] }
ms1 = []
@@ -108,6 +109,12 @@ describe 'Flor unit' do
ms0.collect { |m| m['point'] }.uniq).to eq(%w[ execute ])
expect(
ms1.collect { |m| m['point'] }.uniq).to eq(%w[ execute terminated ])
+rescue (defined?(Java::JavaLang::Exception) ? Java::JavaLang::Exception : Exception) => ex
+ puts "=" * 80
+ p ex.inspect
+ puts ex.backtrace
+ puts "-" * 80
+end
end
it 'may filter on domain:/d:' do | Gather info about JRuby thread-safety in hook spec | floraison_flor | train | rb |
1afb3d74906b42e8006bd13f6643c6b43498c279 | diff --git a/src/Laravel/Cashier/CashierServiceProvider.php b/src/Laravel/Cashier/CashierServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/Laravel/Cashier/CashierServiceProvider.php
+++ b/src/Laravel/Cashier/CashierServiceProvider.php
@@ -11,7 +11,7 @@ class CashierServiceProvider extends ServiceProvider {
*/
public function boot()
{
- $this->loadViewsFrom('cashier', __DIR__.'/../../views');
+ $this->loadViewsFrom(__DIR__.'/../../views', 'cashier');
}
/**
diff --git a/src/Laravel/Cashier/Invoice.php b/src/Laravel/Cashier/Invoice.php
index <HASH>..<HASH> 100644
--- a/src/Laravel/Cashier/Invoice.php
+++ b/src/Laravel/Cashier/Invoice.php
@@ -326,7 +326,7 @@ class Invoice {
*/
protected function writeViewForImaging(array $data, $storagePath)
{
- $storagePath = $storagePath ?: storage_path().'/meta';
+ $storagePath = $storagePath ?: storage_path().'/framework';
$this->files->put($path = $storagePath.'/'.md5($this->id).'.pdf', $this->render($data)); | Fix a few L5 bugs. | laravel_cashier | train | php,php |
c4c9935bb3cd55c1dee3d1d1432b51d1c99fc19a | diff --git a/src/Module.php b/src/Module.php
index <HASH>..<HASH> 100644
--- a/src/Module.php
+++ b/src/Module.php
@@ -19,7 +19,7 @@ use Cawa\Core\DI;
use Cawa\Events\DispatcherFactory;
use Cawa\Events\TimerEvent;
use Cawa\Log\Event;
-use Cawa\Orm\TraitSerializable;
+use Cawa\Orm\SerializableTrait;
use Cawa\Router\Route;
use Cawa\Session\SessionFactory;
@@ -27,7 +27,7 @@ class Module extends \Cawa\App\Module
{
use SessionFactory;
use DispatcherFactory;
- use TraitSerializable;
+ use SerializableTrait;
/**
* @return bool | Rename TraitXxx to XxxTrait | cawaphp_module-clockwork | train | php |
6a4fbb9892c50d930834e09be2d8a339b4fff3e2 | diff --git a/feature_stream.go b/feature_stream.go
index <HASH>..<HASH> 100644
--- a/feature_stream.go
+++ b/feature_stream.go
@@ -184,14 +184,14 @@ func (stream *Stream) Flush() error {
func (stream *Stream) ensure(minimal int) {
available := stream.Available()
if available < minimal {
- if stream.n > 1024 {
- stream.Flush()
- }
stream.growAtLeast(minimal)
}
}
func (stream *Stream) growAtLeast(minimal int) {
+ if stream.out != nil {
+ stream.Flush()
+ }
toGrow := len(stream.buf)
if toGrow < minimal {
toGrow = minimal | ensure buffer flushed to io.Writer | json-iterator_go | train | go |
3a9f4faecfe7a777d63d19e0840139f34174e2bb | diff --git a/src/select.js b/src/select.js
index <HASH>..<HASH> 100644
--- a/src/select.js
+++ b/src/select.js
@@ -381,6 +381,10 @@
// Remove item from multiple select
ctrl.removeChoice = function(index){
var removedChoice = ctrl.selected[index];
+
+ // if the choice is locked, can't remove it
+ if(removedChoice._uiSelectChoiceLocked) return;
+
var locals = {};
locals[ctrl.parserResult.itemName] = removedChoice; | Fix for backspace allowing removal of locked selections | angular-ui_ui-select | train | js |
6c77fdf66183ef5426b9c6c070ba278d957ebca0 | diff --git a/test/test_datasets_utils.py b/test/test_datasets_utils.py
index <HASH>..<HASH> 100644
--- a/test/test_datasets_utils.py
+++ b/test/test_datasets_utils.py
@@ -1,3 +1,4 @@
+import os
import shutil
import tempfile
import torch
@@ -11,12 +12,14 @@ class Tester(unittest.TestCase):
temp_dir = tempfile.mkdtemp()
url = "http://github.com/pytorch/vision/archive/master.zip"
utils.download_url(url, temp_dir)
+ assert not len(os.listdir(temp_dir)) == 0, 'The downloaded root directory is empty after download.'
shutil.rmtree(temp_dir)
def test_download_url_retry_http(self):
temp_dir = tempfile.mkdtemp()
url = "https://github.com/pytorch/vision/archive/master.zip"
utils.download_url(url, temp_dir)
+ assert not len(os.listdir(temp_dir)) == 0, 'The downloaded root directory is empty after download.'
shutil.rmtree(temp_dir) | Test - Added downloaded directory not empty check in test_datasets_utils (#<I>) | pytorch_vision | train | py |
2579d992616707c644d9c973c24100fe65469452 | diff --git a/src/main/java/net/bootsfaces/component/modal/ModalRenderer.java b/src/main/java/net/bootsfaces/component/modal/ModalRenderer.java
index <HASH>..<HASH> 100644
--- a/src/main/java/net/bootsfaces/component/modal/ModalRenderer.java
+++ b/src/main/java/net/bootsfaces/component/modal/ModalRenderer.java
@@ -77,7 +77,7 @@ public class ModalRenderer extends CoreRenderer {
rw.startElement("div", component); // modal
rw.writeAttribute("id", component.getClientId(context), "id");
- String styleClasses = "modal" + " fade";
+ String styleClasses = "modal";
if (modal.getStyleClass() != null) {
styleClasses = modal.getStyleClass() + " " + styleClasses;
} | remove 'fade' effect from modal | TheCoder4eu_BootsFaces-OSP | train | java |
f3ef4a9d1010c8d6e0316bf633954af2d6d0c480 | diff --git a/controller.go b/controller.go
index <HASH>..<HASH> 100644
--- a/controller.go
+++ b/controller.go
@@ -1,12 +1,19 @@
package action_bar
import (
- "github.com/qor/admin"
"net/http"
+
+ "github.com/qor/admin"
)
func SwitchMode(context *admin.Context) {
cookie := http.Cookie{Name: "qor-action-bar", Value: context.Request.URL.Query().Get("checked"), Path: "/", HttpOnly: true}
http.SetCookie(context.Writer, &cookie)
- http.Redirect(context.Writer, context.Request, "/", http.StatusFound)
+
+ referrer := context.Request.Referer()
+ if referrer == "" {
+ referrer = "/"
+ }
+
+ http.Redirect(context.Writer, context.Request, referrer, http.StatusFound)
} | Redirect back to referrer url | qor_action_bar | train | go |
Subsets and Splits