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 |
|---|---|---|---|---|---|
4b47f938b49b7c046947056895969df05dcddac0 | diff --git a/src/XeroPHP/Application.php b/src/XeroPHP/Application.php
index <HASH>..<HASH> 100644
--- a/src/XeroPHP/Application.php
+++ b/src/XeroPHP/Application.php
@@ -69,16 +69,18 @@ abstract class Application {
}
/**
- * @param string|null $oAuthToken
+ * @param string|null $oauth_token
* @return string
*/
- public function getAuthorizeURL($oAuthToken = null) {
- $authorizeUrl = $this->oauth_client->getAuthorizeURL();
- if ($oAuthToken) {
- return sprintf('%s?oauth_token=%s', $authorizeUrl, $oAuthToken);
+ public function getAuthorizeURL($oauth_token = null) {
+ $authorize_url = $this->oauth_client->getAuthorizeURL();
+
+ if ($oauth_token !== null) {
+ $operator = parse_url($authorize_url, PHP_URL_QUERY) !== null ? '&' : '?';
+ $authorize_url .= sprintf('%soauth_token=%s', $operator, $oauth_token);
}
- return $authorizeUrl;
+ return $authorize_url;
}
/** | Updated ->getAuthorizeURL() to return well-formed URL when QS params already exist (#<I>) | calcinai_xero-php | train | php |
ddc41e5027a0620168f88355d2baae450b102124 | diff --git a/src/com/inet/lib/less/FunctionExpression.java b/src/com/inet/lib/less/FunctionExpression.java
index <HASH>..<HASH> 100644
--- a/src/com/inet/lib/less/FunctionExpression.java
+++ b/src/com/inet/lib/less/FunctionExpression.java
@@ -572,11 +572,11 @@ class FunctionExpression extends Expression {
return;
case "hsv":
type = COLOR;
- doubleValue = hsva( getPercent( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), 1 );
+ doubleValue = hsva( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), 1 );
return;
case "hsva":
type = RGBA;
- doubleValue = hsva( getPercent( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), getPercent( 3, formatter ) );
+ doubleValue = hsva( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), getPercent( 3, formatter ) );
return;
case "hsvhue":
doubleValue = toHSV( getColor( 0, formatter ) ).h; | hue value of functions hsva() and hsv() is not a percent. | i-net-software_jlessc | train | java |
27be4589b9add11b45601c2e9d6c96acd706d6ea | diff --git a/webhooks/senders/base.py b/webhooks/senders/base.py
index <HASH>..<HASH> 100644
--- a/webhooks/senders/base.py
+++ b/webhooks/senders/base.py
@@ -187,6 +187,8 @@ class Senderable(object):
sending_metadata['error'] = None if sending_metadata['success'] or not self.error else self.error
sending_metadata['post_attributes'] = post_attributes
merged_dict = sending_metadata.copy()
+ if isinstance(payload, basestring):
+ payload = {'payload': payload}
merged_dict.update(payload)
return merged_dict | NH - support for string payload | pydanny_webhooks | train | py |
3ef04349619279285d82af39c11d0f47a26686b8 | diff --git a/spec/bracket_spec.rb b/spec/bracket_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/bracket_spec.rb
+++ b/spec/bracket_spec.rb
@@ -190,14 +190,10 @@ describe BracketTree::Bracket::Base do
describe 'positional relation hooks' do
let(:bracket) { BracketTree::Bracket::DoubleElimination.by_size 4 }
- it 'delegates the query methods to a relation' do
- relation = bracket.winners
- relation.should be_a BracketTree::PositionalRelation
- end
-
- it 'delegates the accessor methods to a relation' do
- nodes = bracket.winners.round(1).all
- nodes.should have(4).nodes
+ [:winners, :losers, :round, :all, :first, :last, :seat].each do |m|
+ it "should respond to #{m}" do
+ bracket.should respond_to m
+ end
end
end
end | Better test coverage for relational delegators | agoragames_bracket_tree | train | rb |
c8c2c190cd0fb8301e3d71392a6fd8c4b5590578 | diff --git a/lib/art-decomp/dec_tree.rb b/lib/art-decomp/dec_tree.rb
index <HASH>..<HASH> 100644
--- a/lib/art-decomp/dec_tree.rb
+++ b/lib/art-decomp/dec_tree.rb
@@ -11,6 +11,10 @@ module ArtDecomp class DecTree
self.decs == other.decs
end
+ def dup
+ self.class.new decs.dup
+ end
+
protected
attr_accessor :decs
diff --git a/spec/art-decomp/dec_tree_spec.rb b/spec/art-decomp/dec_tree_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/art-decomp/dec_tree_spec.rb
+++ b/spec/art-decomp/dec_tree_spec.rb
@@ -17,6 +17,14 @@ module ArtDecomp describe DecTree do
end
end
+ describe '#dup' do
+ it 'makes a shallow copy' do
+ copy = dec_tree.dup
+ copy << 'baz'
+ dec_tree.must_equal DecTree.new ['foo', 'bar']
+ end
+ end
+
describe '#pop' do
it 'drops elements' do
dec_tree.pop | introducing DecTree#dup | chastell_art-decomp | train | rb,rb |
22878590d6692692fbb903fd08ca9f91e2545098 | diff --git a/tests/test_backends.py b/tests/test_backends.py
index <HASH>..<HASH> 100644
--- a/tests/test_backends.py
+++ b/tests/test_backends.py
@@ -71,6 +71,9 @@ class TestBackends(unittest.TestCase):
if 'updated_on' in item:
updated = datetime.fromtimestamp(item['updated_on'])
item['metadata__updated_on'] = updated.isoformat()
+ if 'timestamp' in item:
+ ts = datetime.fromtimestamp(item['timestamp'])
+ item['metadata__timestamp'] = ts.isoformat()
return item
def __data2es(self, items, ocean): | [tests] Include timestamp in raw ocean | chaoss_grimoirelab-elk | train | py |
c60778bca300a703f184def77fe8e1bead7af975 | diff --git a/lib/jekyll-livereload/build.rb b/lib/jekyll-livereload/build.rb
index <HASH>..<HASH> 100644
--- a/lib/jekyll-livereload/build.rb
+++ b/lib/jekyll-livereload/build.rb
@@ -9,7 +9,7 @@ module Jekyll
def process(opts)
opts = load_config_options(opts)
- if opts['livereload']
+ if opts['livereload'] and opts['serving']
Jekyll::Hooks.register(:site, :post_render) do |site|
regenerator = Jekyll::Regenerator.new(site) | Don't include Livereload during build command
Closes #2 | RobertDeRose_jekyll-livereload | train | rb |
19eca59dd49d7b1ca0f2c71dac348caf86638707 | diff --git a/mot/cl_routines/numerical_hessian.py b/mot/cl_routines/numerical_hessian.py
index <HASH>..<HASH> 100644
--- a/mot/cl_routines/numerical_hessian.py
+++ b/mot/cl_routines/numerical_hessian.py
@@ -21,7 +21,8 @@ def numerical_hessian(objective_func, parameters,
"""Calculate and return the Hessian of the given function at the given parameters.
This calculates the Hessian using central difference (using a 2nd order Taylor expansion) with a Richardson
- extrapolation over the proposed sequence of steps.
+ extrapolation over the proposed sequence of steps, followed by a Wynn epsilon extrapolation over the remaining steps
+ and finally returns the estimate with the lowest error, taking into account outliers using a median filter.
The Hessian is evaluated at the steps: | Comment update in Hessian func | cbclab_MOT | train | py |
463deee98356864a636dd88ceb36822254b774f7 | diff --git a/rules.go b/rules.go
index <HASH>..<HASH> 100644
--- a/rules.go
+++ b/rules.go
@@ -1240,6 +1240,23 @@ func sameValue(value1 ast.Value, value2 ast.Value) bool {
func sameType(typeA, typeB Type) bool {
return fmt.Sprintf("%v", typeA) == fmt.Sprintf("%v", typeB)
+
+ if typeA == typeB {
+ return true
+ }
+
+ if typeA, ok := typeA.(*List); ok {
+ if typeB, ok := typeB.(*List); ok {
+ return sameType(typeA.OfType, typeB.OfType)
+ }
+ }
+ if typeA, ok := typeA.(*NonNull); ok {
+ if typeB, ok := typeB.(*NonNull); ok {
+ return sameType(typeA.OfType, typeB.OfType)
+ }
+ }
+
+ return false
}
/** | Perf improvement for comparing two types
Commit:
f<I>e<I>c3d<I>dee<I>d<I>ed<I>c<I>f4e7 [f<I>e<I>]
Parents:
6a3eac<I>d | graphql-go_graphql | train | go |
3caef4ea63c7228ebb1f36cb88f017ab54e217d0 | diff --git a/lib/camp.js b/lib/camp.js
index <HASH>..<HASH> 100644
--- a/lib/camp.js
+++ b/lib/camp.js
@@ -38,11 +38,7 @@ function Ask (server, req, res) {
// FIXME: can we avoid all this allocation?
// Idea: keeping the same. Would that cause issues?
this.form = new formidable.IncomingForm();
- try {
- this.path = decodeURI(this.uri.pathname);
- } catch (e) { // Using `escape` should not kill the server.
- this.path = unescape(this.uri.pathname);
- }
+ this.path = unescape(this.uri.pathname);
this.query = this.uri.query;
} | Escape all %-encoded elements in a URI. | espadrine_sc | train | js |
92035cef083321347c39463ebf78d12ead2ede79 | diff --git a/lib/jammit.rb b/lib/jammit.rb
index <HASH>..<HASH> 100644
--- a/lib/jammit.rb
+++ b/lib/jammit.rb
@@ -124,8 +124,8 @@ module Jammit
# complain loudly.
def self.disable_compression
@compressor_options[:disabled] = true
- complaint = "Jammit asset compression disabled -- Java unavailable"
- defined?(Rails) ? Rails.logger.error(complaint) : STDERR.puts(complaint)
+ complaint = "Warning: Jammit asset compression disabled -- Java unavailable."
+ defined?(Rails) ? Rails.logger.warn(complaint) : STDERR.puts(complaint)
end
end | nicer warning message when compression is disabled | documentcloud_jammit | train | rb |
9734a09f241f293611f941aa77e87ea728b04b93 | diff --git a/mapclassify.py b/mapclassify.py
index <HASH>..<HASH> 100644
--- a/mapclassify.py
+++ b/mapclassify.py
@@ -766,6 +766,7 @@ class Map_Classifier(object):
x = np.asarray(x).flatten()
uptos = [np.where(value < self.bins)[0] for value in x]
bins = [x.min() if x.size > 0 else len(self.bins)-1 for x in uptos] #bail upwards
+ bins = np.asrrray(bins)
if len(bins) == 1:
return bins[0]
else: | find_bin should return the same type as yb | pysal_mapclassify | train | py |
2525b5a5d8676cb23d39d6b7414b7dfada6a0bc3 | diff --git a/src/pushprocessor.js b/src/pushprocessor.js
index <HASH>..<HASH> 100644
--- a/src/pushprocessor.js
+++ b/src/pushprocessor.js
@@ -52,6 +52,22 @@ const DEFAULT_OVERRIDE_RULES = [
},
],
},
+ {
+ // For homeservers which don't support MSC2153 yet
+ rule_id: ".m.rule.reaction",
+ default: true,
+ enabled: true,
+ conditions: [
+ {
+ kind: "event_match",
+ key: "type",
+ pattern: "m.reaction",
+ },
+ ],
+ actions: [
+ "dont_notify",
+ ],
+ },
];
/** | Add default push rule to ignore reactions
This adds a default push rule to ignore reactions as proposed in
[MSC<I>](<URL> | matrix-org_matrix-js-sdk | train | js |
faaa01ddcfa2ea756a1600f148b2a11f85e0f5e1 | diff --git a/spec/sort_spec.js b/spec/sort_spec.js
index <HASH>..<HASH> 100644
--- a/spec/sort_spec.js
+++ b/spec/sort_spec.js
@@ -70,9 +70,15 @@ describe("sort", function() {
})
it("if you provide a sort feature the cost is zero", function(){
+ var fMin = CollectionFunctions({sort:function(array){ return [].concat(array).sort()}}).functions
+ expect(fMin.sort([6,5,8,7])).toEqual([5,6,7,8])
+ expect(fMin.lastCost()).toEqual(0)
})
it("the array cf has a sort fearure", function(){
+ fArr.lastCost() //ugh, side effects of cost. cost is a bit of a mess isn't it.
+ expect(fArr.sort([6,5,8,7])).toEqual([5,6,7,8])
+ expect(fArr.lastCost()).toEqual(0)
})
})
}) | cost of your own sort function is zero. array cf comes with its own sort function | sconover_collection_functions | train | js |
3fd0af69d3ca77947461d747467d4e3251ce90cd | diff --git a/invenio_accounts/fixtures.py b/invenio_accounts/fixtures.py
index <HASH>..<HASH> 100644
--- a/invenio_accounts/fixtures.py
+++ b/invenio_accounts/fixtures.py
@@ -28,7 +28,6 @@ class UserData(DataSet):
"""User data."""
class admin:
- id = 1
email = current_app.config.get('CFG_SITE_ADMIN_EMAIL')
password = ''
note = '1' | global: fix fixtures loading on PostgreSQL
* BETTER Removes fixed user id from fixtures as it is automatically
generated by database engine. (closes inveniosoftware/invenio#<I>) | inveniosoftware_invenio-accounts | train | py |
d55ecac415fbde1c15e5eaaf4bdb0bb54c9874e3 | diff --git a/packages/ringcentral-integration/modules/RegionSettings/index.js b/packages/ringcentral-integration/modules/RegionSettings/index.js
index <HASH>..<HASH> 100644
--- a/packages/ringcentral-integration/modules/RegionSettings/index.js
+++ b/packages/ringcentral-integration/modules/RegionSettings/index.js
@@ -38,6 +38,7 @@ export default class RegionSettings extends RcModule {
* @param {TabManager} params.tabManager - tabManager module instance
*/
constructor({
+ brand,
storage,
extensionInfo,
dialingPlan,
@@ -49,6 +50,7 @@ export default class RegionSettings extends RcModule {
...options,
actionTypes,
});
+ this._brand = brand;
this._storage = storage;
this._alert = alert;
this._dialingPlan = dialingPlan;
@@ -144,7 +146,9 @@ export default class RegionSettings extends RcModule {
))
) {
countryCode = null;
- this._alertSettingsChanged();
+ if (this._brand.id === '1210') {
+ this._alertSettingsChanged();
+ }
}
if (!countryCode) {
const country = this.availableCountries.find(plan => ( | fix bug RCINT-<I> Region setting alert prompts occasionally when login telus (#<I>) | ringcentral_ringcentral-js-widgets | train | js |
3fcf1d3c227dabbd70411d064a210b4509931a1f | diff --git a/pyads/ads.py b/pyads/ads.py
index <HASH>..<HASH> 100644
--- a/pyads/ads.py
+++ b/pyads/ads.py
@@ -633,6 +633,8 @@ class Connection(object):
@ams_netid.setter
def ams_netid(self, netid):
# type: (str) -> None
+ if self._open:
+ raise AttributeError("Setting netid is not allowed while connection is open.")
self._adr.netid = netid
@property
@@ -643,6 +645,8 @@ class Connection(object):
@ams_port.setter
def ams_port(self, port):
# type: (int) -> None
+ if self._open:
+ raise AttributeError("Setting port is not allowed while connection is open.")
self._adr.port = port
def __enter__(self): | Raise AttributeError if connection is open | stlehmann_pyads | train | py |
285e6a5ead4cb28d71b1e0d91af08420da916fd2 | diff --git a/test/common/storage/base-test.js b/test/common/storage/base-test.js
index <HASH>..<HASH> 100644
--- a/test/common/storage/base-test.js
+++ b/test/common/storage/base-test.js
@@ -72,7 +72,8 @@ function batchThree (providerClient, providerName, nock) {
topic: function () {
var stream = providerClient.upload({
container: testContext.container,
- remote: 'test-file.txt'
+ remote: 'test-file.txt',
+ headers: {'x-amz-acl': 'public-read'}
}, this.callback);
var file = fs.createReadStream(helpers.fixturePath('fillerama.txt')); | [fix] Added test for Amazon headers | pkgcloud_pkgcloud | train | js |
1d4782b8f7af9ec9fb585a75ac6d1b4871885bf9 | diff --git a/tests/test_client.py b/tests/test_client.py
index <HASH>..<HASH> 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -128,3 +128,16 @@ class TestClient(ClientTestCase):
self.assertEqual(self.client.users.me(), 'me')
self.assertEqual(len(responses.calls), 2)
time_sleep.assert_called_once_with(10)
+
+ @patch('time.sleep')
+ def test_rate_limited_twice(self, time_sleep):
+ res = [
+ (429, { 'Retry-After': '10' }, '{}'),
+ (429, { 'Retry-After': '1' }, '{}'),
+ (200, {}, json.dumps({ 'data': 'me' }))
+ ]
+ responses.add_callback(responses.GET, 'http://app/users/me', callback=lambda r: res.pop(0), content_type='application/json')
+
+ self.assertEqual(self.client.users.me(), 'me')
+ self.assertEqual(len(responses.calls), 3)
+ time_sleep.assert_called_twice() | Test case when rate limited twice in a row | Asana_python-asana | train | py |
e58d0fd38f1560673a9d291bd90d373dcd13e2af | diff --git a/src/controllers/AuthenticationController.php b/src/controllers/AuthenticationController.php
index <HASH>..<HASH> 100644
--- a/src/controllers/AuthenticationController.php
+++ b/src/controllers/AuthenticationController.php
@@ -24,7 +24,7 @@ Class AuthenticationController extends BaseController {
{
try {
- $accessToken = $this->auth->authenticationCallback($service, Input::get());
+ return Response::json($this->auth->authenticationCallback($service, Input::get()));
} catch (\Exception $e) {
var_dump($e->getMessage()); | Authentication controller to return the state returned from the authentication callback | Vinelab_social-auth | train | php |
1d64615055ce1301711a3268b1b10996bef6ac25 | diff --git a/minidns/dns.py b/minidns/dns.py
index <HASH>..<HASH> 100644
--- a/minidns/dns.py
+++ b/minidns/dns.py
@@ -215,8 +215,8 @@ class DNSService(service.MultiService):
def rewrite_and_monitor_resolvconf(self):
""" If the only nameserver listed is 127.0.0.1, then we don't need to
rewrite resolv.conf. Otherwise we do some mad stuff. """
- path = os.path.dirname(sys.argv[0])
- subprocess.check_output([os.path.join(path, "resolvmgr"), str(os.getpid())])
+ #path = os.path.dirname(sys.argv[0])
+ #subprocess.check_output([os.path.join(path, "resolvmgr"), str(os.getpid())])
def stopService(self):
service.MultiService.stopService(self) | don't run resolvmgr, it is the problem | yaybu_callsign | train | py |
04e487617a6971922a23f597a66537dc2306b2c3 | diff --git a/commands/command_clone.go b/commands/command_clone.go
index <HASH>..<HASH> 100644
--- a/commands/command_clone.go
+++ b/commands/command_clone.go
@@ -39,7 +39,7 @@ func cloneCommand(cmd *cobra.Command, args []string) {
"speeds to 'git lfs clone'.",
}
- fmt.Fprintln(os.Stderr, strings.Join(msg, "\n")+"\n")
+ fmt.Fprintln(os.Stderr, strings.Join(msg, "\n"))
}
// We pass all args to git clone | commands: remove extraneous trailing LF | git-lfs_git-lfs | train | go |
529b958346f5e2aaeb908f36befcf51269603cca | diff --git a/spec/unique_class.rb b/spec/unique_class.rb
index <HASH>..<HASH> 100644
--- a/spec/unique_class.rb
+++ b/spec/unique_class.rb
@@ -1,8 +1,12 @@
module UniqueClass
@@_counter = 1
+ def self._unique_random_number
+ "#{Time.now.year}#{Time.now.to_i}#{Time.now.usec.to_s[0..2]}".to_i
+ end
+
def self.set(klass, name=nil)
- name ||= "Model_#{@@_counter}"
+ name ||= "Model_#{@@_counter}_#{_unique_random_number}"
@@_counter += 1
klass.class_eval <<-RUBY
def self.to_s | Make sure each test class gets a unique name so that each test session runs in isolation | neo4jrb_neo4j | train | rb |
841f91ef85599d7ada298f90cd54ec22f568b7fc | diff --git a/any_urlfield/models/fields.py b/any_urlfield/models/fields.py
index <HASH>..<HASH> 100644
--- a/any_urlfield/models/fields.py
+++ b/any_urlfield/models/fields.py
@@ -1,6 +1,7 @@
"""
Custom model fields to link to CMS content.
"""
+import django
from django.utils import six
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
@@ -121,11 +122,12 @@ class AnyUrlField(six.with_metaclass(models.SubfieldBase, models.CharField)):
raise ValidationError(self.error_messages['invalid_choice'] % value.type_value)
-# Tell South how to create custom fields
-try:
- from south.modelsinspector import add_introspection_rules
- add_introspection_rules([], [
- "^" + __name__.replace(".", "\.") + "\.AnyUrlField",
- ])
-except ImportError:
- pass
+if django.VERSION < (1,7):
+ # Tell South how to create custom fields
+ try:
+ from south.modelsinspector import add_introspection_rules
+ add_introspection_rules([], [
+ "^" + __name__.replace(".", "\.") + "\.AnyUrlField",
+ ])
+ except ImportError:
+ pass | Avoid importing south in Django <I> projects
This fixes hard to debug errors in Django <I> when south is still in site-packages. | edoburu_django-any-urlfield | train | py |
c311062ada15328f382dad0434a94c0a3602c996 | diff --git a/spec/csound-api-spec.js b/spec/csound-api-spec.js
index <HASH>..<HASH> 100644
--- a/spec/csound-api-spec.js
+++ b/spec/csound-api-spec.js
@@ -586,7 +586,6 @@ describe('Csound instance', () => {
});
setTimeout(() => csound.Stop(Csound), 600);
});
- }
it('performs control periods', done => {
const Csound = csound.Create();
@@ -614,6 +613,7 @@ describe('Csound instance', () => {
done();
});
});
+ }
it('sets message callback', done => {
const Csound = csound.Create(); | Try to fix macOS tests on GitHub Actions | nwhetsell_csound-api | train | js |
5835649fe7e47818983021f7fc8503b8166ffbe9 | diff --git a/i3situation/plugins/cmus.py b/i3situation/plugins/cmus.py
index <HASH>..<HASH> 100644
--- a/i3situation/plugins/cmus.py
+++ b/i3situation/plugins/cmus.py
@@ -52,7 +52,7 @@ class CmusPlugin(Plugin):
# message returned by the process from being output to STDOUT.
cmus_output = subprocess.check_output(['cmus-remote', '-Q'],
stderr=subprocess.STDOUT).decode('utf-8')
- except subprocess.called_process_error:
+ except subprocess.CalledProcessError:
return self.output('Cmus is not running', 'Cmus is not running')
if 'duration' in cmus_output:
status = self.convert_cmus_output(cmus_output) | Fixed a bug caused by my mass renaming frenzy. | HarveyHunt_i3situation | train | py |
8cf036a49d6a5bee901b7dd8b30ba905183134ca | diff --git a/nsqd/guid.go b/nsqd/guid.go
index <HASH>..<HASH> 100644
--- a/nsqd/guid.go
+++ b/nsqd/guid.go
@@ -22,8 +22,8 @@ const (
timestampShift = sequenceBits + workerIDBits
sequenceMask = int64(-1) ^ (int64(-1) << sequenceBits)
- // Thu Nov 4 01:42:54 UTC 2010
- twepoch = int64(1288834974657)
+ // ( 2012-10-28 16:23:42 UTC ).UnixNano() >> 20
+ twepoch = int64(1288834974288)
)
var ErrTimeBackwards = errors.New("time has gone backwards")
@@ -39,7 +39,8 @@ type guidFactory struct {
}
func (f *guidFactory) NewGUID(workerID int64) (guid, error) {
- ts := time.Now().UnixNano() / 1e6
+ // divide by 1048576, giving pseudo-milliseconds
+ ts := time.Now().UnixNano() >> 20
if ts < f.lastTimestamp {
return 0, ErrTimeBackwards | nsqd: optimize NewGUID() division for "milliseconds"
<I>-bit division operations appear to be slow on some
ARM systems, so replace division by <I> with a
bitshift equivalent to division by <I>.
adapt guid twepoch comment for revised guid timestamp scheme | nsqio_nsq | train | go |
efff6ddc2aad3ccbca7a5aaf485d3e0e5a19d557 | diff --git a/salt/modules/file.py b/salt/modules/file.py
index <HASH>..<HASH> 100644
--- a/salt/modules/file.py
+++ b/salt/modules/file.py
@@ -1979,7 +1979,7 @@ def source_list(source, source_hash, saltenv):
proto = salt._compat.urlparse(single_src).scheme
if proto == 'salt':
if single_src[7:] in mfiles or single_src[7:] in mdirs:
- source = single_src
+ ret = (single_src, single_hash)
break
elif proto.startswith('http') or proto == 'ftp':
dest = salt.utils.mkstemp() | Fix regression caused by pull #<I>
Regression tests caught the following:
<URL> | saltstack_salt | train | py |
6fc3c6b3a588df7ca1620b62e58d5e122f44800d | diff --git a/provider/gce/config.go b/provider/gce/config.go
index <HASH>..<HASH> 100644
--- a/provider/gce/config.go
+++ b/provider/gce/config.go
@@ -142,9 +142,9 @@ func (c *environConfig) imageEndpoint() string {
// auth build a new Auth based on the config and returns it.
func (c *environConfig) auth() google.Auth {
return google.Auth{
- ClientID: c.attrs[cfgClientID].(string),
- ClientEmail: c.attrs[cfgClientEmail].(string),
- PrivateKey: []byte(c.attrs[cfgPrivateKey].(string)),
+ ClientID: c.clientID(),
+ ClientEmail: c.clientEmail(),
+ PrivateKey: []byte(c.privateKey()),
}
}
@@ -152,8 +152,8 @@ func (c *environConfig) auth() google.Auth {
// The resulting connection must still have its Connect called.
func (c *environConfig) newConnection() *google.Connection {
return &google.Connection{
- Region: c.attrs[cfgRegion].(string),
- ProjectID: c.attrs[cfgProjectID].(string),
+ Region: c.region(),
+ ProjectID: c.projectID(),
}
} | provider/gce: Use the accessor methods for config fields. | juju_juju | train | go |
ebeec3b21cd8da87ba21169ed3f2773ef13c864a | diff --git a/app/assets/javascripts/IndividualResult.js b/app/assets/javascripts/IndividualResult.js
index <HASH>..<HASH> 100644
--- a/app/assets/javascripts/IndividualResult.js
+++ b/app/assets/javascripts/IndividualResult.js
@@ -39,8 +39,9 @@ const IndividualResultSchema = mongoose.Schema(
},
// Relations to other model classes
- measure: { type: ObjectId, ref: 'Measure' },
- patient: { type: ObjectId, ref: 'Patient' },
+ // 'alias' field makes it so you can call obj.measure, and get the object referenced by measure_id
+ measure_id: { type: ObjectId, ref: 'Measure', alias: 'measure' },
+ patient_id: { type: ObjectId, ref: 'Patient', alias: 'patient' },
},
// Options | Update field names for measure and patient refs | projecttacoma_cqm-models | train | js |
cbd8847e299c12a1a1dafd014bebb7b6cc83af3d | diff --git a/scala/orca/src/main/java/com/intel/analytics/bigdl/orca/inference/AbstractInferenceModel.java b/scala/orca/src/main/java/com/intel/analytics/bigdl/orca/inference/AbstractInferenceModel.java
index <HASH>..<HASH> 100644
--- a/scala/orca/src/main/java/com/intel/analytics/bigdl/orca/inference/AbstractInferenceModel.java
+++ b/scala/orca/src/main/java/com/intel/analytics/bigdl/orca/inference/AbstractInferenceModel.java
@@ -54,6 +54,15 @@ public abstract class AbstractInferenceModel {
this.model = InferenceModelFactory.loadFloatInferenceModel(modelPath, weightPath);
}
+ @Deprecated
+ public List<Float> predict(List<Float> input, int... shape) {
+ List<Integer> inputShape = new ArrayList<Integer>();
+ for (int s : shape) {
+ inputShape.add(s);
+ }
+ return model.predict(input, inputShape);
+ }
+
public List<List<JTensor>> predict(List<JTensor> inputs) {
return model.predict(inputs);
} | deprecate single record predict method (#<I>) | intel-analytics_BigDL | train | java |
0c28cd69b5d4ce090359644a1dbb5701ff62f90f | diff --git a/lib/ryodo/methods.rb b/lib/ryodo/methods.rb
index <HASH>..<HASH> 100644
--- a/lib/ryodo/methods.rb
+++ b/lib/ryodo/methods.rb
@@ -8,5 +8,10 @@ module Ryodo
end
alias_method :[], :parse
+ def domain_valid? domain_string
+ parsed = self.parse(domain_string)
+ !!parsed.tld && !!parsed.domain
+ end
+
end
end
\ No newline at end of file | Add Ryodo.domain_valid?(dom), closes #2 | asaaki_ryodo | train | rb |
b15b8725ab5ef98e97085e5c5c09ecc35a86bf10 | diff --git a/src/Component/Checker/ClaimCheckerManagerFactory.php b/src/Component/Checker/ClaimCheckerManagerFactory.php
index <HASH>..<HASH> 100644
--- a/src/Component/Checker/ClaimCheckerManagerFactory.php
+++ b/src/Component/Checker/ClaimCheckerManagerFactory.php
@@ -43,7 +43,7 @@ final class ClaimCheckerManagerFactory
}
/**
- * @param string $alias
+ * @param string $alias
* @param ClaimChecker $checker
*
* @return ClaimCheckerManagerFactory
diff --git a/src/Component/Checker/HeaderCheckerManagerFactory.php b/src/Component/Checker/HeaderCheckerManagerFactory.php
index <HASH>..<HASH> 100644
--- a/src/Component/Checker/HeaderCheckerManagerFactory.php
+++ b/src/Component/Checker/HeaderCheckerManagerFactory.php
@@ -48,7 +48,7 @@ final class HeaderCheckerManagerFactory
}
/**
- * @param string $alias
+ * @param string $alias
* @param HeaderChecker $checker
*
* @return HeaderCheckerManagerFactory | Apply fixes from StyleCI (#<I>)
[ci skip] [skip ci] | web-token_jwt-framework | train | php,php |
d9f44fa73097cf0ed9e888b82fb2478a6a537cdd | diff --git a/help.js b/help.js
index <HASH>..<HASH> 100644
--- a/help.js
+++ b/help.js
@@ -2,7 +2,7 @@ var exec = require('./utils').exec
;
module.exports = function() {
- var manpath = '.'
+ var manpath = __dirname
, env = {};
Object.keys(process.env).forEach(function (i) { env[i] = process.env[i] });
env.MANPATH = manpath; | Fix MANPATH in dev mode. | francois2metz_node-intervals | train | js |
c4531d4d7573eb8a98fae692804e87fc50170eab | diff --git a/pmovie.py b/pmovie.py
index <HASH>..<HASH> 100755
--- a/pmovie.py
+++ b/pmovie.py
@@ -77,6 +77,8 @@ pool.close();
results = np.array(results);
d = d[results];
frame['data'] = d;
+Frame['valid'] = results == 0;
+frame['valid'][0] = True;
outname = "points{}.pt".format(frame['step']);
vprint('outputting {}'.format(outname)); | pmovie now has information whether it the search is valid | noobermin_lspreader | train | py |
cbe61e307ff6ed75d578521315e994ca4ee9e292 | diff --git a/h2o-automl/src/main/java/ai/h2o/automl/AutoML.java b/h2o-automl/src/main/java/ai/h2o/automl/AutoML.java
index <HASH>..<HASH> 100644
--- a/h2o-automl/src/main/java/ai/h2o/automl/AutoML.java
+++ b/h2o-automl/src/main/java/ai/h2o/automl/AutoML.java
@@ -254,7 +254,7 @@ public final class AutoML extends Keyed<AutoML> implements TimedH2ORunnable {
public AutoMLKeyV3(Key<AutoML> key) { super(key); }
}
-// @Override public Class<AutoMLKeyV3> makeSchema() { return AutoMLKeyV3.class; }
+ @Override public Class<AutoMLKeyV3> makeSchema() { return AutoMLKeyV3.class; }
private class AutoMLDoneException extends H2OAbstractRuntimeException {
public AutoMLDoneException() { this("done","done"); } | Get automl working again from Python. | h2oai_h2o-3 | train | java |
6b18dee309c0d88d5a848307a664048d74be9e3e | diff --git a/src/deprecated/platformSpecificDeprecated.ios.js b/src/deprecated/platformSpecificDeprecated.ios.js
index <HASH>..<HASH> 100644
--- a/src/deprecated/platformSpecificDeprecated.ios.js
+++ b/src/deprecated/platformSpecificDeprecated.ios.js
@@ -35,6 +35,39 @@ async function startTabBasedApp(params) {
params.tabs[index].components = components;
Object.assign(tab, components[0]);
components.shift();
+
+ components.forEach(component => {
+ const screenInstanceID = _.uniqueId('screenInstanceID');
+
+ const {
+ navigatorStyle,
+ navigatorButtons,
+ navigatorEventID
+ } = _mergeScreenSpecificSettings(component.screen, screenInstanceID, params);
+ _saveNavigatorButtonsProps(navigatorButtons);
+ _saveNavBarComponentProps(navigatorStyle);
+ const passProps = Object.assign({}, params.passProps);
+ passProps.navigatorID = navigatorID;
+ passProps.screenInstanceID = screenInstanceID;
+ passProps.navigatorEventID = navigatorEventID;
+
+
+ component.navigationParams = {
+ screenInstanceID,
+ navigatorStyle,
+ navigatorButtons,
+ navigatorEventID,
+ navigatorID: navigatorID,
+ passProps
+ };
+
+ component.subtitle = params.subtitle;
+ component.passProps = passProps;
+
+ savePassProps(component);
+
+ });
+
}
const { | fixed root with depth in startTabBasedApp | wix_react-native-navigation | train | js |
87381932672a8b5a5685aa8f209ea5512c91fee7 | diff --git a/src/main/java/org/primefaces/component/layout/LayoutRenderer.java b/src/main/java/org/primefaces/component/layout/LayoutRenderer.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/primefaces/component/layout/LayoutRenderer.java
+++ b/src/main/java/org/primefaces/component/layout/LayoutRenderer.java
@@ -38,8 +38,6 @@ public class LayoutRenderer extends CoreRenderer {
Layout layout = (Layout) component;
String clientId = layout.getClientId(context);
- encodeScript(context, layout);
-
if (layout.isElementLayout()) {
writer.startElement("div", layout);
writer.writeAttribute("id", clientId, "id");
@@ -57,6 +55,8 @@ public class LayoutRenderer extends CoreRenderer {
if (layout.isElementLayout()) {
writer.endElement("div");
}
+
+ encodeScript(context, layout);
}
protected void encodeScript(FacesContext context, Layout layout) throws IOException { | Fix #<I>: Layout script output in incorrect place. | primefaces_primefaces | train | java |
de22ff3e40e39df5d509bce9061dc67ae0f99442 | diff --git a/modules/wyc/src/wyc/builder/OldCodeGenerator.java b/modules/wyc/src/wyc/builder/OldCodeGenerator.java
index <HASH>..<HASH> 100644
--- a/modules/wyc/src/wyc/builder/OldCodeGenerator.java
+++ b/modules/wyc/src/wyc/builder/OldCodeGenerator.java
@@ -728,6 +728,9 @@ public final class OldCodeGenerator {
private void generate(Assert s, Environment environment, Code.Block codes,
Context context) {
generateAssertion("assertion failed", s.expr, false, environment, codes, context);
+ // TODO: the following is a temporary fix to ensure that manual
+ // assertions and assumed. See #377
+ generateAssertion("assumption failed", s.expr, true, environment, codes, context);
}
private void generate(Assume s, Environment environment, Code.Block codes, | WyC: added an implicit assumption after an assertion so that Code.Asserts don't need to be assumed during verification condition generation. See #<I> | Whiley_WhileyCompiler | train | java |
6a043b53eebf29a23fcee1b743dbdf53749c0e82 | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -165,6 +165,16 @@ type ContainerSpec struct {
// is the same as the root user in the host. Otherwise, the container has a user namespace and the root
// user in the container is mapped to a non-root user in the host. Defaults to false.
Privileged bool `json:"privileged,omitempty"`
+
+ // Limits to be applied to the newly created container.
+ Limits Limits `json:"limits,omitempty"`
+}
+
+type Limits struct {
+ Bandwidth BandwidthLimits `json:"bandwidth_limits,omitempty"`
+ CPU CPULimits `json:"cpu_limits,omitempty"`
+ Disk DiskLimits `json:"disk_limits,omitempty"`
+ Memory MemoryLimits `json:"memory_limits,omitempty"`
}
// BindMount specifies parameters for a single mount point. | Add Limits struct to ContainerSpec [#<I>] | cloudfoundry_garden | train | go |
6f65e91b341f1e2ddb09495f9d1e7df9b7ce9fff | diff --git a/pymatgen/analysis/tests/test_bond_dissociation.py b/pymatgen/analysis/tests/test_bond_dissociation.py
index <HASH>..<HASH> 100644
--- a/pymatgen/analysis/tests/test_bond_dissociation.py
+++ b/pymatgen/analysis/tests/test_bond_dissociation.py
@@ -6,7 +6,6 @@ from __future__ import division, unicode_literals
import unittest
import os
-import copy
from monty.serialization import loadfn
from pymatgen.analysis.bond_dissociation import BondDissociationEnergies
diff --git a/pymatgen/analysis/tests/test_graphs.py b/pymatgen/analysis/tests/test_graphs.py
index <HASH>..<HASH> 100644
--- a/pymatgen/analysis/tests/test_graphs.py
+++ b/pymatgen/analysis/tests/test_graphs.py
@@ -21,6 +21,7 @@ except ImportError:
ob = None
try:
import networkx as nx
+ import networkx.algorithms.isomorphism as iso
except ImportError:
nx = None | Codacy & cleaning up from manual conflict resolve | materialsproject_pymatgen | train | py,py |
072923d8bd924cf08b07deeb89df75045016a22e | diff --git a/mixin.js b/mixin.js
index <HASH>..<HASH> 100644
--- a/mixin.js
+++ b/mixin.js
@@ -8,7 +8,10 @@ var getPath = require('get-object-path');
var unescape = function (content) {
return content.replace(/>/g, '>')
- .replace(/</g, '<');
+ .replace(/</g, '<')
+ .replace(/&/g, '&')
+ .replace(/'/g, '\'')
+ .replace(/"/g, '"');
};
function astAttrsToVdomAttrs(attrs) { | Add additional html entities to be unescaped (for e.g. hogan.js) | AmpersandJS_ampersand-virtual-dom-mixin | train | js |
ba78ba76a3abfab3be9952e913834dbe1a2c3a8b | diff --git a/wpull/options.py b/wpull/options.py
index <HASH>..<HASH> 100644
--- a/wpull/options.py
+++ b/wpull/options.py
@@ -77,12 +77,12 @@ class AppArgumentParser(argparse.ArgumentParser):
action='version',
version=wpull.version.__version__
)
- self.add_argument(
- '-b',
- '--background',
- action='store_true',
- help=_('run as background process')
- )
+# self.add_argument(
+# '-b',
+# '--background',
+# action='store_true',
+# help=_('run as background process')
+# )
# TODO:
# self.add_argument(
# '-e', | Comments out --background which is not yet supported. | ArchiveTeam_wpull | train | py |
4921d03130f1bfaa420b8671ba72ede59e6888c6 | diff --git a/error.go b/error.go
index <HASH>..<HASH> 100644
--- a/error.go
+++ b/error.go
@@ -7,6 +7,8 @@
package facebook
+import "fmt"
+
// Error represents Facebook API error.
type Error struct {
Message string
@@ -21,5 +23,5 @@ type Error struct {
// Error returns error string.
func (e *Error) Error() string {
- return e.Message
+ return fmt.Sprintf("message: %s, error_user_title: %s, error_user_msg: %s", e.Message, e.UserTitle, e.UserMessage)
} | improvement(error): add additional error messages to help debug issues | huandu_facebook | train | go |
880a7b82dc5cb0125eb2fce538d1604bae8f7037 | diff --git a/openquake/baselib/parallel.py b/openquake/baselib/parallel.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/parallel.py
+++ b/openquake/baselib/parallel.py
@@ -233,7 +233,7 @@ class Pickled(object):
def __repr__(self):
"""String representation of the pickled object"""
- return '<Pickled %s %s %s>' % (
+ return '<Pickled %s #%s %s>' % (
self.clsname, self.calc_id, humansize(len(self)))
def __len__(self):
diff --git a/openquake/calculators/ucerf_base.py b/openquake/calculators/ucerf_base.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/ucerf_base.py
+++ b/openquake/calculators/ucerf_base.py
@@ -38,7 +38,7 @@ from openquake.hazardlib import valid
from openquake.hazardlib.sourceconverter import SourceConverter
DEFAULT_TRT = "Active Shallow Crust"
-RUPTURES_PER_BLOCK = 1000
+RUPTURES_PER_BLOCK = 200 # decided by MS
HDD = PMF([(0.2, 3.0), (0.6, 6.0), (0.2, 9.0)])
NPD = PMF([(0.15, NodalPlane(0.0, 90.0, 0.0)),
(0.15, NodalPlane(45.0, 90.0, 0.0)), | Reduced ucerf_base.RUPTURES_PER_BLOCK [skip CI] | gem_oq-engine | train | py,py |
8bb4a532cf5bbfa6ee7c50c98658cbbc0025714a | diff --git a/spec/code/classes/thing.rb b/spec/code/classes/thing.rb
index <HASH>..<HASH> 100644
--- a/spec/code/classes/thing.rb
+++ b/spec/code/classes/thing.rb
@@ -4,6 +4,10 @@ class Thing
1
end
+ def inspect
+ "#<Thing: stuff>"
+ end
+
protected
def not_exposed
diff --git a/spec/code/reference_spec.rb b/spec/code/reference_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/code/reference_spec.rb
+++ b/spec/code/reference_spec.rb
@@ -56,4 +56,8 @@ describe Code::Reference do
it "should raise a NoMethodError when trying to call a protected or private method" do
lambda { @ref.not_exposed }.should raise_error(NoMethodError)
end
+
+ it "should inspect the referenced object when inspect is called" do
+ @ref.inspect.should == '#<Thing: stuff>'
+ end
end | Added a spec for Reference#inspect. | ronin-ruby_ronin | train | rb,rb |
6d4316d98bbbf77d7c71d243d0a0b0e39b20aadf | diff --git a/abilian/web/frontend.py b/abilian/web/frontend.py
index <HASH>..<HASH> 100644
--- a/abilian/web/frontend.py
+++ b/abilian/web/frontend.py
@@ -709,7 +709,11 @@ class Module(object):
# sqlite does not support 'NULLS FIRST|LAST' in ORDER BY clauses
if engine.name != 'sqlite':
nullsorder = nullslast if sort_dir == 'desc' else nullsfirst
- sort_col = nullsorder(sort_col)
+ try:
+ sort_col = nullsorder(sort_col)
+ except:
+ # FIXME
+ pass
sort_cols.append(sort_col) | Workaround another SQLAlchemy regression. | abilian_abilian-core | train | py |
de4a54b8e4c8957f6ef492e4296139e222ed1bf7 | diff --git a/src/store/configureStore.js b/src/store/configureStore.js
index <HASH>..<HASH> 100644
--- a/src/store/configureStore.js
+++ b/src/store/configureStore.js
@@ -17,8 +17,8 @@ const persistConfig = {
const configureStore = (legacyClient, cozyClient, context, options = {}) => {
// Enable Redux dev tools
- const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE || compose
-
+ const composeEnhancers =
+ window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const persistedReducer = persistReducer(
persistConfig,
getReducers(cozyClient) | fix: Redux dev tools working | cozy_cozy-home | train | js |
40a502a1473d57aed472d2678167bc9c3f97d564 | diff --git a/src/UDB2/ActorRepository.php b/src/UDB2/ActorRepository.php
index <HASH>..<HASH> 100644
--- a/src/UDB2/ActorRepository.php
+++ b/src/UDB2/ActorRepository.php
@@ -8,6 +8,7 @@
namespace CultuurNet\UDB3\UDB2;
use Broadway\Repository\AggregateNotFoundException;
+use CultuurNet\Search\Parameter\FilterQuery;
use CultuurNet\Search\Parameter\Query;
/**
@@ -29,7 +30,7 @@ class ActorRepository extends EntityRepository
return array(
new Query('cdbid:' . $id),
- new Query('type:actor')
+ new FilterQuery('type:actor')
);
} | III-<I>: Use filter query to filter on actors | cultuurnet_udb3-php | train | php |
9415c07cd9e86a2c01232ed83a427cbeb6e052bf | diff --git a/main.go b/main.go
index <HASH>..<HASH> 100644
--- a/main.go
+++ b/main.go
@@ -116,7 +116,7 @@ func main() {
log.Error("Unable to create path: %v", err)
}
- s := server.New(path, dbfile, snapAfter, host, port)
+ s := server.NewServer(path, dbfile, snapAfter, host, port)
go func() {
log.Error(s.ListenAndServe(join))
}()
diff --git a/server/server.go b/server/server.go
index <HASH>..<HASH> 100644
--- a/server/server.go
+++ b/server/server.go
@@ -144,7 +144,7 @@ func NewServerDiagnostics() *ServerDiagnostics {
}
// Creates a new server.
-func New(dataDir string, dbfile string, snapAfter int, host string, port int) *Server {
+func NewServer(dataDir string, dbfile string, snapAfter int, host string, port int) *Server {
dbPath := path.Join(dataDir, dbfile)
s := &Server{ | New -> NewServer
More inline with existing conventions. | rqlite_rqlite | train | go,go |
11b8c328d08a2162ec86dac53afcd59a8bdb7b3f | diff --git a/spec/fake_app/fake_app.rb b/spec/fake_app/fake_app.rb
index <HASH>..<HASH> 100644
--- a/spec/fake_app/fake_app.rb
+++ b/spec/fake_app/fake_app.rb
@@ -2,6 +2,7 @@ require 'active_record'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_view/railtie'
+require 'ostruct'
require 'jbuilder'
# config | Fix broken spec
jBuilder <I> is required OpenStruct.
ref: <URL> | amatsuda_active_decorator | train | rb |
fdd494bcafff9ca98a583e705b36f03a2ad91cac | diff --git a/src/framework/src/Helper/PhpHelper.php b/src/framework/src/Helper/PhpHelper.php
index <HASH>..<HASH> 100644
--- a/src/framework/src/Helper/PhpHelper.php
+++ b/src/framework/src/Helper/PhpHelper.php
@@ -39,6 +39,7 @@ class PhpHelper
*/
public static function call($cb, array $args = [])
{
+ $ret = null;
if (\is_object($cb) || (\is_string($cb) && \function_exists($cb))) {
$ret = $cb(...$args);
} elseif (\is_array($cb)) { | Scan bean according to Composer settings (#<I>)
* Parse namespace to dir path according to composer settings
* Update ComposerHelper.php
* Update PhpHelper.php | swoft-cloud_swoft-http-message | train | php |
9025316287e03d2a09ef7f005729a090afa12b2f | diff --git a/src/Context/ContextBuilder.php b/src/Context/ContextBuilder.php
index <HASH>..<HASH> 100644
--- a/src/Context/ContextBuilder.php
+++ b/src/Context/ContextBuilder.php
@@ -32,7 +32,7 @@ class ContextBuilder
*/
public function createFromRequest(HttpRequest $request)
{
- return $this->getContext(['website' => 'ru', 'language' => 'de_DE']);
+ return $this->getContext(['website' => 'ru', 'language' => 'en_US']);
}
/**
diff --git a/src/Http/AbstractHttpRequestHandler.php b/src/Http/AbstractHttpRequestHandler.php
index <HASH>..<HASH> 100644
--- a/src/Http/AbstractHttpRequestHandler.php
+++ b/src/Http/AbstractHttpRequestHandler.php
@@ -125,7 +125,6 @@ abstract class AbstractHttpRequestHandler implements HttpRequestHandler
{
$this->rootSnippetCode = $metaInfo->getRootSnippetCode();
- // todo only add snippets where we can generate a valid key
$snippetCodes = $metaInfo->getPageSnippetCodes();
$this->snippetCodeToKeyMap = array_combine(
$snippetCodes, | Issue #<I>: Change hardcoded context language to en_US so it matches the fixture | lizards-and-pumpkins_catalog | train | php,php |
344151d8835e907572520b6c8145ad5d83e71e1a | diff --git a/Tests/Controller/AdminControllerTest.php b/Tests/Controller/AdminControllerTest.php
index <HASH>..<HASH> 100644
--- a/Tests/Controller/AdminControllerTest.php
+++ b/Tests/Controller/AdminControllerTest.php
@@ -17,19 +17,4 @@ class AdminControllerTest extends WebTestCase
$this->assertEquals( 200, $response->getStatusCode() );
$this->assertContains( '<form class="login"', $response->getContent() );
}
-
-
- public function testIndexPass()
- {
- $client = static::createClient(array(), array(
- 'PHP_AUTH_USER' => 'admin',
- 'PHP_AUTH_PW' => 'adminpass',
- ) );
-
- $client->request( 'GET', '/admin' );
- $response = $client->getResponse();
-
- $this->assertEquals( 302, $response->getStatusCode() );
- $this->assertContains( '/default/jqadm/search/dashboard?lang=en', $response->getContent() );
- }
} | Removed test because basic auth won't work any more | aimeos_aimeos-symfony | train | php |
344c534133c5907cc0ec953040de66d8c55d020a | diff --git a/i18n/i18n.php b/i18n/i18n.php
index <HASH>..<HASH> 100644
--- a/i18n/i18n.php
+++ b/i18n/i18n.php
@@ -2027,13 +2027,14 @@ class i18n extends Object implements TemplateGlobalProvider, Flushable {
* reusing a string which has already been "declared" (using another call to this function,
* with the same class and entity), you can omit it.
* @param string $context (optional) If the string can be difficult to translate by any reason, you can help
- * translators with some more info using this param
- * @param string injectionArray (optional) array of key value pairs that are used to replace corresponding
- * expressions in {curly brackets} in the $string. The injection array can also be
- * used as the their argument to the _t() function
+ * translators with some more info using this param
+ * @param array $injection (optional) array of key value pairs that are used to replace corresponding
+ * expressions in {curly brackets} in the $string. The injection array can also be
+ * used as the their argument to the _t() function. The injection array can be the second,
+ * third or fourth parameter. The function will use the first parameter that is an array
* @return string The translated string, according to the currently set locale {@link i18n::set_locale()}
*/
- public static function _t($entity, $string = "", $context = "", $injection = "") {
+ public static function _t($entity, $string = "", $context = "", $injection = array()) {
if(is_numeric($context) && in_array($context, array(PR_LOW, PR_MEDIUM, PR_HIGH))) {
Deprecation::notice(
'3.0', | _t function parameter documentation fix
This corrects the parameter documentation for the _t function. The docs for the fourth parameter is now declared as an array. This does not break backwards compatibility.
As discussed in #<I> | silverstripe_silverstripe-framework | train | php |
25b7b5c1d72d6bc44fc1435586e15ce11ee8bdcd | diff --git a/gcloud/storage/_helpers.py b/gcloud/storage/_helpers.py
index <HASH>..<HASH> 100644
--- a/gcloud/storage/_helpers.py
+++ b/gcloud/storage/_helpers.py
@@ -112,10 +112,7 @@ class _PropertyMixin(object):
message = "Use '%s' or related methods instead." % custom
raise KeyError((field, message))
- if not self._properties or field not in self._properties:
- self._reload_properties()
-
- return self._properties.get(field, default)
+ return self.properties.get(field, default)
def get_acl(self):
"""Get ACL as an object. | Use 'properties' to ensure loading before lookup. | googleapis_google-cloud-python | train | py |
0c03a90e160f5562f758c99f9453bf97ce6cccce | 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
@@ -9,6 +9,7 @@ require 'awesome_print'
RSpec.configure do |config|
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
+ config.use_transactional_fixtures = true
end
class TestController | use transactional fixtures, so we don't need to clean up records | flyerhzm_switch_user | train | rb |
b7c7ef2f37259bd3eed39454cbcb344352ff5d9a | diff --git a/util.go b/util.go
index <HASH>..<HASH> 100644
--- a/util.go
+++ b/util.go
@@ -1,22 +1,16 @@
package cuckoofilter
import (
- "encoding/binary"
-
"github.com/dgryski/go-metro"
)
func getAltIndex(fp byte, i uint, numBuckets uint) uint {
- bytes := []byte{0, 0, 0, 0, 0, 0, 0, fp}
- hash := binary.LittleEndian.Uint64(bytes)
- return uint(uint64(i)^(hash*0x5bd1e995)) % numBuckets
+ hash := uint(metro.Hash64([]byte{fp}, 1337))
+ return (i ^ hash) % numBuckets
}
func getFingerprint(data []byte) byte {
- fp := byte(metro.Hash64(data, 1337))
- if fp == 0 {
- fp += 7
- }
+ fp := byte(metro.Hash64(data, 1335)%255 + 1)
return fp
} | use different hashing algorithm for fingerprint | seiflotfy_cuckoofilter | train | go |
31fa5a616bb529c194b1b5b69d4798c9b332e422 | diff --git a/connection.js b/connection.js
index <HASH>..<HASH> 100644
--- a/connection.js
+++ b/connection.js
@@ -178,6 +178,8 @@ function Connection(client, server) {
this.data_post_start = null;
this.proxy = false;
this.proxy_timer = false;
+ this.max_line_length = config.get('max_line_length') || 512;
+ this.max_data_line_length = config.get('max_data_line_length') || 992;
setupClient(this);
}
@@ -293,9 +295,12 @@ Connection.prototype._process_data = function() {
// connection is dropped; we'll end up in the function forever.
if (this.state >= states.STATE_DISCONNECTING) return;
- var maxlength = config.get('max_line_length') || 512;
+ var maxlength;
if (this.state === states.STATE_PAUSE_DATA || this.state === states.STATE_DATA) {
- maxlength = config.get('max_data_line_length') || 992;
+ maxlength = this.max_data_line_length;
+ }
+ else {
+ maxlength = this.max_line_length;
}
var offset; | Get line limits once per connection instead of per-line | haraka_Haraka | train | js |
f9365fd5425c4d7f0bad9733d4fb0bbfb82b66f6 | diff --git a/btcec.go b/btcec.go
index <HASH>..<HASH> 100644
--- a/btcec.go
+++ b/btcec.go
@@ -658,7 +658,7 @@ func (curve *KoblitzCurve) QPlus1Div4() *big.Int {
return curve.q
}
-// Curve parameters taken from: http://www.secg.org/collateral/sec2_final.pdf
+// Curve parameters taken from: http://www.secg.org/sec2-v2.pdf
var initonce sync.Once
var secp256k1 KoblitzCurve | Update btcec.go
Updated link to SEC 2: Recommended Elliptic Curve Domain Parameters standard (URL given no longer exists). | btcsuite_btcd | train | go |
df65699d9348721fba67e265e3503bf8592adf2b | diff --git a/src/urh/signalprocessing/encoder.py b/src/urh/signalprocessing/encoder.py
index <HASH>..<HASH> 100755
--- a/src/urh/signalprocessing/encoder.py
+++ b/src/urh/signalprocessing/encoder.py
@@ -666,11 +666,9 @@ class Encoder(object):
@staticmethod
def enocean_checksum8(inpt):
hash = 0
- print(inpt[-8:], inpt)
for i in range(0, len(inpt) - 8, 8):
hash += int("".join(map(str, map(int, inpt[i:i + 8]))), 2)
- # hash += int("".join(map(str, map(int, val[i+8:i:-1]))), 2)
- return hash % 256
+ return list(map(bool, map(int, "{0:08b}".format(hash % 256))))
@staticmethod
def enocean_crc8(inpt): | return checksum 8 as list of bool | jopohl_urh | train | py |
984a7dbc0a72764905db6f2c082adfad96eb2142 | diff --git a/cider/_sh.py b/cider/_sh.py
index <HASH>..<HASH> 100644
--- a/cider/_sh.py
+++ b/cider/_sh.py
@@ -120,14 +120,14 @@ class Defaults(object):
@staticmethod
def key_type(value):
- key_types = {
- bool: "-bool",
- float: "-float",
- int: "-int"
- }
+ key_types = [
+ (bool, "-bool"),
+ (float, "-float"),
+ (int, "-int")
+ ]
return next(
- (k for t, k in sorted(key_types.items()) if isinstance(value, t)),
+ (k for t, k in key_types if isinstance(value, t)),
"-string"
) | Fix Python3 compatibility issue in apply_defaults (#<I>) | msanders_cider | train | py |
ecb4281eb41970e1dac002f5530fc650beb9aaf0 | diff --git a/nMemcached.js b/nMemcached.js
index <HASH>..<HASH> 100644
--- a/nMemcached.js
+++ b/nMemcached.js
@@ -259,6 +259,11 @@ Client.config = {
// combines the stats array, in to an object
stats: function( resultSet, err, S ){
var response = {};
+
+ // add references to the retrieved server
+ response.server = S.server;
+
+ // Fill the object
resultSet.forEach(function( statSet ){
response[ statSet[0] ] = statSet[1];
}); | Added server location to the stats so user can see where what server did what | 3rd-Eden_memcached | train | js |
48dcee9d60459fce1542d11536d465f5d89cff55 | diff --git a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php
+++ b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php
@@ -65,12 +65,12 @@ EOT
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
{
- $output->write('ATTENTION: This operation should not be executed in a production environment.' . PHP_EOL . PHP_EOL);
-
if ($input->getOption('dump-sql') === true) {
$sqls = $schemaTool->getCreateSchemaSql($metadatas);
- $output->write(implode(';' . PHP_EOL, $sqls) . PHP_EOL);
+ $output->write(implode(';' . PHP_EOL, $sqls) . ';' . PHP_EOL);
} else {
+ $output->write('ATTENTION: This operation should not be executed in a production environment.' . PHP_EOL . PHP_EOL);
+
$output->write('Creating database schema...' . PHP_EOL);
$schemaTool->createSchema($metadatas);
$output->write('Database schema created successfully!' . PHP_EOL); | [DDC-<I>] Removed non-SQL message and improve exportability of SchemaTool CreateCommand. | doctrine_orm | train | php |
eaa3f4d6142dbc53fec742e786e7a58db25ef975 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ for scheme in list(INSTALL_SCHEMES.values()):
scheme['data'] = scheme['purelib']
setup(name='purr',
- version='1.5.0',
+ version='1.5.1',
description='Data reduction logging tool, Useful for remembering reductions',
author='Oleg Smirnov',
author_email='Oleg Smirnov <osmirnov@gmail.com>', | Update setup.py
Correct version number to latest release | ska-sa_purr | train | py |
6f35b03580dc10975fc481e8ee16f73ff0f37c73 | diff --git a/write.go b/write.go
index <HASH>..<HASH> 100644
--- a/write.go
+++ b/write.go
@@ -131,19 +131,28 @@ func (w *Writer) writeLiteral(l Literal) error {
return w.writeString(nilAtom)
}
+ // If we expect a continuation request, start to wait for it now
+ var continues chan bool
+ if w.continues != nil {
+ continues = make(chan bool, 1)
+ go func() {
+ continues <- <-w.continues
+ }()
+ }
+
header := string(literalStart) + strconv.Itoa(l.Len()) + string(literalEnd) + crlf
if err := w.writeString(header); err != nil {
return err
}
// If a channel is available, wait for a continuation request before sending data
- if w.continues != nil {
+ if continues != nil {
// Make sure to flush the writer, otherwise we may never receive a continuation request
if err := w.Flush(); err != nil {
return err
}
- if !<-w.continues {
+ if !<-continues {
return fmt.Errorf("imap: cannot send literal: no continuation request received")
}
} | Attempt to fix #<I> | emersion_go-imap | train | go |
5bdbf9a71ca513a092269866eb6871881337dce6 | diff --git a/expr/test.go b/expr/test.go
index <HASH>..<HASH> 100644
--- a/expr/test.go
+++ b/expr/test.go
@@ -55,11 +55,18 @@ func equalSeries(exp, got models.Series) error {
return fmt.Errorf("output expected %d, got %d", len(exp.Datapoints), len(got.Datapoints))
}
for j, p := range got.Datapoints {
- bothNaN := math.IsNaN(p.Val) && math.IsNaN(exp.Datapoints[j].Val)
- if (bothNaN || p.Val == exp.Datapoints[j].Val) && p.Ts == exp.Datapoints[j].Ts {
+ if (doubleFuzzyEqual(p.Val, exp.Datapoints[j].Val)) && p.Ts == exp.Datapoints[j].Ts {
continue
}
return fmt.Errorf("point %d - expected %v got %v", j, exp.Datapoints[j], p)
}
return nil
}
+
+func doubleFuzzyEqual(a, b float64) bool {
+ if math.IsNaN(a) && math.IsNaN(b) {
+ return true
+ }
+ var epsilon = 1e-10
+ return a == b || math.Abs(a-b) < epsilon
+} | Add epsilon to double comparisons | grafana_metrictank | train | go |
e091cc2059f3db4ea34f8de8e7f0d9e975d7512b | diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/version.rb
+++ b/lib/puppet/version.rb
@@ -7,7 +7,7 @@
module Puppet
- PUPPETVERSION = '3.7.5'
+ PUPPETVERSION = '3.8.0'
##
# version is a public API method intended to always provide a fast and | (maint) Update puppet version to <I> | puppetlabs_puppet | train | rb |
d8bd6b70ce49f38d6282da2ae30640814de4de61 | diff --git a/plugin/plugin.go b/plugin/plugin.go
index <HASH>..<HASH> 100644
--- a/plugin/plugin.go
+++ b/plugin/plugin.go
@@ -70,7 +70,7 @@ type Service interface {
}
var register = struct {
- sync.Mutex
+ sync.RWMutex
r []*Registration
}{}
@@ -103,24 +103,28 @@ func Register(r *Registration) {
// Graph returns an ordered list of registered plugins for initialization
func Graph() (ordered []*Registration) {
+ register.RLock()
+ defer register.RUnlock()
+
+ added := map[*Registration]bool{}
for _, r := range register.r {
- children(r.Requires, &ordered)
- if !r.added {
+ children(r.Requires, added, &ordered)
+ if !added[r] {
ordered = append(ordered, r)
- r.added = true
+ added[r] = true
}
}
return ordered
}
-func children(types []Type, ordered *[]*Registration) {
+func children(types []Type, added map[*Registration]bool, ordered *[]*Registration) {
for _, t := range types {
for _, r := range register.r {
if r.Type == t {
- children(r.Requires, ordered)
- if !r.added {
+ children(r.Requires, added, ordered)
+ if !added[r] {
*ordered = append(*ordered, r)
- r.added = true
+ added[r] = true
}
}
} | plugin: allow querying plugin graph to be re-entrant | containerd_containerd | train | go |
477c885cc23538954da6cac72c2a84a939783733 | diff --git a/prow/git/localgit/localgit.go b/prow/git/localgit/localgit.go
index <HASH>..<HASH> 100644
--- a/prow/git/localgit/localgit.go
+++ b/prow/git/localgit/localgit.go
@@ -103,7 +103,11 @@ func (lg *LocalGit) MakeFakeRepo(org, repo string) error {
func (lg *LocalGit) AddCommit(org, repo string, files map[string][]byte) error {
rdir := filepath.Join(lg.Dir, org, repo)
for f, b := range files {
- if err := ioutil.WriteFile(filepath.Join(rdir, f), b, os.ModePerm); err != nil {
+ path := filepath.Join(rdir, f)
+ if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil {
+ return err
+ }
+ if err := ioutil.WriteFile(path, b, os.ModePerm); err != nil {
return err
}
if err := runCmd(lg.Git, rdir, "add", f); err != nil { | Fix localgit to allow files that are not in repo root. | kubernetes_test-infra | train | go |
368b7fbe1464b920afc663df3d6ceb552fd3a67a | diff --git a/Manager.php b/Manager.php
index <HASH>..<HASH> 100644
--- a/Manager.php
+++ b/Manager.php
@@ -19,7 +19,7 @@
*/
namespace Queryyetsimple\Session;
-use Queryyetsimple\Support\Manager as SupportManager;
+use Queryyetsimple\Manager\Manager as Managers;
/**
* manager 入口
@@ -29,7 +29,7 @@ use Queryyetsimple\Support\Manager as SupportManager;
* @since 2017.02.15
* @version 1.0
*/
-class Manager extends SupportManager
+class Manager extends Managers
{
/** | manager out and add ps<I> | hunzhiwange_framework | train | php |
aa3174368b1fb8d0180d1218ff3c1f6e7a88338b | diff --git a/lib/bumbleworks/ruote.rb b/lib/bumbleworks/ruote.rb
index <HASH>..<HASH> 100644
--- a/lib/bumbleworks/ruote.rb
+++ b/lib/bumbleworks/ruote.rb
@@ -57,7 +57,7 @@ module Bumbleworks
while dashboard.processes.count > 0
if (Time.now - start_time) > options[:timeout]
error_type = options[:method] == :cancel ? CancelTimeout : KillTimeout
- raise error_type, "Process #{options[:method]} taking too long - #{dashboard.processes.count} processes remain"
+ raise error_type, "Process #{options[:method]} taking too long - #{dashboard.processes.count} processes remain. Errors: #{dashboard.errors}"
end
sleep 0.1
end | Display errors when kill or cancel not working | bumbleworks_bumbleworks | train | rb |
b8bb80a0892a9a940e699d44b4269417ace50da9 | diff --git a/install.js b/install.js
index <HASH>..<HASH> 100644
--- a/install.js
+++ b/install.js
@@ -29,6 +29,14 @@ const revisionInfo = Downloader.revisionInfo(platform, revision);
if (revisionInfo.downloaded)
return;
+// Override current environment proxy settings with npm configuration, if any.
+const NPM_HTTPS_PROXY = process.env.npm_config_https_proxy || process.env.npm_config_proxy;
+const NPM_HTTP_PROXY = process.env.npm_config_http_proxy || process.env.npm_config_proxy;
+if (NPM_HTTPS_PROXY)
+ process.env.HTTPS_PROXY = NPM_HTTPS_PROXY;
+if (NPM_HTTP_PROXY)
+ process.env.HTTP_PROXY = NPM_HTTP_PROXY;
+
const allRevisions = Downloader.downloadedRevisions();
Downloader.downloadRevision(platform, revision, onProgress)
.then(onSuccess) | support npm proxy configuration for the installation script (#<I>)
This patch starts supporting NPM proxy configuration in the installation script.
If both NPM proxy and environment proxy are set, NPM proxy settings are preferred.
Fixes #<I> | GoogleChrome_puppeteer | train | js |
d073443351ff966f618eaaf1af99f3976e59e75e | diff --git a/lib/worker.js b/lib/worker.js
index <HASH>..<HASH> 100644
--- a/lib/worker.js
+++ b/lib/worker.js
@@ -99,6 +99,8 @@ var buildPrompt = function(envString) {
data: results || env.PS1 || impromptu.fallback()
})
+ if (err) impromptu.log.error('worker error', err)
+
// Run the background update.
// We synchronously perform the background update to optimize for speed of prompt
// generation. Reusing the process allows us to conserve memory while the socket | Properly log worker errors in the build method. | impromptu_impromptu | train | js |
c198096d133eba6f44ebf79c39c4d92302e537ae | diff --git a/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb b/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb
index <HASH>..<HASH> 100644
--- a/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb
+++ b/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb
@@ -1,7 +1,8 @@
class ReplaceArfReportBreakdownView < ActiveRecord::Migration
def self.up
+ execute 'DROP VIEW scaptimony_arf_report_breakdowns' if table_exists? 'scaptimony_arf_report_breakdowns'
execute <<-SQL
-CREATE OR REPLACE VIEW scaptimony_arf_report_breakdowns AS
+CREATE VIEW scaptimony_arf_report_breakdowns AS
SELECT
arf.id as arf_report_id,
COUNT(CASE WHEN result.name IN ('pass','fixed') THEN 1 ELSE null END) as passed, | fixes issue #<I> - support creating view in sqlite3 database | OpenSCAP_scaptimony | train | rb |
792950e3931b94448f104321cc229a6a492f0957 | diff --git a/src/server/pps/server/worker_rc.go b/src/server/pps/server/worker_rc.go
index <HASH>..<HASH> 100644
--- a/src/server/pps/server/worker_rc.go
+++ b/src/server/pps/server/worker_rc.go
@@ -127,6 +127,9 @@ func (a *apiServer) workerPodSpec(options *workerOptions, pipelineInfo *pps.Pipe
}, {
Name: "GC_PERCENT",
Value: strconv.FormatInt(int64(a.gcPercent), 10),
+ }, {
+ Name: "POSTGRES_DATABASE_NAME",
+ Value: a.env.Config().PostgresDBName,
}}
sidecarEnv = append(sidecarEnv, assets.GetSecretEnvVars(a.storageBackend)...)
sidecarEnv = append(sidecarEnv, a.getStorageEnvVars(pipelineInfo)...) | Add postgres database to sidecar environment (#<I>) | pachyderm_pachyderm | train | go |
71c2bfdad410566b47fb1d0ce72a29e2b6240152 | diff --git a/zinnia/plugins/__init__.py b/zinnia/plugins/__init__.py
index <HASH>..<HASH> 100644
--- a/zinnia/plugins/__init__.py
+++ b/zinnia/plugins/__init__.py
@@ -1 +1,8 @@
"""Plugins for Zinnia"""
+import warnings
+
+warnings.warn(
+ "'zinnia.plugins' module is deprecated ; use 'cmsplugin_zinnia' instead.",
+ PendingDeprecationWarning
+ )
+ | adding warning about depreacation of zinnia.plugins | Fantomas42_django-blog-zinnia | train | py |
381f142e7a6638a54ec255bd30892b33c2c516b8 | diff --git a/assets/js/directives/forms.js b/assets/js/directives/forms.js
index <HASH>..<HASH> 100644
--- a/assets/js/directives/forms.js
+++ b/assets/js/directives/forms.js
@@ -86,4 +86,26 @@ zaa.directive('zaaInputSelect', function(){
return '<select ng-options="item.value as item.label for item in options" ng-model="model" >';
}
}
+});
+
+zaa.directive('zaaDatepicker', function() {
+ return {
+ restrict : 'E',
+ transclude : false,
+ replace : true,
+ scope : {
+ "model" : "=",
+ "name" : "=",
+ "options" : "="
+ },
+
+ controller : function($scope)
+ {
+
+ },
+
+ template: function(){
+ /* TBD */
+ }
+ }
});
\ No newline at end of file | [+] added empty datepicker placeholder zaa forms | luyadev_luya-module-admin | train | js |
f7c42268f6a99ab4cb3c503b2b30389ed371fe4a | diff --git a/system/Throttle/Throttler.php b/system/Throttle/Throttler.php
index <HASH>..<HASH> 100644
--- a/system/Throttle/Throttler.php
+++ b/system/Throttle/Throttler.php
@@ -100,7 +100,7 @@ class Throttler implements ThrottlerInterface
// If it hasn't been created, then we'll set it to the maximum
// capacity - 1, and save it to the cache.
$this->cache->save($tokenName, $capacity - $cost, $seconds);
- $this->cache->save($tokenName . 'Time', time(), $seconds);
+ $this->cache->save($tokenName . 'Time', $this->time(), $seconds);
return true;
}
@@ -129,7 +129,7 @@ class Throttler implements ThrottlerInterface
// we need to decrement the number of available tokens.
if ($tokens >= 1) {
$this->cache->save($tokenName, $tokens - $cost, $seconds);
- $this->cache->save($tokenName . 'Time', time(), $seconds);
+ $this->cache->save($tokenName . 'Time', $this->time(), $seconds);
return true;
}
@@ -164,6 +164,8 @@ class Throttler implements ThrottlerInterface
/**
* Return the test time, defaulting to current.
+ *
+ * @TODO should be private
*/
public function time(): int
{ | fix: use $this->time() instead of time()
For testing, we need to use testTime in all places. | codeigniter4_CodeIgniter4 | train | php |
9a65a80589bc37390ea0d2330cf00a70e5923d82 | diff --git a/core/selection.js b/core/selection.js
index <HASH>..<HASH> 100644
--- a/core/selection.js
+++ b/core/selection.js
@@ -38,12 +38,17 @@ class Selection {
if (native.start.node === this.cursor.textNode) return; // cursor.restore() will handle
this.emitter.once(Emitter.events.SCROLL_UPDATE, () => {
try {
- this.setNativeRange(
- native.start.node,
- native.start.offset,
- native.end.node,
- native.end.offset,
- );
+ if (
+ this.root.contains(native.start.node) &&
+ this.root.contains(native.end.node)
+ ) {
+ this.setNativeRange(
+ native.start.node,
+ native.start.offset,
+ native.end.node,
+ native.end.offset,
+ );
+ }
this.update(Emitter.sources.SILENT);
} catch (ignored) {
// ignore | add guard for selection setting
closes #<I> | quilljs_quill | train | js |
162dc7754109926c133450eddea1d54f02324374 | diff --git a/lib/transforms/drawGraph.js b/lib/transforms/drawGraph.js
index <HASH>..<HASH> 100644
--- a/lib/transforms/drawGraph.js
+++ b/lib/transforms/drawGraph.js
@@ -26,7 +26,9 @@ var relationLabelByType = {
JavaScriptAmdRequire: 'require',
CssImage: 'background-image',
CssImport: '@import',
- CssBehavior: 'behavior'
+ CssBehavior: 'behavior',
+ CssFontFaceSrc: '@font-face src',
+ CssAlphaImageLoader: 'AlphaImageLoader'
};
module.exports = function (targetFileName) { | transforms.drawGraph: Added more relation labels. | assetgraph_assetgraph | train | js |
4ec921264c7f62aca015536344ba19c59ceb602e | diff --git a/dipper/models/Genotype.py b/dipper/models/Genotype.py
index <HASH>..<HASH> 100644
--- a/dipper/models/Genotype.py
+++ b/dipper/models/Genotype.py
@@ -383,9 +383,15 @@ class Genotype():
"""
- if part_relationship is None:
+ # Fail loudly if parent or child identifiers are None
+ if parent_id is None:
+ raise TypeError('Attempt to pass None as parent')
+ elif part_id is None:
+ raise TypeError('Attempt to pass None as child')
+ elif part_relationship is None:
part_relationship = self.properties['has_part']
+
self.graph.addTriple(parent_id, part_relationship, part_id)
return | fail hard if None is propagating (force upstream fix) | monarch-initiative_dipper | train | py |
98210f4700c7b6ca0a06732f6ea149a363214173 | diff --git a/gremlin/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/IoTest.java b/gremlin/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/IoTest.java
index <HASH>..<HASH> 100644
--- a/gremlin/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin/gremlin-test/src/main/java/com/tinkerpop/gremlin/structure/IoTest.java
@@ -11,6 +11,7 @@ import com.tinkerpop.gremlin.structure.io.kryo.KryoReader;
import com.tinkerpop.gremlin.structure.io.kryo.KryoWriter;
import com.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.commons.configuration.Configuration;
+import org.junit.Ignore;
import org.junit.Test;
import javax.xml.XMLConstants;
@@ -200,6 +201,7 @@ public class IoTest extends AbstractGremlinTest {
});
}
+ @Ignore
@Test
@FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
public void shouldReadWriteVertexNoEdgesToKryo() throws Exception { | Ignore on a failing Kryo test -- STEPHEN. | apache_tinkerpop | train | java |
f78cfb853a3f65c122d04f702ab6cdd61454bcb0 | diff --git a/packages/workbox-webpack-plugin/src/inject-manifest.js b/packages/workbox-webpack-plugin/src/inject-manifest.js
index <HASH>..<HASH> 100644
--- a/packages/workbox-webpack-plugin/src/inject-manifest.js
+++ b/packages/workbox-webpack-plugin/src/inject-manifest.js
@@ -78,10 +78,6 @@ class InjectManifest {
* [the same rules](https://webpack.js.org/configuration/module/#condition)
* as `webpack`'s standard `exclude` option.
*
- * @param {Array<string>} [config.importScriptsViaChunks] One or more names of
- * webpack chunks. The content of those chunks will be included in the
- * generated service worker, via a call to `importScripts()`.
- *
* @param {Array<string>} [config.excludeChunks] One or more chunk names whose
* corresponding output files should be excluded from the precache manifest.
* | Remove importScriptsViaChunks JSDoc (#<I>) | GoogleChrome_workbox | train | js |
966a55959cd1f7d0613aef3fddc5cdf939e142ac | diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index <HASH>..<HASH> 100644
--- a/sqlparse/sql.py
+++ b/sqlparse/sql.py
@@ -493,7 +493,7 @@ class TypedLiteral(TokenList):
"""A typed literal, such as "date '2001-09-28'" or "interval '2 hours'"."""
M_OPEN = T.Name.Builtin, None
M_CLOSE = T.String.Single, None
- M_EXTEND = T.Keyword, ("DAY", "MONTH", "YEAR", "HOUR", "MINUTE", "SECOND")
+ M_EXTEND = T.Keyword, ("DAY", "MINUTE", "MONTH", "SECOND", "TIMESTAMP", "YEAR")
class Parenthesis(TokenList): | [sql] Adding TIMESTAMP to typed literal | andialbrecht_sqlparse | train | py |
d86dd000305a40cc0649ea9b3eb04fe0da19f42e | diff --git a/Gemfile.lock b/Gemfile.lock
index <HASH>..<HASH> 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- ruby_reportable (0.0.2)
+ ruby_reportable (0.1.2)
GEM
remote: http://rubygems.org/
diff --git a/lib/ruby_reportable/report.rb b/lib/ruby_reportable/report.rb
index <HASH>..<HASH> 100644
--- a/lib/ruby_reportable/report.rb
+++ b/lib/ruby_reportable/report.rb
@@ -54,7 +54,7 @@ module RubyReportable
end
def output(name, options = {}, &block)
- @outputs << RubyReportable::Output.new(name, options, block)
+ @outputs << RubyReportable::Output.new(name, options, block) if options[:hidden].nil? || options[:hidden] == false
end
diff --git a/lib/ruby_reportable/version.rb b/lib/ruby_reportable/version.rb
index <HASH>..<HASH> 100644
--- a/lib/ruby_reportable/version.rb
+++ b/lib/ruby_reportable/version.rb
@@ -1,3 +1,3 @@
module RubyReportable
- VERSION = "0.1.1"
+ VERSION = "0.1.2"
end | add the ability to selectively hide an output field by passing :hidden => true in the options hash | asceth_ruby_reportable | train | lock,rb,rb |
0306afaa84408d4649f2126b8a8d5c96a13b0900 | diff --git a/chef/lib/chef/index_queue/amqp_client.rb b/chef/lib/chef/index_queue/amqp_client.rb
index <HASH>..<HASH> 100644
--- a/chef/lib/chef/index_queue/amqp_client.rb
+++ b/chef/lib/chef/index_queue/amqp_client.rb
@@ -76,7 +76,7 @@ class Chef
end
def queue_for_object(obj_id)
- vnode_tag = UUIDTools::UUID.parse(obj_id).to_i % VNODES
+ vnode_tag = obj_id_to_int(obj_id) % VNODES
queue = amqp_client.queue("vnode-#{vnode_tag}")
retries = 0
begin
@@ -94,6 +94,15 @@ class Chef
end
private
+
+ # Sometimes object ids are "proper" UUIDs, like "64bc00eb-120b-b6a2-ec0e-34fc90d151be"
+ # and sometimes they omit the dashes, like "64bc00eb120bb6a2ec0e34fc90d151be"
+ # UUIDTools uses different methods to parse the different styles.
+ def obj_id_to_int(obj_id)
+ UUIDTools::UUID.parse(obj_id).to_i
+ rescue ArgumentError
+ UUIDTools::UUID.parse_hexdigest(obj_id).to_i
+ end
def durable_queue?
!!Chef::Config[:amqp_consumer_id] | gracefully handle non-standard (no dashes) UUIDs | chef_chef | train | rb |
a3533e4aebcabc25397d74e42b75a56319753124 | diff --git a/lib/right_api_client/client.rb b/lib/right_api_client/client.rb
index <HASH>..<HASH> 100644
--- a/lib/right_api_client/client.rb
+++ b/lib/right_api_client/client.rb
@@ -10,6 +10,7 @@ require File.expand_path('../resource', __FILE__)
require File.expand_path('../resource_detail', __FILE__)
require File.expand_path('../resources', __FILE__)
require File.expand_path('../errors', __FILE__)
+require File.expand_path('../exceptions', __FILE__)
# RightApiClient has the generic get/post/delete/put calls that are used by resources
module RightApi | acu<I> - Include right_api_client/exceptions to right_api_client/client to make the exceptions backward compatible. | rightscale_right_api_client | train | rb |
70ab4502749d23464f06d50779aeea0b3275d67c | diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -163,13 +163,15 @@ module ActiveRecord
end
def custom_join_sql(joins)
- arel = table.select_manager
+ joins = joins.reject { |join| join.blank? }
- joins.each do |join|
- next if join.blank?
+ return if joins.empty?
- @implicit_readonly = true
+ @implicit_readonly = true
+ arel = table.select_manager
+
+ joins.each do |join|
case join
when Array
join = Arel.sql(join.join(' ')) if array_of_strings?(join) | cleaning up custom_join_sql method | rails_rails | train | rb |
0fc323a40d37300ef5a3ceb0062ae3d0e7970201 | diff --git a/ansible_runner/runner_config.py b/ansible_runner/runner_config.py
index <HASH>..<HASH> 100644
--- a/ansible_runner/runner_config.py
+++ b/ansible_runner/runner_config.py
@@ -30,10 +30,7 @@ try:
except ImportError:
from collections import Mapping
-try:
- from distutils import copy_tree
-except ImportError:
- from distutils.dir_util import copy_tree
+from distutils.dir_util import copy_tree
from six import iteritems, string_types
@@ -140,7 +137,7 @@ class RunnerConfig(object):
if os.path.exists(self.project_dir):
output.debug("Copying directory tree from {} to {} for working directory isolation".format(self.project_dir,
self.directory_isolation_path))
- copy_tree(self.project_dir, self.directory_isolation_path)
+ copy_tree(self.project_dir, self.directory_isolation_path, preserve_symlinks=True)
self.prepare_inventory()
self.prepare_env() | Fix copy_tree usage for symlink behavior
This forces symlink preservation to disable deep-copying of the
symlink content.
This also simplifies the import since it appears to be in the same
location in python 2 and 3 distutils | ansible_ansible-runner | train | py |
c2fbe8e3bd85398c8b48c68e66adbffdf863e8ab | diff --git a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
index <HASH>..<HASH> 100644
--- a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
+++ b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
@@ -198,7 +198,7 @@ public abstract class AbstractInvoker implements Invoker
SOAPFaultException sfe = findSoapFaultException(ex);
if (sfe != null) {
SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
- ex,
+ sfe,
sfe.getFault().getFaultCodeAsQName());
fault.setRole(sfe.getFault().getFaultActor());
fault.setDetail(sfe.getFault().getDetail()); | Propagate SOAPFaultException in faults | jbossws_jbossws-cxf | train | java |
e9cf8f172f2e281288e1c89b6d7abc07ce939320 | diff --git a/Views/Timeline/index.html.php b/Views/Timeline/index.html.php
index <HASH>..<HASH> 100644
--- a/Views/Timeline/index.html.php
+++ b/Views/Timeline/index.html.php
@@ -12,15 +12,15 @@
<div class="bg-white panel pt-md pb-md">
<!-- Export button -->
<div class="btn-group col-xs-2 pb-md">
- <?php if ($view['security']->isAdmin() || !$view['security']->isGranted('contactsource:export:disable', 'MATCH_ONE')): ?>
+ <?php // Currently causes exception without patch: if ($view['security']->isAdmin() || !$view['security']->isGranted('contactsource:export:disable', 'MATCH_ONE')): ?>
<a class="btn btn-default"
onclick="Mautic.contactSourceTimelineExport();">
<span>
<i class="fa fa-download"></i><span class="hidden-xs hidden-sm">Export</span>
</span>
</a>
- <?php endif; ?>
- <a id = "transactions-filter-btn"
+ <?php // endif; ?>
+ <a id="transactions-filter-btn"
class="btn btn-default">
<span>
<i class="fa fa-filter"></i> | [ENG-<I>] Prevent exception without patch.
We can always clean this up later in another way. | TheDMSGroup_mautic-contact-source | train | php |
25f2d43e60906b80d0748cca8b9e87380130d4e3 | diff --git a/lib/sensu/constants.rb b/lib/sensu/constants.rb
index <HASH>..<HASH> 100644
--- a/lib/sensu/constants.rb
+++ b/lib/sensu/constants.rb
@@ -1,6 +1,6 @@
module Sensu
unless defined?(Sensu::VERSION)
- VERSION = '0.9.12.beta.1'
+ VERSION = '0.9.12.beta.2'
LOG_LEVELS = [:debug, :info, :warn, :error, :fatal] | [beta] beta version bump | sensu_sensu | train | rb |
0788137ac74ac4e11ae74c04fafce0ac8091bf8d | diff --git a/tests/frontend/org/voltdb/TestAdHocQueries.java b/tests/frontend/org/voltdb/TestAdHocQueries.java
index <HASH>..<HASH> 100644
--- a/tests/frontend/org/voltdb/TestAdHocQueries.java
+++ b/tests/frontend/org/voltdb/TestAdHocQueries.java
@@ -461,7 +461,7 @@ public class TestAdHocQueries extends AdHocQueryTester {
try {
StringBuffer adHocQueryTemp = new StringBuffer("SELECT * FROM VOTES WHERE PHONE_NUMBER IN (");
int i = 0;
- while (adHocQueryTemp.length() <= Short.MAX_VALUE*10) {
+ while (adHocQueryTemp.length() <= Short.MAX_VALUE * 2) {
String randPhone = RandomStringUtils.randomNumeric(10);
VoltTable result = env.m_client.callProcedure("@AdHoc", "INSERT INTO VOTES VALUES(?, ?, ?);", randPhone, "MA", i).getResults()[0];
assertEquals(1, result.getRowCount()); | Adjust testAdHocLengthLimit (#<I>) | VoltDB_voltdb | train | java |
b20dd228943bcf1151af42bccea60600c8421cd4 | diff --git a/devassistant/package_managers.py b/devassistant/package_managers.py
index <HASH>..<HASH> 100644
--- a/devassistant/package_managers.py
+++ b/devassistant/package_managers.py
@@ -201,7 +201,12 @@ class RPMPackageManager(PackageManager):
if pkg.startswith('@'):
y.selectGroup(pkg[1:])
else:
- y.install(y.returnPackageByDep(pkg))
+ try:
+ y.install(y.returnPackageByDep(pkg))
+ except yum.Errors.YumBaseError:
+ msg = 'Package not found: {pkg}'.format(pkg=pkg)
+ logger.error(msg)
+ raise exceptions.DependencyException(msg)
y.resolveDeps()
logger.debug('Installing/Updating:')
to_install = [] | Don't fail with stack trace if yum doesn't find dependency | devassistant_devassistant | train | py |
c3e95933a03e365e21bd5b0125081b5b9bdbc745 | diff --git a/libraries/joomla/installer/adapters/file.php b/libraries/joomla/installer/adapters/file.php
index <HASH>..<HASH> 100644
--- a/libraries/joomla/installer/adapters/file.php
+++ b/libraries/joomla/installer/adapters/file.php
@@ -245,7 +245,7 @@ class JInstallerFile extends JAdapterInstance
$row->set('client_id', 0);
$row->set('params', '');
$row->set('system_data', '');
- $row->set('manifest_cache', '');
+ $row->set('manifest_cache', $this->parent->generateManifestCache());
if (!$row->store())
{ | Generate manifest_cache on file install | joomla_joomla-framework | train | php |
d534fee43d04a24cb8812158b2853fb20819dc54 | diff --git a/paperwork_backend/util.py b/paperwork_backend/util.py
index <HASH>..<HASH> 100644
--- a/paperwork_backend/util.py
+++ b/paperwork_backend/util.py
@@ -215,8 +215,12 @@ def rm_rf(path):
os.unlink(filepath)
for dirname in dirs:
dirpath = os.path.join(root, dirname)
- logger.info("Deleting dir %s" % dirpath)
- os.rmdir(dirpath)
+ if os.path.islink(dirpath):
+ logger.info("Deleting link %s" % dirpath)
+ os.unlink(dirpath)
+ else:
+ logger.info("Deleting dir %s" % dirpath)
+ os.rmdir(dirpath)
logger.info("Deleting dir %s", path)
os.rmdir(path) | util/rm_rf: fix deletion of symlinks | openpaperwork_paperwork-backend | train | py |
d954ae4787103a3a2747068ea2c49b15afa44f7e | diff --git a/lib/chore/pipe_listener.rb b/lib/chore/pipe_listener.rb
index <HASH>..<HASH> 100644
--- a/lib/chore/pipe_listener.rb
+++ b/lib/chore/pipe_listener.rb
@@ -87,7 +87,6 @@ module Chore
# if the child tells us it's done, let's be done
if payload.to_s == 'EOF'
pipe_from_handle(pipe).close
- remove_pipe(pipe)
next
end
handle_payload(payload)
@@ -135,9 +134,5 @@ module Chore
@pipes.values.find { |p| p.out == handle }
end
- def remove_pipe(handle)
- @pipes.delete_if {|k,p| p.out == handle }
- end
-
end
end | Remove the remote_pipe method, it's unnecessary as prune! will remove
the closed pipe at the start of the next iteration. | Tapjoy_chore | train | rb |
35a9f08e44e8396a33dc296e81e73b83a9b00543 | diff --git a/oauth2/__init__.py b/oauth2/__init__.py
index <HASH>..<HASH> 100644
--- a/oauth2/__init__.py
+++ b/oauth2/__init__.py
@@ -369,7 +369,7 @@ class Request(dict):
# spec draft 7, section 3.6
# (http://tools.ietf.org/html/draft-hammer-oauth-07#section-3.6)
# Spaces must be encoded with "%20" instead of "+"
- return encoded_str.replace('+', '%20')
+ return encoded_str.replace('+', '%20').replace('%7E', '~')
def sign_request(self, signature_method, consumer, token):
"""Set the signature parameter to the result of sign.""" | Modified get_normalized_parameters so it does not encode '~' for full conformance with RFC <I> section <I> | TimSC_python-oauth10a | train | py |
8499b3a9774729bc1ebb3058f8c7c8a98d8e647d | diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Eloquent/Model.php
+++ b/src/Illuminate/Database/Eloquent/Model.php
@@ -2934,6 +2934,12 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
if ($value instanceof DateTime) {
return Carbon::instance($value);
}
+
+ // If the value is a DateTimeImmutable instance, also skip the rest of these
+ // checks. Just return the DateTimeImmutable right away.
+ if($value instanceof DateTimeImmutable) {
+ return new Carbon($value->format('Y-m-d H:i:s.u'), $value->getTimeZone());
+ }
// If this value is an integer, we will assume it is a UNIX timestamp's value
// and format a Carbon object from this timestamp. This allows flexibility | Add DateTimeImmutable as valid date to Model.php
DateTimeImmutable behaves just like the DateTime object, so it should be considered as a valid date object when returning a Carbon date object. | laravel_framework | train | php |
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.