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
0423dc0ad3b9da1a2e6c6f13a0fc36504694f6bb
diff --git a/lib/ticket.js b/lib/ticket.js index <HASH>..<HASH> 100644 --- a/lib/ticket.js +++ b/lib/ticket.js @@ -56,7 +56,7 @@ function ticket(options){ // the ST- characters, so allow for it // - if(!/^ST-.{29,256}$/.test(url.query.ticket)){ + if(!/^ST-.{28,256}$/.test(url.query.ticket)){ var queryopts = {'service':opt_service}; res.writeHead(307, { 'location': cas_host+login_service +'?'
parse a slightly shorter response from CAS server Apparently an upgrade to CAS might end up sending a shorter response. Thanks to Christian Illy for the bug report. I can't actually find in the spec anything that says that the ticked MUST be <I> char long...only that the handler must accept tickets up to <I> char long. So probably I misread the spec when I wrote this the first time.
jmarca_cas_validate
train
js
74dad04323e289c2259e77d6d6e4bb696fba32b4
diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index <HASH>..<HASH> 100755 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -885,7 +885,7 @@ class EmailComponent extends Object{ while (substr($response, -2) !== "\r\n" && ((time() - $startTime) < $this->smtpOptions['timeout'])) { $response .= $this->__smtpConnection->read(); } - if (substr($response, -2) === "\r\n") { + if (substr($response, -2) !== "\r\n") { $this->smtpError = 'timeout'; return false; }
Fixing read from SMTP by EmailComponent. Closes #<I>
cakephp_cakephp
train
php
8bfd9bcb89c72e88ae0b6b847cd792649d247ec4
diff --git a/Kwf/Model/Data/Abstract.php b/Kwf/Model/Data/Abstract.php index <HASH>..<HASH> 100644 --- a/Kwf/Model/Data/Abstract.php +++ b/Kwf/Model/Data/Abstract.php @@ -439,6 +439,21 @@ abstract class Kwf_Model_Data_Abstract extends Kwf_Model_Abstract throw new Kwf_Exception_NotYetImplemented(); } + private function _updateModelObserver($options) + { + if (isset($options['skipModelObserver']) && $options['skipModelObserver']) return; + + if (Kwf_Component_Data_Root::getComponentClass()) { + if ($this->_proxyContainerModels) { + foreach ($this->_proxyContainerModels as $m) { + Kwf_Component_ModelObserver::getInstance()->add('update', $m); + } + } else { + Kwf_Component_ModelObserver::getInstance()->add('update', $this); + } + } + } + public function import($format, $data, $options = array()) { if ($format == self::FORMAT_ARRAY) { @@ -469,6 +484,7 @@ abstract class Kwf_Model_Data_Abstract extends Kwf_Model_Abstract $row->save(); } Kwf_Component_ModelObserver::getInstance()->enable(); + $this->_updateModelObserver($options); $this->_afterImport($format, $data, $options); } else { throw new Kwf_Exception_NotYetImplemented();
tell ModelObserver about import just as a Db model would
koala-framework_koala-framework
train
php
64f4430cda0132624987d8a5471b41ba17e9a2c0
diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php @@ -149,7 +149,7 @@ class SwitchUserListener $this->userChecker->checkPostAuth($user); $roles = $user->getRoles(); - + $roles[] = 'ROLE_PREVIOUS_ADMIN'; $token = new SwitchUserToken($user, $user->getPassword(), $this->providerKey, $roles, $token); if (null !== $this->dispatcher) {
[Security] Add back ROLE_PREVIOUS_ADMIN to impersonated user
symfony_symfony
train
php
01ad2e016d2f6e67be397206d0cf861608ff9947
diff --git a/stimela/cargo/cab/wsclean/src/run.py b/stimela/cargo/cab/wsclean/src/run.py index <HASH>..<HASH> 100644 --- a/stimela/cargo/cab/wsclean/src/run.py +++ b/stimela/cargo/cab/wsclean/src/run.py @@ -41,12 +41,11 @@ elif not (isinstance(trim, list) and all([isinstance(t, int) for t in trim]) and len(npix) == 2) : raise ValueError("trim only accepts single int or list[2] of int") - +pad = max(npix[0], npix[1]) / float(min(trim[0], trim[1])) +trindex = filter(lambda x: x['name'] == 'trim', params)[0] +params.remove(trindex) padding = filter(lambda x: x['name'] == 'padding', params) if not padding: - trindex = filter(lambda x: x['name'] == 'trim', params)[0] - params.remove(trindex) - pad = max(npix[0], npix[1]) / float(min(trim[0], trim[1])) filter(lambda x: x['name'] == 'size', params)[0]["value"] = trim # npix is now the unpadded size params.append({'name': 'padding', 'value': pad}) # replace with 'padding' argument
Remove trim from params after calculating the padding parmeter
SpheMakh_Stimela
train
py
5771087fca802d5b0fedbad14bebd174d6eb7239
diff --git a/proxy_collection.go b/proxy_collection.go index <HASH>..<HASH> 100644 --- a/proxy_collection.go +++ b/proxy_collection.go @@ -53,7 +53,10 @@ func (collection *ProxyCollection) Remove(name string) error { } func (collection *ProxyCollection) Clear() error { - for _, proxy := range collection.Proxies() { + collection.Lock() + defer collection.Unlock() + + for _, proxy := range collection.proxies { err := collection.removeByName(proxy.Name) if err != nil { return err
proxy_collection: fix race between indexing and deletion
Shopify_toxiproxy
train
go
c1acdbfa3c97c7fe982d74631d251d9237027a66
diff --git a/aeron-util/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogReader.java b/aeron-util/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogReader.java index <HASH>..<HASH> 100644 --- a/aeron-util/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogReader.java +++ b/aeron-util/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogReader.java @@ -58,8 +58,7 @@ public class LogReader */ public void seek(final int offset) { - final int tail = stateViewer.tailVolatile(); - checkOffset(offset, tail); + checkOffset(offset, stateViewer.tailVolatile()); checkOffsetAlignment(offset); cursor = offset;
[Java]: Minor code style changes.
real-logic_aeron
train
java
8b15fd2284a118c9fc789693ec79763946459646
diff --git a/stimela/__init__.py b/stimela/__init__.py index <HASH>..<HASH> 100644 --- a/stimela/__init__.py +++ b/stimela/__init__.py @@ -140,7 +140,7 @@ def build(argv): if args.us_only: CABS = args.us_only.split(',') else: - # Start with images that have been logged + # Images that have been logged # This is crucial for making custom cabs logged_images = log.read().get('images', {}) for key,val in logged_images.iteritems(): @@ -151,8 +151,9 @@ def build(argv): IGNORE = args.ignore_cabs.split(",") CABS = set(CAB).difference(set(IGNORE)) - cabs += ["{:s}_cab/{:s}".format(args.build_label, cab) for cab in CABS] - dockerfiles += [ "{:s}/{:s}".format(cargo.CAB_PATH, cab) for cab in CABS] + # Prioritise package images over logged images + cabs = ["{:s}_cab/{:s}".format(args.build_label, cab) for cab in CABS] + cabs + dockerfiles = [ "{:s}/{:s}".format(cargo.CAB_PATH, cab) for cab in CABS] + dockerfiles built = [] for image, dockerfile in zip(cabs,dockerfiles): if image not in built:
prioritise package images over logged ones
SpheMakh_Stimela
train
py
2bf0bf4c49800fc98a8f79819ea9b7c9f4eb6708
diff --git a/lib/mincer/processors_map.js b/lib/mincer/processors_map.js index <HASH>..<HASH> 100644 --- a/lib/mincer/processors_map.js +++ b/lib/mincer/processors_map.js @@ -23,6 +23,18 @@ ProcessorsMap.prototype.get = function (key) { }; +// Set processors list to specific value +// +// old_val = processors.get("text/css"); +// new_val = _.without(old_val, MyMegaProcessor); +// processors.set("text/css", new_val); +// +// Used to reset lists and unregister processors. +ProcessorsMap.prototype.set = function (key, val) { + this.data[key] = val || []; +}; + + // Makes a deep copy of processors collection. // // processors.get("text/css").length; // => 1 @@ -38,7 +50,7 @@ ProcessorsMap.prototype.clone = function () { var clone = new ProcessorsMap; Object.keys(this.data).forEach(function (key) { - clone.data[key] = this.data[key].slice(); + clone.set(key, this.data[key].slice()); }, this); return clone;
Fix processors map struct. Adds forgotten `#set` method for processors unregister / override.
nodeca_mincer
train
js
89126f7cbac920fd14df4b5720881ac7392901de
diff --git a/parser/operation.go b/parser/operation.go index <HASH>..<HASH> 100644 --- a/parser/operation.go +++ b/parser/operation.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" //"go/ast" + "log" "regexp" "strconv" "strings" @@ -52,7 +53,7 @@ func (operation *Operation) SetItemsType(itemsType string) { func (operation *Operation) ParseComment(comment string) error { commentLine := strings.TrimSpace(strings.TrimLeft(comment, "//")) - attribute := strings.ToLower(strings.Split(commentLine, " ")[0]) + attribute := strings.ToLower(strings.Fields(commentLine)[0]) switch attribute { case "@router": if err := operation.ParseRouterComment(commentLine); err != nil {
changed Split to Fields so we can eat tabs, too.
yvasiyarov_swagger
train
go
015eabce509f4d8678b77fed4df5d23a4a280523
diff --git a/src/test/java/org/takes/facets/previous/TkPreviousTest.java b/src/test/java/org/takes/facets/previous/TkPreviousTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/takes/facets/previous/TkPreviousTest.java +++ b/src/test/java/org/takes/facets/previous/TkPreviousTest.java @@ -24,8 +24,8 @@ package org.takes.facets.previous; import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; import org.junit.Test; +import org.llorllale.cactoos.matchers.StartsWith; import org.takes.rq.RqFake; import org.takes.rq.RqWithHeader; import org.takes.rs.RsPrint; @@ -52,8 +52,8 @@ public final class TkPreviousTest { "TkPrevious=/home" ) ) - ).print(), - Matchers.startsWith("HTTP/1.1 303 See Other") + ), + new StartsWith("HTTP/1.1 303 See Other") ); }
(#<I>) Replace Guava with Cactoos
yegor256_takes
train
java
edb54ef7334831d47591569316beb69e8ad717d6
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index <HASH>..<HASH> 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1384,10 +1384,10 @@ jQuery.extend({ each: function( obj, fn, args ) { if ( obj.length == undefined ) for ( var i in obj ) - fn.apply( obj[i], args || [i, obj[i]] ); + if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break; else for ( var i = 0; i < obj.length; i++ ) - fn.apply( obj[i], args || [i, obj[i]] ); + if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break; return obj; },
Added code to short-circuit a .each() loop.
jquery_jquery
train
js
496f22deebb0e52ce86cd023d2081648f08d545c
diff --git a/abilian/web/views/object.py b/abilian/web/views/object.py index <HASH>..<HASH> 100644 --- a/abilian/web/views/object.py +++ b/abilian/web/views/object.py @@ -271,6 +271,19 @@ class ObjectEdit(ObjectView): """ pass + def handle_commit_exception(self, exc): + """ + hook point to handle exception that may happen during commit. + + It is the responsability of this method to perform a rollback if it is + required for handling `exc`. If the method does not handle `exc` if should + do nothing and return None. + + :returns: * a valid :class:`Response` if exception is handled. + * `None` if exception is not handled. Default handling happens. + """ + return None + def form_valid(self): """ Save object. @@ -291,13 +304,21 @@ class ObjectEdit(ObjectView): target=self.activity_target) session.commit() except ValidationError, e: + rv = self.handle_commit_exception(e) + if rv is not None: + return rv session.rollback() flash(e.message, "error") + return self.get() except sa.exc.IntegrityError, e: + rv = self.handle_commit_exception(e) + if rv is not None: + return rv session.rollback() logger.error(e) flash(_(u"An entity with this name already exists in the database."), "error") + return self.get() else: flash(self.message_success(), "success") return self.redirect_to_view()
ObjectEdit: add hook to customize exceptions handling during commit
abilian_abilian-core
train
py
d3f64c42920e632008f0503395aadf2e14c2b755
diff --git a/lib/databases/redis.js b/lib/databases/redis.js index <HASH>..<HASH> 100644 --- a/lib/databases/redis.js +++ b/lib/databases/redis.js @@ -15,7 +15,6 @@ var RedisSessionStore = function (options) { port: 6379, prefix: 'sess', ttl: 60 * 60 * 24 * 14, // 14 days - max_attempts: 1, retry_strategy: function (options) { return undefined; }//,
Remove deprecated option max_attempts from Redis options (#<I>) thinking forward
adrai_sessionstore
train
js
e6de87c5ed82f2e8a20a28721d2600bc55d1ddde
diff --git a/models/models_methods.go b/models/models_methods.go index <HASH>..<HASH> 100644 --- a/models/models_methods.go +++ b/models/models_methods.go @@ -28,8 +28,8 @@ const ( DefaultSkipIfEmpty = false ) -// CreateFromJSON ... -func (envList EnvsJSONListModel) CreateFromJSON(jsonStr string) (EnvsJSONListModel, error) { +// NewEnvJSONList ... +func NewEnvJSONList(jsonStr string) (EnvsJSONListModel, error) { list := EnvsJSONListModel{} if err := json.Unmarshal([]byte(jsonStr), &list); err != nil { return EnvsJSONListModel{}, err
NewEnvJSONList instead of CreateFromJSON
bitrise-io_envman
train
go
5696494c6e916b3d6844ebb1c85b9ee3e766bcab
diff --git a/Locale/RequestDetector.php b/Locale/RequestDetector.php index <HASH>..<HASH> 100644 --- a/Locale/RequestDetector.php +++ b/Locale/RequestDetector.php @@ -42,10 +42,11 @@ class RequestDetector implements LocaleDetectorInterface */ public function getLocale() { - if ($request = $this->container->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)) { - return $request->getLocale(); + if ($this->container->isScopeActive("request")) { + if ($request = $this->container->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)) { + return $request->getLocale(); + } } - return $this->defaultLocale; } }
Only access "request"-scope when it is active.
sonata-project_SonataIntlBundle
train
php
a73108a8864e620c101c74d5569a1905ce831594
diff --git a/Mail.php b/Mail.php index <HASH>..<HASH> 100644 --- a/Mail.php +++ b/Mail.php @@ -146,7 +146,6 @@ class Mail $lines[] = $key . ': ' . $value; } elseif (strcasecmp($key, 'Received') === 0) { $received = array(); - // If we've been given an array of Received: lines, join them. if (is_array($value)) { foreach ($value as $line) { $received[] = $key . ': ' . $line;
On second thought, this comment is neither clear nor necessary. git-svn-id: <URL>
pear_Mail
train
php
2d16985313af3db6853185546ddd368998c4a453
diff --git a/ambry/library/search_backends/base.py b/ambry/library/search_backends/base.py index <HASH>..<HASH> 100644 --- a/ambry/library/search_backends/base.py +++ b/ambry/library/search_backends/base.py @@ -482,16 +482,16 @@ class BasePartitionIndex(BaseIndex): doc_field = u('{} {} {}').format( values, schema, ' '.join([ - u'{}'.format(partition.identity.vid), - u'{}'.format(partition.identity.id_), - u'{}'.format(partition.identity.name), - u'{}'.format(partition.identity.vname)])) + u('{}').format(partition.identity.vid), + u('{}').format(partition.identity.id_), + u('{}').format(partition.identity.name), + u('{}').format(partition.identity.vname)])) document = dict( - vid=u'{}'.format(partition.identity.vid), - dataset_vid=u'{}'.format(partition.identity.as_dataset().vid), - title=u'{}'.format(partition.table.description), - keywords=u'{}'.format(keywords), + vid=u('{}').format(partition.identity.vid), + dataset_vid=u('{}').format(partition.identity.as_dataset().vid), + title=u('{}').format(partition.table.description), + keywords=u('{}').format(keywords), doc=doc_field) return document
2to3 for search_backends/base.py. #<I>.
CivicSpleen_ambry
train
py
11ba8958cb5b397f8abdec7b1e10f0ae9f575373
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 @@ -14,6 +14,7 @@ import sys import os +import sphinx_rtd_theme # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -99,7 +100,8 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +#html_theme = 'default' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -108,6 +110,7 @@ html_theme = 'default' # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation".
- added sphinx_rtd_theme
vsjha18_nsetools
train
py
7b473fc78fab5b112dfa5fa72b35521a33fec151
diff --git a/src/EntryPoint.php b/src/EntryPoint.php index <HASH>..<HASH> 100644 --- a/src/EntryPoint.php +++ b/src/EntryPoint.php @@ -126,7 +126,10 @@ class EntryPoint } if (!is_null(self::$instance)) { - return self::$instance->getInstance(); + $instance = self::$instance->getInstance(); + $instance->setCurrentUser($sugarUserId); + + return $instance; } $instance = new self($sugarApp, $sugarUserId); @@ -289,8 +292,8 @@ class EntryPoint define('sugarEntry', true); // @codingStandardsIgnoreEnd } - if (!defined('ENTRY_POINT_TYPE')) { - define('ENTRY_POINT_TYPE', 'api'); + if (!defined('BYPASS_COMPOSER_AUTOLOADER')) { + define('BYPASS_COMPOSER_AUTOLOADER', true); } // Save the variables as it is to make a diff later $beforeVars = get_defined_vars();
Remove useless constant and load current user when get entry point
inetprocess_libsugarcrm
train
php
da21baa6fa320488ba3a97ad90e73356dd0a02bd
diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb index <HASH>..<HASH> 100644 --- a/spec/dummy/config/routes.rb +++ b/spec/dummy/config/routes.rb @@ -1,5 +1,5 @@ Dummy::Application.routes.draw do - mount Teaspoon::Engine, at: '/teaspoon' if defined? Teaspoon + mount ::Teaspoon::Engine, at: '/teaspoon' if defined?(Teaspoon) devise_for :users, ActiveAdmin::Devise.config ActiveAdmin.routes(self)
Ensure correct Teaspoon::Engine Constant is used. Teaspoon Spring Command also defines a Teaspoon::Engine.
codevise_pageflow
train
rb
85109fe1dae6b0a0e4757d0650ff0058fe342739
diff --git a/test/lib/Elastica/IndexTest.php b/test/lib/Elastica/IndexTest.php index <HASH>..<HASH> 100755 --- a/test/lib/Elastica/IndexTest.php +++ b/test/lib/Elastica/IndexTest.php @@ -308,7 +308,7 @@ class Elastica_IndexTest extends PHPUnit_Framework_TestCase try { $index->delete(); - $this->fail('This should never be reached because the above code will throw an exception'); + $this->fail('This should never be reached. Deleting an unknown index will throw an exception'); } catch (Elastica_Exception_Response $error) { $response = $error->getResponse(); $this->assertTrue($response->hasError());
Perhaps this is a more clear explanation for a failure message
ruflin_Elastica
train
php
35b077af19917b868a0f24c9d9754b185a2ad6ec
diff --git a/satpy/readers/__init__.py b/satpy/readers/__init__.py index <HASH>..<HASH> 100644 --- a/satpy/readers/__init__.py +++ b/satpy/readers/__init__.py @@ -465,7 +465,15 @@ def _assign_files_to_readers(files_to_sort, reader_names, ppp_config_dir, files_to_sort = set(files_to_sort) D = {} for reader_configs in configs_for_reader(reader_names, ppp_config_dir): - reader = load_reader(reader_configs, **reader_kwargs) + try: + reader = load_reader(reader_configs, **reader_kwargs) + except yaml.constructor.ConstructorError as e: + LOG.exception( + f"ConstructorError loading {reader_configs!s}, " + "probably a missing dependency, skipping " + "corresponding reader (if you did not explicitly " + "specify the reader, Satpy tries all; performance " + "will improve if you pass readers explicitly).") reader_name = reader.info["name"] files_matching = set(reader.filter_selected_filenames(files_to_sort)) files_to_sort -= files_matching
When no reader passed, skip unimportables When no reader is passed to group_files and some readers can't be imported, skip those while logging the exception communicating the unimportability.
pytroll_satpy
train
py
9d9bb3d0a621be50558d028a3a238b5551af9822
diff --git a/src/Modelling/ModelState.php b/src/Modelling/ModelState.php index <HASH>..<HASH> 100644 --- a/src/Modelling/ModelState.php +++ b/src/Modelling/ModelState.php @@ -191,7 +191,7 @@ class ModelState implements \ArrayAccess, JsonSerializable * This protects the unwary developer from exposing internal secrets by using models that be serialised or * published. It is a chore to populate but it is better to be safe than sorry! * - * @return Array + * @return array */ protected function getPublicPropertyList() { @@ -202,7 +202,7 @@ class ModelState implements \ArrayAccess, JsonSerializable /** * Exports an array of model values that have been marked safe for public consumption. * - * @return Array + * @return array */ public final function exportPublicData() { @@ -249,7 +249,7 @@ class ModelState implements \ArrayAccess, JsonSerializable /** * Imports an array of model values that have been marked safe for public consumption. * - * @param Array $data + * @param array $data */ public final function importData($data) { @@ -404,7 +404,7 @@ class ModelState implements \ArrayAccess, JsonSerializable * The data does not pass through any applicable Set methods or data transforms. If required to do so * call ImportData() instead, but understand the performance penalty of doing so. * - * @param Array $data + * @param array $data */ public function importRawData($data) {
fixed array type return doc comment IDEs such as PHPStorm can percieve a differentce between the "array" primitive and "Array". Which is super annoying.
RhubarbPHP_Rhubarb
train
php
fc80f3d73d4499b1fe7195d848b5cd61e8e36eb2
diff --git a/Form/Type/RelatedToManyMetadataType.php b/Form/Type/RelatedToManyMetadataType.php index <HASH>..<HASH> 100644 --- a/Form/Type/RelatedToManyMetadataType.php +++ b/Form/Type/RelatedToManyMetadataType.php @@ -42,7 +42,7 @@ class RelatedToManyMetadataType extends AbstractType { $resolver ->setDefaults(array( - 'type' => 'related_to_one_metadata', + 'entry_type' => RelatedToOneMetadataType::class, 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false,
Set compatible with sf3.x
IDCI-Consulting_SimpleMetadataBundle
train
php
2ce76561804301b9c83d292af01f5e8ca30d16e3
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java index <HASH>..<HASH> 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java @@ -285,7 +285,7 @@ public class PrivateDataManager extends Manager { StringBuilder buf = new StringBuilder(); buf.append("<query xmlns=\"jabber:iq:private\">"); if (privateData != null) { - privateData.toXML(); + buf.append(privateData.toXML()); } buf.append("</query>"); return buf.toString();
Fix PrivateDataResult.getChildElementXML() that method never worked correctly since <I> years, ie. the PrivateData was never added as element text. It's not surprisingly that this was not discovered in more then a decade, since Smack usually never *sends* those stanza but only receives them. But that's no reason to not fix it. :)
igniterealtime_Smack
train
java
bc9cc744e8c5f4f2fde84a19a742011d063278f9
diff --git a/cwltool/process.py b/cwltool/process.py index <HASH>..<HASH> 100644 --- a/cwltool/process.py +++ b/cwltool/process.py @@ -689,8 +689,8 @@ def mergedirs(listing): for e in listing: if e["basename"] not in ents: ents[e["basename"]] = e - elif e["class"] == "Directory": - ents[e["basename"]]["listing"].extend(e["listing"]) + elif e["class"] == "Directory" and e.get("listing"): + ents[e["basename"]].setdefault("listing", []).extend(e["listing"]) for e in ents.itervalues(): if e["class"] == "Directory" and "listing" in e: e["listing"] = mergedirs(e["listing"])
Fix mergedirs() so it doesn't fail if a Directory object lacks a listing field. (#<I>)
common-workflow-language_cwltool
train
py
078c9cc08de307a0778db7c3e7eafd018b2de3c9
diff --git a/client/lib/domains/dns/index.js b/client/lib/domains/dns/index.js index <HASH>..<HASH> 100644 --- a/client/lib/domains/dns/index.js +++ b/client/lib/domains/dns/index.js @@ -98,13 +98,12 @@ function getNormalizedData( fieldValues, selectedDomainName ) { var data = fieldValues; data.data = getFieldWithDot( data.data ); + data.name = getFieldWithDot( data.name ); if ( includes( [ 'A', 'AAAA' ], data.type ) ) { data.name = removeTrailingDomain( data.name, selectedDomainName ); } - data.name = getFieldWithDot( data.name ); - if ( data.target ) { data.target = getFieldWithDot( data.target ); }
Domains: properly handle add records for subdomains Previously, when the sudomain was more than one level deep (level.nextlevel.example.com), it "looked like" a domain to the getFieldWithDot and got added a '.' at the end resulting in registering a new record for level.nextlevel. - not something we want.
Automattic_wp-calypso
train
js
1a178054d6725479834c188b736bb2a92db62cf0
diff --git a/particles/distributions.py b/particles/distributions.py index <HASH>..<HASH> 100644 --- a/particles/distributions.py +++ b/particles/distributions.py @@ -817,7 +817,7 @@ class MvNormal(ProbDist): class IndepProd(ProbDist): """Product of independent univariate distributions. - The inputs/outputs of IndeProd are numpy ndarrays of shape (N,d), + The inputs/outputs of IndeProd are numpy ndarrays of shape (N,d), or (d), where d is the number of univariate distributions that are passed as arguments. @@ -854,10 +854,10 @@ class IndepProd(ProbDist): return np.stack([d.rvs(size=size) for d in self.dists], axis=1) def logpdf(self, x): - return sum([d.logpdf(x[:, i]) for i, d in enumerate(self.dists)]) + return sum([d.logpdf(x[..., i]) for i, d in enumerate(self.dists)]) def ppf(self, u): - return np.stack([d.ppf(u[:, i]) for i, d in enumerate(self.dists)], + return np.stack([d.ppf(u[..., i]) for i, d in enumerate(self.dists)], axis=1)
Fix #3: distributions.IndepProd now also accepts as input/output arrays of shape (d), (in addition to arrays of shape (N, d)); this is needed in smoothing algorithms (e.g. smoothing.backward_sampling)
nchopin_particles
train
py
55a2a1d6c88e798ee43d77f1e4be8869a9f6167f
diff --git a/src/transposition.js b/src/transposition.js index <HASH>..<HASH> 100644 --- a/src/transposition.js +++ b/src/transposition.js @@ -1,16 +1,16 @@ import Rx from 'rx' function transposeVTree(vTree) { - if (typeof vTree.data === `object` && vTree.data.static) { - return Rx.Observable.just(vTree) - } else if (!vTree) { + if (!vTree) { return null + } else if (typeof vTree.data === `object` && vTree.data.static) { + return Rx.Observable.just(vTree) } else if (typeof vTree.subscribe === `function`) { return vTree.flatMapLatest(transposeVTree) } else if (typeof vTree === `object`) { if (vTree.children && vTree.children.length > 0) { return Rx.Observable.combineLatest( - vTree.children.map(transposeVTree).filter(x => !!x), + vTree.children.map(transposeVTree).filter(x => x !== null), (...children) => ({ sel: vTree.sel, data: vTree.data,
fix(transposition): fix `null` value children switch around the if statements and fix filter() to remove null valued children from the vTree Close #9
TylorS_cycle-snabbdom
train
js
0c31257b0f456caca4f49bf982abd052f6ce15e3
diff --git a/octodns/provider/rackspace.py b/octodns/provider/rackspace.py index <HASH>..<HASH> 100644 --- a/octodns/provider/rackspace.py +++ b/octodns/provider/rackspace.py @@ -377,7 +377,7 @@ class RackspaceProvider(BaseProvider): prior_rs_record = transformer(change.existing, value) prior_key = self._key_for_record(prior_rs_record) next_rs_record = transformer(change.new, value) - next_key = self._key_for_record(prior_rs_record) + next_key = self._key_for_record(next_rs_record) next_rs_record["id"] = self._id_map[prior_key] del next_rs_record["type"] update_out.append(next_rs_record)
Use the correct record when computing the key.
github_octodns
train
py
b3c6f9dfb1a715912ca9b791c5cb3e80f6e58213
diff --git a/widgets/VisualTimer.js b/widgets/VisualTimer.js index <HASH>..<HASH> 100644 --- a/widgets/VisualTimer.js +++ b/widgets/VisualTimer.js @@ -40,6 +40,9 @@ function VisualTimer(options) { this.options = options; + this.options.update = 'undefined' === this.options.update ? + 1000 : this.options.update; + this.id = options.id; this.gameTimer = null; @@ -153,8 +156,6 @@ if (!options.milliseconds) return; - options.update = 1000; - if ('function' === typeof options.milliseconds) { options.milliseconds = options.milliseconds.call(node.game); }
Moved options.update from listener to constructor
nodeGame_nodegame-widgets
train
js
f3af650f8dcdd21a629dd371e564a7aea8a51e99
diff --git a/src/Composer/Satis/Command/BuildCommand.php b/src/Composer/Satis/Command/BuildCommand.php index <HASH>..<HASH> 100644 --- a/src/Composer/Satis/Command/BuildCommand.php +++ b/src/Composer/Satis/Command/BuildCommand.php @@ -396,7 +396,7 @@ EOT $filesystem->ensureDirectoryExists($downloadDir); $downloadManager->download($package, $downloadDir, false); $filesystem->ensureDirectoryExists($directory); - copy($downloadDir . '/' . pathinfo($package->getDistUrl(), PATHINFO_BASENAME), $path); + $filesystem->rename($downloadDir . '/' . pathinfo($package->getDistUrl(), PATHINFO_BASENAME), $path); $filesystem->removeDirectory($downloadDir); } // Set archive format to `file` to tell composer to download it as is
Copy function call changed to Filesystem::rename
composer_satis
train
php
65718213d118c02b65d569fe066904041f9802e4
diff --git a/great_expectations/data_context/data_context.py b/great_expectations/data_context/data_context.py index <HASH>..<HASH> 100644 --- a/great_expectations/data_context/data_context.py +++ b/great_expectations/data_context/data_context.py @@ -1297,6 +1297,11 @@ class ConfigOnlyDataContext(object): logger.warning("Invalid parameter urn (not enough parts): %s" % parameter) continue + normalized_data_asset_name = self._normalize_data_asset_name(data_asset_name) + + data_asset_name = DataAssetIdentifier(normalized_data_asset_name.datasource, + normalized_data_asset_name.generator, + normalized_data_asset_name.generator_asset) if data_asset_name not in self._compiled_parameters["data_assets"]: self._compiled_parameters["data_assets"][data_asset_name] = {}
Switched to use DataAssetIdentifier as the key in _compiled_parameters - otherwise the lookup does not work
great-expectations_great_expectations
train
py
afbf5913ef4379bbe331fc33a09525f2876fba01
diff --git a/generators/entity/templates/server/src/main/java/package/service/mapper/_EntityMapper.java b/generators/entity/templates/server/src/main/java/package/service/mapper/_EntityMapper.java index <HASH>..<HASH> 100644 --- a/generators/entity/templates/server/src/main/java/package/service/mapper/_EntityMapper.java +++ b/generators/entity/templates/server/src/main/java/package/service/mapper/_EntityMapper.java @@ -47,7 +47,7 @@ for (idx in relationships) { List<<%= entityClass %>> <%= entityInstance %>DTOsTo<%= entityClassPlural %>(List<<%= entityClass %>DTO> <%= entityInstance %>DTOs); /** * generating the fromId for all mappers if the databaseType is sql, as the class has relationship to it might need it, instead of - * creating a new attribute to know if the enitity has any relationship from someother entity + * creating a new attribute to know if the entity has any relationship from some other entity */ <%if(databaseType === 'sql') { %> default <%= entityClass %> <%= entityInstance %>FromId(Long id) {
correcting typos. thanks @ruddell
jhipster_generator-jhipster
train
java
af047459373a2c0757a489997c6b24a0799cd7aa
diff --git a/OpenPNM/Network/__GenericNetwork__.py b/OpenPNM/Network/__GenericNetwork__.py index <HASH>..<HASH> 100644 --- a/OpenPNM/Network/__GenericNetwork__.py +++ b/OpenPNM/Network/__GenericNetwork__.py @@ -885,8 +885,8 @@ class GenericNetwork(OpenPNM.Utilities.Tools): else: raise Exception('Mask received was neither Nt nor Np long') self.create_adjacency_matrix(prop='temp', data=temp, sprsfmt='csr', dropzeros=True) - clusters = sprs.csgraph.connected_components(self.adjacency_matrix['csr']['temp'])[1] - del self.adjacency_matrix['csr']['temp'] + clusters = sprs.csgraph.connected_components(self._adjacency_matrix['csr']['temp'])[1] + del self._adjacency_matrix['csr']['temp'] return clusters if __name__ == '__main__':
missed a spot when renaming the adjacency matrices. Former-commit-id: <I>a<I>c8e3e<I>fdd6d4c6b<I>a0f<I>fba<I> Former-commit-id: <I>e<I>a<I>f1a5a6f8b<I>facb9e<I>f<I>b<I>ae3b3f
PMEAL_OpenPNM
train
py
6c1928a0311c85de6055ab1f28d4e04041be256e
diff --git a/src/org/mozilla/javascript/ScriptRuntime.java b/src/org/mozilla/javascript/ScriptRuntime.java index <HASH>..<HASH> 100644 --- a/src/org/mozilla/javascript/ScriptRuntime.java +++ b/src/org/mozilla/javascript/ScriptRuntime.java @@ -2938,6 +2938,12 @@ public class ScriptRuntime { errorObject, "javaException", wrap, ScriptableObject.PERMANENT | ScriptableObject.READONLY); } + if (re != null) { + Object wrap = cx.getWrapFactory().wrap(cx, scope, re, null); + ScriptableObject.defineProperty( + errorObject, "rhinoException", wrap, + ScriptableObject.PERMANENT | ScriptableObject.READONLY); + } obj = errorObject; }
RFE <I>: access to underlying RhinoException in rethrown error objects
mozilla_rhino
train
java
51d56f9756b922513e5024a26905b8134f1f554f
diff --git a/plugins/file-highlight/prism-file-highlight.js b/plugins/file-highlight/prism-file-highlight.js index <HASH>..<HASH> 100644 --- a/plugins/file-highlight/prism-file-highlight.js +++ b/plugins/file-highlight/prism-file-highlight.js @@ -9,7 +9,8 @@ var Extensions = { 'html': 'markup', 'svg': 'markup', 'xml': 'markup', - 'py': 'python' + 'py': 'python', + 'rb': 'ruby' }; Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre) { @@ -50,4 +51,4 @@ Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(f xhr.send(null); }); -})(); \ No newline at end of file +})();
Adding support for .rb extension Fixes #<I>
PrismJS_prism
train
js
f5c6d56c223948657662fe0a918f5cf6950719e5
diff --git a/web/concrete/controllers/single_page/dashboard/blocks/stacks.php b/web/concrete/controllers/single_page/dashboard/blocks/stacks.php index <HASH>..<HASH> 100644 --- a/web/concrete/controllers/single_page/dashboard/blocks/stacks.php +++ b/web/concrete/controllers/single_page/dashboard/blocks/stacks.php @@ -230,11 +230,10 @@ class Stacks extends DashboardPageController $this->deliverStackList($stm); } else { $root = Page::getByPath(STACKS_PAGE_PATH); - if ($root->getCollectionID() == $cID) { - $this->view(); - } else { - throw new Exception(t('Invalid stack')); + if ($root->getCollectionID() != $cID) { + $this->error->add(t('Invalid stack')); } + $this->view(); } } }
Don't throw that ugly exception Former-commit-id: eb<I>b2a8e<I>ef<I>dc<I>f5d<I>f2acd3ddfb Former-commit-id: aab8e<I>f1cf3f<I>c<I>da<I>e4f<I>b9b<I>
concrete5_concrete5
train
php
bc077131bfdef8a35e54bdb61089914d376fdc59
diff --git a/src/middleware.js b/src/middleware.js index <HASH>..<HASH> 100644 --- a/src/middleware.js +++ b/src/middleware.js @@ -4,11 +4,11 @@ class Middleware { } before(event) { - + return event } after(event) { - + return event } }
Make sure stub methods return event.
surebot_Eventline
train
js
2396be2379782f278836ec7e3c4287cdfb13c43e
diff --git a/lib/chore/cli.rb b/lib/chore/cli.rb index <HASH>..<HASH> 100644 --- a/lib/chore/cli.rb +++ b/lib/chore/cli.rb @@ -167,6 +167,7 @@ module Chore if File.directory?(options[:require]) require 'rails' + require 'chore/railtie' require File.expand_path("#{options[:require]}/config/environment.rb") ::Rails.application.eager_load! else diff --git a/lib/chore/railtie.rb b/lib/chore/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/chore/railtie.rb +++ b/lib/chore/railtie.rb @@ -3,5 +3,15 @@ module Chore rake_tasks do Dir[File.join(File.dirname(__FILE__),'tasks/*.task')].each { |f| load f } end + + config.after_initialize do + if Chore.configuring? + # Reset the logger on forks to avoid deadlocks + Rails.logger = Chore.logger + Chore.add_hook(:after_fork) do |worker| + Rails.logger = Chore.logger + end + end + end end -end +end \ No newline at end of file
Reset the Rails logger after being forked
Tapjoy_chore
train
rb,rb
efe9077071ede5b6646b91b697238d790bcb7120
diff --git a/tools/scheduler.py b/tools/scheduler.py index <HASH>..<HASH> 100644 --- a/tools/scheduler.py +++ b/tools/scheduler.py @@ -494,10 +494,14 @@ class MPIScheduler(BaseScheduler): cpus, mem = self.getResource(offer) logger.debug('got resource offer %s: cpus:%s, mem:%s at %s', offer.id.value, cpus, mem, offer.hostname) - if launched >= self.options.tasks or offer.hostname in used_hosts: + if launched >= self.options.tasks: driver.declineOffer(offer.id, REFUSE_FILTER) continue + if offer.hostname in used_hosts: + driver.declineOffer(offer.id) + continue + attrs = self.getAttributes(offer) group = attrs.get('group', 'None') if (self.options.group or group.startswith(
reject offer temporarily when resources are still pending.
douban_dpark
train
py
47521bdb2a504b25781f7c7ca2a24331574a8b36
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,4 @@ -import AutoForm from './AutoForm.js'; -import ComponentFactory from './ComponentFactory.js'; -import DefaultComponentFactory from './DefaultEditComponentFactory'; -import './less/styles.less'; - -export default { - AutoForm, - ComponentFactory, - DefaultComponentFactory -} +export AutoForm from './AutoForm.js'; +export ComponentFactory from './ComponentFactory.js'; +export DefaultEditComponentFactory from './DefaultEditComponentFactory'; +export DefaultDetailsComponentFactory from './DefaultDetailsComponentFactory'; \ No newline at end of file
Fixing the index.js exports
redux-autoform_redux-autoform
train
js
636543ba11711ae19ce960bc8aa6dc9f4526d334
diff --git a/spec/guard/notifier_spec.rb b/spec/guard/notifier_spec.rb index <HASH>..<HASH> 100644 --- a/spec/guard/notifier_spec.rb +++ b/spec/guard/notifier_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' describe Guard::Notifier do subject { Guard::Notifier } - + describe "notify" do before(:each) { ENV["GUARD_ENV"] = 'special_test' } - + if mac? require 'growl' it "should use Growl on Mac OS X" do @@ -17,7 +17,7 @@ describe Guard::Notifier do subject.notify 'great', :title => 'Guard' end end - + if linux? require 'libnotify' it "should use Libnotify on Linux" do @@ -29,8 +29,28 @@ describe Guard::Notifier do subject.notify 'great', :title => 'Guard' end end - + + context "turned off" do + before(:each) { subject.turn_off } + + if mac? + require 'growl' + it "should do nothing" do + Growl.should_not_receive(:notify) + subject.notify 'great', :title => 'Guard' + end + end + + if linux? + require 'libnotify' + it "should do nothing" do + Libnotify.should_not_receive(:show) + subject.notify 'great', :title => 'Guard' + end + end + end + after(:each) { ENV["GUARD_ENV"] = 'test' } end - + end \ No newline at end of file
Added a command line option (-n false) to disable notifications (growl/libnotify). closed #<I>
guard_notiffany
train
rb
f518b27b34c249b6cbbc3431d49dd88584e13b02
diff --git a/Kwf/Model/Union.php b/Kwf/Model/Union.php index <HASH>..<HASH> 100644 --- a/Kwf/Model/Union.php +++ b/Kwf/Model/Union.php @@ -119,6 +119,8 @@ class Kwf_Model_Union extends Kwf_Model_Abstract } } else if ($expr instanceof Kwf_Model_Select_Expr_Sql) { return $expr; + } else if ($expr instanceof Kwf_Model_Select_Expr_Child_Contains) { + return $expr; } else { throw new Kwf_Exception_NotYetImplemented(); }
Forward ChildContains expression in union model. It's required to define dependency with the same key
koala-framework_koala-framework
train
php
140df21ecb7e3d0e885635448f379a4db7f5ae3f
diff --git a/lib/invoices.rb b/lib/invoices.rb index <HASH>..<HASH> 100644 --- a/lib/invoices.rb +++ b/lib/invoices.rb @@ -1,4 +1,5 @@ require "nokogiri" +require "date" module Blinksale class Invoice
Update lib/invoices.rb Need `require "date"` so that Date.strptime works; otherwise an exception is thrown (at least in Ruby <I>p<I>) Please patch and bump <I>. Thanks!
neaf_blinksale
train
rb
d0eda05f4de513f0c0089cc12b9d484d4bab87be
diff --git a/tests/minionswarm.py b/tests/minionswarm.py index <HASH>..<HASH> 100644 --- a/tests/minionswarm.py +++ b/tests/minionswarm.py @@ -263,6 +263,8 @@ class MinionSwarm(Swarm): data['raet_port'] = self.raet_port data['pki_dir'] = os.path.join(dpath, 'pki') self.raet_port += 1 + elif self.opts['transport'] == 'tcp': + data['transport'] = 'tcp' if self.opts['root_dir']: data['root_dir'] = self.opts['root_dir']
Fix bug preventing minionswarm from working with tcp transport
saltstack_salt
train
py
5e6b63e6438353f90a6195d8ce7ea66ac4320f17
diff --git a/renku/cli/_git.py b/renku/cli/_git.py index <HASH>..<HASH> 100644 --- a/renku/cli/_git.py +++ b/renku/cli/_git.py @@ -20,12 +20,19 @@ import os import sys from contextlib import contextmanager +from email.utils import formatdate import click +from git import Actor from renku import errors +from renku.version import __version__ GIT_KEY = 'renku.git' +COMMITTER = Actor( + 'renku {0}'.format(__version__), + 'renku+{0}@datascience.ch'.format(__version__), +) def set_git_home(value): @@ -136,6 +143,8 @@ def with_git( # is_ancestor('origin/master', 'HEAD') pass + author_date = formatdate(localtime=True) + yield if commit: @@ -145,7 +154,12 @@ def with_git( repo.git.add('--all') argv = [os.path.basename(sys.argv[0])] + sys.argv[1:] # Ignore pre-commit hooks since we have already done everything. - repo.index.commit(' '.join(argv), skip_hooks=True) + repo.index.commit( + ' '.join(argv), + author_date=author_date, + committer=COMMITTER, + skip_hooks=True, + ) finally: os.chdir(current_dir)
cli: record execution length (closes #<I>)
SwissDataScienceCenter_renku-python
train
py
eeb12c76698eedecbeb54585deffca605bd7096b
diff --git a/python/setup.py b/python/setup.py index <HASH>..<HASH> 100644 --- a/python/setup.py +++ b/python/setup.py @@ -25,7 +25,7 @@ else: setup( name = 'cm_api', - version = '1.0', # Compatible with API v1 + version = '1.0.0', # Compatible with API v1 packages = find_packages('src'), package_dir = {'cm_api': 'src/cm_api'}, @@ -35,6 +35,6 @@ setup( author = 'Cloudera, Inc.', description = 'Cloudera Manager API client', - license = 'Proprietary', - url = 'http://www.cloudera.com/', + license = 'Apache License 2.0', + url = 'https://github.com/cloudera/cm_api', )
Package metadata should have ASL2 as license
cloudera_cm_api
train
py
ae52042cf2d18bb3ae28c809fb3202c88c7741af
diff --git a/raven/contrib/flask.py b/raven/contrib/flask.py index <HASH>..<HASH> 100644 --- a/raven/contrib/flask.py +++ b/raven/contrib/flask.py @@ -223,7 +223,8 @@ class Sentry(object): self.client.user_context(self.get_user_info(request)) def after_request(self, sender, response, *args, **kwargs): - response.headers['X-Sentry-ID'] = self.last_event_id + if self.last_event_id: + response.headers['X-Sentry-ID'] = self.last_event_id self.client.context.clear() return response
Don't send X-Sentry-ID when last_event_id is None
getsentry_raven-python
train
py
cc700c82c943da824794d0994378c07002ce3aff
diff --git a/tests/unit/components/sl-date-range-picker-test.js b/tests/unit/components/sl-date-range-picker-test.js index <HASH>..<HASH> 100755 --- a/tests/unit/components/sl-date-range-picker-test.js +++ b/tests/unit/components/sl-date-range-picker-test.js @@ -97,9 +97,6 @@ test( 'Latest start date is the based on max date and end date', function( asser test( 'Events from start date input are removed upon willClearRender', function( assert ) { const component = this.subject(); - - this.render(); - const startDateInput = this.$( '.sl-daterange-start-date input' )[ 0 ]; const jQueryData = Ember.get( Ember.$, '_data' );
Closes softlayer/sl-ember-components#<I>
softlayer_sl-ember-components
train
js
0317c3d5a0339d5e658c52fcc9dad06748b5ca1d
diff --git a/src/lib/Supra/Controller/Pages/Email/EmailEncoder.php b/src/lib/Supra/Controller/Pages/Email/EmailEncoder.php index <HASH>..<HASH> 100644 --- a/src/lib/Supra/Controller/Pages/Email/EmailEncoder.php +++ b/src/lib/Supra/Controller/Pages/Email/EmailEncoder.php @@ -26,8 +26,8 @@ class EmailEncoder $alreadySubscribed = $em->getListeners(PageController::EVENT_POST_PREPARE_CONTENT); foreach ($alreadySubscribed as $listener) { - if ($listener instanceof EncoderEventListener) { - $em->removeListener(PageController::EVENT_POST_PREPARE_CONTENT, $listener); + if ($listener[0] instanceof EncoderEventListener) { + $em->removeListener(PageController::EVENT_POST_PREPARE_CONTENT, $listener[0]); } }
Fixed bug in EmailEncoder class caused multiple decipher js files to be attached to context
sitesupra_sitesupra
train
php
b1ce3c872a98f09aeb0b2048afa3e64d6127b988
diff --git a/munigeo/importer/helsinki.py b/munigeo/importer/helsinki.py index <HASH>..<HASH> 100644 --- a/munigeo/importer/helsinki.py +++ b/munigeo/importer/helsinki.py @@ -248,7 +248,7 @@ class HelsinkiImporter(Importer): sep = '&' else: sep = '?' - url = wfs_url + sep + 'typeName=' + div['wfs_layer'] + '&' + "srsName=EPSG:%d" % PROJECTION_SRID + url = wfs_url + sep + 'typeName=' + div['wfs_layer'] + '&' + "srsName=EPSG:%d" % PROJECTION_SRID + '&' + "outputFormat=application/json" ds = DataSource(url) lyr = ds[0] assert len(ds) == 1
Request all data in GeoJSON-format, preventing curve geometries GDAL wrapper in Django cannot handle curve geometries. Easiest way to them being output is to request GeoJSON, which cannot contain them. This might cause the WFS server to silently convert curve geometries to their linear approximations. The alternative would be to miss those geometries entirely.
City-of-Helsinki_django-munigeo
train
py
3c772f7f087f805fde4cb45cc3f9181fdb9d4dd7
diff --git a/lib/nicorepo.rb b/lib/nicorepo.rb index <HASH>..<HASH> 100644 --- a/lib/nicorepo.rb +++ b/lib/nicorepo.rb @@ -77,15 +77,9 @@ class Nicorepo end def parse_kind(node) - case node['class'] - when /video-upload/ then 'video' - when /live-broadcast/ then 'live' - when /seiga-image-upload/ then 'seiga' - when /mylist-add/ then 'mylisted' - when /clip/ then 'clip' - when /register-chblog/ then 'blog' - else 'other' - end + cls = node['class'] + index = cls.index(/(user|community)\-/) + cls[index..cls.size] end end
change how to have a value of log-kinds
upinetree_nicorepo
train
rb
cc854603287f8c24e9c020481bade4ebbcc786d9
diff --git a/src/Models/ForeignRelationship.php b/src/Models/ForeignRelationship.php index <HASH>..<HASH> 100644 --- a/src/Models/ForeignRelationship.php +++ b/src/Models/ForeignRelationship.php @@ -27,6 +27,7 @@ class ForeignRelationship implements JsonWriter 'hasManyThrough', 'morphTo', 'morphMany', + 'morphOne', 'morphToMany', ]; @@ -107,6 +108,7 @@ class ForeignRelationship implements JsonWriter return in_array($this->type, [ 'hasOne', 'belongsTo', + 'morphOne', 'morphTo', ]); }
Add morphOne to supported relation types
CrestApps_laravel-code-generator
train
php
e9cc618678a4805c74c125eaf96f4a73990e8ff6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*', install_requires=[ 'clldutils>=1.13.10', - 'csvw>=1.1.0', + 'csvw>=1.2.0', 'uritemplate>=3.0', 'python-dateutil', 'pybtex', diff --git a/src/pycldf/dataset.py b/src/pycldf/dataset.py index <HASH>..<HASH> 100644 --- a/src/pycldf/dataset.py +++ b/src/pycldf/dataset.py @@ -453,11 +453,7 @@ class Dataset(object): self.write_sources() for table_type, items in table_items.items(): table = self[table_type] - table.write(items) - try: - table.common_props['dc:extent'] = len(items) - except TypeError: - table.common_props.pop('dc:extent', None) + table.common_props['dc:extent'] = table.write(items) class Generic(Dataset):
exploit enhanced API of csvw
cldf_pycldf
train
py,py
7bb7707d27ba414df8053ebb7cbf4ac4f9a56cb5
diff --git a/helpers/urlutils.py b/helpers/urlutils.py index <HASH>..<HASH> 100644 --- a/helpers/urlutils.py +++ b/helpers/urlutils.py @@ -58,7 +58,7 @@ def get_title(url): else: title = "Title Not Found" except (timeout, HTTPError) as e: - raise CommandFailedException(e) + raise CommandFailedException('HTTP Error %d' % e.code) except ConnectionResetError as e: raise CommandFailedException(e.strerror) except URLError as e:
fix #<I> nytimes stupid
tjcsl_cslbot
train
py
c8ada5a5b4a565f4721ecc5e468735b190460071
diff --git a/src/Codeception/Lib/Connector/ZF1.php b/src/Codeception/Lib/Connector/ZF1.php index <HASH>..<HASH> 100644 --- a/src/Codeception/Lib/Connector/ZF1.php +++ b/src/Codeception/Lib/Connector/ZF1.php @@ -64,7 +64,12 @@ class ZF1 extends Client $this->front->setRequest($zendRequest)->setResponse($zendResponse); ob_start(); - $this->bootstrap->run(); + try { + $this->bootstrap->run(); + } catch (\Exception $e) { + ob_end_clean(); + throw $e; + } ob_end_clean(); $this->zendRequest = $zendRequest;
Catch exception and close output buffer to avoid 'risky test' mark
Codeception_base
train
php
957016234b974ee18887500416c844f8945fd9ee
diff --git a/lib/puppet/provider/package/yum.rb b/lib/puppet/provider/package/yum.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/provider/package/yum.rb +++ b/lib/puppet/provider/package/yum.rb @@ -7,8 +7,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do remove dependent packages with this provider use the `purgeable` feature, but note this feature is destructive and should be used with the utmost care." - has_feature :install_options - has_feature :versionable + has_feature :install_options, :versionable commands :yum => "yum", :rpm => "rpm", :python => "python"
(PUP-<I>) Changing the has_feature to a one-liner
puppetlabs_puppet
train
rb
be5a5617ef0e4ae4e2b25cce383d7be2ce584cf7
diff --git a/font.go b/font.go index <HASH>..<HASH> 100644 --- a/font.go +++ b/font.go @@ -87,6 +87,10 @@ func SetFontFolder(folder string) { fontFolder = filepath.Clean(folder) } +func SetFontNamer(fn FontFileNamer) { + fontNamer = fn +} + func loadFont(fontFileName string) *truetype.Font { fontBytes, err := ioutil.ReadFile(path.Join(fontFolder, fontFileName)) if err != nil {
Add SetFontNamer func. SetFontNamer changs draw2d's default font naming convention. Accepts a func of type FontFileNamer, which accepts a FontData and returns the filename as a string.
llgcode_draw2d
train
go
f48a15a7961ffa59f286284b530bf0aec619390c
diff --git a/lib/foreman_ansible_core/runner/ansible_runner.rb b/lib/foreman_ansible_core/runner/ansible_runner.rb index <HASH>..<HASH> 100644 --- a/lib/foreman_ansible_core/runner/ansible_runner.rb +++ b/lib/foreman_ansible_core/runner/ansible_runner.rb @@ -62,7 +62,7 @@ module ForemanAnsibleCore when 'runner_on_unreachable' publish_exit_status_for(hostname, 1) when 'runner_on_failed' - publish_exit_status_for(hostname, 2) if event['ignore_errors'].nil? + publish_exit_status_for(hostname, 2) if event.dig('event_data', 'ignore_errors').nil? end end
Fixes #<I> - Ignore errors for task event (#<I>)
theforeman_foreman_ansible
train
rb
eb4ae0764841a91154cb029e7cfe0bbc0a1c1b3b
diff --git a/src/satosa/state.py b/src/satosa/state.py index <HASH>..<HASH> 100644 --- a/src/satosa/state.py +++ b/src/satosa/state.py @@ -167,6 +167,10 @@ class State(object): """ self._state_dict = {} self.delete = False + + if urlstate_data and not encryption_key: + raise ValueError("If an 'urlstate_data' is supplied 'encrypt_key' must be specified.") + if urlstate_data is not None: urlstate_data = urlstate_data.encode("utf-8") urlstate_data = base64.urlsafe_b64decode(urlstate_data)
Verify decryption key is supplied to State if reconstructing it.
IdentityPython_SATOSA
train
py
67c21c5ab97f49e6bb1c8d2cca4e6582f1949c09
diff --git a/src/Guzzle/Cache/DoctrineCacheAdapter.php b/src/Guzzle/Cache/DoctrineCacheAdapter.php index <HASH>..<HASH> 100644 --- a/src/Guzzle/Cache/DoctrineCacheAdapter.php +++ b/src/Guzzle/Cache/DoctrineCacheAdapter.php @@ -36,6 +36,6 @@ class DoctrineCacheAdapter extends AbstractCacheAdapter public function save($id, $data, $lifeTime = false, array $options = null) { - return $this->cache->save($id, $data, $lifeTime); + return $this->cache->save($id, $data, $lifeTime !== false ? $lifeTime : 0); } }
Doctrine does not allow 'false' as cache lifetime
guzzle_guzzle3
train
php
ab3f17b8312f6a264d76ab8f25b3a6b2df14b7a9
diff --git a/js/data/LocalStorage.js b/js/data/LocalStorage.js index <HASH>..<HASH> 100644 --- a/js/data/LocalStorage.js +++ b/js/data/LocalStorage.js @@ -23,7 +23,7 @@ define(['js/core/Component' , 'inherit'], function (Component, inherit) { } } - window.localStorage = window.localStorage || new LocalStorage.CookieImplementation(document); + this.$implementation = this.$implementation || new LocalStorage.CookieImplementation(document); } else { this.$implementation = new LocalStorage.ObjectImplementation();
fixed feature detection for localstorage for 3rd party applications
rappid_rAppid.js
train
js
97d88fe7fb9290625ea97aeebef80b9494627ff9
diff --git a/phing/phingcludes/BehatTask.php b/phing/phingcludes/BehatTask.php index <HASH>..<HASH> 100644 --- a/phing/phingcludes/BehatTask.php +++ b/phing/phingcludes/BehatTask.php @@ -422,7 +422,7 @@ class BehatTask extends Task } if ($this->tags) { - $this->options['tags'] = $this->tags; + $this->options['tags'] = '"' . $this->tags . '"'; } if ($this->format) {
Adding quotes to Behat tags. (#<I>)
acquia_blt
train
php
1f47a6cca2d8972abfcac89a9f9b86e9bb54a817
diff --git a/src/components/victory-voronoi/helper-methods.js b/src/components/victory-voronoi/helper-methods.js index <HASH>..<HASH> 100644 --- a/src/components/victory-voronoi/helper-methods.js +++ b/src/components/victory-voronoi/helper-methods.js @@ -25,14 +25,14 @@ export default { childProps[eventKey] = { data: dataProps }; const text = this.getLabelText(props, datum, index); if (text !== undefined && text !== null || events || sharedEvents) { - childProps[eventKey].labels = this.getLabelProps(dataProps, text, style); + childProps[eventKey].labels = this.getLabelProps(dataProps, text, style, theme); } return childProps; }, initialChildProps); }, - getLabelProps(dataProps, text, calculatedStyle) { + getLabelProps(dataProps, text, calculatedStyle, theme) { const { x, y, index, scale, datum, data } = dataProps; const labelStyle = this.getLabelStyle(calculatedStyle.labels, dataProps) || {}; return { @@ -46,7 +46,8 @@ export default { data, textAnchor: labelStyle.textAnchor, verticalAnchor: labelStyle.verticalAnchor || "end", - angle: labelStyle.angle + angle: labelStyle.angle, + theme }; },
Ensure theme is passed through to labels
FormidableLabs_victory
train
js
2753a848711aaafb7054b98b343969fae3659bb1
diff --git a/lib/sequent/core/workflow.rb b/lib/sequent/core/workflow.rb index <HASH>..<HASH> 100644 --- a/lib/sequent/core/workflow.rb +++ b/lib/sequent/core/workflow.rb @@ -6,7 +6,7 @@ module Sequent include Helpers::SelfApplier def execute_commands(*commands) - Sequent.configuration.instance.command_service.execute_commands(*commands) + Sequent.configuration.command_service.execute_commands(*commands) end end end
Fix `Workflow`s access to `command_service`
zilverline_sequent
train
rb
1f5ead77faeb71abc5ce999d6010e41e02b4ac5c
diff --git a/src/Analyser/Derive.php b/src/Analyser/Derive.php index <HASH>..<HASH> 100644 --- a/src/Analyser/Derive.php +++ b/src/Analyser/Derive.php @@ -414,6 +414,7 @@ trait Derive if (empty($this->data->device->model)) { $this->data->device->manufacturer = 'Apple'; $this->data->device->model = 'Macintosh'; + $this->data->device->identified |= Constants\Id::INFER; $this->data->device->hidden = true; } } @@ -423,6 +424,7 @@ trait Derive if ($this->data->os->name == 'iOS') { if (empty($this->data->device->model)) { $this->data->device->manufacturer = 'Apple'; + $this->data->device->identified |= Constants\Id::INFER; $this->data->device->hidden = true; } }
Set device->identified for derive Apple devices to INFER
WhichBrowser_Parser-PHP
train
php
eb71ce290b8400d92ae67c04d18a84dadef9aca3
diff --git a/lib/WebSocketConnection.js b/lib/WebSocketConnection.js index <HASH>..<HASH> 100644 --- a/lib/WebSocketConnection.js +++ b/lib/WebSocketConnection.js @@ -98,6 +98,12 @@ WebSocketConnection.prototype.handleSocketData = function(data) { return; } + // For now since we don't support extensions, all RSV bits are illegal + if (this.currentFrame.rsv1 || this.currentFrame.rsv2 || this.currentFrame.rsv3) { + this.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, + "Unsupported usage of rsv bits without negotiated extension."); + } + if (!this.assembleFragments) { this.emit('frame', this.currentFrame); }
Dropping connection on unsupported usage of RSV bits.
theturtle32_WebSocket-Node
train
js
635e01cbed1acfde4779eaa696ea5d68fc973d82
diff --git a/src/module-elasticsuite-catalog/view/adminhtml/web/js/category/filter-config/record.js b/src/module-elasticsuite-catalog/view/adminhtml/web/js/category/filter-config/record.js index <HASH>..<HASH> 100644 --- a/src/module-elasticsuite-catalog/view/adminhtml/web/js/category/filter-config/record.js +++ b/src/module-elasticsuite-catalog/view/adminhtml/web/js/category/filter-config/record.js @@ -39,10 +39,15 @@ define(['Magento_Ui/js/dynamic-rows/record'], function (Component) { onPinChange : function() { if (this.data() && this.data().is_pinned !== undefined) { this.isPinned(this.data().is_pinned); - if (this.isPinned()) { - this.position = this.parentComponent().getPinnedRecords().length + 1; + // Wait for full initialization of record (and its parent component). + if (this.elems().length > 0) { + if (this.isPinned()) { + // Parent's getPinnedRecords relies on this.isPinned() so temporary new position is actually one more than expected. + this.position = this.parentComponent().getPinnedRecords().length + 1; + } + // Sort method signature expected parameters are not actually used. Note that all records position are re-computed. + this.parentComponent().sort(this.position, this); } - this.parentComponent().sort(this.position, this); } },
Fixes #<I> Prevent already pinned attr order loss on components initialization.
Smile-SA_elasticsuite
train
js
dde0912d1e97862257f97e05bd75a08672dc7504
diff --git a/lib/Cake/Model/ConnectionManager.php b/lib/Cake/Model/ConnectionManager.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Model/ConnectionManager.php +++ b/lib/Cake/Model/ConnectionManager.php @@ -99,17 +99,16 @@ class ConnectionManager { $conn = self::$_connectionsEnum[$name]; $class = $conn['classname']; - $instance = new $class(self::$config->{$name}); - $instance->configKeyName = $name; - - if (!$instance instanceof Datasource) { + if (strpos(App::location($class), 'Datasource') === false) { throw new MissingDatasourceException(array( 'class' => $class, 'plugin' => null, - 'message' => 'Only classes extending Datasource can be used as datasources.' + 'message' => 'Datasource is not found in Model/Datasource package.' )); } - self::$_dataSources[$name] = $instance; + self::$_dataSources[$name] = new $class(self::$config->{$name}); + self::$_dataSources[$name]->configKeyName = $name; + return self::$_dataSources[$name]; }
Throw exceptions only when datasource has wrong package, not check for instance of Datasource
cakephp_cakephp
train
php
88e675b9874d6c44ed5026b101158c09f7cfe818
diff --git a/lib/python/dxpy/bindings/__init__.py b/lib/python/dxpy/bindings/__init__.py index <HASH>..<HASH> 100644 --- a/lib/python/dxpy/bindings/__init__.py +++ b/lib/python/dxpy/bindings/__init__.py @@ -477,3 +477,4 @@ from dxrecord import * from dxproject import * from dxjob import * from dxprogram import * +#from search import *
convenience import - I think this is required for tests to pass, too?
dnanexus_dx-toolkit
train
py
4207beae0de12141f50185256cac6045896f8ed4
diff --git a/gossipsub.go b/gossipsub.go index <HASH>..<HASH> 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -356,10 +356,21 @@ func (gs *GossipSubRouter) AddPeer(p peer.ID, proto protocol.ID) { // track the connection direction outbound := false conns := gs.p.host.Network().ConnsToPeer(p) +loop: for _, c := range conns { if c.Stat().Direction == network.DirOutbound { - outbound = true - break + // only count the connection if it has a pubsub stream + for _, s := range c.GetStreams() { + switch s.Protocol() { + case FloodSubID: + fallthrough + case GossipSubID_v10: + fallthrough + case GossipSubID_v11: + outbound = true + break loop + } + } } } gs.outbound[p] = outbound
only count an outbound connection if it has a pubsub stream
libp2p_go-libp2p-pubsub
train
go
75ab4070b0feab266eca86387e483a38d68738b1
diff --git a/radicale_storage_etesync/etesync_cache.py b/radicale_storage_etesync/etesync_cache.py index <HASH>..<HASH> 100644 --- a/radicale_storage_etesync/etesync_cache.py +++ b/radicale_storage_etesync/etesync_cache.py @@ -43,6 +43,8 @@ class EteSyncCache: etesync = api.EteSync(user, auth_token, remote=self.remote_url, db_path=db_path) etesync.cipher_key = cipher_key - self._etesync_cache[user] = etesync + if False: + # XXX: Remove the cache for now, it doesn't save us much and is racey. See commit message + self._etesync_cache[user] = etesync return etesync, True
Disable the etesync cache to prevent race conditions The reason for that, is that with PeeWee, the database file is actually saved per process rather than per EteSync handle due to the database proxy. Since we were caching the etesync object, we were not reiniting the database, causing a race condition that would cause data to be saved on the wrong db.
etesync_radicale_storage_etesync
train
py
d5844a0e4e1153883242c659cbb9930cb96e0df6
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -10,10 +10,11 @@ var loginRequest = require('../lib/login/login-request'); describe('Register tests', function() { this.timeout(3000); + var random = Math.random() * 999; var user = { - username: 'test123', - email: 'test123@test1.com', - password: 'test123' + username: 'test' + random, + email: 'test123' + random + '@test1.com', + password: 'test123' + random }; before(function(done) {
random user account in test, should fix #<I>
jsonresume_resume-cli
train
js
8f2ed772f94ce6993d97c60cacf9cfa353b34149
diff --git a/Connection.php b/Connection.php index <HASH>..<HASH> 100644 --- a/Connection.php +++ b/Connection.php @@ -60,7 +60,7 @@ class Connection extends Component */ public $unixSocket; /** - * @var string the password for establishing DB connection. Defaults to null meaning no AUTH command is send. + * @var string the password for establishing DB connection. Defaults to null meaning no AUTH command is sent. * See http://redis.io/commands/auth */ public $password;
Fixed minor typo in documentation (#<I>) [skip ci]
yiisoft_yii2-redis
train
php
2cc5011e2fa9409bf7688c630f93a5a8ec17073b
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1151,7 +1151,7 @@ EOF; * * @return bool */ - private function hasReference($id, array $arguments, $deep = false, $visited = array()) + private function hasReference($id, array $arguments, $deep = false, &$visited = array()) { foreach ($arguments as $argument) { if (is_array($argument)) {
use visited lookup with reference to gain performance
symfony_symfony
train
php
e50c756d10ae888da3d18fe77512d0975eccb49f
diff --git a/src/utils/find-logfile.js b/src/utils/find-logfile.js index <HASH>..<HASH> 100644 --- a/src/utils/find-logfile.js +++ b/src/utils/find-logfile.js @@ -46,20 +46,20 @@ function findVCCLogFile () { modifiedTime = new Date(stats.mtime).getTime() } - debug(`Find LogFile: Comparing ${modifiedTime} to ${previous.timestap}`) + debug(`Find LogFile: Comparing ${modifiedTime} to ${previous.timestamp}`) - if (modifiedTime && modifiedTime > previous.timestap) { - return { file: current, timestap: modifiedTime } + if (modifiedTime && modifiedTime > previous.timestamp) { + return { file: current, timestamp: modifiedTime } } else { return previous } - }, { file: null, timestap: 0 }) + }, { file: null, timestamp: 0 }) debug(`Find LogFile: Returning ${lastModified.file}`) - matchingFile = lastModified.file + matchingFile = path.join(tmp, lastModified.file) } - - resolve(path.join(tmp, matchingFile)) + + resolve(matchingFile) }) }) }
:wrench: Fix error in log file finder
felixrieseberg_windows-build-tools
train
js
53db18ae032fe1cd81d2125bd79e534fa0d578a3
diff --git a/buildbot/status/mail.py b/buildbot/status/mail.py index <HASH>..<HASH> 100644 --- a/buildbot/status/mail.py +++ b/buildbot/status/mail.py @@ -101,18 +101,16 @@ def message(attrs): # # No source stamp # + source = "" if attrs['branch']: - source = "unavailable" + source += "[branch %s] " % attrs['branch'] + if attrs['revision']: + source += attrs['revision'] else: - source = "" - if attrs['branch']: - source += "[branch %s] " % attrs['branch'] - if attrs['revision']: - source += attrs['revision'] - else: - source += "HEAD" - if attrs['patch']: - source += " (plus patch)" + source += "HEAD" + if attrs['patch']: + source += " (plus patch)" + text += "Build Source Stamp: %s\n" % source text += "Blamelist: %s\n" % ",".join(attrs['responsibleUsers'])
Fixes #<I>: Create correct source stamp in email in all cases (including branch)
buildbot_buildbot
train
py
2da7e3d1234438e3ba50e04985c81e6d2498fbac
diff --git a/lakeside/__init__.py b/lakeside/__init__.py index <HASH>..<HASH> 100755 --- a/lakeside/__init__.py +++ b/lakeside/__init__.py @@ -72,10 +72,19 @@ class device: encrypted_packet = cipher.encrypt(raw_packet) - self.s.send(encrypted_packet) + try: + self.s.send(encrypted_packet) + except: + self.connect() + self.s.send(encrypted_packet) + if response: data = self.s.recv(1024) - + if (len(data) == 0): + self.connect() + self.s.send(encrypted_packet) + data = self.s.recv(1024) + cipher = AES.new(bytes(key), AES.MODE_CBC, bytes(iv)) decrypted_packet = cipher.decrypt(data)
Handle disconnection A terrible -- but working -- solution for issue #7. The disconnection is perceived during the `recv()`, so at receiving zero bytes, we do a reconnect, reissue the command, and receive data again. Definitely not the best solution for this, but at least it is working now.
google_python-lakeside
train
py
e56938627dde118136b7c9291ec56fb96d63d808
diff --git a/indra/sources/rlimsp/api.py b/indra/sources/rlimsp/api.py index <HASH>..<HASH> 100644 --- a/indra/sources/rlimsp/api.py +++ b/indra/sources/rlimsp/api.py @@ -1,9 +1,10 @@ __all__ = ['process_pmc'] -import json import logging import requests +from .processor import RlimspProcessor + logger = logging.getLogger(__name__) @@ -27,4 +28,6 @@ def process_pmc(pmc_id, output_fname=default_output_fname, with_grounding=True): raise RLIMSP_Error("Bad status code: %d - %s" % (resp.status_code, resp.reason)) - return + rp = RlimspProcessor(resp.json()) + + return rp
Use RLIMS-P Processor object.
sorgerlab_indra
train
py
b6f61b45ad721bf155c6a7ada6d0b6d63bcd0e03
diff --git a/pkg/codegen/dotnet/gen.go b/pkg/codegen/dotnet/gen.go index <HASH>..<HASH> 100644 --- a/pkg/codegen/dotnet/gen.go +++ b/pkg/codegen/dotnet/gen.go @@ -358,8 +358,16 @@ func (pt *plainType) genInputProperty(w io.Writer, prop *schema.Property, indent if prop.IsRequired { attributeArgs = ", required: true" } - if pt.res != nil && pt.res.IsProvider && prop.Type != schema.StringType { - attributeArgs += ", json: true" + if pt.res != nil && pt.res.IsProvider { + json := true + if prop.Type == schema.StringType { + json = false + } else if t, ok := prop.Type.(*schema.TokenType); ok && t.UnderlyingType == schema.StringType { + json = false + } + if json { + attributeArgs += ", json: true" + } } // Next generate the input property itself. The way this is generated depends on the type of the property:
Don't mark provider token string types with json attribute in C# (#<I>) Don't mark provider token string types with json attribute in C#
pulumi_pulumi
train
go
bfb6015428fa18eb5fb13ed982988190bb991605
diff --git a/tests/unit/utils/test_vmware.py b/tests/unit/utils/test_vmware.py index <HASH>..<HASH> 100644 --- a/tests/unit/utils/test_vmware.py +++ b/tests/unit/utils/test_vmware.py @@ -3244,7 +3244,6 @@ class GetHostsTestCase(TestCase): self.mock_si, datacenter_name='fake_datacenter', cluster_name='fake_cluster') mock_get_dc.assert_called_once_with(self.mock_si, 'fake_datacenter') - mock_get_cl.assert_called_once_with(mock_dc, 'fake_cluster') mock_get_mors.assert_called_once_with(self.mock_si, vim.HostSystem, container_ref=mock_dc,
Rename/consolidate salt.utils unit tests to conform to naming convention
saltstack_salt
train
py
6355994dcd9afe0483856c5e329d74d4d110c066
diff --git a/lib/Sender.js b/lib/Sender.js index <HASH>..<HASH> 100644 --- a/lib/Sender.js +++ b/lib/Sender.js @@ -176,7 +176,7 @@ function applyMaskToBuffer(buf, mask) { function getBufferFromData(data) { if (!data) return new Buffer(0); - if (data instanceof Buffer) return data; + if (data instanceof Buffer) return new Buffer(data); return (data && typeof data.buffer !== 'undefined') ? getArrayBuffer(data.buffer) : new Buffer(data);
copy buffer, to not overwrite outside data
websockets_ws
train
js
98b176f56f4add94d1770900c534e7415dc05ee5
diff --git a/lib/view.js b/lib/view.js index <HASH>..<HASH> 100644 --- a/lib/view.js +++ b/lib/view.js @@ -8,17 +8,38 @@ class View { constructor (viewId) { this.id = viewId + this.listeners = [] this.element = this.createElement() this.element.view = this this.bindFields() } + destroy () { + this.listeners.forEach((destroy) => destroy()) + this.listeners = [] + this.destroyChildren() + } + + destroyChildren () { + if (this.children) { + this.children.forEach((child) => child.destroy()) + this.children = [] + } + } + bindFields () { View.queryForEach(this.element, '[data-field]', (propertyElement) => { this[propertyElement.dataset.field] = propertyElement }) } + bindListener (emitter, event, callback) { + emitter.addEventListener(event, callback) + this.listeners.push(function () { + emitter.removeEventListener(event, callback) + }) + } + createElement () { const template = document.querySelector(`#${this.id}`).content return document.importNode(template, true).firstElementChild
Add helpers to clean up listeners and child views
electron_devtron
train
js
9288adff454e8843bf68f08cd1a1e4e204d3832c
diff --git a/wandb/wandb_torch.py b/wandb/wandb_torch.py index <HASH>..<HASH> 100644 --- a/wandb/wandb_torch.py +++ b/wandb/wandb_torch.py @@ -127,7 +127,7 @@ class TorchHistory(object): if (isinstance(tensor, tuple) or isinstance(tensor, list)): while (isinstance(tensor, tuple) or isinstance(tensor, list)) and (isinstance(tensor[0], tuple) or isinstance(tensor[0], list)): tensor = [item for sublist in tensor for item in sublist] - tensor = torch.cat([t.view(-1) for t in tensor]) + tensor = torch.cat([t.reshape(-1) for t in tensor]) # checking for inheritance from _TensorBase didn't work for some reason if not hasattr(tensor, 'shape'): @@ -162,7 +162,7 @@ class TorchHistory(object): sparse_zeros = all_values - non_zero_values tensor = backing_values - flat = tensor.view(-1) + flat = tensor.reshape(-1) # For pytorch 0.3 we use unoptimized numpy histograms (detach is new in 0.4) if not hasattr(flat, "detach"):
view->reshape (#<I>)
wandb_client
train
py
3de12906c8e5e27b2216642f0496a3efda8c4edd
diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index <HASH>..<HASH> 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -971,7 +971,7 @@ class Trainer: # Rebuild the deepspeed config to reflect the updated training parameters from transformers.deepspeed import HfDeepSpeedConfig - self.args.hf_deepspeed_config = HfDeepSpeedConfig(self.args) + self.args.hf_deepspeed_config = HfDeepSpeedConfig(self.args.deepspeed) def _report_to_hp_search( self, trial: Union["optuna.Trial", Dict[str, Any]], epoch: int, metrics: Dict[str, float]
fix: hfdeepspeed config argument (#<I>) `HfDeepSpeedConfig` accepts a dictionary or path to `.json` file containing DS configurations, not `TrainingArguments`.
huggingface_pytorch-pretrained-BERT
train
py
15baf090db1ac3c749df6581545a3e0bcd326e7b
diff --git a/modules/cmsadmin/resources/js/cmsadmin.js b/modules/cmsadmin/resources/js/cmsadmin.js index <HASH>..<HASH> 100644 --- a/modules/cmsadmin/resources/js/cmsadmin.js +++ b/modules/cmsadmin/resources/js/cmsadmin.js @@ -322,7 +322,7 @@ return FilterService.get(); }, menu : function(NewMenuService) { - return NewMenuService.get(true); + return NewMenuService.get(); } } }) @@ -452,6 +452,8 @@ */ $scope.AdminLangService.load(true); + NewMenuService.get(); + $scope.$watch(function() { return NewMenuService.data; }, function(n) { $scope.menu = n; });
fixed issue where default sidebar could not be loaded
luyadev_luya
train
js
42bea8dfd9e52bb305766ec186ad940763dd7a2a
diff --git a/lib/penman/record_tag.rb b/lib/penman/record_tag.rb index <HASH>..<HASH> 100644 --- a/lib/penman/record_tag.rb +++ b/lib/penman/record_tag.rb @@ -127,7 +127,7 @@ module Penman end def generate_seeds - generate_seeds_for_models + generate_seeds_for_models(seed_order) end def generate_seeds_for_models(models)
revert an unintented change on my part
uken_penman
train
rb
15bfab627d545f1464d612fb5000ca527d4cbd48
diff --git a/bingmaps/urlschema/__init__.py b/bingmaps/urlschema/__init__.py index <HASH>..<HASH> 100644 --- a/bingmaps/urlschema/__init__.py +++ b/bingmaps/urlschema/__init__.py @@ -9,3 +9,9 @@ from .location_by_point_schema import ( LocationByPointSchema, LocationByPointUrl ) + +from .location_by_query_schema import ( + LocationByQuerySchema, + LocationByQueryString, + LocationByQueryUrl +)
*MAGIC* Imported location by point schemas and class for getting the data
bharadwajyarlagadda_bingmaps
train
py
ee58faa7d0ea02fd9fedea1231d99cda53786cb4
diff --git a/modules/cms/src/admin/views/page/update.php b/modules/cms/src/admin/views/page/update.php index <HASH>..<HASH> 100644 --- a/modules/cms/src/admin/views/page/update.php +++ b/modules/cms/src/admin/views/page/update.php @@ -34,7 +34,7 @@ use luya\cms\admin\Module; </span> </label> </div> - <div class="toolbar-item toolbar-item-lang" ng-class="{'ml-auto':$first}" ng-repeat="lang in AdminLangService.data" ng-click="AdminLangService.toggleSelection(lang)" ng-show="AdminLangService.data.length > 1"> + <div class="toolbar-item toolbar-item-lang" ng-class="{'ml-auto':$first}" ng-repeat="lang in AdminLangService.data" ng-click="AdminLangService.toggleSelection(lang)" ng-if="AdminLangService.data.length > 1"> <button class="btn-toolbar flag-btn" ng-class="{'active' : AdminLangService.isInSelection(lang.short_code)}" > <span class="flag flag-{{lang.short_code}}"> <span class="flag-fallback">{{lang.name}}</span>
Small change to make the new selector work; #<I>
luyadev_luya
train
php
6cdf1017a4fc84291e48fc963197a90d0904c731
diff --git a/subscription/src/main/java/org/killbill/billing/subscription/engine/core/DefaultSubscriptionBaseService.java b/subscription/src/main/java/org/killbill/billing/subscription/engine/core/DefaultSubscriptionBaseService.java index <HASH>..<HASH> 100644 --- a/subscription/src/main/java/org/killbill/billing/subscription/engine/core/DefaultSubscriptionBaseService.java +++ b/subscription/src/main/java/org/killbill/billing/subscription/engine/core/DefaultSubscriptionBaseService.java @@ -182,8 +182,7 @@ public class DefaultSubscriptionBaseService implements EventListener, Subscripti private boolean onPhaseEvent(final DefaultSubscriptionBase subscription, final SubscriptionBaseEvent readyPhaseEvent, final InternalCallContext context) { try { - final DateTime now = clock.getUTCNow(); - final TimedPhase nextTimedPhase = planAligner.getNextTimedPhase(subscription, now, context); + final TimedPhase nextTimedPhase = planAligner.getNextTimedPhase(subscription, readyPhaseEvent.getEffectiveDate(), context); final PhaseEvent nextPhaseEvent = (nextTimedPhase != null) ? PhaseEventData.createNextPhaseEvent(subscription.getId(), nextTimedPhase.getPhase().getName(), nextTimedPhase.getStartPhase()) :
subscription: Use event effecyiveDate instaed of clock.getUTCNOW when processing notification for PHASE change. This is similar to what we did in df<I>a for issue #<I>.
killbill_killbill
train
java
566ef3c164b9d8b89597aa752267430ef66557d3
diff --git a/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js b/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js index <HASH>..<HASH> 100644 --- a/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js +++ b/lib/plugins/aws/package/compile/events/apiGateway/lib/hack/updateStage.js @@ -48,9 +48,8 @@ module.exports = { const provider = this.state.service.provider; const isTracingEnabled = provider.tracing && provider.tracing.apiGateway; const areLogsEnabled = provider.logs && provider.logs.restApi; - const hasTags = Boolean(provider.tags); - if (!isTracingEnabled && !areLogsEnabled && !hasTags) { + if (!isTracingEnabled && !areLogsEnabled) { // Do crash if there are no API Gateway customizations to apply return null; }
Allow unresolved Rest API id for tags
serverless_serverless
train
js
b2f0786137eacd720fb005d420f0eeaf8cd1efb9
diff --git a/app/templates/src/main/java/package/config/_Constants.java b/app/templates/src/main/java/package/config/_Constants.java index <HASH>..<HASH> 100644 --- a/app/templates/src/main/java/package/config/_Constants.java +++ b/app/templates/src/main/java/package/config/_Constants.java @@ -5,9 +5,6 @@ package <%=packageName%>.config; */ public final class Constants { - private Constants() { - } - // Spring profile for development, production and "fast", see http://jhipster.github.io/profiles.html public static final String SPRING_PROFILE_DEVELOPMENT = "dev"; public static final String SPRING_PROFILE_PRODUCTION = "prod"; @@ -19,4 +16,6 @@ public final class Constants { public static final String SYSTEM_ACCOUNT = "system"; + private Constants() { + } }
Moved the constructor after the constants
jhipster_generator-jhipster
train
java
2bb1891288aa1241f465a1a93a9c281df121aaf5
diff --git a/app/javascript/packs/rails_com/semantic.js b/app/javascript/packs/rails_com/semantic.js index <HASH>..<HASH> 100644 --- a/app/javascript/packs/rails_com/semantic.js +++ b/app/javascript/packs/rails_com/semantic.js @@ -8,10 +8,6 @@ document.querySelectorAll('form[method="get"]').forEach(function(el) { if ( this[i].name === 'commit' ) { this[i].disabled = true } - - if ( this[i].name === 'utf8' ) { - this[i].disabled = true - } } }) })
no more utf8 form name
work-design_rails_com
train
js
09c247453371321116c9ac11af2e791eb0f83698
diff --git a/lib/attack.go b/lib/attack.go index <HASH>..<HASH> 100644 --- a/lib/attack.go +++ b/lib/attack.go @@ -9,12 +9,18 @@ import ( "time" ) -// Attacker is an attack executor, wrapping an http.Client +// Attacker is an attack executor which wraps an http.Client type Attacker struct{ client http.Client } var ( + // DefaultRedirects represents the number of times the DefaultAttacker + // follows redirects DefaultRedirects = 10 - DefaultTimeout = 30 * time.Second + // DefaultTimeout represents the amount of time the DefaultAttacker waits + // for a request before it times out + DefaultTimeout = 30 * time.Second + // DefaultLocalAddr is the local IP address the DefaultAttacker uses in its + // requests DefaultLocalAddr = net.IPAddr{IP: net.IPv4zero} )
Improve documentation in lib/attack.go
tsenart_vegeta
train
go
e72fbef9f091bb171a0ac5640aebfa479fcf3e7c
diff --git a/besticon/besticon.go b/besticon/besticon.go index <HASH>..<HASH> 100644 --- a/besticon/besticon.go +++ b/besticon/besticon.go @@ -357,6 +357,8 @@ func get(urlstring string) (*http.Response, error) { if e != nil { return nil, e } + // Maybe we can get rid of this conversion someday + // https://github.com/golang/go/issues/13835 u.Host, e = idna.ToASCII(u.Host) if e != nil { return nil, e
Add comment linking to discussion about IDNA in net/http
mat_besticon
train
go
dd9ed3c938077d363e64c24c7cad630edd822bc0
diff --git a/sdk/go/common/resource/plugin/plugin.go b/sdk/go/common/resource/plugin/plugin.go index <HASH>..<HASH> 100644 --- a/sdk/go/common/resource/plugin/plugin.go +++ b/sdk/go/common/resource/plugin/plugin.go @@ -215,7 +215,7 @@ func newPlugin(ctx *Context, pwd, bin, prefix string, args, env []string) (*plug // The server is unavailable. This is the Linux bug. Wait a little and retry. time.Sleep(time.Millisecond * 10) continue // keep retrying - case codes.Unimplemented, codes.ResourceExhausted: + default: // Since we sent "" as the method above, this is the expected response. Ready to go. break outer }
Support grpc-js plugin servers (#<I>) In order to support grpc-js gRPC servers, we need to slightly loosen our checks on plugin readiness. This change was already in the 2.x branch, but porting back so that 1.x CLIs can also be compatible. Fixes #<I>.
pulumi_pulumi
train
go
0ed47165caa20fbaea97ef6706ffce84ff209184
diff --git a/tests/test_proxies.py b/tests/test_proxies.py index <HASH>..<HASH> 100644 --- a/tests/test_proxies.py +++ b/tests/test_proxies.py @@ -419,7 +419,7 @@ def s6lduD7BJpxW(): @too_many def bUICVObtDZ4I(): - """Declarative Injected with nesting layer.""" + """Declarative Injected with nested layer.""" class Container(Injector): @@ -430,4 +430,20 @@ def bUICVObtDZ4I(): Container.SubContainer.foo +@too_many +def ww6xNI4YrNr6(): + """Let notation.""" + + Injector.let(foo=(this << 1).foo).foo + + +@too_many +def rN3suiVzhqMM(): + """Let notation with nested layer.""" + + Injector.let( + SubContainer=Injector.let(foo=(this << 2).foo), + ).SubContainer.foo + + # TODO: minimize test number here.
Add let notation examples to test.
dry-python_dependencies
train
py
5fb16f13d7ec20d54be08b164863f3f6f3f87ccc
diff --git a/ph-commons/src/main/java/com/helger/commons/mime/CMimeType.java b/ph-commons/src/main/java/com/helger/commons/mime/CMimeType.java index <HASH>..<HASH> 100644 --- a/ph-commons/src/main/java/com/helger/commons/mime/CMimeType.java +++ b/ph-commons/src/main/java/com/helger/commons/mime/CMimeType.java @@ -85,6 +85,9 @@ public final class CMimeType /** SOAP XML. */ public static final IMimeType APPLICATION_SOAP_XML = EMimeContentType.APPLICATION.buildMimeType ("soap+xml"); + /** X.509 user certificate */ + public static final IMimeType APPLICATION_X509_USER_CERT = EMimeContentType.APPLICATION.buildMimeType ("x-x509-user-cert"); + /** For URL posting. Not used in filenames! */ public static final IMimeType APPLICATION_X_WWW_FORM_URLENCODED = EMimeContentType.APPLICATION.buildMimeType ("x-www-form-urlencoded");
Added APPLICATION_X<I>_USER_CERT
phax_ph-commons
train
java