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
e10ea47232cc345bd40b6c7d7d05baa37d7c1835
diff --git a/examples/service-controller.php b/examples/service-controller.php index <HASH>..<HASH> 100644 --- a/examples/service-controller.php +++ b/examples/service-controller.php @@ -31,6 +31,6 @@ $container = Yolo\createContainer( ); $app = new Yolo\Application($container); -$app->get('hello', '/', 'hello.controller:worldAction'); +$app->get('/', 'hello.controller:worldAction'); $app->run();
Update service-controller example for removed route name argument
igorw_yolo
train
php
ae3d546ae23ea780aa9658afb1dd97fec277b8e0
diff --git a/src/Shell/Task/UserTask.php b/src/Shell/Task/UserTask.php index <HASH>..<HASH> 100644 --- a/src/Shell/Task/UserTask.php +++ b/src/Shell/Task/UserTask.php @@ -23,11 +23,13 @@ class UserTask extends Shell $data = [ 'email' => $email, 'password' => $password, - 'role_id' => 1, ]; $new = $this->Users->newEntity($data); + $new->set('role_id', 1); + $new->set('active', 1); + if ($this->Users->save($new)) { return $this->out('The user "' . $email . '" has been created.'); }
Bugfix for shell: Users were not active and admin
cakemanager_cakephp-cakemanager
train
php
a976ffc9226d0759ac5b49e5db8cfd5618bacd9e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -115,7 +115,13 @@ if __name__ == '__main__': 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Topic :: System :: Systems Administration', 'Topic :: System :: Installation/Setup', 'Topic :: Utilities',
Include all Python versions in setup classifiers.
Fizzadar_pyinfra
train
py
e8483fc4444d5a1f4ef4b60a056cc82267bd16ee
diff --git a/presto-parser/src/main/java/com/facebook/presto/sql/ExpressionFormatter.java b/presto-parser/src/main/java/com/facebook/presto/sql/ExpressionFormatter.java index <HASH>..<HASH> 100644 --- a/presto-parser/src/main/java/com/facebook/presto/sql/ExpressionFormatter.java +++ b/presto-parser/src/main/java/com/facebook/presto/sql/ExpressionFormatter.java @@ -254,7 +254,7 @@ public final class ExpressionFormatter @Override protected String visitExists(ExistsPredicate node, Boolean unmangleNames) { - return "EXISTS (" + formatSql(node.getSubquery(), unmangleNames) + ")"; + return "(EXISTS (" + formatSql(node.getSubquery(), unmangleNames) + "))"; } @Override
Fix formating EXISTS predicate Depending on where the EXISTS predicate is placed in the query it could be required that it have to be wrapped with brackets. This patch makes ExpressionFormatter to always wrap EXISTS predicate.
prestodb_presto
train
java
71d51e34237ad43b9dc80639e75d8e1699f69f62
diff --git a/tests/unit/classes/ModelModelTest.php b/tests/unit/classes/ModelModelTest.php index <HASH>..<HASH> 100644 --- a/tests/unit/classes/ModelModelTest.php +++ b/tests/unit/classes/ModelModelTest.php @@ -5,7 +5,7 @@ use RainLab\Builder\Classes\PluginCode; class ModelModelTest extends TestCase { - public function tearDown() + public function tearDown(): void { // Ensure cleanup for testGetModelFields @unlink(__DIR__.'/../../../models/MyMock.php');
Fix method declaration of test (#<I>)
rainlab_builder-plugin
train
php
5c1689d6d74d50e40d57944c0f3075b9a2701a38
diff --git a/publish/publish.go b/publish/publish.go index <HASH>..<HASH> 100644 --- a/publish/publish.go +++ b/publish/publish.go @@ -37,6 +37,7 @@ func getPublishableLocales(req *http.Request, currentUser interface{}) []string return []string{l10n.Global} } +// RegisterL10nForPublish register l10n language switcher for publish func RegisterL10nForPublish(Publish *publish.Publish, Admin *admin.Admin) { searchHandler := Publish.SearchHandler Publish.SearchHandler = func(db *gorm.DB, context *qor.Context) *gorm.DB {
Comment RegisterL<I>nForPublish
qor_l10n
train
go
b1bcbbeeea60cba7f0b419d1ebe0ea8f8c132d60
diff --git a/examples/vector/main.go b/examples/vector/main.go index <HASH>..<HASH> 100644 --- a/examples/vector/main.go +++ b/examples/vector/main.go @@ -30,7 +30,10 @@ import ( ) var ( - emptyImage = ebiten.NewImage(3, 3) + emptyImage = ebiten.NewImage(3, 3) + + // emptySubImage is an internal sub image of emptyImage. + // Use emptySubImage at DrawTriangles instead of emptyImage in order to avoid bleeding edges. emptySubImage = emptyImage.SubImage(image.Rect(1, 1, 2, 2)).(*ebiten.Image) ) diff --git a/image.go b/image.go index <HASH>..<HASH> 100644 --- a/image.go +++ b/image.go @@ -276,6 +276,11 @@ const MaxIndicesNum = graphics.IndicesNum // DrawTriangles draws triangles with the specified vertices and their indices. // +// img is used as a source image. img cannot be nil. +// If you want to draw triangles with a solid color, use a small white image +// and adjust the color elements in the vertices. For an actual implementation, +// see the example 'vector'. +// // Vertex contains color values, which are interpreted as straight-alpha colors. // // If len(indices) is not multiple of 3, DrawTriangles panics.
ebiten: add comments at DrawTriangles
hajimehoshi_ebiten
train
go,go
be6e8a3e1239417d49611acf5e01a42690c1ebdc
diff --git a/src/location-transformer.js b/src/location-transformer.js index <HASH>..<HASH> 100644 --- a/src/location-transformer.js +++ b/src/location-transformer.js @@ -4,7 +4,7 @@ import { find } from './utils.js' import calculateWeeklyLevels from './weekly-levels-calculator' // centralized for whenever we implement #16 -const somethingIsWrong = () => undefined +const somethingIsWrong = () => {} const isVersion = (date, version) => { const momentDate = moment().isoWeekYear(date.year).isoWeek(date.week).isoWeekday(1).startOf('day')
refactor: use more idiomatic version of noop
fielded_angular-nav-thresholds
train
js
54246a656f44be806640f3fc7cb8799ecbd76e26
diff --git a/src/Dependency.php b/src/Dependency.php index <HASH>..<HASH> 100644 --- a/src/Dependency.php +++ b/src/Dependency.php @@ -52,7 +52,7 @@ use SimpleComplex\Utils\Exception\ContainerRuntimeException; * - cache-broker * - config * - logger - * - inspector + * - inspect * - locale * - validator *
Inspect dependency injection container ID renamed to 'inspect'; from 'inspector'.
simplecomplex_php-utils
train
php
b7a70bd880efe7eac2d354c944a902ee41e48400
diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index <HASH>..<HASH> 100644 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -100,8 +100,8 @@ class AppController extends BaseController $patchOptions = $this->{$this->name}->enablePrimaryKeyAccess(); $entity = $this->{$this->name}->patchEntity($entity, $this->request->data, $patchOptions); if ($this->{$this->name}->save($entity)) { - if ($this->_hasUpload() && !$this->_isInValidUpload()) { - $this->_upload($entity); + foreach ($this->_getCsvUploadFields() as $field) { + $this->_upload($entity, $field); } $this->Flash->success(__('The record has been saved.')); return $this->redirect(['action' => 'view', $id]);
Same as add action (task #<I>)
QoboLtd_cakephp-csv-migrations
train
php
11e55be636907e537e9ab4769a55d115a9e42b89
diff --git a/lib/expeditor/command.rb b/lib/expeditor/command.rb index <HASH>..<HASH> 100644 --- a/lib/expeditor/command.rb +++ b/lib/expeditor/command.rb @@ -65,7 +65,7 @@ module Expeditor def wait raise NotStartedError if not started? @normal_future.wait - @fallback_var.wait if @fallback_var + @fallback_var.wait if @fallback_var && @service.fallback_enabled? end # command.on_complete do |success, value, reason|
Do not wait fallback in Command#wait when fallback_enabled is false
cookpad_expeditor
train
rb
ed093da9c5b34523401605bbfd6bc6ab2121187e
diff --git a/lib/upgrader.js b/lib/upgrader.js index <HASH>..<HASH> 100644 --- a/lib/upgrader.js +++ b/lib/upgrader.js @@ -97,7 +97,7 @@ var upgradePerson = function(person, callback) { var start = url.indexOf("/" + person.preferredUsername + "/"); return url.substr(start + 1); }, - slug = urlToSlug(person, person.image.url); + slug; // Automated update from v0.2.x, which had no thumbnailing of images // This checks for local persons with no "width" in their image @@ -105,6 +105,8 @@ var upgradePerson = function(person, callback) { if (person._user && _.isObject(person.image) && !_.has(person.image, "width")) { + slug = urlToSlug(person, person.image.url); + Step( function() { fs.stat(path.join(Image.uploadDir, slug), this);
Move the urlToSlug call down till we know there is one.
pump-io_pump.io
train
js
03b7d29e9e7005d5c6922fa66d9e5e35cd17e74f
diff --git a/main/core/Manager/ResourceManager.php b/main/core/Manager/ResourceManager.php index <HASH>..<HASH> 100644 --- a/main/core/Manager/ResourceManager.php +++ b/main/core/Manager/ResourceManager.php @@ -254,6 +254,8 @@ class ResourceManager []; $this->dispatcher->dispatch('log', 'Log\LogResourceCreate', [$node, $usersToNotify]); + $this->dispatcher->dispatch('log', 'Log\LogResourcePublish', [$node, $usersToNotify]); + $this->om->endFlushSuite(); return $resource; @@ -854,6 +856,12 @@ class ResourceManager $eventName = "publication_change_{$node->getResourceType()->getName()}"; $resource = $this->getResourceFromNode($node); $this->dispatcher->dispatch($eventName, 'PublicationChange', [$resource]); + + $usersToNotify = $node->getWorkspace() ? + $this->container->get('claroline.manager.user_manager')->getUsersByWorkspaces([$node->getWorkspace()], null, null, false) : + []; + + $this->dispatcher->dispatch('log', 'Log\LogResourcePublish', [$node, $usersToNotify]); } $this->om->flush();
[CoreBundle] Publication event trigger by resource creations and multiple publications (#<I>)
claroline_Distribution
train
php
3471b51a3ac666c0632ecc3349e714d3ed1a386b
diff --git a/lib/tracker_api/resources/epic.rb b/lib/tracker_api/resources/epic.rb index <HASH>..<HASH> 100644 --- a/lib/tracker_api/resources/epic.rb +++ b/lib/tracker_api/resources/epic.rb @@ -3,10 +3,15 @@ module TrackerApi class Epic include Shared::HasId + attribute :comment_ids, Array[Integer] + attribute :comments, Array[Comment] attribute :created_at, DateTime attribute :description, String + attribute :follower_ids, Array[Integer] + attribute :followers, Array[Person] attribute :kind, String attribute :label, Label + attribute :label_id, Integer attribute :name, String attribute :project_id, Integer attribute :updated_at, DateTime diff --git a/lib/tracker_api/resources/story.rb b/lib/tracker_api/resources/story.rb index <HASH>..<HASH> 100644 --- a/lib/tracker_api/resources/story.rb +++ b/lib/tracker_api/resources/story.rb @@ -15,6 +15,7 @@ module TrackerApi attribute :estimate, Float attribute :external_id, String attribute :follower_ids, Array[Integer] + attribute :followers, Array[Person] attribute :integration_id, Integer attribute :kind, String attribute :label_ids, Array[Integer]
Added the ability to eagerly load comments and followers for epics using the fields param.
dashofcode_tracker_api
train
rb,rb
4a276534cd9c1834480b324c3b2b8d7bf33d3714
diff --git a/core/codegen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java b/core/codegen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java index <HASH>..<HASH> 100644 --- a/core/codegen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java +++ b/core/codegen/src/main/java/org/overture/codegen/vdm2java/JavaFormat.java @@ -596,7 +596,7 @@ public class JavaFormat || parent instanceof AAddrEqualsBinaryExpCG || parent instanceof AAddrNotEqualsBinaryExpCG || cloneNotNeededCollectionOperator(parent) - || isCallToUtil(parent); + || cloneNotNeededUtilCall(parent); } private boolean cloneNotNeededCollectionOperator(INode parent) @@ -606,7 +606,7 @@ public class JavaFormat || parent instanceof AHeadUnaryExpCG; } - private boolean isCallToUtil(INode node) + private boolean cloneNotNeededUtilCall(INode node) { if(!(node instanceof AApplyExpCG)) return false;
Minor change: Method name did not reflect its function
overturetool_overture
train
java
da87d182784bec5f89bb8d59e08a8cfcff9aeae9
diff --git a/src/Cache.php b/src/Cache.php index <HASH>..<HASH> 100755 --- a/src/Cache.php +++ b/src/Cache.php @@ -42,6 +42,7 @@ class Cache extends AbstractResult "timeout" => static::DAY, "limit" => 10000, "directories" => 3, + "permissions" => 0777, ]); $this->sql = $options["sql"]; @@ -70,7 +71,7 @@ class Cache extends AbstractResult # Ensure a cache directory exists for this query if (!is_dir($this->dir)) { - mkdir($this->dir, 0775, true); + mkdir($this->dir, $options["permissions"], true); } # If cache doesn't exist for this query then create it now
Default the cache permissions to world-writable But allow it to be overridden
duncan3dc_sql-class
train
php
2233790457df59c9fe513c4372d810c74969ca6c
diff --git a/src/pyws/functions/__init__.py b/src/pyws/functions/__init__.py index <HASH>..<HASH> 100644 --- a/src/pyws/functions/__init__.py +++ b/src/pyws/functions/__init__.py @@ -1,4 +1,5 @@ -#noinspection PyUnresolvedReferences +from inspect import getargspec + from pyws.functions.args import DictOf, TypeFactory from pyws.utils import cached_property @@ -106,7 +107,8 @@ class NativeFunctionAdapter(Function): >>> a(context=None) >>> def add(a, b): - ... return a + b + ... c = a + b + ... return c >>> a = NativeFunctionAdapter(add, name='concat') >>> a.name @@ -153,7 +155,7 @@ class NativeFunctionAdapter(Function): self.needs_context = needs_context # Get argument names from origin - arg_names = [(x, ) for x in self.origin.func_code.co_varnames + arg_names = [(x, ) for x in getargspec(origin)[0] if not needs_context or x != CONTEXT_ARG_NAME] # Get argument types
function arguments are inferred correctly, if they are not specified, issue #<I>
stepank_pyws
train
py
c8b323832ec73bc4d86a4307ca0c9b4d3fd92dc4
diff --git a/metric_tank/aggmetric.go b/metric_tank/aggmetric.go index <HASH>..<HASH> 100644 --- a/metric_tank/aggmetric.go +++ b/metric_tank/aggmetric.go @@ -280,7 +280,7 @@ func (a *AggMetric) Add(ts uint32, val float64) { if currentChunk.Saved { //TODO(awoods): allow the chunk to be re-opened. - log.Error(3, "cant write to chunk that has already been saved.", nil) + log.Error(3, "cant write to chunk that has already been saved. %s T0:%d", a.Key, currentChunk.T0) return } // last prior data was in same chunk as new point @@ -333,7 +333,7 @@ func (a *AggMetric) GC(minTs uint32) bool { } } // chunk has not been written to in a while. Lets persist it. - log.Info("Found stale Chunk, persisting it to Cassandra.") + log.Info("Found stale Chunk, persisting it to Cassandra. key: %s T0: %d", a.Key, currentChunk.T0) currentChunk.Finish() a.Persist(currentChunk) }
log the metric key and T0 when GC persists chunk
grafana_metrictank
train
go
0ed4ff25df77688894e5755f901f5726e21c49af
diff --git a/src/Illuminate/Foundation/Testing/TestCase.php b/src/Illuminate/Foundation/Testing/TestCase.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Foundation/Testing/TestCase.php +++ b/src/Illuminate/Foundation/Testing/TestCase.php @@ -4,6 +4,7 @@ namespace Illuminate\Foundation\Testing; use Mockery; use PHPUnit_Framework_TestCase; +use Illuminate\Support\Facades\Facade; abstract class TestCase extends PHPUnit_Framework_TestCase { @@ -70,6 +71,8 @@ abstract class TestCase extends PHPUnit_Framework_TestCase call_user_func($callback); } + Facade::clearResolvedInstances(); + $this->setUpHasRun = true; }
Clear facades before running each test.
laravel_framework
train
php
188b439b25dbe020977761cc719efaf452e79423
diff --git a/spacy/language_data/punctuation.py b/spacy/language_data/punctuation.py index <HASH>..<HASH> 100644 --- a/spacy/language_data/punctuation.py +++ b/spacy/language_data/punctuation.py @@ -25,7 +25,7 @@ _QUOTES = r""" _PUNCT = r""" … , : ; \! \? ¿ ¡ \( \) \[ \] \{ \} < > _ # \* & -。? ! , 、 ; : ~ +。 ? ! , 、 ; : ~ """
Add Chinese punctuation Add Chinese punctuation.
explosion_spaCy
train
py
6591f284cbcc407d2d1bbe1df3aba0b0d21923ff
diff --git a/src/bandersnatch/tests/test_utils.py b/src/bandersnatch/tests/test_utils.py index <HASH>..<HASH> 100644 --- a/src/bandersnatch/tests/test_utils.py +++ b/src/bandersnatch/tests/test_utils.py @@ -95,4 +95,14 @@ def test_unlink_parent_dir(): def test_user_agent(): - assert re.match(r"bandersnatch/[0-9]\.[0-9]\.[0-9] \(.*\)", user_agent()) + assert re.match( + r"bandersnatch/[0-9]\.[0-9]\.[0-9]\.?d?e?v?[0-9]? \(.*\)", user_agent() + ) + + +def test_user_agent_async(): + async_ver = "aiohttp 0.6.9" + assert re.match( + fr"bandersnatch/[0-9]\.[0-9]\.[0-9]\.?d?e?v?[0-9]? \(.*\) \({async_ver}\)", + user_agent(async_ver), + )
Allow devX versions + test asyncio user agent
pypa_bandersnatch
train
py
d311ba4c1857d9579629623b8a48d6158c92cc2d
diff --git a/metapipe/parser.py b/metapipe/parser.py index <HASH>..<HASH> 100644 --- a/metapipe/parser.py +++ b/metapipe/parser.py @@ -1,7 +1,10 @@ """ A parser and other parser related classes. """ -from lexer import Token - +try: + from metapipe.lexer import Token # Python3 +except ImportError: + from lexer import Token + class Parser(object):
Fixes Python2/3 compatability.
TorkamaniLab_metapipe
train
py
c4214ca3ae89899f76f40760b1402536b178143e
diff --git a/tests/preProcessor_test.py b/tests/preProcessor_test.py index <HASH>..<HASH> 100644 --- a/tests/preProcessor_test.py +++ b/tests/preProcessor_test.py @@ -92,13 +92,13 @@ class TTFPreProcessorTest: assert (glyphSets1["a"][0][0].y - glyphSets0["a"][0][0].y) == 10 def test_custom_filters_as_argument(self, FontClass): + from ufo2ft.filters import RemoveOverlapsFilter, TransformationsFilter + ufo1 = FontClass(getpath("TestFont.ufo")) ufo2 = FontClass(getpath("TestFont.ufo")) - filter1 = loadFilterFromString("RemoveOverlapsFilter(backend='pathops')") - filter2 = loadFilterFromString( - "TransformationsFilter(OffsetY=-200, include=['d'], pre=True)" - ) - filter3 = loadFilterFromString("TransformationsFilter(OffsetX=10)") + filter1 = RemoveOverlapsFilter(backend="pathops") + filter2 = TransformationsFilter(include=["d"], pre=True, OffsetY=-200) + filter3 = TransformationsFilter(OffsetX=10) glyphSets0 = TTFPreProcessor( ufo1, filters=[filter1, filter2, filter3]
tests: load filter directly instead of loadFilterFromString
googlefonts_ufo2ft
train
py
5acd02a3755cfc62c132d322c0d8e97f368f2a15
diff --git a/src/bindings/gaiabuild/serialize.js b/src/bindings/gaiabuild/serialize.js index <HASH>..<HASH> 100644 --- a/src/bindings/gaiabuild/serialize.js +++ b/src/bindings/gaiabuild/serialize.js @@ -43,12 +43,12 @@ function serializeEntries(lang, langEntries, sourceEntries) { return [errors, entries]; } -function extend(into, from) { - for (let key in from) { +function extend(target, source) { + for (let key in source) { // overwrite existing keys for reduceRight - into[key] = from[key]; + target[key] = source[key]; } - return into; + return target; } function resolvesToString(entity) {
Use target and source as arg names in extend()
l20n_l20n.js
train
js
db6f7fa4412bd62e02293364833914564a461133
diff --git a/SingularityBase/src/main/java/com/hubspot/singularity/ExtendedTaskState.java b/SingularityBase/src/main/java/com/hubspot/singularity/ExtendedTaskState.java index <HASH>..<HASH> 100644 --- a/SingularityBase/src/main/java/com/hubspot/singularity/ExtendedTaskState.java +++ b/SingularityBase/src/main/java/com/hubspot/singularity/ExtendedTaskState.java @@ -24,6 +24,12 @@ public enum ExtendedTaskState { map.put(extendedTaskState.toTaskState().get(), extendedTaskState); } } + + for (TaskState t : TaskState.values()) { + if (map.get(t) == null) { + throw new IllegalStateException("No ExtendedTaskState provided for TaskState " + t); + } + } } private final String displayName; @@ -58,7 +64,7 @@ public enum ExtendedTaskState { public static ExtendedTaskState fromTaskState(TaskState taskState) { ExtendedTaskState extendedTaskState = map.get(taskState); - Preconditions.checkArgument(extendedTaskState != null); + Preconditions.checkArgument(extendedTaskState != null, "No ExtendedTaskState for TaskState %s", taskState); return extendedTaskState; }
Improve ExtendedTaskState: verify on startup that every possible TaskState has a map entry Improve error message should this somehow fail (right now it is "IllegalArgumentException: null" Note that this causes tests to fail as we are missing the 'TASK_ERROR' state.
HubSpot_Singularity
train
java
ce7d70de082c9ba9bb5b3295b28f0490b72a5cf6
diff --git a/src/main/java/org/dasein/cloud/google/network/LoadBalancerSupport.java b/src/main/java/org/dasein/cloud/google/network/LoadBalancerSupport.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/dasein/cloud/google/network/LoadBalancerSupport.java +++ b/src/main/java/org/dasein/cloud/google/network/LoadBalancerSupport.java @@ -904,11 +904,13 @@ public class LoadBalancerSupport extends AbstractLoadBalancerSupport<Google> { while (loadBalancers.hasNext()) { TargetPool lb = loadBalancers.next(); List<String> healthChecks = lb.getHealthChecks(); - if (null != healthChecks) { + if (null == healthChecks) { + list.add(new ResourceStatus(lb.getName(), "UNKNOWN")); + } else { for (String healthCheckName : healthChecks) { healthCheckName = healthCheckName.substring(healthCheckName.lastIndexOf("/") + 1); LoadBalancerHealthCheck healthCheck = getLoadBalancerHealthCheck(healthCheckName); - list.add(new ResourceStatus(lb.getName(), "UNKNOWN")); + list.add(new ResourceStatus(lb.getName(), "UNKNOWN")); // TODO: (Roger)work out the proper status for this. check 0,1, and many loadbalancer cases } } }
better fix, found in develop, somehow never made it here...
dasein-cloud_dasein-cloud-google
train
java
c76756cd701b19c574993d73d932c91054b65d16
diff --git a/kernel/classes/workflowtypes/event/ezmultiplexer/ezmultiplexertype.php b/kernel/classes/workflowtypes/event/ezmultiplexer/ezmultiplexertype.php index <HASH>..<HASH> 100644 --- a/kernel/classes/workflowtypes/event/ezmultiplexer/ezmultiplexertype.php +++ b/kernel/classes/workflowtypes/event/ezmultiplexer/ezmultiplexertype.php @@ -135,8 +135,15 @@ class eZMultiplexerType extends eZWorkflowEventType case 'usergroups': { - $groups = eZPersistentObject::fetchObjectList( eZContentObject::definition(), array( 'id', 'name' ), - array( 'contentclass_id' => 3 ), null, null, false ); + $groups = eZPersistentObject::fetchObjectList( + eZContentObject::definition(), + array( 'id', 'name' ), + array( 'contentclass_id' => 3, 'status' => eZContentObject::STATUS_PUBLISHED ), + null, + null, + false + ); + foreach ( $groups as $key => $group ) { $groups[$key]['Name'] = $group['name'];
Fix EZP-<I>: Only show published users in multiplexer edit
ezsystems_ezpublish-legacy
train
php
516f7d27328b109c7efe01260603cc4eb8c3908c
diff --git a/core/src/main/java/com/github/gumtreediff/tree/TreeMetrics.java b/core/src/main/java/com/github/gumtreediff/tree/TreeMetrics.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/github/gumtreediff/tree/TreeMetrics.java +++ b/core/src/main/java/com/github/gumtreediff/tree/TreeMetrics.java @@ -20,17 +20,41 @@ package com.github.gumtreediff.tree; +/** + * Class containing several metrics information regarding a node of an AST. + * The metrics are immutables but lazily computed. + * + * @see Tree#getMetrics() + */ public class TreeMetrics { + /** + * The number of nodes in the subtree rooted at the node. + */ public final int size; + /** + * The size of the longer branch in the subtree rooted at the node. + */ public final int height; + /** + * The hashcode of the subtree rooted at the node. + */ public final int hash; + /** + * The hashcode of the subtree rooted at the node, excluding labels. + */ public final int structureHash; + /** + * The number of ancestors of a node. + */ public final int depth; + /** + * An absolute position for the node. Usually computed via the postfix order. + */ public final int position; public TreeMetrics(int size, int height, int hash, int structureHash, int depth, int position) {
doc-feat: documented treemetrics.
GumTreeDiff_gumtree
train
java
e026a853d0df6936d587c636d2bcb434e267fef3
diff --git a/trimesh/resources/__init__.py b/trimesh/resources/__init__.py index <HASH>..<HASH> 100644 --- a/trimesh/resources/__init__.py +++ b/trimesh/resources/__init__.py @@ -1,6 +1,8 @@ import os import json +from ..util import decode_text + # find the current absolute path to this directory _pwd = os.path.expanduser(os.path.abspath( os.path.dirname(__file__))) @@ -38,8 +40,9 @@ def get(name, decode=True, decode_json=False): resource = f.read() # make sure we return it as a string if asked - if decode and hasattr(resource, 'decode'): - resource = resource.decode('utf-8') + if decode: + # will decode into text if possibly + resource = docode_text(resource) if decode_json: resource = json.loads(resource) @@ -71,6 +74,6 @@ def get_schema(name): os.path.join(_pwd, 'schema', name)) # recursively load $ref keys schema = resolve( - json.loads(resolver.get(name)), + json.loads(decode_text(resolver.get(name))), resolver=resolver) return schema
fix json-needs-string-not-bytes issue for Python <I>
mikedh_trimesh
train
py
aae509b82eaca0bada27cb168473c78b916f89ab
diff --git a/src/Symfony/Component/VarDumper/Tests/Command/ServerDumpCommandTest.php b/src/Symfony/Component/VarDumper/Tests/Command/ServerDumpCommandTest.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/VarDumper/Tests/Command/ServerDumpCommandTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Command/ServerDumpCommandTest.php @@ -14,6 +14,10 @@ class ServerDumpCommandTest extends TestCase */ public function testComplete(array $input, array $expectedSuggestions) { + if (!class_exists(CommandCompletionTester::class)) { + $this->markTestSkipped('Test command completion requires symfony/console 5.4+.'); + } + $tester = new CommandCompletionTester($this->createCommand()); $this->assertSame($expectedSuggestions, $tester->complete($input));
skip command completion tests with older Symfony Console versions
symfony_symfony
train
php
1fc55c2bb9bce1451d6199e8aaa23ef8baa0e46c
diff --git a/runtime_test.go b/runtime_test.go index <HASH>..<HASH> 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -21,10 +21,10 @@ func nuke(runtime *Runtime) error { var wg sync.WaitGroup for _, container := range runtime.List() { wg.Add(1) - go func() { - container.Kill() + go func(c *Container) { + c.Kill() wg.Add(-1) - }() + }(container) } wg.Wait() return os.RemoveAll(runtime.root)
kill the right containers in runtime_test
moby_moby
train
go
afc9ddca78301e5c5cbb3121d29f92d790a5e486
diff --git a/freezegun/api.py b/freezegun/api.py index <HASH>..<HASH> 100644 --- a/freezegun/api.py +++ b/freezegun/api.py @@ -616,6 +616,7 @@ def freeze_time(time_to_freeze=None, tz_offset=0, ignore=None, tick=False, as_ar if ignore is None: ignore = [] + ignore.append('nose.plugins') ignore.append('six.moves') ignore.append('django.utils.six.moves') ignore.append('google.gax')
ignore nose plugins to prevent test timing issues
spulec_freezegun
train
py
7a3ee4fa43cc266c17a1d99e91c7a912daf2e338
diff --git a/src/Context/JsonRpcClientContext.php b/src/Context/JsonRpcClientContext.php index <HASH>..<HASH> 100644 --- a/src/Context/JsonRpcClientContext.php +++ b/src/Context/JsonRpcClientContext.php @@ -292,7 +292,7 @@ class JsonRpcClientContext implements JsonRpcClientAwareContext * @param string|integer $id * @param string $message * - * @Then /^(?:the )?response should be error with id "([^"]+)", message "([^"]+)"$/ + * @Then /^(?:the )?response should be error with id "([^"]+)", message "(.+)"$/ */ public function theResponseShouldContainErrorWithMessage($id, $message) { @@ -319,7 +319,7 @@ class JsonRpcClientContext implements JsonRpcClientAwareContext * @param string $message * @param TableNode $table * - * @Then /^(?:the )?response should be error with id "([^"]+)", message "([^"]+)", data:$/ + * @Then /^(?:the )?response should be error with id "([^"]+)", message "(.+)", data:$/ */ public function theResponseShouldContainErrorData($id, $message, TableNode $table) {
Fix the pattern for control error message. The problem: We can not check error message, if message have a double quotes. Solution: Change pattern mask. Example: Then the response should be error with id "<I>", message "The user "t.repak" is removed." Then the response should be error with id "<I>", message "The user "t.repak" is removed.", data:
f1nder_BehatJsonRpcExtension
train
php
b2342866c9835485c667216b309b089da6d73ca0
diff --git a/command/ui_output.go b/command/ui_output.go index <HASH>..<HASH> 100644 --- a/command/ui_output.go +++ b/command/ui_output.go @@ -1,6 +1,8 @@ package command import ( + "sync" + "github.com/mitchellh/cli" "github.com/mitchellh/colorstring" ) @@ -9,7 +11,18 @@ import ( type UIOutput struct { Colorize *colorstring.Colorize Ui cli.Ui + + once sync.Once + ui cli.Ui } func (u *UIOutput) Output(v string) { + u.once.Do(u.init) + u.ui.Output(v) +} + +func (u *UIOutput) init() { + // Wrap the ui so that it is safe for concurrency regardless of the + // underlying reader/writer that is in place. + u.ui = &cli.ConcurrentUi{Ui: u.Ui} }
command: UIOutput is functinal
hashicorp_terraform
train
go
f2c4274002aeea64f6547a99872749192d7803e1
diff --git a/application/libraries/Seeder.php b/application/libraries/Seeder.php index <HASH>..<HASH> 100644 --- a/application/libraries/Seeder.php +++ b/application/libraries/Seeder.php @@ -14,6 +14,7 @@ class Seeder protected $db; protected $dbforge; protected $seedPath; + protected $depends = []; public function __construct() { @@ -29,7 +30,7 @@ class Seeder * * @param string $seeder Seeder classname */ - public function call($seeder) + public function call($seeder, $call_depends = true) { if ($this->seedPath === null) { @@ -37,6 +38,9 @@ class Seeder } $obj = $this->loadSeeder($seeder); + if ($call_depends === true && $obj instanceof Seeder) { + $obj->callDepends($this->seedPath); + } $obj->run(); } @@ -55,6 +59,24 @@ class Seeder } /** + * Call depend seeder list + * + * @param string $seedPath + */ + public function callDepends($seedPath) + { + foreach ($this->depends as $path => $seeders) { + $this->seedPath = $seedPath; + if (is_string($path)) { + $this->setPath($path); + } + + $this->callDepend($seeders); + } + $this->setPath($seedPath); + } + + /** * Call depend seeder * * @param string|array $seederName
feat: add call depends seeder list method
kenjis_ci-phpunit-test
train
php
9d3cfeeefc89291a700addbbfbaf5f931771a93c
diff --git a/holoviews/core/dimension.py b/holoviews/core/dimension.py index <HASH>..<HASH> 100644 --- a/holoviews/core/dimension.py +++ b/holoviews/core/dimension.py @@ -661,7 +661,12 @@ class Dimensioned(LabelledData): if not all(isinstance(v, dict) for v in kwargs.values()): raise Exception("The %s options must be specified using dictionary groups" % ','.join(repr(k) for k in kwargs.keys())) - identifier = '%s.%s' % (self.__class__.__name__, sanitize_identifier(self.group)) + + sanitized_group = sanitize_identifier(self.group) + if sanitized_group != self.__class__.__name__: + identifier = '%s.%s' % (self.__class__.__name__, sanitized_group) + else: + identifier = self.__class__.__name__ identifier += ('.%s' % sanitize_identifier(self.label)) if self.label else '' kwargs = {k:{identifier:v} for k,v in kwargs.items()} deep_clone = self.map(lambda x: x.clone(id=x.id))
The __call__ method now specifies group string in options if necessary This prevents over specific option matching (e.g 'Image.Image' instead of just 'Image') when the group isn't set. This prevents ``__call__`` from always take precedence over the %%opts magic.
pyviz_holoviews
train
py
83e82012e1e701ef79d1900e658ca0eb95e4b17a
diff --git a/pnc-ui/app/app.js b/pnc-ui/app/app.js index <HASH>..<HASH> 100644 --- a/pnc-ui/app/app.js +++ b/pnc-ui/app/app.js @@ -29,7 +29,6 @@ 'pnc.record', 'pnc.configuration-set', 'pnc.websockets', - 'pnc.environment', 'pnc.milestone' ]);
[NCL-<I>] UI throws exception and doesn't load
project-ncl_pnc
train
js
8b418da9a7697678f91937404846d23d7605d860
diff --git a/tests/core/tests/resources_tests.py b/tests/core/tests/resources_tests.py index <HASH>..<HASH> 100644 --- a/tests/core/tests/resources_tests.py +++ b/tests/core/tests/resources_tests.py @@ -715,6 +715,27 @@ class PostgresTests(TransactionTestCase): except IntegrityError: self.fail('IntegrityError was raised.') + def test_collect_failed_rows(self): + resource = ProfileResource() + headers = ['id', 'user'] + # 'user' is a required field, the database will raise an error. + row = [None, None] + dataset = tablib.Dataset(row, headers=headers) + result = resource.import_data( + dataset, dry_run=True, use_transactions=True, + collect_failed_rows=True, + ) + self.assertEqual( + result.failed_dataset.headers, + [u'id', u'user', u'Error'] + ) + self.assertEqual(len(result.failed_dataset), 1) + self.assertEqual(len(result.failed_dataset), 1) + self.assertEqual( + result.failed_dataset.dict[0]['Error'], + 'NOT NULL constraint failed: core_profile.user_id' + ) + if VERSION >= (1, 8) and 'postgresql' in settings.DATABASES['default']['ENGINE']: from django.contrib.postgres.fields import ArrayField
Add test written by bmihelac at a<I>b9f0
django-import-export_django-import-export
train
py
11cc5042ebdc13e192d8137bd649c2ae6ce8d39b
diff --git a/src/main/java/net/wasdev/wlp/common/springboot/util/SpringBootManifest.java b/src/main/java/net/wasdev/wlp/common/springboot/util/SpringBootManifest.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/wasdev/wlp/common/springboot/util/SpringBootManifest.java +++ b/src/main/java/net/wasdev/wlp/common/springboot/util/SpringBootManifest.java @@ -25,6 +25,9 @@ public class SpringBootManifest { enum SpringLauncher { JarLauncher("JarLauncher", "BOOT-INF/lib/", "BOOT-INF/classes/"), WarLauncher("WarLauncher", "WEB-INF/lib/", "WEB-INF/classes/"); + private String name; + private String libDefault; + private String classesDefault; private SpringLauncher(String name, String libDefault, String classesDefault) { this.name = name; @@ -32,15 +35,11 @@ public class SpringBootManifest { this.classesDefault = classesDefault; } - private String name; - private String libDefault; - private String classesDefault; - static SpringLauncher fromMainClass(String mainClass) { if (mainClass != null) { - mainClass = mainClass.trim(); + String mClass = mainClass.trim(); for (SpringLauncher l : SpringLauncher.values()) { - if (mainClass.endsWith(l.name)) { + if (mClass.endsWith(l.name)) { return l; } }
Refactored according to codacy
WASdev_ci.common
train
java
cb2a320a787675268c13783eafea13dd5e400706
diff --git a/plugin/src/main/java/org/graylog/plugins/pipelineprocessor/db/mongodb/MongoDbRuleService.java b/plugin/src/main/java/org/graylog/plugins/pipelineprocessor/db/mongodb/MongoDbRuleService.java index <HASH>..<HASH> 100644 --- a/plugin/src/main/java/org/graylog/plugins/pipelineprocessor/db/mongodb/MongoDbRuleService.java +++ b/plugin/src/main/java/org/graylog/plugins/pipelineprocessor/db/mongodb/MongoDbRuleService.java @@ -16,6 +16,7 @@ */ package org.graylog.plugins.pipelineprocessor.db.mongodb; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Sets; import com.mongodb.BasicDBObject; import com.mongodb.MongoException; @@ -74,8 +75,8 @@ public class MongoDbRuleService implements RuleService { @Override public Collection<RuleDao> loadAll() { try { - final DBCursor<RuleDao> ruleDaos = dbCollection.find(); - return Sets.newHashSet(ruleDaos.iterator()); + final DBCursor<RuleDao> ruleDaos = dbCollection.find().sort(DBSort.asc("title")); + return ruleDaos.toArray(); } catch (MongoException e) { log.error("Unable to load processing rules", e); return Collections.emptySet();
Sort alphabetically by title in MongoDbRuleService#loadAll() (#<I>) The previous implementation returned an intransparent sorting of rules to the user. Users expect a stable sorting of rules, so we'll sort them alphabetically by title to get a stable sorting.
Graylog2_graylog-plugin-pipeline-processor
train
java
4fc0c00a831a5c925970245ee302c23051085034
diff --git a/spring-social-core/src/main/java/org/springframework/social/connect/UserProfile.java b/spring-social-core/src/main/java/org/springframework/social/connect/UserProfile.java index <HASH>..<HASH> 100644 --- a/spring-social-core/src/main/java/org/springframework/social/connect/UserProfile.java +++ b/spring-social-core/src/main/java/org/springframework/social/connect/UserProfile.java @@ -45,6 +45,29 @@ public class UserProfile implements Serializable { private final String username; + /** + * Creates an instance of a UserProfile. + * @param name The user's full name + * @param firstName The user's first name + * @param lastName The user's last name + * @param email The user's email address + * @param username The user's username + * @deprecated Use other constructor instead + */ + @Deprecated + public UserProfile(String name, String firstName, String lastName, String email, String username) { + this(null, name, firstName, lastName, email, username); + } + + /** + * Creates an instance of a UserProfile. + * @param id The user ID + * @param name The user's full name + * @param firstName The user's first name + * @param lastName The user's last name + * @param email The user's email address + * @param username The user's username + */ public UserProfile(String id, String name, String firstName, String lastName, String email, String username) { this.id = id; this.name = name;
Reintroduce constructor to UserProfile to preserve backward compatibility. See #<I>
spring-projects_spring-social
train
java
72cf88e37e95e788cdc8e9b496790ad8f1e2434f
diff --git a/src/numdifftools/tests/test_fornberg.py b/src/numdifftools/tests/test_fornberg.py index <HASH>..<HASH> 100644 --- a/src/numdifftools/tests/test_fornberg.py +++ b/src/numdifftools/tests/test_fornberg.py @@ -1,6 +1,6 @@ from __future__ import print_function -from hypothesis import given, example, note, settings, strategies as st +from hypothesis import given, note, settings, strategies as st from numpy.testing.utils import assert_allclose from numdifftools.example_functions import function_names, get_function @@ -58,7 +58,7 @@ def test_weights(): # print(name) n, m = name w, x = CENTRAL_WEIGHTS_AND_POINTS[name] - + assert len(w) == m weights = fd_weights(np.array(x, dtype=float), 0.0, n=n) assert_allclose(weights, w, atol=1e-15)
Removed obsolete import of example from hypothesis
pbrod_numdifftools
train
py
8331fc1be6691ee5a7ae5e20ab020907bfc317fe
diff --git a/jmx/src/main/java/org/jboss/as/jmx/PluggableMBeanServerImpl.java b/jmx/src/main/java/org/jboss/as/jmx/PluggableMBeanServerImpl.java index <HASH>..<HASH> 100644 --- a/jmx/src/main/java/org/jboss/as/jmx/PluggableMBeanServerImpl.java +++ b/jmx/src/main/java/org/jboss/as/jmx/PluggableMBeanServerImpl.java @@ -281,7 +281,8 @@ class PluggableMBeanServerImpl implements PluggableMBeanServer { } } } - return false; + // check if it's registered with the root (a.k.a platform) MBean server + return rootMBeanServer.isRegistered(name); } @Override
AS7-<I> Fix PluggableMBeanServerImpl#isRegistered() to take into account MBeans registered with the root MBeanServer was: <I>f<I>c<I>b2b<I>b<I>f1ee<I>e
wildfly_wildfly-core
train
java
6a273e4b6db66b58d5ce7931b64f3c1bec5dab77
diff --git a/src/dictionary.js b/src/dictionary.js index <HASH>..<HASH> 100644 --- a/src/dictionary.js +++ b/src/dictionary.js @@ -31,7 +31,7 @@ export default class Dictionary { } const dict = this.dictionary[locale].custom && this.dictionary[locale].custom[field]; - if (! dict) { + if (! dict || ! dict[key]) { return this.getMessage(locale, key); } diff --git a/src/validator.js b/src/validator.js index <HASH>..<HASH> 100644 --- a/src/validator.js +++ b/src/validator.js @@ -459,10 +459,14 @@ export default class Validator { const params = this._getLocalizedParams(rule, scope); // Defaults to english message. if (! this.dictionary.hasLocale(LOCALE)) { - return this.dictionary.getFieldMessage('en', field, rule.name)(name, params, data); + const msg = this.dictionary.getFieldMessage('en', field, rule.name); + + return isCallable(msg) ? msg(name, params, data) : msg; } - return this.dictionary.getFieldMessage(LOCALE, field, rule.name)(name, params, data); + const msg = this.dictionary.getFieldMessage(LOCALE, field, rule.name); + + return isCallable(msg) ? msg(name, params, data) : msg; } /**
messages don't have to be functions and fix dictionary fallback issues
baianat_vee-validate
train
js,js
7a8148a7bbd7aaa5e9e157118c824ab502f9b052
diff --git a/guava/src/com/google/common/cache/Cache.java b/guava/src/com/google/common/cache/Cache.java index <HASH>..<HASH> 100644 --- a/guava/src/com/google/common/cache/Cache.java +++ b/guava/src/com/google/common/cache/Cache.java @@ -137,6 +137,10 @@ public interface Cache<K, V> { /** * Returns a view of the entries stored in this cache as a thread-safe map. Modifications made to * the map directly affect the cache. + * + * <p>Iterators from the returned map are at least <i>weakly consistent</i>: they are safe for + * concurrent use, but if the cache is modified (including by eviction) after the iterator is + * created, it is undefined which of the changes (if any) will be reflected in that iterator. */ ConcurrentMap<K, V> asMap();
Promise at least weakly consistent iteration for asMap(). ------------- Created by MOE: <URL>
google_guava
train
java
7f02af5e1d1733ff9e5b42e1ce029cb18cb7dade
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -19,9 +19,8 @@ else: version = version_parts[0] elif len(version_parts) > 1: version = '-'.join(version_parts[:2]) - if environ.get('CI') != 'true': # no local version for CI - if version_parts[-1] == 'dirty': - version += '.dev' + if version_parts[-1] == 'dirty': + version += '.dev' setup(
doh. .dev is actually a public version cmoponent
dschep_ntfy
train
py
1079f533d16896d99b516c373aa3115b82a0d791
diff --git a/Generator/Readme.php b/Generator/Readme.php index <HASH>..<HASH> 100644 --- a/Generator/Readme.php +++ b/Generator/Readme.php @@ -2,6 +2,8 @@ namespace DrupalCodeBuilder\Generator; +use DrupalCodeBuilder\Definition\PropertyDefinition; + /** * Generator base class for module README file. * @@ -12,12 +14,15 @@ class Readme extends File { /** * {@inheritdoc} */ - public static function componentDataDefinition() { - return parent::componentDataDefinition() + [ - 'readable_name' => [ - 'acquired' => TRUE, - ], - ]; + public static function getPropertyDefinition(): PropertyDefinition { + $definition = parent::getPropertyDefinition(); + + $definition->addProperties([ + 'readable_name' => PropertyDefinition::create('string') + ->setAutoAcquiredFromRequester(), + ]); + + return $definition; } /**
Updated Readme generator to property definition.
drupal-code-builder_drupal-code-builder
train
php
daabd0c8c7c29ff8c5583d610056ea3c8ac91a3a
diff --git a/autotest/pst_tests.py b/autotest/pst_tests.py index <HASH>..<HASH> 100644 --- a/autotest/pst_tests.py +++ b/autotest/pst_tests.py @@ -975,9 +975,8 @@ def write2_nan_test(): pst.write("test.pst", version=2) pst = pyemu.Pst(os.path.join("test.pst")) - print(pst.control_data.nphinored) - return - + assert pst.control_data.nphinored == 1000 + pst = pyemu.Pst(os.path.join("pst", "pest.pst")) pyemu.helpers.zero_order_tikhonov(pst) pst.prior_information.loc[pst.prior_names[0], "weight"] = np.NaN
fix in pst when repeated read and write of v2, some kw args were getting revereted to default values
jtwhite79_pyemu
train
py
d1812e032c2ab3c0f17c038cb77f45f36e074cd4
diff --git a/lib/lwm2m-common.js b/lib/lwm2m-common.js index <HASH>..<HASH> 100644 --- a/lib/lwm2m-common.js +++ b/lib/lwm2m-common.js @@ -1245,6 +1245,7 @@ export class LwM2MObjectStore { repo: result, // toJSON() output cleaner: cleaner }; + this.emit(`/${objectId}`, null, 'backedUp', false); }); } restore(objectId) { @@ -1265,7 +1266,9 @@ export class LwM2MObjectStore { return Resource.from(entry.value).then(r => { this.repo[entry.uri] = r; }); - })); + })).then(() => { + this.emit(`/${objectId}`, null, 'restored', false); + }); }); } write(uri, /* any object */ value, /* boolean */ remote) {
Issue events associated with backup()/restore() functions
CANDY-LINE_node-red-contrib-lwm2m
train
js
b37520fb66bd5c6bccbbcf5e7ec233d39f70adf6
diff --git a/vcs/tests/test_workdirs.py b/vcs/tests/test_workdirs.py index <HASH>..<HASH> 100644 --- a/vcs/tests/test_workdirs.py +++ b/vcs/tests/test_workdirs.py @@ -72,8 +72,8 @@ class WorkdirTestCaseMixin(BackendTestMixin): foobranch_head = self.imc.commit(message='asd', author='john', branch='foobranch') # go back to the default branch self.repo.workdir.checkout_branch() - self.assertNotEqual(self.repo.workdir.get_branch(), 'foobranch') - self.assertNotEqual(self.repo.workdir.get_changeset(), foobranch_head) + self.assertEqual(self.repo.workdir.get_branch(), self.backend_class.DEFAULT_BRANCH_NAME) + self.assertEqual(self.repo.workdir.get_changeset(), self.tip) # checkout 'foobranch' self.repo.workdir.checkout_branch('foobranch') self.assertEqual(self.repo.workdir.get_branch(), 'foobranch')
'checkout_branch' tests: turned two assertNotEqual into assertEqual checks
codeinn_vcs
train
py
5cdc0002e9abb2463fffc962dadc3479f72d7486
diff --git a/certcrypto/crypto.go b/certcrypto/crypto.go index <HASH>..<HASH> 100644 --- a/certcrypto/crypto.go +++ b/certcrypto/crypto.go @@ -199,7 +199,10 @@ func ParsePEMCertificate(cert []byte) (*x509.Certificate, error) { } func ExtractDomains(cert *x509.Certificate) []string { - domains := []string{cert.Subject.CommonName} + var domains []string + if cert.Subject.CommonName != "" { + domains = append(domains, cert.Subject.CommonName) + } // Check for SAN certificate for _, sanDomain := range cert.DNSNames { @@ -213,7 +216,10 @@ func ExtractDomains(cert *x509.Certificate) []string { } func ExtractDomainsCSR(csr *x509.CertificateRequest) []string { - domains := []string{csr.Subject.CommonName} + var domains []string + if csr.Subject.CommonName != "" { + domains = append(domains, csr.Subject.CommonName) + } // loop over the SubjectAltName DNS names for _, sanName := range csr.DNSNames {
crypto: Treat CommonName as optional (#<I>)
go-acme_lego
train
go
fb3e4f61cbea2907f44a94030d7e6d305c4af08e
diff --git a/lib/simple_form/inputs/collection_input.rb b/lib/simple_form/inputs/collection_input.rb index <HASH>..<HASH> 100644 --- a/lib/simple_form/inputs/collection_input.rb +++ b/lib/simple_form/inputs/collection_input.rb @@ -66,10 +66,9 @@ module SimpleForm end def detect_common_display_methods(collection_classes = detect_collection_classes) - if collection_classes == [Symbol] - translate_collection - { :label => :first, :value => :last } - elsif collection_classes.include?(Array) + collection_translated = translate_collection if collection_classes == [Symbol] + + if collection_translated || collection_classes.include?(Array) { :label => :first, :value => :last } elsif collection_includes_basic_objects?(collection_classes) { :label => :to_s, :value => :to_s } @@ -92,7 +91,12 @@ module SimpleForm end def translate_collection - @collection = collection.map { |value| [translate(:options, value.to_s), value.to_s] } + if translated_collection = translate(:options) + @collection = collection.map do |key| + [translated_collection[key] || key, key] + end + true + end end end end
Avoid translating each key in the collection, just lookup once
plataformatec_simple_form
train
rb
562e9feb8abb72b431912fe35f40a6e9469daad5
diff --git a/fear_the_goblin.js b/fear_the_goblin.js index <HASH>..<HASH> 100644 --- a/fear_the_goblin.js +++ b/fear_the_goblin.js @@ -34,4 +34,25 @@ http.get("http://eventpoints.osweekends.com/api/events", function(res){ }); }).on('error', function(e){ console.log("Got an error: ", e); -}); \ No newline at end of file +}); + + +console.log("Let's have some fun with advance features!") +console.log("Fun with Lambda functions!") + +goblinDB.lambda.add({ + id: "testing-goblin", + category: ["data", "other-tag"], + description: "Optional details...", + action: function(argument, callback){ + console.log("This is from the Function storage in Goblin:"); + console.log("Current Argument:", argument); + callback("I can send data..."); + } +}) + +goblinDB.lambda.run("testing-goblin", "I love Goblin", function(arg){ + console.log("This is from the callback: Now Running the Callback..."); + console.log("This is from the Function storage in Goblin:", arg); +}) +
example improved now with lambda basics...
GoblinDBRocks_GoblinDB
train
js
daed75260903119f8f5dc8ee493778c50b1a6a8f
diff --git a/airflow/configuration.py b/airflow/configuration.py index <HASH>..<HASH> 100644 --- a/airflow/configuration.py +++ b/airflow/configuration.py @@ -41,10 +41,11 @@ from airflow.utils.module_loading import import_string log = logging.getLogger(__name__) # show Airflow's deprecation warnings -warnings.filterwarnings( - action='default', category=DeprecationWarning, module='airflow') -warnings.filterwarnings( - action='default', category=PendingDeprecationWarning, module='airflow') +if not sys.warnoptions: + warnings.filterwarnings( + action='default', category=DeprecationWarning, module='airflow') + warnings.filterwarnings( + action='default', category=PendingDeprecationWarning, module='airflow') def expand_env_var(env_var):
Make it possible to silence warnings from Airflow (#<I>) If we blindly set the warnings filter, it is _impossible_ to silence these warnings. This is the approach suggested in <URL>
apache_airflow
train
py
b5f8f758afff495963dfd50ea8d31839d773ab88
diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/BiojavaJmol.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/BiojavaJmol.java index <HASH>..<HASH> 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/BiojavaJmol.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/BiojavaJmol.java @@ -122,6 +122,7 @@ public class BiojavaJmol { /// COMBO BOXES Box hBox1 = Box.createHorizontalBox(); + hBox1.setMaximumSize(new Dimension(Short.MAX_VALUE,30)); String[] styles = new String[] { "Cartoon", "Backbone", "CPK", "Ball and Stick", "Ligands","Ligands and Pocket"}; @@ -143,7 +144,8 @@ public class BiojavaJmol { // Check boxes Box hBox2 = Box.createHorizontalBox(); - + hBox2.setMaximumSize(new Dimension(Short.MAX_VALUE,30)); + JButton resetDisplay = new JButton("Reset Display");
Fixing resizing problem in BiojavaJmol as in commit <I>f9
biojava_biojava
train
java
0d55b660e0c40bdd8eb72644173934e22bcd8738
diff --git a/lib/guard/interactor.rb b/lib/guard/interactor.rb index <HASH>..<HASH> 100644 --- a/lib/guard/interactor.rb +++ b/lib/guard/interactor.rb @@ -18,7 +18,7 @@ module Guard require 'guard/commands/show' def initialize - Pry::RC_FILES << '~/.guardrc' + Pry::RC_FILES.unshift '~/.guardrc' Pry.config.history.file = '~/.guard_history' Pry.config.prompt = [
Try to load ~/.guardrc first.
guard_guard
train
rb
e25bd13153e87e91289343f55b3ee8d3228fb7ac
diff --git a/log/log.go b/log/log.go index <HASH>..<HASH> 100644 --- a/log/log.go +++ b/log/log.go @@ -14,7 +14,7 @@ func SetOutWriter(writer io.Writer) { outWriter = writer } -var enableDebugLog = true +var enableDebugLog = false // SetEnableDebugLog ... func SetEnableDebugLog(enable bool) {
disable debug log by default (#<I>)
bitrise-io_go-utils
train
go
af7d2cb5964ac75a1e3c71ca62efba8b942a0a8e
diff --git a/consul/config.go b/consul/config.go index <HASH>..<HASH> 100644 --- a/consul/config.go +++ b/consul/config.go @@ -32,7 +32,6 @@ func init() { protocolVersionMap = map[uint8]uint8{ 1: 4, 2: 4, - 3: 5, } } diff --git a/consul/server.go b/consul/server.go index <HASH>..<HASH> 100644 --- a/consul/server.go +++ b/consul/server.go @@ -26,7 +26,7 @@ import ( // protocol versions. const ( ProtocolVersionMin uint8 = 1 - ProtocolVersionMax = 3 + ProtocolVersionMax = 2 ) const (
Bumps protocol version back down as we've made memberlist smarter.
hashicorp_consul
train
go,go
d383736bf8bf0780e3c1e293fb999358443311f1
diff --git a/client/lib/abtest/active-tests.js b/client/lib/abtest/active-tests.js index <HASH>..<HASH> 100644 --- a/client/lib/abtest/active-tests.js +++ b/client/lib/abtest/active-tests.js @@ -113,8 +113,8 @@ export default { inlineHelpWithContactForm: { datestamp: '20180306', variations: { - original: 90, - inlinecontact: 10, + original: 0, + inlinecontact: 100, }, defaultVariation: 'original', allowExistingUsers: true,
Inline Help: make the contact form available to all users (#<I>)
Automattic_wp-calypso
train
js
1b2e4c3d4efc0b6271d9e04fd14361ba85c0ed55
diff --git a/t/cmd/git-credential-lfstest.go b/t/cmd/git-credential-lfstest.go index <HASH>..<HASH> 100644 --- a/t/cmd/git-credential-lfstest.go +++ b/t/cmd/git-credential-lfstest.go @@ -118,6 +118,9 @@ func credsFromFilename(file string) (string, string, error) { return "", "", fmt.Errorf("Error opening %q: %s", file, err) } credsPieces := strings.SplitN(strings.TrimSpace(string(userPass)), ":", 2) + if len(credsPieces) != 2 { + return "", "", fmt.Errorf("Invalid data %q while reading %q", string(userPass), file) + } return credsPieces[0], credsPieces[1], nil }
t/cmd: make credential helper produce useful errors The credential helper can fail in some cases when it gets data that doesn't contain a colon. In such a case, make it print a useful error instead of panicking.
git-lfs_git-lfs
train
go
c6d61f9b43d89dc280b6089dee674daa8c180146
diff --git a/example/src/main/java/io/netty/example/http2/server/Http2ServerInitializer.java b/example/src/main/java/io/netty/example/http2/server/Http2ServerInitializer.java index <HASH>..<HASH> 100644 --- a/example/src/main/java/io/netty/example/http2/server/Http2ServerInitializer.java +++ b/example/src/main/java/io/netty/example/http2/server/Http2ServerInitializer.java @@ -70,7 +70,7 @@ public class Http2ServerInitializer extends ChannelInitializer<SocketChannel> { ch.pipeline().addLast(upgradeHandler); ch.pipeline().addLast(new SimpleChannelInboundHandler<HttpMessage>() { @Override - protected void messageReceived(ChannelHandlerContext ctx, HttpMessage msg) throws Exception { + protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception { // If this handler is hit then no upgrade has been attempted and the client is just talking HTTP. System.err.println("Directly talking: " + msg.protocolVersion() + " (no upgrade was attempted)"); ctx.pipeline().replace(this, "http-hello-world",
Fix merge issue introduced by <I>c0d<I> Motiviation: Interface changes between master and <I> branch resulted in a compile failure. Modifications: - change messageReceived to channelRead0 Result: No more compile error.
netty_netty
train
java
be977c133f691509517f44f8119a82c0b653144b
diff --git a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php @@ -1187,7 +1187,7 @@ class SQLServerPlatform extends AbstractPlatform // Even if the TOP n is very large, the use of a CTE will // allow the SQL Server query planner to optimize it so it doesn't // actually scan the entire range covered by the TOP clause. - $selectPattern = '/^(\s*SELECT\s+(?:DISTINCT|)\s*)(.*)$/i'; + $selectPattern = '/^(\s*SELECT\s+(?:DISTINCT)?\s*)(.*)$/i'; $replacePattern = sprintf('$1%s $2', "TOP $end"); $query = preg_replace($selectPattern, $replacePattern, $query);
Change (?:DISTINCT|) to (?:DISTINCT)?
doctrine_dbal
train
php
e2eaf19f4952db4a8218e297ff13e4d2b5f38f43
diff --git a/Spartacus/Database.py b/Spartacus/Database.py index <HASH>..<HASH> 100644 --- a/Spartacus/Database.py +++ b/Spartacus/Database.py @@ -1868,10 +1868,11 @@ class PostgreSQL(Generic): def Close(self, p_commit=True): try: if self.v_con: - if p_commit: - self.v_con.commit() - else: - self.v_con.rollback() + if self.v_con.async_ == 0: + if p_commit: + self.v_con.commit() + else: + self.v_con.rollback() if self.v_cur: self.v_cur.close() self.v_cur = None diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ long_description = open(os.path.join(rootdir, "README")).read() setup( name="Spartacus", - version="3.41", + version="3.42", description="Generic database wrapper", long_description=long_description, url="http://github.com/wind39/spartacus",
<I>: Fixed a bug in Close when in async mode
wind39_spartacus
train
py,py
5adceea7e983e7be221e6411b4b8aeedf264408a
diff --git a/system/src/Grav/Common/Data/Blueprint.php b/system/src/Grav/Common/Data/Blueprint.php index <HASH>..<HASH> 100644 --- a/system/src/Grav/Common/Data/Blueprint.php +++ b/system/src/Grav/Common/Data/Blueprint.php @@ -111,6 +111,18 @@ class Blueprint extends BlueprintForm } /** + * Return blueprint data schema. + * + * @return BlueprintSchema + */ + public function schema() + { + $this->initInternals(); + + return $this->blueprintSchema; + } + + /** * Initialize validator. */ protected function initInternals()
Add function to get direct access to blueprint schema
getgrav_grav
train
php
4c0b37146ef36ea5657ebc0d580bb09a54f0d687
diff --git a/tests/DiffMatchPatch/PerformanceTest.php b/tests/DiffMatchPatch/PerformanceTest.php index <HASH>..<HASH> 100644 --- a/tests/DiffMatchPatch/PerformanceTest.php +++ b/tests/DiffMatchPatch/PerformanceTest.php @@ -37,6 +37,11 @@ class PerformanceTest extends \PHPUnit_Framework_TestCase $text1 = file_get_contents(__DIR__ . '/fixtures/S_performance1.txt'); $text2 = file_get_contents(__DIR__ . '/fixtures/S_performance2.txt'); + // Warm up + $diff = new Diff(); + $diff->setTimeout(0); + $diff->main($text1, $text2); + $timeStart = microtime(1); $memoryStart = memory_get_usage(); @@ -60,6 +65,11 @@ class PerformanceTest extends \PHPUnit_Framework_TestCase $text2 = file_get_contents(__DIR__ . '/fixtures/S_performance2.txt'); $n = 20; + // Warm up + $diff = new Diff(); + $diff->setTimeout(0); + $diff->main($text1, $text2); + $timeStart = microtime(1); $memoryStart = memory_get_usage(); @@ -67,7 +77,6 @@ class PerformanceTest extends \PHPUnit_Framework_TestCase $diff = new Diff(); $diff->setTimeout(0); $diff->main($text1, $text2); - unset($diff); } $timeElapsed = microtime(1) - $timeStart;
Add a warm up to performance tests.
yetanotherape_diff-match-patch
train
php
3740511b1c7de65775bc9a8287e51304c51fff83
diff --git a/bundle/View/Builder/TagViewBuilder.php b/bundle/View/Builder/TagViewBuilder.php index <HASH>..<HASH> 100644 --- a/bundle/View/Builder/TagViewBuilder.php +++ b/bundle/View/Builder/TagViewBuilder.php @@ -73,7 +73,7 @@ class TagViewBuilder implements ViewBuilder */ public function matches($argument) { - return strpos($argument, 'eztags.controller.tag_view:') !== false; + return is_string($argument) && strpos($argument, 'eztags.controller.tag_view:') !== false; } /**
Controller can be a closure in TagViewBuilder
netgen_TagsBundle
train
php
fcd830d781ae5f42ef6dd59163db4b6138556e1a
diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php index <HASH>..<HASH> 100644 --- a/includes/functions/functions_print_lists.php +++ b/includes/functions/functions_print_lists.php @@ -819,7 +819,13 @@ function print_fam_table($datalist, $option='') { } echo '</td>'; //-- Event date (sortable)hidden by datatables code - echo '<td>', $marriage_date->JD(), '</td>'; + echo '<td>'; + if ($marriage_date->JD()) { + echo $marriage_date->JD(); + } else { + echo 0; + } + echo '</td>'; //-- Marriage anniversary echo '<td>'; $mage=WT_Date::GetAgeYears($mdate);
Fix: $marriage_date undefined
fisharebest_webtrees
train
php
2b8424c74895c6a8dbd3d7f2cc789dd1027d6e89
diff --git a/cqlengine/columns.py b/cqlengine/columns.py index <HASH>..<HASH> 100644 --- a/cqlengine/columns.py +++ b/cqlengine/columns.py @@ -313,6 +313,7 @@ class DateTime(Column): db_type = 'timestamp' def to_python(self, value): + if value is None: return if isinstance(value, datetime): return value elif isinstance(value, date): @@ -340,6 +341,7 @@ class Date(Column): def to_python(self, value): + if value is None: return if isinstance(value, datetime): return value.date() elif isinstance(value, date):
Added guards to handle None value in Date and DateTime column to_python conversion
cqlengine_cqlengine
train
py
c38f2af3ca485fc0a6c63c5e5f1a5f9d79c35223
diff --git a/app/models/article.rb b/app/models/article.rb index <HASH>..<HASH> 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -146,7 +146,7 @@ class Article < Content if user.notify_via_jabber? JabberNotify.send_message(user, "New post", "A new message was posted to #{blog.blog_name}", - content.body_html) + body_html) end end diff --git a/lib/jabber_notify.rb b/lib/jabber_notify.rb index <HASH>..<HASH> 100644 --- a/lib/jabber_notify.rb +++ b/lib/jabber_notify.rb @@ -3,6 +3,10 @@ require 'jabber4r/jabber4r' class JabberNotify @@jabber = nil + def self.logger + @@logger ||= RAILS_DEFAULT_LOGGER || Logger.new(STDOUT) + end + def self.send_message(user, subject, body, html) return if user.jabber.blank? @@ -22,11 +26,11 @@ class JabberNotify def self.session return @@jabber if @@jabber - address = this_blog.jabber_address + address = Blog.default.jabber_address unless address =~ /\// address = address + '/typo' end - @@jabber ||= Jabber::Session.bind(address, this_blog.jabber_password) + @@jabber ||= Jabber::Session.bind(address, Blog.default.jabber_password) end end
Update jabber code slightly. May still be broken; I'll revisit after <I>. Closes #<I> git-svn-id: <URL>
publify_publify
train
rb,rb
863d8375c4b13ba8203031824e6c0111cf4d8e66
diff --git a/domain-management/src/main/java/org/jboss/as/domain/management/security/SecurityRealmService.java b/domain-management/src/main/java/org/jboss/as/domain/management/security/SecurityRealmService.java index <HASH>..<HASH> 100644 --- a/domain-management/src/main/java/org/jboss/as/domain/management/security/SecurityRealmService.java +++ b/domain-management/src/main/java/org/jboss/as/domain/management/security/SecurityRealmService.java @@ -193,7 +193,7 @@ public class SecurityRealmService implements Service<SecurityRealm>, SecurityRea final AuthMechanism mechanism = currentRegistration.getKey(); domainBuilder.addRealm(mechanism.toString(), - currentService.allowGroupLoading() && authorizationRealm != null ? new SharedStateSecurityRealm(new AggregateSecurityRealm(elytronRealm, authorizationRealm)) : elytronRealm) + new SharedStateSecurityRealm(currentService.allowGroupLoading() && authorizationRealm != null ? new AggregateSecurityRealm(elytronRealm, authorizationRealm) : elytronRealm)) .setRoleDecoder(RoleDecoder.simple("GROUPS")) .build(); Function<Principal, Principal> preRealmRewriter = p -> new RealmUser(this.name, p.getName());
[WFCORE-<I>] Always wrap using the shared state realm as plug-ins expect a shared state Map in all situations.
wildfly_wildfly-core
train
java
d7b07367edc9ccac2fe50fa2a70e7059a482285b
diff --git a/lib/transports/polling.js b/lib/transports/polling.js index <HASH>..<HASH> 100644 --- a/lib/transports/polling.js +++ b/lib/transports/polling.js @@ -153,23 +153,11 @@ Polling.prototype.doClose = function () { * @api private */ -Polling.prototype.writeMany = function (packets, fn) { +Polling.prototype.write = function (packets, fn) { this.doWrite(parser.encodePayload(packets), fn); }; /** - * Writes a single-packet payload. - * - * @param {Object} data packet - * @param {Function} drain callback - * @api private - */ - -Polling.prototype.write = function (packet, fn) { - this.writeMany([packet], fn); -}; - -/** * Generates uri for connection. * * @api private
writeMany is gone, write now handles arrays directly.
socketio_engine.io-client
train
js
e74891d091a338c3d1fe82b45bc76d9305c14059
diff --git a/Symfony/CS/Resources/phar-stub.php b/Symfony/CS/Resources/phar-stub.php index <HASH>..<HASH> 100644 --- a/Symfony/CS/Resources/phar-stub.php +++ b/Symfony/CS/Resources/phar-stub.php @@ -10,6 +10,11 @@ * with this source code in the file LICENSE. */ +if (version_compare(phpversion(), '5.3.6', '<')) { + fwrite(STDERR, "PHP needs to be a minimum version of PHP 5.3.6\n"); + exit(1); +} + Phar::mapPhar('php-cs-fixer.phar'); require_once 'phar://php-cs-fixer.phar/vendor/autoload.php';
Add PHP version check for phar-stub
FriendsOfPHP_PHP-CS-Fixer
train
php
aee3a452dab3fb507b7bc3359dd48ed9a1577b24
diff --git a/examples/memory/model.js b/examples/memory/model.js index <HASH>..<HASH> 100644 --- a/examples/memory/model.js +++ b/examples/memory/model.js @@ -14,7 +14,7 @@ var oauthAccessTokens = [], password: [ 'thom' ], - refreshToken: [ + refresh_token: [ 'thom' ] },
Corrected Refresh Token array in memory
oauthjs_node-oauth2-server
train
js
7e724f266d8239056b7dd574218a9ad3d85902e2
diff --git a/bugzoo/localization/suspiciousness.py b/bugzoo/localization/suspiciousness.py index <HASH>..<HASH> 100644 --- a/bugzoo/localization/suspiciousness.py +++ b/bugzoo/localization/suspiciousness.py @@ -3,7 +3,7 @@ from typing import Dict, Callable # a registry of suspiciousness metrics SuspiciousnessMetric = Callable[[int, int, int, int], float] -__metrics: Dict[str, SuspiciousnessMetric] = {} +__metrics = {} def metric(name: str) -> Callable[[], SuspiciousnessMetric]:
localization: removed Python <I> code
squaresLab_BugZoo
train
py
67981cb4b4edcd5919f2cc986d3107e0eec6ae76
diff --git a/src/main/java/graphql/validation/TraversalContext.java b/src/main/java/graphql/validation/TraversalContext.java index <HASH>..<HASH> 100644 --- a/src/main/java/graphql/validation/TraversalContext.java +++ b/src/main/java/graphql/validation/TraversalContext.java @@ -127,7 +127,8 @@ public class TraversalContext implements QueryLanguageVisitor { GraphQLInputType inputType = null; if (objectType instanceof GraphQLInputObjectType) { GraphQLInputObjectField inputField = ((GraphQLInputObjectType) objectType).getField(objectField.getName()); - inputType = inputField.getType(); + if (inputField != null) + inputType = inputField.getType(); } addInputType(inputType); }
Fix npe when input object field has a wrong name.
graphql-java_graphql-java
train
java
bec3efcfef9f7d8fde5ae934dd8f159cde210f70
diff --git a/nptdms/tdms.py b/nptdms/tdms.py index <HASH>..<HASH> 100644 --- a/nptdms/tdms.py +++ b/nptdms/tdms.py @@ -94,8 +94,11 @@ else: def fromfile(file, dtype, count, *args, **kwargs): """ Wrapper around np.fromfile to support BytesIO fake files.""" + if isinstance(file, BytesIO): - return np.fromstring(file.read(count * dtype.itemsize), dtype=dtype, count=count, *args, **kwargs) + return np.fromstring( + file.read(count * dtype.itemsize), + dtype=dtype, count=count, *args, **kwargs) else: return np.fromfile(file, dtype=dtype, count=count, *args, **kwargs)
Tidy up to fix PEP8 check
adamreeve_npTDMS
train
py
2fe252ffae69039b0c7e572d9e1c339ca1246376
diff --git a/lib/krikri/engine.rb b/lib/krikri/engine.rb index <HASH>..<HASH> 100644 --- a/lib/krikri/engine.rb +++ b/lib/krikri/engine.rb @@ -18,6 +18,7 @@ module Krikri isolate_namespace Krikri def configure_blacklight! + return unless File.exist?(Blacklight.solr_file) krikri_solr = Krikri::Settings.solr Blacklight.solr_config = Blacklight.solr_config.merge(krikri_solr) unless krikri_solr.nil?
Check existence of Blacklight settings file Merge of Blacklight solr settings failed on initialize before the Blacklight generator runs; this made it impossible run the generator unless some config files had been created manually. The initializer now checks for the existence of the file before trying to merge the Blacklight solr settings with Krikri's.
dpla_KriKri
train
rb
6f367ffb38dec50ee4e22072f8bd5d7acd1ec70e
diff --git a/c7n/cli.py b/c7n/cli.py index <HASH>..<HASH> 100644 --- a/c7n/cli.py +++ b/c7n/cli.py @@ -79,8 +79,9 @@ def _default_options(p, blacklist=""): action="store_true") if 'vars' not in blacklist: - p.add_argument('--vars', default=None, - help='Vars file to substitute into policy') + # p.add_argument('--vars', default=None, + # help='Vars file to substitute into policy') + p.set_defaults(vars=None) if 'log-group' not in blacklist: p.add_argument( diff --git a/c7n/version.py b/c7n/version.py index <HASH>..<HASH> 100644 --- a/c7n/version.py +++ b/c7n/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -version = "0.8.24.1" +version = "0.8.24.2" diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def read(fname): setup( name="c7n", - version='0.8.24.1', + version='0.8.24.2', description="Cloud Custodian - Policy Rules Engine", long_description=read('README.rst'), classifiers=[
version increment - <I> (#<I>)
cloud-custodian_cloud-custodian
train
py,py,py
2ce6632082312a1b2437005f7deb2a1178b114fa
diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js index <HASH>..<HASH> 100644 --- a/tests_config/run_spec.js +++ b/tests_config/run_spec.js @@ -141,7 +141,7 @@ function mergeDefaultOptions(parserConfig) { function getParsersToVerify(parser, additionalParsers) { if (VERIFY_ALL_PARSERS) { - return ALL_PARSERS.splice(ALL_PARSERS.indexOf(parent), 1); + return ALL_PARSERS.splice(ALL_PARSERS.indexOf(parser), 1); } return additionalParsers; }
Fix variable name in getParsersToVerify() (#<I>) It previously referred to an undefined variable.
josephfrazier_prettier_d
train
js
2781ef8af10ca242b21007469022e1fda63452c5
diff --git a/spambl.py b/spambl.py index <HASH>..<HASH> 100644 --- a/spambl.py +++ b/spambl.py @@ -221,12 +221,14 @@ class BaseDNSBLClient(object): ''' Query registered dnsbl services for data on given host :param host: a valid host - :returns: a tuple containing host, source and return code for listed host, or - an empty tuple for not listed one + :returns: a tuple containing source and classification for listed host ''' + for source in self.dnsbl_services: - return_code = source.query(host) - yield (host, source, return_code) if return_code else () + classification = source.get_classification(host) + + if classification: + yield str(source), classification def __contains__(self, host): ''' Test if any dnsbl services contain given host
Modify BaseDNSBLClient._get_item_data The new implementation shifts from using oudated query method of each dnsbl service to calling their get_classification method. The yielded value does not contain host, dnsbl service object and return code anymore, only source identifier and classification of given host, if it's listed.
piotr-rusin_spam-lists
train
py
71920d99112b6e2fc39086a568dede6157b43905
diff --git a/lib/databases/elasticsearch.js b/lib/databases/elasticsearch.js index <HASH>..<HASH> 100644 --- a/lib/databases/elasticsearch.js +++ b/lib/databases/elasticsearch.js @@ -65,7 +65,13 @@ _.extend(ElasticSearchSessionStore.prototype, { } if (!self.isConnected) { - if (!callbacked) { + // Github issue #39 - recover after temp ping error. + if (callbacked) { + // Already callbacked, so only restore isConnected state. + self.isConnected = true; + self.emit('connect'); + } else { + // Not callbacked yet, so perform init logic and handle isConnected state. self.client.indices.create({ index: self.index, type: self.typeName
Github issue #<I> - recover elasticsearch connection after temp ping error
adrai_sessionstore
train
js
52fd3499b9a26a724ea2d3e0d33b78dbad231cc4
diff --git a/lib/TypedFeatureStructure.js b/lib/TypedFeatureStructure.js index <HASH>..<HASH> 100644 --- a/lib/TypedFeatureStructure.js +++ b/lib/TypedFeatureStructure.js @@ -169,14 +169,7 @@ TypedFeatureStructure.prototype.unifiableListOfCrossRefs = function(fs2, signatu unifiable = (fs1.listOfCrossRefs.length === fs2.listOfCrossRefs.length); if (unifiable) { fs1.listOfCrossRefs.forEach(function (ref, index) { - if (ref.type === signature.typeLattice.string) { - // String cross reference - unifiable = unifiable && (ref.lexicalString === fs2.listOfCrossRefs[index].lexicalString); - } - else { - // Normal cross reference - unifiable = unifiable && ref.unifiable(fs2.listOfCrossRefs[index], signature, stacka, stackb); - } + unifiable = unifiable && ref.unifiable(fs2.listOfCrossRefs[index], signature, stacka, stackb); }); } if (unifiable) { @@ -290,11 +283,8 @@ TypedFeatureStructure.prototype.unifiable = function(b, signature, stacka, stack if (still_unifies) { fs2.forwardFS(fs1); - return (true); - } - else { - return (false); } + return (still_unifies); } } };
Further simplifications to unifiable()
Hugo-ter-Doest_chart-parsers
train
js
82c4376f2d0f15e7822dda753f07d2297ab2fc62
diff --git a/src/BoomCMS/Http/Controllers/People/Group.php b/src/BoomCMS/Http/Controllers/People/Group.php index <HASH>..<HASH> 100644 --- a/src/BoomCMS/Http/Controllers/People/Group.php +++ b/src/BoomCMS/Http/Controllers/People/Group.php @@ -19,11 +19,6 @@ class Group extends Controller $group->addRole($request->input('role_id'), $request->input('allowed'), $request->input('page_id')); } - public function create() - { - return view("$this->viewPrefix.add"); - } - public function destroy(GroupModel $group) { GroupFacade::delete($group);
Removed create method from group controller (no longer used)
boomcms_boom-core
train
php
fac113821eb4dfcee6fe053c2a6a097c86fb7e1b
diff --git a/id_test.go b/id_test.go index <HASH>..<HASH> 100644 --- a/id_test.go +++ b/id_test.go @@ -2,6 +2,7 @@ package platform import ( "bytes" + "encoding/json" "reflect" "testing" ) @@ -124,3 +125,23 @@ func TestDecodeFromEmptyString(t *testing.T) { t.Errorf("expecting empty ID to be serialized into empty string") } } + +func TestMarshalling(t *testing.T) { + init := "ca55e77eca55e77e" + id1, err := IDFromString(init) + if err != nil { + t.Errorf(err.Error()) + } + + serialized, err := json.Marshal(id1) + if err != nil { + t.Errorf(err.Error()) + } + + var id2 ID + json.Unmarshal(serialized, &id2) + + if !bytes.Equal(id1.Encode(), id2.Encode()) { + t.Errorf("error marshalling/unmarshalling ID") + } +}
Testing marshalling of IDs and viceversa
influxdata_influxdb
train
go
5cb422a15818df411675fe519346bc30d8972ebe
diff --git a/openquake/calculators/disaggregation.py b/openquake/calculators/disaggregation.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/disaggregation.py +++ b/openquake/calculators/disaggregation.py @@ -237,7 +237,7 @@ class DisaggregationCalculator(base.HazardCalculator): if len(ok_sites) == 0: raise SystemExit('Cannot do any disaggregation') elif len(ok_sites) < self.N: - logging.warning('Doing the disaggregation on' % self.sitecol) + logging.warning('Doing the disaggregation on %s', self.sitecol) return ok_sites def full_disaggregation(self):
Better logging [skip CI]
gem_oq-engine
train
py
1641a4bf740aad71093b3a6d34aa2dd355bfdef5
diff --git a/pwnypack/shellcode/base.py b/pwnypack/shellcode/base.py index <HASH>..<HASH> 100644 --- a/pwnypack/shellcode/base.py +++ b/pwnypack/shellcode/base.py @@ -198,9 +198,9 @@ class BaseEnvironment(object): def decorator(f): @functools.wraps(f) - def proxy(*args, **kwargs): + def proxy(*p_args, **p_kwargs): env = cls(*args, **kwargs) - result = translate(env, f, *args, **kwargs) + result = translate(env, f, *p_args, **p_kwargs) if output == cls.TranslateOutput.code: return env.assemble(result) elif output == cls.TranslateOutput.assembly:
Fix BaseEnvironment.translate with args.
edibledinos_pwnypack
train
py
228c210379f9bbbc2fbd48ad24a0b6945dd1ac1d
diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index <HASH>..<HASH> 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -166,7 +166,7 @@ func getCredentials(dsInfo *datasourceInfo) (*credentials.Credentials, error) { SecretAccessKey: dsInfo.SecretKey, }}, &credentials.SharedCredentialsProvider{Filename: "", Profile: dsInfo.Profile}, - &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, + remoteCredProvider(sess), }) credentialCacheLock.Lock()
Cloudwatch: Fix bug with obtaining IAM roles within ECS containers. (#<I>) Fixes #<I>.
grafana_grafana
train
go
fc3d7cd7a93534d76840418467f303d4b301fbcd
diff --git a/src/platforms/web/runtime/modules/dom-props.js b/src/platforms/web/runtime/modules/dom-props.js index <HASH>..<HASH> 100644 --- a/src/platforms/web/runtime/modules/dom-props.js +++ b/src/platforms/web/runtime/modules/dom-props.js @@ -63,7 +63,11 @@ function shouldUpdateValue ( function isDirty (elm: acceptValueElm, checkVal: string): boolean { // return true when textbox (.number and .trim) loses focus and its value is // not equal to the updated value - return document.activeElement !== elm && elm.value !== checkVal + let notInFocus = true + // #6157 + // work around IE bug when accessing document.activeElement in an iframe + try { notInFocus = document.activeElement !== elm } catch (e) {} + return notInFocus && elm.value !== checkVal } function isInputChanged (elm: any, newVal: string): boolean {
fix: work around IE/Edge bug when accessing document.activeElement from iframe close #<I>
IOriens_wxml-transpiler
train
js
8b2f146ee92e31c41ab8dc22d301e4241cb0a598
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ python-can requires the setuptools package to be installed. from setuptools import setup, find_packages -__version__ = 1.4 +__version__ = "1.4.1" import logging logging.basicConfig(level=logging.WARNING)
Tag <I> for release to Pypi
hardbyte_python-can
train
py
35d60edab1faeab197503e81cd2a08c9c7927fac
diff --git a/plugin-infra/go-plugin-config-repo/src/main/java/com/thoughtworks/go/plugin/configrepo/contract/CRPipeline.java b/plugin-infra/go-plugin-config-repo/src/main/java/com/thoughtworks/go/plugin/configrepo/contract/CRPipeline.java index <HASH>..<HASH> 100644 --- a/plugin-infra/go-plugin-config-repo/src/main/java/com/thoughtworks/go/plugin/configrepo/contract/CRPipeline.java +++ b/plugin-infra/go-plugin-config-repo/src/main/java/com/thoughtworks/go/plugin/configrepo/contract/CRPipeline.java @@ -28,6 +28,7 @@ import java.util.*; public class CRPipeline extends CRBase { private String group; private String name; + private int display_order_weight = -1; private String label_template; private String lock_behavior; private CRTrackingTool tracking_tool; @@ -38,7 +39,6 @@ public class CRPipeline extends CRBase { private Collection<CRMaterial> materials = new ArrayList<>(); private List<CRStage> stages = new ArrayList<>(); private String template; - private int display_order_weight = -1; public CRPipeline(){} public CRPipeline(String name, String groupName, CRMaterial material, String template, CRStage... stages)
#<I> - Move field in a class a little higher The order of the fields determines the output during pipeline export to JSON. This is just to make it look nicer.
gocd_gocd
train
java
a256b842006c5770376f1ba47d648ff8c1eec531
diff --git a/pyemu/utils/gw_utils.py b/pyemu/utils/gw_utils.py index <HASH>..<HASH> 100644 --- a/pyemu/utils/gw_utils.py +++ b/pyemu/utils/gw_utils.py @@ -229,7 +229,7 @@ def setup_mtlist_budget_obs(list_filename,gw_filename="mtlist_gw.dat",sw_filenam if df_sw is None: raise Exception("error processing surface water instruction file") df_gw = df_gw.append(df_sw) - df_gw.obsnme = df_gw.index.values + df_gw.loc[:, "obsnme"] = df_gw.index.values if save_setup_file: df_gw.to_csv("_setup_" + os.path.split(list_filename)[-1] + '.csv', index=False) @@ -325,7 +325,7 @@ def setup_mflist_budget_obs(list_filename,flx_filename="flux.dat", It is recommended to use the default values for flux_file and vol_file. - This is the companion function of `gw_utils.setup_mflist_budget_obs()`. + This is the companion function of `gw_utils.apply_mflist_budget_obs()`. """
minor changes in mf/mtlist setup
jtwhite79_pyemu
train
py
4a9be318ded473220d96bfb0dea07d25ae24f7ba
diff --git a/mingus/extra/tablature.py b/mingus/extra/tablature.py index <HASH>..<HASH> 100644 --- a/mingus/extra/tablature.py +++ b/mingus/extra/tablature.py @@ -267,12 +267,13 @@ Use `string` and `fret` attributes on Notes to force certain fingerings.""" f = [] attr = [] - for note in notes: - if hasattr(note, "string") and hasattr(note, "fret"): - n = tuning.get_Note(note.string, note.fret) - if n is not None and int(n) == int(note): - f.append((note.string, note.fret)) - attr.append(int(note)) + if notes is not None: + for note in notes: + if hasattr(note, "string") and hasattr(note, "fret"): + n = tuning.get_Note(note.string, note.fret) + if n is not None and int(n) == int(note): + f.append((note.string, note.fret)) + attr.append(int(note)) # See if there are any possible fingerings with the # attributes that are set.
Fixed rest bug in tablature exporter.
bspaans_python-mingus
train
py
5c17b940ce095c13d3228199c2dc789cb093806b
diff --git a/web_resources/lib/predDB.js b/web_resources/lib/predDB.js index <HASH>..<HASH> 100644 --- a/web_resources/lib/predDB.js +++ b/web_resources/lib/predDB.js @@ -800,7 +800,7 @@ jQuery(function($, undefined) { break } tablename = dict_to_send['tablename'] - times = dict_to_send['times'] + times = dict_to_send['numpredictions'] success_str = ("PREDICTION DONE " + times + " TIMES FOR PTABLE " + tablename) callback_func = function(returnedData) {
properly get times, which is really numpredictions
probcomp_crosscat
train
js
055e7b7dbad7cee637c480c65e17b40a68f62479
diff --git a/simulation/simulation_suite_test.go b/simulation/simulation_suite_test.go index <HASH>..<HASH> 100644 --- a/simulation/simulation_suite_test.go +++ b/simulation/simulation_suite_test.go @@ -6,6 +6,7 @@ import ( "fmt" "io/ioutil" "os/exec" + "runtime" "strings" "github.com/cloudfoundry-incubator/auction/auctionrep" @@ -81,6 +82,7 @@ func TestAuction(t *testing.T) { } var _ = BeforeSuite(func() { + runtime.GOMAXPROCS(runtime.NumCPU()) fmt.Printf("Running in %s communicationMode\n", communicationMode) fmt.Printf("Running in %s auctioneerMode\n", auctioneerMode)
run with as many processors as possible
cloudfoundry_auction
train
go
cd35216f217caf317043ca6e6dc3556026467afd
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ setup( 'cffi >= 1.9.1', # must be a setup and install requirement 'coloredlogs >= 14.0', # strictly optional 'img2pdf >= 0.3.0, < 0.4', # pure Python, so track HEAD closely - 'pdfminer.six >= 20191110, <= 20200726', + 'pdfminer.six >= 20191110, != 20200720, <= 20200726', 'pikepdf >= 1.14.0, < 2', 'Pillow >= 7.0.0', 'pluggy >= 0.13.0',
setup: blacklist pdfminer.six <I> NotAllowedError is going to removed <URL>
jbarlow83_OCRmyPDF
train
py
c6121675bbef9124f8140a9c71ba6af40f0be029
diff --git a/core/dbt/clients/jinja.py b/core/dbt/clients/jinja.py index <HASH>..<HASH> 100644 --- a/core/dbt/clients/jinja.py +++ b/core/dbt/clients/jinja.py @@ -425,6 +425,18 @@ def render_template(template, ctx: Dict[str, Any], node=None) -> str: return template.render(ctx) +def _requote_result(raw_value, rendered): + double_quoted = raw_value.startswith('"') and raw_value.endswith('"') + single_quoted = raw_value.startswith("'") and raw_value.endswith("'") + if double_quoted: + quote_char = '"' + elif single_quoted: + quote_char = "'" + else: + quote_char = '' + return f'{quote_char}{rendered}{quote_char}' + + def get_rendered( string: str, ctx: Dict[str, Any], @@ -440,7 +452,11 @@ def get_rendered( native=native, ) - return render_template(template, ctx, node) + result = render_template(template, ctx, node) + + if native and isinstance(result, str): + result = _requote_result(string, result) + return result def undefined_error(msg) -> NoReturn:
re-add quoting logic
fishtown-analytics_dbt
train
py
7bbe88f99fd1835eaa3f4fa044133b8051a19e1f
diff --git a/gen/generator.go b/gen/generator.go index <HASH>..<HASH> 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -299,6 +299,7 @@ func camelToSnake(name string) string { multipleUpper := false var lastUpper rune + var beforeUpper rune for _, c := range name { // Non-lowercase character after uppercase is considered to be uppercase too. @@ -312,7 +313,7 @@ func camelToSnake(name string) string { firstInRow := !multipleUpper lastInRow := !isUpper - if ret.Len() > 0 && (firstInRow || lastInRow) { + if ret.Len() > 0 && (firstInRow || lastInRow) && beforeUpper != '_' { ret.WriteByte('_') } ret.WriteRune(unicode.ToLower(lastUpper)) @@ -328,6 +329,7 @@ func camelToSnake(name string) string { ret.WriteRune(c) lastUpper = 0 + beforeUpper = c multipleUpper = false }
fix to camelToSnake function to handle properly Some_Snake_Case
mailru_easyjson
train
go
c0038f5ea7d94700366286cc1db7a078caffa53a
diff --git a/www/email_composer.js b/www/email_composer.js index <HASH>..<HASH> 100644 --- a/www/email_composer.js +++ b/www/email_composer.js @@ -191,12 +191,12 @@ exports.open = function (options, callback, scope) { * Adds a new mail app alias. * * @param [ String ] alias The alias name. - * @param [ String ] package The package name. + * @param [ String ] packageName The package name. * * @return [ Void ] */ -exports.addAlias = function (alias, package) { - this.aliases[alias] = package; +exports.addAlias = function (alias, packageName) { + this.aliases[alias] = packageName; }; /** @@ -297,4 +297,4 @@ exports.registerCallbackForScheme = function (fn) { }; document.addEventListener('resume', callback, false); -}; \ No newline at end of file +};
Update email_composer.js (#<I>) package -> packageName
katzer_cordova-plugin-email-composer
train
js
eba8e1501f7c2dd9a9b9ecfa20fc0c167e896ede
diff --git a/extensions/gii/generators/model/default/model.php b/extensions/gii/generators/model/default/model.php index <HASH>..<HASH> 100644 --- a/extensions/gii/generators/model/default/model.php +++ b/extensions/gii/generators/model/default/model.php @@ -41,6 +41,16 @@ class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') . { return '<?= $tableName ?>'; } +<?php if ($generator->db !== 'db'): ?> + + /** + * @return \yii\db\Connection the database connection used by this AR class. + */ + public static function getDb() + { + return Yii::$app->get('<?= $generator->db ?>'); + } +<?php endif; ?> /** * @inheritdoc
Gii model generator did not add correct db connection if component id is different from 'db'
yiisoft_yii-core
train
php
3fe3bf8cf8a1200baef558b106d5eb9e7d91112e
diff --git a/WrightTools/artists.py b/WrightTools/artists.py index <HASH>..<HASH> 100644 --- a/WrightTools/artists.py +++ b/WrightTools/artists.py @@ -451,7 +451,7 @@ class Axes(matplotlib.axes.Axes): def plot_data(self, data, channel=0, interpolate=False, coloring=None, xlabel=True, ylabel=True, min=None, max=None): - """Plot directly from a data object. + """DEPRECATED. Parameters ---------- @@ -461,9 +461,10 @@ class Axes(matplotlib.axes.Axes): The channel to plot. Default is 0. interpolate : boolean (optional) Toggle interpolation. Default is False. - cmap : str (optional) - A key to the colormaps dictionary found in artists module. Default - is None (inherits from channel). + coloring : str (optional) + A key to the colormaps dictionary found in artists module, for + two-dimensional data. A matplotlib color string for + one-dimensional data. Default is None. xlabel : boolean (optional) Toggle xlabel. Default is True. ylabel : boolean (optional) @@ -473,7 +474,6 @@ class Axes(matplotlib.axes.Axes): max : number (optional) max. Default is None (inherited from channel). - .. plot:: >>> import matplotlib
document coloring (resolves #<I>) (#<I>)
wright-group_WrightTools
train
py