diff
stringlengths
139
3.65k
message
stringlengths
8
627
diff_languages
stringclasses
1 value
diff --git a/netmiko/base_connection.py b/netmiko/base_connection.py index <HASH>..<HASH> 100644 --- a/netmiko/base_connection.py +++ b/netmiko/base_connection.py @@ -381,7 +381,7 @@ class BaseConnection(object): delay_factor = self.select_delay_factor(delay_factor=0) main_delay = delay_factor * .1 time.sleep(main_delay) - while i <= 20: + while i <= 60: new_data = self._read_channel() if new_data: break @@ -391,7 +391,7 @@ class BaseConnection(object): if main_delay >= 8: main_delay = 8 time.sleep(main_delay) - i += 1 + i += main_delay # check if data was ever present if new_data: return ""
Set maximum amount of retry time to <I> seconds for attempting read_channel() in establish_connection()
py
diff --git a/meshcut.py b/meshcut.py index <HASH>..<HASH> 100644 --- a/meshcut.py +++ b/meshcut.py @@ -322,7 +322,6 @@ def merge_close_vertices(verts, faces, close_epsilon=1e-5): # Compute a mapping from old to new : for each input vert, store the index # of the new vert it will be merged into - close_epsilon = 1e-5 old2new = np.zeros(D.shape[0], dtype=np.int) # A mask indicating if a vertex has already been merged into another merged_verts = np.zeros(D.shape[0], dtype=np.bool)
Removed redefined close_epsilon
py
diff --git a/tests/test_misc.py b/tests/test_misc.py index <HASH>..<HASH> 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -63,6 +63,33 @@ def test_maxcall(): sampler.run_nested(dlogz_init=1, maxcall=1000, print_progress=printing) +def test_n_effective_deprecation(): + # test deprecation of n_effective and n_effective_init + ndim = 2 + rstate = get_rstate() + + sampler = dynesty.NestedSampler(loglike, + prior_transform, + ndim, + nlive=nlive, + rstate=rstate) + with pytest.deprecated_call(): + sampler.run_nested(dlogz=1, maxcall=10, n_effective=10) + + sampler = dynesty.DynamicNestedSampler(loglike, + prior_transform, + ndim, + nlive=nlive, + rstate=rstate) + + sample_generator = sampler.sample_initial(n_effective=10) + with pytest.deprecated_call(): + next(sample_generator) + + with pytest.deprecated_call(): + sampler.run_nested(dlogz_init=1, maxcall=10, n_effective_init=10) + + @pytest.mark.parametrize('dynamic,with_pool', itertools.product([True, False], [True, False])) def test_pickle(dynamic, with_pool):
add test for deprecation of n_effective and n_effective_init
py
diff --git a/facepy/graph_api.py b/facepy/graph_api.py index <HASH>..<HASH> 100755 --- a/facepy/graph_api.py +++ b/facepy/graph_api.py @@ -296,7 +296,7 @@ class GraphAPI(object): class HTTPError(FacepyError): """Exception for transport errors.""" -# Define the nested Exception in the module scope so they can be pickled +# Define the GraphAPI nested exception classes in the module scope so they can be found by cPickle (used by celery) FacebookError = GraphAPI.FacebookError OAuthError = GraphAPI.OAuthError -HTTPError = GraphAPI.HTTPError \ No newline at end of file +HTTPError = GraphAPI.HTTPError
Changed the comment and added a newline to the end of the file.
py
diff --git a/cumulusci/robotframework/locators_50.py b/cumulusci/robotframework/locators_50.py index <HASH>..<HASH> 100644 --- a/cumulusci/robotframework/locators_50.py +++ b/cumulusci/robotframework/locators_50.py @@ -3,6 +3,12 @@ import copy lex_locators = copy.deepcopy(locators_49.lex_locators) +lex_locators["actions"] = ( + "//runtime_platform_actions-actions-ribbon//ul" + "|" + "//ul[contains(concat(' ',normalize-space(@class),' '),' oneActionsRibbon ')]" +) + lex_locators["object"][ "button" ] = "//div[contains(@class, 'slds-page-header')]//*[self::a[@title='{title}'] or self::button[@name='{title}']]"
Some pages apparently use different markup for action ribbon in Winter '<I> If a page uses the new style, `Go to record home` and a couple others would raise an exception because it was waiting for the old markup.
py
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,12 +11,13 @@ # # All configuration values have a default; values that are commented out # serve to show the default. - +import datetime import sys import os _ROOT = os.path.join(os.path.dirname(os.path.dirname(__file__)), "src") sys.path.insert(0, _ROOT) +__version__ = '?' execfile(os.path.join(_ROOT, "fileseq/__version__.py")) # If extensions (or modules to document with autodoc) are in another directory, @@ -52,7 +53,7 @@ master_doc = 'index' # General information about the project. project = u'Fileseq' -copyright = u'2015, Matthew Chambers' +copyright = u'2015-%d, Matthew Chambers' % datetime.datetime.now().year # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -109,7 +110,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = 'nature' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the
Update doc conf date range and theme (refs #<I>)
py
diff --git a/src/hamster/edit_activity.py b/src/hamster/edit_activity.py index <HASH>..<HASH> 100644 --- a/src/hamster/edit_activity.py +++ b/src/hamster/edit_activity.py @@ -158,7 +158,10 @@ class CustomFactController(gobject.GObject): self.get_widget("save_button").set_sensitive(looks_good) def validate_fields(self): - """Check entry and description validity. + """Check fields information. + + Update gui status about entry and description validity. + Try to merge date, activity and description informations. Return the consolidated fact if successful, or None. """
doc: more details in validate_fields
py
diff --git a/zappa/cli.py b/zappa/cli.py index <HASH>..<HASH> 100644 --- a/zappa/cli.py +++ b/zappa/cli.py @@ -53,7 +53,6 @@ CUSTOM_SETTINGS = [ 'delete_local_zip', 'delete_s3_zip', 'exclude', - 'http_methods', 'role_name', 'touch', ]
rm HTTP_METHODS
py
diff --git a/spinoff/util/async.py b/spinoff/util/async.py index <HASH>..<HASH> 100644 --- a/spinoff/util/async.py +++ b/spinoff/util/async.py @@ -4,7 +4,7 @@ import traceback import sys from twisted.python.failure import Failure -from twisted.internet.defer import inlineCallbacks, Deferred, CancelledError, DeferredList +from twisted.internet.defer import inlineCallbacks, Deferred, CancelledError, DeferredList, maybeDeferred from twisted.internet import reactor, task @@ -256,3 +256,17 @@ class EventBuffer(object): _kwargs.update(self._kwargs) _kwargs.update(kwargs) self._fn(*_args, **_kwargs) + + +def deferred_with(cm, f, *args, **kwargs): + cm.__enter__() + + def on_failure(f): + should_suppress = cm.__exit__(f.type, f.value, f.getTracebackObject()) + return None if should_suppress else f + + return ( + maybeDeferred(f, *args, **kwargs) + .addCallback(lambda result: (cm.__exit__(None, None, None), result)[-1]) + .addErrback(on_failure) + )
Added deferred_with for using context managers with deferred-based code
py
diff --git a/ovp_core/emails.py b/ovp_core/emails.py index <HASH>..<HASH> 100644 --- a/ovp_core/emails.py +++ b/ovp_core/emails.py @@ -20,7 +20,7 @@ class BaseMail: """ This class is responsible for firing emails """ - from_email = '' + from_email = get_settings().get('DEFAULT_FROM_EMAIL', '') def __init__(self, email_address, async_mail=None, locale=None): self.email_address = email_address
Fix from_email on basemail
py
diff --git a/src/python/dxpy/utils/describe.py b/src/python/dxpy/utils/describe.py index <HASH>..<HASH> 100644 --- a/src/python/dxpy/utils/describe.py +++ b/src/python/dxpy/utils/describe.py @@ -612,7 +612,10 @@ def print_execution_desc(desc): if "rootExecution" in desc: print_field("Root execution", desc["rootExecution"]) if "originJob" in desc: - print_field("Origin job", desc["originJob"]) + if desc["originJob"] is None: + print_field("Origin job", "-") + else: + print_field("Origin job", desc["originJob"]) if desc["parentJob"] is None: print_field("Parent job", "-") else:
Analyses now show originJob (which is, possibly, null).
py
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -21,8 +21,10 @@ import sys # See: http://hg.python.org/cpython/rev/e12efebc3ba6/ # TODO: MOVE THIS ELSEWHERE! # TODO: Make this Python2.6 specific. -old_chflags = os.chflags +old_chflags = getattr(os, "chflags", None) def patch_chflags(*args, **kwargs): + if not old_chflags: + return try: return old_chflags(*args, **kwargs) except OSError, why:
Some machines don't have chflags...
py
diff --git a/buildbot/process/buildstep.py b/buildbot/process/buildstep.py index <HASH>..<HASH> 100644 --- a/buildbot/process/buildstep.py +++ b/buildbot/process/buildstep.py @@ -1012,7 +1012,17 @@ class LoggingBuildStep(BuildStep): all output being put into our self.stdio_log LogFile """ log.msg("ShellCommand.startCommand(cmd=%s)" % (cmd,)) - log.msg(" cmd.args = %r" % (cmd.args)) + args = cmd.args + if "patch" in cmd.args: + # Don't print the patch in the logs, it's often too large and not + # useful. + args = cmd.args.copy() + # This is usually a tuple so convert it to a list to be able to modify + # it. + patch = list(args['patch'][:]) + patch[1] = "(%s bytes)" % len(patch[1]) + args['patch'] = patch + log.msg(" cmd.args = %r" % (args)) self.cmd = cmd # so we can interrupt it self.step_status.setText(self.describe(False))
Reduce verbosity in twistd.log on the try server. Remove the patch from the 'patch' argument when logging. from <URL>
py
diff --git a/tests/jobs.py b/tests/jobs.py index <HASH>..<HASH> 100644 --- a/tests/jobs.py +++ b/tests/jobs.py @@ -26,7 +26,7 @@ import six import sys from tempfile import mkdtemp -from airflow import AirflowException, settings +from airflow import AirflowException, settings, models from airflow.bin import cli from airflow.jobs import BackfillJob, SchedulerJob from airflow.models import DAG, DagModel, DagBag, DagRun, Pool, TaskInstance as TI
[AIRFLOW-<I>] Restore import to fix broken tests The global `models` object is used in the code and was inadvertently removed. This PR restores it Closes #<I> from jlowin/fix-broken-tests
py
diff --git a/RL/operator/functional.py b/RL/operator/functional.py index <HASH>..<HASH> 100644 --- a/RL/operator/functional.py +++ b/RL/operator/functional.py @@ -111,29 +111,6 @@ class Functional(with_metaclass(ABCMeta, object)): str(self.domain) + '->' + str(self.range)) -class FunctionalComposition(Functional): - """Expression type for the composition of functionals - """ - - def __init__(self, left, right): - if right.range != left.domain: - raise TypeError("Range and domain of functionals do not fit") - - self.left = left - self.right = right - - def applyImpl(self, rhs): - return self.left.applyImpl(self.right.applyImpl(rhs)) - - @property - def domain(self): - return self.right.domain - - @property - def range(self): - return self.left.range - - class FunctionalSum(Functional): """Expression type for the sum of functionals """
Removed FunctionalComposition (closes issue #2)
py
diff --git a/replace_doc_link.py b/replace_doc_link.py index <HASH>..<HASH> 100755 --- a/replace_doc_link.py +++ b/replace_doc_link.py @@ -30,7 +30,7 @@ if __name__ == '__main__': if filename in filename_dict: ans.append(line[pos:m.start()]) ans.append('[' + title + ']') - ans.append('(' + filename_dict[filename] + ')') + ans.append('( {{ site.url }}/' + filename_dict[filename] + ')') pos = m.end() ans.append(line[pos:]) print ''.join(ans)
replace doc link script should use site.url site.url is the variable defined in vitess.io/_config.yml which specifies the site url. The replace_doc_link should put the abs link (by concatenating site.url) instead of writing relative link. Relative link causes problem for some link, e.g. GettingStarted link in page youtube.github.io/vitess/doc/TestingOnARamDisk
py
diff --git a/server.py b/server.py index <HASH>..<HASH> 100644 --- a/server.py +++ b/server.py @@ -79,7 +79,6 @@ class OpenIDServer(object): enc_dh_server_public = to_b64(long2a(dh_server_public)) dh_shared = pow(dh_cons_pub, dh_server_private, dh_modulus) - enc_mac_key = to_b64(strxor(secret, sha1(long2a(dh_shared)))) reply.update({ @@ -146,7 +145,8 @@ class OpenIDServer(object): secret, assoc_handle = self.get_server_secret() try: - issued, expires = self.get_auth_range(req.identity, trust_root) + issued, expires = self.get_auth_range( + req, req.identity, trust_root) except TypeError: raise AuthenticationError
[project @ now passing req to get_auth_range in checkid]
py
diff --git a/spyder/utils/dochelpers.py b/spyder/utils/dochelpers.py index <HASH>..<HASH> 100644 --- a/spyder/utils/dochelpers.py +++ b/spyder/utils/dochelpers.py @@ -306,7 +306,7 @@ def isdefined(obj, force_import=False, namespace=None): if base not in globals(): globals()[base] = module namespace[base] = module - except (ImportError, NameError, SyntaxError, SystemExit): + except Exception: return False else: return False
Catch any error in the isdefined method of dochelpers.
py
diff --git a/discord/asset.py b/discord/asset.py index <HASH>..<HASH> 100644 --- a/discord/asset.py +++ b/discord/asset.py @@ -96,10 +96,12 @@ class Asset: return cls(state, url.format(id, hash, format, size, key=key)) def __str__(self): - return self._url + return self._url if self._url is not None else '' def __len__(self): - return len(self._url) + if self._url: + return len(self._url) + return 0 def __bool__(self): return self._url is not None
Fix various bugs with Asset._url None handling.
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ from setuptools import setup from distutils.core import Extension from sys import exit as sys_exit +import versioneer try: from Cython.Distutils import build_ext @@ -32,14 +33,17 @@ ext_dtram = Extension( include_dirs=[get_include()], extra_compile_args=["-O3"]) +cmd_class = versioneer.get_cmdclass() +cmd_class.update({'build_ext': build_ext}) + setup( - cmdclass={'build_ext': build_ext}, + cmdclass=cmd_class, ext_modules=[ ext_lse, ext_wham, ext_dtram], name='thermotools', - version='0.0.0', + version=versioneer.get_version(), description='Lowlevel implementation of free energy estimators', long_description='Lowlevel implementation of free energy estimators', classifiers=[
amending setup.py for versioneer
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -59,21 +59,6 @@ if sys.platform == 'darwin': IncludeDirs = ['/sw/include'] LibraryDirs = ['/sw/lib'] -# Use the SSL_LIB and SSL_INC environment variables to extend -# the library and header directories we pass to the extensions. -ssl_lib = os.environ.get('SSL_LIB', []) -if ssl_lib: - if LibraryDirs: - LibraryDirs += [ssl_lib] - else: - LibraryDirs = [ssl_lib] -ssl_inc = os.environ.get('SSL_INC', []) -if ssl_inc: - if IncludeDirs: - IncludeDirs += [ssl_inc] - else: - IncludeDirs = [ssl_inc] - # On Windows, make sure the necessary .dll's get added to the egg. data_files = [] if sys.platform == 'win32':
Delete some more stuff that I do not think is necessary
py
diff --git a/tests/test_using.py b/tests/test_using.py index <HASH>..<HASH> 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -249,6 +249,16 @@ class UsingFactoryTestCase(unittest.TestCase): test_object = TestObjectFactory.build() self.assertEqual(test_object.one, 'one') + def test_inheritance(self): + @factory.use_strategy(factory.BUILD_STRATEGY) + class TestObjectFactory(factory.Factory, TestObject): + FACTORY_FOR = TestObject + + one = 'one' + + test_object = TestObjectFactory() + self.assertEqual(test_object.one, 'one') + def test_abstract(self): class SomeAbstractFactory(factory.Factory): FACTORY_ABSTRACT = True
Add test for dual class/factory inheritance. If it works properly, this would make pylint happy.
py
diff --git a/nipap-cli/nipap_cli/nipap_cli.py b/nipap-cli/nipap_cli/nipap_cli.py index <HASH>..<HASH> 100755 --- a/nipap-cli/nipap_cli/nipap_cli.py +++ b/nipap-cli/nipap_cli/nipap_cli.py @@ -423,6 +423,8 @@ def add_prefix(arg, opts): if parent.type == 'assignment': if p.type is None: print >> sys.stderr, "WARNING: Parent prefix is of type 'assignment'. Automatically setting type 'host' for new prefix." + elif p.type == 'host': + pass else: print >> sys.stderr, "WARNING: Parent prefix is of type 'assignment'. Automatically overriding specified type '%s' with type 'host' for new prefix." % p.type p.type = 'host'
Don't override if type is correct Fixes #<I>.
py
diff --git a/instant/producers.py b/instant/producers.py index <HASH>..<HASH> 100644 --- a/instant/producers.py +++ b/instant/producers.py @@ -29,7 +29,7 @@ def broadcast_py(message, event_class="default", data={}, channel=None, site=SIT payload = {"message": message, "channel":channel, 'event_class':event_class, "data":data , "site":site} client.publish(channel, payload) if event_class.lower() == "debug": - print "[DEBUG] "+str(json.dumps(payload)) + print ("[DEBUG] ", str(json.dumps(payload))) return True, channel def broadcast_go(message, event_class="default", data={}, channel=None, site=SITE_NAME, message_label=None, target=None): @@ -41,7 +41,7 @@ def broadcast_go(message, event_class="default", data={}, channel=None, site=SIT gocmd=pth+'/go/cent_broadcast '+params os.system(gocmd) if event_class.lower() == "debug": - print "[DEBUG] "+str(json.dumps(data)) + print ("[DEBUG] ", message, str(json.dumps(data))) return if BROADCAST_WITH == "go":
Corrected issue #1: python 3 print compatibility
py
diff --git a/openpnm/io/iMorph.py b/openpnm/io/iMorph.py index <HASH>..<HASH> 100644 --- a/openpnm/io/iMorph.py +++ b/openpnm/io/iMorph.py @@ -1,7 +1,7 @@ import os as os import numpy as np import scipy as sp -from scipy.sparse import lil_matrix +import scipy.sparse from pathlib import Path from openpnm.utils import logging from openpnm.io import GenericIO
changed import sparse [ci skip] so that it doesn't give warning of unsused attribute
py
diff --git a/tests/test_main.py b/tests/test_main.py index <HASH>..<HASH> 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -363,7 +363,8 @@ def test_input_file_not_a_pdf(caplog, no_outpdf): input_file = __file__ # Try to OCR this file result = run_ocrmypdf_api(input_file, no_outpdf) assert result == ExitCode.input_file - assert input_file in caplog.text + if os.name != 'nt': # name will be mangled with \\'s on nt + assert input_file in caplog.text def test_encrypted(resources, caplog, no_outpdf):
Don't expect filenames to be replicated on NT
py
diff --git a/telegram_send.py b/telegram_send.py index <HASH>..<HASH> 100644 --- a/telegram_send.py +++ b/telegram_send.py @@ -103,7 +103,7 @@ def main(): if args.pre: message = pre(message) for c in conf: - send(messages=[message], conf=conf, parse_mode=args.parse_mode, silent=args.silent, disable_web_page_preview=args.disable_web_page_preview) + send(messages=[message], conf=c, parse_mode=args.parse_mode, silent=args.silent, disable_web_page_preview=args.disable_web_page_preview) try: if args.pre:
Fixed bug sending message from stdin (#<I>)
py
diff --git a/localshop/apps/packages/forms.py b/localshop/apps/packages/forms.py index <HASH>..<HASH> 100644 --- a/localshop/apps/packages/forms.py +++ b/localshop/apps/packages/forms.py @@ -27,7 +27,7 @@ class ReleaseFileForm(forms.ModelForm): def save(self, commit=True): obj = super(ReleaseFileForm, self).save(False) - obj.python_version = self.cleaned_data['pyversion'] or 'n/a' + obj.python_version = self.cleaned_data['pyversion'] or 'source' if commit: obj.save() return obj
Fixed bug in file upload handling introduced in <I>fd<I>ac<I>d<I>c7f<I>a<I>acc<I>ef.
py
diff --git a/cliff/app.py b/cliff/app.py index <HASH>..<HASH> 100644 --- a/cliff/app.py +++ b/cliff/app.py @@ -17,7 +17,7 @@ class App(object): NAME = os.path.splitext(os.path.basename(sys.argv[0]))[0] CONSOLE_MESSAGE_FORMAT = '%(message)s' - LOG_FILE_MESSAGE_FORMAT = '%(asctime)s %(levelname)s %(name)s %(message)s' + LOG_FILE_MESSAGE_FORMAT = '[%(asctime)s] %(levelname)-8s %(name)s %(message)s' DEFAULT_VERBOSE_LEVEL = 1 def __init__(self, description, version, command_manager): @@ -89,7 +89,7 @@ class App(object): file_handler.setFormatter(formatter) root_logger.addHandler(file_handler) - # Send higher-level messages to the console, too + # Send higher-level messages to the console via stderr console = logging.StreamHandler() console_level = {0: logging.WARNING, 1: logging.INFO,
make the log messages slightly easier to parse
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from distutils.core import setup description = "A wrapper around Kenneth Reitz' tablib to work with Django models." -VERSION = '1.1.1' +VERSION = '1.2' setup( name='django-tablib',
upped version number to <I>
py
diff --git a/visidata/sheets.py b/visidata/sheets.py index <HASH>..<HASH> 100644 --- a/visidata/sheets.py +++ b/visidata/sheets.py @@ -400,8 +400,8 @@ class TableSheet(BaseSheet): @property def statusLine(self): 'String of row and column stats.' - rowinfo = 'row %d/%d (%d selected)' % (self.cursorRowIndex, self.nRows, self.nSelected) - colinfo = 'col %d/%d (%d visible)' % (self.cursorColIndex, self.nCols, len(self.visibleCols)) + rowinfo = 'row %d (%d selected)' % (self.cursorRowIndex, self.nSelected) + colinfo = 'col %d (%d visible)' % (self.cursorColIndex, len(self.visibleCols)) return '%s %s' % (rowinfo, colinfo) @property
[show-cursor] remove nRows and nCols, total row count and total column count confusing with 0-indexing
py
diff --git a/src/sos/_version.py b/src/sos/_version.py index <HASH>..<HASH> 100644 --- a/src/sos/_version.py +++ b/src/sos/_version.py @@ -33,7 +33,7 @@ if _py_ver.major == 2 or (_py_ver.major == 3 and (_py_ver.minor, _py_ver.micro) # version of the SoS language __sos_version__ = '1.0' # version of the sos command -__version__ = '0.9.9.1' +__version__ = '0.9.9.2' __py_version__ = '{}.{}.{}'.format(_py_ver.major, _py_ver.minor, _py_ver.micro) #
Release sos <I> as a workflow engine alone
py
diff --git a/dingo/core/__init__.py b/dingo/core/__init__.py index <HASH>..<HASH> 100644 --- a/dingo/core/__init__.py +++ b/dingo/core/__init__.py @@ -692,6 +692,16 @@ class NetworkDingo: for grid_district in self.mv_grid_districts(): grid_district.mv_grid.routing(debug, anim) + def connect_generators(self, debug=False): + """ Connects MV generators (graph nodes) to grid (graph) for every MV grid district + + Args: + debug: If True, information is printed during process + """ + + for grid_district in self.mv_grid_districts(): + grid_district.mv_grid.connect_generators(debug) + def mv_parametrize_grid(self, debug=False): """ Performs Parametrization of grid equipment of all MV grids, see method `parametrize_grid()` in class `MVGridDingo` for details.
add call method for connecting generators to NetworkDingo class
py
diff --git a/torchtext/datasets/translation.py b/torchtext/datasets/translation.py index <HASH>..<HASH> 100644 --- a/torchtext/datasets/translation.py +++ b/torchtext/datasets/translation.py @@ -31,7 +31,8 @@ class TranslationDataset(data.Dataset): src_path, trg_path = tuple(os.path.expanduser(path + x) for x in exts) examples = [] - with open(src_path) as src_file, open(trg_path) as trg_file: + with io.open(src_path, mode='r', encoding='utf-8') as src_file, \ + io.open(trg_path, mode='w', encoding='utf-8') as trg_file: for src_line, trg_line in zip(src_file, trg_file): src_line, trg_line = src_line.strip(), trg_line.strip() if src_line != '' and trg_line != '':
Swap open with io open in translation dataset (#<I>) * swap open with io open in translation dataset
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.\ setup( name="python-mpd", - version="0.2.0", + version="0.2.1", description="Python MPD client library", long_description=DESCRIPTION, author="J. Alexander Treuman",
setup.py: incrementing version number to <I>
py
diff --git a/pydle/features/rfc1459/client.py b/pydle/features/rfc1459/client.py index <HASH>..<HASH> 100644 --- a/pydle/features/rfc1459/client.py +++ b/pydle/features/rfc1459/client.py @@ -320,8 +320,8 @@ class RFC1459Support(BasicClient): ## IRC helpers. - def normalize(self, s): - return parsing.normalize(s, case_mapping=self._case_mapping) + def normalize(self, input): + return parsing.normalize(input, case_mapping=self._case_mapping) def is_channel(self, chan): """ Check if given argument is a channel name or not. """ @@ -825,6 +825,7 @@ class RFC1459Support(BasicClient): def on_raw_422(self, message): """ MOTD is missing. """ + self._registration_completed(message) self.motd = None self.on_connect()
Also set registration completed on missing MOTD.
py
diff --git a/dallinger/utils.py b/dallinger/utils.py index <HASH>..<HASH> 100644 --- a/dallinger/utils.py +++ b/dallinger/utils.py @@ -464,12 +464,12 @@ def ensure_constraints_file_presence(directory: str): prev_cwd = os.getcwd() try: os.chdir(directory) - url = f"https://raw.githubusercontent.com/Dallinger/Dallinger/v{__version__}/requirements.txt" + url = f"https://raw.githubusercontent.com/Dallinger/Dallinger/v{__version__}/dev-requirements.txt" print(f"Compiling constraints.txt file from requirements.txt and {url}") compile_info = f"dallinger generate-constraints\n#\n# Compiled from a requirement.txt file with md5sum: {requirements_path_hash}" with TemporaryDirectory() as tmpdirname: tmpfile = Path(tmpdirname) / "requirements.txt" - tmpfile.write_text(Path("requirements.txt").read_text() + "\n-r " + url) + tmpfile.write_text(Path("requirements.txt").read_text() + "\n-c " + url) check_output( ["pip-compile", str(tmpfile), "-o", "constraints.txt"], env=dict(
Use dev-requirements.txt as constraint instead of requirements.txt as requirements when generating experiment constraints
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -181,7 +181,6 @@ When you run this it prints: "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8",
remove Python <I> from support list (it is EOL)
py
diff --git a/src/hunter.py b/src/hunter.py index <HASH>..<HASH> 100644 --- a/src/hunter.py +++ b/src/hunter.py @@ -179,11 +179,17 @@ class Event(Fields.kind.function.module.filename): @_CachedProperty def module(self): - return self.frame.f_globals.get('__name__', '') + module = self.frame.f_globals.get('__name__', '') + if module is None: + module = '' + + return module @_CachedProperty def filename(self): filename = self.frame.f_globals.get('__file__', '') + if filename is None: + filename = '' if filename.endswith(('.pyc', '.pyo')): filename = filename[:-1]
Fixup broken frames that have "None" for filename or module so that we can still treat them as strings.
py
diff --git a/host/analysis/analyze_raw_data.py b/host/analysis/analyze_raw_data.py index <HASH>..<HASH> 100644 --- a/host/analysis/analyze_raw_data.py +++ b/host/analysis/analyze_raw_data.py @@ -616,8 +616,10 @@ class AnalyzeRawData(object): out_file_h5 = tb.openFile(self._analyzed_data_file, mode="r") else: out_file_h5 = None - if os.path.splitext(scan_data_filename)[1].strip().lower() != ".pdf": # check for correct filename extension - output_pdf_filename = os.path.splitext(scan_data_filename)[0] + ".pdf" +# if os.path.splitext(scan_data_filename)[1].strip().lower() != ".pdf": # check for correct filename extension +# output_pdf_filename = os.path.splitext(scan_data_filename)[0] + ".pdf" + if scan_data_filename[len(scan_data_filename) - 3:] != ".pdf": # check for correct filename extension + output_pdf_filename = scan_data_filename + ".pdf" else: output_pdf_filename = scan_data_filename logging.info('Saving output file: %s' % output_pdf_filename)
ENH: better behavior when dots are within the filename string
py
diff --git a/python/ray/util/sgd/torch/training_operator.py b/python/ray/util/sgd/torch/training_operator.py index <HASH>..<HASH> 100644 --- a/python/ray/util/sgd/torch/training_operator.py +++ b/python/ray/util/sgd/torch/training_operator.py @@ -600,7 +600,7 @@ class TrainingOperator: with self.timers.record("apply"): optimizer.step() - return {"train_loss": loss.item(), NUM_SAMPLES: features[0].size(0)} + return {"train_loss": loss.item(), NUM_SAMPLES: target.size(0)} def validate(self, val_iterator, info): """Runs one standard validation pass over the val_iterator.
[sgd] Use target label count as training batch size (#<I>)
py
diff --git a/python/setup.py b/python/setup.py index <HASH>..<HASH> 100644 --- a/python/setup.py +++ b/python/setup.py @@ -74,7 +74,7 @@ def config_cython(): setup(name='mxnet', version=__version__, description=open(os.path.join(CURRENT_DIR, 'README.md')).read(), - packages=find_packages(where=CURRENT_DIR), + packages=find_packages(), data_files=[('mxnet', [LIB_PATH[0]])], url='https://github.com/dmlc/mxnet', ext_modules=config_cython(),
remove where= from find_packages() (#<I>)
py
diff --git a/bika/lims/browser/analyses.py b/bika/lims/browser/analyses.py index <HASH>..<HASH> 100644 --- a/bika/lims/browser/analyses.py +++ b/bika/lims/browser/analyses.py @@ -531,7 +531,18 @@ class AnalysesView(BikaListingView): can_set_instrument = service.getInstrumentEntryOfResults() \ and can_edit_analysis \ and item['review_state'] in allowed_method_states - instrument = obj.getInstrument() if hasattr(obj, 'getInstrument') else None + instrument = None + if service.getInstrumentEntryOfResults() \ + and hasattr(obj, 'getInstrument') \ + and obj.getInstrument(): + instrument = obj.getInstrument() + elif service.getInstrumentEntryOfResults(): + instrument = service.getInstrument() + + if method and instrument \ + and instrument.UID() not in method.getInstrumentUIDs(): + instrument = None + if service.getInstrumentEntryOfResults() == False: item['Instrument'] = '' item['replace']['Instrument'] = ''
Fix #<I> Instruments for Analysis on AR (and WS) not set for the chosen Method If an instrument hasn't been already set to an analysis, show the default instrument for the analysis service if available for the selected method
py
diff --git a/tinyscript/helpers/decorators.py b/tinyscript/helpers/decorators.py index <HASH>..<HASH> 100644 --- a/tinyscript/helpers/decorators.py +++ b/tinyscript/helpers/decorators.py @@ -57,7 +57,7 @@ def try_or_die(message, exc=Exception, extra_info=""): method) """ def _try_or_die(f): - @wraps(f) + #@wraps(f) def wrapper(*args, **kwargs): self = args[0] if __is_method(f) else None try:
Minor fix regarding Travis CI testing (3)
py
diff --git a/lib/websession_templates.py b/lib/websession_templates.py index <HASH>..<HASH> 100644 --- a/lib/websession_templates.py +++ b/lib/websession_templates.py @@ -891,13 +891,13 @@ class Template: 'groups' : _("groups"), } if submitter: - out += """<a class="userinfo" href="%(weburl)s/yoursubmissions?ln=%(ln)s">%(submission)s</a> :: """ % { + out += """<a class="userinfo" href="%(weburl)s/yoursubmissions.py?ln=%(ln)s">%(submission)s</a> :: """ % { 'weburl' : weburl, 'ln' : ln, 'submission' : _("submissions"), } if referee: - out += """<a class="userinfo" href="%(weburl)s/yourapprovals?ln=%(ln)s">%(approvals)s</a> :: """ % { + out += """<a class="userinfo" href="%(weburl)s/yourapprovals.py?ln=%(ln)s">%(approvals)s</a> :: """ % { 'weburl' : weburl, 'ln' : ln, 'approvals' : _("approvals"),
Use .py extension in links to Your Approvals and Your Submissions pages, as they were not migrated yet to the new URL schema.
py
diff --git a/karaage/applications/forms.py b/karaage/applications/forms.py index <HASH>..<HASH> 100644 --- a/karaage/applications/forms.py +++ b/karaage/applications/forms.py @@ -44,6 +44,7 @@ class StartApplicationForm(StartInviteApplicationForm): class ApplicantForm(forms.ModelForm): class Meta: model = Applicant + exclude = ('saml_id',) class UserApplicantForm(ApplicantForm):
Ensure SAML ID doesn't get set on new applications
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import codecs try: from setuptools import setup, find_packages extra_setup = dict( - install_requires=['requests'], + install_requires=['requests', 'Jinja2>=2.9'], ) except ImportError: from distutils.core import setup
Add jinja2>=<I> as dependency Closes #<I>
py
diff --git a/tmuxp/testsuite/test_window.py b/tmuxp/testsuite/test_window.py index <HASH>..<HASH> 100644 --- a/tmuxp/testsuite/test_window.py +++ b/tmuxp/testsuite/test_window.py @@ -91,17 +91,13 @@ class NewTest2(TmuxTestCase): window = self.session.new_window(window_name='test', attach=True) self.assertIsInstance(window, Window) self.assertEqual(1, len(window.panes)) - window.select_layout() window.split_window(attach=True) - window.select_layout() self.assertEqual(2, len(window.panes)) # note: the below used to accept -h, removing because split_window now # has attach as its only argument now - window.select_layout() window.split_window(attach=True) self.assertEqual(3, len(window.panes)) - window.select_layout() class NewTest3(TmuxTestCase):
fix bad test with blank select_layout calls
py
diff --git a/andes/core/model.py b/andes/core/model.py index <HASH>..<HASH> 100644 --- a/andes/core/model.py +++ b/andes/core/model.py @@ -308,6 +308,23 @@ class ModelData: return out + def as_df_local(self): + """ + Export local variable values and services to a DataFrame. + """ + + out = dict() + out['uid'] = np.arange(self.n) + out['idx'] = self.idx.v + + for name, instance in self.cache.all_vars.items(): + out[name] = instance.v + + for name, instance in self.services.items(): + out[name] = instance.v + + return pd.DataFrame(out).set_index('uid') + def update_from_df(self, df, vin=False): """ Update parameter values from a DataFrame.
Add `as_df_local` to export internal variable and service values.
py
diff --git a/cartoframes/core/managers/context_manager.py b/cartoframes/core/managers/context_manager.py index <HASH>..<HASH> 100644 --- a/cartoframes/core/managers/context_manager.py +++ b/cartoframes/core/managers/context_manager.py @@ -256,7 +256,7 @@ class ContextManager(object): COPY {table_name}({columns}) FROM stdin WITH (FORMAT csv, DELIMITER '|', NULL '{null}'); """.format( table_name=table_name, null=PG_NULL, - columns=','.join(column.name for column in dataframe_columns_info.columns)).strip() + columns=','.join(column.dbname for column in dataframe_columns_info.columns)).strip() data = _compute_copy_data(dataframe, dataframe_columns_info)
Use dbname in copyfrom query
py
diff --git a/pyqode/core/frontend/widgets/interactive.py b/pyqode/core/frontend/widgets/interactive.py index <HASH>..<HASH> 100644 --- a/pyqode/core/frontend/widgets/interactive.py +++ b/pyqode/core/frontend/widgets/interactive.py @@ -3,6 +3,7 @@ This module contains interactive widgets: - interactive console: a text edit made to run subprocesses interactively """ +import locale import logging import sys from pyqode.qt.QtCore import Qt, Signal, Property, QProcess @@ -79,12 +80,12 @@ class InteractiveConsole(QTextEdit): self._writer = writer def _on_stdout(self): - txt = bytes(self.process.readAllStandardOutput()).decode('utf-8') + txt = bytes(self.process.readAllStandardOutput()).decode(locale.getpreferredencoding()) logging.debug('stdout ready: %s', txt) self._writer(self, txt, self.stdout_color) def _on_stderr(self): - txt = bytes(self.process.readAllStandardError()).decode('utf-8') + txt = bytes(self.process.readAllStandardError()).decode(locale.getpreferredencoding()) logging.debug('stderr ready: %s', txt) self._writer(self, txt, self.stderr_color)
use locale encoding instead of hardcoded utf-8
py
diff --git a/patroni/postgresql.py b/patroni/postgresql.py index <HASH>..<HASH> 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -715,17 +715,12 @@ $$""".format(name, options), name, password, password) return ret def bootstrap(self): - """ - Failure during initdb always leads to an exception, since there is - no point in continuing if initdb fails. For the rest of the cases, - the function returns False in order to inidicate a failed attempt - that should be retried in the future. - """ + """ Initialize a new node from scratch and start it. """ if self.initialize() and self.start(): self.create_replication_user() self.create_connection_user() - return True - raise PostgresException("Could not bootstrap master PostgreSQL") + else: + raise PostgresException("Could not bootstrap master PostgreSQL") def move_data_directory(self): if os.path.isdir(self.data_dir) and not self.is_running():
Remove the comment that is oudated since the bootstrap separation from the create replica.
py
diff --git a/runcommands/completion/__init__.py b/runcommands/completion/__init__.py index <HASH>..<HASH> 100644 --- a/runcommands/completion/__init__.py +++ b/runcommands/completion/__init__.py @@ -1,6 +1,7 @@ import glob import os import shlex +from contextlib import redirect_stderr from ..args import arg from ..collection import Collection @@ -30,7 +31,10 @@ def complete(command_line, tokens = shlex.split(command_line[:position]) all_argv, run_argv, command_argv = run.partition_argv(tokens[1:]) - run_args = run.parse_args(run_argv) + + with open(os.devnull, 'wb') as devnull_fp: + with redirect_stderr(devnull_fp): + run_args = run.parse_args(run_argv) module = run_args.get('commands_module') module = module or DEFAULT_COMMANDS_MODULE
Hide stderr when parsing args in complete command For example, if an option takes a value, we don't want argparse to show usage when completing.
py
diff --git a/autopep8.py b/autopep8.py index <HASH>..<HASH> 100755 --- a/autopep8.py +++ b/autopep8.py @@ -2302,9 +2302,11 @@ def main(): if args == ['-']: assert not options.in_place - output = LineEndingWrapper(sys.stdout) - output.write(fix_string(sys.stdin.read(), - options)) + + # LineEndingWrapper is unnecessary here due to the symmetry between + # standard in and standard out. + sys.stdout.write(fix_string(sys.stdin.read(), + options)) else: if options.in_place or options.diff: filenames = list(set(args))
Remove unnecessary LineEndingWrapper in "-" case
py
diff --git a/cobe/irc.py b/cobe/irc.py index <HASH>..<HASH> 100644 --- a/cobe/irc.py +++ b/cobe/irc.py @@ -80,7 +80,7 @@ class Bot(irclib.SimpleIRCClient): text = msg # convert message to unicode - text = text.decode("utf-8") + text = text.decode("utf-8").strip() if not self.only_nicks or user in self.only_nicks: self.brain.learn(text)
strip() irc inputs before learning them This fixes an issue where cobe could reply with a leading space.
py
diff --git a/tests/test_tun.py b/tests/test_tun.py index <HASH>..<HASH> 100644 --- a/tests/test_tun.py +++ b/tests/test_tun.py @@ -1,15 +1,6 @@ -# import pytest -# import pytun import socket import time -import os -# import sliplib import string -# import struct -# import binascii -# import dpkt -# import subprocess -# import threading from faradayio import faraday from tests.serialtestclass import SerialTestClass @@ -27,15 +18,6 @@ def test_tunSetup(): assert faradayTUN._tun.mtu == 1500 -def test_tunStart(): - """Start a Faraday TUN adapter and ping it""" - faradayTUN = faraday.TunnelServer() - response = os.system("ping -c 1 10.0.0.1") - - # Check that response == 0 which means TUN adapter started - assert response == 0 - - def test_tunSend(): """ Start a TUN adapter and send a message through it. This tests sending ascii
Cleaned up test_tun.py Removed commented out imports and removed the os module since I also removed the ping test. This test was largely superseded by the remaining TUN tests.
py
diff --git a/pdf/modify/draw/image.py b/pdf/modify/draw/image.py index <HASH>..<HASH> 100644 --- a/pdf/modify/draw/image.py +++ b/pdf/modify/draw/image.py @@ -125,21 +125,16 @@ class DrawPIL: :param y: :return: X and Y values """ - if 'center' in str(x).lower(): - x = self._img_centered_x(image) - elif int(x) < 0: - x = int(self.width - abs(x)) - else: - x = int(x) + def calculator(value, img_size, center_func): + """Helper function to perform bound calculations for either x or y values.""" + if 'center' in str(value).lower(): + return center_func(image) + elif int(value) < 0: + return int(img_size - abs(value)) + else: + return int(value) - if 'center' in str(y).lower(): - y = self._img_centered_y(image) - elif int(y) < 0: - y = int(self.height - abs(y)) - else: - y = int(y) - print(x, y) - return x, y + return calculator(x, self.width, self._img_centered_x), calculator(y, self.height, self._img_centered_x) def scale(self, img, func='min', scale=None): """Scale an image to fit the Pillow canvas."""
ADD calculator function to image_bound method
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,7 @@ setup( "Topic :: Software Development :: Libraries :: Python Modules", ], + use_2to3 = True, long_description = """\ Iron.io common library ----------------------
modified: setup.py added distribute's 2to3 option for python 3 compatibility
py
diff --git a/extra_views/advanced.py b/extra_views/advanced.py index <HASH>..<HASH> 100644 --- a/extra_views/advanced.py +++ b/extra_views/advanced.py @@ -82,7 +82,7 @@ class ProcessFormWithInlinesView(FormView): form_class = self.get_form_class() form = self.get_form(form_class) inlines = self.construct_inlines() - return self.render_to_response(self.get_context_data(form=form, inlines=inlines)) + return self.render_to_response(self.get_context_data(form=form, inlines=inlines, *args, **kwargs)) def post(self, request, *args, **kwargs): """
adding args and kwargs to ProcessFormWithInlinesView for better subclassing
py
diff --git a/tests/test_spec.py b/tests/test_spec.py index <HASH>..<HASH> 100644 --- a/tests/test_spec.py +++ b/tests/test_spec.py @@ -5,6 +5,7 @@ from __future__ import absolute_import from __future__ import unicode_literals import io +import os import json import pytest import requests @@ -13,6 +14,7 @@ from goodtables.spec import spec # Tests [email protected](os.environ.get('TRAVIS_BRANCH') != 'master', reason='CI') def test_spec_is_up_to_date(): origin_spec = requests.get('https://raw.githubusercontent.com/frictionlessdata/data-quality-spec/master/spec.json').json() assert spec == origin_spec, 'run `make spec` to update the spec'
Run spec up-to-date only on CI
py
diff --git a/userena/views.py b/userena/views.py index <HASH>..<HASH> 100644 --- a/userena/views.py +++ b/userena/views.py @@ -263,9 +263,6 @@ def signin(request, auth_form=AuthenticationForm, """ form = auth_form - # Sign a user out if he/she is at the signin page. - logout(request) - if request.method == 'POST': form = auth_form(request.POST, request.FILES) if form.is_valid():
Removed unnecessary logout since django.contrib.auth.login will call request.session.flush() in case a new user logs in.
py
diff --git a/master/buildbot/reporters/github.py b/master/buildbot/reporters/github.py index <HASH>..<HASH> 100644 --- a/master/buildbot/reporters/github.py +++ b/master/buildbot/reporters/github.py @@ -165,7 +165,7 @@ class GitHubStatusPush(http.HttpStatusPushBase): ) if self.verbose: log.msg( - 'Updated status with "{state}" for' + 'Updated status with "{state}" for ' '{repoOwner}/{repoName} at {sha}, issue {issue}.'.format( state=state, repoOwner=repoOwner, repoName=repoName, sha=sha, issue=issue)) except Exception as e:
reporters: fix typo in github status push
py
diff --git a/adafruit_motor/servo.py b/adafruit_motor/servo.py index <HASH>..<HASH> 100644 --- a/adafruit_motor/servo.py +++ b/adafruit_motor/servo.py @@ -44,8 +44,8 @@ class _BaseServo: # pylint: disable-msg=too-few-public-methods self._pwm_out = pwm_out self.set_pulse_widths(min_pulse, max_pulse) - def set_pulse_widths(self, min_pulse=750, max_pulse=2250): - """Change pulse widths.""" + def set_pulse_widths_range(self, min_pulse=750, max_pulse=2250): + """Change min and max pulse widths.""" self._min_duty = int((min_pulse * self._pwm_out.frequency) / 1000000 * 0xffff) max_duty = (max_pulse * self._pwm_out.frequency) / 1000000 * 0xffff self._duty_range = int(max_duty - self._min_duty)
better name for fn to set pulse widths
py
diff --git a/organizations/admin.py b/organizations/admin.py index <HASH>..<HASH> 100644 --- a/organizations/admin.py +++ b/organizations/admin.py @@ -15,7 +15,7 @@ class OrganizationAdmin(admin.ModelAdmin): class OrganizationUserAdmin(admin.ModelAdmin): list_filter = ['organization'] - list_display = ['user', 'is_admin'] + list_display = ['user', 'organization', 'is_admin'] class OrganizationOwnerAdmin(admin.ModelAdmin):
Better list display for users (especially when there are multiple organizations associated with one user)
py
diff --git a/pydriller/utils/conf.py b/pydriller/utils/conf.py index <HASH>..<HASH> 100644 --- a/pydriller/utils/conf.py +++ b/pydriller/utils/conf.py @@ -185,6 +185,7 @@ class Conf: return len([x for x in arr if x is not None]) <= 1 def build_args(self): + single = self.get('single') from_commit = self.get('from_commit') to_commit = self.get('to_commit') branch = self.get('only_in_branch') @@ -192,7 +193,9 @@ class Conf: rev = [] kwargs = {} - if from_commit is not None or to_commit is not None: + if single is not None: + rev = [single, '-n', 1] + elif from_commit is not None or to_commit is not None: if from_commit is not None and to_commit is not None: rev.extend(from_commit) rev.append(to_commit) @@ -228,11 +231,6 @@ class Conf: :param Commit commit: Commit to check :return: """ - if self.get('single') is not None and \ - commit.hash != self.get('single'): - logger.debug('Commit filtered because is not ' - 'the defined in single') - return True if (self.get('since') is not None and commit.committer_date < self.get('since')) or \ (self.get('to') is not None and
single filter now uses a git filter as well, this is much faster
py
diff --git a/nodeconductor/iaas/tests/test_scenarios.py b/nodeconductor/iaas/tests/test_scenarios.py index <HASH>..<HASH> 100644 --- a/nodeconductor/iaas/tests/test_scenarios.py +++ b/nodeconductor/iaas/tests/test_scenarios.py @@ -76,12 +76,14 @@ class InstanceSecurityGroupsTest(test.APISimpleTestCase): security_groups = [ factories.InstanceSecurityGroupFactory(instance=self.instance, name=g['name']) for g in cloud_models.SecurityGroups.groups] - expected_security_groups = [g.name for g in security_groups] response = self.client.get(_instance_url(self.instance)) self.assertEqual(response.status_code, 200) context = json.loads(response.content) - self.assertSequenceEqual([g['name'] for g in context['security_groups']], expected_security_groups) + fields = ('name', 'protocol', 'from_port', 'to_port', 'ip_range') + for field in fields: + expected_security_groups = [getattr(g, field) for g in security_groups] + self.assertSequenceEqual([g[field] for g in context['security_groups']], expected_security_groups) def test_add_instance_with_security_groups(self): data = _instance_data(self.instance)
added test for all security group fields - not only name
py
diff --git a/vyper/compiler/output.py b/vyper/compiler/output.py index <HASH>..<HASH> 100644 --- a/vyper/compiler/output.py +++ b/vyper/compiler/output.py @@ -98,6 +98,7 @@ def build_metadata_output(compiler_data: CompilerData) -> dict: def _to_dict(sig): ret = vars(sig) ret["return_type"] = str(ret["return_type"]) + ret["_lll_identifier"] = sig._lll_identifier for attr in ("gas", "func_ast_code"): del ret[attr] for attr in ("args", "base_args", "default_args"):
fix: _lll_identifier caching (#<I>) since `_lll_identifier` is a cached property, it doesn't show up as a property until it is called for the first time. this forces it into the metadata output
py
diff --git a/coreweb/_closurebuild/compiler.py b/coreweb/_closurebuild/compiler.py index <HASH>..<HASH> 100644 --- a/coreweb/_closurebuild/compiler.py +++ b/coreweb/_closurebuild/compiler.py @@ -76,13 +76,15 @@ def get_deps_list(roots): return [join(root, "deps.js") for root in roots] -def compile(roots, namespaces, output, output_log, defines={}): +def compile(roots, namespaces, output, output_log, externs=[], defines={}): print "Compiling %r" % (output,) fileArgs = ["--js=" + fname for fname in get_deps_list(roots) + get_js_list(roots, namespaces)] - defineArgs = ["--define=" + k + "=" + v for (k, v) in defines.iteritems()] + moreArgs = \ + ["--define=" + k + "=" + v for (k, v) in defines.iteritems()] + \ + ["--externs=" + e for e in externs] main = "com.google.javascript.jscomp.CommandLineRunner" - loggedArgs = COMPILER_FLAGS + defineArgs + fileArgs + loggedArgs = COMPILER_FLAGS + moreArgs + fileArgs args = CLOSURE_COMPILER_JAVA + [main] + loggedArgs pprint.pprint(args)
_closurebuild: add support for customizing externs
py
diff --git a/pyasn1/codec/ber/encoder.py b/pyasn1/codec/ber/encoder.py index <HASH>..<HASH> 100644 --- a/pyasn1/codec/ber/encoder.py +++ b/pyasn1/codec/ber/encoder.py @@ -33,9 +33,10 @@ class AbstractItemEncoder: while length: substrate = chr(length&0xff) + substrate length = length >> 8 - if len(substrate) > 126: - raise Error('Length octets overflow (%d)' % len(substrate)) - return chr(0x80 | len(substrate)) + substrate + substrateLen = len(substrate) + if substrateLen > 126: + raise Error('Length octets overflow (%d)' % substrateLen) + return chr(0x80 | substrateLen) + substrate def encodeValue(self, encodeFun, value, defMode, maxChunkSize): raise Error('Not implemented')
cache substrate length at encodeLength() for better performance
py
diff --git a/datajoint/version.py b/datajoint/version.py index <HASH>..<HASH> 100644 --- a/datajoint/version.py +++ b/datajoint/version.py @@ -1 +1 @@ -__version__ = "0.6.1" +__version__ = "0.7.0"
Increment version number to <I>
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,6 @@ setup( license='MIT', packages=['centerline'], install_requires=[ - 'GDAL>=1.9.2', 'Fiona>=1.6.3' 'Shapely>=1.5.13', 'numpy>=1.10.4',
Remove GDAL as a dependency
py
diff --git a/authapi/urls.py b/authapi/urls.py index <HASH>..<HASH> 100644 --- a/authapi/urls.py +++ b/authapi/urls.py @@ -14,7 +14,14 @@ orgusers_router.register( r'users', views.OrganizationUsersViewSet, base_name='seedorganization-users') +permissions_router = routers.NestedSimpleRouter( + router, r'teams', lookup='team') +permissions_router.register( + r'permissions', views.TeamPermissionViewSet, + base_name='seedteam-permissions') + urlpatterns = [ url(r'^', include(router.urls)), url(r'^', include(orgusers_router.urls)), + url(r'^', include(permissions_router.urls)), ]
Add urls for adding and removing permissions from teams
py
diff --git a/goatools/wr_tbl_class.py b/goatools/wr_tbl_class.py index <HASH>..<HASH> 100644 --- a/goatools/wr_tbl_class.py +++ b/goatools/wr_tbl_class.py @@ -105,7 +105,8 @@ class WrXlsx(object): # If field "format_txt" is present, use value for formatting, but don't print. val = getattr(data_nt, fld, "") # Optional user-formatting of specific fields, eg, pval: "{:8.2e}" - if fld2fmt is not None and fld in fld2fmt: + # If field value is empty (""), don't use fld2fmt + if fld2fmt is not None and fld in fld2fmt and val != "": val = fld2fmt[fld].format(val) worksheet.write(row_idx, col_idx, val, fmt_txt) row_idx += 1
If field value is empty (""), don't use fld2fmt, since it may be formatting a number e.g., "{:<I>e}"
py
diff --git a/tasks.py b/tasks.py index <HASH>..<HASH> 100644 --- a/tasks.py +++ b/tasks.py @@ -1,7 +1,7 @@ from os.path import join -from invoke import Collection -from invocations import docs as _docs, testing +from invoke import Collection, task +from invocations import docs as _docs d = 'sites' @@ -20,4 +20,11 @@ www = Collection.from_module(_docs, name='www', config={ 'sphinx.target': join(path, '_build'), }) -ns = Collection(testing.test, docs=docs, www=www) + +# Until we move to spec-based testing +@task +def test(ctx): + ctx.run("python test.py --verbose") + + +ns = Collection(test, docs=docs, www=www)
Replace incorrect import of generic test runner w/ custom task
py
diff --git a/etrago/cluster/networkclustering.py b/etrago/cluster/networkclustering.py index <HASH>..<HASH> 100644 --- a/etrago/cluster/networkclustering.py +++ b/etrago/cluster/networkclustering.py @@ -550,7 +550,7 @@ def ehv_clustering(self): self.network.generators.control = "PV" busmap = busmap_from_psql(self) self.network = cluster_on_extra_high_voltage( - self.network, busmap, with_time=False) + self.network, busmap, with_time=True) logger.info('Network clustered to EHV-grid') def kmean_clustering(etrago):
Set with_time in ehv clustering to True
py
diff --git a/salt/modules/useradd.py b/salt/modules/useradd.py index <HASH>..<HASH> 100644 --- a/salt/modules/useradd.py +++ b/salt/modules/useradd.py @@ -87,6 +87,15 @@ def add(name, cmd += '-u {0} '.format(uid) if gid not in (None, ''): cmd += '-g {0} '.format(gid) + elif name in groups: + def usergroups(): + for line in open("/etc/login.defs"): + if "USERGROUPS_ENAB" in line[:15]: + if "yes" in line: + return True + return False + if usergroups(): + cmd += '-g {0} '.format(__salt__['file.group_to_gid'](name)) if home: if system: if home is not True:
check whether a usergroup is set explicitly as part of the groups parameter and set it as default group on systems with usergroups enabled
py
diff --git a/codemod/base.py b/codemod/base.py index <HASH>..<HASH> 100755 --- a/codemod/base.py +++ b/codemod/base.py @@ -940,10 +940,6 @@ def _parse_command_line(): help='Don\'t run normally. Instead, just print ' 'out number of times places in the codebase ' 'where the \'query\' matches.') - parser.add_argument('--test', action='store_true', - help='Don\'t run normally. Instead, just run ' - 'the unit tests embedded in the codemod library.') - parser.add_argument('match', nargs='?', action='store', type=str, help='Regular expression to match.') parser.add_argument('subst', nargs='?', action='store', type=str, @@ -951,13 +947,8 @@ def _parse_command_line(): arguments = parser.parse_args() - if arguments.test: - import doctest - doctest.testmod() - sys.exit(0) - if ( - arguments.extensions is None + arguments.extensions is None ) and (arguments.include_extensionless is False): parser.print_usage() sys.exit(0)
removed --test argument since py.test is now the test runner
py
diff --git a/safe/postprocessors/building_type_postprocessor.py b/safe/postprocessors/building_type_postprocessor.py index <HASH>..<HASH> 100644 --- a/safe/postprocessors/building_type_postprocessor.py +++ b/safe/postprocessors/building_type_postprocessor.py @@ -10,9 +10,11 @@ __license__ = "GPL" __copyright__ = 'Copyright 2012, Australia Indonesia Facility for ' __copyright__ += 'Disaster Reduction' +from collections import OrderedDict import itertools + from safe.postprocessors.abstract_postprocessor import AbstractPostprocessor -from collections import OrderedDict +from safe.utilities.i18n import tr class BuildingTypePostprocessor(AbstractPostprocessor):
Building type postprocessor needs to import tr.
py
diff --git a/firecloud/errors.py b/firecloud/errors.py index <HASH>..<HASH> 100644 --- a/firecloud/errors.py +++ b/firecloud/errors.py @@ -14,6 +14,5 @@ class FireCloudServerError(RuntimeError): def __init__(self, code, message): self.code = code self.message = message - emsg = str(code) + ": " + str(self.message) - RuntimeError.__init__(self, emsg) + RuntimeError.__init__(self, message)
we now catch server errors in the outermost scope, and print the status code, so it doesn't need to be suffixed into the exception message body (allowing such to remain pure json and thus parsable to a dict)
py
diff --git a/git/test/test_index.py b/git/test/test_index.py index <HASH>..<HASH> 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -801,7 +801,7 @@ class TestIndex(TestBase): def test_add_a_file_with_wildcard_chars(self, rw_dir): # see issue #407 fp = os.path.join(rw_dir, '[.exe') - with open(fp, "w") as f: + with open(fp, "wb") as f: f.write(b'something') r = Repo.init(rw_dir)
fixed unittest of issue #<I> for Python3
py
diff --git a/tests/test_client.py b/tests/test_client.py index <HASH>..<HASH> 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -119,7 +119,7 @@ def start_server(server, inst, device): exe = find_executable(server) cmd = ("{0} {1} -ORBendPoint giop:tcp::0 -nodb -dlist {2}" .format(exe, inst, device)) - proc = Popen(cmd.split()) + proc = Popen(cmd.split(), close_fds=True) proc.poll() return proc
In tests, make sure we close all FDs before we start DS Only needed in python 2 (in python 3 Popen closes fds by default)
py
diff --git a/holoviews/operation/element.py b/holoviews/operation/element.py index <HASH>..<HASH> 100644 --- a/holoviews/operation/element.py +++ b/holoviews/operation/element.py @@ -555,7 +555,7 @@ class histogram(Operation): if view.group != view.__class__.__name__: params['group'] = view.group - return Histogram(hist, edges, kdims=[view.get_dimension(selected_dim)], + return Histogram((hist, edges), kdims=[view.get_dimension(selected_dim)], label=view.label, **params)
Ensure histogram operation does not raise deprecation warning
py
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -17,24 +17,6 @@ See the License for the specific language governing permissions and limitations under the License. - - -create player profile - player name/ID - player type - if AI or bot - command to execute agent launch/init - command to execute agent callback (handled by launch/init?) -select player profile -remove player profile -edit player profile - - -search for stale profiles - -remove stale profiles - - types of player profiles in-game PlayerAgent limited knowledge
- removed some planning docs that are now implemented
py
diff --git a/bcbio/wgbsseq/trimming.py b/bcbio/wgbsseq/trimming.py index <HASH>..<HASH> 100644 --- a/bcbio/wgbsseq/trimming.py +++ b/bcbio/wgbsseq/trimming.py @@ -66,7 +66,7 @@ def trimming(data): return [[data]] def _run_qc_fastqc(in_files, data, out_dir): - in_files = fastq.downsample(in_files, data=data, N=5000000) + in_files = fastq.downsample(in_files, None, data=data, N=5000000) for fastq_file in in_files: if fastq_file: fastqc.run(fastq_file, data, op.join(out_dir, utils.splitext_plus(op.basename(fastq_file))[0]), rename=False)
Update arg list for downsample()
py
diff --git a/fenix.py b/fenix.py index <HASH>..<HASH> 100644 --- a/fenix.py +++ b/fenix.py @@ -113,7 +113,7 @@ class FenixAPISingleton(object): return self._request(url, params, method, headers = headers) def get_authentication_url(self): - url = self.base_url + self.oauth_endpoint + 'userdialog?client_id=' + self.client_id + '&redirect_uri=' + self.redirect_uri + url = self.base_url + self.oauth_endpoint + '/userdialog?client_id=' + self.client_id + '&redirect_uri=' + self.redirect_uri return url def set_code(self, code):
fixed missing / in the authentication url
py
diff --git a/gphoto2cffi/gphoto2.py b/gphoto2cffi/gphoto2.py index <HASH>..<HASH> 100644 --- a/gphoto2cffi/gphoto2.py +++ b/gphoto2cffi/gphoto2.py @@ -852,4 +852,4 @@ class Camera(object): def __del__(self): if self.__cam is not None: lib.gp_camera_exit(self.__cam, self._ctx) - lib.gp_camera_free(self.__cam) + lib.gp_camera_unref(self.__cam)
Update gphoto2.py use `gp_camera_unref` instead of `gp_camera_free` as the latter is deprecated (<URL>).
py
diff --git a/littlechef/lib.py b/littlechef/lib.py index <HASH>..<HASH> 100644 --- a/littlechef/lib.py +++ b/littlechef/lib.py @@ -167,6 +167,7 @@ def _generate_metadata(path, cookbook_path, name): error_msg += "while executing knife to generate " error_msg += "metadata.json for {0}".format(path) print(error_msg) + print resp if env.loglevel == 'debug': print "\n".join(resp.split("\n")[:2]) except OSError:
Print knife errors when they are unkown
py
diff --git a/tests/app/models.py b/tests/app/models.py index <HASH>..<HASH> 100644 --- a/tests/app/models.py +++ b/tests/app/models.py @@ -6,7 +6,6 @@ from taggit.models import TaggedItemBase from wagtail.wagtailadmin.edit_handlers import FieldPanel, PageChooserPanel from wagtail.wagtailcore.models import Page from wagtail.wagtailsearch import index -from wagtail.wagtailsnippets.models import register_snippet from wagtailnews.decorators import newsindex from wagtailnews.edit_handlers import NewsChooserPanel @@ -39,7 +38,6 @@ class NewsIndex(NewsIndexMixin, Page): return context -@register_snippet @python_2_unicode_compatible class NewsItem(index.Indexed, AbstractNewsItem): title = models.CharField(max_length=32)
Do not register NewsItem as a snippet
py
diff --git a/telethon/tl/session.py b/telethon/tl/session.py index <HASH>..<HASH> 100644 --- a/telethon/tl/session.py +++ b/telethon/tl/session.py @@ -330,7 +330,9 @@ class Session: p_hash = p.access_hash if p_hash is not None: - username = getattr(e, 'username', '').lower() or None + username = getattr(e, 'username', None) or None + if username is not None: + username = username.lower() phone = getattr(e, 'phone', None) name = utils.get_display_name(e) or None rows.append((marked_id, p_hash, username, phone, name))
Fix username.lower() on instances with username field but None
py
diff --git a/metal/mmtl/trainer.py b/metal/mmtl/trainer.py index <HASH>..<HASH> 100644 --- a/metal/mmtl/trainer.py +++ b/metal/mmtl/trainer.py @@ -415,7 +415,7 @@ class MultitaskTrainer(object): ): self._validate_checkpoint_metric(tasks) # Set checkpoint_dir to log_dir/checkpoints/ - if not self.config["checkpoint_config"]["checkpoint_dir"]: + if self.writer and not self.config["checkpoint_config"]["checkpoint_dir"]: self.config["checkpoint_config"]["checkpoint_dir"] = os.path.join( self.writer.log_subdir, "checkpoints" )
Don't try to look up writer log_subdir if writer is None
py
diff --git a/spyder/widgets/mixins.py b/spyder/widgets/mixins.py index <HASH>..<HASH> 100644 --- a/spyder/widgets/mixins.py +++ b/spyder/widgets/mixins.py @@ -754,8 +754,12 @@ class SaveHistoryMixin(object): if self.history_filename not in self.HISTORY_FILENAMES: self.HISTORY_FILENAMES.append(self.history_filename) text = self.SEPARATOR + text - - encoding.write(text, self.history_filename, mode='ab') + # Needed to prevent errors from the history.py + # See issue 6431 + try: + encoding.write(text, self.history_filename, mode='ab') + except (IOError, OSError): + pass if self.append_to_history is not None: self.append_to_history.emit(self.history_filename, text)
Add handling from errors with the history.py file.
py
diff --git a/src/feat/web/httpclient.py b/src/feat/web/httpclient.py index <HASH>..<HASH> 100644 --- a/src/feat/web/httpclient.py +++ b/src/feat/web/httpclient.py @@ -81,6 +81,7 @@ class Protocol(http.BaseProtocol): def request(self, method, location, protocol=None, headers=None, body=None): + self.cancel_timeout("inactivity") headers = dict(headers) if headers is not None else {} if body: @@ -127,6 +128,7 @@ class Protocol(http.BaseProtocol): def process_reset(self): self._response = None + self.reset_timeout('inactivity') self.factory.onConnectionReset(self) self.debug('Ready for new request')
Cancel and reset inactivity timeout correctly in http client.
py
diff --git a/djcelery/models.py b/djcelery/models.py index <HASH>..<HASH> 100644 --- a/djcelery/models.py +++ b/djcelery/models.py @@ -224,6 +224,8 @@ class PeriodicTask(models.Model): self.exchange = self.exchange or None self.routing_key = self.routing_key or None self.queue = self.queue or None + if self.disabled: + self.last_run_at = None super(PeriodicTask, self).save(*args, **kwargs) def __unicode__(self):
Reset last_run_at when periodic task disabled in the db. Closes ask/celery#<I>
py
diff --git a/tests/test-scout2.py b/tests/test-scout2.py index <HASH>..<HASH> 100644 --- a/tests/test-scout2.py +++ b/tests/test-scout2.py @@ -11,23 +11,18 @@ from opinel.utils.credentials import read_creds_from_environment_variables # class TestScout2Class: - # - # Setup - # - def setup(self): - configPrintException(True) - creds = read_creds_from_environment_variables() - self.profile_name = 'travislike' if creds['AccessKeyId'] == None else None - @classmethod def setUpClass(cls): + configPrintException(True) + creds = read_creds_from_environment_variables() + cls.profile_name = 'travislike' if creds['AccessKeyId'] == None else None cls.has_run_scout2 = False def call_scout2(self, args): args = ['./Scout2.py' ] + args - if self.profile_name: + if TestScout2Class.profile_name: args.append('--profile') - args.append(self.profile_name) + args.append(TestScout2Class.profile_name) args.append('--force') args.append('--debug') args.append('--no-browser')
Move one-time setup into the setUpClass method
py
diff --git a/src/feat/web/httpclient.py b/src/feat/web/httpclient.py index <HASH>..<HASH> 100644 --- a/src/feat/web/httpclient.py +++ b/src/feat/web/httpclient.py @@ -151,7 +151,9 @@ class Protocol(http.BaseProtocol): def process_body_data(self, data): assert self._response is not None, "No response information" - self._response.body = data + if self._response.body is None: + self._response.body = '' + self._response.body += data def process_body_finished(self): d = self._requests.pop(0)
Fix problem with downloading long pages with httpclient.
py
diff --git a/ftr/version.py b/ftr/version.py index <HASH>..<HASH> 100644 --- a/ftr/version.py +++ b/ftr/version.py @@ -1,2 +1,2 @@ -version = '0.4.5' +version = '0.4.6'
version bump for <I>.
py
diff --git a/tests/test_decorators.py b/tests/test_decorators.py index <HASH>..<HASH> 100644 --- a/tests/test_decorators.py +++ b/tests/test_decorators.py @@ -13,7 +13,7 @@ def test_query_jwt_required(flask_app: Flask): response = request(test_cli, "query", - f'protected(token:"{access_token}")', + 'protected(token:"{0}")'.format(access_token), """... on AuthInfoField{ message } @@ -32,7 +32,7 @@ def test_mutation_jwt_required(flask_app: Flask): response = request(test_cli, "mutation", - f'protected(token:"{access_token}")', + 'protected(token:"{0}")'.format(access_token), """message { ... on MessageField { message @@ -53,7 +53,7 @@ def test_mutation_refresh_jwt_token_required(flask_app: Flask): response = request(test_cli, "mutation", - f'refresh(refreshToken:"{refresh_token}")', + 'refresh(refreshToken:"{0}")'.format(refresh_token), """newToken""") with flask_app.test_request_context():
Remove f-strings for python backward compatibility
py
diff --git a/openpnm/utils/Workspace.py b/openpnm/utils/Workspace.py index <HASH>..<HASH> 100644 --- a/openpnm/utils/Workspace.py +++ b/openpnm/utils/Workspace.py @@ -65,7 +65,7 @@ class Workspace(dict): if Workspace.__instance__ is None: Workspace.__instance__ = dict.__new__(cls) cls.settings = SettingsDict() - cls.settings['loglevel'] = 40 + cls.settings['loglevel'] = 30 return Workspace.__instance__ def __init__(self):
Change default loglevel from <I> to <I> (warnings are now showed by default)
py
diff --git a/pyvisa/__init__.py b/pyvisa/__init__.py index <HASH>..<HASH> 100644 --- a/pyvisa/__init__.py +++ b/pyvisa/__init__.py @@ -19,7 +19,8 @@ import sys import pkg_resources import subprocess import ConfigParser -import vpp43 + +from . import vpp43 __version__ = "unknown" try: # try to grab the commit version of our package @@ -28,7 +29,7 @@ try: # try to grab the commit version of our package cwd=os.path.dirname(os.path.abspath(__file__)))).strip() except: # on any error just try to grab the version that is installed on the system try: - __version__ = pkg_resources.get_distribution('pint').version + __version__ = pkg_resources.get_distribution('pyvisa').version except: pass # we seem to have a local copy without any repository control or installed without setuptools # so the reported version will be __unknown__
Changed version detection See #<I>
py
diff --git a/mimesis/schema.py b/mimesis/schema.py index <HASH>..<HASH> 100755 --- a/mimesis/schema.py +++ b/mimesis/schema.py @@ -14,7 +14,7 @@ from mimesis.exceptions import ( from mimesis.providers.generic import Generic from mimesis.typing import JSON, Seed -__all__ = ['AbstractField', 'Field', 'Schema'] +__all__ = ['Field', 'Schema'] class AbstractField(object):
Remove AbstractField from schema.__all__
py