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 |
|---|---|---|---|---|---|
c338bc9014863e3ab4f5548ba511d4b150485d86 | diff --git a/pipeline/compressors/__init__.py b/pipeline/compressors/__init__.py
index <HASH>..<HASH> 100644
--- a/pipeline/compressors/__init__.py
+++ b/pipeline/compressors/__init__.py
@@ -60,7 +60,7 @@ class Compressor(object):
js = js + self.compile_templates(templates)
if not settings.PIPELINE_DISABLE_WRAPPER:
- js = "(function() { %s }).call(this);" % js
+ js = "(function() {\n%s\n}).call(this);" % js
compressor = self.js_compressor
if compressor: | Added new lines before and after inserted javascript code. | jazzband_django-pipeline | train | py |
0094f4d2b087463d0c82f9222ddfa4a9cf1d649a | diff --git a/exchange_actions/exchange_actions.go b/exchange_actions/exchange_actions.go
index <HASH>..<HASH> 100644
--- a/exchange_actions/exchange_actions.go
+++ b/exchange_actions/exchange_actions.go
@@ -144,7 +144,7 @@ func RegisterExchangeJobs(I18n *i18n.I18n, Worker *worker.Worker) {
Locale: locales[idx],
Value: value,
})
- logMsg += fmt.Sprintf("%v/%v Imporeted %v,%v,%v\n", index, recordCount, locales[idx], values[0], value)
+ logMsg += fmt.Sprintf("%v/%v Imported %v,%v,%v\n", index, recordCount, locales[idx], values[0], value)
}
}
processedRecordLogs = append(processedRecordLogs, logMsg) | Correct typo 'Imporeted' | qor_i18n | train | go |
2c6193dd5e543914de607567aa7e7f11a91e9e8c | diff --git a/lib/sfn/command/conf.rb b/lib/sfn/command/conf.rb
index <HASH>..<HASH> 100644
--- a/lib/sfn/command/conf.rb
+++ b/lib/sfn/command/conf.rb
@@ -124,10 +124,10 @@ Configuration.new do
google_service_account_private_key ENV['GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY']
google_project ENV['GOOGLE_PROJECT']
# Terraform credentials information
- # Valid driver names: :atlas, :boule, :local
+ # Valid driver names: :tfe, :boule, :local
terraform_driver :local
- terraform_atlas_endpoint ENV['ATLAS_URL']
- terraform_atlas_token ENV['ATLAS_TOKEN']
+ terraform_tfe_endpoint ENV['TFE_URL']
+ terraform_tfe_token ENV['TFE_TOKEN']
terraform_boule_endpoint ENV['BOULE_URL']
terraform_local_directory './terraform-stacks'
terraform_local_scrub_destroyed false | Update driver and attribute names within configuration template | sparkleformation_sfn | train | rb |
1c37be5444df53ba9aa2bc9e53d13582bf7da685 | diff --git a/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb b/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb
index <HASH>..<HASH> 100644
--- a/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb
+++ b/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb
@@ -28,9 +28,13 @@ module StripeMock
def add_subscription_to_customer(cus, sub)
id = new_id('ch')
charges[id] = Data.mock_charge(:id => id, :customer => cus[:id], :amount => sub[:plan][:amount])
+ if cus[:currency].nil?
+ cus[:currency] = sub[:plan][:currency]
+ elsif cus[:currency] != sub[:plan][:currency]
+ raise Stripe::InvalidRequestError.new( "Can't combine currencies on a single customer. This customer has had a subscription, coupon, or invoice item with currency #{cus[:currency]}", 'currency', 400)
+ end
cus[:subscriptions][:total_count] = (cus[:subscriptions][:total_count] || 0) + 1
cus[:subscriptions][:data].unshift sub
- cus[:currency] = sub[:plan][:currency]
end
def delete_subscription_from_customer(cus, subscription) | Raise error if trying to combine currencies on the same customer. | rebelidealist_stripe-ruby-mock | train | rb |
74ceaeeaf33428679b6687ac96ccbb9fdd2f28a0 | diff --git a/cmd/policies.go b/cmd/policies.go
index <HASH>..<HASH> 100644
--- a/cmd/policies.go
+++ b/cmd/policies.go
@@ -47,7 +47,7 @@ func init() {
Usage: "Display the contents of a policy",
ArgsUsage: "<policy>",
Flags: []cli.Flag{
- orgFlag("The org the policy belongs to", true),
+ orgFlag("The org the policy belongs to", false),
},
Action: chain(
ensureDaemon, ensureSession, loadDirPrefs, loadPrefDefaults, | Fixed required org flag in policies view | manifoldco_torus-cli | train | go |
04fc205838bbafaeee7fad327f119d7c5538a544 | diff --git a/WordPress/Sniffs/WP/I18nSniff.php b/WordPress/Sniffs/WP/I18nSniff.php
index <HASH>..<HASH> 100644
--- a/WordPress/Sniffs/WP/I18nSniff.php
+++ b/WordPress/Sniffs/WP/I18nSniff.php
@@ -653,10 +653,13 @@ class I18nSniff extends AbstractFunctionRestrictionsSniff {
// If the opening HTML element includes placeholders in its attributes, we don't warn.
// E.g. '<option id="%1$s" value="%2$s">Translatable option name</option>'.
- for ( $i = 0; $attr = $reader->getAttributeNo( $i ); $i++ ) {
+ $i = 0;
+ while ( $attr = $reader->getAttributeNo( $i ) ) {
if ( preg_match( self::SPRINTF_PLACEHOLDER_REGEX, $attr ) === 1 ) {
return;
}
+
+ ++$i;
}
// We don't flag strings wrapped in `<a href="...">...</a>`, as the link target might actually need localization. | I<I>n: assignment in condition is only allowed in a while loop
The code as was, was throwing two warnings. Let's not set a bad example. | WordPress-Coding-Standards_WordPress-Coding-Standards | train | php |
40d5199c015a44157f2ce547f897560f68be7716 | diff --git a/examples/iojs-todo/deploy.js b/examples/iojs-todo/deploy.js
index <HASH>..<HASH> 100644
--- a/examples/iojs-todo/deploy.js
+++ b/examples/iojs-todo/deploy.js
@@ -1,6 +1,8 @@
var async = require('async')
var apt = require('nibbler-apt')
var iojs = require('nibbler-debian-iojs')
+var copy = require('nibbler-copy')
+var upstart = require('nibbler-upstart')
module.exports = [
[ apt, {
@@ -9,5 +11,16 @@ module.exports = [
pkg: ['redis-server']
} ],
iojs,
- copyContext
+ [ copy, {
+ src: __dirname,
+ dest: '/opt/todo'
+ } ],
+ [ upstart.install, {
+ name: 'todo',
+ execpath: 'iojs',
+ script: '/opt/todo/server.js'
+ } ],
+ [ upstart.start, {
+ name: 'todo'
+ } ]
] | Get the app running in the deployment example | mmalecki_nibbler | train | js |
984eb4e06833803ba11635855b1469b1a9bf5009 | diff --git a/respond.src.js b/respond.src.js
index <HASH>..<HASH> 100644
--- a/respond.src.js
+++ b/respond.src.js
@@ -256,7 +256,7 @@ window.matchMedia = window.matchMedia || (function(doc, undefined){
ss.media = i;
//originally, ss was appended to a documentFragment and sheets were appended in bulk.
- //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set
+ //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
head.insertBefore( ss, lastLink.nextSibling );
if ( ss.styleSheet ){ | improved comment with a credit to @dvelyk | scottjehl_Respond | train | js |
7e3c706faaac6e61400a81409b4e408d96593334 | diff --git a/src/android/NotificareUtils.java b/src/android/NotificareUtils.java
index <HASH>..<HASH> 100644
--- a/src/android/NotificareUtils.java
+++ b/src/android/NotificareUtils.java
@@ -371,9 +371,13 @@ public class NotificareUtils {
public static JSONObject mapInboxItem(NotificareInboxItem notificareInboxItem) throws JSONException {
JSONObject inboxItemMap = new JSONObject();
inboxItemMap.put("inboxId", notificareInboxItem.getItemId());
- inboxItemMap.put("notification", notificareInboxItem.getNotification().getNotificationId());
+ if (notificareInboxItem.getNotification() != null) {
+ inboxItemMap.put("notification", notificareInboxItem.getNotification().getNotificationId());
+ }
inboxItemMap.put("type", notificareInboxItem.getType());
- inboxItemMap.put("message", notificareInboxItem.getNotification().getMessage());
+ if (notificareInboxItem.getNotification() != null) {
+ inboxItemMap.put("message", notificareInboxItem.getNotification().getMessage());
+ }
inboxItemMap.put("title", notificareInboxItem.getTitle());
inboxItemMap.put("subtitle", notificareInboxItem.getSubtitle());
if (notificareInboxItem.getAttachment() != null) { | fix: check null notification on mapping
ISSUE SDK-<I> | Notificare_notificare-push-lib-cordova | train | java |
618d8bb95786cbbbd19bbdab327bebb46f3d490f | diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js
index <HASH>..<HASH> 100644
--- a/src/client/rest/RESTMethods.js
+++ b/src/client/rest/RESTMethods.js
@@ -48,9 +48,9 @@ class RESTMethods{
});
}
- DeleteMessage(channel, message) {
+ DeleteMessage(message) {
return new Promise((resolve, reject) => {
- this.rest.makeRequest('del', Constants.Endpoints.CHANNEL_MESSAGE(channel.id, message.id), true)
+ this.rest.makeRequest('del', Constants.Endpoints.CHANNEL_MESSAGE(message.channel.id, message.id), true)
.then(data => {
resolve(this.rest.client.actions.MessageDelete.handle({
id: message.id,
diff --git a/src/structures/Message.js b/src/structures/Message.js
index <HASH>..<HASH> 100644
--- a/src/structures/Message.js
+++ b/src/structures/Message.js
@@ -73,7 +73,7 @@ class Message {
}
delete() {
- return this.client.rest.methods.DeleteMessage(this.channel, this);
+ return this.client.rest.methods.DeleteMessage(this);
}
} | Simplified client.rest.methods.DeleteMessage, now only takes a message instead of a channel and a message. | discordjs_discord.js | train | js,js |
f72e6488eee30b68a5064c3946656981890e18b0 | diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py
index <HASH>..<HASH> 100644
--- a/elasticsearch/client/__init__.py
+++ b/elasticsearch/client/__init__.py
@@ -200,7 +200,7 @@ class Elasticsearch(object):
params=params)
return data
- @query_params('exclude', 'include', 'parent', 'preference',
+ @query_params('_source_exclude', '_source_include', 'parent', 'preference',
'realtime', 'refresh', 'routing')
def get_source(self, index, id, doc_type='_all', params=None):
""" | Normalizing the source filtering params of get_source with the rest of the API | elastic_elasticsearch-py | train | py |
43d8d97e7c9217a46e6421bf5f32f0475d04284d | diff --git a/pkg/model/gcemodel/api_loadbalancer.go b/pkg/model/gcemodel/api_loadbalancer.go
index <HASH>..<HASH> 100644
--- a/pkg/model/gcemodel/api_loadbalancer.go
+++ b/pkg/model/gcemodel/api_loadbalancer.go
@@ -55,12 +55,14 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error {
}
targetPool := &gcetasks.TargetPool{
- Name: s(b.NameForTargetPool("api")),
+ Name: s(b.NameForTargetPool("api")),
+ Lifecycle: b.Lifecycle,
}
c.AddTask(targetPool)
ipAddress := &gcetasks.Address{
- Name: s(b.NameForIPAddress("api")),
+ Name: s(b.NameForIPAddress("api")),
+ Lifecycle: b.Lifecycle,
}
c.AddTask(ipAddress) | Set lifecycle in GCE APILoadBalancerBuilder | kubernetes_kops | train | go |
4db4ac50fc9691949e02d4fc691c6bb0979759f3 | diff --git a/src/sap.ui.core/src/sap/ui/core/util/MockServer.js b/src/sap.ui.core/src/sap/ui/core/util/MockServer.js
index <HASH>..<HASH> 100644
--- a/src/sap.ui.core/src/sap/ui/core/util/MockServer.js
+++ b/src/sap.ui.core/src/sap/ui/core/util/MockServer.js
@@ -3403,7 +3403,12 @@ sap.ui
day.setHours(day.getHours() + offset);
return day.getTime();
};
- return "/Date(" + fnNoOffset(sString.substring("datetime'".length, sString.length - 1)) + ")/";
+
+ if (sString.indexOf("datetimeoffset") > -1) {
+ return "/Date(" + fnNoOffset(sString.substring("datetimeoffset'".length, sString.length - 1)) + ")/";
+ } else {
+ return "/Date(" + fnNoOffset(sString.substring("datetime'".length, sString.length - 1)) + ")/";
+ }
};
/** | [FIX] Mockserver: Correct parsing Edm.DateTimeOffset-typed Properties
When a mocked service used Edm.DateTimeOffset properties these values
weren't handled correctly in some cases (e.g. filtering).
Change-Id: I8fb<I>e<I>b5ec<I>b<I>cc7e7e5a<I>d | SAP_openui5 | train | js |
a44e62befd4fea60375f41ea129fd39a00cbf505 | diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/relation/delegation.rb
+++ b/activerecord/lib/active_record/relation/delegation.rb
@@ -115,15 +115,5 @@ module ActiveRecord
def respond_to_missing?(method, _)
super || @klass.respond_to?(method) || arel.respond_to?(method)
end
-
- def method_missing(method, *args, &block)
- if @klass.respond_to?(method)
- scoping { @klass.public_send(method, *args, &block) }
- elsif arel.respond_to?(method)
- arel.public_send(method, *args, &block)
- else
- super
- end
- end
end
end | Remove `method_missing` in `Relation::Delegation`
The `method_missing` is never reached since <I>c<I>d7c. | rails_rails | train | rb |
2c73ab92fa5718822ddfb5587727dce6819d9f1a | diff --git a/rundeckapp/src/java/com/dtolabs/rundeck/services/ReportAppender.java b/rundeckapp/src/java/com/dtolabs/rundeck/services/ReportAppender.java
index <HASH>..<HASH> 100644
--- a/rundeckapp/src/java/com/dtolabs/rundeck/services/ReportAppender.java
+++ b/rundeckapp/src/java/com/dtolabs/rundeck/services/ReportAppender.java
@@ -66,6 +66,7 @@ public class ReportAppender extends AppenderSkeleton {
map.put("adhocExecution", event.getMDC(Constants.MDC_ADHOCEXEC_KEY));
map.put("rundeckExecId", event.getMDC("rundeckExecId"));
map.put("rundeckJobId", event.getMDC("rundeckJobId"));
+ map.put("rundeckJobName", event.getMDC("rundeckJobName"));
map.put("epochDateStarted", event.getMDC(Constants.MDC_EPOCHSTART_KEY));
map.put("epochDateEnded", event.getMDC(Constants.MDC_EPOCHEND_KEY));
if (null!=event.getMDC("adhocScript")) { | Support rundeckJobName report field | rundeck_rundeck | train | java |
d165d656365e3edd63833e7b8d3c2ea2d3aafe6f | diff --git a/pipenv/core.py b/pipenv/core.py
index <HASH>..<HASH> 100644
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -2178,6 +2178,7 @@ def do_shell(three=None, python=False, fancy=False, shell_args=None, pypi_mirror
# Only set PIPENV_ACTIVE after finishing reading virtualenv_location
# otherwise its value will be changed
os.environ["PIPENV_ACTIVE"] = vistir.misc.fs_str("1")
+
os.environ.pop("PIP_SHIMS_BASE_MODULE", None)
if fancy: | Add blank line since these two environment variable has different purpose | pypa_pipenv | train | py |
a0f9262ebbaaa8a152991c0cca922b103a06ee23 | diff --git a/src/Knp/DoctrineBehaviors/Model/Translatable/TranslatableProperties.php b/src/Knp/DoctrineBehaviors/Model/Translatable/TranslatableProperties.php
index <HASH>..<HASH> 100644
--- a/src/Knp/DoctrineBehaviors/Model/Translatable/TranslatableProperties.php
+++ b/src/Knp/DoctrineBehaviors/Model/Translatable/TranslatableProperties.php
@@ -22,17 +22,17 @@ trait TranslatableProperties
* Will be mapped to translatable entity
* by TranslatableListener
*/
- private $translations;
+ protected $translations;
/**
* Will be merged with persisted translations on mergeNewTranslations call
*
* @see mergeNewTranslations
*/
- private $newTranslations;
+ protected $newTranslations;
/**
* currentLocale is a non persisted field configured during postLoad event
*/
- private $currentLocale;
+ protected $currentLocale;
} | Changed the private properties into protected, because there is an Error,when serializen the AbstractToken in Symfony2 an user with a relation with a tralatable entity. | KnpLabs_DoctrineBehaviors | train | php |
91c679b6d4cf57d8103083b34a02a410bd2ee90f | diff --git a/pyimzml/ImzMLParser.py b/pyimzml/ImzMLParser.py
index <HASH>..<HASH> 100755
--- a/pyimzml/ImzMLParser.py
+++ b/pyimzml/ImzMLParser.py
@@ -164,7 +164,7 @@ class ImzMLParser:
z = scan_elem.find('%scvParam[@accession="IMS:1000052"]' % self.sl).attrib["value"]
self.coordinates.append((int(x), int(y), int(z)))
except AttributeError:
- self.coordinates.append((int(x), int(y)))
+ self.coordinates.append((int(x), int(y), 0))
def __readimzmlmeta(self):
""" | always return (x,y,z) coordinates, and set z to 0 if not specific in the file | alexandrovteam_pyimzML | train | py |
72db7552d94aaaae884e014552a93d4f64c2372e | diff --git a/src/directives/list/table/controller.js b/src/directives/list/table/controller.js
index <HASH>..<HASH> 100644
--- a/src/directives/list/table/controller.js
+++ b/src/directives/list/table/controller.js
@@ -2,5 +2,10 @@
"use strict";
class Controller {
+
+ constructor() {
+ this.columns = [];
+ }
+
} | let this set an empty default (for the future: guesstimate?) | monomelodies_monad | train | js |
c15b9982be973a9a7d8876765a28fe7fd1d2bb74 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,6 @@ setup(
zip_safe=False,
platforms='any',
install_requires=[
- 'setuptools',
'Flask>=0.10',
'SQLAlchemy'
], | Removed setuptools requirement. This fixes #<I> | pallets_flask-sqlalchemy | train | py |
351f4d98921e593150efb13c3ad14c24afefb693 | diff --git a/middlewares/flow.js b/middlewares/flow.js
index <HASH>..<HASH> 100644
--- a/middlewares/flow.js
+++ b/middlewares/flow.js
@@ -67,6 +67,9 @@ function repeatAttribute (array) {
iteration: for (let item of array) {
let prevItem = prevArray[++i]
+ if (prevItem === item) {
+ continue
+ }
if (trackBy(item, prevItem, trackByProp)) {
this.$mutateContext(i, {[repeatValue]: item})
prevArray[i] = item | perf(flow): check for strict equality before everything else | nx-js_framework | train | js |
740ffc09e33df672d1746a351ace5730428dec11 | diff --git a/gatsby-config.js b/gatsby-config.js
index <HASH>..<HASH> 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -66,7 +66,7 @@ module.exports = {
'homepage-pages': require.resolve('./src/components/layouts/HomepageLayout.js'),
'installing-spark-pages': require.resolve('./src/components/layouts/InstallingSparkLayout.js'),
'using-spark-pages': require.resolve('./src/components/layouts/UsingSparkLayout.js'),
- 'principle-pages': require.resolve('./src/components/layouts/PrinciplesLayout.js'),
+ 'principles-pages': require.resolve('./src/components/layouts/PrinciplesLayout.js'),
default: require.resolve('./src/components/layouts/Layout.js'),
},
}, | fix typo to fix principles nav bug | sparkdesignsystem_spark-design-system | train | js |
ba109c44d32cc57cca6df4a66f68f83b340f8ef1 | diff --git a/goodtables/datatable/datatable.py b/goodtables/datatable/datatable.py
index <HASH>..<HASH> 100644
--- a/goodtables/datatable/datatable.py
+++ b/goodtables/datatable/datatable.py
@@ -233,7 +233,7 @@ class DataTable(object):
def _detect_stream_encoding(self, stream):
"""Return best guess at encoding of stream."""
- sample_length = 10000
+ sample_length = 64*1024
self._check_for_unsupported_format(stream) | Increase sample size for charset detection to a more reasonable value | frictionlessdata_goodtables-py | train | py |
6d3ccc50b9480629090c313c18be9aa7caae9498 | diff --git a/trimesh/exchange/wavefront.py b/trimesh/exchange/wavefront.py
index <HASH>..<HASH> 100644
--- a/trimesh/exchange/wavefront.py
+++ b/trimesh/exchange/wavefront.py
@@ -3,7 +3,7 @@ import collections
import numpy as np
try:
- import PIL
+ import PIL.Image
except ImportError:
pass | Update wavefront.py
fix "PIL has no attribute Image"
PIL itself does not have anything, need explicit import. | mikedh_trimesh | train | py |
cb05a7a66326ce9ebad520738ebcceaf5b1e4f5e | diff --git a/BAC0/core/utils/notes.py b/BAC0/core/utils/notes.py
index <HASH>..<HASH> 100644
--- a/BAC0/core/utils/notes.py
+++ b/BAC0/core/utils/notes.py
@@ -204,17 +204,17 @@ def note_and_log(cls):
logSaveFilePath = join(logUserPath, ".BAC0")
logFile = join(logSaveFilePath, "BAC0.log")
- if not os.path.exists(logSaveFilePath):
- try:
- os.makedirs(logSaveFilePath)
- except:
- _PERMISSION_TO_WRITE = False
- if _PERMISSION_TO_WRITE:
+ try:
+ if not os.path.exists(logSaveFilePath):
+ os.makedirs(logSaveFilePath)
fh = FileHandler(logFile)
fh.set_name("file_handler")
fh.setLevel(file_level)
fh.setFormatter(formatter)
+ except OSError:
+ _PERMISSION_TO_WRITE = False
+
ch.setFormatter(formatter)
ch2.setFormatter(formatter)
# Add handlers the first time only... | Check permision on write to file even if .BAC0 directory exists | ChristianTremblay_BAC0 | train | py |
48d065b0a95036898ae59bee92f63219a948526b | diff --git a/lib/photo.js b/lib/photo.js
index <HASH>..<HASH> 100644
--- a/lib/photo.js
+++ b/lib/photo.js
@@ -41,7 +41,6 @@ export class Photo extends Post {
<Cell
className="photo-metadata"
hideDesktop
- hideTablet
col={4}
>
<h1 className="photo-title">
@@ -50,6 +49,7 @@ export class Photo extends Post {
</Cell>
<Cell
className="photo-metadata"
+ hideTablet
hidePhone
col={4}
> | Hide on tablets as well as on phones. | randytarampi_me | train | js |
354db7bdc45e142a2840800190db9b0c9cdeaf80 | diff --git a/openquake/calculators/post_risk.py b/openquake/calculators/post_risk.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/post_risk.py
+++ b/openquake/calculators/post_risk.py
@@ -101,7 +101,9 @@ def post_ebrisk(dstore, aggkey, monitor):
for x in ast.literal_eval(aggkey)]
idx = tuple(x[0] - 1 for x in agglist if len(x) == 1)
rlz_id = dstore['events']['rlz_id']
- arr = numpy.zeros((len(rlz_id), L)) # E, L
+ E = len(rlz_id)
+ print('Requiring %s' % general.humansize(E*L*8))
+ arr = numpy.zeros((E, L))
for ids in itertools.product(*agglist):
key = ','.join(map(str, ids)) + ','
try: | Added a print [skip CI] | gem_oq-engine | train | py |
b3236f24afac2a89f3f9d74f7c760470d03a048a | diff --git a/src/Sulu/Bundle/ContactBundle/Entity/ContactRepository.php b/src/Sulu/Bundle/ContactBundle/Entity/ContactRepository.php
index <HASH>..<HASH> 100644
--- a/src/Sulu/Bundle/ContactBundle/Entity/ContactRepository.php
+++ b/src/Sulu/Bundle/ContactBundle/Entity/ContactRepository.php
@@ -90,6 +90,28 @@ class ContactRepository extends EntityRepository
return $query->getArrayResult();
}
+
+ /**
+ * Searches for contacts with a specific account and the ability to exclude a certain contact
+ * @param $accountId
+ * @param null $excludeContactId
+ * @return array
+ */
+ public function findByAccountId($accountId, $excludeContactId = null ) {
+ $qb = $this->createQueryBuilder('c')
+ ->join('c.account','a', 'WITH', 'a.id = :accountId')
+ ->setParameter('accountId', $accountId);
+
+ if (!is_null($excludeContactId)) {
+ $qb->where('c.id != :excludeId')
+ ->setParameter('excludeId', $excludeContactId);
+ }
+
+ $query = $qb->getQuery();
+
+ return $query->getArrayResult();
+ }
+
/**
* Add sorting to querybuilder
* @param QueryBuilder $qb | added findOneByAccountId, which enables to get all contacts from same account but exclude one contact (to prohibit circular references | sulu_sulu | train | php |
48611e8543936cbde141c14e69bec50b4b72f8aa | diff --git a/test/test-promises.js b/test/test-promises.js
index <HASH>..<HASH> 100644
--- a/test/test-promises.js
+++ b/test/test-promises.js
@@ -886,4 +886,9 @@ describe('Test promise API', function () {
it('Should finally drop-cascade the pg_model_test schema', async () => {
await client.runFile(path.resolve(__dirname, path.join('fixtures', 'scripts', 'uninstall.sql')))
})
+
+ it('Should close database connections', function (done) {
+ client.end()
+ done()
+ })
})
diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1022,4 +1022,9 @@ describe('Run some basic tests', function () {
it('Should finally drop-cascade the pg_model_test schema', async () => {
await client.runFile(path.resolve(__dirname, path.join('fixtures', 'scripts', 'uninstall.sql')))
})
+
+ it('Should close database connections', function (done) {
+ client.end()
+ done()
+ })
}) | Shutdown db connection after tests finish | wmfs_pg-model | train | js,js |
3fd1d951f88ac1131f7c94352971db2ccb825058 | diff --git a/etcdserver/raft.go b/etcdserver/raft.go
index <HASH>..<HASH> 100644
--- a/etcdserver/raft.go
+++ b/etcdserver/raft.go
@@ -135,6 +135,7 @@ func (r *raftNode) start(rh *raftReadyHandler) {
r.applyc = make(chan apply)
r.stopped = make(chan struct{})
r.done = make(chan struct{})
+ internalTimeout := time.Second
go func() {
defer r.onStop()
@@ -167,6 +168,8 @@ func (r *raftNode) start(rh *raftReadyHandler) {
if len(rd.ReadStates) != 0 {
select {
case r.readStateC <- rd.ReadStates[len(rd.ReadStates)-1]:
+ case <-time.After(internalTimeout):
+ plog.Warningf("timed out sending read state")
case <-r.stopped:
return
} | etcdserver: time out when readStateC is blocking
Otherwise, it will block forever when the server is overloaded.
Fix <URL> | etcd-io_etcd | train | go |
29676ad08da1355a39073fba9ff085793bf039fb | diff --git a/lib/rails_admin_charts.rb b/lib/rails_admin_charts.rb
index <HASH>..<HASH> 100644
--- a/lib/rails_admin_charts.rb
+++ b/lib/rails_admin_charts.rb
@@ -9,12 +9,13 @@ module RailsAdminCharts
module ClassMethods
def total_records_since(since = 30.days.ago)
totals, before_count = self.group('DATE(created_at)').count, self.where('created_at < ?', since.to_date).count
- (since.to_date..Date.today).each_with_object([]) { |day, a| a << (a.last || before_count) + (totals[day.to_s] || 0) }
+ # TODO separate MySQL/Postgres approaches using ActiveRecord::Base.connection.adapter_name or check hash key is_a? String/Date
+ (since.to_date..Date.today).each_with_object([]) { |day, a| a << (a.last || before_count) + (totals[day] || totals[day.to_s] || 0) }
end
def delta_records_since(since = 30.days.ago)
deltas = self.group('DATE(created_at)').count
- (since.to_date..Date.today).map { |date| deltas[date.to_s] || 0 }
+ (since.to_date..Date.today).map { |date| deltas[date] || deltas[date.to_s] || 0 }
end
def graph_data(since=30.days.ago) | Hash access using Date for MySQL with String fallback for SQLite | pgeraghty_rails_admin_charts | train | rb |
91851a563b2aa119fecc0fefec1ed96fc61e5c16 | diff --git a/lib/einhorn/command.rb b/lib/einhorn/command.rb
index <HASH>..<HASH> 100644
--- a/lib/einhorn/command.rb
+++ b/lib/einhorn/command.rb
@@ -123,10 +123,14 @@ module Einhorn
end
end
- if Einhorn::State.signal_timeout
+ if Einhorn::State.signal_timeout && record
Einhorn::Event::Timer.open(Einhorn::State.signal_timeout) do
children.each do |child|
next unless spec = Einhorn::State.children[child]
+ unless spec[:signaled].include?(signal)
+ Einhorn.log_info("No record for #{signal} sent to child #{child.inspect} after #{Einhorn::State.signal_timeout}. This probably indicates a PID rollover happened.", :upgrade)
+ next
+ end
Einhorn.log_info("Child #{child.inspect} is still active after #{Einhorn::State.signal_timeout}. Sending SIGKILL.")
begin | Fix PID rollover bug
Also, don't send SIGKILL for signal commands from einhornsh | stripe_einhorn | train | rb |
e6998ec503524ff41108bfe6b98e56906ba7c0f8 | diff --git a/lib/celluloid/proxy/sync.rb b/lib/celluloid/proxy/sync.rb
index <HASH>..<HASH> 100644
--- a/lib/celluloid/proxy/sync.rb
+++ b/lib/celluloid/proxy/sync.rb
@@ -26,9 +26,10 @@ module Celluloid
if @mailbox == ::Thread.current[:celluloid_mailbox]
args.unshift meth
- actor = Thread.current[:celluloid_actor]
- actor = actor.behavior.subject.bare_object
- return actor.__send__(*args, &block)
+ meth = :__send__
+ # actor = Thread.current[:celluloid_actor]
+ # actor = actor.behavior.subject.bare_object
+ # return actor.__send__(*args, &block)
end
call = Call::Sync.new(::Celluloid.mailbox, meth, args, block) | avoid bypassing mailbox on chained sync calls | celluloid_celluloid | train | rb |
c0ff421772d9fc4f354527ecfb8a8954411ed1d4 | diff --git a/src/main/java/com/stratio/specs/GivenGSpec.java b/src/main/java/com/stratio/specs/GivenGSpec.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/stratio/specs/GivenGSpec.java
+++ b/src/main/java/com/stratio/specs/GivenGSpec.java
@@ -368,8 +368,8 @@ public class GivenGSpec extends BaseGSpec {
* @param path
* @throws Exception
*/
- @Given("^I browse to '(.+?)'$")
- public void seleniumBrowse(String path) throws Exception {
+ @Given("^I( securely browse| browse) to '(.+?)'$")
+ public void seleniumBrowse(Boolean isSecured, String path) throws Exception {
assertThat(path).isNotEmpty();
if (commonspec.getWebHost() == null) {
@@ -379,8 +379,12 @@ public class GivenGSpec extends BaseGSpec {
if (commonspec.getWebPort() == null) {
throw new Exception("Web port has not been set");
}
+ String protocol = "http://";
+ if (isSecured) {
+ protocol = "https://";
+ }
- String webURL = "http://" + commonspec.getWebHost() + commonspec.getWebPort();
+ String webURL = protocol + commonspec.getWebHost() + commonspec.getWebPort();
commonspec.getDriver().get(webURL + path);
commonspec.setParentWindow(commonspec.getDriver().getWindowHandle()); | HTTPS browsing for selenium (non-rest) (#<I>) | Stratio_bdt | train | java |
e9882d9f0ca13bea1362fb5b39fc407cd0123464 | diff --git a/lib/remcached.rb b/lib/remcached.rb
index <HASH>..<HASH> 100644
--- a/lib/remcached.rb
+++ b/lib/remcached.rb
@@ -110,6 +110,11 @@ module Memcached
end
end
+ if client_contents.empty?
+ callback.call results
+ return self
+ end
+
# send requests and wait for responses per client
clients_pending = client_contents.length
client_contents.each do |client,contents_list|
diff --git a/spec/memcached_spec.rb b/spec/memcached_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/memcached_spec.rb
+++ b/spec/memcached_spec.rb
@@ -1,5 +1,6 @@
$: << File.dirname(__FILE__) + '/../lib'
require 'remcached'
+require 'em-spec/rspec'
describe Memcached do
def run(&block)
@@ -263,6 +264,20 @@ describe Memcached do
@calls.should == 1
end
end
+
+ context "when servers are disconnected" do
+ include EM::SpecHelper
+
+ it "should return immediately with response" do
+ em(1) do
+ keys = [ { :key => key(0) } ]
+ Memcached.multi_get(keys) { |responses|
+ responses[key(0)][:status].should == Memcached::Errors::DISCONNECTED
+ stop
+ }
+ end
+ end
+ end
end
end | Fix for multi operations not calling the callback if all servers are disconnected. | astro_remcached | train | rb,rb |
4be63045fe5ef0a324865111ca96ac60089bb386 | diff --git a/src/Tasks.php b/src/Tasks.php
index <HASH>..<HASH> 100644
--- a/src/Tasks.php
+++ b/src/Tasks.php
@@ -297,7 +297,7 @@ class Tasks extends \Robo\Tasks
* @return \Robo\Result
*/
function applyUpdate() {
- $currentBranch = $this->projectProperties['branch'];
+ $currentBranch = $this->taskExec('git branch | grep \* | cut -d " " -f2');
$out = $this->taskExec('echo Current git branch is: $currentBranch')
->run();
@@ -311,7 +311,7 @@ class Tasks extends \Robo\Tasks
$output = $this->taskExec('git checkout $currentBranch')
->dir($this->projectProperties['web_root'])
->run();
-
+
}
/** | trying another approach to get the current branch | thinkshout_robo-drupal | train | php |
1f17d375cee6014135b22f848f9afd2a5d26d582 | diff --git a/molo/core/tests/base.py b/molo/core/tests/base.py
index <HASH>..<HASH> 100644
--- a/molo/core/tests/base.py
+++ b/molo/core/tests/base.py
@@ -143,7 +143,7 @@ class MoloTestCaseMixin(object):
})
data.update(kwargs)
data.update({
- 'slug': generate_slug(data['title'])
+ 'slug': generate_slug(data['title']),
})
section = SectionPage(**data)
parent.add_child(instance=section) | adding , to tuple | praekeltfoundation_molo | train | py |
683c2b641b130c769df2f751c82ca6718fb8f65a | diff --git a/master/setup.py b/master/setup.py
index <HASH>..<HASH> 100755
--- a/master/setup.py
+++ b/master/setup.py
@@ -485,7 +485,7 @@ setup_args['install_requires'] = [
# required for tests, but Twisted requires this anyway
'zope.interface >= 4.1.1',
'sqlalchemy>=1.2.0',
- 'sqlalchemy-migrate>=0.9',
+ 'sqlalchemy-migrate>=0.13',
'python-dateutil>=1.5',
'txaio ' + txaio_ver,
'autobahn ' + autobahn_ver, | require latest sqlalchemy-migrate
waiting for alembic, we should require recent version of sqlalchemy
because <I> can corrupt the db
Fix: #<I> | buildbot_buildbot | train | py |
3102c3dfe840961582477760b041a1257675830d | diff --git a/charmhelpers/contrib/openstack/amulet/deployment.py b/charmhelpers/contrib/openstack/amulet/deployment.py
index <HASH>..<HASH> 100644
--- a/charmhelpers/contrib/openstack/amulet/deployment.py
+++ b/charmhelpers/contrib/openstack/amulet/deployment.py
@@ -44,7 +44,7 @@ class OpenStackAmuletDeployment(AmuletDeployment):
Determine if the local branch being tested is derived from its
stable or next (dev) branch, and based on this, use the corresonding
stable or next branches for the other_services."""
- base_charms = ['mysql', 'mongodb', 'rabbitmq-server']
+ base_charms = ['mysql', 'mongodb']
if self.stable:
for svc in other_services: | allow rabbitmq-server to be used as a next charm in amulet testing | juju_charm-helpers | train | py |
0496fa57cb69431e757239ae235c07c91876ebfb | diff --git a/src/server.js b/src/server.js
index <HASH>..<HASH> 100644
--- a/src/server.js
+++ b/src/server.js
@@ -43,6 +43,9 @@ function Server(host, port, key, cert)
form.parse(req, function(err, fields, files) {
+ // mark the body as parsed so other parsers don't attempt to parse the request
+ req._body = true;
+
req.body = {};
req.files = {}; | FIX multipart form parser marks request as parsed | spreaker_node-mock-http-server | train | js |
a4104215be8c3aa902095dcb182d28b05ff3b79e | diff --git a/src/components/gridList/gridList.js b/src/components/gridList/gridList.js
index <HASH>..<HASH> 100644
--- a/src/components/gridList/gridList.js
+++ b/src/components/gridList/gridList.js
@@ -115,7 +115,7 @@ function GridListDirective($interpolate, $mdConstant, $mdGridLayout, $mdMedia, $
var invalidateLayout = angular.bind(ctrl, ctrl.invalidateLayout),
unwatchAttrs = watchMedia();
- scope.$on('$destroy', unwatchMedia());
+ scope.$on('$destroy', unwatchMedia);
/**
* Watches for changes in media, invalidating layout as necessary. | fix(gridlist): Prevents media from being unwatched immediately | angular_material | train | js |
acc63835f48dee07fdc571971c820cb01e038f95 | diff --git a/src/CouchDB/Util/BatchUpdater.php b/src/CouchDB/Util/BatchUpdater.php
index <HASH>..<HASH> 100644
--- a/src/CouchDB/Util/BatchUpdater.php
+++ b/src/CouchDB/Util/BatchUpdater.php
@@ -29,8 +29,8 @@ class BatchUpdater
/**
* Constructor.
*
- * @param \CouchDB\Http\ClientInterface $client
- * @param \CouchDB\Database $db
+ * @param ClientInterface $client
+ * @param Database $db
*/
public function __construct(ClientInterface $client, Database $db)
{
@@ -72,7 +72,7 @@ class BatchUpdater
/**
* Execute the queue.
*
- * @return mixed
+ * @return array
*/
public function execute()
{ | Fix docblock in BatchUpdater | Baachi_CouchDB | train | php |
8c5fb89d808d3792c187bbe9b5fad36e46306636 | diff --git a/tests/__init__.py b/tests/__init__.py
index <HASH>..<HASH> 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -69,3 +69,7 @@ for path in glob.glob(os.path.join(os.path.dirname(__file__), '*test*.py')):
if module not in sys.modules:
print >> sys.stderr, "Potential missing import of " + module
+
+import logging
+# this is needed to avoid "no handlers" warning during test run
+logging.getLogger('amqplib').addHandler(logging.NullHandler()) | avoiding 'no handlers for amqplib' warning during tests run
Former-commit-id: <I>c2dfe<I>d<I>ca<I>c4d<I>ed<I>db<I>c | gem_oq-engine | train | py |
95d9ea8ffd4ee0788e2f77883eba8726194983ef | diff --git a/karma.conf.js b/karma.conf.js
index <HASH>..<HASH> 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -4,7 +4,7 @@ process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function (config) {
config.set({
- frameworks: ['jasmine'],
+ frameworks: ['jasmine','webpack'],
reporters: [
'spec',
'junit',
@@ -29,7 +29,7 @@ module.exports = function (config) {
module: {
rules: webpackConfig.module.rules,
},
- devtool: 'inline-source-map',
+ devtool: 'eval-cheap-source-map',
externals: {
angular: 'angular',
},
diff --git a/webpack.config.js b/webpack.config.js
index <HASH>..<HASH> 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,6 +1,7 @@
const path = require('path');
const webpackConfig = {
+ mode: 'development',
entry: {
index: path.resolve(__dirname, 'src/index.js'),
},
@@ -18,7 +19,7 @@ const webpackConfig = {
}
]
},
- devtool: 'sourcemap',
+ devtool: 'eval-cheap-source-map',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js', | Updated karma and webpack configs for latest version changes | NYULibraries_primo-explore-nyu-eshelf | train | js,js |
107268eae28bf2879026b0b1b103fc7047e891c7 | diff --git a/moment.js b/moment.js
index <HASH>..<HASH> 100644
--- a/moment.js
+++ b/moment.js
@@ -599,6 +599,10 @@
return this;
},
+ unixValueOf : function () {
+ return parseInt(this.valueOf() / 1000, 10);
+ },
+
local : function () {
this._isUTC = false;
return this; | Add a unixValueOf that returns the unix timestamp in seconds. | moment_moment | train | js |
30e22dbdbb8fedff6df510ab2e5722aedaa18192 | diff --git a/addok/bin/__init__.py b/addok/bin/__init__.py
index <HASH>..<HASH> 100644
--- a/addok/bin/__init__.py
+++ b/addok/bin/__init__.py
@@ -47,8 +47,8 @@ def main():
from addok.index_utils import create_edge_ngrams
# Hook for plugins to register themselves.
- if hasattr(config, 'on_load'):
- config.on_load()
+ if hasattr(config, 'ON_LOAD'):
+ config.ON_LOAD()
if args['serve']:
from werkzeug.serving import run_simple | Only uppercase attributes are kept from local config | addok_addok | train | py |
313e0f06d58e6064e5723912a1c48dbd35f06a30 | diff --git a/library/CM/Model/User.php b/library/CM/Model/User.php
index <HASH>..<HASH> 100644
--- a/library/CM/Model/User.php
+++ b/library/CM/Model/User.php
@@ -80,7 +80,6 @@ class CM_Model_User extends CM_Model_Abstract {
CM_Db_Db::delete('cm_user_online', array('userId' => $this->getId()));
$this->_set(array('online' => null, 'visible' => null));
}
- $this->updateLatestActivityThrottled();
}
/**
diff --git a/tests/library/CM/Model/UserTest.php b/tests/library/CM/Model/UserTest.php
index <HASH>..<HASH> 100644
--- a/tests/library/CM/Model/UserTest.php
+++ b/tests/library/CM/Model/UserTest.php
@@ -137,9 +137,6 @@ class CM_Model_UserTest extends CMTest_TestCase {
$user2 = CM_Model_User::createStatic();
$user2->setOnline();
- $this->assertSameTime($stampOffline, $user1->getLatestActivity());
- $this->assertSameTime($stampOnline, $user2->getLatestActivity());
-
CM_Model_User::offlineOld();
CMTest_TH::reinstantiateModel($user1);
CMTest_TH::reinstantiateModel($user2); | Don't set the activityStamp when online state is changed | cargomedia_cm | train | php,php |
3e29046f1fd3f61f1633fa27c4a7228bf49cc797 | diff --git a/lib/actv/version.rb b/lib/actv/version.rb
index <HASH>..<HASH> 100644
--- a/lib/actv/version.rb
+++ b/lib/actv/version.rb
@@ -1,3 +1,3 @@
module ACTV
- VERSION = "2.10.6"
+ VERSION = "2.10.7"
end | acom-<I> bump up the version after merging with master | activenetwork_actv | train | rb |
4a10d3cbc67535ec32a4058f2216d5aa7c596459 | diff --git a/ocrd/ocrd/task_sequence.py b/ocrd/ocrd/task_sequence.py
index <HASH>..<HASH> 100644
--- a/ocrd/ocrd/task_sequence.py
+++ b/ocrd/ocrd/task_sequence.py
@@ -156,4 +156,4 @@ def run_tasks(mets, log_level, page_id, task_strs, overwrite=False):
# check output file groups are in mets
for output_file_grp in task.output_file_grps:
if not output_file_grp in workspace.mets.file_groups:
- raise Exception("Invalid state: expected output file group not in mets: %s\nSTDOUT:\n%s\nSTDERR:\n%s" % (output_file_grp, out, err))
+ raise Exception("Invalid state: expected output file group '%s' not in METS (despite processor success)" % output_file_grp) | task_sequence: remove invalid refs to out/err
Since run_cli does not (capture and) return stdout and stderr anymore, these references are impossible and unnecessary. | OCR-D_core | train | py |
9c6b18eb279e67a356b59d8bf9b352205bf12a08 | diff --git a/pymc/threadpool.py b/pymc/threadpool.py
index <HASH>..<HASH> 100644
--- a/pymc/threadpool.py
+++ b/pymc/threadpool.py
@@ -163,7 +163,9 @@ class WorkerThread(threading.Thread):
request.exception = True
if request.exc_callback:
request.exc_callback(request)
- self._requests_queue.task_done()
+ self._requests_queue.task_done()
+ finally:
+ request.self_destruct()
def dismiss(self):
"""Sets a flag to tell the thread to exit when done with current job."""
@@ -224,6 +226,15 @@ class WorkRequest:
def __str__(self):
return "<WorkRequest id=%s>" % \
(self.str_requestID)
+
+ def self_destruct(self):
+ """
+ Avoids strange memory leak... for some reason the work request itself never
+ gets let go, so if it has big arguments, or if its callable closes on big
+ variables, there's trouble.
+ """
+ for attr in ['exception', 'callback', 'exc_callback', 'callable', 'args', 'kwds']:
+ delattr(self, attr)
class ThreadPool:
"""A thread pool, distributing work requests and collecting results. | Fixed memory leak, but it is kind of brutal
git-svn-id: <URL> | pymc-devs_pymc | train | py |
911ec23cd993d8b578c9b2d8ff8c863e35ceba29 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -29,6 +29,33 @@ else:
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('../'))
sys.path.append(os.path.abspath('sphinxext'))
+
+
+class Mock(object):
+
+ __all__ = []
+
+ def __init__(self, *args, **kwargs):
+ pass
+
+ def __call__(self, *args, **kwargs):
+ return Mock()
+
+ @classmethod
+ def __getattr__(cls, name):
+ if name in ('__file__', '__path__'):
+ return '/dev/null'
+ elif name[0] == name[0].upper():
+ mockType = type(name, (), {})
+ mockType.__module__ = __name__
+ return mockType
+ else:
+ return Mock()
+
+MOCK_MODULES = ['pygtk', 'gtk', 'gobject', 'argparse']
+for mod_name in MOCK_MODULES:
+ sys.modules[mod_name] = Mock()
+
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here. | modified conf.py according to RTD | pgmpy_pgmpy | train | py |
81503e7479c2ab50592d6042ec772517de6cbcd9 | diff --git a/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java b/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
index <HASH>..<HASH> 100755
--- a/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
+++ b/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
@@ -118,7 +118,7 @@ public class ListIndexedIterating extends BytecodeScanningDetector {
stage = Stage.FIND_LOOP_STAGE;
super.visitCode(obj);
- if (sawListSize) {
+ if (sawListSize && !possibleForLoops.isEmpty()) {
stack.resetForMethodEntry(this);
state = State.SAW_NOTHING;
stage = Stage.FIND_BUG_STAGE; | filter out parsing if no loops were found | mebigfatguy_fb-contrib | train | java |
b92526b81812bbd7ba06e04e2908e49ff3baaa94 | diff --git a/pandas/core/apply.py b/pandas/core/apply.py
index <HASH>..<HASH> 100644
--- a/pandas/core/apply.py
+++ b/pandas/core/apply.py
@@ -633,28 +633,28 @@ class FrameApply(Apply):
obj = self.obj
axis = self.axis
- # TODO: Avoid having to change state
- self.obj = self.obj if self.axis == 0 else self.obj.T
- self.axis = 0
-
- result = None
try:
- result = super().agg()
+ if axis == 1:
+ result = FrameRowApply(
+ obj.T,
+ self.orig_f,
+ self.raw,
+ self.result_type,
+ self.args,
+ self.kwargs,
+ ).agg()
+ result = result.T if result is not None else result
+ else:
+ result = super().agg()
except TypeError as err:
exc = TypeError(
"DataFrame constructor called with "
f"incompatible data and dtype: {err}"
)
raise exc from err
- finally:
- self.obj = obj
- self.axis = axis
-
- if axis == 1:
- result = result.T if result is not None else result
if result is None:
- result = self.obj.apply(self.orig_f, axis, args=self.args, **self.kwargs)
+ result = obj.apply(self.orig_f, axis, args=self.args, **self.kwargs)
return result | CLN: Don't modify state in FrameApply.agg (#<I>) | pandas-dev_pandas | train | py |
ac9c10fcb5aa8cd2df7080c844ec145748f32dde | 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
@@ -1,4 +1,3 @@
-puts ENV.inspect
if ENV['COVERAGE'] == '1'
require 'simplecov'
SimpleCov.start do
@@ -7,7 +6,7 @@ if ENV['COVERAGE'] == '1'
end
end
-if ENV['CI'] == 'true'
+if ENV['CI'] == 'true' && ENV['TRAVIS_RUBY_VERSION'] == '2.2.2' && ENV['BUNDLE_GEMFILE'] =~ /activerecord_4\.2/
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
end | Send report to codeclimate only from last AR version | mirrec_slugable | train | rb |
c93e66081ade89807f2f3aeb5ea047dacbfa11d6 | diff --git a/client/lib/signup/actions.js b/client/lib/signup/actions.js
index <HASH>..<HASH> 100644
--- a/client/lib/signup/actions.js
+++ b/client/lib/signup/actions.js
@@ -15,7 +15,6 @@ const SignupActions = {
},
saveSignupStep( step ) {
-
// there are some conditions in which a step could be saved/processed in the same event loop
// so we should defer the action
defer( () => {
@@ -27,6 +26,7 @@ const SignupActions = {
},
submitSignupStep( step, errors, providedDependencies ) {
+ analytics.tracks.recordEvent( 'calypso_signup_actions_submit_step', { ...providedDependencies, step: step.stepName } );
Dispatcher.handleViewAction( {
type: 'SUBMIT_SIGNUP_STEP',
@@ -37,7 +37,6 @@ const SignupActions = {
},
processSignupStep( step, errors, providedDependencies ) {
-
// deferred because a step can be processed as soon as it is submitted
defer( () => {
Dispatcher.handleViewAction( { | Signup: add Tracks event for Signup step submission (#<I>)
Add `calypso_signup_actions_submit_step` event. | Automattic_wp-calypso | train | js |
1483d168b3d9365a8b25ab771f8d2fa9baa6af5f | diff --git a/lib/tty/prompt/question.rb b/lib/tty/prompt/question.rb
index <HASH>..<HASH> 100644
--- a/lib/tty/prompt/question.rb
+++ b/lib/tty/prompt/question.rb
@@ -12,14 +12,9 @@ module TTY
class Question
include ResponseDelegation
- PREFIX = ' + '
- MULTIPLE_PREFIX = ' * '
- ERROR_PREFIX = ' ERROR:'
-
- # Store statement.
- #
- # @api private
- attr_accessor :statement
+ # Store question message
+ # @api public
+ attr_reader :message
# Store default value.
#
@@ -76,7 +71,7 @@ module TTY
#
# @api public
def call(message, &block)
- self.statement = message
+ @message = message
block.call(self) if block
prompt.output.print("#{prompt.prefix}#{message}")
render
@@ -283,11 +278,11 @@ module TTY
end
def to_s
- "#{statement}"
+ "#{message}"
end
def inspect
- "#<Question @message=#{statement}"
+ "#<Question @message=#{message}"
end
private
@@ -317,7 +312,8 @@ module TTY
# @api private
def within?(value)
if in? && value
- @in.include?(value) || fail(InvalidArgument, "Value #{value} is not included in the range #{@in}")
+ @in.include?(value) || fail(InvalidArgument,
+ "Value #{value} is not included in the range #{@in}")
end
end
end # Question | Remove dead code and rename to message. | piotrmurach_tty-prompt | train | rb |
610228bbf5b260b3af752d889c82c47f09426bb2 | diff --git a/dev/lint.js b/dev/lint.js
index <HASH>..<HASH> 100644
--- a/dev/lint.js
+++ b/dev/lint.js
@@ -13,7 +13,16 @@ function lint() {
return new Promise((resolve, reject) => {
- globby(['**/**.js', '!node_modules/**', '!bower_components/**', '!dist/**', '!build/**', '!_book/**', '!reports/**']).then( paths => {
+ globby([
+ '**/**.js',
+ '!node_modules/**',
+ '!bower_components/**',
+ '!reports/**',
+ '!_book/**',
+ '!build/**',
+ '!dist/**',
+ '!less/**'
+ ]).then( paths => {
const report = engine.executeOnFiles(paths.slice(2));
const formatter = engine.getFormatter(); | add more ignore paths to linter | Availity_availity-angular | train | js |
0be54aa3ae93d653c416929d813c611719f7e8c2 | diff --git a/src/java/com/samskivert/jdbc/depot/SQLBuilder.java b/src/java/com/samskivert/jdbc/depot/SQLBuilder.java
index <HASH>..<HASH> 100644
--- a/src/java/com/samskivert/jdbc/depot/SQLBuilder.java
+++ b/src/java/com/samskivert/jdbc/depot/SQLBuilder.java
@@ -164,6 +164,14 @@ public abstract class SQLBuilder
// append the default value if one was specified
if (defval.length() > 0) {
builder.append(" DEFAULT ").append(defval);
+
+ } else if (field.getType().equals(Integer.TYPE) || // TODO: how to do this properly?
+ field.getType().equals(Integer.class) ||
+ field.getType().equals(Byte.TYPE) ||
+ field.getType().equals(Byte.class) ||
+ field.getType().equals(Short.TYPE) ||
+ field.getType().equals(Short.class)) {
+ builder.append(" DEFAULT 0");
}
} | Hack in a default value for integer types so that Postgres doesn't freak out
when we add a new non-null integer column. Maybe we should just specify default
values for all our integer columns, but decades of programming history point
toward zero as a pretty sensible default.
git-svn-id: <URL> | samskivert_samskivert | train | java |
1022ce0ff87034e69f38d7d3d75f46d2108104e5 | diff --git a/leveldb/session_util.go b/leveldb/session_util.go
index <HASH>..<HASH> 100644
--- a/leveldb/session_util.go
+++ b/leveldb/session_util.go
@@ -62,11 +62,10 @@ func (s *session) setVersion(v *version) {
for {
old := s.stVersion
if atomic.CompareAndSwapPointer(&s.stVersion, old, unsafe.Pointer(v)) {
- if old == nil {
- v.setfin()
- } else {
+ if old != nil {
(*version)(old).next = v
}
+ v.setfin()
break
}
}
diff --git a/leveldb/version.go b/leveldb/version.go
index <HASH>..<HASH> 100644
--- a/leveldb/version.go
+++ b/leveldb/version.go
@@ -74,13 +74,11 @@ func (v *version) purge() {
}
}
}
-
- next.setfin()
}
func (v *version) setfin() {
- runtime.SetFinalizer(v, func(x *version) {
- go x.purge()
+ runtime.SetFinalizer(v, func(v *version) {
+ v.purge()
})
} | leveldb: fix slow version purging
Came out of issue #<I>. | syndtr_goleveldb | train | go,go |
99c3ef0edfa226d49b7de21c2027645994557f4a | diff --git a/drag.js b/drag.js
index <HASH>..<HASH> 100644
--- a/drag.js
+++ b/drag.js
@@ -131,7 +131,7 @@ function Ranger(options) {
});
var idx = $base.findGap([val,val + w]);
- if(!options.minSize || $base.calcGap(idx) > options.minSize) {
+ if(!options.minSize || $base.calcGap(idx) >= options.minSize) {
$base.insertRangeIndex($base.phantom, idx, true);
$base.phantom.val([val,val + w], {trigger: false});
} | do put a phantom in just right a gab | quarterto-archive_Elessar | train | js |
ac8c8181c301efd3fa770f7fe68eb67a984a570b | diff --git a/src/metpy/plots/declarative.py b/src/metpy/plots/declarative.py
index <HASH>..<HASH> 100644
--- a/src/metpy/plots/declarative.py
+++ b/src/metpy/plots/declarative.py
@@ -568,7 +568,7 @@ class PanelContainer(HasTraits):
def show(self):
"""Show the constructed graphic on the screen."""
self.draw()
- self.figure.show()
+ plt.show()
@exporter.export | BUG: Fix declarative show() (Fixes #<I>)
The goal of the original implementation was to avoid triggering
matplotlib backend detection code on import by avoiding importing the
pyplot interface. This seems no longer necessary, and more importantly
it doesn't work just to use figure.show(), so just use plt.show() | Unidata_MetPy | train | py |
6501ad56f4e40fe0f90627c07ae60e545c35c430 | diff --git a/tenant_schemas/postgresql_backend/base.py b/tenant_schemas/postgresql_backend/base.py
index <HASH>..<HASH> 100644
--- a/tenant_schemas/postgresql_backend/base.py
+++ b/tenant_schemas/postgresql_backend/base.py
@@ -4,6 +4,7 @@ from django.conf import settings
from django.utils.importlib import import_module
from django.core.exceptions import ImproperlyConfigured, ValidationError
from tenant_schemas.utils import get_public_schema_name, get_limit_set_calls
+import django.db.utils
ORIGINAL_BACKEND = getattr(settings, 'ORIGINAL_BACKEND', 'django.db.backends.postgresql_psycopg2')
@@ -122,7 +123,7 @@ class DatabaseWrapper(original_backend.DatabaseWrapper):
# we do not have to worry that it's not the good one
try:
cursor.execute('SET search_path = {0}'.format(','.join(search_paths)))
- except DatabaseError:
+ except django.db.utils.DatabaseError:
self.search_path_set = False
else:
self.search_path_set = True | postgresql_backend: catch exception from django.db.utils and not from the backend
really fix #<I> | bernardopires_django-tenant-schemas | train | py |
8e311204a01d7e3d62f6094351cd5b2a278c2987 | diff --git a/shared/globals.native.js b/shared/globals.native.js
index <HASH>..<HASH> 100644
--- a/shared/globals.native.js
+++ b/shared/globals.native.js
@@ -18,6 +18,7 @@ if (typeof __SCREENSHOT__ === 'undefined') {
window.Buffer = require('buffer').Buffer
// Native String.startswith() sometimes incorrectly returns false on Android!
+// See https://github.com/facebook/react-native/issues/11370 for a report.
// $FlowIssue redefining startsWith
String.prototype.startsWith = function(searchString, position) {
position = position || 0
diff --git a/shared/index.native.js b/shared/index.native.js
index <HASH>..<HASH> 100644
--- a/shared/index.native.js
+++ b/shared/index.native.js
@@ -86,14 +86,6 @@ class Keybase extends Component {
}
function load() {
- // Native String.startswith() sometimes incorrectly returns false on Android!
- /* eslint-disable no-extend-native */
- // $FlowIssue redefining startsWith
- String.prototype.startsWith = function(searchString, position) {
- position = position || 0
- return this.substr(position, searchString.length) === searchString
- }
-
AppRegistry.registerComponent('Keybase', () => Keybase)
} | Document Android hack, and deduplicate | keybase_client | train | js,js |
94e8320618ded65a434ff7d3933eb38bea94713d | diff --git a/lib/adhearsion/cli_commands.rb b/lib/adhearsion/cli_commands.rb
index <HASH>..<HASH> 100644
--- a/lib/adhearsion/cli_commands.rb
+++ b/lib/adhearsion/cli_commands.rb
@@ -19,6 +19,7 @@ USAGE
Dir.chdir args[1] do
args = args.compact.map(&:to_s)
args[1], args[2] = args[2], '.'
+ args[3] = "--pid-file=#{args[3]}" if args.size > 3
ScriptAhnLoader.exec_script_ahn! args
end
end | BUG: fixed ahn pid option failing | adhearsion_adhearsion | train | rb |
82726e2708f7dd88abdd7c484c5cb7bb86cf7ede | diff --git a/tensor2tensor/data_generators/text_encoder.py b/tensor2tensor/data_generators/text_encoder.py
index <HASH>..<HASH> 100644
--- a/tensor2tensor/data_generators/text_encoder.py
+++ b/tensor2tensor/data_generators/text_encoder.py
@@ -1057,6 +1057,6 @@ class RealEncoder(object):
def strip_ids(ids, ids_to_strip):
"""Strip ids_to_strip from the end ids."""
ids = list(ids)
- while ids[-1] in ids_to_strip:
+ while ids and ids[-1] in ids_to_strip:
ids.pop()
return ids | Fix case where `ids` is empty.
PiperOrigin-RevId: <I> | tensorflow_tensor2tensor | train | py |
61b1447304cad6e2a8d314fba703fa86c7783b41 | diff --git a/lxd/storage/backend_mock.go b/lxd/storage/backend_mock.go
index <HASH>..<HASH> 100644
--- a/lxd/storage/backend_mock.go
+++ b/lxd/storage/backend_mock.go
@@ -44,6 +44,10 @@ func (b *mockBackend) LocalStatus() string {
return api.NetworkStatusUnknown
}
+func (b *mockBackend) ToAPI() api.StoragePool {
+ return api.StoragePool{}
+}
+
func (b *mockBackend) Driver() drivers.Driver {
return b.driver
} | lxd/storage/backend/mock: Implements ToAPI | lxc_lxd | train | go |
3663c73a6d3cf7d503c654a8e468064196b4b39b | diff --git a/pkg/policy/l4.go b/pkg/policy/l4.go
index <HASH>..<HASH> 100644
--- a/pkg/policy/l4.go
+++ b/pkg/policy/l4.go
@@ -27,6 +27,7 @@ import (
"github.com/cilium/cilium/pkg/policy/api"
"github.com/cilium/cilium/pkg/policy/trafficdirection"
"github.com/cilium/cilium/pkg/u8proto"
+ "github.com/sirupsen/logrus"
)
// L7DataMap contains a map of L7 rules per endpoint where key is a CachedSelector
@@ -185,8 +186,12 @@ func (l4 *L4Filter) ToKeys(direction trafficdirection.TrafficDirection) []Key {
// IdentitySelectionUpdated implements CachedSelectionUser interface
func (l4 *L4Filter) IdentitySelectionUpdated(selector CachedSelector, selections, added, deleted []identity.NumericIdentity) {
- log.Infof("L4Filter::IdentitySelectionUpdated(selector: %v, selections: %v, added: %v, deleted: %v) call received",
- selector, selections, added, deleted)
+ log.WithFields(logrus.Fields{
+ "selector": selector,
+ "selections": selections,
+ "added": added,
+ "deleted": deleted,
+ }).Debug("identities selected by L4Filter updated")
}
func (l4 *L4Filter) cacheIdentitySelector(sel api.EndpointSelector, selectorCache *SelectorCache) CachedSelector { | policy: fix log message in `IdentitySelectionUpdated`
This log message should be at debug, not info level, since it occurs whenever
policy regeneration occurs for an endpoint. Also use `logrus.Fields` for
formatting variables to be in line with convention for Cilium. | cilium_cilium | train | go |
b26f27056786bb33e8677366f42ede15089863a8 | diff --git a/tests/FixtureApp/TestKernel.php b/tests/FixtureApp/TestKernel.php
index <HASH>..<HASH> 100644
--- a/tests/FixtureApp/TestKernel.php
+++ b/tests/FixtureApp/TestKernel.php
@@ -30,6 +30,14 @@ class TestKernel extends Kernel
});
}
+ public function getProjectDir()
+ {
+ // Fake implementation so that the old root_dir/Resources/translations and the new project_dir/translations both
+ // map to the same folder in our fixture app to avoid getting a deprecation warning when running tests with 4.2+
+ // but keeping compat with running tests on 3.4.
+ return __DIR__.'/Resources';
+ }
+
public function getCacheDir()
{
return sys_get_temp_dir().'/incenteev_translation_checker'; | Update the fixture app to avoid a deprecation warning. | Incenteev_translation-checker-bundle | train | php |
baf271b824f16cffde57b78b0170a605d3867f13 | diff --git a/src/com/google/javascript/jscomp/Scope.java b/src/com/google/javascript/jscomp/Scope.java
index <HASH>..<HASH> 100644
--- a/src/com/google/javascript/jscomp/Scope.java
+++ b/src/com/google/javascript/jscomp/Scope.java
@@ -19,7 +19,6 @@ package com.google.javascript.jscomp;
import com.google.common.base.Preconditions;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.StaticScope;
-
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -48,8 +47,7 @@ public class Scope implements StaticScope {
Preconditions.checkNotNull(parent);
Preconditions.checkNotNull(rootNode);
Preconditions.checkArgument(
- rootNode != parent.rootNode,
- "Root node: %s\nParent's root node: %s", rootNode, parent.rootNode);
+ rootNode != parent.rootNode, "rootNode should not be the parent's root node", rootNode);
this.parent = parent;
this.rootNode = rootNode; | Don't print out the same node twice when precondition fails.
-------------
Created by MOE: <URL> | google_closure-compiler | train | java |
4198083b5d03eb08f9df0e3cc59cd8d4fa2c4256 | diff --git a/src/bioio.py b/src/bioio.py
index <HASH>..<HASH> 100644
--- a/src/bioio.py
+++ b/src/bioio.py
@@ -70,6 +70,7 @@ def addLoggingFileHandler(fileName, rotatingLogging=False):
logger.addHandler(handler)
def setLogLevel(logLevel):
+ logLevel = logLevel.upper()
assert logLevel in [ "CRITICAL", "INFO", "DEBUG" ] #Log level must be one of these strings.
global logLevelString
logLevelString = logLevel | allowed --logLevel to accept any case input. | DataBiosphere_toil | train | py |
af77ffe58e4227314f81a50124f6d9a832c8b778 | diff --git a/android/src/main/java/com/imagepicker/ImagePickerModule.java b/android/src/main/java/com/imagepicker/ImagePickerModule.java
index <HASH>..<HASH> 100644
--- a/android/src/main/java/com/imagepicker/ImagePickerModule.java
+++ b/android/src/main/java/com/imagepicker/ImagePickerModule.java
@@ -84,12 +84,14 @@ public class ImagePickerModule extends ReactContextBaseJavaModule {
String cancelButtonTitle = "Cancel";
if (options.hasKey("takePhotoButtonTitle")
- && !options.getString("takePhotoButtonTitle").isEmpty()) {
+ && options.getString("takePhotoButtonTitle") != null
+ && !options.getString("takePhotoButtonTitle").isEmpty()) {
mTitles.add(options.getString("takePhotoButtonTitle"));
mActions.add("photo");
}
if (options.hasKey("chooseFromLibraryButtonTitle")
- && !options.getString("chooseFromLibraryButtonTitle").isEmpty()) {
+ && options.getString("chooseFromLibraryButtonTitle") != null
+ && !options.getString("chooseFromLibraryButtonTitle").isEmpty()) {
mTitles.add(options.getString("chooseFromLibraryButtonTitle"));
mActions.add("library");
} | Added null checks
Checking nulls for options: takePhotoButtonTitle and
chooseFromLibraryButtonTitle | react-native-community_react-native-image-picker | train | java |
7b36dd7a82d66f333ff63ba0a431416189d100ea | diff --git a/test/shared/tests/dummy_app.rb b/test/shared/tests/dummy_app.rb
index <HASH>..<HASH> 100644
--- a/test/shared/tests/dummy_app.rb
+++ b/test/shared/tests/dummy_app.rb
@@ -118,9 +118,19 @@ private
def delete(string)
Dir[expand_path(string)].each do |file|
- puts "Deleting #{file.inspect}"
+ puts "Deleting #{file.inspect}"
File.delete file
end
+
+ dirname = expand_path File.dirname(string)
+
+ return unless File.exists?(dirname)
+ Dir.glob("#{dirname}/*", File::FNM_DOTMATCH) do |file|
+ return unless %w(. ..).include? File::basename(file)
+ end
+
+ puts "Deleting #{dirname.inspect}"
+ Dir.delete dirname
end
def replace(file, replacement) | Deleting directories when they are empty within DummyApp.delete | archan937_rich_cms | train | rb |
ca29aa5c863c04366c9bcd330577562cd13fe277 | diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
index <HASH>..<HASH> 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
@@ -252,7 +252,7 @@ public abstract class Dispatcher extends PermanentlyFencedRpcEndpoint<Dispatcher
try {
jobManagerSharedServices.shutdown();
} catch (Exception e) {
- exception = ExceptionUtils.firstOrSuppressed(e, exception);
+ exception = e;
}
jobManagerMetricGroup.close(); | [hotfix] Remove exception suppression from Dispatcher#stopDispatcherServices | apache_flink | train | java |
54e13751822b1cf6bc4677c07d85224d84d8ef5a | diff --git a/lib/ronin/arch.rb b/lib/ronin/arch.rb
index <HASH>..<HASH> 100644
--- a/lib/ronin/arch.rb
+++ b/lib/ronin/arch.rb
@@ -136,5 +136,15 @@ module Ronin
# The ARM (big-endian) Architecture
predefine :arm_be, :endian => :big, :address_length => 4
+ #
+ # @see mips_be
+ #
+ def self.mips; mips_be; end
+
+ #
+ # @see arm_be
+ #
+ def self.arm; arm_be; end
+
end
end | Added the arm,mips class methods to Arch which call arm_be,mips_be.
* Big-Endian is the default setting for ARM and MIPS. Although they can
have their endianness toggled. | ronin-ruby_ronin | train | rb |
769dd93aa0b87d905ef78e70c59f983a23e24961 | diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go
index <HASH>..<HASH> 100644
--- a/pkg/minikube/cluster/cluster.go
+++ b/pkg/minikube/cluster/cluster.go
@@ -538,7 +538,7 @@ func createHost(api libmachine.API, cfg config.MachineConfig) (*host.Host, error
}
if err := createRequiredDirectories(h); err != nil {
- errors.Wrap(err, "required directories")
+ return h, errors.Wrap(err, "required directories")
}
if driver.BareMetal(cfg.VMDriver) { | Oops, make sure we return the error code | kubernetes_minikube | train | go |
6450647d64b423528431d112b3ca57b7488ce4a8 | diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/FilePath.java
+++ b/core/src/main/java/hudson/FilePath.java
@@ -241,10 +241,11 @@ public final class FilePath implements Serializable {
* Is the given path name an absolute path?
*/
private static boolean isAbsolute(String rel) {
- return rel.startsWith("/") || DRIVE_PATTERN.matcher(rel).matches();
+ return rel.startsWith("/") || DRIVE_PATTERN.matcher(rel).matches() || UNC_PATTERN.matcher(rel).matches();
}
private static final Pattern DRIVE_PATTERN = Pattern.compile("[A-Za-z]:[\\\\/].*"),
+ UNC_PATTERN = Pattern.compile("^\\\\\\\\.*"),
ABSOLUTE_PREFIX_PATTERN = Pattern.compile("^(\\\\\\\\|(?:[A-Za-z]:)?[\\\\/])[\\\\/]*");
/** | [FIXED JENKINS-<I>] recognize UNC path as absolute | jenkinsci_jenkins | train | java |
3716fb1ca9c78883e82e4829ca16c7dd14ba1441 | diff --git a/python/ray/util/sgd/tests/test_torch.py b/python/ray/util/sgd/tests/test_torch.py
index <HASH>..<HASH> 100644
--- a/python/ray/util/sgd/tests/test_torch.py
+++ b/python/ray/util/sgd/tests/test_torch.py
@@ -111,6 +111,8 @@ def test_apply_all_workers(ray_start_2_cpus, num_workers, use_local):
results = trainer.apply_all_workers(fn)
assert all(x == 1 for x in results)
+ trainer.shutdown()
+
@pytest.mark.parametrize("num_workers", [1, 2] if dist.is_available() else [1])
@pytest.mark.parametrize("use_local", [True, False]) | [Ray SGD] Fix hotfix test (#<I>) | ray-project_ray | train | py |
bb8cc40d5df81b6ba382e5aff163bac5a1eaad59 | diff --git a/www/src/py_complex.js b/www/src/py_complex.js
index <HASH>..<HASH> 100644
--- a/www/src/py_complex.js
+++ b/www/src/py_complex.js
@@ -172,6 +172,10 @@ complex.__new__ = function(cls){
return res
}
}
+
+ // If first argument is not a string, the second argument defaults to 0
+ $imag = $imag === missing ? 0 : $imag
+
if(arguments.length == 1 && $real.__class__ === complex && $imag == 0){
return $real
}
@@ -201,7 +205,7 @@ complex.__new__ = function(cls){
throw _b_.TypeError.$factory("complex() second arg can't be a string")
}
if(! isinstance($imag, _b_.float) && ! isinstance($imag, _b_.int) &&
- ! isinstance($imag, _b_.complex) && $imag !== undefined){
+ ! isinstance($imag, _b_.complex) && $imag !== missing){
throw _b_.TypeError.$factory("complex() argument must be a string " +
"or a number")
} | Fix bug when complex is called with a single non-string argument | brython-dev_brython | train | js |
431bafa5597019de3a7013081423bde51e7be756 | diff --git a/core-bundle/src/EventListener/PrettyErrorScreenListener.php b/core-bundle/src/EventListener/PrettyErrorScreenListener.php
index <HASH>..<HASH> 100644
--- a/core-bundle/src/EventListener/PrettyErrorScreenListener.php
+++ b/core-bundle/src/EventListener/PrettyErrorScreenListener.php
@@ -378,7 +378,19 @@ class PrettyErrorScreenListener
*/
private function isBackendUser()
{
- return $this->tokenStorage->getToken()->getUser() instanceof BackendUser;
+ $token = $this->tokenStorage->getToken();
+
+ if (null === $token) {
+ return false;
+ }
+
+ $user = $token->getUser();
+
+ if (null === $user) {
+ return false;
+ }
+
+ return $user instanceof BackendUser;
}
/** | [Core] Handle the case that either the token or the user object is null. | contao_contao | train | php |
b62d796a29933732e47e299f546ac821e3665562 | diff --git a/backtrader/indicator.py b/backtrader/indicator.py
index <HASH>..<HASH> 100644
--- a/backtrader/indicator.py
+++ b/backtrader/indicator.py
@@ -23,13 +23,12 @@ from __future__ import absolute_import, division, print_function, unicode_litera
from six.moves import xrange
-from .lineiterator import LineIterator
+from .lineiterator import LineIterator, IndicatorBase
-class Indicator(LineIterator):
+class Indicator(IndicatorBase):
_ltype = LineIterator.IndType
-
def preonce(self, start, end):
# generic implementation
for i in xrange(start, end): | indicator - Indicator uses intermediate Base Class | backtrader_backtrader | train | py |
c4268df91678af227f2439be1098ebcfda0be871 | diff --git a/lib/events.js b/lib/events.js
index <HASH>..<HASH> 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -146,8 +146,8 @@ define([], function () {
if (['auto', undefined].indexOf(self.style[dim]) !== -1
&& ['auto', undefined].indexOf(self.appliedInlineStyles[dim]) !== -1) {
self.parentNodeStyle[dim] = dims[dim] + 'px';
- } else {
- self.parentNodeStyle[dim] = self.style[dim];
+ } else if (['auto', undefined].indexOf(self.style[dim]) == -1
+ && ['auto', undefined].indexOf(self.appliedInlineStyles[dim]) == -1) { self.parentNodeStyle[dim] = self.style[dim];
if (self.isComponet) {
self.canvas.style[dim] = self.style[dim];
} | Manually set `grid.style.height` reset to 'auto' when applyComponentStyle() is called | TonyGermaneri_canvas-datagrid | train | js |
66fdda140b4be9043d86154f3c3205fa37c86ded | diff --git a/tests/PaymentModelTest.php b/tests/PaymentModelTest.php
index <HASH>..<HASH> 100644
--- a/tests/PaymentModelTest.php
+++ b/tests/PaymentModelTest.php
@@ -4,6 +4,16 @@ use SilverStripe\Omnipay\GatewayInfo;
class PaymentModelTest extends PaymentTest
{
+ public function setUp()
+ {
+ parent::setUp();
+ Config::inst()->update('GatewayInfo', 'Manual', array(
+ 'can_capture' => true,
+ 'can_refund' => true,
+ 'can_void' => true
+ ));
+ }
+
public function testParameterSetup()
{
$payment = Payment::create() | Improve payment-model test by using sensible default config. | silverstripe_silverstripe-omnipay | train | php |
787a52c1b52e5a295e84b4181a91086ab2cf79de | diff --git a/staging/src/github.com/openshift/oc/pkg/cli/admin/release/info.go b/staging/src/github.com/openshift/oc/pkg/cli/admin/release/info.go
index <HASH>..<HASH> 100644
--- a/staging/src/github.com/openshift/oc/pkg/cli/admin/release/info.go
+++ b/staging/src/github.com/openshift/oc/pkg/cli/admin/release/info.go
@@ -1212,7 +1212,7 @@ func describeChangelog(out, errOut io.Writer, diff *ReleaseDiff, dir string) err
}
if len(commits) > 0 {
if u.Host == "github.com" {
- fmt.Fprintf(out, "### [%s](https://github.com%s)\n\n", strings.Join(change.ImagesAffected, ", "), u.Path)
+ fmt.Fprintf(out, "### [%s](https://github.com%s/tree/%s)\n\n", strings.Join(change.ImagesAffected, ", "), u.Path, change.To)
} else {
fmt.Fprintf(out, "### %s\n\n", strings.Join(change.ImagesAffected, ", "))
} | Link the component image in a changelog to the GitHub source view
This allows someone to click directly to the version of code available,
instead of having to go to the changelog. | openshift_origin | train | go |
d8a9c62b30dae6a83a3efe147f5cbc6e97861160 | diff --git a/Tests/Command/InfoDoctrineCommandTest.php b/Tests/Command/InfoDoctrineCommandTest.php
index <HASH>..<HASH> 100644
--- a/Tests/Command/InfoDoctrineCommandTest.php
+++ b/Tests/Command/InfoDoctrineCommandTest.php
@@ -17,7 +17,7 @@ class InfoDoctrineCommandTest extends TestCase
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
$output->expects($this->at(0))
->method('write')
- ->with($this->equalTo("Found 1 entities mapped in entity manager 'default':"), $this->equalTo(true));
+ ->with($this->equalTo("Found <info>1</info> entities mapped in entity manager <info>default</info>:\n"), $this->equalTo(true));
$output->expects($this->at(1))
->method('write')
->with($this->equalTo("<info>[OK]</info> Fixtures\Bundles\YamlBundle\Entity\Test"), $this->equalTo(true)); | [DoctrineBundle] fixed a unit test | doctrine_DoctrineBundle | train | php |
86145a8c76c714f8d690f53e709b2024cf6526b5 | diff --git a/src/ocrmypdf/pdfinfo/info.py b/src/ocrmypdf/pdfinfo/info.py
index <HASH>..<HASH> 100644
--- a/src/ocrmypdf/pdfinfo/info.py
+++ b/src/ocrmypdf/pdfinfo/info.py
@@ -613,12 +613,13 @@ def _pdf_get_pageinfo(pdf, pageno: int, infile: PathLike, xmltext: str):
return pageinfo
-worker_pdf = None
+# worker_pdf = None
def _pdf_pageinfo_sync(args):
pageno, infile, xmltext, detailed_analysis = args
- page = PageInfo(worker_pdf, pageno, infile, xmltext, detailed_analysis)
+ with pikepdf.open(infile) as worker_pdf:
+ page = PageInfo(worker_pdf, pageno, infile, xmltext, detailed_analysis)
return page
@@ -634,8 +635,8 @@ def _pdf_pageinfo_concurrent(pdf, infile, pages_xml, detailed_analysis, progbar)
(n, infile, pages_xml[n] if pages_xml else None, detailed_analysis)
for n in range(len(pdf.pages))
)
- global worker_pdf
- worker_pdf = pdf
+ # global worker_pdf
+ # worker_pdf = pdf
if os.name == 'nt':
# We can't parallelize on Windows, because Windows cannot fork. | Some wrong with forking worker_pdf, just open it once per page for now | jbarlow83_OCRmyPDF | train | py |
96814e499c0c130359e3ddfe6e9ca4fe17facfe5 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -51,9 +51,10 @@ if target in ['linux', 'cygwin']:
sysconfig._config_vars['CFLAGS'] = cvars['CFLAGS'].replace('-Wimplicit-function-declaration', '')
libraries = {
+ # 'windows': ['gdi32', 'opengl32', 'user32'],
'windows': ['gdi32', 'opengl32', 'user32'],
- 'linux': ['GL', 'dl', 'X11'],
- 'cygwin': ['GL', 'X11'],
+ 'linux': [],
+ 'cygwin': [],
'darwin': [],
'android': [],
} | setup.py: Remove unecessary linker args. Moved to glcontext | moderngl_moderngl | train | py |
c5b1551e1d503f6ae84ced37ae49fcd83ac4d0d6 | diff --git a/test/helper.rb b/test/helper.rb
index <HASH>..<HASH> 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -24,6 +24,7 @@ require 'logger'
require 'pp'
CDB = ConceptQL::Database.new(DB)
+DB.extension :error_sql
class Minitest::Spec
def query(statement)
@@ -35,6 +36,13 @@ class Minitest::Spec
statement.query
end
+ def count(statement)
+ dataset(statement).count
+ rescue
+ puts $!.sql if $!.respond_to?(:sql)
+ raise
+ end
+
def criteria_ids(statement)
hash_groups(statement, :criterion_domain, :criterion_id)
end
@@ -49,6 +57,9 @@ class Minitest::Spec
def hash_groups(statement, key, value)
dataset(statement).from_self.distinct.order(*value).to_hash_groups(key, value)
+ rescue
+ puts $!.sql if $!.respond_to?(:sql)
+ raise
end
def log | Have a test spit out the SQL if it fails | outcomesinsights_conceptql | train | rb |
b13fd8a9d3598e1e02faa99f1c012c7f715983cb | diff --git a/src/components/QueryHistory.js b/src/components/QueryHistory.js
index <HASH>..<HASH> 100644
--- a/src/components/QueryHistory.js
+++ b/src/components/QueryHistory.js
@@ -118,7 +118,9 @@ export class QueryHistory extends React.Component {
item.favorite = false;
this.favoriteStore.delete(item);
}
- this.setState({ ...this.historyStore.items, ...this.favoriteStore.items });
+ this.setState({
+ queries: [...this.historyStore.items, ...this.favoriteStore.items],
+ });
};
editLabel = (query, variables, operationName, label, favorite) => {
@@ -133,6 +135,8 @@ export class QueryHistory extends React.Component {
} else {
this.historyStore.edit(item);
}
- this.setState({ ...this.historyStore.items, ...this.favoriteStore.items });
+ this.setState({
+ queries: [...this.historyStore.items, ...this.favoriteStore.items],
+ });
};
} | Fix updating UI after favoriting | graphql_graphiql | train | js |
0bcb856bba72a0a5970346d8d112a0fb038ca2e3 | diff --git a/Klein/DataCollection/DataCollection.php b/Klein/DataCollection/DataCollection.php
index <HASH>..<HASH> 100644
--- a/Klein/DataCollection/DataCollection.php
+++ b/Klein/DataCollection/DataCollection.php
@@ -194,11 +194,11 @@ class DataCollection implements IteratorAggregate, ArrayAccess, Countable
* @param string $key The name of the parameter to set
* @param mixed $value The value of the parameter to set
* @access public
- * @return DataCollection
+ * @return void
*/
public function __set($key, $value)
{
- return $this->set($key, $value);
+ $this->set($key, $value);
}
/** | __set shouldn't return anything | klein_klein.php | train | php |
908f147cb3f67e180d3b91b9198fcb7d278dc500 | diff --git a/tests/PresenceChannelTest.php b/tests/PresenceChannelTest.php
index <HASH>..<HASH> 100644
--- a/tests/PresenceChannelTest.php
+++ b/tests/PresenceChannelTest.php
@@ -170,7 +170,7 @@ class PresenceChannelTest extends TestCase
$this->channelManager->getGlobalConnectionsCount('1234', 'presence-channel')->then(function ($total) {
$this->assertEquals(0, $total);
});
-}
+ }
public function test_can_whisper_to_private_channel()
{ | Apply fixes from StyleCI (#<I>) | beyondcode_laravel-websockets | train | php |
d376314763722f2523901fe23d9464ef069b892a | diff --git a/watcher/batcher.go b/watcher/batcher.go
index <HASH>..<HASH> 100644
--- a/watcher/batcher.go
+++ b/watcher/batcher.go
@@ -1,8 +1,9 @@
package watcher
import (
- "github.com/howeyc/fsnotify"
"time"
+
+ "gopkg.in/fsnotify.v0"
)
type Batcher struct { | use fsnotify <I>
This contains a few fixes (<I> through <I>) but the same API and few internal changes.
<URL> | gohugoio_hugo | train | go |
dce25d05bd3ae014618f8ce77a7bd1a80b500f7a | diff --git a/lib/oink/middleware.rb b/lib/oink/middleware.rb
index <HASH>..<HASH> 100644
--- a/lib/oink/middleware.rb
+++ b/lib/oink/middleware.rb
@@ -20,7 +20,6 @@ module Oink
log_memory
log_activerecord
log_completed
- reset_objects_instantiated
[status, headers, body]
end
@@ -48,13 +47,14 @@ module Oink
sorted_list = Oink::HashUtils.to_sorted_array(ActiveRecord::Base.instantiated_hash)
sorted_list.unshift("Total: #{ActiveRecord::Base.total_objects_instantiated}")
@logger.info("Instantiation Breakdown: #{sorted_list.join(' | ')}")
+ reset_objects_instantiated
end
end
private
def reset_objects_instantiated
- ActiveRecord::Base.reset_instance_type_count if @instruments.include?(:activerecord)
+ ActiveRecord::Base.reset_instance_type_count
end
end | refactor instance type count resetting | noahd1_oink | train | rb |
5c8361a92ecfa47f947de716c2825a40f1cd021f | diff --git a/python/ray/ml/config.py b/python/ray/ml/config.py
index <HASH>..<HASH> 100644
--- a/python/ray/ml/config.py
+++ b/python/ray/ml/config.py
@@ -169,4 +169,4 @@ class RunConfig:
stop: Optional[Union[Mapping, "Stopper", Callable[[str, Mapping], bool]]] = None
failure: Optional[FailureConfig] = None
sync_config: Optional[SyncConfig] = None
- verbose: Union[int, Verbosity] = Verbosity.V2_TRIAL_NORM
+ verbose: Union[int, Verbosity] = Verbosity.V3_TRIAL_DETAILS | [air] Update to use more verbose default config for trainers. (#<I>)
Internal user feedback showing that more detailed logging is preferred:
<URL> | ray-project_ray | train | py |
333f91ffca435e8925ed02361b5865d26ba4c4b7 | diff --git a/src/Filter/AssociationToManyFilter.php b/src/Filter/AssociationToManyFilter.php
index <HASH>..<HASH> 100644
--- a/src/Filter/AssociationToManyFilter.php
+++ b/src/Filter/AssociationToManyFilter.php
@@ -34,7 +34,7 @@ class AssociationToManyFilter extends AbstractAssociationFilter implements Filte
foreach ($values as $key => $value) {
$relatedObject = $this->makeObject($accessor, $object, $field, $value);
- if ($mappedField) {
+ if ($mappedField && $relatedObject) {
$inverse = $accessor->get($relatedObject, $mappedField);
if ($inverse instanceof Collection) { | Make sure we have a related object | imarc_tenet | train | php |
360d0168195616b7ba35b5dd84135cd061e7072f | diff --git a/src/Surfnet/StepupMiddlewareClientBundle/Identity/Service/IdentityService.php b/src/Surfnet/StepupMiddlewareClientBundle/Identity/Service/IdentityService.php
index <HASH>..<HASH> 100644
--- a/src/Surfnet/StepupMiddlewareClientBundle/Identity/Service/IdentityService.php
+++ b/src/Surfnet/StepupMiddlewareClientBundle/Identity/Service/IdentityService.php
@@ -94,6 +94,11 @@ class IdentityService
{
$data = $this->service->getRegistrationAuthorityCredentials($identity->id);
+ // 404 Not Found is a valid case.
+ if (!$data) {
+ return null;
+ }
+
$credentials = RegistrationAuthorityCredentials::fromData($data);
$message = sprintf('Registration Authority Credentials for Identity[%s] are invalid', $identity->id); | Handle <I> when requesting RA credentials | OpenConext_Stepup-Middleware-clientbundle | train | php |
0513fd6ce2b308b27317dc8e9af05cbce9936905 | diff --git a/docs/gridsome.server.js b/docs/gridsome.server.js
index <HASH>..<HASH> 100644
--- a/docs/gridsome.server.js
+++ b/docs/gridsome.server.js
@@ -83,7 +83,7 @@ module.exports = function (api) {
.map(name => name.replace('../packages/', ''))
.forEach(name => {
config.resolve.alias
- .set(`@tiptap/${name}`, path.resolve(`../packages/${name}`))
+ .set(`@tiptap/${name}`, path.resolve(`../packages/${name}/index.ts`))
})
})
} | fix error when starting docs with prebuilt packages | scrumpy_tiptap | train | js |
0938a874ad6242ce6959fd90ef46013a9d1f25fc | diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
index <HASH>..<HASH> 100644
--- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
+++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
@@ -324,17 +324,20 @@ public class SpringApplication {
return context;
}
catch (Exception ex) {
- for (SpringApplicationRunListener runListener : runListeners) {
- finishWithException(runListener, context, ex);
+ try {
+ for (SpringApplicationRunListener runListener : runListeners) {
+ finishWithException(runListener, context, ex);
+ }
+ this.log.error("Application startup failed", ex);
}
- if (context != null) {
- context.close();
+ finally {
+ if (context != null) {
+ context.close();
+ }
}
ReflectionUtils.rethrowRuntimeException(ex);
return context;
}
- finally {
- }
}
private Collection<SpringApplicationRunListener> getRunListeners(String[] args) { | Ensure startup error is logged (and rethrown)
Fixes gh-<I> | spring-projects_spring-boot | train | java |
64420b5699fd469b9da9f2c30999e771588a1716 | diff --git a/lib/DAV/util.js b/lib/DAV/util.js
index <HASH>..<HASH> 100644
--- a/lib/DAV/util.js
+++ b/lib/DAV/util.js
@@ -649,6 +649,7 @@ exports.mime = {
".conf" : "text/plain",
".cpp" : "text/x-c",
".crt" : "application/x-x509-ca-cert",
+ ".cs" : "text/x-csharp",
".css" : "text/css",
".csv" : "text/csv",
".cxx" : "text/x-c",
@@ -767,6 +768,7 @@ exports.mime = {
".texi" : "application/x-texinfo",
".texinfo" : "application/x-texinfo",
".text" : "text/plain",
+ ".textile" : "text/x-web-textile",
".tif" : "image/tiff",
".tiff" : "image/tiff",
".torrent" : "application/x-bittorrent", | add csharp and textile mime types | mikedeboer_jsDAV | train | js |
fc5d6fa676c38da9c9fa11e9ef5fbfec211e24e5 | diff --git a/src/Distribution/src/Internal/DateTimeIntervalFactory.php b/src/Distribution/src/Internal/DateTimeIntervalFactory.php
index <HASH>..<HASH> 100644
--- a/src/Distribution/src/Internal/DateTimeIntervalFactory.php
+++ b/src/Distribution/src/Internal/DateTimeIntervalFactory.php
@@ -71,7 +71,7 @@ final class DateTimeIntervalFactory implements DateTimeIntervalFactoryInterface
return $duration;
case $duration instanceof \DateTimeInterface:
- return $duration->diff($this->factory->now());
+ return $this->factory->now()->diff($duration);
case \is_string($duration):
return new \DateInterval($duration); | - bugfix: invalid duration direction (thank you PHP) | spiral_framework | train | php |
ca2fd93eaf95000fcc5a71723884b97fecfd5b56 | diff --git a/glue/pipeline.py b/glue/pipeline.py
index <HASH>..<HASH> 100644
--- a/glue/pipeline.py
+++ b/glue/pipeline.py
@@ -836,9 +836,10 @@ class CondorDAGNode:
@param opt: option name.
@param value: value of the option for this node in the DAG.
"""
- macro = self.__bad_macro_chars.sub( r'', opt )
- self.__opts['macro' + macro] = value
- self.__job.add_var_opt(opt)
+ if value:
+ macro = self.__bad_macro_chars.sub( r'', opt )
+ self.__opts['macro' + macro] = value
+ self.__job.add_var_opt(opt)
def add_file_opt(self,opt,filename,file_is_output_file=False):
"""
@@ -851,9 +852,10 @@ class CondorDAGNode:
@param file_is_output_file: A boolean if the file will be an output file
instead of an input file. The default is to have it be an input.
"""
- self.add_var_opt(opt,filename)
- if file_is_output_file: self.add_output_file(filename)
- else: self.add_input_file(filename)
+ if filename:
+ self.add_var_opt(opt,filename)
+ if file_is_output_file: self.add_output_file(filename)
+ else: self.add_input_file(filename)
def add_var_arg(self, arg):
""" | don't add var_opts in nodes if the value is None or the empty string | gwastro_pycbc-glue | train | py |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.