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
|
---|---|---|---|---|---|
23886f5dfb88826e03ac8efb6f57fc0d2f964eeb | diff --git a/aioxmpp/disco/service.py b/aioxmpp/disco/service.py
index <HASH>..<HASH> 100644
--- a/aioxmpp/disco/service.py
+++ b/aioxmpp/disco/service.py
@@ -383,7 +383,7 @@ class DiscoServer(service.Service, Node):
Upon construction, the :class:`DiscoServer` adds a default identity with
category ``"client"`` and type ``"bot"`` to the root
- :class:`.disco.Node`. This is to comply with :xep:`30`, which specifies
+ :class:`~.disco.Node`. This is to comply with :xep:`30`, which specifies
that at least one identity must always be returned. Otherwise, the
service would be forced to send a malformed response or reply with
``<feature-not-implemented/>``.
@@ -473,7 +473,7 @@ class DiscoServer(service.Service, Node):
.. seealso::
:meth:`mount_node`
- for a way for mounting :class:`Node` instances.
+ for a way for mounting :class:`~.disco.Node` instances.
"""
del self._node_mounts[mountpoint] | disco: fix references in docs | horazont_aioxmpp | train | py |
26dc882190bf4d774a747fdc7f6df6768f683710 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -5,7 +5,7 @@ var pattern = function (file, included) {
};
var framework = function (files) {
- files.unshift(pattern(path.dirname(require.resolve('mocha')), 'mocha.js'), false);
+ files.unshift(pattern(path.join(path.dirname(require.resolve('mocha')), 'mocha.js')), false);
files.unshift(pattern(path.join(__dirname, 'framework.js'), false));
files.unshift(pattern(path.join(__dirname, 'runner.js'), true));
}; | Fixed mocha pathing for real this time | jimsimon_karma-web-components | train | js |
2f2019a42d8bf3c9101999f204079fdaf7411b0d | diff --git a/code/DMSSiteTreeExtension.php b/code/DMSSiteTreeExtension.php
index <HASH>..<HASH> 100644
--- a/code/DMSSiteTreeExtension.php
+++ b/code/DMSSiteTreeExtension.php
@@ -42,7 +42,7 @@ class DMSSiteTreeExtension extends DataExtension {
sprintf(
'<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-pjax-target="Content" data-icon="add" href="%s">%s</a>',
Controller::join_links(singleton('DMSDocumentAddController')->Link(), '?ID=' . $this->owner->ID),
- "Add Document"
+ "Add Documents"
)
); | MINOR: changing button label to indicate that multiple documents can be added at once | silverstripe_silverstripe-dms | train | php |
159f8f1d4cd8622d5ed2afe25d293c50e0e866df | diff --git a/cms/views/cms_views.py b/cms/views/cms_views.py
index <HASH>..<HASH> 100644
--- a/cms/views/cms_views.py
+++ b/cms/views/cms_views.py
@@ -226,8 +226,9 @@ class CmsViews(BaseCmsView):
def locale_change(self):
return {
'languages': self.get_featured_languages +
- list(set(self.get_available_languages) -
- set(self.get_featured_languages))
+ sorted(list(set(self.get_available_languages) -
+ set(self.get_featured_languages)),
+ key=lambda tup: tup[1].lower())
}
@view_config(route_name='locale') | ensure list of change page is sorted | universalcore_unicore-cms | train | py |
0d9bd10f0314c414ffe40b54d1814573b89f5daf | diff --git a/src/parsy/__init__.py b/src/parsy/__init__.py
index <HASH>..<HASH> 100644
--- a/src/parsy/__init__.py
+++ b/src/parsy/__init__.py
@@ -138,6 +138,14 @@ class Parser(object):
def desc(self, description):
return self | fail(description)
+ def mark(self):
+ @generate
+ def marked():
+ start = yield index
+ body = yield self
+ end = yield index
+ return (start, body, end)
+
def __or__(self, other):
if not isinstance(other, Parser):
raise TypeError('{!r} is not a parser!'.format(other))
@@ -191,6 +199,10 @@ def generate(fn):
return generated.desc(fn.__name__)
+@Parser
+def index(stream, index):
+ return (True, index, index)
+
def success(val):
return Parser(lambda _, index: (True, index, val)) | add mark and index to get index info | python-parsy_parsy | train | py |
394bb40ef754b501296929d3072ab3e35f16ba4a | diff --git a/src/Traits/LoadsTranslatedCachedRoutes.php b/src/Traits/LoadsTranslatedCachedRoutes.php
index <HASH>..<HASH> 100644
--- a/src/Traits/LoadsTranslatedCachedRoutes.php
+++ b/src/Traits/LoadsTranslatedCachedRoutes.php
@@ -59,7 +59,7 @@ trait LoadsTranslatedCachedRoutes
$path = $this->getDefaultCachedRoutePath();
$localeSegment = request()->segment(1);
- if (!$localeSegment || ! in_array($localeSegment, $localeKeys)) {
+ if ( ! $localeSegment || ! in_array($localeSegment, $localeKeys)) {
return $path;
} | Update LoadsTranslatedCachedRoutes.php
Minor style adjustment | czim_laravel-localization-route-cache | train | php |
4bf1d65877e51d278fce779ee792b3d0cf66fee7 | diff --git a/plugin_test.go b/plugin_test.go
index <HASH>..<HASH> 100644
--- a/plugin_test.go
+++ b/plugin_test.go
@@ -73,11 +73,12 @@ func ExamplePlugins_Add() {
Plugins.Add(myplugin)
desc := Plugins.GetDescription(myplugin)
fmt.Println(desc)
- go Listen(":8080")
- if ok := <-Available; ok {
- Close()
- }
+ // travis have problems if I do that using
+ // Listen(":8080") and Close()
+ Plugins.DoPreListen(Default)
+ Plugins.DoPostListen(Default)
+ Plugins.DoPreClose(Default)
// Output:
// GetName Struct | Iris has been updated to <I> . Fix travis plugin_test...
Read HISTORY.md | kataras_iris | train | go |
bf808fb3958b0f6d9e032cea3fc33da54078c9d7 | diff --git a/lib/cobweb.rb b/lib/cobweb.rb
index <HASH>..<HASH> 100644
--- a/lib/cobweb.rb
+++ b/lib/cobweb.rb
@@ -100,7 +100,7 @@ class CobWeb
if content[:mime_type].include?("text/html") or content[:mime_type].include?("application/xhtml+xml")
content[:body] = response.body
else
- content[:body] = Base64.encode64(content[:body])
+ content[:body] = Base64.encode64(response.body)
end
content[:location] = response["location"]
content[:headers] = response.to_hash.symbolize_keys
diff --git a/lib/crawl_job.rb b/lib/crawl_job.rb
index <HASH>..<HASH> 100644
--- a/lib/crawl_job.rb
+++ b/lib/crawl_job.rb
@@ -26,7 +26,7 @@ class CrawlJob
if queue_counter <= content_request[:crawl_limit].to_i
content[:links].keys.map{|key| content[:links][key]}.flatten.each do |link|
unless redis.sismember "crawled", link
- if link.match(Regexp.new("^#{redis.get("base_url")}"))
+ if link.to_s.match(Regexp.new("^#{redis.get("base_url")}"))
new_request = content_request.clone
new_request[:url] = link
new_request[:parent] = content_request[:url] | fixed bug in getting images and when link is a uri rather than string | stewartmckee_cobweb | train | rb,rb |
ad8d2f2218f16ebd5619661226fe6a7b2e6c7502 | diff --git a/src/git.js b/src/git.js
index <HASH>..<HASH> 100644
--- a/src/git.js
+++ b/src/git.js
@@ -69,6 +69,7 @@ git.log = async function( from, to = 'HEAD' ) {
return Bluebird.resolve( `git log ${ from }..${ to } --oneline` )
.then( execute )
.then( text => text.split( '\n' ) )
+ .then( lines => lines.reverse() )
.map( line => {
let [ all, id, message ] = line.match( /^([a-z0-9]+)(.*)$/ );
return { id: id, message: message.trim() }; | Git log is now printed from oldest to most recent | Zelgadis87_npm-versionator | train | js |
e68cf30b3e77fc66eee7f5e33af638b976ffaba2 | diff --git a/zmq4.go b/zmq4.go
index <HASH>..<HASH> 100644
--- a/zmq4.go
+++ b/zmq4.go
@@ -645,6 +645,10 @@ Register a monitoring callback.
See: http://api.zeromq.org/4-0:zmq-socket-monitor#toc2
+WARNING: Closing a context with a monitoring callback will lead to random crashes.
+This is a bug in the ZeroMQ library.
+The monitoring callback has the same context as the socket it was created for.
+
Example:
package main | Added warning that closing a context on a monitor van lead to crashes | pebbe_zmq4 | train | go |
b7324154d19ae9d458810abb96b8f440ef5d24af | diff --git a/scratch/dev-dataset.rb b/scratch/dev-dataset.rb
index <HASH>..<HASH> 100644
--- a/scratch/dev-dataset.rb
+++ b/scratch/dev-dataset.rb
@@ -53,25 +53,38 @@ def test_datastep
datastep work.mydata do |d1|
+ myvar = []
d1.define_variables do
var :rownum, :type => :number
var :retailer_key, :type => :string
var :physical_cases, :type => :number
+
+ for i in 1..100
+ myvar << "myvar_#{i}".to_sym
+ var myvar[i-1], :type => :string
+ end
end
-
- for i in 1..50000
+ for i in 1..1
d1[:rownum] = i
- d1[:retailer_key] = rand_string()
- d1[:physical_cases] = rand(100)
+ d1[:retailer_key] = "AKDFKJDdKDJFKJOIFWIEFWEOFIHOQIHFOQIHFOIEHFOIEHFOIEFHOIEHFOsihfoihEOIFhsofishISEHFOSIHFOISHFOZIHFIOZEHFOEHFIOZEHFEOZIHIFHZOFINIEOVNIEN"
+ d1[:physical_cases] = 385.18356
+
+ for i in 1..100
+ d1[myvar[i-1]] = "0123456789" * 1
+ end
d1.output()
end
+ for i in 1..100000
+ d1.output()
+ end
+
end
end | Dataset write speed not so bad. It was just the random string! | inside-track_remi | train | rb |
f1949a2f26555c782c28eb4cc33e257746468998 | diff --git a/uliweb/orm/__init__.py b/uliweb/orm/__init__.py
index <HASH>..<HASH> 100644
--- a/uliweb/orm/__init__.py
+++ b/uliweb/orm/__init__.py
@@ -4491,14 +4491,7 @@ class Bulk(object):
x = sql.compile(dialect=self.engine.dialect)
fields = []
for i in x.positiontup:
- n, tail = i.rsplit('_', 1)
- if tail.isdigit():
- if n in fields:
- fields.append(i)
- else:
- fields.append(n)
- else:
- fields.append(i)
+ fields.append(i)
self.sqles[name] = {'fields':fields, 'raw_sql':unicode(x), 'data':[]}
except:
if self.transcation: | Fix bulk positionparam process, don't remove '_n' | limodou_uliweb | train | py |
ee21f5ca9b3910d2ade563d98f8e6c2c8c345a2d | diff --git a/publ/entry.py b/publ/entry.py
index <HASH>..<HASH> 100644
--- a/publ/entry.py
+++ b/publ/entry.py
@@ -397,7 +397,7 @@ class Entry(caching.Memoizable):
category = kwargs.get('category', self._record.category)
return {
'category': category,
- 'recurse': kwargs.get('recurse', category != self._record.category)
+ 'recurse': kwargs.get('recurse', 'category' in kwargs)
}
def get(self, name, default=None): | Correctly set the recursion default for previous/next | PlaidWeb_Publ | train | py |
b8fc550c8ff5baf88b5d0feb9758979db542d94a | diff --git a/addon/system/data-transfer.js b/addon/system/data-transfer.js
index <HASH>..<HASH> 100644
--- a/addon/system/data-transfer.js
+++ b/addon/system/data-transfer.js
@@ -11,20 +11,26 @@ export default Ember.Object.extend({
valid: computed('dataTransfer.files', 'files', {
get() {
+ if (get(this, 'files') == null) {
+ return true;
+ }
+
return get(this, 'dataTransfer.items.length') === get(this, 'files.length');
}
}),
files: computed('queue.multiple', 'queue.accept', 'dataTransfer', {
get() {
- let fileList = get(this, 'dataTransfer.files') || [];
- let itemList = get(this, 'dataTransfer.items') || [];
- if (itemList.length > fileList.length) {
+ let fileList = get(this, 'dataTransfer.files');
+ let itemList = get(this, 'dataTransfer.items');
+
+ if (fileList && itemList &&
+ itemList.length > fileList.length) {
fileList = itemList;
}
if (fileList == null) {
- return [];
+ return null;
}
let files = []; | handle browsers that don't support DataTransfer.items | adopted-ember-addons_ember-file-upload | train | js |
3756746c558779b0220c2874b3dba7ce2b8f40a3 | diff --git a/andes/main.py b/andes/main.py
index <HASH>..<HASH> 100644
--- a/andes/main.py
+++ b/andes/main.py
@@ -476,6 +476,7 @@ def run(case, **kwargs):
routine = 'sssa'
if routine is 'td':
if system.Settings.dime_enable:
+ system.TDS.compute_flows = True
system.Streaming.send_init(recepient='all')
system.Log.info('Waiting for modules to send init info...')
sleep(0.5) | Turn on compute_flows when dime is enabled | cuihantao_andes | train | py |
7bf965a6f4fc764b60ff4bbc9c866a670c8c6a44 | diff --git a/is_core/main.py b/is_core/main.py
index <HASH>..<HASH> 100644
--- a/is_core/main.py
+++ b/is_core/main.py
@@ -34,19 +34,19 @@ class ISCoreBase(type):
name, _, attrs = args
abstract = attrs.pop('abstract', False)
-
super_new = super(ISCoreBase, cls).__new__
new_class = super_new(cls, *args, **kwargs)
model_module = sys.modules[new_class.__module__]
app_label = model_module.__name__.split('.')[-2]
- if name != 'NewBase' and not abstract:
+ if name != 'NewBase' and not abstract and new_class.register:
register_core(app_label, new_class)
return new_class
class ISCore(six.with_metaclass(ISCoreBase)):
abstract = True
+ register = True
menu_url_name = None
verbose_name = None
diff --git a/is_core/version.py b/is_core/version.py
index <HASH>..<HASH> 100644
--- a/is_core/version.py
+++ b/is_core/version.py
@@ -1,4 +1,4 @@
-VERSION = (1, 3, 26)
+VERSION = (1, 3, 27)
def get_version():
return '.'.join(map(str, VERSION)) | <I> Add registration attribute to main cores | matllubos_django-is-core | train | py,py |
2771603952d16fa586b4c2dc28db8b74737733dd | diff --git a/fs.go b/fs.go
index <HASH>..<HASH> 100644
--- a/fs.go
+++ b/fs.go
@@ -564,7 +564,7 @@ func (h *fsHandler) createDirIndex(base *URI, filePath string) (*fsFile, error)
className = "file"
}
fmt.Fprintf(w, `<li><a href="%s" class="%s">%s</a>, %s, last modified %s</li>`,
- pathEscaped, className, html.EscapeString(name), auxStr, fi.ModTime())
+ pathEscaped, className, html.EscapeString(name), auxStr, fsModTime(fi.ModTime()))
}
fmt.Fprintf(w, "</ul></body></html>")
@@ -671,5 +671,9 @@ func fsLastModified(path string) (time.Time, error) {
if err != nil {
return zeroTime, err
}
- return fileInfo.ModTime().In(gmtLocation).Truncate(time.Second), nil
+ return fsModTime(fileInfo.ModTime()), nil
+}
+
+func fsModTime(t time.Time) time.Time {
+ return t.In(gmtLocation).Truncate(time.Second)
} | FS: show file modification time in GMT tz and truncate it to seconds | valyala_fasthttp | train | go |
68f36af184c3703d3942d29b67f2244a4db9b529 | diff --git a/netort/data_manager/clients/luna.py b/netort/data_manager/clients/luna.py
index <HASH>..<HASH> 100644
--- a/netort/data_manager/clients/luna.py
+++ b/netort/data_manager/clients/luna.py
@@ -157,6 +157,10 @@ class LunaClient(AbstractClient):
),
)
req.data = meta
+ if 'sys_uts_offset' in meta.keys() and metric_obj.type == 'metrics':
+ req.data['_offset'] = meta['sys_uts_offset']
+ elif 'log_uts_offset' in meta.keys() and metric_obj.type == 'events':
+ req.data['_offset'] = meta['log_uts_offset']
prepared_req = req.prepare()
logger.debug('Prepared update_metric request:\n%s', pretty_print(prepared_req))
response = send_chunk(self.session, prepared_req) | setting metric offsets in luna; | load-tools_netort | train | py |
48765fa24160b1a5a71bc50b3bd152528c836f49 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -45,7 +45,7 @@ copyright = u'2010-2013, Aaron Gallagher'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
-version = release = vcversioner.find_version(version_file=None).version
+version = release = vcversioner.find_version(root='..').version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ setup(
],
license='ISC',
- setup_requires=['vcversioner'],
+ setup_requires=['vcversioner>=1'],
vcversioner={
'version_module_paths': ['txsocksx/_version.py'],
}, | Update vcversioner usage. | habnabit_txsocksx | train | py,py |
4f1e68ea41116bc84e3eb379bd292249f20cf99e | diff --git a/core/ViewDataTable/Factory.php b/core/ViewDataTable/Factory.php
index <HASH>..<HASH> 100644
--- a/core/ViewDataTable/Factory.php
+++ b/core/ViewDataTable/Factory.php
@@ -125,6 +125,8 @@ class Factory
$type = $defaultType ? : HtmlTable::ID;
}
+ $params['viewDataTable'] = $type;
+
$visualizations = Manager::getAvailableViewDataTables();
if (array_key_exists($type, $visualizations)) {
diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
index <HASH>..<HASH> 100644
--- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php
+++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
@@ -81,7 +81,7 @@ class RowEvolution
* @param null|string $graphType
* @throws Exception
*/
- public function __construct($idSite, $date, $graphType = null)
+ public function __construct($idSite, $date, $graphType = 'graphEvolution')
{
$this->apiMethod = Common::getRequestVar('apiMethod', '', 'string');
if (empty($this->apiMethod)) throw new Exception("Parameter apiMethod not set."); | Make sure RowEvolution uses graphEvolution default and make sure this default is saved correctly in client side parameter instead of being overwritten by saved viewDataTable. | matomo-org_matomo | train | php,php |
ba0acb4bf62bf213cfcb2651341fc73ae3e39226 | diff --git a/lib/hawkins/cli.rb b/lib/hawkins/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/hawkins/cli.rb
+++ b/lib/hawkins/cli.rb
@@ -25,6 +25,9 @@ module Hawkins
begin
date = Date.parse(options[:date])
rescue
+ # If an exception is not descended from the Thor::Error class, Thor
+ # prints the stacktrace. We don't want a stacktrace in this instance,
+ # so we lie and use one of Thor's error classes in the call to fail().
fail(Thor::InvocationError, "ERROR: Could not parse '#{options[:date]}' as a date")
end
slug = title.to_url | Add useful comment on Thor's fail method. | awood_hawkins | train | rb |
1fa4aa15e696fd053703e01d6b00250c109e28f4 | diff --git a/client/objects/GitHubRepo.php b/client/objects/GitHubRepo.php
index <HASH>..<HASH> 100644
--- a/client/objects/GitHubRepo.php
+++ b/client/objects/GitHubRepo.php
@@ -30,6 +30,7 @@ class GitHubRepo extends GitHubSimpleRepo
'pushed_at' => 'string',
'created_at' => 'string',
'updated_at' => 'string',
+ 'parent' => 'GitHubFullRepo',
));
}
@@ -124,6 +125,11 @@ class GitHubRepo extends GitHubSimpleRepo
protected $updated_at;
/**
+ * @var GitHubFullRepo
+ */
+ protected $parent;
+
+ /**
* @return string
*/
public function getCloneUrl()
@@ -267,5 +273,13 @@ class GitHubRepo extends GitHubSimpleRepo
return $this->updated_at;
}
+ /**
+ * @return GitHubFullRepo
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
} | Added parent attribute for forked repositories | tan-tan-kanarek_github-php-client | train | php |
6dec5cb7aea69dc4aa0e7586f2c16732aefab6b0 | diff --git a/php/WP_CLI/SynopsisValidator.php b/php/WP_CLI/SynopsisValidator.php
index <HASH>..<HASH> 100644
--- a/php/WP_CLI/SynopsisValidator.php
+++ b/php/WP_CLI/SynopsisValidator.php
@@ -23,7 +23,6 @@ class SynopsisValidator {
$positional = $this->query_spec( array(
'type' => 'positional',
'optional' => false,
- 'repeating' => false
) );
return count( $args ) >= count( $positional ); | don't ignore repeating arguments in enough_positionals() check | wp-cli_export-command | train | php |
af5b516cc566fa8e2d05bf98b6504cb8130e03e2 | diff --git a/core/Mail.php b/core/Mail.php
index <HASH>..<HASH> 100644
--- a/core/Mail.php
+++ b/core/Mail.php
@@ -110,7 +110,8 @@ class Mail extends Zend_Mail
$smtpConfig['ssl'] = $mailConfig['encryption'];
}
- $tr = new \Zend_Mail_Transport_Smtp($mailConfig['host'], $smtpConfig);
+ $host = trim($mailConfig['host']);
+ $tr = new \Zend_Mail_Transport_Smtp($host, $smtpConfig);
Mail::setDefaultTransport($tr);
@ini_set("smtp_port", $mailConfig['port']);
} | Trim the hostname before sending email, fixes #<I> | matomo-org_matomo | train | php |
949cfe50604e0d289b92bc823dc56eb61f170617 | diff --git a/lib/instrumental.js b/lib/instrumental.js
index <HASH>..<HASH> 100644
--- a/lib/instrumental.js
+++ b/lib/instrumental.js
@@ -63,7 +63,7 @@ function build_payload(metrics, time_stamp) {
// By this point in time we should have an array of commands to send to the
// instrumental server. We'll convert that array into a string blob in the
// appropriate protocol.
- return(payload.join("\n") + "\n");
+ return payload;
}
// Push data to instrumental
@@ -122,12 +122,11 @@ function instrumental_send(payload) {
error = false;
if(debug) {
- util.log("Sending:\n" + payload);
+ util.puts("Sending:", payload.join("\n"));
}
- client.write(payload, function() {
+ client.end(payload.join("\n") + "\n", function() {
state = "sent";
- client.end();
});
// Authorization failure
@@ -143,7 +142,7 @@ function instrumental_flush(time_stamp, metrics) {
var payload = build_payload(metrics, time_stamp);
// Right now payload is at a minimum "\n"
- if(payload.length > 1) {
+ if(payload.length > 0) {
instrumental_send(payload);
}
} | Pass around an array of commands instead a compiled string.
Will probably refactor this into an object that has metadata for
retries. Also changed the write to an end to remove an extra call. | Instrumental_statsd-instrumental-backend | train | js |
ccb4a07978fd28cde008079d8a247f36e8b51cb5 | diff --git a/src/main/java/net/sf/rubycollect4j/RubyEnumerable.java b/src/main/java/net/sf/rubycollect4j/RubyEnumerable.java
index <HASH>..<HASH> 100644
--- a/src/main/java/net/sf/rubycollect4j/RubyEnumerable.java
+++ b/src/main/java/net/sf/rubycollect4j/RubyEnumerable.java
@@ -110,7 +110,7 @@ public class RubyEnumerable<E> implements Iterable<E> {
* @throws IllegalArgumentException
* when Iterable is null
*/
- void setIterable(Iterable<E> iter) {
+ protected void setIterable(Iterable<E> iter) {
if (iter == null)
throw new IllegalArgumentException("Iterable can't be null.");
@@ -122,7 +122,7 @@ public class RubyEnumerable<E> implements Iterable<E> {
*
* @return an Iterable of this RubyEnumerable
*/
- Iterable<E> getIterable() {
+ protected Iterable<E> getIterable() {
return iter;
} | Change setIterable & getIterable of RubyEnumerable from default to
protected | wnameless_rubycollect4j | train | java |
3a98c2f7050d5e5deb1a4ce297fe74d07236eb56 | diff --git a/greg/greg.py b/greg/greg.py
index <HASH>..<HASH> 100755
--- a/greg/greg.py
+++ b/greg/greg.py
@@ -59,7 +59,10 @@ class Session():
self.config = configparser.ConfigParser()
self.config.read([config_filename_global, self.config_filename_user])
- def list_feeds(self): # Outputs a list of all feed names
+ def list_feeds(self):
+ """
+ Output a list of all feed names
+ """
feeds = configparser.ConfigParser()
feeds.read(self.data_filename)
return feeds.sections()
@@ -72,9 +75,12 @@ class Session():
pass
return os.path.expanduser('~/.config/greg/greg.conf')
- def retrieve_data_directory(self): # Retrieves the data directory
- # (looks first into config_filename_global
- # then into config_filename_user. The latest takes preeminence)
+ def retrieve_data_directory(self):
+ """
+ Retrieve the data directory
+ (looks first into config_filename_global
+ then into config_filename_user. The latter takes preeminence)
+ """
args = self.args
try:
if args['datadirectory']: | Turning some comments into docstrings | manolomartinez_greg | train | py |
59498ae23f5cd0f6481ec38ed88ba41a737e94f9 | diff --git a/Model/Menu/ImportProcessor/Node/Validator.php b/Model/Menu/ImportProcessor/Node/Validator.php
index <HASH>..<HASH> 100644
--- a/Model/Menu/ImportProcessor/Node/Validator.php
+++ b/Model/Menu/ImportProcessor/Node/Validator.php
@@ -3,8 +3,8 @@
namespace Snowdog\Menu\Model\Menu\ImportProcessor\Node;
use Magento\Framework\Exception\ValidatorException;
-use Snowdog\Menu\Model\Menu\ExportProcessor;
use Snowdog\Menu\Api\Data\NodeInterface;
+use Snowdog\Menu\Model\Menu\ExportProcessor;
use Snowdog\Menu\Model\NodeTypeProvider;
class Validator | [<I>] Reorder some imported classes in node import processor validator | SnowdogApps_magento2-menu | train | php |
3f29ddc12c74002669cf02eee725d8f830df5c39 | diff --git a/src/core/class-papi-core-box.php b/src/core/class-papi-core-box.php
index <HASH>..<HASH> 100644
--- a/src/core/class-papi-core-box.php
+++ b/src/core/class-papi-core-box.php
@@ -137,7 +137,7 @@ class Papi_Core_Box {
}
if ( empty( $this->id ) ) {
- $this->id = strtolower( papi_f( papi_underscorify( papify( $this->title ) ) ) );
+ $this->id = papi_slugify( strtolower( papi_f( papi_underscorify( papify( $this->title ) ) ) ) );
$this->id = sanitize_text_field( $this->id );
}
} | Remove åäö from box id | wp-papi_papi | train | php |
adbbe11835862ac17837f2ddb74e1672b2749b11 | diff --git a/Tests/TestCase.php b/Tests/TestCase.php
index <HASH>..<HASH> 100644
--- a/Tests/TestCase.php
+++ b/Tests/TestCase.php
@@ -40,7 +40,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
protected function skipIfICUVersionIsTooOld()
{
if ($this->isLowerThanIcuVersion('4.0')) {
- $this->markTestSkipped('Please upgrade ICU version to 4+');
+ $this->markTestSkipped('Please upgrade ICU version to 4.0+');
}
} | [Form][Locale] updated minimum ICU version to <I> | symfony_locale | train | php |
06ba47b23e246121f7b22a5db55785fe04546dfe | diff --git a/photon/apitypes.go b/photon/apitypes.go
index <HASH>..<HASH> 100644
--- a/photon/apitypes.go
+++ b/photon/apitypes.go
@@ -654,7 +654,7 @@ type ServiceCreateSpec struct {
MasterVmFlavor string `json:"masterVmFlavor,omitempty"`
WorkerVmFlavor string `json:"workerVmFlavor,omitempty"`
DiskFlavor string `json:"diskFlavor,omitempty"`
- NetworkID string `json:"vmNetworkId,omitempty"`
+ SubnetId string `json:"subnetId,omitempty"`
ImageID string `json:"imageId,omitempty"`
WorkerCount int `json:"workerCount"`
BatchSizeWorker int `json:"workerBatchExpansionSize,omitempty"` | Update ServiceCreateSpec to use SubnetId
The service manager recently deprecated the use of vmNetworkId, and
instead will use subnetId. This switches the SDK to use subnetId. A
corresponding change will happen in the CLI.
Change-Id: If<I>ce<I>ddd<I>a<I>f<I>ac4 | vmware_photon-controller-go-sdk | train | go |
e6c51051e4bbc1483ecc9e0837bb893197bbca83 | diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index <HASH>..<HASH> 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2045,7 +2045,7 @@ module ActiveRecord #:nodoc:
end
def scoped_methods #:nodoc:
- Thread.current[:"#{self}_scoped_methods"] ||= self.default_scoping
+ Thread.current[:"#{self}_scoped_methods"] ||= self.default_scoping.dup
end
def current_scoped_methods #:nodoc: | Ensure shared default_scoping stack is duped before assigning to thread local | rails_rails | train | rb |
0026358364be9ce3c4ae60e3d961de8e52562e6f | diff --git a/feed_test.go b/feed_test.go
index <HASH>..<HASH> 100644
--- a/feed_test.go
+++ b/feed_test.go
@@ -5,8 +5,7 @@ import (
"time"
)
-var atomOutput = `<?xml version="1.0" encoding="UTF-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
+var atomOutput = `<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom">
<title>jmoiron.net blog</title>
<id>http://jmoiron.net/blog</id>
<updated>2013-01-16T21:52:35-05:00</updated>
@@ -44,8 +43,7 @@ var atomOutput = `<?xml version="1.0" encoding="UTF-8"?>
</entry>
</feed>`
-var rssOutput = `<?xml version="1.0" encoding="UTF-8"?>
-<rss version="2.0">
+var rssOutput = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">
<channel>
<title>jmoiron.net blog</title>
<link>http://jmoiron.net/blog</link> | Fix the tests to work correctly.
It appears that go's xml package changed the text it would output. It is
semantically the same, so just update the expected output. | gorilla_feeds | train | go |
a73ca5475b54c7a598cc3b9b2729a603a8f0040e | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -26,7 +26,7 @@ function create (options) {
redirect,
exclude
} = Object.assign({}, defaults, options)
- const _port = redirectPort === 443 ? '' : (': ' + redirectPort)
+ const _port = redirectPort === 443 ? '' : (':' + redirectPort)
return function redirectSSL (req, res, next) {
if (redirect && !isExcluded(req.url, exclude)) { | fix: remove space from URL when port is not <I> (#<I>) | nuxt-community_redirect-ssl | train | js |
0c80d4ccc5147be9726f7684368fb0db4bb1d1aa | diff --git a/Scripts/typo3cms.php b/Scripts/typo3cms.php
index <HASH>..<HASH> 100644
--- a/Scripts/typo3cms.php
+++ b/Scripts/typo3cms.php
@@ -24,6 +24,10 @@ call_user_func(function () {
if (file_exists($autoLoadFile = dirname(dirname(dirname(__DIR__))) . '/autoload.php')) {
// Console is a dependency, thus located in vendor/helhum/typo3-console
$classLoader = require $autoLoadFile;
+ } elseif (file_exists($autoLoadFile = realpath(($rootPath = dirname(dirname(dirname(dirname(__DIR__))))) . '/typo3') . '/../vendor/autoload.php')) {
+ // Console is extension, but TYPO3_PATH_ROOT was not set, because binary is symlinked, so set it here
+ putenv('TYPO3_PATH_ROOT=' . $rootPath);
+ $classLoader = require $autoLoadFile;
} elseif (file_exists($autoLoadFile = realpath(getenv('TYPO3_PATH_ROOT') . '/typo3') . '/../vendor/autoload.php')) {
// Console is extension, this TYPO3_PATH_ROOT was set in typo3cms script, which is located in TYPO3 root
$classLoader = require $autoLoadFile; | [BUGFIX] Allow symlinked binary in non composer mode (#<I>)
Recent refactoring broke the possibility to link
the binary to any place. Add this case to the script again. | TYPO3-Console_TYPO3-Console | train | php |
008e8754a828ba11d0f77530e7ef1ebda63915b2 | diff --git a/lib/releaf/rspec/matchers.rb b/lib/releaf/rspec/matchers.rb
index <HASH>..<HASH> 100644
--- a/lib/releaf/rspec/matchers.rb
+++ b/lib/releaf/rspec/matchers.rb
@@ -1,12 +1,16 @@
RSpec::Matchers.define :match_html do |expected|
-
match do |actual|
- actual.strip.gsub(/\s+/,' ').gsub('> <', '><') == expected.strip.gsub(/\s+/,' ').gsub('> <', '><')
+ normalize_html(actual) == normalize_html(expected)
+ end
+
+ def normalize_html string
+ string.strip.gsub(/\s+/,' ').gsub('> <', '><')
end
failure_message do |actual|
"expected that #{actual} would match the HTML structure of #{expected}"
end
+
end
\ No newline at end of file | Improve DRYness of match_html matcher | cubesystems_releaf | train | rb |
719a8186819cc7f3ec83a0808d256883f6ecaed8 | diff --git a/js/coinex.js b/js/coinex.js
index <HASH>..<HASH> 100644
--- a/js/coinex.js
+++ b/js/coinex.js
@@ -149,6 +149,7 @@ module.exports = class coinex extends Exchange {
'price': market['buy_asset_type_places'],
};
let numMergeLevels = market['merge'].length;
+ let active = (market['status'] === 'pass');
result.push ({
'id': id,
'symbol': symbol,
@@ -156,7 +157,7 @@ module.exports = class coinex extends Exchange {
'quote': quote,
'baseId': baseId,
'quoteId': quoteId,
- 'active': true,
+ 'active': active,
'taker': this.safeFloat (market, 'taker_fee_rate'),
'maker': this.safeFloat (market, 'maker_fee_rate'),
'info': market, | coinex: fetchMarkets: properly set market['active'] flag | ccxt_ccxt | train | js |
79aceb2528598afb78fe033c6f0d02b089713bc5 | diff --git a/lib/queue_classic/database_helpers.rb b/lib/queue_classic/database_helpers.rb
index <HASH>..<HASH> 100644
--- a/lib/queue_classic/database_helpers.rb
+++ b/lib/queue_classic/database_helpers.rb
@@ -52,7 +52,7 @@ module DatabaseHelpers
end
def jobs_db
- connection.exec("SET client_min_messages TO 'warning'")
+ connection
end
def postgres | testing in a production env is hard | QueueClassic_queue_classic | train | rb |
3eed62e132f67930bb1cf5c9eaa5927083011043 | diff --git a/sos/sosreport.py b/sos/sosreport.py
index <HASH>..<HASH> 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -651,6 +651,7 @@ class SoSReport(object):
self.archive = None
self.tempfile_util = None
self._args = args
+ self.sysroot = "/"
try:
import signal
@@ -681,6 +682,10 @@ class SoSReport(object):
self.tempfile_util = TempFileUtil(self.tmpdir)
self._set_directories()
+ # set alternate system root directory
+ if self.opts.sysroot:
+ self.sysroot = self.opts.sysroot
+
def print_header(self):
self.ui_log.info("\n%s\n" % _("sosreport (version %s)" %
(__version__,)))
@@ -693,6 +698,7 @@ class SoSReport(object):
'tmpdir': self.tmpdir,
'soslog': self.soslog,
'policy': self.policy,
+ 'sysroot': self.sysroot,
'verbosity': self.opts.verbosity,
'xmlreport': self.xml_report,
'cmdlineopts': self.opts, | [plugins] propagate sysroot to Plugin via commons
Although plugins should generally be unaware that they are being
run with an alternate sysroot the generic plugin IO code must
peform the appropriate path prefixing when sysroot is not '/'.
Propagate sysroot to plugin classes via the commons dictionary. | sosreport_sos | train | py |
68e9099419c538983c4468cda142c6f022d8e94a | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -119,7 +119,8 @@ setup(
'thrift',
'ftfy',
'gevent',
- 'kvlayer >= 0.2.8',
+ 'kvlayer >= 0.4.11',
+ 'dossier-stack >= 0.1.1',
'rejester',
'protobuf',
'requests', | Depend on latest dossier-stack.
[dossier-migration] | trec-kba_streamcorpus-pipeline | train | py |
ea6d0791e69f241aebbe5a53b5b94ff8fde5cded | diff --git a/pronto/term.py b/pronto/term.py
index <HASH>..<HASH> 100644
--- a/pronto/term.py
+++ b/pronto/term.py
@@ -348,7 +348,7 @@ class Term(Entity):
@equivalent_to.setter
def equivalent_to(self, terms: Iterable["Term"]):
- self._data().equivalent_to = set(equivalent_to.id for term in terms)
+ self._data().equivalent_to = set(term.id for term in terms)
@property
def intersection_of(self) -> FrozenSet[Union["Term", Tuple[Relationship, "Term"]]]:
@@ -584,7 +584,11 @@ class TermSet(MutableSet[Term]):
self._ids.discard(term.id)
def pop(self) -> Term:
- return self._ontology.get_term(self._ids.pop())
+ id_ = self._ids.pop()
+ term = self._ontology.get_term() # type: ignore
+ if not self._ids:
+ self._ontology = None
+ return term
@typechecked()
def remove(self, term: Term): | Fix bug with `Term.equivalent_to` setter | althonos_pronto | train | py |
9a6c5656568e20045aa911ef68d4abeb6b9ae6ef | diff --git a/blockstack_cli_0.14.1/blockstore_client/client.py b/blockstack_cli_0.14.1/blockstore_client/client.py
index <HASH>..<HASH> 100644
--- a/blockstack_cli_0.14.1/blockstore_client/client.py
+++ b/blockstack_cli_0.14.1/blockstore_client/client.py
@@ -175,6 +175,7 @@ class BlockstoreRPCClient(object):
# trim ','
response = response[:-1]
+ result = None
# parse the response
try:
@@ -182,6 +183,8 @@ class BlockstoreRPCClient(object):
# Netstrings responds with [{}] instead of {}
result = result[0]
+
+ return result
except Exception, e:
# try to clean up
@@ -189,8 +192,6 @@ class BlockstoreRPCClient(object):
self.sock = None
raise Exception("Invalid response: not a JSON string")
- return result
-
def session(conf=None, server_host=BLOCKSTORED_SERVER, server_port=BLOCKSTORED_PORT,
storage_drivers=BLOCKSTORE_DEFAULT_STORAGE_DRIVERS, | Only return a result if it's known-good | blockstack_blockstack-core | train | py |
567d9cf70e64f7c18c1e0f18d5a1fe2eaa5311ab | diff --git a/src/main/java/com/ghgande/j2mod/modbus/net/ModbusTCPListener.java b/src/main/java/com/ghgande/j2mod/modbus/net/ModbusTCPListener.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/ghgande/j2mod/modbus/net/ModbusTCPListener.java
+++ b/src/main/java/com/ghgande/j2mod/modbus/net/ModbusTCPListener.java
@@ -155,7 +155,9 @@ public class ModbusTCPListener extends AbstractModbusListener {
}
logger.debug("Making new connection {}", incoming.toString());
if (listening) {
- threadPool.execute(new TCPConnectionHandler(this, new TCPSlaveConnection(incoming, useRtuOverTcp)));
+ TCPSlaveConnection slave = new TCPSlaveConnection(incoming, useRtuOverTcp);
+ slave.setTimeout(timeout);
+ threadPool.execute(new TCPConnectionHandler(this, slave));
}
else {
incoming.close(); | Propagate ModbusTCPListener timeout to the TCPSlaveConnection (#<I>) | steveohara_j2mod | train | java |
82791aa32ee6421d05467b799ae756c30ca4c59c | diff --git a/lib/Unirest/Unirest.php b/lib/Unirest/Unirest.php
index <HASH>..<HASH> 100644
--- a/lib/Unirest/Unirest.php
+++ b/lib/Unirest/Unirest.php
@@ -133,6 +133,10 @@ class Unirest
// Encode and build query based on RFC 1738
$query = '?'.http_build_query($query_parsed);
}
+
+ // Handle port seperator
+ if ($port && $port[0] != ":")
+ $port = ":" . $port;
// Return the completed URL
$result = $scheme . $host . $port . $path . $query;
@@ -182,4 +186,4 @@ function is_hex($hex) {
if (empty($hex)) { $hex = 0; };
$dec = hexdec($hex);
return ($hex == dechex($dec));
-}
\ No newline at end of file
+} | Support port colon, fixes #8
:) | Kong_unirest-php | train | php |
46088b043045813705d155c795a4b728a91c9df1 | diff --git a/btfxwss/classes.py b/btfxwss/classes.py
index <HASH>..<HASH> 100644
--- a/btfxwss/classes.py
+++ b/btfxwss/classes.py
@@ -605,7 +605,7 @@ class BtfxWss:
if isinstance(data, list) and len(data) == 1:
data = data[0]
self._heartbeats[chan_id] = ts
- if data[0] == 'hb':
+ if data == 'hb':
self._handle_hearbeat(ts, chan_id)
return
try:
@@ -1200,4 +1200,4 @@ class BtfxWssRaw(BtfxWss):
:return:
"""
js = json.dumps((ts, self.channel_labels[chan_id], data))
- self.account.write(js + '\n')
\ No newline at end of file
+ self.account.write(js + '\n') | check for heartbeat in data insted of data[0] because its no longer a list | Crypto-toolbox_btfxwss | train | py |
0ec81dd125fa3de33210854a3be24fb1782b8cb6 | diff --git a/src/main/java/uk/org/okapibarcode/backend/Pdf417.java b/src/main/java/uk/org/okapibarcode/backend/Pdf417.java
index <HASH>..<HASH> 100644
--- a/src/main/java/uk/org/okapibarcode/backend/Pdf417.java
+++ b/src/main/java/uk/org/okapibarcode/backend/Pdf417.java
@@ -1371,7 +1371,7 @@ public class Pdf417 extends Symbol {
throw new OkapiException("Unable to determine MicroPDF417 variant");
}
- void pdfSmooth() {
+ private void pdfSmooth() {
int i, length;
EncodingMode crnt, last, next; | PDF<I>: Make method private | woo-j_OkapiBarcode | train | java |
337155f0eafae03e6190505628195f4db123469b | diff --git a/acl/src/main/java/org/springframework/security/acls/objectidentity/ObjectIdentityImpl.java b/acl/src/main/java/org/springframework/security/acls/objectidentity/ObjectIdentityImpl.java
index <HASH>..<HASH> 100644
--- a/acl/src/main/java/org/springframework/security/acls/objectidentity/ObjectIdentityImpl.java
+++ b/acl/src/main/java/org/springframework/security/acls/objectidentity/ObjectIdentityImpl.java
@@ -17,6 +17,7 @@ package org.springframework.security.acls.objectidentity;
import org.springframework.security.acls.IdentityUnavailableException;
import org.springframework.util.Assert;
+import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import java.io.Serializable;
@@ -75,7 +76,7 @@ public class ObjectIdentityImpl implements ObjectIdentity {
public ObjectIdentityImpl(Object object) throws IdentityUnavailableException {
Assert.notNull(object, "object cannot be null");
- this.javaType = object.getClass();
+ this.javaType = ClassUtils.getUserClass(object.getClass());
Object result; | SEC-<I>: Retrieve true underlaying class, properly handling CGLIB enhanced versions. | spring-projects_spring-security | train | java |
cdc12d9eb8edc274ae608eb2b5e23229b7af9933 | diff --git a/cake/tests/lib/cake_test_fixture.php b/cake/tests/lib/cake_test_fixture.php
index <HASH>..<HASH> 100644
--- a/cake/tests/lib/cake_test_fixture.php
+++ b/cake/tests/lib/cake_test_fixture.php
@@ -67,7 +67,7 @@ class CakeTestFixture extends Object {
function init() {
if (isset($this->import) && (is_string($this->import) || is_array($this->import))) {
$import = array();
-
+
if (is_string($this->import) || is_array($this->import) && isset($this->import['model'])) {
$import = array_merge(array('records' => false), is_array($this->import) ? $this->import : array());
$import['model'] = is_array($this->import) ? $this->import['model'] : $this->import;
@@ -79,8 +79,7 @@ class CakeTestFixture extends Object {
$connection = isset($import['connection'])
? $import['connection']
: 'default';
- ClassRegistry::config(array('ds' => $connection));
- $model =& ClassRegistry::init($import['model']);
+ $model =& ClassRegistry::init(array('class' => $import['model'], 'ds' => $connection));
$db =& ConnectionManager::getDataSource($model->useDbConfig);
$db->cacheSources = false; | Changing cake_test_fixture::init() to not alter ClassRegistry::config() settings. Instead model is built with ds parameter. Closes #<I>.
git-svn-id: <URL> | cakephp_cakephp | train | php |
dd6174693e9bbace8fdf73563a3ca9491e03e747 | diff --git a/spyderlib/utils/codeanalysis.py b/spyderlib/utils/codeanalysis.py
index <HASH>..<HASH> 100644
--- a/spyderlib/utils/codeanalysis.py
+++ b/spyderlib/utils/codeanalysis.py
@@ -50,6 +50,12 @@ def check_with_pyflakes(source_code, filename=None):
return []
else:
return [(value.args[0], value.lineno)]
+ except (ValueError, TypeError):
+ # Example of ValueError: file contains invalid \x escape character
+ # (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674797)
+ # Example of TypeError: file contains null character
+ # (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674796)
+ return []
else:
# Okay, it's syntactically valid. Now check it.
w = Checker(tree, filename) | pyflakes code analysis function: handling files with invalid \x or null chars
Update Issue <I>
Status: Started
This revision fixes a part of Issue <I> by handling the following bugs:
<URL> | spyder-ide_spyder | train | py |
366d7cf534d83c31eedb9b49234c9388e3caefc7 | diff --git a/src/org/mozilla/javascript/ScriptableObject.java b/src/org/mozilla/javascript/ScriptableObject.java
index <HASH>..<HASH> 100644
--- a/src/org/mozilla/javascript/ScriptableObject.java
+++ b/src/org/mozilla/javascript/ScriptableObject.java
@@ -320,7 +320,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
args = new Object[] { start, actualArg };
}
nativeSetter.invoke(setterThis, args);
- } else {
+ } else if (setter instanceof Function) {
Function f = (Function)setter;
f.call(cx, f.getParentScope(), start,
new Object[] { value });
@@ -345,7 +345,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
args = new Object[] { start };
}
return nativeGetter.invoke(getterThis, args);
- } else {
+ } else if (getter instanceof Function) {
Function f = (Function)getter;
Context cx = Context.getContext();
return f.call(cx, f.getParentScope(), start, | Protect against class cast exception with undefined getter/setter | mozilla_rhino | train | java |
42304408b550b086cfe62be57d5b649df57ccd1d | diff --git a/src/Bot.php b/src/Bot.php
index <HASH>..<HASH> 100644
--- a/src/Bot.php
+++ b/src/Bot.php
@@ -338,8 +338,8 @@ class Bot
*/
protected function processPlugins(array $plugins, array $processors)
{
- foreach ($plugins as $plugin) {
- foreach ($processors as $processor) {
+ foreach ($processors as $processor) {
+ foreach ($plugins as $plugin) {
$processor->process($plugin, $this);
}
} | Modified Bot->processPlugins() order of processing
Rather than applying all processors to each plugin, this method now applies each processor to all plugins.
This is to address issues arising from one plugin invoking another via events when not all plugin processors have yet been applied, which can result in missing dependencies in the core processors. | phergie_phergie-irc-bot-react | train | php |
6b760d7bda7adf1721be66f93ad838b14242e4af | diff --git a/src/Parser.php b/src/Parser.php
index <HASH>..<HASH> 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -303,9 +303,8 @@ class Parser{
// still testing...
if($preg_error !== PREG_NO_ERROR){
-
throw new BBCodeException('preg_replace_callback() died on ['.$tag.'] due to a '.$this->preg_error[$preg_error]
- .' ('.$preg_error.')'.PHP_EOL.htmlspecialchars(print_r($bbcode, true)));
+ .' ('.$preg_error.')'.PHP_EOL.htmlspecialchars(print_r($bbcode, true))); // @codeCoverageIgnore
}
if($callback && isset($this->tagmap[$tag]) && in_array($tag, $this->allowed_tags)){
@@ -353,7 +352,7 @@ class Parser{
if($preg_error !== PREG_NO_ERROR){
throw new BBCodeException('preg_match_all() died due to a '.$this->preg_error[$preg_error]
- .' ('.$preg_error.')'.PHP_EOL.htmlspecialchars(print_r($attributes, true)));
+ .' ('.$preg_error.')'.PHP_EOL.htmlspecialchars(print_r($attributes, true))); // @codeCoverageIgnore
}
return $attr; | ignore coverage for preg_errors | chillerlan_php-bbcode | train | php |
755a2438be0bdc5231c7ea416e7d51bb130832d7 | diff --git a/Source/garnish.js b/Source/garnish.js
index <HASH>..<HASH> 100644
--- a/Source/garnish.js
+++ b/Source/garnish.js
@@ -729,8 +729,17 @@ Garnish.Base = Base.extend({
if (!resize && !_$elem.data('garnish-resizable'))
{
var sensor = document.createElement('div');
- sensor.className = 'resize-sensor';
- sensor.innerHTML = '<div class="resize-overflow"><div></div></div><div class="resize-underflow"><div></div></div>';
+ sensor.innerHTML = '<div><div></div></div><div><div></div></div>';
+
+ $(sensor).add($('> div', sensor)).css({
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ width: '100%',
+ height: '100%',
+ overflow: 'hidden',
+ 'z-index': -1
+ });
_$elem.data('garnish-resizable', true); | Set the resize div styles with JS rather than relying on CSS | pixelandtonic_garnishjs | train | js |
f31c34dd309004921422056943d607b7d1652595 | diff --git a/sampi/client/client.go b/sampi/client/client.go
index <HASH>..<HASH> 100644
--- a/sampi/client/client.go
+++ b/sampi/client/client.go
@@ -13,11 +13,7 @@ import (
)
func New() (*Client, error) {
- disc, err := discoverd.NewClient()
- if err != nil {
- return nil, err
- }
- services, err := disc.Services("flynn-sampi")
+ services, err := discoverd.Services("flynn-sampi", discoverd.DefaultTimeout)
if err != nil {
return nil, err
} | host/sampi: Update discoverd usage | flynn_flynn | train | go |
293323c4409e84de7ff2478d7482a3f02e816408 | diff --git a/structr-ui/src/main/resources/structr/js/security.js b/structr-ui/src/main/resources/structr/js/security.js
index <HASH>..<HASH> 100644
--- a/structr-ui/src/main/resources/structr/js/security.js
+++ b/structr-ui/src/main/resources/structr/js/security.js
@@ -100,7 +100,7 @@ var _Security = {
blinkRed(inp);
}
});
-
+ _Security.resize();
});
}, | Added missing page resize trigger for resource access tab | structr_structr | train | js |
71d349619fec4be335f0681145e271b7628a4c63 | diff --git a/spec/augeas_tree_spec.rb b/spec/augeas_tree_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/augeas_tree_spec.rb
+++ b/spec/augeas_tree_spec.rb
@@ -72,6 +72,17 @@ describe CFA::AugeasTree do
tree["new_cool_key"] = "Ever cooler value"
expect(tree["new_cool_key"]).to eq "Ever cooler value"
end
+
+ it "adds a new key and then overwrites it with a different kind" do
+ tree["shopping_cart"] = "orange"
+
+ subtree = CFA::AugeasTree.new
+ subtree["item"] = "orange"
+ subtree["note"] = "paint, not fruit"
+ tree["shopping_cart"] = subtree
+
+ expect(tree["shopping_cart"]["item"]).to eq "orange"
+ end
end
describe "#add" do | Add a test to point out a bug (found with Sorbet)
```console
$ srb
lib/cfa/augeas_parser.rb:<I>: Method key does not exist on CFA::AugeasTree <URL> | config-files-api_config_files_api | train | rb |
402679c86daa30c6b3b58c5e2d8eab2b78359d59 | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -64,11 +64,11 @@
* @param {*} acc - initial accumulator
* @returns {object|*} instance object or initial accumulator
*/
- Stream.prototype.acc = function( value ) {
+ Stream.prototype.acc = function( acc ) {
if ( !arguments.length ) {
return this._acc;
}
- this._acc = value;
+ this._acc = acc;
return this;
}; // end METHOD acc() | [UPDATE] changed variable name. | flow-io_flow-reduce | train | js |
215a202c533de1aa845af15b2766355a2d6dc1ef | diff --git a/Adapter/PlentymarketsAdapter/ServiceBus/CommandHandler/Order/HandleOrderCommandHandler.php b/Adapter/PlentymarketsAdapter/ServiceBus/CommandHandler/Order/HandleOrderCommandHandler.php
index <HASH>..<HASH> 100755
--- a/Adapter/PlentymarketsAdapter/ServiceBus/CommandHandler/Order/HandleOrderCommandHandler.php
+++ b/Adapter/PlentymarketsAdapter/ServiceBus/CommandHandler/Order/HandleOrderCommandHandler.php
@@ -451,12 +451,10 @@ class HandleOrderCommandHandler implements CommandHandlerInterface
'lastName' => $customer->getLastname(),
'gender' => $customer->getSalutation() === Customer::SALUTATION_MR ? 'male' : 'female',
'lang' => $languageIdentity->getAdapterIdentifier(),
- 'referrerId' => 1,
'singleAccess' => $customer->getType() === Customer::TYPE_GUEST,
'plentyId' => $shopIdentity->getAdapterIdentifier(),
'newsletterAllowanceAt' => '',
'lastOrderAt' => $order->getOrderTime()->format(DATE_W3C),
- 'userId' => 1,
'options' => [],
]; | Remove user id from customer params (#<I>)
* remove userid from customer params
* remove hardcoded referrerid | plentymarkets_plentymarkets-shopware-connector | train | php |
06bc21bc038c841fda54819ea4e7973eb0920bd0 | diff --git a/spf/parser.go b/spf/parser.go
index <HASH>..<HASH> 100644
--- a/spf/parser.go
+++ b/spf/parser.go
@@ -292,8 +292,8 @@ func (p *Parser) parseMX(t *Token) (bool, SPFResult) {
//TODO(marek): Log DNS lookup error
return
} else {
- contains := false
for _, ip := range ips {
+ contains := false
// handle IPv6 address
if ip.To4() == nil {
v6Ipnet.IP = ip | Initialize contains variable to false
Let's initialize contains variable after each loop iteration. | zaccone_spf | train | go |
c9032e68939071d98215cc6f8d68e33d2a6b9c21 | diff --git a/src/instrumentation/utils.js b/src/instrumentation/utils.js
index <HASH>..<HASH> 100644
--- a/src/instrumentation/utils.js
+++ b/src/instrumentation/utils.js
@@ -126,7 +126,14 @@ module.exports = {
// Instrument static functions
this.getObjectFunctions(object).forEach(function (funcScope) {
- var transaction = $rootScope._opbeatTransactions && $rootScope._opbeatTransactions[$location.absUrl()]
+ var transaction
+
+ if(options.transaction) {
+ transaction = options.transaction
+ } else {
+ transaction = $rootScope._opbeatTransactions && $rootScope._opbeatTransactions[$location.absUrl()]
+ }
+
if (transaction) {
this.instrumentMethod(object, funcScope.property, transaction, options.type, {
prefix: options.prefix, | Make it possible to pass in an transaction as ref | opbeat_opbeat-react | train | js |
6bf0b8b70938d2f85376c864c44af66dee56c677 | diff --git a/vlfeat/utils.py b/vlfeat/utils.py
index <HASH>..<HASH> 100644
--- a/vlfeat/utils.py
+++ b/vlfeat/utils.py
@@ -7,6 +7,7 @@ def is_integer(x):
return np.isscalar(x) and is_integer_type(x)
def as_float_image(image, dtype=None, order=None):
+ image = np.asanyarray(image)
if image.dtype.kind in ('u', 'i'):
bytes = image.dtype.itemsize
if dtype is None: | as_float_image: don't assume input is already an array | dougalsutherland_vlfeat-ctypes | train | py |
2210a530917357a21a4be5377596a545152855a8 | diff --git a/tests/Client/SocketTest.php b/tests/Client/SocketTest.php
index <HASH>..<HASH> 100644
--- a/tests/Client/SocketTest.php
+++ b/tests/Client/SocketTest.php
@@ -58,6 +58,6 @@ class SocketTest extends TestCase
$this->assertInstanceOf(StreamInterface::class, $events);
$this->assertSame(Event::class, (string) $events->type());
$this->assertCount(0, $events); // empty as from here we can't push events to the server
- $this->assertEquals(2, $end - $start, '', 0.015);
+ $this->assertEquals(2, $end - $start, '', 0.02);
}
}
diff --git a/tests/Server/LocalTest.php b/tests/Server/LocalTest.php
index <HASH>..<HASH> 100644
--- a/tests/Server/LocalTest.php
+++ b/tests/Server/LocalTest.php
@@ -30,6 +30,6 @@ class LocalTest extends TestCase
$this->assertNull($listen());
$end = microtime(true);
- $this->assertEquals(1, $end - $start, '', 0.015);
+ $this->assertEquals(1, $end - $start, '', 0.02);
}
} | increase allowed delta as travis is slower | Innmind_InstallationMonitor | train | php,php |
49a6275281afc84cb8a806ec10a7302c08ae6c46 | diff --git a/test/application/domain/verifier/useCases/getIssuerProfile.test.js b/test/application/domain/verifier/useCases/getIssuerProfile.test.js
index <HASH>..<HASH> 100644
--- a/test/application/domain/verifier/useCases/getIssuerProfile.test.js
+++ b/test/application/domain/verifier/useCases/getIssuerProfile.test.js
@@ -27,13 +27,14 @@ describe('Verifier domain getIssuerProfile use case test suite', function () {
describe('given it is called with an issuerAddress parameter', function () {
const issuerProfileFixtureString = JSON.stringify(issuerProfileV2JsonFixture);
const issuerAddressV2Fixture = fixtureBlockcertsV2.badge.issuer;
- const issuerAddressV3AlphaFixture = fixtureBlockcertsV3Alpha.issuer;
beforeEach(function () {
stubRequest.resolves(issuerProfileFixtureString);
});
describe('and the Blockcerts version is 3.0-alpha', function () {
+ const issuerAddressV3AlphaFixture = fixtureBlockcertsV3Alpha.issuer;
+
it('should request the profile address', async function () {
await getIssuerProfile(issuerAddressV3AlphaFixture);
expect(stubRequest.getCall(0).args).toEqual([{ url: fixtureBlockcertsV3Alpha.issuer }]); | test(Verification): var declaration position | blockchain-certificates_cert-verifier-js | train | js |
8b226bf91d808bca6295eeeab8773c1f70a410a3 | diff --git a/sos/report/plugins/kubernetes.py b/sos/report/plugins/kubernetes.py
index <HASH>..<HASH> 100644
--- a/sos/report/plugins/kubernetes.py
+++ b/sos/report/plugins/kubernetes.py
@@ -211,4 +211,16 @@ class UbuntuKubernetes(Kubernetes, UbuntuPlugin):
elif path.exists('/etc/kubernetes/admin.conf'):
kube_cmd = "kubectl --kubeconfig=/etc/kubernetes/admin.conf"
+ services = (
+ # CDK
+ 'cdk.master.auth-webhook',
+ )
+
+ def setup(self):
+ for svc in self.services:
+ self.add_journal(units=svc)
+
+ super(UbuntuKubernetes, self).setup()
+
+
# vim: et ts=5 sw=4 | [kubernetes] Add cdk.master.auth-webhook to journal collection
In Ubuntu CDK when the deployed with Keystone authentication the
service cdk.master.auth-webhook is deployed to handle that integration
this change includes this unit to collect its journal.
Resolves: #<I> | sosreport_sos | train | py |
dfef662e6b6def6b4b5156f2e2cd8cccaab7a999 | diff --git a/spec/plucky/query_spec.rb b/spec/plucky/query_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/plucky/query_spec.rb
+++ b/spec/plucky/query_spec.rb
@@ -310,7 +310,7 @@ describe Plucky::Query do
end
it "works with options" do
- lambda { described_class.new(@collection).remove({:age.lte => 28}, :safe => true) }.should change { @collection.count }
+ lambda { described_class.new(@collection).remove({:age.lte => 28}, :w => 1) }.should change { @collection.count }
end
it "does not modify original query object" do | Fix write concern for mongo <I> in spec. | mongomapper_plucky | train | rb |
816e11c9c127c32b92bac997f6228993b97adac4 | diff --git a/cltk/corpus/greek/tlg/parse_tlg_indices.py b/cltk/corpus/greek/tlg/parse_tlg_indices.py
index <HASH>..<HASH> 100644
--- a/cltk/corpus/greek/tlg/parse_tlg_indices.py
+++ b/cltk/corpus/greek/tlg/parse_tlg_indices.py
@@ -16,7 +16,6 @@ __author__ = ['Kyle P. Johnson <[email protected]>',
'Martín Pozzi <[email protected]>']
__license__ = 'MIT License. See LICENSE.'
-
THIS_DIR = os.path.dirname(os.path.abspath(__file__)) | removed extra line after __license__ | cltk_cltk | train | py |
648f7895d4e0148496c5f443aa03f47531525e2b | diff --git a/runcommands/command.py b/runcommands/command.py
index <HASH>..<HASH> 100644
--- a/runcommands/command.py
+++ b/runcommands/command.py
@@ -224,11 +224,10 @@ class Command:
return description
def run(self, argv=None, **overrides):
- argv = sys.argv[1:] if argv is None else argv
-
if self.timed:
start_time = time.monotonic()
+ argv = sys.argv[1:] if argv is None else argv
kwargs = argv if isinstance(argv, dict) else self.parse_args(argv)
kwargs.update(overrides) | In Command.run(), start timer before doing anything else | wylee_runcommands | train | py |
109c1660c2d149ca9fc67dc8313869ed662adb67 | diff --git a/Classes/Composer/ScriptHandler.php b/Classes/Composer/ScriptHandler.php
index <HASH>..<HASH> 100644
--- a/Classes/Composer/ScriptHandler.php
+++ b/Classes/Composer/ScriptHandler.php
@@ -89,7 +89,6 @@ class ScriptHandler
1501240572934
);
}
- echo 'packacge name: ' . $packageName . chr(10);
}
/** | [CLEANUP] Drop a left-over debug output in the ScriptHandler (#<I>) | phpList_core | train | php |
5764bd6edf7b639fb91bfe0e5732aefbf0bb6c5e | diff --git a/master/buildbot/status/tinderbox.py b/master/buildbot/status/tinderbox.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/status/tinderbox.py
+++ b/master/buildbot/status/tinderbox.py
@@ -171,7 +171,7 @@ class TinderboxMailNotifier(mail.MailNotifier):
elif results == WARNINGS:
res = "testfailed"
text += res
- elif results == EXCEPTION:
+ elif results in (EXCEPTION, RETRY):
res = "exception"
text += res
else: | TinderboxMailNotifier should treat RETRY like EXCEPTION. | buildbot_buildbot | train | py |
d66a1476042462406edc5a7f11f16f9355af8d56 | diff --git a/lib/gateway/Shard.js b/lib/gateway/Shard.js
index <HASH>..<HASH> 100644
--- a/lib/gateway/Shard.js
+++ b/lib/gateway/Shard.js
@@ -156,6 +156,7 @@ class Shard extends EventEmitter {
}
resume() {
+ this.status = "resuming";
this.sendWS(OPCodes.RESUME, {
token: this.client.token,
session_id: this.sessionID,
@@ -1154,7 +1155,7 @@ class Shard extends EventEmitter {
this.reconnectInterval = 1000;
this.connecting = false;
- this.status = "connected";
+ this.status = "ready";
this.presence.status = "online";
this.client.shards._readyPacketCB();
@@ -1513,7 +1514,7 @@ class Shard extends EventEmitter {
}
if(packet.s) {
- if(packet.s > this.seq + 1 && this.ws) {
+ if(packet.s > this.seq + 1 && this.ws && this.status !== "resuming") {
/**
* Fired to warn of something weird but non-breaking happening
* @event Client#warn | Cancel resume attempt if the bot is still resuming | abalabahaha_eris | train | js |
b7ae7a654b672ef3d6f496385c7dd6884e077ea7 | diff --git a/src/_pytest/python.py b/src/_pytest/python.py
index <HASH>..<HASH> 100644
--- a/src/_pytest/python.py
+++ b/src/_pytest/python.py
@@ -1414,11 +1414,6 @@ class Function(FunctionMixin, nodes.Item, fixtures.FuncargnamesCompatAttr):
def _initrequest(self):
self.funcargs = {}
- if hasattr(self, "callspec"):
- callspec = self.callspec
- assert not callspec.funcargs
- if hasattr(callspec, "param"):
- self.param = callspec.param
self._request = fixtures.FixtureRequest(self)
@property | Remove callspec related block of code
It seems this is no longer required now that we don't support
yield tests anymore. The param attribute was added here:
<URL> | pytest-dev_pytest | train | py |
784357238ae6d7eafc0f130fa61e24f464f62ff4 | diff --git a/sshagent/trezor.py b/sshagent/trezor.py
index <HASH>..<HASH> 100644
--- a/sshagent/trezor.py
+++ b/sshagent/trezor.py
@@ -102,12 +102,16 @@ class Client(object):
hidden = os.urandom(64)
identity = self.get_identity(identity)
- node = self.client.get_public_node(_get_address(identity))
+ derivation_path = _get_address(identity)
+ node = self.client.get_public_node(derivation_path)
address = pubkey_to_address(node.node.public_key)
log.info('address: %s', address)
if expected_address is None:
log.warning('Specify Bitcoin address: %s', address)
+ self.client.get_address(n=derivation_path,
+ coin_name='Bitcoin',
+ show_display=True)
return 2
assert expected_address == address | trezor: show BTC address on device | romanz_trezor-agent | train | py |
3f2a276baea2707e1b2dd64f1ed8284263a6b172 | diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -68,6 +68,8 @@ class SessionsController < Clearance::SessionsController
password = session[:password].is_a?(String) && session.fetch(:password)
User.authenticate(who, password) if who && password
+ rescue BCrypt::Errors::InvalidHash
+ nil
end
def url_after_create
diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb
index <HASH>..<HASH> 100644
--- a/test/functional/sessions_controller_test.rb
+++ b/test/functional/sessions_controller_test.rb
@@ -124,6 +124,15 @@ class SessionsControllerTest < ActionController::TestCase
refute @controller.request.env[:clearance].signed_in?
end
end
+
+ context "when user has old SHA1 password" do
+ setup do
+ @user = create(:user, encrypted_password: "b35e3b6e1b3021e71645b4df8e0a3c7fd98a95fa")
+ get :create, params: { session: { who: @user.handle, password: "pass" } }
+ end
+
+ should respond_with :unauthorized
+ end
end
context "on DELETE to destroy" do | Handle user signin with SHA1 password, with test case | rubygems_rubygems.org | train | rb,rb |
cc1c36dff996f21f2e46aba775a0e6f07ed21e3a | diff --git a/ipywidgets/widgets/interaction.py b/ipywidgets/widgets/interaction.py
index <HASH>..<HASH> 100644
--- a/ipywidgets/widgets/interaction.py
+++ b/ipywidgets/widgets/interaction.py
@@ -27,7 +27,12 @@ from ipython_genutils.py3compat import string_types, unicode_type
from traitlets import HasTraits, Any, Unicode, observe
from numbers import Real, Integral
from warnings import warn
-from collections.abc import Iterable, Mapping
+
+try:
+ from collections.abc import Iterable, Mapping
+except ImportError:
+ from collections import Iterable, Mapping # py2
+
empty = Parameter.empty
diff --git a/ipywidgets/widgets/widget_selection.py b/ipywidgets/widgets/widget_selection.py
index <HASH>..<HASH> 100644
--- a/ipywidgets/widgets/widget_selection.py
+++ b/ipywidgets/widgets/widget_selection.py
@@ -6,7 +6,11 @@
Represents an enumeration using a widget.
"""
-from collections.abc import Mapping, Iterable
+try:
+ from collections.abc import Iterable, Mapping
+except ImportError:
+ from collections import Iterable, Mapping # py2
+
try:
from itertools import izip
except ImportError: #python3.x | Make import work in python 2 as well. | jupyter-widgets_ipywidgets | train | py,py |
94ec677ac715599afb2791c72578dd0bb6a8e527 | diff --git a/moment.js b/moment.js
index <HASH>..<HASH> 100644
--- a/moment.js
+++ b/moment.js
@@ -476,9 +476,6 @@
if (typeof from._locale !== 'undefined') {
to._locale = from._locale;
}
- if (typeof from._zn !== 'undefined') {
- to._zn = from._zn;
- }
if (momentProperties.length > 0) {
for (i in momentProperties) {
@@ -1796,8 +1793,6 @@
config._i = input = config._locale.preparse(input);
}
- config._zn = config._zn || moment._zn || null;
-
if (moment.isMoment(input)) {
return new Moment(input, true);
} else if (format) { | Better approach for keeping timezone from @timrwood. | moment_moment | train | js |
35d4836cc5a675681d36d0171f8cc3d59ef60282 | diff --git a/src/Command/Init.php b/src/Command/Init.php
index <HASH>..<HASH> 100644
--- a/src/Command/Init.php
+++ b/src/Command/Init.php
@@ -32,6 +32,9 @@ use bheisig\cli\JSONFile;
/**
* Command "init"
+ *
+ * @todo required = false doesn't work for type = array!
+ * @todo do not print empty braces for non-defined default value! (handle with care because of empty, but valid values)
*/
class Init extends Command { | Add some important TODOs for "init" command | bheisig_cli | train | php |
e0fdab7fc4b784836407f00d8a570adf9ee43925 | diff --git a/lxd/storage/drivers/volume.go b/lxd/storage/drivers/volume.go
index <HASH>..<HASH> 100644
--- a/lxd/storage/drivers/volume.go
+++ b/lxd/storage/drivers/volume.go
@@ -272,12 +272,13 @@ func (v Volume) Snapshots(op *operations.Operation) ([]Volume, error) {
return nil, err
}
- snapVols := []Volume{}
+ snapVols := make([]Volume, 0, len(snapshots))
for _, snapName := range snapshots {
snapshot, err := v.NewSnapshot(snapName)
if err != nil {
return nil, err
}
+
snapVols = append(snapVols, snapshot)
} | lxd/storage/drivers/volume: Optimized creation of slice in Snapshots() | lxc_lxd | train | go |
44d8576eb4a882f5ea960384b9ab5a8912e12704 | diff --git a/plenum/common/timer.py b/plenum/common/timer.py
index <HASH>..<HASH> 100644
--- a/plenum/common/timer.py
+++ b/plenum/common/timer.py
@@ -7,6 +7,8 @@ import time
from sortedcontainers import SortedListWithKey
+logger = getLogger()
+
class TimerService(ABC):
@abstractmethod
@@ -69,7 +71,6 @@ class RepeatingTimer:
self.update_interval(interval)
self._callback = wrapped_callback
self._active = False
- self._logger = getLogger()
if active:
self.start()
@@ -87,6 +88,6 @@ class RepeatingTimer:
def update_interval(self, interval):
if interval <= 0:
- self._logger.debug("RepeatingTimer - incorrect interval {}".format(interval))
+ logger.debug("RepeatingTimer - incorrect interval {}".format(interval))
return
self._interval = interval | INDY-<I>: fix a bug with logger | hyperledger_indy-plenum | train | py |
61d9a14ca4370615c1da3b949f92c027c7801a5f | diff --git a/services/helpers/broker.go b/services/helpers/broker.go
index <HASH>..<HASH> 100644
--- a/services/helpers/broker.go
+++ b/services/helpers/broker.go
@@ -12,7 +12,7 @@ import (
"github.com/pivotal-cf-experimental/cf-test-helpers/generator"
)
-const brokerStartTimeout = 3 * 60.0
+const brokerStartTimeout = 5 * 60.0
const defaultTimeout = 30
type ServiceBroker struct { | Increase broker push timeout to 5 minutes
- Again accommodating for CI failures | cloudfoundry_cf-acceptance-tests | train | go |
d54851c70d58db5243c70d8f20a54a5896621d33 | diff --git a/languagetool-standalone/src/test/java/org/languagetool/rules/patterns/PerformanceTest2.java b/languagetool-standalone/src/test/java/org/languagetool/rules/patterns/PerformanceTest2.java
index <HASH>..<HASH> 100644
--- a/languagetool-standalone/src/test/java/org/languagetool/rules/patterns/PerformanceTest2.java
+++ b/languagetool-standalone/src/test/java/org/languagetool/rules/patterns/PerformanceTest2.java
@@ -54,6 +54,7 @@ final class PerformanceTest2 {
String subText = text.substring(beginIndex, endIndex);
long startTime = System.currentTimeMillis();
MultiThreadedJLanguageTool lt = new MultiThreadedJLanguageTool(language);
+ //lt.activateLanguageModelRules(new File("/home/dnaber/data/google-ngram-index"));
//lt.activateWord2VecModelRules(new File("/home/dnaber/lt/word2vec"));
List<RuleMatch> matches = lt.check(subText);
//System.out.println(matches); | add commented line with ngram activation | languagetool-org_languagetool | train | java |
74382efe00a60b20e1ef7c30d75900f659ab26b9 | diff --git a/StMarksSmarty.php b/StMarksSmarty.php
index <HASH>..<HASH> 100644
--- a/StMarksSmarty.php
+++ b/StMarksSmarty.php
@@ -564,7 +564,7 @@ final class StMarksSmarty extends Smarty {
if (empty($metadata)) {
$this->assign('metadata', $this->minimalMetadata);
} else {
- $this->assign('metadata', array_replace($this->minimalMetadata, $metadata));
+ $this->assign('metadata', array_replace($this->minimalMetadata, $metadata->getArrayCopy()));
}
$this->assign('uiMessages', $this->messages);
$this->assign('uiStylesheets', $this->stylesheets); | getArrayCopy()
Oh, right… AppMetadata is not an `instanceof` array... | smtech_stmarks-bootstrapsmarty | train | php |
c543c8af8daf67ae14f37dcddadeb0f8ac91859e | diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index <HASH>..<HASH> 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -191,8 +191,8 @@ module ApplicationHelper
unless email.blank?
# Build the Gravatar url.
- url = 'http://www.gravatar.com/avatar.php?'
- url << "gravatar_id=#{Digest::MD5.new.update(email)}"
+ url = '//gravatar.com/avatar/'
+ url << "#{Digest::MD5.new.update(email)}?"
url << "&rating=#{options[:rating]}" if options[:rating]
url << "&size=#{options[:size]}" if options[:size]
url << "&default=#{options[:default]}" if options[:default] | Updated `gravatar_url` to use relative URL's | radiant_radiant | train | rb |
94fae0eb70611b2508f08184134c4207c9543730 | diff --git a/tinyrpc/client.py b/tinyrpc/client.py
index <HASH>..<HASH> 100644
--- a/tinyrpc/client.py
+++ b/tinyrpc/client.py
@@ -16,10 +16,15 @@ class RPCClient(object):
self.protocol = protocol
self.transport = transport
- def _send_and_handle_reply(self, req):
- # sends and waits for reply
+ def _send_and_handle_reply(self, req, one_way):
+ # sends ...
reply = self.transport.send_message(req.serialize())
+ if one_way:
+ # ... and be done
+ return
+
+ # ... or process the reply
response = self.protocol.parse_reply(reply)
if hasattr(response, 'error'):
@@ -41,7 +46,12 @@ class RPCClient(object):
"""
req = self.protocol.create_request(method, args, kwargs, one_way)
- return self._send_and_handle_reply(req).result
+ rep = self._send_and_handle_reply(req, one_way)
+
+ if one_way:
+ return
+
+ return rep.result
def get_proxy(self, prefix='', one_way=False):
"""Convenience method for creating a proxy. | Add support for JSON-RPC Notifications | mbr_tinyrpc | train | py |
53ac71b81b29d5f372a655583f9d798f52a10d64 | diff --git a/troposphere/opsworks.py b/troposphere/opsworks.py
index <HASH>..<HASH> 100644
--- a/troposphere/opsworks.py
+++ b/troposphere/opsworks.py
@@ -364,4 +364,5 @@ class Server(AWSObject):
'ServerName': (basestring, False),
'ServiceRoleArn': (basestring, True),
'SubnetIds': ([basestring], False),
+ 'Tags': ((Tags, list), False),
} | adding Tags to Server, per Feb 6 <I> update | cloudtools_troposphere | train | py |
e8c6e6f6345d7acefe7a96502f89f3f3d40714f9 | diff --git a/runner.js b/runner.js
index <HASH>..<HASH> 100644
--- a/runner.js
+++ b/runner.js
@@ -66,6 +66,9 @@ Runner.prototype.runFiles = function (files, dir, cb) {
if (path.extname(f) === ".js") {
cmd = "node"
args = [f]
+ } else if (path.extname(f) === ".coffee") {
+ cmd = "coffee"
+ args = [f]
}
if (st.isDirectory()) {
return self.runDir(f, cb) | Added support for running tests written in coffee. | tapjs_node-tap | train | js |
432042635fd3073a363f802995d36b322073c503 | diff --git a/src/Module.php b/src/Module.php
index <HASH>..<HASH> 100644
--- a/src/Module.php
+++ b/src/Module.php
@@ -101,13 +101,9 @@ class Module extends \Miny\Modules\Module
private function setupAutoLoader(AutoLoader $autoLoader)
{
if ($this->getConfiguration('options:cache', false)) {
- $cacheDirectoryName = $this->getConfiguration('options:cache');
- if (!is_dir($cacheDirectoryName)) {
- mkdir($cacheDirectoryName);
- }
$autoLoader->register(
'\\' . $this->getConfiguration('options:cache_namespace'),
- $cacheDirectoryName
+ $this->getConfiguration('options:cache')
);
}
} | Don't create cache dir by default. It will be created when needed. | bugadani_Minty | train | php |
7df1e201c41f41476207bbf4c8ff222808524d8e | diff --git a/lib/json_api_client/resource.rb b/lib/json_api_client/resource.rb
index <HASH>..<HASH> 100644
--- a/lib/json_api_client/resource.rb
+++ b/lib/json_api_client/resource.rb
@@ -253,6 +253,9 @@ module JsonApiClient
end
end
+ # Instantiate a new resource object
+ #
+ # @param params [Hash] Attributes, links, and relationships
def initialize(params = {})
self.links = self.class.linker.new(params.delete("links") || {})
self.relationships = self.class.relationship_linker.new(params.delete("relationships") || {})
@@ -267,6 +270,10 @@ module JsonApiClient
end
end
+ # Set the current attributes and try to save them
+ #
+ # @param attrs [Hash] Attributes to update
+ # @return [Boolean] Whether the update succeeded or not
def update_attributes(attrs = {})
self.attributes = attrs
save | completed docs on Resource public interface | JsonApiClient_json_api_client | train | rb |
38c633893d223ea89932780273401f5e63446937 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,5 +1,6 @@
#! /usr/bin/env python3
# Requires Python 3.6+
+# pylint: disable=invalid-name
"""Configuration of Sphinx documentation generator."""
extensions = [ | Ignore invalid-name pylint rule in docs.conf | cherrypy_cheroot | train | py |
25a18f168dae03e52b6fcf613ded2facaef9660d | diff --git a/src/openbandparams/version.py b/src/openbandparams/version.py
index <HASH>..<HASH> 100644
--- a/src/openbandparams/version.py
+++ b/src/openbandparams/version.py
@@ -1 +1 @@
-__version__ = '0.4+'
+__version__ = '0.5' | bumped version number to <I> | scott-maddox_openbandparams | train | py |
01f72223fcf90e4396051a9d4da8e3bb4738fa35 | diff --git a/openquake/engine/db/models.py b/openquake/engine/db/models.py
index <HASH>..<HASH> 100644
--- a/openquake/engine/db/models.py
+++ b/openquake/engine/db/models.py
@@ -2568,9 +2568,9 @@ class EventLossData(djm.Model):
class EventLossAsset(djm.Model):
- event_loss = djm.ForeignKey(EventLoss)
- rupture = djm.ForeignKey('SESRupture')
- asset = djm.ForeignKey('ExposureData')
+ event_loss = djm.ForeignKey('EventLoss', null=False)
+ rupture = djm.ForeignKey('SESRupture', null=False)
+ asset = djm.ForeignKey('ExposureData', null=False)
loss = djm.FloatField(null=False)
@property | Added some missing null=False in EventLossAsset
Former-commit-id: <I>fa<I>ce7bcaafc<I>f<I>be<I>d<I>c9f | gem_oq-engine | train | py |
d5ce5e5701932a68c1fd1cb17aff405d1a268d32 | diff --git a/lib/discordrb/gateway.rb b/lib/discordrb/gateway.rb
index <HASH>..<HASH> 100644
--- a/lib/discordrb/gateway.rb
+++ b/lib/discordrb/gateway.rb
@@ -255,6 +255,16 @@ module Discordrb
send_packet(Opcodes::VOICE_STATE, data)
end
+ # Sends a resume packet (op 6). This replays all events from a previous point specified by its packet sequence. This
+ # will not work if the packet to resume from has already been acknowledged using a heartbeat, or if the session ID
+ # belongs to a now invalid session.
+ #
+ # If this packet is sent at the beginning of a connection, it will act similarly to an {#identify} in that it
+ # creates a session on the current connection. Unlike identify however, this packet can also be sent in an existing
+ # session and will just replay some of the events.
+ # @param token [String] The token that was used to identify the session to resume.
+ # @param session_id [String] The session ID of the session to resume.
+ # @param seq [Integer] The packet sequence of the packet after which the events should be replayed.
def send_resume(token, session_id, seq)
data = {
token: token, | Add a doc comment to send_resume | meew0_discordrb | train | rb |
87281a8bea5a00ce87a4f844a2ff6f0d8158515c | diff --git a/src/Lines.js b/src/Lines.js
index <HASH>..<HASH> 100644
--- a/src/Lines.js
+++ b/src/Lines.js
@@ -43,6 +43,10 @@ const Lines = React.createClass({
scaleX: React.PropTypes.object,
scaleY: React.PropTypes.object,
+ minX: React.PropTypes.number,
+ maxX: React.PropTypes.number,
+ minY: React.PropTypes.number,
+ maxY: React.PropTypes.number,
seriesIndex: React.PropTypes.oneOfType([
React.PropTypes.number,
React.PropTypes.array,
@@ -67,14 +71,14 @@ const Lines = React.createClass({
render: function () {
let {props} = this;
- let {className, style, scaleX, scaleY, asAreas, colors, series, opacity} = props;
+ let {className, style, scaleX, scaleY, minY, asAreas, colors, series, opacity} = props;
let rotate = scaleX.swap || scaleY.swap;
let x = scaleX.factory(props);
let y = scaleY.factory(props);
- let _y0 = y(0);
+ let _y0 = y(minY || 0);
let color = helpers.colorFunc(colors);
return <g className={className} style={style} opacity={opacity}> | Use minY as starting point for areas. Fixes #<I> | rumble-charts_rumble-charts | train | js |
92c3271535ec40365ddb56938cf9259e2247e709 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -261,6 +261,13 @@ class ConfigCommand(Command):
('no_pkg_config', 'no_pkg_config'),)
def run(self):
+ if is_msvc(new_compiler(compiler=self.compiler)):
+ # Assume we have to disable /OPT:REF for MSVC with ffmpeg
+ config = {
+ 'extra_link_args': ['/OPT:NOREF'],
+ }
+ update_extend(extension_extra, config)
+
# Check if we're using pkg-config or not
if self.no_pkg_config:
# Simply assume we have everything we need! | Added MSVC /OPT:NOREF linker flag
The libs in the official ffmpeg dev distribution for windows is
typically created with dlltool, so we have to add the /OPT:NOREF
linker flag (<URL>). | mikeboers_PyAV | train | py |
84feb187476fedec26959afdb1ee5f0282bcc8a4 | diff --git a/output/html/assets.php b/output/html/assets.php
index <HASH>..<HASH> 100644
--- a/output/html/assets.php
+++ b/output/html/assets.php
@@ -262,7 +262,7 @@ class QM_Output_Html_Assets extends QM_Output_Html {
printf(
'<a href="%s" class="qm-link">%s</a>',
esc_attr( $src ),
- esc_html( str_replace( home_url(), '', $src ) )
+ esc_html( ltrim( str_replace( home_url(), '', $src ), '/' ) )
);
}
echo '</td>'; | Trim leading slash from asset URLs. | johnbillion_query-monitor | train | php |
42016ae921bd6b2c6e22b1a410a3475b2dcbd64f | diff --git a/openquake/calculators/extract.py b/openquake/calculators/extract.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/extract.py
+++ b/openquake/calculators/extract.py
@@ -1056,6 +1056,21 @@ def extract_event_info(dstore, eidx):
yield 'gsim', repr(gsim)
[email protected]('extreme_event')
+def extract_extreme_event(dstore, eidx):
+ """
+ Extract information about the given event index.
+ Example:
+ http://127.0.0.1:8800/v1/calc/30/extract/extreme_event
+ """
+ arr = dstore['gmf_data/gmv_0'][()]
+ idx = arr.argmax()
+ eid = dstore['gmf_data/eid'][idx]
+ dic = dict(extract_event_info(dstore, eid))
+ dic['gmv'] = arr[idx]
+ return dic
+
+
@extract.add('ruptures_within')
def get_ruptures_within(dstore, bbox):
""" | Added view extreme_event [skip CI] | gem_oq-engine | train | py |
ebec55a827913eec03c554b9a191a2fea3e5dbbc | diff --git a/simuvex/s_procedure.py b/simuvex/s_procedure.py
index <HASH>..<HASH> 100644
--- a/simuvex/s_procedure.py
+++ b/simuvex/s_procedure.py
@@ -219,6 +219,7 @@ class SimProcedureContinuation(SimProcedure):
kwargs['sim_kwargs'] = saved_kwargs
self.__init__(newstate, *args, run_func_name=continue_at, **kwargs)
+ self.initial_state = state
return self
from . import s_options as o | store the original state as the initial_state in SimProcedureContinuum, as otherwise, the callstack becomes empty and the procedure is impossible to re-analyze during backward slicing | angr_angr | train | py |
03d8774ea6385b6389edc3249a41c3fd999ae529 | diff --git a/lib/sensu/api/process.rb b/lib/sensu/api/process.rb
index <HASH>..<HASH> 100644
--- a/lib/sensu/api/process.rb
+++ b/lib/sensu/api/process.rb
@@ -26,9 +26,7 @@ module Sensu
# transport connections have been established.
def setup_connections
setup_redis do |redis|
- @redis = redis
setup_transport do |transport|
- @transport = transport
yield if block_given?
end
end
@@ -55,13 +53,14 @@ module Sensu
# Start the Sensu API HTTP server. This method sets the service
# state to `:running`.
def start
+ api = @settings[:api] || {}
+ bind = api[:bind] || "0.0.0.0"
+ port = api[:port] || 4567
setup_connections do
- api = @settings[:api] || {}
- bind = api[:bind] || "0.0.0.0"
- port = api[:port] || 4567
start_http_server(bind, port)
- super
+ yield if block_given?
end
+ super
end
# Stop the Sensu API process. This method stops the HTTP server,
@@ -81,11 +80,8 @@ module Sensu
# @param options [Hash]
def self.test(options={})
api = self.new(options)
- api.setup_redis do
- api.setup_transport do
- api.start
- yield
- end
+ api.start do
+ yield
end
end
end | [api_callbacks] use callbacks w/test method | sensu_sensu | train | rb |
c78653f9637a1f9fe5a01fa573c09259b27e2761 | diff --git a/examples/uno.js b/examples/uno.js
index <HASH>..<HASH> 100644
--- a/examples/uno.js
+++ b/examples/uno.js
@@ -66,10 +66,12 @@ SerialPort.list(function (err, ports) {
programmer.setOptions.bind(programmer, options),
programmer.enterProgrammingMode.bind(programmer),
programmer.upload.bind(programmer, hex, pageSize),
- programmer.exitProgrammingMode.bind(programmer),
- programmer.disconnect.bind(programmer)
+ programmer.exitProgrammingMode.bind(programmer)
], function(error){
+
+ programmer.disconnect();
+
if(error){
console.log("programing FAILED: " + error);
process.exit(1); | move disconnect to async exit function in case theres a failure we still try to disconnect | jacobrosenthal_bitlash-js | train | js |
26bdcfa82e6540098ae8c0592313cf65ab77d048 | diff --git a/GPy/likelihoods/__init__.py b/GPy/likelihoods/__init__.py
index <HASH>..<HASH> 100644
--- a/GPy/likelihoods/__init__.py
+++ b/GPy/likelihoods/__init__.py
@@ -1,6 +1,6 @@
from .bernoulli import Bernoulli
from .exponential import Exponential
-from .gaussian import Gaussian, Heteroscedastic_Gaussian
+from .gaussian import Gaussian, HeteroscedasticGaussian
from .gamma import Gamma
from .poisson import Poisson
from .student_t import StudentT | [hetnoise] import correction | SheffieldML_GPy | train | py |
626fe16d21da2613f55fd2a1cca0f2302b60c652 | diff --git a/source/Core/oxutilsserver.php b/source/Core/oxutilsserver.php
index <HASH>..<HASH> 100644
--- a/source/Core/oxutilsserver.php
+++ b/source/Core/oxutilsserver.php
@@ -63,10 +63,6 @@ class oxUtilsServer extends oxSuperCfg
*/
public function setOxCookie($sName, $sValue = "", $iExpire = 0, $sPath = '/', $sDomain = null, $blToSession = true, $blSecure = false, $blHttpOnly = true)
{
- //TODO: since setcookie takes more than just 4 params..
- // would be nice to have it sending through https only, if in https mode
- // or allowing only http access to cookie [no JS access - reduces XSS attack possibility]
- // ref: http://lt.php.net/manual/en/function.setcookie.php
if ($blToSession && !$this->isAdmin()) {
$this->_saveSessionCookie($sName, $sValue, $iExpire, $sPath, $sDomain); | Update oxutilsserver.php
removed no longer valid comment about not having all parameters (in the meantime all parameters were added to setOxCookie) | OXID-eSales_oxideshop_ce | train | php |
Subsets and Splits