diff
stringlengths 139
3.65k
| message
stringlengths 8
627
| diff_languages
stringclasses 1
value |
|---|---|---|
diff --git a/examples/notepad/notepad/main_window.py b/examples/notepad/notepad/main_window.py
index <HASH>..<HASH> 100644
--- a/examples/notepad/notepad/main_window.py
+++ b/examples/notepad/notepad/main_window.py
@@ -157,7 +157,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""
Add a new empty code editor to the tab widget
"""
- self.tabWidget.add_code_edit(GenericCodeEdit(self), 'New document')
+ self.tabWidget.add_code_edit(GenericCodeEdit(self), 'New document.txt')
self.refresh_color_scheme()
@QtCore.Slot()
|
Notepad: Use "New document.txt" (so that mimetype and tab icon are properly detected)
|
py
|
diff --git a/annoying/decorators.py b/annoying/decorators.py
index <HASH>..<HASH> 100644
--- a/annoying/decorators.py
+++ b/annoying/decorators.py
@@ -164,7 +164,7 @@ def ajax_request(func):
example:
- @ajax_response
+ @ajax_request
def my_view(request):
news = News.objects.all()
news_titles = [entry.title for entry in news]
|
Fixed another typo - not on the ball today
|
py
|
diff --git a/liquid_tags/include_code.py b/liquid_tags/include_code.py
index <HASH>..<HASH> 100644
--- a/liquid_tags/include_code.py
+++ b/liquid_tags/include_code.py
@@ -53,10 +53,12 @@ FORMAT = re.compile(r"""
(?:(?:lines:)(?P<lines>\d+-\d+))? # Optional lines
(?:\s+)? # Whitespace
(?P<hidefilename>:hidefilename:)? # Hidefilename flag
+(?:\s+)? # Whitespace
(?P<hidelink>:hidelink:)? # Hide download link
+(?:\s+)? # Whitespace
(?P<hideall>:hideall:)? # Hide title and download link
(?:\s+)? # Whitespace
-(?:(?:codec:)(?P<codec>\S+))? # Optional language
+(?:(?:codec:)(?P<codec>\S+))? # Optional language
(?:\s+)? # Whitespace
(?P<title>.+)?$ # Optional title
""", re.VERBOSE)
|
Add spaces to the regex between new parameters
|
py
|
diff --git a/pymongo/cursor.py b/pymongo/cursor.py
index <HASH>..<HASH> 100644
--- a/pymongo/cursor.py
+++ b/pymongo/cursor.py
@@ -1113,9 +1113,9 @@ class Cursor(object):
"""Advance the cursor."""
if self.__empty:
raise StopIteration
- _db = self.__collection.database
if len(self.__data) or self._refresh():
if self.__manipulate:
+ _db = self.__collection.database
return _db._fix_outgoing(self.__data.popleft(),
self.__collection)
else:
|
Slightly faster Cursor.next() (#<I>)
|
py
|
diff --git a/pyModeS/decoder/common.py b/pyModeS/decoder/common.py
index <HASH>..<HASH> 100644
--- a/pyModeS/decoder/common.py
+++ b/pyModeS/decoder/common.py
@@ -89,9 +89,9 @@ def icao(msg):
DF = df(msg)
- if DF in (17, 18):
+ if DF in (11, 17, 18):
addr = msg[2:8]
- elif DF in (4, 5, 20, 21):
+ elif DF in (0, 4, 5, 16, 20, 21):
c0 = bin2int(crc(msg, encode=True))
c1 = hex2int(msg[-6:])
addr = '%06X' % (c0 ^ c1)
|
add more DF to icao function
|
py
|
diff --git a/allegedb/allegedb/graph.py b/allegedb/allegedb/graph.py
index <HASH>..<HASH> 100644
--- a/allegedb/allegedb/graph.py
+++ b/allegedb/allegedb/graph.py
@@ -776,9 +776,9 @@ class DiGraphPredecessorsMapping(GraphEdgeMapping):
def __delitem__(self, key):
"""Delete all edges ending at ``dest``"""
- if key in self._cache:
- self._cache[key].clear()
- del self._cache[key]
+ it = self[key]
+ it.clear()
+ del self._cache[key]
self.send(self, key=key, val=None)
def __iter__(self):
|
Fix deletion of edges from the predecessors mapping
|
py
|
diff --git a/openname/opennamed.py b/openname/opennamed.py
index <HASH>..<HASH> 100644
--- a/openname/opennamed.py
+++ b/openname/opennamed.py
@@ -36,11 +36,19 @@ log.addHandler(console)
from bitcoinrpc.authproxy import AuthServiceProxy
-config_options = 'https://' + config.BITCOIND_USER + ':' + \
- config.BITCOIND_PASSWD + '@' + config.BITCOIND_SERVER + ':' + \
- str(config.BITCOIND_PORT)
-bitcoind = AuthServiceProxy(config_options)
+def create_bitcoind_connection(
+ rpc_username=config.BITCOIND_USER, rpc_password=config.BITCOIND_PASSWD,
+ server=config.BITCOIND_SERVER, port=config.BITCOIND_PORT,
+ use_https=True):
+ """ creates an auth service proxy object, to connect to bitcoind
+ """
+ protocol = 'https' if use_https else 'http'
+ authproxy_config_uri = '%s://%s:%s@%s:%s' % (
+ protocol, rpc_username, rpc_password, server, port)
+ return AuthServiceProxy(authproxy_config_uri)
+
+bitcoind = create_bitcoind_connection()
from lib import preorder_name, register_name, update_name, \
transfer_name
|
add function for creating a bitcoind connection
|
py
|
diff --git a/datajoint/connection.py b/datajoint/connection.py
index <HASH>..<HASH> 100644
--- a/datajoint/connection.py
+++ b/datajoint/connection.py
@@ -82,6 +82,8 @@ class Connection:
connected=connected, **self.conn_info)
def erd(self, *args, **kwargs):
+ # load all dependencies
+ self.erm.load_dependencies()
return self.erm.copy_graph(*args, **kwargs)
@property
|
load dependencies prior to fetching erd
|
py
|
diff --git a/aiohttp/client.py b/aiohttp/client.py
index <HASH>..<HASH> 100644
--- a/aiohttp/client.py
+++ b/aiohttp/client.py
@@ -399,10 +399,7 @@ class ClientSession:
if timeout is sentinel:
real_timeout = self._timeout # type: ClientTimeout
else:
- if not isinstance(timeout, ClientTimeout):
- real_timeout = ClientTimeout(total=timeout) # type: ignore[arg-type]
- else:
- real_timeout = timeout
+ real_timeout = timeout # type: ignore[assignment]
# timeout is cumulative for all request operations
# (request, redirects, responses, data consuming)
tm = TimeoutHandle(self._loop, real_timeout.total)
|
Drop dead code, float timeout support was removed (#<I>)
|
py
|
diff --git a/saharaclient/api/data_sources.py b/saharaclient/api/data_sources.py
index <HASH>..<HASH> 100644
--- a/saharaclient/api/data_sources.py
+++ b/saharaclient/api/data_sources.py
@@ -26,7 +26,7 @@ class DataSourceManagerV1(base.ResourceManager):
def create(self, name, description, data_source_type,
url, credential_user=None, credential_pass=None,
- is_public=None, is_protected=None):
+ is_public=None, is_protected=None, s3_credentials=None):
"""Create a Data Source."""
data = {
@@ -34,14 +34,15 @@ class DataSourceManagerV1(base.ResourceManager):
'description': description,
'type': data_source_type,
'url': url,
- 'credentials': {}
}
- self._copy_if_defined(data['credentials'],
+ credentials = {}
+ self._copy_if_defined(credentials,
user=credential_user,
password=credential_pass)
-
+ credentials = credentials or s3_credentials
self._copy_if_defined(data, is_public=is_public,
- is_protected=is_protected)
+ is_protected=is_protected,
+ credentials=credentials)
return self._create('/data-sources', data, 'data_source')
|
Allow S3 credentials in data source create Do so, in a backwards-compatible way, and not in a way with good UX. Change-Id: I<I>b<I>c2e<I>ec9c<I>aba<I>aabab<I>a6abed<I>f3
|
py
|
diff --git a/salt/states/file.py b/salt/states/file.py
index <HASH>..<HASH> 100644
--- a/salt/states/file.py
+++ b/salt/states/file.py
@@ -318,7 +318,7 @@ def managed(name,
makedirs=False,
context=None,
defaults=None,
- __env__='base':
+ __env__='base'):
'''
Manage a given file, this function allows for a file to be downloaded from
the salt master and potentially run through a templating system.
|
getting back in the mix :)
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
from setuptools import setup, find_packages
-version = '1.0.0'
+version = '1.1.3'
setup(name='bika.lims',
version=version,
|
Corrected the version in setup.py.
|
py
|
diff --git a/src/arcrest/manageags/_services.py b/src/arcrest/manageags/_services.py
index <HASH>..<HASH> 100644
--- a/src/arcrest/manageags/_services.py
+++ b/src/arcrest/manageags/_services.py
@@ -183,10 +183,9 @@ class Services(BaseAGSServer):
}
type_services = []
folders = self.folders
- folders.append("")
baseURL = self._url
for folder in folders:
- if folder == "":
+ if folder == "/":
url = baseURL
else:
url = baseURL + "/%s" % folder
@@ -196,10 +195,10 @@ class Services(BaseAGSServer):
proxy_port=self._proxy_port)
if res.has_key("services"):
for service in res['services']:
- #if service_type == "*":
- #service['URL'] = url + "/%s.%s" % (service['serviceName'],
- #service_type)
- #type_services.append(service)
+ if service_type == "*":
+ service['URL'] = url + "/%s.%s" % (service['serviceName'],
+ service['type'])
+ type_services.append(service)
if service['type'].lower() in lower_types:
service['URL'] = url + "/%s.%s" % (service['serviceName'],
service_type)
|
Fixed find_services() to support * for service types and URL for the services in the root (otherwise double // is added to the url)
|
py
|
diff --git a/asv/benchmark.py b/asv/benchmark.py
index <HASH>..<HASH> 100644
--- a/asv/benchmark.py
+++ b/asv/benchmark.py
@@ -498,7 +498,7 @@ class TimeBenchmark(Benchmark):
if repeat == 0:
# automatic number of samples: 10 is large enough to
# estimate the median confidence interval
- repeat = -(-10//self.processes) # ceildiv
+ repeat = 5 if self.processes > 1 else 10
default_number = (number == 0)
def too_slow(timing):
|
benchmark: use a more reasonable number of repeats per process Minimum at 5 samples per process enables people to scale up more easily just by increasing `processes` without having to set `repeat` at the same time.
|
py
|
diff --git a/salt/modules/virtualenv_mod.py b/salt/modules/virtualenv_mod.py
index <HASH>..<HASH> 100644
--- a/salt/modules/virtualenv_mod.py
+++ b/salt/modules/virtualenv_mod.py
@@ -176,7 +176,7 @@ def create(path,
cmd.append('--distribute')
if python is not None and python.strip() != '':
- if not os.access(python, os.X_OK):
+ if not salt.utils.which(python):
raise salt.exceptions.CommandExecutionError(
'Requested python ({0}) does not appear '
'executable.'.format(python)
|
allow lookup of python on system path fix: #<I> fixes #<I>
|
py
|
diff --git a/resolwe/elastic/indices.py b/resolwe/elastic/indices.py
index <HASH>..<HASH> 100644
--- a/resolwe/elastic/indices.py
+++ b/resolwe/elastic/indices.py
@@ -21,7 +21,6 @@ import logging
import threading
import elasticsearch_dsl as dsl
-from elasticsearch.exceptions import NotFoundError
from elasticsearch.helpers import bulk
from elasticsearch_dsl.connections import connections
from elasticsearch_dsl.exceptions import IllegalOperation
@@ -390,11 +389,10 @@ class BaseIndex(object):
def remove_object(self, obj):
"""Remove current object from the ElasticSearch."""
obj_id = self.generate_id(obj)
- try:
- index = self.document_class.get(obj_id)
- index.delete(refresh=True)
- except NotFoundError:
- pass # object doesn't exist in index
+ es_obj = self.document_class.get(obj_id, ignore=[404])
+ # Object may not exist in this index.
+ if es_obj:
+ es_obj.delete(refresh=True)
def search(self):
"""Return search query of document object."""
|
Don't emit warning logs when deleting objects from ES
|
py
|
diff --git a/umis/umis.py b/umis/umis.py
index <HASH>..<HASH> 100644
--- a/umis/umis.py
+++ b/umis/umis.py
@@ -297,7 +297,7 @@ def tagcount(sam, out, genemap, output_evidence_table, positional, minevidence,
logger.info('Output results')
if subsample:
- cb_hist_sampled.to_csv('ss_{}_'.format(subsample) + cb_histogram, sep='\t')
+ cb_hist_sampled.to_csv('ss_{}_'.format(subsample) + os.path.basename(cb_histogram), sep='\t')
if output_evidence_table:
import shutil
|
Working file writing for sampled cb_hist
|
py
|
diff --git a/nipap-www/nipapwww/controllers/xhr.py b/nipap-www/nipapwww/controllers/xhr.py
index <HASH>..<HASH> 100644
--- a/nipap-www/nipapwww/controllers/xhr.py
+++ b/nipap-www/nipapwww/controllers/xhr.py
@@ -85,6 +85,7 @@ class XhrController(BaseController):
"""
search_options = {}
+ extra_query = None
if 'query_id' in request.params:
search_options['query_id'] = request.params['query_id']
@@ -95,9 +96,16 @@ class XhrController(BaseController):
if 'offset' in request.params:
search_options['offset'] = request.params['offset']
+ if 'vrf_id' in request.params:
+ extra_query = {
+ 'val1': 'id',
+ 'operator': 'equals',
+ 'val2': request.params['vrf_id']
+ }
+
try:
result = VRF.smart_search(request.params['query_string'],
- search_options
+ search_options, extra_query
)
except NipapError, e:
return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})
|
Add vrf_id arg to XHR smart_search_vrf We can't pass a complete dict-SQL as an argument to the XHR from a javscript, so instead vrf_id was added which builds the dict-SQL in the XHR function and adds that as extra_query to the smart_search_vrf function in the backend. Part of #<I>
|
py
|
diff --git a/voltron/plugins/view/register.py b/voltron/plugins/view/register.py
index <HASH>..<HASH> 100644
--- a/voltron/plugins/view/register.py
+++ b/voltron/plugins/view/register.py
@@ -395,7 +395,7 @@ class RegisterView (TerminalView):
@classmethod
def configure_subparser(cls, subparsers):
- sp = subparsers.add_parser('register', help='register values', aliases=('r', 'reg'))
+ sp = subparsers.add_parser('registers', help='register values', aliases=('r', 'reg', 'register'))
VoltronView.add_generic_arguments(sp)
sp.set_defaults(func=RegisterView)
g = sp.add_mutually_exclusive_group()
|
plugins: view: register: Add registers alias The breakpoints view is plural, so it didn't make sense (to me) that register didn't work if pluralized. Kept the non plural version just so I don't break anyone's setup scripts.
|
py
|
diff --git a/telemetry/telemetry/unittest/json_results.py b/telemetry/telemetry/unittest/json_results.py
index <HASH>..<HASH> 100644
--- a/telemetry/telemetry/unittest/json_results.py
+++ b/telemetry/telemetry/unittest/json_results.py
@@ -58,6 +58,9 @@ def UploadFullResultsIfNecessary(args, full_results):
if not args.test_results_server:
return False, ''
+ # TODO(dpranke) crbug.com/403663 disable this temporarily.
+ return False, ''
+
url = 'http://%s/testfile/upload' % args.test_results_server
attrs = [('builder', args.builder_name),
('master', args.master_name),
|
Disable uploading telemetry results temporarily. For some reason the test-results server is crashing when processing the uploaded JSON file. I'm not sure if the file format is invalid, or if we're hitting some other problem on the server. However, if we get a <I> back from the server, we fail the test run, and that is bad, so for now, we'll disable the upload. TBR=<EMAIL>, <EMAIL> BUG=<I> Review URL: <URL>
|
py
|
diff --git a/tinymce/compressor.py b/tinymce/compressor.py
index <HASH>..<HASH> 100644
--- a/tinymce/compressor.py
+++ b/tinymce/compressor.py
@@ -27,7 +27,8 @@ safe_filename_re = re.compile("^[a-zA-Z][a-zA-Z0-9_/-]*$")
def get_file_contents(filename):
base_path = tinymce.settings.JS_ROOT
if settings.DEBUG and settings.STATIC_ROOT:
- base_path = os.path.join(os.path.dirname(__file__), "media/js/tiny_mce")
+ from django.contrib.staticfiles import finders
+ base_path = finders.find('tiny_mce')
try:
f = open(os.path.join(base_path, filename))
|
Use static finder to be able to overload it
|
py
|
diff --git a/plexapi/video.py b/plexapi/video.py
index <HASH>..<HASH> 100644
--- a/plexapi/video.py
+++ b/plexapi/video.py
@@ -168,7 +168,8 @@ class Video(PlexPartialObject):
if title is None:
title = self.title
- key = '/playlists/1111/items?'
+ backgroundProcessing = self.fetchItem('/playlists?type=42')
+ key = '%s/items?' % backgroundProcessing.key
params = {
'Item[type]': 42,
'Item[target]': target,
|
find server's backgroundProcessing key
|
py
|
diff --git a/shap/explainers/_tree.py b/shap/explainers/_tree.py
index <HASH>..<HASH> 100644
--- a/shap/explainers/_tree.py
+++ b/shap/explainers/_tree.py
@@ -126,7 +126,7 @@ class Tree(Explainer):
self.data = data
if self.data is None:
feature_perturbation = "tree_path_dependent"
- warnings.warn("Setting feature_perturbation = \"tree_path_dependent\" because no background data was given.")
+ #warnings.warn("Setting feature_perturbation = \"tree_path_dependent\" because no background data was given.")
elif feature_perturbation == "interventional" and self.data.shape[0] > 1000:
warnings.warn("Passing "+str(self.data.shape[0]) + " background samples may lead to slow runtimes. Consider "
"using shap.sample(data, 100) to create a smaller background data set.")
|
Stop warning for the tree path version of Tree explainer
|
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
@@ -2189,6 +2189,7 @@ def increaseamount_assemble_interactions_only(stmt, model, agent_set):
add_rule_to_model(model, r)
def increaseamount_assemble_one_step(stmt, model, agent_set):
+ print(stmt)
# We get the monomer pattern just to get a valid monomer
# otherwise the patter will be replaced
obj_pattern = get_monomer_pattern(model, stmt.obj)
@@ -2219,7 +2220,7 @@ def increaseamount_assemble_one_step(stmt, model, agent_set):
kf_one_step_synth = get_create_parameter(model, param_name, 2e-1)
rule_subj_str = get_agent_rule_str(stmt.subj)
rule_name = '%s_synthesizes_%s' % (rule_subj_str, rule_obj_str)
- r = Rule(rule_name, subj_pattern >> obj_pattern + subj_pattern,
+ r = Rule(rule_name, subj_pattern >> subj_pattern + obj_pattern,
kf_one_step_synth)
add_rule_to_model(model, r)
|
Change subj/obj order of IncreaseAmount rule
|
py
|
diff --git a/udiskie/umount.py b/udiskie/umount.py
index <HASH>..<HASH> 100644
--- a/udiskie/umount.py
+++ b/udiskie/umount.py
@@ -16,7 +16,7 @@ def unmount_device(device):
device.unmount()
logger.info('unmounted device %s' % (device,))
else:
- logger.info('skipping unhandled device %s' % (device,))
+ logger.debug('skipping unhandled device %s' % (device,))
def unmount(path):
"""Unmount a filesystem
|
That message really should be a debug message.
|
py
|
diff --git a/tests/test_kerberos.py b/tests/test_kerberos.py
index <HASH>..<HASH> 100644
--- a/tests/test_kerberos.py
+++ b/tests/test_kerberos.py
@@ -1,6 +1,7 @@
import kerberos
import os
import requests
+import sys
username = os.environ.get('KERBEROS_USERNAME', 'administrator')
password = os.environ.get('KERBEROS_PASSWORD', 'Password01')
@@ -119,9 +120,14 @@ def test_leaks_server():
def server_init():
kerberos.authGSSServerInit(SERVICE)
+ # We're testing for memory leaks, so use xrange instead of range in python2
+ if sys.version_info[0] > 2:
+ for _ in range(COUNT):
+ server_init()
+ else:
+ for _ in xrange(COUNT):
+ server_init()
- for _ in xrange(COUNT):
- server_init()
# Because I'm not entirely certain that python's gc guaranty's timeliness
# of destructors, lets kick off a manual gc.
gc.collect()
|
Conditional use of xrange Python2's xrange is Python3+'s range, while Python3's xrange isn't a thing at all.
|
py
|
diff --git a/test/test_execute.py b/test/test_execute.py
index <HASH>..<HASH> 100644
--- a/test/test_execute.py
+++ b/test/test_execute.py
@@ -212,7 +212,19 @@ processed.append((_par, _res))
wf = script.workflow()
Sequential_Executor(wf).inspect()
self.assertEqual(env.sos_dict['processed'], [((1, 2), 'p1.txt'), ((1, 3), 'p2.txt'), ((2, 3), 'p3.txt')])
+ #
+ # test for each for pandas dataframe
+ script = SoS_Script(r"""
+[0: alias='res']
+import pandas as pd
+data = pd.DataFrame([(1, 2, 'Hello'), (2, 4, 'World')], columns=['A', 'B', 'C'])
+input: for_each='data'
+output: '${_data["A"]}_${_data["B"]}_${_data["C"]}.txt'
+""")
+ wf = script.workflow()
+ Sequential_Executor(wf).inspect()
+ self.assertEqual(env.sos_dict['res'].output, ['1_2_Hello.txt', '2_4_World.txt'])
def testPairedWith(self):
'''Test option paired_with '''
|
Test for_each looping through pandas dataframe
|
py
|
diff --git a/tests/settings.py b/tests/settings.py
index <HASH>..<HASH> 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -173,6 +173,7 @@ FLOW_DOCKER_VOLUME_EXTRA_OPTIONS = {
'secrets': 'Z',
'users': 'Z',
'tools': 'z',
+ 'runtime': 'Z',
}
FLOW_DOCKER_EXTRA_VOLUMES = []
|
Add extra options for Docker runtime dirs to test settings
|
py
|
diff --git a/qtpylib/algo.py b/qtpylib/algo.py
index <HASH>..<HASH> 100644
--- a/qtpylib/algo.py
+++ b/qtpylib/algo.py
@@ -174,11 +174,12 @@ class Algo(Broker):
sys.exit(0)
if self.backtest_end is None:
self.backtest_end = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
- if self.backtest_csv is not None and not os.path.exists(self.backtest_csv):
- self.log_algo.error("CSV directory cannot be found (%s)" % self.backtest_csv)
- sys.exit(0)
- elif self.backtest_csv.endswith("/"):
- self.backtest_csv = self.backtest_csv[:-1]
+ if self.backtest_csv is not None:
+ if not os.path.exists(self.backtest_csv):
+ self.log_algo.error("CSV directory cannot be found (%s)" % self.backtest_csv)
+ sys.exit(0)
+ elif self.backtest_csv.endswith("/"):
+ self.backtest_csv = self.backtest_csv[:-1]
else:
self.backtest_start = None
|
fixed bug related to backtest csv path
|
py
|
diff --git a/katcp/test/test_server.py b/katcp/test/test_server.py
index <HASH>..<HASH> 100644
--- a/katcp/test/test_server.py
+++ b/katcp/test/test_server.py
@@ -1094,7 +1094,9 @@ class TestDeviceServerClientIntegrated(unittest.TestCase, TestUtilMixin):
if PY3:
with self.assertRaises(ValueError):
self.client.test_help(request_names)
-
+ # Please note that this does not fail in python2
+ if PY2:
+ self.client.test_help(request_names)
class TestHandlerFiltering(unittest.TestCase):
class DeviceWithEverything(katcp.DeviceServer):
|
add condition for python2 in byte strings test_help failure
|
py
|
diff --git a/paved/django.py b/paved/django.py
index <HASH>..<HASH> 100644
--- a/paved/django.py
+++ b/paved/django.py
@@ -14,6 +14,7 @@ util.update(
manage_py = None,
project = None,
settings = '',
+ runserver_port = '',
syncdb = Bunch(
fixtures = [],
),
@@ -112,13 +113,16 @@ def start(info):
"""
cmd = 'runserver'
- settings = __import__(options.paved.django.settings)
try:
import django_extensions
cmd = 'runserver_plus'
except ImportError:
info("Could not import django_extensions. Using default runserver.")
+ port = options.paved.django.runserver_port
+ if port:
+ cmd = '%s %s' % (cmd, port)
+
call_manage(cmd)
|
Added runserver_port option to paver start
|
py
|
diff --git a/hpcbench/benchmark/custream.py b/hpcbench/benchmark/custream.py
index <HASH>..<HASH> 100644
--- a/hpcbench/benchmark/custream.py
+++ b/hpcbench/benchmark/custream.py
@@ -139,7 +139,8 @@ class CUDAStream(Benchmark):
name="{hostname} {category} bandwidth",
series=dict(
metas=['blocksizes'],
- metrics=['copy_bandwidth',
+ metrics=[
+ 'copy_bandwidth',
'scale_bandwidth',
'add_bandwidth',
'triad_bandwidth',
|
fixed indentation to make flake happy
|
py
|
diff --git a/coursera/test/test_parsing.py b/coursera/test/test_parsing.py
index <HASH>..<HASH> 100644
--- a/coursera/test/test_parsing.py
+++ b/coursera/test/test_parsing.py
@@ -173,7 +173,8 @@ class TestSyllabusParsing(unittest.TestCase):
classes = {
'datasci-001': (10, 97, 358, 97), # issue 134
'startup-001': (4, 44, 136, 44), # issue 137
- 'wealthofnations-001': (8, 74, 296, 74) # issue 131
+ 'wealthofnations-001': (8, 74, 296, 74), # issue 131
+ 'malsoftware-001': (3, 18, 56, 16) # issue 148
}
for class_, counts in classes.items():
|
tests: Incorporate test where the parser was dying with an exception. Perhaps this should have been in a different function, but, for now, it works OK.
|
py
|
diff --git a/aikif/.z_prototype/check_ontology_content.py b/aikif/.z_prototype/check_ontology_content.py
index <HASH>..<HASH> 100644
--- a/aikif/.z_prototype/check_ontology_content.py
+++ b/aikif/.z_prototype/check_ontology_content.py
@@ -57,7 +57,11 @@ def main():
# SEE mini lib to do this - https://github.com/tardyp/dictns
# also bunch = https://github.com/dsc/bunch
-
+ # show process file
+ print('\nPROCESS RAW DATA.YAML\n===================================')
+ with open(os.path.join('..','data','ref','process_raw_data.yaml'), 'r') as stream:
+ y = yaml.safe_load(stream)
+ pprint.pprint(y)
class DictView(object):
def __init__(self, d):
|
test to view new process yaml file
|
py
|
diff --git a/pysegbase/graph.py b/pysegbase/graph.py
index <HASH>..<HASH> 100644
--- a/pysegbase/graph.py
+++ b/pysegbase/graph.py
@@ -45,7 +45,7 @@ class Graph(object):
last = self.lastnode
if type(coors) is nm.ndarray:
if len(coors.shape) == 1:
- coors = coors.reshape((1,3))
+ coors = coors.reshape((1, self.data.ndim))
nadd = coors.shape[0]
idx = slice(last, last + nadd)
@@ -181,7 +181,7 @@ class Graph(object):
# in old implementation nodes are always 3D
# right_voxelsize = self.voxelsize3[:nd.shape[1]]
nd = make_nodes_3d(nd)
- self.add_nodes(nd + self.nodes[ndid,:] - (self.voxelsize3 / nsplit))
+ self.add_nodes(nd + self.nodes[ndid,:] - (self.voxelsize3 / 2))
self.add_edges(ed + ndoffset, ed_dir)
# connect subgrid
|
fixed splited node symmetry
|
py
|
diff --git a/synapse/lib/grammar.py b/synapse/lib/grammar.py
index <HASH>..<HASH> 100644
--- a/synapse/lib/grammar.py
+++ b/synapse/lib/grammar.py
@@ -233,8 +233,7 @@ class AstConverter(lark.Transformer):
assert kid.type == 'TAG'
return s_ast.TagName(kid.value)
- kids = self._convert_children(kids)
- return kids[0]
+ return self._convert_child(kid)
def valulist(self, kids):
kids = self._convert_children(kids)
|
Cleanup from PR #<I>
|
py
|
diff --git a/spinoff/remoting/hublogic.py b/spinoff/remoting/hublogic.py
index <HASH>..<HASH> 100644
--- a/spinoff/remoting/hublogic.py
+++ b/spinoff/remoting/hublogic.py
@@ -197,7 +197,7 @@ class HubLogic(object):
def relay_connected_received(self, relayee_nid):
if relayee_nid in self.cl_relayees:
relay_nid = self.cl_relayees[relayee_nid]
- for msg_h in self.queues.pop(relayee_nid):
+ for msg_h in self.queues.pop(relayee_nid, []):
yield RelaySend, (IN if relay_nid in self.channels_in else OUT), relay_nid, relayee_nid, msg_h
def relay_nodedown_received(self, relay_nid, relayee_nid):
|
Fixed KeyError in relaying
|
py
|
diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index <HASH>..<HASH> 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -3,6 +3,7 @@
import os
import site
import sys
+import io
import pytest
@@ -74,16 +75,12 @@ class TestDevelopTest:
assert content == ['easy-install.pth', 'foo.egg-link']
# Check that we are using the right code.
- egg_link_file = open(os.path.join(site.USER_SITE, 'foo.egg-link'), 'rt')
- try:
+ fn = os.path.join(site.USER_SITE, 'foo.egg-link')
+ with io.open(fn) as egg_link_file:
path = egg_link_file.read().split()[0].strip()
- finally:
- egg_link_file.close()
- init_file = open(os.path.join(path, 'foo', '__init__.py'), 'rt')
- try:
+ fn = os.path.join(path, 'foo', '__init__.py')
+ with io.open(fn) as init_file:
init = init_file.read().strip()
- finally:
- init_file.close()
if sys.version < "3":
assert init == 'print "foo"'
else:
|
Use io.open and its context for simpler reading of a file
|
py
|
diff --git a/keyboard/_darwinkeyboard.py b/keyboard/_darwinkeyboard.py
index <HASH>..<HASH> 100644
--- a/keyboard/_darwinkeyboard.py
+++ b/keyboard/_darwinkeyboard.py
@@ -21,7 +21,7 @@ class KeyMap(object):
0x24: 'return',
0x30: 'tab',
0x31: 'space',
- 0x33: 'delete',
+ 0x33: 'backspace',
0x35: 'escape',
0x37: 'command',
0x38: 'shift',
@@ -55,7 +55,7 @@ class KeyMap(object):
0x72: 'help',
0x73: 'home',
0x74: 'page up',
- 0x75: 'forward delete',
+ 0x75: 'delete',
0x76: 'f4',
0x77: 'end',
0x78: 'f2',
|
Rename 'delete' and 'forward delete' to 'backspace' and 'delete'
|
py
|
diff --git a/src/wormhole/server/rendezvous_websocket.py b/src/wormhole/server/rendezvous_websocket.py
index <HASH>..<HASH> 100644
--- a/src/wormhole/server/rendezvous_websocket.py
+++ b/src/wormhole/server/rendezvous_websocket.py
@@ -211,10 +211,10 @@ class WebSocketRendezvous(websocket.WebSocketServerProtocol):
raise Error("missing 'phase'")
if "body" not in msg:
raise Error("missing 'body'")
- msgid = msg.get("id") # optional
+ msg_id = msg.get("id") # optional
sm = SidedMessage(side=self._side, phase=msg["phase"],
body=msg["body"], server_rx=server_rx,
- msg_id=msgid)
+ msg_id=msg_id)
self._mailbox.add_message(sm)
def handle_close(self, msg, server_rx):
|
internal rename msg_id, for consistency
|
py
|
diff --git a/integration_tests/output_collector.py b/integration_tests/output_collector.py
index <HASH>..<HASH> 100644
--- a/integration_tests/output_collector.py
+++ b/integration_tests/output_collector.py
@@ -7,14 +7,8 @@ class OutputCollector:
self.getvalue = self.stream.getvalue
def write(self,data):
self.stream.write(data)
- def assert_equal_to(self, expected):
- return self.should_be(expected)
def should_be(self, expected):
assert_equals_with_unidiff(expected, self.output())
- def should_match(self, regex):
- text = self.output()
- from nose.tools import assert_regexp_matches
- assert_regexp_matches(text, regex)
def output(self):
return self.stream.getvalue()
|
Refactor: removed unused methods assert_equal_to, should_match
|
py
|
diff --git a/num2words/__init__.py b/num2words/__init__.py
index <HASH>..<HASH> 100644
--- a/num2words/__init__.py
+++ b/num2words/__init__.py
@@ -63,7 +63,10 @@ CONVERTER_CLASSES = {
'vi_VN': lang_VN.Num2Word_VN()
}
-def num2words(number, ordinal=False, lang='en'):
+CONVERTES_TYPES = ['cardinal', 'ordinal', 'year', 'currency']
+
+
+def num2words(number, ordinal=False, lang='en', to='cardinal'):
# We try the full language first
if lang not in CONVERTER_CLASSES:
# ... and then try only the first 2 letters
@@ -71,7 +74,11 @@ def num2words(number, ordinal=False, lang='en'):
if lang not in CONVERTER_CLASSES:
raise NotImplementedError()
converter = CONVERTER_CLASSES[lang]
+ # backwards compatible
if ordinal:
return converter.to_ordinal(number)
- else:
- return converter.to_cardinal(number)
+
+ if to not in CONVERTES_TYPES:
+ raise NotImplementedError()
+
+ return getattr(converter, 'to_{}'.format(to))(number)
|
Allow call to other convertes as to_currency, to_year There are at least to issues related with questions about how to use other convertes. This changes should allow the use of this converters
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@ options = dict(name='cascadenik',
author_email='mike@teczno.com',
platforms='OS Independent',
license='todo',
- requires=['Mapnik','cssutils','PIL'],
+ requires=['Mapnik', 'cssutils'],
keywords='Mapnik,xml,css,mapping',
url='https://github.com/mapnik/Cascadenik',
classifiers=[
|
Removed PIL from setup.py so pip will stop ineffectually trying to compile it - use apt or brew or whatever
|
py
|
diff --git a/DataItem.py b/DataItem.py
index <HASH>..<HASH> 100644
--- a/DataItem.py
+++ b/DataItem.py
@@ -1204,6 +1204,12 @@ class DataItem(Storage.StorageBase):
data = property(__get_data)
return DataAccessor(self)
+ def __get_data_immediate(self):
+ """ add_ref, get data, remove_ref """
+ with self.data_ref() as data_ref:
+ return data_ref.data
+ data = property(__get_data_immediate)
+
# root data is data before operations have been applied.
def __get_root_data(self):
# this should NOT happen under the data mutex. it can take a long time.
|
Add immediate '.data' accessor. Use sparingly. svn r<I>
|
py
|
diff --git a/sigal/gallery.py b/sigal/gallery.py
index <HASH>..<HASH> 100644
--- a/sigal/gallery.py
+++ b/sigal/gallery.py
@@ -793,11 +793,11 @@ class Gallery:
self.logger.info("Using %s cores", ncpu)
if ncpu > 1:
- def pool_init():
- if self.settings['max_img_pixels']:
- PILImage.MAX_IMAGE_PIXELS = self.settings['max_img_pixels']
-
- self.pool = multiprocessing.Pool(processes=ncpu, initializer=pool_init)
+ self.pool = multiprocessing.Pool(
+ processes=ncpu,
+ initializer=pool_init,
+ initargs=(self.settings['max_img_pixels'],),
+ )
else:
self.pool = None
@@ -931,6 +931,11 @@ class Gallery:
yield f
+def pool_init(max_img_pixels):
+ if max_img_pixels:
+ PILImage.MAX_IMAGE_PIXELS = max_img_pixels
+
+
def process_file(media):
processor = None
if media.type == 'image':
|
Fix pickle error with pool_init
|
py
|
diff --git a/salt/modules/aptpkg.py b/salt/modules/aptpkg.py
index <HASH>..<HASH> 100644
--- a/salt/modules/aptpkg.py
+++ b/salt/modules/aptpkg.py
@@ -1597,7 +1597,7 @@ def del_repo_key(name=None, **kwargs):
owner_name, ppa_name = name[4:].split('/')
ppa_info = _get_ppa_info_from_launchpad(
owner_name, ppa_name)
- keyid = ppa_info['signing_key_fingerprint']
+ keyid = ppa_info['signing_key_fingerprint'][-8:]
else:
raise SaltInvocationError(
'keyid_ppa requires that a PPA be passed'
|
Fetch a keyid ID from a fingerprint `apt-key del` works with IDs `signing_key_fingerprint` contains a fingerprint
|
py
|
diff --git a/jwt/tests/test_jwk.py b/jwt/tests/test_jwk.py
index <HASH>..<HASH> 100644
--- a/jwt/tests/test_jwk.py
+++ b/jwt/tests/test_jwk.py
@@ -73,7 +73,7 @@ def test_jwk_from_dict_unsupported_kty():
def test_jwk_from_bytes_argument_conversion_confusing_name():
with raises(Exception) as ex:
@jwk_from_bytes_argument_conversion
- def confusing(): # pylint: disable=unused-variable
+ def confusing(): # pylint: disable=unused-variable # pragma: no cover
pass
assert ("the wrapped function must have either public"
" or private in it's name" in str(ex))
|
forgot no cover in this test inner function
|
py
|
diff --git a/wallpaper/color_scheme.py b/wallpaper/color_scheme.py
index <HASH>..<HASH> 100644
--- a/wallpaper/color_scheme.py
+++ b/wallpaper/color_scheme.py
@@ -92,9 +92,9 @@ class ColorNoise:
def __init__(self, params, parent):
self.parent = parent
- hue = params.uniform("hue_variation", -.05, .05)
- saturation = params.uniform("saturation_variation", -.2, .2)
- value = params.uniform("value_variation", -.2, .2)
+ hue = params.uniform("hue_variation", 0, .05)
+ saturation = params.uniform("saturation_variation", 0, .2)
+ value = params.uniform("value_variation", 0, .5)
base_scale = .1 * abs(params.size)
|
Only use half the range for color noise The offset is negated anyway
|
py
|
diff --git a/tests/unit/modules/test_solarisips.py b/tests/unit/modules/test_solarisips.py
index <HASH>..<HASH> 100644
--- a/tests/unit/modules/test_solarisips.py
+++ b/tests/unit/modules/test_solarisips.py
@@ -21,7 +21,6 @@ import salt.utils.data
@skipIf(NO_MOCK, NO_MOCK_REASON)
-@skipIf(sys.platform != 'solaris', 'Skip when not running on Solaris')
class IpsTestCase(TestCase, LoaderModuleMockMixin):
'''
Test cases for salt.modules.solarisips
@@ -172,7 +171,7 @@ class IpsTestCase(TestCase, LoaderModuleMockMixin):
Test installing a package that is already installed
'''
result = None
- expected_result = 'Package already installed.'
+ expected_result = {}
with patch.object(solarisips, 'is_installed', return_value=True):
result = solarisips.install(name='less')
self.assertEqual(result, expected_result)
|
Remove skipif and change expected return for solarisips test
|
py
|
diff --git a/microcosm_postgres/createall.py b/microcosm_postgres/createall.py
index <HASH>..<HASH> 100644
--- a/microcosm_postgres/createall.py
+++ b/microcosm_postgres/createall.py
@@ -10,7 +10,9 @@ from microcosm_postgres.operations import create_all, drop_all
def parse_args(graph):
parser = ArgumentParser()
parser.add_argument("--drop", "-D", action="store_true")
- return parser.parse_args()
+ # Allow services to set custom arguments for `createall`
+ arguments, _ = parser.parse_known_args()
+ return arguments
def main(graph):
|
Parse only known arguments in `createall` **Why?** Services using `createall` may want to have custom behavior, depending on arguments that they will parse but will be unrecognized here. **What?** Only parse know arguments in `createall`.
|
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='python-i18n',
- version='0.1.2',
+ version='0.1.3',
description='Translation library for Python',
long_description=open('README.md').read(),
author='Daniel Perez',
@@ -10,7 +10,7 @@ setup(
url='https://github.com/tuvistavie/python-i18n',
download_url='https://github.com/tuvistavie/python-i18n/archive/master.zip',
license='MIT',
- packages=['i18n', 'i18n.tests'],
+ packages=['i18n', 'i18n.loaders', 'i18n.tests'],
include_package_data=True,
zip_safe=True,
test_suite='i18n.tests',
|
Add missing package to setup.py.
|
py
|
diff --git a/salt/pillar/hiera.py b/salt/pillar/hiera.py
index <HASH>..<HASH> 100644
--- a/salt/pillar/hiera.py
+++ b/salt/pillar/hiera.py
@@ -3,9 +3,26 @@ Take in a hiera configuration file location and execute it.
Adds the hiera data to pillar
'''
+# Import python libs
+import logging
+
+# Import salt libs
+import salt.utils
+
# Import third party libs
import yaml
+
+# Set up logging
+log = logging.getLogger(__name__)
+
+def __virtual__():
+ '''
+ Only return if hiera is installed
+ '''
+ return 'hiera' if salt.utils.which('hiera') else False
+
+
def ext_pillar(conf):
'''
Execute hiera and return the data
@@ -14,4 +31,11 @@ def ext_pillar(conf):
for key, val in __grains__.items():
if isinstance(val, string_types):
cmd += ' {0}={1}'.format(key, val)
- return yaml.safe_load(__salt__['cmd.run'](cmd))
+ try:
+ data = yaml.safe_load(__salt__['cmd.run'](cmd))
+ except Exception:
+ log.critical(
+ 'Hiera yaml data failed to parse from conf {0}'.format(conf)
+ )
+ return {}
+ return data
|
Some fixes for better logging and safety
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -16,6 +16,8 @@ setup(
'Documentation': 'https://features.readthedocs.io',
'Changelog': 'https://features.readthedocs.io/en/latest/changelog.html',
'Issue Tracker': 'https://github.com/xflr6/features/issues',
+ 'CI': 'https://travis-ci.org/xflr6/features',
+ 'Coverage': 'https://codecov.io/gh/xflr6/features',
},
packages=find_packages(),
package_data={'features': ['config.ini']},
|
add Travis CI and Codecov to project_urls
|
py
|
diff --git a/src/mousedb/data/views.py b/src/mousedb/data/views.py
index <HASH>..<HASH> 100644
--- a/src/mousedb/data/views.py
+++ b/src/mousedb/data/views.py
@@ -85,7 +85,6 @@ def experiment_details_csv(request, experiment_id):
return response
-@login_required
def aging_csv(request):
"""This view generates a csv output file of all animal data for use in aging analysis.
@@ -101,7 +100,8 @@ def aging_csv(request):
animal.Strain,
animal.Genotype,
animal.age(),
- animal.Cause_of_Death
+ animal.Cause_of_Death,
+ animal.Alive
])
return response
|
added an alive status indicator to aging.csv. Removed login required protection.
|
py
|
diff --git a/sos/report/plugins/podman.py b/sos/report/plugins/podman.py
index <HASH>..<HASH> 100644
--- a/sos/report/plugins/podman.py
+++ b/sos/report/plugins/podman.py
@@ -38,7 +38,6 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
'info',
'images',
'pod ps',
- 'pod ps -a',
'port --all',
'ps',
'ps -a',
|
[podman] remove "podman pod ps -a" command "-a" option is not used for a while (if ever) and we collect "podman pod ps" already. Resolves: #<I>
|
py
|
diff --git a/agentarchives/archivists_toolkit/atk.py b/agentarchives/archivists_toolkit/atk.py
index <HASH>..<HASH> 100644
--- a/agentarchives/archivists_toolkit/atk.py
+++ b/agentarchives/archivists_toolkit/atk.py
@@ -58,14 +58,13 @@ def get_resource_component_and_children(db, resource_id, resource_type='collecti
cursor = db.cursor()
if resource_type == 'collection':
- cursor.execute("SELECT title, dateExpression, persistentID FROM Resources WHERE resourceid=%s", (resource_id))
+ cursor.execute("SELECT title, dateExpression FROM Resources WHERE resourceid=%s", (resource_id))
for row in cursor.fetchall():
resource_data['id'] = resource_id
resource_data['sortPosition'] = sort_data['position']
resource_data['title'] = row[0]
resource_data['dates'] = row[1]
- resource_data['identifier'] = row[2]
resource_data['levelOfDescription'] = 'collection'
else:
cursor.execute("SELECT title, dateExpression, persistentID, resourceLevel FROM ResourcesComponents WHERE resourceComponentId=%s", (resource_id))
|
Got rid of use of non-existent column in resources table.
|
py
|
diff --git a/test/test_remote.py b/test/test_remote.py
index <HASH>..<HASH> 100644
--- a/test/test_remote.py
+++ b/test/test_remote.py
@@ -406,7 +406,7 @@ class TestRemote(TestBase):
# cleanup - delete created tags and branches as we are in an innerloop on
# the same repository
TagReference.delete(rw_repo, new_tag, other_tag)
- remote.push(":%s" % other_tag.path)
+ remote.push(":%s" % other_tag.path, timeout=10.0)
@skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes!")
@with_rw_and_rw_remote_repo('0.1.6')
|
also test a call to 'push' with <I>s timeout
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,6 @@
# See the LICENSE file for more information.
from setuptools import setup, find_packages
-import tornadis
DESCRIPTION = "tornadis is an async minimal redis client for tornado " \
"ioloop designed for performances (use C hiredis parser)"
@@ -22,7 +21,7 @@ with open('pip-requirements.txt') as reqs:
line.startswith('--'))]
setup(
name='tornadis',
- version=tornadis.__version__,
+ version="0.1.0",
author="Fabien MARTY",
author_email="fabien.marty@gmail.com",
url="https://github.com/thefab/tornadis",
|
Don't import tornadis in setup.py
|
py
|
diff --git a/seleniumbase/core/log_helper.py b/seleniumbase/core/log_helper.py
index <HASH>..<HASH> 100755
--- a/seleniumbase/core/log_helper.py
+++ b/seleniumbase/core/log_helper.py
@@ -130,3 +130,9 @@ def log_folder_setup(log_path, archive_logs=False):
os.makedirs(log_path)
if not settings.ARCHIVE_EXISTING_LOGS and not archive_logs:
shutil.rmtree(archived_logs)
+ elif len(os.listdir(archived_logs)) == 0:
+ # Don't archive an empty directory
+ shutil.rmtree(archived_logs)
+ else:
+ # Logs are saved/archived
+ pass
|
When archive_logs is enabled, don't archive empty directories
|
py
|
diff --git a/ss.py b/ss.py
index <HASH>..<HASH> 100644
--- a/ss.py
+++ b/ss.py
@@ -388,6 +388,7 @@ def main(argv=sys.argv, stream=sys.stdout):
with ThreadPoolExecutor(max_workers=config.parallel_jobs) as executor:
future_to_mkv_filename = {}
for movie_filename, subtitles in to_embed:
+ subtitles.sort()
movie_ext = os.path.splitext(movie_filename)[1].lower()
mkv_filename = os.path.splitext(movie_filename)[0] + u'.mkv'
if movie_ext != u'.mkv' and not os.path.isfile(mkv_filename):
|
making tests more resilient ensuring subtitles are sorted before being passed to embed_mkv, since the order may change when running in multiple threads.
|
py
|
diff --git a/pypif_sdk/accessor.py b/pypif_sdk/accessor.py
index <HASH>..<HASH> 100644
--- a/pypif_sdk/accessor.py
+++ b/pypif_sdk/accessor.py
@@ -1,5 +1,5 @@
-def get_propety_by_name(pif, name):
+def get_property_by_name(pif, name):
"""Get a property by name"""
return next((x for x in pif.properties if x.name == name), None)
|
Fixing typo in get_property_by_name
|
py
|
diff --git a/glitter/urls.py b/glitter/urls.py
index <HASH>..<HASH> 100644
--- a/glitter/urls.py
+++ b/glitter/urls.py
@@ -7,6 +7,7 @@ from glitter.integration import glitter_app_pool
import importlib
urlpatterns = []
+used_apps = []
try:
# Attempt to find all Glitter App Pages, get their corresponding Glitter App configs and then
@@ -26,6 +27,21 @@ try:
include(app_url_conf, namespace=glitter_app.namespace)
)
urlpatterns.append(app_url)
+ used_apps.append(app_page.glitter_app_name)
+
+ # If a page has not been created for an app yet, we don't want a NoReverseMatch error every
+ # time someone tries to '{% url %}' or 'reverse()' a viewname. So lets add a URL pattern entry
+ # to support those requests.
+ glitter_apps = glitter_app_pool.get_glitter_apps()
+ for system_name, glitter_app in glitter_apps.items():
+ if system_name not in used_apps:
+ app_url_conf = importlib.import_module(glitter_app.url_conf)
+
+ app_url = url(
+ '^{}/'.format(system_name),
+ include(app_url_conf, namespace=glitter_app.namespace)
+ )
+ urlpatterns.append(app_url)
except DatabaseError:
# Database not setup correctly, not much we can do
|
Don't error out when using App Page routes not yet in nav For #<I>
|
py
|
diff --git a/skyfield/timelib.py b/skyfield/timelib.py
index <HASH>..<HASH> 100644
--- a/skyfield/timelib.py
+++ b/skyfield/timelib.py
@@ -159,11 +159,15 @@ class JulianDate(object):
"""
dt, leap_second = self.utc_datetime()
- normalize = getattr(tz, 'normalize', lambda d: d)
- if self.shape:
+ normalize = getattr(tz, 'normalize', None)
+ if self.shape and normalize is not None:
dt = [normalize(d.astimezone(tz)) for d in dt]
- else:
+ elif self.shape:
+ dt = [d.astimezone(tz) for d in dt]
+ elif normalize is not None:
dt = normalize(dt.astimezone(tz))
+ else:
+ dt = dt.astimezone(tz)
return dt, leap_second
def utc_datetime(self):
|
Remove no-op lambda, at a cost of more if-else's
|
py
|
diff --git a/uncompyle6/__init__.py b/uncompyle6/__init__.py
index <HASH>..<HASH> 100644
--- a/uncompyle6/__init__.py
+++ b/uncompyle6/__init__.py
@@ -31,7 +31,7 @@ from __future__ import print_function
Probably a complete rewrite would be sensefull. hG/2000-12-27
'''
-import os, marshal, sys, types
+import imp, os, marshal, sys, types
# set before importing scanner
PYTHON3 = (sys.version_info >= (3, 0))
@@ -103,8 +103,9 @@ def load_module(filename):
# print version
fp.read(4) # timestamp
magic_int = magics.magic2int(magic)
+ my_magic_int = magics.magic2int(imp.get_magic())
- if version == PYTHON_VERSION:
+ if my_magic_int == magic_int:
# Note: a higher magic number necessarily mean a later
# release. At Python 3.0 the magic number decreased
# significantly. Hence the range below. Also note
|
Restrict marshal.loads when magic is the same. This is more stringent than using the Python major/minor version
|
py
|
diff --git a/pifpaf/tests/test_drivers.py b/pifpaf/tests/test_drivers.py
index <HASH>..<HASH> 100644
--- a/pifpaf/tests/test_drivers.py
+++ b/pifpaf/tests/test_drivers.py
@@ -75,6 +75,7 @@ class TestDrivers(testtools.TestCase):
def test_stuck_process(self):
d = drivers.Driver(debug=True)
+ d.setUp()
c, _ = d._exec(["bash", "-c",
"trap ':' TERM ; echo start; sleep 10000"],
wait_for_line="start")
|
tests: call setUp to init cleanups
|
py
|
diff --git a/meleeuploader/forms.py b/meleeuploader/forms.py
index <HASH>..<HASH> 100755
--- a/meleeuploader/forms.py
+++ b/meleeuploader/forms.py
@@ -107,7 +107,7 @@ class MeleeUploader(BaseWidget):
resp = self.question(f"Current Version: {consts.__version__}\nVersion {latest_version} is available. Would you like to update?", title="MeleeUploader")
if resp == "yes":
subprocess.call(('pip3', 'install', '-U', 'meleeuploader'))
- print("You can now restart the app to use the new version")
+ self.message("You can now restart the app to use the new version", title="MeleeUploader")
except Exception as e:
print(e)
|
show a message to the user about restarting the program after an update
|
py
|
diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py
index <HASH>..<HASH> 100644
--- a/tests/integration/__init__.py
+++ b/tests/integration/__init__.py
@@ -147,6 +147,14 @@ class ModuleCase(TestCase):
orig = self.client.cmd('minion', function, arg)
return orig['minion']
+
+ def run_state(self, function, **kwargs):
+ '''
+ Run the state.single command and return the state return structure
+ '''
+ return self.run_function('state.single', **kwargs)
+
+
def minion_opts(self):
'''
Return the options used for the minion
@@ -192,6 +200,7 @@ class SyndicCase(TestCase):
orig = self.client.cmd('minion', function, arg)
return orig['minion']
+
class ShellCase(TestCase):
'''
Execute a test for a shell command
|
Add run_state function to ModuleCase
|
py
|
diff --git a/test.py b/test.py
index <HASH>..<HASH> 100644
--- a/test.py
+++ b/test.py
@@ -1826,6 +1826,11 @@ time.sleep(3)
class MiscTests(unittest.TestCase):
+ # https://github.com/amoffat/sh/issues/121
+ def test_wraps(self):
+ from sh import ls
+ wraps(ls)(lambda f: True)
+
def test_signal_exception_aliases(self):
""" proves that signal exceptions with numbers and names are equivalent
"""
|
test for functools.wraps on a sh command
|
py
|
diff --git a/deis/settings.py b/deis/settings.py
index <HASH>..<HASH> 100644
--- a/deis/settings.py
+++ b/deis/settings.py
@@ -155,10 +155,6 @@ AUTHENTICATION_BACKENDS = (
)
ANONYMOUS_USER_ID = -1
-ACCOUNT_EMAIL_REQUIRED = True
-ACCOUNT_EMAIL_VERIFICATION = 'none'
-ACCOUNT_LOGOUT_ON_GET = True
-ACCOUNT_USERNAME_BLACKLIST = ['system']
LOGIN_URL = '/v1/auth/login/'
LOGIN_REDIRECT_URL = '/'
@@ -270,7 +266,6 @@ ETCD_HOST, ETCD_PORT = os.environ.get('ETCD', '127.0.0.1:4001').split(',')[0].sp
DEIS_LOG_DIR = os.path.abspath(os.path.join(__file__, '..', '..', 'logs'))
LOG_LINES = 1000
TEMPDIR = tempfile.mkdtemp(prefix='deis')
-DEFAULT_BUILD = 'deis/helloworld'
DEIS_DOMAIN = 'deisapp.local'
# standard datetime format used for logging, model timestamps, etc.
|
ref(controller): remove several unused settings The ACCOUNT_* settings were not removed when django-allauth was, and DEFAULT_BUILD is not referenced anywhere.
|
py
|
diff --git a/tests/unit/index_tests.py b/tests/unit/index_tests.py
index <HASH>..<HASH> 100644
--- a/tests/unit/index_tests.py
+++ b/tests/unit/index_tests.py
@@ -351,20 +351,15 @@ class IndexTests(UnitTestDbBase):
def test_index_usage_via_query(self):
"""
- Test that a query will fail if the indexes that exist do not satisfy the
+ Test that a query will warn if the indexes that exist do not satisfy the
query selector.
"""
index = Index(self.db, 'ddoc001', 'index001', fields=['name'])
index.create()
self.populate_db_with_documents(100)
- query = Query(self.db)
- with self.assertRaises(requests.HTTPError) as cm:
- resp = query(
- fields=['name', 'age'],
- selector={'age': {'$eq': 6}}
- )
- err = cm.exception
- self.assertEqual(err.response.status_code, 400)
+ result = self.db.get_query_result(fields=['name', 'age'],
+ selector={'age': {'$eq': 6}}, raw_result=True)
+ self.assertTrue(str(result['warning']).startswith("no matching index found"))
@unittest.skipUnless(
os.environ.get('RUN_CLOUDANT_TESTS') is not None,
|
Refactored test_index_usage_via_query Changed to assert that a warning is returned with the result rather than expecting an exception.
|
py
|
diff --git a/python/jsbeautifier/unpackers/packer.py b/python/jsbeautifier/unpackers/packer.py
index <HASH>..<HASH> 100644
--- a/python/jsbeautifier/unpackers/packer.py
+++ b/python/jsbeautifier/unpackers/packer.py
@@ -40,7 +40,7 @@ def detect(source):
endstr = ''
else:
endstr = source_end.split("')))", 1)[1]
- return (mystr != -1)
+ return (mystr != None)
def unpack(source):
|
Fix to make the unpacker pass the tests.
|
py
|
diff --git a/openquake/engine/engine.py b/openquake/engine/engine.py
index <HASH>..<HASH> 100644
--- a/openquake/engine/engine.py
+++ b/openquake/engine/engine.py
@@ -453,6 +453,12 @@ def expose_outputs(dstore, job):
:param job: an OqJob instance
"""
exportable = set(ekey[0] for ekey in export.export)
+
+ # small hack: remove the sescollection outputs from scenario
+ # calculators, as requested by Vitor
+ calcmode = job.get_param('calculation_mode')
+ if 'scenario' in calcmode and 'sescollection' in exportable:
+ exportable.remove('sescollection')
for key in dstore:
if key in exportable:
out = models.Output.objects.create_output(
|
Hiding the sescollection output of scenario calculators
|
py
|
diff --git a/pyfirmata/pyfirmata.py b/pyfirmata/pyfirmata.py
index <HASH>..<HASH> 100755
--- a/pyfirmata/pyfirmata.py
+++ b/pyfirmata/pyfirmata.py
@@ -268,7 +268,9 @@ class Board(object):
return False
try:
handler(*data)
- except ValueError:
+ except ValueError, TypeError:
+ # TypeError occurs when we pass to many arguments.
+ # ValueError may be thrown when the received data is not correct.
return True
return True
|
Catch TypeError on handlers as they might occur when something is screwed up with the data sent from the board
|
py
|
diff --git a/spyderlib/widgets/sourcecode/codeeditor.py b/spyderlib/widgets/sourcecode/codeeditor.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/sourcecode/codeeditor.py
+++ b/spyderlib/widgets/sourcecode/codeeditor.py
@@ -1992,6 +1992,7 @@ class CodeEditor(TextEditBaseWidget):
statement"""
reserved_words = ['def', 'for', 'if', 'while', 'try', 'with', \
'class', 'else', 'elif', 'except', 'finally']
+ end_chars = [':', '\\']
unmatched_brace = False
leading_text = self.get_text('sol', 'cursor').lstrip()
line_pos = self.toPlainText().index(leading_text)
@@ -2002,7 +2003,8 @@ class CodeEditor(TextEditBaseWidget):
unmatched_brace = True
if any([leading_text.startswith(w) for w in reserved_words]) and \
- not leading_text.endswith(':') and not unmatched_brace:
+ not any([leading_text.rstrip().endswith(c) for c in end_chars]) \
+ and not unmatched_brace:
return True
else:
return False
|
Editor: Don't insert colons after a line continuation character ('\')
|
py
|
diff --git a/src/mbed_cloud/subscribe/observer.py b/src/mbed_cloud/subscribe/observer.py
index <HASH>..<HASH> 100644
--- a/src/mbed_cloud/subscribe/observer.py
+++ b/src/mbed_cloud/subscribe/observer.py
@@ -1,5 +1,3 @@
-# coding=utf8
-
# --------------------------------------------------------------------------
# Mbed Cloud Python SDK
# (C) COPYRIGHT 2017 Arm Limited
@@ -31,7 +29,7 @@ class NoMoreNotifications(Exception):
class Observer(object):
- """An async stream generator (Future1, Future2, ... ∞)
+ """An async stream generator (Future1, Future2, ... FutureN)
This system should abstract async concepts to the end application
so that native async logic can be used if available -
|
py2/3 unicode literals don't work with linter
|
py
|
diff --git a/delphi/translators/for2py/syntax.py b/delphi/translators/for2py/syntax.py
index <HASH>..<HASH> 100644
--- a/delphi/translators/for2py/syntax.py
+++ b/delphi/translators/for2py/syntax.py
@@ -86,7 +86,7 @@ RE_ENDDO_STMT = re.compile(ENDDO_STMT, re.I)
ENDIF_STMT = r"\s*(\d+|&)?\s*end\s*if\s*"
RE_ENDIF_STMT = re.compile(ENDIF_STMT, re.I)
-GOTO_STMT = r"\s*(\d+|&)?\s*goto\s*"
+GOTO_STMT = r"\s*(\d+|&)?\s*go\s*to\s*"
RE_GOTO_STMT = re.compile(GOTO_STMT, re.I)
IF_STMT = r"\s*(\d+|&)?\s*(if|elseif|else)\s*"
|
bug fix to accept "GO TO" as well as "GOTO" (#<I>)
|
py
|
diff --git a/libsubmit/version.py b/libsubmit/version.py
index <HASH>..<HASH> 100644
--- a/libsubmit/version.py
+++ b/libsubmit/version.py
@@ -1,4 +1,4 @@
''' Set module version
<Major>.<Minor>.<maintenance>[-alpha/beta/..]
'''
-VERSION = '0.2.2'
+VERSION = '0.2.3'
|
Bumping minor version for cobalt fix
|
py
|
diff --git a/ipymd/markdown.py b/ipymd/markdown.py
index <HASH>..<HASH> 100644
--- a/ipymd/markdown.py
+++ b/ipymd/markdown.py
@@ -146,6 +146,13 @@ class BaseMarkdownWriter(object):
def append_code(self, input, output=None):
raise NotImplementedError("This method must be overriden.")
+ def write(self, cell):
+ if cell['cell_type'] == 'markdown':
+ self.append_markdown(cell['source'])
+ elif cell['cell_type'] == 'code':
+ self.append_code(cell['input'], cell['output'])
+ self._new_paragraph()
+
@property
def contents(self):
return self._output.getvalue().rstrip() + '\n' # end of file \n
@@ -294,10 +301,5 @@ def ipymd_cells_to_markdown(cells, writer=None):
if writer is None:
writer = MarkdownWriter()
for cell in cells:
- if cell['cell_type'] == 'markdown':
- writer.append_markdown(cell['source'])
- writer._new_paragraph()
- elif cell['cell_type'] == 'code':
- writer.append_code(cell['input'], cell['output'])
- writer._new_paragraph()
+ writer.write(cell)
return writer.contents
|
Added writer.write() method in markdown.
|
py
|
diff --git a/src/toil/cwl/cwltoil.py b/src/toil/cwl/cwltoil.py
index <HASH>..<HASH> 100755
--- a/src/toil/cwl/cwltoil.py
+++ b/src/toil/cwl/cwltoil.py
@@ -13,7 +13,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
from toil.job import Job
from toil.common import Toil
|
Update cwltoil.py Trying to trigger Jenkins with a commit.
|
py
|
diff --git a/Lib/fontbakery/specifications/cmap.py b/Lib/fontbakery/specifications/cmap.py
index <HASH>..<HASH> 100644
--- a/Lib/fontbakery/specifications/cmap.py
+++ b/Lib/fontbakery/specifications/cmap.py
@@ -74,11 +74,9 @@ def com_google_fonts_check_078(ttFont):
"glyph names.")
else:
failed = False
- for subtable in ttFont['cmap'].tables:
- for item in subtable.cmap.items():
- name = item[1]
- if len(name) > 109:
- failed = True
- yield FAIL, ("Glyph name is too long:" " '{}'").format(name)
+ for name in ttFont.getGlyphOrder():
+ if len(name) > 109:
+ failed = True
+ yield FAIL, ("Glyph name is too long:" " '{}'").format(name)
if not failed:
yield PASS, "No glyph names exceed max allowed length."
|
<I>: work on font.getGlyphOrder() instead Gets the names from post or CFF tables, so it works for TTFs and OTFs.
|
py
|
diff --git a/skitai/server/http_server.py b/skitai/server/http_server.py
index <HASH>..<HASH> 100644
--- a/skitai/server/http_server.py
+++ b/skitai/server/http_server.py
@@ -336,6 +336,7 @@ class http_server (asyncore.dispatcher):
pid = os.fork ()
if pid == 0:
self.worker_ident = "worker #%d" % len (PID)
+ self.log_info ("starting" % self.worker_ident)
PID = []
signal.signal(signal.SIGTERM, hTERMWORKER)
signal.signal(signal.SIGQUIT, hQUITWORKER)
|
handle KeyboardInterrupt on posix
|
py
|
diff --git a/jss/pretty_element.py b/jss/pretty_element.py
index <HASH>..<HASH> 100644
--- a/jss/pretty_element.py
+++ b/jss/pretty_element.py
@@ -50,7 +50,12 @@ class PrettyElement(ElementTree.Element):
def __getattr__(self, name):
if re.match(_DUNDER_PATTERN, name):
return super(PrettyElement, self).__getattr__(name)
- return self.find(name)
+ result = self.find(name)
+ if result is not None:
+ return result
+ else:
+ raise AttributeError(
+ 'There is no element with the tag "{}"'.format(name))
# TODO: This can be removed once `JSSObject.__init__` signature is fixed.
def makeelement(self, tag, attrib):
|
Getattr should raise AttributeError when nothing is found
|
py
|
diff --git a/openquake/hazardlib/calc/filters.py b/openquake/hazardlib/calc/filters.py
index <HASH>..<HASH> 100644
--- a/openquake/hazardlib/calc/filters.py
+++ b/openquake/hazardlib/calc/filters.py
@@ -188,7 +188,7 @@ class IntegrationDistance(collections.Mapping):
return repr(self.dic)
-def prefilter(srcs, srcfilter, param, monitor):
+def preprocess(srcs, srcfilter, param, monitor):
"""
:returns: a dict src_group_id -> sources
"""
@@ -312,12 +312,12 @@ class SourceFilter(object):
:returns: a dictionary src_group_id -> sources
"""
sources_by_grp = Starmap.apply(
- prefilter, (sources, self, param, monitor),
+ preprocess, (sources, self, param, monitor),
concurrent_tasks=param['concurrent_tasks'],
weight=operator.attrgetter('num_ruptures'),
key=operator.attrgetter('src_group_id'),
progress=logging.info if 'gsims_by_trt' in param else logging.debug
- # log the prefiltering phase in an event based calculation
+ # log the preprocessing phase in an event based calculation
).reduce()
# avoid task ordering issues
for sources in sources_by_grp.values():
|
Renamed prefilter->preprocess
|
py
|
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index <HASH>..<HASH> 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -108,6 +108,7 @@ class BotBase(GroupMixin):
self.description = inspect.cleandoc(description) if description else ''
self.owner_id = options.get('owner_id')
self.owner_ids = options.get('owner_ids', set())
+ self.strip_after_prefix = options.get('strip_after_prefix', False)
if self.owner_id and self.owner_ids:
raise TypeError('Both owner_id and owner_ids are set.')
@@ -911,6 +912,9 @@ class BotBase(GroupMixin):
# Getting here shouldn't happen
raise
+ if self.strip_after_prefix:
+ view.skip_ws()
+
invoker = view.get_word()
ctx.invoked_with = invoker
ctx.prefix = invoked_prefix
@@ -1041,6 +1045,12 @@ class Bot(BotBase, discord.Client):
for the collection. You cannot set both ``owner_id`` and ``owner_ids``.
.. versionadded:: 1.3
+ strip_after_prefix: :class:`bool`
+ Whether to strip whitespace characters after encountering the command
+ prefix. This allows for ``! hello`` and ``!hello`` to both work if
+ the ``command_prefix`` is set to ``!``. Defaults to ``False``.
+
+ .. versionadded:: 1.7
"""
pass
|
[commands] Add support for stripping whitespace after the prefix This is configured with the strip_after_prefix option in `Bot.__init__`
|
py
|
diff --git a/spacy/lang/en/__init__.py b/spacy/lang/en/__init__.py
index <HASH>..<HASH> 100644
--- a/spacy/lang/en/__init__.py
+++ b/spacy/lang/en/__init__.py
@@ -16,11 +16,13 @@ from ...language import Language
from ...attrs import LANG, NORM
from ...util import update_exc, add_lookups
+def _return_en(_):
+ return 'en'
class EnglishDefaults(Language.Defaults):
lex_attr_getters = dict(Language.Defaults.lex_attr_getters)
lex_attr_getters.update(LEX_ATTRS)
- lex_attr_getters[LANG] = lambda text: 'en'
+ lex_attr_getters[LANG] = _return_en
lex_attr_getters[NORM] = add_lookups(Language.Defaults.lex_attr_getters[NORM],
BASE_NORMS, NORM_EXCEPTIONS)
tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS)
|
Make lambda func a named function, for pickling
|
py
|
diff --git a/spyderlib/widgets/ipython.py b/spyderlib/widgets/ipython.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/ipython.py
+++ b/spyderlib/widgets/ipython.py
@@ -379,7 +379,8 @@ class IPythonClient(QWidget, SaveHistoryMixin):
while error.startswith('<br>'):
error = error[4:]
# Remove connection message
- if error.startswith('To connect another client'):
+ if error.startswith('To connect another client') or \
+ error.startswith('[IPKernelApp] To connect another client'):
error = error.split('<br>')
error = '<br>'.join(error[2:])
# Don't break lines in hyphens
|
IPython Console: Don't show connection lines in error message for <I>.x
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ def read_description():
setup(
name='Inject',
- version='3.5.3',
+ version='3.5.4.dev0',
url='https://github.com/ivankorobkov/python-inject',
license='Apache License 2.0',
|
Bumpted to <I>.dev0.
|
py
|
diff --git a/edisgo/flex_opt/curtailment.py b/edisgo/flex_opt/curtailment.py
index <HASH>..<HASH> 100644
--- a/edisgo/flex_opt/curtailment.py
+++ b/edisgo/flex_opt/curtailment.py
@@ -101,7 +101,8 @@ def curtail_voltage(feedin, total_curtailment_ts, edisgo_object, **kwargs):
feedin_factor = v_pu - voltage_threshold_lower
# make sure the difference is positive
# zero the curtailment of those generators below the voltage_threshold_lower
- feedin_factor = feedin_factor[feedin_factor >= 0].fillna(0)
+ # by replacing them by -1 and later adding
+ feedin_factor = feedin_factor[feedin_factor >= 0].fillna(-1)
# and add the difference to 1 (like a scaling factor to feedin)
feedin_factor = difference_scaling*feedin_factor + 1
|
Bug Fix, properly eliminating the generator curtailments by changing to -1 and later adding 1
|
py
|
diff --git a/salt/runners/jobs.py b/salt/runners/jobs.py
index <HASH>..<HASH> 100644
--- a/salt/runners/jobs.py
+++ b/salt/runners/jobs.py
@@ -133,15 +133,16 @@ def lookup_jid(jid,
targeted_minions = data.get('Minions', [])
returns = data.get('Result', {})
- for minion in returns:
- if display_progress:
- __jid_event__.fire_event({'message': minion}, 'progress')
- if u'return' in returns[minion]:
- if returned:
- ret[minion] = returns[minion].get(u'return')
- else:
- if returned:
- ret[minion] = returns[minion].get('return')
+ if returns:
+ for minion in returns:
+ if display_progress:
+ __jid_event__.fire_event({'message': minion}, 'progress')
+ if u'return' in returns[minion]:
+ if returned:
+ ret[minion] = returns[minion].get(u'return')
+ else:
+ if returned:
+ ret[minion] = returns[minion].get('return')
if missing:
for minion_id in (x for x in targeted_minions if x not in returns):
ret[minion_id] = 'Minion did not return'
|
One more case where returner doesn't respond
|
py
|
diff --git a/c7n/resources/asg.py b/c7n/resources/asg.py
index <HASH>..<HASH> 100644
--- a/c7n/resources/asg.py
+++ b/c7n/resources/asg.py
@@ -1403,7 +1403,7 @@ class MarkForOp(Tag):
schema = type_schema(
'mark-for-op',
- op={'enum': ['suspend', 'resume', 'delete']},
+ op={'type': 'string'},
key={'type': 'string'},
tag={'type': 'string'},
message={'type': 'string'},
@@ -1419,6 +1419,10 @@ class MarkForOp(Tag):
if not self.tz:
raise PolicyValidationError(
"Invalid timezone specified %s on %s" % (self.tz, self.manager.data))
+ op = self.data.get('op')
+ if op not in self.manager.action_registry:
+ raise PolicyValidationError(
+ "Invalid op %s for asg on policy %s" % (op, self.manager.data))
return self
def process(self, asgs):
|
aws.asg - mark-for-op support all asg actions (#<I>)
|
py
|
diff --git a/src/yamlinclude/readers.py b/src/yamlinclude/readers.py
index <HASH>..<HASH> 100644
--- a/src/yamlinclude/readers.py
+++ b/src/yamlinclude/readers.py
@@ -16,7 +16,7 @@ except ImportError:
toml = None
__all__ = ['READER_TABLE', 'get_reader_class_by_path', 'get_reader_class_by_name',
- 'Reader', 'IniReader', 'JsonReader', 'TomlReader', 'YamlReader']
+ 'Reader', 'IniReader', 'JsonReader', 'TomlReader', 'YamlReader', 'PlainTextReader']
class Reader:
|
Add PlainTextReader to __all__ (cherry picked from commit <I>f<I>eb<I>f<I>d6a0e<I>cbf<I>ee<I>)
|
py
|
diff --git a/cheroot/test/test_core.py b/cheroot/test/test_core.py
index <HASH>..<HASH> 100644
--- a/cheroot/test/test_core.py
+++ b/cheroot/test/test_core.py
@@ -128,10 +128,22 @@ class HTTPTests(helper.CherootWebCase):
assert response.fp.read(21) == b'Malformed Request-URI'
c.close()
- for uri in ['hello',
- urllib.parse.quote('привіт')]:
- self.getPage(uri)
- self.assertStatus(HTTP_BAD_REQUEST)
+ def _test_parse_no_leading_slash_invalid(self, uri):
+ """
+ URIs with no leading slash produce a 400
+ """
+ self.getPage(urllib.parse.quote(uri))
+ self.assertStatus(HTTP_BAD_REQUEST)
+ assert b"starting with a slash" in self.body
+
+ # TODO: the following two tests could be implemented as a
+ # parametrized fixture on one test if only this test suite
+ # weren't based on unittest.
+ def test_parse_no_leading_slash_invalid_ascii(self):
+ self._test_parse_no_leading_slash_invalid('hello')
+
+ def test_parse_no_leading_slash_invalid_non_ascii(self):
+ self._test_parse_no_leading_slash_invalid('привіт')
def test_parse_uri_absolute_uri(self):
self.getPage('http://google.com/')
|
Extract leading slash checks into separate tests
|
py
|
diff --git a/source/awesome_tool/statemachine/data_port.py b/source/awesome_tool/statemachine/data_port.py
index <HASH>..<HASH> 100644
--- a/source/awesome_tool/statemachine/data_port.py
+++ b/source/awesome_tool/statemachine/data_port.py
@@ -227,7 +227,7 @@ class DataPort(Observable, yaml.YAMLObject):
elif data_type == "float":
converted_value = float(string_value)
elif data_type == "bool":
- converted_value = bool(string_value)
+ converted_value = bool(ast.literal_eval(string_value))
elif data_type in ("list", "dict", "tuple"):
converted_value = ast.literal_eval(string_value)
if type(converted_value).__name__ != data_type:
|
Fix parsing of boolean default value - when parsing a boolean default value, first ast.literal_eval is applied - after this, boil is called with the result - this fixes the issue that any default value inserted was converted into True
|
py
|
diff --git a/django_jenkins/tasks/run_sloccount.py b/django_jenkins/tasks/run_sloccount.py
index <HASH>..<HASH> 100644
--- a/django_jenkins/tasks/run_sloccount.py
+++ b/django_jenkins/tasks/run_sloccount.py
@@ -15,8 +15,7 @@ class Task(BaseTask):
def __init__(self, test_labels, options):
super(Task, self).__init__(test_labels, options)
-
- self.locations = get_apps_locations(self.test_labels, options['test_all'])
+ self.test_all = options['test_all']
self.with_migrations = options['sloccount_with_migrations']
if options.get('sloccount_file_output', True):
@@ -29,8 +28,11 @@ class Task(BaseTask):
def teardown_test_environment(self, **kwargs):
+ locations = get_apps_locations(self.test_labels, self.test_all)
+
report_output = check_output(
- ['sloccount', "--duplicates", "--wide", "--details"] + self.locations)
+ ['sloccount', "--duplicates", "--wide", "--details"] + locations)
+
if self.with_migrations:
self.output.write(report_output)
else:
|
Fix fake coverage by sloccount task. Close #<I>
|
py
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ CLASSIFIERS = [
setup(
name='django-mail-templated',
- version='0.2.1',
+ version='0.2.2',
packages=['mail_templated'],
author='Artem Rizhov',
author_email='artem.rizhov@gmail.com',
|
Changed version to <I>
|
py
|
diff --git a/pyAudioAnalysis/ShortTermFeatures.py b/pyAudioAnalysis/ShortTermFeatures.py
index <HASH>..<HASH> 100644
--- a/pyAudioAnalysis/ShortTermFeatures.py
+++ b/pyAudioAnalysis/ShortTermFeatures.py
@@ -556,7 +556,7 @@ def feature_extraction(signal, sampling_rate, window, step, deltas=True):
RETURNS
features (numpy.ndarray): contains features
(n_feats x numOfShortTermWindows)
- feature_names (numpy.ndarray): contains feature names
+ feature_names (python list): contains feature names
(n_feats x numOfShortTermWindows)
"""
|
Fixed return description for feature_extraction()
|
py
|
diff --git a/pywal/export.py b/pywal/export.py
index <HASH>..<HASH> 100644
--- a/pywal/export.py
+++ b/pywal/export.py
@@ -47,6 +47,7 @@ def get_export_type(export_type):
"tty": "colors-tty.sh",
"xresources": "colors.Xresources",
"yaml": "colors.yml",
+ "xmonad": "colors.hs",
}.get(export_type, export_type)
|
I added the xmonad export_type.
|
py
|
diff --git a/tests/test_rectangular_selection.py b/tests/test_rectangular_selection.py
index <HASH>..<HASH> 100755
--- a/tests/test_rectangular_selection.py
+++ b/tests/test_rectangular_selection.py
@@ -10,6 +10,7 @@ import base
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
+from PyQt5.QtGui import QKeySequence
from qutepart import Qutepart
@@ -242,7 +243,7 @@ class Test(unittest.TestCase):
warning[0] = text
self.qpart.userWarning.connect(_saveWarning)
- QTest.keyClick(self.qpart, Qt.Key_End, Qt.AltModifier | Qt.ShiftModifier | Qt.ControlModifier)
+ base.keySequenceClicks(self.qpart, QKeySequence.SelectEndOfDocument, Qt.AltModifier)
self.assertEqual(warning[0], 'Rectangular selection area is too big')
|
Fix: Use platform-independent keystrokes in tests. This makes Mac tests pass.
|
py
|
diff --git a/pymatgen/io/shengbte.py b/pymatgen/io/shengbte.py
index <HASH>..<HASH> 100644
--- a/pymatgen/io/shengbte.py
+++ b/pymatgen/io/shengbte.py
@@ -82,8 +82,8 @@ class Control(dict, MSONable):
self["t"] = t
self.update(kwargs)
- @staticmethod
- def from_file(filepath):
+ @classmethod
+ def from_file(cls, filepath):
"""
Read a CONTROL namelist file and output a 'Control' object
@@ -102,7 +102,7 @@ class Control(dict, MSONable):
all_dict.update(sdict["parameters"])
all_dict.update(sdict["flags"])
- return Control(**all_dict)
+ return cls.from_dict(all_dict)
@classmethod
def from_dict(cls, sdict):
|
Fixed 'from_file()' to be a class method
|
py
|
diff --git a/test/logging_test.py b/test/logging_test.py
index <HASH>..<HASH> 100644
--- a/test/logging_test.py
+++ b/test/logging_test.py
@@ -228,6 +228,9 @@ REQUEST_NEW_CONNECTION = TEST_CONFIG.get_option('TEST', 'request_new_connection'
REQUEST_POST_ENDPOINT = TEST_CONFIG.get_option('TEST', 'request_POST_endpoint', None)
def test_discord_logger(config=TEST_CONFIG):
"""Execute LogCapture on Discord logger object"""
+ if not WEBHOOK: #FIXME: commenting doesn't work in config file?
+ pytest.skip('discord_webhook is blank')
+
test_logname = 'discord_logger'
log_builder = prosper_logging.ProsperLogger(
test_logname,
@@ -240,7 +243,7 @@ def test_discord_logger(config=TEST_CONFIG):
log_capture = helper_log_messages(test_logger)
discord_helper = prosper_logging.DiscordWebhook()
- discord_helper.webhook(WEBHOOK)
+ discord_helper.webhook(WEBHOOK) #TODO: add blank-webhook test
request_POST_endpoint = REQUEST_POST_ENDPOINT.\
format(
|
adding nowebhook skip to discord_logger test
|
py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.