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
|
---|---|---|---|---|---|
700e30ce0f734c087a6b50f158e3b3d499480463 | diff --git a/src/Drivers/Pgsql/PgsqlDriver.php b/src/Drivers/Pgsql/PgsqlDriver.php
index <HASH>..<HASH> 100644
--- a/src/Drivers/Pgsql/PgsqlDriver.php
+++ b/src/Drivers/Pgsql/PgsqlDriver.php
@@ -401,6 +401,9 @@ class PgsqlDriver implements IDriver
private function processConfig(array $params): array
{
+ if (!isset($params['database']) && isset($params['dbname'])) {
+ throw new InvalidArgumentException("You have passed 'dbname' key, did you mean 'database' key?");
+ }
$params['dbname'] = $params['database'] ?? null;
$params['user'] = $params['username'] ?? null;
unset($params['database'], $params['username']); | pgsql: help with invalid configuration of dbname connection [closes #<I>] | nextras_dbal | train | php |
462db25092b50c39acf731ad7bc1bd4730f52836 | diff --git a/src/Product/Model/Variant.php b/src/Product/Model/Variant.php
index <HASH>..<HASH> 100644
--- a/src/Product/Model/Variant.php
+++ b/src/Product/Model/Variant.php
@@ -57,6 +57,27 @@ class Variant extends BaseVariant implements VariantInterface
}
/**
+ * Checks if the product is available at a certain date
+ *
+ * @param \DateTime $date
+ * @return bool
+ */
+ public function isAvailableAt(\DateTime $date)
+ {
+ return ($this->availableOn !== null && $this->availableOn <= $date);
+ }
+
+ /**
+ * Checks if the product is available now
+ *
+ * @return bool
+ */
+ public function isAvailableNow()
+ {
+ return $this->isAvailableAt(new \DateTime());
+ }
+
+ /**
* {@inheritDoc}
*/
public function setAvailableOn(\DateTime $availableOn = null) | Added helpers methods to check availability (also on variants) | lmammino_e-foundation | train | php |
5a466a34fc24e2747fabf664925d30f5cabaa920 | diff --git a/RestFB/library/src/main/java/com/restfb/types/Checkin.java b/RestFB/library/src/main/java/com/restfb/types/Checkin.java
index <HASH>..<HASH> 100644
--- a/RestFB/library/src/main/java/com/restfb/types/Checkin.java
+++ b/RestFB/library/src/main/java/com/restfb/types/Checkin.java
@@ -67,7 +67,7 @@ public class Checkin extends FacebookType {
* @author <a href="http://restfb.com">Mark Allen</a>
* @since 1.6
*/
- public static class Place extends NamedFacebookType {
+ public static class Place extends CategorizedFacebookType {
@Facebook
private Location location;
@@ -81,10 +81,10 @@ public class Checkin extends FacebookType {
*/
public static class Location {
@Facebook
- private Float latitude;
+ private Double latitude;
@Facebook
- private Float longitude;
+ private Double longitude;
/**
* @see java.lang.Object#hashCode()
@@ -115,7 +115,7 @@ public class Checkin extends FacebookType {
*
* @return The latitude of the check-in.
*/
- public Float getLatitude() {
+ public Double getLatitude() {
return latitude;
}
@@ -124,7 +124,7 @@ public class Checkin extends FacebookType {
*
* @return The longitude of the check-in.
*/
- public Float getLongitude() {
+ public Double getLongitude() {
return longitude;
}
} | Fix for Issue <I>: Add the "category" field to Place and Issue <I>: Checkin type's lat/long should be Double precision, not Float | restfb_restfb | train | java |
56181a079b130d9ac79fa8327649c1c17d37e64a | diff --git a/src/Framework/Router/Route.php b/src/Framework/Router/Route.php
index <HASH>..<HASH> 100644
--- a/src/Framework/Router/Route.php
+++ b/src/Framework/Router/Route.php
@@ -16,7 +16,7 @@ class Route implements Interfaces\Router\RouteInterface
{
protected $name;
protected $supportedMethods = [];
- protected $middleware;
+ protected $middleware = [];
protected $path;
protected $params = [];
@@ -82,10 +82,11 @@ class Route implements Interfaces\Router\RouteInterface
*/
public function __clone()
{
- $this->middleware = null;
+ $this->middleware = [];
$this->name = null;
$this->params = [];
$this->path = null;
+ $this->supportedMethods = [];
}
public function serialize()
@@ -101,7 +102,7 @@ class Route implements Interfaces\Router\RouteInterface
public function unserialize($serialized)
{
$data = unserialize($serialized);
- $this->setMiddleware($data['handler'])
+ $this->setMiddleware($data['handler'] ?: [])
->setPattern($data['pattern'])
->setName($data['name'])
->setSupportedMethods($data['methods']); | updated the $middleware property to make it consistent (always an array) | phOnion_framework | train | php |
4e8ae56efbde9a6c21d2b8363dad8e51ff7c8a4b | diff --git a/public/javascripts/comparison_grid.js b/public/javascripts/comparison_grid.js
index <HASH>..<HASH> 100644
--- a/public/javascripts/comparison_grid.js
+++ b/public/javascripts/comparison_grid.js
@@ -153,7 +153,7 @@ KT.comparison_grid.controls = function(grid) {
slide_left = function() {
var position = '-=100',
current_position = $('#column_headers').position().left,
- stop_position = -((grid.get_num_columns_shown() - 5) * 100);
+ stop_position = -((grid.get_num_columns_shown() - 4) * 100);
if( stop_position < current_position && current_position <= 0 ){
left_arrow.addClass('disabled'); | CS - Fix for hiding column. | Katello_katello | train | js |
6feb85ccbf340d00a10dc1e048d6a8e4bebbc6a7 | diff --git a/jsx/webview-bridge.js b/jsx/webview-bridge.js
index <HASH>..<HASH> 100644
--- a/jsx/webview-bridge.js
+++ b/jsx/webview-bridge.js
@@ -182,6 +182,10 @@ var WebView = React.createClass({
WebViewExManager.onMessage(this.getWebWiewHandle(), cb);
},
+ eval: function (value) {
+ WebViewExManager.eval(this.getWebWiewHandle(), value);
+ },
+
send: function (message) {
WebViewExManager.send(this.getWebWiewHandle(), message);
}, | added eval function into webview-bright react-native js code | alinz_react-native-webview-bridge | train | js |
7f495a01024f187eae1d47857c1a68414fb26674 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -9,13 +9,17 @@ var through = require('through');
function reactify(filename, options) {
options = options || {};
- var source = '';
+ var buf = [];
function write(chunk) {
- return source += chunk;
+ if (!Buffer.isBuffer(chunk)) {
+ chunk = new Buffer(chunk)
+ }
+ return buf.push(chunk)
}
function compile() {
+ var source = Buffer.concat(buf).toString();
// jshint -W040
if (isJSXFile(filename, options)) {
try { | utf8: handle buffering of split multibyte characters | andreypopp_reactify | train | js |
01ef3e319f90e8abfc38c8ab4f145621d5b8bd60 | diff --git a/lxd/container.go b/lxd/container.go
index <HASH>..<HASH> 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -731,7 +731,7 @@ func (c *containerLXD) RenderState() (*shared.ContainerState, error) {
if c.IsRunning() {
pid := c.InitPID()
status.Init = pid
- status.Processcount = c.pRocesscountGet()
+ status.Processcount = c.processcountGet()
status.Ips = c.iPsGet()
}
@@ -2112,7 +2112,7 @@ func (c *containerLXD) iPsGet() []shared.Ip {
return ips
}
-func (c *containerLXD) pRocesscountGet() int {
+func (c *containerLXD) processcountGet() int {
pid := c.c.InitPid()
if pid == -1 { // container not running - we're done
return 0 | Fix function name to be more normal looking | lxc_lxd | train | go |
8ef0b7b60f304cbc166fc9dc4b5055ba8efc8698 | diff --git a/src/main/java/com/conveyal/gtfs/graphql/GraphQLGtfsSchema.java b/src/main/java/com/conveyal/gtfs/graphql/GraphQLGtfsSchema.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/conveyal/gtfs/graphql/GraphQLGtfsSchema.java
+++ b/src/main/java/com/conveyal/gtfs/graphql/GraphQLGtfsSchema.java
@@ -119,6 +119,7 @@ public class GraphQLGtfsSchema {
public static final GraphQLObjectType fareType = newObject().name("fare_attributes")
.description("A GTFS agency object")
.field(MapFetcher.field("id", GraphQLInt))
+ .field(MapFetcher.field("agency_id"))
.field(MapFetcher.field("fare_id"))
.field(MapFetcher.field("price", GraphQLFloat))
.field(MapFetcher.field("currency_type")) | fix(graphql): add missing Fare#agency_id field to GraphQL spec
refs catalogueglobal/datatools-ui#<I> | conveyal_gtfs-lib | train | java |
ff0862ccefcde4ec8ff0302f4b5a9b8cfb7b7fe8 | diff --git a/pale/endpoint.py b/pale/endpoint.py
index <HASH>..<HASH> 100644
--- a/pale/endpoint.py
+++ b/pale/endpoint.py
@@ -239,6 +239,11 @@ class Endpoint(object):
% self.__class__.__name__)
raise
+ # ensure content type is json
+ if "Content-Type" not in response.headers or \
+ response.headers["Content-Type"] != "application/json":
+ response.headers["Content-Type"] = "application/json"
+
return response | ensures response has content type application/json | Loudr_pale | train | py |
15d790b8d3034df5a137fcb17877ede46f8611bb | diff --git a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestJoinQueries.java b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestJoinQueries.java
index <HASH>..<HASH> 100644
--- a/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestJoinQueries.java
+++ b/presto-tests/src/main/java/com/facebook/presto/tests/AbstractTestJoinQueries.java
@@ -912,7 +912,7 @@ public abstract class AbstractTestJoinQueries
}
}
- @Test
+ @Test(enabled = false)
public void testOuterJoinWithExpression()
{
assertQuery("SELECT o.orderkey FROM orders o RIGHT JOIN lineitem l ON l.orderkey * 2 + 1 = o.orderkey"); | Disable testOuterJoinWithExpression test
The test is taking <I> min to finish. Disable it temporarily. | prestodb_presto | train | java |
d574d8fc81ebf344e45cd1bcdc944ef43b450dae | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ setup(
version=__version__,
py_modules=['matplotlib2tikz'],
url='https://github.com/nschloe/matplotlib2tikz',
- download_url='https://github.com/nschloe/matplotlib2tikz/downloads',
+ download_url='https://pypi.python.org/pypi/matplotlib2tikz',
author=__author__,
author_email=__email__,
requires=['matplotlib (>=1.4.0)', 'numpy'], | make pypi the download url | nschloe_matplotlib2tikz | train | py |
34fd6d3ebeb9bef0c80d6e4b5702adaad67d6e35 | diff --git a/pelix/threadpool.py b/pelix/threadpool.py
index <HASH>..<HASH> 100644
--- a/pelix/threadpool.py
+++ b/pelix/threadpool.py
@@ -70,6 +70,13 @@ class FutureResult(object):
:param kwargs: Method keyword arguments
:raise: The exception raised by the method
"""
+ # Normalize arguments
+ if args is None:
+ args = []
+
+ if kwargs is None:
+ kwargs = {}
+
try:
# Call the method
self._result = method(*args, **kwargs) | Protection of Future.execute()
args and kwargs arguments are mandatory, but can now be None. | tcalmant_ipopo | train | py |
4a6ad49dc99e020e570712e3fb8b45126c50aa48 | diff --git a/src/geo/leaflet/leaflet-map-view.js b/src/geo/leaflet/leaflet-map-view.js
index <HASH>..<HASH> 100644
--- a/src/geo/leaflet/leaflet-map-view.js
+++ b/src/geo/leaflet/leaflet-map-view.js
@@ -25,7 +25,8 @@ var LeafletMapView = MapView.extend({
dragging: !!this.map.get('drag'),
doubleClickZoom: !!this.map.get('drag'),
scrollWheelZoom: !!this.map.get('scrollwheel'),
- keyboard: !!this.map.get('keyboard')
+ keyboard: !!this.map.get('keyboard'),
+ attributionControl: false
};
this._leafletMap = new L.Map(this.el, mapConfig); | Remove Leaflet's attributionControl by default | CartoDB_carto.js | train | js |
73bec80df5fdb7fbf5cc7d559dc20c516a362920 | diff --git a/src/js/treemode.js b/src/js/treemode.js
index <HASH>..<HASH> 100644
--- a/src/js/treemode.js
+++ b/src/js/treemode.js
@@ -222,6 +222,9 @@ treemode.update = function (json) {
this.node.update(json);
this.onChangeDisabled = false;
+ // validate JSON schema
+ this.validate();
+
// update search result if any
if (this.searchBox && !this.searchBox.isEmpty()) {
this.searchBox.forceSearch(); | Fixed validation not being executed after `update` in tree mode | josdejong_jsoneditor | train | js |
1d410cd6e93edb7447c69601d5f3cbc1fa9ced5d | diff --git a/lib/App/index.js b/lib/App/index.js
index <HASH>..<HASH> 100644
--- a/lib/App/index.js
+++ b/lib/App/index.js
@@ -193,7 +193,7 @@ class App {
if (driver.zwave) {
for (let j = 0; j < driver.settings.length; j++) {
let setting = driver.settings[j];
- if (setting.zwave && settings.attr && settings.attr.max) {
+ if (setting.zwave && setting.attr && setting.attr.max) {
let signed;
let size = setting.zwave.size;
let max = setting.attr.max; | Fix Z-Wave signed validation | athombv_node-homey-lib | train | js |
875b25dcf8dabcdd0ee6ca5d5cfe5e564f9f14a5 | diff --git a/lib/spidr/agent.rb b/lib/spidr/agent.rb
index <HASH>..<HASH> 100644
--- a/lib/spidr/agent.rb
+++ b/lib/spidr/agent.rb
@@ -566,7 +566,7 @@ module Spidr
# @since 0.2.2
#
def post_page(url,post_data='')
- url = URI(url.to_s)
+ url = URI(url.to_s) unless url.kind_of?(URI)
prepare_request(url) do |session,path,headers|
new_page = Page.new(url,session.post(path,post_data,headers)) | Avoid coercing the url, if it's already a URI::HTTP. | postmodern_spidr | train | rb |
c34318c5980f8c411d3c04ef1e1115ea135a007a | diff --git a/lxd/instances.go b/lxd/instances.go
index <HASH>..<HASH> 100644
--- a/lxd/instances.go
+++ b/lxd/instances.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"io/ioutil"
+ "net/http"
"os"
"path/filepath"
"sort"
@@ -18,9 +19,9 @@ import (
"github.com/lxc/lxd/lxd/instance/instancetype"
"github.com/lxc/lxd/lxd/project"
"github.com/lxc/lxd/lxd/state"
- storagePools "github.com/lxc/lxd/lxd/storage"
"github.com/lxc/lxd/lxd/warnings"
"github.com/lxc/lxd/shared"
+ "github.com/lxc/lxd/shared/api"
"github.com/lxc/lxd/shared/logger"
"github.com/lxc/lxd/shared/logging"
)
@@ -225,7 +226,12 @@ func (slice instanceAutostartList) Swap(i, j int) {
slice[i], slice[j] = slice[j], slice[i]
}
+var instancesStartMu sync.Mutex
+
func instancesStart(s *state.State, instances []instance.Instance) {
+ instancesStartMu.Lock()
+ defer instancesStartMu.Unlock()
+
sort.Sort(instanceAutostartList(instances))
maxAttempts := 3 | lxd/instances: Prevent concurrent running of instancesStart
In case instances are still being started when a storage pool comes online and calls this function. | lxc_lxd | train | go |
d5bfeb8efe10b918b7ebaecfc7509949fd5c716e | diff --git a/personalcapital/personalcapital.py b/personalcapital/personalcapital.py
index <HASH>..<HASH> 100644
--- a/personalcapital/personalcapital.py
+++ b/personalcapital/personalcapital.py
@@ -162,7 +162,7 @@ class PersonalCapital(object):
def __authenticate_email(self, code):
data = self.__generate_authentication_payload(code)
- return self.post("/credential/authenticateEmail", data)
+ return self.post("/credential/authenticateEmailByCode", data)
def __challenge_sms(self):
data = self.__generate_challenge_payload("challengeSMS") | Fix for upstream Issue #<I>. Personal Capital updated the post url for email authentication. | haochi_personalcapital | train | py |
fb4a29dbc115e6a93b02e1acd639d471caf20e94 | diff --git a/spec/plugin.py b/spec/plugin.py
index <HASH>..<HASH> 100644
--- a/spec/plugin.py
+++ b/spec/plugin.py
@@ -251,9 +251,17 @@ class SpecOutputStream(OutputStream):
return " " * self._depth
def print_context(self, context):
+ # Ensure parents get printed too (e.g. an outer class with nothing but
+ # inner classes will otherwise never get printed.)
+ if (
+ hasattr(context, '_parent')
+ and not getattr(context._parent, '_printed', False)
+ ):
+ self.print_context(context._parent)
# Adjust indentation depth
self._depth = depth(context)
self.print_line("\n%s%s" % (self._indent, contextDescription(context)))
+ context._printed = True
def print_spec(self, color_func, test, status=None):
spec = testDescription(test) | Print context line for classes which only wrap others | bitprophet_spec | train | py |
8f1b90189b583a257b229ba2227a2c7f8f74ca3a | diff --git a/Vpc/Form/Dynamic/Admin.php b/Vpc/Form/Dynamic/Admin.php
index <HASH>..<HASH> 100644
--- a/Vpc/Form/Dynamic/Admin.php
+++ b/Vpc/Form/Dynamic/Admin.php
@@ -9,7 +9,7 @@ class Vpc_Form_Dynamic_Admin extends Vpc_Abstract_Composite_Admin
$acl->addResource(
new Vps_Acl_Resource_MenuDropdown(
'vps_enquiries_dropdown', array('text'=>trlVps('Enquiries'), 'icon'=>'email.png')
- ), 'vps_component_root'
+ )
);
} | don't use that parent, as it has permissions for everything | koala-framework_koala-framework | train | php |
064c3018f177219014c6233a2e6d36d300fa4c88 | diff --git a/cli/lib/kontena/cli/nodes/update_command.rb b/cli/lib/kontena/cli/nodes/update_command.rb
index <HASH>..<HASH> 100644
--- a/cli/lib/kontena/cli/nodes/update_command.rb
+++ b/cli/lib/kontena/cli/nodes/update_command.rb
@@ -10,9 +10,11 @@ module Kontena::Cli::Nodes
require_current_grid
token = require_token
+
+ node = client(token).get("grids/#{current_grid}/nodes/#{node_id}")
data = {}
data[:labels] = label_list if label_list
- client(token).put("grids/#{current_grid}/nodes/#{node_id}", data)
+ client.put("nodes/#{node['id']}", data, {}, {'Kontena-Grid-Token' => node['grid']['token']})
end
end
end | fix setting of node labels from cli | kontena_kontena | train | rb |
76c9301117b04c45e835c2c9a66cf124dcbf3584 | diff --git a/salt/modules/win_lgpo.py b/salt/modules/win_lgpo.py
index <HASH>..<HASH> 100644
--- a/salt/modules/win_lgpo.py
+++ b/salt/modules/win_lgpo.py
@@ -1437,6 +1437,21 @@ class _policy_info(object):
},
'Transform': self.enabled_one_disabled_zero_transform,
},
+ 'AddPrinterDrivers': {
+ 'Policy': 'Devices: Prevent users from installing '
+ 'printer drivers',
+ 'Settings': self.enabled_one_disabled_zero_strings.keys(),
+ 'lgpo_section': self.security_options_gpedit_path,
+ 'Registry': {
+ 'Hive': 'HKEY_LOCAL_MACHINE',
+ 'Path': 'System\\CurrentControlSet\\Control\\'
+ 'Print\\Providers\\LanMan Print Services\\'
+ 'Servers',
+ 'Value': 'AddPrinterDrivers',
+ 'Type': 'REG_DWORD',
+ },
+ 'Transform': self.enabled_one_disabled_zero_strings_transform,
+ },
'AllocateDASD': {
'Policy': 'Devices: Allowed to format and eject '
'removable media', | Add support for AddPrinterDrivers | saltstack_salt | train | py |
9b7c49b8f29c41d98d08e00a1aa7a28f3b0078ad | diff --git a/playhouse/apsw_ext.py b/playhouse/apsw_ext.py
index <HASH>..<HASH> 100644
--- a/playhouse/apsw_ext.py
+++ b/playhouse/apsw_ext.py
@@ -98,14 +98,24 @@ class APSWDatabase(SqliteDatabase):
conn.createmodule(mod_name, mod_inst)
return conn
+ def _execute_sql(self, cursor, sql, params):
+ cursor.execute(sql, params or ())
+ return cursor
+
def execute_sql(self, sql, params=None, require_commit=True):
cursor = self.get_cursor()
wrap_transaction = require_commit and self.get_autocommit()
if wrap_transaction:
cursor.execute('begin;')
- res = cursor.execute(sql, params or ())
- if wrap_transaction:
- cursor.execute('commit;')
+ try:
+ self._execute_sql(cursor, sql, params)
+ except:
+ cursor.execute('rollback;')
+ raise
+ else:
+ cursor.execute('commit;')
+ else:
+ cursor = self._execute_sql(cursor, sql, params)
logger.debug((sql, params))
return cursor | Proper autocommit behavior w/apsw | coleifer_peewee | train | py |
d848114f3158e194b3bc6e16fae5ea8cf31a3c45 | diff --git a/spec/controllers/admin/statuses_controller_spec.rb b/spec/controllers/admin/statuses_controller_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/controllers/admin/statuses_controller_spec.rb
+++ b/spec/controllers/admin/statuses_controller_spec.rb
@@ -71,6 +71,14 @@ describe Admin::StatusesController do
it { expect(Status.last.permalink).to eq("my-cool-permalink") }
end
+
+ context "with an existing status" do
+ let!(:existing_status) { create(:status) }
+ before(:each) { post :new, status: { body: "Emphasis _mine_, arguments *strong*" } }
+
+ it {expect(response).to redirect_to(controller: 'statuses', action: 'new')}
+ it {expect(Status.count).to eq(2) }
+ end
end
end | Add test on creating a status whith an existing one | publify_publify | train | rb |
469a9898efa81e999c928c270e799324c65260c0 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -94,7 +94,7 @@ export default class RangePool {
if (this.length === Infinity) {
return 0
}
- return Math.round((this.getCompleted() / this.getRemaining()) * 100)
+ return Math.floor((this.getCompleted() / this.getRemaining()) * 100)
}
dispose() {
this.workers.clear()
diff --git a/src/worker.js b/src/worker.js
index <HASH>..<HASH> 100644
--- a/src/worker.js
+++ b/src/worker.js
@@ -71,7 +71,7 @@ export default class RangeWorker {
return 0
}
- return Math.round((this.getCompleted() / (this.limitIndex - this.startIndex)) * 100)
+ return Math.floor((this.getCompleted() / (this.limitIndex - this.startIndex)) * 100)
}
dispose() {
this.status = false | :new: Use Math.floor instead of Math.round in Worker and Pool percentage | steelbrain_range-pool | train | js,js |
644f2ce13ca21f08f28c48ac68962cc49a018ac1 | diff --git a/lib/formalist/elements/standard/text_area.rb b/lib/formalist/elements/standard/text_area.rb
index <HASH>..<HASH> 100644
--- a/lib/formalist/elements/standard/text_area.rb
+++ b/lib/formalist/elements/standard/text_area.rb
@@ -7,6 +7,7 @@ module Formalist
class TextArea < Field
attribute :text_size, Types::String.enum("xsmall", "small", "normal", "large", "xlarge"), default: "normal"
attribute :box_size, Types::String.enum("single", "small", "normal", "large", "xlarge"), default: "normal"
+ attribute :code Types::Bool
end
register :text_area, TextArea
diff --git a/lib/formalist/elements/standard/text_field.rb b/lib/formalist/elements/standard/text_field.rb
index <HASH>..<HASH> 100644
--- a/lib/formalist/elements/standard/text_field.rb
+++ b/lib/formalist/elements/standard/text_field.rb
@@ -6,6 +6,7 @@ module Formalist
class Elements
class TextField < Field
attribute :password, Types::Bool
+ attribute :code Types::Bool
end
register :text_field, TextField | Add `code` attributes to text-type fields. | team-formalist_formalist-rb | train | rb,rb |
1abacd0d79963c9b97346006bc60b29a93b55295 | diff --git a/lib/ethereum/fast_rlp.rb b/lib/ethereum/fast_rlp.rb
index <HASH>..<HASH> 100644
--- a/lib/ethereum/fast_rlp.rb
+++ b/lib/ethereum/fast_rlp.rb
@@ -19,6 +19,13 @@ module Ethereum
"#{prefix}#{item}"
end
+ ##
+ # Alias to encode_nested_bytes, override default encode.
+ #
+ def encode(item)
+ encode_nested_bytes item
+ end
+
extend self
end
end
diff --git a/test/fast_rlp_test.rb b/test/fast_rlp_test.rb
index <HASH>..<HASH> 100644
--- a/test/fast_rlp_test.rb
+++ b/test/fast_rlp_test.rb
@@ -9,10 +9,10 @@ class FastRLPTest < Minitest::Test
end
def test_encode_nested_bytes
- assert_equal encode("".b), encode_nested_bytes("".b)
+ assert_equal RLP.encode("".b), encode_nested_bytes("".b)
nested_bytes = ["a".b, "hello!".b, ["foo".b], ["bar".b, ["ear".b]]]
- assert_equal encode(nested_bytes), encode_nested_bytes(nested_bytes)
+ assert_equal RLP.encode(nested_bytes), encode_nested_bytes(nested_bytes)
end
end | make FastRLP default to encode nested bytes | cryptape_ruby-ethereum | train | rb,rb |
ebe173a49fb8e2db495e8f45dc382120476162ec | diff --git a/lib/octopress-deploy/git.rb b/lib/octopress-deploy/git.rb
index <HASH>..<HASH> 100644
--- a/lib/octopress-deploy/git.rb
+++ b/lib/octopress-deploy/git.rb
@@ -79,7 +79,7 @@ CONFIG
else
`echo "initialize deploy repo" > _`
`git add .`
- `git commit -m 'initial commit'`
+ `git commit -m \"initial commit\"`
`git branch -m #{@branch}`
`git rm _`
`git add -u`
@@ -115,7 +115,7 @@ CONFIG
FileUtils.cp_r @site_dir + '/.', target_dir
message = "Site updated at: #{Time.now.utc}"
`git add --all :/`
- `git commit -m '#{message}'`
+ `git commit -m \"#{message}\"`
end
end
end | Windows does not understand single quotes in shell commands | octopress_deploy | train | rb |
7ab9145aa504d7c7801cdef8a8a8b608060fe799 | diff --git a/lib/models/requestContext.js b/lib/models/requestContext.js
index <HASH>..<HASH> 100644
--- a/lib/models/requestContext.js
+++ b/lib/models/requestContext.js
@@ -53,9 +53,7 @@ class Connection {
}
set id(str) {
- if (this[_c_id] === null) {
- this[_c_id] = assert.assertString('connection.id', str);
- }
+ this[_c_id] = assert.assertString('connection.id', str);
}
get id() {
@@ -63,9 +61,7 @@ class Connection {
}
set protocol(str) {
- if (this[_c_protocol] === null) {
- this[_c_protocol] = assert.assertString('connection.protocol', str);
- }
+ this[_c_protocol] = assert.assertString('connection.protocol', str);
}
get protocol() { | backward compatibility: connection properties should not be read-only | kuzzleio_kuzzle-common-objects | train | js |
7389952ffc80f5671d202d8c6b8d14dfa05c68ab | diff --git a/src/main/java/hdfs/jsr203/HadoopPath.java b/src/main/java/hdfs/jsr203/HadoopPath.java
index <HASH>..<HASH> 100644
--- a/src/main/java/hdfs/jsr203/HadoopPath.java
+++ b/src/main/java/hdfs/jsr203/HadoopPath.java
@@ -492,7 +492,9 @@ public class HadoopPath implements Path {
@Override
public URI toUri() {
try {
- return getRawResolvedPath().toUri();
+ return new URI(HadoopFileSystemProvider.SCHEME, null,
+ hdfs.getHost(), hdfs.getPort(),
+ new String(path), null, null);
} catch (Exception ex) {
throw new AssertionError(ex);
} | Remove resolve path in Path.toURI() | damiencarol_jsr203-hadoop | train | java |
2feed06abd20522e80eb417d11db0cb2e47ea3c1 | diff --git a/apps/nsq_to_file/nsq_to_file.go b/apps/nsq_to_file/nsq_to_file.go
index <HASH>..<HASH> 100644
--- a/apps/nsq_to_file/nsq_to_file.go
+++ b/apps/nsq_to_file/nsq_to_file.go
@@ -72,6 +72,10 @@ func main() {
fs := flagSet()
fs.Parse(os.Args[1:])
+ if args := fs.Args(); len(args) > 0 {
+ log.Fatalf("unknown arguments: %s", args)
+ }
+
opts := NewOptions()
options.Resolve(opts, fs, nil) | nsq_to_file: fatally exit on unknown non-flag args | nsqio_nsq | train | go |
34275dd89f3b5c6549562629a4a005dbcb1e6213 | diff --git a/aws/logger.go b/aws/logger.go
index <HASH>..<HASH> 100644
--- a/aws/logger.go
+++ b/aws/logger.go
@@ -26,14 +26,14 @@ func (l *LogLevelType) Value() LogLevelType {
// Matches returns true if the v LogLevel is enabled by this LogLevel. Should be
// used with logging sub levels. Is safe to use on nil value LogLevelTypes. If
-// LogLevel is nill, will default to LogOff comparison.
+// LogLevel is nil, will default to LogOff comparison.
func (l *LogLevelType) Matches(v LogLevelType) bool {
c := l.Value()
return c&v == v
}
// AtLeast returns true if this LogLevel is at least high enough to satisfies v.
-// Is safe to use on nil value LogLevelTypes. If LogLevel is nill, will default
+// Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default
// to LogOff comparison.
func (l *LogLevelType) AtLeast(v LogLevelType) bool {
c := l.Value() | Update comments in logger.go (#<I>)
nill -> nil | aws_aws-sdk-go | train | go |
24bfc4856448c8ffd202c95fb9bd5c33739b1b02 | diff --git a/resource/resource.go b/resource/resource.go
index <HASH>..<HASH> 100644
--- a/resource/resource.go
+++ b/resource/resource.go
@@ -41,6 +41,24 @@ import (
type Resource struct {
resource.Resource
+ // ID uniquely identifies a resource-service pair within the model.
+ // Note that the model ignores pending resources (those with a
+ // pending ID) except for in a few clearly pending-related places.
+ ID string
+
+ // PendingID identifies that this resource is pending and
+ // distinguishes it from other pending resources with the same model
+ // ID (and from the active resource). The active resource for the
+ // services will not have PendingID set.
+ PendingID string
+
+ // TODO(ericsnow) Use names.ServiceTag for ServiceID?
+
+ // ServiceID identifies the service for the resource.
+ ServiceID string
+
+ // TODO(ericsnow) Use names.UserTag for Username?
+
// Username is the ID of the user that added the revision
// to the model (whether implicitly or explicitly).
Username string
@@ -51,6 +69,8 @@ type Resource struct {
// Validate ensures that the spec is valid.
func (res Resource) Validate() error {
+ // TODO(ericsnow) Ensure that ID and ServiceID are set.
+
// TODO(ericsnow) Ensure that the "placeholder" fields are not set
// if IsLocalPlaceholder() returns true (and that they *are* set
// otherwise)? Also ensure an "upload" origin in the "placeholder" | Add ID fields to resource.Resource. | juju_juju | train | go |
5514030fe67338b0d469455215d0dd6aa644189c | diff --git a/salt/client.py b/salt/client.py
index <HASH>..<HASH> 100644
--- a/salt/client.py
+++ b/salt/client.py
@@ -979,7 +979,7 @@ class LocalClient(object):
sreq = salt.payload.SREQ(
'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
)
- payload = sreq.send('clear', payload_kwargs, timeout=timeout)
+ payload = sreq.send('clear', payload_kwargs)
# We have the payload, let's get rid of SREQ fast(GC'ed faster)
del(sreq) | Clean out payload connection timeout, this is not passed down from here | saltstack_salt | train | py |
bf9e47499d93ec561633181005ed83159d72d260 | diff --git a/sprd/entity/Payment.js b/sprd/entity/Payment.js
index <HASH>..<HASH> 100644
--- a/sprd/entity/Payment.js
+++ b/sprd/entity/Payment.js
@@ -1,4 +1,4 @@
-define(["js/data/Entity"], function(Entity) {
+define(["js/data/Entity"], function (Entity) {
return Entity.inherit("checkout.entity.Payment", {
type: "payment",
@@ -7,11 +7,11 @@ define(["js/data/Entity"], function(Entity) {
paymentTypeGroup: null
},
- getType: function() {
+ getType: function () {
return this.type;
},
- clearData: function() {
+ clearData: function () {
var $ = this.$,
data = {};
for (var key in $) {
@@ -23,6 +23,13 @@ define(["js/data/Entity"], function(Entity) {
this.set(data);
},
+ /**
+ * Hook to prepare delivery
+ */
+ prepare: function (cb) {
+ cb && cb();
+ },
+
/***
* determinate the real payment method. This is a hook so the credit card
* payment type group can select the payment method | DEV-<I> - Frontend support/ implementation for KLARNA | spreadshirt_rAppid.js-sprd | train | js |
02b2497896f1440b856a039f93cdbd0d9d2e6fc9 | diff --git a/openpnm/__init__.py b/openpnm/__init__.py
index <HASH>..<HASH> 100644
--- a/openpnm/__init__.py
+++ b/openpnm/__init__.py
@@ -53,7 +53,7 @@ It consists of the following submodules:
"""
import os
from pathlib import Path
-from git import Repo, InvalidGitRepositoryError
+from git import Repo
__version__ = '2.0.1'
@@ -62,7 +62,9 @@ try:
repo = Repo(str(path))
if repo.active_branch.name != 'master':
commit_id = repo.active_branch.commit.hexsha[:6]
- __version__ = __version__ + '-' + str(commit_id)
+ __commit__ = ''+str(commit_id)
+ else:
+ __commit__ = None
except:
pass | changing commit id thing in version number | PMEAL_OpenPNM | train | py |
866822a9ccbd633c98b43d92d10bd3014cf66f91 | diff --git a/lib/producer.js b/lib/producer.js
index <HASH>..<HASH> 100644
--- a/lib/producer.js
+++ b/lib/producer.js
@@ -131,6 +131,12 @@ export default function ({ backpack, bakes, slash, target }) {
}
} else
if (stripe.file) {
+ if (stripe.file === target.output) {
+ return cb(wasReported(
+ 'Trying to take executable into executable', stripe.file
+ ));
+ }
+
assert.equal(stripe.store, STORE_CONTENT); // others must be buffers from walker
return cb(undefined, pipeToNewMeter(fs.createReadStream(stripe.file)));
} else {
diff --git a/lib/walker.js b/lib/walker.js
index <HASH>..<HASH> 100644
--- a/lib/walker.js
+++ b/lib/walker.js
@@ -53,7 +53,7 @@ function isPermissive (config) {
function upon (p, base) {
if (typeof p !== 'string') {
throw wasReported(
- 'Config items must be strings. See examples.'
+ 'Config items must be strings. See examples'
);
}
let negate = false; | protect against "assert": "**/*" that causes filling all disk | zeit_pkg | train | js,js |
d73a6d1b46103bb735716cf7edae9557a93465f2 | diff --git a/src/golibmc.go b/src/golibmc.go
index <HASH>..<HASH> 100644
--- a/src/golibmc.go
+++ b/src/golibmc.go
@@ -344,17 +344,17 @@ func (client *Client) newConn() (*conn, error) {
func (client *Client) putConn(cn *conn, err error) error {
client.lk.Lock()
- if err == ErrBadConn {
+ if err == ErrBadConn ||
+ !client.putConnLocked(cn, nil) {
client.lk.Unlock()
- err := cn.quit()
- if err != nil {
- log.Println("Failed cn.close", err)
+ err1 := cn.quit()
+ if err1 != nil {
+ log.Printf("Failed cn.quit: %v", err1)
}
return err
}
- client.putConnLocked(cn, nil)
client.lk.Unlock()
- return nil
+ return err
}
func (client *Client) putConnLocked(cn *conn, err error) bool { | Close connection if putConnLocked is failed | douban_libmc | train | go |
018ea178a70eb346b9acf42449690c0971782b04 | diff --git a/src/main/java/com/stripe/model/PaymentIntent.java b/src/main/java/com/stripe/model/PaymentIntent.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/stripe/model/PaymentIntent.java
+++ b/src/main/java/com/stripe/model/PaymentIntent.java
@@ -27,7 +27,7 @@ public class PaymentIntent extends APIResource implements MetadataStore<PaymentI
Long amountCapturable;
Long amountReceived;
@Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) ExpandableField<Application> application;
- Long applicationFee;
+ Long applicationFeeAmount;
Long canceledAt;
String captureMethod;
ChargeCollection charges; | Rename application_fee to application_fee_amount on PaymentIntent | stripe_stripe-java | train | java |
c6680472c8858a9e53cd6f660f4cf8d3a70f4acb | diff --git a/lib/sorcery/model/submodules/magic_login.rb b/lib/sorcery/model/submodules/magic_login.rb
index <HASH>..<HASH> 100644
--- a/lib/sorcery/model/submodules/magic_login.rb
+++ b/lib/sorcery/model/submodules/magic_login.rb
@@ -52,10 +52,13 @@ module Sorcery
module ClassMethods
# Find user by token, also checks for expiration.
# Returns the user if token found and is valid.
- def load_from_magic_login_token(token)
- token_attr_name = @sorcery_config.magic_login_token_attribute_name
- token_expiration_date_attr = @sorcery_config.magic_login_token_expires_at_attribute_name
- load_from_token(token, token_attr_name, token_expiration_date_attr)
+ def load_from_magic_login_token(token, &block)
+ load_from_token(
+ token,
+ @sorcery_config.magic_login_token_attribute_name,
+ @sorcery_config.magic_login_token_expires_at_attribute_name,
+ &block
+ )
end
protected | Allow load_from_magic_login_token to accept a block (#<I>) | Sorcery_sorcery | train | rb |
839f73a9043a77f9b07f96d7714b7fe69ff2f8dd | diff --git a/javascript/firefox-driver/js/syntheticMouse.js b/javascript/firefox-driver/js/syntheticMouse.js
index <HASH>..<HASH> 100644
--- a/javascript/firefox-driver/js/syntheticMouse.js
+++ b/javascript/firefox-driver/js/syntheticMouse.js
@@ -99,6 +99,20 @@ SyntheticMouse.prototype.isElementShown = function(element) {
SyntheticMouse.prototype.isElementClickable = function(element) {
+ // Check to see if this is an option element. If it is, and the parent isn't a multiple
+ // select, then check that select is clickable.
+ var tagName = element.tagName.toLowerCase();
+ if ('option' == tagName) {
+ var parent = element;
+ while (parent.parentNode != null && parent.tagName.toLowerCase() != 'select') {
+ parent = parent.parentNode;
+ }
+
+ if (parent && parent.tagName.toLowerCase() == 'select' && !parent.multiple) {
+ return this.isElementClickable(parent);
+ }
+ }
+
// get the outermost ancestor of the element. This will be either the document
// or a shadow root.
var owner = element; | firefox: Check that select is clickable when clicking option | SeleniumHQ_selenium | train | js |
f7064539450868817d784587bca0d18c887d74e3 | diff --git a/lib/tgios/images_collection_view_binding.rb b/lib/tgios/images_collection_view_binding.rb
index <HASH>..<HASH> 100644
--- a/lib/tgios/images_collection_view_binding.rb
+++ b/lib/tgios/images_collection_view_binding.rb
@@ -21,7 +21,7 @@ module Tgios
},
clipsToBounds: true}.merge(options))
CommonUIUtility.get_image(item) do |image|
- image_view.image = image
+ image_view.image = image unless image.nil?
end
image_views << image_view
end
diff --git a/lib/tgios/ui_table_view_utility_binding.rb b/lib/tgios/ui_table_view_utility_binding.rb
index <HASH>..<HASH> 100644
--- a/lib/tgios/ui_table_view_utility_binding.rb
+++ b/lib/tgios/ui_table_view_utility_binding.rb
@@ -106,7 +106,7 @@ module Tgios
end
def scroll_to_index_path(index_path)
- @table.scrollToRowAtIndexPath(index_path, atScrollPosition: UITableViewScrollPositionBottom, animated: true)
+ @table.scrollToRowAtIndexPath(index_path, atScrollPosition: UITableViewScrollPositionMiddle, animated: true)
@index_path_to_scroll = nil
end | image collection view binding only assing image when not nil; table view utility scroll to middle instead of bottom | apriltg_tgios | train | rb,rb |
a446f0bae5f43d1ac11ea9bd42480a440fb61035 | diff --git a/lib/classy_enum.rb b/lib/classy_enum.rb
index <HASH>..<HASH> 100644
--- a/lib/classy_enum.rb
+++ b/lib/classy_enum.rb
@@ -24,7 +24,7 @@ end
module ClassyEnum
- module ClassMethods
+ module SuperClassMethods
def new(option)
self::OPTION_HASH[option] || TypeError.new("Valid #{self} options are #{self.valid_options}")
@@ -51,7 +51,7 @@ module ClassyEnum
end
def self.included(other)
- other.extend ClassMethods
+ other.extend SuperClassMethods
other.const_set("OPTION_HASH", Hash.new)
diff --git a/lib/classy_enum/classy_enum_attributes.rb b/lib/classy_enum/classy_enum_attributes.rb
index <HASH>..<HASH> 100644
--- a/lib/classy_enum/classy_enum_attributes.rb
+++ b/lib/classy_enum/classy_enum_attributes.rb
@@ -13,12 +13,12 @@ module ClassyEnumAttributes
# Define getter method
define_method method do
- klass.new(super)
+ klass.new(super())
end
# Define setter method
define_method "#{method}=" do |value|
- super value.to_s
+ super(value.to_s)
end
end | Added Ruby <I> support | beerlington_classy_enum | train | rb,rb |
76499b066f1f0deab01b30152b6608cf4253005d | diff --git a/packages/vaex-jupyter/vaex/jupyter/_version.py b/packages/vaex-jupyter/vaex/jupyter/_version.py
index <HASH>..<HASH> 100644
--- a/packages/vaex-jupyter/vaex/jupyter/_version.py
+++ b/packages/vaex-jupyter/vaex/jupyter/_version.py
@@ -1,2 +1,2 @@
-__version_tuple__ = (0, 2, 2)
-__version__ = '0.2.2'
+__version_tuple__ = (0, 2, 3)
+__version__ = '0.2.3' | Release <I> of vaex-jupyter | vaexio_vaex | train | py |
12c224c14a3b74e6c53918632ccee807d00f6e85 | diff --git a/examples/blocks/blocks/input.go b/examples/blocks/blocks/input.go
index <HASH>..<HASH> 100644
--- a/examples/blocks/blocks/input.go
+++ b/examples/blocks/blocks/input.go
@@ -29,7 +29,7 @@ var gamepadAbstractButtons = []abstractButton{
type Input struct {
keyStates [256]int
gamepadButtonStates [256]int
- gamepadAbstractButtonStates [16]int
+ gamepadAbstractButtonStates map[abstractButton]int
gamepadConfig gamepadConfig
}
@@ -42,6 +42,9 @@ func (i *Input) StateForGamepadButton(b ebiten.GamepadButton) int {
}
func (i *Input) stateForGamepadAbstractButton(b abstractButton) int {
+ if i.gamepadAbstractButtonStates == nil {
+ return 0
+ }
return i.gamepadAbstractButtonStates[b]
}
@@ -63,6 +66,9 @@ func (i *Input) Update() {
i.gamepadButtonStates[b]++
}
+ if i.gamepadAbstractButtonStates == nil {
+ i.gamepadAbstractButtonStates = map[abstractButton]int{}
+ }
for _, b := range gamepadAbstractButtons {
if !i.gamepadConfig.IsButtonPressed(gamepadID, b) {
i.gamepadAbstractButtonStates[b] = 0 | examples/blocks: Refactoring | hajimehoshi_ebiten | train | go |
452b663f4590b7f58c8160072d6af5c1e6c78f8b | diff --git a/spec/crawler_spec.rb b/spec/crawler_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/crawler_spec.rb
+++ b/spec/crawler_spec.rb
@@ -131,6 +131,19 @@ describe Wombat::Crawler do
another_instance.crawl
end
+ it 'should crawl with url and block' do
+ url = 'http://danielinc.com/itens'
+
+ expect(@crawler_instance).to receive(:parse).with(anything, url)
+ @crawler_instance.crawl(url) do
+ end
+
+ another_instance = @crawler.new
+ expect(another_instance).to receive(:parse).with(anything, url)
+
+ another_instance.crawl(url)
+ end
+
it 'should remove created method missing' do
@crawler.base_url "danielnc.com"
@crawler.path "/itens" | Test Wombat.crawl with url | felipecsl_wombat | train | rb |
103cb05ebcac2b85803e7d09e50a43b1054dbf5b | diff --git a/querydsl-sql/src/test/java/com/querydsl/sql/types/JSR310InstantTypeTest.java b/querydsl-sql/src/test/java/com/querydsl/sql/types/JSR310InstantTypeTest.java
index <HASH>..<HASH> 100644
--- a/querydsl-sql/src/test/java/com/querydsl/sql/types/JSR310InstantTypeTest.java
+++ b/querydsl-sql/src/test/java/com/querydsl/sql/types/JSR310InstantTypeTest.java
@@ -34,7 +34,7 @@ public class JSR310InstantTypeTest extends AbstractJSR310DateTimeTypeTest<Instan
@Test
public void jodaSet() throws SQLException {
Instant value = Instant.now();
- Timestamp ts = Timestamp.from(value);
+ Timestamp ts = new Timestamp(value.toEpochMilli());;
PreparedStatement stmt = EasyMock.createNiceMock(PreparedStatement.class);
stmt.setTimestamp(1, ts); | but joda doesn't | querydsl_querydsl | train | java |
d1143352b8cc32ffa4e244794db9f64ba9244c4e | diff --git a/lib/configure.js b/lib/configure.js
index <HASH>..<HASH> 100644
--- a/lib/configure.js
+++ b/lib/configure.js
@@ -93,6 +93,10 @@ function configure (gyp, argv, callback) {
}
log.verbose('check python version', '`%s -c "import platform; print platform.python_version();"` returned: %j', python, stdout)
var version = stdout.trim()
+ if (~version.indexOf('+')) {
+ log.silly('stripping "+" sign(s) from version')
+ version = version.replace(/\+/, '')
+ }
if (semver.gte(version, '2.5.0') && semver.lt(version, '3.0.0')) {
getNodeDir()
} else { | configure: strip "+" signs from the Python version before comparing
Fixes #<I>. | CodeJockey_node-ninja | train | js |
343099db7f84c22b8851a69bbecac8551f1c66c7 | diff --git a/bin/codemods/src/helpers.js b/bin/codemods/src/helpers.js
index <HASH>..<HASH> 100644
--- a/bin/codemods/src/helpers.js
+++ b/bin/codemods/src/helpers.js
@@ -1,3 +1,14 @@
+/**
+ * External dependencies
+ */
+const path = require( 'path' );
+const child_process = require( 'child_process' );
+
+/**
+ * Internal dependencies
+ */
+const config = require( './config' );
+
function bindEvents( jscodeshiftProcess ) {
jscodeshiftProcess.stdout.on( 'data', ( data ) => {
process.stdout.write( data );
@@ -8,6 +19,19 @@ function bindEvents( jscodeshiftProcess ) {
} );
}
+function runCodemod( generateBinArgs ) {
+ const args = process.argv.slice( 2 );
+ if ( args.length === 0 ) {
+ process.stdout.write( 'No files to transform\n' );
+ process.exit( 0 );
+ }
+
+ const binArgs = generateBinArgs( config, args );
+ const binPath = path.join( '.', 'node_modules', '.bin', 'jscodeshift' );
+ const jscodeshift = child_process.spawn( binPath, binArgs );
+ bindEvents( jscodeshift );
+}
+
module.exports = {
- bindEvents,
+ runCodemod,
}; | Codemods: Extract runCodemod function
Credits to @gziolo for this work in #<I>. | Automattic_wp-calypso | train | js |
134a2e0ae7c11adecd521c00b85b488372c8d1aa | diff --git a/app/models/concerns/rubygem_searchable.rb b/app/models/concerns/rubygem_searchable.rb
index <HASH>..<HASH> 100644
--- a/app/models/concerns/rubygem_searchable.rb
+++ b/app/models/concerns/rubygem_searchable.rb
@@ -20,7 +20,7 @@ module RubygemSearchable
most_recent_version = versions.most_recent
{
name: name,
- indexed: versions.any?(&:indexed?),
+ yanked: !versions.any?(&:indexed?),
summary: most_recent_version.try(:summary),
description: most_recent_version.try(:description)
}
@@ -39,7 +39,7 @@ module RubygemSearchable
mapping do
indexes :name, analyzer: 'rubygem'
- indexes :indexed, type: 'boolean'
+ indexes :yanked, type: 'boolean'
indexes :summary, analyzer: 'english'
indexes :description, analyzer: 'english'
end
@@ -72,7 +72,7 @@ module RubygemSearchable
filter: {
bool: {
must: {
- term: { indexed: true }
+ term: { yanked: false }
}
}
} | change "indexed" to "yanked" in ES | rubygems_rubygems.org | train | rb |
8fd64fc9cc945f0e54b61cf82fa4ddedd2208ac8 | diff --git a/tile_generator/tile_unittest.py b/tile_generator/tile_unittest.py
index <HASH>..<HASH> 100644
--- a/tile_generator/tile_unittest.py
+++ b/tile_generator/tile_unittest.py
@@ -23,6 +23,15 @@ import tempfile
from . import tile
class TestTileInit(unittest.TestCase):
+ # tile.init() changes the working directory. In normal usage,
+ # this is fine, but for unit tests this changes the local
+ # state, so we should restore it.
+ def setUp(self):
+ self.cwd = os.getcwd()
+
+ def tearDown(self):
+ os.chdir(self.cwd)
+
def test_tile_init_works(self):
tmpdir = tempfile.mkdtemp()
try: | Maintain working directory in unit test.
Without this, it leaves the process in a directory that no longer
exists, which can break other tests. | cf-platform-eng_tile-generator | train | py |
81c6bcdfb9c6442e222d9fbcfbbc614f264c17f7 | diff --git a/notice.go b/notice.go
index <HASH>..<HASH> 100644
--- a/notice.go
+++ b/notice.go
@@ -17,6 +17,7 @@ type Notice struct {
Hostname string
Env string
Backtrace []*Frame
+ ProjectRoot string
}
func (n *Notice) asJSON() *hash {
@@ -34,6 +35,7 @@ func (n *Notice) asJSON() *hash {
"backtrace": n.Backtrace,
},
"server": &hash{
+ "project_root": n.ProjectRoot,
"environment_name": n.Env,
"hostname": n.Hostname,
},
@@ -79,6 +81,7 @@ func newNotice(config *Configuration, err Error) *Notice {
Env: config.Env,
Hostname: config.Hostname,
Backtrace: composeStack(err.Stack, config.Root),
+ ProjectRoot: config.Root,
}
return ¬ice | Send project root in server hash. | honeybadger-io_honeybadger-go | train | go |
9780bb282655b3745c9ffa87f0d73120f6c23ab8 | diff --git a/src/Guzzle6HttpAdapter.php b/src/Guzzle6HttpAdapter.php
index <HASH>..<HASH> 100644
--- a/src/Guzzle6HttpAdapter.php
+++ b/src/Guzzle6HttpAdapter.php
@@ -32,7 +32,7 @@ class Guzzle6HttpAdapter extends AbstractHttpAdapter
/**
* Creates a guzzle 6 http adapter.
*
- * @param \GuzzleHttp\ClientInterface|null $client The guzzle 4 client.
+ * @param \GuzzleHttp\ClientInterface|null $client The guzzle 6 client.
* @param \Ivory\HttpAdapter\ConfigurationInterface|null $configuration The configuration.
*/
public function __construct(ClientInterface $client = null, ConfigurationInterface $configuration = null) | Fix docblock. (#<I>) | egeloen_ivory-http-adapter | train | php |
0b8217b593c6e24d9c862bbde665bcdc714e6188 | diff --git a/servers/src/main/java/tachyon/master/TachyonMaster.java b/servers/src/main/java/tachyon/master/TachyonMaster.java
index <HASH>..<HASH> 100644
--- a/servers/src/main/java/tachyon/master/TachyonMaster.java
+++ b/servers/src/main/java/tachyon/master/TachyonMaster.java
@@ -127,6 +127,8 @@ public class TachyonMaster {
}
return new TachyonMaster();
}
+
+ private Factory() {} // prevent instantiation.
}
protected TachyonMaster() { | [TACHYON-<I>] Private constructor for the Factory class. | Alluxio_alluxio | train | java |
723ae9edfcff5a39d102f21f5c1ddfd85b8e8aa1 | diff --git a/lib/sinatra/mongo.rb b/lib/sinatra/mongo.rb
index <HASH>..<HASH> 100644
--- a/lib/sinatra/mongo.rb
+++ b/lib/sinatra/mongo.rb
@@ -16,15 +16,15 @@ module Sinatra
end
def mongo
- url = URI(mongo_url)
- connection = Mongo::Connection.new(url.host, url.port)
- @mongo ||= begin
- mongo = connection.db(url.path[1..-1])
- if url.user && url.password
- mongo.authenticate(url.user, url.password)
- end
- mongo
- end
+ @mongo ||= (
+ url = URI(mongo_url)
+ connection = Mongo::Connection.new(url.host, url.port)
+ mongo = connection.db(url.path[1..-1])
+ if url.user && url.password
+ mongo.authenticate(url.user, url.password)
+ end
+ mongo
+ )
end
protected | don't instantiate a new connect on each reference | technicalpickles_sinatra-mongo | train | rb |
2a0dc2f8194e48c67b220fdfb52a45f643473e8a | diff --git a/bundles/org.eclipse.orion.client.ui/web/edit/setup.js b/bundles/org.eclipse.orion.client.ui/web/edit/setup.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.ui/web/edit/setup.js
+++ b/bundles/org.eclipse.orion.client.ui/web/edit/setup.js
@@ -506,6 +506,18 @@ objects.mixin(EditorViewer.prototype, {
if (this.editor) {
this.editor.addEventListener("DirtyChanged", this.editorDirtyListener = function() { //$NON-NLS-0$
mGlobalCommands.setDirtyIndicator(this.editor.isDirty());
+
+ // Update the viewer's header
+ if (this.curFileNode) {
+ var curText = this.curFileNode.innerHTML;
+ if (curText.slice(-1) === '*') {
+ curText = curText.slice(0, -1); // Trim the *
+ }
+ if (this.editor.isDirty()) {
+ curText += '*'; // Add it back if dirty
+ }
+ this.curFileNode.innerHTML = curText;
+ }
}.bind(this));
}
}, | Bug <I> - Add editor 'dirty' indicators to the header's filename when needed | eclipse_orion.client | train | js |
c3161ae12de987e8d3ed2c818086df0ac0268567 | diff --git a/src/App.php b/src/App.php
index <HASH>..<HASH> 100644
--- a/src/App.php
+++ b/src/App.php
@@ -612,6 +612,23 @@ class App {
}
/**
+ * Returns the URL of the current request along with its query string and an additional query parameter indicating the current locale
+ *
+ * @return string
+ */
+ public function currentUrlWithQueryAndLang() {
+ if (isset($this->i18n)) {
+ $locale = $this->i18n->getLocale();
+
+ if (!empty($locale)) {
+ return $this->currentUrlWithQueryAndParams([ 'lang' => $locale ]);
+ }
+ }
+
+ return $this->currentUrlWithQuery();
+ }
+
+ /**
* Returns the URL of the current request along with its query string and the supplied additional parameters in the query
*
* @param array $params the parameters to append to the query | Implement method 'currentUrlWithQueryAndLang' in class 'App' | delight-im_PHP-Foundation-Core | train | php |
5cee23cbfa38df9e07225511fc9a8e37a1753ce1 | diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php
index <HASH>..<HASH> 100644
--- a/system/src/Grav/Common/Page/Page.php
+++ b/system/src/Grav/Common/Page/Page.php
@@ -1224,6 +1224,15 @@ class Page
return $this->route;
}
+ /**
+ * Helper method to clear the route out so it regenerates next time you use it
+ */
+ public function unsetRoute()
+ {
+ unset($this->route);
+
+ }
+
public function rawRoute($var = null)
{
if ($var !== null) { | Added new unsetRoute() to allow route() to rebuild | getgrav_grav | train | php |
c66347768889f140253ecc7a0f4358bc051aaa01 | diff --git a/rules/manager_test.go b/rules/manager_test.go
index <HASH>..<HASH> 100644
--- a/rules/manager_test.go
+++ b/rules/manager_test.go
@@ -433,11 +433,6 @@ func TestForStateRestore(t *testing.T) {
newGroups := make(map[string]*Group)
newGroups["default;"] = newGroup
- m := NewManager(opts)
- m.mtx.Lock()
- m.groups = newGroups
- m.mtx.Unlock()
-
restoreTime := baseTime.Add(tst.restoreDuration)
// First eval before restoration.
newGroup.Eval(suite.Context(), restoreTime)
@@ -626,11 +621,18 @@ func TestUpdate(t *testing.T) {
expected := map[string]labels.Labels{
"test": labels.FromStrings("name", "value"),
}
+ storage := testutil.NewStorage(t)
+ defer storage.Close()
+ engine := promql.NewEngine(nil, nil, 10, 10*time.Second)
ruleManager := NewManager(&ManagerOptions{
- Context: context.Background(),
- Logger: log.NewNopLogger(),
+ Appendable: storage,
+ TSDB: storage,
+ QueryFunc: EngineQueryFunc(engine, storage),
+ Context: context.Background(),
+ Logger: log.NewNopLogger(),
})
ruleManager.Run()
+ defer ruleManager.Stop()
err := ruleManager.Update(10*time.Second, files)
testutil.Ok(t, err) | Fixed TestUpdate in rules/manager_test.go (#<I>) | prometheus_prometheus | train | go |
666801dcf2803a143e5b6016c7b274c446a797ae | diff --git a/tests/__init__.py b/tests/__init__.py
index <HASH>..<HASH> 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -180,7 +180,7 @@ def run_using_pytest(caller_globals):
def wsdl(schema_content, input=None, output=None, operation_name="f",
wsdl_target_namespace="my-wsdl-namespace",
xsd_target_namespace="my-xsd-namespace",
- web_service_URL="unga-bunga-location"):
+ web_service_URL="protocol://unga-bunga-location"):
"""
Returns WSDL schema content used in different suds library tests. | make default generated test WSDL usable with Python 3
The default generated test WSDL schema contained a web service URL without a
protocol specification. When Python 3 urllib implementation attempts to connect
to an URL without a properly specified protocol it raises an error before
calling its urlopener open() operation. This may break our tests expecting suds
to be able to invoke a web service operation based on the default generated WSDL
schema. | ovnicraft_suds2 | train | py |
6333fddaa26a9e427a646d83edbe85d2e9ca3bb5 | diff --git a/lib/less/parser.js b/lib/less/parser.js
index <HASH>..<HASH> 100644
--- a/lib/less/parser.js
+++ b/lib/less/parser.js
@@ -684,7 +684,7 @@ less.Parser = function Parser(env) {
var value, c = input.charCodeAt(i);
if ((c > 57 || c < 45) || c === 47) return;
- if (value = $(/^(-?\d*\.?\d+)(px|%|em|rem|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn)?/)) {
+ if (value = $(/^(-?\d*\.?\d+)(px|%|em|rem|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn|dpi)?/)) {
return new(tree.Dimension)(value[1], value[2]);
}
}, | Adding "dpi" to the list of valid dimensions. | less_less.js | train | js |
90b49419b2ccba5f2a16c88c3d7d553b9b2ba32c | diff --git a/tests/test_fits_image.py b/tests/test_fits_image.py
index <HASH>..<HASH> 100644
--- a/tests/test_fits_image.py
+++ b/tests/test_fits_image.py
@@ -58,6 +58,22 @@ def test_get_beam():
assert beam is None
+def test_fix_aips_header():
+ header = fits.getheader('tests/test_files/1904-66_SIN.fits')
+ # test when this function is not needed
+ newhead = fi.fix_aips_header(header)
+
+ # test when beam params are not present, but there is no aips history
+ del header['BMAJ'], header['BMIN'], header['BPA']
+ newhead = fi.fix_aips_header(header)
+
+ # test with some aips history
+ header['HISTORY'] = 'AIPS CLEAN BMAJ= 1.2500E-02 BMIN= 1.2500E-02 BPA= 0.00'
+ newhead = fi.fix_aips_header(header)
+
+
+
+
if __name__ == "__main__":
# introspect and run all the functions starting with 'test'
for f in dir(): | add test for fix_aips_header | PaulHancock_Aegean | train | py |
89633f2f1856dd0aff45960473261fec06a20c28 | diff --git a/server/influx.go b/server/influx.go
index <HASH>..<HASH> 100644
--- a/server/influx.go
+++ b/server/influx.go
@@ -1,11 +1,14 @@
package server
import (
+ "crypto/tls"
"encoding/json"
"fmt"
+ "net"
"net/http"
"net/http/httputil"
"net/url"
+ "time"
"github.com/influxdata/chronograf"
"github.com/influxdata/chronograf/influx"
@@ -111,8 +114,29 @@ func (s *Service) Write(w http.ResponseWriter, r *http.Request) {
auth := influx.DefaultAuthorization(&src)
auth.Set(req)
}
+
proxy := &httputil.ReverseProxy{
Director: director,
}
+
+ // The connection to influxdb is using a self-signed certificate.
+ // This modifies uses the same values as http.DefaultTransport but specifies
+ // InsecureSkipVerify
+ if src.InsecureSkipVerify {
+ proxy.Transport = &http.Transport{
+ Proxy: http.ProxyFromEnvironment,
+ DialContext: (&net.Dialer{
+ Timeout: 30 * time.Second,
+ KeepAlive: 30 * time.Second,
+ DualStack: true,
+ }).DialContext,
+ MaxIdleConns: 100,
+ IdleConnTimeout: 90 * time.Second,
+ TLSHandshakeTimeout: 10 * time.Second,
+ ExpectContinueTimeout: 1 * time.Second,
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
+ }
+ }
+
proxy.ServeHTTP(w, r)
} | Update influxdb write proxy to allow self-signed certificates | influxdata_influxdb | train | go |
7cd8161bc4ae6b50631b8a0c8b67a7a46325b40c | diff --git a/lib/puppet/provider/user/user_role_add.rb b/lib/puppet/provider/user/user_role_add.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/provider/user/user_role_add.rb
+++ b/lib/puppet/provider/user/user_role_add.rb
@@ -26,7 +26,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
value !~ /\s/
end
- has_features :manages_homedir, :allows_duplicates, :manages_solaris_rbac, :manages_passwords, :manages_password_age
+ has_features :manages_homedir, :allows_duplicates, :manages_solaris_rbac, :manages_passwords, :manages_password_age, :manages_shell
#must override this to hand the keyvalue pairs
def add_properties | (PUP-<I>) Restore ability to manage shells on solaris
Background: for PUP-<I> commit <I>b0c2b0 added a new feature
for user providers `manage_shells`. The intent of that commit
was to add this feature to all existing user providers which
had that feature, and several were covered, but Solaris was
missed.
This commit simply adds the `manage_shells` feature to the
Solaris user provider, following up on the intent in PUP-<I>. | puppetlabs_puppet | train | rb |
fc83d3fe9be7a3a2ed2b428ae4d8cb78fc7c74bd | diff --git a/src/Mongolid/Model/Attributes.php b/src/Mongolid/Model/Attributes.php
index <HASH>..<HASH> 100644
--- a/src/Mongolid/Model/Attributes.php
+++ b/src/Mongolid/Model/Attributes.php
@@ -33,14 +33,14 @@ trait Attributes
*
* @var array
*/
- public $fillable = [];
+ protected $fillable = [];
/**
* The attributes that aren't mass assignable. The oposite
* to the fillable array;
*
* @var array
*/
- public $guarded = [];
+ protected $guarded = [];
/**
* Get an attribute from the model. | Updated Model\Attributes and to be protected | leroy-merlin-br_mongolid | train | php |
711ed5d2ba1b325adc100cdb3026ec52f7fc2fcd | diff --git a/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java b/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java
+++ b/src/main/java/org/jboss/vfs/protocol/VirtualFileURLConnection.java
@@ -45,7 +45,10 @@ class VirtualFileURLConnection extends AbstractURLConnection {
public void connect() throws IOException {
}
- public VirtualFile getContent() throws IOException {
+ public Object getContent() throws IOException {
+ if (getContentType() != null) {
+ return super.getContent();
+ }
return file;
} | JBVFS-<I> VirtualFileURLConnection#getContent() doesn't call a content handler
...determined by connection's contentType | jbossas_jboss-vfs | train | java |
3e9300201e98abae40029094b5deddc2c583a0dd | diff --git a/jenkins/bootstrap.py b/jenkins/bootstrap.py
index <HASH>..<HASH> 100755
--- a/jenkins/bootstrap.py
+++ b/jenkins/bootstrap.py
@@ -299,6 +299,11 @@ class GSUtil(object):
cmd = [self.gsutil, 'stat', path]
return self.call(cmd, output=True, log_failures=False)
+ def ls(self, path):
+ """List a bucket or subdir."""
+ cmd = [self.gsutil, 'ls', path]
+ return self.call(cmd, output=True)
+
def upload_json(self, path, jdict, generation=None):
"""Upload the dictionary object to path."""
if generation is not None: # generation==0 means object does not exist
@@ -337,7 +342,7 @@ class GSUtil(object):
return
try:
# If remote path exists, it will create .../_artifacts subdir instead
- gsutil.stat(path)
+ gsutil.ls(path)
# Success means remote path exists
remote_base = os.path.basename(path)
local_base = os.path.basename(artifacts) | Use ls to test subdir instead of stat | kubernetes_test-infra | train | py |
ba6f52c1172e3ab9113d873d4cb3db5754474fad | diff --git a/src/proj_gen/Client.java b/src/proj_gen/Client.java
index <HASH>..<HASH> 100644
--- a/src/proj_gen/Client.java
+++ b/src/proj_gen/Client.java
@@ -5,6 +5,7 @@ import java.io.IOException;
// VoltTable is VoltDB's table representation.
import org.voltdb.VoltTable;
import org.voltdb.VoltTableRow;
+import org.voltdb.client.ClientConfig;
// Procedures are invoked by class name. Import them to
// allow access to the class name programmatically.
@@ -147,9 +148,11 @@ public class Client {
// an org.voltdb.client.Client instance connected to the database running on
// the specified IP address, in this case 127.0.0.1. The
// database always runs on TCP/IP port 21212.
- final org.voltdb.client.Client voltclient = org.voltdb.client.ClientFactory.createClient();
+ final ClientConfig clientConfig = new ClientConfig("program", "none");
+ final org.voltdb.client.Client voltclient =
+ org.voltdb.client.ClientFactory.createClient(clientConfig);
try {
- voltclient.createConnection("localhost", "program", "none");
+ voltclient.createConnection("localhost");
}
catch (IOException e) {
e.printStackTrace(); | Actually fixing the last bit of ENG-<I>: "Update sample applications to use new createConnection and ClientConfig"
The generate script is now using the new ClientConfig. | VoltDB_voltdb | train | java |
f8211934c31030bd38f08a3cd5a3ac7b447580ec | diff --git a/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/DeclarationRegistrationManager.java b/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/DeclarationRegistrationManager.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/DeclarationRegistrationManager.java
+++ b/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/DeclarationRegistrationManager.java
@@ -51,7 +51,10 @@ public class DeclarationRegistrationManager<T extends Declaration> {
}
Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put("importer.id",declaration.getMetadata().get("id").toString());
+ if(declaration.getMetadata().get("id") != null){
+ props.put("importer.id",declaration.getMetadata().get("id").toString());
+
+ }
String[] clazzes = new String[]{klass.getName()};
ServiceRegistration registration;
registration = bundleContext.registerService(clazzes, declaration, props); | Defensive check of id presence before tostring method | ow2-chameleon_fuchsia | train | java |
d77a1898c0b21d4a391a2bea74daa56783f1399c | diff --git a/test/query.js b/test/query.js
index <HASH>..<HASH> 100644
--- a/test/query.js
+++ b/test/query.js
@@ -223,7 +223,7 @@ describe('client.query()', function() {
});
}
});
- it('should scan aerospike database and apply aggregation user defined function', function(done) {
+ it.skip('should scan aerospike database and apply aggregation user defined function', function(done) {
if( !options.run_aggregation ) {
done(); | Skips the scan aggregation test(known bug) to avoid travis failure. | aerospike_aerospike-client-nodejs | train | js |
cf1175960f717b9912aa5b3fde2e1a53f1597ccf | diff --git a/CanvasArray.php b/CanvasArray.php
index <HASH>..<HASH> 100644
--- a/CanvasArray.php
+++ b/CanvasArray.php
@@ -123,13 +123,9 @@ class CanvasArray implements Iterator, ArrayAccess {
**/
private function requestPageNumber($pageNumber, $forceRefresh = false) {
if (!isset($this->data[$this->pageNumberToKey($pageNumber)]) || $forceRefresh) {
- $page = $this->api->get(
- $this->pagination[CanvasPageLink::CURRENT]->getEndpoint(),
- array(
- CanvasPageLink::PARAM_PAGE_NUMBER => $pageNumber,
- CanvasPageLink::PARAM_PER_PAGE => $this->pagination[CanvasPageLink::CURRENT]->getPerPage()
- )
- );
+ $params = $this->pagination[CanvasPageLink::CURRENT]->getParams();
+ $params[CanvasPageLink::PARAM_PAGE_NUMBER] = $pageNumber;
+ $page = $this->api->get($this->pagination[CanvasPageLink::CURRENT]->getEndpoint(), $params);
$this->data = array_replace($this->data, $page->data);
return true;
} | Keep parameters
Turns out we were losing the parameters to the query when we were paging through the array. Now we're not. | smtech_canvaspest | train | php |
6d7272d79a1e21497f06962b6ae20d4e5e38ab81 | diff --git a/lib/emitter.js b/lib/emitter.js
index <HASH>..<HASH> 100644
--- a/lib/emitter.js
+++ b/lib/emitter.js
@@ -12,6 +12,12 @@ try {
}
/**
+ * Module exports.
+ */
+
+module.exports = Emitter;
+
+/**
* Node-compatible `EventEmitter#removeListener`
*
* @api public | emitter: re-export `Emitter` | socketio_engine.io-client | train | js |
31d6331615f814e535922766b58bdb3939e353b4 | diff --git a/course/enrol.php b/course/enrol.php
index <HASH>..<HASH> 100644
--- a/course/enrol.php
+++ b/course/enrol.php
@@ -18,7 +18,8 @@
if (isguest()) {
add_to_log($course->id, "course", "guest", "view.php?id=$course->id", "$REMOTE_ADDR, $REMOTE_HOST");
- } else {
+ } else if (!record_exists("user_students", "userid", $USER->id, "course", $course->id)) {
+
if (! enrol_student($USER->id, $course->id)) {
error("An error occurred while trying to enrol you.");
} | Don't go through enrolment procedure if they are already enrolled. | moodle_moodle | train | php |
6a2365f099425db950e9237477849c8c10d11394 | diff --git a/bosh-dev/lib/bosh/dev/sandbox/services/director_service.rb b/bosh-dev/lib/bosh/dev/sandbox/services/director_service.rb
index <HASH>..<HASH> 100644
--- a/bosh-dev/lib/bosh/dev/sandbox/services/director_service.rb
+++ b/bosh-dev/lib/bosh/dev/sandbox/services/director_service.rb
@@ -78,10 +78,12 @@ module Bosh::Dev::Sandbox
@worker_processes.each(&:start)
start_time = Time.now
timeout = 60 * 5
- sleep 0.5 until resque_is_ready? do
+ until resque_is_ready? do
if (Time.now - start_time) > timeout
raise "Resque failed to start workers in #{timeout} seconds"
end
+
+ sleep 0.5
end
end
@@ -89,10 +91,12 @@ module Bosh::Dev::Sandbox
@logger.debug('Waiting for Resque queue to drain...')
start_time = Time.now
timeout = 60
- sleep 0.1 until resque_is_done? do
+ until resque_is_done? do
if (Time.now - start_time) > timeout
- @logger.err("Resque queue failed to drain in #{timeout} seconds")
+ raise "Resque queue failed to drain in #{timeout} seconds"
end
+
+ sleep 0.1
end
@logger.debug('Resque queue drained') | Fail if stopping workers fails within timeout | cloudfoundry_bosh | train | rb |
cdc5df495e60c8bf949f8d083fc9a6ca35928df9 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -43,9 +43,10 @@ requirements = [
]
if not os.getenv("READTHEDOCS"):
- requirements.pop("xarray>=0.14.1")
- requirements.append("git+https://github.com/pydata/xarray@master#egg=xarray")
requirements.append("rtree>=0.9")
+else:
+ requirements.remove("xarray>=0.14.1")
+ requirements.append("git+https://github.com/pydata/xarray@master#egg=xarray")
setup_requirements = ["pytest-runner"] | Use remove and ensure that RtD uses xarray@master | Ouranosinc_xclim | train | py |
baf62205c451083e2635aa92a511ce02cd14492e | diff --git a/test/browsers.spec.js b/test/browsers.spec.js
index <HASH>..<HASH> 100644
--- a/test/browsers.spec.js
+++ b/test/browsers.spec.js
@@ -29,7 +29,7 @@ function testFixture(title, browsers, expectThrows){
}
testFixture('Valid: ["last 2 versions"]', ['last 2 versions'], false);
-testFixture('Invalid: ["dummy"]', ['dummy'], true);
+testFixture('Invalid: ["dummy"]', ['dummy'], false);
testFixture('Invalid: []', [], true);
testFixture('Invalid: {}', {}, true);
testFixture('Invalid: 123', 123, true); | Updated a test for property `browsers`
`cssnext` used to check contents of "browsers", `postcss-preset-env` doesn't | wildpeaks_package-webpack-config-web | train | js |
c3e38ea851ddb7187403da06b6d81eb7d4748800 | diff --git a/pavement.py b/pavement.py
index <HASH>..<HASH> 100644
--- a/pavement.py
+++ b/pavement.py
@@ -58,4 +58,4 @@ def docs():
@task
def test():
- sh("nosetests --processes=8")
+ sh("nosetests") | with the increasing port numbers, multiple processes wind up deadlocking | teepark_junction | train | py |
8602f4aa742ed3a05d8cb3c52bf978ea7572229e | diff --git a/lib/parse-args.js b/lib/parse-args.js
index <HASH>..<HASH> 100644
--- a/lib/parse-args.js
+++ b/lib/parse-args.js
@@ -61,7 +61,6 @@ function buildYargs (withCommands = false) {
type: 'boolean'
})
.option('temp-directory', {
- default: './coverage/tmp',
describe: 'directory V8 coverage data is written to and read from'
})
.option('resolve', {
@@ -85,6 +84,12 @@ function buildYargs (withCommands = false) {
.pkgConf('c8')
.config(config)
.demandCommand(1)
+ .check((argv) => {
+ if (!argv.tempDirectory) {
+ argv.tempDirectory = argv.reportsDir
+ }
+ return true
+ })
.epilog('visit https://git.io/vHysA for list of available reporters')
const checkCoverage = require('./commands/check-coverage') | feat!: default temp directory to report directory (#<I>)
BREAKING CHANGE: temp directory now defaults to setting for report directory | bcoe_c8 | train | js |
19503a41afe358f87de4ea0681d0b103b875bb4c | diff --git a/lib/mshoplib/src/MShop/Locale/Manager/Default.php b/lib/mshoplib/src/MShop/Locale/Manager/Default.php
index <HASH>..<HASH> 100644
--- a/lib/mshoplib/src/MShop/Locale/Manager/Default.php
+++ b/lib/mshoplib/src/MShop/Locale/Manager/Default.php
@@ -361,6 +361,7 @@ class MShop_Locale_Manager_Default
}
+ // Try to find the best matching locale
$search = $this->createSearch( $active );
$expr = array (
diff --git a/lib/mshoplib/src/MShop/Locale/Manager/Site/Default.php b/lib/mshoplib/src/MShop/Locale/Manager/Site/Default.php
index <HASH>..<HASH> 100644
--- a/lib/mshoplib/src/MShop/Locale/Manager/Site/Default.php
+++ b/lib/mshoplib/src/MShop/Locale/Manager/Site/Default.php
@@ -406,6 +406,8 @@ class MShop_Locale_Manager_Site_Default
throw new MShop_Locale_Exception( sprintf( 'Tree root with code "%1$s" in "%2$s" not found', 'default', 'locale.site.code' ) );
}
+ $this->_cache[ $item->getId() ] = $item;
+
return $item;
} | Minor improvment in locale managers | Arcavias_arcavias-core | train | php,php |
34552602d6188faa582e2a985c3a8a937c7b7f09 | diff --git a/scripts/bcbio_setup_genome.py b/scripts/bcbio_setup_genome.py
index <HASH>..<HASH> 100755
--- a/scripts/bcbio_setup_genome.py
+++ b/scripts/bcbio_setup_genome.py
@@ -155,6 +155,7 @@ if __name__ == "__main__":
raise ValueError("--mirbase and --srna_gtf both need a value.")
env.hosts = ["localhost"]
+ os.environ["PATH"] += os.pathsep + os.path.dirname(sys.executable)
cbl = get_cloudbiolinux(REMOTES)
sys.path.insert(0, cbl["dir"])
genomemod = __import__("cloudbio.biodata", fromlist=["genomes"]) | Allow bcbio_setup_genome to use bioconda installed binaries. | bcbio_bcbio-nextgen | train | py |
2cc63d7d69a99c1444a6683e7d587a0b47e87816 | diff --git a/blueprints/ember-cli-chosen/index.js b/blueprints/ember-cli-chosen/index.js
index <HASH>..<HASH> 100644
--- a/blueprints/ember-cli-chosen/index.js
+++ b/blueprints/ember-cli-chosen/index.js
@@ -3,8 +3,6 @@ module.exports = {
description: 'Include "Chosen" bower package',
afterInstall: function(options) {
- return this.addBowerPackagesToProject([
- { name: 'chosen=https://github.com/harvesthq/chosen/releases/download/v1.3.0/chosen_v1.3.0.zip' }
- ]);
+ return this.addBowerPackageToProject('chosen', 'https://github.com/harvesthq/chosen/releases/download/v1.3.0/chosen_v1.3.0.zip');
}
}; | Fixing issue with bower package resolution in blueprint | green-arrow_ember-cli-chosen | train | js |
6411e48038d25369b9494e36d121d1472265133c | diff --git a/tests/test_bugzilla.py b/tests/test_bugzilla.py
index <HASH>..<HASH> 100644
--- a/tests/test_bugzilla.py
+++ b/tests/test_bugzilla.py
@@ -20,6 +20,7 @@ class TestBugzillaService(ServiceTest):
arbitrary_record = {
'component': 'Something',
'priority': 'urgent',
+ 'status': 'NEW',
'summary': 'This is the issue summary',
'id': 1234567,
}
@@ -40,6 +41,7 @@ class TestBugzillaService(ServiceTest):
'priority': issue.PRIORITY_MAP[arbitrary_record['priority']],
'annotations': arbitrary_extra['annotations'],
+ issue.STATUS: arbitrary_record['status'],
issue.URL: arbitrary_extra['url'],
issue.SUMMARY: arbitrary_record['summary'],
issue.BUG_ID: arbitrary_record['id'] | Ooops, add status field to tests | ralphbean_bugwarrior | train | py |
17a5bdf1626aff8191866de883be04fab47b5283 | diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php
index <HASH>..<HASH> 100755
--- a/src/Composer/Repository/Vcs/GitHubDriver.php
+++ b/src/Composer/Repository/Vcs/GitHubDriver.php
@@ -76,7 +76,7 @@ class GitHubDriver extends VcsDriver
return $this->gitDriver->getUrl();
}
- return $this->url;
+ return 'https://github.com/'.$this->owner.'/'.$this->repository.'.git';
}
/** | Normalize github URLs generated by the GitHubDriver, fixes #<I> | mothership-ec_composer | train | php |
d7704097ca4ec9ffd3f2e06286331fde36fe2a5e | diff --git a/src/Entity/AbstractEntity.php b/src/Entity/AbstractEntity.php
index <HASH>..<HASH> 100644
--- a/src/Entity/AbstractEntity.php
+++ b/src/Entity/AbstractEntity.php
@@ -441,10 +441,7 @@ abstract class AbstractEntity implements IEntity
}
}
- if (!$metadata->isValid($value)) {
- $class = get_class($this);
- throw new InvalidArgumentException("Value for {$class}::\${$name} property is invalid.");
- }
+ $this->validate($metadata, $name, $value);
$this->data[$name] = $value;
$this->modified[$name] = TRUE;
}
@@ -501,6 +498,22 @@ abstract class AbstractEntity implements IEntity
/**
+ * Validates the value.
+ * @param PropertyMetadata $metadata
+ * @param string $name
+ * @param mixed $value
+ * @throws InvalidArgumentException
+ */
+ protected function validate(PropertyMetadata $metadata, $name, & $value)
+ {
+ if (!$metadata->isValid($value)) {
+ $class = get_class($this);
+ throw new InvalidArgumentException("Value for {$class}::\${$name} property is invalid.");
+ }
+ }
+
+
+ /**
* @param PropertyMetadata $metadata
* @return IProperty $property
*/ | entity: extracted value validation into own method | nextras_orm | train | php |
c7ffb66eef4332f6850c3234af586c96c12ec01e | diff --git a/lib/upnp/control_point/device.rb b/lib/upnp/control_point/device.rb
index <HASH>..<HASH> 100644
--- a/lib/upnp/control_point/device.rb
+++ b/lib/upnp/control_point/device.rb
@@ -255,6 +255,9 @@ module UPnP
def extract_spec_version
"#{@description[:root][:specVersion][:major]}.#{@description[:root][:specVersion][:minor]}"
+ if @description[:root]
+ "#{@description[:root][:specVersion][:major]}.#{@description[:root][:specVersion][:minor]}"
+ end
end
def start_service_extraction | Fix for descriptions that don't have specVersion. Relates to gh-5. | turboladen_playful | train | rb |
eb5b84e89bc6a3fb6fe7cc93b85cfa40e1f030b9 | diff --git a/python_modules/dagster/dagster_tests/general_tests/grpc_tests/test_watch_server.py b/python_modules/dagster/dagster_tests/general_tests/grpc_tests/test_watch_server.py
index <HASH>..<HASH> 100644
--- a/python_modules/dagster/dagster_tests/general_tests/grpc_tests/test_watch_server.py
+++ b/python_modules/dagster/dagster_tests/general_tests/grpc_tests/test_watch_server.py
@@ -2,6 +2,7 @@
import time
+import pytest
from dagster.grpc.client import DagsterGrpcClient
from dagster.grpc.server import open_server_process
from dagster.grpc.server_watcher import create_grpc_watch_thread
@@ -154,6 +155,7 @@ def test_grpc_watch_thread_server_error():
assert called["on_error"]
[email protected]
def test_grpc_watch_thread_server_complex_cycle():
# Server goes down, comes back up as the same server three times, then goes away and comes
# back as a new server
@@ -216,6 +218,7 @@ def test_grpc_watch_thread_server_complex_cycle():
assert events[-1] == "on_updated"
[email protected]
def test_grpc_watch_thread_server_complex_cycle_2():
# Server goes down, comes back up as the same server three times, then goes away and comes
# back as a new server | Mark complex cycle grpc server watch tests as skipped
Summary: Title
Test Plan: none
Reviewers: prha
Reviewed By: prha
Differential Revision: <URL> | dagster-io_dagster | train | py |
fbb31048a7b548b223eabc0cac139a4738780f88 | diff --git a/src/main/java/com/voxeo/tropo/ActionResult.java b/src/main/java/com/voxeo/tropo/ActionResult.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/voxeo/tropo/ActionResult.java
+++ b/src/main/java/com/voxeo/tropo/ActionResult.java
@@ -24,6 +24,11 @@ public class ActionResult implements Serializable {
private String xml;
private Integer duration;
private String url;
+
+ /*Depend on upload status after recording completion. "uploadStatus": ["success"|"failed"|"unavailable�], will provide
+ information about the recording status
+ */
+ private String uploadStatus;
public String getName() {
return name;
@@ -91,6 +96,12 @@ public class ActionResult implements Serializable {
public void setUrl(String url) {
this.url = url;
}
+ public String getuploadStatus() {
+ return uploadStatus;
+ }
+ public void setuploadStatus(String uploadStatus) {
+ this.uploadStatus = uploadStatus;
+ }
@Override
public String toString(){ | [CASE# <I>][Problem Description: During recording Upload failure over
HTTP, Application didn’t get the correct result][Solution: If the upload
fails tropo will give a new field "uploadStatus":
["success"|"failed"|"unavailable”] | tropo_tropo-webapi-java | train | java |
4ae3af4954da5414609b9e5d8abb6e2d4cc81388 | diff --git a/demo.js b/demo.js
index <HASH>..<HASH> 100644
--- a/demo.js
+++ b/demo.js
@@ -25,12 +25,10 @@ const memory = Memory({
start: VIDEO_ADDRESS_OFFSET, // -3280 00iii iiiii
end: VIDEO_ADDRESS_SIZE + VIDEO_ADDRESS_OFFSET, // 29524, end 11111 11111
},
- /* TODO
- input: {
- start: -3,
- end: -1,
+ chargen: {
+ start: -3281, // 0i111 11111,
+ end: -3281,
},
- */
}
});
@@ -48,6 +46,10 @@ memory.map.video.write = (address, value) => {
term.tc.refresh();
};
+memory.map.chargen.write = (address, value) => {
+ term.writeUChar(value);
+ // TODO: write to row,col from another memory address value (no trap needed). -3282, -3283? - for cursor
+};
const cpu = CPU({
memory: memory
@@ -76,6 +78,8 @@ var lines = [
'TAX',
+ 'STA -3281',
+
'HALT_Z'
]; | Chargen - write trit-text character to terminal | thirdcoder_cpu3502 | train | js |
0cf15f13ac72268070b6aa4ff362d7ca8555c08b | diff --git a/ghettoq/backends/pyredis.py b/ghettoq/backends/pyredis.py
index <HASH>..<HASH> 100644
--- a/ghettoq/backends/pyredis.py
+++ b/ghettoq/backends/pyredis.py
@@ -1,6 +1,6 @@
from Queue import Empty
-from redis import Redis as Redis
+from redis import Redis
from ghettoq.backends.base import BaseBackend
DEFAULT_PORT = 6379
@@ -48,4 +48,7 @@ class RedisBackend(BaseBackend):
return item, dest
def purge(self, queue):
- return self.client.delete(queue)
+ size = self.client.llen(queue)
+ self.client.delete(queue)
+ return size
+ | Redis: purge now returns number of messages deleted. | ask_ghettoq | train | py |
86eb7951c13ee7437f5952d63537533068f9f15c | diff --git a/digitalocean/v2/digitalocean/client.go b/digitalocean/v2/digitalocean/client.go
index <HASH>..<HASH> 100644
--- a/digitalocean/v2/digitalocean/client.go
+++ b/digitalocean/v2/digitalocean/client.go
@@ -35,17 +35,19 @@ func (c *Client) loadResponse(path string, i interface{}) error {
return json.Unmarshal(b, &i)
}
+func New(token string) (*Client, error) {
+ if token == "" {
+ return nil, fmt.Errorf("token must be set")
+ }
+ return &Client{Client: &http.Client{Transport: &transport{apiToken: token}}}, nil
+}
+
func NewFromEnv() (*Client, error) {
- cl := &transport{apiToken: os.Getenv("DIGITAL_OCEAN_API_KEY")}
- if cl.apiToken == "" {
+ token := os.Getenv("DIGITAL_OCEAN_API_KEY")
+ if token == "" {
return nil, fmt.Errorf("DIGITAL_OCEAN_API_KEY must be set in env")
}
- return &Client{
- Client: &http.Client{
- Transport: cl,
- },
- },
- nil
+ return New(token)
}
type transport struct { | add constructor for initializing do client with a specific token | dynport_gocloud | train | go |
965ed2cf96c71fbc16bc07f77de5d353d089b334 | diff --git a/plucky/__init__.py b/plucky/__init__.py
index <HASH>..<HASH> 100644
--- a/plucky/__init__.py
+++ b/plucky/__init__.py
@@ -3,7 +3,7 @@ Plucking (deep) keys/paths safely from python collections has never been easier.
"""
__title__ = 'plucky'
-__version__ = '0.3.2'
+__version__ = '0.3.3'
__author__ = 'Radomir Stevanovic'
__author_email__ = '[email protected]'
__copyright__ = 'Copyright 2014 Radomir Stevanovic' | bumped to <I> | randomir_plucky | train | py |
f1123d9b86f0c495a9e2ac4add8296c57cec0d24 | diff --git a/tests/Phinx/Config/ConfigFileTest.php b/tests/Phinx/Config/ConfigFileTest.php
index <HASH>..<HASH> 100644
--- a/tests/Phinx/Config/ConfigFileTest.php
+++ b/tests/Phinx/Config/ConfigFileTest.php
@@ -37,7 +37,9 @@ class ConfigFileTest extends \PHPUnit_Framework_TestCase
public function testWorkingGetConfigFile($input, $dir, $expectedFile)
{
$foundPath = $this->runLocateFile($input, $dir);
- $this->assertEquals($foundPath, $this->baseDir . '/' . $dir . '/' . $expectedFile);
+ $expectedPath = $this->baseDir . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $expectedFile;
+
+ $this->assertEquals($foundPath, $expectedPath);
}
/**
@@ -130,4 +132,4 @@ class VoidCommand extends AbstractCommand
return parent::locateConfigFile($input);
}
-}
\ No newline at end of file
+} | Use DIRECTORY_SEPARATOR in expected result
Who still uses windows ? | cakephp_phinx | train | php |
f9b158da0291a05dc71c51764460ca3aaf8f2e84 | diff --git a/cgroups/fs/apply_raw.go b/cgroups/fs/apply_raw.go
index <HASH>..<HASH> 100644
--- a/cgroups/fs/apply_raw.go
+++ b/cgroups/fs/apply_raw.go
@@ -57,12 +57,13 @@ func GetStats(c *cgroups.Cgroup) (*cgroups.Stats, error) {
d, err := getCgroupData(c, 0)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("getting CgroupData %s", err)
}
- for _, sys := range subsystems {
- if err := sys.GetStats(d, stats); err != nil {
- return nil, err
+ for sysName, sys := range subsystems {
+ // Don't fail if a cgroup hierarchy was not found.
+ if err := sys.GetStats(d, stats); err != nil && err != cgroups.ErrNotFound {
+ return nil, fmt.Errorf("getting stats for system %q %s", sysName, err)
}
} | Don't fail getting stats of unknown hierarchies.
Docker-DCO-<I>- | opencontainers_runc | train | go |
4217295050a8a0790fd60d46099d2ad4f72606be | diff --git a/core/client/Brocfile.js b/core/client/Brocfile.js
index <HASH>..<HASH> 100644
--- a/core/client/Brocfile.js
+++ b/core/client/Brocfile.js
@@ -29,7 +29,8 @@ app = new EmberApp({
source: './app/styles/app.css',
inputFile: 'app.css',
browsers: 'last 2 versions',
- sourcemap: !mythCompress,
+ // @TODO: enable sourcemaps for development without including them in the release
+ sourcemap: false,
compress: mythCompress,
outputFile: isProduction ? 'ghost.min.css' : 'ghost.css'
}, | Temporarily disable sourcemaps
- Sourcemaps are adding ~<I>mb to the release zip, which is not cool
- Long term, we need to swap this out for a system that will let us do sourcemaps in dev, and
generate a separate non-minified css file without the sourcemap when doing a release
- Short term, I'm disabling sourcemaps & they'll need to be enabled when needed | TryGhost_Ghost | train | js |
fa810d1ebd2c69bc0ba12dd91016d3b10199f849 | diff --git a/lib/metasploit/model/version.rb b/lib/metasploit/model/version.rb
index <HASH>..<HASH> 100644
--- a/lib/metasploit/model/version.rb
+++ b/lib/metasploit/model/version.rb
@@ -8,6 +8,8 @@ module Metasploit
MINOR = 24
# The patch number, scoped to the {MINOR} version number.
PATCH = 1
+ # The prerelease version number, scoped to the {PATCH} version number.
+ PRERELEASE = 'metasploit-model-search-operator-and-operation-groups'
# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format. | Change PRERELEASE for branch
MSP-<I> | rapid7_metasploit-model | train | rb |
3c7bfb9bf535f773ccea15f845f4bd0358a53e49 | diff --git a/test/mailinSpec.js b/test/mailinSpec.js
index <HASH>..<HASH> 100644
--- a/test/mailinSpec.js
+++ b/test/mailinSpec.js
@@ -104,6 +104,17 @@ describe('Mailin', function () {
// ]
}],
dkim: 'failed',
+ envelopeFrom: [{
+ address: "[email protected]",
+ name: ""
+ }],
+ envelopeTo: [{
+ address: "[email protected]",
+ name: ""
+ }, {
+ address: "[email protected]",
+ name: ""
+ }],
spf: 'failed',
spamScore: 3.3,
language: 'pidgin',
@@ -176,6 +187,17 @@ describe('Mailin', function () {
length: '28'
}],
dkim: 'failed',
+ envelopeFrom: [{
+ address: '[email protected]',
+ name: ''
+ }],
+ envelopeTo: [{
+ address: '[email protected]',
+ name: ''
+ }, {
+ address: '[email protected]',
+ name: ''
+ }],
spf: 'failed',
spamScore: 3.3,
language: 'pidgin', | Added envelope to expected data in tests | Flolagale_mailin | train | js |
cdc491c3513945706cf1928b60059d744ce8db33 | diff --git a/src/mixins/trackHelper.js b/src/mixins/trackHelper.js
index <HASH>..<HASH> 100644
--- a/src/mixins/trackHelper.js
+++ b/src/mixins/trackHelper.js
@@ -15,6 +15,8 @@ export var getTrackCSS = function(spec) {
var trackWidth, trackHeight;
+ const trackChildren = (spec.slideCount + 2 * spec.slidesToShow);
+
if (!spec.vertical) {
if (spec.variableWidth) {
trackWidth = (spec.slideCount + 2*spec.slidesToShow) * spec.slideWidth; | Fixed trackChildren is not defined error. | akiran_react-slick | train | js |
831b14356f3c44f1beddf2c39fe3748253217836 | diff --git a/stanza/pipeline/tokenize_processor.py b/stanza/pipeline/tokenize_processor.py
index <HASH>..<HASH> 100644
--- a/stanza/pipeline/tokenize_processor.py
+++ b/stanza/pipeline/tokenize_processor.py
@@ -5,7 +5,7 @@ Processor for performing tokenization
import io
import logging
-from stanza.models.tokenization.data import DataLoader
+from stanza.models.tokenization.data import DataLoader, NEWLINE_WHITESPACE_RE
from stanza.models.tokenization.trainer import Trainer
from stanza.models.tokenization.utils import output_predictions
from stanza.pipeline._constants import *
@@ -81,7 +81,7 @@ class TokenizeProcessor(UDProcessor):
# set up batches
if self.config.get('lang') == 'vi':
# special processing is due for Vietnamese
- text = '\n\n'.join([x for x in raw_text.split('\n\n')]).rstrip()
+ text = '\n\n'.join([x.rstrip() for x in NEWLINE_WHITESPACE_RE.split(raw_text)]).rstrip()
dummy_labels = '\n\n'.join(['0' * len(x) for x in text.split('\n\n')])
data = paras_to_chunks(text, dummy_labels)
batches = DataLoader(self.config, input_data=data, vocab=self.vocab, evaluation=True) | Fix inconsistency issue between vi and the rest of the languages on how consecutive newlines are handled (#<I>) | stanfordnlp_stanza | train | py |
414ce1c93a15906a03d80bd94c4a2d3142693416 | diff --git a/cslbot/commands/quote.py b/cslbot/commands/quote.py
index <HASH>..<HASH> 100644
--- a/cslbot/commands/quote.py
+++ b/cslbot/commands/quote.py
@@ -148,7 +148,10 @@ def cmd(send, msg, args):
else:
send("You aren't allowed to edit quotes. Please ask a bot admin to do it")
elif cmdargs.search:
- send(search_quote(session, cmdargs.offset, cmdargs.search))
+ if cmdargs.approve or cmdargs.nick:
+ send("Invalid option for --search")
+ else:
+ send(search_quote(session, cmdargs.offset, cmdargs.search))
else:
if msg.isdigit():
send(do_get_quote(session, int(msg))) | Don't silently eat --nick | tjcsl_cslbot | train | py |
Subsets and Splits