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
|
|---|---|---|---|---|---|
0ca0a805d67830e12a3d3676fac0e4920390c16a
|
diff --git a/api/src/main/java/org/spout/renderer/api/Camera.java b/api/src/main/java/org/spout/renderer/api/Camera.java
index <HASH>..<HASH> 100644
--- a/api/src/main/java/org/spout/renderer/api/Camera.java
+++ b/api/src/main/java/org/spout/renderer/api/Camera.java
@@ -46,7 +46,7 @@ public class Camera {
*
* @param projection The projection matrix
*/
- private Camera(Matrix4f projection) {
+ public Camera(Matrix4f projection) {
this.projection = projection;
}
|
Make the Camera constructor public again
We don’t need to restrain camera creation to predefined projection
matrices, and this makes more sense than adding a static method instead.
|
flow_caustic
|
train
|
java
|
979914b44f10973eefcf7515f79f2f78ba03026b
|
diff --git a/lib/docker-sync/sync_strategy/unison-unox.rb b/lib/docker-sync/sync_strategy/unison-unox.rb
index <HASH>..<HASH> 100644
--- a/lib/docker-sync/sync_strategy/unison-unox.rb
+++ b/lib/docker-sync/sync_strategy/unison-unox.rb
@@ -17,7 +17,7 @@ module Docker_Sync
UNISON_CONTAINER_PORT = '5000'
def initialize(sync_name, options)
@options = options
- @sync_name = @options['project'] != '' ? @options['project'] + '_' + sync_name : sync_name
+ @sync_name = sync_name
# if a custom image is set, apply it
if @options.key?('image')
@docker_image = @options['image']
|
[BUGFIX] Remove code from previous PR
|
EugenMayer_docker-sync
|
train
|
rb
|
35ccfcceb53f49dcc408531d92cb9779251f73ab
|
diff --git a/src/reducers/index.js b/src/reducers/index.js
index <HASH>..<HASH> 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -95,7 +95,7 @@ reducers[DONE_SAVING] = function doneSaving(state) {
reducers[CHANGE_FILENAME] = function changeFilename(state, action) {
const { filename } = action;
- if(!filename) {
+ if (!filename) {
return state;
}
return Object.assign({}, state, { filename });
|
The last eslint bit I'm willing to touch.
|
nteract_nteract
|
train
|
js
|
30ad0ae32f34d978082876b681207ec55eb7b01f
|
diff --git a/restcomm/restcomm.http/src/main/java/org/mobicents/servlet/restcomm/http/IncomingPhoneNumbersEndpoint.java b/restcomm/restcomm.http/src/main/java/org/mobicents/servlet/restcomm/http/IncomingPhoneNumbersEndpoint.java
index <HASH>..<HASH> 100644
--- a/restcomm/restcomm.http/src/main/java/org/mobicents/servlet/restcomm/http/IncomingPhoneNumbersEndpoint.java
+++ b/restcomm/restcomm.http/src/main/java/org/mobicents/servlet/restcomm/http/IncomingPhoneNumbersEndpoint.java
@@ -287,6 +287,11 @@ public abstract class IncomingPhoneNumbersEndpoint extends AbstractEndpoint {
// if(isRealNumber) {
// isDidAssigned = phoneNumberProvisioningManager.buyNumber(number, phoneNumberParameters);
// }
+ if(isRealNumber) {
+ //Try to register the DID with the provision provider.
+ //If this is a long SIP Number it will fail but nevertheless we will register it to the DB
+ phoneNumberProvisioningManager.buyNumber(number, phoneNumberParameters);
+ }
if(isDidAssigned) {
dao.addIncomingPhoneNumber(incomingPhoneNumber);
if (APPLICATION_JSON_TYPE == responseType) {
|
Issue #<I> sovled
RESTCOMM-<I> #Comment fix for VoipInnovation DIDs
|
RestComm_Restcomm-Connect
|
train
|
java
|
dc25d8826524e4567123ddea421b0676fb27e3c1
|
diff --git a/test/test_network.rb b/test/test_network.rb
index <HASH>..<HASH> 100644
--- a/test/test_network.rb
+++ b/test/test_network.rb
@@ -39,15 +39,20 @@ class BioTCM_Network_Test < Test::Unit::TestCase
@net = BioTCM::Network.new("test_network_background.txt")
end
should "select correct network according to input nodes" do
- assert_equal(nil, @net.select(["1", "3"]).edge)
+ assert_equal(nil, @net.select(["1", "3", "8"]).edge)
expected = ["1--2", "2--3", "3--4", "4--1"]
actual = @net.select(["1", "2", "3", "4"]).edge
assert_equal(expected, expected&actual)
assert_equal(expected, expected|actual)
end
should "expand network according selected nodes" do
- assert_equal(@net.edge, @net.select(["1", "3"]).edge.expand)
+ assert_equal(@net.edge, @net.select(["1", "3", "8"]).edge.expand)
end
+ should "knock down edges connected to selected nodes" do
+ expected = ["1--2", "1--5", "4--1"]
+ actual = @net.knock(["3", "8"]).edge
+ assert_equal(expected, expected&actual)
+ assert_equal(expected, expected|actual)
end
end
|
knock_down(nodes) added
|
aidistan_ruby-biotcm
|
train
|
rb
|
fad26a71c858dc1d4e212fae72507925a3f5fcd5
|
diff --git a/test/e2e/scalability/density.go b/test/e2e/scalability/density.go
index <HASH>..<HASH> 100644
--- a/test/e2e/scalability/density.go
+++ b/test/e2e/scalability/density.go
@@ -146,7 +146,7 @@ func density30AddonResourceVerifier(numNodes int) map[string]framework.ResourceC
MemoryConstraint: 100 * (1024 * 1024),
}
constraints["l7-lb-controller"] = framework.ResourceConstraint{
- CPUConstraint: 0.15,
+ CPUConstraint: 0.2 + 0.0001*float64(numNodes),
MemoryConstraint: (75 + uint64(math.Ceil(0.6*float64(numNodes)))) * (1024 * 1024),
}
constraints["influxdb"] = framework.ResourceConstraint{
|
Make CPU constraint for l7-lb-controller in density test scale with #nodes
|
kubernetes_kubernetes
|
train
|
go
|
1a797748d30d15013c3794fc0bb0324501892710
|
diff --git a/nose/test_orbit.py b/nose/test_orbit.py
index <HASH>..<HASH> 100644
--- a/nose/test_orbit.py
+++ b/nose/test_orbit.py
@@ -2284,6 +2284,7 @@ def test_physical_output_off():
# back on by turn_physical_on
def test_physical_output_on():
from galpy.potential import LogarithmicHaloPotential
+ from astropy import units
lp= LogarithmicHaloPotential(normalize=1.)
plp= lp.toPlanar()
for ii in range(4):
@@ -2299,10 +2300,12 @@ def test_physical_output_on():
o_orig= o()
#turn off and on
o.turn_physical_off()
- if ii%2 == 0:
+ if ii == 0:
o.turn_physical_on(ro=ro,vo=vo)
+ elif ii == 1:
+ o.turn_physical_on(ro=ro*units.kpc,vo=vo*units.km/units.s)
else:
- o.turn_physical_on(ro=ro,vo=vo)
+ o.turn_physical_on()
#Test positions
assert numpy.fabs(o.R()-o_orig.R(use_physical=True)) < 10.**-10., 'o.R() output for Orbit setup with ro= does not work as expected when turned back on'
if ii % 2 == 1:
|
Further tests of turn_physical_on for orbits
|
jobovy_galpy
|
train
|
py
|
8f638b87c6d858e11b641509cb953c850f444169
|
diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,9 +13,9 @@ copyright = '2014-2018, Marco Agner'
author = 'Marco Agner'
# The short X.Y version
-version = '1.1.1'
+version = '1.1.2'
# The full version, including alpha/beta/rc tags
-release = 'v1.1.1'
+release = 'v1.1.2'
# -- General configuration ---------------------------------------------------
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@ class PyTest(TestCommand):
setup(
name='Flask-QRcode',
- version='1.1.1',
+ version='1.1.2',
license='GPLv3',
description='A concise Flask extension to render QR codes on Jinja2 ' \
'templates using python-qrcode',
|
bumps version minor for doc bugfix
|
marcoagner_Flask-QRcode
|
train
|
py,py
|
b43f95469c25dbbd9adb145e94083146871d07a6
|
diff --git a/lib/Models/WebMapServiceCatalogItem.js b/lib/Models/WebMapServiceCatalogItem.js
index <HASH>..<HASH> 100644
--- a/lib/Models/WebMapServiceCatalogItem.js
+++ b/lib/Models/WebMapServiceCatalogItem.js
@@ -109,6 +109,10 @@ var WebMapServiceCatalogItem = function(terria) {
*/
this.maxRefreshIntervals = 1000;
+ /**
+ * Gets or sets how many seconds time-series data with a start date but no end date should last, in seconds.
+ * @type {Number}
+ */
this.displayDuration = undefined;
this._sourceInfoItemNames = ['GetCapabilities URL'];
|
Added JSDoc for displayDuration in WMSCatalogItem
|
TerriaJS_terriajs
|
train
|
js
|
82bb9a2c5889c9e65faeba7dd1f8d1be78ca38d9
|
diff --git a/spec/models/permission_spec.rb b/spec/models/permission_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/models/permission_spec.rb
+++ b/spec/models/permission_spec.rb
@@ -27,7 +27,7 @@ describe Permission do
end
- before(:all) do
+ before(:each) do
@some_role = Role.find_or_create_by_name(:name => 'some_role')
@repo_admin = Role.find_or_create_by_name(:name => 'repo_admin')
@super_admin = Role.find_or_create_by_name(:name => 'super_admin')
|
Persmissions rspec - use before(:each) instead of before(:all)
It's not recommanded to use before(:all) with database manipulation,
since it's not in tests trasaction i.e. records created in this
filter remain in db after running - can affect other tests.
|
Katello_katello
|
train
|
rb
|
a2ac5b33d8cb7f3161e61a23b9d40aa57ad2ef98
|
diff --git a/karaage/conf/defaults.py b/karaage/conf/defaults.py
index <HASH>..<HASH> 100644
--- a/karaage/conf/defaults.py
+++ b/karaage/conf/defaults.py
@@ -91,6 +91,7 @@ INSTALLED_APPS = (
'django.contrib.humanize',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'django.contrib.auth',
)
# South not available for Python 3+ or Django 1.7+
|
django.contrib.auth required with Django <I>
Change-Id: I3f0bae<I>c<I>a<I>acb<I>e4f<I>e<I>
|
Karaage-Cluster_karaage
|
train
|
py
|
36ca161f1952c3d0853618a0017a6564134d4875
|
diff --git a/lib/parallel.rb b/lib/parallel.rb
index <HASH>..<HASH> 100644
--- a/lib/parallel.rb
+++ b/lib/parallel.rb
@@ -355,7 +355,7 @@ module Parallel
exception = e
if Parallel::Kill === exception
(workers - [worker]).each do |w|
- w.thread.kill
+ w.thread.kill unless w.thread.nil?
UserInterruptHandler.kill(w.pid)
end
end
|
Do not call kill method if thread is nil
|
grosser_parallel
|
train
|
rb
|
ade7037ccc072bbf83d6df2cef4e8e034fa0ced5
|
diff --git a/spotify/libspotify.go b/spotify/libspotify.go
index <HASH>..<HASH> 100644
--- a/spotify/libspotify.go
+++ b/spotify/libspotify.go
@@ -1532,6 +1532,9 @@ func (l *Link) release() {
func (l *Link) String() string {
// Determine how big string we need and get the string out.
size := C.sp_link_as_string(l.sp_link, nil, 0)
+ if C.size_t(size) == 0 {
+ return ""
+ }
buf := (*C.char)(C.malloc(C.size_t(size) + 1))
if buf == nil {
return "<invalid>"
@@ -2043,9 +2046,12 @@ func (a *Album) Artist() *Artist {
}
func (a *Album) CoverLink(size ImageSize) *Link {
- sp_link := C.sp_link_create_from_album_cover(a.sp_album,
- C.sp_image_size(size))
- return newLink(a.session, sp_link, false)
+ if sp_link := C.sp_link_create_from_album_cover(a.sp_album,
+ C.sp_image_size(size)); sp_link != nil {
+ return newLink(a.session, sp_link, false)
+ }
+
+ return nil
}
func (a *Album) Cover(size ImageSize) *Image {
|
Fixed panic when no album cover is present
|
op_go-libspotify
|
train
|
go
|
ace4a9b111bb57e2b6d19aba6ca3b20ed10851cc
|
diff --git a/lib/restforce/error_code.rb b/lib/restforce/error_code.rb
index <HASH>..<HASH> 100644
--- a/lib/restforce/error_code.rb
+++ b/lib/restforce/error_code.rb
@@ -277,6 +277,8 @@ module Restforce
class MalformedQuery < ResponseError; end
+ class MalformedSearch < ResponseError; end
+
class ManagerNotDefined < ResponseError; end
class MassmailRetryLimitExceeded < ResponseError; end
@@ -551,6 +553,7 @@ module Restforce
"LOGIN_MUST_USE_SECURITY_TOKEN" => LoginMustUseSecurityToken,
"MALFORMED_ID" => MalformedId,
"MALFORMED_QUERY" => MalformedQuery,
+ "MALFORMED_SEARCH" => MalformedSearch,
"MANAGER_NOT_DEFINED" => ManagerNotDefined,
"MASSMAIL_RETRY_LIMIT_EXCEEDED" => MassmailRetryLimitExceeded,
"MASS_MAIL_LIMIT_EXCEEDED" => MassMailLimitExceeded,
|
Handle `MALFORMED_SEARCH` error returned from Salesforce
Fixes #<I>.
|
restforce_restforce
|
train
|
rb
|
1e6972bc32aa63202940c406ffcc7902ffa6d66b
|
diff --git a/test/systemtests/aci_util_test.go b/test/systemtests/aci_util_test.go
index <HASH>..<HASH> 100755
--- a/test/systemtests/aci_util_test.go
+++ b/test/systemtests/aci_util_test.go
@@ -64,11 +64,7 @@ func aciHTTPGet(url string, jin, jout interface{}) error {
return err
}
- if err := json.Unmarshal(response, jout); err != nil {
- return err
- }
-
- return nil
+ return json.Unmarshal(response, jout)
}
// GetEPFromAPIC checks learning
|
Fixed a golint error in test file
|
contiv_netplugin
|
train
|
go
|
1b92515fa97c36da9868b2bc5b136fed3a5a3351
|
diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/provider/cron_spec.rb
+++ b/spec/unit/provider/cron_spec.rb
@@ -563,7 +563,7 @@ HOME=/home/foo
@provider.stub!(:read_crontab).and_return(<<-CRONTAB)
0 2 * * * /some/other/command
-# Chef Name: something else
+# Chef Name: cronhole some stuff
* 5 * * * /bin/true
# Another comment
@@ -581,6 +581,7 @@ CRONTAB
end
it "should log nothing changed" do
+ Chef::Log.should_receive(:debug).with("Found cron '#{@new_resource.name}'")
Chef::Log.should_receive(:debug).with("Skipping existing cron entry '#{@new_resource.name}'")
@provider.run_action(:create)
end
|
fix cron unit test, this worked since @cron_exists was not reset properly.
|
chef_chef
|
train
|
rb
|
ebdf6ad13505efebe4f5b450b3cc086c76099f4f
|
diff --git a/src/chart/pie/pieLayout.js b/src/chart/pie/pieLayout.js
index <HASH>..<HASH> 100644
--- a/src/chart/pie/pieLayout.js
+++ b/src/chart/pie/pieLayout.js
@@ -37,10 +37,8 @@ define(function (require) {
var minAngle = seriesModel.get('minAngle') * RADIAN;
var sum = data.getSum('value');
- if (sum === 0) {
- sum = data.count();
- }
- var unitRadian = Math.PI / sum * 2;
+ // Sum may be 0
+ var unitRadian = Math.PI / (sum || data.count()) * 2;
var clockwise = seriesModel.get('clockwise');
|
Pie sector average angle when all data is 0. Fix #<I>
|
apache_incubator-echarts
|
train
|
js
|
166676a7195ce537222da767200c5b091354f0a7
|
diff --git a/slackclient/_slackrequest.py b/slackclient/_slackrequest.py
index <HASH>..<HASH> 100644
--- a/slackclient/_slackrequest.py
+++ b/slackclient/_slackrequest.py
@@ -6,7 +6,8 @@ class SlackRequest(object):
def __init__(self):
pass
- def do(self, token, request="?", post_data=None, domain="slack.com"):
+ @staticmethod
+ def do(token, request="?", post_data=None, domain="slack.com"):
if post_data is None:
post_data = {}
post_data["token"] = token
|
Make SlackRequest.do method static
|
slackapi_python-slackclient
|
train
|
py
|
ffccac5495bb21b99a2d58427068d67575b3dd5b
|
diff --git a/flowlogs_reader/flowlogs_reader.py b/flowlogs_reader/flowlogs_reader.py
index <HASH>..<HASH> 100644
--- a/flowlogs_reader/flowlogs_reader.py
+++ b/flowlogs_reader/flowlogs_reader.py
@@ -21,6 +21,11 @@ import boto3
from botocore.exceptions import NoRegionError
+DEFAULT_FILTER_PATTERN = (
+ '[version="2", account_id, interface_id, srcaddr, dstaddr, '
+ 'srcport, dstport, protocol, packets, bytes, '
+ 'start, end, action, log_status]'
+)
DEFAULT_REGION_NAME = 'us-east-1'
ACCEPT = 'ACCEPT'
@@ -135,7 +140,7 @@ class FlowLogsReader(object):
profile_name=None,
start_time=None,
end_time=None,
- filter_pattern=None,
+ filter_pattern=DEFAULT_FILTER_PATTERN,
boto_client_kwargs=None
):
boto_client_kwargs = boto_client_kwargs or {}
|
Filter for VPC flow logs v2 by default
|
obsrvbl_flowlogs-reader
|
train
|
py
|
7b05904de35826ff191a15f884a7b89328afa6b9
|
diff --git a/modules/feed/html/rollup.js b/modules/feed/html/rollup.js
index <HASH>..<HASH> 100644
--- a/modules/feed/html/rollup.js
+++ b/modules/feed/html/rollup.js
@@ -325,6 +325,8 @@ function returnTrue () {
}
function getFilter (filterSettings) {
+ if(!filterSettings) return returnTrue
+
return function(msg) {
return !(filterSettings.following && getType(msg) === 'contact')
}
|
Handle filter settings initial state gracefully
|
ssbc_patchwork
|
train
|
js
|
fce5e18f3e3a19011ee0a528df690ad9eab574d6
|
diff --git a/autopep8.py b/autopep8.py
index <HASH>..<HASH> 100755
--- a/autopep8.py
+++ b/autopep8.py
@@ -142,8 +142,7 @@ PROJECT_CONFIG = ('setup.cfg', 'tox.ini', '.pep8', '.flake8')
MAX_PYTHON_FILE_DETECTION_BYTES = 1024
-def open_with_encoding(filename,
- encoding=None, mode='r', limit_byte_check=-1):
+def open_with_encoding(filename, mode='r', encoding=None, limit_byte_check=-1):
"""Return opened file with a specific encoding."""
if not encoding:
encoding = detect_encoding(filename, limit_byte_check=limit_byte_check)
@@ -159,7 +158,7 @@ def detect_encoding(filename, limit_byte_check=-1):
from lib2to3.pgen2 import tokenize as lib2to3_tokenize
encoding = lib2to3_tokenize.detect_encoding(input_file.readline)[0]
- with open_with_encoding(filename, encoding) as test_file:
+ with open_with_encoding(filename, encoding=encoding) as test_file:
test_file.read(limit_byte_check)
return encoding
|
better match the signature of io.open
|
hhatto_autopep8
|
train
|
py
|
9d7f1662448439ad2058a5b48024f609e9784eb7
|
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
index <HASH>..<HASH> 100644
--- a/hugolib/hugo_sites.go
+++ b/hugolib/hugo_sites.go
@@ -727,6 +727,10 @@ type BuildCfg struct {
// For regular builds, this will allways return true.
// TODO(bep) rename/work this.
func (cfg *BuildCfg) shouldRender(p *pageState) bool {
+ if p == nil {
+ return false
+ }
+
if p.forceRender {
return true
}
|
hugolib: Check for nil in shouldRender
|
gohugoio_hugo
|
train
|
go
|
b8f4ab8fb379ffe7d27e6fd4f1cfe73b1144675e
|
diff --git a/libary/src/main/java/com/larswerkman/holocolorpicker/ColorPicker.java b/libary/src/main/java/com/larswerkman/holocolorpicker/ColorPicker.java
index <HASH>..<HASH> 100644
--- a/libary/src/main/java/com/larswerkman/holocolorpicker/ColorPicker.java
+++ b/libary/src/main/java/com/larswerkman/holocolorpicker/ColorPicker.java
@@ -577,8 +577,10 @@ public class ColorPicker extends View {
private float colorToAngle(int color) {
float[] colors = new float[3];
Color.colorToHSV(color, colors);
-
- return (float) Math.toRadians(-colors[0]);
+
+ float rad = (float) Math.toRadians(colors[0]);
+ if (rad > Math.PI) rad -= 2 * Math.PI;
+ return rad;
}
@Override
|
- Fix for colorToAngle method
The angle on the colorWheel uses a range from -PI to PI, while Math.toRadians gives back a range from 0 to 2*PI. I fixed this by subtracting 2*PI when the radians are above PI.
|
LarsWerkman_HoloColorPicker
|
train
|
java
|
d2ab5e598d9143302099997a4277dc1d04117777
|
diff --git a/validator.go b/validator.go
index <HASH>..<HASH> 100644
--- a/validator.go
+++ b/validator.go
@@ -879,13 +879,8 @@ func ErrorsByField(e error) map[string]string {
m[e.(Error).Name] = e.(Error).Err.Error()
case Errors:
for _, item := range e.(Errors).Errors() {
- switch item.(type) {
- case Error:
- m[item.(Error).Name] = item.(Error).Err.Error()
- case Errors:
- for k, v := range ErrorsByField(item) {
- m[k] = v
- }
+ for k, v := range ErrorsByField(item) {
+ m[k] = v
}
}
}
|
There's no need for repeating all the switch statement
|
asaskevich_govalidator
|
train
|
go
|
6e119589541c68aa1dd3436048df25b08e2c08f1
|
diff --git a/jarallax/jarallax.js b/jarallax/jarallax.js
index <HASH>..<HASH> 100644
--- a/jarallax/jarallax.js
+++ b/jarallax/jarallax.js
@@ -28,7 +28,7 @@
speed : 0.5,
src : null,
enableTransform : true,
- forceAcceleration : true
+ forceAcceleration : false
};
dataOptions = _this.$item.data('jarallax') || {};
_this.options = $.extend({}, _this.defaults, dataOptions, userOptions);
|
force acceleration option disabled by default (buggy in some reasons)
|
nk-o_jarallax
|
train
|
js
|
17a6d5227ab2baa37bce40c3336912f11775ec2f
|
diff --git a/app/lib/Chalk.php b/app/lib/Chalk.php
index <HASH>..<HASH> 100755
--- a/app/lib/Chalk.php
+++ b/app/lib/Chalk.php
@@ -52,7 +52,7 @@ class Chalk extends App
}
$nspace = self::$_map[array_shift($parts)];
$parts = array_map('ucfirst', $parts);
- $class = "{$nspace}\\" . implode('\\', $parts);
+ $class = "{$nspace}" . (count($parts) ? '\\' . implode('\\', $parts) : null);
}
if (false !== $pos = strpos($class, '\\__CG__\\')) {
$class = substr($class, $pos + 8);
|
Fix typo in Chalk::info class names.
|
jacksleight_chalk
|
train
|
php
|
b6462c5f4bfe5055a8c765affa47800c4ee57004
|
diff --git a/router.go b/router.go
index <HASH>..<HASH> 100644
--- a/router.go
+++ b/router.go
@@ -174,10 +174,10 @@ func (r *DynamicRouter) ServeHTTP(res http.ResponseWriter, req *http.Request) {
if err != nil {
if r.fileServer == nil {
w.WriteHeader(http.StatusNotFound)
+ w.flush()
} else {
- r.fileServer.ServeHTTP(w, req)
+ r.fileServer.ServeHTTP(res, req)
}
- w.flush()
} else if n.handler != nil {
// we pass all filter in the right order. if one return false
// we return, assuming that everything has been written in response
|
do not override response writer when serving static content
|
jeromedoucet_route
|
train
|
go
|
dc9e76b3c6e48df1f3a60b52fc66a173d1e6c8e1
|
diff --git a/src/lokijs.js b/src/lokijs.js
index <HASH>..<HASH> 100644
--- a/src/lokijs.js
+++ b/src/lokijs.js
@@ -2004,8 +2004,6 @@
for (i = seg[0]; i <= seg[1]; i++) {
result.push(t[index.values[i]]);
}
-
- this.filteredrows = result;
}
// not a chained query so return result as data[]
|
Fixing the bug where find() set the filtered rows equal to the queried data on un-chained queries
|
techfort_LokiJS
|
train
|
js
|
952c41f2aa4516e969ca2c9cc1d12448f46599aa
|
diff --git a/src/Resources/contao/classes/ModuleVisitorChecks.php b/src/Resources/contao/classes/ModuleVisitorChecks.php
index <HASH>..<HASH> 100644
--- a/src/Resources/contao/classes/ModuleVisitorChecks.php
+++ b/src/Resources/contao/classes/ModuleVisitorChecks.php
@@ -160,8 +160,8 @@ class ModuleVisitorChecks extends \Frontend
$dnsResult = false;
//$this->_vhost : Host.TLD
//idn_to_ascii
- $dnsResult = @dns_get_record(\Idna::encode($host), DNS_ANY);
- if ($dnsResult)
+ $dnsResult = @dns_get_record(\Idna::encode($host), DNS_A + DNS_AAAA);
+ if ( (bool)$dnsResult)
{
ModuleVisitorLog::writeLog(__METHOD__, __LINE__, ': True');
|
Fix #<I>, Error in Referrer DNS Check
|
BugBuster1701_contao-visitors-bundle
|
train
|
php
|
79a9951901c5ee38c6bf5576b3f7a06c2cd570f1
|
diff --git a/ghost/admin/app/components/gh-members-chart.js b/ghost/admin/app/components/gh-members-chart.js
index <HASH>..<HASH> 100644
--- a/ghost/admin/app/components/gh-members-chart.js
+++ b/ghost/admin/app/components/gh-members-chart.js
@@ -295,6 +295,9 @@ export default Component.extend({
}]
}
};
+ if (this.chartType === 'mrr' || this.chartType === 'all-members' || this.chartType === 'open-rate') {
+ options.scales.yAxes[0].ticks.suggestedMin = 0;
+ }
if (this.isSmall) {
options.scales.yAxes[0].ticks.display = false;
options.scales.xAxes[0].gridLines.display = true;
|
Refined defaults for Dashboard charts
|
TryGhost_Ghost
|
train
|
js
|
0e426343141b8fa41f0841a765058ff95c1b8450
|
diff --git a/demos/collection/crud.php b/demos/collection/crud.php
index <HASH>..<HASH> 100644
--- a/demos/collection/crud.php
+++ b/demos/collection/crud.php
@@ -63,7 +63,7 @@ $crud->setModel($model);
// Because Crud inherits Grid, you can also define custom actions
$crud->addModalAction(['icon' => [\atk4\ui\Icon::class, 'cogs']], 'Details', function ($p, $id) use ($crud) {
- \atk4\ui\Message::addTo($p, ['Details for: ' . $crud->model->load($id)['name'] . ' (id: ' . $id . ')']);
+ \atk4\ui\Message::addTo($p, ['Details for: ' . $crud->model->load($id)->get('name') . ' (id: ' . $id . ')']);
});
$column = $columns->addColumn();
|
[fix] usage of array access on model in demo (#<I>)
|
atk4_ui
|
train
|
php
|
f6e70a4d7b36dd7b6f7ab3b2f9837442cfa50cf9
|
diff --git a/src/ConsoleCommand/CliFactoryBootstrap.php b/src/ConsoleCommand/CliFactoryBootstrap.php
index <HASH>..<HASH> 100644
--- a/src/ConsoleCommand/CliFactoryBootstrap.php
+++ b/src/ConsoleCommand/CliFactoryBootstrap.php
@@ -8,9 +8,12 @@ use LizardsAndPumpkins\Core\Factory\Factory;
use LizardsAndPumpkins\Core\Factory\MasterFactory;
use LizardsAndPumpkins\Util\Factory\CatalogMasterFactory;
use LizardsAndPumpkins\Util\Factory\CommonFactory;
+use LizardsAndPumpkins\Util\Factory\ProjectFactory;
class CliFactoryBootstrap
{
+ protected static $projectFactoryClass = ProjectFactory::class;
+
protected static $commonFactoryClass = CommonFactory::class;
public static function createMasterFactory(Factory ...$factoriesToRegister): MasterFactory
@@ -54,6 +57,7 @@ class CliFactoryBootstrap
{
return [
static::$commonFactoryClass,
+ static::$projectFactoryClass,
];
}
|
#<I>: Restore CLI project factory binding
|
lizards-and-pumpkins_catalog
|
train
|
php
|
03648193b9779778aa9c5471d2530ea4ea2e2f42
|
diff --git a/lib/rich/cms/content/item.rb b/lib/rich/cms/content/item.rb
index <HASH>..<HASH> 100644
--- a/lib/rich/cms/content/item.rb
+++ b/lib/rich/cms/content/item.rb
@@ -59,10 +59,11 @@ module Rich
(options[:html] ||= {}).store :class, [class_name.to_s.gsub(/^\./, ""), options[:html].try(:fetch, :class, nil)].compact.join(" ")
end
- attrs << options[:html].collect{|k, v| "#{k}=\"#{::ERB::Util.html_escape v}\""}.join(" ") if options[:html]
attrs << data .collect{|k, v| "data-#{k}=\"#{::ERB::Util.html_escape v}\""}.join(" ")
end
+ attrs << options[:html].collect{|k, v| "#{k}=\"#{::ERB::Util.html_escape v}\""}.join(" ") if options[:html]
+
tag = options[:tag] || @group.tag || (%w(text html).include?(options[:as].to_s.downcase) ? :div : :span)
"<#{tag} #{attrs.join(" ")}>#{value.blank? ? default : value}</#{tag}>".html_safe
@@ -72,4 +73,4 @@ module Rich
end
end
-end
\ No newline at end of file
+end
|
Make sure html options get passed to tags when not in edit mode
|
archan937_rich_cms
|
train
|
rb
|
198003c71abd3ed75b051ad8ee6eb9708bb02d8d
|
diff --git a/suds/version.py b/suds/version.py
index <HASH>..<HASH> 100644
--- a/suds/version.py
+++ b/suds/version.py
@@ -22,5 +22,5 @@ See the setup.py script for more detailed information.
"""
-__version__ = "0.5"
+__version__ = "0.6 (development)"
__build__ = ""
|
bump up version information for the next planned release development
|
ovnicraft_suds2
|
train
|
py
|
b7fad3c405c17516f54b2c4927ed48c0c0df3b22
|
diff --git a/lib/db.js b/lib/db.js
index <HASH>..<HASH> 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -117,9 +117,9 @@ db.listenReplications = function(id) {
// We can play around with public / private - maybe we want a consistent public port?
try {
// Both throw err in their async code which we cannot catch
- entry.map({ external: port, internal: port, name: require("../package").name }, function(e) { e && console.error(e) });
+ entry.map({ external: port, internal: port, name: require("../package").name }, function(e) { e && console.error("entry error (non-fatal)", e) });
//natPmp.connect("10.0.1.1").portMapping({ public: port, private: port, ttl: 1000, description: require("../package").name }, function(e) { e && console.error(e) });
- } catch(e) { console.error(e) }
+ } catch(e) { console.error("entry error (non-fatal)", e) }
});
// Announce as an SSDP server
|
explain that messages from entry are non-fatal
|
jaruba_multipass-torrent
|
train
|
js
|
f3c8ef8f7a6d328a438d38e492c77f3334b4d70a
|
diff --git a/src/backbone.syphon.js b/src/backbone.syphon.js
index <HASH>..<HASH> 100644
--- a/src/backbone.syphon.js
+++ b/src/backbone.syphon.js
@@ -35,10 +35,14 @@ Backbone.Syphon = (function(Backbone, $, _){
// Input Readers
// -------------
+
+ // Input Readers are used to extract the value from
+ // an input element, for the serialized object result
+ Syphon.InputReaderSet = function(){
+ this.readers = {};
+ };
- Syphon.InputReaders = {
- readers: {},
-
+ _.extend(Syphon.InputReaderSet.prototype, {
// Retrieve the correct input reader based
// on the type of the element that is passed
// in as the `$el` parameter. If no reader is
@@ -75,7 +79,7 @@ Backbone.Syphon = (function(Backbone, $, _){
unregister: function(type){
delete this.readers[type];
}
- };
+ });
// Key Extractors
// --------------
@@ -128,7 +132,11 @@ Backbone.Syphon = (function(Backbone, $, _){
// Built-in Input Readers
// ----------------------
- // The default reader
+ // The default reader set
+ Syphon.InputReaders = new Syphon.InputReaderSet();
+
+ // The default input reader, which uses an input
+ // element's "value"
Syphon.InputReaders.registerDefault(function($el){
return $el.val();
});
|
converted input readers to an object that can be instantiated and replaced as needed
|
marionettejs_backbone.syphon
|
train
|
js
|
d222496c707e8bdaaa535b0c91c423231e23dec9
|
diff --git a/test/test_autopep8.py b/test/test_autopep8.py
index <HASH>..<HASH> 100644
--- a/test/test_autopep8.py
+++ b/test/test_autopep8.py
@@ -2,6 +2,10 @@ import os
import unittest
from subprocess import Popen, PIPE
from tempfile import mkstemp
+
+import sys
+sys.path.insert(0,
+ os.path.split(os.path.abspath(os.path.dirname(__file__)))[0])
import autopep8
|
Modify path so that correct autopep gets imported
|
hhatto_autopep8
|
train
|
py
|
978e3454947183f2670fbe4adaf039ae4d5cda2e
|
diff --git a/lib/xray/middleware.rb b/lib/xray/middleware.rb
index <HASH>..<HASH> 100644
--- a/lib/xray/middleware.rb
+++ b/lib/xray/middleware.rb
@@ -35,6 +35,7 @@ module Xray
# Inject xray.js and friends if this is a successful HTML response
else
status, headers, response = @app.call(env)
+
if html_headers?(status, headers) && body = response_body(response)
body = body.sub(/<body[^>]*>/) { "#{$~}\n#{xray_bar}" }
# Inject js script tags if assets are unbundled
@@ -42,9 +43,19 @@ module Xray
append_js!(body, 'jquery', 'xray')
append_js!(body, 'backbone', 'xray-backbone')
end
- headers['Content-Length'] = body.bytesize.to_s
+ content_length = body.bytesize.to_s
+ # Modifying the original response obj maintains compatibility with other middlewares
+ if ActionDispatch::Response === response
+ response.body = [body]
+ response.header['Content-Length'] = content_length
+ response.to_a
+ else
+ headers['Content-Length'] = content_length
+ [status, headers, [body]]
+ end
+ else
+ [status, headers, response]
end
- [status, headers, (body ? [body] : response)]
end
end
|
Return ActionDispatch::Response from xray middleware
This fixes compatibility issues with Bullet. #<I>
|
brentd_xray-rails
|
train
|
rb
|
74a322ffb2f84cb18f1505cda8cdb3311e0f106a
|
diff --git a/a10_neutron_lbaas/v1/neutron_ops.py b/a10_neutron_lbaas/v1/neutron_ops.py
index <HASH>..<HASH> 100644
--- a/a10_neutron_lbaas/v1/neutron_ops.py
+++ b/a10_neutron_lbaas/v1/neutron_ops.py
@@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import a10_neutron_lbaas.a10_exceptions as a10_ex
+
class NeutronOpsV1(object):
@@ -43,3 +45,21 @@ class NeutronOpsV1(object):
def vip_get_id(self, context, pool_id):
return self.openstack_driver._pool_get_vip_id(context, pool_id)
+
+ def _provider_from_pool(self, pool):
+ return pool['provider']
+
+ def _provider(self, pool):
+ if 'provider' in pool and pool['provider']:
+ return pool['provider']
+ else:
+ return self.plugin.default_provider
+
+ def provider(self, context, entity):
+ if 'provider' in entity:
+ return self._provider(entity)
+ elif 'pool_id' in entity:
+ return self._provider(self.pool_get(context, pool_id))
+ else:
+ #return self.plugin.default_provider
+ raise a10_ex.UnsupportedFeature("failed to determine provider")
|
get provider for each lbaas
|
a10networks_a10-neutron-lbaas
|
train
|
py
|
c0e8f5b76cf31a72862c7ba1cc611e5dba379f40
|
diff --git a/lib/cuba_api/cors.rb b/lib/cuba_api/cors.rb
index <HASH>..<HASH> 100644
--- a/lib/cuba_api/cors.rb
+++ b/lib/cuba_api/cors.rb
@@ -43,10 +43,12 @@ module CubaApi
end
def origins( domain )
- host = URI.parse( domain ).host
- origins = self._origins
- if origins == [ '*' ] || origins.nil? || origins.member?( host )
- domain
+ if domain
+ host = URI.parse( domain ).host
+ origins = self._origins
+ if origins == [ '*' ] || origins.nil? || origins.member?( host )
+ domain
+ end
end
end
|
allow request with http_origin to pass - no cors context
|
mkristian_cuba-api
|
train
|
rb
|
6fd77ce01d052ba3c5c174faaacea5dad550f91a
|
diff --git a/lib/roo/excel.rb b/lib/roo/excel.rb
index <HASH>..<HASH> 100644
--- a/lib/roo/excel.rb
+++ b/lib/roo/excel.rb
@@ -11,24 +11,6 @@ CHARGUESS =
false
end
-# ruby-spreadsheet has a font object so we're extending it
-# with our own functionality but still providing full access
-# to the user for other font information
-module ExcelFontExtensions
- def bold?(*args)
- #From ruby-spreadsheet doc: 100 <= weight <= 1000, bold => 700, normal => 400
- weight == 700
- end
-
- def italic?
- italic
- end
-
- def underline?
- underline != :none
- end
-end
-
# Class for handling Excel-Spreadsheets
class Roo::Excel < Roo::GenericSpreadsheet
@@ -257,6 +239,24 @@ class Roo::Excel < Roo::GenericSpreadsheet
end
end
+ # ruby-spreadsheet has a font object so we're extending it
+ # with our own functionality but still providing full access
+ # to the user for other font information
+ module ExcelFontExtensions
+ def bold?(*args)
+ #From ruby-spreadsheet doc: 100 <= weight <= 1000, bold => 700, normal => 400
+ weight == 700
+ end
+
+ def italic?
+ italic
+ end
+
+ def underline?
+ underline != :none
+ end
+ end
+
# read all cells in the selected sheet
def read_cells(sheet=nil)
sheet ||= @default_sheet
|
Move ExcelFontExtensions into Roo::Excel - no point in having it in the global namespace
|
roo-rb_roo
|
train
|
rb
|
aa2e8fb50598b7d93eeb0f8fcfef8adcfeb012e9
|
diff --git a/closure/goog/dom/dom_test.js b/closure/goog/dom/dom_test.js
index <HASH>..<HASH> 100644
--- a/closure/goog/dom/dom_test.js
+++ b/closure/goog/dom/dom_test.js
@@ -1041,7 +1041,7 @@ function testHtmlToDocumentFragment() {
var div = goog.dom.htmlToDocumentFragment('<div>3</div>');
assertEquals('DIV', div.tagName);
- if (goog.userAgent.IE) {
+ if (goog.userAgent.IE && !goog.userAgent.isVersion('9')) {
// Removing an Element from a DOM tree in IE sets its parentNode to a new
// DocumentFragment. Bizarre!
assertEquals(goog.dom.NodeType.DOCUMENT_FRAGMENT,
|
Update testHtmlToDocumentFragment to pass in IE9.
R=zhyder
DELTA=1 (0 added, 0 deleted, 1 changed)
Revision created by MOE tool push_codebase.
MOE_MIGRATION=<I>
git-svn-id: <URL>
|
google_closure-library
|
train
|
js
|
c11c5483d69995bb8ae462b75f5532ce6ae02a77
|
diff --git a/pre_commit_hooks/check_json.py b/pre_commit_hooks/check_json.py
index <HASH>..<HASH> 100644
--- a/pre_commit_hooks/check_json.py
+++ b/pre_commit_hooks/check_json.py
@@ -14,8 +14,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
with open(filename, 'rb') as f:
try:
json.load(f)
- # TODO: need UnicodeDecodeError?
- except (ValueError, UnicodeDecodeError) as exc:
+ except ValueError as exc:
print(f'{filename}: Failed to json decode ({exc})')
retval = 1
return retval
diff --git a/tests/check_json_test.py b/tests/check_json_test.py
index <HASH>..<HASH> 100644
--- a/tests/check_json_test.py
+++ b/tests/check_json_test.py
@@ -17,3 +17,9 @@ def test_main(capsys, filename, expected_retval):
if expected_retval == 1:
stdout, _ = capsys.readouterr()
assert filename in stdout
+
+
+def test_non_utf8_file(tmpdir):
+ f = tmpdir.join('t.json')
+ f.write_binary(b'\xa9\xfe\x12')
+ assert main((str(f),))
|
check-json: resolve TODO
|
pre-commit_pre-commit-hooks
|
train
|
py,py
|
3fe852c4dbb7bcfd069cf232ad09ba4f14cb0c7f
|
diff --git a/geomdl/Abstract.py b/geomdl/Abstract.py
index <HASH>..<HASH> 100644
--- a/geomdl/Abstract.py
+++ b/geomdl/Abstract.py
@@ -718,7 +718,7 @@ class Surface(object):
size=[self._control_points_size_u, self._control_points_size_v],
name="Control Points", color=cpcolor, plot_type='ctrlpts')
self._vis_component.add(ptsarr=self._surface_points,
- size=[self._sample_size, self._sample_size],
+ size=[self.sample_size, self.sample_size],
name="Surface", color=surfcolor, plot_type='evalpts')
self._vis_component.render()
|
Fixed a minor bug when the user sets delta but not sample_size
|
orbingol_NURBS-Python
|
train
|
py
|
f5d45d9d3fd7ea3d075f859cfae4445f5014246a
|
diff --git a/urwid_datatable/datatable.py b/urwid_datatable/datatable.py
index <HASH>..<HASH> 100644
--- a/urwid_datatable/datatable.py
+++ b/urwid_datatable/datatable.py
@@ -1642,8 +1642,7 @@ def main():
palette,
screen=screen,
pop_ups=True,
- unhandled_input=global_input,
- event_loop=urwid.TwistedEventLoop())
+ unhandled_input=global_input)
old_signal_keys = screen.tty_signal_keys()
l = list(old_signal_keys)
|
Take event_loop out of example so there's no dependency on twisted.
|
tonycpsu_panwid
|
train
|
py
|
6bf5871f8fe1e7cd54eb56614eea14561d7a786f
|
diff --git a/test/moment/create.js b/test/moment/create.js
index <HASH>..<HASH> 100644
--- a/test/moment/create.js
+++ b/test/moment/create.js
@@ -450,10 +450,13 @@ exports.create = {
},
"null" : function (test) {
- test.expect(3);
+ test.expect(6);
test.equal(moment(''), null, "Calling moment('')");
test.equal(moment(null), null, "Calling moment(null)");
test.equal(moment('', 'YYYY-MM-DD'), null, "Calling moment('', 'YYYY-MM-DD')");
+ test.equal(moment.utc(''), null, "Calling moment.utc('')");
+ test.equal(moment.utc(null), null, "Calling moment.utc(null)");
+ test.equal(moment.utc('', 'YYYY-MM-DD'), null, "Calling moment.utc('', 'YYYY-MM-DD')");
test.done();
},
|
Failing tests for moment.utc() returning null
|
moment_moment
|
train
|
js
|
7ba1edf31a2feb779255a05502227c3f3d883df1
|
diff --git a/Form/Admin/ProductStatusFormBuilder.php b/Form/Admin/ProductStatusFormBuilder.php
index <HASH>..<HASH> 100755
--- a/Form/Admin/ProductStatusFormBuilder.php
+++ b/Form/Admin/ProductStatusFormBuilder.php
@@ -40,6 +40,9 @@ class ProductStatusFormBuilder extends AbstractFormBuilder
$name = $languageData->addChild($this->getElement('text_field', [
'name' => 'name',
'label' => $this->trans('common.label.name'),
+ 'rules' => [
+ $this->getRule('required')
+ ]
]));
$languageData->addChild($this->getElement('slug_field', [
@@ -47,7 +50,10 @@ class ProductStatusFormBuilder extends AbstractFormBuilder
'label' => $this->trans('common.label.slug'),
'name_field' => $name,
'generate_route' => 'admin.routing.generate',
- 'translatable_id' => $this->getRequestHelper()->getAttributesBagParam('id')
+ 'translatable_id' => $this->getRequestHelper()->getAttributesBagParam('id'),
+ 'rules' => [
+ $this->getRule('required')
+ ]
]));
$languageData->addChild($this->getElement('text_field', [
|
Rules handling in forms
(cherry picked from commit b<I>c8ec4a<I>d4c7dce8deef4b<I>a0c<I>c)
|
WellCommerce_WishlistBundle
|
train
|
php
|
4861338aa08459511faa20fe58b390fce47b3ff7
|
diff --git a/nsq/__init__.py b/nsq/__init__.py
index <HASH>..<HASH> 100644
--- a/nsq/__init__.py
+++ b/nsq/__init__.py
@@ -8,7 +8,7 @@ formatter = logging.Formatter(
'%(asctime)s [%(levelname)s] %(filename)s@%(lineno)d: %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
-logger.setLevel(logging.FATAL)
+logger.setLevel(logging.INFO)
# Our underlying json implmentation
try:
|
Be more verbose in logging, by default
|
dlecocq_nsq-py
|
train
|
py
|
405c39047db9c3343ead715a5f2f8a7e91849032
|
diff --git a/src/Controller/CrudController.php b/src/Controller/CrudController.php
index <HASH>..<HASH> 100644
--- a/src/Controller/CrudController.php
+++ b/src/Controller/CrudController.php
@@ -161,7 +161,7 @@ class CrudController extends Base
// If there's a submethod defined, call that
$sSubMethod = $oUri->segment(5);
if ($sSubMethod && method_exists($this, $sSubMethod)) {
- $oResponse->setData($this->$sSubMethod($oItem));
+ $this->$sSubMethod($oResponse, $oItem);
} elseif ($sSubMethod && !method_exists($this, $sSubMethod)) {
throw new ApiException(
'"' . $sSubMethod . '" is not a valid subresource',
|
Passing the resposne to submethods on CRUD controller
|
nails_module-api
|
train
|
php
|
e931d3f72be04dfc0eb34831555ae2f66a90310e
|
diff --git a/spacy/language.py b/spacy/language.py
index <HASH>..<HASH> 100644
--- a/spacy/language.py
+++ b/spacy/language.py
@@ -434,10 +434,6 @@ class Language(object):
DOCS: https://spacy.io/api/language#call
"""
- if len(text) > self.max_length:
- raise ValueError(
- Errors.E088.format(length=len(text), max_length=self.max_length)
- )
doc = self.make_doc(text)
if component_cfg is None:
component_cfg = {}
@@ -464,6 +460,10 @@ class Language(object):
return DisabledPipes(self, *names)
def make_doc(self, text):
+ if len(text) > self.max_length:
+ raise ValueError(
+ Errors.E088.format(length=len(text), max_length=self.max_length)
+ )
return self.tokenizer(text)
def _format_docs_and_golds(self, docs, golds):
|
Move max_length to nlp.make_doc() (#<I>)
Move max_length check to `nlp.make_doc()` so that's it's also checked
for `nlp.pipe()`.
|
explosion_spaCy
|
train
|
py
|
9878039b1561ccb15e4ec72c179ddd8d1cd555ad
|
diff --git a/glue/replicate.js b/glue/replicate.js
index <HASH>..<HASH> 100644
--- a/glue/replicate.js
+++ b/glue/replicate.js
@@ -12,6 +12,8 @@ module.exports = function replicationGlue(sbot, layered, legacy) {
if (dest !== sbot.id) sbot.replicate.block(orig, dest, value === false)
}
+ sbot.replicate.request(sbot.id, true)
+
pull(
legacy.stream({ live: true }),
pull.filter(contacts => !!contacts),
|
self peer is interested in replicating its own data
|
ssbc_ssb-friends
|
train
|
js
|
b4316cb85fff8d57ecc0f7dab3357c913e98b915
|
diff --git a/jaraco/functools.py b/jaraco/functools.py
index <HASH>..<HASH> 100644
--- a/jaraco/functools.py
+++ b/jaraco/functools.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, unicode_literals, print_function
+from __future__ import absolute_import, unicode_literals, print_function, division
import functools
import time
|
Fix test failure on Python <I> where throttler was ineffective due to integer division.
|
jaraco_jaraco.functools
|
train
|
py
|
eb01f1e75cddb405b4df19a616a51cab916de83b
|
diff --git a/slackviewer/reader.py b/slackviewer/reader.py
index <HASH>..<HASH> 100644
--- a/slackviewer/reader.py
+++ b/slackviewer/reader.py
@@ -223,7 +223,7 @@ class Reader(object):
if 'reply_count' in message._message or 'replies' in message._message:
# Identify and save where we are
reply_list = []
- for reply in message._message['replies']:
+ for reply in message._message.get('replies', []):
reply_list.append(reply)
reply_objects = []
for item in reply_list:
|
Fix KeyError: 'replies' (#<I>)
|
hfaran_slack-export-viewer
|
train
|
py
|
e61814d9e7ad18cd338a5374e186048cabcbe652
|
diff --git a/angr/calling_conventions.py b/angr/calling_conventions.py
index <HASH>..<HASH> 100644
--- a/angr/calling_conventions.py
+++ b/angr/calling_conventions.py
@@ -493,13 +493,17 @@ class SimCC:
If you've customized this CC, this will sanity-check the provided locations with the given list.
"""
session = self.arg_session
- if self.func_ty is None:
- # No function prototype is provided. `is_fp` must be provided.
+ if self.func_ty is None and self.args is None:
+ # No function prototype is provided, no args is provided. `is_fp` must be provided.
if is_fp is None:
raise ValueError('"is_fp" must be provided when no function prototype is available.')
else:
- # let's rely on the func_ty for the number of arguments and whether each argument is FP or not
- is_fp = [ True if isinstance(arg, (SimTypeFloat, SimTypeDouble)) else False for arg in self.func_ty.args ]
+ # let's rely on the func_ty or self.args for the number of arguments and whether each argument is FP or not
+ if self.func_ty is not None:
+ args = self.func_ty.args
+ else:
+ args = self.args
+ is_fp = [ True if isinstance(arg, (SimTypeFloat, SimTypeDouble)) else False for arg in args ]
if sizes is None: sizes = [self.arch.bytes] * len(is_fp)
return [session.next_arg(ifp, size=sz) for ifp, sz in zip(is_fp, sizes)]
|
SimCC.arg_logs(): Check the existence of both func_ty and args. (#<I>)
* SimCC.arg_logs(): Check the existence of both func_ty and args.
* get the value after bypassing the check...
|
angr_angr
|
train
|
py
|
1c288052d23df83a4063d3720b6ff10c175dd47c
|
diff --git a/angr/simos.py b/angr/simos.py
index <HASH>..<HASH> 100644
--- a/angr/simos.py
+++ b/angr/simos.py
@@ -364,6 +364,9 @@ class SimCGC(SimOS):
return s
def state_entry(self, **kwargs):
+ if isinstance(self.proj.loader.main_bin, BackedCGC):
+ kwargs['permissions_backer'] = (True, self.proj.loader.main_bin.permissions_map)
+
state = super(SimCGC, self).state_entry(**kwargs)
if isinstance(self.proj.loader.main_bin, BackedCGC):
|
When loading from BackedCGC initialize the blank state with the permissions_map inside
|
angr_angr
|
train
|
py
|
5bbe6109b20f31953c249f9dbf6740971fd322c0
|
diff --git a/net_transport.go b/net_transport.go
index <HASH>..<HASH> 100644
--- a/net_transport.go
+++ b/net_transport.go
@@ -221,6 +221,11 @@ func (t *NetTransport) Shutdown() error {
// and hands them off to the stream channel.
func (t *NetTransport) tcpListen(tcpLn *net.TCPListener) {
defer t.wg.Done()
+
+ const baseDelay = 5 * time.Millisecond
+ const maxDelay = 1 * time.Second
+
+ var loopDelay time.Duration
for {
conn, err := tcpLn.AcceptTCP()
if err != nil {
@@ -228,9 +233,22 @@ func (t *NetTransport) tcpListen(tcpLn *net.TCPListener) {
break
}
+ if loopDelay == 0 {
+ loopDelay = baseDelay
+ } else {
+ loopDelay *= 2
+ }
+
+ if loopDelay > maxDelay {
+ loopDelay = maxDelay
+ }
+
t.logger.Printf("[ERR] memberlist: Error accepting TCP connection: %v", err)
+ time.Sleep(loopDelay)
continue
}
+ // No error, reset loop delay
+ loopDelay = 0
t.streamCh <- conn
}
|
added back-off to accept loop to avoid a tight loop
|
hashicorp_memberlist
|
train
|
go
|
80b293ccb9b313d6e06c2bb94ea35ae37d01c641
|
diff --git a/model/packageWalker.go b/model/packageWalker.go
index <HASH>..<HASH> 100644
--- a/model/packageWalker.go
+++ b/model/packageWalker.go
@@ -2,21 +2,31 @@ package model
import (
"go/ast"
+ "sort"
"github.com/marstr/collection"
)
// PackageWalker traverses an `*ast.Package` looking for top-level declarations of Constants, Functions, Types, or Variables.
type PackageWalker struct {
- target ast.Node
+ target *ast.Package
}
+// Enumerate traverses package content in order of its files lexographically sorted.
func (pw PackageWalker) Enumerate(cancel <-chan struct{}) collection.Enumerator {
plunger := newDepthBoundPlunger(2)
go func() {
defer plunger.Dispose()
-
- ast.Walk(plunger, pw.target)
+ // to ensure the output is deterministic copy the
+ // file names into a string slice and sort it.
+ files := make([]string, 0, len(pw.target.Files))
+ for f := range pw.target.Files {
+ files = append(files, f)
+ }
+ sort.Strings(files)
+ for _, f := range files {
+ ast.Walk(plunger, pw.target.Files[f])
+ }
}()
return plunger.Results()
|
Traverse package files in lexographically sorted order.
|
marstr_goalias
|
train
|
go
|
30091edc73f4f81f385e4ee0b4b6741851875ac7
|
diff --git a/FrontBundle/Manager/SitemapManager.php b/FrontBundle/Manager/SitemapManager.php
index <HASH>..<HASH> 100644
--- a/FrontBundle/Manager/SitemapManager.php
+++ b/FrontBundle/Manager/SitemapManager.php
@@ -100,10 +100,8 @@ class SitemapManager
try {
$nodeInfos = array(
'loc' => $this->router->generate(
- $node->getId(),
- array(
- 'aliasId' => $site->getMainAliasId(),
- ),
+ $site->getMainAliasId() . '_' . $node->getId(),
+ array(),
UrlGeneratorInterface::ABSOLUTE_URL
),
'lastmod' => $this->getLastModificationDate($node),
|
fix sitemap manager (#<I>)
|
open-orchestra_open-orchestra-front-bundle
|
train
|
php
|
99a6998f0837c51a2c17555037025344200fad6c
|
diff --git a/test/feature/relations/BelongsTo.spec.js b/test/feature/relations/BelongsTo.spec.js
index <HASH>..<HASH> 100644
--- a/test/feature/relations/BelongsTo.spec.js
+++ b/test/feature/relations/BelongsTo.spec.js
@@ -90,6 +90,25 @@ describe('Features – Relations – Belongs To', () => {
expect(store.state.entities).toEqual(expected)
})
+ it('returns created record from `create` method', async () => {
+ const store = createStore([{ model: User }, { model: Post }])
+
+ const result = await store.dispatch('entities/posts/create', {
+ data: {
+ id: 1,
+ user_id: 1,
+ user: { id: 1 }
+ }
+ })
+
+ const expected = {
+ users: [{ $id: 1, id: 1 }],
+ posts: [{ $id: 1, id: 1, user_id: 1, user: null }]
+ }
+
+ expect(result).toEqual(expected)
+ })
+
it('can resolve the belongs to relation', () => {
const store = createStore([{ model: User }, { model: Post }])
|
Add test case to check if belongs to relation returns correct object
|
vuex-orm_vuex-orm
|
train
|
js
|
cb3ccb420c324b7eb6d9d509b1f528d1dfe842a3
|
diff --git a/import_export/fields.py b/import_export/fields.py
index <HASH>..<HASH> 100644
--- a/import_export/fields.py
+++ b/import_export/fields.py
@@ -1,5 +1,6 @@
from . import widgets
+from django.core.exceptions import ObjectDoesNotExist
class Field(object):
"""
@@ -60,7 +61,7 @@ class Field(object):
for attr in attrs:
try:
value = getattr(value, attr)
- except ValueError:
+ except (ValueError, ObjectDoesNotExist):
# needs to have a primary key value before a many-to-many
# relationship can be used.
return None
diff --git a/import_export/resources.py b/import_export/resources.py
index <HASH>..<HASH> 100644
--- a/import_export/resources.py
+++ b/import_export/resources.py
@@ -196,8 +196,7 @@ class Resource(object):
self.import_obj(instance, row)
self.save_instance(instance, dry_run)
self.save_m2m(instance, row, dry_run)
- if not new:
- row_result.diff = self.get_diff(original, instance, dry_run)
+ row_result.diff = self.get_diff(original, instance, dry_run)
except Exception, e:
tb_info = traceback.format_exc(sys.exc_info()[2])
row_result.errors.append(Error(repr(e), tb_info))
|
Fixed diff crash for newly created instance in a cleaner way.
|
django-import-export_django-import-export
|
train
|
py,py
|
dace5fddd477aa5ce29ede5f5f6b0fe9242b3fc6
|
diff --git a/public/javascripts/refinery/admin.js b/public/javascripts/refinery/admin.js
index <HASH>..<HASH> 100644
--- a/public/javascripts/refinery/admin.js
+++ b/public/javascripts/refinery/admin.js
@@ -701,7 +701,7 @@ var image_dialog = {
imageThumbnailSize = '_' + imageThumbnailSize;
}
//alert(imageThumbnailSize);
- var relevant_src = imageUrl.pathname.replace('_dialog_thumb', imageThumbnailSize);
+ var relevant_src = imageUrl.pathname.replace('_dialog_thumb', imageThumbnailSize) + '?' + imageUrl.options;
if (imageUrl.protocol == "" && imageUrl.hostname == "assets") {
relevant_src = "/assets" + relevant_src;
}
@@ -963,7 +963,7 @@ parseURL = function(url)
//split the URL by single-slashes to get the component parts
var parts = url.replace('//', '/').split('/');
-
+
//store the protocol and host
loc.protocol = parts[0];
loc.host = parts[1];
@@ -988,6 +988,9 @@ parseURL = function(url)
loc.search = loc.pathname.length > 1 ? '?' + loc.pathname[1] : '';
loc.pathname = loc.pathname[0];
+ var options = url.split('?')[1];
+ loc.options = options;
+
//return the final object
return loc;
}
|
Image insertion was ignoring new dragonfly request URL standards
However, there is still a disconnect between choosing an image size and passing those to the Dragonfly .url(options) method
|
refinery_refinerycms
|
train
|
js
|
f81f81082d8e0177ac63dbdeb106a1b7559194dd
|
diff --git a/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol4.java b/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol4.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol4.java
+++ b/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol4.java
@@ -110,7 +110,7 @@ public class JnlpSlaveAgentProtocol4 extends AgentProtocol {
}
// prepare our keyStore so we can provide our authentication
- keyStore = KeyStore.getInstance("JKS");
+ keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
char[] password = constructPassword();
try {
keyStore.load(null, password);
|
Remove hardcode of JKS for use other key stores (#<I>)
|
jenkinsci_jenkins
|
train
|
java
|
b03e2ac706649bcb833be299e0b61ac27dcb309b
|
diff --git a/lib/Client.js b/lib/Client.js
index <HASH>..<HASH> 100644
--- a/lib/Client.js
+++ b/lib/Client.js
@@ -275,15 +275,30 @@ Client.prototype.createApplication = function() {
});
};
-Client.prototype.getDirectories = function getClientDirectories(/* [options,] callback */) {
- var self = this;
+/**
+ * @callback getDirectoriesCallback
+ * @param {Error} err - The error (if there is one).
+ * @param {Object} directories - The retrieved Directory objects.
+ */
+
+/**
+ * Retrieves all Directory objects.
+ *
+ * @method
+ * @param {Object} [options] - Options.
+ * @param {getDirectoriesCallback} callback - The callback that handles the
+ * response.
+ */
+Client.prototype.getDirectories = function() {
var args = Array.prototype.slice.call(arguments);
var callback = args.pop();
var options = (args.length > 0) ? args.shift() : null;
- return self.getCurrentTenant(function onGetCurrentTenantForDirectories(err, tenant) {
+
+ this.getCurrentTenant(function(err, tenant) {
if (err) {
- return callback(err, null);
+ return callback(err);
}
+
return tenant.getDirectories(options, callback);
});
};
|
Refactoring Client.getDirectories().
Adding jsdocs, simplifying codez.
|
stormpath_stormpath-sdk-node
|
train
|
js
|
dbfca8a22a3e660f327235a61905871a17f3a1c9
|
diff --git a/lib/plugins/enter.js b/lib/plugins/enter.js
index <HASH>..<HASH> 100755
--- a/lib/plugins/enter.js
+++ b/lib/plugins/enter.js
@@ -30,25 +30,19 @@ exports.plugin = function(commandRoute, cli) {
}
- cli.onCommand('enter', function() {
-
- var failed = false;
-
- var commands = cli.buffer().replace(cli.inputPrefix(),'').split(';'),
- running = commands.length;
-
- commands.forEach(function(command) {
- process.nextTick(function() {
- cli.emit(command, null, function(success) {
- failed = !success || failed;
-
- if(!(--running) && failed) {
- process.nextTick(cli.help);
- }
- })
- })
- });
-
- });
-
-}
\ No newline at end of file
+ cli.onCommand('enter', function() {
+ var failed = false;
+ var commands = cli.buffer().replace(cli.inputPrefix(),'').split(';'),
+ running = commands.length;
+ commands.forEach(function(command) {
+ process.nextTick(function() {
+ var success= cli.emit(command, null);
+ failed = !success || failed;
+ if(!(--running) && failed) {
+ console.log("Wrong command!");
+ process.nextTick(cli.help);
+ }
+ });
+ });
+ });
+}
|
Error handling when unknown command is called
|
crcn_celeri
|
train
|
js
|
d60bb2ef9859fc339ad1ed5762493a8daefa8c58
|
diff --git a/src/lib/widget.js b/src/lib/widget.js
index <HASH>..<HASH> 100644
--- a/src/lib/widget.js
+++ b/src/lib/widget.js
@@ -96,9 +96,8 @@ define([
}
function buildScopeRequest() {
- var scopes = remoteStorage.claimedModules;
- return Object.keys(remoteStorage.claimedModules).map(function(module) {
- return (module === 'root' && remoteStorage.getStorageType() === '2012.04' ? '' : module) + ':' + scopes[module];
+ return remoteStorage.access.scopes.map(function(module) {
+ return (module === 'root' && remoteStorage.getStorageType() === '2012.04' ? '' : module) + ':' + remoteStorage.access.get(module);
}).join(' ');
}
@@ -236,10 +235,6 @@ define([
options = {};
}
- if(Object.keys(remoteStorage.claimedModules).length === 0) {
- throw new Error("displayWidget called, but no access claimed! Make sure to call displayWidget after remoteStorage.claimAccess is done.");
- }
-
options.getLastSyncAt = function() {
return sync.lastSyncAt && sync.lastSyncAt.getTime();
};
|
query 'access' instead of remoteStorage.claimedModules in widget
|
remotestorage_remotestorage.js
|
train
|
js
|
8ec05c7dfa3d548a51aa25aa133f09f3947f008d
|
diff --git a/migrations/2016-05-26.1.appdb.backfill-acct-utxos-block-timestamp.go b/migrations/2016-05-26.1.appdb.backfill-acct-utxos-block-timestamp.go
index <HASH>..<HASH> 100644
--- a/migrations/2016-05-26.1.appdb.backfill-acct-utxos-block-timestamp.go
+++ b/migrations/2016-05-26.1.appdb.backfill-acct-utxos-block-timestamp.go
@@ -35,7 +35,7 @@ func main() {
panic(err)
}
err = pg.ForQueryRows(ctx, "SELECT data FROM blocks WHERE height IN (SELECT unnest($1::bigint[]))", pg.Uint64s(heights), func(b bc.Block) {
- _, err := pg.Exec(ctx, "UPDATE account_utxos SET block_timestamp = $1 WHERE confirmed_in = $2", b.Timestamp, b.Height)
+ _, err := pg.Exec(ctx, "UPDATE account_utxos SET block_timestamp = $1 WHERE confirmed_in = $2", b.TimestampMS, b.Height)
if err != nil {
panic(err)
}
|
migrations: update bc.Timestamp field to bc.TimestampMS
This migration was failing due to an out of date `bc.Timestamp` field.
Closes chain/chainprv#<I>.
Reviewers: @jbowens
|
chain_chain
|
train
|
go
|
14a3084b5974e76980b475316fcea77f4b5e44f4
|
diff --git a/lib/generators/devise/views_generator.rb b/lib/generators/devise/views_generator.rb
index <HASH>..<HASH> 100644
--- a/lib/generators/devise/views_generator.rb
+++ b/lib/generators/devise/views_generator.rb
@@ -42,7 +42,7 @@ module Devise
def view_directory(name, _target_path = nil)
directory name.to_s, _target_path || "#{target_path}/#{name}" do |content|
if scope
- content.gsub("devise/shared/links", "#{plural_scope}/shared/links").gsub("devise/shared/error_messages", "#{plural_scope}/shared/error_messages")
+ content.gsub("devise/shared", "#{plural_scope}/shared")
else
content
end
|
Simplify the view generator with scoped views
|
plataformatec_devise
|
train
|
rb
|
57a4c5c862d4617e0e279091dc856dd37532c546
|
diff --git a/src/Http/Controllers/Traits/BreadRelationshipParser.php b/src/Http/Controllers/Traits/BreadRelationshipParser.php
index <HASH>..<HASH> 100644
--- a/src/Http/Controllers/Traits/BreadRelationshipParser.php
+++ b/src/Http/Controllers/Traits/BreadRelationshipParser.php
@@ -18,7 +18,7 @@ trait BreadRelationshipParser
$options = json_decode($row->details);
if ($options->type == 'belongsTo') {
$relationshipField = @$options->column;
- $keyInCollection = key($dataType->{$bread_type . 'Rows'}->where('field', '=', $relationshipField)->toArray());
+ $keyInCollection = key($dataType->{$bread_type.'Rows'}->where('field', '=', $relationshipField)->toArray());
array_push($forget_keys, $keyInCollection);
}
}
|
Apply fixes from StyleCI (#<I>)
|
the-control-group_voyager
|
train
|
php
|
e3a9fc88780a24f31a786c390670460279372bbf
|
diff --git a/lib/angular/directive.js b/lib/angular/directive.js
index <HASH>..<HASH> 100644
--- a/lib/angular/directive.js
+++ b/lib/angular/directive.js
@@ -78,10 +78,9 @@ ngModule.directive('schedule', function($templateCache, $compile, $timeout, medi
})
}
- function scheduleWorkorder(workorder, workerId, hour) {
+ function scheduleWorkorder(workorder, workerId, date, hour) {
workorder.assignee = workerId;
- if (hour !== null) {
- var date = new Date();
+ if (date != null && hour !== null) {
date.setHours(hour);
workorder.startTimestamp = date.getTime();
} else {
@@ -166,11 +165,11 @@ ngModule.directive('schedule', function($templateCache, $compile, $timeout, medi
dropElement.classList.remove('dragover');
var scheduledWorkorder = angular.copy(workorder);
if (dropElement.id === 'workorders-list') {
- scheduleWorkorder(scheduledWorkorder, null, null);
+ scheduleWorkorder(scheduledWorkorder, null, null, null);
} else {
var workerId = dropElement.dataset.workerid;
var hour = dropElement.dataset.hour;
- scheduleWorkorder(scheduledWorkorder, workerId, hour);
+ scheduleWorkorder(scheduledWorkorder, workerId, scope.ctrl.scheduleDate, hour);
}
updateWorkorder(scheduledWorkorder)
.then(function(updated) {
|
Fixed scheduling workorders in the future
|
raincatcher-beta_raincatcher-schedule
|
train
|
js
|
590a52357da23abef014d28a1a2ac0339679a5f3
|
diff --git a/lib/Grid/Advanced.php b/lib/Grid/Advanced.php
index <HASH>..<HASH> 100644
--- a/lib/Grid/Advanced.php
+++ b/lib/Grid/Advanced.php
@@ -287,7 +287,7 @@ class Grid_Advanced extends Grid_Basic {
$this->current_row[$field].'</label>';
}
function prepareIdField($val){
- return preg_replace("/[^a-zA-Z0-9_]/", "_", $val);
+ return $this->api->normalizeName($val);
}
function init_expander_widget($field){
@$this->columns[$field]['thparam'].=' style="width: 40px; text-align: center"';
|
Grid_Advanced: normalizeName
|
atk4_atk4
|
train
|
php
|
1800a9b2c176cc5f8f3b34d36233206e49d088d7
|
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index <HASH>..<HASH> 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1252,7 +1252,7 @@ class Mastodon:
avatar_file_name = "mastodonpyupload_" + mimetypes.guess_extension(avatar_mime_type)
files["avatar"] = (avatar_file_name, avatar, avatar_mime_type)
if not header is None:
- header_file_name = "mastodonpyupload_" + mimetypes.guess_extension(avatar_mime_type)
+ header_file_name = "mastodonpyupload_" + mimetypes.guess_extension(header_mime_type)
files["header"] = (header_file_name, header, header_mime_type)
params = self.__generate_params(params_initial)
|
Fix typo in account_update_credentials
Mime type of avatar was used to guess extension of header.
|
halcy_Mastodon.py
|
train
|
py
|
a1a668d0ddc47687221f168af90150e5fdd87998
|
diff --git a/packages/babel-plugin-transform-es2015-modules-reify/index.js b/packages/babel-plugin-transform-es2015-modules-reify/index.js
index <HASH>..<HASH> 100644
--- a/packages/babel-plugin-transform-es2015-modules-reify/index.js
+++ b/packages/babel-plugin-transform-es2015-modules-reify/index.js
@@ -1,13 +1,13 @@
module.exports = function () {
var transform = require("reify/lib/compiler.js").transform;
- var options = {
- parse: require("reify/lib/parsers/babylon.js").parse
- };
+ var parse = require("reify/lib/parsers/babylon.js").parse;
return {
visitor: {
Program: function (path) {
- path.replaceWith(transform(path.node, options));
+ transform(path.node, Object.assign({
+ parse: parse
+ }, this.opts));
}
}
};
|
Pass Babel plugin options through to compiler.transform.
|
benjamn_reify
|
train
|
js
|
e4f49054c78407d1555cbab38ec5b1aec80a6a96
|
diff --git a/flyfile.js b/flyfile.js
index <HASH>..<HASH> 100644
--- a/flyfile.js
+++ b/flyfile.js
@@ -1,15 +1,13 @@
-var x = module.exports;
-var paths = {
- src: 'lib/**/*.js',
- dist: 'dist'
-};
+'use strict';
+
+var src = 'lib/**/*.js';
-x.default = function * () {
+module.exports.default = function * () {
/** @desc Fly's default development task. */
- yield this.source(paths.src).xo();
- yield this.clear(paths.dist);
+ yield this.source(src).xo();
yield this
.log('Building Fly...')
- .source(paths.src)
- .target(paths.dist);
+ .source(src)
+ .target('tmp');
+ yield this.clear('tmp');
};
|
flyfile syntax & cleanup 'built' files after test-run
|
lukeed_taskr
|
train
|
js
|
033e1129b1dc959fc6b82c511ec67b9685aadbac
|
diff --git a/thinc/layers/softmax_activation.py b/thinc/layers/softmax_activation.py
index <HASH>..<HASH> 100644
--- a/thinc/layers/softmax_activation.py
+++ b/thinc/layers/softmax_activation.py
@@ -18,6 +18,6 @@ def forward(model: Model[InT, OutT], X: InT, is_train: bool) -> Tuple[OutT, Call
Y = model.ops.softmax(X, inplace=False)
def backprop(dY: OutT) -> InT:
- return dY
+ return model.ops.backprop_softmax(Y, dY, axis=-1)
return Y, backprop
|
Maybe irrelevant fix to softmax_activation?
|
explosion_thinc
|
train
|
py
|
98e534147720f4eb0b33129a9012a8b5c38d66f6
|
diff --git a/lib/CLIntegracon/subject.rb b/lib/CLIntegracon/subject.rb
index <HASH>..<HASH> 100644
--- a/lib/CLIntegracon/subject.rb
+++ b/lib/CLIntegracon/subject.rb
@@ -105,7 +105,7 @@ module CLIntegracon
#
def launch(arguments, &block)
vars = environment_vars.map { |key,value| "#{key}=#{value}" }.join ' '
- args = "#{arguments} #{default_args.join(' ')}"
+ args = "#{default_args.join(' ')} #{arguments}"
command = "#{vars} #{executable} #{args} 2>&1"
output = `#{command}`
|
Swapped order of default and specific args in Subject#launch
|
mrackwitz_CLIntegracon
|
train
|
rb
|
ec722e87c8eb3bb7c3d913c95c4b5c620ceb78d2
|
diff --git a/lib/hook.js b/lib/hook.js
index <HASH>..<HASH> 100644
--- a/lib/hook.js
+++ b/lib/hook.js
@@ -67,11 +67,11 @@ module.exports = function(sails) {
req.options.controller = model;
req.options.model = model;
- req.body = JsonApiService.deserialize(req.body);
if (sails.controllers[model].update !== undefined) {
return sails.controllers[model].update(req, res);
} else {
+ req.body = JsonApiService.deserialize(req.body);
return BlueprintController.update(req, res);
}
};
|
Deserialize input payload only if default blueprints is called
|
dynamiccast_sails-json-api-blueprints
|
train
|
js
|
69acba264a554cc71200ab89b22fd9e93fb952f2
|
diff --git a/jsonrpcclient/http_server.py b/jsonrpcclient/http_server.py
index <HASH>..<HASH> 100644
--- a/jsonrpcclient/http_server.py
+++ b/jsonrpcclient/http_server.py
@@ -21,13 +21,13 @@ class HTTPServer(Server):
"""
# The default HTTP header
- DEFAULT_HTTP_HEADERS = {
+ __DEFAULT_HTTP_HEADERS__ = {
'Content-Type': 'application/json', 'Accept': 'application/json'}
def __init__(self, endpoint):
super(HTTPServer, self).__init__(endpoint)
self.session = Session()
- self.session.headers.update(self.DEFAULT_HTTP_HEADERS)
+ self.session.headers.update(self.__DEFAULT_HTTP_HEADERS__)
def _send_message(self, request, headers=None, files=None, params=None,
auth=None, cookies=None, **kwargs):
|
Double underscore for private DEFAULT_HTTP_HEADERS
Re #<I>
|
bcb_jsonrpcclient
|
train
|
py
|
1332b43df45713c5ad1a6178b0b258a0ab5b45a3
|
diff --git a/utils/test/ex.py b/utils/test/ex.py
index <HASH>..<HASH> 100644
--- a/utils/test/ex.py
+++ b/utils/test/ex.py
@@ -16,8 +16,20 @@ data = pd.read_csv(r'C:\Users\torkv\OneDrive - Norwegian University of Life '
r'\data\20160805_sic006_45_cc_01_ocvrlx_down.csv',
sep=';')
data.to_csv('new_data')
-data = pd.read_csv('new_data', index_col=range(1, 35, 2))
-print data.iloc[0]
+data = pd.read_csv('new_data', index_col=0)
+t = []
+v = []
+for i in range(len(data.iloc[0, :])):
+ for column in data.iloc[:, i]:
+ if i % 2:
+ v.append(column)
+ else:
+ t.append(column)
+plt.plot(t, v)
+
+
+
+# print data.iloc[0]
# time = df.loc[:, ::2]
# voltage = df.loc[:, 1::2]
# print time
|
stopped using pandas, cause I didn't get it. Instead ex now plots a list t and v (time and voltage).
|
jepegit_cellpy
|
train
|
py
|
6ae31751c3439f1d5bf34a7625aa79532592843f
|
diff --git a/jose/jws.py b/jose/jws.py
index <HASH>..<HASH> 100644
--- a/jose/jws.py
+++ b/jose/jws.py
@@ -208,8 +208,11 @@ def _load(jwt):
def _sig_matches_keys(keys, signing_input, signature, alg):
for key in keys:
key = jwk.construct(key, alg)
- if key.verify(signing_input, signature):
- return True
+ try:
+ if key.verify(signing_input, signature):
+ return True
+ except:
+ pass
return False
|
fix: Handler errors in list of keys
|
mpdavis_python-jose
|
train
|
py
|
18be82118d56c3460c3bd1b82587d41e340e67ae
|
diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -338,11 +338,11 @@ func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, er
// Subscribe to events that match one or more of the provided filters.
//
-// Callers should listen on both the envelope channel and errs channel. If the
-// errs channel returns nil or an error, the subscriber should terminate.
+// Callers should listen on both the envelope and errs channels. If the errs
+// channel returns nil or an error, the subscriber should terminate.
//
-// To cancel shutdown reciept of events, cancel the provided context. The errs
-// channel will be closed and return a nil error.
+// The subscriber can stop receiving events by canceling the provided context.
+// The errs channel will be closed and return a nil error.
func (c *Client) Subscribe(ctx context.Context, filters ...string) (ch <-chan *eventsapi.Envelope, errs <-chan error) {
var (
evq = make(chan *eventsapi.Envelope)
|
Clean up client Subscribe docs; remove a typo
|
containerd_containerd
|
train
|
go
|
a983c40cdd6ebbba1406aa713f134a751f12b7c3
|
diff --git a/internal/ackhandler/sent_packet_handler.go b/internal/ackhandler/sent_packet_handler.go
index <HASH>..<HASH> 100644
--- a/internal/ackhandler/sent_packet_handler.go
+++ b/internal/ackhandler/sent_packet_handler.go
@@ -187,7 +187,7 @@ func (h *sentPacketHandler) SentPacket(packet *Packet) {
if isAckEliciting {
h.getPacketNumberSpace(packet.EncryptionLevel).history.SentPacket(packet)
}
- if h.qlogger != nil {
+ if h.qlogger != nil && isAckEliciting {
h.qlogger.UpdatedMetrics(h.rttStats, h.congestion.GetCongestionWindow(), h.bytesInFlight, h.packetsInFlight())
}
if isAckEliciting || !h.peerCompletedAddressValidation {
|
don't log a metrics_update when sending a non-ack-eliciting packet
|
lucas-clemente_quic-go
|
train
|
go
|
59b58238b264e1b2ae6477725d4f72832e50b931
|
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index <HASH>..<HASH> 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -1438,6 +1438,43 @@ class DataFrame(PandasGeneric):
from pandas.core.panel import pivot
return pivot(self[index], self[columns], self[values])
+ def pivot2(self, index=None, columns=None, values=None):
+ """
+ Produce 'pivot' table based on 3 columns of this DataFrame.
+ Uses unique values from index / columns and fills with values.
+
+ Parameters
+ ----------
+ index : string or object
+ Column name to use to make new frame's index
+ columns : string or object
+ Column name to use to make new frame's columns
+ values : string or object
+ Column name to use for populating new frame's values
+ """
+ from pandas.core.panel import _make_long_index, LongPanel
+
+ frame = self.copy()
+ index = frame.pop(index)
+ columns = frame.pop(columns)
+ long_index = _make_long_index(index, columns)
+
+ if values is None:
+ items = frame.columns
+ else:
+ items = [values]
+ frame = frame.ix[:, items]
+
+ mat = frame.values
+ lp = LongPanel(mat, items, long_index)
+ lp = lp.sort()
+
+ wp = lp.to_wide()
+ if values is not None:
+ return wp[values]
+ else:
+ return wp
+
#----------------------------------------------------------------------
# Time series-related
|
pivot multiple columns at once, need tests etc. still
|
pandas-dev_pandas
|
train
|
py
|
e238202438736942e9c0b4b5f404d19b9860a01a
|
diff --git a/ckanutils/utils.py b/ckanutils/utils.py
index <HASH>..<HASH> 100644
--- a/ckanutils/utils.py
+++ b/ckanutils/utils.py
@@ -398,7 +398,7 @@ def chunk(iterable, chunksize=0, start=0, stop=None):
return chunked
-def hash_file(filepath, hasher='sha1', chunksize=0):
+def hash_file(filepath, hasher='sha1', chunksize=0, verbose=False):
"""Hashes a file.
http://stackoverflow.com/a/1131255/408556
@@ -407,6 +407,7 @@ def hash_file(filepath, hasher='sha1', chunksize=0):
hasher (str): The hashlib hashing algorithm to use.
chunksize (Optional[int]): Number of bytes to write at a time (default:
0, i.e., all).
+ verbose (Optional[bool]): Print debug statements (default: False).
Returns:
str: File hash.
@@ -431,4 +432,9 @@ def hash_file(filepath, hasher='sha1', chunksize=0):
else:
hasher.update(f.read())
- return hasher.hexdigest()
+ file_hash = hasher.hexdigest()
+
+ if verbose:
+ print('File %s hash is %s.' % (filepath, file_hash))
+
+ return file_hash
|
Add verbose option support to hash_file
|
reubano_ckanutils
|
train
|
py
|
6dcdebbd23fd9bbb7eb00f6548b3bb59d64517b2
|
diff --git a/cursor.go b/cursor.go
index <HASH>..<HASH> 100644
--- a/cursor.go
+++ b/cursor.go
@@ -154,6 +154,8 @@ func (c *Cursor) Close() error {
// When Next returns false, the Err method should be called to verify if
// there was an error during iteration.
//
+// Next will automatically close the cursor if there are no more records to parse
+//
// Also note that you are able to reuse the same variable multiple times as
// `Next` zeroes the value before scanning in the result.
func (c *Cursor) Next(dest interface{}) bool {
|
docs(): add documentation about Nexts auto-closing behavior
|
rethinkdb_rethinkdb-go
|
train
|
go
|
bd57176c35b9f40311d41e2c948c43b9384c728e
|
diff --git a/src/stackTools/fusionRenderer.js b/src/stackTools/fusionRenderer.js
index <HASH>..<HASH> 100644
--- a/src/stackTools/fusionRenderer.js
+++ b/src/stackTools/fusionRenderer.js
@@ -31,6 +31,10 @@ export default class FusionRenderer {
const currentLayerId = this.layerIds[0];
const layer = cornerstone.getLayer(element, currentLayerId);
+ if (layer === undefined) {
+ return;
+ }
+
layer.image = Object.assign({}, image);
} else {
const layerId = cornerstone.addLayer(element, Object.assign({}, image), baseImageObject.options);
@@ -58,6 +62,10 @@ export default class FusionRenderer {
const currentLayerId = this.layerIds[layerIndex];
const layer = cornerstone.getLayer(element, currentLayerId);
+ if (layer === undefined) {
+ return;
+ }
+
layer.image = Object.assign({}, image);
} else {
const layerId = cornerstone.addLayer(element, Object.assign({}, image), imgObj.options);
|
fusionRenderer does not crash if the layer is destroyed while rendering (#<I>)
|
cornerstonejs_cornerstoneTools
|
train
|
js
|
67b7c5adc881a9cd84bcaf2d9ed0c35ce955b121
|
diff --git a/dht/dht.go b/dht/dht.go
index <HASH>..<HASH> 100644
--- a/dht/dht.go
+++ b/dht/dht.go
@@ -21,7 +21,7 @@ import (
"github.com/anacrolix/libtorgo/bencode"
)
-const maxNodes = 10000
+const maxNodes = 1000
// Uniquely identifies a transaction to us.
type transactionKey struct {
diff --git a/dht/getpeers.go b/dht/getpeers.go
index <HASH>..<HASH> 100644
--- a/dht/getpeers.go
+++ b/dht/getpeers.go
@@ -41,7 +41,7 @@ func (s *Server) GetPeers(infoHash string) (*peerStream, error) {
stop: make(chan struct{}),
values: make(chan peerStreamValue),
},
- triedAddrs: bloom.NewWithEstimates(10000, 0.01),
+ triedAddrs: bloom.NewWithEstimates(1000, 0.5),
server: s,
infoHash: infoHash,
}
|
dht: Reduce memory use
|
anacrolix_torrent
|
train
|
go,go
|
6bf9eee8336c056480826a807b36f899ece46002
|
diff --git a/lib/doorkeeper/oauth/client/credentials.rb b/lib/doorkeeper/oauth/client/credentials.rb
index <HASH>..<HASH> 100644
--- a/lib/doorkeeper/oauth/client/credentials.rb
+++ b/lib/doorkeeper/oauth/client/credentials.rb
@@ -1,7 +1,7 @@
module Doorkeeper
module OAuth
class Client
- class Credentials < Struct.new(:uid, :secret)
+ Credentials = Struct.new(:uid, :secret) do
class << self
def from_request(request, *credentials_methods)
credentials_methods.inject(nil) do |credentials, method|
diff --git a/lib/doorkeeper/oauth/error.rb b/lib/doorkeeper/oauth/error.rb
index <HASH>..<HASH> 100644
--- a/lib/doorkeeper/oauth/error.rb
+++ b/lib/doorkeeper/oauth/error.rb
@@ -1,6 +1,6 @@
module Doorkeeper
module OAuth
- class Error < Struct.new(:name, :state)
+ Error = Struct.new(:name, :state) do
def description
I18n.translate(
name,
|
Replace Struct subclassing with block-form initialization
|
doorkeeper-gem_doorkeeper
|
train
|
rb,rb
|
fd4f12aac8ae9523dad3304167ca4b9a9c50db61
|
diff --git a/features/environment.py b/features/environment.py
index <HASH>..<HASH> 100644
--- a/features/environment.py
+++ b/features/environment.py
@@ -115,7 +115,9 @@ class PatroniController(AbstractController):
config['postgresql']['listen'] = config['postgresql']['connect_address'] = '{0}:{1}'.format(host, self.__PORT)
- self._connstring = 'host={0} port={1} dbname=postgres user=postgres'.format(host, self.__PORT)
+ user = config['postgresql'].get('superuser', {})
+ self._connkwargs = {k: user[n] for n, k in [('username', 'user'), ('password', 'password')] if n in user}
+ self._connkwargs.update({'host': host, 'port': self.__PORT, 'database': 'postgres'})
config['postgresql'].update({'name': name, 'data_dir': self._data_dir})
config['postgresql']['parameters'].update({
@@ -141,7 +143,7 @@ class PatroniController(AbstractController):
def _connection(self):
if not self._conn or self._conn.closed != 0:
- self._conn = psycopg2.connect(self._connstring)
+ self._conn = psycopg2.connect(**self._connkwargs)
self._conn.autocommit = True
return self._conn
|
Do not assume that connection user is postgres, but take it from config.yml
|
zalando_patroni
|
train
|
py
|
87971cca1a3f8cd4e8ed2158508e3aec8baef65f
|
diff --git a/manticore/core/cpu/arm.py b/manticore/core/cpu/arm.py
index <HASH>..<HASH> 100644
--- a/manticore/core/cpu/arm.py
+++ b/manticore/core/cpu/arm.py
@@ -856,3 +856,9 @@ class Armv7Cpu(Cpu):
'''
pass
+ @instruction
+ def LDCL(cpu, *operands):
+ '''
+ Occasionally used in glibc (longjmp in ld.so). Nop under our execution model.
+ '''
+ pass
|
Add arm LDCL (#<I>)
|
trailofbits_manticore
|
train
|
py
|
a5dc55a192716c7e04ed2c3417e85ef9a31dd2a2
|
diff --git a/GPyOpt/core/evaluators/batch_local_penalization.py b/GPyOpt/core/evaluators/batch_local_penalization.py
index <HASH>..<HASH> 100644
--- a/GPyOpt/core/evaluators/batch_local_penalization.py
+++ b/GPyOpt/core/evaluators/batch_local_penalization.py
@@ -56,6 +56,8 @@ def estimate_L(model,bounds,storehistory=True):
def df(x,model,x0):
x = np.atleast_2d(x)
dmdx,_ = model.predictive_gradients(x)
+ if dmdx.ndim>2:
+ dmdx = dmdx.reshape(dmdx.shape[:2])
res = np.sqrt((dmdx*dmdx).sum(1)) # simply take the norm of the expectation of the gradient
return -res
@@ -64,7 +66,7 @@ def estimate_L(model,bounds,storehistory=True):
pred_samples = df(samples,model,0)
x0 = samples[np.argmin(pred_samples)]
res = scipy.optimize.minimize(df,x0, method='L-BFGS-B',bounds=bounds, args = (model,x0), options = {'maxiter': 200})
- minusL = res.fun[0][0]
+ minusL = float(res.fun)
L = -minusL
if L<1e-7: L=10 ## to avoid problems in cases in which the model is flat.
return L
|
Fix the bug with respect to scipy <I> (#<I>)
The LP optimization fails when scipy upgrades to <I>
|
SheffieldML_GPyOpt
|
train
|
py
|
a75f21a4b002d461d291132f4efaecd695a018a6
|
diff --git a/app/models/edition.rb b/app/models/edition.rb
index <HASH>..<HASH> 100644
--- a/app/models/edition.rb
+++ b/app/models/edition.rb
@@ -171,20 +171,11 @@ class Edition
# we are changing the type of the edition, any fields other than the base
# fields will likely be meaningless.
def fields_to_copy(target_class)
- return_value = [
- :title,
- :panopticon_id,
- :overview,
- :slug,
- :browse_pages,
- :primary_topic,
- :additional_topics
- ]
if target_class == self.class
- type_specific_keys = self.fields.keys - Edition.fields.keys
- return_value += type_specific_keys
+ base_field_keys + type_specific_field_keys
+ else
+ base_field_keys
end
- return_value
end
def build_clone(target_class=nil)
@@ -321,4 +312,21 @@ class Edition
Artefact.find(self.panopticon_id).destroy
end
end
+
+private
+ def base_field_keys
+ [
+ :title,
+ :panopticon_id,
+ :overview,
+ :slug,
+ :browse_pages,
+ :primary_topic,
+ :additional_topics,
+ ]
+ end
+
+ def type_specific_field_keys
+ self.fields.keys - Edition.fields.keys
+ end
end
|
Extract local variables to private methods
Just trying to make this method a bit more readable
|
alphagov_govuk_content_models
|
train
|
rb
|
57fefba0eb45a21e7fb57bc2400a1cff22c7b72b
|
diff --git a/addon/utils/has-block.js b/addon/utils/has-block.js
index <HASH>..<HASH> 100644
--- a/addon/utils/has-block.js
+++ b/addon/utils/has-block.js
@@ -5,17 +5,21 @@ const { major, minor, isGlimmer } = emberVersionInfo();
let hasBlockSymbol;
-if (major > 3 || (major == 3 && minor >= 1)) {
- // Ember-glimmer moved to TypeScript since v3.1
- // Do nothing since the symbol is not exported
-} else if (isGlimmer) {
- hasBlockSymbol = Ember.__loader.require('ember-glimmer/component')[
- 'HAS_BLOCK'
- ];
-} else {
- hasBlockSymbol = Ember.__loader.require('ember-htmlbars/component')[
- 'HAS_BLOCK'
- ];
+try {
+ if (major > 3 || (major == 3 && minor >= 1)) {
+ // Ember-glimmer moved to TypeScript since v3.1
+ // Do nothing since the symbol is not exported
+ } else if (isGlimmer) {
+ hasBlockSymbol = Ember.__loader.require('ember-glimmer/component')[
+ 'HAS_BLOCK'
+ ];
+ } else {
+ hasBlockSymbol = Ember.__loader.require('ember-htmlbars/component')[
+ 'HAS_BLOCK'
+ ];
+ }
+} catch (e) {
+ // Fallback to use runtime check
}
// NOTE: I really don't know how to test this
|
Add try block to allow fallback to runtime check for HAS_BLOCK symbol
|
AltSchool_ember-cli-react
|
train
|
js
|
a239f8db45e4226d863dcf76cf6c62e35576fca6
|
diff --git a/plugin.js b/plugin.js
index <HASH>..<HASH> 100644
--- a/plugin.js
+++ b/plugin.js
@@ -1,5 +1,4 @@
var flowStatus = require('./lib/flowStatus');
-var mainLocOfError = require('./lib/flowResult').mainLocOfError;
function FlowtypePlugin(options) {
this._options = options || {};
@@ -50,11 +49,7 @@ FlowtypePlugin.prototype._notifyResourceError = function(resource) {
if (resource.callback) {
var errors = [];
if (this._flowStatus && !this._flowStatus.passed) {
- errors = this._flowStatus.errors.filter(function (error) {
- var mainLoc = mainLocOfError(error);
- var mainFile = mainLoc && mainLoc.source;
- return mainFile === resource.path;
- });
+ errors = this._flowStatus.errors
}
resource.callback(errors, this._options);
}
|
Don't filter errors from downstream modules (#6), Fixes #4
* Don't filter errors from downstream modules
* Remove mainLocOfError import from plugin.js
|
torifat_flowtype-loader
|
train
|
js
|
88b3a7ff89230cad7c9c416537ebc29114b6860d
|
diff --git a/src/ThrowOnErrorTransport.php b/src/ThrowOnErrorTransport.php
index <HASH>..<HASH> 100644
--- a/src/ThrowOnErrorTransport.php
+++ b/src/ThrowOnErrorTransport.php
@@ -21,6 +21,10 @@ final class ThrowOnErrorTransport implements Transport
$this->fulfill = $fulfill;
}
+ /**
+ * @throws ClientError When the status code is 4**
+ * @throws ServerError When the status code is 5**
+ */
public function __invoke(Request $request): Response
{
$response = ($this->fulfill)($request);
|
add docblock to explain the exceptions thrown
|
Innmind_HttpTransport
|
train
|
php
|
b0425dfb79ee145b764c6b802c45f060a08b77de
|
diff --git a/mimesis/utils.py b/mimesis/utils.py
index <HASH>..<HASH> 100755
--- a/mimesis/utils.py
+++ b/mimesis/utils.py
@@ -75,7 +75,6 @@ def pull(file: str, locale: str = 'en') -> JSON:
>>> en['day']['abbr'][1]
'Mon.'
"""
-
def get_data(locale_name: str) -> JSON:
"""Pull JSON data from file.
|
Removed disallowed blank space in function
|
lk-geimfari_mimesis
|
train
|
py
|
6ee457e9f5dd53e7d87ea3bddc88e84efa49f10f
|
diff --git a/spec/parser/tag_attributes_spec.rb b/spec/parser/tag_attributes_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/parser/tag_attributes_spec.rb
+++ b/spec/parser/tag_attributes_spec.rb
@@ -65,4 +65,15 @@ a(href = 'href_text', id = 'id_text') abc_text_haha
assert_html expected, source
end
+
+ it 'should parse attributes with double quoted attributes' do
+ source = '
+a(href = "href_text", id = "id_text") abc_text_haha
+ b(class = "aaa") bbb
+'
+
+ expected = '<a href="href_text" id="id_text">abc_text_haha<b class="aaa">bbb</b></a>'
+
+ assert_html expected, source
+ end
end
|
added test for attributes with double quoted values
|
epuber-io_bade
|
train
|
rb
|
70ecb1c3c88c9ff36d59314e6001d47dc25bfb13
|
diff --git a/src/MoneyBag.php b/src/MoneyBag.php
index <HASH>..<HASH> 100644
--- a/src/MoneyBag.php
+++ b/src/MoneyBag.php
@@ -1,6 +1,7 @@
<?php
namespace Brick\Money;
+
use Brick\Money\MoneyContext\ExactContext;
/**
@@ -23,12 +24,13 @@ class MoneyBag implements MoneyContainer
* If no money is present for the given currency, a zero-value money with the default scale
* for the given currency will be returned.
*
- * @param Currency $currency
+ * @param Currency|string $currency
*
* @return Money
*/
- public function get(Currency $currency)
+ public function get($currency)
{
+ $currency = Currency::of($currency);
$currencyCode = $currency->getCurrencyCode();
return isset($this->monies[$currencyCode])
@@ -39,13 +41,14 @@ class MoneyBag implements MoneyContainer
/**
* Returns the total of the monies contained in this bag, in the given currency.
*
- * @param Currency $currency The currency to get the total in.
+ * @param Currency|string $currency The currency to get the total in.
* @param CurrencyConverter $converter The currency converter to use.
*
* @return Money The total in the given currency.
*/
- public function getTotal(Currency $currency, CurrencyConverter $converter)
+ public function getTotal($currency, CurrencyConverter $converter)
{
+ $currency = Currency::of($currency);
$total = Money::zero($currency);
$context = new ExactContext();
|
Allow currency code in MoneyBag
|
brick_money
|
train
|
php
|
bbeef44e667e547cb225cca55d0c918f41fb8be9
|
diff --git a/src/client/ClientDataResolver.js b/src/client/ClientDataResolver.js
index <HASH>..<HASH> 100644
--- a/src/client/ClientDataResolver.js
+++ b/src/client/ClientDataResolver.js
@@ -191,15 +191,13 @@ class ClientDataResolver {
}
/**
- * Turn an array of permissions into a valid discord permission bitfield
+ * Turn an array of permissions into a valid Discord permission bitfield
* @param {PermissionResolvable[]} permissions Permissions to resolve together
* @returns {number}
*/
resolvePermissions(permissions) {
let bitfield = 0;
- for (const permission of permissions) {
- bitfield |= this.resolvePermission(permission);
- }
+ for (const permission of permissions) bitfield |= this.resolvePermission(permission);
return bitfield;
}
|
Update ClientDataResolver.js
|
discordjs_discord.js
|
train
|
js
|
c8065865b3b56acd7fa8222af70703c7cd129629
|
diff --git a/Kwc/Events/Directory/Component.php b/Kwc/Events/Directory/Component.php
index <HASH>..<HASH> 100644
--- a/Kwc/Events/Directory/Component.php
+++ b/Kwc/Events/Directory/Component.php
@@ -15,8 +15,6 @@ class Kwc_Events_Directory_Component extends Kwc_News_Directory_Component
$ret['generators']['child']['component']['view'] = 'Kwc_Events_List_View_Component';
- $ret['flags']['assetsPackage'] = 'Events';
-
return $ret;
}
|
Remove own Events assets package, use inherited News
Fixes problem when a web uses News and Events, where child components of detail (eg. MetaTags) would be in two packages.
|
koala-framework_koala-framework
|
train
|
php
|
41acc0e62ca38f2a62ea2384351394e7035cccb4
|
diff --git a/lib/xcodeproj/scheme.rb b/lib/xcodeproj/scheme.rb
index <HASH>..<HASH> 100644
--- a/lib/xcodeproj/scheme.rb
+++ b/lib/xcodeproj/scheme.rb
@@ -110,7 +110,7 @@ module Xcodeproj
buildable_reference.attributes['ReferencedContainer'] = construct_referenced_container_uri(test_target)
end
- # Sets a runnable target target to be the target of the launch action of the scheme.
+ # Sets a runnable target to be the target of the launch action of the scheme.
#
# @param [Xcodeproj::Project::Object::AbstractTarget] build_target
# A target used by scheme in the launch step.
|
Update docs for set_launch_target
|
CocoaPods_Xcodeproj
|
train
|
rb
|
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.