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 |
|---|---|---|---|---|---|
902a843d8441e942b7d80d4e3b4e9a9a9f66fc19 | diff --git a/Infra/DependencyInjection/Compiler/ResolveDomainPass.php b/Infra/DependencyInjection/Compiler/ResolveDomainPass.php
index <HASH>..<HASH> 100644
--- a/Infra/DependencyInjection/Compiler/ResolveDomainPass.php
+++ b/Infra/DependencyInjection/Compiler/ResolveDomainPass.php
@@ -36,7 +36,7 @@ final class ResolveDomainPass implements CompilerPassInterface
self::register($container, DoctrineInfra\MappingCacheWarmer::class)
->setArgument('$dirname', '%msgphp.doctrine.mapping_cache_dirname%')
->setArgument('$mappingFiles', $mappingFiles)
- ->addTag('kernel.cache_warmer');
+ ->addTag('kernel.cache_warmer', ['priority' => 100]);
}
} | fix doctrine mapping error in prod mode (#<I>) | msgphp_domain | train | php |
1c6cd2541772a0dbd92b24f37f9567c638f5b8ee | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -96,6 +96,8 @@ exclude_patterns = [
'notebooks/Neural_Network_and_Data_Loading.ipynb',
'notebooks/score_matching.ipynb',
'notebooks/maml.ipynb',
+ # Fails with shape error in XL
+ 'notebooks/XLA_in_Python.ipnb'
]
# The name of the Pygments (syntax highlighting) style to use. | Temporarily disable XLA_in_Python notebook, pending fixing of bug
Issue: #<I> | tensorflow_probability | train | py |
eddf98747526825178bbf768c2979e28b34f9ef0 | diff --git a/py3status/__init__.py b/py3status/__init__.py
index <HASH>..<HASH> 100755
--- a/py3status/__init__.py
+++ b/py3status/__init__.py
@@ -227,6 +227,10 @@ class I3status(Thread):
config[section_name].append(value)
line = '}'
+ # create an empty config for this module
+ if value not in config:
+ config[value] = {}
+
# detect internal modules to be loaded dynamically
if not self.valid_config_param(value):
config['py3_modules'].append(value) | make sure we have an empty config for every requested module on the order list | ultrabug_py3status | train | py |
37a82f41f710675d7d382a025fd3fb5215b81d9e | diff --git a/src/MUIDataTable.js b/src/MUIDataTable.js
index <HASH>..<HASH> 100644
--- a/src/MUIDataTable.js
+++ b/src/MUIDataTable.js
@@ -760,10 +760,6 @@ class MUIDataTable extends React.Component {
searchText,
} = this.state;
- if (!data.length) {
- return false;
- }
-
const rowCount = this.options.count || displayData.length;
return (
diff --git a/src/MUIDataTableToolbar.js b/src/MUIDataTableToolbar.js
index <HASH>..<HASH> 100644
--- a/src/MUIDataTableToolbar.js
+++ b/src/MUIDataTableToolbar.js
@@ -94,6 +94,7 @@ class MUIDataTableToolbar extends React.Component {
"",
)
.slice(0, -1) + "\r\n";
+
const CSVBody = data
.reduce(
(soFar, row) => | #<I> Display empty table if no data is given (#<I>)
* display table even when data is empty
* fix bug in CSV export when data is empty | gregnb_mui-datatables | train | js,js |
4051ed47984117e89375d2bca256b3572b09134e | diff --git a/tests/Unit/ContainerTest.php b/tests/Unit/ContainerTest.php
index <HASH>..<HASH> 100644
--- a/tests/Unit/ContainerTest.php
+++ b/tests/Unit/ContainerTest.php
@@ -657,6 +657,32 @@ class ContainerTest extends TestCase
$this->assertSame('firstsecondthird', $compositeContainer->get('first-second-third'));
}
+ public function testCircularReferenceExceptionWhileResolvingProviders(): void
+ {
+ $provider = new class() extends ServiceProvider {
+ public function register(Container $container): void
+ {
+ $container->set(ContainerInterface::class, static function (ContainerInterface $container) {
+ // E.g. wrapping container with proxy class
+ return $container;
+ });
+ $container->get(B::class);
+ }
+ };
+
+ $this->expectException(\RuntimeException::class);
+ new Container(
+ [
+ B::class => function () {
+ throw new \RuntimeException();
+ },
+ ],
+ [
+ $provider,
+ ]
+ );
+ }
+
private function getProxyContainer(ContainerInterface $container): ContainerInterface
{
return new class($container) extends AbstractContainerConfigurator implements ContainerInterface { | Add test for circular exception while resolving providers (#<I>)
This test reproduces `CircularReferenceException` while
running `yii serve` in `yiisoft/app`.
The test is extracted from <URL> | yiisoft_di | train | php |
3daa1b860cf3cb64a3c171474b0fe609eddcd62b | diff --git a/spec/fixtures/rails/config/environment.rb b/spec/fixtures/rails/config/environment.rb
index <HASH>..<HASH> 100644
--- a/spec/fixtures/rails/config/environment.rb
+++ b/spec/fixtures/rails/config/environment.rb
@@ -41,5 +41,4 @@ Rails::Initializer.run do |config|
ENV['RACK_ENV'] = ENV['RAILS_ENV']
config.middleware.insert_after(ActionController::Failsafe, Rack::Lilypad, 'xxx')
- config.middleware.delete(ActionController::Failsafe) # so we can test re-raise
end
\ No newline at end of file
diff --git a/spec/rack/lilypad_spec.rb b/spec/rack/lilypad_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/rack/lilypad_spec.rb
+++ b/spec/rack/lilypad_spec.rb
@@ -74,10 +74,6 @@ describe Rack::Lilypad do
@http.should_receive(:post)
get "/pulse" rescue nil
end
-
- it "should re-raise the exception" do
- lambda { get "/pulse" }.should raise_error(TestError)
- end
it "should not do anything if non-production environment" do
ENV['RACK_ENV'] = 'development' | No need to test re-raise with Rails | winton_lilypad | train | rb,rb |
34b514e1fc58c3a075b53317f9e9993cb110a0fc | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -62,6 +62,13 @@ var NavigationBar = React.createClass({
navigator: React.PropTypes.object.isRequired,
route: React.PropTypes.object.isRequired,
},
+
+ getDefaultProps: function() {
+ return {
+ shouldUpdate: false
+ }
+ },
+
/*
* If there are no routes in the stack, `hidePrev` isn't provided or false,
* and we haven't received `onPrev` click handler, return true
@@ -221,7 +228,7 @@ var NavigationBar = React.createClass({
customStyle = this.props.style;
return (
- <StaticContainer shouldUpdate={false}>
+ <StaticContainer shouldUpdate={this.props.shouldUpdate}>
<View style={[styles.navBarContainer, backgroundStyle, customStyle ]}>
{this.getTitleElement()}
{this.getLeftButtonElement()} | Allow "shouldUpdate" to be configurable
There should be a way to update the title or the buttons of the navigation bar if the user wants to. | react-native-community_react-native-navbar | train | js |
b2e5272a44ed4bcefdd7fabbfc5784a00b9fbb16 | diff --git a/restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/Call.java b/restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/Call.java
index <HASH>..<HASH> 100644
--- a/restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/Call.java
+++ b/restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/Call.java
@@ -1412,7 +1412,7 @@ public final class Call extends UntypedActor {
}
private void onPlay(Play message, ActorRef self, ActorRef sender) {
- if (is(inProgress) || is(waitingForAnswer)) {
+ if (is(inProgress)) {
// Forward to media server controller
this.msController.tell(message, sender);
} | No play actions in 'waitingForAnswer' state | RestComm_Restcomm-Connect | train | java |
20f61864f06e539a0c5a6d2ceddf66b07e75e430 | diff --git a/src/main/java/net/wouterdanes/docker/maven/StartContainerMojo.java b/src/main/java/net/wouterdanes/docker/maven/StartContainerMojo.java
index <HASH>..<HASH> 100644
--- a/src/main/java/net/wouterdanes/docker/maven/StartContainerMojo.java
+++ b/src/main/java/net/wouterdanes/docker/maven/StartContainerMojo.java
@@ -33,7 +33,6 @@ import com.google.common.collect.Collections2;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.InstantiationStrategy;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
@@ -64,10 +63,10 @@ public class StartContainerMojo extends AbstractPreVerifyDockerMojo {
this.containers = containers;
}
- @Component
+ @Parameter(defaultValue = "${project}", readonly = true)
private MavenProject project;
- @Component
+ @Parameter(defaultValue = "${mojoExecution}", readonly = true)
private MojoExecution mojoExecution;
@Override | Replaced deprecated @Component annotation with @Parameter annotation. | wouterd_docker-maven-plugin | train | java |
87999a186beb2fe4daceda9a4cf586860495242c | diff --git a/src/tinydb_jsonorm/models.py b/src/tinydb_jsonorm/models.py
index <HASH>..<HASH> 100644
--- a/src/tinydb_jsonorm/models.py
+++ b/src/tinydb_jsonorm/models.py
@@ -43,12 +43,16 @@ class TinyJsonModel(Model):
def __init__(self, eid=None, *args, **kwargs):
super(TinyJsonModel, self).__init__(*args, **kwargs)
+
# When eid is informed we consider as existent record in the database
if eid is not None:
self.eid = eid
else:
- # Only generate cuid for new record objects eid == None
- self._cuid = uuidgen.cuid()
+ if '_cuid' in kwargs:
+ self._cuid = kwargs['_cuid']
+ else:
+ # Only generate cuid for new record objects eid == None and kwargs['_cuid'] == None
+ self._cuid = uuidgen.cuid()
@property
def id(self): | Fixed issue that occurred when using ListField type fields using data created from another TinyJsonModel table. At the time the master record was saved a new _cuid was generated for the sub record and this caused integrity issues in certain situations. | abnerjacobsen_tinydb-jsonorm | train | py |
c1de47bea50e19ea6592d76f245214588467dc5e | diff --git a/resource_aws_launch_configuration.go b/resource_aws_launch_configuration.go
index <HASH>..<HASH> 100644
--- a/resource_aws_launch_configuration.go
+++ b/resource_aws_launch_configuration.go
@@ -144,15 +144,16 @@ func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}
if err != nil {
return fmt.Errorf("Error retrieving launch configuration: %s", err)
}
+ if len(describConfs.LaunchConfigurations) == 0 {
+ d.SetId("")
+ return nil
+ }
// Verify AWS returned our launch configuration
- if len(describConfs.LaunchConfigurations) != 1 ||
- describConfs.LaunchConfigurations[0].Name != d.Id() {
- if err != nil {
- return fmt.Errorf(
- "Unable to find launch configuration: %#v",
- describConfs.LaunchConfigurations)
- }
+ if describConfs.LaunchConfigurations[0].Name != d.Id() {
+ return fmt.Errorf(
+ "Unable to find launch configuration: %#v",
+ describConfs.LaunchConfigurations)
}
lc := describConfs.LaunchConfigurations[0] | providers/aws: if LC not found, delete it [GH-<I>] | terraform-providers_terraform-provider-aws | train | go |
40b1579642c43fcccd4d072bf5ee0685f6d43e2f | diff --git a/lib/axiom/relation/operation/ungroup.rb b/lib/axiom/relation/operation/ungroup.rb
index <HASH>..<HASH> 100644
--- a/lib/axiom/relation/operation/ungroup.rb
+++ b/lib/axiom/relation/operation/ungroup.rb
@@ -50,7 +50,7 @@ module Axiom
operand.each do |tuple|
outer_tuple = tuple.project(@outer)
tuple[attribute].each do |inner_tuple|
- yield outer_tuple.extend(header, inner_tuple.to_ary)
+ yield outer_tuple.join(header, inner_tuple)
end
end
self | Change Ungroup#each to join the tuples rather than using extend | dkubb_axiom | train | rb |
11f6aa82c8853ebba49b7ade30bb3c1628ca5813 | diff --git a/lib/brcobranca/version.rb b/lib/brcobranca/version.rb
index <HASH>..<HASH> 100644
--- a/lib/brcobranca/version.rb
+++ b/lib/brcobranca/version.rb
@@ -2,5 +2,5 @@
#
module Brcobranca
- VERSION = '9.2.3'
+ VERSION = '9.2.4'
end | bump up version to <I> | kivanio_brcobranca | train | rb |
c2bae0786df3bc12987cb1dc55d288ce445a73dd | diff --git a/tests/e2e/test_e2e.py b/tests/e2e/test_e2e.py
index <HASH>..<HASH> 100644
--- a/tests/e2e/test_e2e.py
+++ b/tests/e2e/test_e2e.py
@@ -90,6 +90,9 @@ def test_incremental(caplog):
assert num_docs == max_docs
docs = corpus_parser.get_documents()
+ last_docs = corpus_parser.get_documents()
+
+ assert len(docs[0].sentences) == len(last_docs[0].sentences)
# Mention Extraction
part_ngrams = MentionNgramsPart(parts_by_doc=None, n_max=3)
@@ -242,9 +245,13 @@ def test_e2e(caplog):
logger.info("Sentences: {}".format(num_sentences))
# Divide into test and train
- docs = corpus_parser.get_documents()
+ docs = sorted(corpus_parser.get_documents())
+ last_docs = sorted(corpus_parser.get_last_documents())
+
ld = len(docs)
- assert ld == len(corpus_parser.get_last_documents())
+ assert ld == len(last_docs)
+ assert len(docs[0].sentences) == len(last_docs[0].sentences)
+
assert len(docs[0].sentences) == 799
assert len(docs[1].sentences) == 663
assert len(docs[2].sentences) == 784 | test(e2e): ensure sentences are accessible from the docs in get_last_documents | HazyResearch_fonduer | train | py |
9d0895b68f69ef22b3a1373d20575918b470379d | diff --git a/src/tokenization-rules.js b/src/tokenization-rules.js
index <HASH>..<HASH> 100644
--- a/src/tokenization-rules.js
+++ b/src/tokenization-rules.js
@@ -100,7 +100,7 @@ exports.forNameVariable = compose(map((tk, idx, iterable) => {
// if last token is For and current token form a valid name
// type of token is changed from WORD to NAME
- if (lastToken.For && tk.WORD && tk.WORD.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)) {
+ if (lastToken.For && tk.WORD && isValidName(tk.WORD)) {
return copyTempObject(tk, {
NAME: tk.WORD,
loc: tk.loc
@@ -113,6 +113,8 @@ exports.forNameVariable = compose(map((tk, idx, iterable) => {
exports.functionName = compose(map((tk, idx, iterable) => {
// apply only on valid positions
// (start of simple commands)
+ // if token can form the name of a function,
+ // type of token is changed from WORD to NAME
if (
tk._.maybeStartOfSimpleCommand &&
tk.WORD && | further refactor of forNameVariable | vorpaljs_bash-parser | train | js |
5901a39358c92a4950d1bd230e4ccb01bac2e8b1 | diff --git a/sprd/view/ProductImage.js b/sprd/view/ProductImage.js
index <HASH>..<HASH> 100644
--- a/sprd/view/ProductImage.js
+++ b/sprd/view/ProductImage.js
@@ -2,7 +2,7 @@ define(["xaml!sprd/view/Image", "sprd/data/ImageService"], function (Image, Imag
var viewIdExtractor = /\/views\/(\d+)/;
- var ProductImage = Image.inherit("sprd.view.ProductImage", {
+ return Image.inherit("sprd.view.ProductImage", {
defaults: {
/***
@@ -68,6 +68,4 @@ define(["xaml!sprd/view/Image", "sprd/data/ImageService"], function (Image, Imag
}.onChange('product', 'width', 'height', 'type', 'view', 'appearance')
});
-
- return ProductImage;
});
\ No newline at end of file | refactored ProductImage variable | spreadshirt_rAppid.js-sprd | train | js |
0d707fb21c43651334bc3841850a27c01d550fa4 | diff --git a/lib/CORL/configuration/file.rb b/lib/CORL/configuration/file.rb
index <HASH>..<HASH> 100644
--- a/lib/CORL/configuration/file.rb
+++ b/lib/CORL/configuration/file.rb
@@ -8,8 +8,8 @@ class File < Nucleon.plugin_class(:CORL, :configuration)
def normalize(reload)
super do
- _set(:search, Config.new)
- _set(:router, Config.new)
+ _set(:search, Config.new({}, {}, true, false))
+ _set(:router, Config.new({}, {}, true, false))
end
end | Fixing configuration file provider initialization to create deep merged search and router configs. | coralnexus_corl | train | rb |
5cececc631466617381071346ddbea88231c1470 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
-from distutils.util import get_platform
+import platform
import shlex
import subprocess
import sys
@@ -40,18 +40,13 @@ platform_libraries = []
platform_extra_compile_args = [] # ['-ggdb', '-O0']
platform_extra_link_args = [] # ['-ggdb']
-if get_platform() in ('win32', 'win-amd64'):
+if platform.system() == 'Windows':
platform__cc_defines = [('WIN32', '100')]
platform_swig_opts = ['-DWIN32']
platform_sources = ['smartcard/scard/scard.rc']
platform_libraries = ['winscard']
-elif 'cygwin-' in get_platform():
- platform__cc_defines = [('WIN32', '100')]
- platform_swig_opts = ['-DWIN32']
- platform_libraries = ['winscard']
-
-elif 'macosx-' in get_platform():
+elif platform.system() == 'Darwin':
platform__cc_defines = [('PCSCLITE', '1'),
('__APPLE__', '1')]
platform_swig_opts = ['-DPCSCLITE', '-D__APPLE__'] | setup.py: do not use deprecated distutils anymore
Fix:
setup.py:<I>: DeprecationWarning: The distutils package is deprecated and slated for removal in Python <I>. Use setuptools or check PEP <I> for potential alternatives
from distutils.util import get_platform | LudovicRousseau_pyscard | train | py |
4cd220b02f4833383caffb86e5481eacdd918a9c | diff --git a/src/main/java/com/semanticcms/file/servlet/impl/FileImpl.java b/src/main/java/com/semanticcms/file/servlet/impl/FileImpl.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/semanticcms/file/servlet/impl/FileImpl.java
+++ b/src/main/java/com/semanticcms/file/servlet/impl/FileImpl.java
@@ -80,7 +80,10 @@ final public class FileImpl {
// In accessible book, use attributes
isDirectory = resourceFile.isDirectory();
// When is a directory, must end in slash
- if(!file.getPath().endsWith(com.semanticcms.file.model.File.SEPARATOR_STRING)) {
+ if(
+ isDirectory
+ && !file.getPath().endsWith(com.semanticcms.file.model.File.SEPARATOR_STRING)
+ ) {
throw new IllegalArgumentException(
"References to directories must end in slash ("
+ com.semanticcms.file.model.File.SEPARATOR_CHAR | Pulling file out of core and making files be elements. | aoindustries_semanticcms-file-servlet | train | java |
728943f73ae536d1fe77183956414dd03e6dca23 | diff --git a/src/Scheduler.php b/src/Scheduler.php
index <HASH>..<HASH> 100644
--- a/src/Scheduler.php
+++ b/src/Scheduler.php
@@ -44,7 +44,7 @@ class Scheduler extends ArrayObject
* @param string $name
* @param callable $job The job.
*/
- public function offsetSet(string $name, callable $job)
+ public function offsetSet($name, $job)
{
if (!is_callable($job)) {
throw new InvalidArgumentException('Each job must be callable'); | not allowed, because php :( | monolyth-php_croney | train | php |
e7c556371a5fbf8046dc9865ad9945791e3e2d74 | diff --git a/core/src/elements/ons-segment.js b/core/src/elements/ons-segment.js
index <HASH>..<HASH> 100755
--- a/core/src/elements/ons-segment.js
+++ b/core/src/elements/ons-segment.js
@@ -140,6 +140,7 @@ export default class SegmentElement extends BaseElement {
<div class="segment__item">
<input type="radio" class="segment__input"
onclick="this.nextElementSibling.click()"
+ value="${index}"
name="${this._segmentId}"
${!this.hasAttribute('tabbar-id') && index === (parseInt(this.getAttribute('active-index')) || 0) ? 'checked' : ''}>
</div> | feat(ons-segment): Index as radio value. | OnsenUI_OnsenUI | train | js |
3efbdc15f37259e3fcd98ae2441b82043f078dbc | diff --git a/lib/github/ldap/membership_validators/base.rb b/lib/github/ldap/membership_validators/base.rb
index <HASH>..<HASH> 100644
--- a/lib/github/ldap/membership_validators/base.rb
+++ b/lib/github/ldap/membership_validators/base.rb
@@ -2,7 +2,12 @@ module GitHub
class Ldap
module MembershipValidators
class Base
- attr_reader :ldap, :groups
+
+ # Internal: The GitHub::Ldap object to search domains with.
+ attr_reader :ldap
+
+ # Internal: an Array of Net::LDAP::Entry group objects to validate with.
+ attr_reader :groups
# Public: Instantiate new validator.
#
@@ -25,6 +30,7 @@ module GitHub
def domains
@domains ||= ldap.search_domains.map { |base| ldap.domain(base) }
end
+ private :domains
end
end
end | Document attrs, make internal method private | github_github-ldap | train | rb |
713da8c25530faa1eb02ad1f6319be40a46aabf7 | diff --git a/src/ShopifyApp/resources/database/migrations/2020_01_29_230905_create_shops_table.php b/src/ShopifyApp/resources/database/migrations/2020_01_29_230905_create_shops_table.php
index <HASH>..<HASH> 100644
--- a/src/ShopifyApp/resources/database/migrations/2020_01_29_230905_create_shops_table.php
+++ b/src/ShopifyApp/resources/database/migrations/2020_01_29_230905_create_shops_table.php
@@ -19,7 +19,9 @@ class CreateShopsTable extends Migration
$table->boolean('shopify_freemium')->default(false);
$table->integer('plan_id')->unsigned()->nullable();
- $table->softDeletes();
+ if (! Schema::hasColumn('users', 'deleted_at')) {
+ $table->softDeletes();
+ }
$table->foreign('plan_id')->references('id')->on('plans');
}); | Added check for if soft delete (#<I>)
* Added check for if soft delete is already enabled on users table for the migration
* StyleCI fix | ohmybrew_laravel-shopify | train | php |
a0cfbe342cba4a6495c30e8a3d27d49394940e5e | diff --git a/src/Fields/Text.php b/src/Fields/Text.php
index <HASH>..<HASH> 100644
--- a/src/Fields/Text.php
+++ b/src/Fields/Text.php
@@ -42,4 +42,16 @@ class Text extends Field
* @var string
*/
protected $type = 'text';
+
+ /**
+ * Set the character limit
+ *
+ * @return self
+ */
+ public function maxLength(int $length): self
+ {
+ $this->config->set('maxlength', $length);
+
+ return $this;
+ }
}
diff --git a/tests/Fields/TextTest.php b/tests/Fields/TextTest.php
index <HASH>..<HASH> 100644
--- a/tests/Fields/TextTest.php
+++ b/tests/Fields/TextTest.php
@@ -98,4 +98,10 @@ class TextTest extends TestCase
$field = Text::make('Append')->append('suffix')->toArray();
$this->assertSame('suffix', $field['append']);
}
+
+ public function testMaxLength()
+ {
+ $field = Text::make('Title with length')->maxLength(10)->toArray();
+ $this->assertEquals($field['maxlength'], 10);
+ }
} | feat: added maxLength for texts fields (#<I>)
* feat: added maxLength for texts fields
* fix: typo maxlength | wordplate_acf | train | php,php |
dddd992a778af9fe97da8a9eb28d5e3c7db1e1b7 | diff --git a/telemetry/telemetry/core/memory_cache_http_server.py b/telemetry/telemetry/core/memory_cache_http_server.py
index <HASH>..<HASH> 100644
--- a/telemetry/telemetry/core/memory_cache_http_server.py
+++ b/telemetry/telemetry/core/memory_cache_http_server.py
@@ -23,6 +23,9 @@ ResourceAndRange = namedtuple('ResourceAndRange', ['resource', 'byte_range'])
class MemoryCacheHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+ protocol_version = 'HTTP/1.1' # override BaseHTTPServer setting
+ wbufsize = -1 # override StreamRequestHandler (a base class) setting
+
def do_GET(self):
"""Serve a GET request."""
resource_range = self.SendHead() | [Telemetry] Set same settings on memory cache http server that WPR sets.
It looks like the error that the windows dom_perf tests are hitting could be
caused by improperly closing the socket, which this might fix.
error: [Errno <I>] An established connection was aborted by the software in your host machine
BUG=<I>
Review URL: <URL> | catapult-project_catapult | train | py |
a3947838441a39fb23e02eabc232c95c54e311a6 | diff --git a/src/bin/nca-init.js b/src/bin/nca-init.js
index <HASH>..<HASH> 100644
--- a/src/bin/nca-init.js
+++ b/src/bin/nca-init.js
@@ -1,7 +1,6 @@
/*eslint no-console: 0 */
// @flow
-import fs from 'fs'
import chalk from 'chalk'
import AutoreleaseYml from '../lib/autorelease-yml'
import WorkingDirectory from '../lib/working-directory' | refactor for lint | CureApp_node-circleci-autorelease | train | js |
8a47c681072a6c621425acdf6776b930519fe34e | diff --git a/test/functional/sessions_tests.js b/test/functional/sessions_tests.js
index <HASH>..<HASH> 100644
--- a/test/functional/sessions_tests.js
+++ b/test/functional/sessions_tests.js
@@ -50,7 +50,7 @@ describe('Sessions', function() {
}
});
- describe.only('withSession', {
+ describe('withSession', {
metadata: { requires: { mongodb: '>3.6.0' } },
test: function() {
[ | chore(sessions): remove accidentally committed `.only` | mongodb_node-mongodb-native | train | js |
62d5382458bc3844f183cef00e2f7323b41b5558 | diff --git a/util/parser.py b/util/parser.py
index <HASH>..<HASH> 100644
--- a/util/parser.py
+++ b/util/parser.py
@@ -233,8 +233,11 @@ class Parser(object):
if len(splitLine) > 0 and splitLine[0].isdigit():
iterNumber = splitLine[0]
+
# Calculate the average number of iterations it took to converge
if (len(itersToConverge) > 0):
+ itersToConverge.append(int(iterNumber))
+ currentStep += 1
avgItersToConverge = float(sum(itersToConverge)) / len(itersToConverge)
# Record some of the data in the self.stdOutData | Fixing some minor corrections for calculating convergence rates. | LIVVkit_LIVVkit | train | py |
d913a8c6c0d07ee180651129b20363cbef7ee8b6 | diff --git a/spec/project/object/helpers/file_references_factory_spec.rb b/spec/project/object/helpers/file_references_factory_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/project/object/helpers/file_references_factory_spec.rb
+++ b/spec/project/object/helpers/file_references_factory_spec.rb
@@ -170,6 +170,20 @@ module ProjectSpecs
ref.current_version.source_tree.should == '<group>'
@group.children.should.include(ref)
end
+
+ it 'resolves path to models in subfolders' do
+ group_path = fixture_path('CoreData')
+ group = @group.new_group('CoreData', group_path)
+
+ path = 'VersionedModel.xcdatamodeld'
+ ref = @factory.send(:new_xcdatamodeld, group, path, :group)
+
+ ref.current_version.isa.should == 'PBXFileReference'
+ ref.current_version.path.should.include 'VersionedModel 2.xcdatamodel'
+ ref.current_version.last_known_file_type.should == 'wrapper.xcdatamodel'
+ ref.current_version.source_tree.should == '<group>'
+ group.children.should.include(ref)
+ end
end
#-------------------------------------------------------------------------# | Added test case for resolving data model packages in subfolders | CocoaPods_Xcodeproj | train | rb |
60e6d89c60a26aa856236aad4bf65d80b239e604 | diff --git a/bindings/vue/src/internal/optionsObjectHelper.js b/bindings/vue/src/internal/optionsObjectHelper.js
index <HASH>..<HASH> 100644
--- a/bindings/vue/src/internal/optionsObjectHelper.js
+++ b/bindings/vue/src/internal/optionsObjectHelper.js
@@ -59,7 +59,7 @@ const createComputedPropertiesFor = (targetClass) => {
// register a computed property
// which relay set/get operations to its corresponding property of DOM element
computed[propertyName] = {
- get() { return this.$el[propertyName].__vue__ || this.$el[propertyName]; },
+ get() { return (this.$el[propertyName] && this.$el[propertyName].__vue__) || this.$el[propertyName]; },
set(newValue) { this.$el[propertyName] = newValue; }
};
} | fix(vue): Property could return null. | OnsenUI_OnsenUI | train | js |
36c1b431999300768bb1b97d3e6c679253f8abfe | diff --git a/crnk-security/src/main/java/io/crnk/security/internal/DataRoomMatcher.java b/crnk-security/src/main/java/io/crnk/security/internal/DataRoomMatcher.java
index <HASH>..<HASH> 100644
--- a/crnk-security/src/main/java/io/crnk/security/internal/DataRoomMatcher.java
+++ b/crnk-security/src/main/java/io/crnk/security/internal/DataRoomMatcher.java
@@ -50,7 +50,7 @@ public class DataRoomMatcher {
public void verifyMatch(Object resource, HttpMethod method, SecurityProvider securityProvider) {
boolean match = checkMatch(resource, method, securityProvider);
if (!match) {
- LOGGER.error("dataroom prevented access to {} for {}", resource, method);
+ LOGGER.warn("dataroom prevented access to {} for {}", resource, method);
throw new ForbiddenException("not allowed to access resource");
}
} | reduce log level of dataroom filter to WARN
align with WARN for ForbiddenException (as any 4xx error) | crnk-project_crnk-framework | train | java |
20aa1bc8b30aa9d4344fe3b66577acecbb83aa79 | diff --git a/client/lxd_containers.go b/client/lxd_containers.go
index <HASH>..<HASH> 100644
--- a/client/lxd_containers.go
+++ b/client/lxd_containers.go
@@ -1388,7 +1388,7 @@ func (r *ProtocolLXD) GetContainerTemplateFile(containerName string, templateNam
}
// Send the request
- resp, err := r.http.Do(req)
+ resp, err := r.do(req)
if err != nil {
return nil, err
}
@@ -1432,7 +1432,7 @@ func (r *ProtocolLXD) setContainerTemplateFile(containerName string, templateNam
}
// Send the request
- resp, err := r.http.Do(req)
+ resp, err := r.do(req)
// Check the return value for a cleaner error
if resp.StatusCode != http.StatusOK {
_, _, err := lxdParseResponse(resp) | client: Always use the "do()" wrapper | lxc_lxd | train | go |
ffa64f35755eb7383146b38f281132bedb01a37d | diff --git a/spec/lib/bumbleworks/worker/info_spec.rb b/spec/lib/bumbleworks/worker/info_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/bumbleworks/worker/info_spec.rb
+++ b/spec/lib/bumbleworks/worker/info_spec.rb
@@ -202,6 +202,11 @@ describe Bumbleworks::Worker::Info do
allow(subject).to receive(:updated_at).and_return(frozen_time - 3)
expect(subject).not_to be_updated_since(frozen_time - 2)
end
+
+ it "returns true if updated_at same as given time" do
+ allow(subject).to receive(:updated_at).and_return(frozen_time - 3)
+ expect(subject).to be_updated_since(frozen_time - 3)
+ end
end
describe "#updated_recently?" do | More test coverage around last worker info update | bumbleworks_bumbleworks | train | rb |
27bcca4374948a456b456029a8f9e2854e0d2b5d | diff --git a/allennlp/commands/train.py b/allennlp/commands/train.py
index <HASH>..<HASH> 100644
--- a/allennlp/commands/train.py
+++ b/allennlp/commands/train.py
@@ -343,6 +343,7 @@ def train_model(
),
nprocs=num_procs,
)
+ archive_model(serialization_dir, files_to_archive=params.files_to_archive)
model = Model.load(params, serialization_dir)
return model
diff --git a/allennlp/tests/commands/train_test.py b/allennlp/tests/commands/train_test.py
index <HASH>..<HASH> 100644
--- a/allennlp/tests/commands/train_test.py
+++ b/allennlp/tests/commands/train_test.py
@@ -114,6 +114,7 @@ class TestTrain(AllenNlpTestCase):
assert "stdout_worker0.log" in serialized_files
assert "stderr_worker1.log" in serialized_files
assert "stdout_worker1.log" in serialized_files
+ assert "model.tar.gz" in serialized_files
# Check we can load the seralized model
assert load_archive(out_dir).model | Create model archive for multi-GPU training (#<I>)
* Create model archive for multi-GPU training
* Add test for model archive creation | allenai_allennlp | train | py,py |
d0566d8d7bb5ab2183ec9a5c397e8979c70a7a40 | diff --git a/boolean/test_boolean.py b/boolean/test_boolean.py
index <HASH>..<HASH> 100644
--- a/boolean/test_boolean.py
+++ b/boolean/test_boolean.py
@@ -1025,6 +1025,16 @@ class OtherTestCase(unittest.TestCase):
exp = alg.parse('a and b or a and c')
assert set([alg.Symbol('a'), alg.Symbol('b'), alg.Symbol('c')]) == exp.literals
+ def test_literals_and_negation(self):
+ alg = BooleanAlgebra()
+ exp = alg.parse('a and not b and not not c')
+ assert set([alg.Symbol('a'), alg.parse('not b'), alg.parse('not c')]) == exp.literals
+
+ def test_symbols_and_negation(self):
+ alg = BooleanAlgebra()
+ exp = alg.parse('a and not b and not not c')
+ assert set([alg.Symbol('a'), alg.Symbol('b'), alg.Symbol('c')]) == exp.symbols
+
def test_objects_return_set_of_unique_Symbol_objs(self):
alg = BooleanAlgebra()
exp = alg.parse('a and b or a and c') | Add literals/symbols+negation tests | bastikr_boolean.py | train | py |
95342dfaadd6e90cc8924a8c695f012c48d95b8b | diff --git a/plugin/kubernetes/setup.go b/plugin/kubernetes/setup.go
index <HASH>..<HASH> 100644
--- a/plugin/kubernetes/setup.go
+++ b/plugin/kubernetes/setup.go
@@ -2,7 +2,9 @@ package kubernetes
import (
"errors"
+ "flag"
"fmt"
+ "os"
"strconv"
"strings"
"time"
@@ -19,6 +21,13 @@ import (
)
func init() {
+ // Kubernetes plugin uses the kubernetes library, which uses glog (ugh), we must set this *flag*,
+ // so we don't log to the filesystem, which can fill up and crash CoreDNS indirectly by calling os.Exit().
+ // We also set: os.Stderr = os.Stdout in the setup function below so we output to standard out; as we do for
+ // all CoreDNS logging. We can't do *that* in the init function, because we, when starting, also barf some
+ // things to stderr.
+ flag.Set("logtostderr", "true")
+
caddy.RegisterPlugin("kubernetes", caddy.Plugin{
ServerType: "dns",
Action: setup,
@@ -26,6 +35,9 @@ func init() {
}
func setup(c *caddy.Controller) error {
+ // See comment in the init function.
+ os.Stderr = os.Stdout
+
k, err := kubernetesParse(c)
if err != nil {
return plugin.Error("kubernetes", err) | plugin/kubernetes: make glog log to standard output (#<I>)
Jump through all the hoops to make this work. | coredns_coredns | train | go |
3d7a71889d5f9a50452f778e467cc9d1a4f0cd05 | diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go
index <HASH>..<HASH> 100644
--- a/cmd/telegraf/telegraf.go
+++ b/cmd/telegraf/telegraf.go
@@ -103,7 +103,7 @@ func reloadLoop(
}()
err := runAgent(ctx, inputFilters, outputFilters)
- if err != nil {
+ if err != nil && err != context.Canceled {
log.Fatalf("E! [telegraf] Error running agent: %v", err)
}
} | Ignore context canceled error when reloading/stopping agent | influxdata_telegraf | train | go |
09e9fd745ce1b58e2ede37e01f2f93c8e40772c2 | diff --git a/cmd/update-main.go b/cmd/update-main.go
index <HASH>..<HASH> 100644
--- a/cmd/update-main.go
+++ b/cmd/update-main.go
@@ -155,6 +155,10 @@ func downloadReleaseData(releaseChecksumURL string, timeout time.Duration) (data
client := &http.Client{
Timeout: timeout,
+ Transport: &http.Transport{
+ // need to close connection after usage.
+ DisableKeepAlives: true,
+ },
}
resp, err := client.Do(req)
@@ -164,6 +168,7 @@ func downloadReleaseData(releaseChecksumURL string, timeout time.Duration) (data
if resp == nil {
return data, fmt.Errorf("No response from server to download URL %s", releaseChecksumURL)
}
+ defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return data, fmt.Errorf("Error downloading URL %s. Response: %v", releaseChecksumURL, resp.Status) | Close client connection after checking for release update (#<I>) | minio_minio | train | go |
74bd0804c50a78ce5226669b1779f5a386f4315b | diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index <HASH>..<HASH> 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -188,7 +188,7 @@ class Configuration implements ConfigurationInterface
// we use the parent directory name in addition to the filename to
// determine the name of the driver (e.g. doctrine/orm)
- $validDrivers[] = substr($file->getPathname(), 1 + strlen($driverDir), -4);
+ $validDrivers[] = str_replace('\\','/',substr($file->getPathname(), 1 + strlen($driverDir), -4));
}
$node | Windows path compatibility:
Updated driver detection to work with Windows file paths, which have "\" instead of "/". | Sylius_SyliusResourceBundle | train | php |
f5efac7b85d4894f2596044e1ded6389f1d50c42 | diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php
index <HASH>..<HASH> 100644
--- a/mod/quiz/mod_form.php
+++ b/mod/quiz/mod_form.php
@@ -23,10 +23,10 @@ class mod_quiz_mod_form extends moodleform_mod {
//-------------------------------------------------------------------------------
$mform->addElement('header', 'timinghdr', get_string('timing', 'form'));
- $mform->addElement('date_selector', 'timeopen', get_string("quizopen", "quiz"), array('optional'=>true));
+ $mform->addElement('date_time_selector', 'timeopen', get_string("quizopen", "quiz"), array('optional'=>true));
$mform->setHelpButton('timeopen', array('timeopen', get_string('quizopens', 'quiz'), 'quiz'));
- $mform->addElement('date_selector', 'timeclose', get_string("quizcloses", "quiz"), array('optional'=>true));
+ $mform->addElement('date_time_selector', 'timeclose', get_string("quizcloses", "quiz"), array('optional'=>true));
$mform->setHelpButton('timeclose', array('timeopen', get_string('quizcloses', 'quiz'), 'quiz')); | fixes (MDL-<I>) Quiz start and close times should allow the teacher to select a time as well as a date. | moodle_moodle | train | php |
c3bc6fe7f7da78d600edb89aa94ea48184b4217a | diff --git a/openquake/hazardlib/geo/utils.py b/openquake/hazardlib/geo/utils.py
index <HASH>..<HASH> 100644
--- a/openquake/hazardlib/geo/utils.py
+++ b/openquake/hazardlib/geo/utils.py
@@ -585,10 +585,10 @@ def cartesian_to_spherical(vectors):
"""
rr = numpy.sqrt(numpy.sum(vectors * vectors, axis=-1))
xx, yy, zz = vectors.T
- lats = numpy.degrees(numpy.arcsin((zz / rr).clip(-1., 1.)))
+ lats = numpy.degrees(numpy.arcsin(numpy.clip(zz / rr, -1., 1.)))
lons = numpy.degrees(numpy.arctan2(yy, xx))
depths = EARTH_RADIUS - rr
- return lons.T, lats.T, depths
+ return lons.T, lats.T, depths.T
def triangle_area(e1, e2, e3): | Fixed misprint in cartesian_to_spherical | gem_oq-engine | train | py |
5621ed6dcc9c43a1c0d3eaf79d205a85b869a519 | diff --git a/src/rinoh/frontend/__init__.py b/src/rinoh/frontend/__init__.py
index <HASH>..<HASH> 100644
--- a/src/rinoh/frontend/__init__.py
+++ b/src/rinoh/frontend/__init__.py
@@ -22,7 +22,12 @@ class TreeNode(object):
@classmethod
def map_node(cls, node):
- return cls._mapping[cls.node_tag_name(node).replace('-', '_')](node)
+ node_name = cls.node_tag_name(node)
+ try:
+ return cls._mapping[node_name.replace('-', '_')](node)
+ except KeyError:
+ raise NotImplementedError("The '{}' node is not yet supported ({})"
+ .format(node_name, cls.__module__))
def __init__(self, doctree_node):
self.node = doctree_node | A more descriptive exception when a node is not mapped | brechtm_rinohtype | train | py |
9be1c5dd6532fa6f0d6c4ad87ca3a648f1296ada | diff --git a/src/main/java/org/efaps/ui/wicket/components/menu/DropDownMenuPanel.java b/src/main/java/org/efaps/ui/wicket/components/menu/DropDownMenuPanel.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/efaps/ui/wicket/components/menu/DropDownMenuPanel.java
+++ b/src/main/java/org/efaps/ui/wicket/components/menu/DropDownMenuPanel.java
@@ -72,12 +72,9 @@ public class DropDownMenuPanel
Component item = null;
if (childItem.getReference() != null) {
childItem.setURL(childItem.getReference());
- if (childItem.getReference().equals(
- "/" + getSession().getApplication().getApplicationKey() + "/taskadmin?")) {
+ if (childItem.getReference().endsWith("/taskadmin")) {
item = new TaskAdminItem(_idGenerator.newChildId(), Model.of(childItem));
- }
- if (childItem.getReference().equals(
- "/" + getSession().getApplication().getApplicationKey() + "/connection?")) {
+ } else if (childItem.getReference().endsWith("/connection")) {
item = new ConnectionItem(_idGenerator.newChildId(), Model.of(childItem));
}
} | - Issue #<I>: Add a new GridPage | eFaps_eFaps-WebApp | train | java |
6a1cc15b39aceb0474ed7f6d3a740411e1387272 | diff --git a/lib/snaptoken/commands/diff.rb b/lib/snaptoken/commands/diff.rb
index <HASH>..<HASH> 100644
--- a/lib/snaptoken/commands/diff.rb
+++ b/lib/snaptoken/commands/diff.rb
@@ -46,7 +46,7 @@ class Snaptoken::Commands::Diff < Snaptoken::Commands::BaseCommand
patch = patches.map(&:to_s).join("\n")
patch.gsub!(/^ /, "|")
- output << "~~~\n\n"
+ output << "~~~\n\n" unless output.empty?
output << commit_message << "\n\n" unless commit_message.empty?
output << patch << "\n" unless patches.empty?
end | Don't render initial '~~~' in .leg files | snaptoken_leg | train | rb |
02faf978349fb6ebec8e8be4fe2bb88dc84bec2e | diff --git a/internal/service/dms/endpoint.go b/internal/service/dms/endpoint.go
index <HASH>..<HASH> 100644
--- a/internal/service/dms/endpoint.go
+++ b/internal/service/dms/endpoint.go
@@ -369,7 +369,7 @@ func ResourceEndpoint() *schema.Resource {
},
"ssl_security_protocol": {
Type: schema.TypeString,
- Required: true,
+ Optional: true,
ValidateFunc: validation.StringInSlice(dms.SslSecurityProtocolValue_Values(), false),
},
}, | r/aws_dms_endpoint: 'redis_settings.ssl_security_protocol' is Optional. | terraform-providers_terraform-provider-aws | train | go |
99113f08bcc582674e80545daf54dd92798a450b | diff --git a/slack/rtm/client.py b/slack/rtm/client.py
index <HASH>..<HASH> 100644
--- a/slack/rtm/client.py
+++ b/slack/rtm/client.py
@@ -141,6 +141,7 @@ class RTMClient(object):
def decorator(callback):
RTMClient.on(event=event, callback=callback)
+ return callback
return decorator
diff --git a/tests/rtm/test_rtm_client.py b/tests/rtm/test_rtm_client.py
index <HASH>..<HASH> 100644
--- a/tests/rtm/test_rtm_client.py
+++ b/tests/rtm/test_rtm_client.py
@@ -17,6 +17,14 @@ class TestRTMClient(unittest.TestCase):
def tearDown(self):
slack.RTMClient._callbacks = collections.defaultdict(list)
+ def test_run_on_returns_callback(self):
+ @slack.RTMClient.run_on(event="message")
+ def fn_used_elsewhere(**_unused_payload):
+ pass
+
+ self.assertIsNotNone(fn_used_elsewhere)
+ self.assertEqual(fn_used_elsewhere.__name__, "fn_used_elsewhere")
+
def test_run_on_annotation_sets_callbacks(self):
@slack.RTMClient.run_on(event="message")
def say_run_on(**payload): | Return callback from `RTMClient.run_on` (#<I>)
* Return callback from `RTMClient.run_on`
* Tidy up test
* Change param name to snake_case
Names are important 😄 | slackapi_python-slackclient | train | py,py |
fce9e16312577ed4e82d92bbc79ab202ec24b3ba | diff --git a/claripy/backends/backend_z3.py b/claripy/backends/backend_z3.py
index <HASH>..<HASH> 100644
--- a/claripy/backends/backend_z3.py
+++ b/claripy/backends/backend_z3.py
@@ -118,6 +118,17 @@ class BackendZ3(SolverBackend):
symbolic |= s
variables |= v
+ # fix up many-arg __add__
+ if op_name == '__add__' and len(args) > 2:
+ many_args = args
+ last = args[-1]
+ rest = args[:-1]
+
+ a = A(op_name, rest[:2])
+ for b in rest[2:]:
+ a = A(op_name, [a,b])
+ args = [ a, last ]
+
return A(op_name, args), variables, symbolic, z3.Z3_get_bv_sort_size(ctx, z3_sort) if z3.Z3_get_sort_kind(ctx, z3_sort) == z3.Z3_BV_SORT else -1
def solver(self, timeout=None): | re-implement multi-arg __add__ support | angr_claripy | train | py |
4791115949145719ad812909f341969f2bd31884 | diff --git a/init.php b/init.php
index <HASH>..<HASH> 100644
--- a/init.php
+++ b/init.php
@@ -8,6 +8,7 @@ Author: Pods Framework Team
Author URI: https://pods.io/about/
Text Domain: pods
GitHub Plugin URI: https://github.com/pods-framework/pods
+Primary Branch: main
Copyright 2009-2019 Pods Foundation, Inc (email : contact@podsfoundation.org) | Add Primary Branch header for GitHub Updater
Since Pods' primary branch is now `main` in order for GitHub Updater to properly work the `Primary Branch` header needs to be added. | pods-framework_pods | train | php |
e316707061f2b1c9d1bb1b00bd30dd56391270be | diff --git a/rfhub/kwdb.py b/rfhub/kwdb.py
index <HASH>..<HASH> 100644
--- a/rfhub/kwdb.py
+++ b/rfhub/kwdb.py
@@ -14,6 +14,7 @@ import logging
import json
import re
import sys
+from operator import itemgetter
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
@@ -434,7 +435,7 @@ class KeywordTable(object):
cursor = self._execute(sql, (pattern,))
result = [(row[0], row[1], row[2], row[3], row[4])
for row in cursor.fetchall()]
- return list(set(result))
+ return list(sorted(result, key=itemgetter(2)))
def reset(self):
"""Remove all data from the database, but leave the tables intact""" | Fixed that random test failure:
Test, 'Verify that a query returns keyword documentation'
could randomly fail with 'Documentation for Keyword #2 != Documentation
for Keyword #1' as set() did not preserve the order
of the original list returned by the database query. | boakley_robotframework-hub | train | py |
30f1d079312b3ceb3f5e7e483c3f874e04f3df79 | diff --git a/lib/mws-rb/api/feeds.rb b/lib/mws-rb/api/feeds.rb
index <HASH>..<HASH> 100644
--- a/lib/mws-rb/api/feeds.rb
+++ b/lib/mws-rb/api/feeds.rb
@@ -18,7 +18,7 @@ module MWS
params = params.except(:merchant_id, :message_type, :message, :messages, :skip_schema_validation)
call(:submit_feed, params.merge!(
request_params: {
- format: "xml",
+ format: :xml,
headers: {
"Content-MD5" => xml_envelope.md5
}, | Fix format option used in the submit_feed method | veeqo_mws-rb | train | rb |
7d4d5cb918076f623978c0c1fd59d427531e2994 | diff --git a/mod/quiz/report/reportlib.php b/mod/quiz/report/reportlib.php
index <HASH>..<HASH> 100644
--- a/mod/quiz/report/reportlib.php
+++ b/mod/quiz/report/reportlib.php
@@ -99,7 +99,9 @@ function quiz_report_qm_filter_subselect($quiz){
break;
}
if ($qmfilterattempts){
- $qmsubselect = "(SELECT id FROM {$CFG->prefix}quiz_attempts WHERE u.id = userid ORDER BY $qmorderby LIMIT 1)=qa.id";
+ $qmsubselect = "(SELECT id FROM {$CFG->prefix}quiz_attempts " .
+ "WHERE quiz = {$quiz->id} AND u.id = userid " .
+ "ORDER BY $qmorderby LIMIT 1)=qa.id";
} else {
$qmsubselect = '';
}
@@ -134,4 +136,4 @@ function quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter)
('<span class="highlight">'.quiz_get_grading_option_name($quiz->grademethod).'</span>'))."</p>";
}
}
-?>
\ No newline at end of file
+?> | MDL-<I> "Quiz Report: the quiz report do not find the first attempt" needed to include quiz id in WHERE conditions.
merged from <I> branch. | moodle_moodle | train | php |
7e4824a01d38414986dc145ba251752468067e28 | diff --git a/pilbox/image.py b/pilbox/image.py
index <HASH>..<HASH> 100644
--- a/pilbox/image.py
+++ b/pilbox/image.py
@@ -465,7 +465,7 @@ def main():
metavar="|".join(Image.POSITIONS), type=str)
define("filter", help="default filter to use when resizing",
metavar="|".join(Image.FILTERS), type=str)
- define("degree", help="the desired rotation degree", type=int)
+ define("degree", help="the desired rotation degree", type=str)
define("expand", help="expand image size to accomodate rotation", type=int)
define("rect", help="rectangle: x,y,w,h", type=str)
define("format", help="default format to use when saving", | Allow degree=auto for image command line | agschwender_pilbox | train | py |
4596c1a31902806a15c970a0e210942912b139b6 | diff --git a/activesupport/lib/active_support/file_evented_update_checker.rb b/activesupport/lib/active_support/file_evented_update_checker.rb
index <HASH>..<HASH> 100644
--- a/activesupport/lib/active_support/file_evented_update_checker.rb
+++ b/activesupport/lib/active_support/file_evented_update_checker.rb
@@ -31,9 +31,8 @@ module ActiveSupport
end
def execute
- @block.call
- ensure
@updated.make_false
+ @block.call
end
def execute_if_updated | reset the @updated flag before the callback invocation | rails_rails | train | rb |
a2176b91e720ec1fae49c271a0f2f6790554fe2b | diff --git a/util/Factory.js b/util/Factory.js
index <HASH>..<HASH> 100644
--- a/util/Factory.js
+++ b/util/Factory.js
@@ -1,31 +1,21 @@
-'use strict';
-
import Registry from './Registry'
/*
- * Simple factory implementation.
- *
- * @class Factory
- * @extends Registry
- * @memberof module:util
- */
-function Factory() {
- Factory.super.call(this);
-}
-
-Factory.Prototype = function() {
+ Simple factory implementation.
+ @class Factory
+ @extends Registry
+*/
+class Factory extends Registry {
/**
- * Create an instance of the clazz with a given name.
- *
- * @param {String} name
- * @return A new instance.
- * @method create
- * @memberof module:Basics.Factory.prototype
- */
- this.create = function ( name ) {
+ Create an instance of the clazz with a given name.
+
+ @param {String} name
+ @return A new instance.
+ */
+ create(name) {
var clazz = this.get(name);
- if ( !clazz ) {
+ if (!clazz) {
throw new Error( 'No class registered by that name: ' + name );
}
// call the clazz providing the remaining arguments
@@ -33,10 +23,7 @@ Factory.Prototype = function() {
var obj = Object.create( clazz.prototype );
clazz.apply( obj, args );
return obj;
- };
-
-};
-
-Registry.extend(Factory);
+ }
+}
export default Factory; | Convert Factory to ES6. | substance_substance | train | js |
2a01daafa8c446cf640661e934285bfd9b8d9050 | diff --git a/controller/Reporting.php b/controller/Reporting.php
index <HASH>..<HASH> 100644
--- a/controller/Reporting.php
+++ b/controller/Reporting.php
@@ -85,8 +85,8 @@ class Reporting extends ProctoringModule
if (count($sessions) > 1) {
$title = __('Detailed Session History of a selection');
} else {
- $session = new \core_kernel_classes_Resource($sessions[0]);
- $title = __('Detailed Session History of %s', $session->getLabel());
+ $deliveryExecution = \taoDelivery_models_classes_execution_ServiceProxy::singleton()->getDeliveryExecution($sessions[0]);
+ $title = __('Detailed Session History of %s', $deliveryExecution->getLabel());
}
$this->setData('title', $title); | fix issue for non ontology delivery executions | oat-sa_extension-tao-proctoring | train | php |
13f43fe5d5e468fef508c390912c715f02a51839 | diff --git a/ez_setup.py b/ez_setup.py
index <HASH>..<HASH> 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -115,8 +115,8 @@ def _do_download(version, download_base, to_dir, download_delay):
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, download_delay=15):
to_dir = os.path.abspath(to_dir)
- was_imported = 'pkg_resources' in sys.modules or \
- 'setuptools' in sys.modules
+ rep_modules = 'pkg_resources', 'setuptools'
+ imported = set(sys.modules).intersection(rep_modules)
try:
import pkg_resources
except ImportError:
@@ -127,7 +127,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
except pkg_resources.DistributionNotFound:
return _do_download(version, download_base, to_dir, download_delay)
except pkg_resources.VersionConflict as VC_err:
- if was_imported:
+ if imported:
msg = textwrap.dedent("""
The required version of setuptools (>={version}) is not available,
and can't be installed while this script is running. Please | Use sets to determine presence of imported modules. | pypa_setuptools | train | py |
940d071b79505b9764e8cd287386afdbe11abe15 | diff --git a/Logger/Logger.php b/Logger/Logger.php
index <HASH>..<HASH> 100644
--- a/Logger/Logger.php
+++ b/Logger/Logger.php
@@ -63,6 +63,6 @@ class Logger implements LoggerInterface
}
});
- $this->logger->info($this->prefix.json_encode($query));
+ $this->logger->debug($this->prefix.json_encode($query));
}
} | changed query logging to debug instead of info | doctrine_DoctrineMongoDBBundle | train | php |
61180a166fc77fbbee013a55eb049fc33fe36816 | diff --git a/dist/RegularList.js b/dist/RegularList.js
index <HASH>..<HASH> 100644
--- a/dist/RegularList.js
+++ b/dist/RegularList.js
@@ -36,6 +36,9 @@ var RegularList = function (_List) {
}
_createClass(RegularList, [{
+ key: 'componentWillReceiveProps',
+ value: function componentWillReceiveProps() {}
+ }, {
key: 'render',
value: function render() {
var _this2 = this;
diff --git a/lib/RegularList.js b/lib/RegularList.js
index <HASH>..<HASH> 100644
--- a/lib/RegularList.js
+++ b/lib/RegularList.js
@@ -3,6 +3,10 @@ import React, { PropTypes } from 'react';
import _ from 'lodash';
class RegularList extends List {
+ componentWillReceiveProps() {
+
+ }
+
render() {
const data = this.checkForModificationsAndReturnModifiedData(this.props.data);
const style = { | fix: do not check data for regular list | poetic_react-super-components | train | js,js |
ed36d58cdf52835eabaa4801a5028c05c202fb0d | diff --git a/robots/__init__.py b/robots/__init__.py
index <HASH>..<HASH> 100644
--- a/robots/__init__.py
+++ b/robots/__init__.py
@@ -1 +1 @@
-__version__ = "1.2rc1"
+__version__ = "2.0rc1" | This is really <I> kind of release | jazzband_django-robots | train | py |
08e53b317f46baf24f2b199d68b61c1186587f4d | diff --git a/salt/modules/saltutil.py b/salt/modules/saltutil.py
index <HASH>..<HASH> 100644
--- a/salt/modules/saltutil.py
+++ b/salt/modules/saltutil.py
@@ -513,6 +513,7 @@ def sync_all(saltenv=None, refresh=True):
ret['output'] = sync_output(saltenv, False)
ret['utils'] = sync_utils(saltenv, False)
ret['log_handlers'] = sync_log_handlers(saltenv, False)
+ ret['proxymodules'] = sync_proxymodules(saltenv, False)
if refresh:
refresh_modules()
return ret | Sync proxymodules with sync_all | saltstack_salt | train | py |
2bde1bd753831ca53677cfe012303c9224a3c012 | diff --git a/server/server.go b/server/server.go
index <HASH>..<HASH> 100644
--- a/server/server.go
+++ b/server/server.go
@@ -945,15 +945,15 @@ func (s *Server) serveLoop(srv *http.Server) error {
// updates. We want to keep the listening socket open as long as there are
// incoming requests (but no longer than 1 min).
//
-// Effective only for servers that serve >0.2 QPS in a steady state.
+// Effective only for servers that serve >0.1 QPS in a steady state.
func (s *Server) waitUntilNotServing() {
logging.Infof(s.Context, "Received SIGTERM, waiting for the traffic to stop...")
deadline := clock.Now(s.Context).Add(time.Minute)
for {
now := clock.Now(s.Context)
lastReq, ok := s.lastReqTime.Load().(time.Time)
- if !ok || now.Sub(lastReq) > 5*time.Second {
- logging.Infof(s.Context, "No requests in last 5 sec, proceeding with the shutdown...")
+ if !ok || now.Sub(lastReq) > 15*time.Second {
+ logging.Infof(s.Context, "No requests in the last 15 sec, proceeding with the shutdown...")
break
}
if now.After(deadline) { | [server] Wait longer for traffic to stop when shutting down.
Looks like 5 sec is not enough when using Envoy STRICT_DNS discovery
type with default DNS polling frequency (which is also accidentally
5 sec).
R=<EMAIL>
Change-Id: I2e<I>c0be5d<I>bf<I>dc<I>a<I>ec<I>
Reviewed-on: <URL> | luci_luci-go | train | go |
012b2502f2587c91b8e7dc68656a91fc95dda9ba | diff --git a/server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java b/server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java
index <HASH>..<HASH> 100644
--- a/server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java
+++ b/server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java
@@ -670,6 +670,13 @@ public class GatewayContextResolver {
}
serviceRegistry.register(acceptURI, serviceContext);
}
+
+ // check for query in each connectURI
+ for (URI connectURI : connectURIs) {
+ if (connectURI.getQuery() != null) {
+ throw new IllegalArgumentException("Query parameters are not allowed in connect");
+ }
+ }
}
for (ServiceContext ctxt : serviceContexts) { | Implemented check for query parameters in connect at gateway startup | kaazing_gateway | train | java |
d471ab09efa21d9f6e5408adfb8c2dadc607c897 | diff --git a/github.js b/github.js
index <HASH>..<HASH> 100644
--- a/github.js
+++ b/github.js
@@ -80,6 +80,8 @@
// -------
this.show = function(username, cb) {
+ var command = username ? "/users/"+username : "/user";
+
_request("GET", "/users/"+username, null, function(err, res) {
cb(err, res);
}); | added ability to get current users info
Added ability to get current users info without asking his name as like
this done here <URL> | github-tools_github | train | js |
168e096eb6969eb94594832786817c90a4df0264 | diff --git a/finagle-thrift/src/main/ruby/lib/finagle-thrift/tracer.rb b/finagle-thrift/src/main/ruby/lib/finagle-thrift/tracer.rb
index <HASH>..<HASH> 100644
--- a/finagle-thrift/src/main/ruby/lib/finagle-thrift/tracer.rb
+++ b/finagle-thrift/src/main/ruby/lib/finagle-thrift/tracer.rb
@@ -181,8 +181,14 @@ module Trace
DOUBLE = "DOUBLE"
STRING = "STRING"
- def self.to_thrift(v)
- FinagleThrift::AnnotationType::VALUE_MAP.index(v)
+ if {}.respond_to?(:key)
+ def self.to_thrift(v)
+ FinagleThrift::AnnotationType::VALUE_MAP.key(v)
+ end
+ else
+ def self.to_thrift(v)
+ FinagleThrift::AnnotationType::VALUE_MAP.index(v)
+ end
end
end
@@ -245,4 +251,4 @@ module Trace
end
end
-end
\ No newline at end of file
+end | [split] finagle-thrift gem: Hash#index is deprecated in Ruby <I>
RB_ID=<I> | twitter_finagle | train | rb |
0027ada2e61252ea3c00946c20ae2e7842e8d1d1 | diff --git a/tests/test_JFS.py b/tests/test_JFS.py
index <HASH>..<HASH> 100644
--- a/tests/test_JFS.py
+++ b/tests/test_JFS.py
@@ -633,6 +633,11 @@ class TestJFSFolder:
assert all(isinstance(item, JFS.JFSFile) for item in dev.files())
assert all(isinstance(item, JFS.JFSFolder) for item in dev.folders())
+
+ @pytest.mark.xfail # TODO: restore this when bug #74 is squashed
+ def test_delete_and_restore():
+ # testing jottacloud delete and restore
+ dev = jfs.getObject('/Jotta/Sync')
newf = dev.mkdir('testdir')
assert isinstance(newf, JFS.JFSFolder)
oldf = newf.delete() | separate JFSFolder tests, and excpect restore tests to fail, waiting on #<I> | havardgulldahl_jottalib | train | py |
bfc8129737a6c0b38558a97f0edd102af7083081 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -4,12 +4,12 @@ from setuptools import find_packages
setup(
name='django-db-pool',
- version='0.0.5',
+ version='0.0.6',
author=u'Greg McGuire',
author_email='gregjmcguire+github@gmail.com',
packages=find_packages(),
url='https://github.com/gmcguire/django-db-pool',
- license='BSD licence, see LICENCE',
+ license='BSD licence, see LICENSE',
description='Basic database persistance / connection pooling for Django + ' + \
'Postgres.',
long_description=open('README.md').read(),
@@ -25,7 +25,7 @@ setup(
],
zip_safe=False,
install_requires=[
- "Django>=1.3,<1.3.99",
+ "Django>=1.3,<1.4.99",
"psycopg2>=2.4",
],
) | Django <I> support | gmcguire_django-db-pool | train | py |
7d97858436c64b0358adc6e768b8c659f8baf0f8 | diff --git a/lib/yaml/symbolmatrix.rb b/lib/yaml/symbolmatrix.rb
index <HASH>..<HASH> 100644
--- a/lib/yaml/symbolmatrix.rb
+++ b/lib/yaml/symbolmatrix.rb
@@ -14,23 +14,22 @@ module YAML
# Can I override initialize and call super anyways??
def initialize argument = nil
- if argument.nil?
- super
- else
- if argument.is_a? String
- if File.exist? argument
- from_file argument
- else
- from_yaml argument
- end
- else
- super argument
- end
- end
end
end
end
class SymbolMatrix
include YAML::SymbolMatrix
+
+ def initialize argument = nil
+ if argument.is_a? String
+ if File.exist? argument
+ from_file argument
+ else
+ from_yaml argument
+ end
+ else
+ merge! argument unless argument.nil?
+ end
+ end
end | <I>.x compatibility | Fetcher_symbolmatrix | train | rb |
437cf8b2b81cf05496928d9518cc665174eafc7f | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -46,7 +46,7 @@ Pager.prototype.set = function (i, buf) {
var page = this.pages[i]
- if (page) page.buffer = buf
+ if (page) page.buffer = truncate(buf, this.pageSize)
else page = this.pages[i] = new Page(i, buf)
}
@@ -70,6 +70,14 @@ function grow (list, index, len) {
return twice
}
+function truncate (buf, len) {
+ if (buf.length === len) return len
+ if (buf.length > len) return buf.slice(0, len)
+ var cpy = alloc(len)
+ buf.copy(cpy)
+ return cpy
+}
+
function alloc (size) {
if (Buffer.alloc) return Buffer.alloc(size)
var buf = new Buffer(size) | make sure page sizes are correct on set | mafintosh_memory-pager | train | js |
b90dfd81d292ca4448eceab64d401a6c90cd970e | diff --git a/invenio_records_rest/schemas/json.py b/invenio_records_rest/schemas/json.py
index <HASH>..<HASH> 100644
--- a/invenio_records_rest/schemas/json.py
+++ b/invenio_records_rest/schemas/json.py
@@ -82,8 +82,8 @@ class RecordMetadataSchemaJSONV1(OriginalKeysMixin):
@post_load()
def inject_pid(self, data):
"""Inject context PID in the RECID field."""
- # Use the already deserialized "pid" field
- pid_value = data.get('pid')
+ # Remove already deserialized "pid" field
+ pid_value = data.pop('pid', None)
if pid_value:
pid_field = current_app.config['PIDSTORE_RECID_FIELD']
data.setdefault(pid_field, pid_value) | marshmallow: delete duplicated pid field
* Delete duplicated pid field from the loaded data since the ``pid``
field in the ``PersistentIdentifier`` object is a ``Generated``
field and therefore, it should not exists per se. | inveniosoftware_invenio-records-rest | train | py |
8e4fd681bdad94fdec15a57f56a3514988336765 | diff --git a/SwatDB/SwatDB.php b/SwatDB/SwatDB.php
index <HASH>..<HASH> 100644
--- a/SwatDB/SwatDB.php
+++ b/SwatDB/SwatDB.php
@@ -478,6 +478,9 @@ class SwatDB extends SwatObject
$value_field = new SwatDBField($value_field, 'integer');
$bound_field = new SwatDBField($bound_field, 'integer');
+ // define here to prevent notice in debug statement
+ $insert_sql = '';
+
$delete_sql = 'delete from %s where %s = %s';
$delete_sql = sprintf($delete_sql, | Fix a PHP notice.
svn commit r<I> | silverorange_swat | train | php |
8ccb46a521964ab80490318504d6e02ae766a912 | diff --git a/client/request.go b/client/request.go
index <HASH>..<HASH> 100644
--- a/client/request.go
+++ b/client/request.go
@@ -134,8 +134,7 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
// Don't decorate context sentinel errors; users may be comparing to
// them directly.
- switch err {
- case context.Canceled, context.DeadlineExceeded:
+ if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
return serverResp, err
} | Check for context error that is wrapped in url.Error | moby_moby | train | go |
4740d43e939ceb174269cf53ec10296c5a6339b8 | diff --git a/Swat/SwatTimeZoneEntry.php b/Swat/SwatTimeZoneEntry.php
index <HASH>..<HASH> 100644
--- a/Swat/SwatTimeZoneEntry.php
+++ b/Swat/SwatTimeZoneEntry.php
@@ -135,7 +135,7 @@ class SwatTimeZoneEntry extends SwatInputControl implements SwatState
} elseif ($this->value === null) {
$message = Swat::_('The %s field is required.');
$this->addMessage(new SwatMessage($message, SwatMessage::ERROR));
- } elseif (!array_key_exists($this->value, $tz_data)) {
+ } elseif (!in_array($this->value, $tz_data)) {
$message = Swat::_('The %s field is an invalid time-zone.');
$this->addMessage(new SwatMessage($message, SwatMessage::ERROR));
} | The TZ IDs are the values, not the keys.
svn commit r<I> | silverorange_swat | train | php |
49a1155ba5d77f8a69b8cdad8c48b8ebb294f26e | diff --git a/Manager/FacebookClientManager.php b/Manager/FacebookClientManager.php
index <HASH>..<HASH> 100644
--- a/Manager/FacebookClientManager.php
+++ b/Manager/FacebookClientManager.php
@@ -13,7 +13,7 @@
namespace WellCommerce\Bundle\OAuthBundle\Manager;
use League\OAuth2\Client\Provider\FacebookUser;
-use WellCommerce\Bundle\ClientBundle\Entity\Client;
+use WellCommerce\Bundle\AppBundle\Entity\Client;
use WellCommerce\Bundle\CoreBundle\Helper\Helper;
use WellCommerce\Bundle\CoreBundle\Manager\AbstractManager; | Moved ClientBundle to AppBundle | WellCommerce_WishlistBundle | train | php |
37c820ed58d625408e6de04461ec4009d40b2e34 | diff --git a/hearthstone/enums.py b/hearthstone/enums.py
index <HASH>..<HASH> 100644
--- a/hearthstone/enums.py
+++ b/hearthstone/enums.py
@@ -580,7 +580,7 @@ class GameTag(IntEnum):
LETTUCE_HAS_MANUALLY_SELECTED_ABILITY = 1967
LETTUCE_KEEP_LAST_STANDING_MINION_ACTOR = 1976
GOLDSPARKLES_HINT = 1984
- LETTUCE_USE_DETERMINISTIC_TEAM_ABILITY_QUEUEING = 1990
+ LETTUCE_USE_DETERMINISTIC_TEAM_ABILITY_QUEUING = 1990
QUESTLINE_FINAL_REWARD_DATABASE_ID = 1992
QUESTLINE_PART = 1993
QUESTLINE_REQUIREMENT_MET_1 = 1994 | Fix LETTUCE_USE_DETERMINISTIC_TEAM_ABILITY_QUEUING to use typo from client | HearthSim_python-hearthstone | train | py |
fea7e3c71fac6530ada2dee538d6b4e717b2f0b9 | diff --git a/lib/feed2email/cli.rb b/lib/feed2email/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/feed2email/cli.rb
+++ b/lib/feed2email/cli.rb
@@ -40,7 +40,7 @@ module Feed2Email
desc 'history FEED', 'edit history file of feed at index FEED with $EDITOR'
def history(index)
- if ENV['EDITOR'].nil?
+ if ENV['EDITOR'].blank?
$stderr.puts '$EDITOR not set'
exit 6
end
diff --git a/lib/feed2email/core_ext.rb b/lib/feed2email/core_ext.rb
index <HASH>..<HASH> 100644
--- a/lib/feed2email/core_ext.rb
+++ b/lib/feed2email/core_ext.rb
@@ -9,6 +9,10 @@ class Numeric
end
class String
+ def blank?
+ nil? || empty?
+ end
+
def escape_html
CGI.escapeHTML(self)
end | Check for empty $EDITOR in history command | agorf_feed2email | train | rb,rb |
6c95a4df4ff80722d00dd20b36f99a9600ab9343 | diff --git a/concepts/tools.py b/concepts/tools.py
index <HASH>..<HASH> 100644
--- a/concepts/tools.py
+++ b/concepts/tools.py
@@ -7,7 +7,7 @@ from itertools import permutations, groupby, starmap
from . import _compat
-__all__ = ['Unique', 'max_len', 'maximal', 'lazyproperty']
+__all__ = ['Unique', 'max_len', 'maximal', 'lazyproperty', 'crc32_hex']
class Unique(_compat.MutableSet):
@@ -190,10 +190,10 @@ class lazyproperty(object):
return result
-def crc32_hex(value):
- """
+def crc32_hex(data):
+ """Return unsigned CRC32 of binary data as hex-encoded string.
>>> crc32_hex(b'spam')
'43daff3d'
"""
- return '%x' % (zlib.crc32(value) & 0xffffffff)
+ return '%x' % (zlib.crc32(data) & 0xffffffff) | add crc<I>_hex() docstring and register | xflr6_concepts | train | py |
cd63debcaf4e62e85cffd6b97f089ddaf4d88c75 | diff --git a/src/Controller/Backend/FileManager.php b/src/Controller/Backend/FileManager.php
index <HASH>..<HASH> 100644
--- a/src/Controller/Backend/FileManager.php
+++ b/src/Controller/Backend/FileManager.php
@@ -197,8 +197,8 @@ class FileManager extends BackendBase
$formview = $form->createView();
}
- $files = $filesystem->find()->in($path)->files()->toArray();
- $directories = $filesystem->find()->in($path)->directories()->toArray();
+ $files = $filesystem->find()->in($path)->files()->depth(0)->toArray();
+ $directories = $filesystem->find()->in($path)->directories()->depth(0)->toArray();
}
// Select the correct template to render this. If we've got 'CKEditor' in the title, it's a dialog | Set depth limit on file/directory look up | bolt_bolt | train | php |
e5365ad0949aae1433509bf8dc0e2d518d34ff5a | diff --git a/animal/models.py b/animal/models.py
index <HASH>..<HASH> 100644
--- a/animal/models.py
+++ b/animal/models.py
@@ -37,6 +37,7 @@ GENOTYPE_CHOICES = (
),
('Floxed with Transgene',(
('fl/fl; ?', 'Floxed Undetermined Transgene'),
+ ('fl/+; ?', 'Heterozygous Floxed, Undetermined Transgene'),
('fl/fl; +/+', 'Floxed no Transgene'),
('fl/+; +/+', 'Heterozygous Floxed no Transgene'),
('fl/fl; Tg/+', 'Floxed Heterozygous Transgene'), | added a fl/+, ? genotype | davebridges_mousedb | train | py |
bf987ea5306555633a9d5e761ddf6adf069117fa | diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Foundation/helpers.php
+++ b/src/Illuminate/Foundation/helpers.php
@@ -138,7 +138,7 @@ if (! function_exists('auth')) {
* Get the available auth instance.
*
* @param string|null $guard
- * @return \Illuminate\Contracts\Auth\Factory
+ * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard
*/
function auth($guard = null)
{ | add additional return types to auth() helper docblock (#<I>) | laravel_framework | train | php |
98b6bfbe82b6f5d38ce3956b92dde29b4f843806 | diff --git a/src/main/java/me/prettyprint/cassandra/service/JmxMonitor.java b/src/main/java/me/prettyprint/cassandra/service/JmxMonitor.java
index <HASH>..<HASH> 100644
--- a/src/main/java/me/prettyprint/cassandra/service/JmxMonitor.java
+++ b/src/main/java/me/prettyprint/cassandra/service/JmxMonitor.java
@@ -14,7 +14,6 @@ import javax.management.ObjectName;
import me.prettyprint.cassandra.connection.HConnectionManager;
-import org.apache.log4j.xml.DOMConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | Fix a small messup I did with importing the optional log4j DOMConfigurator, sorry | hector-client_hector | train | java |
b8f41fbda3b0df58955cd3e40604d3ff7e780157 | diff --git a/docs/source/conf.py b/docs/source/conf.py
index <HASH>..<HASH> 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -27,7 +27,7 @@ author = "The Font Bakery Authors"
# The short X.Y version
version = "0.7"
# The full version, including alpha/beta/rc tags
-release = "0.7.28"
+release = "0.7.29"
# -- General configuration ---------------------------------------------------
@@ -192,7 +192,7 @@ def linkcode_resolve(domain, info):
# AND We can link to a tag i.e. a release tag. This is awesome:
# tag is: "v0.7.2"
# https://github.com/googlefonts/fontbakery/tree/v0.7.2/Lib/fontbakery/profiles
- tree = 'v0.7.28'
+ tree = 'v0.7.29'
# It's not planned for us to get the line number :-(
# I had to hammer this data into the info.
if 'lineno' in info: | update version on docs/source/conf.py | googlefonts_fontbakery | train | py |
2f83cd0ab50e67a67b8c3d6dc25a000bd8904e60 | diff --git a/spyder/utils/ipython/spyder_kernel.py b/spyder/utils/ipython/spyder_kernel.py
index <HASH>..<HASH> 100644
--- a/spyder/utils/ipython/spyder_kernel.py
+++ b/spyder/utils/ipython/spyder_kernel.py
@@ -11,6 +11,7 @@ Spyder kernel for Jupyter
# Standard library imports
import os
import os.path as osp
+import pickle
# Third-party imports
from ipykernel.datapub import publish_data
@@ -146,7 +147,16 @@ class SpyderKernel(IPythonKernel):
"""Get the value of a variable"""
ns = self._get_current_namespace()
value = ns[name]
- publish_data({'__spy_data__': value})
+ try:
+ publish_data({'__spy_data__': value})
+ except (pickle.PicklingError, pickle.PickleError):
+ # There is no need to inform users about these
+ # errors because they are the most common ones
+ value = None
+ except Exception as e:
+ value = e
+ finally:
+ publish_data({'__spy_data__': value})
def set_value(self, name, value):
"""Set the value of a variable""" | IPython console: Fix pickling errors on the kernel side | spyder-ide_spyder-kernels | train | py |
6e93db1c019fcd7883b4dc619727de4f64f3e5c1 | diff --git a/test/test_helper.rb b/test/test_helper.rb
index <HASH>..<HASH> 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -43,7 +43,11 @@ class GeokitTestCase < ActiveSupport::TestCase
end
self.fixture_path = (PLUGIN_ROOT + 'test/fixtures').to_s
- self.use_transactional_fixtures = true
+ if Rails::VERSION::MAJOR >= 5
+ self.use_transactional_tests = true
+ else
+ self.use_transactional_fixtures = true
+ end
self.use_instantiated_fixtures = false
fixtures :all | Rails 5 has renamed `use_transactional_fixtures` into `use_transactional_tests`
cf <URL> | geokit_geokit-rails | train | rb |
2a416fa088917cd777777ebe6c9a580ca9893614 | diff --git a/src/components/TextArea/index.js b/src/components/TextArea/index.js
index <HASH>..<HASH> 100644
--- a/src/components/TextArea/index.js
+++ b/src/components/TextArea/index.js
@@ -128,7 +128,7 @@ export default class TextArea extends React.PureComponent<Props, State> {
hasValue={this.props.value.length > 0}
isFocused={this.state.isFocused}
disabled={this.props.disabled}
- hasError={this.props.error.length > 0}
+ hasError={this.props.error !== null}
color={this.props.color}
>
{this.props.label} | Fixed small error with the TextArea component | HenriBeck_materialize-react | train | js |
34b89b2603a7324517ce0167a4b83fd8713d58cf | diff --git a/bcbio/pipeline/shared.py b/bcbio/pipeline/shared.py
index <HASH>..<HASH> 100644
--- a/bcbio/pipeline/shared.py
+++ b/bcbio/pipeline/shared.py
@@ -132,7 +132,7 @@ def _subset_bed_by_region(in_file, out_file, region):
else:
x.end += 1
return x
- orig_bed.intersect(region_bed).each(_ensure_minsize).saveas(out_file)
+ orig_bed.intersect(region_bed).each(_ensure_minsize).merge().saveas(out_file)
def subset_variant_regions(variant_regions, region, out_file):
"""Return BED file subset by a specified chromosome region. | Ensure subset BED files feeding into variant calling are merged to prevent duplicate features. #<I> #<I> | bcbio_bcbio-nextgen | train | py |
58cb295fd823559a18df698f633745b1f53bca13 | diff --git a/menu.js b/menu.js
index <HASH>..<HASH> 100644
--- a/menu.js
+++ b/menu.js
@@ -45,7 +45,7 @@ function moveTo(el, list, i) {
}
module.exports = function (list) {
- var menu = h('ul')
+ var menu = h('div.row.hypertabs__tabs')
function tab_button (el, onclick) {
var link = h('a', {href: '#', onclick: function (ev) {
@@ -64,7 +64,7 @@ module.exports = function (list) {
menu.removeChild(wrap)
}}, 'x')
- var wrap = h('li', link, rm)
+ var wrap = h('div.hypertabs__tab', link, rm)
function isSelected () {
if(displayable(el)) | use classes which are compatible with v1 | hyperhype_hypertabs | train | js |
d91109c8bdca460cbd9a870188a569fec048ae4a | diff --git a/lib/generate.js b/lib/generate.js
index <HASH>..<HASH> 100644
--- a/lib/generate.js
+++ b/lib/generate.js
@@ -11,15 +11,28 @@ function dedentFunc(func) {
return [lines[0].replace(/^\s+|\s+$/g, '')];
}
- var match = /^\s*/.exec(lines[lines.length-1]);
- var indent = match[0];
- return lines
- .map(function dedent(line) {
- if (line.slice(0, indent.length) === indent) {
- return line.slice(indent.length);
+ var indent = null;
+ var tail = lines.slice(1);
+ for (var i = 0; i < tail.length; i++) {
+ var match = /^\s+/.exec(tail[i]);
+ if (match) {
+ if (indent === null ||
+ match[0].length < indent.length) {
+ indent = match[0];
}
- return line;
- });
+ }
+ }
+
+ if (indent === null) {
+ return lines;
+ }
+
+ return lines.map(function dedent(line) {
+ if (line.slice(0, indent.length) === indent) {
+ return line.slice(indent.length);
+ }
+ return line;
+ });
}
function serializeSymbol(s) { | lib/generate: generalize dedentFunc
Take take the min indent after the first line; now only has edge cases
if we see mixed tabs and spaces in the input. | kach_nearley | train | js |
518f5845c4318b1cd5517811f6141d8a704e550e | diff --git a/bosh-director/lib/bosh/director/agent_client.rb b/bosh-director/lib/bosh/director/agent_client.rb
index <HASH>..<HASH> 100644
--- a/bosh-director/lib/bosh/director/agent_client.rb
+++ b/bosh-director/lib/bosh/director/agent_client.rb
@@ -236,7 +236,15 @@ module Bosh::Director
end
def send_long_running_message(method_name, *args, &blk)
- task = AgentMessageConverter.convert_old_message_to_new(send_message(method_name, *args))
+ task = send_start_long_running_task_message(method_name, *args)
+ track_long_running_task(task, &blk)
+ end
+
+ def send_start_long_running_task_message(method_name, *args)
+ AgentMessageConverter.convert_old_message_to_new(send_message(method_name, *args))
+ end
+
+ def track_long_running_task(task, &blk)
while task['state'] == 'running'
blk.call if block_given?
sleep(DEFAULT_POLL_INTERVAL) | Separate task start and task polling in agent client. | cloudfoundry_bosh | train | rb |
8434a20d10094758f36cafbee56f148149c46804 | diff --git a/tests/lib/IframeApi.spec.js b/tests/lib/IframeApi.spec.js
index <HASH>..<HASH> 100644
--- a/tests/lib/IframeApi.spec.js
+++ b/tests/lib/IframeApi.spec.js
@@ -92,7 +92,7 @@ describe('IframeApi', () => {
const ids = (await KeyStore.instance.list()).map(record => record.id);
for (let id of ids) {
const keyRecord = await KeyStore.instance._get(id);
- const expectedKeyRecord = /** @type {StoredKeyRecord} */(Dummy.storedKeyRecords().find(x => x.id === id));
+ const expectedKeyRecord = /** @type {StoredKeyRecord} */(Dummy.storedKeyRecords().find(record => record.id === id));
expect(keyRecord).toEqual(expectedKeyRecord);
} | Update tests/lib/IframeApi.spec.js | nimiq_keyguard-next | train | js |
9b98d352466c0be772a919be4d6daaad7fdc4344 | diff --git a/lib/did_you_mean/finders.rb b/lib/did_you_mean/finders.rb
index <HASH>..<HASH> 100644
--- a/lib/did_you_mean/finders.rb
+++ b/lib/did_you_mean/finders.rb
@@ -10,6 +10,10 @@ module DidYouMean
def suggestions
@suggestions ||= searches.flat_map {|_, __| WordCollection.new(__).similar_to(_, FILTER) }
end
+
+ def searches
+ raise NotImplementedError
+ end
end
class NullFinder | Add a method that should be implemented | yuki24_did_you_mean | train | rb |
1a67b0d212b0ad80412b36c626dec2a89b5891d8 | diff --git a/GPy/inference/latent_function_inference/var_dtc.py b/GPy/inference/latent_function_inference/var_dtc.py
index <HASH>..<HASH> 100644
--- a/GPy/inference/latent_function_inference/var_dtc.py
+++ b/GPy/inference/latent_function_inference/var_dtc.py
@@ -142,8 +142,7 @@ class VarDTC(LatentFunctionInference):
Cpsi1Vf, _ = dtrtrs(Lm, tmp, lower=1, trans=1)
# data fit and derivative of L w.r.t. Kmm
- dL_dm = -np.dot((_LBi_Lmi_psi1.T.dot(_LBi_Lmi_psi1))
- - np.eye(Y.shape[0]), VVT_factor)
+ dL_dm = -_LBi_Lmi_psi1.T.dot(_LBi_Lmi_psi1.dot(VVT_factor)) + VVT_factor
delit = tdot(_LBi_Lmi_psi1Vf)
data_fit = np.trace(delit) | fix: reorder brackets to avoid an n^2 array | SheffieldML_GPy | train | py |
0c6639e0bcf2aec3ce9349b049b6b04fed8ac522 | diff --git a/blitzdb/backends/mongo/backend.py b/blitzdb/backends/mongo/backend.py
index <HASH>..<HASH> 100644
--- a/blitzdb/backends/mongo/backend.py
+++ b/blitzdb/backends/mongo/backend.py
@@ -166,6 +166,7 @@ class Backend(BaseBackend):
def _exists(obj, key):
value = obj
for elem in key.split("."):
+ print elem
if isinstance(value, list):
try:
value = value[int(elem)]
@@ -176,7 +177,7 @@ class Backend(BaseBackend):
value = value[elem]
except:
return False
- return value
+ return True
def _set(obj, key,new_value):
value = obj | Fixed bug in _exists function. | adewes_blitzdb | train | py |
1daf6b12838597d45e328710544a673ad9a4b53e | diff --git a/lib/kete_gets_trollied.rb b/lib/kete_gets_trollied.rb
index <HASH>..<HASH> 100644
--- a/lib/kete_gets_trollied.rb
+++ b/lib/kete_gets_trollied.rb
@@ -0,0 +1,4 @@
+require 'kete_gets_trollied/has_trolley_controller_helpers_overrides'
+require 'kete_gets_trollied/orders_helper_overrides'
+require 'kete_gets_trollied/line_items_helper_overrides'
+require 'kete_gets_trollied/user_order_notifications' | adding explicit requirements of some modules for overrides, etc. | kete_kete_gets_trollied | train | rb |
a45166e37b2a5571aee1f444ab06868ab1174a4f | diff --git a/src/network/NetworkMonitor.js b/src/network/NetworkMonitor.js
index <HASH>..<HASH> 100644
--- a/src/network/NetworkMonitor.js
+++ b/src/network/NetworkMonitor.js
@@ -1,11 +1,15 @@
"use strict";
+const EventEmitter = require('eventemitter3');
+
/**
+ * Measures network performance between the client and the server
* Represents both the client and server portions of NetworkMonitor
*/
-class NetworkMonitor {
+class NetworkMonitor extends EventEmitter{
constructor() {
+ super();
}
// client
@@ -36,6 +40,10 @@ class NetworkMonitor {
this.movingRTTAverageFrame.shift();
}
this.movingRTTAverage = this.movingRTTAverageFrame.reduce((a,b) => a + b) / this.movingRTTAverageFrame.length;
+ this.emit('RTTUpdate',{
+ RTT: RTT,
+ RTTAverage: this.movingRTTAverage
+ })
}
// server | NetworkMonitor: extend EventEmitter, emit on RTTUpdate | lance-gg_lance | train | js |
46c89be6c7aaa5c8a5ee2c601364da580c4040e8 | diff --git a/vendor/plugins/refinery_settings/app/models/refinery_setting.rb b/vendor/plugins/refinery_settings/app/models/refinery_setting.rb
index <HASH>..<HASH> 100644
--- a/vendor/plugins/refinery_settings/app/models/refinery_setting.rb
+++ b/vendor/plugins/refinery_settings/app/models/refinery_setting.rb
@@ -53,13 +53,13 @@ class RefinerySetting < ActiveRecord::Base
def self.find_or_set(name, the_value, options={})
# Try to get the value from cache first.
scoping = options[:scoping]
- required = options[:required]
+ restricted = options[:restricted]
if (value = cache_read(name, scoping)).nil?
# if the database is not up to date yet then it won't know about scoping..
if self.column_names.include?('scoping')
- setting = find_or_create_by_name_and_scoping(:name => name.to_s, :value => the_value, :scoping => scoping, :required => required)
+ setting = find_or_create_by_name_and_scoping(:name => name.to_s, :value => the_value, :scoping => scoping, :restricted => restricted)
else
- setting = find_or_create_by_name(:name => name.to_s, :value => the_value, :required => required)
+ setting = find_or_create_by_name(:name => name.to_s, :value => the_value, :required => restricted)
end
# cache whatever we found including its scope in the name, even if it's nil. | Required is not the same as Restricted, not the same at all. Restricted is the correct answer however. | refinery_refinerycms | train | rb |
35621706b56de7d8ad966d43e98273f32f1a4b78 | diff --git a/account/forms.py b/account/forms.py
index <HASH>..<HASH> 100644
--- a/account/forms.py
+++ b/account/forms.py
@@ -39,19 +39,15 @@ class SignupForm(forms.Form):
def clean_username(self):
if not alnum_re.search(self.cleaned_data["username"]):
raise forms.ValidationError(_("Usernames can only contain letters, numbers and underscores."))
- try:
- User.objects.get(username__iexact=self.cleaned_data["username"])
- except User.DoesNotExist:
+ qs = User.objects.filter(username__iexact=self.cleaned_data["username"])
+ if not qs.exists():
return self.cleaned_data["username"]
raise forms.ValidationError(_("This username is already taken. Please choose another."))
def clean_email(self):
value = self.cleaned_data["email"]
- try:
- EmailAddress.objects.get(email__iexact=value)
- except EmailAddress.DoesNotExist:
- return value
- if not settings.ACCOUNT_EMAIL_UNIQUE:
+ qs = EmailAddress.objects.filter(email__iexact=value)
+ if not qs.exists() or not settings.ACCOUNT_EMAIL_UNIQUE:
return value
raise forms.ValidationError(_("A user is registered with this email address.")) | changed to use exists in SignupForm | pinax_django-user-accounts | train | py |
4e19ec135c7da0a916af5ccf8dae52e3e910356a | diff --git a/test/test_execute.py b/test/test_execute.py
index <HASH>..<HASH> 100644
--- a/test/test_execute.py
+++ b/test/test_execute.py
@@ -212,7 +212,19 @@ processed.append((_par, _res))
wf = script.workflow()
Sequential_Executor(wf).inspect()
self.assertEqual(env.sos_dict['processed'], [((1, 2), 'p1.txt'), ((1, 3), 'p2.txt'), ((2, 3), 'p3.txt')])
+ #
+ # test for each for pandas dataframe
+ script = SoS_Script(r"""
+[0: alias='res']
+import pandas as pd
+data = pd.DataFrame([(1, 2, 'Hello'), (2, 4, 'World')], columns=['A', 'B', 'C'])
+input: for_each='data'
+output: '${_data["A"]}_${_data["B"]}_${_data["C"]}.txt'
+""")
+ wf = script.workflow()
+ Sequential_Executor(wf).inspect()
+ self.assertEqual(env.sos_dict['res'].output, ['1_2_Hello.txt', '2_4_World.txt'])
def testPairedWith(self):
'''Test option paired_with ''' | Test for_each looping through pandas dataframe | vatlab_SoS | train | py |
cbbb60e1967408f56b26122d3f6b03f0d2521a77 | diff --git a/prospector/tools/pep8/__init__.py b/prospector/tools/pep8/__init__.py
index <HASH>..<HASH> 100644
--- a/prospector/tools/pep8/__init__.py
+++ b/prospector/tools/pep8/__init__.py
@@ -125,7 +125,7 @@ class Pep8Tool(ToolBase):
# Make sure pep8's code ignores are fully reset to zero before
# adding prospector-flavoured configuration.
# pylint: disable=W0201
- self.checker.select = ()
+ self.checker.options.select = ()
self.checker.options.ignore = tuple(prospector_config.get_disabled_messages('pep8'))
if 'max-line-length' in prospector_config.tool_options('pep8'): | Forgot to fix the select option. | PyCQA_prospector | train | py |
3f1c1779633574c3c04c12c0580105230f1c7095 | diff --git a/lib/dm-core/resource.rb b/lib/dm-core/resource.rb
index <HASH>..<HASH> 100644
--- a/lib/dm-core/resource.rb
+++ b/lib/dm-core/resource.rb
@@ -840,7 +840,7 @@ module DataMapper
# true if the resource was successfully saved
#
# @api semipublic
- def save_self(safe)
+ def save_self(safe = true)
if safe
new? ? create_hook : update_hook
else | Make safe the default if people call save_self directly | datamapper_dm-core | train | rb |
f7de4206413c73def89d83e996d821017eea2cbc | diff --git a/django_cron/management/commands/runcrons.py b/django_cron/management/commands/runcrons.py
index <HASH>..<HASH> 100644
--- a/django_cron/management/commands/runcrons.py
+++ b/django_cron/management/commands/runcrons.py
@@ -11,6 +11,7 @@ try:
except ImportError:
# timezone added in Django 1.4
from django_cron import timezone
+from django.db import close_connection
DEFAULT_LOCK_TIME = 24 * 60 * 60 # 24 hours
@@ -55,6 +56,7 @@ class Command(BaseCommand):
for cron_class in crons_to_run:
run_cron_with_cache_check(cron_class, force=options['force'],
silent=options['silent'])
+ close_connection()
def run_cron_with_cache_check(cron_class, force=False, silent=False): | We should force database connection close, because django wont closeing it by itself | Tivix_django-cron | train | py |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.