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
eeeab25e12433b2718874100d30a1e946fc3dabc
diff --git a/packages/tpl-service/src/app.js b/packages/tpl-service/src/app.js index <HASH>..<HASH> 100644 --- a/packages/tpl-service/src/app.js +++ b/packages/tpl-service/src/app.js @@ -45,9 +45,9 @@ if (NODE_ENV !== "production") { */ app .use(helmet()) + .use(cors({ exposeHeaders: ["Link", "X-Total-Count"] })) .use(health({ url: `${BASE}/health`, version: pkg.version })) .use(openapi({ url: `${BASE}/openapi.yml`, file: openapiFile })) - .use(cors({ exposeHeaders: ["Link", "X-Total-Count"] })) .use(jwt({ secret: publicKey })) .use(body()) .use(someMid())
fix(tpl-service): cors for health and openapi
36node_sketch
train
js
86badc7ac1dc9b36b3bade1c5336e869f2636520
diff --git a/lib/formtastic/util.rb b/lib/formtastic/util.rb index <HASH>..<HASH> 100644 --- a/lib/formtastic/util.rb +++ b/lib/formtastic/util.rb @@ -22,12 +22,5 @@ module Formtastic return ActiveSupport::SafeBuffer end - def rails3? - version= - if defined?(ActionPack::VERSION::MAJOR) - ActionPack::VERSION::MAJOR - end - !version.blank? && version >= 3 - end end end
no longer need rails3? method
justinfrench_formtastic
train
rb
6553ab96f248793005e6b840def31d32d28f514b
diff --git a/build/tasks/buildStandaloneClassManager.js b/build/tasks/buildStandaloneClassManager.js index <HASH>..<HASH> 100644 --- a/build/tasks/buildStandaloneClassManager.js +++ b/build/tasks/buildStandaloneClassManager.js @@ -29,7 +29,8 @@ module.exports = function(grunt) { t: Lava.t, VALID_PROPERTY_NAME_REGEX: Lava.VALID_PROPERTY_NAME_REGEX, JS_KEYWORDS: Lava.JS_KEYWORDS, - ClassManager: null + ClassManager: null, + instanceOf: Lava.instanceOf }; var tmp = wrapper_content.split("/*<%content%>*/"); diff --git a/lib/class_manager.js b/lib/class_manager.js index <HASH>..<HASH> 100644 --- a/lib/class_manager.js +++ b/lib/class_manager.js @@ -174,7 +174,12 @@ var Lava = { "use", "volatile" ], - ClassManager: null + ClassManager: null, + instanceOf: function (instance, class_name) { + + return instance.Class.hierarchy_paths.indexOf(class_name) != -1 || instance.Class.implements.indexOf(class_name) != -1; + + } }; /** * Create and manage classes
Added Lava.instanceOf
kogarashisan_ClassManager
train
js,js
21f791e2a6b8d3ea08a5c0fcb5f827553721e750
diff --git a/src/Runtime.php b/src/Runtime.php index <HASH>..<HASH> 100644 --- a/src/Runtime.php +++ b/src/Runtime.php @@ -372,7 +372,7 @@ class Runtime extends Encoder $raw = static::m($cx, $raw, array($bp[0] => $raw)); } if (isset($bp[1])) { - $raw = static::m($cx, $raw, array($bp[1] => $cx['sp_vars']['index'])); + $raw = static::m($cx, $raw, array($bp[1] => $index)); } $ret[] = $cb($cx, $raw); } diff --git a/tests/regressionTest.php b/tests/regressionTest.php index <HASH>..<HASH> 100644 --- a/tests/regressionTest.php +++ b/tests/regressionTest.php @@ -1542,6 +1542,15 @@ VAREND ), Array( + 'template' => '{{#each . as |v k|}}#{{k}}{{/each}}', + 'data' => Array('a' => Array(), 'c' => Array()), + 'options' => Array( + 'flags' => LightnCandy::FLAG_HANDLEBARS + ), + 'expected' => '#a#c' + ), + + Array( 'template' => '{{testNull null undefined 1}}', 'data' => 'test', 'options' => Array(
fix block param for #each on Object case
zordius_lightncandy
train
php,php
7bd5b8b96c895d7abb6945ec8fd8738dcc3881e1
diff --git a/yabt/utils.py b/yabt/utils.py index <HASH>..<HASH> 100644 --- a/yabt/utils.py +++ b/yabt/utils.py @@ -101,10 +101,8 @@ def link_node(abs_src: str, abs_dest: str, force: bool=False): # sync file by linking it to dest link_func(abs_src, abs_dest, force) elif isdir(abs_src): - # sync dir by recursively linking files under it to dest - shutil.copytree(abs_src, abs_dest, - copy_function=link_func, - ignore=shutil.ignore_patterns('.git')) + raise ValueError('try to link: {} which is a directory and not a file', + abs_src) else: raise FileNotFoundError(abs_src)
raise value error because it should never happen
resonai_ybt
train
py
eeaf2e52e7519fb7d3c2fe6f6e52a08f0501ca7b
diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java index <HASH>..<HASH> 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java @@ -67,7 +67,7 @@ public class EqualityInference return ComparisonChain.start() .compare(DependencyExtractor.extractAll(expression1).size(), DependencyExtractor.extractAll(expression2).size()) .compare(SubExpressionExtractor.extract(expression1).size(), SubExpressionExtractor.extract(expression2).size()) - .compare(expression1, expression2, Ordering.arbitrary()) + .compare(expression1.toString(), expression2.toString()) .result(); } });
Make CANONICAL_ORDERING use string comparison as a last resort This makes plans more deterministic since they don't depend on JVM context.
prestodb_presto
train
java
7ad3b20795c9c630048f77416578916c608587d7
diff --git a/qnet/algebra/singleton.py b/qnet/algebra/singleton.py index <HASH>..<HASH> 100644 --- a/qnet/algebra/singleton.py +++ b/qnet/algebra/singleton.py @@ -55,7 +55,9 @@ def singleton_object(cls): cls.__hash__ = lambda self: hash(cls) cls.__repr__ = lambda self: cls.__name__ cls.__reduce__ = lambda self: cls.__name__ - return cls() + obj = cls() + obj.__name__ = cls.__name__ + return obj class Singleton(ABCMeta):
Add __name__ attribute to Singletons This makes better-apidoc recognize them properly as imports
mabuchilab_QNET
train
py
7c52e53aaa2448900e5feb9bcc8e77c167632580
diff --git a/src/RequestParser.php b/src/RequestParser.php index <HASH>..<HASH> 100644 --- a/src/RequestParser.php +++ b/src/RequestParser.php @@ -135,7 +135,7 @@ class RequestParser extends EventEmitter } if (strtolower($headers['Content-Type']) == 'application/x-www-form-urlencoded') { - parse_str(urldecode($content), $result); + parse_str($content, $result); $this->request->setPost($result); return;
Fixes reactphp/http#<I> - postfields parsing without urldecode
reactphp_http
train
php
ad49de2a845cd5649ae527d388b5dc04a4c70568
diff --git a/lib/puppet/pops/validation/checker4_0.rb b/lib/puppet/pops/validation/checker4_0.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/pops/validation/checker4_0.rb +++ b/lib/puppet/pops/validation/checker4_0.rb @@ -412,10 +412,11 @@ class Puppet::Pops::Validation::Checker4_0 if o.name =~ /^(?:0x)?[0-9]+$/ acceptor.accept(Issues::ILLEGAL_NUMERIC_PARAMETER, o, :name => o.name) end + return unless o.value assignments = if o.value.is_a?(Puppet::Pops::Model::AssignmentExpression) [o.value] - else + else o.value o.value.eAllContents.select {|model| model.is_a? Puppet::Pops::Model::AssignmentExpression } end assignments.each do |assignment|
(PUP-<I>) Correct param validation case when parameter has no value Before this, the validation failed when trying to find assignment expressions if a parameter did not have a value expression. This makes the search for assignments conditional.
puppetlabs_puppet
train
rb
32485e1be23ff89044c2839cfb60d535ec5dd848
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ var extend = require('node.extend') var fs = require('fs') var path = require('path') var core = require('jsreport-core') +var _ = require('underscore') function initializeApp (force) { if (!fs.existsSync('server.js') || force) { @@ -42,7 +43,7 @@ function repair () { } var renderDefaults = { - connectionString: {name: 'InMemory'}, + connectionString: {name: 'memory'}, dataDirectory: path.join(__dirname, 'data'), blobStorage: 'inMemory', cacheAvailableExtensions: true, @@ -72,6 +73,12 @@ function start () { } function render (req) { + if (_.isString(req)) { + req = { + template: {content: req, engine: 'handlebars', recipe: 'phantom-pdf'} + } + } + if (!core.Reporter.instance) { ensureTempFolder()
retake responsibility for shortcut recipe and engine defaults from jsreport-core
jsreport_jsreport
train
js
25316fe3566556e93951e7a6eb1ee38d3341443e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,10 +9,10 @@ except ImportError: from version import __version__ dependencies = [ - 'babel>=2.0', + 'babel>=2.1.1', 'humanize>=0.5.1', 'python-dateutil>=2.4.2', - 'pytz>=2015.4', + 'pytz>=2015.7', 'tzlocal>=1.2'] setup(
Update dependencies in setup.py
myusuf3_delorean
train
py
beea014343251fc9f379f996553c0b8030723464
diff --git a/modules/template/template.go b/modules/template/template.go index <HASH>..<HASH> 100644 --- a/modules/template/template.go +++ b/modules/template/template.go @@ -242,12 +242,14 @@ func ActionIcon(opType int) string { switch opType { case 1, 8: // Create and transfer repository return "repo" - case 5, 9: // Commit repository + case 5: // Commit repository return "git-commit" case 6: // Create issue return "issue-opened" case 7: // New pull request return "git-pull-request" + case 9: // Push tag + return "tag" case 10: // Comment issue return "comment-discussion" case 11: // Merge pull request @@ -256,6 +258,10 @@ func ActionIcon(opType int) string { return "issue-closed" case 13, 15: // Reopen issue or pull request return "issue-reopened" + case 16: // Create branch + return "git-branch" + case 17, 18: // Delete branch or tag + return "alert" default: return "invalid type" }
template: add more icons for news feed
gogs_gogs
train
go
732e7d124156d7e62a5300c08bc53675ff3661ef
diff --git a/tests/test_summary_writer.py b/tests/test_summary_writer.py index <HASH>..<HASH> 100644 --- a/tests/test_summary_writer.py +++ b/tests/test_summary_writer.py @@ -15,9 +15,8 @@ class SummaryWriterTest(unittest.TestCase): # OSError: [Errno 24] Too many open files passed = True try: - for _ in range(2048): - writer = SummaryWriter() - writer.close() + writer = SummaryWriter() + writer.close() except OSError: passed = False
Only run writer close test once (#<I>) temporarily disable the stress test.
lanpa_tensorboardX
train
py
94d0d2aa7d6b037dc4047df8a3dfa0ec55262fe8
diff --git a/packages/ui-presets/karma.js b/packages/ui-presets/karma.js index <HASH>..<HASH> 100644 --- a/packages/ui-presets/karma.js +++ b/packages/ui-presets/karma.js @@ -78,6 +78,10 @@ module.exports = function makeConfig ({ bundle, coverageDirectory, coverageThres config.set({ basePath: '', + // The default has some problems inside a monorepo, but specifying this manually + // seems to pull in all karma plugins across disparate node_modules/ dirs + plugins: ['karma-*'], + frameworks: ['mocha'], files: [ bundle ],
fix(karma): Improve plugin support inside monorepos The default karma plugin loading appears to be a little buggy if plugins are distributed among different node_modules dirs. Specifying this manually seems to work well, though. Change-Id: I<I>f4eb<I>e3d<I>f<I>efda6e<I>f4f<I>cfb Reviewed-on: <URL>
instructure_instructure-ui
train
js
78bef2a7cb99993f2b7f1bf00f8ae51c20e8ee0f
diff --git a/openquake/hazardlib/sourceconverter.py b/openquake/hazardlib/sourceconverter.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/sourceconverter.py +++ b/openquake/hazardlib/sourceconverter.py @@ -197,7 +197,8 @@ def get_set_num_ruptures(src): clsname = src.__class__.__name__ if dt > 10: # NB: I am not using logging.warn because it hangs when called - # from a worker with processpool distribution + # from a worker with processpool distribution; see + # https://github.com/gem/oq-engine/pull/3923 if 'Area' in clsname: warn('%s.count_ruptures took %d seconds, perhaps the ' 'area discretization is too small', src, dt)
Added a comment [skip CI]
gem_oq-engine
train
py
6a2b62882fa73ffd72815dcf25e2df42ba1eec9e
diff --git a/lib/einhorn/command/interface.rb b/lib/einhorn/command/interface.rb index <HASH>..<HASH> 100644 --- a/lib/einhorn/command/interface.rb +++ b/lib/einhorn/command/interface.rb @@ -305,7 +305,7 @@ EOF end command 'state', "Get a dump of Einhorn's current state" do - YAML.dump({state: Einhorn::State.dumpable_state}) + YAML.dump({:state => Einhorn::State.dumpable_state}) end command 'reload', 'Reload Einhorn' do |conn, request|
Maintain <I> compatibility. Because I can't be bothered to delurk Ruby <I> right now.
stripe_einhorn
train
rb
6e148e355da5492460997ee961b546608fd2b1d5
diff --git a/spec/unit/digester_spec.rb b/spec/unit/digester_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/digester_spec.rb +++ b/spec/unit/digester_spec.rb @@ -34,7 +34,7 @@ describe Chef::Digester do it "computes a checksum of a file" do fixture_file = CHEF_SPEC_DATA + "/checksum/random.txt" - expected = "dc6665c18676f5f30fdaa420343960edf1883790f83f51f437dbfa0ff678499d" + expected = "09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394" @cache.checksum_for_file(fixture_file).should == expected end
revert checksum to pre-whitespace fix state
chef_chef
train
rb
d709c72ed3efb2b8a82dcb0132796bde685d64b3
diff --git a/src/mixin.js b/src/mixin.js index <HASH>..<HASH> 100644 --- a/src/mixin.js +++ b/src/mixin.js @@ -55,6 +55,12 @@ export default { return; } + // There is a validator but it isn't injected, mark as reactive. + if (!requested && this.$validator) { + const Vue = this.$options._base; // the vue constructor. + Vue.util.defineReactive(this.$validator, 'errors', this.$validator.errors); + } + if (! this.$options.computed) { this.$options.computed = {}; }
fix: fix errors reactivity issue closes #<I>
baianat_vee-validate
train
js
d1f6c3570d96d21f9f9e10a13ccfed5717bff765
diff --git a/lib/hatchet/version.rb b/lib/hatchet/version.rb index <HASH>..<HASH> 100644 --- a/lib/hatchet/version.rb +++ b/lib/hatchet/version.rb @@ -1,3 +1,3 @@ module Hatchet - VERSION = "1.3.3" + VERSION = "1.3.4" end
[ci skip] <I> released
heroku_hatchet
train
rb
e60b21f434c6bd58a05a271f4c7e0ba559bebdbe
diff --git a/userstate.go b/userstate.go index <HASH>..<HASH> 100644 --- a/userstate.go +++ b/userstate.go @@ -340,6 +340,16 @@ func (state *UserState) SetCookieTimeout(cookieTime int64) { state.cookieTime = cookieTime } +// CookieSecret returns the current cookie secret +func (state *UserState) CookieSecret() string { + return state.cookieSecret +} + +// SetCookieSecret sets the current cookie secret +func (state *UserState) SetCookieSecret(cookieSecret string) { + state.cookieSecret = cookieSecret +} + // PasswordAlgo returns the current password hashing algorithm. func (state *UserState) PasswordAlgo() string { return state.passwordAlgorithm
Add cookie secret getter/setter
xyproto_permissionbolt
train
go
fcca22b6f327c1ad640fd9ad64569ca75ec8a97b
diff --git a/deploy_stack.py b/deploy_stack.py index <HASH>..<HASH> 100755 --- a/deploy_stack.py +++ b/deploy_stack.py @@ -376,6 +376,7 @@ def update_env(env, new_env_name, series=None, bootstrap_host=None, agent_url=None, agent_stream=None): # Rename to the new name. env.environment = new_env_name + env.config['name'] = new_env_name if series is not None: env.config['default-series'] = series if bootstrap_host is not None: diff --git a/test_deploy_stack.py b/test_deploy_stack.py index <HASH>..<HASH> 100644 --- a/test_deploy_stack.py +++ b/test_deploy_stack.py @@ -213,6 +213,7 @@ class DeployStackTestCase(TestCase): env, 'bar', series='wacky', bootstrap_host='baz', agent_url='url', agent_stream='devel') self.assertEqual('bar', env.environment) + self.assertEqual('bar', env.config['name']) self.assertEqual('wacky', env.config['default-series']) self.assertEqual('baz', env.config['bootstrap-host']) self.assertEqual('url', env.config['tools-metadata-url'])
Update the config with the env name for MAASAccount.
juju_juju
train
py,py
b5f3bb5cec70d2078dc143524a3ad2231e3f5af3
diff --git a/lib/flor/core/executor.rb b/lib/flor/core/executor.rb index <HASH>..<HASH> 100644 --- a/lib/flor/core/executor.rb +++ b/lib/flor/core/executor.rb @@ -184,7 +184,7 @@ module Flor def task(message) - @unit.tasker.task(message) + @unit.tasker.task(Flor::Ash.inflate_all(@execution, message)) end def return(message) diff --git a/lib/flor/punit/concurrence.rb b/lib/flor/punit/concurrence.rb index <HASH>..<HASH> 100644 --- a/lib/flor/punit/concurrence.rb +++ b/lib/flor/punit/concurrence.rb @@ -114,7 +114,7 @@ class Flor::Pro::Concurrence < Flor::Procedure def store_payload (@node['payloads'] ||= {})[@message['from']] = - Flor::Ash.deflate(@excution, payload) + Flor::Ash.deflate(@execution, payload) end def default_receive
prepare for payload inflating when tasking
floraison_flor
train
rb,rb
a96a41004c4aaaaba33949d32e8d5be769add981
diff --git a/middleman-core/lib/middleman-core/core_extensions/extensions.rb b/middleman-core/lib/middleman-core/core_extensions/extensions.rb index <HASH>..<HASH> 100644 --- a/middleman-core/lib/middleman-core/core_extensions/extensions.rb +++ b/middleman-core/lib/middleman-core/core_extensions/extensions.rb @@ -113,7 +113,7 @@ module Middleman end if ext_module.nil? - logger.warning "== Unknown Extension: #{ext}" + logger.error "== Unknown Extension: #{ext}" else logger.debug "== Activating: #{ext}" self.class.register(ext_module, options, &block)
Logger has no such method .warning. Closes #<I>
middleman_middleman
train
rb
938102a4b51659451d3536ae1decc0d403e6018f
diff --git a/lib/rubycritic/analysers/reek.rb b/lib/rubycritic/analysers/reek.rb index <HASH>..<HASH> 100644 --- a/lib/rubycritic/analysers/reek.rb +++ b/lib/rubycritic/analysers/reek.rb @@ -4,7 +4,7 @@ module Rubycritic module Analyser class Reek < ::Reek::Examiner - DEFAULT_CONFIG_FILES = ["lib/rubycritic/analysers/config.reek"] + DEFAULT_CONFIG_FILES = [File.expand_path("../config.reek", __FILE__)] def initialize(paths) super(Array(paths), DEFAULT_CONFIG_FILES)
Make path to a config file relative to the current file
whitesmith_rubycritic
train
rb
437116ba18823fa25939e62436e799e9841ec153
diff --git a/test/test_reftrack.py b/test/test_reftrack.py index <HASH>..<HASH> 100644 --- a/test/test_reftrack.py +++ b/test/test_reftrack.py @@ -92,6 +92,18 @@ class DummyRefobjInterface(RefobjInterface): super(DummyRefobjInterface, self).__init__() self.current = current + def exists(self, refobj): + """Check if the given refobj is still in the scene + or if it has been deleted/dissapeared + + :param refobj: a reference object to query + :type refobj: refobj + :returns: True, if it still exists + :rtype: :class:`bool` + :raises: None + """ + return not refobj.deleted + def get_parent(self, refobj): """Return the parent
implemented exists in refobjinterface for tests
JukeboxPipeline_jukebox-core
train
py
538e388702ab998beeeccfb16efadf947a247e3c
diff --git a/packages/ra-ui-materialui/src/layout/Menu.js b/packages/ra-ui-materialui/src/layout/Menu.js index <HASH>..<HASH> 100644 --- a/packages/ra-ui-materialui/src/layout/Menu.js +++ b/packages/ra-ui-materialui/src/layout/Menu.js @@ -40,6 +40,7 @@ const Menu = ({ dense, hasDashboard, onMenuClick, + pathname, resources, translate, logout, @@ -72,6 +73,7 @@ Menu.propTypes = { hasDashboard: PropTypes.bool, logout: PropTypes.element, onMenuClick: PropTypes.func, + pathname: PropTypes.string, resources: PropTypes.array.isRequired, translate: PropTypes.func.isRequired, }; @@ -82,13 +84,21 @@ Menu.defaultProps = { const mapStateToProps = state => ({ resources: getResources(state), + pathname: state.routing.location.pathname, // used to force redraw on navigation }); const enhance = compose( translate, connect( mapStateToProps, - {} // Avoid connect passing dispatch in props + {}, // Avoid connect passing dispatch in props, + null, + { + areStatePropsEqual: (prev, next) => + prev.resources.every( + (value, index) => value === next.resources[index] // shallow compare resources + ) && prev.pathname == next.pathname, + } ), withStyles(styles) );
Prevent Menu rerenderings The Menu used to be rerendered at least 4 times on each page, because it was rerendered each time the data changed in the resources.
marmelab_react-admin
train
js
d09eea2dcc5ab9e19ad002d6729a2db3dbafd279
diff --git a/lib/boot/mods/apply.js b/lib/boot/mods/apply.js index <HASH>..<HASH> 100644 --- a/lib/boot/mods/apply.js +++ b/lib/boot/mods/apply.js @@ -77,6 +77,11 @@ function applyJson (originalComponent, mod) { return } - const res = applyPatch(originalComponent, mod.operations) - return res.newDocument + try { + const res = applyPatch(originalComponent, mod.operations) + return res.newDocument + } catch (error) { + console.log(error) + return + } } // applyJson
fix: handle errors with patching json
wmfs_tymly-core
train
js
1867f461ed14f5d73e02818703badabd5dc097b2
diff --git a/github/Github.py b/github/Github.py index <HASH>..<HASH> 100644 --- a/github/Github.py +++ b/github/Github.py @@ -33,14 +33,14 @@ class Github(object): def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT): self.__requester = Requester(login_or_token, password, base_url, timeout) - @property - def FIX_REPO_GET_GIT_REF(self): + def get_FIX_REPO_GET_GIT_REF(self): return self.__requester.FIX_REPO_GET_GIT_REF - @FIX_REPO_GET_GIT_REF.setter - def FIX_REPO_GET_GIT_REF(self, value): + def set_FIX_REPO_GET_GIT_REF(self, value): self.__requester.FIX_REPO_GET_GIT_REF = value + FIX_REPO_GET_GIT_REF = property(get_FIX_REPO_GET_GIT_REF, set_FIX_REPO_GET_GIT_REF) + @property def rate_limiting(self): return self.__requester.rate_limiting
Restore support of Python <I>
PyGithub_PyGithub
train
py
09269191bb160f5c39edc4245ad92ab82b9ae602
diff --git a/lib/redpotion.rb b/lib/redpotion.rb index <HASH>..<HASH> 100644 --- a/lib/redpotion.rb +++ b/lib/redpotion.rb @@ -7,7 +7,7 @@ end require 'ruby_motion_query' require 'ProMotion' require 'motion_print' -require 'redalert' +require 'RedAlert' lib_dir_path = File.dirname(File.expand_path(__FILE__)) Motion::Project::App.setup do |app|
Require "RedAlert" instead of "redalert" When creating a new redpotion (<I>) project, it always failed for me when it does rake pod:install with the following error: cannot load such file -- redalert I changed it to "RedAlert" in lib/redpotion.rb and everything worked as expected.
infinitered_redpotion
train
rb
5209ca834284265e3560152876bf918ce4a40097
diff --git a/tests/test_storage.py b/tests/test_storage.py index <HASH>..<HASH> 100755 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -199,6 +199,11 @@ def test_adding_existing_file(bds, b_file, b_file_path): assert os.path.isfile(path) +def test_adding_object_with_wrong_interface(bds): + with pytest.raises(AssertionError): + bds.add_file("hello") + + def test_file_path_from_hash(bds, b_file_hash, b_file_path): assert bds.file_path_from_hash(b_file_hash) == b_file_path
#1: Added one more test.
Bystroushaak_BalancedDiscStorage
train
py
e92c94d5a1ac617e88f3d87f5894dff274594be0
diff --git a/qiskit/result/postprocess.py b/qiskit/result/postprocess.py index <HASH>..<HASH> 100644 --- a/qiskit/result/postprocess.py +++ b/qiskit/result/postprocess.py @@ -182,6 +182,13 @@ def format_statevector(vec, decimals=None): Returns: list[complex]: a list of python complex numbers. """ + # pylint: disable=cyclic-import + from qiskit.quantum_info.states.statevector import Statevector + + if isinstance(vec, Statevector): + if decimals: + return Statevector(np.around(vec.data, decimals=decimals), dims=vec.dims()) + return vec if isinstance(vec, np.ndarray): if decimals: return np.around(vec, decimals=decimals) @@ -210,6 +217,17 @@ def format_unitary(mat, decimals=None): Returns: list[list[complex]]: a matrix of complex numbers """ + # pylint: disable=cyclic-import + from qiskit.quantum_info.operators.operator import Operator + + if isinstance(mat, Operator): + if decimals: + return Operator( + np.around(mat.data, decimals=decimals), + input_dims=mat.input_dims(), + output_dims=mat.output_dims(), + ) + return mat if isinstance(mat, np.ndarray): if decimals: return np.around(mat, decimals=decimals)
Fix Result post-processing (#<I>) * Fix Result post-processing Fixes bug with Result post-processing functions `get_statevector` and `get_unitary` if the result data is already a Statevector or Operator object. * Change to function level import * Remove import-outside-toplevel * Handle non-qubit dimensions
Qiskit_qiskit-terra
train
py
536408380aa07853bb8a4d4d96af1b0cd06bbe31
diff --git a/src/java/org/apache/cassandra/cql3/statements/DropTypeStatement.java b/src/java/org/apache/cassandra/cql3/statements/DropTypeStatement.java index <HASH>..<HASH> 100644 --- a/src/java/org/apache/cassandra/cql3/statements/DropTypeStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/DropTypeStatement.java @@ -121,7 +121,7 @@ public class DropTypeStatement extends SchemaAlteringStatement else if (toCheck instanceof SetType) return isUsedBy(((SetType)toCheck).getElementsType()); else - return isUsedBy(((MapType)toCheck).getKeysType()) || isUsedBy(((MapType)toCheck).getKeysType()); + return isUsedBy(((MapType)toCheck).getKeysType()) || isUsedBy(((MapType)toCheck).getValuesType()); } return false; }
Include a Maps value type in DropTypeStatement's isUsedBy patch by dbrosius reviewed by thobbs for cassandra-<I>
Stratio_stratio-cassandra
train
java
050a55b006f2dd1c77c65064025b8156a361349b
diff --git a/context_test.go b/context_test.go index <HASH>..<HASH> 100644 --- a/context_test.go +++ b/context_test.go @@ -417,7 +417,7 @@ func TestContextIsAborted(t *testing.T) { assert.True(t, c.IsAborted()) - c.index += 1 + c.Next() assert.True(t, c.IsAborted()) }
Use c.Next() instead of c.index++ in UnitTest
gin-gonic_gin
train
go
695cefe9c73c15cda63e3e0b747e94bd3caff7c2
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ Implements a privately verifiable homomorphic authentication scheme from Shacham setup( - name='heartbeat', + name='storj-heartbeat', version=heartbeat.__version__, url='https://github.com/Storj/heartbeat', license='The MIT License',
Rename project to alleviate PyPI name conflicts
StorjOld_heartbeat
train
py
820f61d49f59577a19d15510f3b2976f19d958c9
diff --git a/spec/mongoid/persistence_spec.rb b/spec/mongoid/persistence_spec.rb index <HASH>..<HASH> 100644 --- a/spec/mongoid/persistence_spec.rb +++ b/spec/mongoid/persistence_spec.rb @@ -1623,6 +1623,15 @@ describe Mongoid::Persistence do it "creates with the given attributes" do container.vehicles.map(&:driver).should eq([driver]) end + + it "searches the document from the given type" do + container.vehicles.size.should == 1 + container.vehicles.find_or_create_by({"driver_id" => driver.id}, Car) + container.vehicles.size.should == 1 # didn't create because found + + container.vehicles.find_or_create_by({"driver_id" => driver.id}, Truck) + container.vehicles.size.should == 2 # created because not found + end end end end
Failing spec: Many#find_or_(create|initialize)_by should search only document in the given collection.
mongodb_mongoid
train
rb
e376815985e7f82160c6e648ec685a755bbc8bab
diff --git a/actstream/tests/test_activity.py b/actstream/tests/test_activity.py index <HASH>..<HASH> 100644 --- a/actstream/tests/test_activity.py +++ b/actstream/tests/test_activity.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from django.contrib.auth.models import Group from django.utils.translation import ugettext_lazy as _ @@ -49,6 +51,15 @@ class ActivityTestCase(DataTestCase): ['Three liked actstream %s ago' % self.timesince] ) + def test_follow_unicode(self): + """ Reproduce bug #201, that pops, for example, in django admin + """ + self.user1.username = 'éé' + self.user1.save() + f = follow(self.user1, self.user2) + # just to check that it do not meet a UnicodeDecodeError + self.assertIn('éé', str(f)) + def test_stream(self): self.assertSetEqual(user_stream(self.user1), [ 'Two started following CoolGroup %s ago' % self.timesince,
added tests to highlight #<I> resolution
justquick_django-activity-stream
train
py
192391a5a850904420d6ba2e90b06558d8e07d3a
diff --git a/tests/integration/container_test.py b/tests/integration/container_test.py index <HASH>..<HASH> 100644 --- a/tests/integration/container_test.py +++ b/tests/integration/container_test.py @@ -989,3 +989,20 @@ class PauseTest(api_test.BaseTestCase): self.assertEqual(state['Running'], True) self.assertIn('Paused', state) self.assertEqual(state['Paused'], False) + + +class GetContainerStatsTest(BaseTestCase): + @requires_api_version('1.19') + def test_get_container_stats_no_stream(self): + container = self.client.create_container( + BUSYBOX, ['sleep', '60'], + ) + self.tmp_containers.append(container) + self.client.start(container) + response = self.client.stats(container, stream=0) + self.client.kill(container) + + self.assertEquals(type(response), dict) + for key in ['read', 'network', 'precpu_stats', 'cpu_stats', + 'memory_stats', 'blkio_stats']: + self.assertIn(key, response)
Add integration test for stats no-stream
docker_docker-py
train
py
1eb187b911248ae0b30b8f8489fe56b313246f86
diff --git a/tests/test_main.py b/tests/test_main.py index <HASH>..<HASH> 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -28,7 +28,7 @@ def test_sort_imports(tmpdir): main.sort_imports(str(tmp_file), DEFAULT_CONFIG) assert not main.sort_imports(str(tmp_file), DEFAULT_CONFIG, check=True).incorrectly_sorted - skip_config = Config(skip=[str(tmp_file)]) + skip_config = Config(skip=["file.py"]) assert main.sort_imports( str(tmp_file), config=skip_config, check=True, disregard_skip=False ).skipped @@ -160,12 +160,7 @@ import a """ ) main.main([str(python_file), "--filter-files", "--verbose"]) - assert ( - python_file.read() - == """import a -import b -""" - ) + assert python_file.read().lstrip() == "import a\nimport b\n" # Add a file to skip should_skip = tmpdir.join("should_skip.py")
Update tests to :fingers-crossed: work on windows
timothycrosley_isort
train
py
f46ab4d82796eb2f7d3b4304a30ff9d973992bf4
diff --git a/controllers/asapi-controller.js b/controllers/asapi-controller.js index <HASH>..<HASH> 100644 --- a/controllers/asapi-controller.js +++ b/controllers/asapi-controller.js @@ -114,8 +114,8 @@ AsapiController.prototype.addRegexPattern = function(type, regex, exclusive) { if (typeof exclusive != "boolean") { console.error("Exclusive must be a boolean"); } - if (["users", "aliases"].indexOf(type) == -1) { - console.error("'type' must be 'users' or 'aliases'"); + if (["users", "aliases", "rooms"].indexOf(type) == -1) { + console.error("'type' must be 'users', 'rooms' or 'aliases'"); return; }
Allow 'rooms' regex patterns
matrix-org_matrix-appservice-node
train
js
6b4e5307a64fc5e5d713429e254542ba0abe35e3
diff --git a/websocket/client.go b/websocket/client.go index <HASH>..<HASH> 100644 --- a/websocket/client.go +++ b/websocket/client.go @@ -468,6 +468,10 @@ func (c *Client) Connect() error { "X-Websocket-Namespace": {WildcardNamespace}, } + for k, v := range c.Headers { + headers[k] = v + } + logging.GetLogger().Infof("Connecting to %s", endpoint) if c.AuthOpts != nil {
websocket: pass HTTP headers when connecting
skydive-project_skydive
train
go
d61692a61e846fafb4524f36a722aec523a9e487
diff --git a/lib/serif/site.rb b/lib/serif/site.rb index <HASH>..<HASH> 100644 --- a/lib/serif/site.rb +++ b/lib/serif/site.rb @@ -2,7 +2,11 @@ class StandardFilterCheck include Liquid::StandardFilters def date_supports_now? - date("now", "%Y") == Time.now.year + begin + date("now", "%Y") == Time.now.year + rescue + false + end end end
Deal with any exceptions out of Time.parse('now').
aprescott_serif
train
rb
4ccaf0994188f8424b0c7bf0aed1f75249468cee
diff --git a/classes/PodsView.php b/classes/PodsView.php index <HASH>..<HASH> 100644 --- a/classes/PodsView.php +++ b/classes/PodsView.php @@ -271,7 +271,7 @@ class PodsView { if ( 0 === strpos( $_view, 'http://' ) || 0 === strpos( $_view, 'https://' ) ) { $_view = apply_filters( 'pods_view_url_include', $_view ); - if ( empty( $_view ) ) + if ( empty( $_view ) || ( defined( 'PODS_REMOTE_VIEWS' ) && PODS_REMOTE_VIEWS ) ) return ''; $response = wp_remote_get( $_view );
Add constant to disable remote views PODS_REMOTE_VIEWS
pods-framework_pods
train
php
1b19e1a2a372b35e57de7c70b26f12ecb47acb7b
diff --git a/prow/spyglass/lenses/buildlog/lens.go b/prow/spyglass/lenses/buildlog/lens.go index <HASH>..<HASH> 100644 --- a/prow/spyglass/lenses/buildlog/lens.go +++ b/prow/spyglass/lenses/buildlog/lens.go @@ -22,6 +22,7 @@ import ( "encoding/json" "fmt" "html/template" + "io" "path/filepath" "regexp" "strings" @@ -196,12 +197,12 @@ func logLinesAll(artifact lenses.Artifact) ([]string, error) { func logLines(artifact lenses.Artifact, offset, length int64) ([]string, error) { b := make([]byte, length) _, err := artifact.ReadAt(b, offset) - if err != nil { + if err != nil && err != io.EOF { if err != lenses.ErrGzipOffsetRead { return nil, fmt.Errorf("couldn't read requested bytes: %v", err) } moreBytes, err := artifact.ReadAtMost(offset + length) - if err != nil { + if err != nil && err != io.EOF { return nil, fmt.Errorf("couldn't handle reading gzipped file: %v", err) } b = moreBytes[offset:]
Spyglass: Do not consider EOF on gcs files an error
kubernetes_test-infra
train
go
f9ce1387bf9a948517f835fd04c139ee9a1fcdc6
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -75,7 +75,7 @@ require('./lib/rollbar') await enterpriseSetup() } - const scheduleRemindersJobData = Buffer.from(JSON.stringify({name: 'schedule-stale-initial-pr-reminders'})) + const scheduleRemindersJobData = { content: Buffer.from(JSON.stringify({name: 'schedule-stale-initial-pr-reminders'})) } async function scheduleReminders () { try { await scheduleJob(scheduleRemindersJobData, {priority: 1})
fix: schedule reminders job with content object
greenkeeperio_greenkeeper
train
js
4106ed8776a9f1da248bb44a22be060f8ff9c42f
diff --git a/src/ol/control/ZoomSlider.js b/src/ol/control/ZoomSlider.js index <HASH>..<HASH> 100644 --- a/src/ol/control/ZoomSlider.js +++ b/src/ol/control/ZoomSlider.js @@ -135,11 +135,9 @@ const ZoomSlider = function(opt_options) { listen(thumbElement, EventType.CLICK, Event.stopPropagation); - const render = options.render ? options.render : ZoomSlider.render; - Control.call(this, { element: containerElement, - render: render + render: options.render || render }); }; @@ -206,7 +204,7 @@ ZoomSlider.prototype.initSlider_ = function() { * @this {ol.control.ZoomSlider} * @api */ -ZoomSlider.render = function(mapEvent) { +export function render(mapEvent) { if (!mapEvent.frameState) { return; } @@ -218,7 +216,7 @@ ZoomSlider.render = function(mapEvent) { this.currentResolution_ = res; this.setThumbPosition_(res); } -}; +} /**
Export render from ol/control/ZoomSlider
openlayers_openlayers
train
js
f20beea041bffd143e0ed2b0ee3b06028ff4d23e
diff --git a/src/toil/jobStores/aws/jobStore.py b/src/toil/jobStores/aws/jobStore.py index <HASH>..<HASH> 100644 --- a/src/toil/jobStores/aws/jobStore.py +++ b/src/toil/jobStores/aws/jobStore.py @@ -981,8 +981,8 @@ class AWSJobStore(AbstractJobStore): def _reservedAttributes(cls): return 3 + super(AWSJobStore.FileInfo, cls)._reservedAttributes() - @classmethod - def maxInlinedSize(cls): + @staticmethod + def maxInlinedSize(): return 256 def save(self):
maxInlineSize is a static method
DataBiosphere_toil
train
py
56e8c796ae44a610b334ec1ba7b7a149c414961c
diff --git a/spyderlib/widgets/sourcecode/codeeditor.py b/spyderlib/widgets/sourcecode/codeeditor.py index <HASH>..<HASH> 100644 --- a/spyderlib/widgets/sourcecode/codeeditor.py +++ b/spyderlib/widgets/sourcecode/codeeditor.py @@ -2603,6 +2603,8 @@ class CodeEditor(TextEditBaseWidget): self.hide_completion_widget() if self.close_parentheses_enabled: self.handle_close_parentheses(text) + else: + self.insert_text(text) elif text in ('[', '{') and not self.has_selected_text() \ and self.close_parentheses_enabled: s_trailing_text = self.get_text('cursor', 'eol').strip()
fix for issue #<I> Restore the insertion of the "(" character when parameter close_parentheses_enabled is False. I suspect some patch destroyed the functionnality formerly in handle_close_parentheses(text) This is the simple fix, maybe a more complete fix would remove unused path in def handle_close_parentheses()
spyder-ide_spyder
train
py
095fb173d713e6fbd1055de627fdab67c58ee388
diff --git a/lib/main.js b/lib/main.js index <HASH>..<HASH> 100644 --- a/lib/main.js +++ b/lib/main.js @@ -59,7 +59,7 @@ var defaults = { mmlNode: false, // DOM element for MML output? svg: false, // return svg output? svgNode: false, // DOM element for SVG output? - speakText: true, // add spoken annotations to svg output + speakText: true, // add spoken annotations timeout: 10 * 1000, // 10 second timeout before restarting MathJax };
update comment; part of #<I>
mathjax_MathJax-node
train
js
5f5cbaf78c6966d1dc714198365cd0901dc71a14
diff --git a/src/selectivity-templates.js b/src/selectivity-templates.js index <HASH>..<HASH> 100644 --- a/src/selectivity-templates.js +++ b/src/selectivity-templates.js @@ -278,7 +278,7 @@ Selectivity.Templates = { * mode - Mode in which select exists, single or multiple. */ selectCompliance: function(options) { - if (!options.name.match(/\[\]$/)) { + if (options.mode === 'multiple' && !options.name.match(/\[\]$/)) { options.name = options.name + '[]'; } return ('<select name="' + options.name + '"' + (options.mode === 'multiple' ? ' multiple' : '') + '></select>');
Apply select name change only for multiple select
arendjr_selectivity
train
js
2ca16a8c285d8db7bede2d894be13da1a57cacfd
diff --git a/eulfedora/cryptutil.py b/eulfedora/cryptutil.py index <HASH>..<HASH> 100644 --- a/eulfedora/cryptutil.py +++ b/eulfedora/cryptutil.py @@ -18,7 +18,10 @@ from Crypto.Cipher import Blowfish as EncryptionAlgorithm import hashlib import logging -from django.conf import settings +try: + from django.conf import settings +except ImportError: + settings = None logger = logging.getLogger(__name__)
tweak cryptutil so it's usable without django
emory-libraries_eulfedora
train
py
3d07d701b5beac0009e788ccb545acea080738a4
diff --git a/pygubu/uidesigner/main.py b/pygubu/uidesigner/main.py index <HASH>..<HASH> 100644 --- a/pygubu/uidesigner/main.py +++ b/pygubu/uidesigner/main.py @@ -273,6 +273,7 @@ class PygubuUI(util.Application): self.tree_editor.load_file(filename) self.project_name.configure(text=filename) + self.previewer.remove_all() #Edit menu
Clear preview when a new file is open.
alejandroautalan_pygubu
train
py
1820003078eeae6ab25e2440669c490caff59b57
diff --git a/graph/pull.go b/graph/pull.go index <HASH>..<HASH> 100644 --- a/graph/pull.go +++ b/graph/pull.go @@ -428,10 +428,11 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri } if verified { - out.Write(sf.FormatStatus(repoInfo.CanonicalName+":"+tag, "The image you are pulling has been verified")) + log.Printf("Image manifest for %s:%s has been verified", repoInfo.CanonicalName, tag) } else { out.Write(sf.FormatStatus(tag, "Pulling from %s", repoInfo.CanonicalName)) } + downloads := make([]downloadInfo, len(manifest.FSLayers)) for i := len(manifest.FSLayers) - 1; i >= 0; i-- { @@ -553,6 +554,8 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri } + out.Write(sf.FormatStatus(repoInfo.CanonicalName+":"+tag, "The image you are pulling has been verified - This is a tech preview, don't rely on it for security yet.")) + if err = s.Set(repoInfo.LocalName, tag, downloads[0].img.ID, true); err != nil { return false, err }
Warn about tech preview of checksums. Docker-DCO-<I>-
moby_moby
train
go
e3ff99c76e769dfb47f410eb7728129e47443256
diff --git a/snakebacon/mcmcbackends/__init__.py b/snakebacon/mcmcbackends/__init__.py index <HASH>..<HASH> 100644 --- a/snakebacon/mcmcbackends/__init__.py +++ b/snakebacon/mcmcbackends/__init__.py @@ -64,7 +64,7 @@ class Bacon: # TODO(brews): Check that these stats are correctly translated to scipy.stats distribs. acc_mean = kwargs['acc_mean'] acc_shape = kwargs['acc_shape'] - x = np.linspace(0, 3 * np.max(acc_mean), 100) + x = np.linspace(0, 6 * np.max(acc_mean), 100) y = stats.gamma.pdf(x, a=acc_shape, scale=1 / (acc_shape/acc_mean)) return y, x
Extended the limits of sediment rate distribution in Bacon backend.
brews_snakebacon
train
py
46f8b2d3014064935fd43ed816a1795d6568a91c
diff --git a/spec/support/active_record.rb b/spec/support/active_record.rb index <HASH>..<HASH> 100644 --- a/spec/support/active_record.rb +++ b/spec/support/active_record.rb @@ -22,7 +22,7 @@ module Support extend ActiveSupport::Concern included do - after :each do + before :each do DatabaseCleaner.clean end end
gotta clean the db before each spec on jruby for some reason (rspec seems to behave differently)
travis-ci_travis-core
train
rb
643bb9a02a4f96f1c114f664ec544e5b79d013ff
diff --git a/lib/merb-core/constants.rb b/lib/merb-core/constants.rb index <HASH>..<HASH> 100644 --- a/lib/merb-core/constants.rb +++ b/lib/merb-core/constants.rb @@ -23,8 +23,8 @@ module Merb FORM_URL_ENCODED_REGEXP = %r{^application/x-www-form-urlencoded}.freeze UPCASE_CONTENT_TYPE = 'CONTENT_TYPE'.freeze CONTENT_TYPE = "Content-Type".freeze - DATE = 'Date' - ETAG = 'ETag' + DATE = 'Date'.freeze + ETAG = 'ETag'.freeze LAST_MODIFIED = "Last-Modified".freeze SLASH = "/".freeze REQUEST_METHOD = "REQUEST_METHOD".freeze
Freeze strings in Merb::Const.
wycats_merb
train
rb
e969d42156437ec44a51828538e96846ab9c21bf
diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index <HASH>..<HASH> 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -645,11 +645,11 @@ func testPids(t *testing.T, systemd bool) { /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true`) if err != nil && !strings.Contains(out.String(), "sh: can't fork") { - ok(t, err) + t.Fatal(err) } if err == nil { - t.Fatalf("expected fork() to fail with restrictive pids limit") + t.Fatal("expected fork() to fail with restrictive pids limit") } // Minimal restrictions are not really supported, due to quirks in using Go
libct/int/testPids: logging nits
opencontainers_runc
train
go
b3020db512cce9cb1318f6472347bd3da0f058ba
diff --git a/Entity/Widget/TextWidget.php b/Entity/Widget/TextWidget.php index <HASH>..<HASH> 100644 --- a/Entity/Widget/TextWidget.php +++ b/Entity/Widget/TextWidget.php @@ -45,6 +45,7 @@ class TextWidget extends AbstractWidget public function getData() { return array( + 'id' => $this->getId(), 'text' => $this->getText() ); } diff --git a/Manager/PortfolioManager.php b/Manager/PortfolioManager.php index <HASH>..<HASH> 100644 --- a/Manager/PortfolioManager.php +++ b/Manager/PortfolioManager.php @@ -218,8 +218,7 @@ class PortfolioManager ); foreach ($widgets as $widget) { - $widgetDatas = $this->widgetsManager->getWidgetData($widget); - $data['widgets'][] = $widgetDatas; + $data['widgets'][] = $this->widgetsManager->getWidgetData($widget); } $commentsDatas = array();
[PortfolioBundle] Add id on text widget as it's mandatory for non unique widget
claroline_Distribution
train
php,php
45de73699d5bf9d7d7548728bf4858744998ce1b
diff --git a/lib/dato/local/item.rb b/lib/dato/local/item.rb index <HASH>..<HASH> 100644 --- a/lib/dato/local/item.rb +++ b/lib/dato/local/item.rb @@ -118,8 +118,8 @@ module Dato if item_type.tree base[:position] = position - base[:children] = children.map do |_i| - value.to_hash( + base[:children] = children.map do |child| + child.to_hash( max_depth, current_depth + 1 )
Fix dato dump for tree objects Int his line, the 'value' variable is not defined, and thus ends up being a method call grabbed by "method_missing" below. Instead, since the tree is recursive, we should be calling that method on the child of the tree.
datocms_ruby-datocms-client
train
rb
032bdcf22999a61c543edb56646eff37fdfb88f4
diff --git a/raiden/network/proxies/token_network.py b/raiden/network/proxies/token_network.py index <HASH>..<HASH> 100644 --- a/raiden/network/proxies/token_network.py +++ b/raiden/network/proxies/token_network.py @@ -311,13 +311,14 @@ class TokenNetwork: block_identifier: BlockSpecification = 'pending', ) -> ChannelID: if not channel_identifier: - channel_identifier = self._call_and_check_result( - block_identifier, - 'getChannelIdentifier', + channel_identifier = self.proxy.contract.functions.getChannelIdentifier( to_checksum_address(participant1), to_checksum_address(participant2), - ) - assert isinstance(channel_identifier, T_ChannelID) + ).call(block_identifier=block_identifier) + + if not isinstance(channel_identifier, T_ChannelID): + raise ValueError('channel_identifier must be of type T_ChannelID') + if channel_identifier == 0: raise RaidenRecoverableError( f'When calling {called_by_fn} either 0 value was given for the ' @@ -325,6 +326,7 @@ class TokenNetwork: f'no channel currently exists between {pex(participant1)} and ' f'{pex(participant2)}', ) + return channel_identifier def channel_exists_and_not_settled(
fix: getChannelIdentifier cannot return empty The signature of getChannelIdentifier is: function (address, address) view public returns (uint<I>) So the function will return 0 if the value exists, never the empty string
raiden-network_raiden
train
py
5564e0b493d8da433e3d3fddb437750029381b9e
diff --git a/src/flagged/applyComplexClasses.js b/src/flagged/applyComplexClasses.js index <HASH>..<HASH> 100644 --- a/src/flagged/applyComplexClasses.js +++ b/src/flagged/applyComplexClasses.js @@ -90,7 +90,6 @@ function buildUtilityMap(css) { utilityName, classPosition: i, rule: rule.clone({ parent: rule.parent }), - containsApply: hasAtRule(rule, 'apply'), }) index++ })
remove unused containsApply check Currently we will walk the tree for every single rule to see if an `@apply` exists somewhere in that tree. However we don't use the `containsApply` anymore so this is a quick win!
tailwindcss_tailwindcss
train
js
d220a277f08f18d3ce3a0c5754769e2e0c12d3a0
diff --git a/snakebite/commandlineparser.py b/snakebite/commandlineparser.py index <HASH>..<HASH> 100644 --- a/snakebite/commandlineparser.py +++ b/snakebite/commandlineparser.py @@ -581,7 +581,7 @@ class CommandLineParser(object): for load in file_to_read: sys.stdout.write(load) - @command(args="path dst", descr="copy local file reference to destination", req_args=['dir [dirs]', 'arg']) + @command(args="path dst", descr="copy local file reference to destination", req_args=['dir [dirs]', 'arg'], visible=False) def copyFromLocal(self): src = self.args.dir dst = self.args.single_arg @@ -597,7 +597,7 @@ class CommandLineParser(object): for line in format_results(result, json_output=self.args.json): print line - @command(args="[paths] dst", descr="copy files from source to destination", allowed_opts=['checkcrc'], req_args=['dir [dirs]', 'arg']) + @command(args="[paths] dst", descr="copy files from source to destination", allowed_opts=['checkcrc'], req_args=['dir [dirs]', 'arg'], visible=False) def cp(self): paths = self.args.dir dst = self.args.single_arg
Disable copyFromLocal and cp. Both copyFromLocal and cp are not implemented in client.
spotify_snakebite
train
py
3813ca942f00ec01b93ebaa2b4e9db6ef06a8be5
diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php index <HASH>..<HASH> 100644 --- a/database/factories/CustomerFactory.php +++ b/database/factories/CustomerFactory.php @@ -1,5 +1,5 @@ <?php -namespace AvoRed\Framework\Database\Factories; +namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Faker\Generator as Faker; use AvoRed\Framework\Database\Models\Customer;
Update CustomerFactory.php
avored_framework
train
php
cbc83a240e9994e37931c9b43504e0f4d5d6ef5b
diff --git a/mod/quiz/format/gift/format.php b/mod/quiz/format/gift/format.php index <HASH>..<HASH> 100755 --- a/mod/quiz/format/gift/format.php +++ b/mod/quiz/format/gift/format.php @@ -447,15 +447,20 @@ function writequestion( $question ) { case TRUEFALSE: if ($question->trueanswer->fraction==1) { $answertext = 'TRUE'; - $feedback = $question->falseanswer->feedback; + $wrong_feedback = $question->falseanswer->feedback; + $right_feedback = $question->trueanswer->feedback; } else { $answertext = 'FALSE'; - $feedback = $question->trueanswer->feedback; + $wrong_feedback = $question->trueanswer->feedback; + $right_feedback = $question->falseanswer->feedback; } $expout .= "::".$question->name."::".$question->questiontext."{".$answertext; - if ($feedback!="") { - $expout .= "#".$feedback; + if ($wrong_feedback!="") { + $expout .= "#".$wrong_feedback; + } + if ($right_feedback!="") { + $expout .= "#".$right_feedback; } $expout .= "}\n"; break;
Added 'right answer' feedback to true/false questions.
moodle_moodle
train
php
c431dae205530295b7c4d47baae03d2c09c9d1bb
diff --git a/aeron-archive/src/main/java/io/aeron/archive/ReplaySession.java b/aeron-archive/src/main/java/io/aeron/archive/ReplaySession.java index <HASH>..<HASH> 100644 --- a/aeron-archive/src/main/java/io/aeron/archive/ReplaySession.java +++ b/aeron-archive/src/main/java/io/aeron/archive/ReplaySession.java @@ -107,7 +107,7 @@ class ReplaySession implements Session, SimpleFragmentHandler catch (final Exception ex) { CloseHelper.close(replayPublication); - onError("failed to open cursor on a recording because: " + ex.getMessage()); + onError("failed to open cursor on a recording - " + ex.getMessage()); LangUtil.rethrowUnchecked(ex); }
[Java] Error message when opening recording.
real-logic_aeron
train
java
0b6272d7088d45514fefffceb94b74da895d74ec
diff --git a/modules/user_messages/module.php b/modules/user_messages/module.php index <HASH>..<HASH> 100644 --- a/modules/user_messages/module.php +++ b/modules/user_messages/module.php @@ -149,7 +149,7 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block { $content .= "<option value=\"last_6mo\">".i18n::translate('Send message to users who have not logged in for 6 months')."</option>"; } foreach (get_all_users() as $user_id=>$user_name) { - if ($user_id!=WT_USER_ID && get_user_setting($user_id, 'verified_by_admin')=='yes' && get_user_setting($user_id, 'contactmethod')!='none') { + if ($user_id!=WT_USER_ID && get_user_setting($user_id, 'verified_by_admin') && get_user_setting($user_id, 'contactmethod')!='none') { $content .= "<option value=\"".$user_name."\">".PrintReady(getUserFullName($user_id))." "; if ($TEXT_DIRECTION=="ltr") { $content .= stripLRMRLM(getLRM()." - ".$user_name.getLRM());
fix bug that unable to send message to the specifed user
fisharebest_webtrees
train
php
f50c2b4ee02a058abc5d07fe091647cf081cb634
diff --git a/login/confirm.php b/login/confirm.php index <HASH>..<HASH> 100644 --- a/login/confirm.php +++ b/login/confirm.php @@ -5,8 +5,8 @@ $data = optional_param('data', '', PARAM_CLEAN); // Formatted as: secret/username - $p = optional_param('p', '', PARAM_ALPHA); // Old parameter: secret - $s = optional_param('s', '', PARAM_CLEAN); // Old parameter: username + $p = optional_param('p', '', PARAM_ALPHANUM); // Old parameter: secret + $s = optional_param('s', '', PARAM_CLEAN); // Old parameter: username if (!empty($data) || (!empty($p) && !empty($s))) {
fix for old email confirmation - spotted by Dirk Grunwald; merged from MOODLE_<I>_STABLE
moodle_moodle
train
php
f81798c7c86178e316fe4bf6ca618f8cf6bd13c9
diff --git a/hydpy/exe/servertools.py b/hydpy/exe/servertools.py index <HASH>..<HASH> 100644 --- a/hydpy/exe/servertools.py +++ b/hydpy/exe/servertools.py @@ -1952,7 +1952,7 @@ method `evaluate` if you have started the `HydPy Server` in debugging mode. def GET_save_conditions(self) -> None: """Save the (resulting) conditions.""" - dir_ = self.state.inputconditiondirs.get(self._id) + dir_ = self.state.outputconditiondirs.get(self._id) self.state.interface.conditions_io.save_conditions(dir_) def GET_update_getitemvalues(self) -> None:
Fix method `GET_save_conditions` of class `HydPyServer` of module `servertools` which should write to the registered "outputconditionsdir", not "inputcontionsdir".
hydpy-dev_hydpy
train
py
46c1caced2ddcb773d15d76ca01e448a0cf700f9
diff --git a/lib/definitions/errors.js b/lib/definitions/errors.js index <HASH>..<HASH> 100644 --- a/lib/definitions/errors.js +++ b/lib/definitions/errors.js @@ -1,7 +1,6 @@ -const url = require('url'); const pkg = require('../../package.json'); -const homepage = url.format({...url.parse(pkg.homepage), ...{hash: null}}); +const [homepage] = pkg.homepage.split('#'); const linkify = file => `${homepage}/blob/master/${file}`; module.exports = {
refactor: replace url parse and format with simple split
byCedric_semantic-release-git-branches
train
js
57271b96cd9de0e8a2ac9c8c5e5c7610070b2eba
diff --git a/src/Command/CacheClearCommand.php b/src/Command/CacheClearCommand.php index <HASH>..<HASH> 100644 --- a/src/Command/CacheClearCommand.php +++ b/src/Command/CacheClearCommand.php @@ -33,7 +33,7 @@ class CacheClearCommand extends Command $this ->setName('cache:clear') ->setDescription('Clear OXID cache') - ->addOption('smarty', 's', InputOption::VALUE_NONE, "Clears out smarty cache") + ->addOption('smarty', null, InputOption::VALUE_NONE, "Clears out smarty cache") ->addOption('files', 'f', InputOption::VALUE_NONE, "Clears out files cache") ->addOption('oxcache', 'o', InputOption::VALUE_NONE, "Clears out oxCache (for EE)") ->setHelp(<<<'EOF'
remove s shortcode from cache clear command
OXIDprojects_oxid-console
train
php
039f1cdea676de29ed49e7b962896b60f7b96bf5
diff --git a/json_log_formatter/__init__.py b/json_log_formatter/__init__.py index <HASH>..<HASH> 100644 --- a/json_log_formatter/__init__.py +++ b/json_log_formatter/__init__.py @@ -67,7 +67,14 @@ class JSONFormatter(logging.Formatter): # argument passed in. if mutated_record is None: mutated_record = json_record - return self.json_lib.dumps(mutated_record) + return self.to_json(mutated_record) + + def to_json(self, record): + """Convert record dict to a json string + + Override this method to change the way dict is converted to JSON. + """ + return self.json_lib.dumps(record) def extra_from_record(self, record): """Returns `extra` dict you passed to logger.
Small refactoring which allow to customize the way the record dict is converted to json
marselester_json-log-formatter
train
py
bd638d926b65b95d16a881e4aa2893b66716a536
diff --git a/packages/app-frontend/src/features/timeline/index.js b/packages/app-frontend/src/features/timeline/index.js index <HASH>..<HASH> 100644 --- a/packages/app-frontend/src/features/timeline/index.js +++ b/packages/app-frontend/src/features/timeline/index.js @@ -63,6 +63,7 @@ const resetCbs = [] export function resetTimeline () { selectedEvent.value = null + inspectedEvent.value = null layersPerApp.value = {} vScrollPerApp.value = {} hoverLayerId.value = null
fix(timeline): reset inspected event
vuejs_vue-devtools
train
js
335cd2785eebb910b354b5686d01051435e0ed0a
diff --git a/src/Libvaloa/Xml/Xml.php b/src/Libvaloa/Xml/Xml.php index <HASH>..<HASH> 100644 --- a/src/Libvaloa/Xml/Xml.php +++ b/src/Libvaloa/Xml/Xml.php @@ -95,14 +95,7 @@ class Xml */ public static function validateNodeName($node) { - if (empty($node) - || is_numeric(substr($node, 0, 1)) - || substr(strtolower($node), 0, 3) === 'xml' - || strstr($node, ' ')) { - return false; - } - - return true; + return Conversion::validateNodeName($node); } /**
use validation from Xml/Conversion
sundflux_libvaloa
train
php
744e27c8db107cd1db381cfc88cf792ba45baa61
diff --git a/tasks/cssmin.js b/tasks/cssmin.js index <HASH>..<HASH> 100644 --- a/tasks/cssmin.js +++ b/tasks/cssmin.js @@ -27,9 +27,12 @@ module.exports = function(grunt) { return true; } }); - var max = valid - .map(grunt.file.read) - .join(grunt.util.normalizelf(grunt.util.linefeed)); + var max; + if(options.report) { + max = valid + .map(grunt.file.read) + .join(grunt.util.normalizelf(grunt.util.linefeed)); + } var min = valid.map(function(f) { options.relativeTo = path.dirname(f); return minifyCSS(grunt.file.read(f), options);
Max file only calculated if report option is true Closes gh-<I>.
gruntjs_grunt-contrib-cssmin
train
js
9a7094b9df826a856cb73e01203aedfec30e306f
diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -47,6 +47,19 @@ public class MammothTests { } @Test + public void wordTablesAreConvertedToHtmlTables() { + assertThat( + convertToHtml("tables.docx"), + deepEquals(success( + "<p>Above</p>" + + "<table>" + + "<tr><td><p>Top left</p></td><td><p>Top right</p></td></tr>" + + "<tr><td><p>Bottom left</p></td><td><p>Bottom right</p></td></tr>" + + "</table>" + + "<p>Below</p>"))); + } + + @Test public void inlineImagesAreIncludedInOutput() { assertThat( convertToHtml("tiny-picture.docx"),
Add end-to-end test for tables
mwilliamson_java-mammoth
train
java
9faeb4ed0bcf90c0d6cf667356bba80f9f5950ff
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ INSTALL_REQUIRES = ( 'setuptools', 'configparser', 'pywinrm', - 'distro==1.5.0', + 'distro>1.5,<2', ) ANSIBLE_REQUIRES = ( # extras for parsing Ansible inventory
Loosen distro requirement.
Fizzadar_pyinfra
train
py
ec80e6e9d8548295878da276654afa88eccd1e29
diff --git a/lib/rein.rb b/lib/rein.rb index <HASH>..<HASH> 100644 --- a/lib/rein.rb +++ b/lib/rein.rb @@ -21,6 +21,12 @@ module ActiveRecord::ConnectionAdapters include Rein::View end + class Mysql2Adapter < AbstractAdapter + include RC::PrimaryKey + include RC::ForeignKey + include Rein::View + end + class PostgreSQLAdapter < AbstractAdapter include RC::PrimaryKey include RC::ForeignKey
Included Mysql2Adapter
nullobject_rein
train
rb
fdc7c4fbf1fd585a2c2d7d822232ab16ee253a08
diff --git a/Kwc/Directories/List/ViewAjax/Component.js b/Kwc/Directories/List/ViewAjax/Component.js index <HASH>..<HASH> 100644 --- a/Kwc/Directories/List/ViewAjax/Component.js +++ b/Kwc/Directories/List/ViewAjax/Component.js @@ -67,7 +67,7 @@ Kwc.Directories.List.ViewAjax = Ext.extend(Ext.Panel, { loadMoreBufferPx: 700, border: false, - layout: 'fit', + layout: 'auto', cls: 'posts', initComponent: function() { Kwc.Directories.List.ViewAjax.byComponentId[this.componentId] = this; @@ -283,7 +283,7 @@ Kwc.Directories.List.ViewAjax.filterLinks = {}; Kwc.Directories.List.ViewAjax.View = Ext.extend(Kwf.Binding.AbstractPanel, { - layout: 'fit', + layout: 'auto', border: false, autoHeight: true,
ViewAjax: use layout auto to avoid inline width style required for responsive layout, has been solved previously using width: auto !important
koala-framework_koala-framework
train
js
c9636d261ba6372af39bdfdf767e05dbff4f5949
diff --git a/lib/testing/generator/data_generator.php b/lib/testing/generator/data_generator.php index <HASH>..<HASH> 100644 --- a/lib/testing/generator/data_generator.php +++ b/lib/testing/generator/data_generator.php @@ -1097,10 +1097,15 @@ EOD; $data->status = ENROL_INSTANCE_ENABLED; } + // Default to legacy lti version. + if (empty($data->ltiversion) || !in_array($data->ltiversion, ['LTI-1p0/LTI-2p0', 'LTI-1p3'])) { + $data->ltiversion = 'LTI-1p0/LTI-2p0'; + } + // Add some extra necessary fields to the data. - $data->name = 'Test LTI'; - $data->roleinstructor = $studentrole->id; - $data->rolelearner = $teacherrole->id; + $data->name = $data->name ?? 'Test LTI'; + $data->roleinstructor = $teacherrole->id; + $data->rolelearner = $studentrole->id; // Get the enrol LTI plugin. $enrolplugin = enrol_get_plugin('lti');
MDL-<I> core_lib: make lti tool generator default to legacy version This means existing tests won't need to change.
moodle_moodle
train
php
7e953388fd76c6c56c01a59fa541f9fe87f26cff
diff --git a/src/Illuminate/Support/Facades/RateLimiter.php b/src/Illuminate/Support/Facades/RateLimiter.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Support/Facades/RateLimiter.php +++ b/src/Illuminate/Support/Facades/RateLimiter.php @@ -12,7 +12,7 @@ namespace Illuminate\Support\Facades; * @method static int retriesLeft($key, $maxAttempts) * @method static void clear($key) * @method static int availableIn($key) - * @method static bool attempt($key, $maxAttempts, \Closure $callback, $decaySeconds = 60) + * @method static mixed attempt($key, $maxAttempts, \Closure $callback, $decaySeconds = 60) * * @see \Illuminate\Cache\RateLimiter */
Update RateLimiter.php (#<I>)
laravel_framework
train
php
3cafca6c6050abd0a6ceea9083ee9c3df23ed79e
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -100,11 +100,9 @@ test('should catch errors and pass it to the final callback', function(t) { setTimeout(function() { n1(new Error('Some error')); }, 100); - setTimeout(n2, 10000); - + setTimeout(n2, 500); }); - test('should only call the final callback once in the case of an error', function(t) { var count = 0; var next = afterAll(function() { @@ -159,8 +157,3 @@ test('should not require the final callback', function(t) { }, 250); }); - -test('end', function(t) { - t.end(); - process.exit(); -});
Decrease timeout and remove 'end' test.
sorribas_after-all
train
js
efee458ded77f3d9983a435fc1cfa1a3f275dc44
diff --git a/httprunner/client.py b/httprunner/client.py index <HASH>..<HASH> 100644 --- a/httprunner/client.py +++ b/httprunner/client.py @@ -82,6 +82,7 @@ class HttpSession(requests.Session): # record actual request info req_resp_dict["request"]["url"] = resp_obj.request.url + req_resp_dict["request"]["method"] = resp_obj.request.method req_resp_dict["request"]["headers"] = dict(resp_obj.request.headers) request_body = resp_obj.request.body
bugfix: add request method in report
HttpRunner_HttpRunner
train
py
d0b4fa6405d832beb34ecbec6f9e29e9b232da57
diff --git a/questionary/prompt.py b/questionary/prompt.py index <HASH>..<HASH> 100644 --- a/questionary/prompt.py +++ b/questionary/prompt.py @@ -1,5 +1,5 @@ from prompt_toolkit.output import ColorDepth -from typing import Any, Dict, Optional, Iterable, Mapping +from typing import Any, Dict, Optional, Iterable, Mapping, Union from questionary import utils from questionary.constants import DEFAULT_KBI_MESSAGE @@ -13,7 +13,7 @@ class PromptParameterException(ValueError): def prompt( - questions: Iterable[Mapping[str, Any]], + questions: Union[Dict[str, Any], Iterable[Mapping[str, Any]]], answers: Optional[Mapping[str, Any]] = None, patch_stdout: bool = False, true_color: bool = False, @@ -74,7 +74,7 @@ def prompt( def unsafe_prompt( - questions: Iterable[Mapping[str, Any]], + questions: Union[Dict[str, Any], Iterable[Mapping[str, Any]]], answers: Optional[Mapping[str, Any]] = None, patch_stdout: bool = False, true_color: bool = False,
fix(types): declare support for single questions Without this patch, when calling `prompt` or `unsafe_prompt` with a `dict` on `questions`, mypy fails with: Argument 1 to "unsafe_prompt" has incompatible type "Dict[str, Any]"; expected "Iterable[Mapping[str, Any]]"
tmbo_questionary
train
py
d11955b2b909dc5aa75e480bd3c459ce2a6cda74
diff --git a/examples/vision/cifar10/cifar10_data.py b/examples/vision/cifar10/cifar10_data.py index <HASH>..<HASH> 100644 --- a/examples/vision/cifar10/cifar10_data.py +++ b/examples/vision/cifar10/cifar10_data.py @@ -54,8 +54,9 @@ class Cifar10DataSource(DataSource): if e.errno != errno.EEXIST: raise if (time.time() - start_time) >= 60 * 30: # wait for 30min - raise Exception( - "Timeout occured. If there are cifar10.lock in $HOME/nnabla_data, it should be deleted.") + # Unlock + os.close(fd) + os.unlink(lockfile) time.sleep(5)
Unlock when the time is gone.
sony_nnabla
train
py
b55dd24de191bb27aa6b1e3b878d7a338318b0e7
diff --git a/mailer.php b/mailer.php index <HASH>..<HASH> 100644 --- a/mailer.php +++ b/mailer.php @@ -11,7 +11,7 @@ * (c) Christian Knuth, ikkez0n3@gmail.com * * @date: 23.10.2016 - * @version 1.0.0 + * @version 1.0.1-dev */ class Mailer { @@ -217,10 +217,10 @@ class Mailer { $body .= $this->message['html'].$eol; } elseif (isset($this->message['text'])) { $this->smtp->set('Content-Type', 'text/plain; charset='.$this->charset); - $body = $this->message['text']; + $body = $this->message['text'].$eol; } elseif (isset($this->message['html'])) { $this->smtp->set('Content-Type', 'text/html; charset='.$this->charset); - $body = $this->message['html']; + $body = $this->message['html'].$eol; } $success = $this->smtp->send($this->encode($body),true,$mock); $f3 = \Base::instance();
add line-break at the end of message this ensures that attachments are displayed below correctly
ikkez_f3-mailer
train
php
e4b722dc9ddc861c3686aedac7b79ad8a03258b0
diff --git a/reana_commons/version.py b/reana_commons/version.py index <HASH>..<HASH> 100755 --- a/reana_commons/version.py +++ b/reana_commons/version.py @@ -14,4 +14,4 @@ and parsed by ``setup.py``. from __future__ import absolute_import, print_function -__version__ = "0.6.0.dev20190823" +__version__ = "0.6.0.dev20190916"
release: <I>.de<I>
reanahub_reana-commons
train
py
ba9b4725cff0b16abdf24491616e7d012ae55ded
diff --git a/aiortc/rtcconfiguration.py b/aiortc/rtcconfiguration.py index <HASH>..<HASH> 100644 --- a/aiortc/rtcconfiguration.py +++ b/aiortc/rtcconfiguration.py @@ -13,13 +13,4 @@ class RTCIceServer: urls = attr.ib() username = attr.ib(default=None) credential = attr.ib(default=None) - credentialType = attr.ib(default="password") - - @classmethod - def fromdict(cls, server): - return cls( - server.get('urls', server.get('url')), - server.get('username'), - server.get('credential'), - server.get('credentialType', "password") - ) + credentialType = attr.ib(default='password')
[rtcconfiguration] remove RTCIceServer.fromdict class method - the 'url' (singular) attribute is deprecated - constructing an RTCIceServer from a dict can be achieved with: iceserver = RTCIceServer(**some_dict)
aiortc_aiortc
train
py
e144e50167fc44f35b47251e241f16e6b5816e70
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100755 --- a/lib/index.js +++ b/lib/index.js @@ -1,21 +1,25 @@ var through = require('through2'); var falafel = require('falafel'); -module.exports = function (file) { - var buffers = []; +var bpb = function () { + //var file = typeof arguments[0] == 'string' ? arguments[0] : null; // not currently used + var options = typeof arguments[0] == 'string' ? arguments[1] : arguments[0]; + var chunks = []; return through(function (buffer, encoding, next) { - buffers.push(buffer); + chunks.push(buffer.toString('utf8')); next(); }, function (next) { - this.push(transform(buffers.map(function(buffer){return buffer.toString('utf8'); }).join(''))); + this.push(transform(chunks.join(''), options)); next() }); }; -function transform(source){ +function transform(source, options){ + options = options || {}; + var occurrences = []; - var f = falafel(source, function(node){ + var f = falafel(source, options, function(node){ if (isOccurrence(node)){ occurrences.push(node); } @@ -69,3 +73,5 @@ function isFunctionOverride(node){ } return false; } + +module.exports = bpb; \ No newline at end of file
Accept options and pass directly to falafel
zenflow_bpb
train
js
103fb32fbc499e6d0f9313630aacc2726c12e2ac
diff --git a/root_numpy/__init__.py b/root_numpy/__init__.py index <HASH>..<HASH> 100644 --- a/root_numpy/__init__.py +++ b/root_numpy/__init__.py @@ -11,8 +11,7 @@ ROOT_VERSION = root_version_active() config = get_config() if config is not None: # pragma: no cover - root_version_at_install = config['ROOT_version'] - numpy_version_at_install = config['numpy_version'] + root_version_at_install = config.get('ROOT_version', ROOT_VERSION) if ROOT_VERSION != root_version_at_install: warnings.warn( @@ -24,6 +23,8 @@ if config is not None: # pragma: no cover RuntimeWarning) import numpy + numpy_version_at_install = config.get('numpy_version', numpy.__version__) + if numpy.__version__ != numpy_version_at_install: warnings.warn( "numpy {0} is currently installed but you "
fall back on active ROOT and numpy versions if not in config
scikit-hep_root_numpy
train
py
fc118c022a89133dc923ca573b3f17993828482a
diff --git a/_config.php b/_config.php index <HASH>..<HASH> 100644 --- a/_config.php +++ b/_config.php @@ -18,3 +18,5 @@ Object::add_extension('Member', 'RestrictedMember'); if ((Director::isDev() || Director::is_cli()) && isset($_GET['disable_perms'])) { Restrictable::set_enabled(false); } + +SS_Cache::set_cache_lifetime('restricted_perms', 3600); \ No newline at end of file
FIX Updated cache lifetime for permissions to be 1hr by default
nyeholt_silverstripe-restrictedobjects
train
php
3bacaf0dde4b44066f44f87988dfe2122c22bc6e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ setup(name = "svg.charts", packages = find_packages(exclude=['tests', 'docs']), zip_safe=True, namespace_packages=['svg'], + include_package_data = True, install_requires=[ 'python-dateutil>=1.4', 'cssutils>=0.9.5.1',
Added 'package data' to the package
Kozea_pygal
train
py
ba490c7f67c7b0ba19c526ea402d1b753c0a404b
diff --git a/plexapi/library.py b/plexapi/library.py index <HASH>..<HASH> 100644 --- a/plexapi/library.py +++ b/plexapi/library.py @@ -454,12 +454,14 @@ class LibrarySection(PlexObject): if not agent: agent = self.agent + locations = [] if kwargs['location']: - paths = kwargs.get('location') - for path in paths: + for path in kwargs['location']: if not self._server.isBrowsable(path): raise BadRequest('Path: %s does not exist.' % path) - params = list(kwargs.items()) + locations = [('location', path) for path in kwargs.pop('location')] + + params = list(kwargs.items()) + locations part = '/library/sections/%s?agent=%s&%s' % (self.key, agent, urlencode(params, doseq=True)) self._server.query(part, method=self._server._session.put)
refactor edit method for correcting location param
pkkid_python-plexapi
train
py
e5ef4c0edf49dbd48d8154ea8cab6cc94ba3ea4e
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategyTest.java index <HASH>..<HASH> 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategyTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PrunePathStrategyTest.java @@ -166,6 +166,8 @@ public class PrunePathStrategyTest { // TODO: below is broken -- the provided answer is correct. // {__.V().select("a").map(select("b").repeat(select("c"))).select("a"), //"[[a, b, c], [[a, b, c], [[a, b, c]]], []]", null} + // TODO: once we are past the path, we can do selective selecting again + // {__.V().select("a").path().select("b").select("c"), "[[c], []]", null} }); } }
added a test around paths where once past the path, back to selective processing.
apache_tinkerpop
train
java
4d29c29c24412493d32a9b0f309b287eb22df98a
diff --git a/waterboy/notebook/loader.py b/waterboy/notebook/loader.py index <HASH>..<HASH> 100644 --- a/waterboy/notebook/loader.py +++ b/waterboy/notebook/loader.py @@ -1,5 +1,5 @@ from waterboy.internals.project_config import ProjectConfig -from waterboy.internals.model_config import ModelConfig +from waterboy.api import ModelConfig def load(config_path, run_number=0, device='cuda:0'):
Fixing imports in the loader.
MillionIntegrals_vel
train
py
379988f9a3b3ee8ddd75f6d05f9386732fea28e4
diff --git a/lib/onebox/engine/github_commit_onebox.rb b/lib/onebox/engine/github_commit_onebox.rb index <HASH>..<HASH> 100644 --- a/lib/onebox/engine/github_commit_onebox.rb +++ b/lib/onebox/engine/github_commit_onebox.rb @@ -20,7 +20,7 @@ module Onebox private def match - @url.match(/github\.com\/(?<owner>[^\/]+)\/(?<repo>[^\/]+)\/commit\/(?<number>[^\/]+)/) + @match ||= @url.match(/github\.com\/(?<owner>[^\/]+)\/(?<repo>[^\/]+)\/commit\/(?<number>[^\/]+)/) end def data
We want to memoize the match result to improve performance
discourse_onebox
train
rb
b18a47dc84b11aecd8e74e2b9b5dff2c579c542a
diff --git a/lib/mongo_mapper/plugins/keys.rb b/lib/mongo_mapper/plugins/keys.rb index <HASH>..<HASH> 100644 --- a/lib/mongo_mapper/plugins/keys.rb +++ b/lib/mongo_mapper/plugins/keys.rb @@ -159,7 +159,7 @@ module MongoMapper module InstanceMethods def initialize(attrs={}) @_new = true - assign(attrs) + self.attributes = attrs end def initialize_from_database(attrs={}) @@ -205,16 +205,17 @@ module MongoMapper alias :to_mongo :attributes def assign(attrs={}) + warn "[DEPRECATION] #assign is deprecated, use #attributes=" self.attributes = attrs end def update_attributes(attrs={}) - assign(attrs) + self.attributes = attrs save end def update_attributes!(attrs={}) - assign(attrs) + self.attributes = attrs save! end
Deprecated #assign I'm not sure why this exists, but #attributes= does the same thing and is a more familiar API
mongomapper_mongomapper
train
rb
170d8aef27c4e23ffa619dc3c580ff6efa066586
diff --git a/lib/ronin/cacheable.rb b/lib/ronin/cacheable.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/cacheable.rb +++ b/lib/ronin/cacheable.rb @@ -66,7 +66,7 @@ module Ronin def Cacheable.load_all_from(path,&block) path = File.expand_path(path) - return Contextify.load_contexts(path) do |obj| + return Contextify.load_contexts(path).select do |obj| if obj.class.include?(Cacheable) obj.cached_path = path obj.cached_timestamp = File.mtime(path)
Filter out non-Cacheable objects from Cacheable.load_all_from.
ronin-ruby_ronin
train
rb
ebf8fb6b61e5c081f39b536fd13bef5d9bdd9a67
diff --git a/proso_models/models.py b/proso_models/models.py index <HASH>..<HASH> 100644 --- a/proso_models/models.py +++ b/proso_models/models.py @@ -267,7 +267,7 @@ class DatabaseEnvironment(CommonEnvironment): ORDER BY id DESC LIMIT %s ''', [user, window_size]) - fetched = map(lambda x: x[0], cursor.fetchall()) + fetched = map(lambda x: True if x[0] else False, cursor.fetchall()) if len(fetched) == 0: return 1.0 else:
be aware there can be not answered questions
adaptive-learning_proso-apps
train
py
c1d2e9150be117cb5798ff4aad766b585c9ff4c5
diff --git a/spec/lib/lobot/config_spec.rb b/spec/lib/lobot/config_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/lobot/config_spec.rb +++ b/spec/lib/lobot/config_spec.rb @@ -39,6 +39,9 @@ describe Lobot::Config do context "without a running instance" do it "returns a pretty-printed string version of the config" do + # The basic_auth_password will be blank on CI, so we force it + subject.stub(:basic_auth_password).and_return('password') + subject.display.should == <<OOTPÜT -- ciborg configuration -- Instance ID:
Fix CI due to password generation being different
pivotal-legacy_lobot
train
rb
25e19462fba249c0f149ee088f866aa4f812467b
diff --git a/phoebe/backend/universe.py b/phoebe/backend/universe.py index <HASH>..<HASH> 100644 --- a/phoebe/backend/universe.py +++ b/phoebe/backend/universe.py @@ -2018,7 +2018,11 @@ class Star(Body): pb = passbands.get_passband(passband) - ptfarea = pb.ptf_area + if intens_weighting=='photon': + ptfarea = pb.ptf_photon_area/pb.h/pb.c + else: + ptfarea = pb.ptf_area + self.set_ptfarea(dataset, ptfarea) ldint = pb.ldint(Teff=self.mesh.teffs.for_computations,
fixed ptfarea when intens_weighting is set to photon
phoebe-project_phoebe2
train
py
bf04c192c5b194163c6f02e3fc312defe75f6591
diff --git a/pywws/Template.py b/pywws/Template.py index <HASH>..<HASH> 100755 --- a/pywws/Template.py +++ b/pywws/Template.py @@ -52,7 +52,11 @@ class Template(object): return idx, count == 0 params = self.params if not live_data: - live_data = self.calib_data[self.calib_data.before(datetime.max)] + idx = self.calib_data.before(datetime.max) + if not idx: + self.logger.error("No calib data - run Process.py first") + return + live_data = self.calib_data[idx] pressure_trend_text = WeatherStation.pressure_trend_text wind_dir_text = WeatherStation.get_wind_dir_text() dew_point = WeatherStation.dew_point
Added a test that processed data exists to Template.py.
jim-easterbrook_pywws
train
py