Merge branch 'pr/2733' into devel

# Conflicts:
#	src/octoprint/plugins/discovery/__init__.py
This commit is contained in:
Gina Häußge committed 2018-09-18 17:30:30 +02:00
commit 2c50aa789a
30 files changed
+76 -76

No files matched your search

+2 -2
View File
@@ -84,7 +84,7 @@ class CodeBlockExt(CodeBlock):
return node
# replace all created literal_blocks with literal_block_ext instances
return map(find_and_wrap_literal_block, code_block)
return list(map(find_and_wrap_literal_block, code_block))
def _wrap_literal_block(self, node):
literal = literal_block_ext.from_literal_block(node)
@@ -255,4 +255,4 @@ def setup(app):
handler = (visit_literal_block_ext, depart_literal_block_ext)
app.add_node(literal_block_ext, html=handler, latex=handler, text=handler)
return dict(version="0.1")
return dict(version="0.1")
+1 -1
View File
@@ -447,7 +447,7 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
def format_blacklist(entries):
format_entry = lambda x: "{} ({})".format(x[0], x[1]) if isinstance(x, (list, tuple)) and len(x) == 2 \
else "{} (any)".format(x)
return ", ".join(map(format_entry, entries))
return ", ".join(list(map(format_entry, entries)))
def process_blacklist(entries):
result = []
+1 -1
View File
@@ -315,7 +315,7 @@ def git_parse_lookup_file(path):
continue
try:
split_line = map(lambda x: x.strip(), line.split())
split_line = list(map(lambda x: x.strip(), line.split()))
if not len(split_line):
continue
+1 -1
View File
@@ -384,7 +384,7 @@ class Group(object):
key=self.key,
name=self.get_name(),
description=self._description,
permissions=map(lambda p: p.key, self._permissions),
permissions=list(map(lambda p: p.key, self._permissions)),
needs=OctoPrintPermission.convert_needs_to_dict(self.needs),
default=self._default,
removable=self._removable,
+1 -1
View File
@@ -102,7 +102,7 @@ class OctoPrintPermission(Permission):
return '{}({!r}, {!r}, {})'.format(self.__class__.__name__,
self.get_name(),
self.get_description(),
', '.join(map(repr, self.needs)))
', '.join(list(map(repr, self.needs))))
def __hash__(self):
return self.get_name().__hash__()
+3 -3
View File
@@ -511,7 +511,7 @@ class FilebasedUserManager(UserManager):
return [self._group_manager.user_group]
def _refresh_groups(self, user):
user._groups = self._to_groups(*map(lambda g: g.key, user.groups))
user._groups = self._to_groups(*list(map(lambda g: g.key, user.groups)))
def add_user(self, username, password, active=False, permissions=None, groups=None, apikey=None, overwrite=False):
if not permissions:
@@ -894,8 +894,8 @@ class User(UserMixin):
return {
"name": self._username,
"active": bool(self.is_active),
"permissions": map(lambda p: p.key, self._permissions),
"groups": map(lambda g: g.key, self._groups),
"permissions": list(map(lambda p: p.key, self._permissions)),
"groups": list(map(lambda g: g.key, self._groups)),
"needs": OctoPrintPermission.convert_needs_to_dict(self.needs),
"apikey": self._apikey,
"settings": self._settings,
+1 -1
View File
@@ -17,7 +17,7 @@ import pprint
def _to_settings_path(path):
if not isinstance(path, (list, tuple)):
path = filter(lambda x: x, map(lambda x: x.strip(), path.split(".")))
path = list(filter(lambda x: x, map(lambda x: x.strip(), path.split("."))))
return path
def _set_helper(settings, path, value, data_type=None):
+4 -4
View File
@@ -519,8 +519,8 @@ class PluginInfo(object):
root.body)
def extract_target_ids(node):
return map(lambda x: x.id,
filter(lambda x: isinstance(x, ast.Name), node.targets))
return list(map(lambda x: x.id,
filter(lambda x: isinstance(x, ast.Name), node.targets)))
for key in (self.__class__.attr_name, self.__class__.attr_version, self.__class__.attr_author,
self.__class__.attr_description, self.__class__.attr_url, self.__class__.attr_license):
@@ -628,7 +628,7 @@ class PluginManager(object):
@property
def plugin_hooks(self):
return {key: map(lambda v: (v[1], v[2]), value) for key, value in self._plugin_hooks.items()}
return {key: list(map(lambda v: (v[1], v[2]), value)) for key, value in self._plugin_hooks.items()}
def find_plugins(self, existing=None, ignore_uninstalled=True, incl_all_found=False):
added, found = self._find_plugins(existing=existing, ignore_uninstalled=ignore_uninstalled)
@@ -1501,7 +1501,7 @@ class PluginManager(object):
assert callable(f)
implementations = self.get_implementations(*types, sorting_context=kwargs.get("sorting_context", None))
return filter(f, implementations)
return list(filter(f, implementations))
def get_helpers(self, name, *helpers):
"""
@@ -170,7 +170,7 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin,
for key, data in channel_configs.items():
read_until = channel_configs[key].get("read_until", None)
entries = sorted(self._to_internal_feed(channel_data.get(key, []), read_until=read_until), key=lambda e: e["published"], reverse=True)
unread = len(filter(lambda e: not e["read"], entries))
unread = len(list(filter(lambda e: not e["read"], entries)))
if read_until is None and entries:
last = entries[0]["published"]
@@ -481,8 +481,12 @@ def _strip_tags(text):
>>> _strip_tags(u"> > Foo")
u'> > Foo'
"""
from HTMLParser import HTMLParser
try:
# noinspection PyCompatibility
from html.parser import HTMLParser
except ImportError:
# noinspection PyCompatibility
from HTMLParser import HTMLParser
class TagStripper(HTMLParser):
+1 -1
View File
@@ -133,7 +133,7 @@ class LoggingPlugin(octoprint.plugin.AssetPlugin,
return files
def _get_available_loggers(self):
return filter(lambda x: self._is_managed_logger(x), self._logger.manager.loggerDict.keys())
return list(filter(lambda x: self._is_managed_logger(x), self._logger.manager.loggerDict.keys()))
def _get_logging_file(self):
# TODO this might not be the logging config we are actually using here (command line parameter...)
+11 -11
View File
@@ -171,7 +171,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
plugins = sorted(self._get_plugins(), key=lambda x: x["name"].lower())
return dict(
all=plugins,
thirdparty=filter(lambda p: not p["bundled"], plugins),
thirdparty=list(filter(lambda p: not p["bundled"], plugins)),
archive_extensions=self.__class__.ARCHIVE_EXTENSIONS
)
@@ -197,7 +197,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
upload_path = flask.request.values[input_upload_path]
upload_name = flask.request.values[input_upload_name]
exts = filter(lambda x: upload_name.lower().endswith(x), self.__class__.ARCHIVE_EXTENSIONS)
exts = list(filter(lambda x: upload_name.lower().endswith(x), self.__class__.ARCHIVE_EXTENSIONS))
if not len(exts):
return flask.make_response("File doesn't have a valid extension for a plugin archive", 400)
@@ -399,8 +399,8 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
.format(source), 500)
try:
result_line = filter(lambda x: x.startswith(success_string) or x.startswith(failure_string),
stdout)[-1]
result_line = list(filter(lambda x: x.startswith(success_string) or x.startswith(failure_string),
stdout))[-1]
except IndexError:
self._logger.error("Installing the plugin from {} failed, could not parse output from pip. "
"See plugin_pluginmanager_console.log for generated output".format(source))
@@ -443,7 +443,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
self._send_result_notification("install", result)
return jsonify(result)
installed = map(lambda x: x.strip(), result_line[len(success_string):].split(" "))
installed = list(map(lambda x: x.strip(), result_line[len(success_string):].split(" ")))
all_plugins_after = self._plugin_manager.find_plugins(existing=dict(), ignore_uninstalled=False)
new_plugin = self._find_installed_plugin(installed, plugins=all_plugins_after)
@@ -691,7 +691,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
def _log(self, lines, prefix=None, stream=None, strip=True):
if strip:
lines = map(lambda x: x.strip(), lines)
lines = list(map(lambda x: x.strip(), lines))
self._plugin_manager.send_plugin_message(self._identifier, dict(type="loglines",
loglines=[dict(line=line, stream=stream) for line in lines]))
@@ -821,7 +821,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
return result
self._repository_plugins = map(map_repository_entry, repo_data)
self._repository_plugins = list(map(map_repository_entry, repo_data))
return True
def _fetch_notices_from_disk(self):
@@ -988,10 +988,10 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
def map_notification(notification):
return self._to_external_notification(key, notification)
return filter(lambda x: x is not None,
map(map_notification,
filter(filter_relevant,
plugin_notifications)))
return list(filter(lambda x: x is not None,
map(map_notification,
filter(filter_relevant,
plugin_notifications))))
def _to_external_notification(self, key, notification):
return dict(key=key,
@@ -173,8 +173,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
config_checks = self._settings.get(["checks"])
plugin_and_not_enabled = lambda k: k in check_providers and \
not check_providers[k] in self._plugin_manager.enabled_plugins
obsolete_plugin_checks = filter(plugin_and_not_enabled,
config_checks.keys())
obsolete_plugin_checks = list(filter(plugin_and_not_enabled,
config_checks.keys()))
for key in obsolete_plugin_checks:
self._logger.debug("Check for key {} was provided by plugin {} that's no longer available, ignoring it".format(key, check_providers[key]))
del self._configured_checks[key]
@@ -34,7 +34,7 @@ def get_latest(target, check, online=True):
# 1.1.0 is the current version, 1.1.1 is the remote version. If only one line is output, it's taken to be the
# display name of the new version
stdout_lines = filter(lambda x: len(x.strip()), stdout.splitlines())
stdout_lines = list(filter(lambda x: len(x.strip()), stdout.splitlines()))
local_name = stdout_lines[-2] if len(stdout_lines) >= 2 else "unknown"
remote_name = stdout_lines[-1] if len(stdout_lines) >= 1 else "unknown"
is_current = returncode != 0
@@ -79,7 +79,7 @@ def _filter_out_latest(releases,
else:
filter_function = lambda rel: not rel["draft"]
releases = filter(filter_function, releases)
releases = list(filter(filter_function, releases))
if not releases:
return nothing
@@ -115,8 +115,8 @@ def _get_latest_release(user, repo, compare_type,
# sanitize
required_fields = {"name", "tag_name", "html_url", "draft", "prerelease", "published_at", "target_commitish"}
releases = filter(lambda rel: set(rel.keys()) & required_fields == required_fields,
releases)
releases = list(filter(lambda rel: set(rel.keys()) & required_fields == required_fields,
releases))
comparable_factory = _get_comparable_factory(compare_type,
force_base=force_base)
+4 -4
View File
@@ -359,7 +359,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
else:
raise ValueError("axes is neither a list nor a string: {axes}".format(axes=axes))
validated_axes = filter(lambda x: x in PrinterInterface.valid_axes, map(lambda x: x.lower(), axes))
validated_axes = list(filter(lambda x: x in PrinterInterface.valid_axes, map(lambda x: x.lower(), axes)))
if len(axes) != len(validated_axes):
raise ValueError("axes contains invalid axes: {axes}".format(axes=axes))
@@ -412,8 +412,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
if not isinstance(offsets, dict):
raise ValueError("offsets must be a dict")
validated_keys = filter(lambda x: PrinterInterface.valid_heater_regex.match(x), offsets.keys())
validated_values = filter(lambda x: isinstance(x, (int, long, float)), offsets.values())
validated_keys = list(filter(lambda x: PrinterInterface.valid_heater_regex.match(x), offsets.keys()))
validated_values = list(filter(lambda x: isinstance(x, (int, long, float)), offsets.values()))
if len(validated_keys) != len(offsets):
raise ValueError("offsets contains invalid keys: {offsets}".format(offsets=offsets))
@@ -653,7 +653,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def get_sd_files(self, *args, **kwargs):
if self._comm is None or not self._comm.isSdReady():
return []
return map(lambda x: (x[0][1:], x[1]), self._comm.getSdFiles())
return list(map(lambda x: (x[0][1:], x[1]), self._comm.getSdFiles()))
def add_sd_file(self, filename, absolutePath, on_success=None, on_failure=None, *args, **kwargs):
if not self._comm or self._comm.isBusy() or not self._comm.isSdReady():
+2 -2
View File
@@ -1071,7 +1071,7 @@ class Server(object):
return all([f(entry) for f in filters])
# filter out all old and non-http entries
cache_data = preemptive_cache.clean_all_data(lambda root, entries: filter(filter_entries, entries))
cache_data = preemptive_cache.clean_all_data(lambda root, entries: list(filter(filter_entries, entries)))
if not cache_data:
return
@@ -1616,7 +1616,7 @@ class Server(object):
return path, data, content_type
rules = map(process, filter(lambda rule: len(rule) == 2 or len(rule) == 3, rules))
rules = list(map(process, filter(lambda rule: len(rule) == 2 or len(rule) == 3, rules)))
class HTTPServerV6(HTTPServer):
address_family = socket.AF_INET6
+2 -2
View File
@@ -29,7 +29,7 @@ def get_permissions():
@require_firstrun
@Permissions.SETTINGS.require(403)
def get_groups():
return jsonify(groups=map(lambda g: g.as_dict(), groupManager.groups))
return jsonify(groups=list(map(lambda g: g.as_dict(), groupManager.groups)))
@api.route("/access/groups", methods=["POST"])
@@ -129,7 +129,7 @@ def get_users():
if not userManager.enabled:
return jsonify(SUCCESS)
return jsonify(users=map(lambda u: u.as_dict(), userManager.get_all_users()))
return jsonify(users=list(map(lambda u: u.as_dict(), userManager.get_all_users())))
@api.route("/access/users", methods=["POST"])
+1 -1
View File
@@ -99,7 +99,7 @@ def uploadLanguagePack():
upload_name = request.values[input_upload_name]
upload_path = request.values[input_upload_path]
exts = filter(lambda x: upload_name.lower().endswith(x), (".zip", ".tar.gz", ".tgz", ".tar"))
exts = list(filter(lambda x: upload_name.lower().endswith(x), (".zip", ".tar.gz", ".tgz", ".tar")))
if not len(exts):
return make_response("File doesn't have a valid extension for a language pack archive", 400)
+2 -2
View File
@@ -32,7 +32,7 @@ def printerState():
if "exclude" in request.values:
excludeStr = request.values["exclude"]
if len(excludeStr.strip()) > 0:
excludes = filter(lambda x: x in ["temperature", "sd", "state"], map(lambda x: x.strip(), excludeStr.split(",")))
excludes = list(filter(lambda x: x in ["temperature", "sd", "state"], map(lambda x: x.strip(), excludeStr.split(","))))
result = {}
@@ -424,7 +424,7 @@ def _get_temperature_data(preprocessor):
limit = min(limit, len(history))
tempData.update({
"history": map(lambda x: preprocessor(x), history[-limit:])
"history": list(map(lambda x: preprocessor(x), history[-limit:]))
})
return preprocessor(tempData)
+2 -2
View File
@@ -263,8 +263,8 @@ def get_plugin_hash():
from octoprint.plugin import plugin_manager
plugin_signature = lambda impl: "{}:{}".format(impl._identifier, impl._plugin_version)
template_plugins = map(plugin_signature, plugin_manager().get_implementations(octoprint.plugin.TemplatePlugin))
asset_plugins = map(plugin_signature, plugin_manager().get_implementations(octoprint.plugin.AssetPlugin))
template_plugins = list(map(plugin_signature, plugin_manager().get_implementations(octoprint.plugin.TemplatePlugin)))
asset_plugins = list(map(plugin_signature, plugin_manager().get_implementations(octoprint.plugin.AssetPlugin)))
ui_plugins = sorted(set(template_plugins + asset_plugins))
import hashlib
+1 -1
View File
@@ -263,7 +263,7 @@ class ReverseProxiedEnvironment(object):
if not isinstance(values, (list, tuple)):
values = [values]
to_wsgi_format = lambda header: "HTTP_" + header.upper().replace("-", "_")
return map(to_wsgi_format, values)
return list(map(to_wsgi_format, values))
@staticmethod
def valid_ip(address):
+2 -3
View File
@@ -125,8 +125,8 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection,
self._groupManager.register_listener(self)
plugin_signature = lambda impl: "{}:{}".format(impl._identifier, impl._plugin_version)
template_plugins = map(plugin_signature, self._pluginManager.get_implementations(octoprint.plugin.TemplatePlugin))
asset_plugins = map(plugin_signature, self._pluginManager.get_implementations(octoprint.plugin.AssetPlugin))
template_plugins = list(map(plugin_signature, self._pluginManager.get_implementations(octoprint.plugin.TemplatePlugin)))
asset_plugins = list(map(plugin_signature, self._pluginManager.get_implementations(octoprint.plugin.AssetPlugin)))
ui_plugins = sorted(set(template_plugins + asset_plugins))
import hashlib
@@ -374,4 +374,3 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection,
self._logger.exception("Could not send message to client {}".format(self._remoteAddress))
else:
self._logger.warn("Could not send message to client {}: {}".format(self._remoteAddress, e))
+4 -4
View File
@@ -422,7 +422,7 @@ def _get_render_kwargs(templates, plugin_names, plugin_vars, now):
first_run = settings().getBoolean(["server", "firstRun"])
locales = dict((l.language, dict(language=l.language, display=l.display_name, english=l.english_name)) for l in LOCALES)
permissions = [permission.as_dict() for permission in Permissions.all()]
extensions = map(lambda ext: ".{}".format(ext), get_all_extensions())
extensions = list(map(lambda ext: ".{}".format(ext), get_all_extensions()))
#~~ prepare full set of template vars for rendering
@@ -852,8 +852,8 @@ def _filter_templates(templates, template_filter):
for template_key, template_entry in template_collection["entries"].items():
if template_filter(template_type, template_key):
filtered_entries[template_key] = template_entry
filtered_templates[template_type] = dict(order=filter(lambda x: x in filtered_entries,
template_collection["order"]),
filtered_templates[template_type] = dict(order=list(filter(lambda x: x in filtered_entries,
template_collection["order"])),
entries=filtered_entries)
return filtered_templates
@@ -914,7 +914,7 @@ def _compute_date_for_i18n(locale, domain):
def _compute_date(files):
from datetime import datetime
timestamps = map(lambda path: os.stat(path).st_mtime, files) + [0] if files else []
timestamps = list(map(lambda path: os.stat(path).st_mtime, files)) + [0] if files else []
max_timestamp = max(*timestamps) if timestamps else None
if max_timestamp:
# we set the micros to 0 since microseconds are not speced for HTTP
+4 -4
View File
@@ -701,7 +701,7 @@ class Settings(object):
templates = []
for key in scripts:
if isinstance(scripts[key], dict):
templates += map(lambda x: key + "/" + x, self._get_templates(scripts[key]))
templates += list(map(lambda x: key + "/" + x, self._get_templates(scripts[key])))
elif isinstance(scripts[key], basestring):
templates.append(key)
return templates
@@ -797,11 +797,11 @@ class Settings(object):
elif "children" in result:
# if it has children we need to process them recursively
result["children"] = map(process_control, [child for child in result["children"] if child is not None])
result["children"] = list(map(process_control, [child for child in result["children"] if child is not None]))
return result
return map(process_control, controls)
return list(map(process_control, controls))
@property
def effective(self):
@@ -1540,7 +1540,7 @@ class Settings(object):
return folder
def listScripts(self, script_type):
return map(lambda x: x[len(script_type + "/"):], filter(lambda x: x.startswith(script_type + "/"), self._get_scripts(script_type)))
return list(map(lambda x: x[len(script_type + "/"):], filter(lambda x: x.startswith(script_type + "/"), self._get_scripts(script_type))))
def loadScript(self, script_type, name, context=None, source=False):
if context is None:
+1 -3
View File
@@ -165,7 +165,7 @@ class SlicingManager(object):
Returns:
(list of str) Identifiers of all available configured slicers.
"""
return map(lambda slicer: slicer.get_slicer_properties()["type"], filter(lambda slicer: slicer.is_slicer_configured(), self._slicers.values()))
return list(map(lambda slicer: slicer.get_slicer_properties()["type"], filter(lambda slicer: slicer.is_slicer_configured(), self._slicers.values())))
@property
def default_slicer(self):
@@ -667,5 +667,3 @@ class SlicingManager(object):
pass
return self.get_slicer(slicer).get_slicer_default_profile()
+5 -5
View File
@@ -621,7 +621,7 @@ class MachineCom(object):
if state is None:
state = self._state
possible_states = filter(lambda x: x.startswith("STATE_"), self.__class__.__dict__.keys())
possible_states = list(filter(lambda x: x.startswith("STATE_"), self.__class__.__dict__.keys()))
for possible_state in possible_states:
if getattr(self, possible_state) == state:
return possible_state[len("STATE_"):]
@@ -977,9 +977,9 @@ class MachineCom(object):
scriptLines = scriptLinesPrefix + scriptLines + scriptLinesSuffix
return filter(lambda x: x is not None and x.strip() != "",
map(lambda x: process_gcode_line(x, offsets=self._tempOffsets, current_tool=self._currentTool),
scriptLines))
return list(filter(lambda x: x is not None and x.strip() != "",
map(lambda x: process_gcode_line(x, offsets=self._tempOffsets, current_tool=self._currentTool),
scriptLines)))
def sendGcodeScript(self, scriptName, replacements=None, tags=None, part_of_job=False):
@@ -4132,7 +4132,7 @@ def canonicalize_temperatures(parsed, current):
dict: the canonicalized version of ``parsed``
"""
reported_extruders = filter(lambda x: x.startswith("T"), parsed.keys())
reported_extruders = list(filter(lambda x: x.startswith("T"), parsed.keys()))
if not "T" in reported_extruders:
# Our reported_extruders are either empty or consist purely
# of Tn keys, no need for any action
+1 -1
View File
@@ -113,7 +113,7 @@ def get_all_template_paths(loader):
result = []
for folder in loader.searchpath:
result += walk_folder(folder)
return filter(loader.path_filter, result)
return list(filter(loader.path_filter, result))
elif isinstance(loader, FileSystemLoader):
result = []
+2 -2
View File
@@ -298,7 +298,7 @@ class PipCaller(CommandlineCaller):
if not output.startswith("pip"):
self._logger.warn("pip command returned unparseable output, can't determine version: {}".format(output))
split_output = map(lambda x: x.strip(), output.split())
split_output = list(map(lambda x: x.strip(), output.split()))
if len(split_output) < 2:
self._logger.warn("pip command returned unparseable output, can't determine version: {}".format(output))
@@ -404,7 +404,7 @@ class PipCaller(CommandlineCaller):
return False, False, False, None
def _preprocess_lines(self, *lines):
return map(self._preprocess, lines)
return list(map(self._preprocess, lines))
@staticmethod
def _preprocess(text):
+2 -2
View File
@@ -56,7 +56,7 @@ def has_requirement(requirement, requirements):
assert isinstance(requirement, basestring)
assert isinstance(requirements, (list, tuple))
assert all(map(lambda x: x is not None and isinstance(x, basestring), requirements))
assert all(list(map(lambda x: x is not None and isinstance(x, basestring), requirements)))
requirement = requirement.lower()
requirements = [r.lower() for r in requirements]
@@ -528,7 +528,7 @@ def create_plugin_setup_parameters(identifier="todo", name="TODO", version="0.1"
cmdclass.update(get_babel_commandclasses(pot_file=pot_file, output_dir=translation_dir, bundled_dir=bundled_dir, pack_name_prefix="{name}-i18n-".format(**locals()), pack_path_prefix="_plugins/{identifier}/".format(**locals())))
from setuptools import find_packages
packages = list(set([package] + filter(lambda x: x.startswith("{package}.".format(package=package)), find_packages(where=source_folder, exclude=ignored_packages)) + additional_packages))
packages = list(set([package] + list(filter(lambda x: x.startswith("{package}.".format(package=package)), find_packages(where=source_folder, exclude=ignored_packages)) + additional_packages)))
print("Found packages: {packages!r}".format(**locals()))
return dict(
+2 -3
View File
@@ -87,7 +87,7 @@ class TimelapseTest(unittest.TestCase):
## verify
expected_deletions = map(lambda x: os.path.join(mocked_path, x), ["b-0.jpg",
"b-1.jpg"])
expected_deletion_calls = map(mock.call, expected_deletions)
expected_deletion_calls = list(map(mock.call, expected_deletions))
self.assertListEqual(mock_remove.mock_calls, expected_deletion_calls)
@mock.patch("time.time")
@@ -127,7 +127,7 @@ class TimelapseTest(unittest.TestCase):
"old-0.jpg",
"old-1.jpg",
"old-2.jpg"])
expected_deletion_calls = map(mock.call, expected_deletions)
expected_deletion_calls = list(map(mock.call, expected_deletions))
self.assertListEqual(mock_remove.mock_calls, expected_deletion_calls)
@mock.patch("octoprint.timelapse.scandir")
@@ -253,4 +253,3 @@ class TimelapseTest(unittest.TestCase):
r._process_ffmpeg_output(progress2Str)
self.assertEqual(r._parsed_duration, 18)
self.assertAlmostEqual(callback.sendRenderProgress.call_args_list[1][0][0], expectedProgress2)