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
9311f5de7bc1e049192e8eca86cc6e1821187353
diff --git a/Mixtape/tests/test_param_sweep.py b/Mixtape/tests/test_param_sweep.py index <HASH>..<HASH> 100644 --- a/Mixtape/tests/test_param_sweep.py +++ b/Mixtape/tests/test_param_sweep.py @@ -44,3 +44,26 @@ def test_both(): npt.assert_array_almost_equal(models[i].transmat_, models_ref[i].transmat_) npt.assert_array_almost_equal(timescales_ref[i], timescales[i]) + +def test_multi_params(): + msm = MarkovStateModel() + param_grid = {'lag_time' : [1, 2, 3], 'reversible_type' : ['mle', 'transpose']} + + sequences = np.random.randint(20, size=(10, 1000)) + + models = param_sweep(msm, sequences, param_grid, n_jobs=2) + + assert len(models) == 6 + + # I don't know what the order should be, so I'm just going + # to check that there are no duplicates + params = [] + for m in models: + params.append('%s%d' % (m.reversible_type, m.lag_time)) + + for l in param_grid['lag_time']: + for s in param_grid['reversible_type']: + assert ('%s%d' % (s, l)) in params + + # this is redundant, but w/e + assert len(set(params)) == 6
added second test for multiple parameters in param_sweep
msmbuilder_msmbuilder
train
py
3ca2861c2dd9abf94cfc8d1b760c9a3d93dee469
diff --git a/code/extensions/LeftAndMainSubsites.php b/code/extensions/LeftAndMainSubsites.php index <HASH>..<HASH> 100644 --- a/code/extensions/LeftAndMainSubsites.php +++ b/code/extensions/LeftAndMainSubsites.php @@ -217,12 +217,10 @@ class LeftAndMainSubsites extends Extension { // Update current subsite in session Subsite::changeSubsite($_GET['SubsiteID']); - if ($this->owner->canView(Member::currentUser())) { - //Redirect to clear the current page - return $this->owner->redirect($this->owner->Link()); + if (!$this->owner->canView(Member::currentUser())) { + //Redirect to the default CMS section + return $this->owner->redirect('admin/'); } - //Redirect to the default CMS section - return $this->owner->redirect('admin/'); } // Automatically redirect the session to appropriate subsite when requesting a record. @@ -234,12 +232,10 @@ class LeftAndMainSubsites extends Extension { // Update current subsite in session Subsite::changeSubsite($record->SubsiteID); - if ($this->owner->canView(Member::currentUser())) { - //Redirect to clear the current page - return $this->owner->redirect($this->owner->Link()); + if (!$this->owner->canView(Member::currentUser())) { + //Redirect to the default CMS section + return $this->owner->redirect('admin/'); } - //Redirect to the default CMS section - return $this->owner->redirect('admin/'); } }
FIX: Removed unnecessary redirect. This is early enough in the script that the correct subsite will be used from hereon.
silverstripe_silverstripe-subsites
train
php
0573105c600f82b2a38de632010fe64ae1aafc98
diff --git a/docs/src/modules/components/AppSettingsDrawer.js b/docs/src/modules/components/AppSettingsDrawer.js index <HASH>..<HASH> 100644 --- a/docs/src/modules/components/AppSettingsDrawer.js +++ b/docs/src/modules/components/AppSettingsDrawer.js @@ -59,15 +59,15 @@ function AppSettingsDrawer(props) { const handleChangeThemeMode = (event, paletteMode) => { if (paletteMode === null) { - paletteMode = mode; + return; } + setMode(paletteMode); + if (paletteMode === 'system') { - setMode('system'); - document.cookie = 'paletteMode=; expires = Thu, 01 Jan 1970 00:00:00 GMT'; + document.cookie = `paletteMode=;path=/;max-age=31536000`; changeTheme({ paletteMode: preferredMode }); } else { - setMode(paletteMode); document.cookie = `paletteMode=${paletteMode};path=/;max-age=31536000`; changeTheme({ paletteMode }); }
[docs] Fix prefers-color-scheme switch (#<I>)
mui-org_material-ui
train
js
2d277a5826d5073c15d7e23f5a301c81fae683bc
diff --git a/symbols/number.py b/symbols/number.py index <HASH>..<HASH> 100644 --- a/symbols/number.py +++ b/symbols/number.py @@ -9,10 +9,13 @@ # the GNU General License # ---------------------------------------------------------------------- +import numbers + from api.constants import TYPE from symbol_ import Symbol from type_ import SymbolTYPE from type_ import SymbolBASICTYPE +from type_ import SymbolTYPEREF class SymbolNUMBER(Symbol): @@ -21,6 +24,7 @@ class SymbolNUMBER(Symbol): def __init__(self, value, type_=None, lineno=None): assert lineno is not None assert type_ is None or isinstance(type_, SymbolTYPE) + assert isinstance(value, numbers.Number) Symbol.__init__(self) @@ -54,6 +58,7 @@ class SymbolNUMBER(Symbol): else: self.type_ = SymbolBASICTYPE(None, TYPE.ulong) + self.type_ = SymbolTYPEREF(self.type_, lineno) self.lineno = lineno def __str__(self): @@ -61,3 +66,10 @@ class SymbolNUMBER(Symbol): def __repr__(self): return "%s:%s" % (self.type_, str(self)) + + def __cmp__(self, other): + if isinstance(other, numbers.Number): + return self.value - other + + assert isinstance(other, SymbolNUMBER) + return self.value - other.value
- Number type is encapsulated in a typeref - Assertion checking upon instantiation - __cmp__ method implemented to allow direct number comparison.
boriel_zxbasic
train
py
2ba2721ac6bb986bfd4287866d01d612bd5b30fe
diff --git a/config.py b/config.py index <HASH>..<HASH> 100644 --- a/config.py +++ b/config.py @@ -70,6 +70,7 @@ PACKAGES_EXCLUDE = [ 'invenio.modules.communities', # remove with invenio/modules/communities 'invenio.modules.multimedia', 'invenio.modules.pages', + 'invenio.modules.tags', ] LEGACY_WEBINTERFACE_EXCLUDE = []
tags: module externalisation to new package * INCOMPATIBILITY Removes 'tags' module that has been externalised to separate Python package called 'invenio_tags'. Migration can be done by running `pip install invenio_tags` and adding 'invenio_tags' to PACKAGES.
inveniosoftware_invenio-base
train
py
92fda97ce1b73a6128728ece01525bf75eeb8989
diff --git a/lib/paraduct/variable_converter.rb b/lib/paraduct/variable_converter.rb index <HASH>..<HASH> 100644 --- a/lib/paraduct/variable_converter.rb +++ b/lib/paraduct/variable_converter.rb @@ -25,9 +25,8 @@ module Paraduct end def self.reject(product_variables, exclude_variables) - product_variables.inject([]) do |rejected_product_variables, variables| + product_variables.each_with_object([]) do |variables, rejected_product_variables| rejected_product_variables << variables unless exclude_variables.any? { |exclude| partial_match?(variables, exclude) } - rejected_product_variables end end
Resolved: Style/EachWithObject: Use each_with_object instead of inject.
sue445_paraduct
train
rb
d9b2eb02982d831eaf6b6ab7b34081e72137f1e8
diff --git a/thoth/solver/python.py b/thoth/solver/python.py index <HASH>..<HASH> 100644 --- a/thoth/solver/python.py +++ b/thoth/solver/python.py @@ -165,6 +165,7 @@ def resolve(requirements: typing.List[str], index_url: str=None, python_version: queue = deque() for requirement in requirements: + _LOGGER.debug("Parsing requirement %r", requirement) dependency = PypiDependencyParser.parse_python(requirement) if dependency.name in exclude_packages: continue
Be more verbose about parsed requirement
thoth-station_solver
train
py
33b9b7ce069c8b2d0656875052246a036c3e79a4
diff --git a/DataCollector/GitDataCollector.php b/DataCollector/GitDataCollector.php index <HASH>..<HASH> 100644 --- a/DataCollector/GitDataCollector.php +++ b/DataCollector/GitDataCollector.php @@ -43,7 +43,7 @@ class GitDataCollector extends DataCollector // is there a web directory ? - if ($fs->exists('../web')) { + if ($fs->exists('../web') || $fs->exists('../public_html') || $fs->exists('../public')) { $gitPath = '../.git'; } else { // unit tests
Update GitDataCollector.php To check any version Symfony in v4.x the main folder is "public" I always rename it as "public_html" to work with shared folders
kendrick-k_symfony-debug-toolbar-git
train
php
e0c926667a32031b5d43ec1701fe7577282176ca
diff --git a/rest_flex_fields/utils.py b/rest_flex_fields/utils.py index <HASH>..<HASH> 100644 --- a/rest_flex_fields/utils.py +++ b/rest_flex_fields/utils.py @@ -1,3 +1,13 @@ +try: + # Python 3 + from collections.abc import Iterable + string_types = (str,) +except ImportError: + # Python 2 + from collections import Iterable + string_types = (str, unicode) + + def is_expanded(request, key): """ Examines request object to return boolean of whether passed field is expanded. @@ -23,7 +33,11 @@ def split_levels(fields): if not fields: return first_level_fields, next_level_fields - if not isinstance(fields, list): + assert ( + isinstance(fields, Iterable) + ), "`fields` must be iterable (e.g. list, tuple, or generator)" + + if isinstance(fields, string_types): fields = [a.strip() for a in fields.split(",") if a.strip()] for e in fields: if "." in e:
Handle other iterable types gracefully in split_level utility function
rsinger86_drf-flex-fields
train
py
6d44d264cd4515a60b0e24ecb4e17cdf76a5ad66
diff --git a/querydsl-core/src/main/java/com/querydsl/core/types/JavaTemplates.java b/querydsl-core/src/main/java/com/querydsl/core/types/JavaTemplates.java index <HASH>..<HASH> 100644 --- a/querydsl-core/src/main/java/com/querydsl/core/types/JavaTemplates.java +++ b/querydsl-core/src/main/java/com/querydsl/core/types/JavaTemplates.java @@ -13,9 +13,6 @@ */ package com.querydsl.core.types; -import java.lang.reflect.Field; - - /** * JavaTemplates extends {@link Templates} to provide Java syntax compliant serialization * of Querydsl expressions @@ -101,13 +98,8 @@ public class JavaTemplates extends Templates { add(Ops.CASE_EQ_ELSE, "{0}"); // Math - try { - for (Field f : Ops.MathOps.class.getFields()) { - Operator op = (Operator) f.get(null); - add(op, "Math." + getTemplate(op)); - } - } catch (IllegalAccessException e) { - throw new RuntimeException(e.getMessage(), e); + for (Operator op : Ops.MathOps.values()) { + add(op, "Math." + getTemplate(op)); } add(Ops.MOD, "{0} % {0}");
Remove unnecessary reflection code from JavaTemplates
querydsl_querydsl
train
java
695c5579399d798fe4499046b7b2636cab52b678
diff --git a/telldus/library.py b/telldus/library.py index <HASH>..<HASH> 100644 --- a/telldus/library.py +++ b/telldus/library.py @@ -174,7 +174,7 @@ class Library(object): assert Library._refcount == 0 return - for callback in self._callbacks.keys(): + for callback in list(self._callbacks.keys()): try: self.tdUnregisterCallback(callback) except:
Iterate over a copy when cleaning up callbacks
erijo_tellcore-py
train
py
9a6d284fc8e900410108e40ab0e8c83fd162b38b
diff --git a/gem_config.rb b/gem_config.rb index <HASH>..<HASH> 100644 --- a/gem_config.rb +++ b/gem_config.rb @@ -16,6 +16,7 @@ OPTIONS = %w{ --bindir= --sbindir= --cache-file= --config-cache --no-create --srcdir= --prefix= --exec-prefix= + --disable-htmldoc -h -V -q -C -n }.join('|') args = []
Allow --disable-htmldoc to pass thru to ./configure
rmagick_rmagick
train
rb
e02e1d6276f2967d8b420ee81b82021594f9184f
diff --git a/src/js/core/core.js b/src/js/core/core.js index <HASH>..<HASH> 100644 --- a/src/js/core/core.js +++ b/src/js/core/core.js @@ -419,9 +419,7 @@ var docReady = false; var loadHandler = function(e) { - if (e) { - log.info("loadHandler, event is " + e.type); - } + log.info("loadHandler triggered by " + (e ? e.type + " event" : "document already loaded")); if (!docReady) { docReady = true; if (!api.initialized && api.config.autoInitialize) { @@ -441,8 +439,8 @@ } // Test whether the document has already been loaded - if (document.readyState === "complete") { - loadHandler() + if (/^(?:complete|interactive)$/.test(document.readyState)) { + loadHandler(); } else { if (isHostMethod(document, "addEventListener")) { document.addEventListener("DOMContentLoaded", loadHandler, false);
Tweaked auto-initialize when document is alread loaded
timdown_rangy
train
js
0dc43dc1eca5f6efca53e19375664e9de85502dd
diff --git a/Query/Builder.php b/Query/Builder.php index <HASH>..<HASH> 100755 --- a/Query/Builder.php +++ b/Query/Builder.php @@ -479,6 +479,17 @@ class Builder } /** + * Pass the query to a given callback. + * + * @param \Closure $callback + * @return \Illuminate\Database\Query\Builder + */ + public function tap($callback) + { + return $this->when(true, $callback); + } + + /** * Merge an array of where clauses and bindings. * * @param array $wheres
[<I>] add tap to query builder (#<I>) * add tap to query builder * formatting mistake * formatting correction
illuminate_database
train
php
bdfbf9bd657b2b1fb86189129249f7eb3dfd20d9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -32,8 +32,11 @@ setup(name='PyChem', author_email='[email protected]', url='http://molmod.ugent.be/projects/pychem', package_dir = {'pychem': 'src'}, - data_files=[('share/pychem/%s/moldata' % version, glob.glob('src/moldata/*.csv'))], - packages=['pychem', 'pychem.moldata'], + data_files=[ + ('share/pychem/%s/moldata' % version, glob.glob('src/moldata/*.csv')), + ('share/pychem/%s/interfaces/awk' % version, glob.glob('src/interfaces/awk/*.awk')) + ], + packages=['pychem', 'pychem.moldata', 'pychem.interfaces'], classifiers=['Development Status :: 3 - Alpha', 'Environment :: Console', 'Intended Audience :: Science/Research',
Added interfaces to setup.py
molmod_molmod
train
py
585b46a22d50f174398d417c53ccc879ba372855
diff --git a/go/libkb/home.go b/go/libkb/home.go index <HASH>..<HASH> 100644 --- a/go/libkb/home.go +++ b/go/libkb/home.go @@ -3,7 +3,6 @@ package libkb import ( "log" "os" - "os/user" "path/filepath" "regexp" "runtime" @@ -71,11 +70,9 @@ func (x XdgPosix) DataDir() string { return x.dirHelper("XDG_DATA_HOME", ".loc func (x XdgPosix) RuntimeDir() (ret string, err error) { ret = os.Getenv("XDG_RUNTIME_DIR") - var u *user.User if len(ret) != 0 { - } else if u, err = user.Current(); err != nil { } else { - ret = x.Join("/tmp", "keybase-"+u.Username) + ret = x.ConfigDir() } return }
some work on #<I>, put the runtime files in our config directory. this seems safer than in /tmp where others can tamper.
keybase_client
train
go
a553e6f78408df4e064b4b99b5492c8d92e3de6d
diff --git a/include/messaging.php b/include/messaging.php index <HASH>..<HASH> 100644 --- a/include/messaging.php +++ b/include/messaging.php @@ -26,6 +26,21 @@ class Messaging return $data; } + public function GetAttachment($MessageGroupID, $MessageUid) + { + $headers = array( + 'Authorization: Bearer ' . $this->oauth, + 'Content-Type: image/jpeg', + 'Content-Transfer-Encoding: binary' + ); + $response = \Utilities::SendRequest(MESSAGE_URL . '/' . $MessageGroupID . '/messages/' . $MessageUid . '?contentKey=image-data-0', $headers, false, null, "GET", null); + + + $data = base64_encode($response['body']); + + return $data; + } + public function Remove($MessageGroupID) { $headers = array(
Add Messaging::GetAttachment() to grab base<I> of image attachments
Tustin_psn-php
train
php
942de7d3602f213f70704c589444f39d736ca2a7
diff --git a/spec/y2r/ast/ycp_spec.rb b/spec/y2r/ast/ycp_spec.rb index <HASH>..<HASH> 100644 --- a/spec/y2r/ast/ycp_spec.rb +++ b/spec/y2r/ast/ycp_spec.rb @@ -488,19 +488,6 @@ module Y2R::AST @context_as_include = YCP::CompilerContext.new( :options => { :as_include_file => true } ) - - # ----- Misc. ----- - - @banner_comment = [ - "Translated by Y2R (https://github.com/yast/y2r).", - "", - "Original file: " - ].join("\n") - @banner_comment_c = [ - "Translated by Y2R (https://github.com/yast/y2r).", - "", - "Original file: c.ycp" - ].join("\n") end end
YCP AST specs: Remove unused fixtures
yast_y2r
train
rb
d91b358d9524618564035662ad1b95a4a9da640e
diff --git a/spec/support/graph_api_shared_examples.rb b/spec/support/graph_api_shared_examples.rb index <HASH>..<HASH> 100644 --- a/spec/support/graph_api_shared_examples.rb +++ b/spec/support/graph_api_shared_examples.rb @@ -85,12 +85,19 @@ shared_examples_for "Koala GraphAPI" do results.should have(2).items end - it "can access a user's picture" do - @api.get_picture(KoalaTest.user2).should =~ /http[s]*\:\/\// - end + describe "#get_picture" do + it "can access a user's picture" do + @api.get_picture(KoalaTest.user2).should =~ /http[s]*\:\/\// + end - it "can access a user's picture, given a picture type" do - @api.get_picture(KoalaTest.user2, {:type => 'large'}).should =~ /^http[s]*\:\/\// + it "can access a user's picture, given a picture type" do + @api.get_picture(KoalaTest.user2, {:type => 'large'}).should =~ /^http[s]*\:\/\// + end + + it "works even if Facebook returns nil" do + @api.stub(:graph_call).and_return(nil) + @api.get_picture(KoalaTest.user2, {:type => 'large'}).should be_nil + end end it "can access connections from public Pages" do
Test for handling nils in get_picture
arsduo_koala
train
rb
4033e097c7dcc976af84d3b8684794be7f184786
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java index <HASH>..<HASH> 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java @@ -207,7 +207,7 @@ public class RestrictedGuacamoleTunnelService int connsA = getActiveConnections(a).size() + 1; int connsB = getActiveConnections(b).size() + 1; - return (connsA * 10000 / weightA) - (connsB * 10000 / weightB); + return (connsA * weightB) - (connsB * weightA); }
GUACAMOLE-<I>: Get rid of arbitary constant in compare method for WLC algorithm.
glyptodon_guacamole-client
train
java
58a38ed53386db28ddd65ae12320f557aadae8f4
diff --git a/cltk/corpus/utils/importer.py b/cltk/corpus/utils/importer.py index <HASH>..<HASH> 100644 --- a/cltk/corpus/utils/importer.py +++ b/cltk/corpus/utils/importer.py @@ -99,7 +99,11 @@ class CorpusImporter(): @staticmethod def _download_file(url, corpus_name): """Download file with SSL. Note: SSL GitHub connections require a - extra TLSv1 extension to the ``requests`` library's connection.""" + extra TLSv1 extension to the ``requests`` library's connection. + TODO: Maybe up max_retries + http://docs.python-requests.org/en/latest/api/?highlight=max_retries#requests.adapters.HTTPAdapter + http://stackoverflow.com/a/21371922 + """ logger.info("Starting download of corpus %s from: '%s'." % (corpus_name, url)) try: session = requests.Session()
add TODO about max_retries
cltk_cltk
train
py
6dca58d4d991f94de6b0adb7e95ab9aba6feb6ff
diff --git a/visidata/cmdlog.py b/visidata/cmdlog.py index <HASH>..<HASH> 100644 --- a/visidata/cmdlog.py +++ b/visidata/cmdlog.py @@ -23,9 +23,9 @@ globalCommand('status', 'status(input("status: ", display=False))', 'show given # not necessary to log movements and scrollers nonLogKeys = 'KEY_DOWN KEY_UP KEY_NPAGE KEY_PPAGE j k gj gk ^F ^B r < > { } / ? n N gg G g/ g?'.split() -nonLogKeys += 'KEY_LEFT KEY_RIGHT h l gh gl c'.split() +nonLogKeys += 'KEY_LEFT KEY_RIGHT h l gh gl c Q'.split() nonLogKeys += 'zk zj zt zz zb zh zl zKEY_LEFT zKEY_RIGHT'.split() -nonLogKeys += '^Z ^L ^C ^U ^K ^I ^D ^G KEY_RESIZE KEY_F(1) z? KEY_BACKSPACE'.split() +nonLogKeys += '^Z ^A ^L ^C ^U ^K ^I ^D ^G KEY_RESIZE KEY_F(1) z? KEY_BACKSPACE'.split() nonLogKeys += [' '] option('rowkey_prefix', 'キ', 'string prefix for rowkey in the cmdlog')
[cmdlog] do not log ^A and Q
saulpw_visidata
train
py
02cf145c7dca5bfc666bed6885c2ab7213daefad
diff --git a/holoviews/core/dimension.py b/holoviews/core/dimension.py index <HASH>..<HASH> 100644 --- a/holoviews/core/dimension.py +++ b/holoviews/core/dimension.py @@ -209,7 +209,6 @@ class redim(object): if self.mode != 'dynamic' and not matches: return redimmed - kdims = self.replace_dimensions(parent.kdims, dimensions) vdims = self.replace_dimensions(parent.vdims, dimensions) zipped_dims = zip(parent.kdims+parent.vdims, kdims+vdims) @@ -219,7 +218,12 @@ class redim(object): data = parent.data if renames: data = parent.interface.redim(parent, renames) - return parent.clone(data, kdims=kdims, vdims=vdims) + clone = parent.clone(data, kdims=kdims, vdims=vdims) + if self.parent.dimensions(label='name') == clone.dimensions(label='name'): + # Ensure that plot_id is inherited as long as dimension + # name does not change + clone._plot_id = self.parent._plot_id + return clone if self.mode != 'dynamic': return redimmed.clone(kdims=kdims, vdims=vdims)
Retain Element._plot_id on redim (#<I>)
pyviz_holoviews
train
py
09f820ef8350475e9ed76253226d632cb574dd59
diff --git a/src/core/renderers/webgl/managers/MaskManager.js b/src/core/renderers/webgl/managers/MaskManager.js index <HASH>..<HASH> 100644 --- a/src/core/renderers/webgl/managers/MaskManager.js +++ b/src/core/renderers/webgl/managers/MaskManager.js @@ -105,6 +105,7 @@ MaskManager.prototype.pushSpriteMask = function (target, maskData) alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new AlphaMaskFilter(maskData)]; } + alphaMaskFilter[0].resolution = this.renderer.resolution; alphaMaskFilter[0].maskSprite = maskData; //TODO - may cause issues!
MaskManager - Sprite Mask Resolution (#<I>) Currently when applying a mask to a -x2 Sprite, the Sprite resolution is lowered to that of the mask.
pixijs_pixi.js
train
js
03e4a1782cc1ef68d90e71e2dc58433ee5af2027
diff --git a/src/Log/FileLogger.php b/src/Log/FileLogger.php index <HASH>..<HASH> 100644 --- a/src/Log/FileLogger.php +++ b/src/Log/FileLogger.php @@ -69,7 +69,7 @@ class FileLogger { $output .= (new \DateTime())->format("Y-m-d H:i:s"); $output .= " : "; $output .= $message; - $output .= "\n"; + $output .= \PHP_EOL; \file_put_contents(self::$path, $output, \FILE_APPEND); } } diff --git a/src/Log/Logger.php b/src/Log/Logger.php index <HASH>..<HASH> 100644 --- a/src/Log/Logger.php +++ b/src/Log/Logger.php @@ -61,7 +61,7 @@ class Logger { echo (new \DateTime())->format("Y-m-d H:i:s"); echo " : "; echo $message; - echo "\n"; + echo \PHP_EOL; } }
PHP_EOL for loggers
doganoo_PHPUtil
train
php,php
44546133995068e965383561ebe2fab7d53503bd
diff --git a/lib/converters/v2.0.0/converter-v2-to-v1.js b/lib/converters/v2.0.0/converter-v2-to-v1.js index <HASH>..<HASH> 100644 --- a/lib/converters/v2.0.0/converter-v2-to-v1.js +++ b/lib/converters/v2.0.0/converter-v2-to-v1.js @@ -417,7 +417,7 @@ _.assign(Builders.prototype, { if (!item) { return; } var units = ['headers', 'dataMode', 'data', 'rawModeData', 'graphqlModeData', - 'pathVariables', 'tests', 'preRequestScript', 'url'], + 'pathVariables', 'tests', 'preRequestScript', 'url', 'dataOptions'], self = this, request, description,
Entry for dataOptions in request for v2 - v1
postmanlabs_postman-collection-transformer
train
js
ebb84da617a989d9d1bff8660d9903d89ca3ea41
diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/hudson/PluginManager.java +++ b/core/src/main/java/hudson/PluginManager.java @@ -558,9 +558,10 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas } if (dependencyURL != null) { - dependencySet.add(dependencyURL); // And transitive deps... addDependencies(dependencyURL, fromPath, dependencySet); + // And then add the current plugin + dependencySet.add(dependencyURL); } } }
[JENKINS-<I>] - Fix handling of dependency trees in PluginManager::addDependencies() (#<I>)
jenkinsci_jenkins
train
java
7cd328fade1955e46f4f736bf2a426dfd589c6a8
diff --git a/src/Inputs/Number.php b/src/Inputs/Number.php index <HASH>..<HASH> 100644 --- a/src/Inputs/Number.php +++ b/src/Inputs/Number.php @@ -16,7 +16,7 @@ class Number extends Input implements InputInterface { $value = $this->val(); - if (!empty($value) && !filter_var($value, FILTER_VALIDATE_FLOAT)) { + if (!empty($value) && (filter_var($value, FILTER_VALIDATE_FLOAT) === false)) { $this->error(static::$error_message); return false;
Fixed Number validation when <I> is used as value
oscarotero_form-manager
train
php
5f96d53c6338390106982a72f07338aa966ea812
diff --git a/src/components/core/defaults.js b/src/components/core/defaults.js index <HASH>..<HASH> 100644 --- a/src/components/core/defaults.js +++ b/src/components/core/defaults.js @@ -113,8 +113,6 @@ export default { // paginationFractionRender: null, // paginationCustomRender: null, // paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom' - fitSlideGroupWithBlank: false, - blankClass: 'swiper-invisible-blank-slide', // Resistance resistance: true, resistanceRatio: 0.85, @@ -142,6 +140,7 @@ export default { loop: false, loopAdditionalSlides: 0, loopedSlides: null, + loopFillGroupWithBlank: false, // Control control: undefined, controlInverse: false, @@ -158,6 +157,7 @@ export default { // NS containerModifierClass: 'swiper-container-', // NEW slideClass: 'swiper-slide', + slideBlankClass: 'swiper-slide-invisible-blank', slideActiveClass: 'swiper-slide-active', slideDuplicateActiveClass: 'swiper-slide-duplicate-active', slideVisibleClass: 'swiper-slide-visible',
Some renames Ref #<I>
nolimits4web_swiper
train
js
332884eee45c64849f5dae9de329d7d9a00ed2c4
diff --git a/fooster/web/query.py b/fooster/web/query.py index <HASH>..<HASH> 100644 --- a/fooster/web/query.py +++ b/fooster/web/query.py @@ -7,7 +7,7 @@ from fooster import web __all__ = ['regex', 'QueryMixIn', 'QueryHandler', 'new'] -regex = r'(?:\?(?P<query>[\w=&%.+]*))?' +regex = r'(?:\?(?P<query>[\w&= !"#$%\'()*+,./:;<>?@[\\\]^`{|}~-]*))?' class QueryMixIn:
update query regex to support more characters
fkmclane_python-fooster-web
train
py
9fa47332b5c668291ba6879b663ccd92afd791ce
diff --git a/plugins/jobs/server/models/job.py b/plugins/jobs/server/models/job.py index <HASH>..<HASH> 100644 --- a/plugins/jobs/server/models/job.py +++ b/plugins/jobs/server/models/job.py @@ -42,7 +42,7 @@ class Job(AccessControlledModel): self.exposeFields(level=AccessType.READ, fields={ 'title', 'type', 'created', 'interval', 'when', 'status', 'progress', 'log', 'meta', '_id', 'public', 'parentId', 'async', - 'updated', 'timestamps'}) + 'updated', 'timestamps', 'handler'}) self.exposeFields(level=AccessType.SITE_ADMIN, fields={'args', 'kwargs'})
Expose job model 'handler' property
girder_girder
train
py
83af7c0c18f1991315ef3d1d63dfc919bc839d4a
diff --git a/tests/jsunit/event_test.js b/tests/jsunit/event_test.js index <HASH>..<HASH> 100644 --- a/tests/jsunit/event_test.js +++ b/tests/jsunit/event_test.js @@ -368,7 +368,7 @@ function test_varCreate_toJson() { var event = new Blockly.Events.VarCreate(variable); var json = event.toJson(); var expectedJson = ({type: "var_create", varId: "id1", varType: "type1", - varName: "name1"}); + varName: "name1", isLocal: false}); assertEquals(JSON.stringify(expectedJson), JSON.stringify(json)); } finally { @@ -427,7 +427,7 @@ function test_varDelete_toJson() { var event = new Blockly.Events.VarDelete(variable); var json = event.toJson(); var expectedJson = ({type: "var_delete", varId: "id1", varType: "type1", - varName: "name1"}); + varName: "name1", isLocal: false}); assertEquals(JSON.stringify(expectedJson), JSON.stringify(json)); eventTest_tearDown();
Update VarCreate/VarDelete JSON tests.
LLK_scratch-blocks
train
js
862b2c66a3b9b5875241a6c2dd27f69fcede61e7
diff --git a/mailmerge/api.py b/mailmerge/api.py index <HASH>..<HASH> 100644 --- a/mailmerge/api.py +++ b/mailmerge/api.py @@ -98,7 +98,7 @@ def make_message_multipart(message): def convert_markdown(message): """Convert markdown in message text to HTML.""" - assert not message['Content-Type'].startswith("text/markdown") + assert message['Content-Type'].startswith("text/markdown") del message['Content-Type'] # Convert the text from markdown and then make the message multipart message = make_message_multipart(message)
Fixed assertion bug Verified that tests pass locally
awdeorio_mailmerge
train
py
e9e7b11855f1890fd0858bf44be731eea150e915
diff --git a/test/exe_test.rb b/test/exe_test.rb index <HASH>..<HASH> 100644 --- a/test/exe_test.rb +++ b/test/exe_test.rb @@ -1,5 +1,5 @@ require "minitest_helper" -require "english" +require "English" class ExeTest < Minitest::Test def test_chandler_is_executable_and_exits_with_success
English must be capitalized on case-sensitive FS
mattbrictson_chandler
train
rb
87ec7eaa49003a4f0bf36930bb88e64220bf7a17
diff --git a/buildbot/status/web/grid.py b/buildbot/status/web/grid.py index <HASH>..<HASH> 100644 --- a/buildbot/status/web/grid.py +++ b/buildbot/status/web/grid.py @@ -188,7 +188,7 @@ class GridStatusResource(HtmlResource): build = builder.getBuild(-1) while build and None in builds: - ss = build.getSourceStamp(specific=True) + ss = build.getSourceStamp(absolute=True) for i in range(len(stamps)): if ss == stamps[i] and builds[i] is None: builds[i] = build @@ -239,7 +239,7 @@ class GridStatusResource(HtmlResource): continue build = builder.getBuild(-1) while build: - ss = build.getSourceStamp(specific=True) + ss = build.getSourceStamp(absolute=True) start = build.getTimes()[0] build = build.getPreviousBuild()
#<I>:grid-absolute.patch Use "absolute" instead of "specific" sourcestamps;
buildbot_buildbot
train
py
0b4502c2a6a64a607f9143addc658d2ba47d0669
diff --git a/classes/Gems/Import/ImportLoader.php b/classes/Gems/Import/ImportLoader.php index <HASH>..<HASH> 100644 --- a/classes/Gems/Import/ImportLoader.php +++ b/classes/Gems/Import/ImportLoader.php @@ -237,11 +237,16 @@ class Gems_Import_ImportLoader extends \Gems_Loader_TargetLoaderAbstract * The file name to use for final storage, minus the extension * * @param string $controller Name of controller (or other id) + * @param mixed $dateValue Optional date item to use in filename, timestamp, or DateObject or MUtil_Date * @return string */ - public function getLongtermFileName($controller) + public function getLongtermFileName($controller, $dateValue = null) { - $date = new \MUtil_Date(); + if ($dateValue instanceof \Zend_Date) { + $date = $dateValue; + } else { + $date = new \MUtil_Date($dateValue); + } $name[] = $controller; $name[] = $date->toString('YYYY-MM-ddTHH-mm-ss');
Allow to use a different timestamp for the long term filename than the current time
GemsTracker_gemstracker-library
train
php
1724b83e28ee912a978f076d975bd25fbd044e0e
diff --git a/lib/oxygen.js b/lib/oxygen.js index <HASH>..<HASH> 100644 --- a/lib/oxygen.js +++ b/lib/oxygen.js @@ -29,7 +29,8 @@ var Runner = module.exports.Runner = function () { var defer = require('when').defer; var module = {}; // inherit from EventEmitter - var ee = {}; + var ee = {}; + ee.prototype = Object.create(EventEmitter.prototype); util.inherits(ee, EventEmitter); // class variables var _isRunning = false;
Fixed compatibility with node 5.x
oxygenhq_oxygen
train
js
b071b66b453f55de7e6ec278fc2b48cf94343431
diff --git a/protractor-shared.js b/protractor-shared.js index <HASH>..<HASH> 100644 --- a/protractor-shared.js +++ b/protractor-shared.js @@ -72,7 +72,10 @@ var BROWSER_CAPS = { ChromeDesktop: { browserName: 'chrome', chromeOptions: mergeInto(CHROME_OPTIONS, { - 'mobileEmulation': CHROME_MOBILE_EMULATION + // TODO(tbosch): when we are using mobile emulation on + // chrome 44.0 beta, clicks are no more working. + // see https://github.com/angular/angular/issues/2309 + // 'mobileEmulation': CHROME_MOBILE_EMULATION }), loggingPrefs: { performance: 'ALL',
fix(tests): disable mobile emulation so benchmarks run on current chrome Workaround for #<I>
angular_angular
train
js
aab5de381c70ae68133164ea995c49bf44cdd1c4
diff --git a/lib/ohm.rb b/lib/ohm.rb index <HASH>..<HASH> 100644 --- a/lib/ohm.rb +++ b/lib/ohm.rb @@ -183,6 +183,8 @@ module Ohm db.rpush(key, value) end + alias push << + # @return [String] Return and remove the last element of the list. def pop db.rpop(key) diff --git a/test/model_test.rb b/test/model_test.rb index <HASH>..<HASH> 100644 --- a/test/model_test.rb +++ b/test/model_test.rb @@ -453,6 +453,13 @@ class TestRedis < Test::Unit::TestCase assert @post.comments.all.kind_of?(Array) end + should "append elements with push" do + @post.comments.push "1" + @post.comments << "2" + + assert_equal ["1", "2"], @post.comments.all + end + should "keep the inserting order" do @post.comments << "1" @post.comments << "2"
Add push as an alias for <<
soveran_ohm
train
rb,rb
dbbe83b09a0c3101ca8c5c462d149089b4e122f3
diff --git a/api/cloudcontroller/wrapper/uaa_authentication.go b/api/cloudcontroller/wrapper/uaa_authentication.go index <HASH>..<HASH> 100644 --- a/api/cloudcontroller/wrapper/uaa_authentication.go +++ b/api/cloudcontroller/wrapper/uaa_authentication.go @@ -85,15 +85,15 @@ func (t *UAAAuthentication) refreshToken() error { tokenStr := strings.TrimPrefix(t.cache.AccessToken(), "bearer ") token, err := jws.ParseJWT([]byte(tokenStr)) - if err != nil { - // if the JWT could not be parsed, force a refresh - expiresIn = 0 - } else { - expiration, _ := token.Claims().Expiration() - expiresIn = time.Until(expiration) + + if err == nil { + expiration, ok := token.Claims().Expiration() + if ok { + expiresIn = time.Until(expiration) + } } - if expiresIn < accessTokenExpirationMargin { + if err != nil || expiresIn < accessTokenExpirationMargin { tokens, err := t.client.RefreshAccessToken(t.cache.RefreshToken()) if err != nil { return err
Explicitly handle missing expiration claim Check whether method succeeded rather than assuming it will return a zero value if it failed. [#<I>](<URL>)
cloudfoundry_cli
train
go
ac89351ab75c74b1786864a5bba90d67f127b866
diff --git a/App.php b/App.php index <HASH>..<HASH> 100644 --- a/App.php +++ b/App.php @@ -22,6 +22,11 @@ class App implements MiddlewareInterface public function with(callable $middleware) { + if (!is_callable($middleware)) + throw new \InvalidArgumentException( + "Argument 1 passed to App->with needs to be valid callback" + ); + $app = clone $this; $app->_middlewares[] = $middleware; @@ -44,7 +49,7 @@ class App implements MiddlewareInterface return $response; $middleware = $this->_middlewares[$current++]; - return $middleware($request, $response, $next); + return call_user_func($middleware, $request, $response, $next); }; return $next($request, $response);
call_user_func is used now
Talesoft_tale-app
train
php
bc1f63d12401d5e43fe4bdbec9faf608656f1e2b
diff --git a/model/db/db.php b/model/db/db.php index <HASH>..<HASH> 100644 --- a/model/db/db.php +++ b/model/db/db.php @@ -431,15 +431,16 @@ abstract class Lib_Model_Db extends Lib_Model $model = static::find()->filterBy($conditions); if( null === $constructor ) { - $constructor = array_keys($model->_data); + $constructor = array_keys($model->recordColumnsGet()); } - if( is_array($constructor) ) + if( is_callable($constructor) ) { - $model->setColumns($constructor); + $constructor($model); } else { - $constructor($model); + arrayize($constructor); + $model->setColumns($constructor); } return $model->loadSet(); }
Model_Db::getSetBy consistency fix
ifrpl_muyo
train
php
716ded32f395d7fddb2dc0928a4ed14e5f0886c9
diff --git a/app/patients/index/route.js b/app/patients/index/route.js index <HASH>..<HASH> 100644 --- a/app/patients/index/route.js +++ b/app/patients/index/route.js @@ -9,12 +9,7 @@ export default AbstractIndexRoute.extend({ }, _modelQueryParams: function() { - var maxValue = this.get('maxValue'); return { - options: { - startkey: [null, null], - endkey: [maxValue, maxValue] - }, mapReduce: 'patient_by_display_id' }; },
Removed unneeded start key and endkey
HospitalRun_hospitalrun-frontend
train
js
e45ba41b0f39a9089dfa9908d33e239273826e87
diff --git a/src/java/com/threerings/media/IconManager.java b/src/java/com/threerings/media/IconManager.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/media/IconManager.java +++ b/src/java/com/threerings/media/IconManager.java @@ -1,5 +1,5 @@ // -// $Id: IconManager.java,v 1.4 2002/12/07 02:09:45 shaper Exp $ +// $Id: IconManager.java,v 1.5 2002/12/07 02:13:00 shaper Exp $ package com.threerings.media; @@ -175,6 +175,6 @@ public class IconManager * metrics configuration parameter. */ protected static final String METRICS_SUFFIX = ".metrics"; - /** The maximum number of icons that may be cached at any one time. */ - protected static final int ICON_CACHE_SIZE = 50; + /** The maximum number of icon tilesets that may be cached at once. */ + protected static final int ICON_CACHE_SIZE = 10; }
Realized that the icon manager is caching icon tilesets, not icons themselves, and accordingly dramatically reduced the cache size and fixed comment. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1
threerings_narya
train
java
99a42f20e9e88daec5c0d7beb4e7eac134680ab0
diff --git a/toolbox.go b/toolbox.go index <HASH>..<HASH> 100644 --- a/toolbox.go +++ b/toolbox.go @@ -26,7 +26,7 @@ import ( "gopkg.in/macaron.v1" ) -const _VERSION = "0.1.1" +const _VERSION = "0.1.2" func Version() string { return _VERSION @@ -38,6 +38,7 @@ type Toolbox interface { AddHealthCheckFunc(string, HealthCheckFunc) AddStatistics(string, string, time.Duration) GetMap(io.Writer) + JSON(io.Writer) } type toolbox struct {
Expose JSON method to Toolbox interface Fix #7
go-macaron_toolbox
train
go
b33dba1e637bd6aaf417d10bda5c9f7fcc52eabe
diff --git a/twitter_ads/cursor.py b/twitter_ads/cursor.py index <HASH>..<HASH> 100644 --- a/twitter_ads/cursor.py +++ b/twitter_ads/cursor.py @@ -58,7 +58,7 @@ class Cursor(object): value = self._collection[self._current_index] self._current_index += 1 return value - elif self._current_index > len(self._collection) and self._next_cursor: + elif self._next_cursor: self.__fetch_next() return self.next() else: @@ -74,8 +74,11 @@ class Cursor(object): self.__die() def __fetch_next(self): - params = self._options.copy().update({'next_cursor': self._next_cursor}) - response = Request(self._client, self._method, self._resource, params=params).perform() + options = self._options.copy() + params = options.get('params', {}) + params.update({'cursor': self._next_cursor}) + options['params'] = params + response = Request(self._client, self._method, self._resource, **options).perform() return self.__from_response(response) def __from_response(self, response):
[bug] fixing cursor to handle next cursor and request params correctly
twitterdev_twitter-python-ads-sdk
train
py
c79fbb2a3bebc94e524c163c2b18fd11216cf8a5
diff --git a/packages/collector/test/tracing/protocols/http/server/test.js b/packages/collector/test/tracing/protocols/http/server/test.js index <HASH>..<HASH> 100644 --- a/packages/collector/test/tracing/protocols/http/server/test.js +++ b/packages/collector/test/tracing/protocols/http/server/test.js @@ -433,7 +433,7 @@ function registerTests(useHttps, useHttp2CompatApi) { fail('Expected the HTTP call to time out.'); }) .catch(err => { - if (err.error && err.error.code === 'ESOCKETTIMEDOUT') { + if (err.error && (err.error.code === 'ESOCKETTIMEDOUT' || err.error.code === 'ETIMEDOUT')) { // We actually expect the request to time out. But we still want to verify that an entry span has been created // for it. return retry(() =>
test(tracing): fix flaky test Actually, both error codes can occur in a timeout situation.
instana_nodejs-sensor
train
js
215740157bb85837e0f2c4bc9a7ce373b4bf1eb1
diff --git a/src/client/actions/GuildDelete.js b/src/client/actions/GuildDelete.js index <HASH>..<HASH> 100644 --- a/src/client/actions/GuildDelete.js +++ b/src/client/actions/GuildDelete.js @@ -18,7 +18,7 @@ class GuildDeleteAction extends Action { if (channel.type === 'text') channel.stopTyping(true); } - if (guild.available && data.unavailable) { + if (data.unavailable) { // Guild is unavailable guild.available = false;
fix: always emit guildUnavailable when a guild becomes unavailable (#<I>)
discordjs_discord.js
train
js
a2e5db713a403aa63882887b95e5876f3da5a9ba
diff --git a/lib/clubhouse_ruby/constants.rb b/lib/clubhouse_ruby/constants.rb index <HASH>..<HASH> 100644 --- a/lib/clubhouse_ruby/constants.rb +++ b/lib/clubhouse_ruby/constants.rb @@ -30,6 +30,7 @@ module ClubhouseRuby :categories, :epics, :files, + :iterations, :labels, :linked_files, :members,
Adds iterations to constants
PhilipCastiglione_clubhouse_ruby
train
rb
304c87c07df80b0b2b905a3f8e28ceafe660551b
diff --git a/pylint/testutils/output_line.py b/pylint/testutils/output_line.py index <HASH>..<HASH> 100644 --- a/pylint/testutils/output_line.py +++ b/pylint/testutils/output_line.py @@ -2,6 +2,7 @@ # For details: https://github.com/PyCQA/pylint/blob/master/LICENSE import collections +from typing import Any, NamedTuple from pylint import interfaces from pylint.constants import PY38_PLUS @@ -54,11 +55,14 @@ Try updating it with: 'python tests/test_functional.py {UPDATE_OPTION}'""" Exception.__init__(self, msg) -class OutputLine( - collections.namedtuple( - "OutputLine", ["symbol", "lineno", "column", "object", "msg", "confidence"] - ) -): +class OutputLine(NamedTuple): + symbol: str + lineno: int + column: int + object: Any + msg: str + confidence: str + @classmethod def from_msg(cls, msg): column = cls.get_column(msg.column)
Use a NamedTuple from typing directly
PyCQA_pylint
train
py
658874419a53b4d77038f901d9f6a47546c820d2
diff --git a/src/GridFieldEditableColumns.php b/src/GridFieldEditableColumns.php index <HASH>..<HASH> 100644 --- a/src/GridFieldEditableColumns.php +++ b/src/GridFieldEditableColumns.php @@ -275,7 +275,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements { $fields = $this->getFields($grid, $record); - $form = new Form($this, null, $fields, new FieldList()); + $form = new Form($grid, null, $fields, new FieldList()); $form->loadDataFrom($record); $form->setFormAction(Controller::join_links(
deny inline editing of records SS4
symbiote_silverstripe-gridfieldextensions
train
php
b97009a3ee2f46024dd04e0916fa15501b1e639a
diff --git a/ui/msm.py b/ui/msm.py index <HASH>..<HASH> 100644 --- a/ui/msm.py +++ b/ui/msm.py @@ -29,6 +29,10 @@ and provides them for later access. .. moduleauthor:: B. Trendelkamp-Schroer <benjamin DOT trendelkamp-schroer AT fu-berlin DOT de> """ + +__docformat__ = "restructuredtext en" + +import copy import numpy as np from itertools import count from math import ceil @@ -67,7 +71,7 @@ class MSM(object): # set inputs # set transition matrix - self._T = T + self._T = copy.deepcopy(T) # nstates self._nstates = np.shape(T)[0] # set time step @@ -839,7 +843,6 @@ class MSM(object): self._assert_pcca() return self._pcca.metastable_assignment -<<<<<<< HEAD class EstimatedMSM(MSM): r"""Estimates a Markov model from discrete trajectories. @@ -1366,5 +1369,3 @@ class EstimatedMSM(MSM): import pyemma.util.discrete_trajectories as dt return dt.sample_indexes_by_distribution(self.active_state_indexes, distributions, nsample) -======= ->>>>>>> [msm.ui]: refactored MSM hierarchy into MSM, EstimatedMSM and SampledMSM
[msm.ui.msm]: dragging along refactor
markovmodel_msmtools
train
py
11c0c6432a8d15b9918f6e03e74e7e94337a3b5f
diff --git a/packages/site/build/webpack.config.babel.js b/packages/site/build/webpack.config.babel.js index <HASH>..<HASH> 100644 --- a/packages/site/build/webpack.config.babel.js +++ b/packages/site/build/webpack.config.babel.js @@ -111,7 +111,8 @@ module.exports = { }, plugins, devServer: { - port: 1337 + port: 1337, + historyApiFallback: true }, resolveLoader: { alias: {
refactor(site): handle pushstate better
pluralsight_design-system
train
js
0fe216c14f0db692bfbe16b4148c938bf9055c9e
diff --git a/lib/Util/Request.php b/lib/Util/Request.php index <HASH>..<HASH> 100644 --- a/lib/Util/Request.php +++ b/lib/Util/Request.php @@ -32,6 +32,10 @@ class Request { $options[CURLOPT_POST] = true; $options[CURLOPT_POSTFIELDS] = $parameters; break; + case 'PUT': + $options[CURLOPT_CUSTOMREQUEST] = 'PUT'; + $options[CURLOPT_POSTFIELDS] = $parameters; + break; default: $options[CURLOPT_CUSTOMREQUEST] = $method; if ($parameters) {
Handle post fields in PUT method for requests
taxjar_taxjar-php
train
php
c7fbdfb7125e03b5653b13db1950fb45344e8e1b
diff --git a/lib/bootstrap.php b/lib/bootstrap.php index <HASH>..<HASH> 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -4,4 +4,9 @@ namespace Amp\Loop; use AsyncInterop\Loop; +\trigger_error( + "You're using amphp/loop, which is deprecated. Please use amphp/amp instead.", + E_USER_WARNING +); + Loop::setFactory(new LoopFactory);
Actively warn if this component is used Just in case somebody follows older issues or blog posts.
amphp_loop
train
php
40a8f0f634c8193605bc9e4a8e00c9366616231c
diff --git a/dfu/src/main/java/no/nordicsemi/android/dfu/internal/ArchiveInputStream.java b/dfu/src/main/java/no/nordicsemi/android/dfu/internal/ArchiveInputStream.java index <HASH>..<HASH> 100644 --- a/dfu/src/main/java/no/nordicsemi/android/dfu/internal/ArchiveInputStream.java +++ b/dfu/src/main/java/no/nordicsemi/android/dfu/internal/ArchiveInputStream.java @@ -319,6 +319,7 @@ public class ArchiveInputStream extends ZipInputStream { if (buffer.length > size) { if (startNextFile() == null) { bytesRead += size; + crc32.update(buffer, 0, size); return size; }
Bug fix: Fixed calculating CRC for unaligned files
NordicSemiconductor_Android-DFU-Library
train
java
15817a23512a1e3a67f89710e89a5d3ef5b07347
diff --git a/opal/corelib/time.rb b/opal/corelib/time.rb index <HASH>..<HASH> 100644 --- a/opal/corelib/time.rb +++ b/opal/corelib/time.rb @@ -204,6 +204,10 @@ class Time `#{wday} == 5` end + def hash + `self.getTime()` + end + def hour %x{ if (#@tz_offset === 0) { diff --git a/spec/filters/bugs/time.rb b/spec/filters/bugs/time.rb index <HASH>..<HASH> 100644 --- a/spec/filters/bugs/time.rb +++ b/spec/filters/bugs/time.rb @@ -56,8 +56,6 @@ opal_filter "Time" do fails "Time#gmtoff returns the correct offset for New Zealand around daylight savings time change" fails "Time#gmtoff returns the correct offset for US Eastern time zone around daylight savings time change" fails "Time#gmtoff returns the offset in seconds between the timezone of time and UTC" - fails "Time#hash is stable" - fails "Time#hash returns a Fixnum" fails "Time#inspect formats the fixed offset time following the pattern 'yyyy-MM-dd HH:mm:ss +/-HHMM'" fails "Time#inspect formats the local time following the pattern 'yyyy-MM-dd HH:mm:ss Z'" fails "Time#isdst dst? returns whether time is during daylight saving time"
Time#hash fully compliant with rubyspec
opal_opal
train
rb,rb
22893dab36514d14b1f3fed1e93565ad1ca4e6dd
diff --git a/scout/adapter/mongo/case.py b/scout/adapter/mongo/case.py index <HASH>..<HASH> 100644 --- a/scout/adapter/mongo/case.py +++ b/scout/adapter/mongo/case.py @@ -446,7 +446,7 @@ class CaseHandler(object): LOG.info("Saving case %s", case_obj['_id']) # update updated_at of case to "today" - case_obj['updated_at'] = datetime.datetime.now(), + case_obj['updated_at'] = datetime.datetime.now() updated_case = self.case_collection.find_one_and_replace( {'_id': case_obj['_id']},
Update case.py Fix #<I> - I believe. Thanks @patrikgrenfeldt for explaining what you are doing - that made the location obvious. In a twist of irony it appears it was your code.. 😉
Clinical-Genomics_scout
train
py
09c35e60f46c141cc60aff1bce6cce3ed20fed05
diff --git a/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/legacy/LegacyVisibilityService.java b/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/legacy/LegacyVisibilityService.java index <HASH>..<HASH> 100644 --- a/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/legacy/LegacyVisibilityService.java +++ b/plugins/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/legacy/LegacyVisibilityService.java @@ -34,7 +34,9 @@ public class LegacyVisibilityService extends VisibilityService { @Override public boolean isVisible(JvmMember member, JvmDeclaredType contextType) { - if (contextType == null) { + if(member.eIsProxy()) + return true; + if (contextType == null || member.eResource() == null || member.eResource().getResourceSet() == null) { return helper.isVisible(member); } StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, member.eResource().getResourceSet());
[typesystem] make legacy visibility provider more resilient to proxies (NPE when quickfixing a broken link to a Java class) Change-Id: Id<I>c0e<I>e<I>c<I>bcd1eb<I>c<I>b7f2
eclipse_xtext-extras
train
java
cd02bac22708695493525a891e6b8d557b27d5b3
diff --git a/src/main/java/com/cx/plugin/CxAbstractPlugin.java b/src/main/java/com/cx/plugin/CxAbstractPlugin.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/cx/plugin/CxAbstractPlugin.java +++ b/src/main/java/com/cx/plugin/CxAbstractPlugin.java @@ -207,7 +207,6 @@ public abstract class CxAbstractPlugin extends AbstractMojo { } protected byte[] getBytesFromZippedSources() throws MojoExecutionException { - log.debug("converting zipped sources to byte array"); byte[] zipFileByte; try { @@ -225,7 +224,6 @@ public abstract class CxAbstractPlugin extends AbstractMojo { return zipFileByte; } - protected void createScanReport() throws MojoExecutionException { byte[] scanReport = cxClient.getScanReport(CxWSReportType.PDF); @@ -237,8 +235,6 @@ public abstract class CxAbstractPlugin extends AbstractMojo { log.debug("fail to create report: ", e); } } - - } protected abstract boolean shouldSkip();
bugid: <I> CR_by: n/a
cxadmin_checkmarx-plugin
train
java
984d5bc30cfacd63872f8c1c4d366c8211a112bd
diff --git a/builder/builder-next/reqbodyhandler.go b/builder/builder-next/reqbodyhandler.go index <HASH>..<HASH> 100644 --- a/builder/builder-next/reqbodyhandler.go +++ b/builder/builder-next/reqbodyhandler.go @@ -57,7 +57,7 @@ func (h *reqBodyHandler) RoundTrip(req *http.Request) (*http.Response, error) { resp := &http.Response{ Status: "200 OK", - StatusCode: 200, + StatusCode: http.StatusOK, Body: rc, ContentLength: -1, }
builder-next: use constants for http status codes
moby_moby
train
go
0362916a63b923bfb304f05677ed9f5c67403d2b
diff --git a/src/plugins/notify/index.js b/src/plugins/notify/index.js index <HASH>..<HASH> 100644 --- a/src/plugins/notify/index.js +++ b/src/plugins/notify/index.js @@ -255,6 +255,11 @@ class Notify { }; } } + this.PopstateEvent = () => { + this.close(); + }; + + window.addEventListener('popstate', this.PopstateEvent); } trigger(event, ...data) { @@ -277,6 +282,8 @@ class Notify { this.trigger('$close'); + window.removeEventListener('popstate', this.PopstateEvent); + utils.removeClass($body, notifyShowCls); $body.addEventListener('transitionend', (event) => {
fix(Notify): add popstate event handler Closes #<I>
heyui_heyui
train
js
7892d4954e1d36267e10c0b3cd0987f8f91e749e
diff --git a/lib/valanga/music_search.rb b/lib/valanga/music_search.rb index <HASH>..<HASH> 100644 --- a/lib/valanga/music_search.rb +++ b/lib/valanga/music_search.rb @@ -20,26 +20,20 @@ module Valanga end def [](music_name) - if info_url = pages[music_name] - session.visit(info_url(src)) - return Music.new(session.html) - else - page_sessions do |session| - begin - session.within("#music_table1") do - session.click_link(music_name) - end - - src = session.find(:css, "iframe")['src'] + return create_music(info_url) if info_url = pages[music_name] - pages[music_name] = info_url(src) + page_sessions do |session| + begin + session.within("#music_table1") do + session.click_link(music_name) + end - session.visit(info_url(src)) + src = session.find(:css, "iframe")['src'] + pages[music_name] = info_url(src) - return Music.new(session.html) - rescue Capybara::ElementNotFound - # if link is not found, go next page. - end + return create_music(info_url(src)) + rescue Capybara::ElementNotFound + # if link is not found, go next page. end end end @@ -48,6 +42,11 @@ module Valanga private + def create_music(info_url) + session.visit(info_url) + Music.new(session.html) + end + def page_sessions(&block) page = 1
Add `#create_music` and use it.
mgi166_valanga
train
rb
c905f53daf2c89ec8eb621eefdc0591b6f6b7813
diff --git a/structr-core/src/main/java/org/structr/schema/SchemaHelper.java b/structr-core/src/main/java/org/structr/schema/SchemaHelper.java index <HASH>..<HASH> 100644 --- a/structr-core/src/main/java/org/structr/schema/SchemaHelper.java +++ b/structr-core/src/main/java/org/structr/schema/SchemaHelper.java @@ -19,6 +19,7 @@ package org.structr.schema; import java.util.Arrays; +import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -449,6 +450,7 @@ public class SchemaHelper { actionList.add(entry); + Collections.sort(actionList); } }
Fixed ordering of save actions in schema editor.
structr_structr
train
java
bb42dfa519bf2f1830b0ceea203fdc856aa85cf9
diff --git a/test/extended/prometheus/prometheus.go b/test/extended/prometheus/prometheus.go index <HASH>..<HASH> 100644 --- a/test/extended/prometheus/prometheus.go +++ b/test/extended/prometheus/prometheus.go @@ -287,6 +287,15 @@ var _ = g.Describe("[Feature:Prometheus][Conformance] Prometheus", func() { } return true, nil })).NotTo(o.HaveOccurred()) + + g.By("verifying standard metrics keys") + queries := map[string][]metricTest{ + `template_router_reload_seconds_count{job="router-internal-default"}`: {metricTest{greaterThanEqual: true, value: 1}}, + `haproxy_server_up{job="router-internal-default"}`: {metricTest{greaterThanEqual: true, value: 1}}, + `template_router_reload_seconds_count{job="router-internal-prometheus"}`: {metricTest{greaterThanEqual: true, value: 1}}, + `haproxy_server_up{job="router-internal-prometheus"}`: {metricTest{greaterThanEqual: true, value: 1}}, + } + runQueries(queries, oc, ns, execPodName, url, bearerToken) }) }) })
e2e: expand ingress prometheus test assertions Check for some important metrics keys which are a decent proxy for readiness.
openshift_origin
train
go
7a16bda2ba5eac3bdda72b6fc6f5d3e33af0bc96
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java index <HASH>..<HASH> 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java @@ -151,7 +151,8 @@ public abstract class AbstractGremlinSuite extends Suite { } private static List<Graph.OptOut> getAllOptOuts(final Class<?> clazz) { - if (clazz == Object.class) + // we typically get a null class if this is called recursively and the original clazz was an interface + if (clazz == Object.class || null == clazz) return Collections.emptyList(); return Stream.concat(getAllOptOuts(clazz.getSuperclass()).stream(),
Need to check for null in case the Graph or GraphProvider is some sort of interface Yes, that can happen......... CTR
apache_tinkerpop
train
java
69e7d21e9a08cf0862c17449daee4225a09dadaa
diff --git a/scheduler/util.go b/scheduler/util.go index <HASH>..<HASH> 100644 --- a/scheduler/util.go +++ b/scheduler/util.go @@ -228,10 +228,17 @@ func tasksUpdated(a, b *structs.TaskGroup) bool { return true } - // Inspect the network to see if the resource ask is different - if !reflect.DeepEqual(at.Resources.Networks, bt.Resources.Networks) { + // Inspect the network to see if the dynamic ports are different + if len(at.Resources.Networks) != len(bt.Resources.Networks) { return true } + for idx := range at.Resources.Networks { + an := at.Resources.Networks[idx] + bn := bt.Resources.Networks[idx] + if len(an.DynamicPorts) != len(bn.DynamicPorts) { + return true + } + } } return false }
scheduler: tasks updated should only check if number of dynamic ports is different
hashicorp_nomad
train
go
f100f0dc25798ee0be310fb66d7be5835f2cb2a2
diff --git a/src/main/java/net/openhft/chronicle/network/WireTcpHandler.java b/src/main/java/net/openhft/chronicle/network/WireTcpHandler.java index <HASH>..<HASH> 100755 --- a/src/main/java/net/openhft/chronicle/network/WireTcpHandler.java +++ b/src/main/java/net/openhft/chronicle/network/WireTcpHandler.java @@ -41,7 +41,9 @@ public abstract class WireTcpHandler<T extends NetworkContext> @NotNull protected Wire outWire; long lastWritePosition = 0; - int writeBps, socketPollCount, bytesReadCount; + long writeBps; + long bytesReadCount; + int socketPollCount; long lastMonitor = System.currentTimeMillis(); @NotNull private Wire inWire; @@ -138,7 +140,7 @@ public abstract class WireTcpHandler<T extends NetworkContext> if (networkStatsListener != null) networkStatsListener.onNetworkStats(writeBps / 10, bytesReadCount / 10, socketPollCount / 10, nc); - writeBps = socketPollCount = bytesReadCount = 0; + writeBps = bytesReadCount = socketPollCount = 0; } if (publisher != null)
Queue#<I> Fix the dumping of bytes, add a TEST_HOURLY, add long counters for read/write bytes per <I> seconds, stop the pretouch task when interrupted, when testing for files to write to, increment the cycle rather than waiting for the timer to do it, reset the insideHeader when an exception occurs in writeHeader,
OpenHFT_Chronicle-Network
train
java
81edf4a7b2290775b643b120a146ef3bca90a8b0
diff --git a/src/Fixer/ControlStructure/ElseifFixer.php b/src/Fixer/ControlStructure/ElseifFixer.php index <HASH>..<HASH> 100644 --- a/src/Fixer/ControlStructure/ElseifFixer.php +++ b/src/Fixer/ControlStructure/ElseifFixer.php @@ -27,12 +27,6 @@ final class ElseifFixer extends AbstractFixer */ public function isCandidate(Tokens $tokens) { - // handle `T_ELSE T_WHITESPACE T_IF` treated as single `T_ELSEIF` by HHVM - // see https://github.com/facebook/hhvm/issues/4796 - if (defined('HHVM_VERSION') && $tokens->isTokenKindFound(T_ELSEIF)) { - return true; - } - return $tokens->isAllTokenKindsFound(array(T_IF, T_ELSE)); }
Drop hacks for unsupported HHVM
FriendsOfPHP_PHP-CS-Fixer
train
php
be8e0e1bed7edd8b6a1b4cfecf0ac3db75e8c912
diff --git a/spdx/parsers/tagvaluebuilders.py b/spdx/parsers/tagvaluebuilders.py index <HASH>..<HASH> 100644 --- a/spdx/parsers/tagvaluebuilders.py +++ b/spdx/parsers/tagvaluebuilders.py @@ -721,8 +721,10 @@ class PackageBuilder(object): if files_analyzed: if validations.validate_pkg_files_analyzed(files_analyzed): self.package_files_analyzed_set = True - doc.packages[-1].files_analyzed = files_analyzed - print(doc.packages[-1].files_analyzed) + doc.packages[-1].files_analyzed = (files_analyzed.lower() == "true") + # convert to boolean; + # validate_pkg_files_analyzed already checked if + # files_analyzed is in ['True', 'true', 'False', 'false'] return True else: raise SPDXValueError("Package::FilesAnalyzed")
files_analyzed is boolean, not string!
spdx_tools-python
train
py
967ee8c44c5356b4827cbbfcc7b11a2816403bd8
diff --git a/app/models/tandem/content/image.rb b/app/models/tandem/content/image.rb index <HASH>..<HASH> 100644 --- a/app/models/tandem/content/image.rb +++ b/app/models/tandem/content/image.rb @@ -3,7 +3,5 @@ module Tandem #todo: the following line introduces an artifact field on the other types of Content. For now there is only one other field type, so this down and dirty association is quickest. #todo: I've already added a polymorphic field "attachment" that is designed for this same purpose, but is currently not being used for anything, it should be removed as well^^. belongs_to :image, class_name: 'Tandem::Image' - - validates :image_id, presence: true end end
We don't need this, since content_images without an image fallback to our blank image.
12spokes_tandem
train
rb
003554b96192f19daad6fcb56ca9706e5a468626
diff --git a/api/ParsoidService.js b/api/ParsoidService.js index <HASH>..<HASH> 100644 --- a/api/ParsoidService.js +++ b/api/ParsoidService.js @@ -11,8 +11,7 @@ var express = require('express'), cluster = require('cluster'), path = require('path'), util = require('util'), - uuid = require('node-uuid').v4, - Buffer = require('buffer').Buffer; + uuid = require('node-uuid').v4; function ParsoidService( parsoidConfig, processLogger ) {
Remove unnecessary require of Buffer JsHint complains about a redefinition as it's a global. Change-Id: Ideff<I>d<I>e<I>a7c<I>ff4ee7c6d5a
wikimedia_parsoid
train
js
5371e9724e6790de1260c1c371e45d50da1506b2
diff --git a/src/Messaging/Scheduling/CronTrigger.php b/src/Messaging/Scheduling/CronTrigger.php index <HASH>..<HASH> 100644 --- a/src/Messaging/Scheduling/CronTrigger.php +++ b/src/Messaging/Scheduling/CronTrigger.php @@ -55,7 +55,7 @@ class CronTrigger implements Trigger } $dateTime = new \DateTime("now", new \DateTimeZone("UTC")); - $dateTime->setTimestamp($clock->unixTimeInMilliseconds() / 1000); + $dateTime->setTimestamp((int)($clock->unixTimeInMilliseconds() / 1000)); $nextExecutionTime = $cron->getNextRunDate($dateTime, 0, true, "UTC")->getTimestamp(); if ($nextExecutionTime < $dateTime->getTimestamp()) {
parse cron as int
SimplyCodedSoftware_integration-messaging
train
php
661af17198fb8d096d5f5de5ca34f2b5197f1365
diff --git a/src/db/clients/postgresql.js b/src/db/clients/postgresql.js index <HASH>..<HASH> 100644 --- a/src/db/clients/postgresql.js +++ b/src/db/clients/postgresql.js @@ -33,7 +33,7 @@ export default async function (server, database) { logger().debug('connected'); const defaultSchema = await getSchema(conn); - const version = (await driverExecuteQuery(conn, { query: 'SHOW server_version;' })).rows[0].server_version; + const version = (await driverExecuteQuery(conn, { query: 'select version()' })).rows[0].version; return { /* eslint max-len:0 */
fix version query for postgres breaking redshift (#<I>)
sqlectron_sqlectron-core
train
js
2c176973574e88bd9dea9c8ae6abfdd86e025128
diff --git a/angr/analyses/cfg/cfg_base.py b/angr/analyses/cfg/cfg_base.py index <HASH>..<HASH> 100644 --- a/angr/analyses/cfg/cfg_base.py +++ b/angr/analyses/cfg/cfg_base.py @@ -1693,7 +1693,8 @@ class CFGBase(Analysis): :rtype: set """ - addrs = sorted(functions.keys()) + addrs = sorted(k for k in functions.keys() + if not self.project.is_hooked(k) and not self.project.simos.is_syscall_addr(k)) functions_to_remove = set() adjusted_cfgnodes = set() @@ -1701,8 +1702,6 @@ class CFGBase(Analysis): if addr_1 in predetermined_function_addrs: continue - if self.project.is_hooked(addr_0) or self.project.is_hooked(addr_1): - continue func_0 = functions[addr_0]
CFGBase: Skip all hooks and syscalls when merging nodes. (#<I>)
angr_angr
train
py
8904c92f0a5a2bb06e8cd60e0e0a3a31bf028e16
diff --git a/jss/jssobjects.py b/jss/jssobjects.py index <HASH>..<HASH> 100644 --- a/jss/jssobjects.py +++ b/jss/jssobjects.py @@ -60,6 +60,9 @@ __all__ = ( 'SoftwareUpdateServer', 'SMTPServer', 'UserExtensionAttribute', 'User', 'UserGroup', 'VPPAccount', 'VPPAssignment', 'VPPInvitation', 'Webhook') +# Map Python 2 basestring type for Python 3. +if sys.version_info.major == 3: + basestring = str # pylint: disable=missing-docstring class Account(Container): diff --git a/jss/misc_endpoints.py b/jss/misc_endpoints.py index <HASH>..<HASH> 100644 --- a/jss/misc_endpoints.py +++ b/jss/misc_endpoints.py @@ -30,6 +30,9 @@ from .tools import error_handler __all__ = ('CommandFlush', 'FileUpload', 'LogFlush') +# Map Python 2 basestring type for Python 3. +if sys.version_info.major == 3: + basestring = str # pylint: disable=missing-docstring # pylint: disable=too-few-public-methods
Map basestring to str in Python 3
jssimporter_python-jss
train
py,py
6e77e38110dab7cebe626c9ddc33dad91e1618fd
diff --git a/src/GreenCape/XML/Converter.php b/src/GreenCape/XML/Converter.php index <HASH>..<HASH> 100644 --- a/src/GreenCape/XML/Converter.php +++ b/src/GreenCape/XML/Converter.php @@ -64,7 +64,6 @@ class Converter implements \Iterator, \ArrayAccess private $tag_value = ''; private $comment = array(); private $comment_index = 0; - private $doctype = ''; public function __construct($data = array()) { @@ -209,7 +208,7 @@ class Converter implements \Iterator, \ArrayAccess { // Skip '<!doctype' $stream->next(9); - $this->doctype = $stream->readTo('>'); + $stream->readTo('>'); // Skip '>' $stream->next();
Don't store doctype - it's not needed
GreenCape_xml-converter
train
php
11fdd479b2ff45a3071672fd483cdb4aa81783ec
diff --git a/tornado/testing.py b/tornado/testing.py index <HASH>..<HASH> 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -198,6 +198,10 @@ class AsyncHTTPTestCase(AsyncTestCase): return Application([('/', MyHandler)...]) def test_homepage(self): + # The following two lines are equivalent to + # response = self.fetch('/') + # but are shown in full here to demonstrate explicit use + # of self.stop and self.wait. self.http_client.fetch(self.get_url('/'), self.stop) response = self.wait() # test contents of response @@ -218,6 +222,17 @@ class AsyncHTTPTestCase(AsyncTestCase): """ raise NotImplementedError() + def fetch(self, path, **kwargs): + """Convenience method to synchronously fetch a url. + + The given path will be appended to the local server's host and port. + Any additional kwargs will be passed directly to + AsyncHTTPClient.fetch (and so could be used to pass method="POST", + body="...", etc). + """ + self.http_client.fetch(self.get_url(path), self.stop, **kwargs) + return self.wait() + def get_httpserver_options(self): """May be overridden by subclasses to return additional keyword arguments for HTTPServer.
Add a convenience method for synchronous fetches in AsyncHTTPTestCase
tornadoweb_tornado
train
py
19b3804ea032383a59bdccb4c8c7cca16d779b3d
diff --git a/cats_suite_test.go b/cats_suite_test.go index <HASH>..<HASH> 100644 --- a/cats_suite_test.go +++ b/cats_suite_test.go @@ -82,12 +82,10 @@ func TestCATS(t *testing.T) { buildCmd := exec.Command("go", "build", "-o", "bin/catnip") buildCmd.Dir = "assets/catnip" - buildCmd.Env = []string{ - fmt.Sprintf("GOPATH=%s", os.Getenv("GOPATH")), - fmt.Sprintf("GOROOT=%s", os.Getenv("GOROOT")), + buildCmd.Env = append(os.Environ(), "GOOS=linux", "GOARCH=amd64", - } + ) buildCmd.Stdout = GinkgoWriter buildCmd.Stderr = GinkgoWriter
Better to add to the existing environment than specify it completely. * The original code breaks with go <I> which requires HOME to be set. This method is more future-proof, if later versions of Go require other env vars.
cloudfoundry_cf-acceptance-tests
train
go
c0435f6becfe00e092d767244e77794197b8089d
diff --git a/packages/ember-metal/lib/logger.js b/packages/ember-metal/lib/logger.js index <HASH>..<HASH> 100644 --- a/packages/ember-metal/lib/logger.js +++ b/packages/ember-metal/lib/logger.js @@ -79,7 +79,7 @@ Ember.Logger = { warn: consoleMethod('warn') || Ember.K, /** - Prints the arguments to the console with an error icon, red text and a stack race. + Prints the arguments to the console with an error icon, red text and a stack trace. You can pass as many arguments as you want and they will be joined together with a space. ```javascript
Fixes typo in error method documentation.
emberjs_ember.js
train
js
51720433900c450925bb0b416168ec2faf260274
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ setup_args.update(dict( license='BSD', url='http://ioam.github.com/param/', packages = ["param","numbergen"], + provides = ["param","numbergen"], classifiers = [ "License :: OSI Approved :: BSD License", "Development Status :: 5 - Production/Stable",
Added 'provides' to distutils' setup() to try to get PyPI to be aware of numbergen.
pyviz_param
train
py
69d0e7aea442788e4b5374dd6c53b080aa84f69c
diff --git a/ProcessManager.php b/ProcessManager.php index <HASH>..<HASH> 100644 --- a/ProcessManager.php +++ b/ProcessManager.php @@ -723,7 +723,9 @@ class ProcessManager foreach ($this->slaves as &$slave) { $slave['keepClosed'] = true; - $slave['connection']->close(); + if(!empty($slave['connection'])) { + $slave['connection']->close(); + } } } else { $this->output->writeln(sprintf('<error>Application bootstrap failed. Restart worker ...</error>'));
Fix process manager tripple braker ;) tripple braker ;) process manager empty checker
php-pm_php-pm
train
php
76521b83113da90e74053b48f56ad6e351aad55c
diff --git a/core-bundle/src/Resources/contao/library/Contao/Database/Updater.php b/core-bundle/src/Resources/contao/library/Contao/Database/Updater.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Resources/contao/library/Contao/Database/Updater.php +++ b/core-bundle/src/Resources/contao/library/Contao/Database/Updater.php @@ -293,7 +293,7 @@ class Updater extends \Controller $this->Database->query("ALTER TABLE `tl_content` ADD ptable varchar(64) NOT NULL default ''"); // Create a content element for each news article - $objNews = $this->Database->execute("SELECT * FROM tl_news WHERE text!=''"); + $objNews = $this->Database->execute("SELECT * FROM tl_news WHERE text!='' AND source='default'"); while ($objNews->next()) { @@ -301,7 +301,7 @@ class Updater extends \Controller } // Create a content element for each event - $objEvents = $this->Database->execute("SELECT * FROM tl_calendar_events WHERE details!=''"); + $objEvents = $this->Database->execute("SELECT * FROM tl_calendar_events WHERE details!='' AND source='default'"); while ($objEvents->next()) {
[Core] Do not create content elements for news and events which redirect to articles, pages or external URLs during the version 3 update (fixes #<I>)
contao_contao
train
php
261becd8b49ed013d88e91904344fd3401fe3ac8
diff --git a/tests/index/btree_test.js b/tests/index/btree_test.js index <HASH>..<HASH> 100644 --- a/tests/index/btree_test.js +++ b/tests/index/btree_test.js @@ -907,7 +907,7 @@ function testUniqueConstraint() { function testRandomNumbers() { stub.reset(); - var ROW_COUNT = 10000; + var ROW_COUNT = 5000; var set = new goog.structs.Set(); while (set.getCount() < ROW_COUNT) { set.add(Math.floor(Math.random() * ROW_COUNT * 100));
Attempt deflake BTreeTest#testRandomNumbers on Firefox. "too much recursion" is thrown sometimes on Firefox. Reducing the number of rows in the test, reduces the recursion level from <I> to <I> which should eliminate the problem, or at least make it more rare. ------------- Created by MOE: <URL>
google_lovefield
train
js
e5cd99e90714e68c728c9a04e38198e6c1d040ed
diff --git a/spec/stat_watcher_spec.rb b/spec/stat_watcher_spec.rb index <HASH>..<HASH> 100644 --- a/spec/stat_watcher_spec.rb +++ b/spec/stat_watcher_spec.rb @@ -70,7 +70,11 @@ describe Cool.io::StatWatcher do end it "should raise when the handler does not take 2 parameters" do - class MyStatWatcher < Cool.io::StatWatcher; def on_change; end; end + class MyStatWatcher < Cool.io::StatWatcher + remove_method :on_change + def on_change + end + end expect { watcher.accessed }.to raise_error(ArgumentError) end
Remove method before redefine it This can suppress following warnings spec/stat_watcher_spec.rb:<I>: warning: method redefined; discarding old on_change spec/stat_watcher_spec.rb:<I>: warning: previous definition of on_change was here
tarcieri_cool.io
train
rb
1f01979b0514a99b3c13105df7fad0d0e2b945f5
diff --git a/lxd/api_project.go b/lxd/api_project.go index <HASH>..<HASH> 100644 --- a/lxd/api_project.go +++ b/lxd/api_project.go @@ -206,7 +206,7 @@ func projectUsedBy(ctx context.Context, tx *db.ClusterTx, project *cluster.Proje for _, instance := range instances { apiInstance := api.Instance{Name: instance.Name} - usedBy = append(usedBy, apiInstance.URL(version.Version, project.Name).String()) + usedBy = append(usedBy, apiInstance.URL(version.APIVersion, project.Name).String()) } for _, profile := range profiles {
lxd: Fixes API version for instances in project usedby.
lxc_lxd
train
go
325c7f24c7bc07f334b6fcbd2e95e4151ae05028
diff --git a/remind.py b/remind.py index <HASH>..<HASH> 100644 --- a/remind.py +++ b/remind.py @@ -470,6 +470,8 @@ class Remind(object): outdat = self.to_reminders(readOne(ical)) open(filename, 'a').write(outdat) + return Remind._get_uid(outdat) + def remove(self, uid, filename=None): """Remove the Remind command with the uid from the file""" if not filename:
Return Remind UID of appended vobject
jspricke_python-remind
train
py
853a334bf302abde2a834d54f682a7deff0d7642
diff --git a/astrodbkit/astrodb.py b/astrodbkit/astrodb.py index <HASH>..<HASH> 100755 --- a/astrodbkit/astrodb.py +++ b/astrodbkit/astrodb.py @@ -468,8 +468,9 @@ class Database: try: # Get the columns, pull out redundant ones, and query the table for this source's data - columns, types = self.query("PRAGMA table_info({})".format(table), unpack=True)[1:3] - # TODO: Fix for Python 3 + t = self.query("PRAGMA table_info({})".format(table), fmt='table') + columns = np.array(t['name']) + types = np.array(t['type']) if table == 'sources' or 'source_id' in columns: diff --git a/astrodbkit/tests/test_astrodb.py b/astrodbkit/tests/test_astrodb.py index <HASH>..<HASH> 100644 --- a/astrodbkit/tests/test_astrodb.py +++ b/astrodbkit/tests/test_astrodb.py @@ -35,6 +35,7 @@ def test_search(): def test_inventory(): bdnyc_db.inventory(1) + bdnyc_db.inventory(11) def test_sqlquery():
fixed python 3 error with inventory method
BDNYC_astrodbkit
train
py,py
f1e2213e08f805eaae07fbc14854e76044e230e1
diff --git a/pyblish_qml/models.py b/pyblish_qml/models.py index <HASH>..<HASH> 100644 --- a/pyblish_qml/models.py +++ b/pyblish_qml/models.py @@ -139,7 +139,7 @@ class Model(QtCore.QAbstractListModel): return type(item).__name__ if role in self.roles: - return getattr(item, self.roles[role]) + return getattr(item, self.roles[role], None) return QtCore.QVariant() @@ -147,6 +147,9 @@ class Model(QtCore.QAbstractListModel): return self.roles def setData(self, index, key, value): + if isinstance(index, QtCore.QModelIndex): + index = index.row() + item = self.items[index] try:
Safeguarding Model in model.py against nonexisting property queries.
pyblish_pyblish-qml
train
py
19ad174274e1aa5f691f8803c4d8240787175d51
diff --git a/java/src/playn/java/JavaMouse.java b/java/src/playn/java/JavaMouse.java index <HASH>..<HASH> 100644 --- a/java/src/playn/java/JavaMouse.java +++ b/java/src/playn/java/JavaMouse.java @@ -76,8 +76,9 @@ class JavaMouse extends MouseImpl { pointer.onMouseUp(time, m.x, m.y); } } else if (Mouse.getEventDWheel() != 0) { + int delta = Mouse.getEventDWheel() > 0 ? -1 : 1; onMouseWheelScroll(new WheelEvent.Impl( - new Events.Flags.Impl(), time, m.x, m.y, -Mouse.getEventDWheel())); + new Events.Flags.Impl(), time, m.x, m.y, delta)); } else { onMouseMove(new MotionEvent.Impl(new Events.Flags.Impl(), time, m.x, m.y, dx, dy)); pointer.onMouseMove(time, m.x, m.y);
Standardize magnitude of mouse wheel event. I think it would be OK to divide this by <I> instead. It certainly appears that in the lwjgl source, they're scaling both Mac and Linux events by <I>, and I *think* they're doing it to match what windows does naturally - but that's not entirely clear, as that detail is hidden in the native layer, and I'm no OpenGL wiz. This is safer and probably good enough for everybody.
threerings_playn
train
java
ca989f74d77aa888e194585bbbc576cf7ae2e3ce
diff --git a/btchip/btchip.py b/btchip/btchip.py index <HASH>..<HASH> 100644 --- a/btchip/btchip.py +++ b/btchip/btchip.py @@ -114,12 +114,12 @@ class btchip: return e.sw - 0x63c0 raise e - def getWalletPublicKey(self, path, showOnScreen=False): + def getWalletPublicKey(self, path, showOnScreen=False, segwit=False, segwitNative=False): result = {} donglePath = parse_bip32_path(path) if self.needKeyCache: self.resolvePublicKeysInPath(path) - apdu = [ self.BTCHIP_CLA, self.BTCHIP_INS_GET_WALLET_PUBLIC_KEY, 0x01 if showOnScreen else 0x00, 0x00, len(donglePath) ] + apdu = [ self.BTCHIP_CLA, self.BTCHIP_INS_GET_WALLET_PUBLIC_KEY, 0x01 if showOnScreen else 0x00, 0x02 if segwitNative else 0x01 if segwit else 0x00, len(donglePath) ] apdu.extend(donglePath) response = self.dongle.exchange(bytearray(apdu)) offset = 0
Add Segwit address support for GET WALLET PUBLIC KEY (requires app >= <I> for native)
LedgerHQ_btchip-python
train
py
91996cc7224429e5746fbfbaa92edbfa90aa17ca
diff --git a/skorch/net.py b/skorch/net.py index <HASH>..<HASH> 100644 --- a/skorch/net.py +++ b/skorch/net.py @@ -660,7 +660,7 @@ class NeuralNet(object): return self def forward_iter(self, X, training=False): - """Yield forward results from batches derived from data. + """Yield outputs of forward calls on each batch of data. Parameters ---------- @@ -682,7 +682,7 @@ class NeuralNet(object): Yields ------ yp : torch tensor - Result from a forward step on a batch. + Result from a forward call on an individual batch. """ self.module_.train(training)
Improve docstring on forward_iter.
skorch-dev_skorch
train
py
151fb1c1caff7bb6ed7cb736b2d75941a3a52819
diff --git a/lib/rory/application.rb b/lib/rory/application.rb index <HASH>..<HASH> 100644 --- a/lib/rory/application.rb +++ b/lib/rory/application.rb @@ -96,7 +96,7 @@ module Rory end def use_middleware(*args, &block) - @middleware << [args, block] + middleware << [args, block] end def middleware diff --git a/lib/rory/version.rb b/lib/rory/version.rb index <HASH>..<HASH> 100644 --- a/lib/rory/version.rb +++ b/lib/rory/version.rb @@ -1,3 +1,3 @@ module Rory - VERSION = '0.3.17' + VERSION = '0.3.18' end
Bug fix on uninitialized middleware array
screamingmuse_rory
train
rb,rb
f0df446e2003741b32b583676e1afdb7ef49b77d
diff --git a/src/Request.php b/src/Request.php index <HASH>..<HASH> 100644 --- a/src/Request.php +++ b/src/Request.php @@ -190,6 +190,7 @@ class Request */ public function setHeader($key, $value) { + $key = strtolower($key); $this->headers[$key] = $value; return $this; @@ -204,6 +205,8 @@ class Request */ public function getHeader($key) { + $key = strtolower($key); + return isset($this->headers[$key]) ? $this->headers[$key] : null; } @@ -281,7 +284,7 @@ class Request * * @param string $user * - * @return mixed + * @return static */ public function setUser($user) { @@ -295,7 +298,7 @@ class Request * * @param string $pass * - * @return mixed + * @return static */ public function setPass($pass) { @@ -376,6 +379,8 @@ class Request /** * Get the current encoding which will be used on the POST data + * + * @return int a Request::ENCODING_* constant */ public function getEncoding() {
headers are case-insensitive, correct docblock types
anlutro_php-curl
train
php
7a6f5d9b759a1dbafc5800534899060786491992
diff --git a/lib/gir_ffi/arg_helper.rb b/lib/gir_ffi/arg_helper.rb index <HASH>..<HASH> 100644 --- a/lib/gir_ffi/arg_helper.rb +++ b/lib/gir_ffi/arg_helper.rb @@ -105,7 +105,6 @@ module GirFFI AllocationHelper.safe_malloc FFI.type_size(type) * length end - # FIXME: Quasi-circular dependency on generated module def self.object_pointer_to_object optr gtype = GObject.type_from_instance_pointer optr wrap_object_pointer_by_gtype optr, gtype
Remove FIXME. Since ArgHelper now uses GLib::Error as well, it seems silly to worry about depending on generated modules here.
mvz_gir_ffi
train
rb
004ad510faeb18d9650787bc0530e46193c06b85
diff --git a/featurex/extractors/google.py b/featurex/extractors/google.py index <HASH>..<HASH> 100644 --- a/featurex/extractors/google.py +++ b/featurex/extractors/google.py @@ -17,11 +17,13 @@ class GoogleVisionAPIExtractor(GoogleVisionAPITransformer, ImageExtractor): features = [] data = [] for i, response in enumerate(responses): - if response: + if response and self.response_object in response: annotations = response[self.response_object] feat, values = self._parse_annotations(annotations) features += feat data += values + elif 'error' in response: + raise Exception(response['error']['message']) data = [data] onsets = [stim[i].onset if hasattr(stim[i], 'onset') else i for i in range(len(responses))]
added error handling for google extractor responses
tyarkoni_pliers
train
py
0db6e62eeaef48a4d191b1358bf6f722b34bbe1f
diff --git a/nifty-client/src/main/java/com/facebook/nifty/client/HttpClientChannel.java b/nifty-client/src/main/java/com/facebook/nifty/client/HttpClientChannel.java index <HASH>..<HASH> 100644 --- a/nifty-client/src/main/java/com/facebook/nifty/client/HttpClientChannel.java +++ b/nifty-client/src/main/java/com/facebook/nifty/client/HttpClientChannel.java @@ -94,6 +94,7 @@ public class HttpClientChannel extends AbstractClientChannel { httpRequest.setHeader(HttpHeaders.HOST, hostName); httpRequest.setHeader(HttpHeaders.CONTENT_LENGTH, request.readableBytes()); httpRequest.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-thrift"); + httpRequest.setHeader(HttpHeaders.ACCEPT, "application/x-thrift"); httpRequest.setHeader(HttpHeaders.USER_AGENT, "Java/Swift-HttpThriftClientChannel"); if (headerDictionary != null) {
Add 'Accept' header to HTTP requests (only accept thrift responses)
facebookarchive_nifty
train
java
43479fe9310a2319e2f18567acf76566ffefc2b9
diff --git a/config/webpack/webpack-base.js b/config/webpack/webpack-base.js index <HASH>..<HASH> 100644 --- a/config/webpack/webpack-base.js +++ b/config/webpack/webpack-base.js @@ -10,6 +10,10 @@ module.exports = { entry: { dicomParser: './index.js' }, + externals: { + 'zlib': 'zlib' + }, + node: false, target: 'web', output: { filename: '[name].js', diff --git a/src/parseDicom.js b/src/parseDicom.js index <HASH>..<HASH> 100644 --- a/src/parseDicom.js +++ b/src/parseDicom.js @@ -47,7 +47,7 @@ export default function parseDicom (byteArray, options) { function getDataSetByteStream (transferSyntax, position) { // Detect whether we are inside a browser or Node.js - const isNode = (typeof window === 'undefined'); + const isNode = (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'); if (transferSyntax === '1.2.840.10008.1.2.1.99') { // if an infalter callback is registered, use it
fix: Remove Node browser polyfill libraries from the build (#<I>). Also updated node check to be based off process so it properly detects within web workers. (#<I>)
cornerstonejs_dicomParser
train
js,js
cd31e940351877955b658c9ae508acbd8accc95d
diff --git a/spec/qml/dispatchable_spec.rb b/spec/qml/dispatchable_spec.rb index <HASH>..<HASH> 100644 --- a/spec/qml/dispatchable_spec.rb +++ b/spec/qml/dispatchable_spec.rb @@ -11,7 +11,6 @@ describe QML::Dispatchable do foo = DispatchableFoo.new foo.later.value = 'hoge' QML.application.process_events # wait for event loop hook to be enabled - expect(foo.value).to be_nil QML.application.process_events expect(foo.value).to eq 'hoge' end diff --git a/spec/qml/dispatcher_spec.rb b/spec/qml/dispatcher_spec.rb index <HASH>..<HASH> 100644 --- a/spec/qml/dispatcher_spec.rb +++ b/spec/qml/dispatcher_spec.rb @@ -64,7 +64,6 @@ describe QML do finished = true end QML.application.process_events # wait for event loop hook to be enabled - expect(finished).to eq false QML.application.process_events expect(finished).to eq true end
Fix specs which fail on Qt <I>
seanchas116_ruby-qml
train
rb,rb
224fdde367c5640ab83b4e70e3319cbec1a9e100
diff --git a/lib/gds_api/maslow.rb b/lib/gds_api/maslow.rb index <HASH>..<HASH> 100644 --- a/lib/gds_api/maslow.rb +++ b/lib/gds_api/maslow.rb @@ -1,5 +1,5 @@ class GdsApi::Maslow < GdsApi::Base - def need_page_url(need_id) - "#{endpoint}/needs/#{need_id}" + def need_page_url(content_id) + "#{endpoint}/needs/#{content_id}" end end
Change need_id to content_id in need_page_url This is to match changes in Maslow. Using need ids will continue to work, and this isn't required for using content ids, but may be less confusing going forward.
alphagov_gds-api-adapters
train
rb