diff
stringlengths 139
3.65k
| message
stringlengths 8
627
| diff_languages
stringclasses 1
value |
---|---|---|
diff --git a/test/test_BEI.py b/test/test_BEI.py
index <HASH>..<HASH> 100644
--- a/test/test_BEI.py
+++ b/test/test_BEI.py
@@ -19,6 +19,18 @@ class TestBEIConstructorHappyPath():
bei = ibei.models.BEI(**valid_constructor_args)
+ @pytest.mark.parametrize("argname", [
+ "energy_bound",
+ "chemical_potential",
+ ]
+ )
+ def test_params_that_can_equal_zero(self, valid_constructor_args, argname):
+ valid_constructor_args[argname] = 0
+
+ with does_not_raise():
+ bei = ibei.models.BEI(**valid_constructor_args)
+
+
class TestIssues():
"""
Tests corresponding to issues raised due to bugs
|
Test constructor args that can equal zero
|
py
|
diff --git a/factordb/factordb.py b/factordb/factordb.py
index <HASH>..<HASH> 100644
--- a/factordb/factordb.py
+++ b/factordb/factordb.py
@@ -4,7 +4,7 @@ from __future__ import print_function, unicode_literals
import requests
-ENDPOINT = "https://factordb.com/api"
+ENDPOINT = "http://factordb.com/api"
class FactorDB():
@@ -15,7 +15,7 @@ class FactorDB():
def connect(self, reconnect=False):
if self.result and not reconnect:
return self.result
- self.result = requests.get(ENDPOINT, params={"query": str(self.n)}, verify=False)
+ self.result = requests.get(ENDPOINT, params={"query": str(self.n)})
return self.result
def get_id(self):
|
Fix endpoint URL not to use https #5
|
py
|
diff --git a/hypermap/aggregator/tasks.py b/hypermap/aggregator/tasks.py
index <HASH>..<HASH> 100644
--- a/hypermap/aggregator/tasks.py
+++ b/hypermap/aggregator/tasks.py
@@ -236,11 +236,12 @@ def index_service(self, service):
)
count = 0
+
for layer in layer_to_process:
# update state
status_update(count)
if not settings.REGISTRY_SKIP_CELERY:
- index_layer.delay(layer)
+ index_layer(layer, use_cache=True)
else:
index_layer(layer)
count = count + 1
@@ -315,7 +316,7 @@ def index_all_layers(self):
meta={'current': count, 'total': total}
)
if not settings.REGISTRY_SKIP_CELERY:
- index_layer.delay(layer)
+ index_layer.delay(layer, use_cache=True)
else:
index_layer(layer)
count = count + 1
|
Indexing all layers and all layers in a service is done by using the cache
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@ from setuptools import setup
from subprocess import call
-class InstallCommand(install):
+class InstallCommand(install, object):
def run(self):
bash_completion = os.path.expanduser(
"~/.bash_completion.d/python-argcomplete.sh"
@@ -30,7 +30,7 @@ class InstallCommand(install):
os.mkdir(bash_dir)
if os.path.exists(bash_completion) is False:
- os.system("activate-global-python-argcomplete --dest=" + bash_dir)
+ os.system(u"activate-global-python-argcomplete --dest=" + bash_dir)
super(InstallCommand, self).run()
@@ -54,6 +54,6 @@ setup(
u"coverage"
],
cmdclass={
- "install": InstallCommand,
+ u"install": InstallCommand,
}
)
|
Compatibility with python <I>
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -3,10 +3,14 @@ from setuptools import setup, find_packages
import os
import re
+import io
-def read(*names):
- return open(os.path.join(os.path.dirname(__file__), *names)).read()
+def read(*names, **kwargs):
+ return io.open(
+ os.path.join(os.path.dirname(__file__), *names),
+ encoding=kwargs.get('encoding', 'utf8')
+ ).read()
setup(
name="aspectlib",
|
Decode as utf8 when reading whatever.
|
py
|
diff --git a/spyder/widgets/tests/test_github_backend.py b/spyder/widgets/tests/test_github_backend.py
index <HASH>..<HASH> 100644
--- a/spyder/widgets/tests/test_github_backend.py
+++ b/spyder/widgets/tests/test_github_backend.py
@@ -11,9 +11,15 @@ Taken from the QCrash Project:
https://github.com/ColinDuquesnoy/QCrash
"""
+import os
+import sys
+
+import pytest
+
from spyder.config.main import CONF
from spyder.widgets.github import backend
+
USERNAME = 'tester'
PASSWORD = 'test1234'
GH_OWNER = 'ccordoba12'
@@ -106,6 +112,9 @@ def test_get_credentials_from_settings():
assert remember_token is True
[email protected]((os.environ.get('CI', None) is not None and
+ sys.platform.startswith('linux')),
+ reason="Hard to make it work in our CIs and Linux")
def test_store_user_credentials():
b = get_backend()
b._store_credentials('user', 'toto', True)
|
Testing: Skip test_store_user_credentials in our CIs and Linux
|
py
|
diff --git a/buildbot_travis/runner.py b/buildbot_travis/runner.py
index <HASH>..<HASH> 100644
--- a/buildbot_travis/runner.py
+++ b/buildbot_travis/runner.py
@@ -18,6 +18,9 @@ from twisted.internet.threads import deferToThread
from buildbot_travis.steps.create_steps import SetupVirtualEnv
from buildbot_travis.travisyml import TRAVIS_HOOKS, TravisYml
+# Fix Python 2.x.
+try: input = raw_input
+except NameError: pass
[readline] # is imported for side effect (i.e get decent raw_input)
@@ -106,7 +109,7 @@ class MyTerminal(urwid.Terminal):
def add_text(self, data):
self.term.modes.lfnl = True
- self.term.addstr(data)
+ self.term.addstr(data.encode("utf8"))
def keypress(self, size, key):
if key == 'esc':
@@ -224,7 +227,7 @@ def run(args):
print("will run:\n" + all_configs)
print(
"Once running: Hit 'esc' to quit. Use mouse scroll wheel to scroll buffer. Use mouse click to zoom/unzoom")
- res = raw_input("OK? [Y/n]")
+ res = input("OK? [Y/n]")
if res.lower()[:1] == "n":
return
ui = Ui(len(config.matrix))
|
fixes for py3. The whole story is not yet there..
|
py
|
diff --git a/mutagen/wave.py b/mutagen/wave.py
index <HASH>..<HASH> 100644
--- a/mutagen/wave.py
+++ b/mutagen/wave.py
@@ -92,12 +92,13 @@ class WaveStreamInfo(StreamInfo):
self.bitrate = self.channels * block_align * self.sample_rate
# Calculate duration
+ self._number_of_samples = 0
if block_align > 0:
try:
data_chunk = wave_file[u'data']
self._number_of_samples = data_chunk.data_size / block_align
except KeyError:
- self._number_of_samples = 0
+ pass
if self.sample_rate > 0:
self.length = self._number_of_samples / self.sample_rate
|
wave: make sure _number_of_samples is always defined
|
py
|
diff --git a/anchore/anchore_image_db.py b/anchore/anchore_image_db.py
index <HASH>..<HASH> 100644
--- a/anchore/anchore_image_db.py
+++ b/anchore/anchore_image_db.py
@@ -39,7 +39,7 @@ class AnchoreImageDB(object):
def __init__(self, imagerootdir):
self.initialized = False
self.imagerootdir = imagerootdir
-
+ self.version = None
try:
from anchore import version as anchore_version_string
if not os.path.exists(self.imagerootdir):
@@ -56,6 +56,8 @@ class AnchoreImageDB(object):
FH=open(dbmetafile, 'r')
json_dict = json.loads(FH.read())
+ self.version = {'anchore_version': json_dict['anchore_version'], 'db_version': json_dict['anchore_db_version']}
+
FH.close()
if 'anchore_version' not in json_dict:
json_dict['anchore_version'] = anchore_version_string
@@ -82,7 +84,7 @@ class AnchoreImageDB(object):
except Exception as err:
raise err
- self.initialized = True
+ self.initialized = True
def check(self):
return(self.initialized)
|
Adds version property to AnchoreImageDB as dict with anchore and db versions
|
py
|
diff --git a/shap/models/_teacher_forcing_logits.py b/shap/models/_teacher_forcing_logits.py
index <HASH>..<HASH> 100644
--- a/shap/models/_teacher_forcing_logits.py
+++ b/shap/models/_teacher_forcing_logits.py
@@ -53,6 +53,15 @@ class TeacherForcingLogits(Model):
else:
return variables.to(device)
+ def get_logodds(self, logits):
+ logodds = []
+ # pass logits through softmax, get the token corresponding score and convert back to log odds (as one vs all)
+ for i in range(0,logits.shape[1]-1):
+ probs = (np.exp(logits[0][i]).T / np.exp(logits[0][i]).sum(-1)).T
+ logit_dist = sp.special.logit(probs)
+ logodds.append(logit_dist[self.target_sentence_ids[0,i].item()])
+ return np.array(logodds)
+
def get_teacher_forced_logits(self,source_sentence_ids,target_sentence_ids):
""" The function generates logits for transformer models.
It generates logits for encoder-decoder models as well as decoder only models by using the teacher forcing technique.
|
added calculation of log odds functionality from logits
|
py
|
diff --git a/test/test_timeseries.py b/test/test_timeseries.py
index <HASH>..<HASH> 100644
--- a/test/test_timeseries.py
+++ b/test/test_timeseries.py
@@ -64,7 +64,7 @@ class TestTimeSeriesMethods(TimeSeriesTestCase):
rdd = self.sc.parallelize([(0, array([1, 2, 3, 4, 5]))])
data = TimeSeries(rdd).detrend('linear')
# detrending linearly increasing data should yield all 0s
- assert(allclose(data.first()[1], array([0, 0, 0, 0, 0])))
+ assert(allclose(data.first()[1], array([1, 1, 1, 1, 1])))
def test_normalization_bypercentile(self):
rdd = self.sc.parallelize([(0, array([1, 2, 3, 4, 5], dtype='float16'))])
|
fixed detrending test in test_timeseries.py
|
py
|
diff --git a/tensorflow_datasets/text/multi_nli.py b/tensorflow_datasets/text/multi_nli.py
index <HASH>..<HASH> 100644
--- a/tensorflow_datasets/text/multi_nli.py
+++ b/tensorflow_datasets/text/multi_nli.py
@@ -63,8 +63,9 @@ class MultiNLIConfig(tfds.core.BuilderConfig):
**kwargs: keyword arguments forwarded to super.
"""
super(MultiNLIConfig, self).__init__(
- version=tfds.core.Version(
- "1.0.0", "New split API (https://tensorflow.org/datasets/splits)"),
+ version=tfds.core.Version("1.0.0"),
+ release_notes=
+ "New split API (https://tensorflow.org/datasets/splits)",
**kwargs)
self.text_encoder_config = (
text_encoder_config or tfds.deprecated.text.TextEncoderConfig())
|
Add release notes for multi_nli
|
py
|
diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py
index <HASH>..<HASH> 100644
--- a/parsimonious/expressions.py
+++ b/parsimonious/expressions.py
@@ -6,7 +6,7 @@ These do the parsing.
# TODO: Make sure all symbol refs are local--not class lookups or
# anything--for speed. And kill all the dots.
-from inspect import getargspec, isfunction, ismethod, ismethoddescriptor
+from inspect import getfullargspec, isfunction, ismethod, ismethoddescriptor
import re
from parsimonious.exceptions import ParseError, IncompleteParseError
@@ -65,7 +65,7 @@ def expression(callable, rule_name, grammar):
if ismethoddescriptor(callable) and hasattr(callable, '__func__'):
callable = callable.__func__
- num_args = len(getargspec(callable).args)
+ num_args = len(getfullargspec(callable).args)
if ismethod(callable):
# do not count the first argument (typically 'self') for methods
num_args -= 1
|
replace getargspec with getfullargspec `getargspec()` is deprecated. `getfullargspec()` is supposed to be a drop in replacement for most use cases, expanding the return value of `getargspec()` to include function annotations and keyword-only parameters. The exact behavior changed in <I> and again in <I>, so if this becomes a problem look into directly calling `signature()`, which underlies `getfullargspec()`, in order to build exactly what is needed.
|
py
|
diff --git a/angr/procedures/libc/strchr.py b/angr/procedures/libc/strchr.py
index <HASH>..<HASH> 100644
--- a/angr/procedures/libc/strchr.py
+++ b/angr/procedures/libc/strchr.py
@@ -30,6 +30,14 @@ class strchr(angr.SimProcedure):
a = a.annotate(MultiwriteAnnotation())
self.state.add_constraints(*c)
+ # If we found the character we are looking for, we need to
+ # ensure that the string length is long enough to include
+ # the character!
+ chrpos = a - s_addr
+ self.state.add_constraints(self.state.solver.If(a != 0,
+ chrpos <= s_strlen.ret_expr,
+ True))
+
return a
#self.state.add_constraints(self.state.solver.ULT(a - s_addr, s_strlen.ret_expr))
#self.max_chr_index = max(i)
|
Strchr: Ensure that the string is long enough to include the found character (#<I>) * Strchr: Ensure that the string is long enough to include the found character * strchr: Fix search for NULL byte * strchr: Push the handling of NULL into the constraint
|
py
|
diff --git a/symbols/var.py b/symbols/var.py
index <HASH>..<HASH> 100644
--- a/symbols/var.py
+++ b/symbols/var.py
@@ -49,6 +49,7 @@ class SymbolVAR(Symbol):
self.accessed = False # Where this object has been accessed (if false it might be not compiled)
self.caseins = OPTIONS.case_insensitive.value # Whether this ID is case insensitive or not
self._t = global_.optemps.new_t()
+ self.scopeRef = None # Must be set by the Symbol Table. PTR to the scope
@property
def size(self):
|
Adds new property: scopeREF Referente to the scope holding this entry.
|
py
|
diff --git a/mrq/job.py b/mrq/job.py
index <HASH>..<HASH> 100644
--- a/mrq/job.py
+++ b/mrq/job.py
@@ -385,6 +385,8 @@ class Job(object):
if self.id is None:
return
+ context.metric("jobs.status.%s" % status)
+
if self.stored is False and self.statuses_no_storage is not None and status in self.statuses_no_storage:
return
@@ -434,8 +436,6 @@ class Job(object):
"_id": self.id
}, {"$set": db_updates}, w=w, j=j, manipulate=False)
- context.metric("jobs.status.%s" % status)
-
if self.data:
self.data.update(db_updates)
|
Send status metrics even when job is not stored
|
py
|
diff --git a/tests/datetime_test.py b/tests/datetime_test.py
index <HASH>..<HASH> 100644
--- a/tests/datetime_test.py
+++ b/tests/datetime_test.py
@@ -75,3 +75,7 @@ def test_timedelta_arithmetics():
# compare vaex to numerical results
assert diff_dev_hours.tolist() == df['diff_dev_hours'].values.tolist()
assert diff_add_days.tolist() == df['diff_add_days'].values.tolist()
+
+ # check the min/max values for the TimeDelta column
+ assert df.diff.min() == df.diff.values.min()
+ assert df.diff.max() == df.diff.values.max()
|
Improve unit-test for timedelta operations: exposes a bug.
|
py
|
diff --git a/shinken/modules/livestatus_broker/livestatus_broker.py b/shinken/modules/livestatus_broker/livestatus_broker.py
index <HASH>..<HASH> 100644
--- a/shinken/modules/livestatus_broker/livestatus_broker.py
+++ b/shinken/modules/livestatus_broker/livestatus_broker.py
@@ -943,6 +943,7 @@ class Livestatus_broker(BaseModule):
# before we open the socket
pass
+ self.do_stop()
def livestatus_factory(cursor, row):
return Logline(row)
|
fix: livestatus_broker: restored do_stop() on exit.
|
py
|
diff --git a/errordite/__init__.py b/errordite/__init__.py
index <HASH>..<HASH> 100644
--- a/errordite/__init__.py
+++ b/errordite/__init__.py
@@ -4,7 +4,7 @@ Custom log handler for posting errors to errordite (www.errordite.com).
Dependencies: Requests (http://docs.python-requests.org)
"""
__title__ = 'errordite'
-__version__ = '0.4'
+__version__ = '0.5'
__author__ = 'Hugo Rodger-Brown'
__license__ = 'Simplified BSD License'
__copyright__ = 'Copyright 2013 Hugo Rodger-Brown'
|
Bumps version to <I> (uploaded to PyPI).
|
py
|
diff --git a/web3/utils/transactions.py b/web3/utils/transactions.py
index <HASH>..<HASH> 100644
--- a/web3/utils/transactions.py
+++ b/web3/utils/transactions.py
@@ -203,7 +203,7 @@ def prepare_replacement_transaction(web3, current_transaction, new_transaction):
new_transaction = assoc(new_transaction, 'nonce', current_transaction['nonce'])
if 'gasPrice' in new_transaction:
- if new_transaction['gasPrice'] < current_transaction['gasPrice']:
+ if new_transaction['gasPrice'] <= current_transaction['gasPrice']:
raise ValueError('Supplied gas price must exceed existing transaction gas price')
else:
generated_gas_price = web3.eth.generateGasPrice(new_transaction)
|
Resend tx api: ensure gas price higher
|
py
|
diff --git a/templated_mail/mail.py b/templated_mail/mail.py
index <HASH>..<HASH> 100644
--- a/templated_mail/mail.py
+++ b/templated_mail/mail.py
@@ -3,9 +3,10 @@ from django.contrib.sites.shortcuts import get_current_site
from django.core import mail
from django.template.context import make_context
from django.template.loader import get_template
+from django.views.generic.base import ContextMixin
-class BaseEmailMessage(mail.EmailMultiAlternatives):
+class BaseEmailMessage(mail.EmailMultiAlternatives, ContextMixin):
_node_map = {
'subject': 'subject',
'text_body': 'body',
@@ -24,9 +25,9 @@ class BaseEmailMessage(mail.EmailMultiAlternatives):
if template_name is not None:
self.template_name = template_name
- def get_context_data(self):
- _context = super(BaseEmailMessage, self).get_context_data(**kwargs)
- context = dict(_context.items() + self.context.items())
+ def get_context_data(self, **kwargs):
+ ctx = super(BaseEmailMessage, self).get_context_data(**kwargs)
+ context = dict(ctx.items() | self.context.items())
if self.request:
site = get_current_site(self.request)
domain = context.get('domain') or (
|
super needs also extend on ContentMixin
|
py
|
diff --git a/fcn/utils.py b/fcn/utils.py
index <HASH>..<HASH> 100644
--- a/fcn/utils.py
+++ b/fcn/utils.py
@@ -118,9 +118,13 @@ def label_accuracy_score(label_trues, label_preds, n_class):
for lt, lp in zip(label_trues, label_preds):
hist += _fast_hist(lt.flatten(), lp.flatten(), n_class)
acc = np.diag(hist).sum() / hist.sum()
- acc_cls = np.diag(hist) / hist.sum(axis=1)
+ with np.errstate(divide='ignore', invalid='ignore'):
+ acc_cls = np.diag(hist) / hist.sum(axis=1)
acc_cls = np.nanmean(acc_cls)
- iu = np.diag(hist) / (hist.sum(axis=1) + hist.sum(axis=0) - np.diag(hist))
+ with np.errstate(divide='ignore', invalid='ignore'):
+ iu = np.diag(hist) / (
+ hist.sum(axis=1) + hist.sum(axis=0) - np.diag(hist)
+ )
mean_iu = np.nanmean(iu)
freq = hist.sum(axis=1) / hist.sum()
fwavacc = (freq[freq > 0] * iu[freq > 0]).sum()
|
Ignore np warnings by np.errstate(..='ignore')
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,6 @@ setup(
install_requires=[
"rackspace-novaclient",
"python-swiftclient",
- "python-keystoneclient",
"python-cloudlb",
],
packages = [
|
Removed dependency on keystoneclient.
|
py
|
diff --git a/beekeeper/api.py b/beekeeper/api.py
index <HASH>..<HASH> 100644
--- a/beekeeper/api.py
+++ b/beekeeper/api.py
@@ -8,6 +8,7 @@ from __future__ import unicode_literals, print_function
import copy
from functools import partial
+from keyword import iskeyword
from beekeeper.variables import Variables
from beekeeper.hive import Hive
@@ -89,6 +90,8 @@ class APIObject(object):
"""
Add a single Action to the APIObject.
"""
+ if iskeyword(name):
+ name = '_' + name
self.actions[name] = parent.new_action(**action)
setattr(self, name, self.actions[name].execute)
@@ -211,6 +214,8 @@ class API(object):
Initialize an APIObject with the given name and make it available
using dot notation from the top-level namespace.
"""
+ if iskeyword(name)
+ name = '_' + name
setattr(self, name, APIObject(self, **obj))
def new_action(self, endpoint, **kwargs):
|
Making changes to avoid objects/actions with reserved names
|
py
|
diff --git a/ca/django_ca/admin.py b/ca/django_ca/admin.py
index <HASH>..<HASH> 100644
--- a/ca/django_ca/admin.py
+++ b/ca/django_ca/admin.py
@@ -172,13 +172,14 @@ class CertificateAdmin(admin.ModelAdmin):
data = form.cleaned_data
x509 = get_cert(
csr=data['csr'],
+ expires=data['expires'],
basic_constraints=data['basicConstraints'],
subject_alt_names=data['subjectAltName'],
key_usage=data['keyUsage'],
ext_key_usage=data['extendedKeyUsage'],
)
- obj.expires = datetime.today() #TODO, obviously
+ obj.expires = data['expires']
obj.pub = crypto.dump_certificate(crypto.FILETYPE_PEM, x509)
obj.save()
|
use the expires value from form
|
py
|
diff --git a/mbed/mbed.py b/mbed/mbed.py
index <HASH>..<HASH> 100755
--- a/mbed/mbed.py
+++ b/mbed/mbed.py
@@ -2774,8 +2774,8 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
# Disable icetea if not supported
if not icetea_supported:
icetea = False
- if not os.path.exists(os.path.join(getcwd(), 'TEST_APPS')):
- warning("Cannot run icetea tests. Current folder does not contain TEST_APPS folder.")
+ if icetea and not os.path.exists(os.path.join(getcwd(), 'TEST_APPS')):
+ error("Cannot run icetea tests. Current folder does not contain TEST_APPS folder.", 1)
icetea = False
# Save original working directory
@@ -2870,7 +2870,6 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False,
popen(icetea_command_base + ['--compile-list'])
if compile_only or build_and_run_tests:
-
# Add icetea binaries in compile list
tests_by_name_temp = tests_by_name if tests_by_name else ''
if icetea:
|
Fixed icetea warning when icetea is not desired and turn it to error when `mbed test --icetea` is called
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name='aguaclara',
- version='0.0.21',
+ version='0.0.22',
description='Open source functions for AguaClara water treatment research and plant design.',
url='https://github.com/AguaClara/aguaclara',
author='AguaClara at Cornell',
|
create a new release with version # <I> (#<I>)
|
py
|
diff --git a/pymatgen/io/vasp/sets.py b/pymatgen/io/vasp/sets.py
index <HASH>..<HASH> 100644
--- a/pymatgen/io/vasp/sets.py
+++ b/pymatgen/io/vasp/sets.py
@@ -585,8 +585,10 @@ class MPStaticSet(MPRelaxSet):
kpoints = super(MPStaticSet, self).kpoints
# Prefer to use k-point scheme from previous run
+ # except for when lepsilon = True is specified
if self.prev_kpoints and self.prev_kpoints.style != kpoints.style:
- if self.prev_kpoints.style == Kpoints.supported_modes.Monkhorst:
+ if (self.prev_kpoints.style == Kpoints.supported_modes.Monkhorst) \
+ and (not self.lepsilon):
k_div = [kp + 1 if kp % 2 == 1 else kp
for kp in kpoints.kpts[0]]
kpoints = Kpoints.monkhorst_automatic(k_div)
|
force gamma kpoints in MPStaticSet if lepsilon is True. This is required for an lepsilon calculation, not sure about forcing this for other Sets as well?
|
py
|
diff --git a/pyGenClean/run_data_clean_up.py b/pyGenClean/run_data_clean_up.py
index <HASH>..<HASH> 100644
--- a/pyGenClean/run_data_clean_up.py
+++ b/pyGenClean/run_data_clean_up.py
@@ -1873,7 +1873,7 @@ def run_remove_heterozygous_haploid(in_prefix, in_type, out_prefix, base_dir,
"After Plink's heterozygous haploid analysis, a total of "
"{:,d} genotype{} were set to missing.".format(
nb_hh_missing,
- "s" if nb_hh_missing - 1 > 1 else "",
+ "s" if nb_hh_missing > 1 else "",
)
)
print >>o_file, latex_template.wrap_lines(text)
|
Forgot to remove a -1
|
py
|
diff --git a/rash/functional_tests/test_cli.py b/rash/functional_tests/test_cli.py
index <HASH>..<HASH> 100644
--- a/rash/functional_tests/test_cli.py
+++ b/rash/functional_tests/test_cli.py
@@ -77,6 +77,8 @@ class FunctionalTestMixIn(object):
self.environ = os.environ.copy()
self.environ['HOME'] = self.home_dir
+ # FIXME: run the test w/o $TERM
+ self.environ['TERM'] = 'xterm-256color'
# Make sure that $XDG_CONFIG_HOME does not confuse sub processes
if 'XDG_CONFIG_HOME' in self.environ:
del self.environ['XDG_CONFIG_HOME']
|
Fix functional test: $TERM is not defined It looks like the latest version of tox strips off environment variable TERM.
|
py
|
diff --git a/integration_tests/test_moduletags/test_moduletags.py b/integration_tests/test_moduletags/test_moduletags.py
index <HASH>..<HASH> 100644
--- a/integration_tests/test_moduletags/test_moduletags.py
+++ b/integration_tests/test_moduletags/test_moduletags.py
@@ -23,9 +23,10 @@ class ModuleTags(IntegrationTest):
tests_dir = os.path.join(base_dir, 'tests')
sampleapp_dir = os.path.join(base_dir, 'sampleapp')
- stacker_file = {
+ cfngin_file = {
'namespace': 'runway-tests',
- 'stacker_bucket': '',
+ 'cfngin_bucket': '',
+ 'sys_path': './',
'stacks': {}
}
stack_definition = {
@@ -66,7 +67,7 @@ class ModuleTags(IntegrationTest):
for i in range(1, 7):
new_dir = os.path.join(self.base_dir, 'sampleapp' + str(i))
copy_dir(os.path.join(self.base_dir, 'sampleapp'), new_dir)
- stacker_contents = deepcopy(self.stacker_file)
+ stacker_contents = deepcopy(self.cfngin_file)
stacker_contents['stacks'] = {
'module-tags-' + str(i): self.stack_definition
}
|
add missing sys_path, change wording from stacker to cfngin (#<I>)
|
py
|
diff --git a/pyrogram/client/types/update.py b/pyrogram/client/types/update.py
index <HASH>..<HASH> 100644
--- a/pyrogram/client/types/update.py
+++ b/pyrogram/client/types/update.py
@@ -17,11 +17,11 @@
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
-class StopPropagation(StopIteration):
+class StopPropagation(StopAsyncIteration):
pass
-class ContinuePropagation(StopIteration):
+class ContinuePropagation(StopAsyncIteration):
pass
|
Inherit from StopAsyncIteration
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -16,12 +16,12 @@ from setuptools import setup
setup(
name="touchworks",
- version="0.1",
+ version="0.2",
license="MIT",
author="Farshid Ghods",
author_email="[email protected]",
url="https://github.com/farshidce/touchworks-python",
- download_url="https://github.com/farshidce/touchworks-python/tarball/0.1",
+ download_url="https://github.com/farshidce/touchworks-python/tarball/0.2",
description="Allscripts Touchworks API Client for Python",
packages=["touchworks"],
platforms="any",
|
updated version n# in setup,py
|
py
|
diff --git a/owslib/csw.py b/owslib/csw.py
index <HASH>..<HASH> 100644
--- a/owslib/csw.py
+++ b/owslib/csw.py
@@ -323,15 +323,15 @@ class CatalogueServiceWeb:
etree.SubElement(node1, util.nspath_eval('csw:ElementSetName', namespaces)).text = esn
- if len(constraints) > 0:
+ if any([len(constraints) > 0, cql is not None]):
node2 = etree.SubElement(node1, util.nspath_eval('csw:Constraint', namespaces))
node2.set('version', '1.1.0')
flt = fes.FilterRequest()
- node2.append(flt.setConstraintList(constraints))
-
- # Now add a CQL filter if passed in
- if cql is not None:
- etree.SubElement(node2, util.nspath_eval('csw:CqlText', namespaces)).text = cql
+ if len(constraints) > 0:
+ node2.append(flt.setConstraintList(constraints))
+ # Now add a CQL filter if passed in
+ elif cql is not None:
+ etree.SubElement(node2, util.nspath_eval('csw:CqlText', namespaces)).text = cql
if sortby is not None and isinstance(sortby, fes.SortBy):
node1.append(sortby)
|
CQL and filters are one or the other
|
py
|
diff --git a/stagpy/stagyydata.py b/stagpy/stagyydata.py
index <HASH>..<HASH> 100644
--- a/stagpy/stagyydata.py
+++ b/stagpy/stagyydata.py
@@ -748,7 +748,7 @@ class StagyyData:
rproffile = self.filename('rprof.h5')
self._stagdat['rprof'] = stagyyparsers.rprof_h5(
rproffile, list(phyvars.RPROF.keys()))
- if self._stagdat['rprof'] is not None:
+ if self._stagdat['rprof'][0] is not None:
return self._stagdat['rprof']
rproffile = self.filename('rprof.dat')
if self.hdf5 and not rproffile.is_file():
|
Fix fallback to ASCII if rprof.h5 doesn't exist
|
py
|
diff --git a/word_embedding_loader/loader/word2vec_text.py b/word_embedding_loader/loader/word2vec_text.py
index <HASH>..<HASH> 100644
--- a/word_embedding_loader/loader/word2vec_text.py
+++ b/word_embedding_loader/loader/word2vec_text.py
@@ -85,7 +85,7 @@ def load(fin, dtype=np.float32, max_vocab=None,
arr = np.empty((words, size), dtype=dtype)
i = 0
for n_line, line in enumerate(fin):
- if max_vocab is not None and i >= max_vocab:
+ if i >= words:
break
token, v = _load_line(line, dtype, size, encoding, unicode_errors)
if token in vocab:
@@ -94,7 +94,7 @@ def load(fin, dtype=np.float32, max_vocab=None,
arr[i, :] = v
vocab[token] = i
i += 1
- if n_line + 1 != words:
- parse_warn('EOF before the defined size (read %d, expected%d)' % (i, words))
- arr = arr[:i, :]
+ if i != words:
+ parse_warn('EOF before the defined size (read %d, expected %d)' % (i, words))
+ arr = arr[:i, :]
return arr, vocab
|
Fixed max_vocab was not working properly for word2vec_text
|
py
|
diff --git a/commands/diff.py b/commands/diff.py
index <HASH>..<HASH> 100644
--- a/commands/diff.py
+++ b/commands/diff.py
@@ -107,6 +107,7 @@ class DiffCommand(object):
diff['data'] = OrderedDict()
for metric, values in query_a['data'].items():
+ data_type = diff['data_types'][metric]
diff['data'][metric] = OrderedDict()
total_a = values['total']
@@ -127,7 +128,7 @@ class DiffCommand(object):
percent_a = float(a) / total_a if total_a > 0 else None
percent_b = float(b) / total_b if total_b > 0 else None
- if label == 'total' or percent_a is None or percent_b is None:
+ if label == 'total' or data_type == 'TIME' or percent_a is None or percent_b is None:
point_change = None
else:
point_change = percent_b - percent_a
|
Point change doesn't make sense for times.
|
py
|
diff --git a/tenant_schemas/template_loaders.py b/tenant_schemas/template_loaders.py
index <HASH>..<HASH> 100644
--- a/tenant_schemas/template_loaders.py
+++ b/tenant_schemas/template_loaders.py
@@ -12,6 +12,7 @@ from django.template.loader import (BaseLoader, get_template_from_string,
from django.utils.encoding import force_bytes
from django.utils._os import safe_join
from django.db import connection
+from tenant_schemas.postgresql_backend.base import FakeTenant
class CachedLoader(BaseLoader):
@@ -85,7 +86,7 @@ class FilesystemLoader(BaseLoader):
directory in "template_dirs". Any paths that don't lie inside one of the
template dirs are excluded from the result set, for security reasons.
"""
- if not connection.tenant:
+ if not connection.tenant or isinstance(connection.tenant, FakeTenant):
return
if not template_dirs:
try:
|
Prevent template loader operating when FakeTenant is the active connection.tenant The FakeTenant does not have a domain_url attribute. Alternative would be to set domain_url, but it seems more appropriate to bypass this loader for the FakeTenant.
|
py
|
diff --git a/hwt/hdl/assignment.py b/hwt/hdl/assignment.py
index <HASH>..<HASH> 100644
--- a/hwt/hdl/assignment.py
+++ b/hwt/hdl/assignment.py
@@ -47,7 +47,7 @@ class Assignment(HdlStatement):
self.dst = dst
if not isinstance(dst, Value):
self._outputs.append(dst)
- self._enclosed_for.append(dst)
+ self._enclosed_for.add(dst)
if isReal:
dst.drivers.append(self)
|
append/add mismatch for enclosure
|
py
|
diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py
index <HASH>..<HASH> 100644
--- a/pandas/core/dtypes/common.py
+++ b/pandas/core/dtypes/common.py
@@ -1245,8 +1245,6 @@ def is_float_dtype(arr_or_dtype) -> bool:
"""
Check whether the provided array or dtype is of a float dtype.
- This function is internal and should not be exposed in the public API.
-
Parameters
----------
arr_or_dtype : array-like or dtype
|
DOC: Remove mention that is_float_dtype is private (#<I>)
|
py
|
diff --git a/openquake/hazardlib/gsim/base.py b/openquake/hazardlib/gsim/base.py
index <HASH>..<HASH> 100644
--- a/openquake/hazardlib/gsim/base.py
+++ b/openquake/hazardlib/gsim/base.py
@@ -532,7 +532,7 @@ class GroundShakingIntensityModel(with_metaclass(MetaGSIM)):
# take the minimum epsilon larger than standard_iml
iml_bin_indices = numpy.searchsorted(epsilons, standard_imls)
poe_lst = []
- for lvl, bin in zip(standard_imls, iml_bin_indices):
+ for lvl, bin in zip(standard_imls, iml_bin_indices): # one per site
if bin == 0:
poe_lst.append(contribution_by_bands)
elif bin > n_epsilons:
|
Added a comment [skip CI]
|
py
|
diff --git a/librosa/core/dtw.py b/librosa/core/dtw.py
index <HASH>..<HASH> 100644
--- a/librosa/core/dtw.py
+++ b/librosa/core/dtw.py
@@ -169,9 +169,14 @@ def dtw(X=None, Y=None, C=None, metric='euclidean', step_sizes_sigma=None,
if step_sizes_sigma is None:
step_sizes_sigma = np.array([[1, 1], [0, 1], [1, 0]])
if weights_add is None:
- weights_add = np.array([0, 0, 0])
+ weights_add = np.zeros(len(step_sizes_sigma))
if weights_mul is None:
- weights_mul = np.array([1, 1, 1])
+ weights_mul = np.ones(len(step_sizes_sigma))
+
+ if len(step_sizes_sigma) != len(weights_add):
+ raise ParameterError('len(weights_add) must be equal to len(step_sizes_sigma)')
+ if len(step_sizes_sigma) != len(weights_mul):
+ raise ParameterError('len(weights_mul) must be equal to len(step_sizes_sigma)')
if C is None and (X is None or Y is None):
raise ParameterError('If C is not supplied, both X and Y must be supplied')
|
fixed that some steps are ignored when len(step_size_sigma)>3 in dtw and added a parameters check
|
py
|
diff --git a/twine/commands/upload.py b/twine/commands/upload.py
index <HASH>..<HASH> 100644
--- a/twine/commands/upload.py
+++ b/twine/commands/upload.py
@@ -70,7 +70,8 @@ def find_dists(dists):
return uploads
-def upload(dists, repository, sign, identity, username, password, comment):
+def upload(dists, repository, sign, identity, username, password, comment,
+ sign_with):
# Check that a nonsensical option wasn't given
if not sign and identity:
raise ValueError("sign must be given along with identity")
@@ -110,7 +111,7 @@ def upload(dists, repository, sign, identity, username, password, comment):
# Sign the dist if requested
if sign:
print("Signing {0}".format(os.path.basename(filename)))
- gpg_args = ["gpg", "--detach-sign", "-a", filename]
+ gpg_args = [sign_with, "--detach-sign", "-a", filename]
if identity:
gpg_args[2:2] = ["--local-user", identity]
subprocess.check_call(gpg_args)
@@ -227,6 +228,11 @@ def main(args):
help="Sign files to upload using gpg",
)
parser.add_argument(
+ "--sign-with",
+ default="gpg",
+ help="GPG program used to sign uploads (default: %(default)s)",
+ )
+ parser.add_argument(
"-i", "--identity",
help="GPG identity used to sign files",
)
|
Support using commands not named gpg for signing Fixes #<I>
|
py
|
diff --git a/master/buildbot/schedulers/timed.py b/master/buildbot/schedulers/timed.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/schedulers/timed.py
+++ b/master/buildbot/schedulers/timed.py
@@ -202,9 +202,10 @@ class Periodic(Timed):
def __init__(self, name, builderNames, periodicBuildTimer,
reason="The Periodic scheduler named '%(name)s' triggered this build",
- branch=None, properties={}, onlyImportant=False):
+ branch=None, properties={}, onlyImportant=False,
+ codebases=base.BaseScheduler.DefaultCodebases):
Timed.__init__(self, name=name, builderNames=builderNames,
- properties=properties, reason=reason)
+ properties=properties, reason=reason, codebases=codebases)
if periodicBuildTimer <= 0:
config.error(
"periodicBuildTimer must be positive")
|
timed: support codebases for Periodic scheduler
|
py
|
diff --git a/trezorlib/client.py b/trezorlib/client.py
index <HASH>..<HASH> 100644
--- a/trezorlib/client.py
+++ b/trezorlib/client.py
@@ -389,6 +389,11 @@ class ProtocolMixin(object):
if n[0] == 'm':
n = n[1:]
+ # coin_name/a/b/c => 44'/SLIP44_constant'/a/b/c
+ coins = { "Bitcoin": 0, "Testnet": 1, "Namecoin": 7, "Litecoin": 2, "Dogecoin": 3, "Dash": 5, "Zcash": 133, }
+ if n[0] in coins:
+ n = ["44'", "%d'" % coins[n[0]] ] + n[1:]
+
path = []
for x in n:
prime = False
|
trezorctl: accept also cointype/a/b/c as get_address path
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ class PyTest(TestCommand):
setup(
- name="polyaxon-cli",
+ name="polyaxon",
version="0.5.6",
description="Command Line Interface (CLI) and client to interact with Polyaxon API.",
long_description=read_readme(),
|
Rename package to polyaxon
|
py
|
diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py
index <HASH>..<HASH> 100644
--- a/adafruit_platformdetect/chip.py
+++ b/adafruit_platformdetect/chip.py
@@ -106,11 +106,11 @@ class Chip:
linux_id = S922X
cpu_model = self.detector.get_cpuinfo_field("cpu model")
-
- if "MIPS 24Kc" in cpu_model:
- linux_id = MIPS24KC
- elif "MIPS 24KEc" in cpu_model:
- linux_id = MIPS24KEC
+ if cpu_model is not None:
+ if "MIPS 24Kc" in cpu_model:
+ linux_id = MIPS24KC
+ elif "MIPS 24KEc" in cpu_model:
+ linux_id = MIPS24KEC
elif hardware in ("BCM2708", "BCM2709", "BCM2835"):
linux_id = BCM2XXX
|
Checking if cpu_model is not None
|
py
|
diff --git a/mill/__init__.py b/mill/__init__.py
index <HASH>..<HASH> 100644
--- a/mill/__init__.py
+++ b/mill/__init__.py
@@ -361,7 +361,7 @@ class Mill:
await self.update_heaters()
return self.heaters
- async def fetch_heater_sensor_data(self):
+ async def fetch_heater_and_sensor_data(self):
"""Request data."""
if not self.heaters:
await self.update_rooms()
|
fetch_heater_and_sensor_data (#<I>)
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ setup(
name='robotframework-faker',
package_dir={'': 'robotframework-faker'},
packages=['FakerLibrary'], # this must be the same as the name above
- version='0.3',
+ version='0.4',
description=short_description,
author='Guy Kisel',
author_email='[email protected]',
|
Bumping version to <I>
|
py
|
diff --git a/holoviews/core/ndmapping.py b/holoviews/core/ndmapping.py
index <HASH>..<HASH> 100644
--- a/holoviews/core/ndmapping.py
+++ b/holoviews/core/ndmapping.py
@@ -504,7 +504,7 @@ class MultiDimensionalMapping(Dimensioned):
if key is None:
return None
return self[key]
- except:
+ except KeyError:
return default
|
NdMapping.get only captures KeyError This ensures that user exceptions bubble up and are no longer caught early
|
py
|
diff --git a/restclients/views.py b/restclients/views.py
index <HASH>..<HASH> 100644
--- a/restclients/views.py
+++ b/restclients/views.py
@@ -3,6 +3,7 @@ try:
except:
# python 2.6
from django.utils.importlib import import_module
+from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_protect
@@ -186,9 +187,13 @@ def format_json(service, content):
formatted = formatted.replace(" ", " ")
formatted = formatted.replace("\n", "<br/>\n")
+ base_url = reverse("restclients_proxy", args=["xx", "xx"])
+ base_url = base_url.replace('/xx/xx', '')
+
+
formatted = re.sub(r"\"/(.*?)\"",
- r'"<a href="/restclients/view/%s/\1">/\1</a>"' %
- service, formatted)
+ r'"<a href="%s/%s/\1">/\1</a>"' % (base_url, service),
+ formatted)
return formatted
|
Make it so WS links work if restclients isn't rooted at /restclients/
|
py
|
diff --git a/terms/forms.py b/terms/forms.py
index <HASH>..<HASH> 100644
--- a/terms/forms.py
+++ b/terms/forms.py
@@ -20,6 +20,10 @@ if WIDGET == AVAILABLE_WIDGETS[3] or (WIDGET == AVAILABLE_WIDGETS[0]
class TermForm(ModelForm):
+ def clean_name(self):
+ data = self.cleaned_data
+ return data['name'].strip(' |')
+
def clean(self):
definition = self.cleaned_data.get('definition')
url = self.cleaned_data.get('url')
|
Removes leading|trailing pipes and spaces while saving. This could lead to dramatic problems…
|
py
|
diff --git a/pyfolio/pos.py b/pyfolio/pos.py
index <HASH>..<HASH> 100644
--- a/pyfolio/pos.py
+++ b/pyfolio/pos.py
@@ -162,7 +162,7 @@ def get_sector_exposures(positions, symbol_sector_map):
positions = positions.drop('cash', axis=1)
unmapped_pos = np.setdiff1d(positions.columns.values,
- symbol_sector_map.keys())
+ list(symbol_sector_map.keys()))
if len(unmapped_pos) > 0:
warn_message = """Warning: Symbols {} have no sector mapping.
They will not be included in sector allocations""".format(
|
BUG py3 compatibility for sector mapping
|
py
|
diff --git a/testing/test_capture.py b/testing/test_capture.py
index <HASH>..<HASH> 100644
--- a/testing/test_capture.py
+++ b/testing/test_capture.py
@@ -493,3 +493,26 @@ def test_capture_early_option_parsing(testdir):
result = testdir.runpytest("-vs")
assert result.ret == 0
assert 'hello19' in result.stdout.str()
+
[email protected](sys.version_info >= (3, 0), reason='encoding issues')
+def test_capture_binary_output(testdir):
+ testdir.makepyfile("""
+ import pytest
+
+ def test_a():
+ import sys
+ import subprocess
+ subprocess.call([sys.executable, __file__])
+
+ @pytest.mark.skip
+ def test_foo():
+ import os;os.write(1, b'\xc3')
+
+ if __name__ == '__main__':
+ test_foo()
+ """)
+ result = testdir.runpytest('--assert=plain')
+ result.stdout.fnmatch_lines([
+ '*2 passed*',
+ ])
+
|
xfailing test for captire encoding issues with binary stdio
|
py
|
diff --git a/angr/analyses/cfg_fast.py b/angr/analyses/cfg_fast.py
index <HASH>..<HASH> 100644
--- a/angr/analyses/cfg_fast.py
+++ b/angr/analyses/cfg_fast.py
@@ -662,11 +662,13 @@ class CFGFast(ForwardAnalysis, CFGBase): # pylint: disable=abstract-method
def __setstate__(self, s):
self._graph = s['graph']
self.indirect_jumps = s['indirect_jumps']
+ self._nodes_by_addr = s['_nodes_by_addr']
def __getstate__(self):
s = {
"graph": self.graph,
"indirect_jumps": self.indirect_jumps,
+ '_nodes_by_addr': self._nodes_by_addr,
}
return s
|
Pickle _nodes_by_addr for cfgfast
|
py
|
diff --git a/pycbc/types/timeseries.py b/pycbc/types/timeseries.py
index <HASH>..<HASH> 100644
--- a/pycbc/types/timeseries.py
+++ b/pycbc/types/timeseries.py
@@ -73,6 +73,20 @@ class TimeSeries(Array):
self._delta_t = delta_t
self._epoch = epoch
+ def to_astropy(self, name='pycbc'):
+ """ Return an astropy.timeseries.TimeSeries instance
+ """
+ from astropy.timeseries import TimeSeries as ATimeSeries
+ from astropy.time import Time
+ from astropy.units import s
+
+ start = Time(float(self.start_time), format='gps', scale='utc')
+ delta = self.delta_t * s
+ return ATimeSeries({name: self.numpy()},
+ time_start=start,
+ time_delta=delta,
+ n_samples=len(self))
+
def epoch_close(self, other):
""" Check if the epoch is close enough to allow operations """
dt = abs(float(self.start_time - other.start_time))
|
add method to convert pycbc ts to astropy (#<I>) * add method to convert pycbc ts to astropy * Update timeseries.py
|
py
|
diff --git a/xdoctest/static_analysis.py b/xdoctest/static_analysis.py
index <HASH>..<HASH> 100644
--- a/xdoctest/static_analysis.py
+++ b/xdoctest/static_analysis.py
@@ -400,7 +400,7 @@ def _parse_static_node_value(node):
values = map(_parse_static_node_value, node.values)
value = OrderedDict(zip(keys, values))
# value = dict(zip(keys, values))
- elif isinstance(node, (ast.NameConstant)):
+ elif six.PY3 and isinstance(node, (ast.NameConstant)):
value = node.value
else:
print(node.__dict__)
|
Fix python2 issue
|
py
|
diff --git a/test/test_mediafile.py b/test/test_mediafile.py
index <HASH>..<HASH> 100644
--- a/test/test_mediafile.py
+++ b/test/test_mediafile.py
@@ -175,7 +175,11 @@ class ImageStructureTestMixin(ArtTestMixin):
class ExtendedImageStructureTestMixin(ImageStructureTestMixin):
- """Checks for additional attributes in the image structure."""
+ """Checks for additional attributes in the image structure.
+
+ Like the base `ImageStructureTestMixin`, per-format test classes
+ should include this mixin to add image-related tests.
+ """
def assertExtendedImageAttributes(self, image, desc=None, type=None): # noqa
self.assertEqual(image.desc, desc)
@@ -308,6 +312,9 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
pasting one of the existing subclasses below. You will want to
update the `format` field in that subclass, and you will probably
need to fiddle with the `bitrate` and other format-specific fields.
+
+ You can also add image tests (using an additional `image.*` fixture
+ file) by including one of the image-related mixins.
"""
full_initial_tags = {
|
More test docs about the image.* mixin
|
py
|
diff --git a/pyjokes/jokes_en.py b/pyjokes/jokes_en.py
index <HASH>..<HASH> 100644
--- a/pyjokes/jokes_en.py
+++ b/pyjokes/jokes_en.py
@@ -71,7 +71,7 @@ neutral = [
"How do you know whether a person is a Vim user? Don't worry, they'll tell you.",
"[a person is choking] Waiter: Is anyone a doctor? Programmer: I'm a Vim user.",
"3 Database Admins walked into a NoSQL bar. A little while later they walked out because they couldn’t find a table.",
- "How do you explain the movie Inception to a programmer? Basically, when you run a VM inside another VM, inside another VM, inside another VM…, everything runs real slow!",
+ "How to explain the movie Inception to a programmer? When you run a VM inside another VM, inside another VM ..., everything runs real slow!",
]
adult = [
|
Shortened joke to follow <I> chars
|
py
|
diff --git a/tensorflow_probability/python/experimental/mcmc/with_reductions_test.py b/tensorflow_probability/python/experimental/mcmc/with_reductions_test.py
index <HASH>..<HASH> 100644
--- a/tensorflow_probability/python/experimental/mcmc/with_reductions_test.py
+++ b/tensorflow_probability/python/experimental/mcmc/with_reductions_test.py
@@ -36,11 +36,10 @@ class TestReducer(tfp.experimental.mcmc.Reducer):
"""Simple Reducer that just keeps track of the last sample"""
def initialize(self, initial_chain_state, initial_kernel_results=None):
- return tf.zeros(tf.convert_to_tensor(initial_chain_state).shape)
+ return tf.zeros_like(initial_chain_state)
def one_step(
self, new_chain_state, current_reducer_state, previous_kernel_results):
- print(new_chain_state)
return new_chain_state
|
making test reducer more robust with tf.zeros_like
|
py
|
diff --git a/segno/writers.py b/segno/writers.py
index <HASH>..<HASH> 100644
--- a/segno/writers.py
+++ b/segno/writers.py
@@ -838,6 +838,7 @@ _VALID_SERIALISERS = {
'pdf': write_pdf,
'ans': write_terminal,
'pbm': write_pbm,
+ 'tex': write_tex,
}
def save(matrix, version, out, kind=None, **kw):
|
Added TeX writer to "save"
|
py
|
diff --git a/satpy/writers/__init__.py b/satpy/writers/__init__.py
index <HASH>..<HASH> 100644
--- a/satpy/writers/__init__.py
+++ b/satpy/writers/__init__.py
@@ -335,7 +335,7 @@ class Writer(Plugin):
"""
delayeds = []
for ds in datasets:
- delayeds.append(self.save_dataset(ds, compute=compute, **kwargs))
+ delayeds.append(self.save_dataset(ds, compute=False, **kwargs))
delayed = dask.delayed(delayeds)
if compute:
return delayed.compute()
|
Fix writers computing saved datasets one at a time
|
py
|
diff --git a/py/testdir_single_jvm/test_summary2_uniform.py b/py/testdir_single_jvm/test_summary2_uniform.py
index <HASH>..<HASH> 100644
--- a/py/testdir_single_jvm/test_summary2_uniform.py
+++ b/py/testdir_single_jvm/test_summary2_uniform.py
@@ -101,7 +101,8 @@ class Basic(unittest.TestCase):
# smaller error likely with larger # of values.
# the maxDelta used for the scipy/sort compare can be tighter, since it's looking
# at actual data
- maxDeltaPlusDistVariance = 4 * maxDelta
+ # this is way too coarse. can't get the distribution tight?
+ maxDeltaPlusDistVariance = 10 * maxDelta
# allow some fuzz in the comparison to scipy/sort
maxDelta = 1.1 * maxDelta
|
large delta allowed due to rand gen variation
|
py
|
diff --git a/saspy/sasioiom.py b/saspy/sasioiom.py
index <HASH>..<HASH> 100644
--- a/saspy/sasioiom.py
+++ b/saspy/sasioiom.py
@@ -654,6 +654,7 @@ class SASsessionIOM():
#print("LIST = \n"+lst)
lstf += lst
else:
+ sleep(0.1)
try:
log = self.stderr[0].recv(4096).decode(self.sascfg.encoding, errors='replace')
except (BlockingIOError):
|
keep from eating <I>% cpu while waiting on iom
|
py
|
diff --git a/django_databrowse/tests/sites.py b/django_databrowse/tests/sites.py
index <HASH>..<HASH> 100644
--- a/django_databrowse/tests/sites.py
+++ b/django_databrowse/tests/sites.py
@@ -51,7 +51,7 @@ class DatabrowseTestsClient(TestCase):
def tearDownClass(self):
django_databrowse.site.unregister(SomeModel)
- def test_root(self):
+ def test_urls(self):
django_databrowse.site.register(SomeModel)
response = Client().get('')
self.assertEqual(response.status_code, 200)
@@ -61,3 +61,11 @@ class DatabrowseTestsClient(TestCase):
response = Client().get('/django_databrowse/somemodel/')
self.assertEqual(response.status_code, 200)
+
+ response = Client().get('/django_databrowse/doesnotexistmodel/')
+ self.assertEqual(response.status_code, 404)
+ response = Client().get('/django_databrowse/something/somemodel/')
+ self.assertEqual(response.status_code, 404)
+ response = Client().get(
+ '/django_databrowse/somemodel/fields/some_field/')
+ self.assertEqual(response.status_code, 200)
|
added a test on a model field detail page
|
py
|
diff --git a/examples/example_22_saga_python/start_saga.py b/examples/example_22_saga_python/start_saga.py
index <HASH>..<HASH> 100644
--- a/examples/example_22_saga_python/start_saga.py
+++ b/examples/example_22_saga_python/start_saga.py
@@ -13,10 +13,10 @@ import os
import traceback
-ADDRESS = '130.149.250.16'
-USER = 'user'
-PASSWORD = '12345'
-WORKING_DIR = '/home/' + USER + '/python/saga-test'
+ADDRESS = '12345.fake.street' # Address of your server
+USER = 'user' # Username
+PASSWORD = '12345' # That's amazing I got the same combination on my luggage!
+WORKING_DIR = '/myhome/' # Your working directory
def upload_file(filename, session):
|
FIX: Also changed address;
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,7 @@ from setuptools import setup, find_packages, Extension
from mwparserfromhell import __version__
from mwparserfromhell.compat import py26, py3k
-with open("README.rst") as fp:
+with open("README.rst", **{'encoding':'utf-8'} if py3k else {}) as fp:
long_docs = fp.read()
tokenizer = Extension("mwparserfromhell.parser._tokenizer",
|
Force opening README.rst as utf-8 Causes issues if the locale is not set to utf-8
|
py
|
diff --git a/src/saml2/client.py b/src/saml2/client.py
index <HASH>..<HASH> 100644
--- a/src/saml2/client.py
+++ b/src/saml2/client.py
@@ -222,7 +222,7 @@ class Saml2Client(Base):
sign = True
if sign is None:
- sign = self.logout_requests_signed
+ sign = self.config.logout_requests_signed
sigalg = None
if sign:
|
Fix check for signed logout ``` ************* Module saml2.client src/saml2/client.py:<I>:<I>: E<I>: Instance of 'Saml2Client' has no 'logout_requests_signed' member (no-member) ``` The reference should be through the config member of the Saml2Client object.
|
py
|
diff --git a/salt/returners/postgres.py b/salt/returners/postgres.py
index <HASH>..<HASH> 100644
--- a/salt/returners/postgres.py
+++ b/salt/returners/postgres.py
@@ -31,7 +31,7 @@ correctly::
DROP TABLE IF EXISTS jids;
CREATE TABLE jids (
- jid bigint PRIMARY KEY,
+ jid varchar(20) PRIMARY KEY,
load text NOT NULL
);
|
jids can't be ints anymore, because we can now set jid names.
|
py
|
diff --git a/superset/utils/core.py b/superset/utils/core.py
index <HASH>..<HASH> 100644
--- a/superset/utils/core.py
+++ b/superset/utils/core.py
@@ -1025,8 +1025,8 @@ def merge_extra_filters( # pylint: disable=too-many-branches
for existing in adhoc_filters:
if (
existing["expressionType"] == "SIMPLE"
- and existing["comparator"] is not None
- and existing["subject"] is not None
+ and existing.get("comparator") is not None
+ and existing.get("subject") is not None
):
existing_filters[get_filter_key(existing)] = existing["comparator"]
|
fix: missing key when verifying adhoc filters in merge_extra_filters (#<I>)
|
py
|
diff --git a/glue/ligolw/lsctables.py b/glue/ligolw/lsctables.py
index <HASH>..<HASH> 100644
--- a/glue/ligolw/lsctables.py
+++ b/glue/ligolw/lsctables.py
@@ -853,8 +853,8 @@ class SnglInspiral(object):
def get_effective_snr(self):
return self.snr/ (1 + self.snr**2/250)**(0.25)/(self.chisq/(2*self.chisq_dof - 2) )**(0.25)
- def get_ifar(self):
- return 1./self.alpha
+ def get_far(self):
+ return self.alpha
def get_id_parts(self):
"""
|
Merging in changes made between <I> and <I> on the cbc_s5_1yr_<I> branch onto the head. PR <I>
|
py
|
diff --git a/mzgtfs/__init__.py b/mzgtfs/__init__.py
index <HASH>..<HASH> 100644
--- a/mzgtfs/__init__.py
+++ b/mzgtfs/__init__.py
@@ -4,4 +4,4 @@ This package is used internally to read and process GTFS files and to create One
"""
-__version__ = '0.10.3'
\ No newline at end of file
+__version__ = 'master'
\ No newline at end of file
|
Set master version to 'master'
|
py
|
diff --git a/tests/scripts/sql_coverage_test.py b/tests/scripts/sql_coverage_test.py
index <HASH>..<HASH> 100755
--- a/tests/scripts/sql_coverage_test.py
+++ b/tests/scripts/sql_coverage_test.py
@@ -80,7 +80,7 @@ def run_once(name, command, statements_path, results_path, testConfigKit):
server = subprocess.Popen(command + " backend=" + name, shell = True)
client = None
- for i in xrange(10):
+ for i in xrange(30):
try:
client = VoltQueryClient(host, port)
client.set_quiet(True)
@@ -467,7 +467,7 @@ if __name__ == "__main__":
success = True
statistics = {}
for config_name in configs_to_run:
- print >> sys.stderr, "SQLCOVERAGE: STARTING ON CONFIG: %s" % config_name
+ print >> sys.stderr, "\nSQLCOVERAGE: STARTING ON CONFIG: %s\n" % config_name
report_dir = output_dir + '/' + config_name
config = config_list.get_config(config_name)
if(options.hostname != None and options.hostname != defaultHost):
|
Fix sql-coverage on slow machines. It just wasn't running long enough.
|
py
|
diff --git a/sorl/thumbnail/engines/wand_engine.py b/sorl/thumbnail/engines/wand_engine.py
index <HASH>..<HASH> 100644
--- a/sorl/thumbnail/engines/wand_engine.py
+++ b/sorl/thumbnail/engines/wand_engine.py
@@ -14,6 +14,9 @@ class Engine(EngineBase):
def get_image_size(self, image):
return image.size
+ def get_image_info(self, image):
+ return image.info or {}
+
def is_valid_image(self, raw_data):
'''
Wand library makes sure when opening any image that is fine, when
@@ -64,7 +67,7 @@ class Engine(EngineBase):
image.crop(x_offset, y_offset, width=width, height=height)
return image
- def _get_raw_data(self, image, format_, quality, progressive=False):
+ def _get_raw_data(self, image, format_, quality, image_info=None, progressive=False):
image.compression_quality = quality
if format_ == 'JPEG' and progressive:
image.format = 'pjpeg'
|
Missing implementation for the wand engine
|
py
|
diff --git a/tests/test_common_data.py b/tests/test_common_data.py
index <HASH>..<HASH> 100644
--- a/tests/test_common_data.py
+++ b/tests/test_common_data.py
@@ -2,7 +2,7 @@ import pytest
import stanza
from tests import *
-from stanza.models.common.data import get_augment_ratio
+from stanza.models.common.data import get_augment_ratio, augment_punct
pytestmark = [pytest.mark.travis, pytest.mark.pipeline]
@@ -23,3 +23,10 @@ def test_augment_ratio():
# and 7 that are eligible to be augmented
# so 2/7 will need to be augmented
assert get_augment_ratio(data, should_augment, can_augment, desired_ratio=0.4) == pytest.approx(2/7)
+
+def test_augment_punct():
+ data = [["Simple", "test", "."]]
+ should_augment = lambda x: x[-1] == "."
+ can_augment = should_augment
+ new_data = augment_punct(data, 1.0, should_augment, can_augment)
+ assert new_data == [["Simple", "test"]]
|
Add a very simple test of removing punct
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -29,6 +29,6 @@ setup(
install_requires=[
'numpy',
'atpbar>=1.0.2',
- 'mantichora>=0.9.3',
+ 'mantichora>=0.9.4',
],
)
|
update mantichora version from <I> to <I>
|
py
|
diff --git a/arguments/__init__.py b/arguments/__init__.py
index <HASH>..<HASH> 100644
--- a/arguments/__init__.py
+++ b/arguments/__init__.py
@@ -253,6 +253,7 @@ class Arguments(object):
if doc is not None:
triggerword = "usage"
+
newdoc = remove_extra_indentation(doc, triggerword)
self.m_doc = self.reorder_commandlist(newdoc)
@@ -361,6 +362,7 @@ class Arguments(object):
for cmd in commandkeys:
if len(commands[cmd].strip()) > 0:
+
newdoc += " " * 4
newdoc += cmd
newdoc += " " * 2
@@ -368,6 +370,7 @@ class Arguments(object):
newdoc += commands[cmd].strip()
newdoc += "\n"
+
return newdoc.strip()
def get_usage_from_mdoc(self):
|
research Monday <I> May <I> (week:<I> day:<I>), <I>:<I>:<I>
|
py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.