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
60627c148402a89a8aefa8f97555d062840b8359
diff --git a/gcs/gcstesting/bucket_tests.go b/gcs/gcstesting/bucket_tests.go index <HASH>..<HASH> 100644 --- a/gcs/gcstesting/bucket_tests.go +++ b/gcs/gcstesting/bucket_tests.go @@ -1424,7 +1424,27 @@ func (t *copyTest) ParticularSourceGeneration_GenerationDoesntExist() { } func (t *copyTest) ParticularSourceGeneration_Exists() { - AssertTrue(false, "TODO") + var err error + + // Create a source object. + src, err := t.bucket.CreateObject( + t.ctx, + &gcs.CreateObjectRequest{ + Name: "foo", + Contents: strings.NewReader("taco"), + }) + + AssertEq(nil, err) + + // Send a copy request for the right generation number. + req := &gcs.CopyObjectRequest{ + SrcName: src.Name, + SrcGeneration: src.Generation, + DstName: "bar", + } + + _, err = t.bucket.CopyObject(t.ctx, req) + ExpectEq(nil, err) } ////////////////////////////////////////////////////////////////////////
CopyTest.ParticularSourceGeneration_Exists
jacobsa_gcloud
train
go
36f13482c58c81dc1669583696c10cebf5c53a2d
diff --git a/mode/stex/stex.js b/mode/stex/stex.js index <HASH>..<HASH> 100644 --- a/mode/stex/stex.js +++ b/mode/stex/stex.js @@ -103,7 +103,7 @@ // Do we look like '\command' ? If so, attempt to apply the plugin 'command' if (source.match(/^\\[a-zA-Z@]+/)) { var cmdName = source.current().slice(1); - plug = plugins[cmdName] || plugins["DEFAULT"]; + plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"]; plug = new plug(); pushCommand(state, plug); setState(state, beginParams);
[sTeX mode] Ensured that tag does not clash with object prototype properties
codemirror_CodeMirror
train
js
ed062e0ce54724714285ce840c2b59ae805e568c
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index <HASH>..<HASH> 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -134,7 +134,7 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) { for _, f := range msg.Extra["file"] { fi := f.(config.FileInfo) if fi.URL != "" { - msg.Text += fi.URL + " " + msg.Text += " " + fi.URL } } err := b.c.WebhookExecute(
Add a space before url in file uploads (discord). Closes #<I>
42wim_matterbridge
train
go
b077f09672f87c4179112cf31754c61735ffeffc
diff --git a/src/main/java/org/mule/tools/maven/rest/MuleRest.java b/src/main/java/org/mule/tools/maven/rest/MuleRest.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/mule/tools/maven/rest/MuleRest.java +++ b/src/main/java/org/mule/tools/maven/rest/MuleRest.java @@ -106,8 +106,6 @@ public class MuleRest { InputStream responseStream = (InputStream) response.getEntity(); JsonNode jsonNode = OBJECT_MAPPER.readTree(responseStream); - processResponse(response); - return jsonNode.path("id") .asText(); } finally {
Removed call to processResponse as response stream is closed at this point and giving IOException
NicholasAStuart_Maven-Mule-REST-Plugin
train
java
8e3c6c8aa185e0f1f07297ac8feba0bda17f2be1
diff --git a/src/Grphp/Client.php b/src/Grphp/Client.php index <HASH>..<HASH> 100644 --- a/src/Grphp/Client.php +++ b/src/Grphp/Client.php @@ -129,7 +129,6 @@ class Client $i->setRequest($request); $i->setMethod($method); $i->setMetadata($metadata); - $i->setOptions($options); $i->setStub($this->client); return $i->call(function() use (&$i, &$interceptors, &$method, &$request, &$metadata, &$options, &$callback) { $metadata = $i->getMetadata();
Dont override interceptor options on call
bigcommerce_grphp
train
php
02967a279c63eb496a8e0913d160b5e871117e43
diff --git a/lib/graceful.js b/lib/graceful.js index <HASH>..<HASH> 100644 --- a/lib/graceful.js +++ b/lib/graceful.js @@ -163,8 +163,8 @@ module.exports = class Graceful { } }); }else{ - process.on('message', msg => { - if(msg === 'think-reload-signal'){ + process.once('message', message => { + if(message === 'think-reload-signal'){ this.disconnectWorker(true); } });
Use once instead of on when reload worker
thinkjs_think-cluster
train
js
d15ed1576c46215f531d747136b71edcc7b2c5a2
diff --git a/provision/docker/docker.go b/provision/docker/docker.go index <HASH>..<HASH> 100644 --- a/provision/docker/docker.go +++ b/provision/docker/docker.go @@ -181,7 +181,7 @@ func newContainer(app provision.App, imageId string, cmds []string) (container, opts := docker.CreateContainerOptions{Name: contName, Config: &config} hostID, c, err := dockerCluster().CreateContainer(opts) if err == docker.ErrNoSuchImage { - var buf bytes.Buffer + var buf safe.Buffer pullOpts := docker.PullImageOptions{Repository: imageId, OutputStream: &buf} dockerCluster().PullImage(pullOpts) hostID, c, err = dockerCluster().CreateContainer(opts)
provision/docker: use safe buffer to prevent data races in pull image
tsuru_tsuru
train
go
23188ab67339e73c77f2f6ababa8d3e183bc434c
diff --git a/host/scan_ext_trigger.py b/host/scan_ext_trigger.py index <HASH>..<HASH> 100644 --- a/host/scan_ext_trigger.py +++ b/host/scan_ext_trigger.py @@ -149,7 +149,9 @@ class ExtTriggerScan(ScanBase): logging.info('Total amount of triggers collected: %d', self.readout_utils.get_trigger_number()) - self.readout.stop() + self.readout.stop() + + raw_data_file.append(self.readout.data) def analyze(self): from analysis.analyze_raw_data import AnalyzeRawData
ENH: readout data that could remain in memory
SiLab-Bonn_pyBAR
train
py
9b3f291702314b81b4bccc40707eba8d8808386a
diff --git a/lib/opal/compiler.rb b/lib/opal/compiler.rb index <HASH>..<HASH> 100644 --- a/lib/opal/compiler.rb +++ b/lib/opal/compiler.rb @@ -61,6 +61,7 @@ module Opal # Defines a compiler option. # @option as: [Symbol] uses a different method name, e.g. with a question mark for booleans # @option default: [Object] the default value for the option + # @option magic_comment: [Bool] allows magic-comments to override the option value def self.compiler_option(name, config = {}) method_name = config.fetch(:as, name) define_method(method_name) { option_value(name, config) } @@ -72,9 +73,14 @@ module Opal default_value = config[:default] valid_values = config[:valid_values] + magic_comment = config[:magic_comment] value = @options.fetch(name, default_value) + if magic_comment && @magic_comments.key?(name) + value = @magic_comments.fetch(name) + end + if valid_values && !valid_values.include?(value) raise( ArgumentError, @@ -152,7 +158,7 @@ module Opal # @!method use_strict? # # Adds source_location for every method definition - compiler_option :use_strict, default: false, as: :use_strict? + compiler_option :use_strict, default: false, as: :use_strict?, magic_comment: true # @!method parse_comments? #
Let use_strict to be controlled by magic comments
opal_opal
train
rb
fe59192fb66b28877800374b917b95dfc9466854
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ from setuptools import ( here = os.path.dirname(__file__) requires = [ - 'cryptography ~= 3.4.5', # Feb 13, 2021 + 'cryptography ~= 3.1, != 3.4.0', ]
deps: relax cryptography version constraint
GehirnInc_python-jwt
train
py
7273037c687963fff0281744c13bd2e1e2f65ac8
diff --git a/anyconfig/backend/base.py b/anyconfig/backend/base.py index <HASH>..<HASH> 100644 --- a/anyconfig/backend/base.py +++ b/anyconfig/backend/base.py @@ -572,7 +572,7 @@ def dump_with_fn(dump_fn, data, stream, **options): if stream is None: return dump_fn(data, **options) - dump_fn(data, stream, **options) + return dump_fn(data, stream, **options) class StringStreamFnParser(Parser, FromStreamLoaderMixin, ToStreamDumperMixin):
fix: suppress pylint's warn, inconsistent-return-statements (not a bug actually but just in case)
ssato_python-anyconfig
train
py
2e798697915e6e6d4a6c1fd1be6f0924db6efcbb
diff --git a/tests/providers/test_cloudxns.py b/tests/providers/test_cloudxns.py index <HASH>..<HASH> 100644 --- a/tests/providers/test_cloudxns.py +++ b/tests/providers/test_cloudxns.py @@ -7,10 +7,15 @@ import pytest # Hook into testing framework by inheriting unittest.TestCase and reuse # the tests which *each and every* implementation of the interface must # pass, by inheritance from define_tests.TheTests -class DnsParkProviderTests(TestCase, IntegrationTests): +class CloudXNSProviderTests(TestCase, IntegrationTests): Provider = Provider provider_name = 'cloudxns' domain = 'capsulecd.com' def _filter_post_data_parameters(self): return ['login_token'] + + # TODO: the following skipped suite and fixtures should be enabled + @pytest.mark.skip(reason="new test, missing recording") + def test_Provider_when_calling_update_record_should_modify_record_name_specified(self): + return \ No newline at end of file
fixing misnamed test class, skipping tests without recordings.
AnalogJ_lexicon
train
py
6c164985823c52f32d059e2512720280dd386729
diff --git a/kana2/query.py b/kana2/query.py index <HASH>..<HASH> 100644 --- a/kana2/query.py +++ b/kana2/query.py @@ -11,7 +11,7 @@ Query dictionaries can include the following keys: Can be any tag combination that works on the booru. Note, Danbooru limits searches to 2 tags for normal members/visitors. - `page` (`list`): List of pages to search. - See :func:`tools.generate_page_set` for details. + See :func:`info.generate_page_set` for details. - `limit` (`int`): How many posts per page to retrieve. - `random` (`bool`): Randomize search results. - `raw` (`bool`): Parse `tags` as a single literal tag. @@ -151,6 +151,8 @@ def search(*args): *args (str): A dictionary of search parameters. Possible parameters are any key found in query directionaries, minus `type`. + If the `"page"` value is a `int` or `str`, it will be wrapped + into a list as expected for queries. Returns: list: Query dictionaries for each argument passed. @@ -162,4 +164,8 @@ def search(*args): for search_ in args: search_["type"] = "search" + + if isinstance(search_["page"], (int, str)): + search_["page"] = [search_["page"]] + return list(args)
query.search(): Wrap page key into list if needed
mirukan_lunafind
train
py
ed332b1e92e14806ee598b7286f180bac8969c7d
diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index <HASH>..<HASH> 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -38,7 +38,6 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; -import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.text.InputType; @@ -518,13 +517,8 @@ public class InAppBrowser extends CordovaPlugin { settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setBuiltInZoomControls(true); - /** - * We need to be careful of this line as a future Android release may deprecate it out of existence. - * Can't replace it with the API 8 level call right now as our minimum SDK is 7 until May 2013 - */ - // @TODO: replace with settings.setPluginState(android.webkit.WebSettings.PluginState.ON) - settings.setPluginsEnabled(true); - + settings.setPluginState(android.webkit.WebSettings.PluginState.ON); + //Toggle whether this is enabled or not! Bundle appSettings = cordova.getActivity().getIntent().getExtras(); boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true);
[CB-<I>] Warning cleanup! Removed deprecated use.
Prasannaa1991_cordova-inappbrowser
train
java
89aabe5cd461ad960649f22fdf1daae05988fc9c
diff --git a/mstate/unit.go b/mstate/unit.go index <HASH>..<HASH> 100644 --- a/mstate/unit.go +++ b/mstate/unit.go @@ -158,6 +158,7 @@ func (u *Unit) AssignToMachine(m *Machine) (err error) { bson.D{{"machineid", nil}}, bson.D{{"machineid", m.Id()}}, }}, + {"life", Alive}, } op := []txn.Operation{{ Collection: u.st.units.Name,
mstate: units have to be alive to be assigned to a machine
juju_juju
train
go
f2d22af6d1f9f0626fc08ceab9b4f67b4d7b714e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -20,11 +20,11 @@ setup( 'Framework :: Django', ], dependency_links=[ - 'http://github.com/wesokes/django-query-builder/tarball/0.5#egg=django-query-builder-0.5.2', + 'http://github.com/ambitioninc/django-query-builder/tarball/master#egg=django-query-builder-0.5.3', ], install_requires=[ 'django>=1.6', - 'django-query-builder>=0.5.2', + 'django-query-builder>=0.5.3', ], include_package_data=True, )
Update setup.py Updated querybuilder requirement
ambitioninc_django-manager-utils
train
py
10d7d27178565555156eaa1e4e33c11080f237d3
diff --git a/rwslib/builders/modm.py b/rwslib/builders/modm.py index <HASH>..<HASH> 100644 --- a/rwslib/builders/modm.py +++ b/rwslib/builders/modm.py @@ -9,12 +9,15 @@ import enum class MODMExtensionRegistry(enum.Enum): """ A registry of MODM extension Elements + TODO: Get this from the Schema """ StudyEventDef = ["ArmAssociation"] StudyEventRef = ["ArmAssociation"] ClinicalData = ["ExternalStudyID", "StudyUUID", "AuditSubCategoryName"] StudyEventData = ["VisitOpenDate", "VisitCloseDate", "StudyEventUUID", - "InstanceName"] + "InstanceName", "VisitTargetDate", "InstanceId", + "InstanceOverDue", "InstanceStartWindow","InstanceEndWindow" + "InstanceClose", "InstanceAccess", "StudyEventDate"] SubjectData = ["SubjectName"] FormData = ["FormUUID"] ItemGroupData = ["ItemGroupUUID"]
Added missing StudyEventData attributes
mdsol_rwslib
train
py
e9e16e7e5f337b57eeae13612d77581292725b36
diff --git a/src/PHPSQLParser/processors/AbstractProcessor.php b/src/PHPSQLParser/processors/AbstractProcessor.php index <HASH>..<HASH> 100644 --- a/src/PHPSQLParser/processors/AbstractProcessor.php +++ b/src/PHPSQLParser/processors/AbstractProcessor.php @@ -64,7 +64,7 @@ abstract class AbstractProcessor { * * @param Options $options */ - public function __construct(Options $options) + public function __construct(Options $options = null) { $this->options = $options; }
A PHP Notice for miss argument passed to construct
greenlion_PHP-SQL-Parser
train
php
f511d2faa5f6e5a56161ff05abafb89bae6d975f
diff --git a/spec/config_spec.rb b/spec/config_spec.rb index <HASH>..<HASH> 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -3,17 +3,6 @@ require 'spec_helper' describe Confoog::Settings do subject { Confoog::Settings.new } - before(:all) do - # create an internal STDERR so we can still test this but it will not - # clutter up the output - $original_stderr = $stderr - $stderr = StringIO.new - end - - after(:all) do - $stderr = $original_stderr - end - it 'should allow the setting of arbitrary value pairs of any type' do subject[:first] = 'testing a string' expect(subject[:first]).to eq 'testing a string'
Remove unused before/after from tests config_spec.rb
seapagan_confoog
train
rb
fd92846686d5dd17dc3353aeb2a5d2f116282fb4
diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index <HASH>..<HASH> 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -195,8 +195,9 @@ func (m *Manager) Set(container *configs.Config) error { if m.Cgroups.Paths != nil { return nil } + + paths := m.GetPaths() for _, sys := range subsystems { - paths := m.GetPaths() path := paths[sys.Name()] if err := sys.Set(path, container.Cgroups); err != nil { return err
move m.GetPaths out of the loop only call m.GetPaths once is ok. os move it out of the loop.
opencontainers_runc
train
go
a1c229d29c0fc2d6e40a2e7f96ce7ad8347f9dae
diff --git a/api/client/volume.go b/api/client/volume.go index <HASH>..<HASH> 100644 --- a/api/client/volume.go +++ b/api/client/volume.go @@ -14,8 +14,8 @@ import ( const ( graphPath = "/graph" - volumePath = "/volumes" - snapPath = "/snapshot" + volumePath = "/osd-volumes" + snapPath = "/osd-snapshot" ) type volumeClient struct { diff --git a/api/server/volume.go b/api/server/volume.go index <HASH>..<HASH> 100644 --- a/api/server/volume.go +++ b/api/server/volume.go @@ -404,11 +404,11 @@ func volVersion(route, version string) string { } func volPath(route, version string) string { - return volVersion("volumes"+route, version) + return volVersion("osd-volumes"+route, version) } func snapPath(route, version string) string { - return volVersion("snapshot"+route, version) + return volVersion("osd-snapshot"+route, version) } func (vd *volApi) Routes() []*Route {
Change the volume REST server path from volumes to osd-volumes, so that we do not clash with docker paths
libopenstorage_openstorage
train
go,go
a7b70581b3001b96b686c997c0b8f4e48b812917
diff --git a/scene/src/playn/scene/CanvasLayer.java b/scene/src/playn/scene/CanvasLayer.java index <HASH>..<HASH> 100644 --- a/scene/src/playn/scene/CanvasLayer.java +++ b/scene/src/playn/scene/CanvasLayer.java @@ -57,6 +57,7 @@ public class CanvasLayer extends ImageLayer { * the contents of the new canvas. Until then, it will display the old image data. */ public void resize (float width, float height) { + if (canvas != null) canvas.dispose(); canvas = gfx.createCanvas(width, height); } @@ -79,11 +80,19 @@ public class CanvasLayer extends ImageLayer { else setTexture(gfx.createTexture(canvas.image)); } - @Override public float width() { + @Override public float width () { return (forceWidth < 0) ? canvas.width : forceWidth; } - @Override public float height() { + @Override public float height () { return (forceHeight < 0) ? canvas.height : forceHeight; } + + @Override public void destroy () { + super.destroy(); + if (canvas != null) { + canvas.dispose(); + canvas = null; + } + } }
Dispose canvas on destroy().
playn_playn
train
java
a7487bbcedde350dfbe9e24943f2abb7c728317a
diff --git a/dynamic_rest/constants.py b/dynamic_rest/constants.py index <HASH>..<HASH> 100644 --- a/dynamic_rest/constants.py +++ b/dynamic_rest/constants.py @@ -5,4 +5,4 @@ DESCRIPTION = "Adds Dynamic API support to Django REST Framework." REPO_NAME = "dynamic-rest" PROJECT_NAME = "Dynamic REST" ORG_NAME = "AltSchool" -VERSION = "1.4.6" +VERSION = "1.4.7"
update version number in constants.py
AltSchool_dynamic-rest
train
py
21f0f0d46896933c36af338c3718deb6826e85ca
diff --git a/index.js b/index.js index <HASH>..<HASH> 100755 --- a/index.js +++ b/index.js @@ -1374,12 +1374,11 @@ const _start = () => { }; if (require.main === module) { - process.on('uncaughtException', err => { + const _logStack = err => { console.warn(err.stack); - }); - process.on('unhandledRejection', err => { - console.warn(err.stack); - }); + }; + process.on('uncaughtException', _logStack); + process.on('unhandledRejection', _logStack); EventEmitter.defaultMaxListeners = 100; if (args.version) {
Small uncaught exceptions handling cleanup
exokitxr_exokit
train
js
dbd133c7cef9cf5d1b832b187959548b74c178ce
diff --git a/fred/helpers/__init__.py b/fred/helpers/__init__.py index <HASH>..<HASH> 100644 --- a/fred/helpers/__init__.py +++ b/fred/helpers/__init__.py @@ -12,6 +12,9 @@ import fred.config as c from json import loads from pandas import DataFrame +# consider putting this in ~/.fred or env var +_USE_JOBLIB_CACHE = True + def _fetch(url, ssl_verify = True): """ Helper funcation to fetch content from a given url. @@ -125,3 +128,11 @@ def _get_request(url_root,api_key,path,response_type,params, ssl_verify): content = _fetch(url, ssl_verify) response = _dispatch(response_type)(content) return response + +if _USE_JOBLIB_CACHE: + import joblib + location = '/tmp/joblib_cache' + one_gb = 1000000000 + memory = joblib.Memory(location, verbose=1, bytes_limit=one_gb) + memory.cache + _get_request = memory.cache(_get_request)
Put joblib cache in the _get_request function. one gb limit. verbose for safety.
avelkoski_FRB
train
py
42ce816cd5618084ce150410b45ed947da9d73e2
diff --git a/src/main/java/com/dlsc/preferencesfx/view/PreferencesFxView.java b/src/main/java/com/dlsc/preferencesfx/view/PreferencesFxView.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/dlsc/preferencesfx/view/PreferencesFxView.java +++ b/src/main/java/com/dlsc/preferencesfx/view/PreferencesFxView.java @@ -27,9 +27,11 @@ public class PreferencesFxView extends BorderPane implements View { BreadCrumbView breadCrumbView, CategoryController categoryController ) { - this(model, categoryController); - this.navigationView = navigationView; this.breadCrumbView = breadCrumbView; + this.navigationView = navigationView; + this.model = model; + this.categoryController = categoryController; + init(); } public PreferencesFxView(PreferencesFxModel model, CategoryController categoryController) {
fixed bug where it would crash upon startup, because of calling init() too soon
dlemmermann_PreferencesFX
train
java
3c30e5041ff5d68991c7297b44d3baa057db9e4d
diff --git a/install_tools.py b/install_tools.py index <HASH>..<HASH> 100644 --- a/install_tools.py +++ b/install_tools.py @@ -235,7 +235,7 @@ def install_tool(app, Cnt): path_tools = input_path('Enter path for NiftyPET tools (registration, etc):') except: print 'enter the intended PATHTOOLS in resources.py located in ~/.niftypet/' - raise ValueError('e> could not get the path for NiftyPET_tools') + raise ValueError('\n e> could not get the path for NiftyPET_tools \n') Cnt['PATHTOOLS'] = path_tools else:
changed installation in case of no interaction with user
pjmark_NIMPA
train
py
199a6bf84660e9c30db2eda8d91470b45ab3d26a
diff --git a/tests/Drivers/DriverTest.php b/tests/Drivers/DriverTest.php index <HASH>..<HASH> 100644 --- a/tests/Drivers/DriverTest.php +++ b/tests/Drivers/DriverTest.php @@ -2,8 +2,8 @@ namespace Sven\FileConfig\Tests\Drivers; +use PHPUnit\Framework\TestCase; use Sven\FileConfig\Drivers\Driver; -use Sven\FileConfig\Tests\TestCase; abstract class DriverTest extends TestCase {
Extend PhpUnit's 'TestCase' class where possible To prevent overhead and unnecessary resources being used, we'll extend PhpUnit's supplied `TestCase` class where possible.
svenluijten_file-config
train
php
77d3a09b832f7c2e49b2f566107009c0fc76ed76
diff --git a/lib/celluloid/rspec.rb b/lib/celluloid/rspec.rb index <HASH>..<HASH> 100644 --- a/lib/celluloid/rspec.rb +++ b/lib/celluloid/rspec.rb @@ -1,3 +1,6 @@ require "celluloid/test" $CELLULOID_DEBUG = true + +# Load shared examples for other gems to use. +Dir["#{File.expand_path("../../../spec/shared", __FILE__)}/*.rb"].map {|f| require f } \ No newline at end of file
bring shared examples into scope for other gems
celluloid_celluloid
train
rb
d879d77cd09940087bab5bd9703482fa32f20cd0
diff --git a/mautrix/types/event/to_device.py b/mautrix/types/event/to_device.py index <HASH>..<HASH> 100644 --- a/mautrix/types/event/to_device.py +++ b/mautrix/types/event/to_device.py @@ -93,7 +93,7 @@ class ToDeviceEvent(BaseEvent, SerializableAttrs['ToDeviceEvent']): def deserialize(cls, data: JSON) -> 'ToDeviceEvent': try: evt_type = EventType.find(data.get("type"), t_class=EventType.Class.TO_DEVICE) - data.get("content", {})["__mautrix_event_type"] = evt_type + data.setdefault("content", {})["__mautrix_event_type"] = evt_type except ValueError: return Obj(**data) return super().deserialize(data)
Handle missing content in to-device events
tulir_mautrix-python
train
py
f86eeac96b2634a585c60e1ea010de90a7d22e1a
diff --git a/chef/spec/unit/provider/cookbook_file_spec.rb b/chef/spec/unit/provider/cookbook_file_spec.rb index <HASH>..<HASH> 100644 --- a/chef/spec/unit/provider/cookbook_file_spec.rb +++ b/chef/spec/unit/provider/cookbook_file_spec.rb @@ -131,8 +131,6 @@ EXPECTED describe "when the file exists but has incorrect content" do before do @tempfile = Tempfile.open('cookbook_file_spec') - # Use binary mode to avoid CRLF on windows - @tempfile.binmode @new_resource.path(@target_file = @tempfile.path) @tempfile.puts "the wrong content" @tempfile.close @@ -182,8 +180,10 @@ EXPECTED before do Chef::FileAccessControl.any_instance.stub(:modified?).and_return(false) @tempfile = Tempfile.open('cookbook_file_spec') - # Use binary mode to avoid CRLF on windows - @tempfile.binmode + # CHEF-2991: We handle CRLF very poorly and we don't know what line endings + # our source file is going to have, so we use binary mode to preserve CRLF if needed. + source_file = CHEF_SPEC_DATA + "/cookbooks/apache2/files/default/apache2_module_conf_generate.pl" + @tempfile.binmode unless File.open(source_file, "rb") { |f| f.read =~ /\r/ } @new_resource.path(@target_file = @tempfile.path) @tempfile.write(@file_content) @tempfile.close
Look at our source line endings before we compare them We may have a file on disk with CRLF line endings, if so, we need to use binmode so the file we write to disk will match. We suck at CRLF. See CHEF-<I>.
chef_chef
train
rb
2c16aaf6567073bb3212d0e8dd62693218d48c77
diff --git a/closure/goog/crypt/base64.js b/closure/goog/crypt/base64.js index <HASH>..<HASH> 100644 --- a/closure/goog/crypt/base64.js +++ b/closure/goog/crypt/base64.js @@ -256,9 +256,19 @@ goog.crypt.base64.decodeStringToUint8Array = function(input) { goog.asserts.assert( !goog.userAgent.IE || goog.userAgent.isVersionOrHigher('10'), 'Browser does not support typed arrays'); - var output = new Uint8Array(Math.ceil(input.length * 3 / 4)); + var len = input.length; + // Check if there are trailing '=' as padding in the b64 string. + var placeholders = 0; + if (input[len - 2] === '=') { + placeholders = 2; + } else if (input[len - 1] === '=') { + placeholders = 1; + } + var output = new Uint8Array(Math.ceil(len * 3 / 4) - placeholders); var outLen = 0; - function pushByte(b) { output[outLen++] = b; } + function pushByte(b) { + output[outLen++] = b; + } goog.crypt.base64.decodeStringInternal_(input, pushByte);
Return a Uint8Array of the exact length rather than a subarray. This makes it possible to construct a Float<I>Array out of the Uint8Array without byte alignment problems. RELNOTES: decodeStringToUint8Array returns a Uint8Array with a buffer with a more accurate size. ------------- Created by MOE: <URL>
google_closure-library
train
js
314f1632342b3d3a3b04d56a1bfaa0b482e654e8
diff --git a/src/Message/PxPostAuthorizeRequest.php b/src/Message/PxPostAuthorizeRequest.php index <HASH>..<HASH> 100644 --- a/src/Message/PxPostAuthorizeRequest.php +++ b/src/Message/PxPostAuthorizeRequest.php @@ -124,11 +124,26 @@ class PxPostAuthorizeRequest extends AbstractRequest $data = $this->getBaseData(); $data->InputCurrency = $this->getCurrency(); $data->Amount = $this->getAmount(); - $data->MerchantReference = $this->getDescription(); - $data->TxnId = $this->getTransactionId(); - $data->TxnData1 = $this->getTransactionData1(); - $data->TxnData2 = $this->getTransactionData2(); - $data->TxnData3 = $this->getTransactionData3(); + + if ($this->getDescription()) { + $data->MerchantReference = $this->getDescription(); + } + + if ($this->getTransactionId()) { + $data->TxnId = $this->getTransactionId(); + } + + if ($this->getTransactionData1()) { + $data->TxnData1 = $this->getTransactionData1(); + } + + if ($this->getTransactionData2()) { + $data->TxnData2 = $this->getTransactionData2(); + } + + if ($this->getTransactionData3()) { + $data->TxnData3 = $this->getTransactionData3(); + } if ($this->getCardReference()) { $data->DpsBillingId = $this->getCardReference();
Add conditionals for optional fields MerchantReference, TxnId, TxnData1, TxnData2, and TxnData3 are all optional fields so instead of sending empty strings if they're not set, don't include them in the request at all.
thephpleague_omnipay-paymentexpress
train
php
1f53d214936f3e0ef83670b900d521e74614b6ef
diff --git a/lib/deliver/commands_generator.rb b/lib/deliver/commands_generator.rb index <HASH>..<HASH> 100644 --- a/lib/deliver/commands_generator.rb +++ b/lib/deliver/commands_generator.rb @@ -33,7 +33,17 @@ module Deliver c.description = 'Upload metadata and binary to iTunes Connect' c.action do |args, options| options = FastlaneCore::Configuration.create(Deliver::Options.available_options, options.__hash__) - options.load_configuration_file("Deliverfile") + loaded = options.load_configuration_file("Deliverfile") + loaded = true if (options[:description] || options[:ipa]) # do we have *anything* here? + unless loaded + if agree("No deliver configuration found in the current directory. Do you want to setup deliver? (y/n)".yellow, true) + require 'deliver/setup' + Deliver::Runner.new(options) # to login... + Deliver::Setup.new.run(options) + return + end + end + Deliver::Runner.new(options).run end end
Automatic detection if deliver is setup in the current folder
fastlane_fastlane
train
rb
f0fe547e20476e00637d15de57c14532fec6c01c
diff --git a/activerecord/lib/active_record/encryption/encryptable_record.rb b/activerecord/lib/active_record/encryption/encryptable_record.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/encryption/encryptable_record.rb +++ b/activerecord/lib/active_record/encryption/encryptable_record.rb @@ -89,7 +89,6 @@ module ActiveRecord end preserve_original_encrypted(name) if attribute_scheme.ignore_case? - validate_column_size(name) if ActiveRecord::Encryption.config.validate_column_size ActiveRecord::Encryption.encrypted_attribute_was_declared(self, name) end @@ -121,12 +120,22 @@ module ActiveRecord end) end + def load_schema! + super + + add_length_validation_for_encrypted_columns if ActiveRecord::Encryption.config.validate_column_size + end + + def add_length_validation_for_encrypted_columns + encrypted_attributes&.each do |attribute_name| + validate_column_size attribute_name + end + end + def validate_column_size(attribute_name) if table_exists? && limit = columns_hash[attribute_name.to_s]&.limit validates_length_of attribute_name, maximum: limit end - rescue ActiveRecord::ConnectionNotEstablished => e - Rails.logger.warn "Skipping adding length validation for #{self.name}\##{attribute_name}. Can't check column limit due to: #{e.inspect}" end end
Move length-validation for encrypted columns after schema is loaded Doing it before meant it required a database connection at class loading time, which was a source a trouble. See <URL>
rails_rails
train
rb
d9a40005ded2595329fa909c9cf6e0a8b1739e34
diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index <HASH>..<HASH> 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -440,6 +440,14 @@ define(["widgets/js/manager", }, this); }, + + toJSON: function(options) { + /** + * Serialize the model. See the types.js deserialization function + * and the kernel-side serializer/deserializer + */ + return "IPY_MODEL_"+this.id; + } }); widgetmanager.WidgetManager.register_widget_model('WidgetModel', WidgetModel);
Fix serialization of models from js -> kernel
jupyter-widgets_ipywidgets
train
js
9edc03d2949122127f4fec2a68f02ddf01cfd8e8
diff --git a/mpd/asyncio.py b/mpd/asyncio.py index <HASH>..<HASH> 100644 --- a/mpd/asyncio.py +++ b/mpd/asyncio.py @@ -18,6 +18,7 @@ Command lists are currently not supported. This module requires Python 3.5.2 or later to run. """ +import warnings import asyncio from functools import partial from typing import Optional, List, Tuple, Iterable, Callable, Union @@ -199,10 +200,12 @@ class MPDClient(MPDClientBase): self.__rfile = self.__wfile = None async def connect(self, host, port=6600, loop=None): + if loop is not None: + warnings.warn("loop passed into MPDClient.connect is ignored, this will become an error", DeprecationWarning) if "/" in host: - r, w = await asyncio.open_unix_connection(host, loop=loop) + r, w = await asyncio.open_unix_connection(host) else: - r, w = await asyncio.open_connection(host, port, loop=loop) + r, w = await asyncio.open_connection(host, port) self.__rfile, self.__wfile = r, w self.__command_queue = asyncio.Queue(maxsize=self.COMMAND_QUEUE_LENGTH)
asyncio: Remove forwarding of loop= The argument was removed from the asyncio API in Python <I>, and was probably not useful anyway in earlier versions. Closes: <URL>
Mic92_python-mpd2
train
py
566d76e2877e781b340dadd3076cadcaf8840691
diff --git a/lib/cli/authentication.services.js b/lib/cli/authentication.services.js index <HASH>..<HASH> 100755 --- a/lib/cli/authentication.services.js +++ b/lib/cli/authentication.services.js @@ -11,7 +11,7 @@ const loginJwt = require('../login-jwt'); const makeClient = require('../make-client'); const loginPassword = 'orprotroiyotrtouuikj'; -const loginEmail = 'hdsjkhsdkhfhfdhgfjffghfghfghfh'; +const loginEmail = 'hdsjkhsdkhfhfd@hgfjffghfgh.com'; module.exports = function checkHealthAuthTest(appRoot = cwd(), options = {}) { const delayAfterServerOnce = options.delayAfterServerOnce || 500;
Fixed test email to look more like an email addr.
feathers-plus_test-utils
train
js
eb434aab90785b0523fab545a8a8680d3bda9d0b
diff --git a/code/pages/NewsHolderPage.php b/code/pages/NewsHolderPage.php index <HASH>..<HASH> 100644 --- a/code/pages/NewsHolderPage.php +++ b/code/pages/NewsHolderPage.php @@ -475,7 +475,7 @@ class NewsHolderPage_Controller extends Page_Controller { } return $records; } - return false; + return $allEntries; } /**
Bugfix for entries lower than treshhold.
Firesphere_silverstripe-newsmodule
train
php
6f43e6e523868da2484bb46cf12faaf9c266a9e0
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -103,7 +103,9 @@ setup(name='ReText', packages=['ReText'], scripts=['retext.py'], data_files=[ - ('share/retext/locale', glob('locale/*.qm')) + ('share/appdata', ['data/me.mitya57.ReText.appdata.xml']), + ('share/applications', ['data/me.mitya57.ReText.desktop']), + ('share/retext/locale', glob('locale/*.qm')) ], requires=requires, install_requires=requires,
setup.py: Install appdata and desktop files
retext-project_retext
train
py
6144e4196e921c8026faf198297495c05d892629
diff --git a/ui-samples-plugin/src/main/java/hudson/plugins/ui_samples/DynamicComboBox.java b/ui-samples-plugin/src/main/java/hudson/plugins/ui_samples/DynamicComboBox.java index <HASH>..<HASH> 100644 --- a/ui-samples-plugin/src/main/java/hudson/plugins/ui_samples/DynamicComboBox.java +++ b/ui-samples-plugin/src/main/java/hudson/plugins/ui_samples/DynamicComboBox.java @@ -12,6 +12,7 @@ import static java.util.Arrays.asList; * * @author Kohsuke Kawaguchi */ +@Extension public class DynamicComboBox extends UISample { @Override @@ -55,9 +56,12 @@ public class DynamicComboBox extends UISample { return new ComboBoxModel("Come Together","Something","I Want You"); case 3: return new ComboBoxModel("The One After 909","Rocker","Get Back"); + default: + // if no value is selected in the album, we'll get 0 + return new ComboBoxModel(); } - throw new AssertionError(); // impossible } + } }
marked as an extension and removed AssertionError git-svn-id: <URL>
jenkinsci_jenkins
train
java
5aa6be58fbf179b328f5470c7501c12a9b97164b
diff --git a/intern/resource/boss/resource.py b/intern/resource/boss/resource.py index <HASH>..<HASH> 100644 --- a/intern/resource/boss/resource.py +++ b/intern/resource/boss/resource.py @@ -14,7 +14,12 @@ from intern.resource import Resource from abc import abstractmethod +from enum import Enum +class CacheMode(Enum): + cache = 'cache' + no_cache = 'no_cache' + raw = 'raw' class BossResource(Resource): """Base class for Boss resources.
Adds CacheMode Enum class to resources
jhuapl-boss_intern
train
py
dd4edec5d275a55d4c4bee8873d6ecbd83bb08d0
diff --git a/scheduler/fleet.py b/scheduler/fleet.py index <HASH>..<HASH> 100644 --- a/scheduler/fleet.py +++ b/scheduler/fleet.py @@ -129,7 +129,7 @@ class FleetHTTPClient(object): # prepare memory limit for the container type mem = kwargs.get('memory', {}).get(l['c_type'], None) if mem: - l.update({'memory': '-m {}'.format(mem.lower())}) + l.update({'memory': '-m {} --memory-swap=-1'.format(mem.lower())}) else: l.update({'memory': ''}) # prepare memory limit for the container type
feat(controller): disable swap usage if there is a memory limit
deis_controller-sdk-go
train
py
85ca0716844cebc24c8fb180940d3e585bd9038f
diff --git a/lib/queue/worker.js b/lib/queue/worker.js index <HASH>..<HASH> 100644 --- a/lib/queue/worker.js +++ b/lib/queue/worker.js @@ -128,7 +128,8 @@ Worker.prototype.process = function(job, fn){ , start = new Date; job.active(); this.job = job; - fn(job, function(err){ + fn(job, function(err, pause){ + if( pause ) { self.shutdown( function(){} );} self.job = null; if (err) return self.failed(job, err, fn); job.complete(); @@ -136,6 +137,9 @@ Worker.prototype.process = function(job, fn){ self.emit('job complete', job); events.emit(job.id, 'complete'); self.start(fn); + }, function(){ + self.resume(); + self.start( fn ); }); return this; }; @@ -222,3 +226,7 @@ Worker.prototype.shutdown = function(fn, timeout) { } }; +Worker.prototype.resume = function() { + this.running = true; +}; +
Worker job processing pause/resume support
Automattic_kue
train
js
f2c87915df29a948dc51f0f2b180915ab1c99297
diff --git a/hamster/widgets.py b/hamster/widgets.py index <HASH>..<HASH> 100644 --- a/hamster/widgets.py +++ b/hamster/widgets.py @@ -272,16 +272,12 @@ class TimeInput(gtk.Entry): if self.start_time: end_time = i_time + dt.timedelta(hours = 12) + i_time += dt.timedelta(minutes = 15) else: end_time = i_time + dt.timedelta(hours = 24) i, focus_row = 0, None while i_time < end_time: - if self.start_time: - i_time += dt.timedelta(minutes = 15) - else: - i_time += dt.timedelta(minutes = 30) - row_text = self._format_time(i_time) if self.start_time: delta = (i_time - self.start_time).seconds / 60 @@ -291,10 +287,15 @@ class TimeInput(gtk.Entry): hours.append([row_text]) - - if focus_time and i_time <= focus_time <= i_time + dt.timedelta(minutes = 30): + if focus_time and i_time <= focus_time <= i_time + \ + dt.timedelta(minutes = 30): focus_row = i + if self.start_time: + i_time += dt.timedelta(minutes = 15) + else: + i_time += dt.timedelta(minutes = 30) + i += 1 self.time_tree.set_model(hours)
start with <I>:<I>, for cases when start time is specified, start with <I>min
projecthamster_hamster
train
py
66734350c41b5d8f06594fb57d6b1e67678daf7c
diff --git a/src/frontend/org/voltdb/planner/AbstractParsedStmt.java b/src/frontend/org/voltdb/planner/AbstractParsedStmt.java index <HASH>..<HASH> 100644 --- a/src/frontend/org/voltdb/planner/AbstractParsedStmt.java +++ b/src/frontend/org/voltdb/planner/AbstractParsedStmt.java @@ -654,6 +654,7 @@ public abstract class AbstractParsedStmt { */ HashMap<AbstractExpression, Set<AbstractExpression>> analyzeValueEquivalence() { // collect individual where/join expressions + analyzeJoinExpressions(joinTree); return joinTree.getAllEquivalenceFilters(); }
Add this line back to keep it synchronized with master
VoltDB_voltdb
train
java
fb92c2858cd5f06bcf49fe95dfbe43e73a0fb926
diff --git a/tests/pytests/scenarios/compat/test_with_versions.py b/tests/pytests/scenarios/compat/test_with_versions.py index <HASH>..<HASH> 100644 --- a/tests/pytests/scenarios/compat/test_with_versions.py +++ b/tests/pytests/scenarios/compat/test_with_versions.py @@ -39,7 +39,7 @@ ENV VIRTUAL_ENV={virtualenv_path} RUN virtualenv --python=python{python_version} $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN pip install salt=={salt_version} +RUN pip install salt~={salt_version} {extra} CMD . $VIRTUAL_ENV/bin/activate @@ -53,13 +53,13 @@ def _get_test_versions(): test_versions.append( PySaltCombo(python_version=python_version, salt_version=salt_version) ) - for salt_version in ("3001.4", "3002.2"): + for salt_version in ("3001.0", "3002.0", "3003.0", "3004.0"): test_versions.append(PySaltCombo(python_version="3", salt_version=salt_version)) return test_versions def _get_test_versions_ids(pysaltcombo): - return "Py{}-SaltMinion=={}".format( + return "Py{}-SaltMinion~={}".format( pysaltcombo.python_version, pysaltcombo.salt_version )
Add <I>.x and <I>.x to the list of versions to test
saltstack_salt
train
py
a0e7a9174214fd1f9f97e8c329b79f7944c9554e
diff --git a/api/repository/gitosis/key.go b/api/repository/gitosis/key.go index <HASH>..<HASH> 100644 --- a/api/repository/gitosis/key.go +++ b/api/repository/gitosis/key.go @@ -10,6 +10,14 @@ import ( // BuildAndStoreKeyFile adds a key to key dir, returning the name // of the file containing the new public key. This name should // be stored for future remotion of the key. +// +// It is up to the caller to add the keyfile name to the gitosis +// configuration file. One possible use to this function is together +// with AddMember function: +// +// keyfile, _ := BuildAndStoreKeyFile("opeth", "face-of-melinda") +// AddMember("bands", keyfile) // adds keyfile to group bands +// AddMember("sweden", keyfile) // adds keyfile to group sweden func BuildAndStoreKeyFile(member, key string) (string, error) { p, err := getKeydirPath() if err != nil { @@ -42,6 +50,10 @@ func BuildAndStoreKeyFile(member, key string) (string, error) { } // DeleteKeyFile deletes the keyfile in the keydir +// +// After deleting the keyfile, the user will not be able +// to push to the repository, even if the keyfile name still +// is in the gitosis configuration file. func DeleteKeyFile(keyfilename string) error { p, err := getKeydirPath() if err != nil {
gitosis: improving docs for key functions
tsuru_tsuru
train
go
ea87c5abea101d709d4d028be4e53b9791802b94
diff --git a/Service/AccessRights.php b/Service/AccessRights.php index <HASH>..<HASH> 100644 --- a/Service/AccessRights.php +++ b/Service/AccessRights.php @@ -10,11 +10,34 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; class AccessRights { + /** + * @var ContainerInterface + */ private $em; + + /** + * @var RouterInterface + */ private $router; + + /** + * @var Session + */ private $session; + + /** + * @var RequestStack + */ private $request; + + /** + * @var Globals + */ private $globals; + + /** + * @var ModuleService + */ private $module; /**
[refa] comments of AccessRights service
Piou-piou_RibsAdminBundle
train
php
418c44a899eefc6e942aa898aed49940129d3e29
diff --git a/spec/watirspec/window_switching_spec.rb b/spec/watirspec/window_switching_spec.rb index <HASH>..<HASH> 100644 --- a/spec/watirspec/window_switching_spec.rb +++ b/spec/watirspec/window_switching_spec.rb @@ -51,17 +51,15 @@ describe Browser do browser.window.url.should =~ /window_switching\.html/ end - not_compliant_on [:webdriver, :ie] do - bug "http://github.com/jarib/celerity/issues#issue/17", :celerity do - it "it executes the given block in the window" do - browser.window(:title => "closeable window") do - link = browser.a(:id => "close") - link.should exist - link.click - end - - browser.windows.size.should == 1 + bug "http://github.com/jarib/celerity/issues#issue/17", :celerity do + it "it executes the given block in the window" do + browser.window(:title => "closeable window") do + link = browser.a(:id => "close") + link.should exist + link.click end + + browser.windows.size.should == 1 end end
Remove IE guard, fixed in Selenium trunk.
watir_watir
train
rb
e02b569c963d4346c77b3824fbe82313021ba7f4
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -102,6 +102,7 @@ module.exports = function(grunt) { } }, clean: { + build: ['local-build'], temp: ['tmp'] },
Add grunt task to clean the `local-build` folder
mediaelement_mediaelement
train
js
8f3f2f4bd88f9d19bd3dc582f336cb524ef2a534
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 @@ -575,7 +575,7 @@ class NamedTests seen_correct_exception = false begin resp = @stub.full_duplex_call([duplex_req]) - resp.next # triggers initial req to be sent + resp.each { |r| } rescue GRPC::Unknown => e if e.details != message fail AssertionError,
Fix ruby:{python,csharp,csharpcoreclr}_server behavior
grpc_grpc
train
rb
9a9cc15547e3166ea18f0886db7a7fd775c6b5a7
diff --git a/ProgressBar.php b/ProgressBar.php index <HASH>..<HASH> 100644 --- a/ProgressBar.php +++ b/ProgressBar.php @@ -26,7 +26,7 @@ use yii\helpers\Html; * and [[end()]] calls within the widget container: * * ~~~php - * ProgressBar::widget([ + * ProgressBar::begin([ * 'clientOptions' => ['value' => 75], * ]); *
Tiny Change - Typo Second Example should start with ProgressBar::begin not ProgressBar::widget
yiisoft_yii2-jui
train
php
bcbc3875bde170cb00221e8b716562d7a02840b2
diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index <HASH>..<HASH> 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -94,6 +94,7 @@ func newActionConfig(allNamespaces bool) *action.Configuration { KubeClient: kc, Releases: store, Discovery: clientset.Discovery(), + Log: logf, } }
fix(pkg/action): action log must be initialized Fixes panic from calling Log.
helm_helm
train
go
fe26f13ceae321d8058ef455bed8dacf6c50d748
diff --git a/lib/airbrake/configuration.rb b/lib/airbrake/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/airbrake/configuration.rb +++ b/lib/airbrake/configuration.rb @@ -152,7 +152,8 @@ module Airbrake 'ActionController::UnknownHttpMethod', 'ActionController::UnknownAction', 'AbstractController::ActionNotFound', - 'Mongoid::Errors::DocumentNotFound'] + 'Mongoid::Errors::DocumentNotFound', + 'ActionController::UnknownFormat'] alias_method :secure?, :secure alias_method :use_system_ssl_cert_chain?, :use_system_ssl_cert_chain
Ignore ActionController::UnknownFormat for Rails 4+ which is now handled by middleware
airbrake_airbrake
train
rb
47808f00c65eff49c7421a9aadb03148b2fd8b9a
diff --git a/astrocats/catalog/catalog.py b/astrocats/catalog/catalog.py index <HASH>..<HASH> 100644 --- a/astrocats/catalog/catalog.py +++ b/astrocats/catalog/catalog.py @@ -194,7 +194,7 @@ class Catalog: catalog_sha = catalog_sha.decode('ascii').strip() # Git SHA of `astrocats` parent_path = os.path.join(my_path, os.pardir) - self.log.debug("Running '{}' in '{}'.".format(git_command, my_path)) + self.log.debug("Running '{}' in '{}'.".format(git_command, parent_path)) astrocats_sha = subprocess.check_output(git_command, cwd=parent_path) astrocats_sha = astrocats_sha.decode('ascii').strip() # Name of this class (if subclassed)
BUG: typo in path being printed.
astrocatalogs_astrocats
train
py
1ffbd8cf22dd981516c1ef7e969d078731a7d528
diff --git a/lib/graphql/language/nodes.rb b/lib/graphql/language/nodes.rb index <HASH>..<HASH> 100644 --- a/lib/graphql/language/nodes.rb +++ b/lib/graphql/language/nodes.rb @@ -73,7 +73,11 @@ module GraphQL end def to_query_string(printer: GraphQL::Language::Printer.new) - @query_string ||= printer.print(self) + if printer.is_a?(GraphQL::Language::Printer) + @query_string ||= printer.print(self) + else + printer.print(self) + end end # This creates a copy of `self`, with `new_options` applied. @@ -83,7 +87,9 @@ module GraphQL copied_self = dup new_options.each do |key, value| copied_self.instance_variable_set(:"@#{key}", value) - copied_self.instance_variable_set(:@query_string, nil) + if copied_self.instance_variable_defined?(:@query_string) + copied_self.instance_variable_set(:@query_string, nil) + end end copied_self end
Only cache query_string if GraphQL::Language::Printer is used
rmosolgo_graphql-ruby
train
rb
8c28d021dddbe8804584414735036251a15772c6
diff --git a/fedmsg_meta_fedora_infrastructure/buildsys.py b/fedmsg_meta_fedora_infrastructure/buildsys.py index <HASH>..<HASH> 100644 --- a/fedmsg_meta_fedora_infrastructure/buildsys.py +++ b/fedmsg_meta_fedora_infrastructure/buildsys.py @@ -62,8 +62,12 @@ class KojiProcessor(BaseProcessor): file_base = 'https://kojipkgs.fedoraproject.org/work/' info = sess.getTaskInfo(taskid) - host = sess.getHost(info['host_id']) - info['build_host'] = host['name'] + if info['host_id'] is None: + info['build_host'] = '(unscheduled)' + else: + host = sess.getHost(info['host_id']) + info['build_host'] = host['name'] + weburl = sess.baseurl.rsplit('/', 1)[0] + '/koji/' info['url'] = weburl + 'taskinfo?taskID=%i' % info['id']
Be careful with a null host from koji.
fedora-infra_fedmsg_meta_fedora_infrastructure
train
py
9b23212618b0ea6a32ad2f3f65d19d8acc40e99f
diff --git a/gwpy/segments/tests/test_flag.py b/gwpy/segments/tests/test_flag.py index <HASH>..<HASH> 100644 --- a/gwpy/segments/tests/test_flag.py +++ b/gwpy/segments/tests/test_flag.py @@ -19,6 +19,7 @@ """Tests for :mod:`gwpy.segments` """ +import importlib import os.path import re import tempfile @@ -438,8 +439,12 @@ class TestDataQualityFlag(object): flag.pad(*PADDING, kwarg='test') @utils.skip_missing_dependency('ligo.lw.lsctables') - def test_from_veto_def(self): - from ligo.lw.lsctables import VetoDef + @pytest.mark.parametrize("lsctables", ( + pytest.param("glue.ligolw.lsctables", id="glue.ligolw"), + pytest.param("ligo.lw.lsctables", id="python-ligo-lw"), + )) + def test_from_veto_def(self, lsctables): + VetoDef = importlib.import_module(lsctables).VetoDef def veto_def(ifo, name, version, **kwargs): vdef = VetoDef()
gwpy.segments: improve tests of from_veto_def
gwpy_gwpy
train
py
da23067f800a6e06b8da2679f99ed903ed5302d4
diff --git a/salt/states/user.py b/salt/states/user.py index <HASH>..<HASH> 100644 --- a/salt/states/user.py +++ b/salt/states/user.py @@ -88,10 +88,6 @@ def _changes(name, attributes supported as integers only. ''' - # Set gid to None in cases an empty string is passed - if gid == '': - gid = None - if 'shadow.info' in __salt__: lshad = __salt__['shadow.info'](name) @@ -460,9 +456,8 @@ def present(name, if gid_from_name: gid = __salt__['file.group_to_gid'](name) - if not gid: - ret['comment'] = 'Default group with name "{0}" ' \ - 'is not present'.format(name) + if gid == '': + ret['comment'] = 'Default group with name "{0}" is not present'.format(name) ret['result'] = False return ret
Refactor to prevent logical bug when gid is 0
saltstack_salt
train
py
9c82b4b6c84b1796fe0ce3cbf28f9040e63fce79
diff --git a/test/e2e/es_cluster_logging.go b/test/e2e/es_cluster_logging.go index <HASH>..<HASH> 100644 --- a/test/e2e/es_cluster_logging.go +++ b/test/e2e/es_cluster_logging.go @@ -97,9 +97,10 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) { var statusCode float64 var esResponse map[string]interface{} err = nil + var body []byte for start := time.Now(); time.Since(start) < graceTime; time.Sleep(5 * time.Second) { // Query against the root URL for Elasticsearch. - body, err := f.Client.Get(). + body, err = f.Client.Get(). Namespace(api.NamespaceSystem). Prefix("proxy"). Resource("services"). @@ -143,7 +144,6 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) { // Now assume we really are talking to an Elasticsearch instance. // Check the cluster health. By("Checking health of Elasticsearch service.") - var body []byte for start := time.Now(); time.Since(start) < graceTime; time.Sleep(5 * time.Second) { body, err = f.Client.Get(). Namespace(api.NamespaceSystem).
Fix error with variable re-declaration in ES logging test
kubernetes_kubernetes
train
go
3d60cb8c780a3df953c3804f4a7b0eb61ed9ec39
diff --git a/test/integration/test_buildtasks_api.py b/test/integration/test_buildtasks_api.py index <HASH>..<HASH> 100644 --- a/test/integration/test_buildtasks_api.py +++ b/test/integration/test_buildtasks_api.py @@ -7,7 +7,7 @@ tasks_api = BuildtasksApi(utils.get_api_client()) def test_build_task_completed_no_task_id(): - testutils.assert_raises_valueerror(tasks_api, 'build_task_completed', task_id=None, build_status='hi') + testutils.assert_raises_valueerror(tasks_api, 'build_task_completed', task_id=None, build_status='NEW') def test_build_task_completed_no_build_status(): @@ -15,10 +15,10 @@ def test_build_task_completed_no_build_status(): def test_build_task_completed_invalid_param(): - testutils.assert_raises_typeerror(tasks_api, 'build_task_completed', task_id=1, build_status='hi') + testutils.assert_raises_typeerror(tasks_api, 'build_task_completed', task_id=1, build_status='NEW') def test_build_task_completed(): - response = tasks_api.build_task_completed(task_id=1, build_status='hi') + response = tasks_api.build_task_completed(task_id=1, build_status='NEW') assert response
make sure tests use a valid build status
project-ncl_pnc-cli
train
py
976b9b7c6da4c34bda0c1286565db1d9ba921ea3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -20,13 +20,13 @@ from setuptools import setup, find_packages -setup(name='django_scheduledjobs', +setup(name='django-scheduledjobs', version='0.1.1', description='Scheduled jobs in Django', long_description=open('README').read(), author='Shrubbery Software', author_email='team@shrubberysoft.com', - url='http://github.com/shrubberysoft/django_scheduledjobs', + url='http://github.com/shrubberysoft/django-scheduledjobs', packages=find_packages('src'), package_dir={'' : 'src'}, classifiers=[
Changed underscore to dash in package name.
shrubberysoft_django-future
train
py
2ef3c4df1756aa4a67bebb9755dbee6a079eeddf
diff --git a/provisioning/src/main/java/org/wildfly/build/provisioning/ServerProvisioner.java b/provisioning/src/main/java/org/wildfly/build/provisioning/ServerProvisioner.java index <HASH>..<HASH> 100644 --- a/provisioning/src/main/java/org/wildfly/build/provisioning/ServerProvisioner.java +++ b/provisioning/src/main/java/org/wildfly/build/provisioning/ServerProvisioner.java @@ -302,6 +302,9 @@ public class ServerProvisioner { if (! repl.equals(orig)) { artifactName.getAttribute().setValue(repl); } + File artifactFile = artifactFileResolver.getArtifactFile(artifact); + // extract schemas if needed + extractSchema(schemaOutputDirectory, artifact, artifactFile); } else { // process the module artifact File artifactFile = artifactFileResolver.getArtifactFile(artifact);
[WFBUILD-<I>] fix schema extraction with thin server
wildfly_wildfly-build-tools
train
java
e5a7beb46cbc2093d0fe59864e2fe03c3cf36eeb
diff --git a/lib/numbers/generators.js b/lib/numbers/generators.js index <HASH>..<HASH> 100644 --- a/lib/numbers/generators.js +++ b/lib/numbers/generators.js @@ -36,10 +36,10 @@ generate.fibonacci = function (n) { while (n > 0) { bit = (n < 2) ? n : n % 2; n = Math.floor(n / 2); - bits.push(bit); + bits.unshift(bit); } - return bits.reverse(); + return bits; }; var a = 1;
Use Array unshift instead of push and reverse when building the numbers.generate.fibonacci bitSystem
numbers_numbers.js
train
js
134a5041242177130b10c79e25bd01e8feeebc05
diff --git a/vex/config.py b/vex/config.py index <HASH>..<HASH> 100644 --- a/vex/config.py +++ b/vex/config.py @@ -137,13 +137,14 @@ def extract_key_value(line, environ): # '{foo}' passes through literally # "{foo}" substitutes from environ's foo value = value.strip() - if value[0] == "'" and _SQUOTE_RE.match(value): - value = value[1:-1] - elif value[0] == '"' and _DQUOTE_RE.match(value): - template = value[1:-1] - value = template.format(**environ) + if value: + if value[0] == "'" and _SQUOTE_RE.match(value): + value = value[1:-1] + elif value[0] == '"' and _DQUOTE_RE.match(value): + template = value[1:-1] + value = template.format(**environ) + value = value.strip() key = key.strip() - value = value.strip() return key, value
fix bug with handling of empty values from vexrc not a big deal but it makes the error message better
sashahart_vex
train
py
6171464566e8b101420ef3c81e53faaf9d5389f0
diff --git a/js/webgl-heatmap-leaflet.js b/js/webgl-heatmap-leaflet.js index <HASH>..<HASH> 100644 --- a/js/webgl-heatmap-leaflet.js +++ b/js/webgl-heatmap-leaflet.js @@ -24,7 +24,7 @@ L.TileLayer.WebGLHeatMap = L.Class.extend({ var options = this.options; var c = document.createElement("canvas"); - c.id = 'webgl-leaflet'; + c.id = 'webgl-leaflet-' + L.Util.stamp(this); c.width = mapsize.x; c.height = mapsize.y; c.style.opacity = options.opacity; @@ -139,4 +139,4 @@ L.TileLayer.WebGLHeatMap = L.Class.extend({ L.TileLayer.webglheatmap = function (options) { return new L.TileLayer.WebGLHeatMap(options); -}; \ No newline at end of file +};
Added unique id for multiple layers
ursudio_leaflet-webgl-heatmap
train
js
ed37dea79999ecd67bca76ae2645f7573335c126
diff --git a/qbit/core/src/test/java/io/advantageous/qbit/service/ServiceBundleAndEvents.java b/qbit/core/src/test/java/io/advantageous/qbit/service/ServiceBundleAndEvents.java index <HASH>..<HASH> 100644 --- a/qbit/core/src/test/java/io/advantageous/qbit/service/ServiceBundleAndEvents.java +++ b/qbit/core/src/test/java/io/advantageous/qbit/service/ServiceBundleAndEvents.java @@ -69,7 +69,7 @@ public class ServiceBundleAndEvents extends TimedTesting { testService.method1("HELLO"); testService.clientProxyFlush(); - waitForTrigger(1, o -> (method.get() != null) && + waitForTrigger(4, o -> (method.get() != null) && method.get().equals("method1 HELLO")); assertEquals("method1 HELLO\n", method.get());
this test failed.. not sure why.
advantageous_qbit
train
java
44d030b9cab970fe197555d87fc821f154c3b204
diff --git a/geometry.go b/geometry.go index <HASH>..<HASH> 100644 --- a/geometry.go +++ b/geometry.go @@ -415,8 +415,8 @@ func minCircle(c, d Circle) Circle { // Union returns the minimal Circle which covers both `c` and `d`. func (c Circle) Union(d Circle) Circle { - biggerC := maxCircle(c, d) - smallerC := minCircle(c, d) + biggerC := maxCircle(c.Norm(), d.Norm()) + smallerC := minCircle(c.Norm(), d.Norm()) // Get distance between centers dist := c.Center.To(d.Center).Len() @@ -445,8 +445,8 @@ func (c Circle) Union(d Circle) Circle { // centers. func (c Circle) Intersect(d Circle) Circle { // Check if one of the circles encompasses the other; if so, return that one - biggerC := maxCircle(c, d) - smallerC := minCircle(c, d) + biggerC := maxCircle(c.Norm(), d.Norm()) + smallerC := minCircle(c.Norm(), d.Norm()) if biggerC.Radius >= biggerC.Center.To(smallerC.Center).Len()+smallerC.Radius { return biggerC
normalising before getting bigger/smaller
faiface_pixel
train
go
2d815ff749b00b90b6c4f23d6f665bde4799a50e
diff --git a/djgeojson/serializers.py b/djgeojson/serializers.py index <HASH>..<HASH> 100644 --- a/djgeojson/serializers.py +++ b/djgeojson/serializers.py @@ -347,7 +347,9 @@ def Deserializer(stream_or_string, **options): def FeatureToPython(dictobj): properties = dictobj['properties'] - model_name = properties.pop('model') + model_name = options.get("model_name") + if not(model_name): + model_name = properties.pop('model') # Deserialize concrete fields only (bypass dynamic properties) model = _get_model(model_name) field_names = [f.name for f in model._meta.fields]
Add possibility to specify the model_name as argument.
makinacorpus_django-geojson
train
py
b6ace0aeccecc36d0aebe8498e0c1b38a4ee1efd
diff --git a/soundscrape/soundscrape.py b/soundscrape/soundscrape.py index <HASH>..<HASH> 100755 --- a/soundscrape/soundscrape.py +++ b/soundscrape/soundscrape.py @@ -8,6 +8,7 @@ import re import requests import soundcloud import sys +import urllib from clint.textui import colored, puts, progress from datetime import datetime @@ -87,7 +88,11 @@ def main(): if not vargs['artist_url']: parser.error('Please supply an artist\'s username or URL!') - vargs['artist_url'] = vargs['artist_url'][0].decode('utf-8') + if sys.version_info < (3,0,0): + vargs['artist_url'] = urllib.quote(vargs['artist_url'][0], safe=':/') + else: + vargs['artist_url'] = urllib.parse.quote(vargs['artist_url'][0], safe=':/') + artist_url = vargs['artist_url'] if not exists(vargs['path']):
another attempt to fix #<I> Pull #<I> introduced new issue on Windows, Python 3. This commit tries to fix it with quote.
Miserlou_SoundScrape
train
py
d29f96227a6bc15b8b3ee1c69205f74071463a35
diff --git a/src/Thruway/Peer/Client.php b/src/Thruway/Peer/Client.php index <HASH>..<HASH> 100644 --- a/src/Thruway/Peer/Client.php +++ b/src/Thruway/Peer/Client.php @@ -216,9 +216,14 @@ class Client extends AbstractPeer implements EventEmitterInterface * Start the transport * * @param boolean $startLoop + * @throws \Exception */ public function start($startLoop = true) { + if ($this->transportProvider === null) { + throw new \Exception("You must add exactly one transport provider prior to starting"); + } + $this->transportProvider->startTransportProvider($this, $this->loop); if ($startLoop) {
Throw exception if client is started without a transport provider.
voryx_Thruway
train
php
04f6665323621469caa76204ac0eb8819be1c6f5
diff --git a/provider/gce/environ_network.go b/provider/gce/environ_network.go index <HASH>..<HASH> 100644 --- a/provider/gce/environ_network.go +++ b/provider/gce/environ_network.go @@ -182,6 +182,10 @@ type networkDetails struct { network network.Id } +// findNetworkDetails looks up the network information we need to +// populate an InterfaceInfo - if the interface is on a legacy network +// we use information from the network because there'll be no subnet +// linked. func findNetworkDetails(iface compute.NetworkInterface, subnets subnetMap, networks networkMap) (networkDetails, error) { var result networkDetails if iface.Subnetwork == "" {
Comment for findNetworkDetails
juju_juju
train
go
d1067c82e9c1f0b7507923f51135c08def03d6b9
diff --git a/lib/hub/commands.rb b/lib/hub/commands.rb index <HASH>..<HASH> 100644 --- a/lib/hub/commands.rb +++ b/lib/hub/commands.rb @@ -1010,7 +1010,7 @@ help # in order to turn our raw roff (manpage markup) into something # readable on the terminal. def groff_command - cols = terminal_width + cols = [terminal_width - 1, 120].min "groff -Wall -mtty-char -mandoc -Tascii -rLL=#{cols}n -rLT=#{cols}n" end
Don't allow man page width to exceed <I> characters Text wider that that is hard to read. Also, on terminals narrower than <I> chars, provide a 1-character right margin to improve readability in case of vertical splits.
github_hub
train
rb
9a5bcbbf15ca454d6197a13b4d89c5cffafe4b2d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -16,20 +16,17 @@ # import os - import f5 -from pip.req import parse_requirements as parse_reqs from setuptools import find_packages from setuptools import setup if 'rpm' not in os.getcwd(): - install_requires = map(lambda x: str(x.req), - parse_reqs('./setup_requirements.txt', - session='setup')) + with open('setup_requirements.txt') as fh: + required = [x for x in fh.read().splitlines() if not x.startswith('#')] else: - install_requires = [] -print('install_requires', install_requires) + required = [] + setup( name='f5-sdk', description='F5 Networks Python SDK', @@ -39,7 +36,7 @@ setup( author_email='f5_common_python@f5.com', url='https://github.com/F5Networks/f5-common-python', keywords=['F5', 'sdk', 'api', 'icontrol', 'bigip', 'api', 'ltm'], - install_requires=install_requires, + install_requires=required, packages=find_packages( exclude=["*.test", "*.test.*", "test.*", "test_*", "test", "test*"] ),
Fixes pip installs for python 3 Issues: Fixes #<I> Problem: The means by which dependencies was being determined was not working in python 3. The pip API is not public, so we shouldn't be using it as we were Analysis: This changes the means of looking up requirements to be similar, but to not use the interal pip APIs to prevent breakage Tests:
F5Networks_f5-common-python
train
py
3bbfdadc9f1408452d3fba1ee092d09d716f4949
diff --git a/vertica_python/vertica/connection.py b/vertica_python/vertica/connection.py index <HASH>..<HASH> 100644 --- a/vertica_python/vertica/connection.py +++ b/vertica_python/vertica/connection.py @@ -23,11 +23,11 @@ class OldResults(object): class Connection(object): - def __init__(self, options={}): + def __init__(self, options=None): self.reset_values() self.options = {} - + options = options or {} for key, value in options.iteritems(): if value is not None: self.options[key] = value diff --git a/vertica_python/vertica/messages/frontend_messages/password.py b/vertica_python/vertica/messages/frontend_messages/password.py index <HASH>..<HASH> 100644 --- a/vertica_python/vertica/messages/frontend_messages/password.py +++ b/vertica_python/vertica/messages/frontend_messages/password.py @@ -11,9 +11,9 @@ from vertica_python.vertica.messages.backend_messages.authentication import Auth class Password(FrontendMessage): - def __init__(self, password, auth_method=None, options={}): + def __init__(self, password, auth_method=None, options=None): self.password = password - self.options = options + self.options = options or {} if auth_method is not None: self.auth_method = auth_method else:
don't use mutable types for default parameter values Mutable kwarg defaults can produce all kinds of unexpected behaviors, this commit replaces them with immutable values.
vertica_vertica-python
train
py,py
667a9e42251ad3d565423162e15c3f74b51ffba6
diff --git a/library/Imbo/EventListener/ImageTransformationCache.php b/library/Imbo/EventListener/ImageTransformationCache.php index <HASH>..<HASH> 100644 --- a/library/Imbo/EventListener/ImageTransformationCache.php +++ b/library/Imbo/EventListener/ImageTransformationCache.php @@ -155,11 +155,11 @@ class ImageTransformationCache extends Listener implements ListenerInterface { } if (is_file($fullPath)) { - $response = unserialize(file_get_contents($fullPath)); + $container->response = unserialize(file_get_contents($fullPath)); + $container->response->getHeaders()->set('X-Imbo-TransformationCache', 'Hit'); - $response->getHeaders()->set('X-Imbo-TransformationCache', 'Hit'); - $response->send(); - exit; + $event->haltApplication(true); + return; } $response->getHeaders()->set('X-Imbo-TransformationCache', 'Miss');
Instead of sending the response this listener will now halt the application and return
imbo_imbo
train
php
e05d670982197c96e0c12879ed8cce9320ace718
diff --git a/cake/libs/overloadable.php b/cake/libs/overloadable.php index <HASH>..<HASH> 100644 --- a/cake/libs/overloadable.php +++ b/cake/libs/overloadable.php @@ -29,9 +29,5 @@ * Load the interface class based on the version of PHP. * */ -if (!PHP5) { - require(LIBS . 'overloadable_php4.php'); -} else { - require(LIBS . 'overloadable_php5.php'); -} +require(LIBS . 'overloadable_php5.php'); ?> \ No newline at end of file
Remove PHP4 option in overloadable class include.
cakephp_cakephp
train
php
a69f97005b597639ca7f16c9551e9d0e0827ea17
diff --git a/balancer/xds/xds.go b/balancer/xds/xds.go index <HASH>..<HASH> 100644 --- a/balancer/xds/xds.go +++ b/balancer/xds/xds.go @@ -91,7 +91,7 @@ func (b *xdsBalancerBuilder) Name() string { return xdsName } -func (x *xdsBalancerBuilder) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { +func (b *xdsBalancerBuilder) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { var cfg xdsConfig if err := json.Unmarshal(c, &cfg); err != nil { return nil, fmt.Errorf("unable to unmarshal balancer config %s into xds config", string(c))
internal: lint receiver name not x (#<I>)
grpc_grpc-go
train
go
25f4c23ab245d28f6e35e332ad98290a307f17ca
diff --git a/pkg/server/server_entrypoint_tcp.go b/pkg/server/server_entrypoint_tcp.go index <HASH>..<HASH> 100644 --- a/pkg/server/server_entrypoint_tcp.go +++ b/pkg/server/server_entrypoint_tcp.go @@ -3,6 +3,7 @@ package server import ( "context" "fmt" + stdlog "log" "net" "net/http" "sync" @@ -16,10 +17,13 @@ import ( "github.com/containous/traefik/v2/pkg/middlewares/forwardedheaders" "github.com/containous/traefik/v2/pkg/safe" "github.com/containous/traefik/v2/pkg/tcp" + "github.com/sirupsen/logrus" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" ) +var httpServerLogger = stdlog.New(log.WithoutContext().WriterLevel(logrus.DebugLevel), "", 0) + type httpForwarder struct { net.Listener connChan chan net.Conn @@ -352,7 +356,8 @@ func createHTTPServer(ln net.Listener, configuration *static.EntryPoint, withH2c } serverHTTP := &http.Server{ - Handler: handler, + Handler: handler, + ErrorLog: httpServerLogger, } listener := newHTTPForwarder(ln)
Write HTTP server logs into the global logger.
containous_traefik
train
go
a01848a2c8be94e172c2935df779f6eb928e380f
diff --git a/salt/minion.py b/salt/minion.py index <HASH>..<HASH> 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -387,8 +387,7 @@ class Matcher(object): else: self.functions = functions - - def confirm_top(self, data): + def confirm_top(self, match, data): ''' Takes the data passed to a top file environment and determines if the data matches this minion @@ -399,7 +398,7 @@ class Matcher(object): if item.has_key('match'): matcher = item['match'] if hasattr(self, matcher + '_match'): - return getattr(self, matcher + '_match') + return getattr(self, matcher + '_match')(match) else: log.error('Attempting to match with unknown matcher: %s', matcher) return False diff --git a/salt/state.py b/salt/state.py index <HASH>..<HASH> 100644 --- a/salt/state.py +++ b/salt/state.py @@ -418,12 +418,13 @@ class HighState(object): matches = {} for env, body in top.items(): for match, data in body.items(): - if self.matcher.confirm_top(data): + if self.matcher.confirm_top(match, data): if not matches.has_key(env): matches[env] = [] for item in data: if type(item) == type(str()): matches[env].append(item) + print matches return matches def gather_states(self, matches):
repair matching issue in state top file parsing
saltstack_salt
train
py,py
ff502eaa039323934baf69fc7a9fdb2037ff9dd4
diff --git a/bingraphvis/angr/transform.py b/bingraphvis/angr/transform.py index <HASH>..<HASH> 100644 --- a/bingraphvis/angr/transform.py +++ b/bingraphvis/angr/transform.py @@ -10,7 +10,8 @@ class AngrRemovePathTerminator(Transformer): def transform(self, graph): remove = [] for n in graph.nodes: - if n.obj.is_simprocedure and n.obj.simprocedure_name == 'PathTerminator': + + if hasattr(n.obj, 'is_simprocedure') and n.obj.is_simprocedure and n.obj.simprocedure_name == 'PathTerminator': remove.append(n) for r in remove: graph.remove_node(r)
Added a bit resilience to PathTerminator removal
axt_bingraphvis
train
py
454b0dd88582310b34e1ff9f0e824ba85e1db61c
diff --git a/yfinance/base.py b/yfinance/base.py index <HASH>..<HASH> 100644 --- a/yfinance/base.py +++ b/yfinance/base.py @@ -386,13 +386,19 @@ class TickerBase(): except Exception: pass - # For ETFs, provide this valuable data: the top holdings of the ETF - if data.get('topHoldings'): - self._info.update(data['topHoldings']) + # For ETFs, provide this valuable data: the top holdings of the ETF + try: + if 'topHoldings' in data: + self._info.update(data['topHoldings']) + except Exception: + pass - if not isinstance(data.get('summaryDetail'), dict): - # For some reason summaryDetail did not give any results. The price dict usually has most of the same info - self._info.update(data.get('price', {})) + try: + if not isinstance(data.get('summaryDetail'), dict): + # For some reason summaryDetail did not give any results. The price dict usually has most of the same info + self._info.update(data.get('price', {})) + except Exception: + pass try: # self._info['regularMarketPrice'] = self._info['regularMarketOpen']
try + except still required - topHoldings, summaryDetail Reason is that a failure would be harmful without a graceful try+except
ranaroussi_fix-yahoo-finance
train
py
a8ca40bb398c9f7f822a36077476b5fd9572cbe3
diff --git a/panics.go b/panics.go index <HASH>..<HASH> 100644 --- a/panics.go +++ b/panics.go @@ -16,10 +16,44 @@ package oglematchers import ( + "errors" + "reflect" ) // Panics matches zero-arg functions which, when invoked, panic with an error // that matches the supplied matcher. func Panics(m Matcher) Matcher { - return nil + return &panicsMatcher{m} +} + +type panicsMatcher struct { + wrappedMatcher Matcher +} + +func (m *panicsMatcher) Description() string { + return "panics with: " + m.wrappedMatcher.Description() +} + +func (m *panicsMatcher) Matches(c interface{}) (res MatchResult, err error) { + // Make sure c is a zero-arg function. + v := reflect.ValueOf(c) + if v.Kind() != reflect.Func || v.Type().NumIn() != 0 { + res = MATCH_UNDEFINED + err = errors.New("which is not a zero-arg function") + return + } + + // Call the function and check its panic error. + defer func() { + if e := recover(); e != nil { + res, err = t.wrappedMatcher.Matches(e) + } + }() + + v.Call([]Value{}) + + // If we got here, the function didn't panic. + res = MATCH_FALSE + err = nil + return }
Added a partial implementation of Panics, for #7.
jacobsa_oglematchers
train
go
0ec524483e628a813a697b0e43a9523d7324997a
diff --git a/lib/rubylog/simple_procedure.rb b/lib/rubylog/simple_procedure.rb index <HASH>..<HASH> 100644 --- a/lib/rubylog/simple_procedure.rb +++ b/lib/rubylog/simple_procedure.rb @@ -25,6 +25,18 @@ module Rubylog @rules.each {|r| yield r} end + def delete_at index + @rules.delete_at index + end + + def insert index, value + @rules.insert index, value + end + + def [] index + @rules[index] + end + end end
added some more proxy methods to simple_procedure
cie_rubylog
train
rb
41b9542ed6dc93a116047f3355bff3d8a86b2034
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -383,7 +383,8 @@ exports.parseNoPatch = function (code, options) { "functionBind", "functionSent", "objectRestSpread", - "trailingFunctionCommas" + "trailingFunctionCommas", + "dynamicImport" ] }; diff --git a/test/non-regression.js b/test/non-regression.js index <HASH>..<HASH> 100644 --- a/test/non-regression.js +++ b/test/non-regression.js @@ -1601,6 +1601,14 @@ describe("verify", function () { }); }); + it("dynamic import support", function () { + verifyAndAssertMessages( + "import('test-module').then(() => {})", + {}, + [] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);",
[import()] Adding support to lint dynamic imports (#<I>) * [import()] Adding support to lint dynamic imports * [import()] Adding regression test to import
babel_babel-eslint
train
js,js
04cad8f1512c0384be05c798597ded7b05fb07ac
diff --git a/tests/Process/ProcessorCounterTest.php b/tests/Process/ProcessorCounterTest.php index <HASH>..<HASH> 100644 --- a/tests/Process/ProcessorCounterTest.php +++ b/tests/Process/ProcessorCounterTest.php @@ -2,7 +2,6 @@ namespace Liuggio\Fastest\Process; - use Liuggio\Fastest\Process\ProcessorCounter; class ProcessorCounterTest extends \PHPUnit_Framework_TestCase @@ -12,9 +11,8 @@ class ProcessorCounterTest extends \PHPUnit_Framework_TestCase */ public function shouldCountTheNumberOfProcessorInLinux() { - $processorCount = new ProcessorCounter(); + $processorCount = new ProcessorCounter(__DIR__.'/Fixture/proc_cpuinfo'); $this->assertEquals(4, $processorCount->execute()); } } -
Restored the test to use Fixture file again
liuggio_fastest
train
php
df5224cf9fad74e9b64c3e053bf9c8ceae323f2a
diff --git a/lib/openapi3.js b/lib/openapi3.js index <HASH>..<HASH> 100644 --- a/lib/openapi3.js +++ b/lib/openapi3.js @@ -631,6 +631,7 @@ function convertInner(api, options, callback) { let header = {}; header.title = api.info && (api.info.title||'API') + ' ' + data.version; header.language_tabs = options.language_tabs; + if (options.language_clients) header.language_clients = options.language_clients; header.toc_footers = []; if (api.externalDocs) { if (api.externalDocs.url) {
feat: include language_clients in yaml frontmatter
Mermade_widdershins
train
js
62302361e261b1b4d8da15c96b200ecaf10eebc3
diff --git a/src/Sulu/Bundle/ContactBundle/Controller/AccountsController.php b/src/Sulu/Bundle/ContactBundle/Controller/AccountsController.php index <HASH>..<HASH> 100644 --- a/src/Sulu/Bundle/ContactBundle/Controller/AccountsController.php +++ b/src/Sulu/Bundle/ContactBundle/Controller/AccountsController.php @@ -162,7 +162,7 @@ class AccountsController extends RestController implements ClassResourceInterfac /** @var Account $account */ $account = $this->getDoctrine() ->getRepository($accountEntity) - ->find($id); + ->findAccountById($id); if (!$account) { throw new EntityNotFoundException($accountEntity, $id); @@ -176,7 +176,7 @@ class AccountsController extends RestController implements ClassResourceInterfac if ($parentData != null && isset($parentData['id'])) { $parent = $this->getDoctrine() ->getRepository($this->entityName) - ->find($parentData['id']); + ->findAccountById($parentData['id']); if (!$parent) { throw new EntityNotFoundException($this->entityName, $parentData['id']);
changed find to custom find by id
sulu_sulu
train
php
cd65b0a95a8099e75c2bcbbfb64e3adc264b4559
diff --git a/vc_dummy/indico_vc_dummy/plugin.py b/vc_dummy/indico_vc_dummy/plugin.py index <HASH>..<HASH> 100644 --- a/vc_dummy/indico_vc_dummy/plugin.py +++ b/vc_dummy/indico_vc_dummy/plugin.py @@ -67,6 +67,9 @@ class DummyPlugin(VCPluginMixin, IndicoPlugin): def update_room(self, vc_room, event): pass + def refresh_room(self, vc_room, event): + pass + def update_data_association(self, event, vc_room, event_vc_room, data): super(DummyPlugin, self).update_data_association(event, vc_room, event_vc_room, data) event_vc_room.data.update({key: data.pop(key) for key in [
VC/Dummy: Add missing method
indico_indico-plugins
train
py
3f9e4bf650339b4f2a4800f2d15cc3eb052a08ed
diff --git a/tests/src/rules/no-named-default.js b/tests/src/rules/no-named-default.js index <HASH>..<HASH> 100644 --- a/tests/src/rules/no-named-default.js +++ b/tests/src/rules/no-named-default.js @@ -13,14 +13,14 @@ ruleTester.run('no-named-default', rule, { ], invalid: [ - test({ + /*test({ code: 'import { default } from "./bar";', errors: [{ message: 'Use default import syntax to import \'default\'.', type: 'Identifier', }], parser: 'babel-eslint', - }), + }),*/ test({ code: 'import { default as bar } from "./bar";', errors: [{
[Tests] comment out failing (and probably invalid) test I suspect that this test is not actually valid syntax, and that babel is now throwing on it. If so, it should simply be removed.
benmosher_eslint-plugin-import
train
js
1cda5e674a432d7c7ea25e1c52731f2a217aa308
diff --git a/app/specs/no-plugin.spec.php b/app/specs/no-plugin.spec.php index <HASH>..<HASH> 100644 --- a/app/specs/no-plugin.spec.php +++ b/app/specs/no-plugin.spec.php @@ -8,8 +8,8 @@ use Peridot\Plugin\Silex\SilexScope; describe('Api', function() { - $app = include __DIR__ . '/../app.php'; - $scope = new SilexScope($app); + //here we manually mixin the silex scope + $scope = new SilexScope(include __DIR__ . '/../app.php'); $this->peridotAddChildScope($scope); describe('/info', function() {
mix in scope at suite level in no-plugin.spec.php
peridot-php_peridot-httpkernel-plugin
train
php
a04b11c261a77c989c53774253c5f6df09c70226
diff --git a/WPEloquent/Model/Term/Taxonomy.php b/WPEloquent/Model/Term/Taxonomy.php index <HASH>..<HASH> 100644 --- a/WPEloquent/Model/Term/Taxonomy.php +++ b/WPEloquent/Model/Term/Taxonomy.php @@ -6,6 +6,6 @@ class Taxonomy extends \Illuminate\Database\Eloquent\Model { protected $table = 'term_taxonomy'; public function term() { - return $this->belongsTo(\WPEloquent\Model\Term::class); + return $this->belongsTo(\WPEloquent\Model\Term::class, 'term_id', 'term_id'); } }
term will be null otherwise - relationship
drewjbartlett_wordpress-eloquent
train
php
273b02fc54034252183e61bb015bc1c1eaf9c083
diff --git a/dvc/command/metrics.py b/dvc/command/metrics.py index <HASH>..<HASH> 100644 --- a/dvc/command/metrics.py +++ b/dvc/command/metrics.py @@ -284,7 +284,7 @@ def add_parser(subparsers, parent_parser): "(even if not found as `metrics` in `dvc.yaml`). " "Using -R, directories to search metrics files in " "can also be given." - "Shows all tracked metrics by default.", + "Shows all tracked metrics by default." ), metavar="<paths>", ).complete = completion.FILE diff --git a/dvc/command/params.py b/dvc/command/params.py index <HASH>..<HASH> 100644 --- a/dvc/command/params.py +++ b/dvc/command/params.py @@ -101,7 +101,7 @@ def add_parser(subparsers, parent_parser): help=( "Specific params file(s) to compare " "(even if not found as `params` in `dvc.yaml`). " - "Shows all tracked params by default.", + "Shows all tracked params by default." ), metavar="<paths>", ).complete = completion.FILE
metrics/params: fix bug preventing usage from being displayed (#<I>)
iterative_dvc
train
py,py
f4cbf3dd6d1cd0ba466d40d5b4074c99685bb793
diff --git a/test/spec/read-id3v2.3-iso-8859-1.spec.js b/test/spec/read-id3v2.3-iso-8859-1.spec.js index <HASH>..<HASH> 100644 --- a/test/spec/read-id3v2.3-iso-8859-1.spec.js +++ b/test/spec/read-id3v2.3-iso-8859-1.spec.js @@ -405,7 +405,7 @@ describe("ID3v2.3 reader run on ID3v2.3 tag with ISO-8859-1 encoded frames", fun }); // - it("should read POPM: Popularimeter", function () { + it("should read POPM: Popularimeter (multiple)", function () { var capturedFrames = expectCapturedFrames("POPM", 2), frame1 = _(capturedFrames).find(function (frame) {
Mark popularimeter tests as concerning multiples
biril_mp3-parser
train
js
6066b076b9cd9d836044e062a3bfdb80bf02d0a2
diff --git a/lib/gitWorkflow.js b/lib/gitWorkflow.js index <HASH>..<HASH> 100644 --- a/lib/gitWorkflow.js +++ b/lib/gitWorkflow.js @@ -306,7 +306,7 @@ class GitWorkflow { await Promise.all(this.deletedFiles.map(file => unlink(file))) // Clean out patch - if (this.partiallyStagedFiles) await unlink(PATCH_UNSTAGED) + await unlink(this.getHiddenFilepath(PATCH_UNSTAGED)) debug('Done restoring original state!') } catch (error) {
fix: pass correct path to unstaged patch during cleanup
okonet_lint-staged
train
js
502f3c081317cf69c21f94965a647f5c05923a09
diff --git a/lib/mixlib/shellout/windows.rb b/lib/mixlib/shellout/windows.rb index <HASH>..<HASH> 100644 --- a/lib/mixlib/shellout/windows.rb +++ b/lib/mixlib/shellout/windows.rb @@ -111,6 +111,12 @@ module Mixlib when WAIT_TIMEOUT # Kill the process if (Time.now - start_wait) > timeout + begin + Process.kill(:KILL, process.process_id) + rescue Errno::EIO + logger.warn("Failed to kill timed out process #{process.process_id}") if logger + end + raise Mixlib::ShellOut::CommandTimeout, "command timed out:\n#{format_for_exception}" end
On windows, send sigkill to process if it exceeds its alloted time Timeouts did not work correctly on windows because we do not kill or abandon the process. What was happening was a timeout condition was getting correctly detected, and an exception was being raised. However, before the exception could propogate, whatever the process was writing was fully read until it closed its FD.
chef_mixlib-shellout
train
rb
c670407c5b006c3d6508ca58dfe676f0d925a774
diff --git a/gcp/testing/eventually_consistent.py b/gcp/testing/eventually_consistent.py index <HASH>..<HASH> 100644 --- a/gcp/testing/eventually_consistent.py +++ b/gcp/testing/eventually_consistent.py @@ -15,6 +15,7 @@ Tools for dealing with eventually consistent tests. """ +import gcloud.exceptions from retrying import retry @@ -33,7 +34,8 @@ def mark(f): wait_exponential_multiplier=100, wait_exponential_max=3000, stop_max_attempt_number=10, - retry_on_exception=_retry_on_exception(AssertionError))(f) + retry_on_exception=_retry_on_exception( + (AssertionError, gcloud.exceptions.GCloudError)))(f) def call(f, exceptions=AssertionError, tries=4):
Make eventual consistent retry on gcloud errors as well
GoogleCloudPlatform_python-repo-tools
train
py
ad73ce714bda469a7446fad7607bd39bdd988e66
diff --git a/src/test/java/com/marklogic/client/test/RawQueryDefinitionTest.java b/src/test/java/com/marklogic/client/test/RawQueryDefinitionTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/marklogic/client/test/RawQueryDefinitionTest.java +++ b/src/test/java/com/marklogic/client/test/RawQueryDefinitionTest.java @@ -550,7 +550,7 @@ public class RawQueryDefinitionTest { @Test public void test_issue581_RawStructuredQueryFromFileHandle() throws Exception { Common.client.newDocumentManager().write("test_issue581_RawStructuredQueryFromFileHandle.xml", - new FileHandle(new File("src/test/resources/constraint5.xml"))); + new FileHandle(new File("src/test/resources/constraint5.xml")).withFormat(Format.XML)); // get the combined query File file = new File("src/test/resources/combinedQueryOption.xml");
fix broken unit test because XML file wasn't marked as such, so it was written in BINARY format
marklogic_java-client-api
train
java
00af0de01abfbf07ad42ce6b41b5c3b164b477ae
diff --git a/pandas/io/tests/test_excel.py b/pandas/io/tests/test_excel.py index <HASH>..<HASH> 100644 --- a/pandas/io/tests/test_excel.py +++ b/pandas/io/tests/test_excel.py @@ -1070,12 +1070,15 @@ class ExcelWriterEngineTests(tm.TestCase): except ImportError: _skip_if_no_openpyxl() writer_klass = _OpenpyxlWriter - writer = ExcelWriter('apple.xlsx') - tm.assert_isinstance(writer, writer_klass) + + with ensure_clean('.xlsx') as path: + writer = ExcelWriter(path) + tm.assert_isinstance(writer, writer_klass) _skip_if_no_xlwt() - writer = ExcelWriter('apple.xls') - tm.assert_isinstance(writer, _XlwtWriter) + with ensure_clean('.xls') as path: + writer = ExcelWriter(path) + tm.assert_isinstance(writer, _XlwtWriter) def test_register_writer(self): # some awkward mocking to test out dispatch and such actually works
TST: Cleanup temp files in Excel test. Issue #<I>
pandas-dev_pandas
train
py