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
|
---|---|---|---|---|---|
5907ae78d285815a8dd26af020a7b687a036d340 | diff --git a/vyked/bus.py b/vyked/bus.py
index <HASH>..<HASH> 100644
--- a/vyked/bus.py
+++ b/vyked/bus.py
@@ -218,8 +218,6 @@ class TCPBus:
def handle_connected(self):
if self.tcp_host:
- self._registry_client.register(self.tcp_host.host, self.tcp_host.port, self.tcp_host.name,
- self.tcp_host.version, self.tcp_host.node_id, self.tcp_host.clients, 'tcp')
yield from self.tcp_host.initiate()
if self.http_host:
yield from self.http_host.initiate()
diff --git a/vyked/host.py b/vyked/host.py
index <HASH>..<HASH> 100644
--- a/vyked/host.py
+++ b/vyked/host.py
@@ -56,8 +56,8 @@ class Host:
Host.pubsub_host = pubsub_host
Host.pubsub_port = pubsub_port
- @deprecated
@classmethod
+ @deprecated
def attach_service(cls, service):
""" Allows you to attach one TCP and one HTTP service | Fixed bugs in bus.py (decorator ordering) and host.py (double registration for tcp) | kashifrazzaqui_vyked | train | py,py |
1ec86bb0e921b25848cf128febffd8b87e94c3fb | diff --git a/lib/xclarity_client/mixins/remote_access_mixin.rb b/lib/xclarity_client/mixins/remote_access_mixin.rb
index <HASH>..<HASH> 100644
--- a/lib/xclarity_client/mixins/remote_access_mixin.rb
+++ b/lib/xclarity_client/mixins/remote_access_mixin.rb
@@ -4,14 +4,6 @@ module XClarityClient
#
module Mixins::RemoteAccessMixin
def remote_control(uuid)
- res = fetch_nodes([uuid])
- tier_level = res[0].FeaturesOnDemand['tierLevel']
-
- if tier_level == -1
- raise ['Cannot launch remote console because tier level value is',
- ' invalid.Please contact the administrator.'].join
- end
-
RemoteAccessManagement.new(@config).remote_control(uuid)
end
end | reverted validation change as its breaking test cases | lenovo_xclarity_client | train | rb |
b20e59800ab92ef520a06f9c5d549e1fabbad2b0 | diff --git a/lib/tokenizer/index.js b/lib/tokenizer/index.js
index <HASH>..<HASH> 100644
--- a/lib/tokenizer/index.js
+++ b/lib/tokenizer/index.js
@@ -1195,11 +1195,15 @@ _[SCRIPT_DATA_DOUBLE_ESCAPED_STATE] = function scriptDataDoubleEscapedState(cp)
this._emitChars('<');
}
- else if (cp === $.NULL)
+ else if (cp === $.NULL) {
+ this._err(ERR.unexpectedNullCharacter);
this._emitChars(UNICODE.REPLACEMENT_CHARACTER);
+ }
- else if (cp === $.EOF)
+ else if (cp === $.EOF) {
+ this._err(ERR.eofInScriptHtmlComment);
this._emitEOFToken();
+ }
else
this._emitCodePoint(cp); | Add Script data double escaped state errors. | inikulin_parse5 | train | js |
0918750b61bd71d9d01ac4bba7e6698318811ffd | diff --git a/lib/extract_jwt.js b/lib/extract_jwt.js
index <HASH>..<HASH> 100644
--- a/lib/extract_jwt.js
+++ b/lib/extract_jwt.js
@@ -3,12 +3,15 @@
var url = require('url'),
auth_hdr = require('./auth_header');
-
+// Note: express http converts all headers
+// to lower case.
var AUTH_HEADER = "authorization",
DEFAULT_AUTH_SCHEME = "JWT";
+
var extractors = {};
+
extractors.fromHeader = function (header_name) {
return function (request) {
var token = null;
diff --git a/lib/strategy.js b/lib/strategy.js
index <HASH>..<HASH> 100644
--- a/lib/strategy.js
+++ b/lib/strategy.js
@@ -3,12 +3,7 @@ var passport = require('passport-strategy')
, util = require('util')
, url = require('url');
-// Note: express http converts all headers
-// to lower case.
-var AUTH_HEADER = "authorization"
- , DEFAULT_AUTH_SCHEME = "JWT"
- , DEFAULT_TOKEN_BODY_FIELD = 'auth_token'
- , DEFAULT_TOKEN_QUERY_PARAM_NAME = 'auth_token'
+
/**
* Strategy constructor | Remove unused constants from strategy.js | und3fined_passport-auth-jwt | train | js,js |
06ce47919af54266d5dee131a922d915504a44d5 | diff --git a/troposphere/elasticache.py b/troposphere/elasticache.py
index <HASH>..<HASH> 100644
--- a/troposphere/elasticache.py
+++ b/troposphere/elasticache.py
@@ -94,6 +94,8 @@ class ReplicationGroup(AWSObject):
resource_type = "AWS::ElastiCache::ReplicationGroup"
props = {
+ 'AtRestEncryptionEnabled': (boolean, False),
+ 'AuthToken': (basestring, False),
'AutoMinorVersionUpgrade': (boolean, False),
'AutomaticFailoverEnabled': (boolean, False),
'CacheNodeType': (basestring, True),
@@ -120,6 +122,7 @@ class ReplicationGroup(AWSObject):
'SnapshottingClusterId': (basestring, False),
'SnapshotWindow': (basestring, False),
'Tags': (Tags, False),
+ 'TransitEncryptionEnabled': (boolean, False),
}
def validate(self): | Add new properties to ElastiCache::ReplicationGroup
Proerties added:
AtRestEncryptionEnabled, AuthToken, TransitEncryptionEnabled | cloudtools_troposphere | train | py |
864956f80979c080413cf1bfaf4835a00ff9c508 | diff --git a/sundial/__init__.py b/sundial/__init__.py
index <HASH>..<HASH> 100644
--- a/sundial/__init__.py
+++ b/sundial/__init__.py
@@ -5,6 +5,6 @@ from sundial.versioning import get_version
__all__ = ['VERSION', '__version__']
-VERSION = (1, 0, 1, 'final', 0)
+VERSION = (1, 0, 2, 'alpha', 0)
__version__ = get_version(VERSION) | Bumped version number to <I> alpha. | charettes_django-sundial | train | py |
d431db0a3813cd71deb8b4a24d60fa274086c366 | diff --git a/hcl2template/types.packer_config.go b/hcl2template/types.packer_config.go
index <HASH>..<HASH> 100644
--- a/hcl2template/types.packer_config.go
+++ b/hcl2template/types.packer_config.go
@@ -353,7 +353,7 @@ func (cfg *PackerConfig) GetBuilds(opts packer.GetBuildsOptions) ([]packer.Build
}
pcb := &packer.CoreBuild{
- Type: src.Type,
+ Type: src.Ref().String(),
Builder: builder,
Provisioners: provisioners,
PostProcessors: pps, | HCL2: use source type and name as Name of a CoreBuild | hashicorp_packer | train | go |
8133d862e4ec166152b6f40ac10141dac6f584b4 | diff --git a/addon/initialize.js b/addon/initialize.js
index <HASH>..<HASH> 100644
--- a/addon/initialize.js
+++ b/addon/initialize.js
@@ -15,6 +15,8 @@ export function initialize(container, config) {
});
container.register('liquid-modals:main', Modals);
+ container.injection('component:liquid-modal', 'owner', 'liquid-modals:main');
+
var lwTemplate = container.lookup('template:liquid-with');
if (lwTemplate) {
diff --git a/app/initializers/liquid-fire.js b/app/initializers/liquid-fire.js
index <HASH>..<HASH> 100644
--- a/app/initializers/liquid-fire.js
+++ b/app/initializers/liquid-fire.js
@@ -17,8 +17,6 @@ export default {
initialize(container, container.lookupFactory('transitions:main'));
- application.inject('component:liquid-modal', 'owner', 'liquid-modals:main');
-
if (Ember.testing) {
Ember.Test.registerWaiter(function(){
return container.lookup('transitions:map').runningTransitions() === 0; | move initializer into library function for use in non-ember-cli builds | ember-animation_liquid-fire | train | js,js |
ce73a28b2d60d8b349fd5478918238a04a91ec7e | diff --git a/testem.js b/testem.js
index <HASH>..<HASH> 100644
--- a/testem.js
+++ b/testem.js
@@ -1,10 +1,13 @@
/* eslint-env node */
+const DotReporter = require('testem/lib/reporters/dot_reporter');
+
module.exports = {
framework: 'qunit',
test_page: 'tests/index.html?hidepassed',
timeout: 540,
disable_watching: true,
+ reporter: new DotReporter(),
launch_in_ci: [
'Chrome',
'Firefox', | chore: switch to testem dot reporter | CenterForOpenScience_ember-osf | train | js |
4b09c3c38d522b4346d68b3115fc7fb40db80f2d | diff --git a/looper/models.py b/looper/models.py
index <HASH>..<HASH> 100644
--- a/looper/models.py
+++ b/looper/models.py
@@ -353,7 +353,8 @@ class Project(AttributeDict):
# With all samples, prepare file paths and get read type (optionally make sample dirs)
for sample in self.samples:
- sample.get_genome()
+ if hasattr(sample, "organism"):
+ sample.get_genome()
sample.set_file_paths()
if not sample.check_input_exists():
continue | remove requirement of genomes and transcriptomes to be set | pepkit_peppy | train | py |
05f650fab5ef9f37c298a0178d5724fda3a8b5d9 | diff --git a/JSAT/src/jsat/distributions/Normal.java b/JSAT/src/jsat/distributions/Normal.java
index <HASH>..<HASH> 100644
--- a/JSAT/src/jsat/distributions/Normal.java
+++ b/JSAT/src/jsat/distributions/Normal.java
@@ -149,7 +149,7 @@ public class Normal extends Distribution
*/
public static double logPdf(double x, double mu, double sigma)
{
- return -0.5*log(2*PI) + log(sigma) + -pow(x-mu,2)/(2*sigma*sigma);
+ return -0.5*log(2*PI) - log(sigma) + -pow(x-mu,2)/(2*sigma*sigma);
}
@Override | Correction of mathematical error
In <I>f<I>b<I>dade<I>a7ad8a<I>d<I>b<I>f7 a sign error was made when expanding the parenthesis. | EdwardRaff_JSAT | train | java |
e9487b437876da221065ab75bd40bcaefa8bf414 | diff --git a/pandas/tests/io/test_gcs.py b/pandas/tests/io/test_gcs.py
index <HASH>..<HASH> 100644
--- a/pandas/tests/io/test_gcs.py
+++ b/pandas/tests/io/test_gcs.py
@@ -108,9 +108,7 @@ def test_gcs_get_filepath_or_buffer(monkeypatch):
assert_frame_equal(df1, df2)
[email protected](
- td.safe_import("gcsfs"), reason="Only check when gcsfs not installed"
-)
[email protected]_if_installed("gcsfs")
def test_gcs_not_present_exception():
with pytest.raises(ImportError) as e:
read_csv("gs://test/test.csv") | replaced safe_import with a corresponding test decorator (#<I>) | pandas-dev_pandas | train | py |
0f5086a4c88fadeaf2f3084e5968cc13f80a6a81 | diff --git a/nano.php b/nano.php
index <HASH>..<HASH> 100644
--- a/nano.php
+++ b/nano.php
@@ -59,11 +59,11 @@ final class nano{
return $mValue;
}else if(is_object($mValue)){
-
+
return $mValue();
- }else{
- $aSearchIn = $mValue;
}
+
+ $aSearchIn = $mValue;
}
return ( | The method render uses an else expression
Else is never necessary and you can simplify the code to work without
else. | azettl_php-nano-template | train | php |
d59464db6bb0cd2de4c95dd587cc5a66f3209cf6 | diff --git a/src/transformers/models/bart/modeling_bart.py b/src/transformers/models/bart/modeling_bart.py
index <HASH>..<HASH> 100755
--- a/src/transformers/models/bart/modeling_bart.py
+++ b/src/transformers/models/bart/modeling_bart.py
@@ -529,8 +529,8 @@ BART_GENERATION_EXAMPLE = r"""
>>> from transformers import BartTokenizer, BartForConditionalGeneration, BartConfig
- >>> model = BartForConditionalGeneration.from_pretrained('facebook/bart-large')
- >>> tokenizer = BartTokenizer.from_pretrained('facebook/bart-large')
+ >>> model = BartForConditionalGeneration.from_pretrained('facebook/bart-large-cnn')
+ >>> tokenizer = BartTokenizer.from_pretrained('facebook/bart-large-cnn')
>>> ARTICLE_TO_SUMMARIZE = "My friends are cool but they eat too many carbs."
>>> inputs = tokenizer([ARTICLE_TO_SUMMARIZE], max_length=1024, return_tensors='pt') | fix BART Summarization example in doc (#<I>) | huggingface_pytorch-pretrained-BERT | train | py |
75d439ab9e8bf1e045b7f865f90fc86e774a9b85 | diff --git a/O365/message.py b/O365/message.py
index <HASH>..<HASH> 100644
--- a/O365/message.py
+++ b/O365/message.py
@@ -235,7 +235,7 @@ class Message(ApiComponent, AttachableMixin, HandleRecipientsMixin):
'HTML') # default to HTML for new messages
if self.has_attachments is False and self.body_type.upper() == 'HTML':
# test for inline attachments (Azure responds with hasAttachments=False when there are only inline attachments):
- if any(img['src'].startswith('cid:') for img in self.get_body_soup().find_all('img')):
+ if any(img.get('src', '').startswith('cid:') for img in self.get_body_soup().find_all('img')):
self.has_attachments = True
if self.has_attachments and download_attachments: | fix for when img tag doesn't have a src | O365_python-o365 | train | py |
7eb975de59a30596780b1bd6f8ced4f3dd2de23b | diff --git a/karma.conf.js b/karma.conf.js
index <HASH>..<HASH> 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -15,7 +15,7 @@ module.exports = function (config) {
// sl_ie_9: { base: "SauceLabs", browserName: "internet explorer", version: "9" },
// sl_ie_8: { base: "SauceLabs", browserName: "internet explorer", version: "8" },
sl_android: { base: "SauceLabs", browserName: "android", version: "4.0" },
- sl_iphone: { base: "SauceLabs", browserName: "iphone", version: "7.1" }
+ sl_iphone: { base: "SauceLabs", browserName: "iphone", version: "8.0" }
};
config.set({ | increasing iphone's browser version as <I> seems unreliable | clr-format_clr-format | train | js |
34021f1dc7b32c55a3e4203235468be307e9e979 | diff --git a/molgenis-fair/src/main/java/org/molgenis/fair/controller/FairController.java b/molgenis-fair/src/main/java/org/molgenis/fair/controller/FairController.java
index <HASH>..<HASH> 100644
--- a/molgenis-fair/src/main/java/org/molgenis/fair/controller/FairController.java
+++ b/molgenis-fair/src/main/java/org/molgenis/fair/controller/FairController.java
@@ -75,6 +75,10 @@ public class FairController
{
String subjectIRI = getBaseUri().pathSegment(catalogID, datasetID).toUriString();
Entity subjectEntity = dataService.findOneById("fdp_Dataset", datasetID);
+ if (subjectEntity == null)
+ {
+ throw new UnknownEntityException("fdp_Dataset", datasetID);
+ }
return entityModelWriter.createRdfModel(subjectIRI, subjectEntity);
} | Fix: throw UnknownEntityException when dataset does not exist | molgenis_molgenis | train | java |
643091f5925f7130fa144b6bff0be675021d708c | diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/distributed/ONetworkProtocolDistributed.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/distributed/ONetworkProtocolDistributed.java
index <HASH>..<HASH> 100644
--- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/distributed/ONetworkProtocolDistributed.java
+++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/distributed/ONetworkProtocolDistributed.java
@@ -61,7 +61,7 @@ public class ONetworkProtocolDistributed extends ONetworkProtocolBinary implemen
@Override
protected void parseCommand() throws IOException, InterruptedException {
- if (clientId == null && data.clientId != null)
+ if (clientId == null && data.clientId != null && data.clientId.startsWith(ODistributedStorage.DNODE_PREFIX))
// ASSIGN CLIENT-ID ONCE
clientId = data.clientId.substring(ODistributedStorage.DNODE_PREFIX.length()); | Fixed bug found by Anton in binary protocol on clientId in OPEN and CONNECT | orientechnologies_orientdb | train | java |
2fb0eba29c2716eba938bb3042b7f6c750ccdc46 | diff --git a/src/Handler/File.php b/src/Handler/File.php
index <HASH>..<HASH> 100644
--- a/src/Handler/File.php
+++ b/src/Handler/File.php
@@ -88,9 +88,15 @@ class File extends AbstractHandler
);
}
- return $this->checkData(
- file_get_contents("{$this->path}{$name}.cache")
- )["data"];
+ try {
+ return $this->checkData(
+ file_get_contents("{$this->path}{$name}.cache")
+ )["data"];
+ } catch (CacheDataExpiredException $e) {
+ // remove expired data and rethrow the exception
+ $this->remove($name, false);
+ throw $e;
+ }
}
/** | remove cache data if it is expired | SlaxWeb_Cache | train | php |
09cb1c9fff2e5988bde7678425ca814d18ea576c | diff --git a/src/Command/IssueCreateCommand.php b/src/Command/IssueCreateCommand.php
index <HASH>..<HASH> 100644
--- a/src/Command/IssueCreateCommand.php
+++ b/src/Command/IssueCreateCommand.php
@@ -34,6 +34,7 @@ class IssueCreateCommand extends BaseCommand implements GitHubFeature
->setName('issue:create')
->setDescription('Creates an issue')
->addOption('issue_title', null, InputOption::VALUE_REQUIRED, 'Issue Title')
+ ->addOption('issue_body', null, InputOption::VALUE_REQUIRED, 'Issue Body')
->setHelp(
<<<EOF
The <info>%command.name%</info> command creates a new issue for either the current or the given organization
@@ -70,9 +71,11 @@ EOF
);
}
- /** @var EditorHelper $editor */
- $editor = $this->getHelper('editor');
- $body = $editor->fromString('');
+ if (!$body = $input->getOption('issue_body')) {
+ /** @var EditorHelper $editor */
+ $editor = $this->getHelper('editor');
+ $body = $editor->fromString('');
+ }
$issue = $adapter->openIssue($title, $body); | added issue body option to issue create command | gushphp_gush | train | php |
d195d68d9009c80ea4248c6a382ce51f9825a41d | diff --git a/generators/server/files.js b/generators/server/files.js
index <HASH>..<HASH> 100644
--- a/generators/server/files.js
+++ b/generators/server/files.js
@@ -305,6 +305,7 @@ function writeFiles() {
this.template(`${SERVER_MAIN_SRC_DIR}package/config/_FeignConfiguration.java`, `${javaDir}config/FeignConfiguration.java`);
this.template(`${SERVER_MAIN_SRC_DIR}package/client/_AuthorizedFeignClient.java`, `${javaDir}client/AuthorizedFeignClient.java`);
this.template(`${SERVER_MAIN_SRC_DIR}package/client/_OAuth2InterceptedFeignConfiguration.java`, `${javaDir}client/OAuth2InterceptedFeignConfiguration.java`);
+ this.template(`${SERVER_MAIN_SRC_DIR}package/client/_FeignClientInterceptor.java`, `${javaDir}client/FeignClientInterceptor.java`);
}
this.copy(`${SERVER_MAIN_RES_DIR}static/microservices_index.html`, `${SERVER_MAIN_RES_DIR}static/index.html`);
}, | added new line to files.js | jhipster_generator-jhipster | train | js |
1070bda40f809bf1d423400ca9203819c6b9b9ab | diff --git a/tests/integration/trigger.php b/tests/integration/trigger.php
index <HASH>..<HASH> 100644
--- a/tests/integration/trigger.php
+++ b/tests/integration/trigger.php
@@ -22,7 +22,7 @@ class triggerTestCase extends WatchmanTestCase {
$lines = 0;
$got = array();
- foreach (file("$root/trigger.json") as $line) {
+ foreach (@file("$root/trigger.json") as $line) {
$lines++;
$list = json_decode($line, true);
// Filter out the unpredictable data from lstat() | suppress warnings for file to avoid spew on a race condition | facebook_watchman | train | php |
7977a7a1e00e94cbed28c0210491dbc1191e43ef | diff --git a/lib/active_record/connection_adapters/sqlserver_adapter.rb b/lib/active_record/connection_adapters/sqlserver_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record/connection_adapters/sqlserver_adapter.rb
+++ b/lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -311,6 +311,11 @@ module ActiveRecord
end
def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:
+ # Remove limit for data types which do not require it
+ # Valid: ALTER TABLE sessions ALTER COLUMN [data] varchar(max)
+ # Invalid: ALTER TABLE sessions ALTER COLUMN [data] varchar(max)(16777215)
+ limit = nil if %w{text varchar(max) nvarchar(max) ntext varbinary(max) image}.include?(native_database_types[type.to_sym][:name])
+
return super unless type.to_s == 'integer'
if limit.nil? | Remove limit for data types which do not require it such as varchar(max) varbinary(max). | rails-sqlserver_activerecord-sqlserver-adapter | train | rb |
f65a35675eca15555ddbd50d4bf29dbdc4e12238 | diff --git a/test/linked_rails.rb b/test/linked_rails.rb
index <HASH>..<HASH> 100644
--- a/test/linked_rails.rb
+++ b/test/linked_rails.rb
@@ -15,6 +15,9 @@ begin
# Necessary for Rails 3
require 'rails'
rescue LoadError
+ # Necessary for Rails 2.3.7
+ require 'initializer'
+rescue LoadError
end
if defined?(Rails::Application) # Rails 3
@@ -22,6 +25,10 @@ if defined?(Rails::Application) # Rails 3
config.root = File.join(File.dirname(__FILE__), "../..")
end
Rails.application = TestApp
+elsif defined?(RAILS_ROOT)
+ RAILS_ROOT.replace(File.join(File.dirname(__FILE__), "../.."))
+else
+ RAILS_ROOT = File.join(File.dirname(__FILE__), "../..")
end
ActionController::Base.logger = Logger.new(nil)
@@ -31,5 +38,5 @@ ActionController::Base.logger = Logger.new(nil)
# since we don't want to load the entirety of Rails.
Dir[File.dirname(__FILE__) + '/plugins/*'].each do |plugin|
$: << plugin + '/lib'
- Object.new.instance_eval(File.read(plugin + '/init.rb'))
+ eval(File.read(plugin + '/init.rb'))
end | Load linked Rails properly for Rails <I>. | sass_ruby-sass | train | rb |
680ebda18affed9051a99ab94ac006a746d78e68 | diff --git a/lib/puppet-lint/lexer.rb b/lib/puppet-lint/lexer.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet-lint/lexer.rb
+++ b/lib/puppet-lint/lexer.rb
@@ -144,7 +144,7 @@ class PuppetLint
elsif chunk.match(/\A\/.*?\//)
str_content = StringScanner.new(code[i+1..-1]).scan_until(/(\A|[^\\])\//m)
- tokens << new_token(:REGEX, str_content, code[0..i])
+ tokens << new_token(:REGEX, str_content[0..-2], code[0..i])
i += str_content.size + 1
elsif indent = chunk[/\A\n([ \t]+)/m, 1] | :REGEX token value shouldn't include trailing / | rodjek_puppet-lint | train | rb |
eef0b2c0dc82a317bc9bb0fa507bcc11d8ade4fd | diff --git a/services/discovery/v1-query-builder.js b/services/discovery/v1-query-builder.js
index <HASH>..<HASH> 100644
--- a/services/discovery/v1-query-builder.js
+++ b/services/discovery/v1-query-builder.js
@@ -87,8 +87,7 @@ module.exports = function (RED) {
function (err, response) {
if (err) {
res.json(err);
- }
- else {
+ } else {
var fieldList = discoveryutils.buildFieldList(response);
res.json(fieldList);
} | Create New Query Builder Node for Discovery Service | watson-developer-cloud_node-red-node-watson | train | js |
10e5987331faf35628357f29d7a21e5d386c8c3c | diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index <HASH>..<HASH> 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -619,9 +619,12 @@ class Plugin(object):
def get_description(self):
""" This function will return the description for the plugin"""
try:
- return self.__doc__.strip()
- except:
- return "<no description available>"
+ if hasattr(self, '__doc__') and self.__doc__:
+ return self.__doc__.strip()
+ return super(self.__class__, self).__doc__.strip()
+ except Exception as e:
+ raise e
+ #return "<no description available>"
def check_enabled(self):
"""This method will be used to verify that a plugin should execute | [plugin] Use superclass __doc__ if not defined in derived class
Fixes #<I>. | sosreport_sos | train | py |
b8209d1d0c02b26e2c0b1def29cef134f30354a5 | diff --git a/ansible_runner/runner_config.py b/ansible_runner/runner_config.py
index <HASH>..<HASH> 100644
--- a/ansible_runner/runner_config.py
+++ b/ansible_runner/runner_config.py
@@ -81,7 +81,7 @@ class RunnerConfig(object):
- prepare_env
- prepare_command
- It's also responsiblel for wrapping the command with the proper ssh agent invocation
+ It's also responsible for wrapping the command with the proper ssh agent invocation
and setting early ANSIBLE_ environment variables.
"""
if self.private_data_dir is None: | Docstring minor corrections (runner_config) | ansible_ansible-runner | train | py |
d2f116711ebb84801041e293a59ae4bdcbf9c002 | diff --git a/get_http.go b/get_http.go
index <HASH>..<HASH> 100644
--- a/get_http.go
+++ b/get_http.go
@@ -173,7 +173,6 @@ func (g *HttpGetter) GetFile(dst string, src *url.URL) error {
}
req.Method = "GET"
- req.Header = g.Header
resp, err := g.Client.Do(req)
if err != nil {
return err | don't reset headers to allow range request to work | hashicorp_go-getter | train | go |
c6d8299f3dea65006ca2b83847051cecedcd2c37 | diff --git a/python_modules/dagster/dagster_tests/cli_tests/command_tests/test_launch_command.py b/python_modules/dagster/dagster_tests/cli_tests/command_tests/test_launch_command.py
index <HASH>..<HASH> 100644
--- a/python_modules/dagster/dagster_tests/cli_tests/command_tests/test_launch_command.py
+++ b/python_modules/dagster/dagster_tests/cli_tests/command_tests/test_launch_command.py
@@ -55,9 +55,7 @@ def test_launch_non_existant_file():
with default_cli_test_instance() as instance:
kwargs = non_existant_python_origin_target_args()
- with pytest.raises(
- DagsterUserCodeProcessError, match=re.escape("No such file or directory")
- ):
+ with pytest.raises(DagsterUserCodeProcessError):
run_launch(kwargs, instance) | [easy] fix launch test on windows by being less specific about error message
Summary: Missing file messages differ between windows and unix (and escape differently), just don't try to match the string for now.
Test Plan: BK + Azure
Reviewers: alangenfeld, sashank, max, johann, prha
Reviewed By: prha
Differential Revision: <URL> | dagster-io_dagster | train | py |
bd2de95fc32d0f8018bb78bdd2db2aebb96cdce7 | diff --git a/pyup/cli.py b/pyup/cli.py
index <HASH>..<HASH> 100644
--- a/pyup/cli.py
+++ b/pyup/cli.py
@@ -87,6 +87,6 @@ class CLIBundle(RequirementsBundle):
class CLIRequirementFile(RequirementFile):
def iter_lines(self, lineno=0):
- bar = tqdm(self.content.splitlines(), desc="Processing {}".format(self.path))
+ bar = tqdm(self.content.splitlines()[lineno:], desc="Processing {}".format(self.path))
for item in bar:
yield item | fixed a bug on the CLI where the bot was unable to parse hashed requirements | pyupio_pyup | train | py |
55238cc121a6821a66511654ff4da02a2390c695 | diff --git a/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java b/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java
index <HASH>..<HASH> 100644
--- a/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java
+++ b/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java
@@ -60,9 +60,11 @@ public class RNPushNotification extends ReactContextBaseJavaModule {
}
private void sendEvent(String eventName, Object params) {
- mReactContext
- .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
- .emit(eventName, params);
+ if ( mReactContext.hasActiveCatalystInstance() ) {
+ mReactContext
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
+ .emit(eventName, params);
+ }
}
public void newIntent(Intent intent) { | Check if React instance was fully loaded before sending events | zo0r_react-native-push-notification | train | java |
11db4bcf66431391effc834dde1bdc458fc54830 | diff --git a/lib/emites/entities/nfse.rb b/lib/emites/entities/nfse.rb
index <HASH>..<HASH> 100644
--- a/lib/emites/entities/nfse.rb
+++ b/lib/emites/entities/nfse.rb
@@ -20,6 +20,8 @@ module Emites
attribute :send_nfse_taker, Boolean
attribute :service_values, NfseValues
attribute :_links, Array
+ attribute :created_at, DateTime
+ attribute :updated_at, DateTime
def url(action)
links = self._links || []
diff --git a/spec/emites/entities/nfse_spec.rb b/spec/emites/entities/nfse_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/emites/entities/nfse_spec.rb
+++ b/spec/emites/entities/nfse_spec.rb
@@ -132,7 +132,7 @@ describe Emites::Entities::Nfse do
:emission_date_nfse, :operation_nature, :other_informations,
:competence, :special_regime, :status,
:description, :send_nfse_taker, :service_values,
- :_links
+ :created_at, :updated_at, :_links
]
describe "#url" do | Adds created_at and updated_at properties to nfse. | myfreecomm_emites-client-ruby | train | rb,rb |
ac87c88f9ae12aca9307b9d2d6a02200f02c8a72 | diff --git a/tests/unit/test_spm.py b/tests/unit/test_spm.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_spm.py
+++ b/tests/unit/test_spm.py
@@ -1,8 +1,3 @@
-# coding: utf-8
-
-# Import Python libs
-from __future__ import absolute_import
-
import os
import shutil
import tempfile
@@ -13,8 +8,6 @@ import salt.utils.files
from tests.support.helpers import destructiveTest
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
from tests.support.mock import MagicMock, patch
-
-# Import Salt Testing libs
from tests.support.unit import TestCase
_F1 = { | Drop Py2 and six on tests/unit/test_spm.py | saltstack_salt | train | py |
b73ab11e4ed08cd9146839dfa912251ff057e23f | diff --git a/lib/oxcelix/workbook.rb b/lib/oxcelix/workbook.rb
index <HASH>..<HASH> 100644
--- a/lib/oxcelix/workbook.rb
+++ b/lib/oxcelix/workbook.rb
@@ -14,16 +14,12 @@ module Oxcelix
# The Workbook class will open the excel file, and convert it to a collection of
# Matrix objects
- # @!attribute [rw] sheetbase
- # @return [Hash] sheetbase Single sheet metadata - will be obsolete in the future
# @!attribute [rw] sheets
# @return [Array] sheets Collection of {Sheet} objects
- # @!attribute [rw] sharedstrings
- # @return [Sharedstrings] sharedstrings returns a {Sharedstrings} object used to interpolate string indexes with their actual value.
class Workbook
include Cellhelper
include Workbookhelper
- attr_accessor :sheetbase, :sheets, :sharedstrings
+ attr_accessor :sheets
##
# Create a new Workbook object.
#
@@ -58,6 +54,7 @@ module Oxcelix
}
@sheets=[]
@sheetbase={}
+ @sharedstrings=[]
f=IO.read(@destination+'/xl/workbook.xml')
@a=Ox::load(f) | Removed sharedstrings and sheetbase properties as they were useless. Docs updated with the change. | gbiczo_oxcelix | train | rb |
e5dc5bd387cbf6cd9b3caa3ac65c24d74c751b8e | diff --git a/lib/heroku/jsplugin.rb b/lib/heroku/jsplugin.rb
index <HASH>..<HASH> 100644
--- a/lib/heroku/jsplugin.rb
+++ b/lib/heroku/jsplugin.rb
@@ -15,7 +15,7 @@ class Heroku::JSPlugin
command = commands.find { |t| t["topic"] == topic && (t["command"] == nil || t["default"]) }
end
return if !command || command["hidden"]
- run(command['topic'], command['command'], ARGV[1..-1])
+ run(command['topic'], command['command'], args)
end
def self.load! | use passed in args for v4 takeover | heroku_legacy-cli | train | rb |
a2d29c62a442a56d1464a6505aa64c968cab326c | diff --git a/salt/state.py b/salt/state.py
index <HASH>..<HASH> 100644
--- a/salt/state.py
+++ b/salt/state.py
@@ -33,13 +33,13 @@ import salt.fileclient
import salt.utils.event
import salt.syspaths as syspaths
from salt.utils import context, immutabletypes
-from six import string_types
+from salt.utils.six import string_types
from salt.template import compile_template, compile_template_str
from salt.exceptions import SaltRenderError, SaltReqTimeoutError, SaltException
from salt.utils.odict import OrderedDict, DefaultOrderedDict
# Import third party libs
-from six.moves import range
+from salt.utils.six.moves import range
log = logging.getLogger(__name__) | Replaced module six in file /salt/state.py | saltstack_salt | train | py |
d775ab8f655afdb51e94c56504c82ffe739b4de5 | diff --git a/asq/test/test_log.py b/asq/test/test_log.py
index <HASH>..<HASH> 100644
--- a/asq/test/test_log.py
+++ b/asq/test/test_log.py
@@ -120,3 +120,9 @@ class TestLog(unittest.TestCase):
'take two : [1] = 8',
'take two : END (EAGER)' ]
self.assertEqual(logger.log, c)
+
+ def test_log_closed(self):
+ a = [1, 6, 4, 3, 9, 2]
+ b = Queryable(a)
+ b.close()
+ self.assertRaises(ValueError, lambda: b.log()) | Coverage for calling log() on a closed Queryable. | sixty-north_asq | train | py |
a7a7f49c9fc554db46f09abe4b08497d00dc5002 | diff --git a/graylog2-server/src/main/java/org/graylog2/bundles/BundleImporter.java b/graylog2-server/src/main/java/org/graylog2/bundles/BundleImporter.java
index <HASH>..<HASH> 100644
--- a/graylog2-server/src/main/java/org/graylog2/bundles/BundleImporter.java
+++ b/graylog2-server/src/main/java/org/graylog2/bundles/BundleImporter.java
@@ -454,7 +454,7 @@ public class BundleImporter {
dashboardService.addWidget(dashboard, widget);
final WidgetPositionRequest widgetPosition = new WidgetPositionRequest(widget.getId(),
- dashboardWidget.getRow(), dashboardWidget.getCol());
+ dashboardWidget.getCol(), dashboardWidget.getRow());
widgetPositions.add(widgetPosition);
} | Correct widget position when added in a bundle | Graylog2_graylog2-server | train | java |
a40ebbd474569cb7a2c4ac77d898697746638aa2 | diff --git a/src/MultiplexStream.js b/src/MultiplexStream.js
index <HASH>..<HASH> 100644
--- a/src/MultiplexStream.js
+++ b/src/MultiplexStream.js
@@ -115,6 +115,8 @@ function Tunnel(id, streamMultiplexStream) {
self.readable = true;
self.writable = true;
+
+ self.id = id;
self.write = function(data, encoding) {
var buffer = Buffer.isBuffer(data) ? data : new Buffer(data, encoding);
@@ -188,7 +190,7 @@ function MultiplexStream(callback) {
}
});
- self.createStream = function(callback, id){
+ self.createStream = function(id){
id = id || uuid.v1();
var tunnel = new Tunnel(id, self);
registerTunnel(id, tunnel); | Allow streams to be named by the user.
'callback' was entirely unused, and has been replaced. | pghalliday_multiplex-stream | train | js |
21a2066f38361fc1c357ced45e393b1b40e38f5f | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from os.path import join
from setuptools import setup
# Also in twarc.py
-__version__ = '1.0.0'
+__version__ = '1.0.1'
if sys.version_info[0] < 3:
dependencies = open(join('requirements', 'python2.txt')).read().split()
diff --git a/twarc.py b/twarc.py
index <HASH>..<HASH> 100755
--- a/twarc.py
+++ b/twarc.py
@@ -2,7 +2,7 @@
from __future__ import print_function
-__version__ = '1.0.0' # also in setup.py
+__version__ = '1.0.1' # also in setup.py
import os
import re
@@ -58,6 +58,17 @@ def main():
format="%(asctime)s %(levelname)s %(message)s"
)
+ if command == "version":
+ print("twarc v%s" % __version__)
+ sys.exit()
+ elif command == "help" or not command:
+ parser.print_help()
+ print("\nPlease use one of the following commands:\n")
+ for cmd in commands:
+ print(" - %s" % cmd)
+ print("\nFor example:\n\n twarc search blacklivesmatter")
+ sys.exit(1)
+
t = Twarc(
consumer_key=args.consumer_key,
consumer_secret=args.consumer_secret, | allow people to use version and help without asking for credentials. fixes #<I> | DocNow_twarc | train | py,py |
5efa575ff6d16675c174eb16c12c110eefb7f098 | diff --git a/ViewErrorBag.php b/ViewErrorBag.php
index <HASH>..<HASH> 100644
--- a/ViewErrorBag.php
+++ b/ViewErrorBag.php
@@ -12,6 +12,17 @@ class ViewErrorBag implements Countable {
protected $bags = [];
/**
+ * Get a MessageBag instance from the bags.
+ *
+ * @param string $key
+ * @return \Illuminate\Support\MessageBag
+ */
+ public function getBag($key)
+ {
+ return array_get($this->bags, $key, new MessageBag);
+ }
+
+ /**
* Add a new MessageBag instance to the bags.
*
* @param string $key | Added getBag method to ViewErrorBag. | illuminate_support | train | php |
2fe148395530d296869e5e6e6e6958070566c52b | diff --git a/intranet/apps/auth/backends.py b/intranet/apps/auth/backends.py
index <HASH>..<HASH> 100644
--- a/intranet/apps/auth/backends.py
+++ b/intranet/apps/auth/backends.py
@@ -57,18 +57,9 @@ class KerberosAuthenticationBackend(object):
if exitstatus == 0:
logger.debug("Kerberos authorized {}@{}".format(username, realm))
- kgetcred = pexpect.spawnu("/usr/bin/kgetcred ldap/{}@{}".format(settings.HOST, settings.LDAP_REALM))
- kgetcred.expect(pexpect.EOF)
- kgetcred.close()
-
- if kgetcred.exitstatus == 0:
- logger.debug("Kerberos got ticket for ldap service")
- return True
- else:
- logger.error("Kerberos failed to get ticket for LDAP service")
- os.system("/usr/bin/kdestroy")
- return False
+ return True
else:
+ logger.debug("Kerberos failed to authorize {}".format(username))
os.system("/usr/bin/kdestroy")
return False | Remove kgetcred from auth procedure | tjcsl_ion | train | py |
36280ffd7117094b32ae961e5eee2d4ff99f8025 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@ setup(
'deform',
'fanstatic',
'js.jquery',
- 'js.jquery-form',
+ 'js.jquery_form',
'js.jquery_maskedinput',
'js.jquery_maskmoney',
'js.jquery_timepicker_addon', | Be consistent
The other packages use _ instead of - | fanstatic_js.deform | train | py |
29b10392ad5c08da051696a0f86402d7b5f7fd71 | diff --git a/ext/RMagick/extconf.rb b/ext/RMagick/extconf.rb
index <HASH>..<HASH> 100644
--- a/ext/RMagick/extconf.rb
+++ b/ext/RMagick/extconf.rb
@@ -358,7 +358,7 @@ module RMagick
$defs = []
# Force re-compilation if the generated Makefile changed.
- $config_h = 'Makefile rmagick.h'
+ $config_h = 'Makefile'
create_makefile('RMagick2')
print_summary | CI: Remove rmagick.h from forced recompile checking (#<I>) | rmagick_rmagick | train | rb |
1f84440538a017e463aaad9686831ce9527122b5 | diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py
index <HASH>..<HASH> 100644
--- a/tools/mpremote/mpremote/main.py
+++ b/tools/mpremote/mpremote/main.py
@@ -268,7 +268,7 @@ def do_filesystem(pyb, args):
def _list_recursive(files, path):
if os.path.isdir(path):
for entry in os.listdir(path):
- _list_recursive(files, os.path.join(path, entry))
+ _list_recursive(files, "/".join((path, entry)))
else:
files.append(os.path.split(path))
@@ -289,7 +289,7 @@ def do_filesystem(pyb, args):
if d not in known_dirs:
pyb.exec_("try:\n uos.mkdir('%s')\nexcept OSError as e:\n print(e)" % d)
known_dirs.add(d)
- pyboard.filesystem_command(pyb, ["cp", os.path.join(dir, file), ":" + dir + "/"])
+ pyboard.filesystem_command(pyb, ["cp", "/".join((dir, file)), ":" + dir + "/"])
else:
pyboard.filesystem_command(pyb, args)
args.clear() | tools/mpremote: Fix "fs cp -r" on Windows.
A backslash in the directory name will end up being passed through to the
device and becoming a backslash in a filename, rather than being
interpreted as directories. This makes "cp -r" problematic on Windows.
Changing to simply "/",join() fixes this. | micropython_micropython | train | py |
10c026cb7a7189d9573f30f2f2242f0f76842a72 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -502,10 +502,10 @@ devel = [
'pre-commit',
'pylint==2.6.0',
'pysftp',
- 'pytest',
+ 'pytest~=6.0',
'pytest-cov',
'pytest-instafail',
- 'pytest-rerunfailures',
+ 'pytest-rerunfailures~=9.1',
'pytest-timeouts',
'pytest-xdist',
'pywinrm', | Update to Pytest <I> (#<I>)
And pytest 6 removed a class that the rerunfailures plugin was using, so
we have to upgrade that too. | apache_airflow | train | py |
22e3d2f531a3ab99d11714b716384c6bf846a7b2 | diff --git a/lib/test/phantomas.js b/lib/test/phantomas.js
index <HASH>..<HASH> 100644
--- a/lib/test/phantomas.js
+++ b/lib/test/phantomas.js
@@ -21,7 +21,7 @@ module.exports = function (config, opts) {
opts = Object.assign({}, opts);
function testPhantomas() {
- var phantomasOpts = omit(config, ['src', 'dest']);
+ var phantomasOpts = omit(config, ['src']);
return gulp.src(config.src)
.pipe(phantomas(phantomasOpts)); | Do not strip dest key in phantomas config | LastCallMedia_gulp-drupal-tasks | train | js |
5a52d3fe8b2a60f437515a8284f98e0166691dd4 | diff --git a/myql/myql.py b/myql/myql.py
index <HASH>..<HASH> 100755
--- a/myql/myql.py
+++ b/myql/myql.py
@@ -109,9 +109,10 @@ class YQL(object):
args is a list of ['column', 'operator', 'value']
'''
if cond[1].lower() == 'in':
- #if len(cond[2]) > 1:
- if not isinstance(cond[2], str):
+ if not isinstance(cond[2], str) and 'select' not in cond[2][0].lower() :
cond[2] = "({0})".format(','.join(map(str,["'{0}'".format(e) for e in cond[2]])))
+ elif not isinstance(cond[2], str) and 'select' in cond[2][0].lower() :
+ cond[2] = "({0})".format(','.join(map(str,["{0}".format(e) for e in cond[2]])))
else:
cond[2] = "({0})".format(','.join(map(str,["{0}".format(e) for e in cond[2]]))) | fix #<I>: special treatment for IN cond with SELECT statement in it | josuebrunel_myql | train | py |
5b77ee9810c46419bce2486fb12ae8a58d526da4 | diff --git a/lib/rango/ext/platform.rb b/lib/rango/ext/platform.rb
index <HASH>..<HASH> 100644
--- a/lib/rango/ext/platform.rb
+++ b/lib/rango/ext/platform.rb
@@ -7,22 +7,22 @@ module Rango
def eql?(platform)
!! RUBY_PLATFORM.match(/#{platform}/i)
end
-
+
def windows?
- eql?("win32")
+ eql?("mswin|mingw")
end
-
+
def linux?
eql?("linux")
end
-
+
def macosx?
eql?("universal-darwin")
end
-
+
def unix?
linux? or macosx?
end
end
end
-end
+end
\ No newline at end of file | Correct indetification of Windows platform | botanicus_rango | train | rb |
4ad0cf5224332103c2ddf52209a0b7901a09e5a4 | diff --git a/lib/discordrb/events/message.rb b/lib/discordrb/events/message.rb
index <HASH>..<HASH> 100644
--- a/lib/discordrb/events/message.rb
+++ b/lib/discordrb/events/message.rb
@@ -5,7 +5,23 @@ module Discordrb::Events
class MessageEvent < Event
attr_reader :message, :saved_message
+ # @!attribute [r] author
+ # @return [User] who sent this message.
+ # @see Message#author
+ # @!attribute [r] channel
+ # @return [Channel] the channel in which this message was sent.
+ # @see Message#channel
+ # @!attribute [r] content
+ # @return [String] the message's content.
+ # @see Message#content
+ # @!attribute [r] timestamp
+ # @return [Time] the time at which the message was sent.
+ # @see Message#timestamp
delegate :author, :channel, :content, :timestamp, to: :message
+
+ # @!attribute [r] server
+ # @return [Server, nil] the server where this message was sent, or nil if it was sent in PM.
+ # @see Channel#server
delegate :server, to: :channel
def initialize(message, bot) | Do the same for MessageEvent too (not just for AwaitEvent) | meew0_discordrb | train | rb |
b81404bbc15c21b6c18530f24a8bd0642f83b7aa | diff --git a/bulbs/content/models.py b/bulbs/content/models.py
index <HASH>..<HASH> 100644
--- a/bulbs/content/models.py
+++ b/bulbs/content/models.py
@@ -335,7 +335,7 @@ class PolymorphicIndexable(object):
return '%s_%s' % (cls._meta.app_label, cls.__name__.lower())
-class Tag(PolymorphicModel, PolymorphicIndexable):
+class Tag(PolymorphicIndexable, PolymorphicModel):
"""Model for tagging up Content."""
name = models.CharField(max_length=255)
slug = models.SlugField()
@@ -380,7 +380,7 @@ class Section(Tag):
proxy = True
-class Content(PolymorphicModel, PolymorphicIndexable):
+class Content(PolymorphicIndexable, PolymorphicModel):
"""The base content model from which all other content derives."""
published = models.DateTimeField(blank=True, null=True)
title = models.CharField(max_length=512) | Switch around the MRO so model `save()` doesn't receive `refresh` or `index` parameters | theonion_django-bulbs | train | py |
8c072a0e8448715ba942f3239e147292d28bcf06 | diff --git a/problem-spring-web-autoconfigure/src/main/java/org/zalando/problem/spring/web/autoconfigure/security/SecurityConfiguration.java b/problem-spring-web-autoconfigure/src/main/java/org/zalando/problem/spring/web/autoconfigure/security/SecurityConfiguration.java
index <HASH>..<HASH> 100644
--- a/problem-spring-web-autoconfigure/src/main/java/org/zalando/problem/spring/web/autoconfigure/security/SecurityConfiguration.java
+++ b/problem-spring-web-autoconfigure/src/main/java/org/zalando/problem/spring/web/autoconfigure/security/SecurityConfiguration.java
@@ -1,6 +1,7 @@
package org.zalando.problem.spring.web.autoconfigure.security;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -11,6 +12,7 @@ import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport;
* Registers exception handling in spring-security
*/
@Configuration
+@ConditionalOnClass(WebSecurityConfigurerAdapter.class) //only when spring-security is in classpath
@Import(SecurityProblemSupport.class)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired | Add missing conditional for spring-security
Without it, if spring security is not present, it creates a runtime exception
due to AuthenticationEntryPointr not being in the classpath | zalando_problem-spring-web | train | java |
785b9876a24b88e852fd930712e742be1e8930b9 | diff --git a/salt/utils/vmware.py b/salt/utils/vmware.py
index <HASH>..<HASH> 100644
--- a/salt/utils/vmware.py
+++ b/salt/utils/vmware.py
@@ -1407,8 +1407,6 @@ def wait_for_task(task, instance_name, task_type, sleep_seconds=1, log_level='de
# task is in an error state
try:
raise task_info.error
- log.error(exc)
- raise salt.exceptions.VMwareNotFoundError(exc.msg)
except vim.fault.NoPermission as exc:
log.error(exc)
raise salt.exceptions.VMwareApiError( | Removed additional raise in vmware.wait_for_task | saltstack_salt | train | py |
a9c56c5ece54deaa05d7d2a584eaafb1891993c1 | diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index <HASH>..<HASH> 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/lib/psych/visitors/to_ruby.rb
@@ -61,7 +61,7 @@ module Psych
case o.tag
when '!binary', 'tag:yaml.org,2002:binary'
o.value.unpack('m').first
- when /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
+ when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
klass = resolve_class($1)
if klass
klass.allocate.replace o.value
@@ -208,7 +208,7 @@ module Psych
obj
end
- when /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
+ when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
klass = resolve_class($1)
members = {}
string = nil | don't assume any tag starting with 'str' is a string | ruby_psych | train | rb |
97bef83c9c538c4fc8637529f272c57b5af4c68d | diff --git a/modules/streams/src/main/java/com/aboutsip/streams/impl/SimpleCallStateMachine.java b/modules/streams/src/main/java/com/aboutsip/streams/impl/SimpleCallStateMachine.java
index <HASH>..<HASH> 100644
--- a/modules/streams/src/main/java/com/aboutsip/streams/impl/SimpleCallStateMachine.java
+++ b/modules/streams/src/main/java/com/aboutsip/streams/impl/SimpleCallStateMachine.java
@@ -397,7 +397,6 @@ public final class SimpleCallStateMachine {
}
}
-
/**
* When a messages (or event in general) "arrives" to this state machine but
* this message's arrival time is actually before our last seen message then
@@ -499,7 +498,7 @@ public final class SimpleCallStateMachine {
return -1;
}
- return t2 - t1;
+ return (t2 - t1) / 1000;
}
public long getDuration() { | small bug where we returned the PDD in microseconds instead of milliseconds as the javadoc said we would | aboutsip_pkts | train | java |
0b7396c40f09d7f7a2ee9de4221edfaddc74384c | diff --git a/registrasion/controllers/invoice.py b/registrasion/controllers/invoice.py
index <HASH>..<HASH> 100644
--- a/registrasion/controllers/invoice.py
+++ b/registrasion/controllers/invoice.py
@@ -122,12 +122,19 @@ class InvoiceController(ForId, object):
line_items = []
+ def format_product(product):
+ return "%s - %s" % (product.category.name, product.name)
+
+ def format_discount(discount, product):
+ description = discount.description
+ return "%s (%s)" % (description, format_product(product))
+
invoice_value = Decimal()
for item in product_items:
product = item.product
line_item = commerce.LineItem(
invoice=invoice,
- description="%s - %s" % (product.category.name, product.name),
+ description=format_product(product),
quantity=item.quantity,
price=product.price,
product=product,
@@ -137,7 +144,7 @@ class InvoiceController(ForId, object):
for item in discount_items:
line_item = commerce.LineItem(
invoice=invoice,
- description=item.discount.description,
+ description=format_discount(item.discount, item.product),
quantity=item.quantity,
price=cls.resolve_discount_value(item) * -1,
product=item.product, | Discount line items now describe the product that the discount applies to. | chrisjrn_registrasion | train | py |
39ae13f15777d5e691f792935c3ffd3eae88d1fc | diff --git a/attitude/plot/pca_aligned.py b/attitude/plot/pca_aligned.py
index <HASH>..<HASH> 100644
--- a/attitude/plot/pca_aligned.py
+++ b/attitude/plot/pca_aligned.py
@@ -29,6 +29,7 @@ def plot_aligned(pca, sparse=True, **kwargs):
lengths = [j-i for i,j in minmax]
if sparse:
+ i = 1
l = len(A)
if l > 10000:
i = N.ceil(l/10000) | Updated plotting of axis-aligned data | davenquinn_Attitude | train | py |
8b72fbc05667355b86ea459519d8d34a68f5bd18 | diff --git a/src/Tokens.php b/src/Tokens.php
index <HASH>..<HASH> 100644
--- a/src/Tokens.php
+++ b/src/Tokens.php
@@ -135,6 +135,7 @@ class Tokens
try {
$validate->structure();
+ $validate->algorithmNotNone();
$validate->signature();
return true;
} catch (ValidateException $e) { | Added algorithmNotNone check to Tokens Validate method to fix security flaw. | RobDWaller_ReallySimpleJWT | train | php |
3935857fffaf6b3bea0c51549d0ddb1e4f3e0ae5 | diff --git a/bika/lims/browser/bika_listing.py b/bika/lims/browser/bika_listing.py
index <HASH>..<HASH> 100644
--- a/bika/lims/browser/bika_listing.py
+++ b/bika/lims/browser/bika_listing.py
@@ -944,14 +944,18 @@ class BikaListingView(BrowserView):
# Set states and state titles
ptype = obj.portal_type
for state_var, state in states.items():
+ results_dict[state_var] = state
st_title = self.state_titles.get(state, None)
if not st_title:
- st_title = self.workflow.getTitleForStateOnType(state,
- ptype)
- if st_title:
- st_title = t(PMF(st_title))
- self.state_titles[state] = st_title
- results_dict[state_var] = state
+ try:
+ st_title = self.workflow.getTitleForStateOnType(state,
+ ptype)
+ if st_title:
+ st_title = t(PMF(st_title))
+ self.state_titles[state] = st_title
+ except:
+ logger.warning("Cannot obtain title for state {0} and "
+ "object {1}".format(state, obj.getId))
if st_title and state_var == obj.review_state:
results_dict['state_title'] = st_title | Added preventive try except on state's title retrieval in bikallisting | senaite_senaite.core | train | py |
b4b0b1c88e045e67e78d356106d6593e721e4347 | diff --git a/lib/redis/connection/memory.rb b/lib/redis/connection/memory.rb
index <HASH>..<HASH> 100644
--- a/lib/redis/connection/memory.rb
+++ b/lib/redis/connection/memory.rb
@@ -16,7 +16,8 @@ class Redis
end
def self.connect(options = {})
- self.instances[options] ||= self.new(true)
+ instance_key = [options[:host], options[:port]]
+ instances[instance_key] ||= self.new(options)
end
def initialize(connected = false) | Store memory instances by host & port | guilleiguaran_fakeredis | train | rb |
4658783b74d350fa65374a0d44e5e52ddef838bc | diff --git a/src/js/bootstrap-datetimepicker.js b/src/js/bootstrap-datetimepicker.js
index <HASH>..<HASH> 100644
--- a/src/js/bootstrap-datetimepicker.js
+++ b/src/js/bootstrap-datetimepicker.js
@@ -851,7 +851,8 @@
detachDatePickerGlobalEvents();
picker.widget.remove();
picker.element.removeData('DateTimePicker');
- picker.component.removeData('DateTimePicker');
+ if (picker.component)
+ picker.component.removeData('DateTimePicker');
};
picker.show = function (e) { | Fixed an exception on destroy() if the element isn't an <input> | Eonasdan_bootstrap-datetimepicker | train | js |
a991550420f6809c929c16cfee3d82a6d440cbf5 | diff --git a/test/utils-request-test.js b/test/utils-request-test.js
index <HASH>..<HASH> 100644
--- a/test/utils-request-test.js
+++ b/test/utils-request-test.js
@@ -25,6 +25,8 @@ describe('Request utils', function(){
});
describe('#makeRequest', function(){
+ this.timeout(15000);
+
it('should return object with url and body properties', function(){
return request.makeRequest({}, 'http://example.com').then(function (data) {
data.should.have.properties(['url', 'body']); | Add timeout for makeRequest test | website-scraper_node-website-scraper | train | js |
cd4cd2e5cbb366351a71b75627eb45fd3bcd57c5 | diff --git a/Rule.js b/Rule.js
index <HASH>..<HASH> 100644
--- a/Rule.js
+++ b/Rule.js
@@ -81,24 +81,29 @@ Rule.makeItemProcessor = function(rules){
terminatePreviousAcc(currentAccumulator); // TODO: remove currentAccumulator parameter
}
}
+ var applyRulesOnNextItem = true;
return function(item){
if (!item) // last item of the file => flush buffers
return terminateAccumulator();
else if (!item.text)
return;
- for (var r in rules) {
- var accumulator = rules[r].test(item);
- if (accumulator) {
- terminateAccumulator();
- LOG("current accumulator:", accumulator.methodName);
- currentAccumulator = accumulator;
- delete rules[r];
- return;
+ //LOG("ITEM:", item.text, "=> apply rules:", applyRulesOnNextItem);
+ if (applyRulesOnNextItem)
+ for (var r in rules) {
+ var accumulator = rules[r].test(item);
+ if (accumulator) {
+ terminateAccumulator();
+ LOG("current accumulator:", accumulator.methodName);
+ currentAccumulator = accumulator;
+ delete rules[r];
+ return;
+ }
}
- }
+ else
+ applyRulesOnNextItem = true;
// if reaching this point, the current item matches none of the rules => accumulating data on current accumulator
if (currentAccumulator)
- currentAccumulator(item);
+ applyRulesOnNextItem = !currentAccumulator(item);
};
} | new feature: if an accumulator returns true, rules won't be considered on next item => the current accumulator keeps control | adrienjoly_npm-pdfreader | train | js |
c413d445d80f00686ebbfabb2c80852da9333a45 | diff --git a/lib/instana/tracing/processor.rb b/lib/instana/tracing/processor.rb
index <HASH>..<HASH> 100644
--- a/lib/instana/tracing/processor.rb
+++ b/lib/instana/tracing/processor.rb
@@ -23,8 +23,27 @@ module Instana
# Sends all traces in @queue to the host
# agent
#
+ # FIXME: Add limits checking here in regards to:
+ # - Max HTTP Post size
+ # - Out of control/growing queue
+ # - Prevent another run of the timer while this is running
+ #
def send
return if @queue.empty?
+
+ size = @queue.size
+ if size > 10
+ Instana.logger.debug "Trace queue is #{size}"
+ end
+
+ spans = []
+ until @queue.empty? do
+ set = @queue.pop(true)
+ set.each do |s|
+ spans << s.raw
+ end
+ end
+ ::Instana.agent.report_traces(spans)
end
end
end | Better queue processing and report of traces | instana_ruby-sensor | train | rb |
e714301b6e3f104450eaf00139d95c3c0b6f3330 | diff --git a/py/tests/integration/external_only/test_H2OContext.py b/py/tests/integration/external_only/test_H2OContext.py
index <HASH>..<HASH> 100644
--- a/py/tests/integration/external_only/test_H2OContext.py
+++ b/py/tests/integration/external_only/test_H2OContext.py
@@ -68,7 +68,7 @@ def testDownloadLogsAsLOG(spark):
clusterName = hc._conf.cloudName()
with open(path, 'r') as f:
- lines = list(filter(lambda line: "INFO: H2O cloud name: '" + clusterName + "'" in line, f.readlines()))
+ lines = list(filter(lambda line: "INFO water.default: H2O cloud name: '" + clusterName + "'" in line, f.readlines()))
assert len(lines) >= 1
hc.stop() | [SW-<I>][Followup] Log structure has changed after changes on H2O side (#<I>) | h2oai_sparkling-water | train | py |
6482fd0b6d6bea4f3e91538393dfa822b33430cc | diff --git a/checkers/exceptions.py b/checkers/exceptions.py
index <HASH>..<HASH> 100644
--- a/checkers/exceptions.py
+++ b/checkers/exceptions.py
@@ -75,7 +75,8 @@ MSGS = {
'unpacking-in-except',
'Python3 will not allow implicit unpacking of exceptions in except '
'clauses. '
- 'See http://www.python.org/dev/peps/pep-3110/'),
+ 'See http://www.python.org/dev/peps/pep-3110/',
+ {'maxversion': (3, 0)}),
} | Mark unpacking-in-except as python2-specific | PyCQA_pylint | train | py |
c45ceb20223db1b52044df7c8a0d54f2005ed90d | diff --git a/benchexec/tablegenerator/test_integration/__init__.py b/benchexec/tablegenerator/test_integration/__init__.py
index <HASH>..<HASH> 100644
--- a/benchexec/tablegenerator/test_integration/__init__.py
+++ b/benchexec/tablegenerator/test_integration/__init__.py
@@ -148,7 +148,7 @@ class TableGeneratorIntegrationTests(unittest.TestCase):
csv_file,
csv_diff_file,
) = self.generate_tables_and_check_produced_files(
- args, table_prefix, diff_prefix
+ args + ["--static-table"], table_prefix, diff_prefix
)
generated_csv = util.read_file(csv_file) | In table-generator's integration tests, continue to use old HTML tables.
These tests compare created tables against expected files,
and for the dynamically-rendered new tables this does not make as much
sense. We need to find a better way to test these. | sosy-lab_benchexec | train | py |
d8a149c8bea7404fc807506aab0eacdb75d37595 | diff --git a/cms_themes/__init__.py b/cms_themes/__init__.py
index <HASH>..<HASH> 100644
--- a/cms_themes/__init__.py
+++ b/cms_themes/__init__.py
@@ -43,13 +43,12 @@ def set_themes():
return
theme_templates = []
- theme_static = []
for theme_dir in os.listdir(settings.THEMES_DIR):
if theme_dir in themes:
theme_full_path = os.path.join(settings.THEMES_DIR, theme_dir)
if os.path.isdir(theme_full_path) and 'templates' in os.listdir(theme_full_path):
template_path = os.path.join(theme_full_path, 'templates')
- setattr(settings, 'TEMPLATE_DIRS', (template_path,) + settings.DEFAULT_TEMPLATE_DIRS)
+ setattr(settings, 'TEMPLATE_DIRS', [template_path,] + settings.DEFAULT_TEMPLATE_DIRS)
for template in os.listdir(template_path):
template_display = '%s (%s)' % (template.replace('_', ' ').title().split('.')[0], theme_dir)
theme_templates.append((template, template_display)) | Fixed list addition error caused from last code merge | MegaMark16_django-cms-themes | train | py |
28abe4f5385e034cbba5285288ddddad7dd3e592 | diff --git a/jptsmeta.py b/jptsmeta.py
index <HASH>..<HASH> 100644
--- a/jptsmeta.py
+++ b/jptsmeta.py
@@ -483,7 +483,9 @@ class JPTSMeta(object):
"""
<copyright-statement> is an optional, 0 or 1, element in <article-meta>
which can contain text, address linking elements, and formatting
- elements. This method will return the node if it exists.
+ elements. This method will return the node if it exists. In version 2.3
+ it is best practice to put the <copyright-statement> element and its
+ information within the <permissions> tag.
"""
try:
cs = self.getChildrenByTagName('copyright-statement', self.article_meta)[0]
@@ -497,7 +499,8 @@ class JPTSMeta(object):
<copyright-year> is an optional, 0 or 1, element in <article-meta>
which may contain only text, numbers, and special characters. If the
node exists, this method will return the text data it contains as a
- string.
+ string. In version 2.3 it is best practice to put the <copyright-year>
+ element and its information within the <permissions> tag.
"""
try:
cy = self.getChildrenByTagName('copyright-year', self.article_meta)[0] | Updated docstrings for getCopyrightStatement() and getCopyrightYear() to note that their results should be not used in good practice of the JPTS | SavinaRoja_OpenAccess_EPUB | train | py |
027d2f1bedd3c86dc36dc3b66676de7f51adfec0 | diff --git a/qiskit/synthesis/evolution/lie_trotter.py b/qiskit/synthesis/evolution/lie_trotter.py
index <HASH>..<HASH> 100644
--- a/qiskit/synthesis/evolution/lie_trotter.py
+++ b/qiskit/synthesis/evolution/lie_trotter.py
@@ -24,7 +24,7 @@ class LieTrotter(ProductFormula):
r"""The Lie-Trotter product formula.
The Lie-Trotter formula approximates the exponential of two non-commuting operators
- with products of their exponentials up to a first order error:
+ with products of their exponentials up to a second order error:
.. math::
@@ -35,13 +35,16 @@ class LieTrotter(ProductFormula):
.. math::
- e^{-it(XX + ZZ)} = e^{-it XX}e^{-it ZZ} + \mathcal{O}(t).
+ e^{-it(XX + ZZ)} = e^{-it XX}e^{-it ZZ} + \mathcal{O}(t^2).
References:
[1]: D. Berry, G. Ahokas, R. Cleve and B. Sanders,
"Efficient quantum algorithms for simulating sparse Hamiltonians" (2006).
`arXiv:quant-ph/0508139 <https://arxiv.org/abs/quant-ph/0508139>`_
+ [2]: N. Hatano and M. Suzuki,
+ "Finding Exponential Product Formulas of Higher Orders" (2005).
+ `arXiv:math-ph/0506007 <https://arxiv.org/pdf/math-ph/0506007.pdf>`_
"""
def __init__( | Fix the order of the Lie-Trotter formula in the documentation (#<I>)
* Fix the order of the Lie-Trotter formula in the documentation
The Lie-Trotter formula has a second order error [1][2].
[1] <URL> | Qiskit_qiskit-terra | train | py |
2c261669bef6aa9b73305eb07c4c6d558b1c0284 | diff --git a/tests/test_repr.py b/tests/test_repr.py
index <HASH>..<HASH> 100644
--- a/tests/test_repr.py
+++ b/tests/test_repr.py
@@ -4,18 +4,21 @@ import six
class ReprTest(unittest.TestCase):
+ """Checks that the string representations of charts and entries are correct.
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ cls.chart = billboard.ChartData("hot-100", date="2010-01-02")
+
def testReprChart(self):
- """Checks that the string representation of a chart is correct."""
- chart = billboard.ChartData("hot-100", date="1996-08-03")
self.assertEqual(
- repr(chart), "billboard.ChartData('hot-100', date='1996-08-03')"
+ repr(self.chart), "billboard.ChartData('hot-100', date='2010-01-02')"
)
def testReprEntry(self):
- """Checks that the string representation of an entry is correct."""
- chart = billboard.ChartData("hot-100", date="2010-01-02")
self.assertEqual(
- repr(chart[0]),
+ repr(self.chart[0]),
"billboard.ChartEntry(title={!r}, artist={!r})".format(
six.text_type("TiK ToK"), six.text_type("Ke$ha")
), | Merge tests to reduce number of HTTP requests | guoguo12_billboard-charts | train | py |
eab6ebd88e4000178e63861c2650b93445488f8f | diff --git a/test/run.js b/test/run.js
index <HASH>..<HASH> 100644
--- a/test/run.js
+++ b/test/run.js
@@ -8,7 +8,7 @@ describe('async-chainable.run() - parallel execution with arrays', function() {
var output = [];
asyncChainable()
- .run([
+ .runArray([
function(next) { output.push('cb1'); next() },
function(next) { output.push('cb2'); next() },
function(next) { output.push('cb3'); next() },
@@ -21,7 +21,7 @@ describe('async-chainable.run() - parallel execution with arrays', function() {
it('should exit on errors', function(done) {
asyncChainable()
- .run([
+ .runArray([
function(next) { next() },
function(next) { next('NOPE') },
function(next) { next() }, | BUGFIX: Wrong function name after recent funciton rename | hash-bang_async-chainable | train | js |
761070af646daf5ea832a3e8733aabbd9fda861b | diff --git a/lib/stream/feed.rb b/lib/stream/feed.rb
index <HASH>..<HASH> 100644
--- a/lib/stream/feed.rb
+++ b/lib/stream/feed.rb
@@ -111,32 +111,23 @@ module Stream
self.make_request(:post, uri, nil, follow_data)
end
- def parse_follow_data(response)
- return {
- 'count' => response['count'],
- 'results' => response['results']
- }
- end
-
- def followers(limit=100, offset=0)
+ def followers(limit=25, offset=0)
uri = "/feed/#{@feed_url}/followers/"
params = {
'offset' => offset,
'limit' => limit
}
- response = self.make_request(:get, uri, params)
- self.parse_follow_data(response)
+ self.make_request(:get, uri, params)
end
- def following(limit=100, offset=0, filter=[])
+ def following(limit=25, offset=0, filter=[])
uri = "/feed/#{@feed_url}/follows/"
params = {
'limit' => limit,
'offset' => offset,
'filter' => filter.join(",")
}
- response = self.make_request(:get, uri, params)
- self.parse_follow_data(response)
+ self.make_request(:get, uri, params)
end
def unfollow(target_feed_id) | return <I> feeds by default | GetStream_stream-ruby | train | rb |
4104a9bcde4a9513038a074b99a0271b30253bbf | diff --git a/lnwallet/channel.go b/lnwallet/channel.go
index <HASH>..<HASH> 100644
--- a/lnwallet/channel.go
+++ b/lnwallet/channel.go
@@ -1421,9 +1421,14 @@ func createCommitTx(fundingOutput *wire.TxIn, selfKey, theirKey *btcec.PublicKey
commitTx := wire.NewMsgTx()
commitTx.Version = 2
commitTx.AddTxIn(fundingOutput)
- // TODO(roasbeef): don't make 0 BTC output...
- commitTx.AddTxOut(wire.NewTxOut(int64(amountToSelf), payToUsScriptHash))
- commitTx.AddTxOut(wire.NewTxOut(int64(amountToThem), theirWitnessKeyHash))
+
+ // Avoid creating zero value outputs within the commitment transaction.
+ if amountToSelf != 0 {
+ commitTx.AddTxOut(wire.NewTxOut(int64(amountToSelf), payToUsScriptHash))
+ }
+ if amountToThem != 0 {
+ commitTx.AddTxOut(wire.NewTxOut(int64(amountToThem), theirWitnessKeyHash))
+ }
return commitTx, nil
} | lnwallet: never create zero-value outputs within the commitment transaction | lightningnetwork_lnd | train | go |
ebbff65dbb656c6df1153f82f37c2ddd60e0df06 | diff --git a/Components/Helper/OpenSSLHelper.php b/Components/Helper/OpenSSLHelper.php
index <HASH>..<HASH> 100755
--- a/Components/Helper/OpenSSLHelper.php
+++ b/Components/Helper/OpenSSLHelper.php
@@ -28,6 +28,8 @@ class OpenSSLHelper
*/
public static function encrypt($plainText, $key, $cipher)
{
+ $cipher = strtolower($cipher);
+
if (false === in_array($cipher, openssl_get_cipher_methods())) {
throw new \LogicException(sprintf('Cipher %s not supported', $cipher));
}
@@ -52,6 +54,8 @@ class OpenSSLHelper
*/
public static function decrypt($encryptedText, $key, $cipher)
{
+ $cipher = strtolower($cipher);
+
if (false === in_array($cipher, openssl_get_cipher_methods())) {
throw new \LogicException(sprintf('Cipher %s not supported', $cipher));
} | fix cipher for openssl <I> | pmdevelopment_tool-bundle | train | php |
8842846e815498f982e83ba44c370143522e0d37 | diff --git a/tests/Integration/Http/ThrottleRequestsTest.php b/tests/Integration/Http/ThrottleRequestsTest.php
index <HASH>..<HASH> 100644
--- a/tests/Integration/Http/ThrottleRequestsTest.php
+++ b/tests/Integration/Http/ThrottleRequestsTest.php
@@ -44,9 +44,9 @@ class ThrottleRequestsTest extends TestCase
Carbon::now()->addSeconds(58)
);
- try{
+ try {
$response = $this->withoutExceptionHandling()->get('/');
- }catch(\Throwable $e){
+ } catch (\Throwable $e) {
$this->assertEquals(429, $e->getStatusCode());
$this->assertEquals(2, $e->getHeaders()['X-RateLimit-Limit']);
$this->assertEquals(0, $e->getHeaders()['X-RateLimit-Remaining']); | Apply fixes from StyleCI (#<I>) | laravel_framework | train | php |
228570ef5f7d955cfb0892bb3623c40b63de008e | diff --git a/src/adapt/layout.js b/src/adapt/layout.js
index <HASH>..<HASH> 100644
--- a/src/adapt/layout.js
+++ b/src/adapt/layout.js
@@ -888,7 +888,6 @@ adapt.layout.Column.prototype.layoutFloat = function(nodeContext) {
// TODO: review if it is good to rely on it
// TODO: position where a real float would have been positioned
adapt.base.setCSSProperty(element, "display", "inline-block");
- adapt.base.setCSSProperty(element, "position", "absolute");
adapt.base.setCSSProperty(element, "left", "auto");
adapt.base.setCSSProperty(element, "right", "auto");
adapt.base.setCSSProperty(element, "top", "auto");
@@ -965,6 +964,7 @@ adapt.layout.Column.prototype.layoutFloat = function(nodeContext) {
if (self.vertical) {
floatBox = adapt.geom.unrotateBox(floatHorBox);
}
+ adapt.base.setCSSProperty(element, "position", "absolute");
adapt.base.setCSSProperty(element, "left",
(floatBox.x1 - self.getLeftEdge() + self.paddingLeft) + "px");
adapt.base.setCSSProperty(element, "top", | make float element position: absolute after positioning done | vivliostyle_vivliostyle.js | train | js |
c14982c53bdd8a1c30b28524531ac095e33cfa60 | diff --git a/lib/beetle/version.rb b/lib/beetle/version.rb
index <HASH>..<HASH> 100644
--- a/lib/beetle/version.rb
+++ b/lib/beetle/version.rb
@@ -1,3 +1,3 @@
module Beetle
- VERSION = "0.4.0"
+ VERSION = "0.4.1"
end | bumped version to <I> | xing_beetle | train | rb |
9cdd95511054830da9b053bde14a57675fab76cc | diff --git a/src/Slick/Database/Adapter/MysqlAdapter.php b/src/Slick/Database/Adapter/MysqlAdapter.php
index <HASH>..<HASH> 100644
--- a/src/Slick/Database/Adapter/MysqlAdapter.php
+++ b/src/Slick/Database/Adapter/MysqlAdapter.php
@@ -83,7 +83,7 @@ class MysqlAdapter extends AbstractAdapter implements AdapterInterface
$dsn,
$this->_username,
$this->_password,
- [PDO::ERRMODE_EXCEPTION]
+ [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);
$this->_connected = true;
} catch (\Exception $exp) { | Fixing the PDO exceptions mode | slickframework_slick | train | php |
46f31e50d048600b5fe4b539adc763dcc005fc1a | diff --git a/lib/active_scaffold/config/search.rb b/lib/active_scaffold/config/search.rb
index <HASH>..<HASH> 100644
--- a/lib/active_scaffold/config/search.rb
+++ b/lib/active_scaffold/config/search.rb
@@ -42,7 +42,7 @@ module ActiveScaffold::Config
def columns
# we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?
unless @columns
- self.columns = @core.columns.collect{|c| c.name if c.searchable? and c.column and c.column.text?}.compact
+ self.columns = @core.columns.collect{|c| c.name if @core.columns._inheritable.include?(c.name) and c.searchable? and c.column and c.column.text?}.compact
end
@columns
end | Bugfix: ignore_columns settings are not considered for search_columns
(issue <I> by eriko) | activescaffold_active_scaffold | train | rb |
b7b2b226bf76cff960f4d231a86821c797867b89 | diff --git a/lib/cms_scanner.rb b/lib/cms_scanner.rb
index <HASH>..<HASH> 100644
--- a/lib/cms_scanner.rb
+++ b/lib/cms_scanner.rb
@@ -106,13 +106,7 @@ module CMSScanner
# depending on the findings / errors
def exit_hook
at_exit do
- if run_error
- exit(NS::ExitCode::CLI_OPTION_ERROR) if run_error.is_a?(OptParseValidator::Error) ||
- run_error.is_a?(OptionParser::ParseError)
-
- exit(NS::ExitCode::INTERRUPTED) if run_error.is_a?(Interrupt)
- exit(NS::ExitCode::ERROR)
- end
+ exit(run_error_exit_code) if run_error
controller = controllers.first
@@ -121,6 +115,16 @@ module CMSScanner
exit(NS::ExitCode::OK)
end
end
+
+ # @return [ Integer ] The exit code related to the run_error
+ def run_error_exit_code
+ return NS::ExitCode::CLI_OPTION_ERROR if run_error.is_a?(OptParseValidator::Error) ||
+ run_error.is_a?(OptionParser::ParseError)
+
+ return NS::ExitCode::INTERRUPTED if run_error.is_a?(Interrupt)
+
+ NS::ExitCode::ERROR
+ end
end
end | rework the at_exit hook a bit | wpscanteam_CMSScanner | train | rb |
9feed61748c7c6ddae54a6e8138a18457f933547 | diff --git a/zipline/examples/dual_ema_talib.py b/zipline/examples/dual_ema_talib.py
index <HASH>..<HASH> 100644
--- a/zipline/examples/dual_ema_talib.py
+++ b/zipline/examples/dual_ema_talib.py
@@ -53,11 +53,11 @@ class DualEMATaLib(TradingAlgorithm):
self.buy = False
self.sell = False
- if self.short_ema > self.long_ema and not self.invested:
+ if (self.short_ema > self.long_ema).all() and not self.invested:
self.order('AAPL', 100)
self.invested = True
self.buy = True
- elif self.short_ema < self.long_ema and self.invested:
+ elif (self.short_ema < self.long_ema).all() and self.invested:
self.order('AAPL', -100)
self.invested = False
self.sell = True
diff --git a/zipline/transforms/batch_transform.py b/zipline/transforms/batch_transform.py
index <HASH>..<HASH> 100644
--- a/zipline/transforms/batch_transform.py
+++ b/zipline/transforms/batch_transform.py
@@ -381,7 +381,7 @@ class BatchTransform(object):
else:
data = self.rolling_panel.get_current()
- if self.supplemental_data:
+ if self.supplemental_data is not None:
for item in data.items:
if item not in self.supplemental_data.items:
continue | MAINT: Use more exact boolean checks for pandas structures.
To prepare for being compatible with pandas==<I>, which is stricter
on boolean checks. | quantopian_zipline | train | py,py |
add29e3cfc6e5c4e515c53aaad721ee1b3f814e9 | diff --git a/app/src/js/init.js b/app/src/js/init.js
index <HASH>..<HASH> 100644
--- a/app/src/js/init.js
+++ b/app/src/js/init.js
@@ -222,7 +222,7 @@ var init = {
});
// Check if any records in the overview have been checked, and if so: show action buttons.
- $('.dashboardlisting input:checkbox').click(function () {
+ $('.dashboardlisting input:checkbox[name="checkRow"]').click(function () {
var aItems = getSelectedItems();
if (aItems.length >= 1) { | Make row checkbox more selective when en/disabling buttons | bolt_bolt | train | js |
5a876fbb0997c4835bbfe3dd9b58c3b492d86a44 | diff --git a/web/concrete/single_pages/dashboard/reports/statistics.php b/web/concrete/single_pages/dashboard/reports/statistics.php
index <HASH>..<HASH> 100644
--- a/web/concrete/single_pages/dashboard/reports/statistics.php
+++ b/web/concrete/single_pages/dashboard/reports/statistics.php
@@ -66,6 +66,8 @@ defined('C5_EXECUTE') or die("Access Denied.");
<p><?php echo t('Total page versions')?>: <strong><?php echo $totalVersions?></strong></p>
<p><?php echo t('Total pages in edit mode')?>: <strong><?php echo $totalEditMode?></strong></p>
+<br/><br/>
+
<h4><?=t('Five Most Recent Downloads')?></h4>
<table class="table" id="ccm-site-statistics-downloads"> | light tweaks to statistics but it's still broken
Former-commit-id: e<I>ac8cc1dd<I>cac3cf4ef<I>b0e<I>f | concrete5_concrete5 | train | php |
d95ef8f026f65ec8d677dcb00413ae979836a61f | diff --git a/test/test_mock_solver_loading.py b/test/test_mock_solver_loading.py
index <HASH>..<HASH> 100644
--- a/test/test_mock_solver_loading.py
+++ b/test/test_mock_solver_loading.py
@@ -7,6 +7,7 @@ import unittest
import requests_mock
import dwave_micro_client
+from dwave_micro_client import InvalidAPIResponseError
try:
import unittest.mock as mock
@@ -135,7 +136,7 @@ class MockSolverLoading(unittest.TestCase):
with requests_mock.mock() as m:
m.get(solver1_url, text=solver_object(solver_name, True))
con = dwave_micro_client.Connection(url, token)
- with self.assertRaises(KeyError):
+ with self.assertRaises(InvalidAPIResponseError):
con.get_solver(solver_name)
def test_load_solver_broken_response(self): | Fix unit test for case of a solver with invalid structure | dwavesystems_dwave-cloud-client | train | py |
3d2d1709a3b959f019cfeb9b00ae65e8f32908d4 | diff --git a/test/__init__.py b/test/__init__.py
index <HASH>..<HASH> 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -106,6 +106,7 @@ class TestSendGrid(unittest.TestCase):
self.assertEqual(html, url['html'])
def test_drop_to_header(self):
+ smtpapi = '{}'
m = Mail()
m.add_to('John, Doe <[email protected]>')
m.set_from('[email protected]')
@@ -113,8 +114,7 @@ class TestSendGrid(unittest.TestCase):
m.set_text('test')
m.add_bcc('John, Doe <[email protected]>')
url = self.sg._build_body(m)
-
- print url
+ self.assertEqual(smtpapi, url['x-smtpapi'])
class SendGridClientUnderTest(SendGridClient): | Assert dumps in headers | sendgrid_sendgrid-python | train | py |
45eb0a36db43342aee0af75ade0abb6cb1700fb6 | diff --git a/lib/kaminari/sinatra.rb b/lib/kaminari/sinatra.rb
index <HASH>..<HASH> 100644
--- a/lib/kaminari/sinatra.rb
+++ b/lib/kaminari/sinatra.rb
@@ -2,4 +2,6 @@ require 'sinatra/base'
require 'kaminari'
require 'kaminari/helpers/sinatra_helpers'
+ActiveSupport::Deprecation.warn 'Kaminari Sinatra support has been extracted to a separate gem, and will be removed in the next 1.0 release. Please bundle kaminari-sinatra gem.'
+
Kaminari::Hooks.init | Extract kaminari-sinatra gem, and warn users to use the gemified adapter
The built-in Sinatra support will be removed from this gem in the <I> release | kaminari_kaminari | train | rb |
dc875b42e9fb231fc61622a698df996a116fff0d | diff --git a/src/adapters/stdOut.js b/src/adapters/stdOut.js
index <HASH>..<HASH> 100644
--- a/src/adapters/stdOut.js
+++ b/src/adapters/stdOut.js
@@ -12,6 +12,13 @@ function configure( config, formatter ) {
error: "red"
}, config.theme );
+ var logType = {
+ info: "info",
+ warn: "warn",
+ debug: "log",
+ error: "error"
+ };
+
colors.setTheme( theme );
adapter = adapter || {
@@ -23,7 +30,7 @@ function configure( config, formatter ) {
msg = data.msg;
}
var timestamp = formatter( config, data );
- console.log( colors[ data.type ]( timestamp, data.namespace || "", msg ) );
+ console[logType[data.type]]( colors[ data.type ]( timestamp, data.namespace || "", msg ) );
},
constraint: function( data ) {
return data.level <= config.level && ( !config.bailIfDebug || ( config.bailIfDebug && !envDebug ) ); | first hack to use appropriate console method for logging levels | LeanKit-Labs_whistlepunk | train | js |
ef8edee4099ed19f5086fa734363b65a3ddfcd26 | diff --git a/kernel_tuner/strategies/firefly_algorithm.py b/kernel_tuner/strategies/firefly_algorithm.py
index <HASH>..<HASH> 100644
--- a/kernel_tuner/strategies/firefly_algorithm.py
+++ b/kernel_tuner/strategies/firefly_algorithm.py
@@ -66,7 +66,7 @@ def tune(runner, kernel_options, device_options, tuning_options):
# compute initial intensities
for j in range(num_particles):
try:
- swarm[i].compute_intensity(_cost_func)
+ swarm[j].compute_intensity(_cost_func)
except util.StopCriterionReached as e:
if tuning_options.verbose:
print(e) | fix computation of initial scores in firefly | benvanwerkhoven_kernel_tuner | train | py |
2ce8d8a8c522f92561a1ad9287a329be2a831d8c | diff --git a/lib/disney/couchbaseChannel.js b/lib/disney/couchbaseChannel.js
index <HASH>..<HASH> 100644
--- a/lib/disney/couchbaseChannel.js
+++ b/lib/disney/couchbaseChannel.js
@@ -30,6 +30,8 @@ const sLongPollDelay = Symbol('Long Poll Restart Delay');
// size of batches to fetch docs in
const docFetchBatchSize = 500;
+const longPollTimeout = 1000 * 60 * 5; // 5 minutes
+
// current (< 2.x) User-Agent
// https://github.com/couchbase/couchbase-lite-android/blob/5bffb9f80db52946b543d6dec03f1cb2d7b6de50/shared/src/main/java/com/couchbase/lite/internal/replicator/CBLWebSocket.java#L351
const CouchbaseLiteUserAgent = 'CouchbaseLite/1.3 (1.4.1/8a21c5927a273a038fb3b66ec29c86425e871b11)';
@@ -51,9 +53,9 @@ function DoLongPoll() {
}, {
json: true,
headers: this.HTTPHeaders,
- // timeout long-poll after a minute
- response_timeout: 1000 * 60,
- read_timeout: 1000 * 60,
+ // timeout long-poll after 5 minutes
+ response_timeout: longPollTimeout,
+ read_timeout: longPollTimeout,
}).then((resp) => {
// check for success
if (resp.statusCode !== 200) { | [~] Set longpoll timeout to 5 minutes | cubehouse_themeparks | train | js |
a589bdb558f9bf407565152cbb25a6b9049bc4fb | diff --git a/users.go b/users.go
index <HASH>..<HASH> 100644
--- a/users.go
+++ b/users.go
@@ -246,7 +246,7 @@ func (api *Client) GetUserIdentityContext(ctx context.Context) (*UserIdentityRes
// SetUserPhoto changes the currently authenticated user's profile image
func (api *Client) SetUserPhoto(ctx context.Context, image string, params UserSetPhotoParams) error {
- return api.SetUserPhoto(context.Background(), image, params)
+ return api.SetUserPhotoContext(context.Background(), image, params)
}
// SetUserPhotoContext changes the currently authenticated user's profile image using a custom context | Fix bug wherein users.SetUserPhoto was calling itself recursively. | nlopes_slack | train | go |
39c670881521ff39ee25fcced1572471d7f91907 | diff --git a/redis_metrics/utils.py b/redis_metrics/utils.py
index <HASH>..<HASH> 100644
--- a/redis_metrics/utils.py
+++ b/redis_metrics/utils.py
@@ -10,9 +10,9 @@ def metric(slug, num=1, **kwargs):
_r.metric(slug, num)
-def gague(slug, current_value):
- """Set a value for a Guage"""
- _r.gague(slug, current_value)
+def gauge(slug, current_value):
+ """Set a value for a Gauge"""
+ _r.gauge(slug, current_value)
def _dates(num): | Fixed the spelling of ``gauge`` again. | bradmontgomery_django-redis-metrics | train | py |
3cb55c46acea1fe14e161ba0e46c0d292d1d9d27 | diff --git a/lib/fog/dynect/requests/dns/get_record.rb b/lib/fog/dynect/requests/dns/get_record.rb
index <HASH>..<HASH> 100644
--- a/lib/fog/dynect/requests/dns/get_record.rb
+++ b/lib/fog/dynect/requests/dns/get_record.rb
@@ -60,7 +60,7 @@ module Fog
records = zone[:records][type].select { |record| record[:fqdn] == fqdn }
response.body = {
"status" => "success",
- "data" => records.collect { |record| "/REST/ARecord/#{record[:zone][:zone]}/#{record[:fqdn]}/#{record[:record_id]}" },
+ "data" => records.collect { |record| "/REST/#{record[:type]}Record/#{record[:zone][:zone]}/#{record[:fqdn]}/#{record[:record_id]}" },
"job_id" => Fog::Dynect::Mock.job_id,
"msgs" => [{
"INFO" => "detail: Found #{records.size} record", | [dynect|dns] accidentally hardcoded the record type in the mocked data. | fog_fog | train | rb |
708f8019f49d8669395d5ae379d571edd351610b | diff --git a/src/hamster/widgets/facttree.py b/src/hamster/widgets/facttree.py
index <HASH>..<HASH> 100644
--- a/src/hamster/widgets/facttree.py
+++ b/src/hamster/widgets/facttree.py
@@ -321,6 +321,7 @@ class FactTree(graphics.Scene, gtk.Scrollable):
return facts_ids.index(self.current_fact.id)
def on_mouse_down(self, scene, event):
+ self.on_mouse_move(None, event)
self.grab_focus()
if self.hover_fact:
if self.hover_fact == self.current_fact: | call on_mouse_move in on_mouse_down
otherwise the hover information is sometimes not up to date | projecthamster_hamster | train | py |
4d1d988e7ebc227ba0b0f3db5f1e7295e384c5b6 | diff --git a/sling/core/commons/src/main/java/com/composum/sling/clientlibs/service/DefaultClientlibService.java b/sling/core/commons/src/main/java/com/composum/sling/clientlibs/service/DefaultClientlibService.java
index <HASH>..<HASH> 100644
--- a/sling/core/commons/src/main/java/com/composum/sling/clientlibs/service/DefaultClientlibService.java
+++ b/sling/core/commons/src/main/java/com/composum/sling/clientlibs/service/DefaultClientlibService.java
@@ -754,7 +754,7 @@ public class DefaultClientlibService implements ClientlibService {
} else if (new FileHandle(resourceAsAdmin).isValid() && !new FileHandle(resourceAsUser).isValid()) {
buf.append("ERROR: Content resource not readable: ").append(resourceAsAdmin.getPath()).append("\n");
}
- } else {
+ } else if (!resourceFolder.getOptional()) {
buf.append("ERROR: can't find element ").append(ref.path)
.append(" of resource folder ").append(resourceFolder.resource.getPath()).append("\n");
} | CMP-<I> Don't present missing optional resources as error | ist-dresden_composum | train | java |
375be4fbfe627b6012321f8cfcd0f0f6ac38d936 | diff --git a/dclab/rtdc_dataset/fmt_tdms/naming.py b/dclab/rtdc_dataset/fmt_tdms/naming.py
index <HASH>..<HASH> 100644
--- a/dclab/rtdc_dataset/fmt_tdms/naming.py
+++ b/dclab/rtdc_dataset/fmt_tdms/naming.py
@@ -35,6 +35,8 @@ dclab2tdms = {
"pos_y": "y",
"size_x": "ax2",
"size_y": "ax1",
+ "temp": "temp",
+ "amb_temp": "amb_temp",
}
# Add lower-case userdef features | Update naming.py
Add keys for ambient and sample temperature during measurement | ZELLMECHANIK-DRESDEN_dclab | train | py |
7694555886ac4a53a351f5a0d12443dd6443edd0 | diff --git a/core/src/main/java/hudson/util/AtomicFileWriter.java b/core/src/main/java/hudson/util/AtomicFileWriter.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/util/AtomicFileWriter.java
+++ b/core/src/main/java/hudson/util/AtomicFileWriter.java
@@ -149,7 +149,7 @@ public class AtomicFileWriter extends Writer {
integrityOnClose = false;
}
- core = new FileChannelWriter(tmpPath, charset, integrityOnFlush, integrityOnClose, StandardOpenOption.WRITE);
+ core = new FileChannelWriter(tmpPath, charset, integrityOnFlush, integrityOnClose, StandardOpenOption.WRITE, StandardOpenOption.CREATE);
}
@Override | Fix JENKINS-<I>
Add StandardOpenOption.CREATE flag to create FileChannelWriter to avoid full fs flush and 5sec log operation on creating empty file with CephFS as a storage | jenkinsci_jenkins | train | java |
caf8dc7bccd1fad9c5c586e676c61ecca809e922 | diff --git a/hammer.js b/hammer.js
index <HASH>..<HASH> 100644
--- a/hammer.js
+++ b/hammer.js
@@ -25,16 +25,16 @@ function HammerPlugin(game, opts) {
};
HammerPlugin.prototype.enable = function() {
- this.registry.registerItem('hammerIron', {
+ this.registry.registerItem('hammer', {
itemTexture: 'items/iron_pickaxe', // TODO
- displayName: 'Iron Hammer',
+ displayName: 'Hammer',
toolClass: 'pickaxe',
});
if (this.recipes) {
this.recipes.registerPositional([
['ingotIron', 'ingotIron', 'ingotIron'],
['ingotIron', 'stick', 'ingotIron'],
- [undefined, 'stick', undefined]], ['hammerIron']);
+ [undefined, 'stick', undefined]], ['hammer']);
}
this.mine.on('break', this.break.bind(this));
};
@@ -55,7 +55,7 @@ var around = function(cb) {
HammerPlugin.prototype.break = function(target) {
var heldItem = this.hotbar.held();
- if (!heldItem || heldItem.item !== 'hammerIron') return;
+ if (!heldItem || heldItem.item !== 'hammer') return;
console.log(target);
around(function(dx, dy, dz) { | Rename item to just 'hammer' (drop iron) | voxel_voxel-hammer | train | js |
4afd96a1c96ecdc31b0eb638efd9bbacde886049 | diff --git a/esm-webpack-plugin.js b/esm-webpack-plugin.js
index <HASH>..<HASH> 100644
--- a/esm-webpack-plugin.js
+++ b/esm-webpack-plugin.js
@@ -52,6 +52,7 @@ function exportsForModule(module, libVar) {
exports += `export default ${libVar};\nexport { ${libVar} };\n`
}
return `
+${libVar} === undefined && ${exports.length > 0 && namedExports.length > 0} && console.error('esm-webpack-plugin: nothing exported!');
${exports}${
namedExports.length ?
`\nexport {\n${namedExports.join(",\n")}\n}` : | Add output console error code for when no exports are exposed | purtuga_esm-webpack-plugin | train | js |
Subsets and Splits