diff
stringlengths 139
3.65k
| message
stringlengths 8
627
| diff_languages
stringclasses 1
value |
|---|---|---|
diff --git a/docs/source/generate_configs.py b/docs/source/generate_configs.py
index <HASH>..<HASH> 100755
--- a/docs/source/generate_configs.py
+++ b/docs/source/generate_configs.py
@@ -22,15 +22,13 @@ NOTE = """
"""
-def rewrite_entries(config, path, specpath, sec=None, sort=False):
+def rewrite_entries(config, path, specpath, sec=None):
file = open(path, 'w')
file.write(NOTE % specpath)
if sec is None:
sec = config
- if sort:
- sec.scalars.sort()
- for entry in sec.scalars:
+ for entry in sorted(sec.scalars):
v = Validator()
etype, eargs, ekwargs, default = v._parse_check(sec[entry])
if default is not None:
@@ -72,7 +70,7 @@ if __name__ == "__main__":
alotrc_table_file = os.path.join(HERE, 'configuration', 'alotrc_table')
rewrite_entries(config.configspec, alotrc_table_file,
- 'defaults/alot.rc.spec', sort=True)
+ 'defaults/alot.rc.spec')
rewrite_entries(config,
os.path.join(HERE, 'configuration', 'accounts_table'),
|
docs: ensure configs are sorted as well
|
py
|
diff --git a/examples/tenant_tutorial/tenant_tutorial/settings.py b/examples/tenant_tutorial/tenant_tutorial/settings.py
index <HASH>..<HASH> 100644
--- a/examples/tenant_tutorial/tenant_tutorial/settings.py
+++ b/examples/tenant_tutorial/tenant_tutorial/settings.py
@@ -156,7 +156,15 @@ TENANT_MODEL = "customers.Client" # app.Model
DEFAULT_FILE_STORAGE = 'tenant_schemas.storage.TenantFileSystemStorage'
-INSTALLED_APPS = list(OrderedDict.fromkeys(SHARED_APPS + TENANT_APPS))
+INSTALLED_APPS = (
+ 'tenant_schemas',
+ 'customers',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+)
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
|
Explicitly define INSTALLED_APPS in settings.py
|
py
|
diff --git a/pyfakefs/tests/fake_os_test.py b/pyfakefs/tests/fake_os_test.py
index <HASH>..<HASH> 100644
--- a/pyfakefs/tests/fake_os_test.py
+++ b/pyfakefs/tests/fake_os_test.py
@@ -4711,9 +4711,13 @@ class FakeScandirTest(FakeOsModuleTestBase):
[f.path for f in self.scandir(link_path)])
def test_inode(self):
- if use_scandir and self.is_windows and self.use_real_fs():
- self.skipTest(
- 'inode seems not to work in scandir module under Windows')
+ if use_scandir and self.use_real_fs():
+ if self.is_windows:
+ self.skipTest(
+ 'inode seems not to work in scandir module under Windows')
+ if os.path.exists('/.dockerenv'):
+ self.skipTest(
+ 'inode seems not to work in a Docker container')
self.assertEqual(self.os.stat(self.dir_path).st_ino,
self.dir_entries[0].inode())
self.assertEqual(self.os.stat(self.file_path).st_ino,
|
Skip RealScandirTest.test_inode if running in Docker container - fails there for unknown reason
|
py
|
diff --git a/seleniumbase/fixtures/constants.py b/seleniumbase/fixtures/constants.py
index <HASH>..<HASH> 100755
--- a/seleniumbase/fixtures/constants.py
+++ b/seleniumbase/fixtures/constants.py
@@ -48,6 +48,11 @@ class Dashboard:
DASH_PIE_PNG_3 = encoded_images.DASH_PIE_PNG_3 # Faster than CDN
+class MultiBrowser:
+ CHROMEDRIVER_FIXING_LOCK = Files.DOWNLOADS_FOLDER + "/driver_fixing.lock"
+ CHROMEDRIVER_REPAIRED = Files.DOWNLOADS_FOLDER + "/driver_fixed.lock"
+
+
class SavedCookies:
STORAGE_FOLDER = "saved_cookies"
|
Add lock files for repairing ChromeDriver in multi-process mode
|
py
|
diff --git a/ontquery/terms.py b/ontquery/terms.py
index <HASH>..<HASH> 100644
--- a/ontquery/terms.py
+++ b/ontquery/terms.py
@@ -110,6 +110,9 @@ class OntId(str): # TODO all terms singletons to prevent nastyness
def __new__(cls, curie_or_iri=None, prefix=None, suffix=None, curie=None, iri=None, **kwargs):
+ if type(curie_or_iri) == cls:
+ return curie_or_iri
+
if not hasattr(cls, f'_{cls.__name__}__repr_level'):
cls.__repr_level = 0
cls._oneshot_old_repr_args = None
|
terms.__new__ don't run twice on same type
|
py
|
diff --git a/cobe/model.py b/cobe/model.py
index <HASH>..<HASH> 100644
--- a/cobe/model.py
+++ b/cobe/model.py
@@ -121,9 +121,9 @@ class Model(object):
# Create a reverse n-gram key from a count key as returned by
# _tokens_count_key.
- # key is "t" + token1token2token3. Rotate its grams to
- # token2token3token1 so we can easily enumerate the tokens
- # that precede token2token3
+ # key is e.g. "3" + token1token2token3. Strip the number
+ # prefix and rotate its grams to token2token3token1 so we can
+ # easily enumerate the tokens that precede token2token3
token_nums = varint.decode(key[1:])
token_nums.append(token_nums[0])
|
Improve the comment in _tokens_reverse_key
|
py
|
diff --git a/labware/microplates.py b/labware/microplates.py
index <HASH>..<HASH> 100644
--- a/labware/microplates.py
+++ b/labware/microplates.py
@@ -27,16 +27,4 @@ class Microplate(GridContainer):
Coordinates should represent the center and near-bottom of well
A1 with the pipette tip in place.
"""
- super(Microplate, self).calibrate(**kwargs)
-
-
-class Microplate_96(Microplate):
- pass
-
-
-class Microplate_96_Deepwell(Microplate_96):
- volume = 400
- min_vol = 50
- max_vol = 380
- height = 14.6
- depth = 10.8
+ super(Microplate, self).calibrate(**kwargs)
\ No newline at end of file
|
Microplate subsets are obsolete now with the new containers.
|
py
|
diff --git a/salt/modules/linux_lvm.py b/salt/modules/linux_lvm.py
index <HASH>..<HASH> 100644
--- a/salt/modules/linux_lvm.py
+++ b/salt/modules/linux_lvm.py
@@ -206,8 +206,10 @@ def pvcreate(devices, override=True, **kwargs):
cmd = ['pvcreate']
for device in devices.split(','):
if not os.path.exists(device):
- return '{0} does not exist'.format(device)
- cmd.append(device)
+ raise CommandExecutionError('{0} does not exist'.format(device))
+ # Verify pvcreate was successful
+ if not pvdisplay(device):
+ cmd.append(device)
elif not override:
raise CommandExecutionError('Device "{0}" is already an LVM physical volume.'.format(device))
|
Bugfix: use exceptions for failure in pvcreate
|
py
|
diff --git a/werkzeug/contrib/cache.py b/werkzeug/contrib/cache.py
index <HASH>..<HASH> 100644
--- a/werkzeug/contrib/cache.py
+++ b/werkzeug/contrib/cache.py
@@ -471,15 +471,15 @@ class RedisCache(BaseCache):
:param key_prefix: A prefix that should be added to all keys.
"""
- def __init__(self, host='localhost', port=6379, default_timeout=300,
- key_prefix=None):
+ def __init__(self, host='localhost', port=6379, password=None,
+ default_timeout=300, key_prefix=None):
BaseCache.__init__(self, default_timeout)
if isinstance(host, basestring):
try:
import redis
except ImportError:
raise RuntimeError('no redis module found')
- self._client = redis.Redis(host=host, port=port)
+ self._client = redis.Redis(host=host, port=port, password=password)
else:
self._client = host
self.key_prefix = key_prefix or ''
|
Added password support to RedisCache.
|
py
|
diff --git a/tests/utils.py b/tests/utils.py
index <HASH>..<HASH> 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -6,9 +6,13 @@ TEST_DIR = path.dirname(__file__)
def load_snippet(filename):
"""Helper to fetch in the content of a test snippet"""
- return open(path.join(TEST_DIR, 'test_snippets', filename)).read()
+ file_path = path.join(TEST_DIR, 'test_snippets', filename)
+ with open(file_path) as file:
+ return file.read()
def load_article(filename):
"""Helper to fetch in the content of a test article"""
- return open(path.join(TEST_DIR, 'test_articles', filename)).read()
+ file_path = path.join(TEST_DIR, 'test_articles', filename)
+ with open(file_path) as file:
+ return file.read()
|
Suppress warning "ResourceWarning: unclosed file"
|
py
|
diff --git a/inginious/frontend/pages/tasks.py b/inginious/frontend/pages/tasks.py
index <HASH>..<HASH> 100644
--- a/inginious/frontend/pages/tasks.py
+++ b/inginious/frontend/pages/tasks.py
@@ -38,6 +38,11 @@ class BaseTaskPage(object):
def set_selected_submission(self, course, task, submissionid):
submission = self.submission_manager.get_submission(submissionid)
+
+ # Do not continue if submission does not exist or is not owned by current user
+ if not submission:
+ return None
+
is_staff = self.user_manager.has_staff_rights_on_course(course, self.user_manager.session_username())
# Do not enable submission selection after deadline
|
Fix error when admin attempt to set user eval submission
|
py
|
diff --git a/tests/unit/modules/timezone_test.py b/tests/unit/modules/timezone_test.py
index <HASH>..<HASH> 100644
--- a/tests/unit/modules/timezone_test.py
+++ b/tests/unit/modules/timezone_test.py
@@ -66,6 +66,9 @@ class TimezoneTestCase(TestCase):
'os': 'Debian'}):
self.assertEqual(timezone.get_zone(), '#\nA')
+ with patch('salt.utils.fopen', mock_open(read_data=file_data),
+ create=True) as mfile:
+ mfile.return_value.__iter__.return_value = file_data.splitlines()
with patch.dict(timezone.__grains__, {'os_family': 'Gentoo',
'os': 'Gentoo'}):
self.assertEqual(timezone.get_zone(), '#\nA')
|
Fix issue that #<I> exposed in timezone_test
|
py
|
diff --git a/utils/string_parsers.py b/utils/string_parsers.py
index <HASH>..<HASH> 100644
--- a/utils/string_parsers.py
+++ b/utils/string_parsers.py
@@ -23,7 +23,7 @@ def colon_separated_string_to_dict(string):
line_data = line.split(':')
if len(line_data) > 1:
- dictionary[line_data[0].strip()] = ''.join(line_data[1:])
+ dictionary[line_data[0].strip()] = ''.join(line_data[1:]).strip()
elif len(line_data) == 1:
dictionary[line_data[0].strip()] = None
else:
|
Strip moved to the parser as it is more useful there
|
py
|
diff --git a/qds_sdk/connection.py b/qds_sdk/connection.py
index <HASH>..<HASH> 100644
--- a/qds_sdk/connection.py
+++ b/qds_sdk/connection.py
@@ -140,7 +140,7 @@ class Connection:
elif code == 422:
sys.stderr.write(response.text + "\n")
raise ResourceInvalid(response)
- elif code in (449, 503):
+ elif code in (449, 502, 503, 504):
sys.stderr.write(response.text + "\n")
raise RetryWithDelay(response)
elif 401 <= code < 500:
|
Add retries for GET calls which return <I> or <I> errors.
|
py
|
diff --git a/tohu/base_NEW.py b/tohu/base_NEW.py
index <HASH>..<HASH> 100644
--- a/tohu/base_NEW.py
+++ b/tohu/base_NEW.py
@@ -1,3 +1,4 @@
+from abc import ABCMeta, abstractmethod
from itertools import islice
from random import Random
from tqdm import tqdm
@@ -33,9 +34,6 @@ class SeedGenerator:
return self.randgen.randint(self.minval, self.maxval)
-#
-# TODO: Make `TohuUltraBaseGenerator` an abstract base class to ensure that the expected API methods are implemented.
-#
class TohuUltraBaseGenerator(metaclass=ABCMeta):
"""
This is the base class for all tohu generators.
@@ -44,9 +42,11 @@ class TohuUltraBaseGenerator(metaclass=ABCMeta):
def __iter__(self):
return self
+ @abstractmethod
def __next__(self):
raise NotImplementedError("Class {} does not implement method '__next__'.".format(self.__class__.__name__))
+ @abstractmethod
def reset(self, seed):
raise NotImplementedError("Class {} does not implement method 'reset'.".format(self.__class__.__name__))
|
Make TohuUltraBaseGenerator an abstract base class; mark __next__() and reset() as abstract methods
|
py
|
diff --git a/bitcash/network/services.py b/bitcash/network/services.py
index <HASH>..<HASH> 100644
--- a/bitcash/network/services.py
+++ b/bitcash/network/services.py
@@ -143,6 +143,14 @@ class BitcoinDotComAPI():
return r.json()['transactions']
@classmethod
+ def get_transactions_testnet(cls, address):
+ r = requests.get(cls.TEST_ADDRESS_API.format(address),
+ timeout=DEFAULT_TIMEOUT)
+ if r.status_code != 200: # pragma: no cover
+ raise ConnectionError
+ return r.json()['transactions']
+
+ @classmethod
def get_transaction(cls, txid):
r = requests.get(cls.MAIN_TX_API.format(txid),
timeout=DEFAULT_TIMEOUT)
|
Added missing get_transactions_testnet BitcoinDotComAPI
|
py
|
diff --git a/dvc/cache/base.py b/dvc/cache/base.py
index <HASH>..<HASH> 100644
--- a/dvc/cache/base.py
+++ b/dvc/cache/base.py
@@ -273,7 +273,7 @@ class CloudCache:
to_info = self.tree.path_info / tmp_fname("")
self.tree.upload(from_info, to_info, no_progress_bar=True)
- hash_info = self.tree.get_hash(to_info)
+ hash_info = self.tree.get_file_hash(to_info)
hash_info.value += self.tree.CHECKSUM_DIR_SUFFIX
hash_info.dir_info = dir_info
|
cache: use get_file_hash instead of get_hash (#<I>) This is what we've been doing before. No need to try to pull it up from the state db, as this is a clearly newly generated file that will get deleted.
|
py
|
diff --git a/samcli/local/docker/lambda_container.py b/samcli/local/docker/lambda_container.py
index <HASH>..<HASH> 100644
--- a/samcli/local/docker/lambda_container.py
+++ b/samcli/local/docker/lambda_container.py
@@ -181,9 +181,9 @@ class LambdaContainer(Container):
+ debug_args_list \
+ [
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,quiet=y,address=" + str(debug_port),
- "-XX:MaxHeapSize=1336935k",
- "-XX:MaxMetaspaceSize=157286k",
- "-XX:ReservedCodeCacheSize=78643k",
+ "-XX:MaxHeapSize=2834432k",
+ "-XX:MaxMetaspaceSize=163840k",
+ "-XX:ReservedCodeCacheSize=81920k",
"-XX:+UseSerialGC",
# "-Xshare:on", doesn't work in conjunction with the debug options
"-XX:-TieredCompilation",
|
chore: Update JVM size params to match docker-lambda (#<I>)
|
py
|
diff --git a/rtbhouse_sdk/reports_api.py b/rtbhouse_sdk/reports_api.py
index <HASH>..<HASH> 100644
--- a/rtbhouse_sdk/reports_api.py
+++ b/rtbhouse_sdk/reports_api.py
@@ -112,6 +112,9 @@ class ReportsApiSession:
def get_rtb_conversions(self, adv_hash, day_from, day_to):
deduplicated = self._get('/advertisers/' + adv_hash + '/deduplicated-conversions', {'dayFrom': day_from, 'dayTo': day_to})
+ for i in deduplicated:
+ i['conversionType'] = 'deduplicated'
+
post_click = self._get('/advertisers/' + adv_hash + '/conversions', {'dayFrom': day_from, 'dayTo': day_to, 'conversionType' : 'POST_CLICK'})
post_view = self._get('/advertisers/' + adv_hash + '/conversions', {'dayFrom': day_from, 'dayTo': day_to, 'conversionType' : 'POST_VIEW'})
all_post_click = post_click + deduplicated
|
Update reports_api.py minor change
|
py
|
diff --git a/src/binwalk/core/module.py b/src/binwalk/core/module.py
index <HASH>..<HASH> 100644
--- a/src/binwalk/core/module.py
+++ b/src/binwalk/core/module.py
@@ -536,11 +536,16 @@ class Modules(object):
def _set_arguments(self, argv=[], kargv={}):
for (k,v) in iterator(kargv):
k = self._parse_api_opt(k)
- argv.append(k)
if v not in [True, False, None]:
- if not isinstance(v, str):
- v = str(bytes2str(v))
- argv.append(v)
+ if not isinstance(v, list):
+ v = [v]
+ for value in v:
+ if not isinstance(value, str):
+ value = str(bytes2str(value))
+ argv.append(k)
+ argv.append(value)
+ else:
+ argv.append(k)
if not argv and not self.arguments:
self.arguments = sys.argv[1:]
|
Fixed bug which prevented multiple API arguments from being passed as kwargs
|
py
|
diff --git a/underwear/run_underwear.py b/underwear/run_underwear.py
index <HASH>..<HASH> 100644
--- a/underwear/run_underwear.py
+++ b/underwear/run_underwear.py
@@ -71,6 +71,10 @@ def deploy(args):
options.sudo_user = options.sudo_user or C.DEFAULT_SUDO_USER
extra_vars={}
+
+ skip_tags = options.skip_tags
+ if options.skip_tags is not None:
+ skip_tags = options.skip_tags.split(",")
playbook = args[0]
inventory.set_playbook_basedir(os.path.dirname(playbook))
|
updating script to include ansible playbook execution hook
|
py
|
diff --git a/salt/runners/manage.py b/salt/runners/manage.py
index <HASH>..<HASH> 100644
--- a/salt/runners/manage.py
+++ b/salt/runners/manage.py
@@ -5,15 +5,16 @@ and what hosts are down
'''
# Import python libs
-from __future__ import print_function
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
import os
import operator
import re
import subprocess
import tempfile
import time
-import urllib
+
+# Import 3rd-party libs
+from salt.ext.six.moves.urllib.request import url_open as _url_open # pylint: disable=no-name-in-module,import-error
# Import salt libs
import salt.key
@@ -370,7 +371,7 @@ def bootstrap_psexec(hosts='', master=None, version=None, arch='win32',
if not installer_url:
base_url = 'http://docs.saltstack.com/downloads/'
- source = urllib.urlopen(base_url).read()
+ source = _url_open(base_url).read()
salty_rx = re.compile('>(Salt-Minion-(.+?)-(.+)-Setup.exe)</a></td><td align="right">(.*?)\\s*<')
source_list = sorted([[path, ver, plat, time.strptime(date, "%d-%b-%Y %H:%M")]
for path, ver, plat, date in salty_rx.findall(source)],
|
Use `url_open` from six
|
py
|
diff --git a/isso/ext/notifications.py b/isso/ext/notifications.py
index <HASH>..<HASH> 100644
--- a/isso/ext/notifications.py
+++ b/isso/ext/notifications.py
@@ -67,7 +67,7 @@ class SMTP(object):
username = self.conf.get('username')
password = self.conf.get('password')
- if username is not None and password is not None:
+ if username and password:
if PY2K:
username = username.encode('ascii')
password = password.encode('ascii')
|
Correct auth without password or username. If no username is set, returns an empty string. So the test `username is not None` is always True. Idem for password. This can lead to authentication problems. This commit fixes the test to `if username and password` as it was in the previous version.
|
py
|
diff --git a/test/helpers.py b/test/helpers.py
index <HASH>..<HASH> 100644
--- a/test/helpers.py
+++ b/test/helpers.py
@@ -141,14 +141,18 @@ class RunOnceTask(luigi.Task):
class LuigiTestCase(unittest.TestCase):
"""
Tasks registred within a test case will get unregistered in a finalizer
+
+ Instance caches are cleared before and after all runs
"""
def setUp(self):
super(LuigiTestCase, self).setUp()
self._stashed_reg = luigi.task_register.Register._get_reg()
+ luigi.task_register.Register.clear_instance_cache()
def tearDown(self):
luigi.task_register.Register._set_reg(self._stashed_reg)
super(LuigiTestCase, self).tearDown()
+ luigi.task_register.Register.clear_instance_cache()
def run_locally(self, args):
""" Helper for running tests testing more of the stack, the command
|
Updates LuigiTestCase to clear instance caches before and after runs
|
py
|
diff --git a/src/python/dxpy/__init__.py b/src/python/dxpy/__init__.py
index <HASH>..<HASH> 100644
--- a/src/python/dxpy/__init__.py
+++ b/src/python/dxpy/__init__.py
@@ -111,11 +111,11 @@ environment variables:
.. envvar:: HTTP_PROXY
- HTTP proxy, in the form 'hostname:port' (e.g. '10.10.1.10:3128')
+ HTTP proxy, in the form 'protocol://hostname:port' (e.g. 'http://10.10.1.10:3128')
.. envvar:: HTTPS_PROXY
- HTTPS proxy, in the form 'hostname:port'
+ HTTPS proxy, in the form 'protocol://hostname:port'
'''
|
Add protocol to proxy variable documentation; not specifying the protocol breaks some versions of requests/openssl
|
py
|
diff --git a/indra/assemblers/pysb_assembler.py b/indra/assemblers/pysb_assembler.py
index <HASH>..<HASH> 100644
--- a/indra/assemblers/pysb_assembler.py
+++ b/indra/assemblers/pysb_assembler.py
@@ -392,7 +392,7 @@ def set_extended_initial_condition(model, monomer, value=0):
if site in monomer.site_states:
sites_dict[site] = monomer.site_states[site][-1]
else:
- mod_sites_dict[site] = ANY
+ sites_dict[site] = ANY
mp = monomer(**sites_dict)
pname = monomer.name + '_0_mod'
try:
|
Fix extended initial value setting for binding sites in PySB Assembler
|
py
|
diff --git a/flake8_future_import.py b/flake8_future_import.py
index <HASH>..<HASH> 100755
--- a/flake8_future_import.py
+++ b/flake8_future_import.py
@@ -166,7 +166,7 @@ def main(args):
return
parser = argparse.ArgumentParser()
choices = set(10 + feature.index for feature in FEATURES.values())
- choices |= set(50 + choice for choice in choices) | set([90])
+ choices |= set(40 + choice for choice in choices) | set([90])
choices = set('FI{0}'.format(choice) for choice in choices)
parser.add_argument('--ignore', help='Ignore the given comma-separated '
'codes')
|
Fix defining upper error codes The upper error codes (`FI<I>` and greater) accidentally used `FI<I>` and greater.
|
py
|
diff --git a/hvac/v1/__init__.py b/hvac/v1/__init__.py
index <HASH>..<HASH> 100644
--- a/hvac/v1/__init__.py
+++ b/hvac/v1/__init__.py
@@ -162,7 +162,7 @@ class Client(object):
payload = {
'list': True
}
- return self._adapter.get('/v1/{}'.format(path), params=payload).json()
+ return self._adapter.get('/v1/{0}'.format(path), params=payload).json()
except exceptions.InvalidPath:
return None
|
'list' function python <I> compatibility (#<I>) Other functions use '/v1/{0}' format, 'list' should as well. The {} format doesn't work in python <I>.
|
py
|
diff --git a/km3pipe/pumps/clb.py b/km3pipe/pumps/clb.py
index <HASH>..<HASH> 100644
--- a/km3pipe/pumps/clb.py
+++ b/km3pipe/pumps/clb.py
@@ -46,7 +46,7 @@ class CLBPump(Pump):
except struct.error:
pass
self.rewind_file()
- log.info("Found {0} CLB UDP packets.".format(len(self.packet_positions)))
+ print("Found {0} CLB UDP packets.".format(len(self.packet_positions)))
def seek_to_packet(self, index):
"""Move file pointer to the packet with given index."""
|
Changes log.info to print for found packets
|
py
|
diff --git a/pyblish_qml/__main__.py b/pyblish_qml/__main__.py
index <HASH>..<HASH> 100644
--- a/pyblish_qml/__main__.py
+++ b/pyblish_qml/__main__.py
@@ -1,4 +1,4 @@
import sys
import app
-sys.exit(app.main())
+sys.exit(app.cli())
|
Updating __main__.py to new CLI
|
py
|
diff --git a/moneyfield/fields.py b/moneyfield/fields.py
index <HASH>..<HASH> 100644
--- a/moneyfield/fields.py
+++ b/moneyfield/fields.py
@@ -21,7 +21,7 @@ __all__ = ['MoneyField', 'MoneyModelForm']
logger = logging.getLogger(__name__)
-REGEX_CURRENCY_CODE = re.compile("[A-Z]{3}")
+REGEX_CURRENCY_CODE = re.compile("^[A-Z]{3}$")
def currency_code_validator(value):
if not REGEX_CURRENCY_CODE.match(force_text(value)):
raise ValidationError('Invalid currency code.')
|
Add start and end to currency validation regex
|
py
|
diff --git a/doc/conf.py b/doc/conf.py
index <HASH>..<HASH> 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -35,6 +35,7 @@ if rtd:
sys.modules.update((mod_name, unittest.mock.Mock()) for mod_name in MOCK_MODULES)
# Mocking certain classes causes subclasses not to be documented properly
sys.modules['spead2._spead2.send'].UdpStreamAsyncio = object
+ sys.modules['spead2._spead2.send'].UdpIbvStreamAsyncio = object
# -- General configuration ------------------------------------------------
|
Fix a compilation error on readthedocs
|
py
|
diff --git a/qiskit/_quantumprogram.py b/qiskit/_quantumprogram.py
index <HASH>..<HASH> 100644
--- a/qiskit/_quantumprogram.py
+++ b/qiskit/_quantumprogram.py
@@ -383,7 +383,8 @@ class QuantumProgram(object):
max_credits is the credits of the experiments.
basis_gates are the base gates by default are: u1,u2,u3,cx,id
"""
- self.compile(circuits, device, shots, max_credits, coupling_map)
+ self.compile(circuits, device, shots, max_credits,
+ basis_gates, coupling_map)
output = self.run(wait, timeout)
if 'error' in output:
return {"status": "Error", "result": output['error']}
|
fix call to compile() in execute().
|
py
|
diff --git a/subnuker.py b/subnuker.py
index <HASH>..<HASH> 100644
--- a/subnuker.py
+++ b/subnuker.py
@@ -126,7 +126,7 @@ class AeidonProject:
for match in matches:
os.system('clear')
- print(self.project.main_file.read()[match].main_text)
+ print(self.project.subtitles[match].main_text)
print('----------------------------------------')
print("Delete cell %s of '%s'?" % (str(match + 1), self.filename))
response = getch().lower()
|
Fix bug encountered when subtitles are mis-ordered
|
py
|
diff --git a/source/rafcon/mvc/history.py b/source/rafcon/mvc/history.py
index <HASH>..<HASH> 100755
--- a/source/rafcon/mvc/history.py
+++ b/source/rafcon/mvc/history.py
@@ -234,7 +234,7 @@ def insert_state_meta_data(meta_dict, state_model, with_parent_linkage=True, wit
for state_id, state_m in state_model.states.iteritems():
if with_prints:
print "FIN: ", state_id, state_m.state.state_id, meta_dict['states'].keys(), state_model.state.state_id
- if state_m.state.state_id is not UNIQUE_DECIDER_STATE_ID:
+ if state_m.state.state_id != UNIQUE_DECIDER_STATE_ID:
insert_state_meta_data(meta_dict['states'][state_m.state.state_id], state_m, with_parent_linkage)
if with_prints:
print "FINISHED META for STATE: ", state_m.state.state_id
|
Compare string with "!=" instead of "is not"
|
py
|
diff --git a/malcolm/modules/pandablocks/parts/pandablocksmaker.py b/malcolm/modules/pandablocks/parts/pandablocksmaker.py
index <HASH>..<HASH> 100644
--- a/malcolm/modules/pandablocks/parts/pandablocksmaker.py
+++ b/malcolm/modules/pandablocks/parts/pandablocksmaker.py
@@ -175,7 +175,9 @@ class PandABlocksMaker(object):
inport = Port.BOOL
else:
inport = Port.INT32
- meta = ChoiceMeta(field_data.description, field_data.labels, tags=[
+ labels = [x for x in field_data.labels if x in ("ZERO", "ONE")] + \
+ sorted(x for x in field_data.labels if x not in ("ZERO", "ONE"))
+ meta = ChoiceMeta(field_data.description, labels, tags=[
group, inport.inport_tag("ZERO"), Widget.COMBO.tag()])
self._make_field_part(field_name, meta, writeable=True)
meta = make_meta(typ, "%s current value" % field_name,
|
Put PandA bit_mux and pos_mux labels in a more sensible order
|
py
|
diff --git a/timepiece/migrations/0035_billable_to_develop.py b/timepiece/migrations/0035_billable_to_develop.py
index <HASH>..<HASH> 100644
--- a/timepiece/migrations/0035_billable_to_develop.py
+++ b/timepiece/migrations/0035_billable_to_develop.py
@@ -9,17 +9,17 @@ class Migration(DataMigration):
def forwards(self, orm):
orm.Activity.objects.update(billable=False)
dev, created = orm.Activity.objects.get_or_create(
- code='dev',
- defaults= {
+ code = 'dev',
+ defaults = {
'name': 'Web Development',
}
)
dev.billable=True
dev.save()
non_dev, created = orm.Activity.objects.get_or_create(
- code='nobil',
- defaults= {
- 'name': 'Non-billable',
+ code = 'admin',
+ defaults = {
+ 'name': 'Administration',
}
)
non_dev.billable = False
|
change non-billable to administration in migration <I>
|
py
|
diff --git a/eli5/formatters/image.py b/eli5/formatters/image.py
index <HASH>..<HASH> 100644
--- a/eli5/formatters/image.py
+++ b/eli5/formatters/image.py
@@ -104,6 +104,7 @@ def format_as_image(expl, # type: Explanation
# no heatmaps
return image
else:
+ assert len(expl.targets) == 1
heatmap = expl.targets[0].heatmap
_validate_heatmap(heatmap)
|
(keras image) Assert that we have 1 target in explanation only
|
py
|
diff --git a/scripts/importer/mtasks/general_data.py b/scripts/importer/mtasks/general_data.py
index <HASH>..<HASH> 100644
--- a/scripts/importer/mtasks/general_data.py
+++ b/scripts/importer/mtasks/general_data.py
@@ -170,7 +170,7 @@ def do_ascii(events, stubs, args, tasks, task_obj, log):
events[name].add_quantity('ra', row[1], source)
events[name].add_quantity('dec', row[2], source)
events[name].add_quantity('redshift', row[3], source)
- disc_date = datetime.strptime(row[4], '%Y %bb %d').isoformat()
+ disc_date = datetime.strptime(row[4], '%Y %b %d').isoformat()
disc_date = disc_date.split('T')[0].replace('-', '/')
events[name].add_quantity('discoverdate', disc_date, source)
events, stubs = Events.journal_events(tasks, args, events, stubs, log)
|
BUG: fix formatting for string; introduced error at some point during a regex replacement."
|
py
|
diff --git a/amazon/api.py b/amazon/api.py
index <HASH>..<HASH> 100644
--- a/amazon/api.py
+++ b/amazon/api.py
@@ -315,6 +315,19 @@ class AmazonBrowseNode(object):
node = node.ancestor
return ancestors
+ @property
+ def children(self):
+ """This browse node's children in the browse node tree.
+
+ :return:
+ A list of this browse node's children in the browse node tree.
+ """
+ children = []
+ child_nodes = getattr(self.element, 'Children')
+ for child in getattr(child_nodes, 'BrowseNode', []):
+ children.append(AmazonBrowseNode(child))
+ return children
+
class AmazonProduct(object):
"""A wrapper class for an Amazon product.
|
added the children property in class AmazonBrowseNode
|
py
|
diff --git a/rtv/__main__.py b/rtv/__main__.py
index <HASH>..<HASH> 100755
--- a/rtv/__main__.py
+++ b/rtv/__main__.py
@@ -85,15 +85,11 @@ def main():
config.keymap.set_bindings(bindings)
if config['copy_config']:
- copy_default_config()
- return
+ return copy_default_config()
if config['copy_mailcap']:
- copy_default_mailcap()
- return
-
+ return copy_default_mailcap()
if config['list_themes']:
- Theme.print_themes()
- return
+ return Theme.print_themes()
# Load the browsing history from previous sessions
config.load_history()
@@ -121,6 +117,7 @@ def main():
env = [
('$DISPLAY', os.getenv('DISPLAY')),
('$TERM', os.getenv('TERM')),
+ ('$LANG', os.getenv('LANG')),
('$XDG_CONFIG_HOME', os.getenv('XDG_CONFIG_HOME')),
('$XDG_DATA_HOME', os.getenv('$XDG_DATA_HOME')),
('$RTV_EDITOR', os.getenv('RTV_EDITOR')),
|
Add $LANG to the log for debugging
|
py
|
diff --git a/spyderlib/plugins/editor.py b/spyderlib/plugins/editor.py
index <HASH>..<HASH> 100644
--- a/spyderlib/plugins/editor.py
+++ b/spyderlib/plugins/editor.py
@@ -1322,7 +1322,7 @@ class Editor(PluginWidget):
for editorstack in self.editorstacks:
editorstack.set_codeanalysis_enabled(checked)
current_editorstack = self.get_current_editorstack()
- current_index = current_editorstack.currentIndex()
+ current_index = current_editorstack.get_stack_index()
for editorstack in self.editorstacks:
for index, finfo in enumerate(editorstack.data):
finfo.editor.setup_margins(linenumbers=True,
|
Editor/bugfix: toggling code analysis state was broken
|
py
|
diff --git a/pyicloud/base.py b/pyicloud/base.py
index <HASH>..<HASH> 100644
--- a/pyicloud/base.py
+++ b/pyicloud/base.py
@@ -101,7 +101,8 @@ class PyiCloudSession(Session):
self.cookies.save(ignore_discard=True, ignore_expires=True)
LOGGER.debug("Cookies saved to %s", self.service.cookiejar_path)
- if not response.ok and content_type not in json_mimetypes:
+ if not response.ok and (content_type not in json_mimetypes
+ or response.status_code in [421, 450, 500]):
if has_retried is None and response.status_code in [421, 450, 500]:
api_error = PyiCloudAPIResponseException(
response.reason, response.status_code, retry=True
@@ -160,6 +161,8 @@ class PyiCloudSession(Session):
reason + ". Please wait a few minutes then try again."
"The remote servers might be trying to throttle requests."
)
+ if code in [421, 450, 500]:
+ reason = "Authentication required for Account."
api_error = PyiCloudAPIResponseException(reason, code)
LOGGER.error(api_error)
|
Improved support for <I>s
|
py
|
diff --git a/tests/test.py b/tests/test.py
index <HASH>..<HASH> 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -310,7 +310,7 @@ class DockerClientTest(unittest.TestCase):
args = fake_request.call_args
self.assertEqual(args[0][0],
- 'unix://var/run/docker.sock/v1.6/containers/create')
+ url_prefix + 'containers/create')
self.assertEqual(json.loads(args[1]['data']),
json.loads('''
{"Tty": false, "Image": "busybox", "Cmd": ["true"],
@@ -566,7 +566,7 @@ class DockerClientTest(unittest.TestCase):
args = fake_request.call_args
self.assertEqual(
args[0][0],
- 'unix://var/run/docker.sock/v1.6/containers/3cc2351ab11b/start'
+ url_prefix + 'containers/3cc2351ab11b/start'
)
self.assertEqual(
json.loads(args[1]['data']),
|
Fix unit tests broken by PR #<I> Updates newer unit tests to use the http+unix scheme.
|
py
|
diff --git a/git/objects/commit.py b/git/objects/commit.py
index <HASH>..<HASH> 100644
--- a/git/objects/commit.py
+++ b/git/objects/commit.py
@@ -121,7 +121,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
self.parents = parents
if encoding is not None:
self.encoding = encoding
- if gpgsig is not None:
+ if binsha == '\x00'*20 or gpgsig is not None:
self.gpgsig = gpgsig
@classmethod
|
[#<I>] Fixed error serializing programmatically created commits
|
py
|
diff --git a/sawtooth_rps/cli.py b/sawtooth_rps/cli.py
index <HASH>..<HASH> 100644
--- a/sawtooth_rps/cli.py
+++ b/sawtooth_rps/cli.py
@@ -39,8 +39,20 @@ def do_list(args, config):
client = RPSClient(base_url=url, keyfile=key_file)
state = client.get_state()
- print state
-
+ print "GAMES:"
+ for k, v in state.iteritems():
+ creator = v['InitialID']
+ players = v.get('Players')
+ state = v.get('State')
+ print "%s\tplayers: %s status: %s creator: %s" % (k, players, state.capitalize(), creator)
+ if state == "COMPLETE":
+ print " Results:"
+ for other_player, result in v['Results'].iteritems():
+ print " %s vs %s: %s" % (creator, other_player, result)
+ else:
+ print " Hands Played:"
+ for player, hand in v['Hands'].iteritems():
+ print " %s: %s" % (player, hand.capitalize())
def do_init(args, config):
username = config.get('DEFAULT', 'username')
|
rps list, print information about games
|
py
|
diff --git a/paypal/standard/models.py b/paypal/standard/models.py
index <HASH>..<HASH> 100644
--- a/paypal/standard/models.py
+++ b/paypal/standard/models.py
@@ -306,7 +306,12 @@ class PayPalStandardBase(Model):
def initialize(self, request):
"""Store the data we'll need to make the postback from the request object."""
- self.query = getattr(request, request.method).urlencode()
+ if request.method == 'GET':
+ # PDT only - this data is currently unused
+ self.query = request.META.get('QUERY_STRING', '')
+ elif request.method == 'POST':
+ # The following works if paypal sends an ASCII bytestring, which it does.
+ self.query = request.raw_post_data
self.ipaddress = request.META.get('REMOTE_ADDR', '')
def _postback(self):
|
Handle saving of query the way PayPal needs
|
py
|
diff --git a/provider/digitalocean.py b/provider/digitalocean.py
index <HASH>..<HASH> 100644
--- a/provider/digitalocean.py
+++ b/provider/digitalocean.py
@@ -12,10 +12,12 @@ from api.models import Layer
REGION_LIST = {
- 'san-francisco-1': 'San Francisco 1',
- 'amsterdam-1': 'Amsterdam 1',
'new-york-1': 'New York 1',
- 'new-york-2': 'New York 2'
+ 'amsterdam-1': 'Amsterdam 1',
+ 'san-francisco-1': 'San Francisco 1',
+ 'new-york-2': 'New York 2',
+ 'amsterdam-2': 'Amsterdam 2',
+ 'singapore-1': 'Singapore 1',
}
|
Added missing DigitalOcean cloud regions.
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup
setup(
name='pypromise',
- version='0.3',
+ version='0.4',
description='Promises/A+ implementation for Python',
long_description=open('README.rst').read(),
url='https://github.com/syrusakbary/promise',
|
Updated version to <I>
|
py
|
diff --git a/ips_vagrant/models/sites.py b/ips_vagrant/models/sites.py
index <HASH>..<HASH> 100644
--- a/ips_vagrant/models/sites.py
+++ b/ips_vagrant/models/sites.py
@@ -74,7 +74,8 @@ class Domain(Base):
"""
Domain = cls
dname = dname.hostname if hasattr(dname, 'hostname') else dname
- extras = 'www.{dn}'.format(dn=dname)
+ extras = 'www.{dn}'.format(dn=dname) if dname not in ('localhost', ) and not \
+ re.match('^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$', dname) else None
# Fetch the domain entry if it already exists
logging.getLogger('ipsv.sites.domain').debug('Checking if the domain %s has already been registered', dname)
domain = Session.query(Domain).filter(Domain.name == dname).first()
@@ -163,7 +164,7 @@ class Site(Base):
self.disable()
Session.delete(self)
- if drop_database:
+ if drop_database and self.db_name:
mysql = create_engine('mysql://root:secret@localhost')
mysql.execute('DROP DATABASE IF EXISTS `{db}`'.format(db=self.db_name))
try:
|
Don't create www versions of IP address and localhost domains, don't try and drop undefined databases
|
py
|
diff --git a/pyp2rpmlib/filters.py b/pyp2rpmlib/filters.py
index <HASH>..<HASH> 100644
--- a/pyp2rpmlib/filters.py
+++ b/pyp2rpmlib/filters.py
@@ -3,4 +3,10 @@ from pyp2rpmlib import utils
def for_python_version(name, version):
return utils.rpm_name(name, version)
-__all__ = [for_python_version]
+def macroed_pkg_name(name):
+ if name.startswith('python-'):
+ return 'python-%{pypi_name}'
+ else:
+ return '%{pypi_name}'
+
+__all__ = [for_python_version, macroed_pkg_name]
|
Filter for macroing the package name with %{pypi_name}
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from setuptools import setup, find_packages
setup(
- name='meteor-json',
+ name='meteor-ejson',
version='1.0.0',
packages=find_packages(exclude=['*tests*']),
url='',
|
Fix package name in setup.py
|
py
|
diff --git a/src/bandersnatch/master.py b/src/bandersnatch/master.py
index <HASH>..<HASH> 100644
--- a/src/bandersnatch/master.py
+++ b/src/bandersnatch/master.py
@@ -15,6 +15,8 @@ class CustomTransport(xmlrpclib.Transport):
xmlrpclib.Transport.__init__(self)
self.timeout = timeout
self.ssl = ssl
+ if not hasattr(self, '_connection'):
+ self._connection = None
def make_connection(self, host):
# Partially copied from xmlrpclib.py because its inheritance model is
|
assign attr _connection to Transport object if not defined this assists in Python <I> compatibility. xmlrpclib.Transport has _connection by default beginning in <I>
|
py
|
diff --git a/tests/test_mypy.py b/tests/test_mypy.py
index <HASH>..<HASH> 100644
--- a/tests/test_mypy.py
+++ b/tests/test_mypy.py
@@ -103,8 +103,9 @@ class MypyTestCase(unittest.TestCase):
6,
4,
vars=(
- 'Incompatible return value type (got UserDict[<nothing>, <nothing>], '
- 'expected Counter[Any])',
+ 'Incompatible return value type '
+ '(got "UserDict[<nothing>, <nothing>]", '
+ 'expected "Counter[Any]")',
),
),
),
|
Fix a line-too-long lint warning
|
py
|
diff --git a/tests/unit/modules/mine_test.py b/tests/unit/modules/mine_test.py
index <HASH>..<HASH> 100644
--- a/tests/unit/modules/mine_test.py
+++ b/tests/unit/modules/mine_test.py
@@ -114,6 +114,7 @@ class MineTestCase(TestCase):
'match.ipcidr': MagicMock(),
'match.compound': MagicMock(),
'match.pillar': MagicMock(),
+ 'match.pillar_pcre': MagicMock(),
'data.getval':
MagicMock(return_value={})}):
with patch.dict(mine.__opts__, {'file_client': 'local',
|
Mock pillar_pcre for the mine tests
|
py
|
diff --git a/cassandra/cluster.py b/cassandra/cluster.py
index <HASH>..<HASH> 100644
--- a/cassandra/cluster.py
+++ b/cassandra/cluster.py
@@ -1636,8 +1636,8 @@ class ResponseFuture(object):
self._req_id = req_id
return
- self._final_exception = NoHostAvailable(
- "Unable to complete the operation against any hosts", self._errors)
+ self._set_final_exception(NoHostAvailable(
+ "Unable to complete the operation against any hosts", self._errors))
def _query(self, host):
pool = self.session._pools.get(host)
|
Correctly set final exception when query fails on all hosts Before this change, the Event that notifies listeners that the operation has completed was not being triggered.
|
py
|
diff --git a/portend.py b/portend.py
index <HASH>..<HASH> 100644
--- a/portend.py
+++ b/portend.py
@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-
+"""
+A simple library for managing the availability of ports.
+"""
+
from __future__ import print_function
import time
@@ -10,6 +14,7 @@ import sys
from jaraco import timing
+
def client_host(server_host):
"""Return the host on which a client can connect to the given listener."""
if server_host == '0.0.0.0':
@@ -138,6 +143,9 @@ wait_for_occupied_port = occupied
def find_available_local_port():
"""
Find a free port on localhost.
+
+ >>> 0 < find_available_local_port() < 65536
+ True
"""
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
addr = '', 0
@@ -148,6 +156,21 @@ def find_available_local_port():
class HostPort(str):
+ """
+ A simple representation of a host/port pair as a string
+
+ >>> hp = HostPort('localhost:32768')
+
+ >>> hp.host
+ 'localhost'
+
+ >>> hp.port
+ 32768
+
+ >>> len(hp)
+ 15
+ """
+
@property
def host(self):
host, sep, port = self.partition(':')
|
Add docstrings and basic tests.
|
py
|
diff --git a/sportsref/utils.py b/sportsref/utils.py
index <HASH>..<HASH> 100644
--- a/sportsref/utils.py
+++ b/sportsref/utils.py
@@ -29,8 +29,8 @@ def get_html(url):
try:
response = requests.get(url)
if 400 <= response.status_code < 500:
- raise ValueError(
- "Invalid ID led to an error in fetching HTML")
+ raise ValueError(('Invalid URL led to an error in fetching '
+ 'HTML: {}').format(url))
html = response.text
html = html.replace('<!--', '').replace('-->', '')
except requests.ConnectionError as e:
|
made error message more helpful in get_html
|
py
|
diff --git a/pdfminer/image.py b/pdfminer/image.py
index <HASH>..<HASH> 100644
--- a/pdfminer/image.py
+++ b/pdfminer/image.py
@@ -1,9 +1,13 @@
#!/usr/bin/env python2
+import cStringIO
+import logging
import sys
import struct
import os, os.path
+from PIL import Image
+from PIL import ImageChops
from pdftypes import LITERALS_DCT_DECODE
-from pdfcolor import LITERAL_DEVICE_GRAY, LITERAL_DEVICE_RGB
+from pdfcolor import LITERAL_DEVICE_GRAY, LITERAL_DEVICE_RGB, LITERAL_DEVICE_CMYK
def align32(x):
return ((x+3)/4)*4
@@ -77,7 +81,15 @@ class ImageWriter(object):
path = os.path.join(self.outdir, name)
fp = file(path, 'wb')
if ext == '.jpg':
- fp.write(stream.get_rawdata())
+ raw_data = stream.get_rawdata()
+ if LITERAL_DEVICE_CMYK in image.colorspace:
+ ifp = cStringIO.StringIO(raw_data)
+ i = Image.open(ifp)
+ i = ImageChops.invert(i)
+ i = i.convert('RGB')
+ i.save(fp, 'JPEG')
+ else:
+ fp.write(raw_data)
elif image.bits == 1:
bmp = BMPWriter(fp, 1, width, height)
data = stream.get_data()
|
Deal with CMYK images by converting them to RGB. PIL does not invert CMYK images as of PIL <I>, so the invert happens in ImageWriter.
|
py
|
diff --git a/marrow/mailer/transport/sendmail.py b/marrow/mailer/transport/sendmail.py
index <HASH>..<HASH> 100644
--- a/marrow/mailer/transport/sendmail.py
+++ b/marrow/mailer/transport/sendmail.py
@@ -23,7 +23,13 @@ class SendmailTransport(object): # pragma: no cover
def deliver(self, message):
# TODO: Utilize -F full_name (sender full name), -f sender (envelope sender), -V envid (envelope ID), and space-separated BCC recipients
# TODO: Record the output of STDOUT and STDERR to capture errors.
- proc = Popen('%s -t -i' % (self.executable,), shell=True, stdin=PIPE)
+ # proc = Popen('%s -t -i' % (self.executable,), shell=True, stdin=PIPE)
+ args = [self.executable, '-t', '-i']
+
+ if message.sendmail_f:
+ args.extend(['-f', message.sendmail_f])
+
+ proc = Popen(args, shell=False, stdin=PIPE)
proc.communicate(bytes(message))
proc.stdin.close()
if proc.wait() != 0:
|
Include envelope sender in args to sendmail
|
py
|
diff --git a/cookiecutter/main.py b/cookiecutter/main.py
index <HASH>..<HASH> 100755
--- a/cookiecutter/main.py
+++ b/cookiecutter/main.py
@@ -14,6 +14,7 @@ library rather than a script.
import argparse
import os
+from .cleanup import remove_repo
from .find import find_template
from .generate import generate_context, generate_files
from .vcs import git_clone
@@ -34,6 +35,7 @@ def main():
# If it's a git repo, clone and prompt
if args.input_dir.endswith('.git'):
+ got_repo_arg = True
repo_dir = git_clone(args.input_dir)
project_template = find_template(repo_dir)
os.chdir(repo_dir)
@@ -47,6 +49,11 @@ def main():
context=context
)
+ # Remove repo if Cookiecutter cloned it in the first place.
+ # Here the user just wants a project, not a project template.
+ if got_repo_arg:
+ generated_project = context['project']['repo_name']
+ remove_repo(repo_dir, generated_project)
if __name__ == '__main__':
main()
|
Clean up after cloned repo if needed. (partial checkin)
|
py
|
diff --git a/fastavro/_write_py.py b/fastavro/_write_py.py
index <HASH>..<HASH> 100644
--- a/fastavro/_write_py.py
+++ b/fastavro/_write_py.py
@@ -498,7 +498,7 @@ def write_union(fo, datum, schema):
break
else:
msg = 'provided union type name %s not found in schema %s' \
- % (name, schema)
+ % (name, schema)
raise ValueError(msg)
else:
pytype = type(datum)
|
ugh spacing again! PyCharm's auto-spacing is going to be my doom!
|
py
|
diff --git a/pyemma/util/_config.py b/pyemma/util/_config.py
index <HASH>..<HASH> 100644
--- a/pyemma/util/_config.py
+++ b/pyemma/util/_config.py
@@ -26,8 +26,6 @@ import warnings
from pyemma.util.files import mkdir_p
from pyemma.util.exceptions import ConfigDirectoryException
-import pkg_resources
-
# indicate error during reading
class ReadConfigException(Exception):
@@ -183,12 +181,15 @@ class Config(object):
@property
def default_config_file(self):
""" default config file living in PyEMMA package """
- return pkg_resources.resource_filename('pyemma', Config.DEFAULT_CONFIG_FILE_NAME)
-
+ import os.path as p
+ import pyemma
+ return p.join(pyemma.__path__[0], Config.DEFAULT_CONFIG_FILE_NAME)
@property
def default_logging_file(self):
""" default logging configuration"""
- return pkg_resources.resource_filename('pyemma', Config.DEFAULT_LOGGING_FILE_NAME)
+ import os.path as p
+ import pyemma
+ return p.join(pyemma.__path__[0], Config.DEFAULT_LOGGING_FILE_NAME)
def keys(self):
""" valid configuration keys"""
|
[config] do not use pkg_resources delays import by <I> ms!
|
py
|
diff --git a/bokeh/server/serverbb.py b/bokeh/server/serverbb.py
index <HASH>..<HASH> 100644
--- a/bokeh/server/serverbb.py
+++ b/bokeh/server/serverbb.py
@@ -64,8 +64,8 @@ def prune(document, temporary_docid=None, delete=False):
storage_id = document.docid
to_delete = document.prune()
if delete:
- for objid in to_delete:
- bokeh_app.backbone_storage.del_obj(storage_id, objid)
+ for obj in to_delete:
+ bokeh_app.backbone_storage.del_obj(storage_id, obj)
class PersistentBackboneStorage(object):
"""Base class for `RedisBackboneStorage`, `InMemoryBackboneStorage`, etc. """
|
remnamed to be less confusing
|
py
|
diff --git a/denovonear/transcript_sequence_methods.py b/denovonear/transcript_sequence_methods.py
index <HASH>..<HASH> 100755
--- a/denovonear/transcript_sequence_methods.py
+++ b/denovonear/transcript_sequence_methods.py
@@ -52,16 +52,16 @@ class SequenceMethods(object):
# quickly find the exon containing the CDS position
for start, end in self.cds:
start_cds = min(self.exon_to_cds[start], self.exon_to_cds[end])
- end_cds = max(self.exon_to_cds[end], self.exon_to_cds[end])
+ end_cds = max(self.exon_to_cds[start], self.exon_to_cds[end])
if start_cds <= cds_position <= end_cds:
break
# convert the CDS position to a chromosomal coordinate
- if self.strand == "+":
+ if self.get_strand() == "+":
return start + (cds_position - start_cds)
else:
- return end - (cds_position - start_cds)
+ return start + (end_cds - cds_position)
def get_codon_number_for_cds_position(self, cds_position):
""" figure out the codon position for a position
|
fix converting CDS to chrom position on minus strand
|
py
|
diff --git a/werkzeug/script.py b/werkzeug/script.py
index <HASH>..<HASH> 100644
--- a/werkzeug/script.py
+++ b/werkzeug/script.py
@@ -262,11 +262,15 @@ def make_shell(init_func=None, banner=None, use_ipython=True):
namespace = init_func()
if ipython:
try:
- import IPython
+ try:
+ from IPython.frontend.terminal.embed import InteractiveShellEmbed
+ sh = InteractiveShellEmbed(banner1=banner)
+ except ImportError:
+ from IPython.Shell import IPShellEmbed
+ sh = IPShellEmbed(banner=banner)
except ImportError:
pass
else:
- sh = IPython.Shell.IPShellEmbed(banner=banner)
sh(global_ns={}, local_ns=namespace)
return
from code import interact
|
add compatibility with ipython <I> first try to import <I> api if that fails try the old api
|
py
|
diff --git a/openquake/server/manage.py b/openquake/server/manage.py
index <HASH>..<HASH> 100755
--- a/openquake/server/manage.py
+++ b/openquake/server/manage.py
@@ -22,6 +22,16 @@ if __name__ == "__main__":
# the issue is that importing openquake.engine sets a wrong
# DJANGO_SETTINGS_MODULE environment variable, causing the irritating
# CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.
+
+ # Please note: the /usr/bin/oq-engine script requires a celeryconfig.py
+ # file in the PYTHONPATH; when using binary packages, if a celeryconfig.py
+ # is not available the OpenQuake Engine default celeryconfig.py, located
+ # in /usr/share/openquake/engine, is used.
+ try:
+ import celeryconfig
+ except ImportError:
+ sys.path.append('/usr/share/openquake/engine')
+
from openquake.engine.db import models
models.getcursor('job_init').execute(
# cleanup of the flag oq_job.is_running
|
server: fix celeryconfig.py path when server is installed by packages
|
py
|
diff --git a/seleniumbase/core/browser_launcher.py b/seleniumbase/core/browser_launcher.py
index <HASH>..<HASH> 100755
--- a/seleniumbase/core/browser_launcher.py
+++ b/seleniumbase/core/browser_launcher.py
@@ -1503,6 +1503,8 @@ def get_local_driver(
auto_upgrade_chromedriver = False
if "This version of ChromeDriver only supports" in e.msg:
auto_upgrade_chromedriver = True
+ elif "Chrome version must be between" in e.msg:
+ auto_upgrade_chromedriver = True
if not auto_upgrade_chromedriver:
raise Exception(e.msg) # Not an obvious fix. Raise.
else:
|
Auto-upgrade chromedriver on "version must be between"
|
py
|
diff --git a/molo/commenting/tests/test_models.py b/molo/commenting/tests/test_models.py
index <HASH>..<HASH> 100644
--- a/molo/commenting/tests/test_models.py
+++ b/molo/commenting/tests/test_models.py
@@ -61,12 +61,12 @@ class MoloCommentTest(TestCase):
comment.save()
comment_flag = self.mk_comment_flag(comment)
comment_flag.save()
- settings.COMMENTS_FLAG_THRESHHOLD = 1
- signals.comment_was_flagged.send(
- sender=comment.__class__,
- comment=comment,
- flag=CommentFlag.MODERATOR_DELETION,
- created=True,
- )
+ with self.settings(COMMENTS_FLAG_THRESHHOLD=1):
+ signals.comment_was_flagged.send(
+ sender=comment.__class__,
+ comment=comment,
+ flag=CommentFlag.MODERATOR_DELETION,
+ created=True,
+ )
altered_comment = MoloComment.objects.get(pk=comment.pk)
self.assertTrue(altered_comment.is_removed)
|
override the setting for testing rather than overwriting it
|
py
|
diff --git a/pypet/utils/helpful_functions.py b/pypet/utils/helpful_functions.py
index <HASH>..<HASH> 100644
--- a/pypet/utils/helpful_functions.py
+++ b/pypet/utils/helpful_functions.py
@@ -321,7 +321,7 @@ def port_to_tcp(port=None):
try:
addr_list = socket.getaddrinfo(domain_name, None)
except Exception:
- addr_list = socket.getaddrinfo('localhost', None)
+ addr_list = socket.getaddrinfo('127.0.0.1', None)
family, socktype, proto, canonname, sockaddr = addr_list[0]
address = 'tcp://' + sockaddr[0]
if port is None:
|
Trying to fix ZMQ error by replacing localhost with <I>
|
py
|
diff --git a/esptool.py b/esptool.py
index <HASH>..<HASH> 100755
--- a/esptool.py
+++ b/esptool.py
@@ -3363,6 +3363,10 @@ ESP8684ROM.BOOTLOADER_IMAGE = ESP8684FirmwareImage
class ELFFile(object):
SEC_TYPE_PROGBITS = 0x01
SEC_TYPE_STRTAB = 0x03
+ SEC_TYPE_INITARRAY = 0x0e
+ SEC_TYPE_FINIARRAY = 0x0f
+
+ PROG_SEC_TYPES = (SEC_TYPE_PROGBITS, SEC_TYPE_INITARRAY, SEC_TYPE_FINIARRAY)
LEN_SEC_HEADER = 0x28
@@ -3419,7 +3423,7 @@ class ELFFile(object):
name_offs, sec_type, _flags, lma, sec_offs, size = struct.unpack_from("<LLLLLL", section_header[offs:])
return (name_offs, sec_type, lma, size, sec_offs)
all_sections = [read_section_header(offs) for offs in section_header_offsets]
- prog_sections = [s for s in all_sections if s[1] == ELFFile.SEC_TYPE_PROGBITS]
+ prog_sections = [s for s in all_sections if s[1] in ELFFile.PROG_SEC_TYPES]
# search for the string table section
if not (shstrndx * self.LEN_SEC_HEADER) in section_header_offsets:
|
ELF parser: recognize flash.rodata as part of IRAM
|
py
|
diff --git a/echo.py b/echo.py
index <HASH>..<HASH> 100644
--- a/echo.py
+++ b/echo.py
@@ -245,7 +245,7 @@ class delay_callback(object):
for prop in self.props:
p = getattr(type(self.instance), prop)
- if not isinstance(p, CallbackProperty):
+ if not isinstance(p, CallbackProperty): # pragma: no cover
raise TypeError("%s is not a CallbackProperty" % prop)
if self.delay_count[self.instance, prop] > 1:
|
coverage: added pragma
|
py
|
diff --git a/eye/models.py b/eye/models.py
index <HASH>..<HASH> 100644
--- a/eye/models.py
+++ b/eye/models.py
@@ -1,6 +1,8 @@
import collections
import inspect
+PRIMITIVES = set([int, bool, str, unicode, type(None)])
+
class Node(object):
@@ -8,15 +10,14 @@ class Node(object):
self.context = context
def _dict(self):
- if self.context is None:
- d = {}
- elif isinstance(self.context, basestring):
+ if type(self.context) in PRIMITIVES:
d = {}
elif isinstance(self.context, collections.Mapping):
d = self.context
elif isinstance(self.context, collections.Iterable):
d = dict((str(i), v) for i, v in enumerate(self.context))
elif hasattr(self.context, '__Broken_state__'):
+ # ZODB
d = self.context.__Broken_state__
else:
d = dict(inspect.getmembers(self.context))
|
be explicit about primitives that aren't traversable
|
py
|
diff --git a/looper/models.py b/looper/models.py
index <HASH>..<HASH> 100644
--- a/looper/models.py
+++ b/looper/models.py
@@ -1725,7 +1725,7 @@ class Sample(object):
setattr(self, feature,
files[0][i] if len(set(f[i] for f in files)) == 1 else None)
- if getattr(self, feature) is None:
+ if getattr(self, feature) is None and len(existing_files) > 0:
_LOGGER.warn("Not all input files agree on "
"feature '%s' for sample '%s'",
feature, self.name)
|
Don't warn about unmatching properties if input files don't exist
|
py
|
diff --git a/tests/test_query_fixture.py b/tests/test_query_fixture.py
index <HASH>..<HASH> 100644
--- a/tests/test_query_fixture.py
+++ b/tests/test_query_fixture.py
@@ -147,6 +147,32 @@ class TestQueryFixture(FixtureTestCase):
_rel(5, rels=[2, 4]),
], 5)
+ def test_query_source(self):
+ # check that the 'source' property is preserved for output features.
+ from shapely.geometry import Point
+
+ def min_zoom_fn(shape, props, fid, meta):
+ return 5
+
+ shape = Point(0, 0)
+ rows = [
+ (0, shape, {'source': 'testdata'})
+ ]
+
+ fetch = self._make(rows, min_zoom_fn, None)
+
+ # first, check that it can get the original item back when both the
+ # min zoom filter and geometry filter are okay.
+ read_rows = fetch(5, (-1, -1, 1, 1))
+
+ self.assertEquals(1, len(read_rows))
+ read_row = read_rows[0]
+ self.assertEquals(0, read_row.get('__id__'))
+ # query processing code expects WKB bytes in the __geometry__ column
+ self.assertEquals(shape.wkb, read_row.get('__geometry__'))
+ self.assertEquals({'min_zoom': 5, 'source': 'testdata'},
+ read_row.get('__testlayer_properties__'))
+
class TestLabelPlacement(FixtureTestCase):
|
Added test to make sure that the 'source' property is propagated by the fixture data fetcher.
|
py
|
diff --git a/asynch2/stream.py b/asynch2/stream.py
index <HASH>..<HASH> 100644
--- a/asynch2/stream.py
+++ b/asynch2/stream.py
@@ -55,8 +55,9 @@ class HTTP2Stream:
# Getters
async def read_frame(self):
- await self._data_frames_available.wait()
frame = b''
+ if len(self._data_frames) == 0 and not self._closed:
+ await self._data_frames_available.wait()
if len(self._data_frames) > 0:
frame = self._data_frames.popleft()
if len(self._data_frames) == 0 and not self.closed:
|
Only wait for frames if none are present and stream is not closed
|
py
|
diff --git a/upgrades/workflows_2014_08_12_task_results_to_dict.py b/upgrades/workflows_2014_08_12_task_results_to_dict.py
index <HASH>..<HASH> 100644
--- a/upgrades/workflows_2014_08_12_task_results_to_dict.py
+++ b/upgrades/workflows_2014_08_12_task_results_to_dict.py
@@ -79,6 +79,11 @@ def estimate():
def convert_to_dict(results):
"""Convert WorkflowTask object to dict."""
results_new = {}
+ if isinstance(results, list):
+ if len(results) == 0:
+ return results_new
+ else:
+ raise RuntimeError("Cannot convert task result.")
for task, res in results.iteritems():
result_list = []
for result in res:
|
workflows: upgrade compatibility fix * Fixes compatibility issue in upgrade.
|
py
|
diff --git a/salt/daemons/masterapi.py b/salt/daemons/masterapi.py
index <HASH>..<HASH> 100644
--- a/salt/daemons/masterapi.py
+++ b/salt/daemons/masterapi.py
@@ -855,7 +855,7 @@ class RemoteFuncs(object):
fp_.write(load['id'])
return ret
- def minion_publish(self, load, skip_verify=False):
+ def minion_publish(self, load):
'''
Publish a command initiated from a minion, this method executes minion
restrictions so that the minion publication will only work if it is
|
Fix #<I> We should not accept and skip_verify for this function anyway
|
py
|
diff --git a/vtki/plotting.py b/vtki/plotting.py
index <HASH>..<HASH> 100644
--- a/vtki/plotting.py
+++ b/vtki/plotting.py
@@ -1514,7 +1514,7 @@ class BasePlotter(object):
font_family=None, shadow=False, mapper=None,
width=None, height=None, position_x=None,
position_y=None, vertical=None,
- interactive=False, fmt=None):
+ interactive=False, fmt=None, use_opacity=True):
"""
Creates scalar bar using the ranges as set by the last input
mesh.
@@ -1571,6 +1571,9 @@ class BasePlotter(object):
interactive : bool, optional
Use a widget to control the size and location of the scalar bar.
+ use_opacity : bool, optional
+ Optionally disply the opacity mapping on the scalar bar
+
Notes
-----
Setting title_font_size, or label_font_size disables automatic font
@@ -1738,6 +1741,9 @@ class BasePlotter(object):
rep.SetOrientation(0) # 0 = Horizontal, 1 = Vertical
self._scalar_bar_widgets[title] = self.scalar_widget
+ if use_opacity:
+ self.scalar_bar.SetUseOpacity(True)
+
self.add_actor(self.scalar_bar, reset_camera=False)
def update_scalars(self, scalars, mesh=None, render=True):
|
Map opacity on scalar bars to resolve #<I>
|
py
|
diff --git a/ding0/examples/example_analyze_single_grid_district.py b/ding0/examples/example_analyze_single_grid_district.py
index <HASH>..<HASH> 100644
--- a/ding0/examples/example_analyze_single_grid_district.py
+++ b/ding0/examples/example_analyze_single_grid_district.py
@@ -24,6 +24,7 @@ __url__ = "https://github.com/openego/ding0/blob/master/LICENSE"
__author__ = "nesnoj, gplssm"
from ding0.tools import results
+from pandas import option_context
from matplotlib import pyplot as plt
base_path = ''
@@ -61,7 +62,8 @@ def example_stats(filename, plotpath=''):
# print all the calculated stats
# this isn't a particularly beautiful format but it is
# information rich
- print(stats.T)
+ with option_context('display.max_rows', None, 'display.max_columns', None):
+ print(stats.T)
if __name__ == '__main__':
|
Fix to ensure the pandas df prints all rows and all columns completely instead of only a sample
|
py
|
diff --git a/doc/conf.py b/doc/conf.py
index <HASH>..<HASH> 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -4,15 +4,15 @@ import os
import sys
from os.path import dirname, relpath
-import flask_mongo_profiler
-from flask_mongo_profiler import contrib
-
# Get the project root dir, which is the parent dir of this
cwd = os.getcwd()
project_root = os.path.dirname(cwd)
sys.path.insert(0, project_root)
+import flask_mongo_profiler # # NOQA: F401 isort:skip
+from flask_mongo_profiler import contrib # NOQA: F401 isort:skip
+
# package data
about = {}
with open("../flask_mongo_profiler/__about__.py") as fp:
|
:wheelchair: Move imports down
|
py
|
diff --git a/osx/_lightblue.py b/osx/_lightblue.py
index <HASH>..<HASH> 100755
--- a/osx/_lightblue.py
+++ b/osx/_lightblue.py
@@ -23,6 +23,7 @@ import warnings
import Foundation
import AppKit
import objc
+from objc import super
import _IOBluetooth
import _LightAquaBlue
|
Inquiry for <I> works
|
py
|
diff --git a/observer.py b/observer.py
index <HASH>..<HASH> 100644
--- a/observer.py
+++ b/observer.py
@@ -4,6 +4,8 @@ from gevent import event
import json
import hashlib
+from django.db.models import query as django_query
+
from ws4redis import publisher, redis_store
from . import exceptions
@@ -35,7 +37,15 @@ class QueryObserver(object):
self.status = QueryObserver.STATUS_NEW
self._pool = pool
self._queryset = queryset.all()
- self._query = queryset.query.sql_with_params()
+
+ try:
+ self._query = queryset.query.sql_with_params()
+ except django_query.EmptyResultSet:
+ # Queries which always return an empty result set, regardless of when they are
+ # executed, must be handled specially as they do not produce any valid SQL statements
+ # and as such, they cannot be observed and will always be mapped to this same observer.
+ self._query = ('', ())
+
self.primary_key = self._queryset.model._meta.pk.name
self._last_results = collections.OrderedDict()
self._subscribers = set()
|
Fixed handling of empty querysets. There are queries which always return an empty result set, because the conditions will never be satisfied. As such, they do not produce a valid SQL statement and must be handled separately.
|
py
|
diff --git a/src/paperwork/backend/docimport.py b/src/paperwork/backend/docimport.py
index <HASH>..<HASH> 100644
--- a/src/paperwork/backend/docimport.py
+++ b/src/paperwork/backend/docimport.py
@@ -54,6 +54,12 @@ class SinglePdfImporter(object):
"""
Import the specified PDF file
"""
+ f = Gio.File.parse_name(file_uri)
+ if docsearch.is_hash_in_index(PdfDoc.hash_file(f.get_path())):
+ logger.info("Document %s already found in the index. Skipped"
+ % (f.get_path()))
+ return (None, None, False)
+
doc = PdfDoc(docsearch.rootdir)
logger.info("Importing doc '%s' ..." % file_uri)
error = doc.import_pdf(file_uri)
|
PDF import: don't import a PDF already imported
|
py
|
diff --git a/dependencies/contrib/_pytest.py b/dependencies/contrib/_pytest.py
index <HASH>..<HASH> 100644
--- a/dependencies/contrib/_pytest.py
+++ b/dependencies/contrib/_pytest.py
@@ -2,8 +2,6 @@ from __future__ import absolute_import
import pytest
-# TODO: `parametrize` function.
-
def register(injector):
"""Register Py.test fixture performing injection in it's scope."""
|
Remove development note. Py.test parametrize works with params injector attribute.
|
py
|
diff --git a/ansible/modules/hashivault/hashivault_secret_engine.py b/ansible/modules/hashivault/hashivault_secret_engine.py
index <HASH>..<HASH> 100644
--- a/ansible/modules/hashivault/hashivault_secret_engine.py
+++ b/ansible/modules/hashivault/hashivault_secret_engine.py
@@ -113,6 +113,7 @@ def hashivault_secret_engine(module):
options = params.get('options')
current_state = dict()
exists = False
+ created = False
changed = False
if not backend:
@@ -156,6 +157,7 @@ def hashivault_secret_engine(module):
client.sys.enable_secrets_engine(backend, description=description, path=name, config=config, options=options)
else:
client.sys.enable_secrets_engine(backend, description=description, path=name, config=config)
+ created = True
# needs to be updated
elif changed and exists and (state == 'present' or state == 'enabled') and not module.check_mode:
@@ -168,7 +170,7 @@ def hashivault_secret_engine(module):
elif changed and (state == 'absent' or state == 'disabled') and not module.check_mode:
client.sys.disable_secrets_engine(path=name)
- return {'changed': changed}
+ return {'changed': changed, 'created': created}
if __name__ == '__main__':
|
Added var to defirentiate new and updated engines
|
py
|
diff --git a/python/rosette/api.py b/python/rosette/api.py
index <HASH>..<HASH> 100644
--- a/python/rosette/api.py
+++ b/python/rosette/api.py
@@ -17,6 +17,7 @@ _ACCEPTABLE_SERVER_VERSION = "0.5"
_GZIP_BYTEARRAY = bytearray([0x1F, 0x8b, 0x08])
N_RETRIES = 3
+
import sys
_IsPy3 = sys.version_info[0] == 3
@@ -123,7 +124,10 @@ class RosetteException(Exception):
self.response_message = response_message
def __str__(self):
- return self.status + ": " + self.message + ":\n " + self.response_message
+ sst = self.status
+ if not (isinstance(sst, str)):
+ sst = repr(sst)
+ return sst + ": " + self.message + ":\n " + self.response_message
class _PseudoEnum:
@@ -390,7 +394,13 @@ class Operator:
else:
complaint_url = ename + " " + self.suburl
- raise RosetteException(code, complaint_url + " : failed to communicate with Rosette",
+ if "code" in the_json:
+ serverCode = the_json["code"]
+ else:
+ serverCode = "error"
+
+ raise RosetteException(serverCode,
+ complaint_url + " : failed to communicate with Rosette",
msg)
def _set_use_multipart(self, value):
|
RCB-<I> Fix some bugs in server error handling.
|
py
|
diff --git a/phonopy/cui/settings.py b/phonopy/cui/settings.py
index <HASH>..<HASH> 100644
--- a/phonopy/cui/settings.py
+++ b/phonopy/cui/settings.py
@@ -509,8 +509,8 @@ class ConfParser(object):
self._confs['pm'] = '.true.'
if 'is_tetrahedron_method' in arg_list:
- if not self._args.is_tetrahedron_method:
- self._confs['tetrahedron'] = '.false.'
+ if self._args.is_tetrahedron_method:
+ self._confs['tetrahedron'] = '.true.'
if 'is_trigonal_displacements' in arg_list:
if self._args.is_trigonal_displacements:
|
Use of tetrahedron is set to true as default in settings.py
|
py
|
diff --git a/MAVProxy/modules/mavproxy_calibration.py b/MAVProxy/modules/mavproxy_calibration.py
index <HASH>..<HASH> 100644
--- a/MAVProxy/modules/mavproxy_calibration.py
+++ b/MAVProxy/modules/mavproxy_calibration.py
@@ -73,7 +73,11 @@ class CalibrationModule(mp_module.MPModule):
s += "%u%% " % v
self.console.set_status('Progress', 'Calibration Progress: %s' % s, row=4)
if m.get_type() == 'MAG_CAL_REPORT':
- print("Calibration of compass %u complete: fitness %.3f" % (m.compass_id, m.fitness))
+ if m.cal_status == mavutil.mavlink.MAG_CAL_SUCCESS:
+ result = "SUCCESS"
+ else:
+ result = "FAILED"
+ print("Calibration of compass %u %s: fitness %.3f" % (m.compass_id, result, m.fitness))
def idle_task(self):
'''handle mavlink packets'''
|
calibration: show success/failure of magcal
|
py
|
diff --git a/invenio_oauth2server/views/settings.py b/invenio_oauth2server/views/settings.py
index <HASH>..<HASH> 100644
--- a/invenio_oauth2server/views/settings.py
+++ b/invenio_oauth2server/views/settings.py
@@ -222,6 +222,9 @@ def token_new():
session['show_personal_access_token'] = True
return redirect(url_for(".token_view", token_id=t.id))
+ if len(current_oauth2server.scope_choices()) == 0:
+ del(form.scopes)
+
return render_template(
"invenio_oauth2server/settings/token_new.html",
form=form,
@@ -251,6 +254,9 @@ def token_view(token):
token.scopes = form.data['scopes']
db.session.commit()
+ if len(current_oauth2server.scope_choices()) == 0:
+ del(form.scopes)
+
return render_template(
"invenio_oauth2server/settings/token_view.html",
token=token,
|
views: don't render scopes if empty * ADDS check to delete the scopes field from the token form so that it doesn't render if there are no scope choices.
|
py
|
diff --git a/spyder/plugins/plots/widgets/tests/test_plots_widgets.py b/spyder/plugins/plots/widgets/tests/test_plots_widgets.py
index <HASH>..<HASH> 100644
--- a/spyder/plugins/plots/widgets/tests/test_plots_widgets.py
+++ b/spyder/plugins/plots/widgets/tests/test_plots_widgets.py
@@ -247,8 +247,16 @@ def test_scroll_to_select_item(figbrowser, tmpdir, qtbot):
figbrowser.go_next_thumbnail()
qtbot.wait(500)
+ scene = figbrowser.thumbnails_sb.scene
+
+ spacing = scene.verticalSpacing()
+ height = scene.itemAt(0).sizeHint().height()
+ height_view = figbrowser.thumbnails_sb.scrollarea.viewport().height()
+
+ expected = (spacing * 5) + (height * 4) - ((height_view - height) // 2)
+
vsb = figbrowser.thumbnails_sb.scrollarea.verticalScrollBar()
- assert vsb.value() == 134
+ assert vsb.value() == expected
@pytest.mark.parametrize("fmt", ['image/png', 'image/svg+xml'])
|
change expected value of test_scroll_to_select_item.
|
py
|
diff --git a/jellyfish/_jellyfish.py b/jellyfish/_jellyfish.py
index <HASH>..<HASH> 100644
--- a/jellyfish/_jellyfish.py
+++ b/jellyfish/_jellyfish.py
@@ -422,7 +422,7 @@ def metaphone(s):
elif next == 'h' and nextnext and nextnext not in 'aeiou':
i += 1
elif c == 'h':
- if i == 0 or next in 'aeiou' or s[i-1] in 'aeiou':
+ if i == 0 or next in 'aeiou' or s[i-1] not in 'aeiou':
result.append('h')
elif c == 'k':
if i == 0 or s[i-1] != 'c':
|
Rule for H character should be 'Drop H if after vowel and not before a vowel'
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -97,8 +97,8 @@ if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
#TODO: create an install wizard
elif len(sys.argv) >= 2 and sys.argv[1] == 'py2app':
os.system('rm -rf build')
- os.system('cp -rf data/dist-files/qt_menu.nib dist/Aston.app/Contents/Resources/')
- os.system('cp data/dist-files/qt.conf dist/Aston.app/Contents/Resources/')
+ os.system('cp -rf ui/mac/qt_menu.nib dist/Aston.app/Contents/Resources/')
+ os.system('cp ui/mac/qt.conf dist/Aston.app/Contents/Resources/')
os.system('mkdir dist/Aston.app/Contents/Resources/aston')
os.system('mkdir dist/Aston.app/Contents/Resources/aston/ui')
os.system('mkdir dist/Aston.app/Contents/Resources/aston/ui/icons')
|
Setup.py now points to correct mac Qt files.
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,7 @@ setup(
zip_safe=True,
install_requires=[
'pyserial==3.2.0',
- 'pyserial-asyncio'
+ 'pyserial-asyncio',
'async_timeout'
],
entry_points={
|
Added async_timeout to requirements
|
py
|
diff --git a/gtdoit/logbook.py b/gtdoit/logbook.py
index <HASH>..<HASH> 100644
--- a/gtdoit/logbook.py
+++ b/gtdoit/logbook.py
@@ -91,7 +91,7 @@ class IdGenerator:
def build_socket(context, socket_type, bind_endpoints=[], connect_endpoints=[]):
- socket = contect.socket(socket_type)
+ socket = context.socket(socket_type)
for endpoint in bind_endpoints:
socket.bind(endpoint)
for endpoint in connect_endpoints:
@@ -174,8 +174,8 @@ def main(argv=None, exit=True):
help='the connect address for streaming of events',
action='append', dest='streaming_connect_endpoints')
- argv = argv if argv else sys.argv[1:]
- args = parser.parse_argv(args)
+ args = argv if argv else sys.argv[1:]
+ args = parser.parse_args(args)
exitcode = run(args)
|
Fixing typos in logbook.py This is the first time I am actually executing the code. Hallmark!
|
py
|
diff --git a/test_path.py b/test_path.py
index <HASH>..<HASH> 100644
--- a/test_path.py
+++ b/test_path.py
@@ -1097,7 +1097,7 @@ class TestInPlace:
with doc.in_place() as (reader, writer):
writer.write(self.alternate_content)
raise RuntimeError("some error")
- assert "some error" in str(exc)
+ assert "some error" in str(exc.value)
with doc.open() as stream:
data = stream.read()
assert 'Lorem' not in data
|
Correct usage of exception resolution from exception info context. Fixes #<I>.
|
py
|
diff --git a/superset/views/core.py b/superset/views/core.py
index <HASH>..<HASH> 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1953,6 +1953,9 @@ class Superset(BaseSupersetView):
'common': self.common_bootsrap_payload(),
}
+ if request.args.get('json') == 'true':
+ return json_success(json.dumps(bootstrap_data))
+
return self.render_template(
'superset/dashboard.html',
entry='dashboard',
|
read query params for json in dashboard endpoint (#<I>)
|
py
|
diff --git a/src/foremast/common/base.py b/src/foremast/common/base.py
index <HASH>..<HASH> 100644
--- a/src/foremast/common/base.py
+++ b/src/foremast/common/base.py
@@ -1,10 +1,20 @@
"""Base Plugin class."""
-from abc import ABC, abstractmethod
+from abc import ABC, abstractmethod, abstractproperty
class BasePlugin(ABC):
"""All Plugins should inherit from this base class."""
+ @abstractproperty
+ def resource(self):
+ """Implement the resource property."""
+ pass
+
+ @abstractproperty
+ def provider(self):
+ """Implement the provider property."""
+ pass
+
@abstractmethod
def create(self):
"""Implement the Resource create operation."""
|
refactor: Plugins must specify provider and resource properties
|
py
|
diff --git a/PyFunceble/checker/base.py b/PyFunceble/checker/base.py
index <HASH>..<HASH> 100644
--- a/PyFunceble/checker/base.py
+++ b/PyFunceble/checker/base.py
@@ -79,6 +79,12 @@ class CheckerBase:
*,
do_syntax_check_first: Optional[bool] = None,
) -> None:
+ if self.params is None:
+ self.params = CheckerParamsBase()
+
+ if self.status is None:
+ self.status = CheckerStatusBase()
+
if subject is not None:
self.subject = subject
@@ -273,14 +279,6 @@ class CheckerBase:
return self
- def get_do_syntax_check_first(self) -> Optional[str]:
- """
- Provides the currently set value of the :code:`do_syntax_check_first`
- attribute.
- """
-
- return self.do_syntax_check_first
-
def subject_propagator(self) -> "CheckerBase":
"""
Propagate the currently set subject.
|
Handle missing status and params and remove unneeded method. Indeed, before this patch, we didn't took in consideration that the status and params attribute could be "forgotten" leaving the door open for some errors. This patch fix that, by overwritting them with an empty Param and Status object.
|
py
|
diff --git a/github/Requester.py b/github/Requester.py
index <HASH>..<HASH> 100644
--- a/github/Requester.py
+++ b/github/Requester.py
@@ -172,10 +172,6 @@ class Requester:
def __check(self, status, responseHeaders, output):
output = self.__structuredFromJson(output)
- # #193: Shouldn't next line be in __requestEncode? (__check is not called on all requests)
- # Log frame
- self.DEBUG_ON_RESPONSE(status, responseHeaders, output)
-
if status >= 400:
raise self.__createException(status, output)
return responseHeaders, output
@@ -255,6 +251,8 @@ class Requester:
if "x-oauth-scopes" in responseHeaders:
self.oauth_scopes = responseHeaders["x-oauth-scopes"].split(", ")
+ self.DEBUG_ON_RESPONSE(status, responseHeaders, output)
+
return status, responseHeaders, output
def __requestRaw(self, verb, url, requestHeaders, input):
|
Move the DEBUG_ON_RESPONSE call to Requester.__requestEncode
|
py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.