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
|
---|---|---|---|---|---|
6db63ef61947bd9fb6221e82ac214550abfb8035 | diff --git a/middlewares/animate.js b/middlewares/animate.js
index <HASH>..<HASH> 100644
--- a/middlewares/animate.js
+++ b/middlewares/animate.js
@@ -35,7 +35,7 @@ function animate (elem) {
elem.$attribute('leave-animation', leaveAttribute)
elem.$attribute('move-animation', moveAttribute)
- queueCheck()
+ Promise.resolve().then(queueCheck)
elem.$cleanup(queueCheck)
}
animate.$name = 'animate' | fix(animate): defer premature queue checks as microtasks | nx-js_framework | train | js |
adffe3764c827afcfe62c3f53bf873ed9367aa76 | diff --git a/src/Models/Traits/HasMemberOfTrait.php b/src/Models/Traits/HasMemberOfTrait.php
index <HASH>..<HASH> 100644
--- a/src/Models/Traits/HasMemberOfTrait.php
+++ b/src/Models/Traits/HasMemberOfTrait.php
@@ -4,7 +4,6 @@ namespace Adldap\Models\Traits;
use Adldap\Utilities;
use Adldap\Models\Group;
-use Adldap\Models\Model;
trait HasMemberOfTrait
{
@@ -120,14 +119,14 @@ trait HasMemberOfTrait
{
$dns = $this->getAttribute($this->getSchema()->memberOf());
- $dns = (is_array($dns) ? $dns : []);
+ $dns = is_array($dns) ? $dns : [];
$query = $this->getQuery()->newInstance();
return $query->newCollection($dns)->map(function ($dn) use ($query, $fields) {
return $query->select($fields)->findByDn($dn);
})->filter(function ($group) {
- return $group instanceof Model;
+ return $group instanceof Group;
});
}
@@ -138,7 +137,7 @@ trait HasMemberOfTrait
*/
public function getMemberOfNames()
{
- return $this->getMemberOf()->map(function (Model $group) {
+ return $this->getMemberOf()->map(function (Group $group) {
return $group->getCommonName();
})->toArray();
} | Revert fix for #<I>
- Reverting until an update is given. | Adldap2_Adldap2 | train | php |
5f025706ac794d502c640d4fcc3ec3e91f016869 | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -288,12 +288,14 @@ describe('Filter', function() {
}
beforeEach(co.wrap(function* () {
+ process.env.JOBS = '4';
input = yield createTempDir();
subject = new Plugin(input.path(), { async:true });
output = createBuilder(subject);
}));
afterEach(co.wrap(function* () {
+ delete process.env.JOBS;
yield input.dispose();
yield output.dispose();
})); | fix async build failure test
must explicitly specify concurrency of 4,
otherwise this test will fail on machines with < 4 cores | stefanpenner_broccoli-persistent-filter | train | js |
f1fc305401afb0acc431ba50b6f47ed8d0c3f985 | diff --git a/kernel_tuner/interface.py b/kernel_tuner/interface.py
index <HASH>..<HASH> 100644
--- a/kernel_tuner/interface.py
+++ b/kernel_tuner/interface.py
@@ -120,6 +120,7 @@ limitations under the License.
import numpy
import itertools
+from collections import OrderedDict
from kernel_tuner.cuda import CudaFunctions
from kernel_tuner.opencl import OpenCLFunctions
@@ -235,7 +236,7 @@ def tune_kernel(kernel_name, kernel_string, problem_size, arguments,
#compute cartesian product of all tunable parameters
for element in itertools.product(*tune_params.values()):
- params = dict(zip(tune_params.keys(), element))
+ params = OrderedDict(zip(tune_params.keys(), element))
instance_string = "_".join([str(i) for i in params.values()])
#check for search space restrictions | started using ordered dictionary allowing a fixed order among tuning parameters | benvanwerkhoven_kernel_tuner | train | py |
0ccc759c9e9fadac77a19b9f6f6d4085dcdf21b2 | diff --git a/choco/src/main/java/org/btrplace/scheduler/choco/constraint/CSpread.java b/choco/src/main/java/org/btrplace/scheduler/choco/constraint/CSpread.java
index <HASH>..<HASH> 100644
--- a/choco/src/main/java/org/btrplace/scheduler/choco/constraint/CSpread.java
+++ b/choco/src/main/java/org/btrplace/scheduler/choco/constraint/CSpread.java
@@ -86,10 +86,11 @@ public class CSpread implements ChocoConstraint {
private static void disallowOverlap(ReconfigurationProblem rp, VMTransition t1, VMTransition t2) {
Slice dI = t1.getDSlice();
- Slice cJ = t1.getCSlice();
+ Slice cI = t1.getCSlice();
Slice dJ = t2.getDSlice();
- Slice cI = t2.getCSlice();
+ Slice cJ = t2.getCSlice();
+
if (dI != null && cJ != null) {
precedenceIfOverlap(rp, dI, cJ); | Fix #<I>
A copy paste error when refactoring.
This however exhibit a cyclic dependency that takes ages to be fixed using other migrations. | btrplace_scheduler | train | java |
3b5c522a7852de526c6edf9080990de6c57bd7c9 | diff --git a/soco/data_structures.py b/soco/data_structures.py
index <HASH>..<HASH> 100755
--- a/soco/data_structures.py
+++ b/soco/data_structures.py
@@ -764,6 +764,24 @@ class DidlMusicTrack(DidlAudioItem):
)
+class DidlAudioBook(DidlAudioItem):
+
+ """Class that represents a music library track."""
+
+ # the DIDL Lite class for this object.
+ item_class = 'object.item.audioItem.audioBook'
+ # name: (ns, tag)
+ _translation = DidlAudioItem._translation.copy()
+ _translation.update(
+ {
+ 'storageMedium': ('upnp', 'storageMedium'),
+ 'producer': ('upnp', 'producer'),
+ 'contributor': ('dc', 'contributor'),
+ 'date': ('dc', 'date'),
+ }
+ )
+
+
class DidlAudioBroadcast(DidlAudioItem):
"""Class that represents an audio broadcast.""" | Added support for object.item.audioItem.audioBook | amelchio_pysonos | train | py |
cee6c74960a5176d921eb16458cd053f39833639 | diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java
index <HASH>..<HASH> 100644
--- a/gson/src/main/java/com/google/gson/Gson.java
+++ b/gson/src/main/java/com/google/gson/Gson.java
@@ -427,16 +427,10 @@ public final class Gson {
*/
@SuppressWarnings("unchecked")
public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonParseException {
- try {
- JsonDeserializationContext context = new JsonDeserializationContextDefault(
- createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
- T target = (T) context.deserialize(json, typeOfT);
- return target;
- } catch (StackOverflowError e) {
- throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
- } catch (OutOfMemoryError e) {
- throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
- }
+ JsonDeserializationContext context = new JsonDeserializationContextDefault(
+ createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
+ T target = (T) context.deserialize(json, typeOfT);
+ return target;
}
/** | incorporated code review comments from r<I> by removing the catching of OutOfMemoryError and StackOverflowError in Gson.fromJson. This is obviated since JsonParser.parse catches these errors, and that was the primary source of these problems. | google_gson | train | java |
467c3f8efe1a87e3029df282e4df60ad98bc4142 | diff --git a/src/main/java/org/junit/Assert.java b/src/main/java/org/junit/Assert.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/junit/Assert.java
+++ b/src/main/java/org/junit/Assert.java
@@ -923,8 +923,9 @@ public class Assert {
* @param matcher an expression, built of {@link Matcher}s, specifying allowed
* values
* @see org.hamcrest.CoreMatchers
- * @see org.hamcrest.MatcherAssert
+ * @deprecated use {@code org.hamcrest.MatcherAssert.assertThat()}
*/
+ @Deprecated
public static <T> void assertThat(T actual, Matcher<? super T> matcher) {
assertThat("", actual, matcher);
}
@@ -955,8 +956,9 @@ public class Assert {
* @param matcher an expression, built of {@link Matcher}s, specifying allowed
* values
* @see org.hamcrest.CoreMatchers
- * @see org.hamcrest.MatcherAssert
+ * @deprecated use {@code org.hamcrest.MatcherAssert.assertThat()}
*/
+ @Deprecated
public static <T> void assertThat(String reason, T actual,
Matcher<? super T> matcher) {
MatcherAssert.assertThat(reason, actual, matcher); | Deprecate Assert#assertThat
The method "assertThat" is used for writing assertions with Hamcrest.
Hamcrest is an independent assertion library and contains an own
"assertThat" method in the class "org.hamcrest.MatcherAssert". It is
available both in the old Hamcrest <I> release and in the current
Hamcrest <I>. Therefore the JUnit team recommends to use Hamcrest's own
"assertThat" directly. | junit-team_junit4 | train | java |
4a27816fd7cb9ddee00652d3994758980811d43b | diff --git a/src/Locator/SanitizeLocator.php b/src/Locator/SanitizeLocator.php
index <HASH>..<HASH> 100644
--- a/src/Locator/SanitizeLocator.php
+++ b/src/Locator/SanitizeLocator.php
@@ -49,8 +49,6 @@ class SanitizeLocator extends Locator
'now' => function () { return new Sanitize\Now(); },
'regex' => function () { return new Sanitize\Regex(); },
'remove' => function () { return new Sanitize\Remove(); },
- 'strictEqualToField' => function () { return new Sanitize\StrictEqualToField(); },
- 'strictEqualToValue' => function () { return new Sanitize\StrictEqualToValue(); },
'string' => function () { return new Sanitize\Str(); },
'strlen' => function () { return new Sanitize\Strlen(); },
'strlenBetween' => function () { return new Sanitize\StrlenBetween(); }, | Removed undefined but registered sanitizers | auraphp_Aura.Filter | train | php |
c97e6d32be1c1fccc9b39f8441fe83034dcb033c | diff --git a/src/fuzzfetch/fetch.py b/src/fuzzfetch/fetch.py
index <HASH>..<HASH> 100644
--- a/src/fuzzfetch/fetch.py
+++ b/src/fuzzfetch/fetch.py
@@ -24,6 +24,7 @@ import zipfile
import configparser # pylint: disable=wrong-import-order
import requests
+from datetime import datetime
__all__ = ("Fetcher", "FetcherException", "BuildFlags")
@@ -188,6 +189,11 @@ class Fetcher(object):
self._flags = BuildFlags(*flags)
self._task = BuildTask(build, branch, self._flags)
+ now = datetime.utcnow()
+ build_time = datetime.strptime(self.build_id, '%Y%m%d%H%M%S')
+ if build == 'latest' and (now - build_time).total_seconds() > 86400:
+ log.warning('Latest available build is older than 1 day: %s', self.build_id)
+
# if the build string contains the platform, assume it is a TaskCluster namespace
if self.moz_info["platform_guess"] in build:
# try to set args to match the namespace given | Warn when latest available build is older than 1 day | MozillaSecurity_fuzzfetch | train | py |
14c1006048c406a719e1c544c318c4568e0012d8 | diff --git a/lib/api/apex.js b/lib/api/apex.js
index <HASH>..<HASH> 100644
--- a/lib/api/apex.js
+++ b/lib/api/apex.js
@@ -137,7 +137,6 @@ Apex.prototype.patch = function(path, body, options, callback) {
* @method Apex#del
*
* @param {String} path - URL path to Apex REST service
- * @param {Object} [body] - Request body
* @param {Callback.<Object>} [callback] - Callback function
* @returns {Promise.<Object>}
*/
@@ -147,7 +146,6 @@ Apex.prototype.patch = function(path, body, options, callback) {
* @method Apex#delete
*
* @param {String} path - URL path to Apex REST service
- * @param {Object} [body] - Request body
* @param {Object} [options] - Holds headers and other meta data for the request.
* @param {Callback.<Object>} [callback] - Callback function
* @returns {Promise.<Object>} | Documentation fixes
Issue #<I> | jsforce_jsforce | train | js |
7c747bf99a91c8efd5ddbfc6a8215f92eeacefbb | diff --git a/Tests/ResourceWatcherTest.php b/Tests/ResourceWatcherTest.php
index <HASH>..<HASH> 100644
--- a/Tests/ResourceWatcherTest.php
+++ b/Tests/ResourceWatcherTest.php
@@ -219,6 +219,8 @@ class ResourceWatcherTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($event);
$this->assertSame($file, (string) $event->getResource());
$this->assertSame(FilesystemEvent::IN_MODIFY, $event->getType());
+
+ unlink($file);
}
protected function getResourceMock() | [ResourceWatcher] prevent temp folder flooding by test suite | flint_Lurker | train | php |
df45eff2ad1aefc7c3a9f2d2a69915a2e2e1cfb5 | diff --git a/pelix/shell/console.py b/pelix/shell/console.py
index <HASH>..<HASH> 100644
--- a/pelix/shell/console.py
+++ b/pelix/shell/console.py
@@ -298,7 +298,6 @@ class InteractiveShell(object):
self._shell_ref = None
self._shell = None
- self._readline_matches = None
def stop(self): | Avoid to have an error when updating the shell core bundle
The console was nullifying readline_matches but not re-creating it | tcalmant_ipopo | train | py |
01925e1b70fa0b88f4f675ae079630ebba09bf13 | diff --git a/src/Row.php b/src/Row.php
index <HASH>..<HASH> 100644
--- a/src/Row.php
+++ b/src/Row.php
@@ -30,7 +30,24 @@ class Row
public function format($how, $class_name = "stdClass", $ctor_args = [])
{
+ /**
+ * @todo:
+ * - Implement PDO::FETCH_CLASSTYPE flag on PDO::FETCH_CLASS
+ * - Implement PDO::FETCH_PROPS_LATE flag on PDO::FETCH_CLASS
+ * - Implement PDO::FETCH_ASSOC
+ * - Implement PDO::FETCH_BOTH
+ * - Implement PDO::FETCH_BOUND
+ * - Implement PDO::FETCH_INTO
+ * - Implement PDO::FETCH_LAZY
+ * - Implement PDO::FETCH_NAMED
+ * - Implement PDO::FETCH_NUM
+ * - Implement PDO::FETCH_OBJ
+ */
+
switch ($how) {
+ case PDO::FETCH_ASSOC:
+ $data = $this->formatAssoc();
+ break;
case PDO::FETCH_CLASS:
$data = $this->formatClass($class_name, $ctor_args);
break;
@@ -42,6 +59,12 @@ class Row
}
+ protected function formatAssoc()
+ {
+ return $this->data();
+ }
+
+
protected function formatClass($class_name, $ctor_args)
{
$r = new ReflectionClass($class_name); | Handle formatting a row with PDO::FETCH_ASSOC | stratedge_wye | train | php |
788817c48df5bd229791d1620002e59c638a7b4c | diff --git a/gooey/gui/util/filedrop.py b/gooey/gui/util/filedrop.py
index <HASH>..<HASH> 100644
--- a/gooey/gui/util/filedrop.py
+++ b/gooey/gui/util/filedrop.py
@@ -8,3 +8,4 @@ class FileDrop(wx.FileDropTarget):
def OnDropFiles(self, x, y, filenames):
for name in filenames:
self.window.WriteText(name)
+ return True | Ensure OnDropFiles function matches interface
Fixes the following error printed to the console after dropping a file onto a text box:
TypeError: invalid result from FileDrop.OnDropFiles(), a 'bool' is expected not 'NoneType' | chriskiehl_Gooey | train | py |
37aafb571c3e67fb522662665efbbe94a2ceaa90 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -73,11 +73,10 @@ app.resource('tags', tags);
app.get('/users/count', users.count);
app.resource('users', users);
-app.post('/setup/connection-test', setup.connectionTest);
+app.get('/setup/connection-test', setup.connectionTest);
app.post('/setup/table-creation', setup.tableCreation);
app.post('/setup/commit', setup.commit);
app.post('/setup/create-user', setup.createUser);
-app.resource('setup', setup);
app.resource('sessions', sessions);
app.resource('feed', feed);
diff --git a/lib/resources/setup.js b/lib/resources/setup.js
index <HASH>..<HASH> 100644
--- a/lib/resources/setup.js
+++ b/lib/resources/setup.js
@@ -24,9 +24,7 @@ function show(req, res) {
exports.show = util.loginRequired(show);
function connectionTest(req, res, next) {
- var body = req.body;
-
- db.connect(body.uri, function(err) {
+ db.connect(req.query.uri, function(err) {
if(err) return next(err);
res.json(200, {ok: true});
}); | Use get for /setup/connection-test | shinuza_captain-core | train | js,js |
01760ff324bfe4218c34d648c53af46d782f14c1 | diff --git a/core/server/src/main/java/alluxio/RpcUtils.java b/core/server/src/main/java/alluxio/RpcUtils.java
index <HASH>..<HASH> 100644
--- a/core/server/src/main/java/alluxio/RpcUtils.java
+++ b/core/server/src/main/java/alluxio/RpcUtils.java
@@ -64,7 +64,7 @@ public final class RpcUtils {
LOG.debug("Internal Alluxio error when running rpc", e);
throw e.toThrift();
} catch (IOException e) {
- LOG.error("I/O error when running rpc", e);
+ LOG.warn("I/O error when running rpc", e);
throw new ThriftIOException(e.getMessage());
} catch (Exception e) {
LOG.error("Unexpected error running rpc", e); | Change error to warn to more accurately reflect severity. | Alluxio_alluxio | train | java |
d88df42c58219b44c88c2cc272880f5b31874d62 | diff --git a/src/Mouf/Utils/Graphics/MoufImagine/Controller/ImagePresetController.php b/src/Mouf/Utils/Graphics/MoufImagine/Controller/ImagePresetController.php
index <HASH>..<HASH> 100644
--- a/src/Mouf/Utils/Graphics/MoufImagine/Controller/ImagePresetController.php
+++ b/src/Mouf/Utils/Graphics/MoufImagine/Controller/ImagePresetController.php
@@ -191,7 +191,7 @@ class ImagePresetController extends Controller{
* Purge presets of an image
* @param string $path
*/
- public static function purgePresets($path = null) {
+ public static function purgePresets($path = null, $callback = null) {
$moufManager = MoufManager::getMoufManager();
$instances = $moufManager->findInstances('Mouf\\Utils\\Graphics\\MoufImagine\\Controller\\ImagePresetController');
foreach ($instances as $instanceName) {
@@ -199,6 +199,11 @@ class ImagePresetController extends Controller{
if ($path && strpos($path, $instance->originalPath) !== false) {
$imagePath = substr($path, strlen($instance->originalPath) + 1);
$instance->deletePreset($imagePath);
+
+ if(is_callable($callback)) {
+ $finalPath = ROOT_PATH . $instance->url . DIRECTORY_SEPARATOR . $imagePath;
+ $callback($finalPath);
+ }
}
}
} | Add a callback function call after the image deletion when purging all presets | thecodingmachine_utils.graphics.mouf-imagine | train | php |
99e17ad2118a0841a376a97162758d8a47b38ab1 | diff --git a/src/Services/ZipCode.php b/src/Services/ZipCode.php
index <HASH>..<HASH> 100644
--- a/src/Services/ZipCode.php
+++ b/src/Services/ZipCode.php
@@ -188,6 +188,27 @@ class ZipCode implements ZipCodeInterface
}
/**
+ * Retorna complemento de um endereço.
+ *
+ * @param array $address
+ * @return array
+ */
+ protected function getComplement(array $address)
+ {
+ $complement = [];
+
+ if (array_key_exists('complemento', $address)) {
+ $complement[] = $address['complemento'];
+ }
+
+ if (array_key_exists('complemento2', $address)) {
+ $complement[] = $address['complemento2'];
+ }
+
+ return $complement;
+ }
+
+ /**
* Recupera endereço do XML de resposta.
*
* @return array
@@ -196,9 +217,7 @@ class ZipCode implements ZipCodeInterface
{
$address = $this->parsedXML['consultaCEPResponse']['return'];
$zipcode = preg_replace('/^([0-9]{5})([0-9]{3})$/', '${1}-${2}', $address['cep']);
- $complement = array_values(array_filter([
- $address['complemento'], $address['complemento2']
- ]));
+ $complement = $this->getComplement($address);
return [
'zipcode' => $zipcode, | zipcode-service: fix error when "complemento" is undefined | flyingluscas_correios-php | train | php |
c6931e9ade3828ad2096959f5c273057e0e47a5c | diff --git a/src/components/site-logo.js b/src/components/site-logo.js
index <HASH>..<HASH> 100644
--- a/src/components/site-logo.js
+++ b/src/components/site-logo.js
@@ -4,7 +4,7 @@ const SiteLogo = () => (
/* eslint-disable max-len */
<svg
- class="sprk-c-Masthead__logo"
+ className="sprk-c-Masthead__logo"
xmlns="http://www.w3.org/2000/svg"
width="365.4"
height="101.35" | update class to className to resolve error | sparkdesignsystem_spark-design-system | train | js |
05d6e9e5c2c7455f32f958e5a587a10cebb5a50c | diff --git a/loginlink.go b/loginlink.go
index <HASH>..<HASH> 100644
--- a/loginlink.go
+++ b/loginlink.go
@@ -3,6 +3,7 @@ package stripe
// LoginLinkParams is the set of parameters that can be used when creating a login_link.
// For more details see https://stripe.com/docs/api#create_login_link.
type LoginLinkParams struct {
+ Params `form:"*"`
Account *string `form:"-"` // Included in URL
}
diff --git a/loginlink/client.go b/loginlink/client.go
index <HASH>..<HASH> 100644
--- a/loginlink/client.go
+++ b/loginlink/client.go
@@ -27,7 +27,7 @@ func (c Client) New(params *stripe.LoginLinkParams) (*stripe.LoginLink, error) {
path := stripe.FormatURLPath("/accounts/%s/login_links", stripe.StringValue(params.Account))
loginLink := &stripe.LoginLink{}
- err := c.B.Call(http.MethodPost, path, c.Key, nil, loginLink)
+ err := c.B.Call(http.MethodPost, path, c.Key, params, loginLink)
return loginLink, err
} | Properly use params on loginlink creation and add `Params` to it. | stripe_stripe-go | train | go,go |
28a6b18f180148a516df0a3cbc7956e2ba13d3c4 | diff --git a/lib/deployer.js b/lib/deployer.js
index <HASH>..<HASH> 100644
--- a/lib/deployer.js
+++ b/lib/deployer.js
@@ -234,8 +234,9 @@ async function _content(Section) {
*/
async function _compileAssets(wwwDir, tmpDir) {
const config = webPackConfig('production', tmpDir, wwwDir, tmpDir);
- const compiler = Webpack(config);
+ if (Utils.isEmpty(config.entry)) return;
+ const compiler = Webpack(config);
await new Promise((_resolve, _reject) => {
compiler.run((err) => {
if (err) { _reject(err); } | Fixed deployer bug where no pack files threw an error | vapid_vapid | train | js |
e7239c0fe5110171e48ad3f168b683a0fed0e1df | diff --git a/android/src/main/java/com/lazaronixon/rnturbolinks/RNTurbolinksModule.java b/android/src/main/java/com/lazaronixon/rnturbolinks/RNTurbolinksModule.java
index <HASH>..<HASH> 100644
--- a/android/src/main/java/com/lazaronixon/rnturbolinks/RNTurbolinksModule.java
+++ b/android/src/main/java/com/lazaronixon/rnturbolinks/RNTurbolinksModule.java
@@ -82,8 +82,11 @@ public class RNTurbolinksModule extends ReactContextBaseJavaModule {
}
@ReactMethod
- public void removeAllCookies(final Promise promise) {
- new ForwardingCookieHandler(getReactApplicationContext()).clearCookies(null);
+ public void removeAllCookies() {
+ new ForwardingCookieHandler(getReactApplicationContext()).clearCookies(new Callback() {
+ public void invoke(Object... args) {
+ }
+ });
}
@ReactMethod | fix refactor on removeAllCookies | lazaronixon_react-native-turbolinks | train | java |
fd6694614614976e1be32ce7eb9fd7453490b747 | diff --git a/src/Port.php b/src/Port.php
index <HASH>..<HASH> 100644
--- a/src/Port.php
+++ b/src/Port.php
@@ -28,8 +28,7 @@ class Port extends AbstractComponent implements Component
*/
protected function validate($data)
{
- $data = filter_var($data, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
- if (! $data) {
+ if (! ctype_digit($data) || $data < 1) {
throw new InvalidArgumentException('The submitted port is invalid');
} | Use ctype_digit to validate port | thephpleague_uri-components | train | php |
62cb7c111db0c1147c5de062acb346f8eb4321c6 | diff --git a/app/view/js/src/obj-datetime.js b/app/view/js/src/obj-datetime.js
index <HASH>..<HASH> 100644
--- a/app/view/js/src/obj-datetime.js
+++ b/app/view/js/src/obj-datetime.js
@@ -47,7 +47,7 @@ bolt.datetimes = function () {
}
// If data is a valid datetime
- match = field.data.val().match(/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:00)$/);
+ match = field.data.val().match(/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})$/);
if (match) {
date = match[1];
time = match[2]; | Allow and ignore seconds in while scanning times | bolt_bolt | train | js |
12ae4e433ef8c5d77c33c355494fe7d45aa580fb | diff --git a/src/Error/ErrorHandlerTrait.php b/src/Error/ErrorHandlerTrait.php
index <HASH>..<HASH> 100644
--- a/src/Error/ErrorHandlerTrait.php
+++ b/src/Error/ErrorHandlerTrait.php
@@ -64,6 +64,15 @@ trait ErrorHandlerTrait {
];
/**
+ * By design, these exceptions are also 404 with a valid internal referer.
+ *
+ * @var array
+ */
+ protected static $evenWithReferer = [
+ AuthSecurityException::class,
+ ];
+
+ /**
* @param \Exception $exception
* @param \Psr\Http\Message\ServerRequestInterface|null $request
* @return bool
@@ -82,7 +91,7 @@ trait ErrorHandlerTrait {
return false;
}
- if (!$request) {
+ if (!$request || $this->isBlacklistedEvenWithReferer($class)) {
return true;
}
$referer = $request->getHeaderLine('Referer');
@@ -115,4 +124,14 @@ trait ErrorHandlerTrait {
return false;
}
+ /**
+ * Is a 404 even with referer present.
+ *
+ * @param string $class
+ * @return bool
+ */
+ protected function isBlacklistedEvenWithReferer($class) {
+ return $this->isBlacklisted($class, static::$evenWithReferer);
+ }
+
} | Fix <I> blacklist for internal referer. | dereuromark_cakephp-tools | train | php |
419c1605d50fa716dc51947da73262f1eb981685 | diff --git a/app/models/esr_record.rb b/app/models/esr_record.rb
index <HASH>..<HASH> 100644
--- a/app/models/esr_record.rb
+++ b/app/models/esr_record.rb
@@ -209,6 +209,10 @@ class EsrRecord < ActiveRecord::Base
end
public
+ def create_write_off_booking
+ invoice.write_off("Korrektur nach VESR Zahlung").save
+ end
+
def create_extra_earning_booking(comments = nil)
if invoice
invoice.book_extra_earning("Korrektur nach VESR Zahlung").save | New (unused?) method EsrRecord#create_write_off_booking. | raskhadafi_vesr | train | rb |
a07f4b100c3b9d739a3d214a1adf8c8d73490c66 | diff --git a/lib/openapi/mongoid/spec_builder.rb b/lib/openapi/mongoid/spec_builder.rb
index <HASH>..<HASH> 100644
--- a/lib/openapi/mongoid/spec_builder.rb
+++ b/lib/openapi/mongoid/spec_builder.rb
@@ -305,6 +305,14 @@ module Openapi
key :'$ref', name
end
end
+
+ response 422 do
+ key :description, 'UnprocessableEntityError'
+ schema do
+ key :'$ref', name
+ end
+ end
+
end
end
end
@@ -409,6 +417,14 @@ module Openapi
key :'$ref', name
end
end
+
+ response 422 do
+ key :description, 'UnprocessableEntityError'
+ schema do
+ key :'$ref', name
+ end
+ end
+
end
end
diff --git a/lib/openapi/version.rb b/lib/openapi/version.rb
index <HASH>..<HASH> 100644
--- a/lib/openapi/version.rb
+++ b/lib/openapi/version.rb
@@ -1,3 +1,3 @@
module Openapi
- VERSION = '0.3.9'.freeze
+ VERSION = '0.4.0'.freeze
end | Add <I> response to create and update methods crud specification | slate-studio_openapi-rails | train | rb,rb |
175a62c80e7d5e4a12ed2cf464e3db07e6469d5f | diff --git a/app/controllers/releaf/base_application_controller.rb b/app/controllers/releaf/base_application_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/releaf/base_application_controller.rb
+++ b/app/controllers/releaf/base_application_controller.rb
@@ -11,10 +11,6 @@ module Releaf
helper_method :controller_scope_name
- def full_controller_name
- self.class.name.sub(/Controller$/, '').underscore
- end
-
def controller_scope_name
'admin.' + self.class.name.sub(/Controller$/, '').underscore.gsub('/', '_')
end
@@ -26,7 +22,7 @@ module Releaf
end
def access_denied
- @controller_name = full_controller_name
+ @controller_name = self.class.name.sub(/Controller$/, '').underscore
respond_to do |format|
format.html { render 'releaf/error_pages/access_denied', :status => 403 }
format.any { render :text => '', :status =>403 } | Remove "full_controller_name" method as it only used once | cubesystems_releaf | train | rb |
343e7b7a1e162e6ca8060e16d9716d5cdbf316d8 | diff --git a/lib/autotune/index.js b/lib/autotune/index.js
index <HASH>..<HASH> 100644
--- a/lib/autotune/index.js
+++ b/lib/autotune/index.js
@@ -205,6 +205,8 @@ function generate (inputs) {
mealCarbs = Math.max(mealCarbs, parseInt(csf_glucose[i].mealCarbs));
}
}
+ // at midnight, write down the mealcarbs as total meal carbs (to prevent special case of when only one meal and it not finishing absorbing by midnight)
+ // TODO: figure out what to do with dinner carbs that don't finish absorbing by midnight
if (totalMealCarbs == 0) { totalMealCarbs += mealCarbs; }
if (totalDeviations == 0) { totalDeviations += deviations; }
//console.error(totalDeviations, totalMealCarbs); | Adding to-do about dinner carbs not absorbed at midnight | openaps_oref0 | train | js |
f25055c9f774e20bb1cbc89023b58cd3f5cd40bf | diff --git a/server/index.js b/server/index.js
index <HASH>..<HASH> 100644
--- a/server/index.js
+++ b/server/index.js
@@ -12,7 +12,6 @@ import {
renderScriptError
} from './render'
import Router from './router'
-import HotReloader from './hot-reloader'
import { resolveFromList } from './resolve'
import { getAvailableChunks } from './utils'
import getConfig from './config'
@@ -35,7 +34,7 @@ export default class Server {
this.dev = dev
this.quiet = quiet
this.router = new Router()
- this.hotReloader = dev ? new HotReloader(this.dir, { quiet, conf }) : null
+ this.hotReloader = dev ? this.getHotReloader(this.dir, { quiet, conf }) : null
this.http = null
this.config = getConfig(this.dir, conf)
this.dist = this.config.distDir
@@ -59,6 +58,11 @@ export default class Server {
this.defineRoutes()
}
+ getHotReloader (dir, options) {
+ const HotReloader = require('./hot-reloader').default
+ return new HotReloader(dir, options)
+ }
+
handleRequest (req, res, parsedUrl) {
// Parse url if parsedUrl not provided
if (!parsedUrl || typeof parsedUrl !== 'object') { | Load the hot-reloader when only needed. (#<I>)
This reduce the server boot-up time a lot.
With a <I> MacBook Pro, it went down from <I>ms to <I>ms | zeit_next.js | train | js |
a1da2670191e67effafcb8524c81523e05bcdba3 | diff --git a/.eslintrc.js b/.eslintrc.js
index <HASH>..<HASH> 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -205,12 +205,7 @@ module.exports = {
],
"prefer-arrow-callback": 1,
"prefer-const": 1,
- "prefer-destructuring": [1, {
- array: false,
- object: true
- }, {
- enforceForRenamedProperties: false
- }],
+ "prefer-destructuring": 0,
"prefer-numeric-literals": 1,
"prefer-promise-reject-errors": 1,
"prefer-rest-params": 0, | change eslint rule | darwin-education_resium | train | js |
cb74f9be12eddffdcad19c7afdeaa1dea85e8bcb | diff --git a/sniffy-core/src/test/java/io/sniffy/registry/ConnectionsRegistryTest.java b/sniffy-core/src/test/java/io/sniffy/registry/ConnectionsRegistryTest.java
index <HASH>..<HASH> 100644
--- a/sniffy-core/src/test/java/io/sniffy/registry/ConnectionsRegistryTest.java
+++ b/sniffy-core/src/test/java/io/sniffy/registry/ConnectionsRegistryTest.java
@@ -94,8 +94,8 @@ public class ConnectionsRegistryTest extends BaseSocketTest {
@Test
public void testWriteToWriter() throws Exception {
- ConnectionsRegistry.INSTANCE.setDataSourceStatus("dataSource","userName", ConnectionsRegistry.ConnectionStatus.OPEN);
- ConnectionsRegistry.INSTANCE.setSocketAddressStatus("localhost", 6666, ConnectionsRegistry.ConnectionStatus.CLOSED);
+ ConnectionsRegistry.INSTANCE.setDataSourceStatus("dataSource","userName", OPEN);
+ ConnectionsRegistry.INSTANCE.setSocketAddressStatus("localhost", 6666, CLOSED);
StringWriter sw = new StringWriter();
ConnectionsRegistry.INSTANCE.writeTo(sw); | Unnecessary use of fully qualified name 'ConnectionsRegistry.ConnectionStatus.OPEN' due to existing static import 'io.sniffy.registry.ConnectionsRegistry.ConnectionStatus.OPEN'
Unnecessary use of fully qualified name 'ConnectionsRegistry.ConnectionStatus.CLOSED' due to existing static import 'io.sniffy.registry.ConnectionsRegistry.ConnectionStatus.CLOSED' | sniffy_sniffy | train | java |
f5fcc872541087092a106ee20499f024d6678f9a | diff --git a/src/org/jgroups/blocks/MethodCall.java b/src/org/jgroups/blocks/MethodCall.java
index <HASH>..<HASH> 100644
--- a/src/org/jgroups/blocks/MethodCall.java
+++ b/src/org/jgroups/blocks/MethodCall.java
@@ -18,7 +18,7 @@ import java.util.*;
* It includes the name of the method (case sensitive) and a list of arguments.
* A method call is serializable and can be passed over the wire.
* @author Bela Ban
- * @version $Revision: 1.25 $
+ * @version $Revision: 1.26 $
*/
public class MethodCall implements Externalizable {
@@ -352,11 +352,6 @@ public class MethodCall implements Externalizable {
log.error(sb.toString());
throw no;
}
- catch(Throwable e) {
- // e.printStackTrace(System.err);
- if(log.isErrorEnabled()) log.error("exception in invoke()", e);
- throw e;
- }
}
public Object invoke(Object target, Object[] args) throws Throwable { | removed log of exception - we're rethrowing it anyway | belaban_JGroups | train | java |
0babfeffefd70e3df1ef1fd2f12049d0f4976ee7 | diff --git a/src/services/print.js b/src/services/print.js
index <HASH>..<HASH> 100644
--- a/src/services/print.js
+++ b/src/services/print.js
@@ -281,8 +281,13 @@ ngeo.Print.prototype.encodeImageWmsLayer_ = function(arr, layer) {
*/
ngeo.Print.prototype.encodeWmsLayer_ = function(arr, opacity, url, params) {
const customParams = {'TRANSPARENT': true};
- ol.obj.assign(customParams, params);
-
+ // remove empty params
+ for (const key in params) {
+ const val = params[key];
+ if (val !== null && val !== undefined) {
+ customParams[key] = val;
+ }
+ }
delete customParams['LAYERS'];
delete customParams['FORMAT'];
delete customParams['SERVERTYPE']; | Don't send empty WMS param to the print | camptocamp_ngeo | train | js |
fa7507079c2ad784fb166239ae7b63ef716ac385 | diff --git a/lib/Account.php b/lib/Account.php
index <HASH>..<HASH> 100644
--- a/lib/Account.php
+++ b/lib/Account.php
@@ -247,7 +247,7 @@ class Account extends ApiResource
/**
* @param string|null $id The ID of the account to which the person belongs.
- * @param array|null $personId The ID of the person to retrieve.
+ * @param string|null $personId The ID of the person to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
@@ -260,7 +260,7 @@ class Account extends ApiResource
/**
* @param string|null $id The ID of the account to which the person belongs.
- * @param array|null $personId The ID of the person to update.
+ * @param string|null $personId The ID of the person to update.
* @param array|null $params
* @param array|string|null $opts
*
@@ -273,7 +273,7 @@ class Account extends ApiResource
/**
* @param string|null $id The ID of the account to which the person belongs.
- * @param array|null $personId The ID of the person to delete.
+ * @param string|null $personId The ID of the person to delete.
* @param array|null $params
* @param array|string|null $opts
* | Corrects type of $personId in PHPDoc comment. | stripe_stripe-php | train | php |
61a4d63620a8e5f7c5e28abffa25613bc8a1b041 | diff --git a/bdata/__init__.py b/bdata/__init__.py
index <HASH>..<HASH> 100644
--- a/bdata/__init__.py
+++ b/bdata/__init__.py
@@ -1,11 +1,11 @@
from bdata.bdata import bdata,life
-from bdata.mdata import mdata,mdict,mhist,mscaler,mvar,mcontainer,mlist
+from bdata.mdata import mdata,mdict,mhist,mscaler,mvar,mcontainer,mlist,mcomment
from bdata.bjoined import bjoined
from bdata import mudpy
import os
__all__ = ['bdata','mudpy','bjoined','mdata']
-__version__ = '5.0.0'
+__version__ = '5.0.1'
__author__ = 'Derek Fujimoto'
-_mud_data = os.path.join(os.environ['HOME'],'.bdata')
+_mud_data = os.path.join(os.environ['HOME'],'.mdata') | Added mcomment. Changed default data dir to .mdata | dfujim_bdata | train | py |
d42ac98339ded93a366deb15d9e7f10150c419e9 | diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js
index <HASH>..<HASH> 100644
--- a/src/structures/GuildChannel.js
+++ b/src/structures/GuildChannel.js
@@ -144,8 +144,8 @@ class GuildChannel extends Channel {
const prevOverwrite = this.permissionOverwrites.get(userOrRole.id);
if (prevOverwrite) {
- payload.allow = prevOverwrite.allow;
- payload.deny = prevOverwrite.deny;
+ payload.allow = prevOverwrite.allowData;
+ payload.deny = prevOverwrite.denyData;
}
for (const perm in options) { | Fix #<I> (permission overwrites not taking into account previous values) | discordjs_discord.js | train | js |
d9d57d4fc56bb758be2a50852adc49e0f0b97509 | diff --git a/django_fsm_log/admin.py b/django_fsm_log/admin.py
index <HASH>..<HASH> 100644
--- a/django_fsm_log/admin.py
+++ b/django_fsm_log/admin.py
@@ -11,7 +11,7 @@ class StateLogInline(GenericTabularInline):
model = StateLog
can_delete = False
- def has_add_permission(self, request):
+ def has_add_permission(self, request, obj=None):
return False
def has_change_permission(self, request, obj=None): | admin: StateLogInline: has_add_permission: dj<I> compatibility (#<I>) | gizmag_django-fsm-log | train | py |
0d29f59e4edb891cdb73071b8df0b17b4e67ffb8 | diff --git a/packages/cerebral-forms/src/chains/changeField.js b/packages/cerebral-forms/src/chains/changeField.js
index <HASH>..<HASH> 100644
--- a/packages/cerebral-forms/src/chains/changeField.js
+++ b/packages/cerebral-forms/src/chains/changeField.js
@@ -1,8 +1,7 @@
+import {set, state, input} from 'cerebral/operators'
import validateField from '../factories/validateField'
export default [
- function updateValue ({input, state}) {
- state.set(`${input.field}.value`, input.value)
- },
+ set(state`${input`field`}.value`, input`value`),
validateField()
] | refactor(forms): switch to tagged template based operators | cerebral_cerebral | train | js |
038f8543a0b60875f3e85c2bd1b8847747299f2c | diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveClient.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveClient.java
index <HASH>..<HASH> 100644
--- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveClient.java
+++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveClient.java
@@ -1059,7 +1059,7 @@ public class HiveClient
return partitions;
}
- catch (NoSuchObjectException | NullPointerException | IllegalStateException | IllegalArgumentException e) {
+ catch (PrestoException | NoSuchObjectException | NullPointerException | IllegalStateException | IllegalArgumentException e) {
throw Throwables.propagate(e);
}
catch (MetaException | RuntimeException e) { | Fix retry handling for offline partitions | prestodb_presto | train | java |
d971fbb4dc3b69e012b212cd54b6e8511571e1f5 | diff --git a/graphene/core/classtypes/uniontype.py b/graphene/core/classtypes/uniontype.py
index <HASH>..<HASH> 100644
--- a/graphene/core/classtypes/uniontype.py
+++ b/graphene/core/classtypes/uniontype.py
@@ -1,3 +1,5 @@
+from functools import partial
+
import six
from graphql.core.type import GraphQLUnionType
@@ -35,6 +37,6 @@ class UnionType(six.with_metaclass(UnionTypeMeta, FieldsClassType)):
return GraphQLUnionType(
cls._meta.type_name,
types=list(map(schema.T, cls._meta.types)),
- resolve_type=lambda instance, info: cls._resolve_type(schema, instance, info),
+ resolve_type=partial(cls._resolve_type, schema),
description=cls._meta.description,
) | Update to use partial instead of lambda function | graphql-python_graphene | train | py |
45a1976e5cba5c47d7b6a9d8ddbc929192a65fd0 | diff --git a/master/buildbot/changes/pb.py b/master/buildbot/changes/pb.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/changes/pb.py
+++ b/master/buildbot/changes/pb.py
@@ -43,10 +43,9 @@ class ChangePerspective(NewCredPerspective):
files.append(path)
changedict['files'] = files
- if files:
- return self.master.addChange(**changedict)
- else:
- return defer.succeed(None)
+ if not files:
+ log.msg("No files listed in change... bit strange, but not fatal.")
+ return self.master.addChange(**changedict)
class PBChangeSource(base.ChangeSource):
compare_attrs = ["user", "passwd", "port", "prefix", "port"] | "Fix" PBChangeSource to ignore file list.
Old behavior was to (silently!) ignore changes which had no files
associated with it. Such changes appear to work fine in basic
configurations, at least.
This resolves #<I>. | buildbot_buildbot | train | py |
316032316b45d27f5767bd43c8e92e70d570fc46 | diff --git a/src/feat/web/http.py b/src/feat/web/http.py
index <HASH>..<HASH> 100644
--- a/src/feat/web/http.py
+++ b/src/feat/web/http.py
@@ -861,6 +861,8 @@ def compose_headers(headers, buffer=None):
for name, value in headers.iteritems():
capname = '-'.join([p.capitalize() for p in name.split('-')])
if is_header_multifield(name):
+ if isinstance(value, str):
+ value = [value]
buffer.append("%s: %s" % (capname, ", ".join(value)))
else:
buffer.append("%s: %s" % (capname, value)) | Don't force developers to remember which http fields can take multiple values. | f3at_feat | train | py |
4131a026135b6051c3a017507cada9496a35dbec | diff --git a/hendrix/contrib/resources/static.py b/hendrix/contrib/resources/static.py
index <HASH>..<HASH> 100644
--- a/hendrix/contrib/resources/static.py
+++ b/hendrix/contrib/resources/static.py
@@ -1,8 +1,41 @@
import os
from hendrix.resources import DjangoStaticResource
from django.conf import settings
+from django.contrib.staticfiles import finders
+
+class DjangoStaticsFinder:
+ """
+ finds all static resources for this django installation
+ and creates a static resource for each's base directory
+ """
+
+ namespace = settings.STATIC_URL
+
+ @staticmethod
+ def get_resources():
+
+ ignore_patterns = [
+ '*.less',
+ '*.scss',
+ '*.styl',
+ ]
+
+ existing = []
+ for finder in finders.get_finders():
+ for _, storage in finder.list([]):
+ if not storage.base_location in existing:
+ yield DjangoStaticResource(
+ storage.location,
+ settings.STATIC_URL + '%s/' % storage.base_location
+ )
+
+"""
+The rest is for compatibility with existing code based on the deprecated
+classes below.
+
+"""
try:
DefaultDjangoStaticResource = DjangoStaticResource(
settings.STATIC_ROOT, settings.STATIC_URL
@@ -21,3 +54,4 @@ try:
)
except:
raise
+ | adds DjangoStaticsFinder which creates a DjangoStaticResource for each statics directory found by django's get_finders method | hendrix_hendrix | train | py |
837f8325264eab777161f30712001a59403e03ee | diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php
index <HASH>..<HASH> 100644
--- a/mod/quiz/lang/en/quiz.php
+++ b/mod/quiz/lang/en/quiz.php
@@ -537,7 +537,7 @@ $string['numerical'] = 'Numerical';
$string['numquestionsx'] = 'Questions: {$a}';
$string['onlyteachersexport'] = 'Only teachers can export questions';
$string['onlyteachersimport'] = 'Only teachers with editing rights can import questions';
-$string['open'] = 'Started';
+$string['open'] = 'Not answered';
$string['openclosedatesupdated'] = 'Quiz open and close dates updated';
$string['optional'] = 'optional';
$string['orderandpaging'] = 'Order and paging'; | quiz summary. Change 'Started' to 'Not answered'. | moodle_moodle | train | php |
3d41d156e8431c17aacf03aa3cb8c1a167165c62 | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -163,6 +163,10 @@ func (c *client) Connect() Token {
t := newToken(packets.Connect).(*ConnectToken)
DEBUG.Println(CLI, "Connect()")
+ c.obound = make(chan *PacketAndToken, c.options.MessageChannelDepth)
+ c.oboundP = make(chan *PacketAndToken, c.options.MessageChannelDepth)
+ c.ibound = make(chan packets.ControlPacket)
+
go func() {
c.persist.Open()
@@ -232,9 +236,6 @@ func (c *client) Connect() Token {
c.options.protocolVersionExplicit = true
- c.obound = make(chan *PacketAndToken, c.options.MessageChannelDepth)
- c.oboundP = make(chan *PacketAndToken, c.options.MessageChannelDepth)
- c.ibound = make(chan packets.ControlPacket)
c.errors = make(chan error, 1)
c.stop = make(chan struct{}) | Create the message channels before attempting connect
As Connect() is non blocking and returns a token it was possible for the token.Wait() to return and the calling code to attempt to send a message prior to the message channels being created. Moved this channel creation to outside the go routine that handles connecting to ensure this doesn't happen
resolves #<I> | eclipse_paho.mqtt.golang | train | go |
e59f3dfce5dff0d39ba60c741a3619a779c9f96d | diff --git a/drizzlepac/runastrodriz.py b/drizzlepac/runastrodriz.py
index <HASH>..<HASH> 100755
--- a/drizzlepac/runastrodriz.py
+++ b/drizzlepac/runastrodriz.py
@@ -541,13 +541,14 @@ def process(inFile, force=False, newpath=None, num_cores=None, inmemory=True,
ftrl.write(hlet_msg)
ftrl.close()
+ # Remove secondary log files for good...
+ logging.shutdown()
+
if not debug:
# Remove all temp sub-directories now that we are done
for sd in sub_dirs:
if os.path.exists(sd): rmtree2(sd)
- # Remove secondary log files for good...
- logging.shutdown()
for _olog in [_alignlog]:
if os.path.exists(_olog):
os.remove(_olog)
@@ -1014,7 +1015,6 @@ def rmtree2(path, n=3):
break
except OSError as err:
print("Failed to remove path %s with shutil.rmtree at attempt %d: %s" % (path, n, err))
- raise OSError
time.sleep(3)
if not ok: | More tweaks to try to remove directories (#<I>) | spacetelescope_drizzlepac | train | py |
3078f1f196601da7b40e074123a343c9bc81c5d0 | diff --git a/core/src/main/java/org/ocpsoft/prettytime/i18n/Resources_sq.java b/core/src/main/java/org/ocpsoft/prettytime/i18n/Resources_sq.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/ocpsoft/prettytime/i18n/Resources_sq.java
+++ b/core/src/main/java/org/ocpsoft/prettytime/i18n/Resources_sq.java
@@ -17,7 +17,7 @@ package org.ocpsoft.prettytime.i18n;
import java.util.ListResourceBundle;
-public class Resources_en extends ListResourceBundle
+public class Resources_sq extends ListResourceBundle
{
private static final Object[][] OBJECTS = new Object[][] {
{ "CenturyPattern", "%n %u" }, | Fix resources_sq class naming | ocpsoft_prettytime | train | java |
aaa82f0ea4e9cb4453657c46d008cd8305c3f81b | diff --git a/lib/WebSocketConnection.js b/lib/WebSocketConnection.js
index <HASH>..<HASH> 100644
--- a/lib/WebSocketConnection.js
+++ b/lib/WebSocketConnection.js
@@ -802,7 +802,7 @@ WebSocketConnection.prototype.writeToSocket = function(buffer, cb) {
if (this.listeners('error').length > 0) {
var self = this;
process.nextTick(function() {
- self.emit("error", "Error while writing to socket: " + e.toString());
+ self.emit("error", new Error("Error while writing to socket: " + e.toString()));
});
return false;
} | Consistently using Error objects instead of passing strings for the error event. | theturtle32_WebSocket-Node | train | js |
1cc84163c69b8c711431d62a4de9e1fc8c56feb0 | diff --git a/bika/lims/content/analysis.py b/bika/lims/content/analysis.py
index <HASH>..<HASH> 100644
--- a/bika/lims/content/analysis.py
+++ b/bika/lims/content/analysis.py
@@ -379,8 +379,9 @@ class Analysis(BaseContent):
service_uid = self.getRawService()
catalog = getToolByName(self, "uid_catalog")
brain = catalog(UID=service_uid)
- if brain:
- return brain[0].getObject().getDepartment().UID()
+ if brain and len(brain) == 1:
+ dep = brain[0].getObject().getDepartment()
+ return dep.UID() if dep else ''
return ''
# TODO-performance: improve this function using another catalog and takeing | Analyses w/o department assigned fire error on cleaning/rebuilding bika_analysis_catalog | senaite_senaite.core | train | py |
9c83b10cd4092c36911e8f4246639f94a7320e9e | diff --git a/packages/blueprint/lib/Messaging.js b/packages/blueprint/lib/Messaging.js
index <HASH>..<HASH> 100644
--- a/packages/blueprint/lib/Messaging.js
+++ b/packages/blueprint/lib/Messaging.js
@@ -164,7 +164,10 @@ Messaging.prototype.relay = function (ev) {
var self = this;
return function () {
- self.emit (ev, arguments);
+ var args = Array.from (arguments);
+ args.unshift (ev);
+
+ self.emit.apply (self, args);
};
}; | Messaging.relay() did not handle arguments correctly | onehilltech_blueprint | train | js |
592463daf7b7d5328dd01ad0c8c47cca7c8f5857 | diff --git a/src/JsonEditorWidget.php b/src/JsonEditorWidget.php
index <HASH>..<HASH> 100644
--- a/src/JsonEditorWidget.php
+++ b/src/JsonEditorWidget.php
@@ -132,9 +132,9 @@ var {$widgetId} = new JSONEditor(document.getElementById('{$containerId}'), {$cl
} catch (e) {
console.warn('Could not parse initial value for {$widgetId}, error: '+e);
}
-});
-{$widgetId}.on('change', function() {
- document.getElementById('{$inputId}').value = JSON.stringify({$widgetId}.getValue());
+ {$widgetId}.on('change', function() {
+ document.getElementById('{$inputId}').value = JSON.stringify({$widgetId}.getValue());
+ });
});
JS
, $view::POS_READY); | Also setup on Change listener after widget is ready. | beowulfenator_yii2-json-editor | train | php |
71591707dfcf47c8dc88ac09a8f29630aa611c4f | diff --git a/src/TemporaryDirectory.php b/src/TemporaryDirectory.php
index <HASH>..<HASH> 100644
--- a/src/TemporaryDirectory.php
+++ b/src/TemporaryDirectory.php
@@ -30,12 +30,12 @@ class TemporaryDirectory
}
}
- public static function create($path)
+ public static function create(string $path): TemporaryDirectory
{
return new TemporaryDirectory($path, false);
}
- public static function forceCreate($path)
+ public static function forceCreate(string $path): TemporaryDirectory
{
return new TemporaryDirectory($path, true);
} | Added type hinting to static create methods | spatie_temporary-directory | train | php |
db56c9d01a66e26087ae2e14d7a739ccffaa81f0 | diff --git a/static/lib/composer.js b/static/lib/composer.js
index <HASH>..<HASH> 100644
--- a/static/lib/composer.js
+++ b/static/lib/composer.js
@@ -643,6 +643,7 @@ define('composer', [
// Restore composer on error
composer.load(post_uuid);
+ textareaEl.prop('readonly', false);
return app.alertError(err.message);
} | fix: composer textarea stays readonly even after error returned | NodeBB_nodebb-plugin-composer-default | train | js |
48a04a14b41367607d650f03f5d619e43fedc2f8 | diff --git a/lib/marginalia/comment.rb b/lib/marginalia/comment.rb
index <HASH>..<HASH> 100644
--- a/lib/marginalia/comment.rb
+++ b/lib/marginalia/comment.rb
@@ -108,7 +108,8 @@ module Marginalia
end
def self.line
- Marginalia::Comment.lines_to_ignore ||= /\.rvm|gem|vendor\/|marginalia|rbenv/
+ Marginalia::Comment.lines_to_ignore ||= /\.rvm|gem|vendor\/|marginalia|rbenv|monitor\.rb.*mon_synchronize/
+
last_line = caller.detect do |line|
line !~ Marginalia::Comment.lines_to_ignore
end | Ignore mon_synchronize by default, which comes up as caller in Rails 5+. Fixes #<I>. | basecamp_marginalia | train | rb |
096205ed61c395ee4c1e1368a5f790efe73e7d19 | diff --git a/mordred.py b/mordred.py
index <HASH>..<HASH> 100755
--- a/mordred.py
+++ b/mordred.py
@@ -513,7 +513,7 @@ class TaskPanels(Task):
}
""" % (es_index, alias)
- logger.debug(alias_url, action)
+ logger.debug("%s %s", alias_url, action)
r = requests.post(alias_url, data=action)
r.raise_for_status() | Fix logging issue in aliases creation | chaoss_grimoirelab-sirmordred | train | py |
8545ea0a2d8cd13153ab99047f78143af48181d8 | diff --git a/lib/slop/option.rb b/lib/slop/option.rb
index <HASH>..<HASH> 100644
--- a/lib/slop/option.rb
+++ b/lib/slop/option.rb
@@ -25,6 +25,7 @@ class Slop
@config = DEFAULT_OPTIONS.merge(config)
@count = 0
@callback = block_given? ? block : config[:callback]
+ @argument_value = nil
@config.each_key do |key|
self.class.send(:define_method, "#{key}?") { !!@config[key] }
@@ -48,11 +49,22 @@ class Slop
end
def value=(value)
- # ...
+ @argument_value = value
end
def value
- # ...
+ type = config[:as].to_s.downcase
+
+ case type
+ when 'string', 'str'
+ when 'symbol', 'sym'
+ when 'integer', 'int'
+ when 'float'
+ when 'array'
+ when 'range'
+ else
+
+ end
end
end | added basic case/when code to Option#value | leejarvis_slop | train | rb |
37b872f6954966d14ef0d0b5160904a60103d957 | diff --git a/eventsourcing/examples/aggregate7/application.py b/eventsourcing/examples/aggregate7/application.py
index <HASH>..<HASH> 100644
--- a/eventsourcing/examples/aggregate7/application.py
+++ b/eventsourcing/examples/aggregate7/application.py
@@ -16,7 +16,11 @@ from eventsourcing.persistence import Mapper, Transcoder
class DogSchool(Application):
- is_snapshotting_enabled = True
+ env = {
+ "AGGREGATE_CACHE_MAXSIZE": "50",
+ "DEEPCOPY_FROM_AGGREGATE_CACHE": "n",
+ "IS_SNAPSHOTTING_ENABLED": "y",
+ }
snapshot_class = Snapshot
def register_dog(self, name: str) -> UUID: | Changed immutable aggregate example to use caching with disabled deepcopy from cache. | johnbywater_eventsourcing | train | py |
a3d66deb7a42d083d8d05801f38e40154f8450f7 | diff --git a/lib/rackstash/flows.rb b/lib/rackstash/flows.rb
index <HASH>..<HASH> 100644
--- a/lib/rackstash/flows.rb
+++ b/lib/rackstash/flows.rb
@@ -229,6 +229,7 @@ module Rackstash
def initialize_copy(other)
@flows = other.flows.dup
+ @flows.freeze if other.frozen?
super
end
diff --git a/spec/rackstash/flows_spec.rb b/spec/rackstash/flows_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/rackstash/flows_spec.rb
+++ b/spec/rackstash/flows_spec.rb
@@ -155,6 +155,25 @@ RSpec.describe Rackstash::Flows do
end
end
+ describe '#clone' do
+ it 'clones the flows' do
+ flows << a_flow
+ copied = flows.clone
+
+ expect(copied).to be_instance_of described_class
+ expect(copied.length).to eql 1
+ expect(copied).to_not equal flows
+ end
+
+ it 'preserves the frozen? status' do
+ flows.freeze
+ expect(flows).to be_frozen
+
+ expect(flows.clone).to be_frozen
+ expect { flows.clone << a_flow }.to raise_error(RuntimeError)
+ end
+ end
+
describe '#freeze' do
it 'freezes the object' do
expect(flows.freeze).to equal flows | Preserve the frozen state when cloning Flows objects | meineerde_rackstash | train | rb,rb |
ebcfaf9050e1d82c7ef676a3a47b681b20233d9d | diff --git a/salt/payload.py b/salt/payload.py
index <HASH>..<HASH> 100644
--- a/salt/payload.py
+++ b/salt/payload.py
@@ -48,6 +48,21 @@ except ImportError:
#sys.exit(salt.defaults.exitcodes.EX_GENERIC)
+if not hasattr(msgpack, 'exceptions'):
+ class PackValueError(Exception):
+ '''
+ older versions of msgpack do not have PackValueError
+ '''
+
+ class exceptions(object):
+ '''
+ older versions of msgpack do not have an exceptions module
+ '''
+ PackValueError = PackValueError()
+
+ msgpack.exceptions = exceptions()
+
+
def package(payload):
'''
This method for now just wraps msgpack.dumps, but it is here so that | add exception placeholder for older msgpacks
Fix for #<I>. | saltstack_salt | train | py |
cf7225f56180a0e44922f59e870c4378f2f72d59 | diff --git a/pkg/proxy/userspace/proxier.go b/pkg/proxy/userspace/proxier.go
index <HASH>..<HASH> 100644
--- a/pkg/proxy/userspace/proxier.go
+++ b/pkg/proxy/userspace/proxier.go
@@ -435,7 +435,7 @@ func (proxier *Proxier) mergeService(service *v1.Service) sets.String {
return nil
}
svcName := types.NamespacedName{Namespace: service.Namespace, Name: service.Name}
- if !helper.IsServiceIPSet(service) {
+ if utilproxy.ShouldSkipService(svcName, service) {
klog.V(3).Infof("Skipping service %s due to clusterIP = %q", svcName, service.Spec.ClusterIP)
return nil
}
@@ -500,7 +500,7 @@ func (proxier *Proxier) unmergeService(service *v1.Service, existingPorts sets.S
return
}
svcName := types.NamespacedName{Namespace: service.Namespace, Name: service.Name}
- if !helper.IsServiceIPSet(service) {
+ if utilproxy.ShouldSkipService(svcName, service) {
klog.V(3).Infof("Skipping service %s due to clusterIP = %q", svcName, service.Spec.ClusterIP)
return
} | proxy/userspace: replace IsServiceIPSet() with ShouldSkipService()
Keeps things consistent with iptables/IPVS proxies. Proxies don't
handle ServiceTypeExternalName even if the ClusterIP is set. | kubernetes_kubernetes | train | go |
e4df86f4d3d39d6fca2f9e353a1e74b0bba9650a | diff --git a/utils_test.go b/utils_test.go
index <HASH>..<HASH> 100644
--- a/utils_test.go
+++ b/utils_test.go
@@ -28,7 +28,7 @@ digraph fsm {
"intermediate";
"open";
}`
- normalizedGot := strings.Replace(got, "\n", "", -1)
+ normalizedGot := strings.ReplaceAll(got, "\n", "")
normalizedWanted := strings.ReplaceAll(wanted, "\n", "")
if normalizedGot != normalizedWanted {
t.Errorf("build graphivz graph failed. \nwanted \n%s\nand got \n%s\n", wanted, got)
@@ -58,7 +58,7 @@ graph fsm
intermediate -->|part-close| closed
open -->|close| closed
`
- normalizedGot := strings.Replace(got, "\n", "", -1)
+ normalizedGot := strings.ReplaceAll(got, "\n", "")
normalizedWanted := strings.ReplaceAll(wanted, "\n", "")
if normalizedGot != normalizedWanted {
t.Errorf("build mermaid graph failed. \nwanted \n%s\nand got \n%s\n", wanted, got) | fix: replaces forgotten ReplaceAll (#<I>) | looplab_fsm | train | go |
b0108bf824438c3a8b1a646460da4300825e9432 | diff --git a/lib/radius/ord_string.rb b/lib/radius/ord_string.rb
index <HASH>..<HASH> 100644
--- a/lib/radius/ord_string.rb
+++ b/lib/radius/ord_string.rb
@@ -1,6 +1,6 @@
module Radius
class OrdString < String
- if RUBY_VERSION[0,3] == '1.9'
+ unless "a"[0] == 97 # test for lower than Ruby 1.9
def [](*args)
if args.size == 1 && args.first.is_a?(Integer)
slice(args.first).ord | use ruby behavior to test for feature instead of RUBY_VERSION
Previous code checked part of the RUBY_VERSION constant and no longer worked properly in 2.x
This change will check the behavior of strings before applying the change, which protects against
numbering changes in versions. | jlong_radius | train | rb |
0a9ee7bc80c4c630d6b16463af833babb208a753 | diff --git a/cherrypy/process/servers.py b/cherrypy/process/servers.py
index <HASH>..<HASH> 100644
--- a/cherrypy/process/servers.py
+++ b/cherrypy/process/servers.py
@@ -62,7 +62,7 @@ hello.py::
import cherrypy
class HelloWorld:
- \"""Sample request handler class.\"""
+ '''Sample request handler class.'''
@cherrypy.expose
def index(self):
return "Hello world!" | Use single quotes as double-quotes, even with the first one escaped, causes problems with SublimeText syntax highlighting. | cherrypy_cheroot | train | py |
f5dd33ce09bf89cf2f2f30ab0aab9f33f3c610ff | diff --git a/src/com/google/javascript/jscomp/DefaultPassConfig.java b/src/com/google/javascript/jscomp/DefaultPassConfig.java
index <HASH>..<HASH> 100644
--- a/src/com/google/javascript/jscomp/DefaultPassConfig.java
+++ b/src/com/google/javascript/jscomp/DefaultPassConfig.java
@@ -2588,6 +2588,11 @@ public final class DefaultPassConfig extends PassConfig {
protected CompilerPass create(final AbstractCompiler compiler) {
return new NameAnalyzer(compiler, true, options.reportPath);
}
+
+ @Override
+ public FeatureSet featureSet() {
+ return ES8_MODULES;
+ }
};
private final PassFactory smartNamePass = new PassFactory("smartNamePass", true) {
@@ -2595,6 +2600,11 @@ public final class DefaultPassConfig extends PassConfig {
protected CompilerPass create(final AbstractCompiler compiler) {
return new NameAnalyzer(compiler, true, options.reportPath);
}
+
+ @Override
+ public FeatureSet featureSet() {
+ return ES8_MODULES;
+ }
};
private final PassFactory smartNamePass2 = new PassFactory("smartNamePass", true) {
@@ -2602,6 +2612,11 @@ public final class DefaultPassConfig extends PassConfig {
protected CompilerPass create(final AbstractCompiler compiler) {
return new NameAnalyzer(compiler, true, null);
}
+
+ @Override
+ public FeatureSet featureSet() {
+ return ES8_MODULES;
+ }
};
/** Inlines simple methods, like getters */ | Run smartNamePass pass when language_out is ES6+.
-------------
Created by MOE: <URL> | google_closure-compiler | train | java |
d8518682be161ac58fadb3f4b71401d0ddaa5cb2 | diff --git a/routing/routing.go b/routing/routing.go
index <HASH>..<HASH> 100644
--- a/routing/routing.go
+++ b/routing/routing.go
@@ -5,8 +5,8 @@ import (
"errors"
key "github.com/ipfs/go-ipfs/blocks/key"
- ci "gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/crypto"
- peer "gx/ipfs/QmY3NAw959vbE1oJooP9HchcRdBsbxhgQsEZTRhKgvoSuC/go-libp2p/p2p/peer"
+ ci "gx/ipfs/QmZxtCsPRgCnCXwVPUjcBiFckkG5NMYM4Pthwe6X4C8uQq/go-libp2p/p2p/crypto"
+ peer "gx/ipfs/QmZxtCsPRgCnCXwVPUjcBiFckkG5NMYM4Pthwe6X4C8uQq/go-libp2p/p2p/peer"
context "gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
) | go-keyspace dep from libp2p added
License: MIT | libp2p_go-libp2p-routing | train | go |
ddb8a6fb43649e6deb56922c1ec81350822567ee | diff --git a/scripts/generate_rpc_templates.py b/scripts/generate_rpc_templates.py
index <HASH>..<HASH> 100755
--- a/scripts/generate_rpc_templates.py
+++ b/scripts/generate_rpc_templates.py
@@ -72,8 +72,10 @@ def generate_async_message_template(nargs):
print " boost::function< void(" + csep("arg#_t") + ") > callback;"
print "};"
print
- if nargs == 0: print "inline"
- else: print "template<" + csep("class arg#_t") + ">"
+ if nargs == 0:
+ print "inline"
+ else:
+ print "template<" + csep("class arg#_t") + ">"
print "void send(mailbox_cluster_t *src, " + ("typename " if nargs > 0 else "") + "async_mailbox_t< void(" + csep("arg#_t") + ") >::address_t dest" + cpre("const arg#_t &arg#") + ") {"
print " send(src, dest.addr,"
print " boost::bind(&async_mailbox_t< void(" + csep("arg#_t") + ") >::write, _1" + cpre("arg#") + "));" | Got rid of some one-line ifs in generate_rpc_templates.py. | rethinkdb_rethinkdb | train | py |
71ad46cbac25c577f995749ba965f5b2f3497233 | diff --git a/src/visual-data-demo.js b/src/visual-data-demo.js
index <HASH>..<HASH> 100644
--- a/src/visual-data-demo.js
+++ b/src/visual-data-demo.js
@@ -11,6 +11,7 @@ jQuery(document).ready(function($) {
queue.defer(d3.json, "sunburst/data/day-2017-05-07.json");
queue.defer(d3.json, "sunburst/data/day-2017-05-08.json");
queue.defer(d3.json, "sunburst/data/day-2017-05-09.json");
+ queue.defer(d3.json, "sunburst/data/week-2017-03-12.json");
queue.awaitAll(function(error, results) {
if (error) {
throw error;
@@ -20,7 +21,8 @@ jQuery(document).ready(function($) {
var combinedData = {};
theData.forEach(function(aPage, index) {
path = aPage[0];
- if(Object.keys(combinedData).indexOf(path) < 0) {
+ //if(Object.keys(combinedData).indexOf(path) < 0) {
+ if(!combinedData.hasOwnProperty(path)) {
combinedData[path] = aPage;
} else {
combinedData[path] = [path, | the Object method hasOwnProperty is a lot faster | leocornus_leocornus-visualdata | train | js |
f2d9dc23a98fb2729736f407f535f65e4ecca125 | diff --git a/ceph_deploy/lsb.py b/ceph_deploy/lsb.py
index <HASH>..<HASH> 100644
--- a/ceph_deploy/lsb.py
+++ b/ceph_deploy/lsb.py
@@ -1,3 +1,4 @@
+from . import hosts
from . import exc
def check_lsb_release():
@@ -10,6 +11,7 @@ def check_lsb_release():
process = subprocess.Popen(
args=args,
stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
)
lsb_release_path, _ = process.communicate()
ret = process.wait()
@@ -70,7 +72,7 @@ def get_lsb_release(sudo):
Get LSB release information from lsb_release.
Check if lsb_release is installed on the remote host and issue
- a message if not.
+ a message if not.
Returns truple with distro, release and codename. Otherwise
the function raises an error (subprocess.CalledProcessError or
@@ -80,7 +82,7 @@ def get_lsb_release(sudo):
check_lsb_release_r = sudo.compile(check_lsb_release)
status = check_lsb_release_r()
except RuntimeError as e:
- raise exc.MissingPackageError(e.message)
+ return hosts.lsb_fallback(sudo)
lsb_release_r = sudo.compile(lsb_release)
return lsb_release_r() | use the lsb_fallback when lsb is not found | ceph_ceph-deploy | train | py |
f250e46e8334c49a523cd2f9b107c0f5094d5831 | diff --git a/internal/buffer/out_message_test.go b/internal/buffer/out_message_test.go
index <HASH>..<HASH> 100644
--- a/internal/buffer/out_message_test.go
+++ b/internal/buffer/out_message_test.go
@@ -86,6 +86,22 @@ func TestMemclr(t *testing.T) {
}
}
+func TestOutMessageAppend(t *testing.T) {
+ t.Fatal("TODO")
+}
+
+func TestOutMessageAppendString(t *testing.T) {
+ t.Fatal("TODO")
+}
+
+func TestOutMessageShrinkTo(t *testing.T) {
+ t.Fatal("TODO")
+}
+
+func TestOutMessageHeader(t *testing.T) {
+ t.Fatal("TODO")
+}
+
func TestOutMessageReset(t *testing.T) {
var om OutMessage
h := om.OutHeader() | buffer_test: add TODOs where more test coverage is necessary. | jacobsa_fuse | train | go |
562767b04015546e53677bb3c8aa5cae12897fa3 | diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go
index <HASH>..<HASH> 100644
--- a/cmd/helm/upgrade.go
+++ b/cmd/helm/upgrade.go
@@ -100,6 +100,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
instClient.PostRenderer = client.PostRenderer
instClient.DisableOpenAPIValidation = client.DisableOpenAPIValidation
instClient.SubNotes = client.SubNotes
+ instClient.Description = client.Description
rel, err := runInstall(args, instClient, valueOpts, out)
if err != nil { | Fix description is ignore when installed with upgrade | helm_helm | train | go |
091f6661613b17928a764c0ffb70e2f829226449 | diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -51,14 +51,6 @@ class Puppet::Parser::Scope
end
end
- def [](name, options = {})
- lookupvar(name, options)
- end
-
- def []=(var, value)
- setvar(var, value)
- end
-
def each
to_hash.each { |name, value| yield(name, value) }
end
@@ -254,6 +246,7 @@ class Puppet::Parser::Scope
nil
end
end
+ alias [] lookupvar
def qualified_scope(classname)
raise "class #{classname} could not be found" unless klass = find_hostclass(classname)
@@ -335,6 +328,7 @@ class Puppet::Parser::Scope
table[name] = value
end
end
+ alias []= setvar
def append_value(bound_value, new_value)
case new_value | Use `alias` to map []{,=} to {lookup,set}var on scope.
Rather than hand-rolling an alias for the hash-like accessors to the named get
and set methods, we can just use the stock alias method.
This eliminates an extra layer of function calls, but also makes clearer to
code analysis and the casual reader what the actual significance of those
different methods are. | puppetlabs_puppet | train | rb |
e07682b6a32b304127c05ffd9ef472199b96e80c | diff --git a/test/arm/test_fibo.rb b/test/arm/test_fibo.rb
index <HASH>..<HASH> 100644
--- a/test/arm/test_fibo.rb
+++ b/test/arm/test_fibo.rb
@@ -10,10 +10,11 @@ class TestFibo < MiniTest::Test
# not my hand off course, found in the net from a basic introduction
def test_fibo
int = Vm::Integer.new(1) # the one is funny, but the fibo is _really_ tight code and reuses registers
- fibo = utoa = @program.get_or_create_function(:fibo)
+ fibo = @program.get_or_create_function(:fibo)
@program.main.mov( int , 10 )
@program.main.call( fibo )
- #could put ...
+ putint = @program.get_or_create_function(:putint)
+ @program.main.call( putint )
write 20 , "fibo"
end | make the asm fibo output its result. slam dunk | ruby-x_rubyx | train | rb |
d160a65904af1fd98db9d87d6f08be37d8f00368 | diff --git a/src/test/org/openscience/cdk/io/cml/CDKRoundTripTest.java b/src/test/org/openscience/cdk/io/cml/CDKRoundTripTest.java
index <HASH>..<HASH> 100644
--- a/src/test/org/openscience/cdk/io/cml/CDKRoundTripTest.java
+++ b/src/test/org/openscience/cdk/io/cml/CDKRoundTripTest.java
@@ -81,6 +81,7 @@ public class CDKRoundTripTest extends CDKTestCase {
Assert.assertEquals("Found non-zero diff: " + difference, 0, difference.length());
}
+ @Ignore("exact mass not currently supported in CML implmenetation")
@Test public void testIIsotope_ExactMass() throws Exception {
IAtomContainer mol = builder.newInstance(IAtomContainer.class);
IAtom atom = builder.newInstance(IAtom.class,"C"); | CML can't round trip exact mass at the moment. | cdk_cdk | train | java |
7cbe65acc50afbc405ed743aad365f21e8bd84ea | diff --git a/sexpr/__init__.py b/sexpr/__init__.py
index <HASH>..<HASH> 100644
--- a/sexpr/__init__.py
+++ b/sexpr/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '0.1.6'
+__version__ = '0.1.7'
from .loaders import load, load_file, load_string, load_dict
from .sexpr import Sexpr, inject, extend | Bump patch version to <I> | IwoHerka_sexpr | train | py |
1da975ffcee2099c58315282eb4d1f117c522e91 | diff --git a/tests/Ivr/IvrTest.php b/tests/Ivr/IvrTest.php
index <HASH>..<HASH> 100644
--- a/tests/Ivr/IvrTest.php
+++ b/tests/Ivr/IvrTest.php
@@ -59,7 +59,8 @@ class IvrTest extends TestCase
*/
public function testLoad($filename)
{
- $this->expectOutputString('');
+ $this->markTestIncomplete('IVR loading not implemented properly');
+
$ivr = new Ivr;
$ivr->load($filename); | Mark loading test incomplete, as it's not really ready. | CallFire_CallFire-PHP-SDK | train | php |
874466beb79eb1342522a326b31ad51500872708 | diff --git a/src/Type/FileTypeMapper.php b/src/Type/FileTypeMapper.php
index <HASH>..<HASH> 100644
--- a/src/Type/FileTypeMapper.php
+++ b/src/Type/FileTypeMapper.php
@@ -37,7 +37,7 @@ class FileTypeMapper
public function getTypeMap(string $fileName): array
{
- $cacheKey = sprintf('%s-%d-v24-%d', $fileName, filemtime($fileName), $this->enableUnionTypes ? 1 : 0);
+ $cacheKey = sprintf('%s-%d-v25-%d', $fileName, filemtime($fileName), $this->enableUnionTypes ? 1 : 0);
if (isset($this->memoryCache[$cacheKey])) {
return $this->memoryCache[$cacheKey];
} | Bump file type mapper cache version because of <I>b8ffd<I>fc2fefb<I>be<I>da<I> | phpstan_phpstan | train | php |
ca82b8d91a5926d9d1c0c82bc448dfd77f42e48b | diff --git a/resource.go b/resource.go
index <HASH>..<HASH> 100644
--- a/resource.go
+++ b/resource.go
@@ -165,7 +165,6 @@ func (r Resource) Init(container *restful.Container, resource interface{}) {
Doc(resource.PostDoc()).
Reads(resource.Reads()).
Returns(http.StatusOK, "OK", resource.Returns()).
- Returns(http.StatusNotFound, "Not found", ErrorResponse{}).
Returns(http.StatusBadRequest, "Invalid post data", ErrorResponse{})
if resource.PostAuthRequired() { | Removed <I> response from POST responses | muesli_smolder | train | go |
ac544adbfdf794296df91251d63123f57dfa8559 | diff --git a/lib/origen/errata/hw_erratum.rb b/lib/origen/errata/hw_erratum.rb
index <HASH>..<HASH> 100644
--- a/lib/origen/errata/hw_erratum.rb
+++ b/lib/origen/errata/hw_erratum.rb
@@ -1,15 +1,18 @@
module Origen
module Errata
- class HwErratum < BaseErratum
+ class HwErratum
- attr_accessor :hw_workaround_description, :disposition, :impact, :fix_plan, :affected_items
- def initialize(id, title, description, hw_workaround_description, disposition, impact, fix_plan, affected_items, options = {})
- super(id, type = "hw", title, description)
- @hw_workaround_description = hw_workaround_description
- @disposition = disposition
- @impact = impact
- @fix_plan = fix_plan
- @affected_items = affected_items
+ attr_accessor :id, :title, :description, :hw_workaround_description, :disposition, :impact, :fix_plan, :affected_items, :sw_workaround
+ def initialize(id, options = {})
+ @id = id
+ @title = options[:title]
+ @description = options[:description]
+ @hw_workaround_description = options[:hw_workaround_description]
+ @disposition = options[:disposition]
+ @impact = options[:impact]
+ @fix_plan = options[:fix_plan]
+ @affected_items = options[:affected_items]
+ @sw_workaround = options[:sw_workaround]
end
end | Change HwErratum Class to no longer extend BaseErratum, all variables except id are options | Origen-SDK_origen | train | rb |
9c0b0229a1585ef5639e5e273b90ad6c9f90f9c2 | diff --git a/export.py b/export.py
index <HASH>..<HASH> 100755
--- a/export.py
+++ b/export.py
@@ -48,7 +48,7 @@ def main():
print >>sys.stderr, 'W: Failed to read', path
continue
- with open(dest_path, 'w') as file:
+ with open(dest_path, 'wb') as file:
file.write(data)
num_files += 1 | export.py: extract files as binary (might fix #<I>) | blixt_py-starbound | train | py |
ac14b89af05b3d6ca12f85efa771b3a7b4f80bfa | diff --git a/grab/ext/soup.py b/grab/ext/soup.py
index <HASH>..<HASH> 100644
--- a/grab/ext/soup.py
+++ b/grab/ext/soup.py
@@ -10,9 +10,9 @@ class Extendsion(object):
grab._soup = None
def extra_default_config(self):
- return dict(
- 'soup_remove_scripts': True
- )
+ return {
+ 'soup_remove_scripts': True,
+ }
@property
def soup(self):
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@ for dirpath, dirnames, filenames in os.walk(PACKAGE):
data_files.append(os.path.join(prefix, f))
setup(
- version = '0.2.0',
+ version = '0.2.1',
description = 'Pycurl wrapper',
author = 'Grigoriy Petukhov',
author_email = '[email protected]', | Fix bug in soup extension which causes error in pip installation | lorien_grab | train | py,py |
acc5ea5d7b27d9be42b859ffc4631ac14794a52c | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from setuptools import setup
setup(
name='sphinx-git',
description='git Changelog for Sphinx',
- version='5',
+ version='6',
author='Daniel Watkins',
author_email='[email protected]',
install_requires=['sphinx', 'GitPython'], | Bump to v6 (for development). | OddBloke_sphinx-git | train | py |
0c16fc64f9eb9fcc63b3e19a79c5d846d637d01d | diff --git a/addon/components/flexberry-dialog.js b/addon/components/flexberry-dialog.js
index <HASH>..<HASH> 100644
--- a/addon/components/flexberry-dialog.js
+++ b/addon/components/flexberry-dialog.js
@@ -167,7 +167,7 @@ let FlexberryDialogComponent = Ember.Component.extend(
@property duration
@type Number
- @default 300
+ @default 200
*/
duration: 200, | Fix typo in 'duration' property comment. | Flexberry_ember-flexberry-gis | train | js |
9f98bd79d83f566833d99aa78a8b0c3c5957fce6 | diff --git a/libnetwork/iptables/iptables.go b/libnetwork/iptables/iptables.go
index <HASH>..<HASH> 100644
--- a/libnetwork/iptables/iptables.go
+++ b/libnetwork/iptables/iptables.go
@@ -62,7 +62,7 @@ var (
initOnce sync.Once
)
-// IPTable defines struct with IPVersion and few other members are added later
+// IPTable defines struct with IPVersion
type IPTable struct {
Version IPVersion
} | reworked comment of IPTable struct | moby_moby | train | go |
40748d8b824efaac4ea950e3b34f260fc4e39b07 | diff --git a/tests/test_BOD.py b/tests/test_BOD.py
index <HASH>..<HASH> 100644
--- a/tests/test_BOD.py
+++ b/tests/test_BOD.py
@@ -39,3 +39,7 @@ class TestBODEquality(unittest.TestCase):
def test_value_check(self):
bod = BOD([('a', -2), ('b', 0), ('c', 3)])
self.assertNotEquals(self.d, bod)
+
+ def test_builtin_dict_inequality(self):
+ d = {'a': -2, 'b': 0, 'c': 3}
+ self.assertNotEquals(self.d, d) | Added test_builtin_dict_inequality test.
This test makes sure that builtin dict objects can't compare equal to
BetterOrderedDict objects. | therealfakemoot_collections2 | train | py |
9b3a6cc3d2fb1d24932d1507d7f278bac34deaba | diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php
index <HASH>..<HASH> 100644
--- a/src/php/lib/Grpc/BaseStub.php
+++ b/src/php/lib/Grpc/BaseStub.php
@@ -87,7 +87,7 @@ class BaseStub
'ChannelCredentials::create methods');
}
if ($channel) {
- if (!is_a($channel, 'Channel')) {
+ if (!is_a($channel, 'Grpc\Channel')) {
throw new \Exception('The channel argument is not a'.
'Channel object');
} | Fixing is_a check for Channel
php ```is_a``` function expects fully qualified class name to validate. | grpc_grpc | train | php |
94b881ea9a426a23d225d1520ab3a21eaa528032 | diff --git a/src/main/java/com/yahoo/sketches/quantiles/HeapUnion.java b/src/main/java/com/yahoo/sketches/quantiles/HeapUnion.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/yahoo/sketches/quantiles/HeapUnion.java
+++ b/src/main/java/com/yahoo/sketches/quantiles/HeapUnion.java
@@ -20,7 +20,7 @@ class HeapUnion extends Union {
HeapUnion() {} //creates a virgin Union object
HeapUnion(QuantilesSketch sketch) {
- gadget_ = (HeapQuantilesSketch) sketch;
+ gadget_ = HeapQuantilesSketch.copy(sketch);
}
/** | Fixed bug: HeapUnion(QuantilesSketch) should have been a copy. | DataSketches_sketches-core | train | java |
8bc7b4d3cda28528fbfc984e815b471f0958b354 | diff --git a/core/src/test/java/com/graphhopper/routing/util/CarFlagEncoderTest.java b/core/src/test/java/com/graphhopper/routing/util/CarFlagEncoderTest.java
index <HASH>..<HASH> 100644
--- a/core/src/test/java/com/graphhopper/routing/util/CarFlagEncoderTest.java
+++ b/core/src/test/java/com/graphhopper/routing/util/CarFlagEncoderTest.java
@@ -69,6 +69,16 @@ public class CarFlagEncoderTest
map.put("route", "ferry");
map.put("foot", "yes");
assertFalse(encoder.acceptWay(way) > 0);
+
+ map.clear();
+ map.put("highway", "primary");
+ long flags = encoder.handleWayTags(way, encoder.acceptWay(way), 0);
+ assertTrue(encoder.isForward(flags));
+ assertTrue(encoder.isBackward(flags));
+ map.put("oneway", "yes");
+ flags = encoder.handleWayTags(way, encoder.acceptWay(way), 0);
+ assertTrue(encoder.isForward(flags));
+ assertFalse(encoder.isBackward(flags));
}
@Test | added test for oneway to car encoder | graphhopper_graphhopper | train | java |
4290c43b41fc4a0dc59a16bd41a6198e7a9cdd09 | diff --git a/packages/taro/src/create-page.js b/packages/taro/src/create-page.js
index <HASH>..<HASH> 100644
--- a/packages/taro/src/create-page.js
+++ b/packages/taro/src/create-page.js
@@ -97,9 +97,9 @@ function initPage (weappPageConf, page) {
return recurrenceComponent(weappPageConf, page)
}
-function componentActivate (component, key) {
+function componentTrigger (component, key) {
Object.getOwnPropertyNames(component.$$components || {}).forEach(name => {
- componentActivate(component.$$components[name], key)
+ componentTrigger(component.$$components[name], key)
})
component[key] && typeof component[key] === 'function' && component[key]()
}
@@ -114,13 +114,13 @@ function createPage (PageClass) {
page.$router = {
params: options
}
- componentActivate(page, 'componentWillMount')
+ componentTrigger(page, 'componentWillMount')
},
onReady () {
- componentActivate(page, 'componentDidMount')
+ componentTrigger(page, 'componentDidMount')
},
onUnload () {
- componentActivate(page, 'componentDidUnmount')
+ componentTrigger(page, 'componentDidUnmount')
},
_setData (data, cb, isRoot) {
this.stateList.push({ | fix(tarojs): method rename | NervJS_taro | train | js |
f3d7ec9211689aacea117d6ff9494ce4631c2486 | diff --git a/astrobase/lcproc.py b/astrobase/lcproc.py
index <HASH>..<HASH> 100644
--- a/astrobase/lcproc.py
+++ b/astrobase/lcproc.py
@@ -639,13 +639,18 @@ def getlclist(listpickle,
# get our kdtree
our_kdt = lclist['kdtree']
+ # get the external kdtree
+ ext_kdt = sps.cKDTree(ext_xyz)
+
# do a query_ball_tree
- extkd_dists, extkd_matchinds = our_kdt.query(ext_xyz)
+ extkd_matchinds = ext_kdt.query_ball_tree(our_kdt, ext_xyzdist)
+
+ ext_matches = []
+ for mind in extkd_matchinds:
+ if len(mind) > 0:
+ ext_matches.append(mind[0])
- # find all matching objects
- ext_matches = extkd_matchinds[
- (np.isfinite(extkd_dists)) & (extkd_dists < ext_xyzdist)
- ]
+ ext_matches = np.array(ext_matches)
raise Exception('testing') | lcproc.getlclist fix bugs with xmatchexternal | waqasbhatti_astrobase | train | py |
9ccf7f778852bc6931326606ab20f38a9f13d972 | diff --git a/src/JsonDecoder.php b/src/JsonDecoder.php
index <HASH>..<HASH> 100644
--- a/src/JsonDecoder.php
+++ b/src/JsonDecoder.php
@@ -7,12 +7,12 @@ use Psr\Http\Message\ServerRequestInterface as Request;
class JsonDecoder
{
protected $assoc;
- protected $max_depth;
+ protected $maxDepth;
protected $options;
public function __construct($assoc = false, $max_depth = 256, $options = 0){
$this->assoc = $assoc;
- $this->max_depth = $max_depth;
+ $this->max_depth = $maxDepth;
$this->options = $options;
}
@@ -29,7 +29,7 @@ class JsonDecoder
$body = (string) $request->getBody();
$request = $request->withParsedBody(json_decode($body,
$this->assoc,
- $this->max_depth,
+ $this->maxDepth,
$this->options));
} | Changed max_depth property from snake_case to camelCase | relayphp_Relay.Middleware | train | php |
035b43949f037950f53ce409124ce00ddf824e6f | diff --git a/rest/test/util.go b/rest/test/util.go
index <HASH>..<HASH> 100644
--- a/rest/test/util.go
+++ b/rest/test/util.go
@@ -16,7 +16,8 @@ import (
"testing"
)
-func MakeRequestWithHeader(method, urlStr string, header http.Header, payload interface{}) *http.Request {
+func MakeSimpleRequest(method string, urlStr string, payload interface{}) *http.Request {
+
s := ""
if payload != nil {
@@ -31,9 +32,7 @@ func MakeRequestWithHeader(method, urlStr string, header http.Header, payload in
if err != nil {
panic(err)
}
- r.Header = header
r.Header.Set("Accept-Encoding", "gzip")
-
if payload != nil {
r.Header.Set("Content-Type", "application/json")
}
@@ -41,10 +40,6 @@ func MakeRequestWithHeader(method, urlStr string, header http.Header, payload in
return r
}
-func MakeSimpleRequest(method string, urlStr string, payload interface{}) *http.Request {
- return MakeRequestWithHeader(method, urlStr, http.Header{}, payload)
-}
-
func CodeIs(t *testing.T, r *httptest.ResponseRecorder, expectedCode int) {
if r.Code != expectedCode {
t.Errorf("Code %d expected, got: %d", expectedCode, r.Code) | revert test.MakeRequestWithHeader addition | ant0ine_go-json-rest | train | go |
e9266e53df3dc9022f9f679ed8a1ce01a0fda3e7 | diff --git a/IPython/html/widgets/widget.py b/IPython/html/widgets/widget.py
index <HASH>..<HASH> 100644
--- a/IPython/html/widgets/widget.py
+++ b/IPython/html/widgets/widget.py
@@ -196,8 +196,10 @@ class Widget(LoggingConfigurable):
Parameters
----------
callback: callable
- callback will be passed two arguments when a message arrives:
+ callback will be passed two arguments when a message arrives::
+
callback(widget, content)
+
remove: bool
True if the callback should be unregistered."""
self._msg_callbacks.register_callback(callback, remove=remove)
@@ -208,8 +210,10 @@ class Widget(LoggingConfigurable):
Parameters
----------
callback: method handler
- Must have a signature of:
+ Must have a signature of::
+
callback(widget, **kwargs)
+
kwargs from display are passed through without modification.
remove: bool
True if the callback should be unregistered.""" | Fix some formatting in widget docstrings | jupyter-widgets_ipywidgets | train | py |
c320f65802ee83d4c1976dec46ae89a207064a12 | diff --git a/spec/unit/util/log/destinations_spec.rb b/spec/unit/util/log/destinations_spec.rb
index <HASH>..<HASH> 100755
--- a/spec/unit/util/log/destinations_spec.rb
+++ b/spec/unit/util/log/destinations_spec.rb
@@ -1,5 +1,6 @@
#! /usr/bin/env ruby
require 'spec_helper'
+require 'json'
require 'puppet/util/log' | (maint) Require json for logstash test
Removal of the hiera2 bindings code exposed the fact that the test for
logstash logging doesn't require JSON even though it uses it. This adds
a line to require JSON so that it is available when the test runs. | puppetlabs_puppet | train | rb |
635010bc50b68ea44ffea80f5396e4cf4e9491fc | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -74,10 +74,15 @@ var objects = {
var mail = value.replace(/MAILTO:/i, '');
if(params.CN) {
- lastEvent.organizer = params.CN + " <" + mail + ">";
+ lastEvent.organizer = {
+ name: params.CN,
+ mail: mail
+ };
}
else {
- lastEvent.organizer = mail;
+ lastEvent.organizer = {
+ mail: mail
+ };
}
return lastEvent;
},
@@ -107,10 +112,15 @@ var objects = {
var mail = value.replace(/MAILTO:/i, '');
if(params.CN) {
- lastEvent.attendee.push(params.CN + " <" + mail + ">");
+ lastEvent.attendee.push({
+ name: params.CN,
+ mail: mail
+ });
}
else {
- lastEvent.attendee.push(mail);
+ lastEvent.attendee.push({
+ mail: mail
+ });
}
return lastEvent;
} | Organizer and attendees are object now with name and mail | AnyFetch_ics-parser | train | js |
5763ba9706e50f0b74d739bd49d131a4de0f35fd | diff --git a/tests/python/tensorrt/test_tensorrt_lenet5.py b/tests/python/tensorrt/test_tensorrt_lenet5.py
index <HASH>..<HASH> 100644
--- a/tests/python/tensorrt/test_tensorrt_lenet5.py
+++ b/tests/python/tensorrt/test_tensorrt_lenet5.py
@@ -95,9 +95,11 @@ def test_tensorrt_inference():
print("MXNet accuracy: %f" % mx_pct)
print("MXNet-TensorRT accuracy: %f" % trt_pct)
- assert abs(mx_pct - trt_pct) < 1e-2, \
- """Diff. between MXNet & TensorRT accuracy too high:
- MXNet = %f, TensorRT = %f""" % (mx_pct, trt_pct)
+ absolute_accuracy_diff = abs(mx_pct - trt_pct)
+ epsilon = 1.01e-2
+ assert absolute_accuracy_diff < epsilon, \
+ """Absolute diff. between MXNet & TensorRT accuracy (%f) exceeds threshold (%f):
+ MXNet = %f, TensorRT = %f""" % (absolute_accuracy_diff, epsilon, mx_pct, trt_pct)
if __name__ == '__main__': | Decreases test sensitivity (#<I>) | apache_incubator-mxnet | train | py |
72c3c6d0802919eb4d24a4ef19cc465e9fa8ff1b | diff --git a/src/core/core.animator.js b/src/core/core.animator.js
index <HASH>..<HASH> 100644
--- a/src/core/core.animator.js
+++ b/src/core/core.animator.js
@@ -210,6 +210,14 @@ class Animator {
anims.items = [];
this._notify(chart, anims, Date.now(), 'complete');
}
+
+ /**
+ * Remove chart from Animator
+ * @param {Chart} chart
+ */
+ remove(chart) {
+ return this._charts.delete(chart);
+ }
}
const instance = new Animator();
diff --git a/src/core/core.controller.js b/src/core/core.controller.js
index <HASH>..<HASH> 100644
--- a/src/core/core.controller.js
+++ b/src/core/core.controller.js
@@ -893,6 +893,7 @@ class Chart {
let i, ilen;
me.stop();
+ Animator.remove(me);
// dataset controllers need to cleanup associated data
for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) { | Fix memory leak (#<I>) | chartjs_Chart.js | train | js,js |
1f1f638254071d936336bf70d3c5ed578574794d | diff --git a/mpd/client.go b/mpd/client.go
index <HASH>..<HASH> 100644
--- a/mpd/client.go
+++ b/mpd/client.go
@@ -605,25 +605,13 @@ func (c *Client) ListOutputs() ([]Attrs, error) {
}
// EnableOutput enables the audio output with the given id.
-func (c *Client) EnableOutput(id uint) error {
- id, err := c.cmd("enableoutput %d", id)
- if err != nil {
- return err
- }
- c.text.StartResponse(id)
- defer c.text.EndResponse(id)
- return nil
+func (c *Client) EnableOutput(id int) error {
+ return c.okCmd("enableoutput %d", id)
}
// DisableOutput disables the audio output with the given id.
-func (c *Client) DisableOutput(id uint) error {
- id, err := c.cmd("disableoutput %d", id)
- if err != nil {
- return err
- }
- c.text.StartResponse(id)
- defer c.text.EndResponse(id)
- return nil
+func (c *Client) DisableOutput(id int) error {
+ return c.okCmd("disableoutput %d", id)
}
// Stored playlists related commands | Prefer int over uint
This is more consistent with the library, and enables reuse of the
okCmd helper. | fhs_gompd | train | go |
8bc8c077e28c9d97a0b3c105374ca5b6b75bb129 | diff --git a/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php b/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php
index <HASH>..<HASH> 100644
--- a/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php
+++ b/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php
@@ -13,6 +13,7 @@ namespace PHPCompatibility\Sniffs\UseDeclarations;
use PHPCompatibility\Sniff;
use PHP_CodeSniffer_File as File;
use PHP_CodeSniffer_Tokens as Tokens;
+use PHPCSUtils\Utils\UseStatements;
/**
* Detect importing constants and functions via a `use` statement.
@@ -74,6 +75,10 @@ class NewUseConstFunctionSniff extends Sniff
return;
}
+ if (UseStatements::isImportUse($phpcsFile, $stackPtr) === false) {
+ return;
+ }
+
$tokens = $phpcsFile->getTokens();
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); | NewUseConstFunction: only check import `use` statements
... as trait or closure `use` statements cannot use `function` or `const` anyway. | PHPCompatibility_PHPCompatibility | train | php |
Subsets and Splits