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
59dbd6d15c1e22bf6d6926835ff3a96c668192f3
diff --git a/platforms/bebop/client/client.go b/platforms/bebop/client/client.go index <HASH>..<HASH> 100644 --- a/platforms/bebop/client/client.go +++ b/platforms/bebop/client/client.go @@ -220,7 +220,7 @@ func (b *Bebop) Discover() error { ), ) - data := make([]byte, 2048) + data := make([]byte, 10240) _, err = b.discoveryClient.Read(data) @@ -272,7 +272,7 @@ func (b *Bebop) Connect() error { go func() { for { - data := make([]byte, 1024) + data := make([]byte, 40960) i, _, err := b.d2cClient.ReadFromUDP(data) if err != nil { fmt.Println("d2cClient error:", err)
Make expected packets larger for updated Bebop firmware
hybridgroup_gobot
train
go
cf11474296a55a784b97004ea060b6a6a0badb87
diff --git a/molecule/command/matrix.py b/molecule/command/matrix.py index <HASH>..<HASH> 100644 --- a/molecule/command/matrix.py +++ b/molecule/command/matrix.py @@ -65,7 +65,10 @@ class Matrix(base.Base): @click.command() @click.pass_context @click.option('--scenario-name', '-s', help='Name of the scenario to target.') [email protected]('subcommand', nargs=-1, type=click.UNPROCESSED) +# NOTE(retr0h): Cannot introspect base.Base for `click.Choice`, since +# subclasses have not all loaded at this point. [email protected]( + 'subcommand', nargs=1, type=click.UNPROCESSED) def matrix(ctx, scenario_name, subcommand): # pragma: no cover """ List matrix of steps used to test instances.
Accept a single option to the matrix subcommand (#<I>) Fixes: #<I>
ansible_molecule
train
py
e755bde0f34d6fe27e0d0ef9c541a7946562730a
diff --git a/src/hypercorn/protocol/h2.py b/src/hypercorn/protocol/h2.py index <HASH>..<HASH> 100755 --- a/src/hypercorn/protocol/h2.py +++ b/src/hypercorn/protocol/h2.py @@ -207,7 +207,7 @@ class H2Protocol: await self.send(Updated()) elif isinstance(event, Request): await self._create_server_push(event.stream_id, event.raw_path, event.headers) - except h2.exceptions.ProtocolError: + except (KeyError, priority.MissingStreamError, h2.exceptions.ProtocolError): # Connection has closed whilst blocked on flow control or # connection has advanced ahead of the last emitted event. return
Bugfix handle MissingStreamError and KeyError Both are potentially raised if the stream (application) tries to send events after the connection has closed. As this is a valid occurance the h2 protocol should just return, rather than error.
pgjones_hypercorn
train
py
269950d8fc2dd7f78a71a653e222f6d92d3d8f41
diff --git a/src/listener/conditional.js b/src/listener/conditional.js index <HASH>..<HASH> 100644 --- a/src/listener/conditional.js +++ b/src/listener/conditional.js @@ -84,10 +84,10 @@ function addToPrototype(prototype) { prototype.enterOf_clause = enterTestedClause; prototype.exitOf_clause = exitTestedClause; prototype.enterElse_of_clause = enterTestedClause; - prototype.exitElse_of_clause = enterTestedClause; + prototype.exitElse_of_clause = exitTestedClause; prototype.enterOelse_clause = enterClause; prototype.exitOelse_clause = exitClause; prototype.exitOf_statement = exit; } -module.exports = addToPrototype; \ No newline at end of file +module.exports = addToPrototype;
fix clause issue (cherry picked from commit b5d<I>a3f1c9f5c<I>ee<I>a7c<I>b<I>a<I>)
StirfireStudios_Jacquard-YarnParser
train
js
8d89f09bfd502aa42e8a83c2c5e5c7e4a2d8aefb
diff --git a/horizon/test/test_dashboards/dogs/puppies/tables.py b/horizon/test/test_dashboards/dogs/puppies/tables.py index <HASH>..<HASH> 100644 --- a/horizon/test/test_dashboards/dogs/puppies/tables.py +++ b/horizon/test/test_dashboards/dogs/puppies/tables.py @@ -26,8 +26,8 @@ class EagerPuppiesTable(tables.DataTable): class SellPuppy(tables.DeleteAction): @staticmethod def action_present(count): - # Translators: test code, don't really have to translate return ungettext_lazy( + # Translators: test code, don't really have to translate u"Sell Puppy", u"Sell Puppies", count @@ -35,8 +35,8 @@ class SellPuppy(tables.DeleteAction): @staticmethod def action_past(count): - # Translators: test code, don't really have to translate return ungettext_lazy( + # Translators: test code, don't really have to translate u"Sold Puppy", u"Sold Puppies", count
Move translator notes just before translatable strings Translator notes must be placed just before strings. Otherwise translator notes are ignored when generating POT files. We need to be careful when we use multiline *gettext* methods. How to detect them is a future topic in I<I>N team. Change-Id: I<I>c<I>b<I>b<I>ecc<I>b<I>a4f<I>d<I>e Closes-Bug: #<I>
openstack_horizon
train
py
61ac9b6980b8f3d9571289c6b190ccc9745741db
diff --git a/progress/__init__.py b/progress/__init__.py index <HASH>..<HASH> 100644 --- a/progress/__init__.py +++ b/progress/__init__.py @@ -26,13 +26,15 @@ __version__ = '1.2' class Infinite(object): file = stderr - sma_window = 10 + sma_window = 10 # Simple Moving Average window + time_threshold = 0.1 # Minimum distance between data points (in seconds) def __init__(self, *args, **kwargs): self.index = 0 self.start_ts = time() self._ts = self.start_ts self._dt = deque(maxlen=self.sma_window) + self._pending = 0 for key, val in kwargs.items(): setattr(self, key, val) @@ -65,9 +67,13 @@ class Infinite(object): def next(self, n=1): if n > 0: now = time() - dt = (now - self._ts) / n - self._dt.append(dt) - self._ts = now + dt = now - self._ts + if dt < self.time_threshold: + self._pending += n + else: + self._dt.append(dt / (n + self._pending)) + self._ts = now + self._pending = 0 self.index = self.index + n self.update()
Improve stats when progressing too quickly Do not update stats if time between data points is less than `time_threshold`. This should fix the issue reported in #<I>.
verigak_progress
train
py
171fbc142a17d187ab5d2ea7943c2719379ab231
diff --git a/src/execution/execute.js b/src/execution/execute.js index <HASH>..<HASH> 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -472,7 +472,7 @@ function executeFields( if (result !== undefined) { results[responseName] = result; - if (!containsPromise && isPromise(result)) { + if (isPromise(result)) { containsPromise = true; } } @@ -949,7 +949,7 @@ function completeListValue( item, ); - if (!containsPromise && isPromise(completedItem)) { + if (isPromise(completedItem)) { containsPromise = true; }
execute: simplify check for promises inside collections (#<I>)
graphql_graphql-js
train
js
653987e5827beb668a2b32d9512fc7b238576155
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index <HASH>..<HASH> 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2469,9 +2469,9 @@ def _remove_md5_fragment(location): def _version_from_file(lines): is_version_line = lambda line: line.lower().startswith('version:') version_lines = filter(is_version_line, lines) - line = next(iter(version_lines)) + line = next(iter(version_lines), '') _, _, value = line.partition(':') - return safe_version(value.strip()) + return safe_version(value.strip()) or None class Distribution(object):
Return None when no version is encountered.
pypa_setuptools
train
py
051b9bd7e61dc3a1e0a4078cd38d80051bcdf690
diff --git a/packages/perspective-viewer/test/js/utils.js b/packages/perspective-viewer/test/js/utils.js index <HASH>..<HASH> 100644 --- a/packages/perspective-viewer/test/js/utils.js +++ b/packages/perspective-viewer/test/js/utils.js @@ -239,6 +239,7 @@ exports.invoke_tooltip = async function invoke_tooltip(svg_selector, page) { await element.hover(); await page.waitForSelector(".highcharts-label.highcharts-tooltip"); await page.waitFor(() => { - return document.querySelector(".highcharts-label.highcharts-tooltip text tspan").textContent !== "Loading ..."; + let elem = document.querySelector(".highcharts-label.highcharts-tooltip"); + return window.getComputedStyle(elem).opacity !== "0" && elem.querySelector("text tspan").textContent.indexOf("Loading") === -1 && elem.querySelector("text tspan").textContent.trim() !== ""; }); };
Fix #<I> (attempt #2)
finos_perspective
train
js
50d37e33a066bbf755fd5878a2db9f5402f546f3
diff --git a/lib/rack/cors.rb b/lib/rack/cors.rb index <HASH>..<HASH> 100644 --- a/lib/rack/cors.rb +++ b/lib/rack/cors.rb @@ -333,7 +333,6 @@ module Rack end def to_headers(env) - x_origin = env['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'] h = { 'Access-Control-Allow-Origin' => origin_for_response_header(env[ORIGIN_HEADER_KEY]), 'Access-Control-Allow-Methods' => methods.collect{|m| m.to_s.upcase}.join(', '),
remove unused variable this removes the following Ruby warning: ``` rack-cors-<I>/lib/rack/cors.rb:<I>: warning: assigned but unused variable - x_origin ```
cyu_rack-cors
train
rb
7c5ca03835c922cbfdfd62772c9e560062c954c7
diff --git a/tests/test_aio_listeners.py b/tests/test_aio_listeners.py index <HASH>..<HASH> 100644 --- a/tests/test_aio_listeners.py +++ b/tests/test_aio_listeners.py @@ -121,7 +121,7 @@ async def test_simple(sender_cls, loop_debug): with pytest.raises(RuntimeError) as excinfo: sender.bind(on_test_a=listener.on_event) - assert excinfo.value == 'Coroutine function given without event loop' + assert 'Coroutine function given without event loop' in str(excinfo.value) for name in ev_names: sender.trigger_event(name)
Correct errors from 9e6becf
nocarryr_python-dispatch
train
py
385452469a9aac44b686f05515c613738629ee43
diff --git a/resources/views/partials/header.blade.php b/resources/views/partials/header.blade.php index <HASH>..<HASH> 100644 --- a/resources/views/partials/header.blade.php +++ b/resources/views/partials/header.blade.php @@ -4,7 +4,7 @@ </a> @if (has_nav_menu('primary_navigation')) - <nav class="nav-primary" aria-label="{{wp_get_nav_menu_name('primary_navigation')}}"> + <nav class="nav-primary" aria-label="{{ wp_get_nav_menu_name('primary_navigation') }}"> {!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav', 'echo' => false]) !!} </nav> @endif
chore(views): nitpick blade syntax
roots_sage
train
php
dde64fb95046904a8d402ca38f0f715fcba55a82
diff --git a/monascaclient/v2_0/shell.py b/monascaclient/v2_0/shell.py index <HASH>..<HASH> 100644 --- a/monascaclient/v2_0/shell.py +++ b/monascaclient/v2_0/shell.py @@ -15,7 +15,6 @@ # limitations under the License. import datetime -import json import numbers import time @@ -91,7 +90,7 @@ def do_metric_create(mc, args): @utils.arg('jsonbody', metavar='<JSON_BODY>', - type=json.loads, + type=jsonutils.loads, help='The raw JSON body in single quotes. See api doc.') def do_metric_create_raw(mc, args): '''Create metric from raw json body.'''
Update json module to jsonutils oslo project provide jsonutils, and monascaclient use it in many place[1], this PS to update the remained json moudule to oslo jsonutils for consistency. [1]: <URL>
openstack_python-monascaclient
train
py
297ea20ddd7e523d7ce5a9ebef8a9ac5ae7e1c89
diff --git a/resources/views/components/comments.blade.php b/resources/views/components/comments.blade.php index <HASH>..<HASH> 100644 --- a/resources/views/components/comments.blade.php +++ b/resources/views/components/comments.blade.php @@ -1,16 +1,18 @@ -@if($model->comments->count() < 1) +@php + if (isset($approved) and $approved == true) { + $comments = $model->approvedComments; + } else { + $comments = $model->comments; + } +@endphp + +@if($comments->count() < 1) <div class="alert alert-warning">There are no comments yet.</div> @endif <ul class="list-unstyled"> @php - if (isset($approved) and $approved == true) { - $grouped_comments = $model->approvedComments; - } else { - $grouped_comments = $model->comments; - } - - $grouped_comments = $grouped_comments->sortBy('created_at')->groupBy('child_id'); + $grouped_comments = $comments->sortBy('created_at')->groupBy('child_id'); @endphp @foreach($grouped_comments as $comment_id => $comments) {{-- Process parent nodes --}}
Improves performance after implementing approval system.
laravelista_comments
train
php
204f32c71edb5ab42c191bc6419c929a8b1a55f2
diff --git a/upload/catalog/controller/checkout/voucher.php b/upload/catalog/controller/checkout/voucher.php index <HASH>..<HASH> 100644 --- a/upload/catalog/controller/checkout/voucher.php +++ b/upload/catalog/controller/checkout/voucher.php @@ -136,7 +136,7 @@ class Voucher extends \Opencart\System\Engine\Controller { $this->response->setOutput(json_encode($json)); } - public function remove() { + public function remove(): void { $this->load->language('checkout/voucher'); $json = [];
[Master] - Added void on remove() method
opencart_opencart
train
php
3d965940efe2e09688e0b4c7ead5cd2165358c36
diff --git a/lib/pay/billable/braintree.rb b/lib/pay/billable/braintree.rb index <HASH>..<HASH> 100644 --- a/lib/pay/billable/braintree.rb +++ b/lib/pay/billable/braintree.rb @@ -101,13 +101,12 @@ module Pay def save_braintree_transaction(transaction) attrs = card_details_for_braintree_transaction(transaction) - attrs.merge!( - processor: :braintree, - processor_id: transaction.id, - amount: transaction.amount.to_f * 100, - ) + attrs.merge!(amount: transaction.amount.to_f * 100) - charges.create(attrs) + charges.find_or_initialize_by( + processor: :braintree, + processor_id: transaction.id + ).update(attrs) end private
Allow saving the transaction multiple times without creating duplicates
jasoncharnes_pay
train
rb
3ead1acc36dc8c7a1fe8834972931b6213e6d140
diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb index <HASH>..<HASH> 100644 --- a/lib/axlsx/workbook/worksheet/data_bar.rb +++ b/lib/axlsx/workbook/worksheet/data_bar.rb @@ -118,7 +118,7 @@ module Axlsx private def initialize_cfvos(cfvos) - self.class.default_cfvos.map.with_index do |default, index| + self.class.default_cfvos.each_with_index.map do |default, index| if index < cfvos.size value_objects << Cfvo.new(default.merge(cfvos[index])) else
Patched for <I> Time to think about ending support for <I>?
randym_axlsx
train
rb
206560a74b56e7a2dcc7f358f24b5769a22769b5
diff --git a/kafka/consumer/kafka.py b/kafka/consumer/kafka.py index <HASH>..<HASH> 100644 --- a/kafka/consumer/kafka.py +++ b/kafka/consumer/kafka.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + from collections import namedtuple from copy import deepcopy import logging
Force absolue_imports in kafka/consumer/kafka.py
dpkp_kafka-python
train
py
2ba4a5c49327d20739ad78bcfd34cee3335f47ad
diff --git a/crane/container.go b/crane/container.go index <HASH>..<HASH> 100644 --- a/crane/container.go +++ b/crane/container.go @@ -46,7 +46,7 @@ type container struct { type RunParameters struct { RawCidfile string `json:"cidfile" yaml:"cidfile"` - CpuSet int `json:"cpuset" yaml:"cpuset"` + Cpuset int `json:"cpuset" yaml:"cpuset"` CpuShares int `json:"cpu-shares" yaml:"cpu-shares"` Detach bool `json:"detach" yaml:"detach"` RawDns []string `json:"dns" yaml:"dns"` @@ -350,7 +350,7 @@ func (c *container) Run() { args = append(args, "--cidfile", c.RunParams.Cidfile()) } // CPU set - if len(c.RunParams.CpuSet()) > 0 { + if len(c.RunParams.Cpuset()) > 0 { args = append(args, "--cpuset", strconv.Itoa(c.RunParams.CpuSet)) } // CPU shares
renaming CpuSet to cpuset for consistency
michaelsauter_crane
train
go
d9b286272c7d20d2aff74a0ef28384071d0a18f5
diff --git a/src/transformers/models/roberta/modeling_tf_roberta.py b/src/transformers/models/roberta/modeling_tf_roberta.py index <HASH>..<HASH> 100644 --- a/src/transformers/models/roberta/modeling_tf_roberta.py +++ b/src/transformers/models/roberta/modeling_tf_roberta.py @@ -541,7 +541,9 @@ class TFRobertaMainLayer(tf.keras.layers.Layer): # Since we are adding it to the raw scores before the softmax, this is # effectively the same as removing these entirely. extended_attention_mask = tf.cast(extended_attention_mask, dtype=embedding_output.dtype) - extended_attention_mask = tf.multiply(tf.subtract(1.0, extended_attention_mask), -10000.0) + one_cst = tf.constant(1.0, dtype=embedding_output.dtype) + ten_thousand_cst = tf.constant(-10000.0, dtype=embedding_output.dtype) + extended_attention_mask = tf.multiply(tf.subtract(one_cst, extended_attention_mask), ten_thousand_cst) # Prepare head mask if needed # 1.0 in head_mask indicate we keep the head
Fix TF Roberta for mixed precision training (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
2ffe2c4905ce07697e8fe013c3534f0108030c0c
diff --git a/modules/@apostrophecms/doc-type/index.js b/modules/@apostrophecms/doc-type/index.js index <HASH>..<HASH> 100644 --- a/modules/@apostrophecms/doc-type/index.js +++ b/modules/@apostrophecms/doc-type/index.js @@ -591,13 +591,10 @@ module.exports = { // If `builders` is an object its properties are invoked as // query builders, for instance `{ attachments: true }`. async findOneForEditing(req, criteria, builders) { - const query = await self.findForEditing(req, criteria, builders); - const doc = query.toObject(); - if (self.options.annotate) { - self.apos.attachment.all(doc, { annotate: true }); - } - return doc; + return self.findForEditing(req, criteria, builders).toObject(); }, + // Identical to findOneForEditing by default, but could be + // overridden usefully in subclasses. async findOneForCopying(req, criteria) { return self.findOneForEditing(req, criteria); },
Remove busted, unnecessary feature, document a method
apostrophecms_apostrophe
train
js
6252511b7fa5505ba4f47dfad9ff16f26fe0c5e0
diff --git a/atom/browser/lib/chrome-extension.js b/atom/browser/lib/chrome-extension.js index <HASH>..<HASH> 100644 --- a/atom/browser/lib/chrome-extension.js +++ b/atom/browser/lib/chrome-extension.js @@ -54,12 +54,16 @@ app.on('will-quit', function() { loadedExtensions = Object.keys(extensionInfoMap).map(function(key) { return extensionInfoMap[key].srcDirectory; }); - try { - fs.mkdirSync(path.dirname(loadedExtensionsPath)); - } catch (error) { - // Ignore error + if (loadedExtensions.length > 0) { + try { + fs.mkdirSync(path.dirname(loadedExtensionsPath)); + } catch (error) { + // Ignore error + } + return fs.writeFileSync(loadedExtensionsPath, JSON.stringify(loadedExtensions)); + } else { + fs.unlinkSync(loadedExtensionsPath); } - return fs.writeFileSync(loadedExtensionsPath, JSON.stringify(loadedExtensions)); } catch (error) { // Ignore error }
Delete extensions file when there are no loaded extensions
electron_electron
train
js
0fca5475db3819240cff4e4071fc72b8bed9537d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup( setup_requires=['setuptools-markdown'], extras_require={ 'tester': [ - "eth-tester[py-evm]==0.1.0b16", + "eth-tester[py-evm]==0.1.0b19", ], 'testrpc': ["eth-testrpc>=1.3.3,<2.0.0"], 'linter': [
bump to latest eth-tester
ethereum_web3.py
train
py
b69025ebd0cd2544d3cdb84f46f6fc177421cf1d
diff --git a/lib/swig.js b/lib/swig.js index <HASH>..<HASH> 100644 --- a/lib/swig.js +++ b/lib/swig.js @@ -603,7 +603,7 @@ exports.Swig = function (opts) { context = getLocals(options); contextLength = utils.keys(context).length; - pre = this.precompile(source, options); + pre = self.precompile(source, options); function compiled(locals) { var lcls;
fix: 'this.precompile' BUG in swig.compile
Thunf_swiger
train
js
527ec23c20164736203eb5a7e3109368c9629aed
diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index <HASH>..<HASH> 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -447,7 +447,7 @@ def start(format: bool = False): ) read_types += "\n " - read_types += "{} = TLObject.read(b{}) if flags & (1 << {}) else None\n ".format( + read_types += "{} = TLObject.read(b{}) if flags & (1 << {}) else []\n ".format( arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "", index ) else:
Revert reading non-existent flag vectors from None to []
pyrogram_pyrogram
train
py
61520634740de13bb82d46686423a415114d8d45
diff --git a/lib/jenkins_api_client/build_queue.rb b/lib/jenkins_api_client/build_queue.rb index <HASH>..<HASH> 100644 --- a/lib/jenkins_api_client/build_queue.rb +++ b/lib/jenkins_api_client/build_queue.rb @@ -94,7 +94,7 @@ module JenkinsApi response_json = @client.api_get_request("/queue") details = {} response_json["items"].each do |item| - details = item if item["task"]["name"] + details = item if item["task"]["name"] == task_name end details end
Fix get_details to compare against task_name
arangamani_jenkins_api_client
train
rb
5ba1fffdeb879cfde6ab0c3ac17b7d1810dc28a3
diff --git a/modules/rectangle/rectangle.js b/modules/rectangle/rectangle.js index <HASH>..<HASH> 100644 --- a/modules/rectangle/rectangle.js +++ b/modules/rectangle/rectangle.js @@ -36,10 +36,11 @@ export default class Rectangle extends Component { * @return {Position} */ getOriginPosition () { - const { origin } = this.options; - - if (origin instanceof Position) { - return origin; + try { + return Position.from(this.options.origin); + } + catch (e) { + const { origin } = this.options; } const position = new Position(); @@ -80,7 +81,7 @@ export default class Rectangle extends Component { /** * @typedef {Object} RectangleOptions * @extends ComponentOptions - * @prop {String} [origin=Rectangle.origins.topLeft] - Origin of the rectangle's position + * @prop {String|PositionDefinition} [origin=Rectangle.origins.topLeft] - Origin of the rectangle's position */ /** * @return {RectangleOptions}
Rectangle's origin support for PositionDefinition
pencil-js_pencil.js
train
js
8a183696fe5202caf2a0259d995b74d723bdf637
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -144,7 +144,7 @@ Web3ProviderEngine.prototype._stopPolling = function(){ } Web3ProviderEngine.prototype._fetchLatestBlock = function(cb) { - if (!cb) cb = function(err) { if (err) throw err} + if (!cb) cb = function(err) { if (err) return console.error(err) } const self = this
error - graceful failure on block polling
MetaMask_web3-provider-engine
train
js
217a04b3bf34354ffb90a289705fb1a4cf48eb6b
diff --git a/clay/utils.py b/clay/utils.py index <HASH>..<HASH> 100644 --- a/clay/utils.py +++ b/clay/utils.py @@ -58,7 +58,6 @@ def make_dirs(*lpath): return path - def get_source(filepath): source = '' with io.open(filepath) as f: @@ -103,17 +102,19 @@ def replace_processed_names(content, rx_processed): def get_file_mdate(filepath): - st = os.stat(filepath) - mdate = datetime.utcfromtimestamp(st.st_mtime) + mtime = os.path.getmtime(filepath) + mdate = datetime.utcfromtimestamp(mtime) mdate -= datetime.utcnow() - datetime.now() return mdate def copy_if_has_change(path_in, path_out): - oldt = os.path.getmtime(path_out) - newt = os.path.getmtime(path_in) - if oldt != newt: - shutil.copy2(path_in, path_out) + if os.path.exists(path_out): + oldt = os.path.getmtime(path_out) + newt = os.path.getmtime(path_in) + if oldt == newt: + return + shutil.copy2(path_in, path_out) def _is_protected_type(obj):
fix copy_if_has_change if file doesn't exist
lucuma_Clay
train
py
a1b426a2df16c8062f3185131cf51ab9f9fb9bd9
diff --git a/src/SocialiteWasCalled.php b/src/SocialiteWasCalled.php index <HASH>..<HASH> 100644 --- a/src/SocialiteWasCalled.php +++ b/src/SocialiteWasCalled.php @@ -49,6 +49,9 @@ class SocialiteWasCalled $socialite->extend( $providerName, function () use ($provider) { + if (defined('SOCIALITEPROVIDERS_STATELESS') && SOCIALITEPROVIDERS_STATELESS) { + return $provider->stateless(); + } return $provider; } );
Fix: Lumen stateless by default When we call Socialite::with('some_provider')->redirect() in Lumen we expect a stateless provider ("Note: If you are using this with Lumen, all providers will automatically be stateless since Lumen does not keep track of state."), but get the provider with state.
SocialiteProviders_Manager
train
php
4fbf20e5317f1a649e55259e673176fe8bfeb174
diff --git a/relationship.php b/relationship.php index <HASH>..<HASH> 100644 --- a/relationship.php +++ b/relationship.php @@ -46,6 +46,7 @@ $Dbasexoffset = 0; $Dbaseyoffset = 0; if ($show_full==false) { + $Dbwidth = $Dbwidth - 50; $bwidth = $bwidth / 1.5; $bheight = $bheight / 2 ; $Dbheight=25;
Correct block spacing on Relationship chart w/o the Show detail box checked.
fisharebest_webtrees
train
php
782fe5025d24d9368054f6548dd34d1314858198
diff --git a/textplot/text.py b/textplot/text.py index <HASH>..<HASH> 100644 --- a/textplot/text.py +++ b/textplot/text.py @@ -11,6 +11,7 @@ from nltk.stem import PorterStemmer from collections import OrderedDict, Counter from sklearn.neighbors import KernelDensity from pyemd import emd +from itertools import islice class Text(object): @@ -85,6 +86,25 @@ class Text(object): i += 1 + def window(self, n=2): + + """ + Yield a sliding window of words. + + :param n: The window width. + """ + + it = iter(self.tokens) + result = tuple(islice(it, n)) + + if len(result) == n: + yield result + + for token in it: + result = result[1:] + (token,) + yield result + + def term_counts(self): """
Adds a window() method to text.
davidmcclure_textplot
train
py
59e5472568fbe5683a3a36bdb68c29870ba123fa
diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb index <HASH>..<HASH> 100755 --- a/src/ruby/pb/test/client.rb +++ b/src/ruby/pb/test/client.rb @@ -160,7 +160,7 @@ end # produces a string of null chars (\0) of length l. def nulls(l) fail 'requires #{l} to be +ve' if l < 0 - [].pack('x' * l).force_encoding('utf-8') + [].pack('x' * l).force_encoding('ascii-8bit') end # a PingPongPlayer implements the ping pong bidi test.
Fix encoding for bytes fields in ruby interop client
grpc_grpc
train
rb
bef4346219958f7eb7ebba840e3a5ef17c4f4ad8
diff --git a/lib/sprout/executable/session.rb b/lib/sprout/executable/session.rb index <HASH>..<HASH> 100644 --- a/lib/sprout/executable/session.rb +++ b/lib/sprout/executable/session.rb @@ -292,7 +292,7 @@ module Sprout::Executable # Execute the collection of provided actions. def execute_actions action_stack.each do |action| - break unless execute_action(action) + execute_action(action) end @action_stack = [] end
Ensure that all pending actions get executed when requested
lukebayes_project-sprouts
train
rb
92f9f68f914168e00142f00e27ac5247269ac1e4
diff --git a/cmd/crio/main.go b/cmd/crio/main.go index <HASH>..<HASH> 100644 --- a/cmd/crio/main.go +++ b/cmd/crio/main.go @@ -14,6 +14,7 @@ import ( "time" _ "github.com/containers/libpod/pkg/hooks/0.1.0" + "github.com/containers/storage/pkg/ioutils" "github.com/containers/storage/pkg/reexec" "github.com/cri-o/cri-o/internal/criocli" "github.com/cri-o/cri-o/internal/log" @@ -109,6 +110,9 @@ func main() { klog.SetOutput(ioutil.Discard) + // This must be done before reexec.Init() + ioutils.SetDefaultOptions(ioutils.AtomicFileWriterOptions{NoSync: true}) + if reexec.Init() { fmt.Fprintf(os.Stderr, "unable to initialize container storage\n") os.Exit(-1)
container_server: disable fdatasync() for atomic writes
cri-o_cri-o
train
go
1a35871e560a935aa169c5242ed444c9f7e6f625
diff --git a/cli/valet.php b/cli/valet.php index <HASH>..<HASH> 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -77,7 +77,7 @@ if (is_dir(VALET_HOME_PATH)) { */ $app->command('tld [tld]', function ($tld = null) { if ($tld === null) { - return info(Configuration::read()['tld']); + return output(Configuration::read()['tld']); } DnsMasq::updateTld(
Fix issue with `valet share` on Hyper Related: <URL>` to just `output()` avoids ANSI char output for color display, and this particular line doesn't "need" colored output particularly.
laravel_valet
train
php
5e828970b760d367065e276127ec690d5927fb01
diff --git a/minifier.js b/minifier.js index <HASH>..<HASH> 100644 --- a/minifier.js +++ b/minifier.js @@ -23,7 +23,10 @@ function minifyHTML(opts) { // Custom callback specified by user, use that one return function (err, html) { - html = minify(html, opts.htmlMinifier); + if (html) { + html = minify(html, opts.htmlMinifier); + } + callback(err, html); } }
Don't attempt to minify non-existant html in error situations
melonmanchan_express-minify-html
train
js
2ba5b922ea9752b84f53dfb6628516d0b08456b9
diff --git a/src/utils.js b/src/utils.js index <HASH>..<HASH> 100644 --- a/src/utils.js +++ b/src/utils.js @@ -109,6 +109,15 @@ function tryPromise( value ) { } } +function tryReject( func, context, ...args ) { + try { + return tryPromise( func.apply( context, args ) ); + + } catch( err ) { + return Promise.reject( err ); + } +} + //Taken from tj/co export function isGenerator( obj ) { return 'function' === typeof obj.next && 'function' === typeof obj.throw;
src: Added tryReject to utils.js
novacrazy_scriptor
train
js
1acfc46c84f11a563096be0dfa48d42c5717986f
diff --git a/a10_neutron_lbaas/tests/unit/plumbing/test_portbinding_vlan.py b/a10_neutron_lbaas/tests/unit/plumbing/test_portbinding_vlan.py index <HASH>..<HASH> 100644 --- a/a10_neutron_lbaas/tests/unit/plumbing/test_portbinding_vlan.py +++ b/a10_neutron_lbaas/tests/unit/plumbing/test_portbinding_vlan.py @@ -21,7 +21,7 @@ from a10_neutron_lbaas.plumbing import portbinding_vlan from neutron.db.models.segment import NetworkSegment from neutron.db.models_v2 import Port -from neutron.db.models_v2 import PortBindingLevel +from neutron.plugins.ml2.db import PortBindingLevel _SUBNET_ID = "mysubnet" _PORT_ID = "portid"
Fixed wrong import for PortBindingLevel model
a10networks_a10-neutron-lbaas
train
py
dcdc1f49c0ec8b6b73337256c973fb958ea7a528
diff --git a/src/server/pps/cmds/cmds.go b/src/server/pps/cmds/cmds.go index <HASH>..<HASH> 100644 --- a/src/server/pps/cmds/cmds.go +++ b/src/server/pps/cmds/cmds.go @@ -553,7 +553,7 @@ All jobs created by a pipeline will create commits in the pipeline's repo. } request.Update = true request.Reprocess = reprocess - if request.Input.Atom != nil { + if request.Input != nil && request.Input.Atom != nil { fmt.Fprintln(os.Stderr, "the `atom` input type is deprecated as of 1.8.1, please replace `atom` with `pfs`") } if _, err := client.PpsAPIClient.CreatePipeline( @@ -775,7 +775,7 @@ func pipelineHelper(metrics bool, portForwarding bool, reprocess bool, build boo } else if err != nil { return err } - if request.Input.Atom != nil { + if request.Input != nil && request.Input.Atom != nil { fmt.Println("WARNING: The `atom` input type has been deprecated and will be removed in a future version. Please replace `atom` with `pfs`.") } if update {
Handle missing input field in pipeline specs without panicing
pachyderm_pachyderm
train
go
618384e54060968a0a0e5472a0f1633c71149f77
diff --git a/buku.py b/buku.py index <HASH>..<HASH> 100755 --- a/buku.py +++ b/buku.py @@ -3298,6 +3298,7 @@ def browse(url): ---------- suppress_browser_output : bool True if a text based browser is detected. + Must be initialized (as applicable) to use the API. """ if not parse_url(url).scheme:
Fix #<I>: attribute must be initialized before API usage.
jarun_Buku
train
py
f2ac62770865e21dded85c69ac5d06e20222ee24
diff --git a/admin/jqadm/config/admin.php b/admin/jqadm/config/admin.php index <HASH>..<HASH> 100644 --- a/admin/jqadm/config/admin.php +++ b/admin/jqadm/config/admin.php @@ -41,6 +41,7 @@ return [ 'type/text', 'type/text/lists', ], + 'log', ], 'resource' => [ 'site' => [ @@ -451,6 +452,15 @@ return [ ], ], ], + 'log' => [ + /** admin/jqadm/resource/log/groups + * List of user groups that are allowed to view the log messages + * + * @param array List of user group names + * @since 2018.04 + */ + 'groups' => ['admin', 'super'], + ], 'language' => [ /** admin/jqadm/resource/language/groups * List of user groups that are allowed to switch languages
Added log panel to navbar and added permissions
aimeos_ai-admin-jqadm
train
php
f382e348aa5e881ff901982cda5aaef3fc015cd5
diff --git a/mysql/toolkit/components/execute.py b/mysql/toolkit/components/execute.py index <HASH>..<HASH> 100644 --- a/mysql/toolkit/components/execute.py +++ b/mysql/toolkit/components/execute.py @@ -33,7 +33,7 @@ class SQLScript: def __init__(self, sql_script, split_func=True, split_char=';', dump_fails=True, mysql_instance=None): """Execute a sql file one command at a time.""" # Pass MySQL instance from execute_script method to ExecuteScript class - self.MySQL = mysql_instance + self._MySQL = mysql_instance # SQL script to be executed self.sql_script = sql_script @@ -100,7 +100,7 @@ class SQLScript: for command in tqdm(commands, total=len(commands), desc='Executing SQL Commands'): # Attempt to execute command and skip command if error is raised try: - self.MySQL.execute(command) + self._MySQL.execute(command) success += 1 except: fail.append(command)
Refactored self.MySQL to _MySQL to avoid external access
mrstephenneal_mysql-toolkit
train
py
3286b24fce03b8302c17939cbbabcb0e0e9b0eb7
diff --git a/commands/version.go b/commands/version.go index <HASH>..<HASH> 100644 --- a/commands/version.go +++ b/commands/version.go @@ -16,6 +16,7 @@ package commands import ( "os" "path/filepath" + "runtime" "strings" "time" @@ -43,9 +44,9 @@ func printHugoVersion() { formatBuildDate() // format the compile time } if hugolib.CommitHash == "" { - jww.FEEDBACK.Printf("Hugo Static Site Generator v%s BuildDate: %s\n", helpers.HugoVersion(), hugolib.BuildDate) + jww.FEEDBACK.Printf("Hugo Static Site Generator v%s %s/%s BuildDate: %s\n", helpers.HugoVersion(), runtime.GOOS, runtime.GOARCH, hugolib.BuildDate) } else { - jww.FEEDBACK.Printf("Hugo Static Site Generator v%s-%s BuildDate: %s\n", helpers.HugoVersion(), strings.ToUpper(hugolib.CommitHash), hugolib.BuildDate) + jww.FEEDBACK.Printf("Hugo Static Site Generator v%s-%s %s/%s BuildDate: %s\n", helpers.HugoVersion(), strings.ToUpper(hugolib.CommitHash), runtime.GOOS, runtime.GOARCH, hugolib.BuildDate) } }
commands: Show OS and ARCH in version output
gohugoio_hugo
train
go
16b6aec2082123f1875db74fe17d93b468fc10b1
diff --git a/lang/en/rating.php b/lang/en/rating.php index <HASH>..<HASH> 100644 --- a/lang/en/rating.php +++ b/lang/en/rating.php @@ -40,6 +40,7 @@ $string['aggregatetype_help'] = 'The aggregate type defines how ratings are comb If "No ratings" is selected, then the activity will not appear in the gradebook.'; $string['allowratings'] = 'Allow items to be rated?'; +$string['allratingsforitem'] = 'All submitted ratings'; $string['capabilitychecknotavailable'] = 'Capability check not available until activity is saved'; $string['couldnotdeleteratings'] = 'Sorry, that cannot be deleted as people have already rated it'; $string['norate'] = 'Rating of items not allowed!';
rating MDLSITE-<I> added a new string for a window title
moodle_moodle
train
php
8b4ead79550833ea7b6f67e449947be2932438de
diff --git a/core/metrics-core-impl/src/main/java/org/hawkular/metrics/core/impl/cassandra/BucketedOutputMapper.java b/core/metrics-core-impl/src/main/java/org/hawkular/metrics/core/impl/cassandra/BucketedOutputMapper.java index <HASH>..<HASH> 100644 --- a/core/metrics-core-impl/src/main/java/org/hawkular/metrics/core/impl/cassandra/BucketedOutputMapper.java +++ b/core/metrics-core-impl/src/main/java/org/hawkular/metrics/core/impl/cassandra/BucketedOutputMapper.java @@ -40,7 +40,7 @@ import com.google.common.base.Function; public abstract class BucketedOutputMapper<DATA extends MetricData, METRIC extends Metric<DATA>, POINT> implements Function<METRIC, BucketedOutput<POINT>> { - private final Buckets buckets; + protected final Buckets buckets; /** * @param buckets the bucket configuration @@ -115,7 +115,7 @@ public abstract class BucketedOutputMapper<DATA extends MetricData, METRIC exten * Create a bucket data point from the metric data in this bucket. * * @param from timestamp of the bucket - * @param metricDatas metric data in this bucket + * @param metricDatas metric data in this bucket, ordered by {@link MetricData#TIME_UUID_COMPARATOR} * * @return a bucket data point summurazing the metric data */
Minor BucketedOutputMapper change: expose bucket config to subclasses
hawkular_hawkular-metrics
train
java
616967d6e6a0b5fc64bffc9ee9da8ce71b676b7e
diff --git a/django/contrib/contacts/models.py b/django/contrib/contacts/models.py index <HASH>..<HASH> 100755 --- a/django/contrib/contacts/models.py +++ b/django/contrib/contacts/models.py @@ -93,11 +93,19 @@ class Identity(models.Model): field_data = models.ManyToManyField(IdentityData, related_name='identity', blank=True) def get_subclass(self): - if not getattr(self, 'person') is None: - return Person - - if not getattr(self, 'company') is None: - return Company + # TODO: Figure out a better way to do this. getattr throws an exception because + # django attempts to query for a non-existing person when that attr is accessed. + try: + if not getattr(self, 'person') is None: + return Person + except: + pass + + try: + if not getattr(self, 'company') is None: + return Company + except: + pass def get_field_data(self, model=None): field_list = []
Fixed a bug that existed when working with companies.
LimpidTech_django-contact
train
py
71cbbfa7b6c1543fff656e7d67a3ef57bde1a87b
diff --git a/lib/god/cli/run.rb b/lib/god/cli/run.rb index <HASH>..<HASH> 100644 --- a/lib/god/cli/run.rb +++ b/lib/god/cli/run.rb @@ -83,6 +83,8 @@ module God def run_daemonized # trap and ignore SIGHUP Signal.trap('HUP') {} + # trap and log-reopen SIGUSR1 + Signal.trap('USR1') { setup_logging } pid = fork do begin
When caught USR1, reopen log file if defined. (just a call "setup_logging".)
mojombo_god
train
rb
6bcb6a30ddb14c5463cb0ff67889692473b951fc
diff --git a/zinnia/__init__.py b/zinnia/__init__.py index <HASH>..<HASH> 100644 --- a/zinnia/__init__.py +++ b/zinnia/__init__.py @@ -1,5 +1,5 @@ """Zinnia""" -__version__ = '0.14.dev' +__version__ = '0.14' __license__ = 'BSD License' __author__ = 'Fantomas42'
Bumping to version <I>
Fantomas42_django-blog-zinnia
train
py
294ea8de4fd3a06df4ff5f94eeeaed65455442b9
diff --git a/lib/arm/instructions/logic_instruction.rb b/lib/arm/instructions/logic_instruction.rb index <HASH>..<HASH> 100644 --- a/lib/arm/instructions/logic_instruction.rb +++ b/lib/arm/instructions/logic_instruction.rb @@ -31,7 +31,7 @@ module Arm @left.is_a?(Symbol) and !Register::RegisterReference.look_like_reg(@left) # do pc relative addressing with the difference to the instuction # 8 is for the funny pipeline adjustment (ie pointing to fetch and not execute) - right = @left.position - self.position + right = @left.position - self.position - 8 raise "todo in direction #{right}" if( opcode == :add and right < 0 ) raise "No negatives implemented #{right} " if right < 0 left = :pc
fix the move, correct for funny pipeline
ruby-x_rubyx
train
rb
d8768deb17adf5e6a454b80217104790dd4ae817
diff --git a/src/liftN.js b/src/liftN.js index <HASH>..<HASH> 100644 --- a/src/liftN.js +++ b/src/liftN.js @@ -20,7 +20,7 @@ var map = require('./map'); * @see R.lift * @example * - * var madd3 = R.liftN(3, R.curryN(3, () => R.reduce(R.add, 0, arguments))); + * var madd3 = R.liftN(3, R.curryN(3, function(){ return R.sum(arguments))})); * madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] */ module.exports = _curry2(function liftN(arity, fn) {
refactor example of liftN - in order to use arguments as expected we need to use normal function: <URL>
ramda_ramda
train
js
0dedf26c1b24ebebc9ae3ff244eea7f0b7cf074f
diff --git a/web.php b/web.php index <HASH>..<HASH> 100644 --- a/web.php +++ b/web.php @@ -291,7 +291,7 @@ class Web extends Prefab { return strlen($line); } ); - curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,TRUE); + curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,2); curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,FALSE); ob_start(); curl_exec($curl);
fix deprecated CURLOPT_SSL_VERIFYHOST value value `1` was removed with curl <I> <URL>
bcosca_fatfree-core
train
php
e5c0e77b9fa0fcbf22fb029b893e42476b8d72a6
diff --git a/lib/ruby_bugzilla/version.rb b/lib/ruby_bugzilla/version.rb index <HASH>..<HASH> 100644 --- a/lib/ruby_bugzilla/version.rb +++ b/lib/ruby_bugzilla/version.rb @@ -1,3 +1,3 @@ class RubyBugzilla - VERSION = "0.1.0" + VERSION = "0.2.0" end
Bump minor version due to new coveralls dependency
ManageIQ_active_bugzilla
train
rb
7298b41c456912d672257578ffe49b074fbe1d51
diff --git a/src/Psalm/Checker/StatementsChecker.php b/src/Psalm/Checker/StatementsChecker.php index <HASH>..<HASH> 100644 --- a/src/Psalm/Checker/StatementsChecker.php +++ b/src/Psalm/Checker/StatementsChecker.php @@ -3648,7 +3648,7 @@ class StatementsChecker } if ($stmt->dim) { - if (isset($stmt->dim->inferredType) && $key_type) { + if (isset($stmt->dim->inferredType) && $key_type && !$key_type->isEmpty()) { foreach ($stmt->dim->inferredType->types as $at) { if ($at->isMixed()) { // @todo emit issue
Do not throw access errors when array might be empty
vimeo_psalm
train
php
91399bba82d0bc980a5cc91b989a0ef575c006f9
diff --git a/lib/coa.js b/lib/coa.js index <HASH>..<HASH> 100644 --- a/lib/coa.js +++ b/lib/coa.js @@ -38,7 +38,6 @@ module.exports = require('coa').Cmd() .end() .opt() .name('inputString').title('Input string') - .short('is').long('input-string') .act(function(opts) { if (opts.input) { //TODO: test @@ -52,7 +51,6 @@ module.exports = require('coa').Cmd() .end() .opt() .name('basePath').title('Base path for text input') - .short('b').long('base-path') .end() .opt() .name('output').title('Output path')
Borschik should support to process strings as input or ouput #<I> There is no sense in cli support
borschik_borschik
train
js
f4b21f9da8f0b26afd68f9c07b0a2c1fa3551022
diff --git a/lib/nexpose/site_credentials.rb b/lib/nexpose/site_credentials.rb index <HASH>..<HASH> 100644 --- a/lib/nexpose/site_credentials.rb +++ b/lib/nexpose/site_credentials.rb @@ -57,7 +57,7 @@ module Nexpose attr_accessor :scope #Create a credential object using name, id, description, host and port - def self.for_service(name, id = -1, desc = nil, host = nil, port = nil, service = Service::CIFS) + def self.for_service(name, id = -1, desc = nil, host = nil, port = nil, service = Credential::Service::CIFS) cred = new cred.name = name cred.id = id.to_i @@ -66,7 +66,7 @@ module Nexpose cred.host_restriction = host cred.port_restriction = port cred.service = service - cred.scope = Scope::SITE_SPECIFIC + cred.scope = Credential::Scope::SITE_SPECIFIC cred end
hmm need to learn how to reference constant in ruby
rapid7_nexpose-client
train
rb
a330746432f7e3ab9b8fe8a4941142f314b05fdd
diff --git a/dddp/websocket.py b/dddp/websocket.py index <HASH>..<HASH> 100644 --- a/dddp/websocket.py +++ b/dddp/websocket.py @@ -13,6 +13,7 @@ from six.moves import range as irange import ejson import geventwebsocket +from django.core import signals from django.core.handlers.base import BaseHandler from django.core.handlers.wsgi import WSGIRequest from django.db import connection, transaction @@ -151,6 +152,7 @@ class DDPWebSocketApplication(geventwebsocket.WebSocketApplication): del self.pgworker.connections[self.connection.pk] self.connection.delete() self.connection = None + signals.request_finished.send(sender=self.__class__) self.logger.info('- %s %s', self, args or 'CLOSE') def on_message(self, message):
Send django.core.signals.request_finished when closing WebSocket.
jazzband_django-ddp
train
py
e8038079b16f063c0601386e44f1c0ce8411a4d7
diff --git a/src/Controllers/OpenPlatformController.php b/src/Controllers/OpenPlatformController.php index <HASH>..<HASH> 100644 --- a/src/Controllers/OpenPlatformController.php +++ b/src/Controllers/OpenPlatformController.php @@ -14,7 +14,7 @@ class OpenPlatformController extends Controller * * @var array */ - protected $events = [ + protected static $events = [ 'authorized' => Events\Authorized::class, 'unauthorized' => Events\Unauthorized::class, 'updateauthorized' => Events\UpdateAuthorized::class, @@ -31,7 +31,7 @@ class OpenPlatformController extends Controller { $server = $application->open_platform->server; - $server->setMessageHandler([$this, 'handle']); + $server->setMessageHandler([self::class, 'handle']); return $server->serve(); } @@ -41,9 +41,9 @@ class OpenPlatformController extends Controller * * @param \EasyWeChat\Support\Collection $message */ - private function handle($message) + public static function handle($message) { - if ($event = array_get($this->events, $message->InfoType)) { + if ($event = array_get(self::$events, $message->InfoType)) { Event::fire(new $event($message)); } }
:bug: Fixed callable issue.
overtrue_laravel-wechat
train
php
1f098c07b72ad5062e0f674d1c714f60ad565d3b
diff --git a/notario/validators/__init__.py b/notario/validators/__init__.py index <HASH>..<HASH> 100644 --- a/notario/validators/__init__.py +++ b/notario/validators/__init__.py @@ -0,0 +1,28 @@ + + +class cherry_pick(tuple): + """ + This is not really a validator, but will allow one to make + sure just certain keys (as defined in ``must_validate`` are + validated. The engine will discard all others that are not + defined here. + + It should be used in the same manner as when constructing + a schema, but instead of a regular tuple, this should be used. + + .. note:: + If ``must_validate`` is not defined with any items, it will + generate them with the items on the tuple passed in if possible, unless + the tuple created is not a key value pair. + + """ + must_validate = () + + def __init__(self, _tuple): + try: + self.must_validate = tuple([key for key, value in _tuple]) + except ValueError: # single k/v pair + self.must_validate = (_tuple[0]) + except TypeError: # maybe not k, v pairs + pass + return super(cherry_pick, self).__init__()
introduce cherry_pick for picking keys in validation
alfredodeza_notario
train
py
88e50e75dedf4cc5ffc35332283abd7ec487fa2a
diff --git a/dynamic_rest/filters.py b/dynamic_rest/filters.py index <HASH>..<HASH> 100644 --- a/dynamic_rest/filters.py +++ b/dynamic_rest/filters.py @@ -19,8 +19,8 @@ from dynamic_rest.related import RelatedObject patch_prefetch_one_level() -def has_outer_joins(queryset): - """Return True iff. a queryset uses outer joins. +def has_joins(queryset): + """Return True iff. a queryset includes joins. If this is the case, it is possible for the queryset to return duplicate results. @@ -487,7 +487,7 @@ class DynamicFilterBackend(BaseFilterBackend): prefetch = prefetches.values() queryset = queryset.prefetch_related(*prefetch) - if has_outer_joins(queryset): + if has_joins(queryset): queryset = queryset.distinct() return queryset
change name of helper method to reflect new logic
AltSchool_dynamic-rest
train
py
e56f2e22fc761e82a34aca553f6725e2aff4fe6c
diff --git a/internal/util/sysreadfile_linux.go b/internal/util/sysreadfile_linux.go index <HASH>..<HASH> 100644 --- a/internal/util/sysreadfile_linux.go +++ b/internal/util/sysreadfile_linux.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// +build !windows +// +build !windows !appengine package util
Don't build sysreadfile for app engine (#<I>) Google App Engine does not allow compiling with `import "syscall"`. See discussion in <URL>
prometheus_procfs
train
go
74c5f65bfb7813cecb3a1e78b522de4586e76ac9
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -478,7 +478,7 @@ module ActiveRecord connection, table_name, class_names[table_name.to_sym] || table_name.classify, - File.join(fixtures_directory, path)) + ::File.join(fixtures_directory, path)) end all_loaded_fixtures.update(fixtures_map) @@ -656,9 +656,9 @@ module ActiveRecord end def read_fixture_files - if File.file?(yaml_file_path) + if ::File.file?(yaml_file_path) read_yaml_fixture_files - elsif File.file?(csv_file_path) + elsif ::File.file?(csv_file_path) read_csv_fixture_files else raise FixturesFileNotFound, "Could not find #{yaml_file_path} or #{csv_file_path}" @@ -713,7 +713,7 @@ module ActiveRecord end def yaml_fixtures_key(path) - File.basename(@fixture_path).split(".").first + ::File.basename(@fixture_path).split(".").first end def parse_yaml_string(fixture_content)
use top level file constant for join, etc
rails_rails
train
rb
fedb50036861d107e4ed1b25b1ab4466978c7c3b
diff --git a/rice/embed-go.go b/rice/embed-go.go index <HASH>..<HASH> 100644 --- a/rice/embed-go.go +++ b/rice/embed-go.go @@ -46,6 +46,17 @@ func operationEmbedGo(pkg *build.Package) { Dirs: make(map[string]*dirDataType), } + boxInfo, ierr := os.Stat(boxPath) + if ierr != nil { + fmt.Printf("Error: unable to access box at %s\n", boxPath) + os.Exit(1) + } + if !boxInfo.IsDir() { + fmt.Printf("Error: Box %s must point to a directory but points to %s instead\n", + boxname, boxPath) + os.Exit(1) + } + // fill box datastructure with file data filepath.Walk(boxPath, func(path string, info os.FileInfo, err error) error { if err != nil { @@ -90,6 +101,10 @@ func operationEmbedGo(pkg *build.Package) { // add tree entry pathParts := strings.Split(fileData.FileName, "/") parentDir := box.Dirs[strings.Join(pathParts[:len(pathParts)-1], "/")] + if parentDir == nil { + fmt.Printf("Error: parent of %s is not within the box\n", path) + os.Exit(1) + } parentDir.ChildFiles = append(parentDir.ChildFiles, fileData) } return nil
Trapping some errors I got embed-go to crash so I wanted to stick in some diagnostics and exit gracefully.
GeertJohan_go.rice
train
go
23d2469b1b53daebe7922a7e8ea2ed033a06b177
diff --git a/language/google/cloud/language/document.py b/language/google/cloud/language/document.py index <HASH>..<HASH> 100644 --- a/language/google/cloud/language/document.py +++ b/language/google/cloud/language/document.py @@ -51,7 +51,12 @@ Annotations = collections.namedtuple( class Encoding(object): - """Document text encoding types.""" + """The encoding type used to calculate offsets. + + Represents the text encoding that the caller uses to process the output. + The API provides the beginning offsets for various outputs, such as tokens + and mentions. + """ NONE = 'NONE' """Unspecified encoding type.""" diff --git a/language/google/cloud/language/entity.py b/language/google/cloud/language/entity.py index <HASH>..<HASH> 100644 --- a/language/google/cloud/language/entity.py +++ b/language/google/cloud/language/entity.py @@ -68,6 +68,9 @@ class Entity(object): :type metadata: dict :param metadata: The metadata associated with the entity. + Wikipedia URLs and Knowledge Graph MIDs are + provided, if available. The associated keys are + "wikipedia_url" and "mid", respectively. :type salience: float :param salience: The prominence of the entity / phrase within the text
Added documentation from language proto (#<I>)
googleapis_google-cloud-python
train
py,py
81fdc6ffbc5d5861e6d9af4517157f246f03980f
diff --git a/src/model/line_widget.js b/src/model/line_widget.js index <HASH>..<HASH> 100644 --- a/src/model/line_widget.js +++ b/src/model/line_widget.js @@ -39,7 +39,7 @@ export class LineWidget { this.height = null let diff = widgetHeight(this) - oldH if (!diff) return - updateLineHeight(line, line.height + diff) + if (!lineIsHidden(this.doc, line)) updateLineHeight(line, line.height + diff) if (cm) { runInOp(cm, () => { cm.curOp.forceUpdate = true
When lineWidget changed, do not update hidden lines' height. Fix #<I>
codemirror_CodeMirror
train
js
749f5cae0bc6fa3d5bf1b108bd44721978ef7f83
diff --git a/ftr/version.py b/ftr/version.py index <HASH>..<HASH> 100644 --- a/ftr/version.py +++ b/ftr/version.py @@ -1,2 +1,2 @@ -version = '0.7.1' +version = '0.7.2'
version bump for <I>.
1flow_python-ftr
train
py
ee318f54bdbefa1ea94057ea864be73d9fe21e35
diff --git a/hgvs/location.py b/hgvs/location.py index <HASH>..<HASH> 100644 --- a/hgvs/location.py +++ b/hgvs/location.py @@ -244,9 +244,9 @@ class AAPosition(recordtype.recordtype("AAPosition", field_names=[("base", None) class Interval(recordtype.recordtype("Interval", field_names=["start", ("end", None), ("uncertain", False)])): def validate(self): - if not self.start: + if self.start: self.start.validate() - if not self.end: + if self.end: self.end.validate() # Check start less than or equal to end if not self.start or not self.end:
Fix bug in Interval start and end validation
biocommons_hgvs
train
py
8afd7a4b70f70822f25cf8b42ae757ca3b433259
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ if __name__ == "__main__": "optlang>=1.4.2", "tabulate", "depinfo", - "python-libsbml==5.18.0", + "python-libsbml-experimental>=5.18.0", ], tests_require=[ "jsonschema > 2.5",
changing to experimental libsbml for access to additional packages
opencobra_cobrapy
train
py
13f075a856b75ca91f97ef1bfc382d5f449b7083
diff --git a/code/Heystack/Subsystem/Ecommerce/Transaction/Collator.php b/code/Heystack/Subsystem/Ecommerce/Transaction/Collator.php index <HASH>..<HASH> 100644 --- a/code/Heystack/Subsystem/Ecommerce/Transaction/Collator.php +++ b/code/Heystack/Subsystem/Ecommerce/Transaction/Collator.php @@ -30,7 +30,8 @@ class Collator implements ViewableDataInterface { return array( - 'Total' => 'Money' + 'Total' => 'Money', + 'SubTotal' => 'Money' ); } @@ -76,8 +77,11 @@ class Collator implements ViewableDataInterface } } - - return $this->round($this->sumModifiers($modifiers)); + + return array( + 'Amount' => $this->round($this->sumModifiers($modifiers)), + 'Currency' => $this->transaction->getCurrencyCode() + ); }
UPDATE: added casting to subtotal
heyday_heystack-ecommerce-core
train
php
03da9af29272241f49627a0859bfed8d342494d9
diff --git a/src/platforms/vue-native/runtime/render-helpers/renderSlot.js b/src/platforms/vue-native/runtime/render-helpers/renderSlot.js index <HASH>..<HASH> 100644 --- a/src/platforms/vue-native/runtime/render-helpers/renderSlot.js +++ b/src/platforms/vue-native/runtime/render-helpers/renderSlot.js @@ -1,4 +1,4 @@ -import { COMMON } from "react-vue/compiler/config"; +import { COMMON } from "vue-native/compiler/config"; export function renderSlot(names, children) { const hitSlot = {};
getting the common tag name from vue-native in the renderSlot
GeekyAnts_vue-native-core
train
js
7d0b6fc34038a20de512fd6587df05a247ef76bd
diff --git a/src/transformers/commands/pt_to_tf.py b/src/transformers/commands/pt_to_tf.py index <HASH>..<HASH> 100644 --- a/src/transformers/commands/pt_to_tf.py +++ b/src/transformers/commands/pt_to_tf.py @@ -207,7 +207,7 @@ class PTtoTFCommand(BaseTransformersCLICommand): tf_from_pt_model = tf_class.from_pretrained(self._local_dir, from_pt=True) # Extra input requirements, in addition to the input modality - if hasattr(pt_model, "encoder") and hasattr(pt_model, "decoder"): + if config.is_encoder_decoder or (hasattr(pt_model, "encoder") and hasattr(pt_model, "decoder")): decoder_input_ids = np.asarray([[1], [1]], dtype=int) * pt_model.config.decoder_start_token_id pt_input.update({"decoder_input_ids": torch.tensor(decoder_input_ids)}) tf_input.update({"decoder_input_ids": tf.convert_to_tensor(decoder_input_ids)})
CLI: Properly detect encoder-decoder models (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
aeef39c03408c4211bcfb116bce68a3b28b19e1e
diff --git a/object.go b/object.go index <HASH>..<HASH> 100644 --- a/object.go +++ b/object.go @@ -221,12 +221,15 @@ func (o *ObjectConstraint) setProp(rv reflect.Value, pname string, val interface } // Is this a Maybe value? If so, we should use its Set() method - if f.CanAddr() { - if ptr := f.Addr(); ptr.Type().Implements(maybeif) { - mv := ptr.MethodByName("Set") - mv.Call([]reflect.Value{reflect.ValueOf(val)}) - return nil - } + switch { + case f.Type().Implements(maybeif): + mv := f.MethodByName("Set") + mv.Call([]reflect.Value{reflect.ValueOf(val)}) + return nil + case f.CanAddr() && f.Addr().Type().Implements(maybeif): + mv := f.Addr().MethodByName("Set") + mv.Call([]reflect.Value{reflect.ValueOf(val)}) + return nil } f.Set(reflect.ValueOf(val))
Check for both the value itself and pointer
lestrrat-go_jsval
train
go
9b64596264d03182b02c67c5c8ff3adc79ac3d7b
diff --git a/lib/omnibus/builder.rb b/lib/omnibus/builder.rb index <HASH>..<HASH> 100644 --- a/lib/omnibus/builder.rb +++ b/lib/omnibus/builder.rb @@ -9,7 +9,7 @@ module Omnibus # can arise from instance_eval. class DSLProxy extend Forwardable - + def_delegator :@builder, :patch def_delegator :@builder, :command def_delegator :@builder, :ruby def_delegator :@builder, :gem @@ -94,6 +94,14 @@ module Omnibus def command(*args) @build_commands << args end + + def patch(*args) + args = args.dup.pop + source = File.expand_path(args[:source]) + plevel = args[:plevel] || 0 + @build_commands << + "cat #{source} | patch -p#{plevel} #{args[:target]}" + end def ruby(*args) @build_commands << bundle_bust(*prepend_cmd("#{install_dir}/embedded/bin/ruby", *args))
Initial patch support, not yet idempotent
chef_omnibus
train
rb
be4d5d29590f639a1011b50f3c58b323b9ebd762
diff --git a/go/service/main.go b/go/service/main.go index <HASH>..<HASH> 100644 --- a/go/service/main.go +++ b/go/service/main.go @@ -740,11 +740,11 @@ func (d *Service) slowChecks() { ticker.Stop() return nil }) - // Do this once fast - if err := d.deviceCloneSelfCheck(); err != nil { - d.G().Log.Debug("deviceCloneSelfCheck error: %s", err) - } go func() { + // Do this once fast + if err := d.deviceCloneSelfCheck(); err != nil { + d.G().Log.Debug("deviceCloneSelfCheck error: %s", err) + } ctx := context.Background() m := libkb.NewMetaContext(ctx, d.G()).WithLogTag("SLOWCHK") for {
run initial clone check in background (#<I>)
keybase_client
train
go
95a94fee2ba601b83ce560bd48ce720510ea4380
diff --git a/runtests.py b/runtests.py index <HASH>..<HASH> 100644 --- a/runtests.py +++ b/runtests.py @@ -18,8 +18,7 @@ DEFAULT_SETTINGS = dict( DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", - "NAME": ":memory:", - "TEST_NAME": "dev.db" + "NAME": ":memory:" } }, SITE_ID=1,
No need for TEST_NAME
pinax_pinax-points
train
py
8178189e0193d862e4b42790de5e9c621f97ab80
diff --git a/lib/Rule.js b/lib/Rule.js index <HASH>..<HASH> 100644 --- a/lib/Rule.js +++ b/lib/Rule.js @@ -85,7 +85,7 @@ Rule.prototype.setNegation = function(negation) { }; Rule.prototype.toString = function() { - return this.reg.toString(); + return (this.negation ? '!' : '') + this.reg.toString(); }; exports = module.exports = Rule;
fix(fix rule toString when neg):
xgfe_freepack
train
js
8d8d43c50af3c4d709c5bc3fc7b3bca4f8cbaeb0
diff --git a/src/Jaguar/AbstractCanvas.php b/src/Jaguar/AbstractCanvas.php index <HASH>..<HASH> 100644 --- a/src/Jaguar/AbstractCanvas.php +++ b/src/Jaguar/AbstractCanvas.php @@ -197,7 +197,7 @@ abstract class AbstractCanvas implements CanvasInterface } $this->forceDestory(); $this->setHandler($handler); - $this->fill(new RGBColor(0, 0, 0, 127)); + $this->fill(new RGBColor(255, 255, 255, 127)); return $this; } @@ -323,6 +323,7 @@ abstract class AbstractCanvas implements CanvasInterface { $this->assertEmpty(); $coordinate = ($coordinate === null) ? new Coordinate() : $coordinate; + $this->alphaBlending(false); if ( false == @imagefill( $this->getHandler() @@ -336,6 +337,7 @@ abstract class AbstractCanvas implements CanvasInterface , (string) $this, (string) $color )); } + $this->alphaBlending(true); return $this; }
Made "fill" method in Abstractcanvas disable the alphablending before filling the color
hyyan_jaguar
train
php
bdbb066d729aa0b507cada7fadab6553daf7c9b6
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -81,6 +81,7 @@ function format(f, args, opts) { str += '%' lastPos = i + 2 i++ + a-- break } ++a diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -98,3 +98,4 @@ assert.equal(format('foo %j', [circularObject]), 'foo "[Circular]"') assert.equal(format('%%', ['foo']), '%') assert.equal(format('foo %%', ['foo']), 'foo %') +assert.equal(format('foo %% %s', ['bar']), 'foo % bar')
fix: percent escape eats argument
davidmarkclements_quick-format-unescaped
train
js,js
cce3df13efd21d613efb84b434b1a679f35562a5
diff --git a/lib/byebug/helpers/path.rb b/lib/byebug/helpers/path.rb index <HASH>..<HASH> 100644 --- a/lib/byebug/helpers/path.rb +++ b/lib/byebug/helpers/path.rb @@ -13,11 +13,7 @@ module Byebug end def lib_files - @lib_files ||= expand_from_root('lib/**/*.{rb,yml}') - end - - def ext_files - @ext_files ||= expand_from_root('ext/**/*.{c,h,rb}') + @lib_files ||= expand_from_root('lib/**/*.rb') end def test_files @@ -25,7 +21,7 @@ module Byebug end def gem_files - @gem_files ||= [bin_file] + lib_files + ext_files + @gem_files ||= [bin_file] + lib_files end def all_files
Less ignored files We were ignoring a lot of files we can't actually stop at.
deivid-rodriguez_byebug
train
rb
5b35958bd141acea0effc896c4ceca71c2c06937
diff --git a/js/whitebit.js b/js/whitebit.js index <HASH>..<HASH> 100644 --- a/js/whitebit.js +++ b/js/whitebit.js @@ -194,6 +194,7 @@ module.exports = class whitebit extends Exchange { 'Given amount is less than min amount': InvalidOrder, // {"code":0,"message":"Validation failed","errors":{"amount":["Given amount is less than min amount 200000"],"total":["Total is less than 5.05"]}} 'Total is less than': InvalidOrder, // {"code":0,"message":"Validation failed","errors":{"amount":["Given amount is less than min amount 200000"],"total":["Total is less than 5.05"]}} 'fee must be no less than': InvalidOrder, // {"code":0,"message":"Validation failed","errors":{"amount":["Total amount + fee must be no less than 5.05505"]}} + 'Enable your key in API settings': PermissionDenied, // {"code":2,"message":"This action is unauthorized. Enable your key in API settings"} }, }, });
whitebit PermissionDenied error mapping
ccxt_ccxt
train
js
0f68cbb408949575f9ce2887a00f0ee63ab4391b
diff --git a/api/src/main/java/org/telegram/botapi/api/chat/message/content/type/Contact.java b/api/src/main/java/org/telegram/botapi/api/chat/message/content/type/Contact.java index <HASH>..<HASH> 100644 --- a/api/src/main/java/org/telegram/botapi/api/chat/message/content/type/Contact.java +++ b/api/src/main/java/org/telegram/botapi/api/chat/message/content/type/Contact.java @@ -16,5 +16,5 @@ public interface Contact { return getFirstName() + " " + getLastName(); } - String getUserId(); + int getUserId(); }
Changed Contact#getUsedId() to int rather than String as that was incorrect.
zackpollard_JavaTelegramBot-API
train
java
354c8a53d92581a1b24310cf07e7612ee8b4f81b
diff --git a/tools/os_tools.go b/tools/os_tools.go index <HASH>..<HASH> 100644 --- a/tools/os_tools.go +++ b/tools/os_tools.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "os" + "os/exec" "strings" "github.com/git-lfs/git-lfs/subprocess" @@ -33,6 +34,11 @@ func translateCygwinPath(path string) (string, error) { out, err := cmd.Output() output := strings.TrimSpace(string(out)) if err != nil { + // If cygpath doesn't exist, that's okay: just return the paths + // as we got it. + if _, ok := err.(*exec.Error); ok { + return path, nil + } return path, fmt.Errorf("failed to translate path from cygwin to windows: %s", buf.String()) } return output, nil
tools: handle missing cygpath gracefully It looks like there are situations in which some Git for Windows installations don't have the cygpath binary. In that case, we end up picking an empty string, which leads us to install hooks and LFS objects in the current directory. Fix this by trying cygpath, and if it fails due to a path lookup error, returning the original path as we got it.
git-lfs_git-lfs
train
go
8cf4a4e5ad3d15f3119d0f9837a39809c1417682
diff --git a/pkg/datapath/linux/ethtool/ethtool.go b/pkg/datapath/linux/ethtool/ethtool.go index <HASH>..<HASH> 100644 --- a/pkg/datapath/linux/ethtool/ethtool.go +++ b/pkg/datapath/linux/ethtool/ethtool.go @@ -59,6 +59,8 @@ func ethtoolIoctl(iface string, info *ethtoolDrvInfo) error { if err != nil { return err } + defer unix.Close(fd) + copy(ifname[:], iface) req := ifreq{ name: ifname,
datapath/linux/ethtool: avoid leaking fd in ethtoolIoctl Close fd after using it to avoid leaking file descriptors. Fixes: 2c<I>a<I>de9 ("cilium: auto-detect network interfaces for IPAMENI case")
cilium_cilium
train
go
c2d9b2280cd17804151b02379ccc92709287c962
diff --git a/src/dom_components/view/ComponentView.js b/src/dom_components/view/ComponentView.js index <HASH>..<HASH> 100644 --- a/src/dom_components/view/ComponentView.js +++ b/src/dom_components/view/ComponentView.js @@ -7,10 +7,6 @@ import { replaceWith } from 'utils/dom'; import { setViewEl } from 'utils/mixins'; export default class ComponentView extends Backbone.View { - static getEvents() { - return result(this.prototype, 'events'); - } - className() { return this.getClasses(); } @@ -514,3 +510,8 @@ export default class ComponentView extends Backbone.View { onRender() {} } + +// Due to the Backbone extend mechanism, static methods are not properly extended +ComponentView.getEvents = function () { + return result(this.prototype, 'events'); +}; diff --git a/src/trait_manager/view/TraitsView.js b/src/trait_manager/view/TraitsView.js index <HASH>..<HASH> 100644 --- a/src/trait_manager/view/TraitsView.js +++ b/src/trait_manager/view/TraitsView.js @@ -32,4 +32,4 @@ export default class TraitsView extends DomainViews { } } -TraitView.prototype.itemView = TraitView; +TraitsView.prototype.itemView = TraitView;
Fixes for traits and component events
artf_grapesjs
train
js,js
a7d07e1fb05fbaa0c14b80ea6aaf20dae4a6b9f6
diff --git a/DependencyInjection/Compiler/TranslationResourceFilesPass.php b/DependencyInjection/Compiler/TranslationResourceFilesPass.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Compiler/TranslationResourceFilesPass.php +++ b/DependencyInjection/Compiler/TranslationResourceFilesPass.php @@ -49,14 +49,9 @@ class TranslationResourceFilesPass implements CompilerPassInterface $translationFiles = array(); $translator = $container->findDefinition('translator.default'); - try { - $translatorOptions = $translator->getArgument(4); - } catch (OutOfBoundsException $e) { - $translatorOptions = array(); - } - $translatorOptions = array_merge($translatorOptions, $translator->getArgument(3)); - + $translatorOptions = $translator->getArgument(4); + if (isset($translatorOptions['resource_files'])) { $translationFiles = $translatorOptions['resource_files']; }
Remove support for Symfony < <I> constructor signature (#<I>)
willdurand_BazingaJsTranslationBundle
train
php
44a96ba992664f111c6021e8bf8e90eca9b2839e
diff --git a/chef/lib/chef/provider/file.rb b/chef/lib/chef/provider/file.rb index <HASH>..<HASH> 100644 --- a/chef/lib/chef/provider/file.rb +++ b/chef/lib/chef/provider/file.rb @@ -161,7 +161,7 @@ class Chef def backup(file=nil) file ||= @new_resource.path - if @new_resource.backup > 0 && ::File.exist?(file) + if @new_resource.backup != false && @new_resource.backup > 0 && ::File.exist?(file) time = Time.now savetime = time.strftime("%Y%m%d%H%M%S") backup_filename = "#{@new_resource.path}.chef-#{savetime}"
Make "backup false" work in File provider derived resources again.
chef_chef
train
rb
25d3605da9d4458714014c3a7abd1896d40d4d97
diff --git a/lib/foodcritic/rules.rb b/lib/foodcritic/rules.rb index <HASH>..<HASH> 100644 --- a/lib/foodcritic/rules.rb +++ b/lib/foodcritic/rules.rb @@ -864,6 +864,9 @@ end rule 'FC064', 'Ensure issues_url is set in metadata' do tags %w(metadata supermarket) + applies_to do |version| + version >= gem_version('12.0.0') + end metadata do |ast, filename| [file_match(filename)] unless field(ast, 'issues_url').any? end @@ -871,6 +874,9 @@ end rule 'FC065', 'Ensure source_url is set in metadata' do tags %w(metadata supermarket) + applies_to do |version| + version >= gem_version('12.0.0') + end metadata do |ast, filename| [file_match(filename)] unless field(ast, 'source_url').any? end
Rules <I> and <I> only apply to Chef <I> and later
Foodcritic_foodcritic
train
rb
375e27247c6cecd2c154e6903ab2a3efa5b6943e
diff --git a/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java b/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java index <HASH>..<HASH> 100644 --- a/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java +++ b/azkaban-exec-server/src/main/java/azkaban/execapp/FlowRunnerManager.java @@ -553,8 +553,14 @@ public class FlowRunnerManager implements EventListener, final FlowRunner flowRunner = this.runningFlows.get(execId); if (flowRunner == null) { - throw new ExecutorManagerException("Execution " + execId - + " is not running."); + throw new ExecutorManagerException("Execution " + execId + " is not running."); + } + + // account for those unexpected cases where a completed execution remains in the runningFlows + //collection due to, for example, the FLOW_FINISHED event not being emitted/handled. + if(Status.isStatusFinished(flowRunner.getExecutableFlow().getStatus())) { + LOGGER.warn("Found a finished execution in the list of running flows: " + execId); + throw new ExecutorManagerException("Execution " + execId + " is already finished."); } flowRunner.kill(user);
Check that an execution is not in a final state already before killing it. (#<I>)
azkaban_azkaban
train
java
29b4cef6afb6c67ae831d4f42a4db3c19bc500ee
diff --git a/test/wsfed.tests.js b/test/wsfed.tests.js index <HASH>..<HASH> 100644 --- a/test/wsfed.tests.js +++ b/test/wsfed.tests.js @@ -204,7 +204,7 @@ describe('wsfed', function () { }); describe('using custom profile mapper', function() { - describe('when NameIdentifier is found', function() { + describe('when NameIdentifier and NameIdentifierFormat have been configured', function() { const fakeNameIdentifier = 'fakeNameIdentifier'; const fakeNameIdentifierFormat = 'fakeNameIdentifierFormat';
chore: giving test description a better name
auth0_node-wsfed
train
js
4b0426edfabb07feb8cead72231d822b22c03468
diff --git a/src/FrameReflower/Block.php b/src/FrameReflower/Block.php index <HASH>..<HASH> 100644 --- a/src/FrameReflower/Block.php +++ b/src/FrameReflower/Block.php @@ -492,29 +492,27 @@ class Block extends AbstractFrameReflower $lines = $this->_frame->get_line_boxes(); // needs to be a variable (strict standards) $last_line = array_pop($lines); - foreach ($lines as $i => $line) { + foreach ($lines as $line) { + if ($line->left) { + foreach ($line->get_frames() as $frame) { + if ($frame->get_positioner() instanceof InlinePositioner) { + $frame->move($line->left, 0); + } + } + } + if ($line->br) { - unset($lines[$i]); + continue; } - } - foreach ($lines as $line) { $other_frame_count = 0; - + foreach ($line->get_frames() as $frame) { if (!($frame instanceof TextFrameDecorator)) { $other_frame_count++; } } - if ($line->left) { - foreach ($line->get_frames() as $frame) { - if ($frame->get_positioner() instanceof InlinePositioner) { - $frame->move($line->left, 0); - } - } - } - $word_count = $line->wc + $other_frame_count; // Set the spacing for each child
Apply line shift to justified lines with break
dompdf_dompdf
train
php
a3d044e59e74aa45abb849962111f1a05e8ed4ae
diff --git a/lib/creator/yeoman/webpack-generator.js b/lib/creator/yeoman/webpack-generator.js index <HASH>..<HASH> 100644 --- a/lib/creator/yeoman/webpack-generator.js +++ b/lib/creator/yeoman/webpack-generator.js @@ -43,6 +43,7 @@ module.exports = class WebpackGenerator extends Generator { this.configuration.config.webpackOptions.plugins = getDefaultPlugins(); this.configuration.config.topScope.push( 'const webpack = require(\'webpack\')', + 'const path = require(\'path\')', tooltip.uglify(), 'const UglifyJSPlugin = require(\'uglifyjs-webpack-plugin\');', '\n' @@ -76,7 +77,7 @@ module.exports = class WebpackGenerator extends Generator { if(outputTypeAnswer['outputType'].length) { this.configuration.config.webpackOptions.output.path = `'${outputTypeAnswer['outputType']}'`; } else { - this.configuration.config.webpackOptions.output.path = '\'./dist\''; + this.configuration.config.webpackOptions.output.path = '\path.resolve(__dirname, \'dist\')'; } }).then( () => { this.prompt([
ensure default output path is absolute (#<I>)
webpack_webpack-cli
train
js
6d356368118cdedb44fdd1c27662c95f417db32f
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -49,5 +49,6 @@ setup( 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', ], - long_description=read_file('README.md') + long_description=read_file('README.md'), + long_description_content_type="text/markdown" )
Specifying for pypi that the readme is in markdown format.
KartikTalwar_Duolingo
train
py
c47824914299ff288e3dd4e503d3e6a25f9ec159
diff --git a/pygsp/plotting.py b/pygsp/plotting.py index <HASH>..<HASH> 100644 --- a/pygsp/plotting.py +++ b/pygsp/plotting.py @@ -67,10 +67,7 @@ def plot_graph(G, show_edges=None, savefig=False): """ - local_arg = locals() - print(local_arg) - - def _thread(**kwargs): + def _thread(G, show_edges, savefig): # TODO handling when G is a list of graphs # TODO integrate param when G is a clustered graph @@ -135,7 +132,7 @@ def plot_graph(G, show_edges=None, savefig=False): else: plt.show() - threading.Thread(None, _thread, kwargs=local_arg).start() + threading.Thread(None, _thread, None, (G, show_edges, savefig)).start() def pg_plot_graph(G, show_edges=None):
plot_graph() now handles show_Edges arg correctly with the thread
epfl-lts2_pygsp
train
py
8d8fde2007cb48887b4bca1a4dede016d8961283
diff --git a/eventsourcing/domain.py b/eventsourcing/domain.py index <HASH>..<HASH> 100644 --- a/eventsourcing/domain.py +++ b/eventsourcing/domain.py @@ -770,7 +770,7 @@ class MetaAggregate(type): def __init__( cls, *args: Any, - created_event_name: Optional[str] = None, + created_event_name: str = "", ) -> None: super().__init__(*args) @@ -1269,7 +1269,7 @@ class Aggregate(metaclass=MetaAggregate): def aggregate( cls: Optional[Any] = None, *, - created_event_name: Optional[str] = None, + created_event_name: str = "", ) -> Union[Type[Aggregate], Callable[[Any], Type[Aggregate]]]: """ Converts the class that was passed in to inherit from Aggregate.
Changed 'created_event_name' arg to be 'str' with empty string as default (resolved pyright error).
johnbywater_eventsourcing
train
py
b41e790ff850f21d143d6380107790178f0fc78c
diff --git a/DbalConsumerHelperTrait.php b/DbalConsumerHelperTrait.php index <HASH>..<HASH> 100644 --- a/DbalConsumerHelperTrait.php +++ b/DbalConsumerHelperTrait.php @@ -129,9 +129,10 @@ trait DbalConsumerHelperTrait ->delete($this->getContext()->getTableName()) ->andWhere('(time_to_live IS NOT NULL) AND (time_to_live < :now)') ->andWhere('delivery_id IS NULL') - ->andWhere('redelivered = false') + ->andWhere('redelivered = :redelivered') ->setParameter(':now', time(), Type::BIGINT) + ->setParameter('redelivered', false, Type::BOOLEAN) ; try {
#<I> - swap redelivered flag from in-line sql constant to parameter to better work with MS-SQL server
php-enqueue_dbal
train
php
0f401a2d5168f4cf492cce52ea2eb3c8a1efc1be
diff --git a/src/ol/base/maprenderer.js b/src/ol/base/maprenderer.js index <HASH>..<HASH> 100644 --- a/src/ol/base/maprenderer.js +++ b/src/ol/base/maprenderer.js @@ -110,7 +110,9 @@ ol.MapRenderer.prototype.disposeInternal = function() { goog.dispose(layerRenderer); }); goog.array.forEach(this.mapListenerKeys_, goog.events.unlistenByKey); - goog.array.forEach(this.layersListenerKeys_, goog.events.unlistenByKey); + if (!goog.isNull(this.layersListenerKeys_)) { + goog.array.forEach(this.layersListenerKeys_, goog.events.unlistenByKey); + } goog.base(this, 'disposeInternal'); };
forEach cannot iterate over a null object
openlayers_openlayers
train
js
b4d96095fb16d9c8a6e70ec8d05d6a539e9aee91
diff --git a/quark/python.py b/quark/python.py index <HASH>..<HASH> 100644 --- a/quark/python.py +++ b/quark/python.py @@ -136,7 +136,9 @@ def main(fname, common): ## Naming and imports -SUBS = {"print": "print_"} +SUBS = {"print": "print_", + "global": "global_", + } def name(n): return SUBS.get(n, n).replace("-", "_")
Global is a reserved word in python
datawire_quark
train
py
836bd2727a36cb984325c62f66951e0417c5c7c7
diff --git a/lib/active_dynamic/has_dynamic_attributes.rb b/lib/active_dynamic/has_dynamic_attributes.rb index <HASH>..<HASH> 100644 --- a/lib/active_dynamic/has_dynamic_attributes.rb +++ b/lib/active_dynamic/has_dynamic_attributes.rb @@ -22,7 +22,6 @@ module ActiveDynamic # use internal ActiveModel callback to generate accessors for dynamic attributes # before attributes get assigned def initialize_internals_callback - puts '!' * 100 load_dynamic_attributes super end diff --git a/lib/active_dynamic/version.rb b/lib/active_dynamic/version.rb index <HASH>..<HASH> 100644 --- a/lib/active_dynamic/version.rb +++ b/lib/active_dynamic/version.rb @@ -1,3 +1,3 @@ module ActiveDynamic - VERSION = '0.2.0' + VERSION = '0.3.0' end
Bump up verion to <I>
koss-lebedev_active_dynamic
train
rb,rb
09cb0787caa09fa23e49d4147078955156a1161c
diff --git a/src/Malenki/Bah/A.php b/src/Malenki/Bah/A.php index <HASH>..<HASH> 100644 --- a/src/Malenki/Bah/A.php +++ b/src/Malenki/Bah/A.php @@ -223,6 +223,10 @@ class A implements \Iterator, \Countable return $this; } + public function push($thing) + { + return $this->add($thing); + } protected function _unique() { diff --git a/tests/ATest.php b/tests/ATest.php index <HASH>..<HASH> 100644 --- a/tests/ATest.php +++ b/tests/ATest.php @@ -81,11 +81,11 @@ class ATest extends PHPUnit_Framework_TestCase $this->assertEquals(2, count($a)); $this->assertEquals(2, $a->length->value); $this->assertEquals(2, $a->length->int); - $a->add('three'); + $a->push('three'); $this->assertEquals(3, count($a)); $this->assertEquals(3, $a->length->value); $this->assertEquals(3, $a->length->int); - $a->add('four')->add('five'); + $a->push('four')->add('five'); $this->assertEquals(5, count($a)); $this->assertEquals(5, $a->length->value); $this->assertEquals(5, $a->length->int);
Push alais of add method added to A class
malenkiki_bah
train
php,php
fd2d8956ec967261b0c8efb4a958d7bb2b07a753
diff --git a/spotinst/service_aws_group.go b/spotinst/service_aws_group.go index <HASH>..<HASH> 100644 --- a/spotinst/service_aws_group.go +++ b/spotinst/service_aws_group.go @@ -43,6 +43,7 @@ type AwsGroupIntegration struct { ElasticBeanstalk *AwsGroupElasticBeanstalkIntegration `json:"elasticBeanstalk,omitempty"` Rancher *AwsGroupRancherIntegration `json:"rancher,omitempty"` Kubernetes *AwsGroupKubernetesIntegration `json:"kubernetes,omitempty"` + Mesosphere *AwsGroupMesosphereIntegration `json:"mesosphere,omitempty"` } type AwsGroupRancherIntegration struct { @@ -64,6 +65,10 @@ type AwsGroupKubernetesIntegration struct { Token *string `json:"token,omitempty"` } +type AwsGroupMesosphereIntegration struct { + Server *string `json:"apiServer,omitempty"` +} + type AwsGroupScheduling struct { Tasks []*AwsGroupScheduledTask `json:"tasks,omitempty"` }
src: Add support for Mesosphere intergation
spotinst_spotinst-sdk-go
train
go