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
d8a3a4cd4f5d4ef6bd4374b6de6a0d179cfeece1
diff --git a/components/templates/Hogan/index.js b/components/templates/Hogan/index.js index <HASH>..<HASH> 100644 --- a/components/templates/Hogan/index.js +++ b/components/templates/Hogan/index.js @@ -1,21 +1,15 @@ 'use strict'; -var React = require('react'); - var hogan = require('hogan.js'); +var React = require('react'); var HoganResult = React.createClass({ propTypes: { template: React.PropTypes.string, data: React.PropTypes.object }, - componentWillMount: function() { - this.setState({ - template: hogan.compile(this.props.template) - }); - }, render: function() { - var content = this.state.template.render(this.props.data); + var content = hogan.compile(this.props.template).render(this.props.data); return <div className="hit" dangerouslySetInnerHTML={{__html: content}} />; } });
fix: no state needed for Hogan component
algolia_instantsearch.js
train
js
8869e1cb67b6273fada8778a34ef90bbc87f954f
diff --git a/python-package/lightgbm/basic.py b/python-package/lightgbm/basic.py index <HASH>..<HASH> 100644 --- a/python-package/lightgbm/basic.py +++ b/python-package/lightgbm/basic.py @@ -934,6 +934,9 @@ class Dataset(object): # construct subset used_indices = list_to_1d_numpy(self.used_indices, np.int32, name='used_indices') assert used_indices.flags.c_contiguous + if self.reference.group is not None: + group_info = np.array(self.reference.group).astype(int) + _, self.group = np.unique(np.repeat(range_(len(group_info)), repeats=group_info)[self.used_indices], return_counts=True) self.handle = ctypes.c_void_p() params_str = param_dict_to_str(self.params) _safe_call(_LIB.LGBM_DatasetGetSubset( @@ -942,6 +945,8 @@ class Dataset(object): ctypes.c_int(used_indices.shape[0]), c_str(params_str), ctypes.byref(self.handle))) + if self.group is not None: + self.set_group(self.group) if self.get_label() is None: raise ValueError("Label should not be None.") else:
fix lgb.cv with ndcg (#<I>) * fix ndcg group * fix ndcg
Microsoft_LightGBM
train
py
2c596214592d8ba815ed3fda8627b745dd91bd06
diff --git a/js/dsx.js b/js/dsx.js index <HASH>..<HASH> 100644 --- a/js/dsx.js +++ b/js/dsx.js @@ -451,6 +451,7 @@ module.exports = class dsx extends liqui { 'takerOrMaker': takerOrMaker, 'price': price, 'amount': amount, + 'cost': price * amount, 'fee': fee, 'info': trade, };
[dsx] added cost field to parsed trade
ccxt_ccxt
train
js
d52748797b9c38dd2ea02d13e866a79dffb548cc
diff --git a/enforcer.go b/enforcer.go index <HASH>..<HASH> 100644 --- a/enforcer.go +++ b/enforcer.go @@ -125,6 +125,16 @@ func (e *Enforcer) SetModel(model model.Model) { e.model = model } +// GetAdapter gets the current adapter. +func (e *Enforcer) GetAdapter() persist.Adapter { + return e.adapter +} + +// SetAdapter sets the current adapter. +func (e *Enforcer) SetAdapter(adapter persist.Adapter) { + e.adapter = adapter +} + // ClearPolicy clears all policy. func (e *Enforcer) ClearPolicy() { e.model.ClearPolicy() diff --git a/enforcer_test.go b/enforcer_test.go index <HASH>..<HASH> 100644 --- a/enforcer_test.go +++ b/enforcer_test.go @@ -39,7 +39,8 @@ func TestCreateModelManually(t *testing.T) { e.SetModel(model) a := persist.NewFileAdapter("examples/basic_policy.csv") - a.LoadPolicy(e.GetModel()) + e.SetAdapter(a) + e.LoadPolicy() testEnforce(t, e, "alice", "data1", "read", true) testEnforce(t, e, "alice", "data1", "write", false)
Add GetAdapter() and SetAdapter() to mgmt API.
casbin_casbin
train
go,go
27029ba55b5e3604f32e34a030f40410be8d480a
diff --git a/searchquery.go b/searchquery.go index <HASH>..<HASH> 100644 --- a/searchquery.go +++ b/searchquery.go @@ -35,6 +35,7 @@ type searchQueryData struct { Explain bool `json:"explain,omitempty"` Highlight *searchQueryHighlightData `json:"highlight,omitempty"` Fields []string `json:"fields,omitempty"` + Sort []string `json:"sort,omitempty"` Facets map[string]interface{} `json:"facets,omitempty"` Ctl *searchQueryCtlData `json:"ctl,omitempty"` } @@ -80,6 +81,12 @@ func (sq *SearchQuery) Fields(fields ...string) *SearchQuery { return sq } +// Sort specifies a sorting order for the results. Only available in Couchbase Server 4.6+. +func (sq *SearchQuery) Sort(fields ...string) *SearchQuery { + sq.data.Sort = fields + return sq +} + // AddFacet adds a new search facet to include in the results. func (sq *SearchQuery) AddFacet(name string, facet interface{}) *SearchQuery { if sq.data.Facets == nil {
GOCBC-<I>: Added support for result sorting in FTS. Change-Id: If<I>de<I>c5d<I>b<I>f<I>c<I>c<I>a<I>bab9 Reviewed-on: <URL>
couchbase_gocb
train
go
744f387a4a43debedf415d5d3d7815a718950c59
diff --git a/lfs/client.go b/lfs/client.go index <HASH>..<HASH> 100644 --- a/lfs/client.go +++ b/lfs/client.go @@ -271,8 +271,7 @@ func doApiRequestWithRedirects(req *http.Request, creds Creds, via []*http.Reque via = append(via, req) if seeker, ok := req.Body.(io.Seeker); ok { - _, err := seeker.Seek(0, 0) - if err != nil { + if _, err := seeker.Seek(0, 0); err != nil { return nil, Error(err) } redirectedReq.Body = req.Body
Moved initialization statement in if statement
git-lfs_git-lfs
train
go
50093ec0136b337b6ddae874f25983587cff9c63
diff --git a/AegeanTools/source_finder.py b/AegeanTools/source_finder.py index <HASH>..<HASH> 100755 --- a/AegeanTools/source_finder.py +++ b/AegeanTools/source_finder.py @@ -1856,6 +1856,8 @@ class SourceFinder(object): islands = find_islands(im=data, bkg=np.zeros_like(data), rms=rmsimg, seed_clip=innerclip, flood_clip=outerclip, log=self.log) + self.log.info("Found {0} islands".format(len(islands))) + self.log.info("Begin fitting") #for i, xmin, xmax, ymin, ymax in self._gen_flood_wrap(data, rmsimg, innerclip, outerclip, domask=True): for island in islands: #i = island.mask @@ -1903,6 +1905,7 @@ class SourceFinder(object): if outfile: print(str(src), file=outfile) self.sources.extend(sources) + self.log.info("Fit {0} sources".format(len(sources))) return sources def priorized_fit_islands(self, filename, catalogue, hdu_index=0, outfile=None, bkgin=None, rmsin=None, cores=1,
add found/fit island/source reporting
PaulHancock_Aegean
train
py
ec44dd976ce0ce5d7680ab9250cd33eaf945e660
diff --git a/lib/knife-solo/bootstraps/linux.rb b/lib/knife-solo/bootstraps/linux.rb index <HASH>..<HASH> 100644 --- a/lib/knife-solo/bootstraps/linux.rb +++ b/lib/knife-solo/bootstraps/linux.rb @@ -82,6 +82,8 @@ module KnifeSolo::Bootstraps {:type => "yum_omnibus"} when %r{Fedora release.*? 17} {:type => "yum_omnibus"} + when %r{Fedora release.*? 18} + {:type => "yum_omnibus"} when %r{Scientific Linux.*? 5} {:type => "yum_omnibus"} when %r{Scientific Linux.*? 6}
Add Fedora <I> to known platform.
matschaffer_knife-solo
train
rb
3fb65e801265e3d5daf1a481a309edb47a3895db
diff --git a/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/Filter/LanguageFilter.php b/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/Filter/LanguageFilter.php index <HASH>..<HASH> 100644 --- a/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/Filter/LanguageFilter.php +++ b/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/Filter/LanguageFilter.php @@ -109,7 +109,7 @@ class LanguageFilter implements EventSubscriberInterface $currentLanguage = $dataProvider->getFallbackLanguage($modelId)->getLocale(); } - $session['ml_support'][$providerName][$modelId] = $currentLanguage; + $session['ml_support'][$providerName] = $currentLanguage; $sessionStorage->set('dc_general', $session); $dataProvider->setCurrentLanguage($currentLanguage);
Hotfix saving a translation jumps back to fallback language and overrides it <URL>
contao-community-alliance_dc-general
train
php
6a08cbc42c4afc0744bffa20c040e6bd39aa84a0
diff --git a/src/main/java/org/sqldroid/SQLDroidClob.java b/src/main/java/org/sqldroid/SQLDroidClob.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/sqldroid/SQLDroidClob.java +++ b/src/main/java/org/sqldroid/SQLDroidClob.java @@ -26,6 +26,10 @@ import java.sql.SQLException; * Methods in the interfaces {@link ResultSet}, {@link CallableStatement}, and {@link PreparedStatement}, such as * <code>getClob</code> and <code>setClob</code> allow a programmer to access an SQL <code>CLOB</code> value. * In addition, this interface has methods for updating a <code>CLOB</code> value. + * + * Based on ClobImpl from DataNucleus project. Thanks to DataNucleus contributors. + * @see <a href="https://github.com/datanucleus/datanucleus-rdbms/blob/master/src/main/java/org/datanucleus/store/rdbms/mapping/datastore/ClobImpl.java">ClobImpl from DataNucleus Project</a> + * */ public class SQLDroidClob implements Clob {
changes needed for working with datanucleus
SQLDroid_SQLDroid
train
java
a21fc1a52aead97d5ece06fb6d572641ca561124
diff --git a/casjobs.py b/casjobs.py index <HASH>..<HASH> 100644 --- a/casjobs.py +++ b/casjobs.py @@ -246,22 +246,3 @@ class CasJobs(object): if status[0] != 5: raise Exception("Couldn't drop table %s"%table) -if __name__ == '__main__': - jobs = CasJobs() - - print jobs.drop_table("pisces2") - - # job_id = jobs.request_output("pisces2", "FITS") - # jobs.monitor(job_id) - # jobs.get_output(job_id, "test.fits") - - raise Exception() - - job_id = jobs.submit("""SELECT * -INTO mydb.pisces2 -FROM Stripe82..Field AS p -WHERE p.mjd_g > 0 AND p.ramin < 355 AND p.ramax > 355""") - - status = jobs.monitor(job_id) - print status -
removing test code from the bottom of the file
dfm_casjobs
train
py
c9c75177bcdbe4f9c59d7a95a57d13a623a85b47
diff --git a/pylint/checkers/classes/special_methods_checker.py b/pylint/checkers/classes/special_methods_checker.py index <HASH>..<HASH> 100644 --- a/pylint/checkers/classes/special_methods_checker.py +++ b/pylint/checkers/classes/special_methods_checker.py @@ -201,6 +201,7 @@ class SpecialMethodsChecker(BaseChecker): optional = len(node.args.defaults) current_params = mandatory + optional + emit = False # If we don't know we choose a false negative if isinstance(expected_params, tuple): # The expected number of parameters can be any value from this # tuple, although the user should implement the method
Fix emit might be undefined in special method checker
PyCQA_pylint
train
py
bd256555b90f9db8aea99d5abeba8c45a44cd804
diff --git a/Twilio/Tests/Holodeck.php b/Twilio/Tests/Holodeck.php index <HASH>..<HASH> 100644 --- a/Twilio/Tests/Holodeck.php +++ b/Twilio/Tests/Holodeck.php @@ -9,22 +9,22 @@ use Twilio\Http\Response; class Holodeck implements Client { private $requests = array(); - private $response = null; + private $responses = array(); public function request($method, $url, $params = array(), $data = array(), $headers = array(), $user = null, $password = null, $timeout = null) { array_push($this->requests, new Request($method, $url, $params, $data, $headers, $user, $password)); - if ($this->response == null) { + if (count($this->responses) === 0) { return new Response(404, null, null); } else { - return $this->response; + return array_shift($this->responses); } } public function mock($response) { - $this->response = $response; + array_push($this->responses, $response); } public function assertRequest($request) {
Issue <I>: Replicating patch from kevenburke to allow multiple responses for holodeck. (#<I>)
twilio_twilio-php
train
php
21c626133adc4b5060df1081d9423024b6b7479d
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -13,7 +13,7 @@ module ActionDispatch class << self def extract_domain(host, tld_length) - host.split('.').last(1 + tld_length).join('.') if named_host?(host) + extract_domain_from(host, tld_length) if named_host?(host) end def extract_subdomains(host, tld_length) @@ -60,6 +60,10 @@ module ActionDispatch private + def extract_domain_from(host, tld_length) + host.split('.').last(1 + tld_length).join('.') + end + def add_trailing_slash(path) # includes querysting if path.include?('?') @@ -131,7 +135,7 @@ module ActionDispatch host << subdomain.to_param end host << "." unless host.empty? - host << (options[:domain] || extract_domain(_host, tld_length)) + host << (options[:domain] || extract_domain_from(_host, tld_length)) host end
reduce calls to `named_host?` `normalize_host` already calls `named_host?`, so there is no reason to test `named_host?` again in the `extract_domain` method.
rails_rails
train
rb
c40da8f5c89ac0f437624237f08f7e3b66ca0189
diff --git a/lib/fridge/version.rb b/lib/fridge/version.rb index <HASH>..<HASH> 100644 --- a/lib/fridge/version.rb +++ b/lib/fridge/version.rb @@ -1,3 +1,3 @@ module Fridge - VERSION = '0.4.3'.freeze + VERSION = '0.4.4'.freeze end
Version bump to <I> (#<I>)
aptible_fridge
train
rb
70f5489f053ad6faf7900de32a22f0a44692d5ff
diff --git a/mygeotab/py3/api_async.py b/mygeotab/py3/api_async.py index <HASH>..<HASH> 100644 --- a/mygeotab/py3/api_async.py +++ b/mygeotab/py3/api_async.py @@ -226,11 +226,16 @@ async def _query( verify = verify_ssl if verify_ssl: ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) - conn = aiohttp.TCPConnector(verify_ssl=verify, ssl_context=ssl_context, loop=loop) + conn = aiohttp.TCPConnector(ssl_context=ssl_context, loop=loop) try: async with aiohttp.ClientSession(connector=conn, loop=loop) as session: response = await session.post( - api_endpoint, data=json_serialize(params), headers=headers, timeout=timeout, allow_redirects=True + api_endpoint, + data=json_serialize(params), + headers=headers, + timeout=timeout, + allow_redirects=True, + ssl_verify=verify, ) response.raise_for_status() content_type = response.headers.get("Content-Type")
Pass ssl_verify to the client session instead of tcp connector (which was deprecated)
Geotab_mygeotab-python
train
py
4c075d14afced41cf1541ea0e62f08e9ab933fbc
diff --git a/pywb/webapp/views.py b/pywb/webapp/views.py index <HASH>..<HASH> 100644 --- a/pywb/webapp/views.py +++ b/pywb/webapp/views.py @@ -105,7 +105,7 @@ class J2TemplateView: template_result = self.render_to_string(**kwargs) status = kwargs.get('status', '200 OK') content_type = 'text/html; charset=utf-8' - return WbResponse.text_response(str(template_result), + return WbResponse.text_response(template_result.encode('utf-8'), status=status, content_type=content_type)
views: actually encode template result as utf-8!
webrecorder_pywb
train
py
4e14a6d29510ae17375ba2392d73b77b82f1e1e9
diff --git a/intranet/apps/auth/views.py b/intranet/apps/auth/views.py index <HASH>..<HASH> 100644 --- a/intranet/apps/auth/views.py +++ b/intranet/apps/auth/views.py @@ -32,8 +32,10 @@ def login_view(request): else: logger.info("Login failed") return index(request, auth_form=form) # Modified to show errors + elif request.GET.get("next"): + return redirect("/?next={}".format(request.GET.get("next"))) else: - return redirect("/logout") + return redirect('/') def logout_view(request): @@ -44,4 +46,4 @@ def logout_view(request): pass logger.info("Destroying kerberos cache and logging out") logout(request) - return redirect('/') + return redirect('/?logout=true')
redirect to ?next= when going to page requiring login
tjcsl_ion
train
py
e07592ee515c2a56a135c122d2a611ea36f2c51c
diff --git a/src/main/java/nonapi/io/github/classgraph/scanspec/ScanSpec.java b/src/main/java/nonapi/io/github/classgraph/scanspec/ScanSpec.java index <HASH>..<HASH> 100644 --- a/src/main/java/nonapi/io/github/classgraph/scanspec/ScanSpec.java +++ b/src/main/java/nonapi/io/github/classgraph/scanspec/ScanSpec.java @@ -295,6 +295,10 @@ public class ScanSpec { if (this.overrideClasspath == null) { this.overrideClasspath = new ArrayList<>(); } + if (overrideClasspathElement instanceof ClassLoader) { + throw new IllegalArgumentException( + "Need to pass ClassLoader instances to overrideClassLoaders, not overrideClasspath"); + } this.overrideClasspath .add(overrideClasspathElement instanceof String || overrideClasspathElement instanceof URL || overrideClasspathElement instanceof URI ? overrideClasspathElement
Throw exception if passing ClassLoader to overrideClasspath (#<I>)
classgraph_classgraph
train
java
b121b50f2402185cf558992cc1311d930b83c981
diff --git a/lib/models.js b/lib/models.js index <HASH>..<HASH> 100644 --- a/lib/models.js +++ b/lib/models.js @@ -31,11 +31,11 @@ function buildSchema(model) // Setup the id property Object.defineProperty(proto, 'id', { - get: function(){ return this.$$values[pk]; }, + get: function() { return this.$$values[pk]; }, set: function(val) { // We only allow setting in the event that id is undefined. - if(!this.$$values.id) + if(this.$$values.id === undefined) { this.$dirty = true; this.$$values[pk] = val; @@ -178,7 +178,7 @@ Model.prototype._validate = function(schema, updates, values) // Check to see if we have a value in $$updates, if not, then we check $$values. Finally, var val = _.has(updates, key) ? updates[key] : values[key]; - if(_.isPlainObject(type) && type.type) + if(_.isPlainObject(type) && _.isFunction(type.type)) { // `type` is an options object with the key `type`. typeDef = type;
Made some checks more strict to avoid confusion between sub-schemas and options objects.
trivialsoftware_trivialdb
train
js
3739f186355e742d891ab477e796bcb850dbddfd
diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/b2c/AADB2CTrustedIssuerRepository.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/b2c/AADB2CTrustedIssuerRepository.java index <HASH>..<HASH> 100644 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/b2c/AADB2CTrustedIssuerRepository.java +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/b2c/AADB2CTrustedIssuerRepository.java @@ -42,7 +42,7 @@ public class AADB2CTrustedIssuerRepository extends AADTrustedIssuerRepository { private void addB2CUserFlowIssuers() { Assert.notNull(resolvedBaseUri, "resolvedBaseUri cannot be null."); Assert.notNull(userFlows, "userFlows cannot be null."); - userFlows.keySet() + userFlows.values() .stream() .map(uf -> String.format("%s/tfp/%s/%s/v2.0/", resolvedBaseUri, tenantId, uf.toLowerCase(ROOT))) .forEach(this::addTrustedIssuer);
* Use value instead of key for user-flows. (#<I>)
Azure_azure-sdk-for-java
train
java
684841668728e2954d831157f22c86617a8a4099
diff --git a/js/lib/d3-timeline.js b/js/lib/d3-timeline.js index <HASH>..<HASH> 100644 --- a/js/lib/d3-timeline.js +++ b/js/lib/d3-timeline.js @@ -204,6 +204,8 @@ } else { return colorCycle( datum[colorPropertyName] ); } + } else if (hasLabel) { + return colorCycle(datum.label); } return colorCycle(index); })
Fix #<I> Use label for color instead of index Prevent other tracks from changing color when a track is split
cBioPortal_clinical-timeline
train
js
7eaedb2dd3839f46a70b5164f32c913a4a5a7d57
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -81,12 +81,13 @@ var torrentStream = function(link, opts) { if (!opts) opts = {}; if (!opts.id) opts.id = '-TS0008-'+hat(48); if (!opts.tmp) opts.tmp = TMP; - if (!opts.path) opts.path = path.join(opts.tmp, opts.name || 'torrent-stream', infoHash); + if (!opts.name) opts.name = 'torrent-stream'; + if (!opts.path) opts.path = path.join(opts.tmp, opts.name, infoHash); if (!opts.blocklist) opts.blocklist = []; var engine = new events.EventEmitter(); var swarm = pws(infoHash, opts.id, {size:opts.connections || opts.size}); - var torrentPath = path.join(opts.tmp, '.torrents', infoHash + '.torrent'); + var torrentPath = path.join(opts.tmp, opts.name, '.torrents', infoHash + '.torrent'); var wires = swarm.wires; var critical = [];
Move .torrents inside /tmp/torrent-stream/
mafintosh_torrent-stream
train
js
4a3eed038ced3a06e599a9e1fa3d2cf27c7be1de
diff --git a/gym/lib/gym/generators/package_command_generator_xcode7.rb b/gym/lib/gym/generators/package_command_generator_xcode7.rb index <HASH>..<HASH> 100644 --- a/gym/lib/gym/generators/package_command_generator_xcode7.rb +++ b/gym/lib/gym/generators/package_command_generator_xcode7.rb @@ -161,6 +161,17 @@ module Gym end hash[:teamID] = Gym.config[:export_team_id] if Gym.config[:export_team_id] + UI.important("Generated plist file with the following values:") + UI.command_output("-----------------------------------------") + UI.command_output(JSON.pretty_generate(hash)) + UI.command_output("-----------------------------------------") + if $verbose + UI.message("This results in the following plist file:") + UI.command_output("-----------------------------------------") + UI.command_output(hash.to_plist) + UI.command_output("-----------------------------------------") + end + hash.to_plist end
Print plist information in gym (#<I>)
fastlane_fastlane
train
rb
fcb544e6f473d2e778baf3533196015958ba5049
diff --git a/src/hamster/db.py b/src/hamster/db.py index <HASH>..<HASH> 100644 --- a/src/hamster/db.py +++ b/src/hamster/db.py @@ -460,13 +460,15 @@ class Storage(storage.Storage): activity = stuff.parse_activity_input(activity_name) - tags = [tag.strip() for tag in tags.split(",") if tag.strip()] # split by comma - # explicitly stated takes precedence activity.description = description or activity.description + tags = [tag.strip() for tag in tags.split(",") if tag.strip()] # split by comma + tags = tags or activity.tags # explicitly stated tags take priority + tags = self.get_tag_ids(tags) #this will create any missing tags too + if category_name: activity.category_name = category_name if description:
take tags parsed from activity name into account (fixes bug <I>)
projecthamster_hamster
train
py
6d3512b9cf3ebeabeb816d402fcda2a83ef51863
diff --git a/tweepy/pagination.py b/tweepy/pagination.py index <HASH>..<HASH> 100644 --- a/tweepy/pagination.py +++ b/tweepy/pagination.py @@ -26,11 +26,12 @@ class Paginator: count = 0 for response in PaginationIterator(self.method, *self.args, **self.kwargs): - for data in response.data: - yield data - count += 1 - if count == limit: - return + if response.data is not None: + for data in response.data: + yield data + count += 1 + if count == limit: + return class PaginationIterator:
Handle response.data being None in Paginator.flatten
tweepy_tweepy
train
py
f29ff197c62181d1d7918f7baa768d6d81f19fa4
diff --git a/PHPCI/Controller/SessionController.php b/PHPCI/Controller/SessionController.php index <HASH>..<HASH> 100644 --- a/PHPCI/Controller/SessionController.php +++ b/PHPCI/Controller/SessionController.php @@ -53,6 +53,7 @@ class SessionController extends \PHPCI\Controller $user = $this->userStore->getByEmail($this->getParam('email')); if ($user && password_verify($this->getParam('password', ''), $user->getHash())) { + session_regenerate_id(true); $_SESSION['phpci_user_id'] = $user->getId(); $response = new b8\Http\Response\RedirectResponse(); $response->setHeader('Location', $this->getLoginRedirect());
Generate an new session identifier on successful login to prevent session fixation attacks.
dancryer_PHPCI
train
php
e050014a41299b4e551c132495a7dceb14c4d36e
diff --git a/resources/lang/pt-PT/cachet.php b/resources/lang/pt-PT/cachet.php index <HASH>..<HASH> 100644 --- a/resources/lang/pt-PT/cachet.php +++ b/resources/lang/pt-PT/cachet.php @@ -34,7 +34,7 @@ return [ 'stickied' => 'Stickied Incidents', 'scheduled' => 'Maintenance', 'scheduled_at' => ', agendada :timestamp', - 'posted' => 'Posted :timestamp', + 'posted' => 'Posted :timestamp by :username', 'posted_at' => 'Posted at :timestamp', 'status' => [ 1 => 'Investigando',
New translations cachet.php (Portuguese)
CachetHQ_Cachet
train
php
3f2f49e4ab1c99c0a154c42d3c7089b502c04654
diff --git a/src/frontend/org/voltdb/SnapshotSiteProcessor.java b/src/frontend/org/voltdb/SnapshotSiteProcessor.java index <HASH>..<HASH> 100644 --- a/src/frontend/org/voltdb/SnapshotSiteProcessor.java +++ b/src/frontend/org/voltdb/SnapshotSiteProcessor.java @@ -785,9 +785,6 @@ public class SnapshotSiteProcessor { m_snapshotTargetTerminators.add(terminatorThread); terminatorThread.start(); - - // Schedule a task to clean up the buffer pool after the terminators are done - m_siteTaskerQueue.offer(new SnapshotTask()); } } return retval;
ENG-<I>: Removed redundant snapshot task queue code left from previous commit.
VoltDB_voltdb
train
java
e79960edb0d6d0153310570f87076a891385707a
diff --git a/lib/rufus/decision/matcher.rb b/lib/rufus/decision/matcher.rb index <HASH>..<HASH> 100644 --- a/lib/rufus/decision/matcher.rb +++ b/lib/rufus/decision/matcher.rb @@ -30,6 +30,10 @@ module Rufus attr_accessor :options + # Subclasses of Matcher override this method to provide matching. + # If a matcher wishes to "short-circuit" -- ie, stop further matching + # by other matchers on this cell/value while not actually matching -- + # it should return :break def matches?(cell, value) false end
document abstract method Matcher#matches?
jmettraux_rufus-decision
train
rb
91bcdeb75bf4065b22937c79e5c85715428b6cbe
diff --git a/lib/wavefront/cli/ts.rb b/lib/wavefront/cli/ts.rb index <HASH>..<HASH> 100755 --- a/lib/wavefront/cli/ts.rb +++ b/lib/wavefront/cli/ts.rb @@ -23,6 +23,7 @@ class Wavefront::Cli::Ts < Wavefront::Cli attr_accessor :options, :arguments def run + raise 'Please supply a query.' if @arguments.empty? query = @arguments[0] if @options[:minutes] @@ -34,13 +35,11 @@ class Wavefront::Cli::Ts < Wavefront::Cli elsif @options[:days] granularity = 'd' else - puts "You must specify a granularity of either --seconds, --minutes --hours or --days. See --help for more information." - exit 1 + raise "You must specify a granularity of either --seconds, --minutes --hours or --days. See --help for more information." end unless Wavefront::Client::FORMATS.include?(@options[:format].to_sym) - puts "The output format must be on of #{Wavefront::Client::FORMATS.join(', ')}" - exit 1 + raise "The output format must be one of: #{Wavefront::Client::FORMATS.join(', ')}." end options = Hash.new
don't exit from library raise an exception so the consumer can deal with it appropriately
wavefrontHQ_ruby-client
train
rb
9739f7b7b1d8f8f6d57aac1429a6f3fae9e36abe
diff --git a/sources/scalac/transformer/UnCurry.java b/sources/scalac/transformer/UnCurry.java index <HASH>..<HASH> 100644 --- a/sources/scalac/transformer/UnCurry.java +++ b/sources/scalac/transformer/UnCurry.java @@ -228,7 +228,9 @@ public class UnCurry extends OwnerTransformer * escaping */ private Tree[] toSequence(int pos, Symbol[] params, Tree[] args) { - assert (args.length != 1 || !(args[0] instanceof Tree.Sequence)); + assert (args.length != 1 + || !(args[0] instanceof Tree.Sequence) + || TreeInfo.isSequenceValued( args[0])); if (args.length == 1) { switch (args[0]) { case Typed(Tree arg, Ident(TypeNames.WILDCARD_STAR)):
uncurry should also add Sequence nodes for Alte... uncurry should also add Sequence nodes for Alternative patterns that are sequence valued.
scala_scala
train
java
12e55cbe322c33e13db9d1f038e892b4cb61f3d0
diff --git a/lib/kafka/client.rb b/lib/kafka/client.rb index <HASH>..<HASH> 100644 --- a/lib/kafka/client.rb +++ b/lib/kafka/client.rb @@ -82,6 +82,10 @@ module Kafka logger: @logger ) + if sasl_authenticator.enabled? && ssl_context.nil? + raise ArgumentError, "SASL authentication requires that SSL is configured" + end + @connection_builder = ConnectionBuilder.new( client_id: client_id, connect_timeout: connect_timeout,
Ensure SSL is configured for SASL auth
zendesk_ruby-kafka
train
rb
43f50ee1e63237b39ae38d3b40c1c757862aede5
diff --git a/src/howler.core.js b/src/howler.core.js index <HASH>..<HASH> 100644 --- a/src/howler.core.js +++ b/src/howler.core.js @@ -366,7 +366,7 @@ // Setup user-defined default properties. self._autoplay = o.autoplay || false; - self._format = o.format || null; + self._format = (typeof o.format !== 'string') ? o.format : [o.format]; self._html5 = o.html5 || false; self._muted = o.mute || false; self._loop = o.loop || false;
Allow format passed as string when only using one sound file This matches the behavior of `src`
goldfire_howler.js
train
js
4d4c9c4e6a5b3b76db88c64349f8e74e47c02d77
diff --git a/spikeextractors/extractors/yassextractors/yassextractors.py b/spikeextractors/extractors/yassextractors/yassextractors.py index <HASH>..<HASH> 100644 --- a/spikeextractors/extractors/yassextractors/yassextractors.py +++ b/spikeextractors/extractors/yassextractors/yassextractors.py @@ -4,11 +4,7 @@ import numpy as np from pathlib import Path from spikeextractors.extraction_tools import check_valid_unit_id -try: - import h5py - HAVE_SCSX = True -except ImportError: - HAVE_SCSX = False +HAVE_YASS = True class YassSortingExtractor(SortingExtractor):
Update spikeextractors/extractors/yassextractors/yassextractors.py
SpikeInterface_spikeextractors
train
py
98902a033a673d2fcd2993c1a3a533690b558ca0
diff --git a/ontobio/rdfgen/gocamgen/gocamgen.py b/ontobio/rdfgen/gocamgen/gocamgen.py index <HASH>..<HASH> 100644 --- a/ontobio/rdfgen/gocamgen/gocamgen.py +++ b/ontobio/rdfgen/gocamgen/gocamgen.py @@ -342,7 +342,7 @@ class GoCamModel: self.writer.emit_type(property_id, OWL.ObjectProperty) if evidence: - self.add_evidence(stmt_id, evidence.evidence_code, evidence.references) + self.add_evidence(stmt_id, evidence) return stmt_id
Pass full evidence object to add_evidence.
biolink_ontobio
train
py
3513143027341638744ca3ce3c740744fda07c08
diff --git a/molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/FileIngestRepositoryDecorator.java b/molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/FileIngestRepositoryDecorator.java index <HASH>..<HASH> 100644 --- a/molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/FileIngestRepositoryDecorator.java +++ b/molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/FileIngestRepositoryDecorator.java @@ -241,4 +241,10 @@ public class FileIngestRepositoryDecorator implements Repository decorated.removeEntityListener(entityListener); } + @Override + public Stream<Entity> stream(Fetch fetch) + { + return decorated.stream(fetch); + } + }
Add delegate for new stream(Fetch) method.
molgenis_molgenis
train
java
8c79548aeb0fa4ddcc60e0efcf2d1dd590a8c2c2
diff --git a/master/buildbot/test/interfaces/test_remotecommand.py b/master/buildbot/test/interfaces/test_remotecommand.py index <HASH>..<HASH> 100644 --- a/master/buildbot/test/interfaces/test_remotecommand.py +++ b/master/buildbot/test/interfaces/test_remotecommand.py @@ -83,6 +83,9 @@ class Tests(interfaces.InterfaceTests): cmd = self.makeRemoteCommand() self.assertIsInstance(cmd.active, bool) + def test_RemoteShellCommand_constructor(self): + self.remoteShellCommandClass('wkdir', 'some-command') + class TestRunCommand(unittest.TestCase, Tests):
Test that RemoteShellCommand's constructor can run with trivial arguments. This catches the error fixed in ab<I>f<I>fe1e<I>a<I>adfac9a<I>a1f9.
buildbot_buildbot
train
py
91591a375291ad3445afcb8b29796e351ab22b31
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,7 +217,11 @@ class LeftAndMainSubsites extends Extension { // Update current subsite in session Subsite::changeSubsite($_GET['SubsiteID']); - //Redirect to clear the current page + if ($this->owner->canView(Member::currentUser())) { + //Redirect to clear the current page + return $this->owner->redirect($this->owner->Link()); + } + //Redirect to the default CMS section return $this->owner->redirect('admin/'); } @@ -230,7 +234,11 @@ class LeftAndMainSubsites extends Extension { // Update current subsite in session Subsite::changeSubsite($record->SubsiteID); - //Redirect to clear the current page + if ($this->owner->canView(Member::currentUser())) { + //Redirect to clear the current page + return $this->owner->redirect($this->owner->Link()); + } + //Redirect to the default CMS section return $this->owner->redirect('admin/'); }
redirect_fix_between_CMS_sections previously if you were editing settings and you changed subsites ti would revert you to /admin, now it stays within your current controller
silverstripe_silverstripe-subsites
train
php
47e595be5632248667072bbe4b69a22960125172
diff --git a/engine/system/core/src/main/java/it/unibz/inf/ontop/materialization/impl/DefaultOntopRDFMaterializer.java b/engine/system/core/src/main/java/it/unibz/inf/ontop/materialization/impl/DefaultOntopRDFMaterializer.java index <HASH>..<HASH> 100644 --- a/engine/system/core/src/main/java/it/unibz/inf/ontop/materialization/impl/DefaultOntopRDFMaterializer.java +++ b/engine/system/core/src/main/java/it/unibz/inf/ontop/materialization/impl/DefaultOntopRDFMaterializer.java @@ -79,7 +79,7 @@ public class DefaultOntopRDFMaterializer implements OntopRDFMaterializer { private static final String CLASS_QUERY = "CONSTRUCT {?s a <%s>} WHERE {?s a <%s>}"; String getQuery() { - return String.format((arity == 1) ? CLASS_QUERY : PROPERTY_QUERY, name.toString(), name.toString()); + return String.format((arity == 1) ? CLASS_QUERY : PROPERTY_QUERY, name.getIRIString(), name.getIRIString()); } }
Bugfix: double angle brackets for IRIs during materialization.
ontop_ontop
train
java
d3cc723e50cd3058907c50e80a1b1c47443d1a1a
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -75,12 +75,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - public const VERSION = '5.3.0-DEV'; + public const VERSION = '5.3.0'; public const VERSION_ID = 50300; public const MAJOR_VERSION = 5; public const MINOR_VERSION = 3; public const RELEASE_VERSION = 0; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public const END_OF_MAINTENANCE = '05/2021'; public const END_OF_LIFE = '01/2022';
Update VERSION for <I>
symfony_symfony
train
php
178beb594c48ba60a9f01681ca839335542c243d
diff --git a/squad/core/tasks/__init__.py b/squad/core/tasks/__init__.py index <HASH>..<HASH> 100644 --- a/squad/core/tasks/__init__.py +++ b/squad/core/tasks/__init__.py @@ -100,6 +100,11 @@ class ReceiveTestRun(object): "resubmit_url", ) metadata_fields = {k: data[k] for k in fields if data.get(k)} + + job_id = metadata_fields['job_id'] + if build.test_runs.filter(job_id=job_id).exists(): + raise exceptions.InvalidMetadata("There is already a test run with job_id %s" % job_id) + else: metadata_fields = {} diff --git a/test/api/tests.py b/test/api/tests.py index <HASH>..<HASH> 100644 --- a/test/api/tests.py +++ b/test/api/tests.py @@ -180,3 +180,18 @@ class ApiTest(TestCase): } ) self.assertEqual(400, response.status_code) + + def test_reject_submission_with_existing_job_id(self): + def post(): + return self.client.post( + '/api/submit/mygroup/myproject/1.0.0/myenvironment', + { + 'metadata': open(metadata_file), + } + ) + + first = post() + second = post() + + self.assertEqual(201, first.status_code) + self.assertEqual(400, second.status_code)
api: reject test run with duplicated job_id
Linaro_squad
train
py,py
9fa211902dacba70273c50821e54de9210e0e1bd
diff --git a/tasks/release_manager.rb b/tasks/release_manager.rb index <HASH>..<HASH> 100644 --- a/tasks/release_manager.rb +++ b/tasks/release_manager.rb @@ -1,5 +1,6 @@ class ReleaseManager def initialize + assert_compatible_ruby! assert_synced_versioning! end @@ -49,6 +50,12 @@ class ReleaseManager private + def assert_compatible_ruby! + incompatible_ruby = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7.0") + + raise "Unsupported ruby version. Use ruby 2.7.0 or higher to release" if incompatible_ruby + end + def assert_synced_versioning! unsynced_versioning = npmify(gem_version) != npm_version @@ -115,7 +122,7 @@ class ReleaseManager end def bump_npm(version) - system "npm", "version", npmify(version), "--no-git-tag-version" + system "npm", "version", npmify(version), "--no-git-tag-version", exception: true end def bump_gem(version)
Raise if `npm` bump fails for some reason I used a ruby <I> feature for this. I think it's fine to only use ruby <I> or higher for realeasing.
activeadmin_activeadmin
train
rb
02c8c2fce4b81d65e20938b14b225212c4a2bef5
diff --git a/src/test/java/com/arangodb/ArangoDatabaseTest.java b/src/test/java/com/arangodb/ArangoDatabaseTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/arangodb/ArangoDatabaseTest.java +++ b/src/test/java/com/arangodb/ArangoDatabaseTest.java @@ -277,6 +277,11 @@ public class ArangoDatabaseTest extends BaseTest { @Test public void createCollectionWithSmartJoinAttributeWrong() { + if (!requireVersion(3, 5)) { + LOG.info("Skip Test because feature not implemented yet."); + return; + } + if (arangoDB.getVersion().getLicense() == License.COMMUNITY) { LOG.info("Skip Test on COMMUNITY SERVER"); return;
dismiss smart join attribute test for versions older as <I>
arangodb_arangodb-java-driver
train
java
47b8e318b71a63436fbdbf341be5ba28d0789225
diff --git a/src/Mathielen/ImportEngine/Storage/ServiceStorage.php b/src/Mathielen/ImportEngine/Storage/ServiceStorage.php index <HASH>..<HASH> 100644 --- a/src/Mathielen/ImportEngine/Storage/ServiceStorage.php +++ b/src/Mathielen/ImportEngine/Storage/ServiceStorage.php @@ -38,7 +38,7 @@ class ServiceStorage implements StorageInterface public function isCalledService($serviceOrClassname) { - return $this->callable[0] === $serviceOrClassname; + return is_string($serviceOrClassname) ? get_class($this->callable[0]) === $serviceOrClassname : $this->callable[0] === $serviceOrClassname; } public function setObjectFactory($objectFactory)
...but also allow a string
mathielen_import-engine
train
php
ab97c9fbaad2ae8bc30d63a98bec1fa6fb58dd4d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,8 @@ import sys from setuptools import setup -if sys.version_info < (3, 5): - raise Exception("Python 3.5 or higher is required. Your version is %s." % sys.version) +if sys.version_info < (3, 6): + raise Exception("Python 3.6 or higher is required. Your version is %s." % sys.version) long_description = open('README.rst').read()
Update requirement to Python <I>
blueset_ehForwarderBot
train
py
9f9916b87e52a476bc11635ef474d9014e0739e7
diff --git a/src/Credentials/EcsCredentialProvider.php b/src/Credentials/EcsCredentialProvider.php index <HASH>..<HASH> 100644 --- a/src/Credentials/EcsCredentialProvider.php +++ b/src/Credentials/EcsCredentialProvider.php @@ -78,11 +78,6 @@ class EcsCredentialProvider private function getEcsUri() { $credsUri = getenv(self::ENV_URI); - - if ($credsUri === false) { - $credsUri = isset($_SERVER[self::ENV_URI]) ? $_SERVER[self::ENV_URI] : ''; - } - return self::SERVER_URI . $credsUri; }
Internal test fix (#<I>) * Update CredentialProvider.php * Update EcsCredentialProvider.php * Update EcsCredentialProvider.php
aws_aws-sdk-php
train
php
e48f625ce4d4c57a86f98d7b19752879735d64e1
diff --git a/plugins/org.eclipse.xtext.generator/src/org/eclipse/xtext/generator/ecore/EcoreGeneratorFragment.java b/plugins/org.eclipse.xtext.generator/src/org/eclipse/xtext/generator/ecore/EcoreGeneratorFragment.java index <HASH>..<HASH> 100644 --- a/plugins/org.eclipse.xtext.generator/src/org/eclipse/xtext/generator/ecore/EcoreGeneratorFragment.java +++ b/plugins/org.eclipse.xtext.generator/src/org/eclipse/xtext/generator/ecore/EcoreGeneratorFragment.java @@ -729,12 +729,14 @@ public class EcoreGeneratorFragment extends AbstractGeneratorFragment { ResourceSet rs = new XtextResourceSet(); GenModelHelper gmh = new GenModelHelper(); for (String uriStr : getReferencedGenModels().split(",")) { - URI uri = URI.createURI(uriStr); + URI uri = URI.createURI(uriStr.trim()); gmh.registerGenModel(rs, uri); } } + } catch (ConfigurationException ce) { + throw ce; } catch (Exception e) { - log.error(e); + log.error(e, e); } }
[xtext][generator] URIs that are configured by means of the EcoreGeneratorFragment have to be trimmed, throw exception if genmodel cannot be loaded
eclipse_xtext-extras
train
java
bab1f90bda85ab22fdb05adf001cc7a93ce988f0
diff --git a/src/core/scene/a-scene.js b/src/core/scene/a-scene.js index <HASH>..<HASH> 100644 --- a/src/core/scene/a-scene.js +++ b/src/core/scene/a-scene.js @@ -662,7 +662,9 @@ module.exports.AScene = registerElement('a-scene', { AEntity.prototype.play.call(this); // .play() *before* render. // WebXR Immersive navigation handler. - navigator.xr.addEventListener('sessiongranted', function () { sceneEl.enterVR(); }); + if (this.hasWebXR) { + navigator.xr.addEventListener('sessiongranted', function () { sceneEl.enterVR(); }); + } if (sceneEl.renderStarted) { return; } sceneEl.resize();
Check for WebXR before attaching sessiongranted event listener
aframevr_aframe
train
js
1241beba851248545095f8d1f0aa8804a8678d15
diff --git a/environs/ec2/storage.go b/environs/ec2/storage.go index <HASH>..<HASH> 100644 --- a/environs/ec2/storage.go +++ b/environs/ec2/storage.go @@ -29,11 +29,24 @@ func (s *storage) makeBucket() error { } // try to make the bucket - PutBucket will succeed if the // bucket already exists. - err := s.bucket.PutBucket(s3.Private) - if err == nil { - s.madeBucket = true + if err := s.bucket.PutBucket(s3.Private); err != nil { + // PutBucket always return a 200 if we recreate an existing bucket for the + // original s3.amazonaws.com endpoint. For all other endpoints PutBucket + // returns 409 with a known subcode. + if !bucketAlreadyCreated(err) { + return err + } } - return err + + s.madeBucket = true + return nil +} + +func bucketAlreadyCreated(err error) bool { + if err, ok := err.(*s3.Error); ok { + return err.StatusCode == 409 && err.Code == "BucketAlreadyOwnedByYou" + } + return false } func (s *storage) Put(file string, r io.Reader, length int64) error {
filter out suprious <I>s
juju_juju
train
go
ac4c42bf858bc129aa6b0d15f7ef6f953fd307a7
diff --git a/integration/v7/isolated/routes_command_test.go b/integration/v7/isolated/routes_command_test.go index <HASH>..<HASH> 100644 --- a/integration/v7/isolated/routes_command_test.go +++ b/integration/v7/isolated/routes_command_test.go @@ -113,8 +113,7 @@ var _ = Describe("routes command", func() { Expect(session).ToNot(Say(`%s\s+route2\s+%s\s+%s`, spaceName, domainName, appName2)) }) - // This is blocked on CAPI error https://www.pivotaltracker.com/story/show/169884201 - XIt("lists all the routes by label", func() { + It("lists all the routes by label", func() { session := helpers.CF("routes", "--labels", "env in (prod)") Eventually(session).Should(Exit(0)) Expect(session).To(Say(`Getting routes for org %s / space %s as %s\.\.\.`, orgName, spaceName, userName))
Unpend route label integration test - The bug in CAPI has been fixed [#<I>]
cloudfoundry_cli
train
go
bdf92c6f2b377832e555d44e6c01e950870fe868
diff --git a/canmatrix/exportall.py b/canmatrix/exportall.py index <HASH>..<HASH> 100644 --- a/canmatrix/exportall.py +++ b/canmatrix/exportall.py @@ -35,7 +35,7 @@ except: try: from .exportxlsx import * except: - logger.warn("no xlsx-export-support, some dependencies missing... try pip install xlswriter") + logger.warn("no xlsx-export-support, some dependencies missing... try pip install xlsxwriter") try: from .exportyaml import *
Correct hint to `pip install xlsxwriter`
ebroecker_canmatrix
train
py
4439dbd8bd99391241b21d229b5938b299b47eb2
diff --git a/code/Checkout.php b/code/Checkout.php index <HASH>..<HASH> 100644 --- a/code/Checkout.php +++ b/code/Checkout.php @@ -136,7 +136,7 @@ class Checkout extends ViewableData { $postage_areas = $config ->PostageAreas() ->filter(array( - "Country" => array($country, "*"), + "Country:PartialMatch" => array($country, "*"), "ZipCode:PartialMatch" => array($filter_zipcode, "*") )); @@ -144,6 +144,22 @@ class Checkout extends ViewableData { foreach($postage_areas as $item) { $return->add($item); } + + // Before doing anything else, remove any wildcards (if needed) + $exact_country = false; + + // Find any countries that are exactly matched + foreach($return as $location) { + if($location->Country != "*") + $exact_country = true; + } + + // If exactly matched, remove any wildcards + foreach($return as $location) { + if($exact_country && $location->Country == "*") + $return->remove($location); + } + // Now we have a list of locations, start checking for additional // rules an remove if not applicable.
Update Postage calculation to use partialmatch on country search
i-lateral_silverstripe-checkout
train
php
9f8ec8eb74b25d4f281f3e966659b4cb2b219e65
diff --git a/QueryFilter/DoctrineODMQueryFilter.php b/QueryFilter/DoctrineODMQueryFilter.php index <HASH>..<HASH> 100644 --- a/QueryFilter/DoctrineODMQueryFilter.php +++ b/QueryFilter/DoctrineODMQueryFilter.php @@ -7,7 +7,11 @@ class DoctrineODMQueryFilter extends BaseQueryFilter public function addDefaultFilter($field, $value) { - $this->query->field($field)->equals($value); + if (is_array($value)) { + $this->query->field($field)->in($value); + } else { + $this->query->field($field)->equals($value); + } } public function addStringFilter($field, $value)
Add support to an array of values on filters for DoctrineODM.
symfony2admingenerator_AdmingeneratorGeneratorBundle
train
php
c0c286556511bc88646609bd10a364af9c8f05bb
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,6 @@ from setuptools import setup, find_packages REQUIRES = [ - 'aiohttp', 'PyYAML' ]
removed dependency to aiohttp which is no longer needed
Julius2342_pyvlx
train
py
f06e264ac528d528c2272082c657b226f4393611
diff --git a/src/arraylike.js b/src/arraylike.js index <HASH>..<HASH> 100644 --- a/src/arraylike.js +++ b/src/arraylike.js @@ -11,7 +11,7 @@ /*#endif*/ function _gpfArraySlice (array, from, to) { - return Array.prototype.slice.call(array, from, to); + return Array.prototype.slice.call(array, from, to || array.length); } var _GPF_ARRAYLIKE_TAIL_FROMINDEX = 1;
Compatibility with old hosts (#<I>)
ArnaudBuchholz_gpf-js
train
js
6ca86bcdba94e2df1e8c55912ff12022b5cee81d
diff --git a/lib/active_record/id_regions.rb b/lib/active_record/id_regions.rb index <HASH>..<HASH> 100644 --- a/lib/active_record/id_regions.rb +++ b/lib/active_record/id_regions.rb @@ -12,6 +12,10 @@ module ArRegion cache_with_timeout(:id_to_miq_region) { Hash.new } end + def self.anonymous_class_with_ar_region + @klass_with_ar_region ||= Class.new(ActiveRecord::Base).send(:include, self) + end + module ClassMethods def inherited(other) if other == other.base_class
Add module method for getting class which includes the module we can call methods as: ArRegion.anonymous_class_with_ar_region.rails_sequence_start (transferred from ManageIQ/manageiq@e0c<I>e7f8af7ff<I>e<I>ad<I>ec<I>eb4f<I>b8)
ManageIQ_activerecord-id_regions
train
rb
3802e30061a3790107e3c99d33f8780be6954811
diff --git a/javascript/libjoynr-js/src/main/js/joynr/dispatching/Dispatcher.js b/javascript/libjoynr-js/src/main/js/joynr/dispatching/Dispatcher.js index <HASH>..<HASH> 100644 --- a/javascript/libjoynr-js/src/main/js/joynr/dispatching/Dispatcher.js +++ b/javascript/libjoynr-js/src/main/js/joynr/dispatching/Dispatcher.js @@ -818,7 +818,7 @@ function Dispatcher(clusterControllerMessagingStub, securityManager, ttlUpLiftMs try { var subscriptionStop = new SubscriptionStop(payload); log.info( - "subscription stop " + subscriptionStop.subscriptionId, + "received subscription stop " + subscriptionStop.subscriptionId, DiagnosticTags.forSubscriptionStop({ subscriptionId: subscriptionStop.subscriptionId, to: joynrMessage.to,
[JS] Fixed trace for received subscription stop Change-Id: I<I>f5e9e<I>f0a9a3e<I>a<I>d<I>c5fe1
bmwcarit_joynr
train
js
2245638c1ebeb2d550ed480274c332ad395c94d1
diff --git a/jsonld.php b/jsonld.php index <HASH>..<HASH> 100644 --- a/jsonld.php +++ b/jsonld.php @@ -2435,7 +2435,11 @@ class JsonLdProcessor { if(property_exists($active_ctx->mappings, $key) && $active_ctx->mappings->{$key} && $active_ctx->mappings->{$key}->reverse) { - $reverse_map = $rval->{'@reverse'} = new stdClass(); + if(property_exists($rval, '@reverse')) { + $reverse_map = $rval->{'@reverse'}; + } else { + $reverse_map = $rval->{'@reverse'} = new stdClass(); + } $expanded_value = self::arrayify($expanded_value); foreach($expanded_value as $item) { if(self::_isValue($item) || self::_isList($item)) {
Preserve existing @reverse map when merging properties.
digitalbazaar_php-json-ld
train
php
c609660cc274f22fe46c72eb980502be79e88374
diff --git a/join.js b/join.js index <HASH>..<HASH> 100644 --- a/join.js +++ b/join.js @@ -1,5 +1,5 @@ /*jshint -W054 */ -(function (exports) { +;(function (exports) { 'use strict'; function Join(context) {
use leading ';' to protect against idiocy
FuturesJS_join
train
js
f5055f2073073fa20e0e979c0c33f1d2450ff309
diff --git a/src/Rel2MTrait.php b/src/Rel2MTrait.php index <HASH>..<HASH> 100644 --- a/src/Rel2MTrait.php +++ b/src/Rel2MTrait.php @@ -2,18 +2,18 @@ namespace KS\JsonApi; trait Rel2MTrait { - protected function add2MRel(string $name, BaseResourceInterface $resource) { + protected function add2MRel($name, BaseResourceInterface $resource) { if (!$this->has2MRel($resource)) $this->relationships[$name]->getData()[] = $resource; return $this; } - protected function has2MRel(string $name, BaseResourceInterface $resource=null) { + protected function has2MRel($name, BaseResourceInterface $resource=null) { if (!$resource || !$this->relationships[$name]->getData()) return false; foreach($this->relationships[$name]->getData() as $test) { if ($test->getId() == $resource->getId() && $test->getResourceType() == $resource->getResourceType()) return true; } return false; } - protected function remove2MRel(string $name, BaseResourceInterface $resource) { + protected function remove2MRel($name, BaseResourceInterface $resource) { if (!$this->relationships[$name]->getData()) return; foreach($this->relationships[$name]->getData() as $k => $test) { if ($test->getId() == $resource->getId() && $test->getResourceType() == $resource->getResourceType()) {
Modified relationship trait for php <I>
cfxmarkets_php-jsonapi-objects
train
php
731b0ac86f37a6888b7a09da1f286c408b25d064
diff --git a/src/conbo/utils/utils.js b/src/conbo/utils/utils.js index <HASH>..<HASH> 100644 --- a/src/conbo/utils/utils.js +++ b/src/conbo/utils/utils.js @@ -1,6 +1,6 @@ /* * Utility methods - * A subset of underscore.js methods, plus a few of our own + * A subset of Underscore.js methods, plus a few of our own */ var _ = {};
Tidied up utils.js
mesmotronic_conbo
train
js
7aa8125114d90be5959aa2c839f9e329c27a2594
diff --git a/test/server_tests.js b/test/server_tests.js index <HASH>..<HASH> 100644 --- a/test/server_tests.js +++ b/test/server_tests.js @@ -87,7 +87,7 @@ async function initRepository(dir) { } describe('Server Test', function suite() { - this.timeout(60000); + this.timeout(10000); let testRepoRoot;
revert to <I>s timeout
adobe_git-server
train
js
64b756535722ef9b9fe64f620a720bd1ee63464d
diff --git a/tests/request_headers_tests.rb b/tests/request_headers_tests.rb index <HASH>..<HASH> 100644 --- a/tests/request_headers_tests.rb +++ b/tests/request_headers_tests.rb @@ -16,6 +16,14 @@ Shindo.tests('Excon request methods') do end + tests('header order') do + tests('host is the first sent header by default').returns('host: localhost:9292') do + response = Excon.post('http://localhost:9292/') + + response.body.lines.first.chomp + end + end + end end
Test that host header is the first by default
excon_excon
train
rb
a4460ff2280ac05519096ced3f04a31977f8bc24
diff --git a/lib/Cake/Test/Case/View/Helper/RssHelperTest.php b/lib/Cake/Test/Case/View/Helper/RssHelperTest.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Test/Case/View/Helper/RssHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/RssHelperTest.php @@ -745,7 +745,7 @@ class RssHelperTest extends CakeTestCase { $item = array( 'title' => 'Title', 'dc:creator' => 'Alex', - 'xy:description' => 'descriptive words' + 'dc:description' => 'descriptive words' ); $attributes = array( 'namespace' => array( @@ -768,11 +768,11 @@ class RssHelperTest extends CakeTestCase { ), 'Alex', '/dc:creator', - 'xy:description' => array( + 'dc:description' => array( 'xmlns:dc' => 'http://link.com' ), 'descriptive words', - '/xy:description', + '/dc:description', '/item' ); $this->assertTags($result, $expected, true);
Fix tests even better than before. The current tests work on travis, but fail on jenkins. Fix that up.
cakephp_cakephp
train
php
dc31ec4aa8b1ee76277a255179e879f4fa2950a1
diff --git a/oauth2client/crypt.py b/oauth2client/crypt.py index <HASH>..<HASH> 100644 --- a/oauth2client/crypt.py +++ b/oauth2client/crypt.py @@ -89,12 +89,12 @@ def make_signed_jwt(signer, payload, key_id=None): header['kid'] = key_id segments = [ - _urlsafe_b64encode(_json_encode(header)), - _urlsafe_b64encode(_json_encode(payload)), + _urlsafe_b64encode(_json_encode(header)), + _urlsafe_b64encode(_json_encode(payload)), ] signing_input = b'.'.join(segments) - signature = signer.sign(signing_input).rstrip(b'=') + signature = signer.sign(signing_input) segments.append(_urlsafe_b64encode(signature)) logger.debug(str(segments))
Fixing bug where '=' was stripped from signed bytes. Fixes #<I>.
googleapis_oauth2client
train
py
2d11302c7e0401d0a2479ea6186351a93dd1763d
diff --git a/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go b/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go index <HASH>..<HASH> 100644 --- a/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go +++ b/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go @@ -16,6 +16,7 @@ func TestAccAwsVpcIpv4CidrBlockAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsVpcIpv4CidrBlockAssociationDestroy, Steps: []resource.TestStep{
tests/r/vpc_ipv4_cidr_block_association: Add ErrorCheck
terraform-providers_terraform-provider-aws
train
go
7ceb560d46ace5edd42728978f0b1f4c5e48a731
diff --git a/public/js/share-codemirror-json.js b/public/js/share-codemirror-json.js index <HASH>..<HASH> 100644 --- a/public/js/share-codemirror-json.js +++ b/public/js/share-codemirror-json.js @@ -160,7 +160,15 @@ timestamp: new Date () }}); } else { - if (change.origin !== 'paste' && change.origin !== 'redo' && change.origin !== 'undo') { + /* + * For the following values of change.origin, we know what we want to happen. + * - null - this is a programmatic insertion + * - paste, redo, undo - cm detected the indicated behavior + * + * For others, they'll have to fall through and be handled accordingly. + * Not having this conditional here leads to things breaking... + */ + if (change.origin && change.origin !== 'paste' && change.origin !== 'redo' && change.origin !== 'undo') { console.warn('not sure what to do in this case', change); } else {
Properly handle text inserted via api calls. Previously, inserting multiple lines with the insertTextAtCursor call was breaking the timestamps. Now, handle this the same as if someone copy and pasted a block of text in, etc. Fixes #<I>.
VisionistInc_jibe
train
js
fe1e95e44d17596732b28edc4baca47b194f175b
diff --git a/aws/convert_types_test.go b/aws/convert_types_test.go index <HASH>..<HASH> 100644 --- a/aws/convert_types_test.go +++ b/aws/convert_types_test.go @@ -562,7 +562,7 @@ func TestTimeValueSlice(t *testing.T) { } for i := range out2 { if in[i] == nil { - if !(*(out2[i])).IsZero() { + if !(out2[i]).IsZero() { t.Errorf("Unexpected value at idx %d", idx) } } else { diff --git a/aws/credentials/stscreds/web_identity_provider.go b/aws/credentials/stscreds/web_identity_provider.go index <HASH>..<HASH> 100644 --- a/aws/credentials/stscreds/web_identity_provider.go +++ b/aws/credentials/stscreds/web_identity_provider.go @@ -26,9 +26,7 @@ const ( // now is used to return a time.Time object representing // the current time. This can be used to easily test and // compare test values. -var now = func() time.Time { - return time.Now() -} +var now = time.Now // WebIdentityRoleProvider is used to retrieve credentials using // an OIDC token.
Cleanup unneeded wrapping of values in aws and stscreds package (#<I>) Cleans up unneeded wrapping of values in the aws and stscreds package: * aws: removes pointer dereference for `IsZero` method call. * stscreds: removes anonymous function wrapping `time.Now`
aws_aws-sdk-go
train
go,go
c13c2b4f0dd6eff0b89ebb81c28dfe842074dfa9
diff --git a/core/generator/generator.go b/core/generator/generator.go index <HASH>..<HASH> 100644 --- a/core/generator/generator.go +++ b/core/generator/generator.go @@ -102,7 +102,7 @@ func GetBlocks(ctx context.Context, c *protocol.Chain, afterHeight uint64) ([]*b return nil, errors.Wrapf(err, "waiting for block at height %d", afterHeight+1) } - const q = `SELECT data FROM blocks WHERE height > $1 ORDER BY height` + const q = `SELECT data FROM blocks WHERE height > $1 ORDER BY height LIMIT 10` var blocks []*bc.Block err = pg.ForQueryRows(ctx, q, afterHeight, func(b bc.Block) { blocks = append(blocks, &b)
core/generator: limit blocks fetched at a time It would be bad to reply with a bajillion blocks when a client is connecting for the first time. Closes chain/chainprv#<I>. Reviewers: @jbowens
chain_chain
train
go
6644675831a5a87c77f66697124d95ab37202509
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_view/template/error.rb +++ b/actionpack/lib/action_view/template/error.rb @@ -43,8 +43,9 @@ module ActionView end class Template - # The Template::Error exception is raised when the compilation of the template fails. This exception then gathers a - # bunch of intimate details and uses it to report a very precise exception message. + # The Template::Error exception is raised when the compilation or rendering of the template + # fails. This exception then gathers a bunch of intimate details and uses it to report a + # precise exception message. class Error < ActionViewError #:nodoc: SOURCE_CODE_RADIUS = 3
Template::Error is also used if rendering fails.
rails_rails
train
rb
05504784e8586f1401d9b984380e34570976d7c3
diff --git a/exponential.go b/exponential.go index <HASH>..<HASH> 100644 --- a/exponential.go +++ b/exponential.go @@ -37,6 +37,7 @@ func NewExponential(options ...Option) *Exponential { interval: interval, jitterFactor: jitterFactor, maxRetries: maxRetries, + random: rand.New(rand.NewSource(time.Now().UnixNano())), threshold: threshold, } } @@ -65,7 +66,7 @@ func (b *exponentialBackoff) delayForAttempt(attempt float64) time.Duration { jitteredMin := durf - jitterDelta jitteredMax := durf + jitterDelta - durf = jitteredMin + rand.Float64()*(jitteredMax-jitteredMin+1) + durf = jitteredMin + b.policy.random.Float64()*(jitteredMax-jitteredMin+1) } dur := time.Duration(durf) diff --git a/interface.go b/interface.go index <HASH>..<HASH> 100644 --- a/interface.go +++ b/interface.go @@ -2,6 +2,7 @@ package backoff import ( "context" + "math/rand" "sync" "time" ) @@ -50,11 +51,11 @@ type constantBackoff struct { // Exponential implements an exponential backoff policy. type Exponential struct { - // next = interval * (value in [1 - jitterFactor, 1 + jitterFactor]) factor float64 interval time.Duration jitterFactor float64 maxRetries int + random *rand.Rand threshold time.Duration // max backoff }
Seed the RNG differently depending on the instance
lestrrat-go_backoff
train
go,go
8787138fc378c1ece5e0aad1d9171ef856d92a9b
diff --git a/src/Definition/Column.php b/src/Definition/Column.php index <HASH>..<HASH> 100644 --- a/src/Definition/Column.php +++ b/src/Definition/Column.php @@ -6,6 +6,7 @@ * @package contao-bootstrap * @subpackage Grid * @author David Molineus <david.molineus@netzmacht.de> + * @author Florian Vick <florian@florian-vick.de> * @copyright 2017 netzmacht David Molineus. All rights reserved. * @license https://github.com/contao-bootstrap/grid/blob/master/LICENSE LGPL 3.0 * @filesource @@ -184,7 +185,7 @@ class Column if ($this->cssClasses) { $classes = array_merge($classes, $this->cssClasses); } - + return array_unique($classes); } @@ -218,7 +219,7 @@ class Column /** * Build the align setting. * - * @param array $classes Column classes. + * @param array $classes Column classes. * @param string $sizeSuffix Bootstrap Size suffix like 'md' or 'lg'. * * @return void @@ -233,7 +234,7 @@ class Column /** * Build the justify setting. * - * @param array $classes Column classes. + * @param array $classes Column classes. * @param string $sizeSuffix Bootstrap Size suffix like 'md' or 'lg'. * * @return void
Modifications to match coding standards
contao-bootstrap_grid
train
php
52222c6f912b8c537874bd0107bedf55c9bd3079
diff --git a/xblock/exceptions.py b/xblock/exceptions.py index <HASH>..<HASH> 100644 --- a/xblock/exceptions.py +++ b/xblock/exceptions.py @@ -50,7 +50,16 @@ class NoSuchViewError(Exception): """ Raised to indicate that the view requested was not found. """ - pass + def __init__(self, block, view_name): + """ + Create a new NoSuchViewError + + :param block: The XBlock without a view + :param view_name: The name of the view that couldn't be found + """ + # Can't use super because Exception is an old-style class + Exception.__init__(self, "Unable to find view {!r} on block {!r}".format(view_name, block)) + class NoSuchHandlerError(Exception): diff --git a/xblock/runtime.py b/xblock/runtime.py index <HASH>..<HASH> 100644 --- a/xblock/runtime.py +++ b/xblock/runtime.py @@ -350,7 +350,7 @@ class Runtime(object): if view_fn is None: view_fn = getattr(block, "fallback_view", None) if view_fn is None: - raise NoSuchViewError() + raise NoSuchViewError(block, view_name) view_fn = functools.partial(view_fn, view_name) frag = view_fn(context)
Make NoSuchViewError record what the name of the missing view was
edx_XBlock
train
py,py
11cbc4f1827ec5ffbad27767a579820f1cd52d63
diff --git a/src/sap.m/src/sap/m/Table.js b/src/sap.m/src/sap/m/Table.js index <HASH>..<HASH> 100644 --- a/src/sap.m/src/sap/m/Table.js +++ b/src/sap.m/src/sap/m/Table.js @@ -810,7 +810,7 @@ sap.ui.define([ id: this.getId() + "-clearSelection", src: "sap-icon://clear-all", decorative: false, - press: this.removeSelections.bind(this, false, true) + press: this.removeSelections.bind(this, false, true, false) }).setParent(this, null, true).addEventDelegate({ onAfterRendering: function() { this._clearAllButton.getDomRef().setAttribute("tabindex", -1);
[INTERNAL] Table: fix clearAllButton press handler The press handler for the clearAllButton were having incorrect parameters which caused problem in deselecting the items correclty. The parameters are now adapted correctly to fix the issue. Change-Id: Ib4ee5f<I>bb2e<I>a<I>d7b<I>ab4af<I>a<I>
SAP_openui5
train
js
578afc9704f6193561c3d2219f1f86109d7599b0
diff --git a/xray/dataset.py b/xray/dataset.py index <HASH>..<HASH> 100644 --- a/xray/dataset.py +++ b/xray/dataset.py @@ -995,9 +995,11 @@ class Dataset(Mapping): dimension. If not supplied, indexers is inferred from the length of each variable along the dimension, and the variables are stacked in the given order. - concat_over : None or str or iterable of str, optional + concat_over : None or str or iterable of str or True, optional Names of additional variables to concatenate, in which "dimension" - does not already appear as a dimension. + does not already appear as a dimension. If True all noncoordinate + variables that are not the same across all datasets will be + concatenated over. Returns ------- @@ -1018,6 +1020,11 @@ class Dataset(Mapping): # figure out variables to concatenate over if concat_over is None: concat_over = set() + elif concat_over is True: + # all noncoordinates that are not the same in each dataset + concat_over = {k for k, v in datasets[0].noncoordinates.iteritems() + if not all(utils.xarray_equal(ds[k], v) + for ds in datasets[1:])} elif isinstance(concat_over, basestring): concat_over = {concat_over} else:
Dataset.concat() can now automatically concat over non-equal variables. concat_over=True indicates that concat should concat over all variables that are not the same in the set of datasets that are to be concatenated.
pydata_xarray
train
py
09fa917eb4a2026cb1e39228bd55215b322d142a
diff --git a/app/models/renalware/medications/revise_prescription.rb b/app/models/renalware/medications/revise_prescription.rb index <HASH>..<HASH> 100644 --- a/app/models/renalware/medications/revise_prescription.rb +++ b/app/models/renalware/medications/revise_prescription.rb @@ -17,6 +17,8 @@ module Renalware private def terminate_existing_prescription(params) + return if prescription.termination.present? + prescription.terminate(by: params[:by]).save! end
Don't terminate a prescription again
airslie_renalware-core
train
rb
394f9f5749f0cbd6942d8513b68bf99c68d69de7
diff --git a/tests/index.js b/tests/index.js index <HASH>..<HASH> 100644 --- a/tests/index.js +++ b/tests/index.js @@ -81,6 +81,7 @@ describe("style-manifest", function() { }); }); + it("should handle a multiple style types", async function() { input.write({ "src": { @@ -148,7 +149,6 @@ describe("style-manifest", function() { }); - it("should handle a no styles", async function() { input.write({ "src": { @@ -171,5 +171,4 @@ describe("style-manifest", function() { ` + os.EOL }); }); - });
chore(whitespace): cleaned up some whitespace in the tests
webark_broccoli-style-manifest
train
js
781a358e80cf2435f3ceab2214a6740d11e7b4fb
diff --git a/Console/Migrations/FreshCommand.php b/Console/Migrations/FreshCommand.php index <HASH>..<HASH> 100644 --- a/Console/Migrations/FreshCommand.php +++ b/Console/Migrations/FreshCommand.php @@ -52,6 +52,7 @@ class FreshCommand extends Command '--path' => $this->input->getOption('path'), '--realpath' => $this->input->getOption('realpath'), '--force' => true, + '--step' => $this->option('step'), ]); if ($this->needsSeeding()) { @@ -131,6 +132,8 @@ class FreshCommand extends Command ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'], ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'], + + ['step', null, InputOption::VALUE_NONE, 'Force the migrations to be run so they can be rolled back individually'], ]; } }
[<I>] Add --step to migrate:fresh command (#<I>) * Add --step flag to migrate:fresh command Adds a flag to enable running migrations in step with the migrate:fresh command * StyleCI fixes
illuminate_database
train
php
ee690017f13488572094e44181d03ca0d95c283f
diff --git a/lib/knapsack_pro/runners/queue/rspec_runner.rb b/lib/knapsack_pro/runners/queue/rspec_runner.rb index <HASH>..<HASH> 100644 --- a/lib/knapsack_pro/runners/queue/rspec_runner.rb +++ b/lib/knapsack_pro/runners/queue/rspec_runner.rb @@ -131,7 +131,11 @@ module KnapsackPro end RSpec.world.example_groups.clear RSpec.configuration.start_time = ::RSpec::Core::Time.now - RSpec.configuration.reset_filters + + # skip reset filters for old RSpec versions + if RSpec.configuration.respond_to?(:reset_filters) + RSpec.configuration.reset_filters + end end end end
Call reset_filters for RSpec only if this method exists. This way we won't call it for old RSpec version like <I>
KnapsackPro_knapsack_pro-ruby
train
rb
e78909f531eadd8ae11849354624b7c06e3e8572
diff --git a/src/infi/instruct/buffer/__init__.py b/src/infi/instruct/buffer/__init__.py index <HASH>..<HASH> 100644 --- a/src/infi/instruct/buffer/__init__.py +++ b/src/infi/instruct/buffer/__init__.py @@ -1,2 +1,2 @@ -from .buffer import Buffer +from .buffer import Buffer, BufferType from .macros import *
added BufferType to the infi.instruct.buffer imports
Infinidat_infi.instruct
train
py
9ed467dd99c85c7017afe3ee7419f18290d73bb4
diff --git a/src/BuildRunner.php b/src/BuildRunner.php index <HASH>..<HASH> 100644 --- a/src/BuildRunner.php +++ b/src/BuildRunner.php @@ -95,6 +95,7 @@ class BuildRunner { // variable to be changed mid-run by an outside force such as a unit test. $watchMessage = $continue ? "Watching for changes..." : null; do { + $errors = []; $updates = $build->build($errors); foreach($updates as $update) { $this->stream->writeLine(
Don't continue executing on error until next change detected, fixes #6
PhpGt_Build
train
php
21d0879bc4d53c00a209e8fb23fb143c3b6334cf
diff --git a/example.js b/example.js index <HASH>..<HASH> 100644 --- a/example.js +++ b/example.js @@ -28,7 +28,7 @@ steamClient.on('logOnResponse', function(logonResp) { }); steamClient.on('servers', function(servers) { - fs.writeFile('servers', JSON.stringify(servers)); + fs.writeFileSync('servers', JSON.stringify(servers)); }); steamFriends.on('chatInvite', function(chatRoomID, chatRoomName, patronID) {
Fix missing callback in example.js
seishun_node-steam
train
js
cf0696522a826c8570effc2d8a486c6f0601814c
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +'use strict'; const fsp = require('fs-promise'); const newLineCharacters = ["\n", "\r"]
fix(strict): add use strict to index no issue - in node v4 requiring this library throws an error because `const` and `let` aren't allowed outside of strict mode
alexbbt_read-last-lines
train
js
13d1be7cde913b72365172ca14b7d717531c24a1
diff --git a/jupyterdrive/gdrive/drive-contents.js b/jupyterdrive/gdrive/drive-contents.js index <HASH>..<HASH> 100644 --- a/jupyterdrive/gdrive/drive-contents.js +++ b/jupyterdrive/gdrive/drive-contents.js @@ -104,30 +104,6 @@ define(function(require) { .catch(function(err) {console.log(err)}); }; - Contents.prototype.delete_notebook = function(name, path) { - var settings = { - processData : false, - cache : false, - type : "DELETE", - dataType : "json", - success : $.proxy(this.events.trigger, this.events, - 'notebook_deleted.Contents', - { - name: name, - path: path - }), - error : utils.log_ajax_error - }; - var url = utils.url_join_encode( - this.base_url, - 'api/contents', - path, - name - ); - $.ajax(url, settings); - }; - - Contents.prototype.delete = function(path) { return drive_utils.get_id_for_path(path, drive_utils.FileType.FILE) .then(function(file_id){
Remove delete_notebook method from Contents This method is no longer part of the API.
jupyter_jupyter-drive
train
js
bf7460a74708ca9b33700b070910d9377627ab27
diff --git a/prow/cmd/line/main.go b/prow/cmd/line/main.go index <HASH>..<HASH> 100644 --- a/prow/cmd/line/main.go +++ b/prow/cmd/line/main.go @@ -388,7 +388,6 @@ func (c *testClient) TestPRJenkins() error { return nil } logrus.WithFields(fields(c)).Info("Starting build.") - c.tryCreateStatus("", github.StatusPending, "Build triggered.", "") b, err := c.JenkinsClient.Build(jenkins.BuildRequest{ JobName: c.Presubmit.Name, Number: c.PRNumber, @@ -406,6 +405,7 @@ func (c *testClient) TestPRJenkins() error { c.tryCreateStatus("", github.StatusError, "Error queueing build.", testInfra) return err } + c.tryCreateStatus("", github.StatusPending, "Build queued.", "") for eq { // Wait for it to move out of the queue time.Sleep(10 * time.Second) eq, err = c.JenkinsClient.Enqueued(b)
Set a status message that a build is in the queue. This is clearer than noting that a build has been triggered.
kubernetes_test-infra
train
go
df3f9178de584e79a23a83eebfc8d114fee3249a
diff --git a/elastic/datadog_checks/elastic/config_models/validators.py b/elastic/datadog_checks/elastic/config_models/validators.py index <HASH>..<HASH> 100644 --- a/elastic/datadog_checks/elastic/config_models/validators.py +++ b/elastic/datadog_checks/elastic/config_models/validators.py @@ -18,5 +18,9 @@ def initialize_instance(values, **kwargs): # Each query must have both `name` and `value_path` if not (column.get('value_path') and column.get('name')): raise ValueError('Each column must have a `value_path` and `name` values') + if column.get('type', 'gauge') not in ['gauge', 'monotonic_count', 'rate', 'tag']: + raise ValueError( + 'Metric type {} not recognized for custom query {}'.format(column.get('type'), column) + ) return values
Validate custom query column type (#<I>)
DataDog_integrations-core
train
py
260a7911224ee5bd2e0c39ddef3b98054b01e9d4
diff --git a/Python/phate/cluster.py b/Python/phate/cluster.py index <HASH>..<HASH> 100644 --- a/Python/phate/cluster.py +++ b/Python/phate/cluster.py @@ -2,7 +2,7 @@ import graphtools from sklearn import cluster, exceptions -def kmeans(phate_op, k=8): +def kmeans(phate_op, k=8, random_state=None): """KMeans on the PHATE potential Clustering on the PHATE operator as introduced in Moon et al. @@ -15,6 +15,8 @@ def kmeans(phate_op, k=8): Fitted PHATE operator k : int, optional (default: 8) Number of clusters + random_state : int or None, optional (default: None) + Random seed for k-means Returns ------- @@ -25,7 +27,7 @@ def kmeans(phate_op, k=8): diff_potential = phate_op.calculate_potential() if isinstance(phate_op.graph, graphtools.graphs.LandmarkGraph): diff_potential = phate_op.graph.interpolate(diff_potential) - return cluster.KMeans(k).fit_predict(diff_potential) + return cluster.KMeans(k, random_state=random_state).fit_predict(diff_potential) else: raise exceptions.NotFittedError( "This PHATE instance is not fitted yet. Call "
add random_state to cluster.kmeans
KrishnaswamyLab_PHATE
train
py
45ca743d532704f5b905f5377b45b555cd828b94
diff --git a/lib/aws.rb b/lib/aws.rb index <HASH>..<HASH> 100644 --- a/lib/aws.rb +++ b/lib/aws.rb @@ -1,5 +1,8 @@ module Aws + # @api private + GEM_ROOT = File.dirname(File.dirname(__FILE__)) + @config = {} autoload :Credentials, 'aws/credentials' @@ -153,9 +156,11 @@ module Aws private + # @return Returns a hash of API paths grouped by their service class names. def bundled_apis - apis = File.join(File.dirname(File.dirname(__FILE__)), 'apis', '*.json') - Dir.glob(apis).group_by { |path| File.basename(path).split('-').first } + Dir.glob(File.join(GEM_ROOT, 'apis', '*.json')).group_by do |path| + File.basename(path).split('-').first + end end end
Added a GEM_ROOT constant. This is used for loading bundled APIs.
aws_aws-sdk-ruby
train
rb
e997dd4f60fcb2bc48f35c46dc93dbc0bc544d78
diff --git a/test/naomi.js b/test/naomi.js index <HASH>..<HASH> 100644 --- a/test/naomi.js +++ b/test/naomi.js @@ -39,7 +39,7 @@ describe('naomi', function () { assert.instanceOf(db._engine, MySQLEngine); }); - it('returns a new POSTGRES Database when "postgres" type is specified', function () { + it('returns a new Postgres Database when "postgres" type is specified', function () { var db = naomi.create('postgres'); assert.instanceOf(db._engine, PostgresEngine); });
No need to have postgres written in uppercase in the unit-test.
jmike_naomi
train
js
61a92b60c50110ab49512c8cd522d49c494acf63
diff --git a/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java b/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java index <HASH>..<HASH> 100644 --- a/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java +++ b/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java @@ -1563,6 +1563,19 @@ public class Drawer { */ public void addItem(IDrawerItem drawerItem, int position) { if (mDrawer.mDrawerItems != null) { + mDrawer.mDrawerItems.add(position, drawerItem); + mDrawer.mAdapter.dataUpdated(); + } + } + + /** + * Set a drawerItem at a specific position + * + * @param drawerItem + * @param position + */ + public void setItem(IDrawerItem drawerItem, int position) { + if (mDrawer.mDrawerItems != null) { mDrawer.mDrawerItems.set(position, drawerItem); mDrawer.mAdapter.dataUpdated(); }
* split up addItem and setItem methods
mikepenz_MaterialDrawer
train
java
4b67aac4f9e8cfe9f4d1027368f25212a1161b5b
diff --git a/lib/Doctrine/ODM/CouchDB/Mapping/MappingException.php b/lib/Doctrine/ODM/CouchDB/Mapping/MappingException.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/ODM/CouchDB/Mapping/MappingException.php +++ b/lib/Doctrine/ODM/CouchDB/Mapping/MappingException.php @@ -60,4 +60,11 @@ class MappingException extends \Exception "parent classes: " . implode(", ", $parents) ); } + + public static function mappingFileNotFound($className, $filename) + { + return new self( + "Mapping file: '" . $filename . "' not found, for class: '" . $className . "'." + ); + } }
Update lib/Doctrine/ODM/CouchDB/Mapping/MappingException.php Add missing method static factory method for MappingException. This is used by DoctrineCouchDBBundle in the XML and YAML drivers.
doctrine_couchdb-odm
train
php
625f57778b6e35aeaec501e1cb7800b42166b1ae
diff --git a/spec/graphql/language/lexer_spec.rb b/spec/graphql/language/lexer_spec.rb index <HASH>..<HASH> 100644 --- a/spec/graphql/language/lexer_spec.rb +++ b/spec/graphql/language/lexer_spec.rb @@ -26,5 +26,9 @@ describe GraphQL::Language::Lexer do it "unescapes escaped unicode characters" do assert_equal "\t", subject.tokenize('"\\u0009"').first.to_s end + + it "rejects bad unicode, even when there's good unicode in the string" do + assert_equal :BAD_UNICODE_ESCAPE, subject.tokenize('"\\u0XXF \\u0009"').first.name + end end end
spec(Lexer) add spec for good and bad unicode in the same string
rmosolgo_graphql-ruby
train
rb
6a5c0589541293e68c8880594e55e303fe607b49
diff --git a/src/main/java/com/podio/app/ApplicationField.java b/src/main/java/com/podio/app/ApplicationField.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/podio/app/ApplicationField.java +++ b/src/main/java/com/podio/app/ApplicationField.java @@ -13,6 +13,11 @@ public class ApplicationField extends ApplicationFieldCreate { * The external id of the field */ private String externalId; + + /** + * Indicates if the field was deleted in Podio - values include "active" and "deleted". + */ + private String status; @JsonProperty("field_id") public int getId() { @@ -32,4 +37,14 @@ public class ApplicationField extends ApplicationFieldCreate { public void setExternalId(String externalId) { this.externalId = externalId; } + + @JsonProperty("status") + public String getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(String status) { + this.status = status; + } }
support for status of application fields to recognize deleted fields.
podio_podio-java
train
java
f6bb0e3922432a4667033955c92bc5310379bd82
diff --git a/great_expectations/cli/__init__.py b/great_expectations/cli/__init__.py index <HASH>..<HASH> 100755 --- a/great_expectations/cli/__init__.py +++ b/great_expectations/cli/__init__.py @@ -240,7 +240,7 @@ it will walk you through configuring the database connection and next steps. "database": "postgres" } context.add_profile_credentials(data_source_name, **credentials) - context.add_datasource(data_source_name, "sqlalchemy", profile_name=data_source_name) + context.add_datasource(data_source_name, "sqlalchemy", profile=data_source_name) elif data_source_selection == "1": # csv
Fixed arg name from profile_name to profile
great-expectations_great_expectations
train
py
c0268f7f6b4850ee99f8eb94e9cf396de45a476f
diff --git a/morp/main.py b/morp/main.py index <HASH>..<HASH> 100644 --- a/morp/main.py +++ b/morp/main.py @@ -4,7 +4,7 @@ from .app import SQLApp, Session, BaseApp from .sql import Base import os from zope.sqlalchemy import register as register_session -from more.jwtauth import JWTIdentityPolicy +from authmanager.authpolicy import JWTWithAPIKeyIdentityPolicy from more.basicauth import BasicAuthIdentityPolicy from morp.exc import ConfigurationError import transaction @@ -16,7 +16,7 @@ def get_identity_policy(settings): jwtauth_settings = getattr(settings, 'jwtauth', None) if jwtauth_settings: # Pass the settings dictionary to the identity policy. - return JWTIdentityPolicy(**jwtauth_settings.__dict__.copy()) + return JWTWithAPIKeyIdentityPolicy(**jwtauth_settings.__dict__.copy()) raise Exception('JWTAuth configuration is not set')
use JWTPolicy from authmanager
morpframework_morpfw
train
py
1e2e9d73bfe05a81e44492a60cd9223bcbd926cc
diff --git a/lib/feed-summary.js b/lib/feed-summary.js index <HASH>..<HASH> 100644 --- a/lib/feed-summary.js +++ b/lib/feed-summary.js @@ -67,8 +67,8 @@ function groupMessages (messages, filter) { const group = ensureMessage(c.root, messageUpdates) group.lastUpdateType = 'reply' group.repliesFrom.add(msg.value.author) - SortedArray.add(group.replies, msg, compareUserTimestamp) - + //SortedArray.add(group.replies, msg, compareUserTimestamp) + group.replies.push(msg) group.channel = group.channel || msg.value.content.channel group.updated = msg.timestamp } else {
go back to showing replies in sync order (rather than timestamp order)
ssbc_patchwork
train
js
49569bb09fe9465a4fc0a80afa48cde7e0eea1a6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ def get_required_packages(): Plus any version tests and warnings """ install_requires = ['six', - 'mizani >= 0.3.4', + 'mizani >= 0.4.0', 'matplotlib >= 2.0.0', 'numpy', 'scipy',
Bump mizani requirement to <I>
has2k1_plotnine
train
py
964d9d8ddc167ea498da6d05af626c1252f56687
diff --git a/src/python/pants/backend/go/util_rules/go_pkg.py b/src/python/pants/backend/go/util_rules/go_pkg.py index <HASH>..<HASH> 100644 --- a/src/python/pants/backend/go/util_rules/go_pkg.py +++ b/src/python/pants/backend/go/util_rules/go_pkg.py @@ -186,7 +186,6 @@ async def resolve_go_package( go_mod_spec_path = owning_go_mod.address.spec_path assert request.address.spec_path.startswith(go_mod_spec_path) spec_subpath = request.address.spec_path[len(go_mod_spec_path) :] - print(request.address.spec_path, go_mod_spec_path, spec_subpath) go_mod_info, pkg_sources = await MultiGet( Get(GoModInfo, GoModInfoRequest(owning_go_mod.address)),
[internal] go: remove extraneous print statement (#<I>) Remove a left-over debugging print statement. [ci skip-rust] [ci skip-build-wheels]
pantsbuild_pants
train
py
6fcb15191ed634dd7d08b22dfe087162f0cb58fe
diff --git a/packages/ember-views/tests/views/container_view_test.js b/packages/ember-views/tests/views/container_view_test.js index <HASH>..<HASH> 100644 --- a/packages/ember-views/tests/views/container_view_test.js +++ b/packages/ember-views/tests/views/container_view_test.js @@ -263,7 +263,7 @@ QUnit.test("views that are removed from a ContainerView should have their child container.removeObject(view); }); equal(get(view, 'childViews.length'), 0, "child views are cleared when removed from container view"); - equal(container.$().html(), '', "the child view is removed from the DOM"); + equal(container.$().text(), '', "the child view is removed from the DOM"); }); QUnit.test("if a ContainerView starts with an empty currentView, nothing is displayed", function() {
Relax ContainerView test to accept comment nodes as empty
emberjs_ember.js
train
js