diff
stringlengths
139
3.65k
message
stringlengths
8
627
diff_languages
stringclasses
1 value
diff --git a/log.py b/log.py index <HASH>..<HASH> 100644 --- a/log.py +++ b/log.py @@ -31,7 +31,10 @@ class Log: # emulate backslashreplace error handler encoding = stream.encoding msg = msg.encode(encoding, "backslashreplace").decode(encoding) - stream.write('%s\n' % msg) + try: + stream.write('%s\n' % msg) + except UnicodeEncodeError: + stream.write('%s\n' % msg.encode('unicode-escape').decode('ascii')) stream.flush() def log(self, level, msg, *args):
bpo-<I> avoid unicode error in distutils logging (GH-<I>) This caused installation errors in some cases on Windows. Patch by Julien Malard.
py
diff --git a/gdspy/path.py b/gdspy/path.py index <HASH>..<HASH> 100644 --- a/gdspy/path.py +++ b/gdspy/path.py @@ -538,9 +538,11 @@ class FlexPath(object): self.n = 1 self.offsets = [offset] self.widths = [width] * self.n + self.points = numpy.array(points) + if self.points.shape == (2,): + self.points.resize((1, 2)) self.widths = numpy.tile(self.widths, (len(points), 1)) self.offsets = numpy.tile(self.offsets, (len(points), 1)) - self.points = numpy.array(points) if isinstance(ends, list): self.ends = [ends[i % len(ends)] for i in range(self.n)] else:
Accept single point for FlexPath initialization #<I>
py
diff --git a/pyramid_skosprovider/views.py b/pyramid_skosprovider/views.py index <HASH>..<HASH> 100644 --- a/pyramid_skosprovider/views.py +++ b/pyramid_skosprovider/views.py @@ -86,11 +86,9 @@ class ProviderView(RestView): #Result sorting if sort: - sort_desc = False - if sort[0] in ['+', '-', ' ']: # ' ' is urlencoded representation of '+' - if sort[0] == '-': - sort_desc = True - sort = sort[1:] + sort_desc = (sort[0:1] == '-') + sort = sort[1:] if sort[0:1] in ['-', '+'] else sort + sort = sort.strip() # dojo store does not encode '+' if (len(concepts) > 0) and (sort in concepts[0]): concepts.sort(key=lambda concept: concept[sort], reverse=sort_desc)
Slightly different way of handling spaces in sort param. Refs #5.
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ setup( '': ['*.txt', '*.md', '*.rst', '*.json', '*.conf', '*.html', '*.css', '*.ico', '*.png', 'LICENSE', 'LEGAL', '*.sovrin']}, include_package_data=True, - install_requires=['sovrin-common-dev==0.2.51', 'anoncreds-dev==0.3.8'], + install_requires=['sovrin-common-dev==0.2.52', 'anoncreds-dev==0.3.8'], setup_requires=['pytest-runner'], tests_require=['pytest', 'sovrin-node-dev==0.3.81'], scripts=['scripts/sovrin', 'scripts/change_node_ha',
Updated sovrin-common-dev dependency.
py
diff --git a/bokeh/server/serverbb.py b/bokeh/server/serverbb.py index <HASH>..<HASH> 100644 --- a/bokeh/server/serverbb.py +++ b/bokeh/server/serverbb.py @@ -60,6 +60,7 @@ class ContinuumModelsStorage(object): return result def add(self, model, retries=10): + model.set('created', True) try: with self.client.pipeline() as pipe: self._upsert(pipe, model)
setting created inside serverbb, instead of inside views
py
diff --git a/keyboard/__init__.py b/keyboard/__init__.py index <HASH>..<HASH> 100644 --- a/keyboard/__init__.py +++ b/keyboard/__init__.py @@ -94,7 +94,7 @@ def matches(event, name): or 'right ' + normalized == event.name ) - return matched_name or _os_keyboard.map_char(name) == event.scan_code + return matched_name or _os_keyboard.map_char(name)[0] == event.scan_code def is_pressed(key): """
Fix bug that caused 'matches' to ignore scan codes
py
diff --git a/geomdl/fitting.py b/geomdl/fitting.py index <HASH>..<HASH> 100644 --- a/geomdl/fitting.py +++ b/geomdl/fitting.py @@ -235,22 +235,16 @@ def compute_knot_vector(degree, num_points, params): :return: knot vector :rtype: list """ - # Number of start and end knots - m_ends = degree + 1 - # Number of middle knots - m_compute = len(num_points) - degree - 1 - # Start knot vector - kv = [0.0 for _ in range(m_ends)] + kv = [0.0 for _ in range(degree + 1)] - # Use averaging method (Eqn 9.8) to compute middle knots in the knot vector - if m_compute > 0: - for i in range(m_compute): - temp_kv = (1.0 / degree) * sum([params[j] for j in range(i + 1, i + degree + 1)]) - kv.append(temp_kv) + # Use averaging method (Eqn 9.8) to compute internal knots in the knot vector + for i in range(num_points - degree - 1): + temp_kv = (1.0 / degree) * sum([params[j] for j in range(i + 1, i + degree + 1)]) + kv.append(temp_kv) # End knot vector - kv += [1.0 for _ in range(m_ends)] + kv += [1.0 for _ in range(degree + 1)] return kv
Fix errors in compute_knot_vector
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ setuptools.setup( "build_ext": BuildExtension, "test": Test }, - description="", + description="An open source image processing library", ext_modules=Cython.Build.cythonize([ setuptools.Extension( name="_cpmorphology",
Update setup.py Adding `description`
py
diff --git a/polyaxon/scheduler/spawners/templates/pod_manager.py b/polyaxon/scheduler/spawners/templates/pod_manager.py index <HASH>..<HASH> 100644 --- a/polyaxon/scheduler/spawners/templates/pod_manager.py +++ b/polyaxon/scheduler/spawners/templates/pod_manager.py @@ -194,7 +194,7 @@ class BasePodManager(object): return client.V1PodSpec( restart_policy=restart_policy, service_account_name=service_account_name, - init_containers=to_list(self.get_init_container(persistence_outputs)), + init_containers=to_list(self.get_init_container(persistence_outputs), check_none=True), containers=containers, volumes=volumes, node_selector=node_selector,
Fix pod manager condition on init container
py
diff --git a/osuapi/model.py b/osuapi/model.py index <HASH>..<HASH> 100644 --- a/osuapi/model.py +++ b/osuapi/model.py @@ -159,6 +159,7 @@ class SoloScore(Score): beatmap_id = Attribute(int) pp = Attribute(Nullable(float)) enabled_mods = Attribute(PreProcessInt(OsuMod)) + score_id = Attribute(int) date = Attribute(DateConverter) def __repr__(self):
SoloScore now also has score_id
py
diff --git a/distutils/command/install.py b/distutils/command/install.py index <HASH>..<HASH> 100644 --- a/distutils/command/install.py +++ b/distutils/command/install.py @@ -406,7 +406,7 @@ class install(Command): def _load_schemes(self): """ - Allow sysconfig and runtime behaviors to alter schemes. + Allow sysconfig to alter schemes. """ schemes = dict(INSTALL_SCHEMES) @@ -414,24 +414,9 @@ class install(Command): try: import sysconfig schemes.update(sysconfig.INSTALL_SCHEMES) - return schemes except (ImportError, AttributeError): pass - # debian: - def is_deb_system(): - # TODO: how to solicit without an additional parameter to build? - return self.install_layout.lower() == 'deb' - - if is_deb_system(): - schemes['unix_prefix'] = { - 'purelib': '$base/lib/python3/dist-packages', - 'platlib': '$platbase/lib/python3/dist-packages', - 'headers': '$base/include/python$py_version_short/$dist_name', - 'scripts': '$base/bin', - 'data' : '$base', - } - return schemes def finalize_unix(self):
Remove special casing for Debian. Instead, Debian should make sure the schemes are updated in sysconfig.
py
diff --git a/MAVProxy/tools/MAVExplorer.py b/MAVProxy/tools/MAVExplorer.py index <HASH>..<HASH> 100755 --- a/MAVProxy/tools/MAVExplorer.py +++ b/MAVProxy/tools/MAVExplorer.py @@ -775,8 +775,8 @@ def extract_files(): if m is None: break if not m.FileName in ret: - ret[m.FileName] = '' - ret[m.FileName] += m.Data + ret[m.FileName] = bytes() + ret[m.FileName] += m.Data[:m.Length] mestate.mlog.rewind() return ret @@ -786,7 +786,7 @@ def cmd_file(args): if len(args) == 0: # list for n in sorted(files.keys()): - print(n) + print("%s (length %u)" % (n, len(files[n]))) return fname = args[0] if not fname in files: @@ -798,7 +798,7 @@ def cmd_file(args): else: # save to file dest = args[1] - open(dest, "w").write(files[fname]) + open(dest, "wb").write(files[fname]) print("Saved %s to %s" % (fname, dest)) def set_vehicle_name():
MAVExplorer: allow binary files in FILE
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,11 @@ coffee_files = [ 'struct.coffee', 'class.coffee', 'namespace.coffee', - 'typedef.coffee' + 'typedef.coffee', + 'variable.coffee', + 'function.coffee', + 'field.coffee', + 'constructor.coffee' ] class cldoc_build(build):
Added missing coffee files to setup.py
py
diff --git a/tests/test_meshes.py b/tests/test_meshes.py index <HASH>..<HASH> 100644 --- a/tests/test_meshes.py +++ b/tests/test_meshes.py @@ -82,12 +82,12 @@ def test_mesh_can_draw(): assert not mesh.vbos assert not mesh.vao - with pytest.raises(UnboundLocalError): - mesh.draw() +# with pytest.raises(UnboundLocalError): +# mesh.draw() - with default_shader: - mesh.draw() +# with default_shader: +# mesh.draw() - assert mesh.vao - assert mesh.vbos - assert len(mesh.vbos) == 3 # vertices, texcoords, and normals +# assert mesh.vao +# assert mesh.vbos +# assert len(mesh.vbos) == 3 # vertices, texcoords, and normals
stopping draw tests These tests are involved in the segfaults we're getting with Travis.
py
diff --git a/edisgo/data/import_data.py b/edisgo/data/import_data.py index <HASH>..<HASH> 100644 --- a/edisgo/data/import_data.py +++ b/edisgo/data/import_data.py @@ -102,6 +102,16 @@ def import_from_ding0(file, network): # Set more params network._id = network.mv_grid.id + # Update the weather_cell_ids in mv_grid to include the ones in lv_grids + # TODO: maybe get a better solution to push the weather_cell_ids in lv_grids but not in mv_grid but into the + # mv_grid.weather_cell_ids from within the Grid() object or the MVGrid() or LVGrid() + mv_weather_cell_id = network.mv_grid.weather_cells + for lvg in lv_grids: + if lvg.weather_cells: + for lv_w_id in lvg._weather_cells: + if not (lv_w_id in mv_weather_cell_id): + network.mv_grid._weather_cells.append(lv_w_id) + def _build_lv_grid(ding0_grid, network): """
Fixed weather cell id list for mv_grid Added the weather cell ids in the lv_grids into the list of weather cell ids in the mv_grid. It makes it easier to use this list to catch the correct feedin time series from oedb
py
diff --git a/freshen/noseplugin.py b/freshen/noseplugin.py index <HASH>..<HASH> 100644 --- a/freshen/noseplugin.py +++ b/freshen/noseplugin.py @@ -55,7 +55,8 @@ class ParseFailure(Failure): def __init__(self, parse_exception, tb, filename): self.parse_exception = parse_exception self.filename = filename - super(ParseFailure, self).__init__(parse_exception.__class__, parse_exception, tb) + address = TestAddress(filename).totuple() + super(ParseFailure, self).__init__(parse_exception.__class__, parse_exception, tb, address) def __str__(self): return "Could not parse %s" % (self.filename) @@ -149,7 +150,7 @@ class FreshenNosePlugin(Plugin): feat = load_feature(filename, self.language) path = os.path.dirname(filename) except ParseException, e: - ec, ev, tb = sys.exc_info() + _, _, tb = sys.exc_info() yield ParseFailure(e, tb, filename) return
support parse error in PyDev (closes #<I>)
py
diff --git a/textract/parsers/tesseract.py b/textract/parsers/tesseract.py index <HASH>..<HASH> 100644 --- a/textract/parsers/tesseract.py +++ b/textract/parsers/tesseract.py @@ -6,7 +6,7 @@ def extract(filename, **kwargs): # Tesseract can't output to console directly so you must first create # a dummy file to write to, read, and then delete stdout, stderr = run( - 'tesseract %(filename)s tmpout && cat tmpout.txt && rm -f tmpout.txt' + 'tesseract - - <%(filename)s' % locals() ) return stdout
apparently tesseract <I> supports stdout!
py
diff --git a/km3pipe/tests/test_dataclasses.py b/km3pipe/tests/test_dataclasses.py index <HASH>..<HASH> 100644 --- a/km3pipe/tests/test_dataclasses.py +++ b/km3pipe/tests/test_dataclasses.py @@ -642,6 +642,22 @@ class TestTableFancyAttributes(TestCase): 'dir_z': [7, 8, 9]}) assert np.allclose([[2, 5, 8]], tab.dir[1]) + def test_dir_setter(self): + tab = Table({'dir_x': [1, 0, 0], + 'dir_y': [0, 1, 0], + 'dir_z': [0, 0, 1]}) + new_dir = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + tab.dir = new_dir + assert np.allclose(new_dir, tab.dir) + + def test_pos_setter(self): + tab = Table({'pos_x': [1, 0, 0], + 'pos_y': [0, 1, 0], + 'pos_z': [0, 0, 1]}) + new_pos = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + tab.pos = new_pos + assert np.allclose(new_pos, tab.pos) + def test_same_shape_pos(self): with pytest.raises(AttributeError): p = self.arr_bare.pos
Add explicit tests for pos/dir setter
py
diff --git a/model_utils/managers.py b/model_utils/managers.py index <HASH>..<HASH> 100644 --- a/model_utils/managers.py +++ b/model_utils/managers.py @@ -247,7 +247,7 @@ class QueryManager(QueryManagerMixin, models.Manager): pass -class SoftDeletableQuerySet(QuerySet): +class SoftDeletableQuerySetMixin(object): """ QuerySet for SoftDeletableModel. Instead of removing instance sets its ``is_removed`` field to True. @@ -261,7 +261,11 @@ class SoftDeletableQuerySet(QuerySet): self.update(is_removed=True) -class SoftDeletableManager(models.Manager): +class SoftDeletableQuerySet(SoftDeletableQuerySetMixin, QuerySet): + pass + + +class SoftDeletableManagerMixin(object): """ Manager that limits the queryset by default to show only not removed instances of model. @@ -280,3 +284,7 @@ class SoftDeletableManager(models.Manager): return self._queryset_class(**kwargs).filter(is_removed=False) get_query_set = get_queryset + + +class SoftDeletableManager(SoftDeletableManagerMixin, models.Manager): + pass
Split SoftDeletableQuerySet/Manager into Mixin
py
diff --git a/examples/simple_threaded_publisher.py b/examples/simple_threaded_publisher.py index <HASH>..<HASH> 100644 --- a/examples/simple_threaded_publisher.py +++ b/examples/simple_threaded_publisher.py @@ -13,7 +13,6 @@ try: def send_messages(connection): start_time = time.time() channel = connection.channel() - channel.confirm_deliveries() messages_sent = 0 while True: channel.basic.publish('Hey World!', 'simple_queue') @@ -24,9 +23,6 @@ try: messages_sent += 1 connection = Connection('127.0.0.1', 'guest', 'guest') - channel = connection.channel() - channel.queue.declare('simple_queue') - # channel.queue.purge('simple_queue') threads = [] for index in xrange(2):
Removed confirm_delivery from thread publish example.
py
diff --git a/labsuite/labware/deck.py b/labsuite/labware/deck.py index <HASH>..<HASH> 100644 --- a/labsuite/labware/deck.py +++ b/labsuite/labware/deck.py @@ -42,7 +42,7 @@ class Deck(GridContainer): if pos not in self._children: raise KeyError( "No deck module at slot {}/{}." - .format(position.upper(), pos) + .format(humanize_position(pos), pos) ) return self._children[pos]
Deck: Fixed some bitrot on how positions are output.
py
diff --git a/sevenbridges/meta/resource.py b/sevenbridges/meta/resource.py index <HASH>..<HASH> 100644 --- a/sevenbridges/meta/resource.py +++ b/sevenbridges/meta/resource.py @@ -180,9 +180,6 @@ class Resource(six.with_metaclass(ResourceMeta)): """ try: if hasattr(self, 'href'): - query = {'id': self.id} if hasattr(self, 'id') else {} - extra = {'resource': self.__class__.__name__, 'query': query} - logger.info('Reloading {} resource.'.format(self), extra=extra) data = self._api.get(self.href, append_base=False).json() resource = self.__class__(api=self._api, **data) elif hasattr(self, 'id') and hasattr(self, '_URL') and \ @@ -192,6 +189,11 @@ class Resource(six.with_metaclass(ResourceMeta)): resource = self.__class__(api=self._api, **data) else: raise SbgError('Resource can not be refreshed!') + + query = {'id': self.id} if hasattr(self, 'id') else {} + extra = {'resource': self.__class__.__name__, 'query': query} + logger.info('Reloading {} resource.'.format(self), extra=extra) + except Exception: raise SbgError('Resource can not be refreshed!')
Log reloads for models without href as well
py
diff --git a/pluginutils_unit_tests.py b/pluginutils_unit_tests.py index <HASH>..<HASH> 100644 --- a/pluginutils_unit_tests.py +++ b/pluginutils_unit_tests.py @@ -37,12 +37,12 @@ class TestPluginContainer(unittest.TestCase): """ PluginContainer TestSuite. """ - def FIXME_test_plugin_container_wrapping_bibformat_elements(self): + def test_plugin_container_wrapping_bibformat_elements(self): """pluginutils - wrapping bibformat elements""" - def format_signature(dummy_bfo, *dummy_args, **dummy_argd): + def format_signature(bfo, *dummy_args, **dummy_argd): pass - def escape_values_signature(dummy_bfo): + def escape_values_signature(bfo): pass plugin_builder = create_enhanced_plugin_builder(
pluginutils: fix for failing bibformat test case * Fixes broken test case caused by 'dummy_' variable prefix which made the pluginbuilder's function-signature incompatible with the bibformat elements.
py
diff --git a/eth_utils/currency.py b/eth_utils/currency.py index <HASH>..<HASH> 100644 --- a/eth_utils/currency.py +++ b/eth_utils/currency.py @@ -83,7 +83,7 @@ def to_wei(number, unit): with localcontext() as ctx: multiplier = len(s_number) - s_number.index('.') - 1 ctx.prec = multiplier - d_number = decimal.Decimal(value=number, context = ctx) * 10**multiplier + d_number = decimal.Decimal(value=number, context=ctx) * 10**multiplier unit_value /= 10**multiplier result_value = d_number * unit_value
Fixed issue with spaces (E<I>).
py
diff --git a/snakebite/commandlineparser.py b/snakebite/commandlineparser.py index <HASH>..<HASH> 100644 --- a/snakebite/commandlineparser.py +++ b/snakebite/commandlineparser.py @@ -581,7 +581,7 @@ class CommandLineParser(object): for load in file_to_read: sys.stdout.write(load) - @command(args="path dst", descr="copy local file reference to destination", req_args=['dir [dirs]', 'arg']) + @command(args="path dst", descr="copy local file reference to destination", req_args=['dir [dirs]', 'arg'], visible=False) def copyFromLocal(self): src = self.args.dir dst = self.args.single_arg @@ -597,7 +597,7 @@ class CommandLineParser(object): for line in format_results(result, json_output=self.args.json): print line - @command(args="[paths] dst", descr="copy files from source to destination", allowed_opts=['checkcrc'], req_args=['dir [dirs]', 'arg']) + @command(args="[paths] dst", descr="copy files from source to destination", allowed_opts=['checkcrc'], req_args=['dir [dirs]', 'arg'], visible=False) def cp(self): paths = self.args.dir dst = self.args.single_arg
Disable copyFromLocal and cp. Both copyFromLocal and cp are not implemented in client.
py
diff --git a/salt/runner.py b/salt/runner.py index <HASH>..<HASH> 100644 --- a/salt/runner.py +++ b/salt/runner.py @@ -278,7 +278,7 @@ class Runner(RunnerClient): outputter = None display_output(ret, outputter, self.opts) else: - ret = self._proc_function_local( + ret = self._proc_function( self.opts["fun"], low, user,
Call the right function since `_proc_function_local` was removed
py
diff --git a/threat_intel/util/http.py b/threat_intel/util/http.py index <HASH>..<HASH> 100644 --- a/threat_intel/util/http.py +++ b/threat_intel/util/http.py @@ -240,6 +240,17 @@ class MultiRequest(object): return zip(urls, query_params, data) + def _handle_exception(self, request, exception): + """Handles grequests exception (timeout, etc.). + + Args: + request - A request that caused the exception + exception - An exception caused by the request + Raises: + InvalidRequestError - custom exception encapsulating grequests exception + """ + raise InvalidRequestError('Request to {0} caused an exception: {1}'.format(request.url, exception)) + def _wait_for_response(self, requests, to_json): """Issue a batch of requests and wait for the responses. @@ -253,7 +264,7 @@ class MultiRequest(object): for retry in range(self._max_retry): try: - responses = grequests.map(requests) + responses = grequests.map(requests, self._handle_exception) valid_responses = [response for response in responses if response] if any(response is not None and response.status_code == 403 for response in responses):
Added grequests exception handling method
py
diff --git a/rakuten/apis/travel_api.py b/rakuten/apis/travel_api.py index <HASH>..<HASH> 100644 --- a/rakuten/apis/travel_api.py +++ b/rakuten/apis/travel_api.py @@ -13,7 +13,13 @@ class TravelApi(BaseApi): r = requests.get(url, params=params) if r.status_code == 200: result = r.json() - hotels = [r['hotel'] for r in result['hotels']] + hotels = [self._parse_hotel(r) for r in result['hotels']] return hotels else: raise RakutenApiException(r.status_code, r.text) + + def _parse_hotel(self, hotel_info): + hotel = hotel_info['hotel'][0]['hotelBasicInfo'] + room_infos = [r['roomInfo'][0]['roomBasicInfo'] for r in hotel_info['hotel'] if 'roomInfo' in r] + hotel['room_infos'] = room_infos + return hotel
Improve vacant_hotel_search parsing.
py
diff --git a/datacats/cli/pull.py b/datacats/cli/pull.py index <HASH>..<HASH> 100644 --- a/datacats/cli/pull.py +++ b/datacats/cli/pull.py @@ -19,7 +19,8 @@ IMAGES = [ EXTRA_IMAGES = [ 'datacats/lessc', - 'datacats/ckan:latest' + 'datacats/ckan:latest', + 'datacats/ckan:2.3' ]
include datacats/ckan:<I> for completeness
py
diff --git a/pythonforandroid/toolchain.py b/pythonforandroid/toolchain.py index <HASH>..<HASH> 100755 --- a/pythonforandroid/toolchain.py +++ b/pythonforandroid/toolchain.py @@ -1672,7 +1672,7 @@ class Recipe(object): info('Extracting {} at {}'.format(extraction_filename, filename)) sh.tar('xjf', extraction_filename) root_directory = sh.tar('tjf', extraction_filename).stdout.decode( - 'utf-8').split('\n')[0].strip('/') + 'utf-8').split('\n')[0].split('/')[0] if root_directory != directory_name: shprint(sh.mv, root_directory, directory_name) elif extraction_filename.endswith('.zip'):
Update toolchain.py tar.bz2 unpacking, twisted recipe faults with "OSError: [Errno <I>] Not a directory" fixed
py
diff --git a/safe/definitions/versions.py b/safe/definitions/versions.py index <HASH>..<HASH> 100644 --- a/safe/definitions/versions.py +++ b/safe/definitions/versions.py @@ -8,11 +8,12 @@ __email__ = "info@inasafe.org" __revision__ = '$Format:%H$' # InaSAFE Keyword Version compatibility. -inasafe_keyword_version = '4.1' +inasafe_keyword_version = '4.2' keyword_version_compatibilities = { # 'InaSAFE keyword version': 'List of supported InaSAFE keyword version' '3.3': ['3.2'], '3.4': ['3.2', '3.3'], '3.5': ['3.4', '3.3'], '4.1': ['4.0'], + '4.2': ['4.1', '4.0'], }
Updated versions.py keywords compatibility list
py
diff --git a/tests/sign_test.py b/tests/sign_test.py index <HASH>..<HASH> 100644 --- a/tests/sign_test.py +++ b/tests/sign_test.py @@ -26,7 +26,7 @@ from minio.signer import generate_canonical_request, generate_string_to_sign, ge __author__ = 'minio' empty_hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' -dt = datetime(2015, 06, 20, 1, 2, 3, 0, pytz.utc) +dt = datetime(2015, 6, 20, 1, 2, 3, 0, pytz.utc) class CanonicalRequestTest(TestCase):
Changing test to use dceimal rather than octal
py
diff --git a/metpy/plots/station_plot.py b/metpy/plots/station_plot.py index <HASH>..<HASH> 100644 --- a/metpy/plots/station_plot.py +++ b/metpy/plots/station_plot.py @@ -250,6 +250,8 @@ class StationPlot(object): The data to use for the u-component of the barbs. v : array-like The data to use for the v-component of the barbs. + plot_units: `pint.unit` + Units to plot in (performing conversion if necessary). Defaults to given units. kwargs Additional keyword arguments to pass to matplotlib's :meth:`~matplotlib.axes.Axes.barbs` function. @@ -261,6 +263,16 @@ class StationPlot(object): """ kwargs = self._make_kwargs(kwargs) + # If plot_units specified, convert the data to those units + plotting_units = kwargs.pop('plot_units', None) + if plotting_units: + if hasattr(u, 'units') and hasattr(v, 'units'): + u = u.to(plotting_units) + v = v.to(plotting_units) + else: + raise ValueError('To convert to plotting units, units must be attached to ' + 'u and v wind components.') + # Strip units, CartoPy transform doesn't like u = np.array(u) v = np.array(v)
Add unit conversion capability to plot_barbs.
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from setuptools import setup, find_packages import sys +from io import open # Python 2 compatibility + +from setuptools import setup, find_packages from getmac.getmac import __version__
Fix Python 2 issue with setup.py (This is what I get for not following my own rules and testing before push)
py
diff --git a/tests/examples/user_code/worker.py b/tests/examples/user_code/worker.py index <HASH>..<HASH> 100644 --- a/tests/examples/user_code/worker.py +++ b/tests/examples/user_code/worker.py @@ -13,7 +13,7 @@ app.conf.resultrepr_maxsize = 100 * 1024 # to not truncate args and kwargs unti def function_test(self, retries, **kwargs): if retries > self.request.retries: raise self.retry(countdown=2) - return 'this is the result' + return kwargs.get('result', 'this is the result') @app.task
example supporting to return what I want used to test task without result (None) vs result ''
py
diff --git a/dusty/cli/test.py b/dusty/cli/test.py index <HASH>..<HASH> 100644 --- a/dusty/cli/test.py +++ b/dusty/cli/test.py @@ -2,14 +2,14 @@ If args are passed, default arguments are dropped Usage: - test [options] <app_or_lib_name> [--all] [<suite_name>] [<args>...] + test [options] <app_or_lib_name> [<suite_name>] [<args>...] Options: <suite_name> Name of the test suite you would like to run + This can also be --all to run all suites in the spec <args> A list of arguments to be passed to the test script --recreate Ensures that the testing image will be recreated --no-pull Do not pull dusty managed repos from remotes. - --all Run all test suites Examples: To call test suite frontend with default arguments: @@ -27,7 +27,7 @@ from ..commands.test import (run_app_or_lib_tests, test_info_for_app_or_lib, pul def main(argv): args = docopt(__doc__, argv, options_first=True) - if args['--all']: + if args['<suite_name>'] == '--all': payload0 = Payload(pull_repos_and_sync, args['<app_or_lib_name>'], pull_repos=not args['--no-pull'])
standardize on using --all in place of suite_name
py
diff --git a/bcbio/structural/metasv.py b/bcbio/structural/metasv.py index <HASH>..<HASH> 100644 --- a/bcbio/structural/metasv.py +++ b/bcbio/structural/metasv.py @@ -26,9 +26,10 @@ def run(items): "--bam", dd.get_align_bam(data), "--outdir", work_dir] methods = [] for call in data.get("sv", []): - if call["variantcaller"] in SUPPORTED and call["variantcaller"] not in methods: + vcf_file = call.get("vcf_file", call.get("vrn_file", None)) + if call["variantcaller"] in SUPPORTED and call["variantcaller"] not in methods and vcf_file is not None: methods.append(call["variantcaller"]) - cmd += ["--%s_vcf" % call["variantcaller"], call.get("vcf_file", call["vrn_file"])] + cmd += ["--%s_vcf" % call["variantcaller"], vcf_file] if len(methods) >= MIN_CALLERS: if not utils.file_exists(out_file): tx_work_dir = utils.safe_makedir(os.path.join(work_dir, "raw"))
Ensured VCF file input for metasv.py is not None.
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( url = 'https://github.com/roanuz/py-cricket', package_dir={'': 'src'}, packages=[''], - install_requires=['requests==2.5.1'], + install_requires=['requests>=2.5.1'], entry_points=''' [console_scripts] pycricket=src.pycricket:RcaApp
REquest is on permanent feature freeze. API is unlikely to break
py
diff --git a/twittytwister/twitter.py b/twittytwister/twitter.py index <HASH>..<HASH> 100644 --- a/twittytwister/twitter.py +++ b/twittytwister/twitter.py @@ -662,4 +662,21 @@ class TwitterFeed(Twitter): """ return self.filter(delegate, {'track': ','.join(terms)}) + + def user(self, delegate, withFollowings=False, allReplies=False, + follow=None, terms=None): + args = {} + if withFollowings: + args['with'] = 'followings' + if allReplies: + args['replies'] = 'all' + if follow: + args['follow'] = ','.join(follow) + if terms: + args['track'] = ','.join(terms) + + return self._rtfeed('https://userstream.twitter.com/2/user.json', + delegate, + args) + # vim: set expandtab:
First stab at support for User Streams.
py
diff --git a/dispatch/api/validators.py b/dispatch/api/validators.py index <HASH>..<HASH> 100644 --- a/dispatch/api/validators.py +++ b/dispatch/api/validators.py @@ -50,8 +50,13 @@ class SlugValidator(object): raise ValidationError('%s with slug \'%s\' already exists.' % (self.model.__name__, slug)) def AuthorValidator(data): + """Raise a ValidationError if data does not match the author format.""" + if not isinstance(data, list): + # Convert single instance to a list + data = [data] + for author in data: - if 'person' not in data: + if 'person' not in author: raise ValidationError('An author must contain a person.') - if 'type' not in data: + if 'type' not in author: raise ValidationError('A type must be defined for each author.')
Update AuthorValidator to support list and single instances
py
diff --git a/docker/client.py b/docker/client.py index <HASH>..<HASH> 100644 --- a/docker/client.py +++ b/docker/client.py @@ -306,8 +306,8 @@ class Client(clientbase.ClientBase): return self._result(res, True) def exec_inspect(self, exec_id): - if utils.compare_version('1.15', self._version) < 0: - raise errors.InvalidVersion('Exec is not supported in API < 1.15') + if utils.compare_version('1.16', self._version) < 0: + raise errors.InvalidVersion('Exec is not supported in API < 1.16') if isinstance(exec_id, dict): exec_id = exec_id.get('Id') res = self._get(self._url("/exec/{0}/json".format(exec_id)))
Change minimum API version for exec_inspect
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -37,8 +37,10 @@ def get_version(): with open(version_file) as f: return f.read() except: - print("Error: please create a file", version_file, "with the tile-generator version in it.", file=sys.stderr) - raise + version = '0.0.0' + print("Warning: Generating default version", version, file=sys.stderr) + print("To override this, please create a file", version_file, "with the tile-generator version in it.", file=sys.stderr) + return version setup( name = "tile-generator",
Default version to <I> to enable local builds without creating a version.txt
py
diff --git a/twstock/analytics.py b/twstock/analytics.py index <HASH>..<HASH> 100644 --- a/twstock/analytics.py +++ b/twstock/analytics.py @@ -30,6 +30,7 @@ class LegacyAnalytics(object): :rtype: 序列 舊→新 """ result = [] + data = data[:] for dummy in range(len(data) - int(days) + 1): result.append(round(sum(data[-days:]) / days, 2)) data.pop()
Fix legacy moving_average affect data problem
py
diff --git a/src/livestreamer/plugins/twitch.py b/src/livestreamer/plugins/twitch.py index <HASH>..<HASH> 100644 --- a/src/livestreamer/plugins/twitch.py +++ b/src/livestreamer/plugins/twitch.py @@ -30,7 +30,7 @@ QUALITY_WEIGHTS = { _url_re = re.compile(r""" http(s)?:// (?: - (?P<subdomain>\w+) + (?P<subdomain>[\w\-]+) \. )? twitch.tv
plugins.twitch: Handle subdomains with dash in them, e.g. en-gb. Resolves #<I>.
py
diff --git a/src/ossos-pipeline/ossos/orbfit.py b/src/ossos-pipeline/ossos/orbfit.py index <HASH>..<HASH> 100644 --- a/src/ossos-pipeline/ossos/orbfit.py +++ b/src/ossos-pipeline/ossos/orbfit.py @@ -351,10 +351,10 @@ class Orbfit(object): predict = self.orbfit.predict(ctypes.c_char_p(abg_file.name), jd, ctypes.c_int(obs_code)) - self._coordinate = ICRSCoordinates(predict.contents[0], - predict.contents[1], - unit=(units.degree, units.degree), - obstime=date) + self._coordinate = SkyCoord(predict.contents[0], + predict.contents[1], + unit=(units.degree, units.degree), + obstime=date) self._dra = predict.contents[2] * units.arcsec self._ddec = predict.contents[3] * units.arcsec self._pa = predict.contents[4] * units.degree
Switched to use SkyCoord instead of ICRSCoordinates. astropy 1.X has adopted a generic SkyCoord object that returns the specific type when system is set.
py
diff --git a/tldr.py b/tldr.py index <HASH>..<HASH> 100755 --- a/tldr.py +++ b/tldr.py @@ -414,11 +414,11 @@ def main(): options.language ) if not result: - print(( + sys.exit(( "`{cmd}` documentation is not available. " "Consider contributing Pull Request to " "https://github.com/tldr-pages/tldr" - ).format(cmd=command), file=sys.stderr) + ).format(cmd=command)) else: output(result) except URLError as e:
Exit with exit code 1 when command not found (#<I>)
py
diff --git a/latex2text.py b/latex2text.py index <HASH>..<HASH> 100644 --- a/latex2text.py +++ b/latex2text.py @@ -92,6 +92,8 @@ macro_list = [ ('o', u'\u00f8'), # o norvegien/nordique ('O', u'\u00d8'), # O norvegien/nordique ('ss', u'\u00df'), # s-z allemand + ('L', u"\N{LATIN CAPITAL LETTER L WITH STROKE}"), + ('l', u"\N{LATIN SMALL LETTER L WITH STROKE}"), ("~", "~" ), ("&", "&" ),
added \l and \L for latex2text
py
diff --git a/stellar_sdk/exceptions.py b/stellar_sdk/exceptions.py index <HASH>..<HASH> 100644 --- a/stellar_sdk/exceptions.py +++ b/stellar_sdk/exceptions.py @@ -131,7 +131,7 @@ class BaseHorizonError(BaseRequestError): self.status: Optional[int] = message.get("status") self.detail: Optional[str] = message.get("detail") self.extras: Optional[dict] = message.get("extras") - self.result_xdr: Optional[str] = message.get("result_xdr") + self.result_xdr: Optional[str] = message.get("extras", {}).get("result_xdr") def __str__(self): return self.message
fix: BaseHorizonError.result_xdr is populated incorrectly in __init__.py (#<I>)
py
diff --git a/blockstack_client/rpc.py b/blockstack_client/rpc.py index <HASH>..<HASH> 100644 --- a/blockstack_client/rpc.py +++ b/blockstack_client/rpc.py @@ -5401,8 +5401,8 @@ def local_api_start( port=None, host=None, config_dir=blockstack_constants.CONFI log.debug("Initializing registrar...") state = backend.registrar.set_registrar_state(config_path=config_path, wallet_keys=wallet) if state is None: - log.error("Failed to initialize registrar: {}".format(res['error'])) - return {'error': 'Failed to initialize registrar: {}'.format(res['error'])} + log.error("Failed to initialize registrar: failed to set registrar state") + return {'error': 'Failed to initialize registrar: failed to set registrar state'} log.debug("Setup finished")
fix error path reference to undeclared variable
py
diff --git a/helpers/postgresql.py b/helpers/postgresql.py index <HASH>..<HASH> 100644 --- a/helpers/postgresql.py +++ b/helpers/postgresql.py @@ -158,14 +158,15 @@ class Postgresql: # that we have to convert to hex and 'prepend' to the high offset digits. lsn_segment = backup_start_segment[8:16] - lsn_offset = hex(int(backup_start_segment[16:32], 16) << 24 + backup_start_offset)[2:] + # first 2 characters of the result are 0x and the last one is L + lsn_offset = hex((long(backup_start_segment[16:32], 16) << 24) + long(backup_start_offset))[2:-1] # construct the LSN from the segment and offset backup_start_lsn = '{}/{}'.format(lsn_segment, lsn_offset) conn = None cursor = None - diff_in_bytes = backup_size + diff_in_bytes = long(backup_size) try: # get the difference in bytes between the current WAL location and the backup start offset conn = psycopg2.connect(master_connurl)
some arithmetics and type conversion fixes.
py
diff --git a/openquake/baselib/tests/config_test.py b/openquake/baselib/tests/config_test.py index <HASH>..<HASH> 100644 --- a/openquake/baselib/tests/config_test.py +++ b/openquake/baselib/tests/config_test.py @@ -17,6 +17,7 @@ # along with OpenQuake. If not, see <http://www.gnu.org/licenses/>. import os +import logging import unittest from openquake.baselib import config @@ -26,9 +27,11 @@ class ConfigPathsTestCase(unittest.TestCase): def test_venv(self): venv = os.environ.get('VIRTUAL_ENV') - self.assertTrue(venv, 'You cannot run the tests, you must use a ' - 'development installation with a virtualenv!') - self.assertIn(os.path.join(venv, 'openquake.cfg'), config.paths) + if venv: + self.assertIn(os.path.join(venv, 'openquake.cfg'), config.paths) + else: + logging.warn('To run the tests, you should use a ' + 'development installation with a virtualenv') def test_config_file(self): cfgfile = os.environ.get('OQ_CONFIG_FILE')
Removed an assertion in ConfigPathsTestCase
py
diff --git a/glue/ligolw/ligolw.py b/glue/ligolw/ligolw.py index <HASH>..<HASH> 100644 --- a/glue/ligolw/ligolw.py +++ b/glue/ligolw/ligolw.py @@ -238,7 +238,7 @@ class Element(object): # modifies its internal data. probably not a good idea, # but I don't know how else to edit an attribute because # the stupid things don't export a method to do it. - self.attributes._attrs[attrname] = str(value) + self.attributes._attrs[attrname] = unicode(value) def appendData(self, content): """
"correct" a type in Element.setAttribute() in Element.setAttribute(), the value should be stored as a unicode.
py
diff --git a/nbrmd/__init__.py b/nbrmd/__init__.py index <HASH>..<HASH> 100644 --- a/nbrmd/__init__.py +++ b/nbrmd/__init__.py @@ -16,7 +16,7 @@ from .hooks import update_rmd, update_ipynb, \ update_rmd_and_ipynb, update_selected_formats try: - from .nbconvert import RMarkdownExporter + from .rmarkdownexporter import RMarkdownExporter except ImportError as e: RMarkdownExporter = str(e)
Renamed nbconvert to rmarkdownexporter
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -338,7 +338,7 @@ def create_pipes_ext(patched_src_dir, pipes_ext_name): include_dirs = [ "%s/%s/api" % (patched_src_dir, _) for _ in "pipes", "utils" ] - libraries = ["pthread", BOOST_PYTHON, "ssl"] + libraries = ["pthread", BOOST_PYTHON, ] #if HADOOP_VERSION_INFO.tuple != (0, 20, 2): #libraries.append("ssl") return BoostExtension(
removing ssl for all hadoop version
py
diff --git a/examples/custom.py b/examples/custom.py index <HASH>..<HASH> 100644 --- a/examples/custom.py +++ b/examples/custom.py @@ -11,7 +11,11 @@ class MyAstroidChecker(BaseChecker): __implements__ = IAstroidChecker name = 'custom' - msgs = {} + msgs = { + 'W0001': ('Message that will be emitted', + 'message-symbol', + 'Message help') + } options = () # this is important so that your checker is executed before others priority = -1
Add a message in the example checker, since the message is needed.
py
diff --git a/tests/test_i2c.py b/tests/test_i2c.py index <HASH>..<HASH> 100644 --- a/tests/test_i2c.py +++ b/tests/test_i2c.py @@ -54,6 +54,10 @@ def test_interactive(): print("Starting interactive test. Get out your logic analyzer, buddy!") raw_input("Press enter to continue...") + # Check tostring + print("I2C description: {}".format(str(i2c))) + assert raw_input("I2C description looks ok? y/n ") == "y" + # There isn't much we can do without assuming a device on the other end, # because I2C needs an acknowledgement bit on each transferred byte. #
tests/i2c: add tostring check to interactive test
py
diff --git a/werobot/client.py b/werobot/client.py index <HASH>..<HASH> 100644 --- a/werobot/client.py +++ b/werobot/client.py @@ -518,6 +518,9 @@ class Client(object): del pay_param[oldkey] pay_param[key] = t + # 不转成字符串 ios 会出错 + pay_param = dict([(str(k), str(v)) for k,v in pay_param.items()]) + return pay_param def create_native_pay_url(self, productid):
fix sign error in ios
py
diff --git a/pyradio/player.py b/pyradio/player.py index <HASH>..<HASH> 100644 --- a/pyradio/player.py +++ b/pyradio/player.py @@ -7,9 +7,6 @@ from sys import platform logger = logging.getLogger(__name__) -def updateTitle(*arg, **karg): - arg[0].write(arg[1]) - class Player(object): """ Media player class. Playing is handled by player sub classes """ process = None @@ -155,12 +152,15 @@ class Player(object): if self.a_thread.isAlive(): self.a_thread.cancel() try: - self.a_thread = threading.Timer(delay, updateTitle, [ self.outputStream, self.oldUserInput[2] ] ) + self.a_thread = threading.Timer(delay, self.updateTitle, [ self.outputStream, self.oldUserInput[2] ] ) self.a_thread.start() except: if (logger.isEnabledFor(logging.DEBUG)): logger.debug("title update thread start failed") + def updateTitle(self, *arg, **karg): + arg[0].write(arg[1]) + def isPlaying(self): return bool(self.process)
implementing threaded title delay when volume changed/saved
py
diff --git a/javalang/test/test_java_8_syntax.py b/javalang/test/test_java_8_syntax.py index <HASH>..<HASH> 100644 --- a/javalang/test/test_java_8_syntax.py +++ b/javalang/test/test_java_8_syntax.py @@ -34,7 +34,7 @@ class LambdaSupportTest(unittest.TestCase): if isinstance(p, tree.MethodDeclaration): self.assertEqual(p.name, method_name) return node, path - self.fail() + self.fail('No lambda expression found.') def test_lambda_support_no_parameters_no_body(self): """ tests support for lambda with no parameters and no body. """
set a fail message when no lambda expression is found.
py
diff --git a/automated_ebs_snapshots/snapshot_manager.py b/automated_ebs_snapshots/snapshot_manager.py index <HASH>..<HASH> 100644 --- a/automated_ebs_snapshots/snapshot_manager.py +++ b/automated_ebs_snapshots/snapshot_manager.py @@ -2,6 +2,8 @@ import logging import datetime +from boto.exception import EC2ResponseError + from automated_ebs_snapshots import volume_manager from automated_ebs_snapshots.valid_intervals import VALID_INTERVALS @@ -124,6 +126,10 @@ def _remove_old_snapshots(connection, volume): for snapshot in snapshots: logger.info('Deleting snapshot {}'.format(snapshot.id)) - snapshot.delete() + try: + snapshot.delete() + except EC2ResponseError as error: + logger.warning('Could not remove snapshot: {}'.format( + error.reason)) logger.info('Done deleting snapshots')
Now handling exceptions when deleting snapshots #4
py
diff --git a/h2o-test-integ/tests/s3n/pyunit_s3_bigdata_parsing_large.py b/h2o-test-integ/tests/s3n/pyunit_s3_bigdata_parsing_large.py index <HASH>..<HASH> 100644 --- a/h2o-test-integ/tests/s3n/pyunit_s3_bigdata_parsing_large.py +++ b/h2o-test-integ/tests/s3n/pyunit_s3_bigdata_parsing_large.py @@ -1,5 +1,5 @@ import sys, os, timeit -sys.path.insert(1, "../../../h2o-") +sys.path.insert(1, "../../../h2o-py") import h2o def s3timings(ip, port):
small fix to pyunit script
py
diff --git a/tests/test_commands.py b/tests/test_commands.py index <HASH>..<HASH> 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -209,10 +209,9 @@ class TestRedisCommands(object): def test_dump_and_restore(self, r): r['a'] = 'foo' dumped = r.dump('a') - assert dumped.startswith('\x00\x03foo') - assert r.delete('a') - assert r.restore('a', 0, dumped) - assert r.dump('a') == dumped + del r['a'] + r.restore('a', 0, dumped) + assert r['a'] == b('foo') def test_exists(self, r): assert not r.exists('a')
Simplify dump and restore test case - works with Python 3.x now.
py
diff --git a/raven/utils/serializer/base.py b/raven/utils/serializer/base.py index <HASH>..<HASH> 100644 --- a/raven/utils/serializer/base.py +++ b/raven/utils/serializer/base.py @@ -9,7 +9,6 @@ raven.utils.serializer.base from __future__ import absolute_import import itertools -import uuid import types from raven.utils import six @@ -76,13 +75,6 @@ class IterableSerializer(Serializer): ) -class UUIDSerializer(Serializer): - types = (uuid.UUID,) - - def serialize(self, value, **kwargs): - return repr(value) - - class DictSerializer(Serializer): types = (dict,) @@ -178,7 +170,6 @@ if not six.PY3: # register all serializers, order matters serialization_manager.register(IterableSerializer) -serialization_manager.register(UUIDSerializer) serialization_manager.register(DictSerializer) serialization_manager.register(UnicodeSerializer) serialization_manager.register(StringSerializer)
Remove UUID serializer (same as default behavior) Refs GH-<I>
py
diff --git a/skorch/exceptions.py b/skorch/exceptions.py index <HASH>..<HASH> 100644 --- a/skorch/exceptions.py +++ b/skorch/exceptions.py @@ -1,11 +1,13 @@ """Contains skorch-specific exceptions and warnings.""" +from sklearn.exceptions import NotFittedError + class SkorchException(BaseException): """Base skorch exception.""" -class NotInitializedError(SkorchException): +class NotInitializedError(SkorchException, NotFittedError): """Module is not initialized, please call the ``.initialize`` method or train the model by calling ``.fit(...)``.
NotInitializedError inherits from NotFittedError (#<I>) This ensures that a user can catch the sklearn `NotFittedError`, just as they can with regular sklearn estimators. As discussed in [1]. [1] <URL>
py
diff --git a/uncompyle6/scanners/tok.py b/uncompyle6/scanners/tok.py index <HASH>..<HASH> 100644 --- a/uncompyle6/scanners/tok.py +++ b/uncompyle6/scanners/tok.py @@ -2,7 +2,7 @@ # Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com> # Copyright (c) 1999 John Aycock -import sys +import re, sys from uncompyle6 import PYTHON3 if PYTHON3: @@ -71,8 +71,10 @@ class Token: elif self.op in self.opc.hascompare: if isinstance(self.attr, int): pattr = self.opc.cmp_op[self.attr] - # And so on. See xdis/bytecode.py get_instructions_bytes + # And so on. See xdis/bytecode.py get_instructions_bytes pass + elif re.search('_\d+$', self.type): + return "%s%s%s" % (prefix, offset_opname, argstr) else: pattr = '' return "%s%s%s %r" % (prefix, offset_opname, argstr, pattr)
Tidy assembly output a little more
py
diff --git a/mib/reflash.py b/mib/reflash.py index <HASH>..<HASH> 100644 --- a/mib/reflash.py +++ b/mib/reflash.py @@ -35,10 +35,10 @@ def build_reflasher(stub, payload, chip): oldret = Instruction('retlw 0') - if stub[start_addr] != Instruction('retlw 0').encode(): + if stub[start_addr] != Instruction('retlw 0xAB').encode(): raise ValueError("Invalid reflashing stub, wrong instruction at start_addr 0x%X" % start_addr) - if stub[size_addr] != Instruction('retlw 0').encode(): + if stub[size_addr] != Instruction('retlw 0xCD').encode(): raise ValueError("Invalid reflashing stub, wrong instruction at size_addr 0x%X" % size_addr) start_instr = 'retlw 0x%X' % start_row
Add marker instructions to idenfity reflashing module This lets mibtool more accurately infer if it's working with a real mib<I>_reflasher and minimizes the chances of an error occuring
py
diff --git a/discord/client.py b/discord/client.py index <HASH>..<HASH> 100644 --- a/discord/client.py +++ b/discord/client.py @@ -521,8 +521,7 @@ class Client: if resp.status == 400: raise LoginFailure('Improper credentials have been passed.') elif resp.status != 200: - data = yield from resp.json() - raise HTTPException(resp, data.get('message')) + raise HTTPException(resp, None) log.info('logging in returned status code {}'.format(resp.status)) self.email = email
Client.login no longer calls resp.json() aiohttp didn't like it.
py
diff --git a/O365/drive.py b/O365/drive.py index <HASH>..<HASH> 100644 --- a/O365/drive.py +++ b/O365/drive.py @@ -813,7 +813,7 @@ class Folder(DriveItem): url = self.build_url(self._endpoints.get('list_items').format(id=self.object_id)) - data = {'name': name} + data = {'name': name, 'folder': {}} if description: data['description'] = description
Drive: Fixed bug on Folder:create_child_folder
py
diff --git a/acos_client/v21/license_manager.py b/acos_client/v21/license_manager.py index <HASH>..<HASH> 100644 --- a/acos_client/v21/license_manager.py +++ b/acos_client/v21/license_manager.py @@ -27,5 +27,6 @@ class LicenseManager(base.BaseV21): def connect(self, connect=False): raise NotImplementedError("LicenseManager is not yet supported using AXAPI v2.1") - def delete(self): + def update(self, host_list=[], serial=None, instance_name=None, use_mgmt_port=False, + interval=None, bandwidth_base=None, bandwidth_unrestricted=None): raise NotImplementedError("LicenseManager is not yet supported using AXAPI v2.1")
Removed <I> delete, added update
py
diff --git a/gcloud/datastore/batch.py b/gcloud/datastore/batch.py index <HASH>..<HASH> 100644 --- a/gcloud/datastore/batch.py +++ b/gcloud/datastore/batch.py @@ -12,7 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Create / interact with a batch of updates / deletes.""" +"""Create / interact with a batch of updates / deletes. + +Batches provide the ability to execute multiple operations +in a single request to the Cloud Datastore API. + +See +https://cloud.google.com/datastore/docs/concepts/entities#Datastore_Batch_operations +""" from gcloud._helpers import _LocalStack from gcloud.datastore import _implicit_environ
Added more expressive module docstring to batch.py
py
diff --git a/skyfield/__init__.py b/skyfield/__init__.py index <HASH>..<HASH> 100644 --- a/skyfield/__init__.py +++ b/skyfield/__init__.py @@ -4,4 +4,5 @@ Most users will use Skyfield by importing ``skyfield.api`` and using the functions and classes there. """ -__version__ = '0.2' +__version_info__ = (0, 2) +__version__ = '%s.%s' % __version_info__
Experiment with a version-info tuple
py
diff --git a/pyparsing.py b/pyparsing.py index <HASH>..<HASH> 100644 --- a/pyparsing.py +++ b/pyparsing.py @@ -94,7 +94,7 @@ classes inherit from. Use the docstrings for examples of how to: """ __version__ = "2.3.1" -__versionTime__ = "05 Jan 2019 23:47 UTC" +__versionTime__ = "08 Jan 2019 01:25 UTC" __author__ = "Paul McGuire <ptmcg@users.sourceforge.net>" import string @@ -2734,12 +2734,6 @@ class CaselessKeyword(Keyword): def __init__( self, matchString, identChars=None ): super(CaselessKeyword,self).__init__( matchString, identChars, caseless=True ) - def parseImpl( self, instring, loc, doActions=True ): - if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and - (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) ): - return loc+self.matchLen, self.match - raise ParseException(instring, loc, self.errmsg, self) - class CloseMatch(Token): """A variation on :class:`Literal` which matches "close" matches, that is, strings with at most 'n' mismatching characters.
Fix inconsistency between Keyword(caseless=True) and CaselessKeyword (issue #<I>)
py
diff --git a/SpiffWorkflow/bpmn/PythonScriptEngine.py b/SpiffWorkflow/bpmn/PythonScriptEngine.py index <HASH>..<HASH> 100644 --- a/SpiffWorkflow/bpmn/PythonScriptEngine.py +++ b/SpiffWorkflow/bpmn/PythonScriptEngine.py @@ -268,10 +268,9 @@ class PythonScriptEngine(object): try: exec(script, globals, data) except Exception as err: + detail = err.__class__.__name__ if len(err.args) > 0: - detail = err.args[0] - else: - detail = err.__class__.__name__ + detail += ":" + err.args[0] line_number = 0 error_line = '' cl, exc, tb = sys.exc_info()
Slight improvement on error message details.
py
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,9 +19,11 @@ sys.path.insert(0, os.path.abspath("../src/")) autodoc_mock_imports = [ "bs4", + "cloudpickle", "editdistance", "emmental", "lxml", + "mlflow", "numpy", "pandas", "scipy",
Mock imports of "cloudpickle" and "mlflow"
py
diff --git a/PlugIns/EELSAcq_Phil/PlugIn.py b/PlugIns/EELSAcq_Phil/PlugIn.py index <HASH>..<HASH> 100644 --- a/PlugIns/EELSAcq_Phil/PlugIn.py +++ b/PlugIns/EELSAcq_Phil/PlugIn.py @@ -133,7 +133,14 @@ class AcquireController(object): def show_in_panel(data_item, document_controller, image_panel_id): workspace = document_controller.workspace document_controller.document_model.append_data_item(data_item) - workspace.get_image_panel_by_id(image_panel_id).set_displayed_data_item(data_item) + # argh + found_image_panel = None + for image_panel in workspace.image_panels: + if image_panel.element_id == image_panel_id: + found_image_panel = image_panel + break + if found_image_panel: + found_image_panel.set_displayed_data_item(data_item) def add_line_profile(data_item, document_controller, image_panel_id, midpoint=0.5, integration_width=.25): document_model = document_controller.document_model
Fix problem of missing 'find image panel' method. Was svn r<I>
py
diff --git a/arangodb/tests.py b/arangodb/tests.py index <HASH>..<HASH> 100644 --- a/arangodb/tests.py +++ b/arangodb/tests.py @@ -1,7 +1,8 @@ import unittest +import datetime from arangodb.api import Client, Database, Collection, Document -from arangodb.orm.fields import CharField, ForeignKeyField, NumberField +from arangodb.orm.fields import CharField, ForeignKeyField, NumberField, DatetimeField from arangodb.orm.models import CollectionModel from arangodb.query.advanced import Query, Traveser from arangodb.query.utils.document import create_document_from_result_dict @@ -575,6 +576,12 @@ class DatetimeFieldTestCase(unittest.TestCase): def tearDown(self): pass + def test_basic_creation_with_default(self): + time = datetime.datetime.now() + field = DatetimeField(default=time) + + self.assertEqual(time, field.time) + class TransactionTestCase(ExtendedTestCase): def setUp(self):
Test creation of a datetime field with default value
py
diff --git a/ford/sourceform.py b/ford/sourceform.py index <HASH>..<HASH> 100644 --- a/ford/sourceform.py +++ b/ford/sourceform.py @@ -1026,18 +1026,20 @@ class FortranVariable(FortranBase): self.dimension = '' self.meta = {} + indexlist = [] indexparen = self.name.find('(') - indexstar = self.name.find('*') if indexparen > 0: - if indexparen < indexstar or indexstar < 0: - self.dimension = self.name[indexparen:] - self.name = self.name[0:indexparen] - else: - self.dimension = self.name[indexstar:] - self.name = self.name[0:indexstar] - elif indexstar > 0: - self.dimension = self.name[indexstar:] - self.name = self.name[0:indexstar] + indexlist.append(indexparen) + indexbrack = self.name.find('[') + if indexbrack > 0: + indexlist.append(indexbrack) + indexstar = self.name.find('*') + if indexstar > 0: + indexlist.append(indexstar) + + if len(indexlist) > 0: + self.dimension = self.name[min(indexlist):] + self.name = self.name[0:min(indexlist)] self.hierarchy = [] cur = self.parent
Now recognizes codimensions in variable declarations.
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ except ImportError: setup( name='eventsourcing', - version='1.0.11', + version='1.1.0', description='Event sourcing in Python', author='John Bywater', author_email='john.bywater@appropriatesoftware.net',
Increased minor version number. Minor version number change follows from addition of new optimistic concurrency control features, performance improvements, and the fact that an 'entity version' table has been added to the stored event repo database schema.
py
diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index <HASH>..<HASH> 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -133,7 +133,7 @@ class Message(Object, Update): Signature of the post author for messages in channels, or the custom title of an anonymous group administrator. - has_protected_content (``str``, *optional*): + has_protected_content (``bool``, *optional*): True, if the message can't be forwarded. text (``str``, *optional*):
Fix type of "has_protected_content" (#<I>) `has_protected_content` attribute of Message class was assigned the wrong type in the docstring (str), corrected it to `bool`
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ setup( data_files=[( (BASE_DIR, ['data/nssm_original.exe']) )], - install_requires=['indy-plenum-dev==1.2.205', + install_requires=['indy-plenum-dev==1.2.212', 'indy-anoncreds-dev==1.0.32', 'python-dateutil', 'timeout-decorator'],
INDY-<I>: Updated indy-plenum dependency (#<I>)
py
diff --git a/django_dev/dev.py b/django_dev/dev.py index <HASH>..<HASH> 100644 --- a/django_dev/dev.py +++ b/django_dev/dev.py @@ -50,6 +50,8 @@ if __name__ == '__main__': 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.sites', + 'django.contrib.flatpages', ) if not settings.configured: settings.configure(
Flatpages and sites contribs add to INSTALLED_APPS.
py
diff --git a/dwave/cloud/cli.py b/dwave/cloud/cli.py index <HASH>..<HASH> 100644 --- a/dwave/cloud/cli.py +++ b/dwave/cloud/cli.py @@ -252,7 +252,9 @@ def ping(config_file, profile, json_output): type=click.Path(exists=True, dir_okay=False), help='Configuration file path') @click.option('--profile', '-p', default=None, help='Connection profile name') @click.option('--id', default=None, help='Solver ID/name') -def solvers(config_file, profile, id): +@click.option('--list', 'list_solvers', default=False, is_flag=True, + help='List available solvers, one per line') +def solvers(config_file, profile, id, list_solvers): """Get solver details. Unless solver name/id specified, fetch and display details for @@ -268,6 +270,11 @@ def solvers(config_file, profile, id): click.echo("Solver {} not found.".format(id)) return 1 + if list_solvers: + for solver in solvers: + click.echo(solver.id) + return + # ~YAML output for solver in solvers: click.echo("Solver: {}".format(solver.id))
CLI: add --list option to 'dwave solvers'
py
diff --git a/elifetools/parseJATS.py b/elifetools/parseJATS.py index <HASH>..<HASH> 100644 --- a/elifetools/parseJATS.py +++ b/elifetools/parseJATS.py @@ -2397,7 +2397,7 @@ def body_block_content(tag, html_flag=True, base_url=None): set_if_value(tag_content, "id", tag.get("id")) set_if_value(tag_content, "title", convert(title_text(tag, direct_sibling_only=True))) - if tag.name == "related-object": + elif tag.name == "related-object": # related-object tag for clinical trial data in structured abstract sec tag tag_content["type"] = "paragraph" set_if_value(tag_content, "id", tag.get("id"))
Change if to elif for related-object tag matching.
py
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -219,7 +219,7 @@ class Firefox: glob.glob(os.path.join(os.environ.get('PROGRAMFILES(X86)', ''), 'Mozilla Firefox/profile/cookies.sqlite')) or \ glob.glob(os.path.join(os.environ.get('APPDATA', ''), - 'Mozilla/Firefox/Profiles/*.default/cookies.sqlite')) + 'Mozilla/Firefox/Profiles/*.default*/cookies.sqlite')) else: raise BrowserCookieError('Unsupported operating system: ' + sys.platform) if cookie_files:
Fix Firefox win<I> folder naming conventions .default may be followed by additional characters. This correctly locates profile folder.
py
diff --git a/tests/test_upload.py b/tests/test_upload.py index <HASH>..<HASH> 100644 --- a/tests/test_upload.py +++ b/tests/test_upload.py @@ -288,12 +288,15 @@ def test_values_from_env(monkeypatch): assert "/foo/bar.crt" == upload_settings.cacert -def test_check_status_code_for_wrong_repo_url(make_settings, capsys): +@pytest.mark.parametrize('repo_url', [ + "https://upload.pypi.org/", + "https://test.pypi.org/" +]) +def test_check_status_code_for_wrong_repo_url(repo_url, make_settings, capsys): upload_settings = make_settings() # override defaults to use incorrect URL - upload_settings.repository_config['repository'] = \ - "https://upload.pypi.org" + upload_settings.repository_config['repository'] = repo_url with pytest.raises(HTTPError): upload.upload(upload_settings, [
Add pytest.mark.parametrize to try both upload.pypi and test.pypi as repository URLs
py
diff --git a/salt/modules/virt.py b/salt/modules/virt.py index <HASH>..<HASH> 100644 --- a/salt/modules/virt.py +++ b/salt/modules/virt.py @@ -211,12 +211,12 @@ def _prepare_serial_port_xml(serial_type='pty', telnet_port='', console=True, ** Returns string representing the serial and console devices suitable for insertion into the VM XML definition ''' - - if serial_type not in ['pty', 'tcp']: - log.debug('Unsupported serial type {0}'.format(serial_type)) + fn_ = 'serial_port_{0}.jinja'.format(serial_type) + try: + template = JINJA.get_template(fn_) + except jinja2.exceptions.TemplateNotFound: + log.error('Could not load template {0}'.format(fn_)) return '' - - template = JINJA.get_template('serial_port_{0}.jinja'.format(serial_type)) return template.render(serial_type=serial_type, telnet_port=telnet_port, console=console)
Easier to ask for forgiveness than permission (EAFP)
py
diff --git a/pyinfra/modules/mysql.py b/pyinfra/modules/mysql.py index <HASH>..<HASH> 100644 --- a/pyinfra/modules/mysql.py +++ b/pyinfra/modules/mysql.py @@ -342,6 +342,7 @@ def dump( Example: .. code:: python + mysql.dump( {'Dump the pyinfra_stuff database'}, '/tmp/pyinfra_stuff.dump',
Fix missing newline in rst docstring.
py
diff --git a/airtest/utils/logger.py b/airtest/utils/logger.py index <HASH>..<HASH> 100644 --- a/airtest/utils/logger.py +++ b/airtest/utils/logger.py @@ -20,5 +20,4 @@ init_logging() def get_logger(name): logger = logging.getLogger(name) - logger.setLevel(logging.DEBUG) return logger
no reset logger level on every get_logger invocation.
py
diff --git a/moto/iam/responses.py b/moto/iam/responses.py index <HASH>..<HASH> 100644 --- a/moto/iam/responses.py +++ b/moto/iam/responses.py @@ -407,7 +407,7 @@ class IamResponse(BaseResponse): return template.render( user_name=user_name, policy_name=policy_name, - policy_document=policy_document + policy_document=policy_document.get('policy_document') ) def list_user_policies(self):
fixes wrong IAM get_user_policy() response
py
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ classifiers = [ 'Topic :: Utilities', ] -long_description = open('README').read() +long_description = open('README').read() + '\n' + open('Changelog').read() setup(name='cgroup-utils', version=VERSION,
Append Changelog to README for PyPI
py
diff --git a/pypsa/plot.py b/pypsa/plot.py index <HASH>..<HASH> 100644 --- a/pypsa/plot.py +++ b/pypsa/plot.py @@ -142,7 +142,7 @@ def plot(network, margin=0.05, ax=None, basemap=True, bus_colors='b', if isinstance(bus_sizes, pd.Series) and isinstance(bus_sizes.index, pd.MultiIndex): # We are drawing pies to show all the different shares - assert len(network.buses.index.difference(bus_sizes.index.levels[0])) == 0, \ + assert len(bus_sizes.index.levels[0].difference(network.buses.index)) == 0, \ "The first MultiIndex level of bus_sizes must contain buses" assert isinstance(bus_colors, dict) and set(bus_colors).issuperset(bus_sizes.index.levels[1]), \ "bus_colors must be a dictionary defining a color for each element " \
plot: Fix pie plotting with multi-sector networks
py
diff --git a/soco/data_structures.py b/soco/data_structures.py index <HASH>..<HASH> 100644 --- a/soco/data_structures.py +++ b/soco/data_structures.py @@ -598,7 +598,7 @@ class DidlAudioItem(DidlItem): """An audio item.""" - item_class = 'object.item.audioitem' + item_class = 'object.item.audioItem' _translation = DidlItem._translation.copy() _translation.update( {
Fix capitalization of object.item.audioItem
py
diff --git a/countries_plus/management/commands/update_countries_plus.py b/countries_plus/management/commands/update_countries_plus.py index <HASH>..<HASH> 100644 --- a/countries_plus/management/commands/update_countries_plus.py +++ b/countries_plus/management/commands/update_countries_plus.py @@ -1,12 +1,13 @@ -from django.core.management.base import BaseCommand - from countries_plus.utils import update_geonames_data +from django.core.management.base import BaseCommand + class Command(BaseCommand): help = 'Updates the Countries Plus database from geonames.org' def handle(self, *args, **options): num_updated, num_created = update_geonames_data() - print "Countries Plus data has been succesfully updated from geonames.org. " \ - "%s countries were updated, %s countries were created." % (num_updated, num_created) + self.stdout.write( + "Countries Plus data has been succesfully updated from geonames.org. " + "%s countries were updated, %s countries were created." % (num_updated, num_created))
update_countries_plus: use self.stdout.write Using the `print` keyword does not work for Python 3, and management commands seem to use `self.stdout.write`.
py
diff --git a/luigi/lock.py b/luigi/lock.py index <HASH>..<HASH> 100644 --- a/luigi/lock.py +++ b/luigi/lock.py @@ -62,7 +62,7 @@ def getpcmd(pid): # worked. See the pull request at # https://github.com/spotify/luigi/pull/1876 try: - with open('/proc/{0}/cmdline'.format(pid), 'r') as fh: + with open('/proc/{0}/cmdline'.format(pid), 'rb') as fh: return fh.read().replace('\0', ' ').decode('utf8').rstrip() except IOError: # the system may not allow reading the command line
Fix decode to utf8 when reading /proc/*/cmdline
py
diff --git a/GDAX/WebsocketClient.py b/GDAX/WebsocketClient.py index <HASH>..<HASH> 100644 --- a/GDAX/WebsocketClient.py +++ b/GDAX/WebsocketClient.py @@ -102,10 +102,6 @@ if __name__ == "__main__": print(wsClient.url, wsClient.products) # Do some logic with the data while (wsClient.MessageCount < 500): -<<<<<<< HEAD print ("\nMessageCount =", "%i \n" % wsClient.MessageCount) -======= - print("\nMessageCount =", "%i \n" % wsClient.MessageCount) ->>>>>>> e5d2bb8d930db1ddf64ab446467845a41f0ab5cd time.sleep(1) wsClient.close()
Cleared conflict with WebsocketClient
py
diff --git a/grappa/operators/contain.py b/grappa/operators/contain.py index <HASH>..<HASH> 100644 --- a/grappa/operators/contain.py +++ b/grappa/operators/contain.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- +from array import array from six.moves import collections_abc import six + from ..operator import Operator @@ -59,21 +61,21 @@ class ContainOperator(Operator): NORMALIZE_TYPES = ( collections_abc.Iterator, collections_abc.MappingView, - collections_abc.Set + collections_abc.Set, + array ) def match(self, subject, *expected): if isinstance(subject, self.NORMALIZE_TYPES): subject = list(subject) + elif isinstance(subject, collections_abc.Mapping): + subject = list(subject.values()) - if self._is_not_a_sequence(subject): + if not isinstance(subject, collections_abc.Sequence): return False, ['is not a valid sequence type'] return self._matches(subject, *expected) - def _is_not_a_sequence(self, value): - return not isinstance(value, collections_abc.Sequence) - def _matches(self, subject, *expected): reasons = []
contain now supports dicts and arrays. Partially fix #<I>
py
diff --git a/salt/states/pip_state.py b/salt/states/pip_state.py index <HASH>..<HASH> 100644 --- a/salt/states/pip_state.py +++ b/salt/states/pip_state.py @@ -57,13 +57,6 @@ if HAS_PIP is True: # pylint: enable=import-error - ver = pip.__version__.split('.') - pip_ver = tuple([int(x) for x in ver if x.isdigit()]) - if pip_ver >= (8, 0, 0): - from pip.exceptions import InstallationError - else: - InstallationError = ValueError - logger = logging.getLogger(__name__) # Define the module's virtual name
Remove duplicated code. This check exists twice in the code. Once is good enough for anyone.
py
diff --git a/reference/_generate.py b/reference/_generate.py index <HASH>..<HASH> 100755 --- a/reference/_generate.py +++ b/reference/_generate.py @@ -65,7 +65,8 @@ def walk_contexts(name="globus", cmd=CLI, parent_ctx=None): """ current_ctx = click.Context(cmd, info_name=name, parent=parent_ctx) cmds, groups = [], [] - for subcmdname, subcmd in getattr(cmd, "commands", {}).items(): + for subcmdname in cmd.list_commands(current_ctx): + subcmd = cmd.get_command(current_ctx, subcmdname) # explicitly skip hidden commands and `globus config` if subcmd.hidden or (name + " " + subcmdname) == "globus config": continue @@ -139,7 +140,7 @@ class AdocPage: sections = [] sections.append(f"= {self.commandname.upper()}\n") sections.append(f"== NAME\n\n{self.commandname} - {self.short_help}\n") - sections.append(f"== SYNOPSIS\n\n`{self.commandname} {self.synopsis}`\n") + sections.append(f"== SYNOPSIS\n\n`{self.commandname}`\n{self.synopsis}\n") if self.description: sections.append(f"== DESCRIPTION\n\n{self.description}\n") if self.options:
Fix reference generator to handle lazy subcommands (#<I>) The reference doc generator script was crawling `Group.commands` instead of using `Group.list_commands` and `Group.get_command`. As a result, it did not process lazy imported subcommands correctly. Also fix a typo in the synopsis format string.
py
diff --git a/schema_salad/ref_resolver.py b/schema_salad/ref_resolver.py index <HASH>..<HASH> 100644 --- a/schema_salad/ref_resolver.py +++ b/schema_salad/ref_resolver.py @@ -581,7 +581,7 @@ class Loader(object): document[idmapField] = ls - typeDSLregex = re.compile(ur"^([^[?]+)(\[\])?(\?)?$") + typeDSLregex = re.compile(u"^([^[?]+)(\[\])?(\?)?$") def _type_dsl(self, t, # type: Union[Text, Dict, List]
fix: make regex command python3 compatible
py
diff --git a/pyfrc/mains/cli_undeploy.py b/pyfrc/mains/cli_undeploy.py index <HASH>..<HASH> 100644 --- a/pyfrc/mains/cli_undeploy.py +++ b/pyfrc/mains/cli_undeploy.py @@ -41,6 +41,9 @@ class PyFrcUndeploy: robot_path = dirname(robot_file) cfg_filename = join(robot_path, ".deploy_cfg") + if not yesno( + "This will stop your robot code and delete it from the RoboRIO. Continue?" + ): return 1 hostname_or_team = options.robot @@ -56,9 +59,17 @@ class PyFrcUndeploy: no_resolve=options.no_resolve, ) as ssh: + # first, turn off the running program + ssh.exec_cmd("/usr/local/frc/bin/frcKillRobot.sh -t") + # delete the code ssh.exec_cmd("rm -rf /home/lvuser/py") + # for good measure, delete the start command too + ssh.exec_cmd( + "rm -f /home/lvuser/robotDebugCommand /home/lvuser/robotCommand" + ) + except sshcontroller.SshExecError as e: print_err("ERROR:", str(e)) return 1
Warn user about undeploy, and stop the code first
py