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
01d573825f98349bf67fa1e64b06c6b383672c8d
diff --git a/spec/cycle_spec.rb b/spec/cycle_spec.rb index <HASH>..<HASH> 100644 --- a/spec/cycle_spec.rb +++ b/spec/cycle_spec.rb @@ -5,6 +5,8 @@ require 'tmpdir' class Chicken < ActiveRecord::Base end +ActiveRecord::Base.logger = Logger.new(File.join(DumpRake::RailsRoot, 'log/dump.log')) + def database_configs YAML.load(IO.read(File.expand_path('../db/database.yml', __FILE__))) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,7 +3,6 @@ ENV['RAILS_ENV'] ||= 'test' require 'dummy_rails_app' require 'dump_rake' -ActiveRecord::Base.logger = Logger.new(File.join(DumpRake::RailsRoot, 'log/dump.log')) def grab_output real_stdout, $stdout = $stdout, StringIO.new
move setting logger to cycle_spec
toy_dump
train
rb,rb
4d8e0fa166dc47325bf4693865075669b4e09fcd
diff --git a/profile/legacy_profile.go b/profile/legacy_profile.go index <HASH>..<HASH> 100644 --- a/profile/legacy_profile.go +++ b/profile/legacy_profile.go @@ -373,6 +373,15 @@ func cpuProfile(b []byte, period int64, parse func(b []byte) (uint64, []byte)) ( } } + if err := p.ParseMemoryMap(bytes.NewBuffer(b)); err != nil { + return nil, err + } + + cleanupDuplicateLocations(p) + return p, nil +} + +func cleanupDuplicateLocations(p *Profile) { // The profile handler may duplicate the leaf frame, because it gets // its address both from stack unwinding and from the signal // context. Detect this and delete the duplicate, which has been @@ -383,11 +392,6 @@ func cpuProfile(b []byte, period int64, parse func(b []byte) (uint64, []byte)) ( s.Location = append(s.Location[:1], s.Location[2:]...) } } - - if err := p.ParseMemoryMap(bytes.NewBuffer(b)); err != nil { - return nil, err - } - return p, nil } // parseCPUSamples parses a collection of profilez samples from a @@ -936,6 +940,7 @@ func parseThread(b []byte) (*Profile, error) { return nil, err } + cleanupDuplicateLocations(p) return p, nil }
Apply leaf cleanup to threadz samples The legacy profilez parser handles duplicate leaf samples that are a common artifact of satck unwinding. Apply the same technique to threadz profiles where duplicate samples also occur.
google_pprof
train
go
c074516053bd9a0a357fc71db72844ab8b987feb
diff --git a/indra/tests/test_statements.py b/indra/tests/test_statements.py index <HASH>..<HASH> 100644 --- a/indra/tests/test_statements.py +++ b/indra/tests/test_statements.py @@ -1337,6 +1337,7 @@ def test_serialize(): st2 = stmts_from_json([jstr])[0] assert(st.equals(st2)) assert unicode_strs((ev1, st, st2)) + assert st.evidence[0].source_hash == st2.evidence[0].source_hash def test_location_refinement():
Check hash is persistend through to_json-from_json.
sorgerlab_indra
train
py
09637a30fa00f86fe81a3191069304effb44cbd5
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -96,15 +96,23 @@ describe('node-serialize', function () { '', 'http://www.w3.org/1999/xhtml' ); - - // Some older browsers require the DOCTYPE to be within a Document, - // otherwise the "serialize" custom event is considered "cancelled". - // See: https://travis-ci.org/webmodules/dom-serialize/builds/47307749 - var doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'root-element', node); + document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'root-element', node); assert.equal('<!DOCTYPE root-element SYSTEM "http://www.w3.org/1999/xhtml">', serialize(node)); }); + + it('should serialize an HTML5 Doctype node', function () { + node = document.implementation.createDocumentType( + 'html', + '', + '' + ); + document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'node', node); + + assert.equal('<!DOCTYPE html>', serialize(node)); + }); + it('should serialize a DocumentFragment node', function () { node = document.createDocumentFragment(); node.appendChild(document.createElement('b'));
test: add HTML5 Doctype test, for <I>% test code coverage!
webmodules_dom-serialize
train
js
cfcc96c896408a433fee088d4034bc6a6b566968
diff --git a/examples/conversations.php b/examples/conversations.php index <HASH>..<HASH> 100644 --- a/examples/conversations.php +++ b/examples/conversations.php @@ -32,7 +32,7 @@ $filters = (new ConversationFilters()) ->withSortField('createdAt') ->withSortOrder('asc') // See https://developer.helpscout.com/mailbox-api/endpoints/conversations/list/#query for details on what you can do with query - ->withQuery('(email:"[email protected]")') + ->withQuery('email:"[email protected]"') ->withCustomFieldById(123, 'blue'); $conversations = $client->conversations()->list($filters); diff --git a/examples/customers.php b/examples/customers.php index <HASH>..<HASH> 100644 --- a/examples/customers.php +++ b/examples/customers.php @@ -35,7 +35,7 @@ $filters = (new CustomerFilters()) ->withMailbox('12') ->withModifiedSince(new DateTime('last month')) // See https://developer.helpscout.com/mailbox-api/endpoints/customers/list/#query for details on what you can do with query - ->withQuery('(email:"[email protected]")') + ->withQuery('email:"[email protected]"') ->withSortField('createdAt') ->withSortOrder('asc');
Removing parenthesis from the example since it's not required
helpscout_helpscout-api-php
train
php,php
d848629349643bb04194efa0af2aeecdf8b16fe0
diff --git a/packages/ember-metal/lib/platform.js b/packages/ember-metal/lib/platform.js index <HASH>..<HASH> 100644 --- a/packages/ember-metal/lib/platform.js +++ b/packages/ember-metal/lib/platform.js @@ -38,7 +38,6 @@ if (!Ember.create) { Ember.create.isSimulated = true; } -Object.defineProperty = null; /** @private */ var defineProperty = Object.defineProperty; var canRedefineProperties, canDefinePropertyOnDOM;
Let ES5 browsers actually work
emberjs_ember.js
train
js
e7afdda0356ee32ba600e3408586365147ac5457
diff --git a/src/Sql/Relator/OneMany.php b/src/Sql/Relator/OneMany.php index <HASH>..<HASH> 100644 --- a/src/Sql/Relator/OneMany.php +++ b/src/Sql/Relator/OneMany.php @@ -39,6 +39,8 @@ class OneMany extends Base ); if ($relation[0] == 'one' && $result) { $result = current($result); + } else { + $result = null; } return $result; }
result should not return empty array from OneMany getRelated
shabbyrobe_amiss
train
php
64ffa2a2432216e8685f483733a3b6c3be9835a6
diff --git a/filter/tex/latex.php b/filter/tex/latex.php index <HASH>..<HASH> 100644 --- a/filter/tex/latex.php +++ b/filter/tex/latex.php @@ -44,14 +44,19 @@ } else { $this->supported_platform = false; - return false; } $this->path_latex = "{$binpath}latex"; $this->path_dvips = "{$binpath}dvips"; $this->path_convert = "{$binpath}convert"; $this->path_identify = "{$binpath}identify"; + } - return true; + /** + * Accessor function for support_platform field. + * @return boolean value of supported_platform + */ + function supported() { + return $this->supported_platform; } /** @@ -101,6 +106,11 @@ * @return bool true if successful */ function render( $formula, $filename, $fontsize=12, $density=240, $background='', $log=null ) { + // quick check - will this work? + if (!$this->supported_platform) { + return false; + } + $doc = $this->construct_latex_document( $formula, $fontsize ); // construct some file paths
Added check so render returns with false if unsupported platform.
moodle_moodle
train
php
dbb680bf11300eceeb364168b667c78c335ecc0e
diff --git a/base/src/org/droidparts/manager/AbstractPrefsManager.java b/base/src/org/droidparts/manager/AbstractPrefsManager.java index <HASH>..<HASH> 100644 --- a/base/src/org/droidparts/manager/AbstractPrefsManager.java +++ b/base/src/org/droidparts/manager/AbstractPrefsManager.java @@ -67,8 +67,14 @@ public abstract class AbstractPrefsManager { // shortcuts - protected String resToKey(int resId) { - return ctx.getString(resId); + protected boolean getBoolean(int keyResId, int defValueResId) { + return prefs.getBoolean(ctx.getString(keyResId), + Boolean.valueOf(ctx.getString(defValueResId))); + } + + protected String getString(int keyResId, int defValueResId) { + return prefs.getString(ctx.getString(keyResId), + ctx.getString(defValueResId)); } protected boolean saveBoolean(String key, boolean val) {
PrefsManager helper methods.
droidparts_droidparts
train
java
4d683eee9594df60cd9aae92bff337057f3b76b8
diff --git a/productmd/composeinfo.py b/productmd/composeinfo.py index <HASH>..<HASH> 100644 --- a/productmd/composeinfo.py +++ b/productmd/composeinfo.py @@ -580,12 +580,8 @@ class VariantBase(productmd.common.MetadataBase): if variant.parent is None and '-' in variant_id and variant.type != "optional": variant_id = variant_id.replace("-", "") - if variant.type == "optional": - if variant.uid != variant_id: - raise ValueError("Variant UID doesn't match: '%s' vs '%s'" % (variant.uid, variant_id)) - else: - if variant.id != variant_id: - raise ValueError("Variant ID doesn't match: '%s' vs '%s'" % (variant.id, variant_id)) + if variant.id != variant_id and variant.uid != variant_id: + raise ValueError("Variant ID doesn't match: '%s' vs '%s'" % (variant.id, variant_id)) def add(self, variant, variant_id=None): if hasattr(self, "uid"):
Fix VariantBase._validate_variants() Refer to the implementation of Variants.add(), variant_id could be any value. This patch could cover the case we met currently, but the validation will fail if people pass other variant_id value to Variants.add() JIRA: RHELCMP-<I>
release-engineering_productmd
train
py
f30ca2d5d68dd00625714c440c7940dee5b27140
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ """The setup script.""" import sys + from setuptools import setup, find_packages with open('README.rst') as readme_file:
space btw stdlib and related third-party libs re: pep8 guidance.
remix_partridge
train
py
6247fa5b8f296b6bd67bb5263387562c20c92e27
diff --git a/fabfile.py b/fabfile.py index <HASH>..<HASH> 100644 --- a/fabfile.py +++ b/fabfile.py @@ -36,8 +36,8 @@ def send(): def start(): with cd(env.tsuru_path): run("tar -xzf dist.tar.gz") - run("nohup %s/dist/collector >& /dev/null < /dev/null &" % env.tsuru_path, pty=False) - run("nohup %s/dist/webserver >& /dev/null < /dev/null &" % env.tsuru_path, pty=False) + run("nohup %s/dist/collector 2>&1 > /tmp/collector.hup.out < /dev/null &" % env.tsuru_path, pty=False) + run("nohup %s/dist/webserver 2>&1 > /tmp/webserver.hup.out < /dev/null &" % env.tsuru_path, pty=False) def deploy():
fabfile: redirecting output from collector and webserver to files
tsuru_tsuru
train
py
d89e81cd66e0b3df02f198bf405bc7b4a9af1ffd
diff --git a/lib/Core/Values/BlockCreateStruct.php b/lib/Core/Values/BlockCreateStruct.php index <HASH>..<HASH> 100644 --- a/lib/Core/Values/BlockCreateStruct.php +++ b/lib/Core/Values/BlockCreateStruct.php @@ -29,10 +29,6 @@ class BlockCreateStruct extends APIBlockCreateStruct */ public function setParameter($parameterName, $parameterValue) { - if ($this->parameters === null) { - $this->parameters = array(); - } - $this->parameters[$parameterName] = $parameterValue; } diff --git a/lib/Core/Values/BlockUpdateStruct.php b/lib/Core/Values/BlockUpdateStruct.php index <HASH>..<HASH> 100644 --- a/lib/Core/Values/BlockUpdateStruct.php +++ b/lib/Core/Values/BlockUpdateStruct.php @@ -29,10 +29,6 @@ class BlockUpdateStruct extends APIBlockUpdateStruct */ public function setParameter($parameterName, $parameterValue) { - if ($this->parameters === null) { - $this->parameters = array(); - } - $this->parameters[$parameterName] = $parameterValue; }
Remove uneeded check from block structs
netgen-layouts_layouts-core
train
php,php
d322ddb49c5de05925124bb062141f4f9e7c29d7
diff --git a/lib/log.js b/lib/log.js index <HASH>..<HASH> 100644 --- a/lib/log.js +++ b/lib/log.js @@ -13,7 +13,7 @@ log.addLevel('debug', 999, {fg: 'grey'}, 'debu'); // monkey patch npmlog… log.heading = ''; log.headingStyle.fg = 'blue'; -log.disp.verbose = 'verbose'; +log.disp.verbose = 'verb'; log.disp.error = 'err!'; log.disp.warn = 'warn'; log.style.error.bold = true;
normalize verbose level output to 4 char
YahooArchive_mojito-cli-doc
train
js
c70e8c11ec812f1a8a5fbb06c69419d47bd24a2a
diff --git a/src/javascripts/ng-admin/Main/component/service/config/Field.js b/src/javascripts/ng-admin/Main/component/service/config/Field.js index <HASH>..<HASH> 100644 --- a/src/javascripts/ng-admin/Main/component/service/config/Field.js +++ b/src/javascripts/ng-admin/Main/component/service/config/Field.js @@ -45,22 +45,6 @@ define(function (require) { Configurable(Field.prototype, config); /** - * Set or get the type - * - * @param {String} type - * @returns string|Field - */ - Field.prototype.type = function (type) { - if (arguments.length === 0) { - return this.config.type; - } - - this.config.type = type; - - return this; - }; - - /** * Add a map function * * @param {Function} fn
Remove needless method (added by Configurable)
marmelab_ng-admin
train
js
593a192f0c6dd79dd29845c4efe27d33e6843343
diff --git a/nanomath/version.py b/nanomath/version.py index <HASH>..<HASH> 100644 --- a/nanomath/version.py +++ b/nanomath/version.py @@ -1 +1 @@ -__version__ = "0.22.0" +__version__ = "0.23.0"
bumping version after pull request speeding up ave_qual
wdecoster_nanomath
train
py
046b8f2fa56c83daedbfbfd29a21878160f9b884
diff --git a/pyemma/msm/models/msm.py b/pyemma/msm/models/msm.py index <HASH>..<HASH> 100644 --- a/pyemma/msm/models/msm.py +++ b/pyemma/msm/models/msm.py @@ -139,11 +139,9 @@ class MSM(_Model): """ # we set reversible first, so it can be derived from P, if None was given. self.update_model_params(reversible=reversible) - if P is not None: - self.P = P - self.pi = pi - self.dt_model = dt_model - self.neig = neig + self.update_model_params(P=P) + # pi might be derived from P, if None was given. + self.update_model_params(pi=pi, dt_model=dt_model, neig=neig) ################################################################################ # Basic attributes @@ -181,7 +179,6 @@ class MSM(_Model): @reversible.setter def reversible(self, value): - # allow to set it to None, so it can be derived from P in set_model_params self._reversible = value @property
[msm] use multiple calls to update_model_params to preserve order. This restores the old behaviour: if a param is set to None it can be overriden, but not set twice. Setting a parameter twice causes problems with other Estimators like ChapmanKolmogorov, which invokes set_model_params again with None.
markovmodel_PyEMMA
train
py
c1d915df5bfab86bd27784f99eaca9a2e2b1e526
diff --git a/test/e2e_node/runner/run_e2e.go b/test/e2e_node/runner/run_e2e.go index <HASH>..<HASH> 100644 --- a/test/e2e_node/runner/run_e2e.go +++ b/test/e2e_node/runner/run_e2e.go @@ -104,7 +104,7 @@ func main() { noColour = "\033[0m" } - go arc.getArchive() + arc.getArchive() defer arc.deleteArchive() var err error
Wait for arc.getArchive() to complete before running tests
kubernetes_kubernetes
train
go
3850b05388a01ac369d78be58a9db04ebb93408c
diff --git a/server/client.go b/server/client.go index <HASH>..<HASH> 100644 --- a/server/client.go +++ b/server/client.go @@ -310,23 +310,28 @@ func (c *client) processConnect(arg []byte) error { c.mu.Lock() c.clearAuthTimer() c.last = time.Now() + typ := c.typ + r := c.route + srv := c.srv c.mu.Unlock() if err := json.Unmarshal(arg, &c.opts); err != nil { return err } - if c.srv != nil { + if srv != nil { // Check for Auth - if ok := c.srv.checkAuth(c); !ok { + if ok := srv.checkAuth(c); !ok { c.authViolation() return ErrAuthorization } } // Grab connection name of remote route. - if c.typ == ROUTER && c.route != nil { + if typ == ROUTER && r != nil { + c.mu.Lock() c.route.remoteID = c.opts.Name + c.mu.Unlock() } if c.opts.Verbose {
Fix data race When processing a connect request, there was a risk of race condition when the server was being shutdown. Capture fields that are checked under lock and lock when setting the route's remote ID. Resolves #<I>
nats-io_gnatsd
train
go
75cb03535f7b48eea7a8bbddf773f55962e09de3
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,7 @@ require "rdkafka" def rdkafka_config config = { :"bootstrap.servers" => "localhost:9092", - :"group.id" => "ruby-test-#{Random.new.rand(0..10_000)}", + :"group.id" => "ruby-test-#{Random.new.rand(0..1_000_000)}", :"auto.offset.reset" => "earliest", :"enable.partition.eof" => false } @@ -23,7 +23,6 @@ def native_client end def wait_for_message(topic:, delivery_report:, timeout_in_seconds: 30) - offset = delivery_report.offset - 1 consumer = rdkafka_config.consumer consumer.subscribe(topic) timeout = Time.now.to_i + timeout_in_seconds @@ -32,7 +31,9 @@ def wait_for_message(topic:, delivery_report:, timeout_in_seconds: 30) raise "Timeout of #{timeout_in_seconds} seconds reached in wait_for_message" end message = consumer.poll(100) - if message && message.offset == offset + if message && + message.partition == delivery_report.partition && + message.offset == delivery_report.offset - 1 return message end end
Take partition into account in wait_for_message spec helper
appsignal_rdkafka-ruby
train
rb
d606bcb7fd0afc69e35eea301573a0d530e7b211
diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -388,7 +388,7 @@ class FileEngine extends CacheEngine { return false; } - $key = Inflector::underscore(str_replace(array(DS, '/', '.','<','>','?',':','|','*','"'), '_', strval($key))); + $key = Inflector::underscore(str_replace(array(DS, '/', '.', '<', '>', '?', ':', '|', '*', '"'), '_', strval($key))); return $key; }
convert forbidden character in filename(Windows) with underline
cakephp_cakephp
train
php
f65a4568f23a276622833ddcda6a6e6b153f7d68
diff --git a/klue/swagger/client.py b/klue/swagger/client.py index <HASH>..<HASH> 100644 --- a/klue/swagger/client.py +++ b/klue/swagger/client.py @@ -218,7 +218,8 @@ class ClientCaller(): raise e # max_attempts has been reached: propagate the last received Exception - log.info("Reached max-attempts. Giving up calling %s %s" % (self.method, self.url)) + if not last_exception: + last_exception = Exception("Reached max-attempts (%s). Giving up calling %s %s" % (self.max_attempts, self.method, self.url) raise last_exception def call(self, force_retry=False):
Fix bug of undefined exception when retrying 3 times with no error
pymacaron_pymacaron-core
train
py
b20185aa7f6780c6f5736d91bc8ee724805d80aa
diff --git a/decoda.php b/decoda.php index <HASH>..<HASH> 100644 --- a/decoda.php +++ b/decoda.php @@ -351,25 +351,25 @@ class Decoda { } } } + } + + // Make urls/emails clickable + if ($this->__config['clickable']) { + $string = $this->__clickable($string); + } - // Make urls/emails clickable - if ($this->__config['clickable']) { - $string = $this->__clickable($string); - } - - // Convert smilies - if ($this->__config['emoticons']) { - $string = $this->__emoticons($string); - } + // Convert smilies + if ($this->__config['emoticons']) { + $string = $this->__emoticons($string); + } - // Censor words - if ($this->__config['censor']) { - $string = $this->__censor($string); - } + // Censor words + if ($this->__config['censor']) { + $string = $this->__censor($string); + } - // Clean linebreaks - $string = $this->__cleanup($string); - } + // Clean linebreaks + $string = $this->__cleanup($string); if ($return === false) { echo $string;
Trigger utility functions even if parse is false.
milesj_decoda
train
php
ee254021b67eda4bba1a8e3a2216e289bde64ba0
diff --git a/src/Charcoal/Core/IndexableTrait.php b/src/Charcoal/Core/IndexableTrait.php index <HASH>..<HASH> 100644 --- a/src/Charcoal/Core/IndexableTrait.php +++ b/src/Charcoal/Core/IndexableTrait.php @@ -10,11 +10,21 @@ trait IndexableTrait /** * @var mixed $_id The object (unique) identifier */ - public $_id; + protected $_id; /** * @var string $_key The object key */ - public $_key; + protected $_key; + + protected function set_indexable_data($data) + { + if (isset($data['id']) && $data['id'] !== null) { + $this->set_id($data['id']); + } + if (isset($data['key']) && $data['key'] !== null) { + $this->set_key($data['key']); + } + } /** * Set the object's ID. The actual property set depends on `key()`
set_indexable_data, to be called from classes (set_data) that uses the Indexable trait
locomotivemtl_charcoal-core
train
php
ff2e56ffc3a292c79a2c249559d4decf69416397
diff --git a/ph-oton-uicore/src/main/java/com/helger/photon/uicore/icon/DefaultIcons.java b/ph-oton-uicore/src/main/java/com/helger/photon/uicore/icon/DefaultIcons.java index <HASH>..<HASH> 100644 --- a/ph-oton-uicore/src/main/java/com/helger/photon/uicore/icon/DefaultIcons.java +++ b/ph-oton-uicore/src/main/java/com/helger/photon/uicore/icon/DefaultIcons.java @@ -33,7 +33,7 @@ import com.helger.commons.collection.ext.ICommonsMap; @NotThreadSafe public final class DefaultIcons { - private static final ICommonsMap <EDefaultIcon, IIcon> s_aMap = new CommonsHashMap <> (); + private static final ICommonsMap <EDefaultIcon, IIcon> s_aMap = new CommonsHashMap<> (); private DefaultIcons () {} @@ -44,7 +44,7 @@ public final class DefaultIcons */ public static boolean areDefined () { - return !s_aMap.isEmpty (); + return s_aMap.isNotEmpty (); } /** @@ -62,6 +62,10 @@ public final class DefaultIcons return s_aMap.get (eDefaultIcon); } + /** + * @return A copy of all currently defined default icons. Never + * <code>null</code> but maybe empty. + */ @Nonnull @ReturnsMutableCopy public static ICommonsMap <EDefaultIcon, IIcon> getAll ()
Added JavaDocs :)
phax_ph-oton
train
java
ecb6dfdece9a02a114df200b6bce549b302ec4b7
diff --git a/campaigns.go b/campaigns.go index <HASH>..<HASH> 100644 --- a/campaigns.go +++ b/campaigns.go @@ -1,15 +1,15 @@ package mailgun type Campaign struct { - Id string - Name string - CreatedAt string - DeliveredCount int - ClickedCount int - OpenedCount int - SubmittedCount int - UnsubscribedCount int - BouncedCount int - ComplainedCount int - DroppedCount int + Id string `json:"id"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + DeliveredCount int `json:"delivered_count"` + ClickedCount int `json:"clicked_count"` + OpenedCount int `json:"opened_count"` + SubmittedCount int `json:"submitted_count"` + UnsubscribedCount int `json:"unsubscribed_count"` + BouncedCount int `json:"bounced_count"` + ComplainedCount int `json:"complained_count"` + DroppedCount int `json:"dropped_count"` }
Added JSON-names and did gofmt.
mailgun_mailgun-go
train
go
e89761368bd8722e6cbc72964b10773c6bbc4d0c
diff --git a/src/Entity/Base.php b/src/Entity/Base.php index <HASH>..<HASH> 100644 --- a/src/Entity/Base.php +++ b/src/Entity/Base.php @@ -10,6 +10,7 @@ abstract class Base */ protected $apiRequest = null; protected $playerInformation = null; + protected $parameters = null; public function setApiRequest(WowApiRequest $apiRequest) @@ -18,7 +19,11 @@ abstract class Base } abstract public function getRessource(); - abstract public function getParametters(); + + public function getParametters() + { + return $this->parameters; + } public function loadInformation() { diff --git a/src/Entity/Player.php b/src/Entity/Player.php index <HASH>..<HASH> 100644 --- a/src/Entity/Player.php +++ b/src/Entity/Player.php @@ -16,5 +16,11 @@ class Player extends Base if ($locale !== null) { $this->apiRequest->setLocale($locale); } + $this->loadInformation(); + } + + public function getRessource() + { + return "wow/character/". $this->realmName ."/" . $this->characterName; } }
get ressource method for player + method for get parametters
Game-scan_WoW
train
php,php
6b151c3159d120ab9e8a04e8b5c883bc7129ae52
diff --git a/splunklib/searchcommands/internals.py b/splunklib/searchcommands/internals.py index <HASH>..<HASH> 100644 --- a/splunklib/searchcommands/internals.py +++ b/splunklib/searchcommands/internals.py @@ -580,7 +580,7 @@ class RecordWriter(object): value = str(value.real) elif value_t is six.text_type: value = value - elif value_t is int or value_t is int or value_t is float or value_t is complex: + elif isinstance(value, six.integer_types) or value_t is float or value_t is complex: value = str(value) elif issubclass(value_t, (dict, list, tuple)): value = str(''.join(RecordWriter._iterencode_json(value, 0))) @@ -610,7 +610,7 @@ class RecordWriter(object): values += (value, None) continue - if value_t is int or value_t is int or value_t is float or value_t is complex: + if isinstance(value, six.integer_types) or value_t is float or value_t is complex: values += (str(value), None) continue
Pull request for DVPL-<I> to treat the integer and long variables same in both python versions
splunk_splunk-sdk-python
train
py
0b902838c0f8eae52570d6b1b84411a93c0b02f2
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,9 @@ setup( license='MIT', packages=find_packages(), install_requires=['nose>=1.3', 'six'], + dependency_links=[ + 'https://github.com/nose-devs/nose/tarball/c0f777e488337dc7dde933453799986c46b37deb#egg=nose-1.3.0', + ], entry_points={ 'nose.plugins.0.10': [ 'spec = spec:SpecPlugin',
Hit github for Nose for now, boo
bitprophet_spec
train
py
7396f47a7fdfaf65142fdd736c56b4060806235e
diff --git a/src/File/Path/Basepath/DefaultTrait.php b/src/File/Path/Basepath/DefaultTrait.php index <HASH>..<HASH> 100644 --- a/src/File/Path/Basepath/DefaultTrait.php +++ b/src/File/Path/Basepath/DefaultTrait.php @@ -30,6 +30,7 @@ trait DefaultTrait $replacements = [ '{primaryKey}' => $this->entity->get($this->table->primaryKey()), '{model}' => $this->table->alias(), + '{table}' => $this->table->table(), '{field}' => $this->field, '{time}' => time(), '{microtime}' => microtime(),
Add {table} placeholder for path.
FriendsOfCake_cakephp-upload
train
php
7bd8549df705507b3b8d8a70e160779a33aef28f
diff --git a/src/API/AbstractAPIClient.php b/src/API/AbstractAPIClient.php index <HASH>..<HASH> 100644 --- a/src/API/AbstractAPIClient.php +++ b/src/API/AbstractAPIClient.php @@ -58,9 +58,9 @@ abstract class AbstractAPIClient implements APIInterface $method = $request->getMethod(); // Since Guzzle automatically overwrites a new header when the request - // is POST / PATCH / DELETE, we need to overwrite the Content-Type header + // is POST / PATCH / DELETE / PUT, we need to overwrite the Content-Type header // with setBody() function. - if ($method === 'PATCH' || $method === 'DELETE' || $method === 'POST') { + if ($method !== 'GET') { $apiRequest->setBody(json_encode($request->getBody()), 'application/json'); }
PI-<I> fixed method for Guzzle setBody
cloudflare_cloudflare-plugin-backend
train
php
7342bd9f7523efe29d7fe91ca326938f92e458bb
diff --git a/ui/plugins/annotations/controller.js b/ui/plugins/annotations/controller.js index <HASH>..<HASH> 100644 --- a/ui/plugins/annotations/controller.js +++ b/ui/plugins/annotations/controller.js @@ -21,8 +21,7 @@ treeherder.controller('AnnotationsPluginCtrl', [ }, true); $scope.deleteClassification = function(classification) { - var jcModel = new ThJobClassificationModel(classification); - jcModel.delete() + classification.delete() .then( function(){ thNotify.send("Classification successfully deleted", "success", false); @@ -42,8 +41,7 @@ treeherder.controller('AnnotationsPluginCtrl', [ }; $scope.deleteBug = function(bug) { - var bjmModel = new ThBugJobMapModel(bug); - bjmModel.delete() + bug.delete() .then( function(){ thNotify.send("Association to bug " + bug.bug_id + " successfully deleted", "success", false);
Bug <I> - Don't re-create bugjobmap and classification objects in the annotations plugin controller
mozilla_treeherder
train
js
7274d54058c618a956a60f97c582e2e9bb11a34f
diff --git a/src/Strategies/Settings.php b/src/Strategies/Settings.php index <HASH>..<HASH> 100644 --- a/src/Strategies/Settings.php +++ b/src/Strategies/Settings.php @@ -45,13 +45,13 @@ class Settings implements SettingsStrategyInterface const KEY_SERVER_ORIGIN = 0; /** Settings key */ - const KEY_SERVER_ORIGIN_SCHEMA = 0; + const KEY_SERVER_ORIGIN_SCHEME = 'scheme'; /** Settings key */ - const KEY_SERVER_ORIGIN_HOST = 1; + const KEY_SERVER_ORIGIN_HOST = 'host'; /** Settings key */ - const KEY_SERVER_ORIGIN_PORT = 2; + const KEY_SERVER_ORIGIN_PORT = 'port'; /** Settings key */ const KEY_ALLOWED_ORIGINS = 1; @@ -90,7 +90,7 @@ class Settings implements SettingsStrategyInterface * @see http://php.net/manual/function.parse-url.php */ self::KEY_SERVER_ORIGIN => [ - self::KEY_SERVER_ORIGIN_SCHEMA => '', + self::KEY_SERVER_ORIGIN_SCHEME => '', self::KEY_SERVER_ORIGIN_HOST => ParsedUrlInterface::DEFAULT_PORT, self::KEY_SERVER_ORIGIN_PORT => '', ],
Close #<I> make keys compatible with keys from parse_url
neomerx_cors-psr7
train
php
a7b9a27c585298bb4744f65d69c1f02b6db24cfa
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -57,7 +57,7 @@ class Client { // Shared functions - listBuckets(data) { + listBuckets() { return this.aws.request('S3', 'listBuckets', {}, this.stage, this.region).bind(this); } @@ -107,18 +107,19 @@ class Client { _removeDeployedResources() { this.bucketName = this.serverless.service.custom.client.bucketName; - this.serverless.cli.log(`Preparing to remove bucket ${this.bucketName}`); - - let params = { - Bucket: this.bucketName - }; + var safetyDelay = 3000; + this.serverless.cli.log(`Preparing to empty and remove bucket ${this.bucketName}, waiting for ${safetyDelay/1000} seconds...`); function deleteBucket() { this.serverless.cli.log(`Removing bucket ${this.bucketName}...`); + let params = { + Bucket: this.bucketName + }; return this.aws.request('S3', 'deleteBucket', params, this.stage, this.region); } - return this.listBuckets() + return BbPromise.delay(safetyDelay).bind(this) + .then(this.listBuckets) .then(this.findBucket) .then(this.listObjectsInBucket) .then(this.deleteObjectsFromBucket)
Adds a delay just incase
fernando-mc_serverless-finch
train
js
4b6804eaabe26516069ca16063b9bef45107d9f3
diff --git a/src/Extensions/GroupSubsites.php b/src/Extensions/GroupSubsites.php index <HASH>..<HASH> 100644 --- a/src/Extensions/GroupSubsites.php +++ b/src/Extensions/GroupSubsites.php @@ -47,7 +47,7 @@ class GroupSubsites extends DataExtension implements PermissionProvider } // Migration for Group.SubsiteID data from when Groups only had a single subsite $schema = DataObject::getSchema(); - $groupTable = $schema->tableName(Group::class); + $groupTable = Convert::raw2sql($schema->tableName(Group::class)); $groupFields = DB::field_list($groupTable); // Detection of SubsiteID field is the trigger for old-style-subsiteID migration
[SS-<I>-<I>] Group table name is escaped to prevent possibility of SQL injection
silverstripe_silverstripe-subsites
train
php
41dfb46462bf25f329c56032dbfdfece39eafef6
diff --git a/javascript/node/selenium-webdriver/lib/webdriver.js b/javascript/node/selenium-webdriver/lib/webdriver.js index <HASH>..<HASH> 100644 --- a/javascript/node/selenium-webdriver/lib/webdriver.js +++ b/javascript/node/selenium-webdriver/lib/webdriver.js @@ -1229,6 +1229,19 @@ class WebDriver { if (target && cdpTargets.indexOf(target.toLowerCase()) === -1) { throw new error.InvalidArgumentError('invalid target value') } + + if (debuggerAddress.match(/\/se\/cdp/)) { + if (debuggerAddress.match("ws:\/\/", "http:\/\/")) { + return debuggerAddress.replace("ws:\/\/", "http:\/\/") + } + else if (debuggerAddress.match("wss:\/\/", "https:\/\/")) { + return debuggerAddress.replace("wss:\/\/", "https:\/\/") + } + else { + return debuggerAddress + } + } + const path = '/json/version' let request = new http.Request('GET', path) let client = new http.HttpClient('http://' + debuggerAddress)
[js] Add a check for Grid CDP endpoint
SeleniumHQ_selenium
train
js
2c5bc3070e622e4bd7a33c1e6e186b2b3b1dfbe8
diff --git a/realtime/shake_data.py b/realtime/shake_data.py index <HASH>..<HASH> 100644 --- a/realtime/shake_data.py +++ b/realtime/shake_data.py @@ -336,18 +336,19 @@ class ShakeData: :file:`/tmp/inasafe/realtime/shakemaps-extracted/20131105060809` - After extraction the complete path will appear something like this: + After extraction, under that directory, there will be directory that + appears something like this: - :file:`/tmp/inasafe/realtime/shakemaps-extracted/20131105060809/usr/local/smap/data/20131105060809` + :file:`/usr/local/smap/data/20131105060809` with input and output directories appearing beneath that. This method will then move the grid.xml file up to the root of the extract dir and recursively remove the extracted dirs. - After this final step, the following file will be present: + After this final step, :file:`grid.xml` will be present under: - :file:`/tmp/inasafe/realtime/shakemaps-extracted/20131105060809/grid.xml` + :file:`/tmp/inasafe/realtime/shakemaps-extracted/20131105060809/` If the zips have not already been retrieved from the ftp server, they will be fetched first automatically.
Fix last pylint violation.
inasafe_inasafe
train
py
eec6e1dcf61ccbc91cf70fc94d4050cd52396758
diff --git a/instant/templates/instant/channels/superuser/client.js b/instant/templates/instant/channels/superuser/client.js index <HASH>..<HASH> 100644 --- a/instant/templates/instant/channels/superuser/client.js +++ b/instant/templates/instant/channels/superuser/client.js @@ -10,6 +10,7 @@ var superuser_callbacks_{% get_superuser_channel %} = { var data = res['data'] var channel = res['channel']; var uid = res['UID']; + var site = res["site"]; // handlers if (debug === true) { console.log('Msg: '+message+"\nChan: "+channel+"\nEvent_class: "+event_class+'\nData: '+JSON.stringify(data));
Correction in js superuser channel client
synw_django-instant
train
js
fecd31dd46b4f790f9c0cfe28eff3909fd0945b5
diff --git a/lib/ee.js b/lib/ee.js index <HASH>..<HASH> 100644 --- a/lib/ee.js +++ b/lib/ee.js @@ -20,10 +20,8 @@ module.exports = { var args = slice.call(arguments, 1), array = this._events[ev]; - array && array.forEach(invokeHandler, this); - - function invokeHandler(handler) { - handler.apply(this, args); + for (var i = 0, len = array.length; i < len; i++) { + array[i].apply(this, args); } }, once: function once(ev, handler) {
Use `for` instead of `forEach` as it minifies better.
Raynos_eventemitter-light
train
js
c670274b9f63a12c3b08f5011b54e2bffb4fca46
diff --git a/client.go b/client.go index <HASH>..<HASH> 100644 --- a/client.go +++ b/client.go @@ -235,6 +235,12 @@ func (c *Client) User() string { return c.namenode.User } +// Name returns the unique name that the Client uses in communication +// with namenodes and datanodes. +func (c *Client) Name() string { + return c.namenode.ClientName +} + // ReadFile reads the file named by filename and returns the contents. func (c *Client) ReadFile(filename string) ([]byte, error) { f, err := c.Open(filename)
Allow to get an unique name of the client
colinmarc_hdfs
train
go
f7473c7f85fa1d1a7fa4dcb4e581ac4fa7c8f541
diff --git a/modules/adgenerationBidAdapter.js b/modules/adgenerationBidAdapter.js index <HASH>..<HASH> 100644 --- a/modules/adgenerationBidAdapter.js +++ b/modules/adgenerationBidAdapter.js @@ -75,11 +75,6 @@ export const spec = { return []; } const bidRequest = bidRequests.bidRequest; - if (!bidRequest.mediaTypes || bidRequest.mediaTypes.banner) { - if (!body.w || !body.h) { - return []; - } - } const bidResponse = { requestId: bidRequest.bidId, cpm: body.cpm || 0, @@ -91,7 +86,7 @@ export const spec = { netRevenue: true, ttl: body.ttl || 10, }; - if (bidRequest.mediaTypes && bidRequest.mediaTypes.native) { + if (isNative(body)) { bidResponse.native = createNativeAd(body); bidResponse.mediaType = NATIVE; } else { @@ -124,6 +119,11 @@ function createAd(body, bidRequest) { return ad; } +function isNative(body) { + if (!body) return false; + return body.native_ad && body.native_ad.assets.length > 0; +} + function createNativeAd(body) { let native = {}; if (body.native_ad && body.native_ad.assets.length > 0) {
update AdGenetation adapter (<I> squashed commit) (#<I>) Squashed commits: [1b<I>ca0] update AdGenetation adapter
prebid_Prebid.js
train
js
0c62773c4664fc51d36d9375be94481439865332
diff --git a/tests/unit/AbstractClientTest.php b/tests/unit/AbstractClientTest.php index <HASH>..<HASH> 100644 --- a/tests/unit/AbstractClientTest.php +++ b/tests/unit/AbstractClientTest.php @@ -162,7 +162,7 @@ class ClientTest extends Unit $client->send($request2); $transport = $this->createMock(TransportInterface::class); - $transport->expects($this->exactly(2))->method('send')->withConsecutive([$request, 4 |ApiRequestOption::NO_RESPONSE], [$request2, ApiRequestOption::NO_RESPONSE]); + $transport->expects($this->once())->method('sendMany')->with([[$request, 4 |ApiRequestOption::NO_RESPONSE], [$request2, ApiRequestOption::NO_RESPONSE]]); $client->setTransport($transport); $fluent = $client->commit();
modify the test to be ok with the new commit definition.
flash-global_api-client
train
php
5b6a66599e7a686559ee59d3b91eb5867e2a8cce
diff --git a/api/app.go b/api/app.go index <HASH>..<HASH> 100644 --- a/api/app.go +++ b/api/app.go @@ -1638,6 +1638,15 @@ func forceDeleteLock(w http.ResponseWriter, r *http.Request, t auth.Token) error return nil } +// title: register unit +// path: /apps/{app}/units/register +// method: POST +// consume: application/x-www-form-urlencoded +// produce: application/json +// responses: +// 200: Ok +// 401: Unauthorized +// 404: App not found func registerUnit(w http.ResponseWriter, r *http.Request, t auth.Token) error { appName := r.URL.Query().Get(":app") a, err := app.GetByName(appName)
api/apps: add comments to describe register unit
tsuru_tsuru
train
go
71ee033078e56115d0325b75dd2289943f2fcf16
diff --git a/djstripe/models.py b/djstripe/models.py index <HASH>..<HASH> 100644 --- a/djstripe/models.py +++ b/djstripe/models.py @@ -283,15 +283,13 @@ Use ``Customer.sources`` and ``Customer.subscriptions`` to access them. In this case, use ``Customer.subscriptions`` instead. """ - subscription_count = self.subscriptions.count() + subscriptions = self.subscriptions.exclude(status="canceled") - if subscription_count == 0: - return None - elif subscription_count == 1: - return self.subscriptions.first() - else: + if subscriptions.count() > 1: raise MultipleSubscriptionException("This customer has multiple subscriptions. Use Customer.subscriptions " "to access them.") + else: + return subscriptions.first() # TODO: Accept a coupon object when coupons are implemented def subscribe(self, plan, charge_immediately=True, **kwargs):
Exclude canceled subscriptions from Customer.subscriptions
dj-stripe_dj-stripe
train
py
72fe6164be33d98f28497488bb6773516ff1fde8
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js index <HASH>..<HASH> 100644 --- a/jquery.multiple.select.js +++ b/jquery.multiple.select.js @@ -48,10 +48,6 @@ this.selectAllName = 'name="selectAll' + name + '"'; this.selectGroupName = 'name="selectGroup' + name + '"'; this.selectItemName = 'name="selectItem' + name + '"'; - - if (this.options.isOpen) { - this.open(); - } } MultipleSelect.prototype = { @@ -95,6 +91,10 @@ this.$noResults = this.$drop.find('.ms-no-results'); this.events(); this.update(); + + if (this.options.isOpen) { + this.open(); + } }, optionToHtml: function(i, elm, group, groupDisabled) {
Fix #<I>: call open function after init when isOpen and filter options are set to true.
wenzhixin_multiple-select
train
js
92295999e2a0e181d861bd843eb622b55a02dc23
diff --git a/test/connection_test.py b/test/connection_test.py index <HASH>..<HASH> 100755 --- a/test/connection_test.py +++ b/test/connection_test.py @@ -61,7 +61,7 @@ class BaseTest(unittest.TestCase): json.dump(klass.dbconfig, f) @classmethod - def setUpClass(klass): + def _setUpClass(klass): os.mkdir(klass.mysqldir) klass.dump_config_files() klass.start_mysql() @@ -95,7 +95,7 @@ class BaseTest(unittest.TestCase): connection.commit() @classmethod - def tearDownClass(klass): + def _tearDownClass(klass): try: klass.process.kill() klass.process.wait() @@ -208,9 +208,9 @@ class TestConnection(BaseTest): if __name__=="__main__": try: - BaseTest.setUpClass() + BaseTest._setUpClass() unittest.main(argv=["auth_test.py"]) finally: print "Waiting for processes to terminate...", - BaseTest.tearDownClass() + BaseTest._tearDownClass() print "OK"
Make connection_test.py work in both <I> and <I>.
vitessio_vitess
train
py
742154be9a26e849f02d296073c077e0a7c23828
diff --git a/association.go b/association.go index <HASH>..<HASH> 100644 --- a/association.go +++ b/association.go @@ -267,15 +267,16 @@ func (association *Association) Count() int { query = scope.DB() ) - if relationship.Kind == "many_to_many" { + switch relationship.Kind { + case "many_to_many": query = relationship.JoinTableHandler.JoinWith(relationship.JoinTableHandler, query, scope.Value) - } else if relationship.Kind == "has_many" || relationship.Kind == "has_one" { + case "has_many", "has_one": primaryKeys := scope.getColumnAsArray(relationship.AssociationForeignFieldNames, scope.Value) query = query.Where( fmt.Sprintf("%v IN (%v)", toQueryCondition(scope, relationship.ForeignDBNames), toQueryMarks(primaryKeys)), toQueryValues(primaryKeys)..., ) - } else if relationship.Kind == "belongs_to" { + case "belongs_to": primaryKeys := scope.getColumnAsArray(relationship.ForeignFieldNames, scope.Value) query = query.Where( fmt.Sprintf("%v IN (%v)", toQueryCondition(scope, relationship.AssociationForeignDBNames), toQueryMarks(primaryKeys)),
rewrite if-else chain as switch statement (#<I>) From effective Go: <URL>
jinzhu_gorm
train
go
e509a733a4a0b8821512be1222e4945d5e27f51b
diff --git a/packages/blueprint/lib/application.js b/packages/blueprint/lib/application.js index <HASH>..<HASH> 100644 --- a/packages/blueprint/lib/application.js +++ b/packages/blueprint/lib/application.js @@ -145,13 +145,15 @@ module.exports = BO.extend (Events, { * Destroy the application. */ destroy () { - // Instruct each service to destroy itself. - let { services } = this.resources; - - return BPromise.props (mapValues (services, (service, name) => { - debug (`destroying service ${name}`); - return service.destroy (); - })); + return this._server.close ().then (() => { + // Instruct each service to destroy itself. + let { services } = this.resources; + + return BPromise.props (mapValues (services, (service, name) => { + debug (`destroying service ${name}`); + return service.destroy (); + })); + }); }, /**
The application failed to stop at the end of testing
onehilltech_blueprint
train
js
4df699b383403e48e9446322167b083194211e48
diff --git a/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb b/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb index <HASH>..<HASH> 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb @@ -165,6 +165,14 @@ module ActiveRecord def remove_index(table_name, options = {}) #:nodoc: index_name = index_name(table_name, options) unless index_name_exists?(table_name, index_name, true) + # sometimes options can be String or Array with column names + options = {} unless options.is_a?(Hash) + if options.has_key? :name + options_without_column = options.dup + options_without_column.delete :column + index_name_without_column = index_name(table_name, options_without_column) + return index_name_without_column if index_name_exists?(table_name, index_name_without_column, false) + end raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' does not exist" end remove_index!(table_name, index_name)
Use the index name explicitly provided in a migration when reverting see rails/rails#<I>
rsim_oracle-enhanced
train
rb
2ce819df062792b2c3919d027ed09286de2ce409
diff --git a/modules/admin/resources/js/controllers.js b/modules/admin/resources/js/controllers.js index <HASH>..<HASH> 100644 --- a/modules/admin/resources/js/controllers.js +++ b/modules/admin/resources/js/controllers.js @@ -389,11 +389,15 @@ }); }; + $scope.$on('topMenuClick', function(e) { + $scope.currentItem = null; + }); + $scope.init(); }); zaa.controller("DashboardController", function ($scope) { - $scope.logItemOpen = false; + $scope.logItemOpen = false; }); // LayoutMenuController.js @@ -457,6 +461,7 @@ $scope.currentItem = {}; $scope.click = function(menuItem) { + $scope.$broadcast('topMenuClick', { menuItem : menuItem }); if (menuItem.template) { $state.go('custom', { 'templateId' : menuItem.template }); } else {
fixed bug where activ class on dashboard still appears closing #<I>
luyadev_luya
train
js
c289a4d54635b6b1cb54c78d85ca9fc51242c031
diff --git a/yarl/__init__.py b/yarl/__init__.py index <HASH>..<HASH> 100644 --- a/yarl/__init__.py +++ b/yarl/__init__.py @@ -10,7 +10,7 @@ import idna from .quoting import _Quoter, _Unquoter -__version__ = '1.2.5a2' +__version__ = '1.2.5a3' __all__ = ('URL',)
Bump to <I>a3
aio-libs_yarl
train
py
38904353afcaff507e87711b7b239f0a00c633e1
diff --git a/wafer/settings.py b/wafer/settings.py index <HASH>..<HASH> 100644 --- a/wafer/settings.py +++ b/wafer/settings.py @@ -147,9 +147,9 @@ INSTALLED_APPS = ( 'wafer.sponsors', 'wafer.pages', 'wafer.tickets', + 'wafer.compare', # Django isn't finding the overridden templates 'registration', - 'wafer.compare', ) from django.db import migrations
Keep all the wafer apps together in the settings file
CTPUG_wafer
train
py
6a8713ba2072f7f0684e1e09fb560a3568198c00
diff --git a/src/cli.js b/src/cli.js index <HASH>..<HASH> 100644 --- a/src/cli.js +++ b/src/cli.js @@ -37,17 +37,13 @@ commander /^(trace|debug|info|warn|error|silent)$/i, 'warn') .action((host, file, options) => { - const { port, username, password, loglevel, command } = options; - if (!host) { log.error('Please specify a host to connect to'); commander.help(); } - log.setLevel(loglevel); - const source = file && fs.readFileSync(file); - const xapi = connect(host, { port, username, password, command }) + const xapi = connect(host, options) .on('error', (error) => { log.error('xapi error:', error); }) .on('ready', () => { if (source) {
Fix setting correct cli log level Setting of log level has been moved into `connect`, so whatever we do outside of it will be reverted by connect. Which is why we also have to pass along all options to `connect`.
cisco-ce_jsxapi
train
js
02b653bd42bef7854d0175f14f3747829fdbc8b2
diff --git a/cloudinit/cloudinit_test.go b/cloudinit/cloudinit_test.go index <HASH>..<HASH> 100644 --- a/cloudinit/cloudinit_test.go +++ b/cloudinit/cloudinit_test.go @@ -220,9 +220,7 @@ var ctests = []struct { }, { "AddFile", - "runcmd:\n" + - "- install -m 644 /dev/null '/etc/apt/apt.conf.d/99proxy'\n" + - "- echo '\"Acquire::http::Proxy \"http://10.0.3.1:3142\";' > '/etc/apt/apt.conf.d/99proxy'\n", + addFileExpected, func(cfg *cloudinit.Config) { cfg.AddFile( "/etc/apt/apt.conf.d/99proxy", @@ -233,7 +231,13 @@ var ctests = []struct { }, } -const header = "#cloud-config\n" +const ( + header = "#cloud-config\n" + addFileExpected = `runcmd: +- install -m 644 /dev/null '/etc/apt/apt.conf.d/99proxy' +- echo '"Acquire::http::Proxy "http://10.0.3.1:3142";' > '/etc/apt/apt.conf.d/99proxy' +` +) func (S) TestOutput(c *C) { for _, t := range ctests {
- Switch expected to a literla string.
juju_juju
train
go
98e815f7d23114b6bc9e54e309f65efe1cc8d073
diff --git a/DependencyInjection/Compiler/EnvironmentVariablesPass.php b/DependencyInjection/Compiler/EnvironmentVariablesPass.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Compiler/EnvironmentVariablesPass.php +++ b/DependencyInjection/Compiler/EnvironmentVariablesPass.php @@ -13,6 +13,7 @@ namespace ONGR\SettingsBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\HttpFoundation\Request; /** * Environment variables pass, overrides default variables with environment ones. @@ -26,7 +27,9 @@ class EnvironmentVariablesPass implements CompilerPassInterface */ public function process(ContainerBuilder $container) { - foreach ($_SERVER as $key => $value) { + $request = Request::createFromGlobals(); + + foreach ($request->server as $key => $value) { if (0 === strpos($key, 'ongr__')) { $param = strtolower(str_replace('__', '.', substr($key, 6))); $container->setParameter($param, $value);
Use server value from request instead of super global variable
ongr-io_SettingsBundle
train
php
1474db937c44f4adcabdc182e222d1554cf1c434
diff --git a/lib/excon/socket.rb b/lib/excon/socket.rb index <HASH>..<HASH> 100644 --- a/lib/excon/socket.rb +++ b/lib/excon/socket.rb @@ -36,10 +36,20 @@ module Excon end end - def read(max_length) + def read(max_length=nil) begin - until @read_buffer.length >= max_length - @read_buffer << @socket.read_nonblock(max_length - @read_buffer.length) + if max_length + until @read_buffer.length >= max_length + @read_buffer << @socket.read_nonblock(max_length - @read_buffer.length) + end + else + # no length specified, so read until EOFError + begin + while true + @read_buffer << @socket.read_nonblock(CHUNK_SIZE) + end + rescue EOFError + end end rescue OpenSSL::SSL::SSLError => error if error.message == 'read would block' @@ -56,7 +66,12 @@ module Excon raise(Excon::Errors::Timeout.new("read timeout reached")) end end - @read_buffer.slice!(0, max_length) + if max_length + @read_buffer.slice!(0, max_length) + else + # read until EOFError, so return everything + @read_buffer.slice!(0, @read_buffer.length) + end end def write(data)
fix nonblock stuff to work properly in read until socket closes case
excon_excon
train
rb
78e01c4834552cb1826178866be983c973fbbd91
diff --git a/lib/pubcontrolclient.js b/lib/pubcontrolclient.js index <HASH>..<HASH> 100644 --- a/lib/pubcontrolclient.js +++ b/lib/pubcontrolclient.js @@ -9,7 +9,7 @@ * Licensed under the MIT License, see file COPYING for details. */ -var fetch = (global.fetch !== undefined) ? global.fetch : require('node-fetch'); +var fetch = (global.fetch !== undefined) ? global.fetch : require('node-fetch').default; var agentkeepalive = require('agentkeepalive'); var url = require('url');
node-fetch workaround for webpack
fanout_node-pubcontrol
train
js
07f2df8b49f0b05338223673f9d32a8db7680f4d
diff --git a/src/toil/test/docs/scriptsTest.py b/src/toil/test/docs/scriptsTest.py index <HASH>..<HASH> 100644 --- a/src/toil/test/docs/scriptsTest.py +++ b/src/toil/test/docs/scriptsTest.py @@ -127,9 +127,9 @@ class ToilDocumentationTest(ToilTest): def testArguments(self): self.checkExpectedOut("tutorial_arguments.py", "Hello, world!, here's a message: Woot") - @needs_docker + """@needs_docker # timing out; likely need to update docker on toil def testDocker(self): - self.checkExitCode("tutorial_docker.py") + self.checkExitCode("tutorial_docker.py")""" def testPromises(self): self.checkExpectedPattern("tutorial_promises.py", "i is: 1.*i is: 2.*i is: 3")
Comment out docker test and investigate on jenkins later.
DataBiosphere_toil
train
py
bb31e62ecccba6bac05ccb4a5be9599cf2340385
diff --git a/lib/turbine/vertex.rb b/lib/turbine/vertex.rb index <HASH>..<HASH> 100644 --- a/lib/turbine/vertex.rb +++ b/lib/turbine/vertex.rb @@ -3,6 +3,9 @@ module Turbine # formed: a directed graph consists of a set of vertices and a set of arcs # (ordered pairs of vertices). class Vertex + # Public: Returns the unique key which identifies the vertex. + attr_reader :key + # Public: Returns edges which connect other vertices to this one. attr_reader :in_edges @@ -10,7 +13,7 @@ module Turbine attr_reader :out_edges # Creates a new Vertex. - def initialize(key = nil) + def initialize(key) @key = key @in_edges = [] @out_edges = [] diff --git a/spec/turbine/vertex_spec.rb b/spec/turbine/vertex_spec.rb index <HASH>..<HASH> 100644 --- a/spec/turbine/vertex_spec.rb +++ b/spec/turbine/vertex_spec.rb @@ -1,7 +1,13 @@ require 'spec_helper' describe 'Turbine::Vertex' do - let(:vertex) { Turbine::Vertex.new } + let(:vertex) { Turbine::Vertex.new(:phil) } + + context 'creating a new vertex' do + context 'without providing a key' do + it { expect(-> { Turbine::Vertex.new }).to raise_error(ArgumentError) } + end + end describe '#in_edges' do subject { vertex.in_edges }
Vertex.new must be provided a key.
quintel_turbine
train
rb,rb
d19c496f2872b178cb76de14b7590d633092e53b
diff --git a/model/execution/implementation/KvLtiDeliveryExecutionService.php b/model/execution/implementation/KvLtiDeliveryExecutionService.php index <HASH>..<HASH> 100644 --- a/model/execution/implementation/KvLtiDeliveryExecutionService.php +++ b/model/execution/implementation/KvLtiDeliveryExecutionService.php @@ -147,7 +147,7 @@ class KvLtiDeliveryExecutionService extends AbstractLtiDeliveryExecutionService */ protected function getDeliveryExecutionLinks($userUri, $deliveryExecutionUri) { - $linksOfExecutionAndUser = $this->getPersistence()->get(self::LINKS_OF_DELIVERY_EXECUTION . $userUri . $deliveryExecutionUri . '_'); + $linksOfExecutionAndUser = $this->getPersistence()->get(self::LINKS_OF_DELIVERY_EXECUTION . $userUri . $deliveryExecutionUri); if (empty($linksOfExecutionAndUser)) { $linksOfExecutionAndUser = [];
check if links of execution are not empty
oat-sa_extension-tao-ltideliveryprovider
train
php
d86d28054a73a8584b708401c205b7c702e1e81a
diff --git a/gettext.go b/gettext.go index <HASH>..<HASH> 100644 --- a/gettext.go +++ b/gettext.go @@ -42,9 +42,9 @@ var ( // LcAll is for all of the locale. LcAll = uint(C.LC_ALL) - // LcColate is for regular expression matching (it determines the meaning of + // LcCollate is for regular expression matching (it determines the meaning of // range expressions and equivalence classes) and string collation. - LcColate = uint(C.LC_ALL) + LcCollate = uint(C.LC_COLLATE) // LcCtype is for regular expression matching, character classification, // conversion, case-sensitive comparison, and wide character functions. @@ -64,6 +64,17 @@ var ( LcTime = uint(C.LC_TIME) ) +// Deprecated but kept for backwards compatibility. +var ( + LC_ALL = LcAll + LC_COLLATE = LcCollate + LC_CTYPE = LcCtype + LC_MESSAGES = LcMessages + LC_MONETARY = LcMonetary + LC_NUMERIC = LcNumeric + LC_TIME = LcTime +) + // SetLocale sets the program's current locale. func SetLocale(category uint, locale string) string { clocale := C.CString(locale)
Adding old LC_* style constants for backward compatibility.
gosexy_gettext
train
go
35e025fec400786330ddc89ae4352dba0e7026d4
diff --git a/bucky/cfg.py b/bucky/cfg.py index <HASH>..<HASH> 100644 --- a/bucky/cfg.py +++ b/bucky/cfg.py @@ -30,7 +30,9 @@ graphite_pickle_buffer_size = 500 full_trace = False name_prefix = None +name_prefix_parts = None name_postfix = None +name_postfix_parts = None name_replace_char = '_' name_strip_duplicates = True name_host_trim = [] diff --git a/bucky/names.py b/bucky/names.py index <HASH>..<HASH> 100644 --- a/bucky/names.py +++ b/bucky/names.py @@ -61,9 +61,13 @@ def statname(host, name): parts = [] if cfg.name_prefix: parts.append(cfg.name_prefix) + if cfg.name_prefix_parts: + parts.extend(cfg.name_prefix_parts) if host: parts.extend(hostname(host)) parts.extend(nameparts) + if cfg.name_postfix_parts: + parts.append(cfg.name_postfix_parts) if cfg.name_postfix: parts.append(cfg.name_postfix) if cfg.name_replace_char is not None:
Allow prefix and postfix to have multiple parts.
trbs_bucky
train
py,py
81308a21b3f2ac4c40a8c714b9111806e50e9c2a
diff --git a/cache2k-config/src/test/java/org/cache2k/extra/config/test/IntegrationTest.java b/cache2k-config/src/test/java/org/cache2k/extra/config/test/IntegrationTest.java index <HASH>..<HASH> 100644 --- a/cache2k-config/src/test/java/org/cache2k/extra/config/test/IntegrationTest.java +++ b/cache2k-config/src/test/java/org/cache2k/extra/config/test/IntegrationTest.java @@ -225,7 +225,7 @@ public class IntegrationTest { /** * As of version 2.0 we allow duplicate listeners to simplify the configuration */ - @Test + @Test @Ignore public void duplicateListener() { Cache2kBuilder<String, String> builder = new Cache2kBuilder<String, String>() { }
ignore test again, need to fix module configuration first
cache2k_cache2k
train
java
b344d158dcb02e7dd8e3f6d1dfc8f3363e014704
diff --git a/lib/happymapper.rb b/lib/happymapper.rb index <HASH>..<HASH> 100644 --- a/lib/happymapper.rb +++ b/lib/happymapper.rb @@ -1,5 +1,3 @@ -require 'rubygems' -gem 'libxml-ruby', '=1.1.3' require 'date' require 'time' require 'xml' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,4 @@ -begin - require 'spec' -rescue LoadError - require 'rubygems' - gem 'rspec' - require 'spec' -end - +require 'spec' require File.expand_path('../../lib/happymapper', __FILE__) def fixture_file(filename)
Removing rubygems.
jnunemaker_happymapper
train
rb,rb
20c594066b48b9b17b167419a78063015467a3c5
diff --git a/test/e2e/cluster_dns.go b/test/e2e/cluster_dns.go index <HASH>..<HASH> 100644 --- a/test/e2e/cluster_dns.go +++ b/test/e2e/cluster_dns.go @@ -37,6 +37,11 @@ func TestClusterDNS(c *client.Client) bool { return true } + if testContext.provider == "vagrant" { + glog.Infof("Skipping test which is broken for vagrant (See https://github.com/GoogleCloudPlatform/kubernetes/issues/3580)") + return true + } + podClient := c.Pods(api.NamespaceDefault) //TODO: Wait for skyDNS diff --git a/test/e2e/network.go b/test/e2e/network.go index <HASH>..<HASH> 100644 --- a/test/e2e/network.go +++ b/test/e2e/network.go @@ -25,6 +25,11 @@ import ( ) func TestNetwork(c *client.Client) bool { + if testContext.provider == "vagrant" { + glog.Infof("Skipping test which is broken for vagrant (See https://github.com/GoogleCloudPlatform/kubernetes/issues/3580)") + return true + } + ns := api.NamespaceDefault svc, err := c.Services(ns).Create(loadObjectOrDie(assetPath( "contrib", "for-tests", "network-tester", "service.json",
Disable a couple of e2e tests for vagrant for now. The core issue is that vagrant lacks connectivity from master to containers.
kubernetes_kubernetes
train
go,go
864f312fa95a1fd285d6382200c48a43bbb4442a
diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/ensemble/Bagging.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/ensemble/Bagging.java index <HASH>..<HASH> 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/ensemble/Bagging.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/ensemble/Bagging.java @@ -33,7 +33,7 @@ import com.github.javacliparser.ClassOption; import com.github.javacliparser.Configurable; import com.github.javacliparser.IntOption; import com.yahoo.labs.samoa.core.Processor; -import com.yahoo.labs.samoa.learners.classifiers.SingleClassifier; +import com.yahoo.labs.samoa.learners.classifiers.trees.VerticalHoeffdingTree; /** * The Bagging Classifier by Oza and Russell. @@ -45,7 +45,7 @@ public class Bagging implements Learner , Configurable { /** The base learner option. */ public ClassOption baseLearnerOption = new ClassOption("baseLearner", 'l', - "Classifier to train.", Learner.class, SingleClassifier.class.getName()); + "Classifier to train.", Learner.class, VerticalHoeffdingTree.class.getName()); /** The ensemble size option. */
Updated Bagging deafault base classifier option
YahooArchive_samoa
train
java
264cdd367675b8ac0bfbc3f21eb53625fd5bf53c
diff --git a/src/ContainerBuilder.php b/src/ContainerBuilder.php index <HASH>..<HASH> 100644 --- a/src/ContainerBuilder.php +++ b/src/ContainerBuilder.php @@ -492,7 +492,9 @@ class ContainerBuilder { // process services foreach ($config["services"] as $key => $definition) { // check if this is an alias of another service - $key = $this->referenceResolver->aliasThisKey($key, $alias); + if (!$this->referenceResolver->keyIsAliased($key)) { + $key = $this->referenceResolver->aliasThisKey($key, $alias); + } if (!empty($definition["aliasOf"])) { // override any existing definitions for this key
Only alias a key if it is not already aliased
lexide_syringe
train
php
1499d755b62a7a57ac71356b3cc0999349504da2
diff --git a/backbone.js b/backbone.js index <HASH>..<HASH> 100644 --- a/backbone.js +++ b/backbone.js @@ -619,7 +619,7 @@ if (ev == 'destroy') { this._remove(model, options); } - if (ev === 'change:' + model.idAttribute) { + if (model && ev === 'change:' + model.idAttribute) { delete this._byId[model.previous(model.idAttribute)]; this._byId[model.id] = model; }
Check for model before accessing its properties, fixes #<I>
jashkenas_backbone
train
js
c458424f2ea7f81a175a294c1d329d744911c007
diff --git a/trump/orm.py b/trump/orm.py index <HASH>..<HASH> 100644 --- a/trump/orm.py +++ b/trump/orm.py @@ -538,20 +538,25 @@ class Symbol(Base, ReprMixin): def __init__(self, name, description=None, units=None, agg_method="PRIORITY_FILL", indexname="UNNAMED", indeximp="DatetimeIndexImp"): - """ - :param name: str + """A Trump Symbol persistently objectifies indexed data + + Use the SymbolManager class to create or retrieve existing symbols. + + Parameters + ---------- + name : str The name of the symbol to be added to the database, serves as a primary key across the trump installation. - :param description: str, optional + description : str, optional a description of the symbol, just for notes. - :param units: str, optional + units : str, optional a string representing the units for the data. - :param agg_method: str, default PRIORITY_FILL - the method used for aggregating feeds, see + agg_method : str, default PRIORITY_FILL + the method used for aggregating feeds, see trump.extensions.symbol_aggs.py for the list of available options. - :param indexname: str + indexname : str a proprietary name assigned to the index. - :param indeximp: str + indeximp : str a string representing an index implementer (one of the classes in indexing.py) """
Change Symbol docstring to numpy style
Equitable_trump
train
py
3e3ddb9348ac7cdaefcde33db18620da6e2ebeb5
diff --git a/lib/inject.js b/lib/inject.js index <HASH>..<HASH> 100644 --- a/lib/inject.js +++ b/lib/inject.js @@ -54,14 +54,11 @@ function injectAllRequirements() { if (!get(f, 'module')) { set(f, ['module'], '.'); } - if (!doneModules.includes(f.module)) { - injectRequirements( - path.join('.serverless', f.module, 'requirements'), - f.package.artifact, - this.options - ); - doneModules.push(f.module); - } + injectRequirements( + path.join('.serverless', f.module, 'requirements'), + f.package.artifact, + this.options + ); }); } else { injectRequirements(
Include requirements into every package, even when it's in the root
UnitedIncome_serverless-python-requirements
train
js
fd009b436532c939930051b7778f9d22ebd28b1c
diff --git a/src/renderable/sprite.js b/src/renderable/sprite.js index <HASH>..<HASH> 100644 --- a/src/renderable/sprite.js +++ b/src/renderable/sprite.js @@ -21,7 +21,7 @@ * @param {Number} [settings.rotation] Initial rotation angle in radians. * @param {Boolean} [settings.flipX] Initial flip for X-axis. * @param {Boolean} [settings.flipY] Initial flip for Y-axis. - * @param {me.Vector2d} [settings.anchorPoint] Anchor point. + * @param {me.Vector2d} [settings.anchorPoint={x:0.5, y:0.5}] Anchor point (defaults to the center of the sprite). * @example * // create a static Sprite Object * mySprite = new me.Sprite (100, 100, {
[documentation] better highlight the default value for the anchor point in the `me.Sprite` constructor
melonjs_melonJS
train
js
7090db0c446b0c4c0daa84c9dfa5e62642729475
diff --git a/src/Themosis/Route/RouteServiceProvider.php b/src/Themosis/Route/RouteServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Themosis/Route/RouteServiceProvider.php +++ b/src/Themosis/Route/RouteServiceProvider.php @@ -2,21 +2,14 @@ namespace Themosis\Route; -use Illuminate\Events\Dispatcher; -use Illuminate\Support\ServiceProvider; +use Illuminate\Routing\RoutingServiceProvider; -class RouteServiceProvider extends ServiceProvider +class RouteServiceProvider extends RoutingServiceProvider { public function register() { - /* - * Register the Events Dispatcher into the container. - */ - $this->app->bind('events', function ($container) { - return new Dispatcher($container); - }); - $this->app->singleton('router', function ($container) { - return new Router($container['events'], $container); + $this->app->singleton('router', function ($app) { + return new Router($app['events'], $app); }); } }
Themosis route service provider extends the illuminate routing provider.
themosis_framework
train
php
df5bb5e1219096d78c346bf48ba83421c8b5ef65
diff --git a/src/Api/Issues.php b/src/Api/Issues.php index <HASH>..<HASH> 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -97,7 +97,7 @@ class Issues extends AbstractApi * * @return mixed */ - public function reorder($project_id, $issue_iid, array $params) + public function reorder($project_id, int $issue_iid, array $params) { return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/reorder', $params); }
Added missing scalar type
m4tthumphrey_php-gitlab-api
train
php
94db5b306e3a9a716aa67edcce8b6f4747d2be3c
diff --git a/anyvcs/git.py b/anyvcs/git.py index <HASH>..<HASH> 100644 --- a/anyvcs/git.py +++ b/anyvcs/git.py @@ -146,11 +146,11 @@ class GitRepo(VCSRepo): cmd.append('--no-merges') single = False if revrange is None: - pass + cmd.append('--all') elif isinstance(revrange, tuple): if revrange[0] is None: if revrange[1] is None: - pass + cmd.append('--all') else: cmd.append(revrange[1]) else:
fix bug in GitRepo.log when revrange=None or (None,None)
ScottDuckworth_python-anyvcs
train
py
24ece5cbc0b2953fe8228d9a723e05c242507677
diff --git a/sacred/initialize.py b/sacred/initialize.py index <HASH>..<HASH> 100755 --- a/sacred/initialize.py +++ b/sacred/initialize.py @@ -240,8 +240,18 @@ def create_scaffolding(experiment, sorted_ingredients): named_configs=experiment.named_configs, config_hooks=experiment.config_hooks, generate_seed=True) - return OrderedDict([(sc.path, sc) for sc in scaffolding.values()]) - + + scaffolding_ret = OrderedDict([ + (sc.path, sc) + for sc in scaffolding.values() + ]) + if len(scaffolding_ret) != len(scaffolding): + raise ValueError( + 'The pathes of the ingredients are not unique. ' + '{}'.format([s.path for s in scaffolding]) + ) + + return scaffolding_ret def gather_ingredients_topological(ingredient): sub_ingredients = defaultdict(int)
create_scaffolding raise exception when pathes aren't unique
IDSIA_sacred
train
py
fb19e42ceef19e858b2a3ab946124489d4e61351
diff --git a/spec/wordpress/api_spec.rb b/spec/wordpress/api_spec.rb index <HASH>..<HASH> 100644 --- a/spec/wordpress/api_spec.rb +++ b/spec/wordpress/api_spec.rb @@ -37,7 +37,9 @@ describe Wordpress::API do it "should raise error with invalid parameter" do expect { - obj = client.send(method, *params[:args], :invalid_key => 1) + args = [method, *params[:args]] + args << {:invalid_key => 1} + obj = client.send(*args) }.to raise_error(Wordpress::ArgumentError) end end
Improve the argument format in spec.
dtaniwaki_wordpress-client
train
rb
c65bf5bbc6f8829849b58fbdd18704672b20b51b
diff --git a/core/src/elements/ons-fab.js b/core/src/elements/ons-fab.js index <HASH>..<HASH> 100755 --- a/core/src/elements/ons-fab.js +++ b/core/src/elements/ons-fab.js @@ -72,6 +72,13 @@ export default class FabElement extends BaseElement { */ init() { + // The following statements can be executed before contentReady + // since these do not access the children + { + this.show(); + this.classList.add(defaultClassName); + } + contentReady(this, () => { this._compile(); }); @@ -80,8 +87,6 @@ export default class FabElement extends BaseElement { _compile() { autoStyle.prepare(this); - this.classList.add(defaultClassName); - if (!util.findChild(this, '.fab__icon')) { const content = document.createElement('span'); content.classList.add('fab__icon'); @@ -99,8 +104,6 @@ export default class FabElement extends BaseElement { ModifierUtil.initModifier(this, scheme); this._updatePosition(); - - this.show(); } static get observedAttributes() {
fix(ons-fab): Execute this.show() and some statements before contentReady.
OnsenUI_OnsenUI
train
js
47493a03577b500615cb9757d9581e4908ff10e5
diff --git a/Pdf/Engine/WkHtmlToPdfEngine.php b/Pdf/Engine/WkHtmlToPdfEngine.php index <HASH>..<HASH> 100644 --- a/Pdf/Engine/WkHtmlToPdfEngine.php +++ b/Pdf/Engine/WkHtmlToPdfEngine.php @@ -26,14 +26,6 @@ class WkHtmlToPdfEngine extends AbstractPdfEngine { * @return string raw pdf data */ public function output() { - $binary = $this->config('binary'); - - if ($binary) { - $this->binary = $binary; - } - if (!is_executable($this->binary)) { - throw new CakeException(sprintf('wkhtmltopdf binary is not found or not executable: %s', $this->binary)); - } $content = $this->_exec($this->_getCommand(), $this->_Pdf->html()); if (strpos(mb_strtolower($content['stderr']), 'error')) { @@ -82,6 +74,14 @@ class WkHtmlToPdfEngine extends AbstractPdfEngine { * @return string the command for generating the pdf */ protected function _getCommand() { + $binary = $this->config('binary'); + + if ($binary) { + $this->binary = $binary; + } + if (!is_executable($this->binary)) { + throw new CakeException(sprintf('wkhtmltopdf binary is not found or not executable: %s', $this->binary)); + } $command = $this->binary; $command .= " -q";
move binary setting to _getCommand
FriendsOfCake_CakePdf
train
php
45724d362c1bb9ca10222abb1a4c68a7e716b3e7
diff --git a/widgets/RelTabs.php b/widgets/RelTabs.php index <HASH>..<HASH> 100755 --- a/widgets/RelTabs.php +++ b/widgets/RelTabs.php @@ -58,14 +58,23 @@ class RelTabs extends \dlds\rels\components\Widget { */ protected function renderViews() { - $widget = $this->relViewClass; + if (empty($this->_relViews)) + { + $message = \Yii::t('dlds/rels/widgets', 'RelTabs widget cannot be generated. No related models exist. Please create at least one relation model first.'); + + echo \yii\helpers\Html::tag('div', $message, ['class' => 'alert alert-warning']); + } + else + { + $widget = $this->relViewClass; - echo $widget::widget(array( - 'items' => $this->_relViews, - 'options' => array( - 'collapsible' => true, - ), - )); + echo $widget::widget(array( + 'items' => $this->_relViews, + 'options' => array( + 'collapsible' => true, + ), + )); + } } }
RelTabs updated - added warning when no related model exist
dlds_yii2-rels
train
php
1e7e6275bd4140f1f84e8882696d15e31871bebd
diff --git a/pyocd/commands/commands.py b/pyocd/commands/commands.py index <HASH>..<HASH> 100755 --- a/pyocd/commands/commands.py +++ b/pyocd/commands/commands.py @@ -1561,8 +1561,7 @@ class HelpCommand(CommandBase): } HELP_ADDENDUM = """ -All register names are also available as commands that print the register's value. -Any ADDR or LEN argument will accept a register name. +Any integer argument will accept a register name. Prefix line with $ to execute a Python expression. Prefix line with ! to execute a shell command."""
commands: help: fix addendum regarding register name commands.
mbedmicro_pyOCD
train
py
e8f7743c85e9267cdac838a81d6fcf20353a5764
diff --git a/sprd/manager/ProductManager.js b/sprd/manager/ProductManager.js index <HASH>..<HASH> 100644 --- a/sprd/manager/ProductManager.js +++ b/sprd/manager/ProductManager.js @@ -5,6 +5,8 @@ define(["sprd/manager/IProductManager", "underscore", "flow", "sprd/util/Product var PREVENT_VALIDATION_OPTIONS = { preventValidation: true }; + // factor * print area height = font size + var INITIAL_FONT_SIZE_SCALE_FACTOR = 0.07; return IProductManager.inherit("sprd.manager.ProductManager", { @@ -569,10 +571,15 @@ define(["sprd/manager/IProductManager", "underscore", "flow", "sprd/util/Product .seq("configuration", function () { var textFlow = TextFlow.initializeFromText(text); + var fontSize = 25; + + if(!printType.isPrintColorColorSpace()){ + fontSize = INITIAL_FONT_SIZE_SCALE_FACTOR* printArea.get('_size.height'); + } (new ApplyStyleToElementOperation(TextRange.createTextRange(0, textFlow.textLength()), textFlow, new Style({ font: font, - fontSize: 25, + fontSize: fontSize, lineHeight: 1.2, printTypeColor: this.vars["printTypeColor"] }), new
DEV-<I> - First Text to big for small product types
spreadshirt_rAppid.js-sprd
train
js
dfb5165d2c88e62d313c0806319d9b6961997c32
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/rule-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/rule-filters.js index <HASH>..<HASH> 100644 --- a/sonar-server/src/main/webapp/javascripts/navigator/filters/rule-filters.js +++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/rule-filters.js @@ -39,6 +39,7 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/ajax-se that.choices.add(new Backbone.Model({ id: r.rule.key, text: r.rule.name, + category: r.rule.language, checked: true })); });
SONAR-<I> Little change to support rule language after page reload
SonarSource_sonarqube
train
js
27a7be4bf78424a74327e26180b55209a67d93d1
diff --git a/test/test-suite.js b/test/test-suite.js index <HASH>..<HASH> 100644 --- a/test/test-suite.js +++ b/test/test-suite.js @@ -1264,15 +1264,22 @@ self { JScrewIt = arg || global.JScrewIt; featureSet = Object.create(null); - EMU_FEATURES.forEach( - function (feature) { featureSet[feature] = true; } - ); - JScrewIt.FEATURE_INFOS.AUTO.includes.forEach( - function (feature) { featureSet[feature] = false; } - ); + EMU_FEATURES.forEach(function (feature) { featureSet[feature] = true; }); + initIncludesOf('AUTO'); describeTests(); } + function initIncludesOf(feature) + { + JScrewIt.FEATURE_INFOS[feature].includes.forEach( + function (feature) + { + initIncludesOf(feature); + featureSet[feature] = false; + } + ); + } + function isExpected(expected) { var result =
Minor fix in test-suite.js
fasttime_JScrewIt
train
js
952ae2d11b03419b1ce3398b8a25478e36f0b43c
diff --git a/index.es6.js b/index.es6.js index <HASH>..<HASH> 100644 --- a/index.es6.js +++ b/index.es6.js @@ -50,11 +50,11 @@ function shim(iter, root) { value: function () { let result = iter.nextNode(); _pointerBeforeReferenceNode = false; - if (result !== null) { - _referenceNode = iter.nextNode(); - return _referenceNode; - } else { + if (result === null) { return null; + } else { + _referenceNode = result; + return _referenceNode; } } }, @@ -63,11 +63,11 @@ function shim(iter, root) { value: function () { let result = iter.previousNode(); _pointerBeforeReferenceNode = true; - if (result !== null) { - _referenceNode = iter.previousNode(); - return _referenceNode; - } else { + if (result === null) { return null; + } else { + _referenceNode = result; + return _referenceNode; } } }
Positive assertions and correct code are good
tilgovi_dom-node-iterator
train
js
1dea2ba7060777eabca4959312736b1b3e1eae97
diff --git a/library/Garp/Model/Helper.php b/library/Garp/Model/Helper.php index <HASH>..<HASH> 100755 --- a/library/Garp/Model/Helper.php +++ b/library/Garp/Model/Helper.php @@ -11,6 +11,11 @@ */ abstract class Garp_Model_Helper extends Garp_Util_ObserverAbstract { /** + * Configuration + */ + protected $_config; + + /** * Class constructor. Loads config. * @param Array $config Configuration values. * @return Void @@ -18,12 +23,13 @@ abstract class Garp_Model_Helper extends Garp_Util_ObserverAbstract { public function __construct($config = array()) { $this->_setup($config); } - - + /** * Setup the behavioral environment * @param Array $config Configuration options * @return Void */ - abstract protected function _setup($config); -} \ No newline at end of file + protected function _setup($config) { + $this->_config = $config; + } +}
Added Dateable behavior for to/from dates with themes.
grrr-amsterdam_garp3
train
php
ee82b48efcd4c9a18bbeeb5862cd67d9b8b0e2bd
diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index <HASH>..<HASH> 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -2756,7 +2756,7 @@ class lesson extends lesson_base { $result->newpageid = $page->nextpageid; } } else { - $result->newpageid = $lesson->cluster_jump($page->id); + $result->newpageid = $this->cluster_jump($page->id); } } return $result;
MDL-<I> lesson: Replace old var reference by self
moodle_moodle
train
php
9221338890dc9e7361509fbfc03d14bf94616ec1
diff --git a/lib/lotus/utils/escape.rb b/lib/lotus/utils/escape.rb index <HASH>..<HASH> 100644 --- a/lib/lotus/utils/escape.rb +++ b/lib/lotus/utils/escape.rb @@ -528,9 +528,10 @@ module Lotus # @since 0.4.0 # @api private def self.encode(input) - input.to_s.encode(Encoding::UTF_8) + return '' if input.nil? + input.encode(Encoding::UTF_8) rescue Encoding::UndefinedConversionError - input.to_s.force_encoding(Encoding::UTF_8) + input.dup.force_encoding(Encoding::UTF_8) end # Encode the given UTF-8 char. diff --git a/test/escape_test.rb b/test/escape_test.rb index <HASH>..<HASH> 100644 --- a/test/escape_test.rb +++ b/test/escape_test.rb @@ -105,8 +105,14 @@ describe Lotus::Utils::Escape do it "escapes 'тест'" do skip "There is no ASCII-8BIT encoding" unless Encoding.name_list.include?('ASCII-8BIT') - result = mod.html('тест'.force_encoding('ASCII-8BIT')) + string = 'тест'.force_encoding('ASCII-8BIT') + encoding = string.encoding + + result = mod.html(string) result.must_equal 'тест' + result.encoding.must_equal Encoding::UTF_8 + + string.encoding.must_equal encoding end end
Ensure immutability for encoded strings which failed the conversion Ref #<I>
hanami_utils
train
rb,rb
fe584796965ce1920d28627ffcc4a020e1c0cb0b
diff --git a/spec/custom_field_spec.rb b/spec/custom_field_spec.rb index <HASH>..<HASH> 100644 --- a/spec/custom_field_spec.rb +++ b/spec/custom_field_spec.rb @@ -10,7 +10,7 @@ module Trello before do allow(client) .to receive(:get) - .with('customFields/abcdef123456789123456789', {}) + .with('/customFields/abcdef123456789123456789', {}) .and_return custom_fields_payload end @@ -37,7 +37,7 @@ module Trello it 'properly initializes all fields from options-like formatted hash' do custom_field_details = custom_fields_details[1] - custom_field = CustomField.new(details) + custom_field = CustomField.new(custom_field_details) expect(custom_field.id).to eq(custom_field_details[:id]) expect(custom_field.name).to eq(custom_field_details[:name]) expect(custom_field.type).to eq(custom_field_details[:type]) @@ -97,5 +97,15 @@ module Trello expect(CustomField.find('abcdef123456789123456789')).to eq(custom_field) end end + + context "deleting" do + it "deletes the custom field" do + expect(client) + .to receive(:delete) + .with("/customFields/#{custom_field.id}") + + custom_field.delete + end + end end end
Updated custom field creation test and added deletion test
jeremytregunna_ruby-trello
train
rb
9a499f3fe491102300fc1003f00e958916d7bba4
diff --git a/server.js b/server.js index <HASH>..<HASH> 100644 --- a/server.js +++ b/server.js @@ -59,6 +59,8 @@ module.exports = function (opts, onConnection) { wsServer.close() return emitter } + + emitter.address = server.address.bind(server) return emitter }
expose .address from underlying server
pull-stream_pull-ws
train
js
e231af8d2081125fb8c4cfa4c17ad857669177c4
diff --git a/lib/rnes/ppu.rb b/lib/rnes/ppu.rb index <HASH>..<HASH> 100644 --- a/lib/rnes/ppu.rb +++ b/lib/rnes/ppu.rb @@ -82,6 +82,8 @@ module Rnes case address when 0x0002 registers.status + when 0x0004 + read_from_sprite_ram(@sprite_ram_address) when 0x0007 read_from_video_ram else @@ -135,7 +137,7 @@ module Rnes when 0x0003 write_sprite_ram_address(value) when 0x0004 - write_to_sprite_ram(value) + write_to_sprite_ram_via_ppu_read(value) when 0x0005 write_to_scroll_registers(value) when 0x0006 @@ -355,7 +357,7 @@ module Rnes end # @param [Integer] value - def write_to_sprite_ram(value) + def write_to_sprite_ram_via_ppu_read(value) @sprite_ram.write(@sprite_ram_address, value) @sprite_ram_address += 1 end
Implement reading OAM data from PPU $<I>
r7kamura_rnes
train
rb
e296a4911fe8811fd557f523af5e7d1abf52dac6
diff --git a/spyderlib/widgets/dicteditorutils.py b/spyderlib/widgets/dicteditorutils.py index <HASH>..<HASH> 100644 --- a/spyderlib/widgets/dicteditorutils.py +++ b/spyderlib/widgets/dicteditorutils.py @@ -186,7 +186,7 @@ def value_to_display(value, truncate=False, trunc_len=80, minmax=False): return '%s Mode: %s' % (address(value), value.mode) if isinstance(value, DataFrame): cols = value.columns - if PY2 and cols: + if PY2 and len(cols) > 0: # Get rid of possible BOM utf-8 data present at the # beginning of a file, which gets attached to the first # column header when headers are present in the first
Variable Explorer: Fix another freeze when creating DataFrames on PY 2 - This is a regression introduced when trying to fix issue #<I>
spyder-ide_spyder
train
py
166057f84c6b68b810565b30913d5eaa9e94d528
diff --git a/abilian/services/audit/service.py b/abilian/services/audit/service.py index <HASH>..<HASH> 100644 --- a/abilian/services/audit/service.py +++ b/abilian/services/audit/service.py @@ -48,6 +48,9 @@ class AuditService(Service): Service.start(self) self.register_classes() + def is_auditable(self, model): + return isinstance(model, Entity) + def register_classes(self): state = self.app_state for cls in all_entity_classes(): @@ -132,7 +135,7 @@ class AuditService(Service): transaction.commit() def log_new(self, session, model): - if not isinstance(model, Entity): + if not self.is_auditable(model): return entry = AuditEntry.from_model(model, type=CREATION) @@ -142,18 +145,17 @@ class AuditService(Service): del model.__changes__ def log_updated(self, session, model): - if not (isinstance(model, Entity) + if not (self.is_auditable(model) and hasattr(model, '__changes__')): return entry = AuditEntry.from_model(model, type=UPDATE) entry.changes = model.__changes__ session.add(entry) - del model.__changes__ def log_deleted(self, session, model): - if not isinstance(model, Entity): + if not self.is_auditable(model): return entry = AuditEntry.from_model(model, type=DELETION)
audit: added method to determine if an item is auditable (factorization)
abilian_abilian-core
train
py
d68842d74778ca3bd994f775e167837be25944e0
diff --git a/minio/thread_pool.py b/minio/thread_pool.py index <HASH>..<HASH> 100644 --- a/minio/thread_pool.py +++ b/minio/thread_pool.py @@ -45,7 +45,7 @@ class Worker(Thread): """ Continously receive tasks and execute them """ while True: task = self.tasks_queue.get() - if task is None: + if not task: self.tasks_queue.task_done() break # No exception detected in any thread, @@ -61,6 +61,7 @@ class Worker(Thread): # Mark this task as done, whether an exception happened or not self.tasks_queue.task_done() + class ThreadPool: """ Pool of threads consuming tasks from a queue """ @@ -91,4 +92,3 @@ class ThreadPool: if not self.exceptions_queue.empty(): raise self.exceptions_queue.get() return self.results_queue -
fix formatting as per pep8 in thread_pool.py (#<I>)
minio_minio-py
train
py
78eea4a27a131f0fa82d8831dffb0f500a9e5d01
diff --git a/src/command/KeyBindingManager.js b/src/command/KeyBindingManager.js index <HASH>..<HASH> 100644 --- a/src/command/KeyBindingManager.js +++ b/src/command/KeyBindingManager.js @@ -469,8 +469,11 @@ define(function (require, exports, module) { */ function handleKey(key) { if (_enabled && _keyMap[key]) { - CommandManager.execute(_keyMap[key].commandID); - return true; + // The execute() function returns a promise because some commands are async. + // Generally, commands decide whether they can run or not synchronously, + // and reject immediately, so we can test for that synchronously. + var promise = CommandManager.execute(_keyMap[key].commandID); + return (promise.state() === "rejected") ? false : true; } return false; }
be smarter about key event propagation
adobe_brackets
train
js
22bfc8ccad309abb0181531aea684f9039a35a1f
diff --git a/diego/lifecycle_test.go b/diego/lifecycle_test.go index <HASH>..<HASH> 100644 --- a/diego/lifecycle_test.go +++ b/diego/lifecycle_test.go @@ -94,4 +94,21 @@ var _ = Describe("Application Lifecycle", func() { describeLifeCycle() }) + + Describe("An existing DEA-based app being migrated to Diego", func() { + BeforeEach(func() { + appName = generator.RandomName() + Eventually(cf.Cf("push", appName, "-p", helpers.NewAssets().Dora), CF_PUSH_TIMEOUT).Should(Exit(0)) + Eventually(cf.Cf("stop", appName), DEFAULT_TIMEOUT).Should(Exit(0)) + Eventually(helpers.CurlingAppRoot(appName)).Should(ContainSubstring("404")) + Eventually(cf.Cf("set-env", appName, "CF_DIEGO_RUN_BETA", "true"), DEFAULT_TIMEOUT).Should(Exit(0)) // CF_DIEGO_RUN_BETA also implies CF_DIEGO_BETA in CC + Eventually(cf.Cf("start", appName), CF_PUSH_TIMEOUT).Should(Exit(0)) + }) + + AfterEach(func() { + Eventually(cf.Cf("delete", appName, "-f"), DEFAULT_TIMEOUT).Should(Exit(0)) + }) + + describeLifeCycle() + }) })
Add test for switching DEA app to diego
cloudfoundry_cf-acceptance-tests
train
go
f7a8564c52f39e57c335ca1c522ca64f835f9080
diff --git a/packages/cli/utils/PluginsContainer.js b/packages/cli/utils/PluginsContainer.js index <HASH>..<HASH> 100644 --- a/packages/cli/utils/PluginsContainer.js +++ b/packages/cli/utils/PluginsContainer.js @@ -35,6 +35,10 @@ module.exports = class PluginsContainer { return Array.from(plugins); } + findByType(type) { + return Object.values(this.plugins).filter(pl => pl.type === type); + } + register(...args) { assign(...args, this.plugins); }
fix: add missing findByType method
Webiny_webiny-js
train
js
ec5938942160135f3ed6c8375c8a35746aa293b3
diff --git a/src/entity/Entity.Geometry.js b/src/entity/Entity.Geometry.js index <HASH>..<HASH> 100644 --- a/src/entity/Entity.Geometry.js +++ b/src/entity/Entity.Geometry.js @@ -100,7 +100,7 @@ meta.class("Entity.Geometry", this._updateAnchor(); - if(this.renderer.culling) { + if(this.renderer.culling && this._view.entityBuffer === this.renderer.entities) { this.node = new meta.SparseNode(this); }
Culling is now used only for entities that is on main layer only.
tenjou_meta2d
train
js
78b208c17c0f64d5ccc3563916cb316e4dd4d548
diff --git a/examples/examples.py b/examples/examples.py index <HASH>..<HASH> 100644 --- a/examples/examples.py +++ b/examples/examples.py @@ -11,13 +11,15 @@ from halo.halo import Halo spinner = Halo({'text': 'Such Spin', 'spinner': 'dots'}) - -spinner.start() -time.sleep(2) -spinner.text = 'Much Colors' -spinner.color = 'magenta' -time.sleep(2) -spinner.text = 'Very emojis' -spinner.spinner = {'spinner': 'hearts'} -time.sleep(2) -spinner.stop_and_persist({'symbol': '🦄 '.encode('utf-8'), 'text': 'Wow!'}) +try: + spinner.start() + time.sleep(2) + spinner.text = 'Much Colors' + spinner.color = 'magenta' + time.sleep(2) + spinner.text = 'Very emojis' + spinner.spinner = {'spinner': 'hearts'} + time.sleep(2) + spinner.stop_and_persist({'symbol': '🦄 '.encode('utf-8'), 'text': 'Wow!'}) +except (KeyboardInterrupt, SystemExit): + spinner.stop()
Example: Now handles KeyboardInterrupts too!
manrajgrover_halo
train
py
616f16ebdd6fb410fb48c30a64473d23c23dbf4b
diff --git a/bread/__init__.py b/bread/__init__.py index <HASH>..<HASH> 100644 --- a/bread/__init__.py +++ b/bread/__init__.py @@ -1,5 +1,5 @@ __title__ = 'bread' -__version__ = '2.0.0' +__version__ = '2.1.0' __author__ = 'Alex Rasmussen' __license__ = 'MIT' __copyright__ = 'Copyright 2015 Alex Rasmussen' diff --git a/docs/source/conf.py b/docs/source/conf.py index <HASH>..<HASH> 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -48,9 +48,9 @@ copyright = u'2013, Alex Rasmussen' # built documents. # # The short X.Y version. -version = '2.0.0' +version = '2.1.0' # The full version, including alpha/beta/rc tags. -release = '2.0.0' +release = '2.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='bread', - version='2.0.0', + version='2.1.0', description='Binary format parsing made easier', url='https://github.com/alexras/bread', author='Alex Rasmussen',
Bumping version to <I>
alexras_bread
train
py,py,py
4993d5fe00cfc0e4dd59d2ec7249898b1f8cc917
diff --git a/lib/dml/tests/dml_test.php b/lib/dml/tests/dml_test.php index <HASH>..<HASH> 100644 --- a/lib/dml/tests/dml_test.php +++ b/lib/dml/tests/dml_test.php @@ -4176,6 +4176,7 @@ class dml_testcase extends database_driver_testcase { $t->allow_commit(); $j++; } + $rs2->close(); $this->assertEquals(4, $j); } $rs1->close();
MDL-<I> add missing rs close Thanks Eloy!
moodle_moodle
train
php