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
fd6590a98761da3a5e8175bfb6ff9884c2f297bb
diff --git a/mod/forum/lib.php b/mod/forum/lib.php index <HASH>..<HASH> 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1435,9 +1435,9 @@ function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC", } else { return get_records_sql("SELECT $postdata, d.name, d.timemodified, d.usermodified, d.groupid, u.firstname, u.lastname, u.email, u.picture $umfields - FROM {$CFG->prefix}forum_posts p, + FROM ({$CFG->prefix}forum_posts p, {$CFG->prefix}user u, - {$CFG->prefix}forum_discussions d + {$CFG->prefix}forum_discussions d) $umtable WHERE d.forum = '$forum' AND p.discussion = d.id
Fix for bug <I> which was only happening on MySQL 5
moodle_moodle
train
php
41ca610754d4b0da26fc28d8d445cdbfef84f62c
diff --git a/py/selenium/webdriver/remote/webdriver.py b/py/selenium/webdriver/remote/webdriver.py index <HASH>..<HASH> 100644 --- a/py/selenium/webdriver/remote/webdriver.py +++ b/py/selenium/webdriver/remote/webdriver.py @@ -112,7 +112,7 @@ class WebDriver(object): _web_element_cls = WebElement - def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub', + def __init__(self, command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options=None): """
[py] Changing default command executor address to the address of TNG Grid
SeleniumHQ_selenium
train
py
d654581e80c1e7aabce627484b194276377a4681
diff --git a/structr-ui/src/main/java/org/structr/xmpp/XMPPContext.java b/structr-ui/src/main/java/org/structr/xmpp/XMPPContext.java index <HASH>..<HASH> 100644 --- a/structr-ui/src/main/java/org/structr/xmpp/XMPPContext.java +++ b/structr-ui/src/main/java/org/structr/xmpp/XMPPContext.java @@ -94,8 +94,8 @@ public class XMPPContext { final XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder() .setUsernameAndPassword(callback.getUsername(), callback.getPassword()) -// .setSecurityMode(ConnectionConfiguration.SecurityMode.ifpossible) - .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled) + .setSecurityMode(ConnectionConfiguration.SecurityMode.ifpossible) +// .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled) .setServiceName(callback.getService()) .setHost(callback.getHostName()) .setPort(callback.getPort())
Modified default XMPP security to "ifpossible", was "disabled".
structr_structr
train
java
18f69b9092b005762671df06ef173f0fd438c6e5
diff --git a/salt/minion.py b/salt/minion.py index <HASH>..<HASH> 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -321,6 +321,7 @@ class Syndic(salt.client.LocalClient, Minion): or not data.has_key('expr_form')\ or not data.has_key('arg'): return + data['to'] = int(data['to']) - 1 self._handle_decoded_payload(data) def _handle_decoded_payload(self, data):
modify the timeout on syndic connections
saltstack_salt
train
py
39a01f463b48e088eac5e595260f0f677dca70cb
diff --git a/lib/mini_fb.rb b/lib/mini_fb.rb index <HASH>..<HASH> 100644 --- a/lib/mini_fb.rb +++ b/lib/mini_fb.rb @@ -652,7 +652,6 @@ module MiniFB post_params[k] = v end end - puts post_params.inspect post_params end
Removed a puts for Issue 6: <URL>
appoxy_mini_fb
train
rb
e8bbf0a1cb81e2504c949c49b241720021a44a9c
diff --git a/lib/identify/identifiables.rb b/lib/identify/identifiables.rb index <HASH>..<HASH> 100644 --- a/lib/identify/identifiables.rb +++ b/lib/identify/identifiables.rb @@ -13,7 +13,7 @@ module Identify def find key, *default_values, &block instances.fetch key.to_s do if block - block.call + block.call key elsif default_values.length > 0 default_values.first else diff --git a/spec/lib/identify/identifiables_spec.rb b/spec/lib/identify/identifiables_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/identify/identifiables_spec.rb +++ b/spec/lib/identify/identifiables_spec.rb @@ -16,11 +16,11 @@ module Identify context "when not found by key" do it "returns value returned by a given block" do - identifiable = identifiables.find(:foo) do - "Not found" + identifiable = identifiables.find(:foo) do |id| + "#{id} not found" end - identifiable.should == "Not found" + identifiable.should == "foo not found" end it "returns the second value if no block given" do
Passes the key to the block when unidentified
natedavisolds_identify
train
rb,rb
8ae4a8a1b42e1a81222f508e03184911d1af97d4
diff --git a/src/Growl.php b/src/Growl.php index <HASH>..<HASH> 100644 --- a/src/Growl.php +++ b/src/Growl.php @@ -4,6 +4,10 @@ namespace BryanCrowe\Growl; use BryanCrowe\Growl\Builder\BuilderAbstract; +/** + * This class accepts a Builder in its constructor to be used for building the growl/notification command. It contains + * various methods to set command options, toggling escaping, whitelisting fields, and finally executing the command. + */ class Growl { /**
Add docblock description to Growl class
bcrowe_growl
train
php
e6117b21daf03eeb6b01072b4297b4e612da4ba7
diff --git a/spec/controllers/changeset_controller_spec.rb b/spec/controllers/changeset_controller_spec.rb index <HASH>..<HASH> 100644 --- a/spec/controllers/changeset_controller_spec.rb +++ b/spec/controllers/changeset_controller_spec.rb @@ -85,7 +85,6 @@ describe ChangesetsController do it "should be able to check the progress of a changeset being promoted" do get :promotion_progress, :id=>@changeset.id response.should be_success - debugger response.should contain('changeset_' + @changeset.id.to_s) end
removed rogue debugger statement
Katello_katello
train
rb
877971db6af385ad84c403f51b87490d87cf9a33
diff --git a/lib/active_scaffold/finder.rb b/lib/active_scaffold/finder.rb index <HASH>..<HASH> 100644 --- a/lib/active_scaffold/finder.rb +++ b/lib/active_scaffold/finder.rb @@ -239,9 +239,9 @@ module ActiveScaffold when :float then value.to_f when :decimal if Rails.version >= '4.2.0' - ActiveRecord::Type::Decimal.new.type_cast_from_user(value) + ::ActiveRecord::Type::Decimal.new.type_cast_from_user(value) else - ActiveRecord::ConnectionAdapters::Column.value_to_decimal(value) + ::ActiveRecord::ConnectionAdapters::Column.value_to_decimal(value) end else value
fix uninitialized constant error
activescaffold_active_scaffold
train
rb
f756bbd94be194723b084f73cbae5a813caa8a20
diff --git a/src/DependencyInjection/JWTAuthExtension.php b/src/DependencyInjection/JWTAuthExtension.php index <HASH>..<HASH> 100644 --- a/src/DependencyInjection/JWTAuthExtension.php +++ b/src/DependencyInjection/JWTAuthExtension.php @@ -55,7 +55,9 @@ class JWTAuthExtension extends Extension if (isset($config['validations'])) { if (array_key_exists('azp', $config['validations'])) { if (! empty($config['validations']['azp'])) { - $validations['azp'] = $config['validations']['azp']; + if (true !== $config['validations']['azp']) { + $validations['azp'] = $config['validations']['azp']; + } } else { $validations['azp'] = null; } @@ -63,7 +65,9 @@ class JWTAuthExtension extends Extension if (array_key_exists('aud', $config['validations'])) { if (! empty($config['validations']['aud'])) { - $validations['aud'] = $config['validations']['aud']; + if (true !== $config['validations']['aud']) { + $validations['aud'] = $config['validations']['aud']; + } } else { $validations['aud'] = null; }
feat: Passing true for azp and aud jwt validators will use default values from client_id and audience
auth0_jwt-auth-bundle
train
php
a51bcec1965212f88b5abbe307681459b71f7f7c
diff --git a/src/input/mouse.js b/src/input/mouse.js index <HASH>..<HASH> 100644 --- a/src/input/mouse.js +++ b/src/input/mouse.js @@ -54,5 +54,5 @@ inherit(MouseInput, Input, { pointerType: INPUT_TYPE_MOUSE, srcEvent: ev }); - }, + } });
Removed comma from from last item in Mouse object. Unfortunatly these things will break older browsers and build systems.
hammerjs_hammer.js
train
js
2f722f09f86098e6200ba20bf89bbeb0936b45ef
diff --git a/src/main/org/openscience/cdk/ChemObject.java b/src/main/org/openscience/cdk/ChemObject.java index <HASH>..<HASH> 100644 --- a/src/main/org/openscience/cdk/ChemObject.java +++ b/src/main/org/openscience/cdk/ChemObject.java @@ -28,7 +28,6 @@ package org.openscience.cdk; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; -import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -305,7 +304,7 @@ public class ChemObject implements Serializable, IChemObject, Cloneable System.arraycopy(flags, 0, clone.flags, 0, flags.length); // clone the properties if (properties != null) { - Map<Object, Object> clonedHashtable = new Hashtable<Object, Object>(); + Map<Object, Object> clonedHashtable = new HashMap<Object, Object>(); Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next();
Fixed cloning of properties with null values by always using HashMap (fixes #<I>)
cdk_cdk
train
java
9b263e6c265ab304d62e9b1b3321891ca81e2267
diff --git a/tools/c7n_azure/c7n_azure/resources/key_vault_storage.py b/tools/c7n_azure/c7n_azure/resources/key_vault_storage.py index <HASH>..<HASH> 100644 --- a/tools/c7n_azure/c7n_azure/resources/key_vault_storage.py +++ b/tools/c7n_azure/c7n_azure/resources/key_vault_storage.py @@ -146,7 +146,6 @@ class KeyVaultStorageRegenerationPeriodFilter(ValueFilter): def __init__(self, *args, **kwargs): super(KeyVaultStorageRegenerationPeriodFilter, self).__init__(*args, **kwargs) self.data['key'] = '"{0}".regenerationPeriod'.format(gap('extra')) - self.data['op'] = 'eq' @KeyVaultStorage.filter_registry.register('active-key-name')
azure - fix op for regeneration-period filter (#<I>)
cloud-custodian_cloud-custodian
train
py
c148e6236fba5b5beb86626ce42d94e9fcc5cb44
diff --git a/Classes/Service/Abstract.php b/Classes/Service/Abstract.php index <HASH>..<HASH> 100644 --- a/Classes/Service/Abstract.php +++ b/Classes/Service/Abstract.php @@ -33,7 +33,7 @@ abstract class Tx_HappyFeet_Service_Abstract /** * @var Tx_Extbase_Object_ObjectManager */ - protected $objectManager; + private $objectManager; /** * @return object|Tx_Extbase_Object_ObjectManager
tsk<I> Code Review: protected (sto<I>)
AOEpeople_happy_feet
train
php
3deac72a8e2da8739bb45f8c7cc9a0ea8656d648
diff --git a/src/Illuminate/Filesystem/Filesystem.php b/src/Illuminate/Filesystem/Filesystem.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Filesystem/Filesystem.php +++ b/src/Illuminate/Filesystem/Filesystem.php @@ -357,7 +357,7 @@ class Filesystem { */ public function deleteDirectory($directory, $preserve = false) { - if ( ! $this->isDirectory($directory)) return; + if ( ! $this->isDirectory($directory)) return false; $items = new FilesystemIterator($directory); @@ -381,6 +381,8 @@ class Filesystem { } if ( ! $preserve) @rmdir($directory); + + return true; } /** @@ -391,7 +393,9 @@ class Filesystem { */ public function cleanDirectory($directory) { - $this->deleteDirectory($directory, true); + if ( ! $this->isDirectory($directory)) return false; + + return $this->deleteDirectory($directory, true); } }
Update Filesystem.php Changed deleteDirectory and cleanDirectory function. Now return true on success.
laravel_framework
train
php
4b7ee7b1aa89afd1f7d287e8f46b2060991ef9b5
diff --git a/lib/roar/json/json_api.rb b/lib/roar/json/json_api.rb index <HASH>..<HASH> 100644 --- a/lib/roar/json/json_api.rb +++ b/lib/roar/json/json_api.rb @@ -6,7 +6,7 @@ module Roar module JsonApi def self.included(base) base.class_eval do - include Representable::Hash + include Representable::JSON include Roar::JSON::JsonApi::Singular include Roar::JSON::JsonApi::Resource include Roar::JSON::JsonApi::Document
maybe including JSON instead of Hash, only, could help :)
trailblazer_roar
train
rb
053108620f26775e2e2f8f3160c3a38260db470d
diff --git a/programs/pmag_gui.py b/programs/pmag_gui.py index <HASH>..<HASH> 100755 --- a/programs/pmag_gui.py +++ b/programs/pmag_gui.py @@ -821,7 +821,7 @@ class MagMainFrame(wx.Frame): meas_file_name = "measurements.txt" dm = "3.0" if not os.path.isfile(os.path.join(self.WD, meas_file_name)): - pw.simple_warning("Your working directory must have a {} format {} file to run this step. Make sure you have fully completed step 1 (import magnetometer file) and ALSO converted to 3.0., if necessary), then try again.".format(dm, meas_file_name)) + pw.simple_warning("Your working directory must have a {} format {} file to run this step. Make sure you have fully completed step 1 (import magnetometer file) and ALSO converted to 3.0., if necessary), then try again.\n\nIf you are trying to look at data downloaded from MagIC, you must unpack the txt file first. Some contributions do not contain measurement data, in which case you won't be able to use this function.".format(dm, meas_file_name)) return False return True
in Pmag GUI, add clarifying text if WD doesn’t have a measurements file, #<I>
PmagPy_PmagPy
train
py
c18202acd2e314909dfa87f86c0da890c9961199
diff --git a/mrcrowbar/fields.py b/mrcrowbar/fields.py index <HASH>..<HASH> 100644 --- a/mrcrowbar/fields.py +++ b/mrcrowbar/fields.py @@ -382,6 +382,10 @@ class BlockField( Field ): stream = property_get( self.stream, parent ) fill = property_get( self.fill, parent ) + if count is not None and count != len( value ): + property_set( self.count, parent, len( value ) ) + count = len( value ) + klass = self.get_klass( parent ) is_array = stream or (count is not None) @@ -434,8 +438,8 @@ class BlockField( Field ): it = iter( value ) except TypeError: raise FieldValidationError( 'Type {} not iterable'.format( type( value ) ) ) - if count is not None: - assert len( value ) <= count + if count is not None and (not isinstance( self.count, Ref )) and (len( value ) != count): + raise FieldValidationError( 'Count defined as a constant, was expecting {} list entries but got {}!'.format( length, len( value ) ) ) else: value = [value] for b in value:
fields.BlockField: allow writeback of count property
moralrecordings_mrcrowbar
train
py
4a06a13b970f848ee544b5f625199429fec2b9a0
diff --git a/openquake/db/fields.py b/openquake/db/fields.py index <HASH>..<HASH> 100644 --- a/openquake/db/fields.py +++ b/openquake/db/fields.py @@ -158,7 +158,6 @@ class PickleField(djm.Field): def to_python(self, value): """Unpickle the value.""" if isinstance(value, (buffer, str, bytearray)) and value: - import nose; nose.tools.set_trace() return pickle.loads(str(value)) else: return value
Removed a breakpoint; oops.
gem_oq-engine
train
py
822d033a3e4d4b9e8592b6a416a9a26ad18d40f1
diff --git a/inigo_suite_test.go b/inigo_suite_test.go index <HASH>..<HASH> 100644 --- a/inigo_suite_test.go +++ b/inigo_suite_test.go @@ -28,8 +28,8 @@ import ( Bbs "github.com/cloudfoundry-incubator/runtime-schema/bbs" "github.com/cloudfoundry/gunk/diegonats" "github.com/cloudfoundry/gunk/timeprovider" + "github.com/cloudfoundry/gunk/workpool" "github.com/cloudfoundry/storeadapter/etcdstoreadapter" - "github.com/cloudfoundry/storeadapter/workerpool" ) var DEFAULT_EVENTUALLY_TIMEOUT = 1 * time.Minute @@ -128,7 +128,7 @@ var _ = BeforeEach(func() { _, err = natsClient.Connect([]string{"nats://" + componentMaker.Addresses.NATS}) Ω(err).ShouldNot(HaveOccurred()) - adapter := etcdstoreadapter.NewETCDStoreAdapter([]string{"http://" + componentMaker.Addresses.Etcd}, workerpool.NewWorkerPool(20)) + adapter := etcdstoreadapter.NewETCDStoreAdapter([]string{"http://" + componentMaker.Addresses.Etcd}, workpool.NewWorkPool(20)) err = adapter.Connect() Ω(err).ShouldNot(HaveOccurred())
Use gunk workpool [#<I>]
cloudfoundry_inigo
train
go
51ae04dcf17fa18d46e5f0b72227b1156ca3eb72
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ var extend = require('util')._extend; function withoutNulls(obj) { - return obj && Object.keys(obj).reduce(function(sum, curr) { + return obj && Object.keys(obj).reduce(function (sum, curr) { if (typeof obj[curr] === 'string') { sum[curr] = obj[curr]; } @@ -12,11 +12,12 @@ function withoutNulls(obj) { } module.exports = function headers(plexApi, extraHeaders) { + var options; if (typeof plexApi !== 'object') { throw new TypeError('A PlexAPI object containing .options is required'); } - var options = plexApi.options; + options = plexApi.options; extraHeaders = withoutNulls(extraHeaders) || {}; return extend(extraHeaders, {
Fixing style issues needed to use jscs <I>
phillipj_node-plex-api-headers
train
js
8fdcfbc63ec49f9c09040f0ee2f11cf6d7493b7f
diff --git a/src/Backend/PostponeRuntimeBackend.php b/src/Backend/PostponeRuntimeBackend.php index <HASH>..<HASH> 100644 --- a/src/Backend/PostponeRuntimeBackend.php +++ b/src/Backend/PostponeRuntimeBackend.php @@ -16,7 +16,6 @@ namespace Sonata\NotificationBundle\Backend; use Laminas\Diagnostics\Result\Success; use Sonata\NotificationBundle\Iterator\IteratorProxyMessageIterator; use Sonata\NotificationBundle\Model\MessageInterface; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** @@ -74,7 +73,7 @@ class PostponeRuntimeBackend extends RuntimeBackend * Actually, an event is not necessary, you can call this method manually, to. * The event is not processed in any way. */ - public function onEvent(?Event $event = null) + public function onEvent() { while (!empty($this->messages)) { $message = array_shift($this->messages);
Remove unused parameter Event was not used and the type declaration was a deprecated Event class.
sonata-project_SonataNotificationBundle
train
php
9d3aba5443091389790579ba8379e3133e90a2eb
diff --git a/core/src/main/java/org/kohsuke/stapler/framework/io/LargeText.java b/core/src/main/java/org/kohsuke/stapler/framework/io/LargeText.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/kohsuke/stapler/framework/io/LargeText.java +++ b/core/src/main/java/org/kohsuke/stapler/framework/io/LargeText.java @@ -175,7 +175,8 @@ public class LargeText { HeadMark head = new HeadMark(buf); TailMark tail = new TailMark(buf); - while(tail.moveToNextLine(f)) { + int readLines = 0; + while(tail.moveToNextLine(f) && readLines++ < MAX_LINES_READ) { head.moveTo(tail,os); } head.finish(os); @@ -394,4 +395,9 @@ public class LargeText { return in.read(buf,offset,length); } } + + /** + * We cap the # of lines read in one batch to avoid buffering too much in memory. + */ + private static final int MAX_LINES_READ = 10000; }
[FIXED STAPLER-<I>] cap the # of lines to be processe in one batch to avoid too much buffering
stapler_stapler
train
java
dfcae711f920e85875eb89894355f035e8dea6eb
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -4,8 +4,8 @@ var crypto = require('crypto') var stream = require('stream') var fileType = require('file-type') -function getKey (req, file, cb) { - crypto.pseudoRandomBytes(16, function (err, raw) { +function defaultKey (req, file, cb) { + crypto.randomBytes(16, function (err, raw) { cb(err, err ? undefined : raw.toString('hex')) }) } @@ -38,7 +38,7 @@ function S3Storage (opts) { delete s3cfg.bucket this.options = opts - this.getKey = (opts.key || getKey) + this.getKey = (opts.key || defaultKey) this.getContentType = (opts.contentType || defaultContentType) this.s3 = new aws.S3(s3cfg) }
psuedoRandomBytes is deprecated
badunk_multer-s3
train
js
fb0d9c7132228036fdd69eecbcd27eb457291c60
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,6 @@ def gen_data_files(src_dir): distribution_files = [('.', ['./NEWS.rst', './Makefile', './LICENSE', './README.rst', './Dockerfile'])] -#corpora_files = gen_data_files('data') setup(name='discoursegraphs', @@ -76,7 +75,7 @@ setup(name='discoursegraphs', package_dir = {'': "src"}, package_data = {'discoursegraphs': gen_data_files('src/discoursegraphs/data')}, include_package_data=True, - data_files = distribution_files, # + corpora_files, + data_files = distribution_files, zip_safe=False, install_requires=install_requires, #setup_requires=['pytest-runner'],
Tidying up setup.py
arne-cl_discoursegraphs
train
py
b5f8e3d5b17842bf455cb90e2ae41928af9f8c0c
diff --git a/formlayout.py b/formlayout.py index <HASH>..<HASH> 100644 --- a/formlayout.py +++ b/formlayout.py @@ -378,7 +378,7 @@ class FormWidget(QWidget): else: field = QLineEdit(value, self) elif isinstance(value, (list, tuple)): - value = list(value) # in case this is a tuple + value = list(value) # always needed to protect self.data selindex = value.pop(0) field = QComboBox(self) if isinstance(value[0], (list, tuple)):
Fix a comment to guard against a terrible side effect
PierreRaybaut_formlayout
train
py
f320c24519280bd67c513cac67926b21ba0561a0
diff --git a/src/Entities/Transaction.php b/src/Entities/Transaction.php index <HASH>..<HASH> 100644 --- a/src/Entities/Transaction.php +++ b/src/Entities/Transaction.php @@ -177,4 +177,20 @@ final class Transaction extends Entity { return $this->getResult() === 'approved'; } + + /** + * @return array + */ + public function getSubscriptionIds() + { + return $this->getAttribute('subscriptionIds'); + } + + /** + * @return array + */ + public function getInvoiceIds() + { + return $this->getAttribute('invoiceIds'); + } }
Add subscriptionIds and invoiceIds methods to Transaction (#<I>)
Rebilly_rebilly-php
train
php
7134b74a5c923b10c6291d0b3409215d081c0491
diff --git a/lib/options/rule-indent.js b/lib/options/rule-indent.js index <HASH>..<HASH> 100644 --- a/lib/options/rule-indent.js +++ b/lib/options/rule-indent.js @@ -21,7 +21,6 @@ module.exports = { * @param {node} node */ process: function(nodeType, node, level) { - // increasing indent level if (nodeType === 'block') { if (node[0][0] !== 's') { node.unshift(['s', '']); @@ -38,12 +37,8 @@ module.exports = { tail = node.splice(i); tail.unshift(space); Array.prototype.push.apply(node, tail); + i++; } - - // replacing last line space by value: - // '' => '\n\t' - // '\n ' => '\n\t' - // '\n \n ' => '\n \n\t' space[1] = space[1].replace(/(\n)?([\t ]+)?$/, value); } };
rule-indent: loop fix
csscomb_csscomb.js
train
js
9e81c6de3b039b6afc1ff65ba0d3c75bca5fbd4f
diff --git a/pymc3/distributions/multivariate.py b/pymc3/distributions/multivariate.py index <HASH>..<HASH> 100644 --- a/pymc3/distributions/multivariate.py +++ b/pymc3/distributions/multivariate.py @@ -79,11 +79,11 @@ class Dirichlet(Continuous): # only defined for sum(value) == 1 return bound( - sum(logpow( - value, a - 1) - gammaln(a), axis=0) + gammaln(sum(a)), - + sum(logpow(value, a - 1) - gammaln(a), axis=0) + gammaln(sum(a)), k > 1, - all(a > 0)) + all(a > 0), + all(value >= 0), + all(value <= 1)) class Multinomial(Discrete):
Fix: Dirichlet distribution did not check support.
pymc-devs_pymc
train
py
c02956375f7e406b776aae5bd39e1b417d313b5d
diff --git a/pyphi/macro.py b/pyphi/macro.py index <HASH>..<HASH> 100644 --- a/pyphi/macro.py +++ b/pyphi/macro.py @@ -169,8 +169,7 @@ class MacroSubsystem(Subsystem): else: self.nodes = () - # Hash the final subsystem and nodes - # Only compute hash once. + # Hash the final subsystem - only compute hash once. self._hash = hash((self.network, self.cut, self._network_state, @@ -178,8 +177,6 @@ class MacroSubsystem(Subsystem): self._hidden_indices, self._output_grouping, self._state_grouping)) - for node in self.nodes: - node._hash = hash((node.index, node.subsystem)) # The nodes represented in computed repertoires. self._dist_indices = self.node_indices
Remove redundant Node hash Node hashes are already generated in `Node.__init__`.
wmayner_pyphi
train
py
03abb26ac39b5ff09b643850afd51ab13f4d779f
diff --git a/spec/celluloid/pool_spec.rb b/spec/celluloid/pool_spec.rb index <HASH>..<HASH> 100644 --- a/spec/celluloid/pool_spec.rb +++ b/spec/celluloid/pool_spec.rb @@ -33,7 +33,7 @@ describe "Celluloid.pool" do queue.pop.should == :done end - it "handles crashes", :pending => (RUBY_ENGINE == 'rbx') do + it "handles crashes" do expect { subject.crash }.to raise_error(ExampleError) subject.process.should == :done end
Not sure why this was disabled on rbx
celluloid_celluloid
train
rb
024baf8c300efa4c38940829cb30d830e1969ace
diff --git a/spec/execution_spec.rb b/spec/execution_spec.rb index <HASH>..<HASH> 100644 --- a/spec/execution_spec.rb +++ b/spec/execution_spec.rb @@ -28,6 +28,13 @@ describe "Execution" do Given { stack.add Factory.middleware(2, implement: nil) } Then { expect(env.result).to eq [:before1, :before2, :around_pre2, :implement1, :around_post2, :after1, :after2 ] } + + context "if add middleware3" do + + Given { stack.add Factory.middleware(3, around: nil, implement: nil) } + + Then { expect(env.result).to eq [:before1, :before2, :before3, :around_pre2, :implement1, :around_post2, :after1, :after2, :after3 ] } + end end end
longer chain to make sure chain linking works
ronen_modware
train
rb
d57871cf72f4fe50f1456d89a839ae53007a81ca
diff --git a/src/models/app_configuration.js b/src/models/app_configuration.js index <HASH>..<HASH> 100644 --- a/src/models/app_configuration.js +++ b/src/models/app_configuration.js @@ -40,7 +40,7 @@ AppConfiguration.addLinkedApplication = function(appData, alias) { var currentConfig = AppConfiguration.loadApplicationConf(); var appEntry = { app_id: appData.id, - deploy_url: appData.deployment.httpUrl || app.deployment.url, + deploy_url: appData.deployment.httpUrl || appData.deployment.url, name: appData.name, alias: alias || unidecode(appData.name).replace(/[^a-zA-z0-9]+/gi, "-").toLowerCase() };
Fix git fallback for http deployment urls
CleverCloud_clever-tools
train
js
ee7aef3baf6f8d83974d6188809bfd4b714eab16
diff --git a/Kwf/Assets/Loader.php b/Kwf/Assets/Loader.php index <HASH>..<HASH> 100644 --- a/Kwf/Assets/Loader.php +++ b/Kwf/Assets/Loader.php @@ -55,6 +55,8 @@ class Kwf_Assets_Loader $ret['mimeType'] = 'text/x-component'; } else if (substr($file, -4)=='.pdf') { $ret['mimeType'] = 'application/pdf'; + } else if (substr($file, -4)=='.xml') { + $ret['mimeType'] = 'application/xml; charset=utf-8'; } else { throw new Kwf_Assets_NotFoundException("Invalid filetype ($file)"); }
Add xml to supported mimeTypes in AssetsLoader Using application/xml because normally this output is not read by users.
koala-framework_koala-framework
train
php
4d1e56159c45c23ae6d4fd99073a11794c28d77e
diff --git a/apitools/base/protorpclite/descriptor_test.py b/apitools/base/protorpclite/descriptor_test.py index <HASH>..<HASH> 100644 --- a/apitools/base/protorpclite/descriptor_test.py +++ b/apitools/base/protorpclite/descriptor_test.py @@ -18,9 +18,9 @@ """Tests for apitools.base.protorpclite.descriptor.""" import platform import types -import unittest import six +import unittest2 from apitools.base.protorpclite import descriptor from apitools.base.protorpclite import message_types @@ -78,8 +78,8 @@ class DescribeEnumTest(test_util.TestCase): described.check_initialized() self.assertEquals(expected, described) - @unittest.skipIf('PyPy' in platform.python_implementation(), - 'todo: reenable this') + @unittest2.skipIf('PyPy' in platform.python_implementation(), + 'todo: reenable this') def testEnumWithItems(self): class EnumWithItems(messages.Enum): A = 3 @@ -511,9 +511,5 @@ class DescriptorLibraryTest(test_util.TestCase): self.assertEquals(None, self.library.lookup_package('Packageless')) -def main(): - unittest.main() - - if __name__ == '__main__': - main() + unittest2.main()
Update a unittest skip for py<I> compatibility.
google_apitools
train
py
aa1e6b004489d7d7d8601d408bcbdf4fdd237c7d
diff --git a/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java b/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java +++ b/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java @@ -388,7 +388,6 @@ public abstract class WebDriverManager { } } catch (Exception e) { - e.printStackTrace(); handleException(e, arch, version); } } @@ -826,7 +825,5 @@ public abstract class WebDriverManager { mirrorLog = false; listVersions = null; versionToDownload = null; - downloadedVersion = null; - driverManagerType = null; } }
Remove non-necessary statements in parent manager
bonigarcia_webdrivermanager
train
java
d0e702249415c35f9e3d172ef873804d059200ba
diff --git a/src/webignition/UrlHealthChecker/UrlHealthChecker.php b/src/webignition/UrlHealthChecker/UrlHealthChecker.php index <HASH>..<HASH> 100644 --- a/src/webignition/UrlHealthChecker/UrlHealthChecker.php +++ b/src/webignition/UrlHealthChecker/UrlHealthChecker.php @@ -140,6 +140,20 @@ class UrlHealthChecker { } catch (HttpConnectException $connectException) { throw $connectException; } catch (RequestException $requestException) { + $isCurlExceptionMessage = + substr($requestException->getMessage(), 0, strlen('cURL error')) == 'cURL error'; + + if (!$requestException->hasResponse() && $isCurlExceptionMessage) { + $connectException = new ConnectException( + $requestException->getMessage(), + $requestException->getRequest(), + $requestException->getResponse(), + $requestException->getPrevious() + ); + + throw $connectException; + } + $this->badRequestCount++; if ($this->isBadRequestLimitReached()) {
Handle curl errors that are not raised as a ConnectException (#2)
webignition_url-health-checker
train
php
53dfa459ed3937d6e3f543ba26d04c4b7e1f3b48
diff --git a/src/Form.js b/src/Form.js index <HASH>..<HASH> 100644 --- a/src/Form.js +++ b/src/Form.js @@ -75,7 +75,10 @@ export default class Form extends InputContainer { return child; } - if (child.type === ValidatedInput || child.type === RadioGroup) { + if (child.type === ValidatedInput || + child.type.prototype instanceof ValidatedInput || + child.type === RadioGroup || + child.type.prototype instanceof RadioGroup) { let name = child.props && child.props.name; if (!name) {
Add ability to subclass ValidatedInput Allow the creation of custom components by subclassing ValidatedInput
heilhead_react-bootstrap-validation
train
js
104f0109579aefccf98b97932c5635c1da8b4dac
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ setup( version=version.txaws, description="Async library for EC2, OpenStack, and Eucalyptus", author="txAWS Developers", - url="https://github.com/oubiwann/txaws", + url="https://github.com/twisted/txaws", license="MIT", packages=find_packages(), scripts=glob("./bin/*"),
Updated URL for new home on GitHub.
twisted_txaws
train
py
b4dea9be874641bf211d0b8e101c5217c7429037
diff --git a/src/httpRangeFetcher.js b/src/httpRangeFetcher.js index <HASH>..<HASH> 100644 --- a/src/httpRangeFetcher.js +++ b/src/httpRangeFetcher.js @@ -228,7 +228,7 @@ class HttpRangeFetcher { // have been overwritten sometime while the promise was in flight _uncacheIfSame(key, cachedPromise) { if (this.chunkCache.get(key) === cachedPromise) { - this.chunkCache.del(key) + this.chunkCache.delete(key) } }
Correct cache delete for quick-lru
rbuels_http-range-fetcher
train
js
1abfe21e9958ea5587ef0b3c669dc2c5d9dfbd9c
diff --git a/src/ServerRequest.php b/src/ServerRequest.php index <HASH>..<HASH> 100644 --- a/src/ServerRequest.php +++ b/src/ServerRequest.php @@ -520,8 +520,8 @@ class ServerRequest extends Request implements ServerRequestInterface $headers = function_exists('getallheaders') ? getallheaders() : []; foreach ($headers as $name => $value) { - $name = str_replace('-', '_', $name); unset($headers[$name]); + $name = str_replace('-', '_', $name); $headers[$name] = $value; }
replace '-' in the request header with '_' while create server request
fastdlabs_http
train
php
93e9adea69e1dfa38cc21054f63393e6eb6a1fb4
diff --git a/workalendar/oceania.py b/workalendar/oceania.py index <HASH>..<HASH> 100644 --- a/workalendar/oceania.py +++ b/workalendar/oceania.py @@ -97,20 +97,16 @@ class AustraliaCapitalTerritory(Australia): if year in (2007, 2008, 2009): day = AustraliaCapitalTerritory.get_nth_weekday_in_month( year, 11, TUE) - elif year == 2010: - day = date(2010, 9, 27) - elif year == 2011: - day = date(2011, 10, 10) - elif year == 2012: - day = date(2012, 10, 8) - elif year == 2013: - day = date(2013, 9, 30) - elif year == 2014: - day = date(2014, 9, 29) - elif year == 2015: - day = date(2015, 9, 28) - elif year == 2016: - day = date(2016, 9, 26) + # Family & Community Day was celebrated on the last Monday of + # November in 2010, 2013, 2014, 2015, 2016, 2017 + elif year in (2010, 2013, 2014, 2015, 2016, 2017): + day = AustraliaCapitalTerritory.get_last_weekday_in_month( + year, 9, MON) + # Family & Community Day was celebrated on the second Monday of + # October in 2011 and 2012 + elif year in (2011, 2012): + day = AustraliaCapitalTerritory.get_nth_weekday_in_month( + year, 10, MON, 2) else: raise Exception("Year %d is not implemented, Sorry" % year) return (day, "Family & Community Day")
Add AustraliaCapitalTerritory <I> Family Day.
peopledoc_workalendar
train
py
b0fee64a044685de05f7c5b63309d28131ae5719
diff --git a/django_prometheus/middleware.py b/django_prometheus/middleware.py index <HASH>..<HASH> 100644 --- a/django_prometheus/middleware.py +++ b/django_prometheus/middleware.py @@ -119,7 +119,7 @@ class PrometheusAfterMiddleware(MiddlewareMixin): requests_by_transport.labels(transport).inc() if request.is_ajax(): ajax_requests.inc() - requests_body_bytes.observe(len(request.body)) + requests_body_bytes.observe(int(request.META.get('CONTENT_LENGTH') or 0)) request.prometheus_after_middleware_event = Time() def process_view(self, request, view_func, *view_args, **view_kwargs):
Do not read request.body in middleware (not valid for streaming requests)
korfuri_django-prometheus
train
py
dad858994ba869888b95d75d0bbe75529217a400
diff --git a/template.go b/template.go index <HASH>..<HASH> 100644 --- a/template.go +++ b/template.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "path/filepath" + "reflect" "regexp" "strconv" "strings" @@ -100,10 +101,21 @@ var ( }, // Pluralize - "pluralize": func(num int, singular, plural string) template.HTML { - if num == 1 { + "pluralize": func(array interface{}, pluralOverrides ...string) template.HTML { + singular, plural := "", "s" + + if len(pluralOverrides) >= 1 { + singular = pluralOverrides[0] + if len(pluralOverrides) == 2 { + plural = pluralOverrides[1] + } + } + + v := reflect.ValueOf(array) + if v.Kind() != reflect.Slice || v.Len() == 1 { return template.HTML(singular) } + return template.HTML(plural) }, }
Changed functionality of pluralize template helper
revel_revel
train
go
da14de34e92bc23ea4afe630e13caa9e4438af35
diff --git a/main.py b/main.py index <HASH>..<HASH> 100644 --- a/main.py +++ b/main.py @@ -90,7 +90,7 @@ def download_matches(store_callback, seed_players_by_tier, minimum_tier = Tier.b .format(datetime.datetime.now().strftime("%m-%d %H:%M:%S"), tier.name, len(matches_to_download_by_tier), matches_in_time_slice)) - for match_id in matches_to_download_by_tier.consume(tier, 10): + for match_id in matches_to_download_by_tier.consume(tier, 10, 0.2): try: match = get_match(match_id, include_timeline) if match.mapId == map_type.value:
Consuming at least <I> matches, but up to <I>% of the total matches for each tier every time we download matches
MakersF_LoLScraper
train
py
c654e350071a68ab7ce813599154d92c946b5c5d
diff --git a/lib/db/caches.php b/lib/db/caches.php index <HASH>..<HASH> 100644 --- a/lib/db/caches.php +++ b/lib/db/caches.php @@ -382,9 +382,6 @@ $definitions = array( 'mode' => cache_store::MODE_SESSION, 'simplekeys' => true, 'simpledata' => true, - 'ttl' => 1800, - 'invalidationevents' => array( - 'createduser', - ) + 'ttl' => 1800 ), ); diff --git a/user/lib.php b/user/lib.php index <HASH>..<HASH> 100644 --- a/user/lib.php +++ b/user/lib.php @@ -126,8 +126,9 @@ function user_create_user($user, $updatepassword = true, $triggerevent = true) { \core\event\user_created::create_from_userid($newuserid)->trigger(); } - // Purge the associated caches. - cache_helper::purge_by_event('createduser'); + // Purge the associated caches for the current user only. + $presignupcache = \cache::make('core', 'presignup'); + $presignupcache->purge_current_user(); return $newuserid; }
MDL-<I> core_user: Avoid redirection during signup Purge cache just for the current user to avoid redirection when 2 simultaneous users try to sign up at the same time and some policy has to be agreed. The 'createduser' invalidation event has been removed also because is not used any more. Thanks John Azinheira for spotting it!
moodle_moodle
train
php,php
048f3aebcfb72b79d653f5fdb25152295d13b306
diff --git a/web/concrete/src/Support/Symbol/MetadataGenerator.php b/web/concrete/src/Support/Symbol/MetadataGenerator.php index <HASH>..<HASH> 100644 --- a/web/concrete/src/Support/Symbol/MetadataGenerator.php +++ b/web/concrete/src/Support/Symbol/MetadataGenerator.php @@ -25,7 +25,7 @@ class MetadataGenerator $className = $static['concrete']; } - if ($className !== null) { + if ($className !== null && $className !== get_class($this)) { if ($className[0] !== '\\') { $className = '\\' . $className; }
One of the SPs was coming back as the metadata generator Former-commit-id: b4d<I>e<I>c<I>dfe4ebab1cb<I>d8c8aa
concrete5_concrete5
train
php
027496ccbb811c2da57c162ae2dbed8c76a8ee5e
diff --git a/sumo/plotting/bs_plotter.py b/sumo/plotting/bs_plotter.py index <HASH>..<HASH> 100644 --- a/sumo/plotting/bs_plotter.py +++ b/sumo/plotting/bs_plotter.py @@ -161,12 +161,14 @@ class SBSPlotter(BSPlotter): if spin is not None and not self._bs.is_spin_polarized: raise ValueError('Spin-selection only possible with spin-polarised ' 'calculation results') - - elif spin is not None: - is_vb = self._bs.bands[spin] <= self._bs.get_vbm()['energy'] - elif self._bs.is_spin_polarized or self._bs.is_metal(): + elif self._bs.is_metal() or (self._bs.is_spin_polarized and not spin): + # if metal or spin polarized and spin not specified is_vb = [True] + elif spin: + # not metal, spin-polarized and spin is set + is_vb = self._bs.bands[spin] <= self._bs.get_vbm()['energy'] else: + # not metal, not spin polarized and therefore spin not set is_vb = self._bs.bands[Spin.up] <= self._bs.get_vbm()['energy'] # nd is branch index, nb is band index, nk is kpoint index
BUG: Fix spin selection in metals
SMTG-UCL_sumo
train
py
2f9cd81b494441d61b80a5effa0590dd9afc883a
diff --git a/proxy/fails/classifier_group.go b/proxy/fails/classifier_group.go index <HASH>..<HASH> 100644 --- a/proxy/fails/classifier_group.go +++ b/proxy/fails/classifier_group.go @@ -2,6 +2,14 @@ package fails type ClassifierGroup []Classifier +// RetriableClassifiers include backend errors that are safe to retry +// +// Backend errors are only safe to retry if we can be certain that they have +// occurred before any http request data has been sent from gorouter to the +// backend application. +// +// Otherwise, there’s risk of a mutating non-idempotent request (e.g. send +// payment) being silently retried without the client knowing. var RetriableClassifiers = ClassifierGroup{ Dial, AttemptedTLSWithNonTLSBackend,
Add guidance for adding retriable classifiers RetriableClassifiers include backend errors that are safe to retry Backend errors are only safe to retry if we can be certain that they have occurred before any http request data has been sent from gorouter to the backend application. Otherwise, there’s risk of a mutating non-idempotent request (e.g. send payment) being silently retried without the client knowing.
cloudfoundry_gorouter
train
go
584bb4b73163b8dbf320c87ae6311fa9232752f1
diff --git a/lib/device.js b/lib/device.js index <HASH>..<HASH> 100644 --- a/lib/device.js +++ b/lib/device.js @@ -9,6 +9,7 @@ var defaultOptions = { unknownUserAgentDeviceType: 'phone', botUserAgentDeviceType: 'bot', carUserAgentDeviceType: 'car', + consoleUserAgentDeviceType: 'tv', parseUserAgent: false }; @@ -53,7 +54,7 @@ function DeviceParser(user_agent, options) { return 'tv'; } else if (ua.match(/Xbox|PLAYSTATION (3|4)|Wii/i)) { // if user agent is a TV Based Gaming Console - return 'tv'; + return self.options.consoleUserAgentDeviceType; } else if (ua.match(/QtCarBrowser/i)) { // if the user agent is a car return self.options.carUserAgentDeviceType;;
Add consoleUserAgentDeviceType option. Add custom option for console so those who wants another result (such as 'console') when a console is detected instead of 'tv' can.
rguerreiro_device
train
js
1da7985105ecdec78798c0f7e7bc3f3ab36f4a2d
diff --git a/src/js/components/Tabs.js b/src/js/components/Tabs.js index <HASH>..<HASH> 100644 --- a/src/js/components/Tabs.js +++ b/src/js/components/Tabs.js @@ -21,7 +21,7 @@ export default class Tabs extends Component { } componentWillReceiveProps(nextProps) { - if ((nextProps.activeIndex || 0 === nextProps.activeIndex) && + if (nextProps.activeIndex && this.state.activeIndex !== nextProps.activeIndex) { this.setState({activeIndex: nextProps.activeIndex}); } diff --git a/src/js/components/TextInput.js b/src/js/components/TextInput.js index <HASH>..<HASH> 100644 --- a/src/js/components/TextInput.js +++ b/src/js/components/TextInput.js @@ -34,8 +34,6 @@ export default class TextInput extends Component { this.state = { announceChange: false, dropActive: false, - defaultValue: props.defaultValue, - value: props.value, activeSuggestionIndex: -1 }; }
Fixed Tabs componentWillReceiveProps. Removed used state from TextInput.
grommet_grommet
train
js,js
02830bd829c6b8d4b98ec22816469e715a170ebc
diff --git a/lib/drizzlepac/catalogs.py b/lib/drizzlepac/catalogs.py index <HASH>..<HASH> 100644 --- a/lib/drizzlepac/catalogs.py +++ b/lib/drizzlepac/catalogs.py @@ -737,7 +737,7 @@ class UserCatalog(Catalog): self.sharp_col = False if self.pars['xyunits'] == 'degrees': - self.radec = (self.xypos[0].copy(), self.xypos[1].copy()) + self.radec = [self.xypos[0].copy(), self.xypos[1].copy()] if self.wcs is not None: self.xypos[:2] = list(self.wcs.all_world2pix(np.array(self.xypos[:2]).T, self.origin).T)
Add support for user-provided image catalogs in degrees
spacetelescope_drizzlepac
train
py
f2c1d52ed6f8f656d536630907124395392b4c68
diff --git a/test/Type/PhpEnumTypeTest.php b/test/Type/PhpEnumTypeTest.php index <HASH>..<HASH> 100644 --- a/test/Type/PhpEnumTypeTest.php +++ b/test/Type/PhpEnumTypeTest.php @@ -121,16 +121,14 @@ class PhpEnumTypeTest extends TestCase $this->assertEquals($expectedValue, $actualValue); } - public function provideValues(): array - { - return [ - [Action::class, Action::CREATE(), Action::CREATE], - [Action::class, Action::READ(), Action::READ], - [Action::class, Action::UPDATE(), Action::UPDATE], - [Action::class, Action::DELETE(), Action::DELETE], - [Gender::class, Gender::FEMALE(), Gender::FEMALE], - [Gender::class, Gender::MALE(), Gender::MALE], - ]; + public function provideValues(): iterable + { + yield [Action::class, Action::CREATE(), Action::CREATE]; + yield [Action::class, Action::READ(), Action::READ]; + yield [Action::class, Action::UPDATE(), Action::UPDATE]; + yield [Action::class, Action::DELETE(), Action::DELETE]; + yield [Gender::class, Gender::FEMALE(), Gender::FEMALE]; + yield [Gender::class, Gender::MALE(), Gender::MALE]; } /**
Replaced test data provider using an array by a generator
acelaya_doctrine-enum-type
train
php
f121390083a682bde5754c58c66ed61e4fdcb059
diff --git a/Classes/Service/ImageResizer.php b/Classes/Service/ImageResizer.php index <HASH>..<HASH> 100644 --- a/Classes/Service/ImageResizer.php +++ b/Classes/Service/ImageResizer.php @@ -539,7 +539,7 @@ class ImageResizer { $data['bytes'] = $bytes + (isset($data['bytes']) ? (int)$data['bytes'] : 0); $data['images'] = 1 + (isset($data['images']) ? (int)$data['images'] : 0); - file_put_contents($fileName, json_encode($data)); + GeneralUtility::writeFile($fileName, json_encode($data)); } } \ No newline at end of file
[BUGFIX] Upload fails due to file permission error The hidden file "typo3conf/.tx_imageautoresize" may be created with invalid ownership which, in turn, may prevent the upload of images to succeed. Change-Id: Ia5a<I>d4a0f<I>f5f<I>f7f<I>c<I>a3ff4bc Resolves: #<I> Reviewed-on: <URL>
xperseguers_t3ext-image_autoresize
train
php
fc79d594d34a51c9986e4ed8fe382d2f658a1c0d
diff --git a/lib/jsdom/living/filelist.js b/lib/jsdom/living/filelist.js index <HASH>..<HASH> 100644 --- a/lib/jsdom/living/filelist.js +++ b/lib/jsdom/living/filelist.js @@ -1,6 +1,6 @@ "use strict"; -const filelistSymbols = require("./file-symbols"); +const filelistSymbols = require("./filelist-symbols"); module.exports = function (core) { class FileList {
Fix typo in symbols file name The correct file containing the symbols for filellist.js is filelist-symbols, not file-symbols.
jsdom_jsdom
train
js
581782a0230e926cc9d42f548a44e095a371ef49
diff --git a/src/react/RouterToUrlQuery.js b/src/react/RouterToUrlQuery.js index <HASH>..<HASH> 100644 --- a/src/react/RouterToUrlQuery.js +++ b/src/react/RouterToUrlQuery.js @@ -16,10 +16,11 @@ export default class RouterToUrlQuery extends Component { componentWillMount() { const { router } = this.context; + configureUrlQuery({ history: { - push: router.transitionTo, - replace: router.replaceWith, + push: router.push || router.transitionTo, + replace: router.replace || router.replaceWith, }, }); }
Look for replace and push functions first when linking router
pbeshai_react-url-query
train
js
3fcafeb57934328a87b476584502caf457544767
diff --git a/lib/oauth.js b/lib/oauth.js index <HASH>..<HASH> 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -253,10 +253,8 @@ OAuth.prototype.accessToken = function(token, verifier, callback) { // // #### Code OAuth.prototype.authenticate = function(token, cb) { - var self = this; helper.check(token, 'string','','Requires a token', cb); - - return cb(null, self.uri.authenticate + '?oauth_token=' + token); + return cb(null, this.uri.authenticate + '?oauth_token=' + token); }; // @@ -288,10 +286,8 @@ OAuth.prototype.authenticate = function(token, cb) { // ``` // #### Code OAuth.prototype.authorize = function(token, cb) { - var self = this; helper.check(token, 'string', '', 'Requires a token', cb); - - return cb(null, self.uri.authorize + '?oauth_token=' + token); + return cb(null, this.uri.authorize + '?oauth_token=' + token); }; module.exports = OAuth;
lib/oauth: simplify
ghostbar_twitter-rest-lite
train
js
4f748c7220ea0e5006f8a01b6941c27fc36b3fb3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ with open('LICENSE') as fl: setup( name='CurrencyConverter', - version='0.13.5', + version='0.13.6', author='Alex Prengère', author_email='[email protected]', url='https://github.com/alexprengere/currencyconverter',
Bump to version <I>
alexprengere_currencyconverter
train
py
a4eb3e9192c09da9a9e77911f7a22a81fef879df
diff --git a/src/Chromabits/Nucleus/Support/Std.php b/src/Chromabits/Nucleus/Support/Std.php index <HASH>..<HASH> 100644 --- a/src/Chromabits/Nucleus/Support/Std.php +++ b/src/Chromabits/Nucleus/Support/Std.php @@ -167,9 +167,7 @@ class Std extends StaticObject Arguments::contain(Boa::func(), Boa::foldable()) ->check($function, $foldable); - static::foldl(function ($accumulator, $value, $key) use ($function) { - $function($value, $key); - }, null, $foldable); + static::map($function, $foldable); } /**
Revert behavior of Std::each
chromabits_nucleus
train
php
50e21b071cf3e6ad66e0a6534d108fb17d5a24e9
diff --git a/command/agent/dns.go b/command/agent/dns.go index <HASH>..<HASH> 100644 --- a/command/agent/dns.go +++ b/command/agent/dns.go @@ -194,6 +194,8 @@ func (d *DNSServer) handlePtr(resp dns.ResponseWriter, req *dns.Msg) { } var out structs.IndexedNodes + // TODO: Replace ListNodes with an internal RPC that can do the filter + // server side to avoid transfering the entire node list. if err := d.agent.RPC("Catalog.ListNodes", &args, &out); err == nil { for _, n := range out.Nodes { arpa, _ := dns.ReverseAddr(n.Address)
agent: Adding TODO for future optimization
hashicorp_consul
train
go
ee0ebd72ea421ea7d0de08422114c9f746cbab1e
diff --git a/build.php b/build.php index <HASH>..<HASH> 100755 --- a/build.php +++ b/build.php @@ -8,7 +8,7 @@ if ($returnStatus !== 0) { exit(1); } -passthru('./vendor/bin/phpcs --standard=' . __DIR__ . '/DWS --extensions=php -n tests DWS', $returnStatus); +passthru('./vendor/bin/phpcs --standard=' . __DIR__ . '/DWS --extensions=php -n tests DWS *.php', $returnStatus); if ($returnStatus !== 0) { exit(1); }
Include php files in root of project in phpcs check.
traderinteractive_dws-coding-standard
train
php
a8c8b78e78e7df8a93d047e9d1a3b2975f0e4f43
diff --git a/js/modules/LevenshteinFS.js b/js/modules/LevenshteinFS.js index <HASH>..<HASH> 100644 --- a/js/modules/LevenshteinFS.js +++ b/js/modules/LevenshteinFS.js @@ -17,6 +17,8 @@ var LevenshteinFS = prime({ }, search: function(term, haystack) { + var that = this; + this.lastTerm = term; this.lastHaystack = haystack; @@ -25,22 +27,17 @@ var LevenshteinFS = prime({ var matches = []; - var nwl = needleWords.length; - var hwl = haystackWords.length; - for (var i = 0; i < hwl; i++) { - var haystackWord = haystackWords[i]; - var best = this.options.maxDistanceTolerance + 1; - for (var j = 0; j < nwl; j++) { - var needleWord = needleWords[j]; - + arr.forEach(haystackWords, function (haystackWord) { + var best = that.options.maxDistanceTolerance + 1; + arr.forEach(needleWords, function (needleWord) { var score = lev(needleWord, haystackWord); if (score < best) { best = score; } - } + }); matches.push(best); - } + }); this.lastResults = matches;
Changed for loops to forEach loops
unlooped_FuzzySearchJS
train
js
6775464b06bf6ac4320e6258a3c86d3632728f31
diff --git a/lib/observable/remove.js b/lib/observable/remove.js index <HASH>..<HASH> 100644 --- a/lib/observable/remove.js +++ b/lib/observable/remove.js @@ -84,6 +84,10 @@ function emitParentRemoval (parent, key, event) { parent.emit('change', event) console.log('propertyREMOVE----->', 'allready have to have nulled fields ;?', event.removed) - // this[key]._input = null + + // temp fix totaly wrong! + // remove needs restructure + parent[key]._input = null + parent.emit('property', event, key) } diff --git a/test/common/observable/emitter/direct/meta/index.js b/test/common/observable/emitter/direct/meta/index.js index <HASH>..<HASH> 100644 --- a/test/common/observable/emitter/direct/meta/index.js +++ b/test/common/observable/emitter/direct/meta/index.js @@ -36,7 +36,7 @@ describe('meta', function () { it('change meta should be null when removed', function () { console.warn('-------') - a.remove() + a.afield.remove() expect(measure.a.change).equals(null) }) })
added remove functionality for properties (temp fix)
vigour-io_vjs
train
js,js
09eceaf120ed4cba88c2c959661c3d52b883d495
diff --git a/tests/test_core.py b/tests/test_core.py index <HASH>..<HASH> 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -239,6 +239,20 @@ class TestArgNesting: arg.validated('', {}) assert 'Required parameter "foo" not found.' in str(excinfo) + def test_nested_multiple(self): + arg = Arg({ + 'foo': Arg(required=True), + 'bar': Arg(required=True), + }, multiple=True) + + in_data = [{'foo': 42, 'bar': 24}, {'foo': 12, 'bar': 21}] + assert arg.validated('', in_data) == in_data + bad_data = [{'foo': 42, 'bar': 24}, {'bar': 21}] + + with pytest.raises(ValidationError) as excinfo: + arg.validated('', bad_data) + assert 'Required' in str(excinfo) + # Parser tests @mock.patch('webargs.core.Parser.parse_json')
Add test case for nested args with multiple=True verifies #<I>
marshmallow-code_webargs
train
py
1f57d237e10d9565655b898678e1355ab7cbd49b
diff --git a/core/src/main/java/org/testcontainers/containers/GenericContainer.java b/core/src/main/java/org/testcontainers/containers/GenericContainer.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/testcontainers/containers/GenericContainer.java +++ b/core/src/main/java/org/testcontainers/containers/GenericContainer.java @@ -241,6 +241,12 @@ public class GenericContainer<SELF extends GenericContainer<SELF>> } ResourceReaper.instance().stopAndRemoveContainer(containerId, imageName); + + try { + dockerClient.close(); + } catch (IOException e) { + logger().debug("Failed to close docker client"); + } } /**
Explicitly close docker clients at end of test method/class
testcontainers_testcontainers-java
train
java
cdaf56213ed30728190895a475bcafd635aad1a5
diff --git a/dimod/package_info.py b/dimod/package_info.py index <HASH>..<HASH> 100644 --- a/dimod/package_info.py +++ b/dimod/package_info.py @@ -14,7 +14,7 @@ # # ================================================================================================ -__version__ = '0.9.0.dev3' +__version__ = '0.9.0.dev4' __author__ = 'D-Wave Systems Inc.' __authoremail__ = '[email protected]' __description__ = 'A shared API for binary quadratic model samplers.'
Update version <I>.dev3 -> <I>.dev4 Fixes ----- * Fix deserialization of variables that are nested tuples * Include `shapeablebqm.pyx.src` in the `manifest.ini`
dwavesystems_dimod
train
py
469f985602270efd4282ccfc49424edb6a2afe8d
diff --git a/raven/contrib/django/client.py b/raven/contrib/django/client.py index <HASH>..<HASH> 100644 --- a/raven/contrib/django/client.py +++ b/raven/contrib/django/client.py @@ -41,6 +41,14 @@ def install_sql_hook(): except ImportError: from django.db.backends.util import CursorWrapper + try: + real_execute = CursorWrapper.execute + real_executemany = CursorWrapper.executemany + except AttributeError: + # XXX(mitsuhiko): On some very old django versions (<1.6) this + # trickery would have to look different but I can't be bothered. + return + def record_sql(start, sql, params): breadcrumbs.record_breadcrumb('query', { 'query': sql, @@ -49,9 +57,6 @@ def install_sql_hook(): 'classifier': 'django.db' }) - real_execute = CursorWrapper.execute - real_executemany = CursorWrapper.executemany - def execute(self, sql, params=None): start = time.time() try:
Fix breakage for older django versions
getsentry_raven-python
train
py
b2a49dcb0e927de6d0ba33e1b5106e6a9897a677
diff --git a/Entity/DistributionListRepository.php b/Entity/DistributionListRepository.php index <HASH>..<HASH> 100644 --- a/Entity/DistributionListRepository.php +++ b/Entity/DistributionListRepository.php @@ -19,6 +19,7 @@ class DistributionListRepository extends EntityRepository return $key; } } + return false; } private function compare($a, $b) @@ -44,11 +45,13 @@ class DistributionListRepository extends EntityRepository $includedStops = $distributionList->getIncludedStops(); foreach ($includedStops as $scheduleId) { $key = $this->findScheduleKey($scheduleId, $schedules); - if ($reset == false) { - $sortedSchedules['included'][] = clone $schedules[$key]; + if ($key != false) { + if ($reset == false) { + $sortedSchedules['included'][] = clone $schedules[$key]; + } + unset($schedules[$key]); + reset($schedules); } - unset($schedules[$key]); - reset($schedules); } $sortedSchedules['excluded'] = $schedules; if ($reset == 1) {
BUGFIX when a stoppoint was deleted in Navitia, distribution list was broken
CanalTP_MttBundle
train
php
2df1126b2d751f36f8aa4e62cade8df4253029eb
diff --git a/lib/weblib.php b/lib/weblib.php index <HASH>..<HASH> 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2849,7 +2849,11 @@ function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) { if (!defined('DEBUGGING_PRINTED')) { define('DEBUGGING_PRINTED', 1); // indicates we have printed something } - echo '<div class="notifytiny">' . $message . $from . '</div>'; + if (CLI_SCRIPT) { + echo "++ $message ++\n$from"; + } else { + echo '<div class="notifytiny">' . $message . $from . '</div>'; + } } else { trigger_error($message . $from, E_USER_NOTICE);
MDL-<I> debugging does not print html any more in CLI mode
moodle_moodle
train
php
0d9afcdb64906820b244ffdcf33fb026dfd2bcea
diff --git a/samples/TimePickerSample.js b/samples/TimePickerSample.js index <HASH>..<HASH> 100644 --- a/samples/TimePickerSample.js +++ b/samples/TimePickerSample.js @@ -48,7 +48,7 @@ enyo.kind({ {name:"timePicker2", kind:"onyx.TimePicker", is24HrMode:true} ]}, {kind: "onyx.Groupbox", style:"padding:5px;", components: [ - {kind: "onyx.GroupboxHeader", content: "Value"}, + {kind: "onyx.GroupboxHeader", content: "Localized Value"}, {name:"timePicker2Value", style:"padding:15px;"} ]}, {content:"DISABLED",classes:"onyx-sample-divider"},
ENYO-<I>: update label to more clearly indicate that the time being shown is the localized value of the time in the picker Enyo-DCO-<I>-
enyojs_onyx
train
js
600758e9f88ad693484386fd355985b2fb5f3c9f
diff --git a/irco/parsers/compendex.py b/irco/parsers/compendex.py index <HASH>..<HASH> 100644 --- a/irco/parsers/compendex.py +++ b/irco/parsers/compendex.py @@ -12,6 +12,7 @@ class Tokenizer(base.Tokenizer): value = '\n'.join(lines) record = base.Record(self.FORMAT, value) record.source = (stream.name, line) + return record def tokenize(self, stream): record = [] diff --git a/irco/scripts/data_import.py b/irco/scripts/data_import.py index <HASH>..<HASH> 100644 --- a/irco/scripts/data_import.py +++ b/irco/scripts/data_import.py @@ -53,11 +53,11 @@ def import_records(engine, records): affiliated_author = models.AffiliatedAuthor( order=1, unparsed_institution_name=raw, - affiliation=institution, + institution=institution, unparsed_person_name=name, author=author, + publication=publication, ) - publication.authors.append(affiliated_author) session.add(affiliated_author) session.commit()
Adapted to the models updates.
GaretJax_irco
train
py,py
33335fe0c5cc05192e97cc615b4a1901a0faa515
diff --git a/modules/static/app/controllers/static.go b/modules/static/app/controllers/static.go index <HASH>..<HASH> 100644 --- a/modules/static/app/controllers/static.go +++ b/modules/static/app/controllers/static.go @@ -71,7 +71,7 @@ func (c Static) Serve(prefix, filepath string) revel.Result { } file, err := os.Open(fname) - return c.RenderFile(file, "") + return c.RenderFile(file, revel.Inline) } // This method allows modules to serve binary files. The parameters are the same
Use Content-Disposition: Inline for static serving
revel_revel
train
go
b1821e8b33455147c3cac6b81b699d3265cab1c9
diff --git a/src/scripts/user/user.store.js b/src/scripts/user/user.store.js index <HASH>..<HASH> 100644 --- a/src/scripts/user/user.store.js +++ b/src/scripts/user/user.store.js @@ -92,6 +92,7 @@ let UserStore = Reflux.createStore({ * user if the user doesn't already exist. */ signIn(options) { + if (!google.initialized) {return;} let transition = options.hasOwnProperty('transition') ? options.transition : true; this.update({loading: true}); google.signIn((token, profile) => {
Prevent signins before google has initialized
OpenNeuroOrg_openneuro
train
js
2f571a1256c592229951d78da453b363cdd05117
diff --git a/malcolm/modules/stats/controllers/statscontroller.py b/malcolm/modules/stats/controllers/statscontroller.py index <HASH>..<HASH> 100644 --- a/malcolm/modules/stats/controllers/statscontroller.py +++ b/malcolm/modules/stats/controllers/statscontroller.py @@ -15,7 +15,7 @@ def start_ioc(stats, prefix): root = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0] db_template = os.path.join(root, 'db', 'stats.template') ioc = subprocess.Popen( - "softIoc" + " -m %s" % db_macros + " -d %s" % db_template, shell=True, + ["softIoc", "-m", db_macros, "-d", db_template], stdout=subprocess.PIPE, stdin=subprocess.PIPE) # wait for IOC to start pid_rbv = catools.caget("%s:PID" % prefix, timeout=5)
fixed args passed to subprocess so softIoc can be launched without shell=True
dls-controls_pymalcolm
train
py
ae7f95c51f9485002ed8fb448f1d3564ead71319
diff --git a/aws/resource_aws_opsworks_instance_test.go b/aws/resource_aws_opsworks_instance_test.go index <HASH>..<HASH> 100644 --- a/aws/resource_aws_opsworks_instance_test.go +++ b/aws/resource_aws_opsworks_instance_test.go @@ -20,6 +20,7 @@ func TestAccAWSOpsworksInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksInstanceDestroy, Steps: []resource.TestStep{ @@ -69,6 +70,7 @@ func TestAccAWSOpsworksInstance_UpdateHostNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksInstanceDestroy, Steps: []resource.TestStep{
tests/r/opsworks_instance: Add ErrorCheck
terraform-providers_terraform-provider-aws
train
go
20774cb98ac061bf810cae213af9e4a760ae1a29
diff --git a/lib/gelf/transport/tcp.rb b/lib/gelf/transport/tcp.rb index <HASH>..<HASH> 100644 --- a/lib/gelf/transport/tcp.rb +++ b/lib/gelf/transport/tcp.rb @@ -53,6 +53,13 @@ module GELF end def write_socket(socket, message) + unsafe_write_socket(socket, message) + rescue IOError, SystemCallError + socket.close unless socket.closed? + false + end + + def unsafe_write_socket(socket, message) r,w = IO.select([socket], [socket]) # Read everything first while r.any? do @@ -64,10 +71,8 @@ module GELF end # Now send the payload - return w.any? && socket.syswrite(message) > 0 - rescue IOError, SystemCallError - socket.close unless socket.closed? - false + return false unless w.any? + return socket.syswrite(message) > 0 end end end
Code cleanup A second attempt to lower cognitive complexity.
graylog-labs_gelf-rb
train
rb
24fe3787ad2b66ad27f8b38dbdff37b61c06b913
diff --git a/src/Orchestra/Memory/Provider.php b/src/Orchestra/Memory/Provider.php index <HASH>..<HASH> 100644 --- a/src/Orchestra/Memory/Provider.php +++ b/src/Orchestra/Memory/Provider.php @@ -45,7 +45,6 @@ class Provider extends Relic */ public function put($key, $value = '') { - $value = value($value); $this->set($key, $value); return $value;
Update code based on orchestral/support@1d5febb
orchestral_memory
train
php
b33fb2c74331bf0897843d3f3147dd49049abeef
diff --git a/javascript/firefox-driver/extension/components/firefoxDriver.js b/javascript/firefox-driver/extension/components/firefoxDriver.js index <HASH>..<HASH> 100644 --- a/javascript/firefox-driver/extension/components/firefoxDriver.js +++ b/javascript/firefox-driver/extension/components/firefoxDriver.js @@ -371,7 +371,7 @@ FirefoxDriver.prototype.findElementInternal_ = function(respond, method, return; } else { // this is not the exception we are interested in, so we propagate it. - throw e; + throw ex; } } if (element) {
EranMes, on behalf of AndreasHaas: Additioal fix for issue <I>, fix typo when throwing the original exception. r<I>
SeleniumHQ_selenium
train
js
55d9671fde247223b041fcc121b62a22ab482b81
diff --git a/feed.py b/feed.py index <HASH>..<HASH> 100644 --- a/feed.py +++ b/feed.py @@ -173,7 +173,7 @@ def extractNotes(name, notes, legend=None, regex=default_extra_regex): # ---------------------------- -class BasicCanteen(): +class BasicCanteen(object): """ This class represents and stores all informations about OpenMensa canteens. It helps writing new python parsers with helper and shortcuts methods.
feed: fixes LazyCanteen inheritance (uses New-Style-Classes in Python2)
mswart_pyopenmensa
train
py
c6e9e54b7bfe5ad24e7f3e44b7e3286445fb32c0
diff --git a/pytds/dbapi.py b/pytds/dbapi.py index <HASH>..<HASH> 100644 --- a/pytds/dbapi.py +++ b/pytds/dbapi.py @@ -1,7 +1,7 @@ """DB-SIG compliant module for communicating with MS SQL servers""" __author__ = 'Mikhail Denisenko <[email protected]>' -__version__ = '1.6.9' +__version__ = '1.6.9.1' import logging import six diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup setup(name='python-tds', - version='1.6.9', + version='1.6.9.1', description='Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation', author='Mikhail Denisenko', author_email='[email protected]',
bumped version <I>
denisenkom_pytds
train
py,py
50d77092c045298267ffb822b338a469aa3ea70e
diff --git a/src/main/java/org/msgpack/MessagePack.java b/src/main/java/org/msgpack/MessagePack.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/msgpack/MessagePack.java +++ b/src/main/java/org/msgpack/MessagePack.java @@ -556,6 +556,19 @@ public class MessagePack { Template<T> tmpl = registry.lookup(c); return tmpl.read(new Converter(this, v), null); } + + /** + * Converts {@link org.msgpack.type.Value} object to object according to template + * + * @since 0.6.8 + * @param v + * @param tmpl + * @return + * @throws IOException + */ + public <T> T convert(Value v, Template<T> tmpl) throws IOException { + return tmpl.read(new Converter(this, v), null); + } /** * Unconverts specified object to {@link org.msgpack.type.Value} object.
overload convert method with Template parameter convert method with Template is required when you convert Value to parametric type. e.g. `readAsValue(writeV((1,2,))).as[(Int,Int)]` doesn't work with msgpack-scala
msgpack_msgpack-java
train
java
a37e91b35ca421160d34526f3d091164023e6f65
diff --git a/djcelery/snapshot.py b/djcelery/snapshot.py index <HASH>..<HASH> 100644 --- a/djcelery/snapshot.py +++ b/djcelery/snapshot.py @@ -33,7 +33,6 @@ class Camera(Polaroid): def __init__(self, *args, **kwargs): super(Camera, self).__init__(*args, **kwargs) - self.prev_count = 0 self._last_worker_write = defaultdict(lambda: (None, None)) def get_heartbeat(self, worker): @@ -91,11 +90,8 @@ class Camera(Polaroid): return obj def on_shutter(self, state): - event_count = state.event_count - if event_count != self.prev_count: - map(self.handle_worker, state.workers.items()) - map(self.handle_task, state.tasks.items()) - self.prev_count = event_count + map(self.handle_worker, state.workers.items()) + map(self.handle_task, state.tasks.items()) def on_cleanup(self): dirty = sum(self.TaskState.objects.expire_by_states(states, expires)
Fixed bug with losing events. event_count is reset after every shutter, so don't try to keep track of it
celery_django-celery
train
py
d3a60e5a26a8100d291026506f015f6dfd016a6a
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ setup( 'z3-solver>=4.8.5.0', 'future', 'cachetools', + 'decorator', 'pysmt', ], description='An abstraction layer for constraint solvers', diff --git a/tests/common_backend_smt_solver.py b/tests/common_backend_smt_solver.py index <HASH>..<HASH> 100644 --- a/tests/common_backend_smt_solver.py +++ b/tests/common_backend_smt_solver.py @@ -1,17 +1,17 @@ import nose -from functools import wraps +from decorator import decorator import claripy from test_backend_smt import TestSMTLibBackend -def if_installed(f): - @wraps(f) - def inner(*args, **kwargs): - try: - return f(*args, **kwargs) - except claripy.errors.MissingSolverError: - raise nose.SkipTest() - return inner +# use of decorator instead of the usual pattern is important because nose2 will check the argspec and wraps does not +# preserve that! +@decorator +def if_installed(f, *args, **kwargs): + try: + return f(*args, **kwargs) + except claripy.errors.MissingSolverError: + raise nose.SkipTest() KEEP_TEST_PERFORMANT = True
switch from wraps to decorator module to make nose2 happy
angr_claripy
train
py,py
543a3f0cc6d815fe12e1947814ec166a638f3210
diff --git a/tests/test_nationstates_obj.py b/tests/test_nationstates_obj.py index <HASH>..<HASH> 100644 --- a/tests/test_nationstates_obj.py +++ b/tests/test_nationstates_obj.py @@ -143,7 +143,10 @@ class nationstates_object(unittest.TestCase): unicode except NameError: unicode = str - self.assertTrue(isinstance(nation_obj.url, str) or isinstance(nation_obj.url, unicode)) + try: + nation_obj.url + except: + self.fail() try: nation_obj.collect() nation_obj["fullname"]
Python 2 fix, for real this time
DolphDev_pynationstates
train
py
7bfe19a6a14c9b98933fd2c283c24b1f68589502
diff --git a/src/variety-common/MouseInput.js b/src/variety-common/MouseInput.js index <HASH>..<HASH> 100644 --- a/src/variety-common/MouseInput.js +++ b/src/variety-common/MouseInput.js @@ -100,7 +100,7 @@ MouseEvent:{ var subtype=0; // qsubを0~いくつまで入力可能かの設定 if (puzzle.editmode) { subtype =-1;} - else if(puzzle.pid==="easyasabc" && this.cursor.targetdir>=2){ subtype=0; qs = 0;} + else if(this.cursor.targetdir>=2){ subtype=0; qs = 0;} else if(cell.numberWithMB) { subtype = 2; qs = cell.qsub;} else if(puzzle.pid==="roma" || puzzle.pid==="yinyang"){ subtype=0;} // 全マス埋めるタイプのパズルは補助記号なし else if(cell.numberAsObject || puzzle.pid==="hebi"){ subtype = 1;}
Mouse: Enable to input sub numbers on aux. marks by mouse for the genre View
sabo2_pzprjs
train
js
e682c365050f5d94284ec959795b82bb37ae03c4
diff --git a/src/devtools/env.js b/src/devtools/env.js index <HASH>..<HASH> 100644 --- a/src/devtools/env.js +++ b/src/devtools/env.js @@ -12,6 +12,8 @@ export const keys = { } export function initEnv (Vue) { + if (Vue.prototype.hasOwnProperty('$isChrome')) return + Object.defineProperties(Vue.prototype, { '$isChrome': { get: () => isChrome }, '$isWindows': { get: () => isWindows },
Fix initEnv, so it doesn't crash on page refresh (#<I>)
vuejs_vue-devtools
train
js
73f0ad70e12fc5b28a77d3591e410edf0370e57c
diff --git a/Samurai/Raikiri/Container.php b/Samurai/Raikiri/Container.php index <HASH>..<HASH> 100644 --- a/Samurai/Raikiri/Container.php +++ b/Samurai/Raikiri/Container.php @@ -130,7 +130,7 @@ class Container if ($component instanceof ComponentDefine) { $component->setContainer($this); } - elseif ($component instanceof Object) { + elseif (method_exists($component, 'raikiri')) { $component->setContainer($this); }
set container auto has raikiri.
samurai-fw_samurai
train
php
d14fb56119d203f18638609b07e06df1b21e2da3
diff --git a/agents/tools/wrappers.py b/agents/tools/wrappers.py index <HASH>..<HASH> 100644 --- a/agents/tools/wrappers.py +++ b/agents/tools/wrappers.py @@ -118,7 +118,7 @@ class FrameHistory(object): self._past_indices = past_indices self._step = 0 self._buffer = None - self._capacity = max(past_indices) + self._capacity = max(past_indices) + 1 self._flatten = flatten def __getattr__(self, name):
Fix off-by-one bug in FrameHistory environment wrapper (#<I>)
google-research_batch-ppo
train
py
68a12a6e588e4ac5c4016a8bb6efd3d4f52870d8
diff --git a/tasks/task.go b/tasks/task.go index <HASH>..<HASH> 100644 --- a/tasks/task.go +++ b/tasks/task.go @@ -3,6 +3,7 @@ package tasks import ( "encoding/json" "fmt" + "math" "strconv" "strings" @@ -93,7 +94,9 @@ var _ = TasksDescribe("v3 tasks", func() { It("can successfully create and run a task", func() { By("creating the task") taskName := "mreow" - command := "ls" + // sleep for enough time to see the task is RUNNING + sleepTime := math.Min(float64(2), float64(Config.DefaultTimeoutDuration().Seconds())) + command := fmt.Sprintf("sleep %f", sleepTime) lastUsageEventGuid := app_helpers.LastAppUsageEventGuid(TestSetup) createCommand := cf.Cf("run-task", appName, command, "--name", taskName).Wait(Config.DefaultTimeoutDuration()) Expect(createCommand).To(Exit(0))
Sleep for enough time to see the task is RUNNING [#<I>]
cloudfoundry_cf-acceptance-tests
train
go
69103a2ca1f8b586c0db2fcbb20f3ad9d1e39eb5
diff --git a/websockets/server.py b/websockets/server.py index <HASH>..<HASH> 100644 --- a/websockets/server.py +++ b/websockets/server.py @@ -25,8 +25,7 @@ class WebSocketServerProtocol(WebSocketCommonProtocol): :class:`~websockets.protocol.WebSocketCommonProtocol`. For the sake of simplicity, this protocol doesn't inherit a proper HTTP - implementation, and it doesn't send appropriate HTTP responses when - something goes wrong. + implementation. Its support for HTTP responses is very limited. """ state = 'CONNECTING' @@ -46,6 +45,12 @@ class WebSocketServerProtocol(WebSocketCommonProtocol): uri = yield from self.handshake(origins=self.origins) except Exception as exc: logger.info("Exception in opening handshake: {}".format(exc)) + if isinstance(exc, InvalidHandshake): + response = 'HTTP/1.1 400 Bad Request\r\n\r\n' + str(exc) + else: + response = ('HTTP/1.1 500 Internal Server Error\r\n\r\n' + 'See server log for more information.') + self.writer.write(response.encode()) self.writer.write_eof() self.writer.close() return @@ -80,6 +85,7 @@ class WebSocketServerProtocol(WebSocketCommonProtocol): uri, headers = yield from read_request(self.reader) except Exception as exc: raise InvalidHandshake("Malformed HTTP message") from exc + get_header = lambda k: headers.get(k, '') key = check_request(get_header)
Add HTTP responses on handshake errors.
aaugustin_websockets
train
py
10e3913d24d634512ab49f256dc9c010e438db80
diff --git a/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java b/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java index <HASH>..<HASH> 100644 --- a/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java +++ b/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java @@ -203,14 +203,14 @@ class SSLDefinitions { static final SimpleAttributeDefinition MAXIMUM_SESSION_CACHE_SIZE = new SimpleAttributeDefinitionBuilder(ElytronDescriptionConstants.MAXIMUM_SESSION_CACHE_SIZE, ModelType.INT, true) .setAllowExpression(true) - .setDefaultValue(new ModelNode(0)) + .setDefaultValue(new ModelNode(-1)) .setValidator(new IntRangeValidator(-1)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); static final SimpleAttributeDefinition SESSION_TIMEOUT = new SimpleAttributeDefinitionBuilder(ElytronDescriptionConstants.SESSION_TIMEOUT, ModelType.INT, true) .setAllowExpression(true) - .setDefaultValue(new ModelNode(0)) + .setDefaultValue(new ModelNode(-1)) .setValidator(new IntRangeValidator(-1)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build();
[WFCORE-<I>](reopen) Explain the meaning of and set default values of maximum-session-cache-size and session-timeout
wildfly_wildfly-core
train
java
8867b7c6f661c1c16a892baccf46c36bc4f5a01c
diff --git a/modules/Cockpit/Controller/Assets.php b/modules/Cockpit/Controller/Assets.php index <HASH>..<HASH> 100644 --- a/modules/Cockpit/Controller/Assets.php +++ b/modules/Cockpit/Controller/Assets.php @@ -32,10 +32,12 @@ class Assets extends \Cockpit\AuthController { $ret = $this->module('cockpit')->listAssets($options); // virtual folders - $ret['folders'] = $this->app->storage->find('cockpit/assets_folders', [ + $options = [ 'filter' => ['_p' => $this->param('folder', '')], 'sort' => ['name' => 1] - ])->toArray(); + ]; + $this->app->trigger('cockpit.folders.find.before', [&$options]); + $ret['folders'] = $this->app->storage->find('cockpit/assets_folders', $options)->toArray(); return $ret; } @@ -77,9 +79,12 @@ class Assets extends \Cockpit\AuthController { if (!$name) return; + $user = $this->module('cockpit')->getUser(); + $folder = [ 'name' => $name, - '_p' => $parent + '_p' => $parent, + '_by' => $user['_id'], ]; $this->app->storage->save('cockpit/assets_folders', $folder);
add _by attribute and also provide ability to change the options when performing find operations in assets_folders storage
agentejo_cockpit
train
php
ba86716ddcdbdf64212a633139fe37ffcdb00e6c
diff --git a/werkzeug/datastructures.py b/werkzeug/datastructures.py index <HASH>..<HASH> 100644 --- a/werkzeug/datastructures.py +++ b/werkzeug/datastructures.py @@ -9,6 +9,7 @@ :license: BSD, see LICENSE for more details. """ import re +import sys import codecs import mimetypes from itertools import repeat @@ -2461,7 +2462,8 @@ class FileStorage(object): # This might not be if the name attribute is bytes due to the # file being opened from the bytes API. if not PY2 and isinstance(filename, bytes): - filename = filename.decode('utf-8', 'replace') + filename = filename.decode(sys.getfilesystemencoding(), + 'replace') self.filename = filename if headers is None:
utf-8 to filesystem encoding
pallets_werkzeug
train
py
9f722912acd30b47c095596b96333854fe049a6a
diff --git a/src/components/VueSignaturePad.js b/src/components/VueSignaturePad.js index <HASH>..<HASH> 100644 --- a/src/components/VueSignaturePad.js +++ b/src/components/VueSignaturePad.js @@ -50,14 +50,15 @@ export default { window.addEventListener( 'resize', - this.resizeCanvas.bind(this, canvas), + this.resizeCanvas.bind(this), false ); - this.resizeCanvas(canvas); + this.resizeCanvas(); }, methods: { resizeCanvas(canvas) { + const canvas = this.$refs.signaturePadCanvas; const data = this.signaturePad.toData(); const ratio = Math.max(window.devicePixelRatio || 1, 1); canvas.width = canvas.offsetWidth * ratio;
Simplify method resizeCanvas (#<I>) * Simplify method resizeCanvas Remove required param of `canvas` for `resizeCanvas()` as it can be found using `$refs` * Revert formating by codesandbox
neighborhood999_vue-signature-pad
train
js
eaf1db955b2ddd7be042a444109dc57075fb22f6
diff --git a/src/FormObject/Support/Laravel/LaravelForm.php b/src/FormObject/Support/Laravel/LaravelForm.php index <HASH>..<HASH> 100644 --- a/src/FormObject/Support/Laravel/LaravelForm.php +++ b/src/FormObject/Support/Laravel/LaravelForm.php @@ -1,8 +1,10 @@ <?php namespace FormObject\Support\Laravel; +use DomainException; use FormObject\Form; use FormObject\Field\HiddenField; use \App; +use Illuminate\Validation\Validator; class LaravelForm extends Form{ @@ -23,4 +25,22 @@ class LaravelForm extends Form{ protected function createValidatorAdapter($validator){ return new ValidatorAdapter($this, $validator); } + + public function setValidator($validator){ + + if(!$validator instanceof Validator){ + throw new DomainException('LaravelForm Validators have to be Illuminate\Validation\Validator'); + } + $validator->setAttributeNames($this->buildAttributeNames()); + + parent::setValidator($validator); + } + + protected function buildAttributeNames(){ + $attributeNames = array(); + foreach($this->getDataFields() as $field){ + $attributeNames[$field->getName()] = $field->getTitle(); + } + return $attributeNames; + } }
* Added Titles as custom attributes for better errormessages
mtils_formobject
train
php
433010c4f312a78ae7e8268cb821af6ec5be9c9d
diff --git a/test/test_helper.rb b/test/test_helper.rb index <HASH>..<HASH> 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,6 +8,10 @@ require 'ruboto/sdk_versions' require 'ruboto/sdk_locations' require 'ruboto/util/update' +# FIXME(uwe): Remove when we stop supporting onler Ruby versions +MiniTest = Minitest if RUBY_VERSION =~ /^(1\.9|2\.0|2\.1)\./ +# EMXIF + module RubotoTest include Ruboto::SdkVersions include Ruboto::SdkLocations
* Allow testing with Ruby <<I>
ruboto_ruboto
train
rb
391a3765c6f16cec3902413c8b33e1eb26c4c5a4
diff --git a/salt/modules/pw_group.py b/salt/modules/pw_group.py index <HASH>..<HASH> 100644 --- a/salt/modules/pw_group.py +++ b/salt/modules/pw_group.py @@ -36,7 +36,7 @@ def add(name, gid=None, **kwargs): if salt.utils.is_true(kwargs.pop('system', False)): log.warning('pw_group module does not support the \'system\' argument') if kwargs: - raise TypeError('Invalid keyword argument(s): {}'.format(kwargs)) + log.warning('Invalid kwargs passed to group.add') cmd = 'pw groupadd ' if gid:
Again, don't stack trace States!!!
saltstack_salt
train
py
8e9228a92b49b0ecd0074db92457ff0da247a6e5
diff --git a/lib/rummager/images.rb b/lib/rummager/images.rb index <HASH>..<HASH> 100644 --- a/lib/rummager/images.rb +++ b/lib/rummager/images.rb @@ -113,7 +113,8 @@ class Rummager::ImageBuildTask < Rummager::ImageTaskBase end end newimage.tag( 'repo' => @repo, - 'tag' => 'latest' ) + 'tag' => 'latest', + 'force' => true ) puts "Image '#{@repo}': build complete" puts "#{@build_args} -> #{newimage.json}" if Rake.verbose == true }
fix docker complaints about re-tagging an image
exactassembly_rummager
train
rb
7cf94f76cf7ed960a224fe9c7b70733d2858a6a0
diff --git a/server.js b/server.js index <HASH>..<HASH> 100644 --- a/server.js +++ b/server.js @@ -22,6 +22,10 @@ var UNASSIGNED = "nobody"; var CURRENT_USER = "me"; var io = sio.listen(server); +io.configure(function () { + // excluded websocket due to Chrome bug: https://github.com/LearnBoost/socket.io/issues/425 + io.set('transports', ['htmlfile', 'xhr-polling', 'jsonp-polling']); +}); io.sockets.on('connection', function(socket) { applyIssueDefaults();
Remove websocket as available transport; should improve Chrome stability.
wachunga_omega
train
js
649b6f73200b794f3957dfd2bc465a06425a2010
diff --git a/twitteroauth/twitteroauth.php b/twitteroauth/twitteroauth.php index <HASH>..<HASH> 100644 --- a/twitteroauth/twitteroauth.php +++ b/twitteroauth/twitteroauth.php @@ -72,11 +72,9 @@ class TwitterOAuth { * * @returns a key/value array containing oauth_token and oauth_token_secret */ - function getRequestToken($oauth_callback = NULL) { + function getRequestToken($oauth_callback) { $parameters = array(); - if (!empty($oauth_callback)) { - $parameters['oauth_callback'] = $oauth_callback; - } + $parameters['oauth_callback'] = $oauth_callback; $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters); $token = OAuthUtil::parse_parameters($request); $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
oauth_callback is now required for getRequestToken
abraham_twitteroauth
train
php