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
9d2cedee2e740bdab804aa4ed62345fcef0689dd
diff --git a/src/build.js b/src/build.js index <HASH>..<HASH> 100644 --- a/src/build.js +++ b/src/build.js @@ -3,7 +3,7 @@ var dag = require('breeze-dag'); var through2 = require('through2'); var relativeImports = /import\s*{[a-zA-Z\,\s]+}\s*from\s*'(\.[^\s']+)';\s*/g; -var nonRelativeImports = /import\s*{?[a-zA-Z\*\,\s]+}?\s*from\s*'[a-zA-Z\-]+';\s*/g; +var nonRelativeImports = /import(\s*{?[a-zA-Z\*\,\s]+}?)?(\s*as\s*[a-zA-Z0-9]+)?(\s*from)?\s*'[a-zA-Z\-]+';\s*/g; var importGrouper = /import\s*{([a-zA-Z\,\s]+)}\s*from\s*'([a-zA-Z\-]+)'\s*;\s*/; exports.sortFiles = function sortFiles() {
fix(build.js): Add support for global and wildcard import syntax. Imports of the format `import 'lib'` and `import * as lib from 'lib'` were not properly being consolidated by the build tool. Now they consolidate correctly. closes <URL>
aurelia_tools
train
js
c6a1e70ad3f083893dd94f31c05421eb3bf9b8b9
diff --git a/js/client/api.js b/js/client/api.js index <HASH>..<HASH> 100644 --- a/js/client/api.js +++ b/js/client/api.js @@ -97,6 +97,14 @@ fin = Singleton(function(){ } } + /* + * Get the last cached mutation of a currently observed item property + */ + this.getCachedMutation = function(itemId, propName) { + var key = shared.keys.getItemPropertyKey(itemId, propName) + return this._mutationCache[key] + } + /********************** * Local property API * **********************/ @@ -123,6 +131,15 @@ fin = Singleton(function(){ this.releaseLocal = function(subId) { this.release(subId, { local: true }) } + + /* + * Get the last cached mutation of a currently observed item property + */ + this.getLocalCachedMutation = function(propName) { + var key = shared.keys.getItemPropertyKey(this._localId, propName) + return this._mutationCache[key] + } + /*********** * Set API *
Add support for getting the last cached mutation
marcuswestin_fin
train
js
33de418c362a5de9ab1e71cc50c441d09c49c7ed
diff --git a/modules/power-assign/src/power-assign.js b/modules/power-assign/src/power-assign.js index <HASH>..<HASH> 100644 --- a/modules/power-assign/src/power-assign.js +++ b/modules/power-assign/src/power-assign.js @@ -442,7 +442,12 @@ export default class PowerAssign { /** * */ -export function assign(obj: Object, uOp: Object): Object { +export function assign(obj: Object, uOp: Object | Array<Object>): Object { + if (Array.isArray(uOp)) { + return uOp.reduce((ret, _uOp) => { + return PowerAssign.assign(ret, _uOp) + }, obj) + } return PowerAssign.assign(obj, normalizeUpdateOperation(uOp)) }
[power-assign] allow multi operations
phenyl-js_phenyl
train
js
e1c1c7fbbdc3f4061b213b62dc220adc9b71cd4a
diff --git a/src/extensions/filter-control/bootstrap-table-filter-control.js b/src/extensions/filter-control/bootstrap-table-filter-control.js index <HASH>..<HASH> 100644 --- a/src/extensions/filter-control/bootstrap-table-filter-control.js +++ b/src/extensions/filter-control/bootstrap-table-filter-control.js @@ -40,7 +40,9 @@ }; var sortSelectControl = function (selectControl) { + selectControl = $(selectControl.get(selectControl.length - 1)); var $opts = selectControl.find('option:gt(0)'); + $opts.sort(function (a, b) { a = $(a).text().toLowerCase(); b = $(b).text().toLowerCase();
Fix #<I> #<I> #<I> Duplicate options when height is set or sticky extension is used
wenzhixin_bootstrap-table
train
js
c0338082d21b8ebcd5f6e65b9da9b306d79388a6
diff --git a/examples/epcs/client.py b/examples/epcs/client.py index <HASH>..<HASH> 100644 --- a/examples/epcs/client.py +++ b/examples/epcs/client.py @@ -6,10 +6,8 @@ def run_client(address, port): @client.register_function def pong(*args): - print("PONG got {0}".format(args)) - return args - # FIXME: calling echo here hangs! - # return client.call_sync('echo', args, timeout=1) + print("PONG sending {0}".format(args)) + return client.call_sync('echo', args, timeout=1) print("Server provides these methods:") print(client.methods_sync())
Calling echo from client pong (it hangs)
tkf_python-epc
train
py
fda95bba164b7fda422cc658ba06155aa3e143e8
diff --git a/lxd/main_shutdown.go b/lxd/main_shutdown.go index <HASH>..<HASH> 100644 --- a/lxd/main_shutdown.go +++ b/lxd/main_shutdown.go @@ -8,14 +8,6 @@ import ( ) func cmdShutdown() error { - var timeout int - - if *argTimeout == -1 { - timeout = 60 - } else { - timeout = *argTimeout - } - c, err := lxd.ConnectLXDUnix("", nil) if err != nil { return err @@ -38,11 +30,15 @@ func cmdShutdown() error { close(chMonitor) }() - select { - case <-chMonitor: - break - case <-time.After(time.Second * time.Duration(timeout)): - return fmt.Errorf("LXD still running after %ds timeout.", timeout) + if *argTimeout > 0 { + select { + case <-chMonitor: + break + case <-time.After(time.Second * time.Duration(*argTimeout)): + return fmt.Errorf("LXD still running after %ds timeout.", *argTimeout) + } + } else { + <-chMonitor } return nil
lxd/shutdown: Only timeout if told to This changes the behavior from a default timeout of <I>s, to no timeout at all unless one is directly passed by the user. LXD has an internal <I>s timeout per container (shutdown is parallelize) which can be overriden through container configuration. Closes #<I>
lxc_lxd
train
go
8ef92f36f0d5d5bb75f7829b2b47f4200d87c459
diff --git a/moskito-webcontrol/test/junit/net/java/dev/moskito/webcontrol/MoskitoWebControlUIFilterTest.java b/moskito-webcontrol/test/junit/net/java/dev/moskito/webcontrol/MoskitoWebControlUIFilterTest.java index <HASH>..<HASH> 100644 --- a/moskito-webcontrol/test/junit/net/java/dev/moskito/webcontrol/MoskitoWebControlUIFilterTest.java +++ b/moskito-webcontrol/test/junit/net/java/dev/moskito/webcontrol/MoskitoWebControlUIFilterTest.java @@ -5,6 +5,7 @@ import net.java.dev.moskito.webcontrol.configuration.StatsSource; import net.java.dev.moskito.webcontrol.configuration.ViewConfiguration; import net.java.dev.moskito.webcontrol.configuration.ViewField; import net.java.dev.moskito.webcontrol.repository.*; +import org.junit.Ignore; import org.junit.Test; import org.w3c.dom.Document; import org.w3c.dom.NodeList; @@ -19,6 +20,7 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +@Ignore public class MoskitoWebControlUIFilterTest { private class PatternWithName {
set continuosly failing test to ignore
anotheria_moskito
train
java
1fa5eeb4c4cf1f9878639825a6765d8f454123bb
diff --git a/src/ossos-pipeline/ossos/storage.py b/src/ossos-pipeline/ossos/storage.py index <HASH>..<HASH> 100644 --- a/src/ossos-pipeline/ossos/storage.py +++ b/src/ossos-pipeline/ossos/storage.py @@ -511,7 +511,8 @@ def build_counter_tag(epoch_field, dry_run=False): Builds the tag for the counter of a given epoch/field, without the OSSOS base. """ - tag = epoch_field + "-" + OBJECT_COUNT + logger.info("Epoch Field: {}, OBJECT_COUNT {}".format(str(epoch_field),str(OBJECT_COUNT))) + tag = epoch_field[1] + "-" + OBJECT_COUNT if dry_run: tag += "-DRYRUN"
Corrected the way names are assigned during 'dry-run' to account for our removal of the '<I>A/B' part from object names. This is just a knock on effect of how dry-run was using the name generator.
OSSOS_MOP
train
py
bb080bfd16ac5620a695ba39d59238c947bd6944
diff --git a/xwiki-commons-tools/xwiki-commons-tool-test/xwiki-commons-tool-test-simple/src/main/java/org/xwiki/test/LogRule.java b/xwiki-commons-tools/xwiki-commons-tool-test/xwiki-commons-tool-test-simple/src/main/java/org/xwiki/test/LogRule.java index <HASH>..<HASH> 100644 --- a/xwiki-commons-tools/xwiki-commons-tool-test/xwiki-commons-tool-test-simple/src/main/java/org/xwiki/test/LogRule.java +++ b/xwiki-commons-tools/xwiki-commons-tool-test/xwiki-commons-tool-test-simple/src/main/java/org/xwiki/test/LogRule.java @@ -56,7 +56,10 @@ import ch.qos.logback.core.read.ListAppender; * * @version $Id$ * @since 4.2RC1 + * @deprecated starting with 7.0M1 you should use {@link AllLogRule} instead since we want tests to not output anything + * to the console */ +@Deprecated public class LogRule implements TestRule { /**
[Misc] AllLogRule shoud now be preferred (see also XCOMMONS-<I>: Add a new AllLogRule to capture all logs for all loggers) since it ensure all logs are capture and handled.
xwiki_xwiki-commons
train
java
e1821d261ed728e85433ac7cbb6202a56a663ebb
diff --git a/src/Carbon/Carbon.php b/src/Carbon/Carbon.php index <HASH>..<HASH> 100644 --- a/src/Carbon/Carbon.php +++ b/src/Carbon/Carbon.php @@ -1840,8 +1840,6 @@ class Carbon extends DateTime $other = static::now($this->tz); } - $isFuture = $this->gt($other); - $diffInterval = $this->diff($other); switch (true) { @@ -1849,6 +1847,7 @@ class Carbon extends DateTime $unit = 'year'; $delta = $diffInterval->y; break; + case ($diffInterval->m > 0): $unit = 'month'; $delta = $diffInterval->m; @@ -1890,6 +1889,8 @@ class Carbon extends DateTime return $txt; } + $isFuture = $diffInterval->invert === 1; + if ($isNow) { if ($isFuture) { return $txt . ' from now';
Calculate isFuture a bit later with $$diffInterval
briannesbitt_Carbon
train
php
4bdf573111356b947a32a8921869519f95233089
diff --git a/lib/feature_flagger.rb b/lib/feature_flagger.rb index <HASH>..<HASH> 100644 --- a/lib/feature_flagger.rb +++ b/lib/feature_flagger.rb @@ -2,6 +2,7 @@ require 'yaml' require 'feature_flagger/version' require 'feature_flagger/storage/redis' +require 'feature_flagger/storage/feature_keys_migration' require 'feature_flagger/control' require 'feature_flagger/model' require 'feature_flagger/model_settings'
Require the FeatureKeysMigration file
ResultadosDigitais_feature_flagger
train
rb
d7ba34bb7060c18cdbe62a34a36eb4e9a9ad178f
diff --git a/index.php b/index.php index <HASH>..<HASH> 100644 --- a/index.php +++ b/index.php @@ -32,9 +32,9 @@ $app->get('/', function ($request, $response, $args) { }); $app->get('/hello[/{name}]', function ($request, $response, $args) { - $response->write("Hello " . $args['name']); + $response->write("Hello, " . $args['name']); return $response; -})->setArgument('name', 'world'); +})->setArgument('name', 'World!'); /** * Step 4: Run the Slim application
Updated example to the proper "Hello, World!"
slimphp_Slim
train
php
a6705ea8ed304cf3a0ec2bba768b64e51e919d3f
diff --git a/lib/alchemy/test_support/shared_ingredient_examples.rb b/lib/alchemy/test_support/shared_ingredient_examples.rb index <HASH>..<HASH> 100644 --- a/lib/alchemy/test_support/shared_ingredient_examples.rb +++ b/lib/alchemy/test_support/shared_ingredient_examples.rb @@ -28,6 +28,16 @@ RSpec.shared_examples_for "an alchemy ingredient" do end context "with element" do + before do + expect(element).to receive(:ingredient_definition_for) do + { + settings: { + linkable: true, + }, + }.with_indifferent_access + end + end + it { is_expected.to eq({ linkable: true }.with_indifferent_access) } end end @@ -42,15 +52,23 @@ RSpec.shared_examples_for "an alchemy ingredient" do end context "with element" do - it do - is_expected.to eq({ + let(:definition) do + { role: "headline", type: "Text", default: "Hello World", settings: { linkable: true, }, - }.with_indifferent_access) + }.with_indifferent_access + end + + before do + expect(element).to receive(:ingredient_definition_for) { definition } + end + + it "returns ingredient definition" do + is_expected.to eq(definition) end end end
Make ingredient examples usable without elements.yml If you want to use the ingredient examples in another project or gem we do not have the elements.yml from alchemys dummy. We need to stub the definition instead.
AlchemyCMS_alchemy_cms
train
rb
58d5b8a8a2e5af48f2a7f0b56d754d12787637ed
diff --git a/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLHandler.java b/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLHandler.java index <HASH>..<HASH> 100644 --- a/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLHandler.java +++ b/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLHandler.java @@ -114,8 +114,10 @@ public class CMLHandler extends DefaultHandler { if (local.startsWith("reaction")) { // e.g. reactionList, reaction -> CRML module logger.info("Detected CRML module"); - conv = new CMLReactionModule(conv); - conventionStack.push(conventionStack.current()); + if (!conventionStack.current().equals("CMLR")) { + conv = new CMLReactionModule(conv); + } + conventionStack.push("CMLR"); } else if (uri == null || uri.length() == 0 || uri.startsWith("http://www.xml-cml.org/")) { // assume CML Core
Only create a new Reaction convention if the current convention isn't already CMLR.
cdk_cdk
train
java
4e2303a72b5b1429f73060aed8dbf6df4de4b626
diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java index <HASH>..<HASH> 100644 --- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java +++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java @@ -1059,12 +1059,19 @@ public class Groovyc extends MatchingTask { } private String getClasspathRelative(Path classpath) { - String raw = classpath.toString(); String baseDir = getProject().getBaseDir().getAbsolutePath(); - if (!raw.startsWith(baseDir)) { - return raw; + StringBuilder sb = new StringBuilder(); + for (String next : classpath.list()) { + if (sb.length() > 0) { + sb.append(File.pathSeparatorChar); + } + if (next.startsWith(baseDir)) { + sb.append(".").append(next.substring(baseDir.length())); + } else { + sb.append(next); + } } - return "." + raw.substring(baseDir.length()); + return sb.toString(); } /**
GROOVY-<I>: Groovyc ant task can overflow Windows command line if classpath is large (properly handle multi-part path)
apache_groovy
train
java
48d1afb104fe8ffa3a78c8362367beee49585542
diff --git a/celerytask/tasks.py b/celerytask/tasks.py index <HASH>..<HASH> 100755 --- a/celerytask/tasks.py +++ b/celerytask/tasks.py @@ -229,7 +229,7 @@ def run_corp_update(): corpinfo = EveApiManager.get_corporation_information(settings.CORP_ID) if not EveManager.check_if_corporation_exists_by_id(corpinfo['id']): EveManager.create_corporation_info(corpinfo['id'], corpinfo['name'], corpinfo['ticker'], - corpinfo['members']['current'], False, alliance) + corpinfo['members']['current'], False, None) # Create the corps in the standings corp_standings = EveApiManager.get_corp_standings() @@ -276,7 +276,7 @@ def run_corp_update(): EveManager.update_alliance_info(all_alliance_api_info['id'], all_alliance_api_info['executor_id'], all_alliance_api_info['member_count'], False) - else: + else: EveManager.update_alliance_info(all_alliance_api_info['id'], all_alliance_api_info['executor_id'], all_alliance_api_info['member_count'], False)
Fixed indentation in tasks.py Removed reference to undefined variable 'alliance' when checking corps
allianceauth_allianceauth
train
py
c76fed9c3d49ae7b4812ffd7423958996f330877
diff --git a/test/org/opencms/search/gallery/TestCmsGallerySearchBasic.java b/test/org/opencms/search/gallery/TestCmsGallerySearchBasic.java index <HASH>..<HASH> 100644 --- a/test/org/opencms/search/gallery/TestCmsGallerySearchBasic.java +++ b/test/org/opencms/search/gallery/TestCmsGallerySearchBasic.java @@ -161,7 +161,7 @@ public class TestCmsGallerySearchBasic extends OpenCmsTestCase { @Override protected void setUp() { - setupOpenCms("simpletest", "/sites/default/", "/../org/opencms/search/gallery"); + setupOpenCms("simpletest", "", "/../org/opencms/search/gallery"); } @Override
Correxted import target for gallery search test cases.
alkacon_opencms-core
train
java
ce0c40bd02b9ba879c858e94cb52d7acdcfab1be
diff --git a/google-cloud-bigtable/acceptance/bigtable/table/row_filter_test.rb b/google-cloud-bigtable/acceptance/bigtable/table/row_filter_test.rb index <HASH>..<HASH> 100644 --- a/google-cloud-bigtable/acceptance/bigtable/table/row_filter_test.rb +++ b/google-cloud-bigtable/acceptance/bigtable/table/row_filter_test.rb @@ -40,6 +40,7 @@ describe "DataClient Read Rows Filters", :bigtable do end it "sample filter" do + skip filter = table.filter.sample(0.2) rows = table.read_rows(filter: filter).to_a rows.wont_be :empty? @@ -102,6 +103,7 @@ describe "DataClient Read Rows Filters", :bigtable do end it "cells per column filter" do + skip filter = table.filter.cells_per_column(1) rows = table.read_rows(filter: filter, limit: 2).to_a rows.wont_be :empty?
Skip problematic acceptance tests (#<I>)
googleapis_google-cloud-ruby
train
rb
9d80cfd7d968b16245f077af87eaaa3c73abcea2
diff --git a/Tests/ImplementationTest.php b/Tests/ImplementationTest.php index <HASH>..<HASH> 100644 --- a/Tests/ImplementationTest.php +++ b/Tests/ImplementationTest.php @@ -508,6 +508,12 @@ class ImplementationTest extends Base true )); + static::assertTrue(in_array( + $className::DaftRouterHttpRouteDefaultMethod(), + array_merge([], ...array_values($className::DaftRouterRoutes())), + true + )); + $check_auto_method_checking = ( in_array( DaftRouterAutoMethodCheckingTrait::class,
double-check default method is in routes
SignpostMarv_daft-router
train
php
116f738c3e3e180d0219e046f2ba795cd0baae47
diff --git a/autograd/differential_operators.py b/autograd/differential_operators.py index <HASH>..<HASH> 100644 --- a/autograd/differential_operators.py +++ b/autograd/differential_operators.py @@ -2,7 +2,10 @@ from __future__ import absolute_import from functools import partial from collections import OrderedDict -from inspect import getargspec +try: + from inspect import getfullargspec as _getargspec # Python 3 +except ImportError: + from inspect import getargspec as _getargspec # Python 2 import warnings from .wrap_util import unary_to_nary @@ -69,7 +72,7 @@ def holomorphic_grad(fun, x): def grad_named(fun, argname): '''Takes gradients with respect to a named argument. Doesn't work on *args or **kwargs.''' - arg_index = getargspec(fun).args.index(argname) + arg_index = _getargspec(fun).args.index(argname) return grad(fun, arg_index) @unary_to_nary
Replace inspect.getargspec on Python 3 Where inspect.getfullargspec is available (Python <I> and later), use it instead of inspect.getargspec, which was deprecated in Python <I> and will be removed in Python <I>.
HIPS_autograd
train
py
01847a802598483f7d22754140671a8b97c3c533
diff --git a/src/date-picker/BasePicker.js b/src/date-picker/BasePicker.js index <HASH>..<HASH> 100644 --- a/src/date-picker/BasePicker.js +++ b/src/date-picker/BasePicker.js @@ -127,10 +127,7 @@ export default class BasePicker extends Component { onChange && onChange(date, this.parseDate(date)); } createPickerPanel() { - return this.pickerPanel( - this.state, - Object.assign({}, { ...this.props }) - ); + return this.pickerPanel(this.state); } render() { const { className, style, diff --git a/src/date-picker/TimePickerSpinner.js b/src/date-picker/TimePickerSpinner.js index <HASH>..<HASH> 100644 --- a/src/date-picker/TimePickerSpinner.js +++ b/src/date-picker/TimePickerSpinner.js @@ -73,7 +73,6 @@ export default class TimeSpinner extends Component { render() { const { prefixCls } = this.props; const { several } = this.state; - return ( <div ref={(elm) => {
fix(TimePicker): drop-dawn list is selected by default.
uiwjs_uiw
train
js,js
328b16290ea55ab1da0e8c952a2566f817f46118
diff --git a/py/nupic/encoders/delta.py b/py/nupic/encoders/delta.py index <HASH>..<HASH> 100644 --- a/py/nupic/encoders/delta.py +++ b/py/nupic/encoders/delta.py @@ -31,7 +31,7 @@ class DeltaEncoder(AdaptiveScalarEncoder): def __init__(self, w, minval=None, maxval=None, periodic=False, n=0, radius=0, - resolution=0, name=None, verbosity=0, clipInput=True): + resolution=0, name=None, verbosity=0, clipInput=True, forced=False): """[ScalarEncoder class method override]""" self._learningEnabled = True self._stateLock = False @@ -45,7 +45,7 @@ class DeltaEncoder(AdaptiveScalarEncoder): assert n!=0 #An adaptive encoder can only be intialized using n self._adaptiveScalarEnc = AdaptiveScalarEncoder(w=w, n=n, minval=minval, - maxval=maxval, clipInput=True, name=name, verbosity=verbosity) + maxval=maxval, clipInput=True, name=name, verbosity=verbosity, forced=forced) self.width+=self._adaptiveScalarEnc.getWidth() self.n = self._adaptiveScalarEnc.n self._prevAbsolute = None #how many inputs have been sent to the encoder?
add forced param to delta encoder
numenta_nupic
train
py
17b7490891aff8560862d3be8416423b3e1df552
diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index <HASH>..<HASH> 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -309,6 +309,9 @@ func NewTaskRunner(config *Config) (*TaskRunner, error) { // Initialize base labels tr.initLabels() + // Initialize initial task received event + tr.appendEvent(structs.NewTaskEvent(structs.TaskReceived)) + return tr, nil }
taskrunner: emit TaskReceived event Preserve pre-<I>, where task runner emits `Received: Task received by client` event on task runner creation.
hashicorp_nomad
train
go
4cfa10cda5e5088eabce10cef0623e2b2a9c40dd
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -247,14 +247,12 @@ module ActionDispatch args = [] model = record.to_model - name = if model.persisted? - args << model - model.model_name.singular_route_key - else - @key_strategy.call model.model_name - end - - named_route = get_method_for_string name + named_route = if model.persisted? + args << model + get_method_for_string model.model_name.singular_route_key + else + get_method_for_class model + end [named_route, args] end
refactor `handle_model` to use private helper methods for generation
rails_rails
train
rb
a2ddca3d6c3823315bd0f53cd54db1886b6464a1
diff --git a/montblanc/impl/biro/v4/BiroSolver.py b/montblanc/impl/biro/v4/BiroSolver.py index <HASH>..<HASH> 100644 --- a/montblanc/impl/biro/v4/BiroSolver.py +++ b/montblanc/impl/biro/v4/BiroSolver.py @@ -78,6 +78,7 @@ P = [ prop_dict('nbeaml', 'int', 50), prop_dict('nbeamm', 'int', 50), prop_dict('nbeamlambda', 'int', 50), + prop_dict('beam_angular_rot_velocity', 'ft', np.deg2rad(1)) ] # List of arrays
Add an beam_angular_rot_velocity property, describing the speed at which sources rotate within the beam.
ska-sa_montblanc
train
py
daa5bfea331da734335e4055cff5a8c516a1a989
diff --git a/iiif_testserver.py b/iiif_testserver.py index <HASH>..<HASH> 100755 --- a/iiif_testserver.py +++ b/iiif_testserver.py @@ -326,7 +326,7 @@ class IIIFHandler(object): (outfile,mime_type)=self.manipulator.derive(file,self.iiif) # FIXME - find efficient way to serve file with headers self.add_compliance_header() - return send_file(open(outfile,'r'),mimetype=mime_type) + return send_file(open(outfile,'rb'),mimetype=mime_type) def error_response(self, e): """Make response for an IIIFError e.
Fix image serve with py3, #<I>
zimeon_iiif
train
py
2beb090672ef222735be545f039bca9ab99d633d
diff --git a/Library/Installation/Plugin/Installer.php b/Library/Installation/Plugin/Installer.php index <HASH>..<HASH> 100644 --- a/Library/Installation/Plugin/Installer.php +++ b/Library/Installation/Plugin/Installer.php @@ -100,7 +100,7 @@ class Installer */ public function update(PluginBundle $plugin, BundleVersion $current, BundleVersion $target) { - $this->checkRegistrationStatus($plugin, true); + $this->checkInstallationStatus($plugin, true); $this->baseInstaller->update($plugin, $current, $target); // here come the plugin update tasks (e.g. config update) }
[CoreBundle] Fixed wrong method call
claroline_Distribution
train
php
a7de1cf2fdfa99a135f17020f6b2476831ac7bd2
diff --git a/src/Api/CollectorsTrait.php b/src/Api/CollectorsTrait.php index <HASH>..<HASH> 100644 --- a/src/Api/CollectorsTrait.php +++ b/src/Api/CollectorsTrait.php @@ -289,7 +289,7 @@ trait CollectorsTrait * * @return @see Client::sendRequest */ - public function createCollectorMessageRecipientBulk($collectorId, $messageId, array $data = []) + public function createCollectorMessageRecipientBulk($collectorId, $messageId, $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('collectors/%s/messages/%s/recipients/bulk', $collectorId, $messageId), [], $data)
BUGFIX: Updated createCollectorMessageRecipientBulk to not force array type
ghassani_surveymonkey-v3-api-php
train
php
ac98ab7f0bfa58c2dc83ae58ee75713cfe832d16
diff --git a/core/Transform.js b/core/Transform.js index <HASH>..<HASH> 100644 --- a/core/Transform.js +++ b/core/Transform.js @@ -3,9 +3,9 @@ 'use strict'; function Transform() { - this._position = null; - this._rotation = null; - this._scale = null; + this._position = [0, 0, 0]; + this._rotation = [0, 0, 0]; + this._scale = [1, 1, 1]; } Transform.prototype.getPosition = function getPosition() { @@ -21,9 +21,6 @@ Transform.prototype.getScale = function getScale() { }; Transform.identity = new Transform(); -Transform.identity._position = [0, 0, 0]; -Transform.identity._rotation = [0, 0, 0]; -Transform.identity._scale = [1, 1, 1]; Transform.translate = function(x, y, z) { var transform = new Transform();
Fixed Transform to have initial values when it is created(Transform.identity as default)
panarch_famous-mig
train
js
03d83778d5243b28a61e8e6f6e0b1f47df7e8b30
diff --git a/calendar-bundle/contao/Calendar.php b/calendar-bundle/contao/Calendar.php index <HASH>..<HASH> 100644 --- a/calendar-bundle/contao/Calendar.php +++ b/calendar-bundle/contao/Calendar.php @@ -224,9 +224,10 @@ class Calendar extends Frontend * Add events to the indexer * @param array * @param integer + * @param boolean * @return array */ - public function getSearchablePages($arrPages, $intRoot=0) + public function getSearchablePages($arrPages, $intRoot=0, $blnIsSitemap=false) { $arrRoot = array(); @@ -256,7 +257,7 @@ class Calendar extends Frontend $arrProcessed[$objCalendar->jumpTo] = false; // Get target page - $objParent = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=? AND (start='' OR start<$time) AND (stop='' OR stop>$time) AND published=1 AND noSearch!=1") + $objParent = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=? AND (start='' OR start<$time) AND (stop='' OR stop>$time) AND published=1 AND noSearch!=1" . ($blnIsSitemap ? " AND sitemap!='map_never'" : "")) ->limit(1) ->execute($objCalendar->jumpTo);
[Calendar] Consider the site map setting when finding searchable pages (see #<I>)
contao_contao
train
php
7651dff2a0388ce250e46ec61fd0b1db6f1b4f69
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,7 @@ module.exports = class Smart extends Promise { catch () { // need at least 2 if (arguments.length < 2) { - return super.then.call(this, null, ...arguments) + return super.then.bind(this, null).apply(this, arguments) } let args = Array.from(arguments)
fix(node4): workaround for node v4
ahmadnassri_smart-promise
train
js
e2aad2e704e6a3658a1d8549a65a5db94f377392
diff --git a/lib/configurable/conversions.rb b/lib/configurable/conversions.rb index <HASH>..<HASH> 100644 --- a/lib/configurable/conversions.rb +++ b/lib/configurable/conversions.rb @@ -16,11 +16,13 @@ module Configurable traverse do |nesting, config| next if config[:hidden] == true || nesting.any? {|nest| nest[:hidden] == true } - nest_keys = nesting.collect {|nest| nest.key } - nest_names = nesting.collect {|nest| nest.name }.push(config.name) - + nest_keys = nesting.collect {|nest| nest.key } + long, short = nesting.collect {|nest| nest.name }.push(config.name).join(':'), nil + long, short = short, long if long.length == 1 + guess_attrs = { - :long => nest_names.join(':') + :long => long, + :short => short } config_attrs = {
made conversions guess shorts for single-character names
thinkerbot_configurable
train
rb
5e46c31610090ebc425516d94f0ec186a3744afe
diff --git a/eventsourcing/application.py b/eventsourcing/application.py index <HASH>..<HASH> 100644 --- a/eventsourcing/application.py +++ b/eventsourcing/application.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod from dataclasses import dataclass -from typing import Generic, List, Optional, TypeVar +from typing import Any, Generic, List, Optional, TypeVar from uuid import UUID from eventsourcing.domain import ( @@ -312,7 +312,7 @@ class Application(ABC, Generic[TAggregate]): """ return LocalNotificationLog(self.recorder, section_size=10) - def save(self, *aggregates: Aggregate) -> None: + def save(self, *aggregates: Aggregate, **kwargs: Any) -> None: """ Collects pending events from given aggregates and puts them in the application's event store. @@ -320,7 +320,7 @@ class Application(ABC, Generic[TAggregate]): events = [] for aggregate in aggregates: events += aggregate.collect_events() - self.events.put(events) + self.events.put(events, **kwargs) self.notify(events) def notify(self, new_events: List[AggregateEvent]) -> None:
Added **kwargs to Application's save method, passed to EventStore's put method, so that arbitrary objects can be passed down the stack and persisted atomically with the domain events.
johnbywater_eventsourcing
train
py
fc58eec9a6c069c644784601f036e04690619d77
diff --git a/localshop/apps/packages/models.py b/localshop/apps/packages/models.py index <HASH>..<HASH> 100644 --- a/localshop/apps/packages/models.py +++ b/localshop/apps/packages/models.py @@ -53,6 +53,12 @@ class Repository(TimeStampedModel): members__role__in=roles ).exists() + @property + def upstream_pypi_url_api(self): + if self.upstream_pypi_url == 'https://pypi.python.org/simple': + return 'https://pypi.python.org/pypi' + return self.upstream_pypi_url + class Classifier(models.Model): name = models.CharField(max_length=255, unique=True) diff --git a/localshop/apps/packages/tasks.py b/localshop/apps/packages/tasks.py index <HASH>..<HASH> 100644 --- a/localshop/apps/packages/tasks.py +++ b/localshop/apps/packages/tasks.py @@ -20,7 +20,7 @@ def fetch_package(self, repository_pk, slug): logging.info('start fetch_package: %s', slug) response = requests.get( - '%s/%s/json' % (repository.upstream_pypi_url, slug)) + '%s/%s/json' % (repository.upstream_pypi_url_api, slug)) if response.status_code == 404: return
Add temporary hack to workaround pypi.python.org/simple and /pypi difference
mvantellingen_localshop
train
py,py
1444c483693316c896f9c8af1fea247fe80e07f4
diff --git a/lib/parse/object.rb b/lib/parse/object.rb index <HASH>..<HASH> 100644 --- a/lib/parse/object.rb +++ b/lib/parse/object.rb @@ -133,6 +133,10 @@ module Parse as_json.to_json(*a) end + def inspect + "#{@class_name}:#{@parse_object_id} #{super}" + end + # Update the fields of the local Parse object with the current # values from the API. def refresh
include class and id in inspect
adelevie_parse-ruby-client
train
rb
14836bbeca2ce786d94fb5d2cb75a1176e8e5a56
diff --git a/test/integration/dss/test_dss_cli.py b/test/integration/dss/test_dss_cli.py index <HASH>..<HASH> 100755 --- a/test/integration/dss/test_dss_cli.py +++ b/test/integration/dss/test_dss_cli.py @@ -4,7 +4,6 @@ import contextlib import filecmp import json import os -import pty import sys import unittest import uuid @@ -131,6 +130,7 @@ class TestDssCLI(unittest.TestCase): @unittest.skipIf(os.name is 'nt', 'No pty support on Windows') def test_upload_progress_bar_interactive(self): """Tests upload progress bar with a simulated interactive session""" + import pty # Trying to import this on Windows will cause a ModuleNotFoundError dirpath = os.path.join(TEST_DIR, 'tutorial', 'data') # arbitrary and small put_args = ['dss', 'upload', '--src-dir', dirpath, '--replica', 'aws', '--staging-bucket', 'org-humancellatlas-dss-cli-test']
Fix import causing integration failures on Windows There is limited to no pty support on Windows, so test cases calling it are skipped on Windows. This PR changes test behavior to only import pty on non-NT platforms.
HumanCellAtlas_dcp-cli
train
py
ee9e1570befe6e624264d137a442745efd1f147d
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -154,7 +154,7 @@ module ActiveRecord else # Apply limit and order only if they're both present if @limit_value.present? == @order_values.present? - arel.update(@klass.send(:sanitize_sql_for_assignment, updates)) + arel.update(Arel::SqlLiteral.new(@klass.send(:sanitize_sql_for_assignment, updates))) else except(:limit, :order).update_all(updates) end
we should mark strings as SQL Literal values
rails_rails
train
rb
5c9b22de11f9b6b87c5afaae058cdf8db54b8d94
diff --git a/lib/impromptu.js b/lib/impromptu.js index <HASH>..<HASH> 100644 --- a/lib/impromptu.js +++ b/lib/impromptu.js @@ -1,4 +1,3 @@ -var events = require('events') var fs = require('fs') var path = require('path') var util = require('util') @@ -11,11 +10,8 @@ var npmConfig = require('../package.json') /** * The base Impromptu class. * @constructor - * @extends {events.EventEmitter} */ function Impromptu() { - events.EventEmitter.call(this) - this.config = new Impromptu.Config() this._setRootPath(Impromptu.DEFAULT_CONFIG_DIR) @@ -27,10 +23,7 @@ function Impromptu() { this.plugin = new Impromptu.PluginFactory(this) this._loadPlugins = this.plugin.claimPluginLoader() this.prompt = new Impromptu.Prompt(this) - - this.setMaxListeners(200) } -util.inherits(Impromptu, events.EventEmitter) /** * Set paths to files in the impromptu config directory.
Impromptu is no longer an EventEmitter.
impromptu_impromptu
train
js
9b032f9fc5540a114d81173a7d51713490941c77
diff --git a/pyvlx/heartbeat.py b/pyvlx/heartbeat.py index <HASH>..<HASH> 100644 --- a/pyvlx/heartbeat.py +++ b/pyvlx/heartbeat.py @@ -43,7 +43,10 @@ class Heartbeat: await self.loop_event.wait() if not self.stopped: self.loop_event.clear() - await self.pulse() + try: + await self.pulse() + except PyVLXException as e: + pass self.cancel_loop_timeout() self.stopped_event.set()
do not let exception in pulse end the heartbeat
Julius2342_pyvlx
train
py
b96332b97b5c5632e232a115381560fe0d2f6ea3
diff --git a/lib/site_prism/version.rb b/lib/site_prism/version.rb index <HASH>..<HASH> 100644 --- a/lib/site_prism/version.rb +++ b/lib/site_prism/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SitePrism - VERSION = '2.10' + VERSION = '2.10'.freeze end
Quiet rubocop complaint about unfrozen constant
natritmeyer_site_prism
train
rb
b9451371d40e82e0e0e014a4d22854fd8c2f75e9
diff --git a/lib/gem_publisher/publisher.rb b/lib/gem_publisher/publisher.rb index <HASH>..<HASH> 100644 --- a/lib/gem_publisher/publisher.rb +++ b/lib/gem_publisher/publisher.rb @@ -33,12 +33,5 @@ module GemPublisher this_release = @version.split(/\./).map(&:to_i) releases.include?(this_release) end - - def tag_remote - return - sha1 = `git rev-parse HEAD` - system "git update-ref refs/tags/v#@version #{sha1}" - system "git push origin tag v#@version" - end end end
Remove unused method. This presumably predates the GitRemote class.
alphagov_gem_publisher
train
rb
97c6aca1f471f0c4e3ac8a6083ad81045b7a0f15
diff --git a/src/AbstractValidator.php b/src/AbstractValidator.php index <HASH>..<HASH> 100644 --- a/src/AbstractValidator.php +++ b/src/AbstractValidator.php @@ -77,7 +77,7 @@ abstract class AbstractValidator $classMethod = explode("\\", $classMethod); $classMethod = array_pop($classMethod); - $this->conditions[] = [ + $this->conditions[$classMethod] = [ 'key' => $classMethod, 'arguments' => $arguments, 'values' => $errorMessageValues,
Enable rule overriding instead of appending them
nilportugues_php-validator
train
php
1d89cb6c3061c060601f10c43302a0d7c03953e7
diff --git a/lib/techs/deps.js.js b/lib/techs/deps.js.js index <HASH>..<HASH> 100644 --- a/lib/techs/deps.js.js +++ b/lib/techs/deps.js.js @@ -97,7 +97,7 @@ var Deps = exports.Deps = INHERIT({ try { _this.parse(VM.runInThisContext(content), item); } catch(e) { - console.error(path, '\n', e.stack); + return Q.reject(path + '\n' + e.stack); } }); });
Fail build of `deps.js` file in case there are any errors in `deps.js` files of blocks
bem-archive_bem-tools
train
js
273981a4a6fff15e2e1319eb6b7205825fa4daa6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ except IOError: readme = '' setup( name = 'pyaml', - version = '16.9.0', + version = '16.11.0', author = 'Mike Kazantsev', author_email = '[email protected]', license = 'WTFPL', @@ -26,7 +26,6 @@ setup( classifiers = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', - 'License :: OSI Approved', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2 :: Only',
setup: drop "OSI Approved" classifier, WTFPL is not
mk-fg_pretty-yaml
train
py
5542a35946afacd83477e341b0d9c5cc6992cd00
diff --git a/html/pfappserver/root/static.alt/src/views/Status/_store/index.js b/html/pfappserver/root/static.alt/src/views/Status/_store/index.js index <HASH>..<HASH> 100644 --- a/html/pfappserver/root/static.alt/src/views/Status/_store/index.js +++ b/html/pfappserver/root/static.alt/src/views/Status/_store/index.js @@ -69,6 +69,7 @@ const mutations = { CHARTS_UPDATED: (state, chart) => { if (state.charts.filter(c => c.id === chart.id).length) { console.warn('chart ' + chart.id + ' already on dashboard') + } else { state.charts.push(chart) } },
(web admin) Fix condition to add a chart to the dashboard
inverse-inc_packetfence
train
js
b2e142529256574d6e7cfa343c9a3fad9a62a2df
diff --git a/classes/class.tx_solr_template.php b/classes/class.tx_solr_template.php index <HASH>..<HASH> 100644 --- a/classes/class.tx_solr_template.php +++ b/classes/class.tx_solr_template.php @@ -663,10 +663,11 @@ class tx_solr_Template { * * Supported operators are ==, !=, <, <=, >, >=, % * - * @param string First comaprand - * @param string Second comaprand - * @param string Operator - * @return boolean Boolean evaluation of the condition. + * @param string First comaprand + * @param string Second comaprand + * @param string Operator + * @return boolean Boolean evaluation of the condition. + * @throws InvalidArgumentException for unknown $operator */ protected function evaluateCondition($comparand1, $comparand2, $operator) { $conditionResult = FALSE; @@ -693,6 +694,11 @@ class tx_solr_Template { case '%'; $conditionResult = ($comparand1 % $comparand2); break; + default: + throw new InvalidArgumentException( + 'Unknown condition operator "' . htmlspecialchars($operator) . '"', + 1344340207 + ); } // explicit casting, just in case
[TASK] Throw exception on unknown condition operator Change-Id: Ib<I>de<I>eec<I>dd<I>ba<I>c6b<I>f2ad<I>e7
TYPO3-Solr_ext-solr
train
php
459ecda1e881176421b8d2de9f06678ffe4ffbde
diff --git a/supernova/supernova.py b/supernova/supernova.py index <HASH>..<HASH> 100644 --- a/supernova/supernova.py +++ b/supernova/supernova.py @@ -69,7 +69,7 @@ class SuperNova: configuration parameter pair. """ try: - return keyring.get_password('supernova', username) + return keyring.get_password('supernova', username).encode('ascii') except: return False
fixed keyring for windows There is a unicode issue with Windows 8 at a minimum.  The .encode('ascii') fixed the problem for windows and I tested it on OSX and there was no problem.
major_supernova
train
py
71dd1652009c91302d920793da39e12ca5fb559c
diff --git a/contrib/distributed_rails_event_store/dres_client/lib/dres_client/version.rb b/contrib/distributed_rails_event_store/dres_client/lib/dres_client/version.rb index <HASH>..<HASH> 100644 --- a/contrib/distributed_rails_event_store/dres_client/lib/dres_client/version.rb +++ b/contrib/distributed_rails_event_store/dres_client/lib/dres_client/version.rb @@ -1,3 +1,3 @@ module DresClient - VERSION = "0.39.0" + VERSION = "0.6.0" end
Revert unintended version change. This is not yet part of RES release.
RailsEventStore_rails_event_store
train
rb
28ac6d96a425fd4a21c61bdbdae321abde87e305
diff --git a/src/main/java/com/codeborne/selenide/WebDriverRunner.java b/src/main/java/com/codeborne/selenide/WebDriverRunner.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/codeborne/selenide/WebDriverRunner.java +++ b/src/main/java/com/codeborne/selenide/WebDriverRunner.java @@ -137,6 +137,14 @@ public class WebDriverRunner { } private static void writeToFile(String content, File targetFile) { + File reportsFolder = targetFile.getParentFile(); + if (!reportsFolder.exists()) { + System.err.println("Creating folder for test reports: " + reportsFolder); + if (!reportsFolder.mkdirs()) { + System.err.println("Failed to create " + reportsFolder); + } + } + try { FileWriter output = new FileWriter(targetFile); try {
Method writeToFile automatically creates parent folder if it doesn't exist yet.
selenide_selenide
train
java
9bd46f4f4c27f9d48355d8aee4d9f16902ca5440
diff --git a/couchbase/n1ql.py b/couchbase/n1ql.py index <HASH>..<HASH> 100644 --- a/couchbase/n1ql.py +++ b/couchbase/n1ql.py @@ -399,6 +399,8 @@ class N1QLRequest(object): for _ in self: pass + return self + def get_single_result(self): """ Execute the statement and return its single result.
Allow 'N1QLRequest.execute()' to return itself This allows for more idiomatic access such as execute().meta[...] Change-Id: I<I>af5f<I>dbb<I>bfa5abad7af1cdb<I> Reviewed-on: <URL>
couchbase_couchbase-python-client
train
py
b3dec68dcdb381623b187d8a20a2036cf1864628
diff --git a/lib/ore/cli.rb b/lib/ore/cli.rb index <HASH>..<HASH> 100644 --- a/lib/ore/cli.rb +++ b/lib/ore/cli.rb @@ -7,9 +7,22 @@ module Ore default_task :cut + map '-l' => :list desc 'list', 'List installed Ore templates' + # + # Lists builtin and installed templates. + # def list + print_template = lambda { |path| + puts " #{File.basename(path)}" + } + + say "Builtin templates:", :green + Config.builtin_templates(&print_template) + + say "Installed templates:", :green + Config.installed_templates(&print_template) end desc 'install URI', 'Installs an Ore template'
Filled in CLI#list.
ruby-ore_ore
train
rb
727a41c38a24844f5090d1442867b0e7226e22f4
diff --git a/viper.go b/viper.go index <HASH>..<HASH> 100644 --- a/viper.go +++ b/viper.go @@ -176,6 +176,8 @@ func DecodeHook(hook mapstructure.DecodeHookFunc) DecoderConfigOption { // "user": "root", // "endpoint": "https://localhost" // } +// +// Note: Vipers are not safe for concurrent Get() and Set() operations. type Viper struct { // Delimiter that separates a list of keys // used to access a nested value in one go
doc: add a note about concurent Get/Set to godoc
spf13_viper
train
go
16417c6d5ecd196f8ca08b74c104322b8c89a37e
diff --git a/kernel/classes/datatypes/ezimage/ezimagealiashandler.php b/kernel/classes/datatypes/ezimage/ezimagealiashandler.php index <HASH>..<HASH> 100644 --- a/kernel/classes/datatypes/ezimage/ezimagealiashandler.php +++ b/kernel/classes/datatypes/ezimage/ezimagealiashandler.php @@ -1599,8 +1599,7 @@ class eZImageAliasHandler { $this->setOriginalAttributeDataValues( $contentObjectAttribute->attribute( 'id' ), $contentObjectAttribute->attribute( 'version' ), - $contentObjectAttribute->attribute( 'language_code' ), - false ); + $contentObjectAttribute->attribute( 'language_code' ) ); } }
setOriginalAttributeDataValues() method only supports 3 args, but a call uses 4 args => 4th arg is useless
ezsystems_ezpublish-legacy
train
php
5afd98dff578c29bb004cd9910b6c32aac1842d4
diff --git a/spacy/util.py b/spacy/util.py index <HASH>..<HASH> 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -434,6 +434,27 @@ def compounding(start, stop, compound): curr *= compound +def stepping(start, stop, steps): + """Yield an infinite series of values that step from a start value to a + final value over some number of steps. Each step is (stop-start)/steps. + + After the final value is reached, the generator continues yielding that + value. + + EXAMPLE: + >>> sizes = stepping(1., 200., 100) + >>> assert next(sizes) == 1. + >>> assert next(sizes) == 1 * (200.-1.) / 100 + >>> assert next(sizes) == 1 + (200.-1.) / 100 + (200.-1.) / 100 + """ + def clip(value): + return max(value, stop) if (start > stop) else min(value, stop) + curr = float(start) + while True: + yield clip(curr) + curr += (stop - start) / steps + + def decaying(start, stop, decay): """Yield an infinite series of linearly decaying values.""" def clip(value):
Add a stepping function, for changing batch sizes or learning rates
explosion_spaCy
train
py
e7a26682686b19529b5a29dbec296ffc7f8e95ed
diff --git a/tests.py b/tests.py index <HASH>..<HASH> 100644 --- a/tests.py +++ b/tests.py @@ -8,6 +8,7 @@ import bx.intervals.io import bx.phylo.newick_tests import bx.phylo.phast_tests import bx.seqmapping_tests +import bx.seq.nib_tests tests = [] @@ -22,5 +23,6 @@ tests.append( bx.bitset_tests.suite ) tests.append( bx.align.maf_tests.suite ) tests.append( bx.align.score_tests.suite ) tests.append( bx.seqmapping_tests.suite ) +tests.append( bx.seq.nib_tests.suite ) suite = unittest.TestSuite( tests )
added nib_tests.py
bxlab_bx-python
train
py
6ad55a5b5ffb55394e551e3578cf9667a3b70d34
diff --git a/sentinelhub/sh_utils.py b/sentinelhub/sh_utils.py index <HASH>..<HASH> 100644 --- a/sentinelhub/sh_utils.py +++ b/sentinelhub/sh_utils.py @@ -92,6 +92,8 @@ class SentinelHubService: category=SHDeprecationWarning) base_url = base_url or self.config.sh_base_url + if not isinstance(base_url, str): + raise ValueError(f'Sentinel Hub base URL parameter should be a string but got {base_url}') base_url = base_url.rstrip('/') self.service_url = self._get_service_url(base_url)
raising a nicer error in case of missing base_url
sentinel-hub_sentinelhub-py
train
py
9becc5c689caabf9684ad1ea4dfb2a2cc117c33e
diff --git a/src/Model.php b/src/Model.php index <HASH>..<HASH> 100644 --- a/src/Model.php +++ b/src/Model.php @@ -1024,8 +1024,8 @@ class Model implements \ArrayAccess, \IteratorAggregate * but will assume that both models are compatible, * therefore will not perform any loading. * - * @param string $class - * @param array $options + * @param string|Model $class + * @param array $options * * @return Model */ @@ -1061,8 +1061,8 @@ class Model implements \ArrayAccess, \IteratorAggregate * This will cast Model into another class without * loosing state of your active record. * - * @param string $class - * @param array $options + * @param string|Model $class + * @param array $options * * @return Model */ @@ -1088,8 +1088,8 @@ class Model implements \ArrayAccess, \IteratorAggregate * Create new model from the same base class * as $this. * - * @param string $class - * @param array $options + * @param string|Model $class + * @param array $options * * @return Model */ @@ -1097,8 +1097,11 @@ class Model implements \ArrayAccess, \IteratorAggregate { if ($class === null) { $class = get_class($this); + } elseif ($class instanceof self) { + $class = get_class($class); } - $m = $this->persistence->add($class, $options); + + $m = $this->persistence->add('\\'.ltrim($class, '\\'), $options); return $m; }
works better with namespaces (#<I>) * works better with namespaces * use ltrim * add support for saveAs, asModel and newInstance to use Model object as first parameter * Apply fixes from StyleCI
atk4_data
train
php
ce1e883a4fd54063c42d70df40ffac63d77cc22e
diff --git a/logical/plugin/backend_client.go b/logical/plugin/backend_client.go index <HASH>..<HASH> 100644 --- a/logical/plugin/backend_client.go +++ b/logical/plugin/backend_client.go @@ -84,6 +84,9 @@ type RegisterLicenseReply struct { } func (b *backendPluginClient) HandleRequest(req *logical.Request) (*logical.Response, error) { + // Do not send the storage, since go-plugin cannot serialize + // interfaces. The server will pick up the storage from the shim. + req.Storage = nil args := &HandleRequestArgs{ Request: req, } @@ -126,6 +129,9 @@ func (b *backendPluginClient) Logger() log.Logger { } func (b *backendPluginClient) HandleExistenceCheck(req *logical.Request) (bool, bool, error) { + // Do not send the storage, since go-plugin cannot serialize + // interfaces. The server will pick up the storage from the shim. + req.Storage = nil args := &HandleExistenceCheckArgs{ Request: req, }
Do not send storage on HandleRequest and HandleExistenceCheck on plugins
hashicorp_vault
train
go
30c8598f5735bec02b35dfbf1311a7422d800fe3
diff --git a/pale/fields/links.py b/pale/fields/links.py index <HASH>..<HASH> 100644 --- a/pale/fields/links.py +++ b/pale/fields/links.py @@ -5,7 +5,7 @@ class RelativeLinksField(BaseField): This field is inherently a list of relative links, but it's special in that it accepts a list of methods that get called to generate the links. - + Each of these link generation methods should return a tuple with the name of the relative link, as well as the url, i.e. @@ -30,7 +30,10 @@ class RelativeLinksField(BaseField): def render(self, obj, name, context): links = {} for renderer in self.link_generators: - name, val = renderer(obj) + _tup = renderer(obj) + if _tup is None: + continue + name, val = _tup links[name] = val if len(links) == 0: return None
allow relative link generators to return None
Loudr_pale
train
py
428f4682c1ff136880d0987e6b062e95b2448aa4
diff --git a/pypet/storageservice.py b/pypet/storageservice.py index <HASH>..<HASH> 100644 --- a/pypet/storageservice.py +++ b/pypet/storageservice.py @@ -150,6 +150,7 @@ class PipeStorageServiceSender(MultiprocWrapper, LockAcquisition): self.lock = lock self.pickle_pipe = True self.is_locked = False + self._set_logger() def __getstate__(self): # result = super(PipeStorageServiceSender, self).__getstate__()
FIX: Added a logger to the PipeStorageWriter;
SmokinCaterpillar_pypet
train
py
d04a625eb683a8364bae740afcbdc254f409b06c
diff --git a/crud_controller.js b/crud_controller.js index <HASH>..<HASH> 100644 --- a/crud_controller.js +++ b/crud_controller.js @@ -117,6 +117,7 @@ module.exports = Controller.extend({ return collection.fetch(options).tap(function() { var total = _.parseInt(collection.total); + var count = _.parseInt(collection.length); var page = Math.ceil(_.parseInt(options.skip) / _.parseInt(options.limit)) + 1; var pages = Math.ceil(_.parseInt(collection.total) / _.parseInt(options.limit)); var limit = _.parseInt(options.limit) || 0; @@ -124,7 +125,7 @@ module.exports = Controller.extend({ res.paging = { total: total, - count: page, + count: count, limit: limit, offset: skip, page: page,
Fix bug where paging count was using page instead of actual count/length
airbrite_muni
train
js
f3afe3038b14b1e2349623955dd814e3a57643c5
diff --git a/src/js/core.js b/src/js/core.js index <HASH>..<HASH> 100644 --- a/src/js/core.js +++ b/src/js/core.js @@ -402,7 +402,7 @@ Core.prototype.hideButtons = function ($el) { $el = $el || this.$el; - + $el.find('.medium-insert-buttons').hide(); $el.find('.medium-insert-buttons-addons').hide(); }; @@ -477,11 +477,18 @@ */ Core.prototype.moveCaret = function (element) { - var range, sel; + var range, sel, el; range = document.createRange(); sel = window.getSelection(); - range.setStart(element.get(0).childNodes[0], 0); + el = element.get(0); + + if (!el.childNodes.length) { + var textEl = document.createTextNode(' '); + el.appendChild(textEl); + } + + range.setStart(el.childNodes[0], 0); range.collapse(true); sel.removeAllRanges(); sel.addRange(range);
in moveCaret, ensure that target element has a text node child, create an empty one if none exists (for ie9 compatibility)
orthes_medium-editor-insert-plugin
train
js
6991bcbc24de3238ab321787e5159af5a0782c60
diff --git a/plugin/00default.rb b/plugin/00default.rb index <HASH>..<HASH> 100644 --- a/plugin/00default.rb +++ b/plugin/00default.rb @@ -359,6 +359,8 @@ end enable_js( '00default.js' ) add_js_setting( '$tDiary.style', "'#{@conf.style.downcase.sub( /\Ablog/, '' )}'" ) + enable_js( '02edit.js' ) + def script_tag_query_string "?#{TDIARY_VERSION}#{Time::now.strftime('%Y%m%d')}" end diff --git a/tdiary.rb b/tdiary.rb index <HASH>..<HASH> 100644 --- a/tdiary.rb +++ b/tdiary.rb @@ -377,8 +377,9 @@ module TDiary def load_logger return if @logger + require 'fileutils' log_path = (@conf.log_path || "#{@conf.data_path}log").untaint - Dir::mkdir( log_path ) unless FileTest::directory?( log_path ) + FileUtils.mkdir_p( log_path ) unless FileTest::directory?( log_path ) @logger = Logger::new( File.join(log_path, "debug.log"), 'daily' ) @logger.level = Logger.const_get( @conf.log_level || 'DEBUG' )
handling error when not found parent directory for log path.
tdiary_tdiary-core
train
rb,rb
2ffe87e9d257e0c6cc584c11a4b55a3bb7fa1470
diff --git a/src/java/org/apache/cassandra/tools/BulkLoader.java b/src/java/org/apache/cassandra/tools/BulkLoader.java index <HASH>..<HASH> 100644 --- a/src/java/org/apache/cassandra/tools/BulkLoader.java +++ b/src/java/org/apache/cassandra/tools/BulkLoader.java @@ -69,12 +69,14 @@ public class BulkLoader ProgressIndicator indicator = new ProgressIndicator(future.getPendingFiles()); indicator.start(); System.out.println(""); + boolean printEnd = false; while (!future.isDone()) { if (indicator.printProgress()) { // We're done with streaming System.out.println("\nWaiting for targets to rebuild indexes ..."); + printEnd = true; future.get(); assert future.isDone(); } @@ -83,6 +85,8 @@ public class BulkLoader try { Thread.sleep(1000L); } catch (Exception e) {} } } + if (!printEnd) + indicator.printProgress(); } System.exit(0); // We need that to stop non daemonized threads
fix loader progress bar display when the transfer was lightning fast git-svn-id: <URL>
Stratio_stratio-cassandra
train
java
4c681e15832bdfd968c1baee91f46e0b54e230b8
diff --git a/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java b/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java index <HASH>..<HASH> 100644 --- a/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java @@ -46,11 +46,6 @@ import java.util.concurrent.TimeUnit; public class RateLimiterTest extends TestCase { private static final double EPSILON = 1e-8; - /** - * The stopwatch gathers events and presents them as strings. - * R0.6 means a delay of 0.6 seconds caused by the (R)ateLimiter - * U1.0 means the (U)ser caused the stopwatch to sleep for a second. - */ private final FakeStopwatch stopwatch = new FakeStopwatch(); public void testSimple() { @@ -393,7 +388,12 @@ public class RateLimiterTest extends TestCase { assertEquals(Arrays.toString(events), stopwatch.readEventsAndClear()); } - private static class FakeStopwatch extends SleepingStopwatch { + /** + * The stopwatch gathers events and presents them as strings. + * R0.6 means a delay of 0.6 seconds caused by the (R)ateLimiter + * U1.0 means the (U)ser caused the stopwatch to sleep for a second. + */ + static class FakeStopwatch extends SleepingStopwatch { long instant = 0L; final List<String> events = Lists.newArrayList();
Shuffling from internal-only change. ------------- Created by MOE: <URL>
google_guava
train
java
e4c16ea8940ef5391b377607ed1845baaff328c3
diff --git a/tests/conftest.py b/tests/conftest.py index <HASH>..<HASH> 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -78,7 +78,7 @@ class ProcessFixture(object): time.sleep(0.1) if self.wait_port: - wait_for_net_service("127.0.0.1", int(self.wait_port)) + wait_for_net_service("127.0.0.1", int(self.wait_port), poll_interval=0.01) def stop(self, force=False, timeout=None, block=True, sig=15): @@ -239,7 +239,7 @@ class WorkerFixture(ProcessFixture): return out def get_report(self): - wait_for_net_service("127.0.0.1", 20020) + wait_for_net_service("127.0.0.1", 20020, poll_interval=0.01) f = urllib2.urlopen("http://127.0.0.1:20020") data = json.load(f) f.close()
Use lower poll_interval for tests
pricingassistant_mrq
train
py
ff3e9605c79ce535b28d822161688dcf28dde026
diff --git a/test/com/google/javascript/jscomp/InlineVariablesTest.java b/test/com/google/javascript/jscomp/InlineVariablesTest.java index <HASH>..<HASH> 100644 --- a/test/com/google/javascript/jscomp/InlineVariablesTest.java +++ b/test/com/google/javascript/jscomp/InlineVariablesTest.java @@ -844,6 +844,18 @@ public final class InlineVariablesTest extends CompilerTestCase { "}")); } + public void testVarInBlock1() { + test( + "function f(x) { if (true) {var y = x; y; y;} }", + "function f(x) { if (true) {x; x;} }"); + } + + public void testVarInBlock2() { + test( + "function f(x) { switch (0) { case 0: { var y = x; y; y; } } }", + "function f(x) { switch (0) { case 0: { x; x; } } }"); + } + public void testLocalsOnly1() { inlineLocalsOnly = true; test(
Add a few tests to make sure that the switch to ES6 scope creator doesn't regress functionality. ------------- Created by MOE: <URL>
google_closure-compiler
train
java
0bbee1f8842e15e4cf851262a5955579ec81c149
diff --git a/src/main/java/water/util/Utils.java b/src/main/java/water/util/Utils.java index <HASH>..<HASH> 100644 --- a/src/main/java/water/util/Utils.java +++ b/src/main/java/water/util/Utils.java @@ -378,9 +378,10 @@ public class Utils { result[0] = a[startIndex]; for (int i = 1; i < n; i++) { int j = random.nextInt(i+1); - if (j!=i) result[i] = a[startIndex+j]; + if (j!=i) result[i] = result[j]; result[j] = a[startIndex+i]; } + for (int val : a) assert(Utils.contains(result, val)); return result; }
Fix bug in shuffleArray, was not doing a bijection. Affected feature importances.
h2oai_h2o-2
train
java
14ec838c0aad75098c5c86f77603640f6b1e7efc
diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/provider/nameservice/directoryservice.rb +++ b/lib/puppet/provider/nameservice/directoryservice.rb @@ -108,6 +108,9 @@ class DirectoryService < Puppet::Provider::NameService return @macosx_version_major end begin + # Make sure we've loaded all of the facts + Facter.loadfacts + if Facter.value(:macosx_productversion_major) product_version_major = Facter.value(:macosx_productversion_major) else
Explicitly loading all facts in the directory service provider We otherwise have load-order issues, where this provider tries to use the facts but they aren't currently autoloaded by default in Facter.
puppetlabs_puppet
train
rb
279d6a0ebb0b1aea482ddba937d28e6f4bce6c71
diff --git a/tm-bench/transacter.go b/tm-bench/transacter.go index <HASH>..<HASH> 100644 --- a/tm-bench/transacter.go +++ b/tm-bench/transacter.go @@ -207,7 +207,7 @@ func generateTx(a int, b int, hosthash [16]byte) []byte { } // 32-40 current time - PutUvarint(tx[32:40], uint64(time.Now().Unix())) + binary.PutUvarint(tx[32:40], uint64(time.Now().Unix())) // 40-64 random data if _, err := rand.Read(tx[40:]); err != nil {
Typo fix in transacter.go
tendermint_tendermint
train
go
8b5cf73ccc608060c32c5c87f6541df67ce6b405
diff --git a/lib/liquid/drop.rb b/lib/liquid/drop.rb index <HASH>..<HASH> 100644 --- a/lib/liquid/drop.rb +++ b/lib/liquid/drop.rb @@ -29,7 +29,7 @@ module Liquid # called by liquid to invoke a drop def invoke_drop(method_or_key) - if self.class.public_method_defined?(method_or_key.to_s.to_sym) + if method_or_key != '' && self.class.public_method_defined?(method_or_key.to_s.to_sym) send(method_or_key.to_s.to_sym) else before_method(method_or_key) diff --git a/test/lib/liquid/drop_test.rb b/test/lib/liquid/drop_test.rb index <HASH>..<HASH> 100644 --- a/test/lib/liquid/drop_test.rb +++ b/test/lib/liquid/drop_test.rb @@ -155,4 +155,8 @@ class DropsTest < Test::Unit::TestCase def test_enumerable_drop_size assert_equal '3', Liquid::Template.parse( '{{collection.size}}').render('collection' => EnumerableDrop.new) end + + def test_empty_string_value_access + assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => '') + end end # DropsTest
Fix regression with calling a drop with a empty string
Shopify_liquid
train
rb,rb
330397d370a9c79d1eed47097c169019aa31b8c2
diff --git a/app/helpers/lines/application_helper.rb b/app/helpers/lines/application_helper.rb index <HASH>..<HASH> 100644 --- a/app/helpers/lines/application_helper.rb +++ b/app/helpers/lines/application_helper.rb @@ -76,7 +76,7 @@ module Lines "<div class='submenu'> <div class='submenu-inner'> <ul> - <li>#{link_to("Dashboard", admin_articles_path)}</li> + <li>#{link_to(t('lines.buttons.dashboard').html_safe, admin_articles_path)}</li> <li>#{link_to(t('activerecord.models.lines/author', count: 2).html_safe, admin_authors_path)}</li> </ul> <ul>
Add dashboard translation to render_navbar method on application_helper.rb
opoloo_lines-engine
train
rb
1305e6cd4517ee7b6ebb31695099edd01e007a2a
diff --git a/lib/attr_extras/explicit.rb b/lib/attr_extras/explicit.rb index <HASH>..<HASH> 100644 --- a/lib/attr_extras/explicit.rb +++ b/lib/attr_extras/explicit.rb @@ -21,10 +21,11 @@ module AttrExtras end def attr_private(*names) - if names && !names.empty? - attr_reader(*names) - private(*names) - end + # Avoid warnings: https://github.com/barsoom/attr_extras/pull/31 + return unless names && names.any? + + attr_reader(*names) + private(*names) end def attr_value(*names)
Change 'if' block to guard More conventional in our team.
barsoom_attr_extras
train
rb
e890072c16183f73e169eada81c93332506399db
diff --git a/Resources/public/js/vendor/jquery.dialog2.js b/Resources/public/js/vendor/jquery.dialog2.js index <HASH>..<HASH> 100644 --- a/Resources/public/js/vendor/jquery.dialog2.js +++ b/Resources/public/js/vendor/jquery.dialog2.js @@ -331,6 +331,8 @@ overlay.hide(); + $('body').removeClass('modal-open'); + dialog .removeClass("opened") .parent().parent().parent().hide(); @@ -347,6 +349,8 @@ if (!dialog.is(".opened")) { this.__overlay.show(); + $('body').addClass('modal-open'); + dialog .trigger("dialog2.before-open") .addClass("opened")
Fix Bootstrap <I> scrolling issue with Dialog2
vivait_BootstrapBundle
train
js
9b2fadcc3e3206d820b7debd89dec471b73433f5
diff --git a/components/utils/scripts/proxy.js b/components/utils/scripts/proxy.js index <HASH>..<HASH> 100644 --- a/components/utils/scripts/proxy.js +++ b/components/utils/scripts/proxy.js @@ -38,6 +38,7 @@ elation.require(['utils.events'], function() { } var getProxyValue = function(target, name) { + if (name == '_proxydefs') return proxydefs; if (proxydefs && proxydefs.hasOwnProperty(name)) { var def = proxydefs[name]; var value;
Expose _proxydefs as property
jbaicoianu_elation
train
js
cf7cf86f2854f9d7ade0c7bf0ab1c24fdbe3ab6f
diff --git a/packages/build-tools/utils/manifest.deprecated.js b/packages/build-tools/utils/manifest.deprecated.js index <HASH>..<HASH> 100644 --- a/packages/build-tools/utils/manifest.deprecated.js +++ b/packages/build-tools/utils/manifest.deprecated.js @@ -65,4 +65,4 @@ async function aggregateBoltDependencies(data) { module.exports = { aggregateBoltDependencies, flattenDeep, -}; \ No newline at end of file +};
chore: fix linting issue
bolt-design-system_bolt
train
js
e47fe9094120b386d8e0153cf4008c115d46d223
diff --git a/lib/messagebird/client.rb b/lib/messagebird/client.rb index <HASH>..<HASH> 100644 --- a/lib/messagebird/client.rb +++ b/lib/messagebird/client.rb @@ -20,8 +20,8 @@ module MessageBird class Client attr_reader :access_key - def initialize(access_key) - @access_key = access_key + def initialize(access_key = nil) + @access_key = access_key || ENV['MESSAGE_BIRD_ACCES_KEY'] end def request(method, path, params={})
allowing initializer to read from env file
messagebird_ruby-rest-api
train
rb
65235aa57c8dd32daec3c63448f6ce873d4dc385
diff --git a/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/SecuredEndpoint.java b/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/SecuredEndpoint.java index <HASH>..<HASH> 100644 --- a/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/SecuredEndpoint.java +++ b/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/SecuredEndpoint.java @@ -116,6 +116,10 @@ public abstract class SecuredEndpoint extends AbstractEndpoint { } } + protected boolean isSuperAdmin() { + return userIdentityContext.getEffectiveAccount().getParentSid() == null; + } + /** * Grants access by permission. If the effective account has a role that resolves * to the specified permission (accoording to mappings of restcomm.xml) access is granted.
Added method to check if the effective account is a super admin. This refer to #<I>
RestComm_Restcomm-Connect
train
java
9d6d94ddb4b3f440909a8ff9fd25d6626f5ba23e
diff --git a/madison_wcb.py b/madison_wcb.py index <HASH>..<HASH> 100644 --- a/madison_wcb.py +++ b/madison_wcb.py @@ -78,7 +78,7 @@ def move_to(x, y): def point_in_direction(angle): make_cnc_request("move.absturn./" + str(angle)) - state['turtle'].setheading(angle + 90) + state['turtle'].setheading(90 - angle) def move_forward(num_steps): make_cnc_request("move.forward./" + str(num_steps)) @@ -128,7 +128,7 @@ def flower_scene(): # stem 1 move_to(-100, -145) - point_in_direction(0) + point_in_direction(20) brush_down() for _ in range(25): move_forward(5) @@ -142,7 +142,7 @@ def flower_scene(): # stem 2 move_to(-100, -145) - point_in_direction(20) + point_in_direction(0) brush_down() for _ in range(25): move_forward(5)
fix bug in angle conversion between turtle coordinate system and scratch coordinate system
jrheard_madison_wcb
train
py
590f40209e83e918f2b7c4c46e92e1c476a34594
diff --git a/opendatalake/classification/named_folders.py b/opendatalake/classification/named_folders.py index <HASH>..<HASH> 100644 --- a/opendatalake/classification/named_folders.py +++ b/opendatalake/classification/named_folders.py @@ -3,7 +3,9 @@ from scipy.misc import imread from random import shuffle import numpy as np import json -from datasets.tfrecords import PHASE_TRAIN, PHASE_VALIDATION + +PHASE_TRAIN = "train" +PHASE_VALIDATION = "validation" def one_hot(idx, max_idx):
Update named_folders.py
penguinmenac3_opendatalake
train
py
9e25097748ec249644e4a026f26ba9596adcc3a8
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index <HASH>..<HASH> 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto/ofproto_v1_0_parser.py @@ -459,9 +459,9 @@ class OFPActionVendor(OFPAction): return cls return _register_action_vendor - def __init__(self, vendor): + def __init__(self): super(OFPActionVendor, self).__init__() - self.vendor = vendor + self.vendor = self.cls_vendor @classmethod def parser(cls, buf, offset): @@ -484,7 +484,7 @@ class NXActionHeader(OFPActionVendor): return _register_nx_action_subtype def __init__(self, subtype_, len_): - super(NXActionHeader, self).__init__(ofproto_v1_0.NX_VENDOR_ID) + super(NXActionHeader, self).__init__() self.len = len_ self.subtype = subtype_
of<I>: simplify OFPActionVendor vendor value is available as cls_vendor.
osrg_ryu
train
py
dff56b80257d3ddba50765e24872f39339be1f50
diff --git a/tests/specifications/external_spec_test.py b/tests/specifications/external_spec_test.py index <HASH>..<HASH> 100644 --- a/tests/specifications/external_spec_test.py +++ b/tests/specifications/external_spec_test.py @@ -183,3 +183,24 @@ def test_in_and_exclude_checks(): x in check.id for x in exclude_checks): check_names_expected.add(check.id) assert check_names == check_names_expected + + +def test_in_and_exclude_checks_default(): + spec_imports = ("fontbakery.specifications.opentype",) + specification = spec_factory(default_section=Section("OpenType Testing")) + specification.auto_register({}, spec_imports=spec_imports) + specification.test_dependencies() + explicit_checks = None # "All checks aboard" + exclude_checks = None # "No checks left behind" + iterargs = {"font": 1} + check_names = { + c[1].id for c in specification.execution_order( + iterargs, + explicit_checks=explicit_checks, + exclude_checks=exclude_checks) + } + check_names_expected = set() + for section in specification.sections: + for check in section.checks: + check_names_expected.add(check.id) + assert check_names == check_names_expected
Add check in/exclude test for no in/excluding
googlefonts_fontbakery
train
py
7428e6572a9f08d26d436431858b8ed883421f0f
diff --git a/lib/time_boots/boot/day.rb b/lib/time_boots/boot/day.rb index <HASH>..<HASH> 100644 --- a/lib/time_boots/boot/day.rb +++ b/lib/time_boots/boot/day.rb @@ -8,23 +8,17 @@ module TimeBoots protected def _advance(tm, steps) - res = super(tm, steps) - - if res.dst? && !tm.dst? - hour.decrease(res) - elsif !res.dst? && tm.dst? - hour.advance(res) - else - res - end + fix_dst(super(tm, steps), tm) end def _decrease(tm, steps) - res = super(tm, steps) + fix_dst(super(tm, steps), tm) + end - if res.dst? && !tm.dst? + def fix_dst(res, src) + if res.dst? && !src.dst? hour.decrease(res) - elsif !res.dst? && tm.dst? + elsif !res.dst? && src.dst? hour.advance(res) else res
Simplification again. Thanks, codeclimate!
zverok_time_math2
train
rb
a967197a9bc581e2e3337046674f4f5a267ada76
diff --git a/protempa-framework/src/main/java/org/protempa/BackendManager.java b/protempa-framework/src/main/java/org/protempa/BackendManager.java index <HASH>..<HASH> 100644 --- a/protempa-framework/src/main/java/org/protempa/BackendManager.java +++ b/protempa-framework/src/main/java/org/protempa/BackendManager.java @@ -23,10 +23,10 @@ class BackendManager<E extends BackendUpdatedEvent, S extends Source<E>, private B[] backendsToAdd; - private S source; +// private S source; BackendManager(S source, B[] backends) { - this.source = source; +// this.source = source; this.backendsToAdd = backends; } @@ -37,7 +37,6 @@ class BackendManager<E extends BackendUpdatedEvent, S extends Source<E>, /** * Connect to the knowledge source backend. */ - @SuppressWarnings("unchecked") void initializeIfNeeded() throws BackendInitializationException, BackendNewInstanceException { List<B> ksb = null;
Resolved warnings about unnecessary @SuppressWarnings("unchecked") and unused code.
eurekaclinical_protempa
train
java
4a88a13e92b65f409fc8583d43abc8178a75743c
diff --git a/lib/converters/v1.0.0/converter-v1-to-v2.js b/lib/converters/v1.0.0/converter-v1-to-v2.js index <HASH>..<HASH> 100644 --- a/lib/converters/v1.0.0/converter-v1-to-v2.js +++ b/lib/converters/v1.0.0/converter-v1-to-v2.js @@ -623,6 +623,11 @@ _.assign(Builders.prototype, { responses_order = _.map(responses, 'id'); } + // Filter out any response id that is not available + responses_order = _.filter(responses_order, function (responseId) { + return _.has(responsesCache, responseId); + }); + return _.map(responses_order, function (responseId) { return self.singleResponse(responsesCache[responseId]); });
Ensure v1->v2 conversion does not error out when invalid response ids are provided in responses_order
postmanlabs_postman-collection-transformer
train
js
bbd37d111d681f4088d5db3d0721a79f84b26972
diff --git a/library/CMService/MaxMind.php b/library/CMService/MaxMind.php index <HASH>..<HASH> 100644 --- a/library/CMService/MaxMind.php +++ b/library/CMService/MaxMind.php @@ -1059,7 +1059,7 @@ class CMService_MaxMind extends CM_Class_Abstract { } } elseif (strlen($countryCode)) { // Country record if (!isset($this->_locationTree[$countryCode]['location'])) { - if (in_array($countryCode, array('A1', 'A2', 'AP', 'EU'), true)) { + if (in_array($countryCode, array('O1', 'A1', 'A2', 'AP', 'EU'), true)) { $infoListWarning['Ignoring proprietary MaxMind country codes'][] = $countryCode; } elseif (!isset($this->_countryList[$countryCode])) { $infoListWarning['Ignoring unknown countries'][] = $countryCode . ' (' . implode(', ', $row) . ')';
Added proprietary country code "O1"
cargomedia_cm
train
php
ec86165eeab7681eef5ab9ab553316253fc763e3
diff --git a/scripts/stackstorm.js b/scripts/stackstorm.js index <HASH>..<HASH> 100644 --- a/scripts/stackstorm.js +++ b/scripts/stackstorm.js @@ -98,7 +98,7 @@ module.exports = function(robot) { robot.logger.info('Loading commands....'); // TODO: We should use st2client for this - request = client.scope('/exp/actionalias'); + request = client.scope('/v1/actionalias'); if (auth_token) { request = request.header('X-Auth-Token', auth_token); @@ -163,7 +163,7 @@ module.exports = function(robot) { robot.logger.debug('Sending command payload %s ' + JSON.stringify(payload)); - client.scope('/exp/aliasexecution').post(JSON.stringify(payload)) ( + client.scope('/v1/aliasexecution').post(JSON.stringify(payload)) ( function(err, resp, body) { var message, history_url, execution_id;
Use v1 API endpoints for actionalias and aliasexecution
StackStorm_hubot-stackstorm
train
js
b91e10b2c2743cb6c7fa5b15ce2a4decffc24903
diff --git a/pifpaf/tests/test_cli.py b/pifpaf/tests/test_cli.py index <HASH>..<HASH> 100644 --- a/pifpaf/tests/test_cli.py +++ b/pifpaf/tests/test_cli.py @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from distutils import spawn import os import signal import subprocess @@ -20,10 +21,14 @@ import testtools class TestCli(testtools.TestCase): + @testtools.skipUnless(spawn.find_executable("memcached"), + "memcached not found") def test_cli(self): self.assertEqual(0, os.system( "pifpaf run memcached --port 11216 echo >/dev/null 2>&1")) + @testtools.skipUnless(spawn.find_executable("memcached"), + "memcached not found") def test_eval(self): c = subprocess.Popen(["pifpaf", "run", "memcached", "--port", "11215"], stdout=subprocess.PIPE)
Fix test_cli when memcached is absent
jd_pifpaf
train
py
60ec4def1e3627f9691c2d7544971358cf0f81aa
diff --git a/server/build/webpack.js b/server/build/webpack.js index <HASH>..<HASH> 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -103,6 +103,10 @@ export default async function createCompiler (dir, { dev = false, quiet = false ) } + const nodePathList = (process.env.NODE_PATH || '') + .split(process.platform === 'win32' ? ';' : ':') + .filter((p) => !!p) + const mainBabelOptions = { babelrc: true, cacheDirectory: true, @@ -185,18 +189,16 @@ export default async function createCompiler (dir, { dev = false, quiet = false resolve: { modules: [ nextNodeModulesDir, - 'node_modules' - ].concat( - (process.env.NODE_PATH || '') - .split(process.platform === 'win32' ? ';' : ':') - .filter((p) => !!p) - ) + 'node_modules', + ...nodePathList + ] }, resolveLoader: { modules: [ nextNodeModulesDir, 'node_modules', - join(__dirname, 'loaders') + join(__dirname, 'loaders'), + ...nodePathList ] }, plugins,
Add NODE_PATH support for resolveLoaders as well. (#<I>) * Add NODE_PATH support for resolveLoaders as well. * Remove unwanted code.
zeit_next.js
train
js
25ccb64a807ba265333895aa682137d53028582c
diff --git a/README.md b/README.md index <HASH>..<HASH> 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # BBS Server Internal API to access the database for Diego. + +## Code Generation + +We generate code from the .proto (protobuf) files. We also generate a set of fakes from the interfaces we have. +To do so, just use `go generate`. + +``` +go generate ./... +``` diff --git a/errors.go b/errors.go index <HASH>..<HASH> 100644 --- a/errors.go +++ b/errors.go @@ -1,5 +1,6 @@ package bbs +//go:generate protoc --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf/:. --gogofast_out=. error.proto func (err Error) Error() string { return err.GetMessage() } diff --git a/models/actual_lrp.go b/models/actual_lrp.go index <HASH>..<HASH> 100644 --- a/models/actual_lrp.go +++ b/models/actual_lrp.go @@ -6,6 +6,7 @@ import ( "time" ) +//go:generate protoc --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf/:. --gogofast_out=. actual_lrp.proto const ( ActualLRPStateUnclaimed = "UNCLAIMED" ActualLRPStateClaimed = "CLAIMED"
Add proto generation to go generate [#<I>]
cloudfoundry_bbs
train
md,go,go
f48f8cd105a3444b01cd4e84b67419570a0526e9
diff --git a/src/js/components/CheckBox/stories/Indeterminate.js b/src/js/components/CheckBox/stories/Indeterminate.js index <HASH>..<HASH> 100644 --- a/src/js/components/CheckBox/stories/Indeterminate.js +++ b/src/js/components/CheckBox/stories/Indeterminate.js @@ -48,6 +48,6 @@ const IndeterminateCheckBox = () => { ); }; -storiesOf('CheckBox', module).add('Interminate', () => ( +storiesOf('CheckBox', module).add('Indeterminate', () => ( <IndeterminateCheckBox /> ));
docs: fix indeterminate typo in Indeterminate story (#<I>)
grommet_grommet
train
js
4203c261536380259235ba087a8c1e048c725825
diff --git a/example/driver.py b/example/driver.py index <HASH>..<HASH> 100644 --- a/example/driver.py +++ b/example/driver.py @@ -3,7 +3,6 @@ from pyannotate_runtime import collect_types if __name__ == '__main__': collect_types.init_types_collection() - collect_types.resume() - main() - collect_types.pause() + with collect_types.collect(): + main() collect_types.dump_stats('type_info.json') diff --git a/pyannotate_runtime/collect_types.py b/pyannotate_runtime/collect_types.py index <HASH>..<HASH> 100644 --- a/pyannotate_runtime/collect_types.py +++ b/pyannotate_runtime/collect_types.py @@ -47,6 +47,7 @@ from typing import ( TypeVar, Union, ) +from contextlib import contextmanager # pylint: disable=invalid-name @@ -642,6 +643,15 @@ sampling_counters = {} # type: Dict[int, Optional[int]] call_pending = set() # type: Set[int] +@contextmanager +def collect(): + resume() + try: + yield + finally: + pause() + + def pause(): # type: () -> None """
Add context manager so you can use "with collect_types.collect()" (#<I>) Fixes #<I>
dropbox_pyannotate
train
py,py
fb509ac8b70956c28d33578ad08ff8a14c54a449
diff --git a/plugins/synced_folders/rsync/helper.rb b/plugins/synced_folders/rsync/helper.rb index <HASH>..<HASH> 100644 --- a/plugins/synced_folders/rsync/helper.rb +++ b/plugins/synced_folders/rsync/helper.rb @@ -56,8 +56,10 @@ module VagrantPlugins # Connection information username = ssh_info[:username] host = ssh_info[:host] + proxy_command = "-o ProxyCommand='#{ssh_info[:proxy_command]}' " if ssh_info[:proxy_command] rsh = [ "ssh -p #{ssh_info[:port]} " + + proxy_command + "-o StrictHostKeyChecking=no " + "-o UserKnownHostsFile=/dev/null", ssh_info[:private_key_path].map { |p| "-i '#{p}'" },
Add ssh ProxyCommand functionality to rsync
hashicorp_vagrant
train
rb
47d746a99a20b6e572f7f50d5b7631841b017835
diff --git a/src/testhelpers/commands/context.go b/src/testhelpers/commands/context.go index <HASH>..<HASH> 100644 --- a/src/testhelpers/commands/context.go +++ b/src/testhelpers/commands/context.go @@ -7,6 +7,7 @@ import ( "strings" "cf/commands" testreq "testhelpers/requirements" + "fmt" ) func NewContext(cmdName string, args []string) (*cli.Context) { @@ -49,7 +50,7 @@ func findCommand(cmdName string) (cmd cli.Command) { return cmd } } - + panic(fmt.Sprintf("command %s does not exist",cmdName)) return }
test context panics if it cannot find requested command
cloudfoundry_cli
train
go
798384540841c404635448bf7367da70ae325f8e
diff --git a/lib/chef/property.rb b/lib/chef/property.rb index <HASH>..<HASH> 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -347,7 +347,7 @@ class Chef # `get`, the non-lazy, coerced, validated value will always be returned. # def call(resource, value = NOT_PASSED) - if NOT_PASSED == value + if NOT_PASSED == value # see https://github.com/chef/chef/pull/8781 before changing this get(resource) else set(resource, value)
Add comment to property call method order Let's make sure we don't revert this by accident
chef_chef
train
rb
c6f630d65a06fa52fafd6846b5b29ee71f599eab
diff --git a/reactor-core/src/test/java/reactor/core/publisher/ContextTests.java b/reactor-core/src/test/java/reactor/core/publisher/ContextTests.java index <HASH>..<HASH> 100644 --- a/reactor-core/src/test/java/reactor/core/publisher/ContextTests.java +++ b/reactor-core/src/test/java/reactor/core/publisher/ContextTests.java @@ -47,7 +47,7 @@ public class ContextTests { }) .log()) .take(10) - //ctx: test=baseSubscriber_range + //ctx: test=baseSubscriber_take //return: test=baseSubscriber_take_range .subscriberContext(ctx -> ctx.put("test", ctx.get("test") + "_range")) //ctx: test=baseSubscriber
Fix comment about Context content in test (#<I>)
reactor_reactor-core
train
java
977a79caac4debb638f707faf88a5ad2cc8ca041
diff --git a/src/XeroPHP/Remote/Object.php b/src/XeroPHP/Remote/Object.php index <HASH>..<HASH> 100644 --- a/src/XeroPHP/Remote/Object.php +++ b/src/XeroPHP/Remote/Object.php @@ -292,9 +292,10 @@ abstract class Object implements ObjectInterface, \JsonSerializable, \ArrayAcces return $instance; default: - if(is_scalar($value)) + if(is_scalar($value)){ return (string) $value; - return ''; + } + return (object) $value; }
Updated unknown property returning to not be an empty string.
calcinai_xero-php
train
php
61e652c4726cc8ead25126fea03831c4d817b802
diff --git a/msk/__init__.py b/msk/__init__.py index <HASH>..<HASH> 100644 --- a/msk/__init__.py +++ b/msk/__init__.py @@ -19,4 +19,4 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -__version__ = '0.1.3' # Also update in setup.py +__version__ = '0.3.0' # Also update in setup.py diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ from setuptools import setup setup( name='msk', - version='0.2.0', # Also update in msk/__init__.py + version='0.3.0', # Also update in msk/__init__.py packages=['msk'], install_requires=['GitPython', 'typing', 'msm>=0.5.13', 'pygithub'], url='https://github.com/MycroftAI/mycroft-skills-kit',
Increment version to <I>
MycroftAI_mycroft-skills-kit
train
py,py
893d228e5e0b6efa8c3614128ff611b30b9a88b2
diff --git a/datastore/google/cloud/datastore/__init__.py b/datastore/google/cloud/datastore/__init__.py index <HASH>..<HASH> 100644 --- a/datastore/google/cloud/datastore/__init__.py +++ b/datastore/google/cloud/datastore/__init__.py @@ -18,17 +18,17 @@ You'll typically use these to get started with the API: .. doctest:: constructors - >>> from google.cloud import datastore - >>> - >>> client = datastore.Client() - >>> key = client.key('EntityKind', 1234) - >>> key - <Key('EntityKind', 1234), project=...> - >>> entity = datastore.Entity(key) - >>> entity['answer'] = 42 - >>> entity - <Entity('EntityKind', 1234) {'answer': 42}> - >>> query = client.query(kind='EntityKind') + >>> from google.cloud import datastore + >>> + >>> client = datastore.Client() + >>> key = client.key('EntityKind', 1234) + >>> key + <Key('EntityKind', 1234), project=...> + >>> entity = datastore.Entity(key) + >>> entity['answer'] = 42 + >>> entity + <Entity('EntityKind', 1234) {'answer': 42}> + >>> query = client.query(kind='EntityKind') The main concepts with this API are:
Changing doctest indent from 2->3 spaces to be uniform.
googleapis_google-cloud-python
train
py
4536d2bbddcb84ed6b669d445695f1a1dee75c92
diff --git a/src/org/mozilla/javascript/JavaMembers.java b/src/org/mozilla/javascript/JavaMembers.java index <HASH>..<HASH> 100644 --- a/src/org/mozilla/javascript/JavaMembers.java +++ b/src/org/mozilla/javascript/JavaMembers.java @@ -453,7 +453,7 @@ class JavaMembers // Add the new bean properties. for (Enumeration e = toAdd.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); + Object key = e.nextElement(); Object value = toAdd.get(key); ht.put(key, value); }
Removal of unnecessary cast to (String) during getter/setter enumeration.
mozilla_rhino
train
java