🎨 Switch to use of isort
This commit is contained in:
1 parent
1f93b2355a
commit
fbfb34df58
137 files changed
+822
-820
No files matched your search
@@ -1,16 +1,17 @@
|
||||
#!/usr/bin/env python2
|
||||
# coding=utf-8
|
||||
|
||||
from distutils.command.build_py import build_py as _build_py
|
||||
import os
|
||||
import sys
|
||||
from distutils.command.build_py import build_py as _build_py
|
||||
|
||||
import versioneer
|
||||
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "src"))
|
||||
import octoprint_setuptools
|
||||
import setuptools
|
||||
|
||||
import octoprint_setuptools
|
||||
|
||||
# ----------------------------------------------------------------------------------------
|
||||
|
||||
# Supported python versions
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import io
|
||||
import sys
|
||||
import logging as log
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ._version import get_versions
|
||||
|
||||
# ~~ version
|
||||
|
||||
from ._version import get_versions
|
||||
|
||||
versions = get_versions()
|
||||
|
||||
@@ -222,7 +223,7 @@ def init_platform(
|
||||
def init_settings(basedir, configfile):
|
||||
"""Inits the settings instance based on basedir and configfile to use."""
|
||||
|
||||
from octoprint.settings import settings, InvalidSettings
|
||||
from octoprint.settings import InvalidSettings, settings
|
||||
|
||||
try:
|
||||
return settings(init=True, basedir=basedir, configfile=configfile)
|
||||
@@ -562,9 +563,10 @@ def init_pluginsystem(
|
||||
|
||||
|
||||
def get_plugin_blacklist(settings, connectivity_checker=None):
|
||||
import requests
|
||||
import os
|
||||
import time
|
||||
|
||||
import requests
|
||||
import yaml
|
||||
|
||||
from octoprint.util import bom_aware_open
|
||||
|
||||
@@ -14,11 +14,11 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
|
||||
import errno
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import logging
|
||||
|
||||
|
||||
def get_keywords():
|
||||
|
||||
@@ -11,16 +11,14 @@ import os
|
||||
from functools import partial
|
||||
|
||||
import yaml
|
||||
|
||||
from past.builtins import basestring
|
||||
|
||||
from octoprint.access import ADMIN_GROUP, GUEST_GROUP, READONLY_GROUP, USER_GROUP
|
||||
from octoprint.access.permissions import OctoPrintPermission, Permissions
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import atomic_write
|
||||
from octoprint.access import ADMIN_GROUP, USER_GROUP, GUEST_GROUP, READONLY_GROUP
|
||||
from octoprint.access.permissions import Permissions, OctoPrintPermission
|
||||
from octoprint.vendor.flask_principal import Need, Permission
|
||||
|
||||
|
||||
GroupNeed = partial(Need, "group")
|
||||
GroupNeed.__doc__ = """A need with the method preset to `"group"`."""
|
||||
|
||||
|
||||
@@ -5,18 +5,18 @@ __author__ = "Marc Hannappel <salandora@gmail.com>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from future.utils import with_metaclass
|
||||
from flask import g, abort
|
||||
from flask_babel import gettext
|
||||
from octoprint.vendor.flask_principal import Permission, PermissionDenied, RoleNeed, Need
|
||||
|
||||
from functools import wraps
|
||||
from collections import OrderedDict, defaultdict
|
||||
from functools import wraps
|
||||
|
||||
from flask import abort, g
|
||||
from flask_babel import gettext
|
||||
from future.utils import with_metaclass
|
||||
|
||||
# noinspection PyCompatibility
|
||||
from past.builtins import basestring
|
||||
|
||||
from octoprint.access import ADMIN_GROUP, USER_GROUP, READONLY_GROUP
|
||||
from octoprint.access import ADMIN_GROUP, READONLY_GROUP, USER_GROUP
|
||||
from octoprint.vendor.flask_principal import Need, Permission, PermissionDenied, RoleNeed
|
||||
|
||||
|
||||
class OctoPrintPermission(Permission):
|
||||
|
||||
@@ -4,36 +4,28 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask_login import UserMixin, AnonymousUserMixin
|
||||
from werkzeug.local import LocalProxy
|
||||
import hashlib
|
||||
import io
|
||||
import os
|
||||
import yaml
|
||||
import uuid
|
||||
import wrapt
|
||||
import time
|
||||
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
|
||||
# noinspection PyCompatibility
|
||||
from builtins import range, bytes
|
||||
|
||||
from octoprint.settings import settings as s
|
||||
|
||||
from octoprint.util import (
|
||||
atomic_write,
|
||||
to_bytes,
|
||||
deprecated,
|
||||
monotonic_time,
|
||||
generate_api_key,
|
||||
)
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
|
||||
from octoprint.access.permissions import Permissions, OctoPrintPermission
|
||||
from octoprint.access.groups import GroupChangeListener, Group
|
||||
from builtins import bytes, range
|
||||
|
||||
import wrapt
|
||||
import yaml
|
||||
from flask_login import AnonymousUserMixin, UserMixin
|
||||
from past.builtins import basestring
|
||||
from werkzeug.local import LocalProxy
|
||||
|
||||
from octoprint.access.groups import Group, GroupChangeListener
|
||||
from octoprint.access.permissions import OctoPrintPermission, Permissions
|
||||
from octoprint.settings import settings as s
|
||||
from octoprint.util import atomic_write, deprecated, generate_api_key
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
from octoprint.util import monotonic_time, to_bytes
|
||||
|
||||
|
||||
class UserManager(GroupChangeListener, object):
|
||||
|
||||
@@ -8,9 +8,10 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms
|
||||
import click
|
||||
|
||||
click.disable_unicode_literals_warning = True
|
||||
import octoprint
|
||||
import sys
|
||||
|
||||
import octoprint
|
||||
|
||||
# ~~ click context
|
||||
|
||||
|
||||
@@ -46,6 +47,7 @@ def hidden_option(*param_decls, **attrs):
|
||||
"""
|
||||
|
||||
import inspect
|
||||
|
||||
from click.decorators import _param_memo
|
||||
|
||||
def decorator(f):
|
||||
@@ -197,12 +199,12 @@ legacy_options = bulk_options(
|
||||
|
||||
# ~~ "octoprint" command, merges server_commands and plugin_commands groups
|
||||
|
||||
from .server import server_commands
|
||||
from .plugins import plugin_commands
|
||||
from .dev import dev_commands
|
||||
from .analysis import analysis_commands
|
||||
from .client import client_commands
|
||||
from .config import config_commands
|
||||
from .analysis import analysis_commands
|
||||
from .dev import dev_commands
|
||||
from .plugins import plugin_commands
|
||||
from .server import server_commands
|
||||
from .user import user_commands
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,9 @@ def gcode_command(
|
||||
"""Runs a GCODE file analysis."""
|
||||
|
||||
import time
|
||||
|
||||
import yaml
|
||||
|
||||
from octoprint.util import monotonic_time
|
||||
from octoprint.util.gcodeInterpreter import gcode
|
||||
|
||||
|
||||
@@ -11,13 +11,12 @@ click.disable_unicode_literals_warning = True
|
||||
import io
|
||||
import json
|
||||
|
||||
import octoprint_client
|
||||
|
||||
from octoprint.cli import get_ctx_obj_option, bulk_options
|
||||
from octoprint import init_settings, FatalStartupError
|
||||
|
||||
from past.builtins import unicode
|
||||
|
||||
import octoprint_client
|
||||
from octoprint import FatalStartupError, init_settings
|
||||
from octoprint.cli import bulk_options, get_ctx_obj_option
|
||||
|
||||
|
||||
class JsonStringParamType(click.ParamType):
|
||||
name = "json"
|
||||
|
||||
@@ -8,14 +8,14 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms
|
||||
import click
|
||||
|
||||
click.disable_unicode_literals_warning = True
|
||||
import json
|
||||
import logging
|
||||
|
||||
from octoprint import init_settings, FatalStartupError
|
||||
from octoprint.cli import standard_options, bulk_options, get_ctx_obj_option
|
||||
import pprint
|
||||
|
||||
import yaml
|
||||
import json
|
||||
import pprint
|
||||
|
||||
from octoprint import FatalStartupError, init_settings
|
||||
from octoprint.cli import bulk_options, get_ctx_obj_option, standard_options
|
||||
|
||||
|
||||
def _to_settings_path(path):
|
||||
|
||||
@@ -26,9 +26,10 @@ class OctoPrintDevelCommands(click.MultiCommand):
|
||||
def __init__(self, *args, **kwargs):
|
||||
click.MultiCommand.__init__(self, *args, **kwargs)
|
||||
|
||||
from octoprint.util.commandline import CommandlineCaller
|
||||
from functools import partial
|
||||
|
||||
from octoprint.util.commandline import CommandlineCaller
|
||||
|
||||
def log_util(f):
|
||||
def log(*lines):
|
||||
for line in lines:
|
||||
@@ -171,8 +172,8 @@ class OctoPrintDevelCommands(click.MultiCommand):
|
||||
# that tries to fix such permissions
|
||||
def onerror(func, path, exc_info):
|
||||
"""Originally from http://stackoverflow.com/a/2656405/2028598"""
|
||||
import stat
|
||||
import os
|
||||
import stat
|
||||
|
||||
if not os.access(path, os.W_OK):
|
||||
os.chmod(path, stat.S_IWUSR)
|
||||
|
||||
@@ -11,7 +11,7 @@ click.disable_unicode_literals_warning = True
|
||||
import logging
|
||||
import logging.config
|
||||
|
||||
from octoprint.cli import pass_octoprint_ctx, OctoPrintContext, get_ctx_obj_option
|
||||
from octoprint.cli import OctoPrintContext, get_ctx_obj_option, pass_octoprint_ctx
|
||||
from octoprint.util import dict_merge
|
||||
|
||||
LOGGING_CONFIG = {
|
||||
@@ -78,7 +78,7 @@ class OctoPrintPluginCommands(click.MultiCommand):
|
||||
|
||||
# initialize settings and plugin manager based on provided
|
||||
# context (basedir and configfile)
|
||||
from octoprint import init_settings, init_pluginsystem, FatalStartupError
|
||||
from octoprint import FatalStartupError, init_pluginsystem, init_settings
|
||||
|
||||
try:
|
||||
self.settings = init_settings(
|
||||
|
||||
@@ -13,9 +13,9 @@ import sys
|
||||
|
||||
from octoprint.cli import (
|
||||
bulk_options,
|
||||
standard_options,
|
||||
set_ctx_obj_option,
|
||||
get_ctx_obj_option,
|
||||
set_ctx_obj_option,
|
||||
standard_options,
|
||||
)
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ def run_server(
|
||||
):
|
||||
"""Initializes the environment and starts up the server."""
|
||||
|
||||
from octoprint import init_platform, __display_version__, FatalStartupError
|
||||
from octoprint import FatalStartupError, __display_version__, init_platform
|
||||
|
||||
def log_startup(recorder=None, safe_mode=None, **kwargs):
|
||||
from octoprint.logging import get_divider_line
|
||||
@@ -85,7 +85,7 @@ def run_server(
|
||||
def log_register_rollover(
|
||||
safe_mode=None, plugin_manager=None, environment_detector=None, **kwargs
|
||||
):
|
||||
from octoprint.logging import get_handler, log_to_handler, get_divider_line
|
||||
from octoprint.logging import get_divider_line, get_handler, log_to_handler
|
||||
from octoprint.logging.handlers import OctoPrintLogHandler
|
||||
|
||||
def rollover_callback():
|
||||
@@ -248,7 +248,7 @@ def server_commands():
|
||||
@click.pass_context
|
||||
def enable_safemode(ctx, **kwargs):
|
||||
"""Sets the safe mode flag for the next start."""
|
||||
from octoprint import init_settings, FatalStartupError
|
||||
from octoprint import FatalStartupError, init_settings
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG
|
||||
|
||||
@@ -5,13 +5,14 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2019 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import click
|
||||
import logging
|
||||
|
||||
import click
|
||||
|
||||
from octoprint import init_settings
|
||||
from octoprint.cli import get_ctx_obj_option
|
||||
from octoprint.access.groups import FilebasedGroupManager
|
||||
from octoprint.access.users import FilebasedUserManager, UnknownUser, UserAlreadyExists
|
||||
from octoprint.cli import get_ctx_obj_option
|
||||
from octoprint.util import get_class, sv
|
||||
|
||||
click.disable_unicode_literals_warning = True
|
||||
|
||||
@@ -7,7 +7,11 @@ Generic linux daemon base class
|
||||
Originally from http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/#c35
|
||||
"""
|
||||
|
||||
import io, sys, os, time, signal
|
||||
import io
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
||||
class Daemon:
|
||||
|
||||
@@ -9,9 +9,9 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import yaml
|
||||
|
||||
import psutil
|
||||
import yaml
|
||||
|
||||
from octoprint.plugin import EnvironmentDetectionPlugin
|
||||
from octoprint.util.platform import get_os
|
||||
|
||||
@@ -13,12 +13,13 @@ try:
|
||||
import queue
|
||||
except ImportError:
|
||||
import Queue as queue
|
||||
import threading
|
||||
|
||||
import collections
|
||||
import re
|
||||
import threading
|
||||
|
||||
from octoprint.settings import settings
|
||||
import octoprint.plugin
|
||||
from octoprint.settings import settings
|
||||
|
||||
# singleton
|
||||
_instance = None
|
||||
|
||||
@@ -5,25 +5,23 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import logging
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.util
|
||||
|
||||
from octoprint.events import eventManager, Events
|
||||
|
||||
from .destinations import FileDestinations
|
||||
from .analysis import QueueEntry, AnalysisQueue
|
||||
from .storage import LocalFileStorage
|
||||
from .util import AbstractFileWrapper, StreamWrapper, DiskFileWrapper
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
from past.builtins import basestring
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.util
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
|
||||
from .analysis import AnalysisQueue, QueueEntry
|
||||
from .destinations import FileDestinations
|
||||
from .storage import LocalFileStorage
|
||||
from .util import AbstractFileWrapper, DiskFileWrapper, StreamWrapper
|
||||
|
||||
ContentTypeMapping = namedtuple("ContentTypeMapping", "extensions, content_type")
|
||||
ContentTypeDetector = namedtuple("ContentTypeDetector", "extensions, detector")
|
||||
|
||||
@@ -937,7 +935,9 @@ class FileManager(object):
|
||||
|
||||
def save_recovery_data(self, origin, path, pos):
|
||||
import time
|
||||
|
||||
import yaml
|
||||
|
||||
from octoprint.util import atomic_write
|
||||
|
||||
data = {
|
||||
|
||||
@@ -12,15 +12,17 @@ try:
|
||||
import queue
|
||||
except ImportError:
|
||||
import Queue as queue
|
||||
|
||||
import collections
|
||||
import os
|
||||
import threading
|
||||
import collections
|
||||
import time
|
||||
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import dict_merge
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
from octoprint.util import monotonic_time
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn, dict_merge
|
||||
from octoprint.util.platform import CLOSE_FDS
|
||||
|
||||
|
||||
@@ -391,8 +393,9 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
|
||||
self._reenqueue = False
|
||||
|
||||
def _do_analysis(self, high_priority=False):
|
||||
import sarge
|
||||
import sys
|
||||
|
||||
import sarge
|
||||
import yaml
|
||||
|
||||
if self._current.analysis and all(
|
||||
|
||||
@@ -5,30 +5,28 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import copy
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import re
|
||||
import shutil
|
||||
|
||||
import pylru
|
||||
import copy
|
||||
|
||||
try:
|
||||
from os import scandir, walk
|
||||
except ImportError:
|
||||
from scandir import scandir, walk
|
||||
|
||||
from octoprint.util import atomic_write, time_this
|
||||
from contextlib import contextmanager
|
||||
|
||||
from emoji import demojize
|
||||
from past.builtins import basestring
|
||||
|
||||
from emoji import demojize
|
||||
from octoprint.vendor.awesome_slugify import Slugify
|
||||
|
||||
import octoprint.filemanager
|
||||
|
||||
from octoprint.util import is_hidden_path, to_unicode, to_bytes
|
||||
from octoprint.util import atomic_write, is_hidden_path, time_this, to_bytes, to_unicode
|
||||
from octoprint.vendor.awesome_slugify import Slugify
|
||||
|
||||
|
||||
class StorageInterface(object):
|
||||
@@ -1911,9 +1909,10 @@ class LocalFileStorage(StorageInterface):
|
||||
|
||||
def _migrate_metadata(self, path):
|
||||
# we switched to json in 1.3.9 - if we still have yaml here, migrate it now
|
||||
import yaml
|
||||
import json
|
||||
|
||||
import yaml
|
||||
|
||||
with self._get_persisted_metadata_lock(path):
|
||||
metadata_path_yaml = os.path.join(path, ".metadata.yaml")
|
||||
metadata_path_json = os.path.join(path, ".metadata.json")
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
from typing import Union
|
||||
|
||||
from past.builtins import basestring, unicode
|
||||
|
||||
from octoprint.logging import handlers
|
||||
|
||||
from typing import Union
|
||||
|
||||
|
||||
def log_to_handler(logger, handler, level, msg, exc_info=None, extra=None, *args):
|
||||
"""
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
# noinspection PyCompatibility
|
||||
import concurrent.futures
|
||||
import logging.handlers
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
|
||||
# noinspection PyCompatibility
|
||||
import concurrent.futures
|
||||
|
||||
|
||||
class AsyncLogHandlerMixin(logging.Handler):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -19,15 +19,14 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
|
||||
from octoprint.settings import settings as s
|
||||
from octoprint.plugin.core import PluginInfo, PluginManager, Plugin
|
||||
from octoprint.plugin.types import OctoPrintPlugin, SettingsPlugin
|
||||
from octoprint.plugin.core import Plugin, PluginInfo, PluginManager
|
||||
from octoprint.plugin.types import * # noqa: F403 ## used by multiple other modules
|
||||
|
||||
from octoprint.plugin.types import OctoPrintPlugin, SettingsPlugin
|
||||
from octoprint.settings import settings as s
|
||||
from octoprint.util import deprecated, to_native_str
|
||||
|
||||
# singleton
|
||||
|
||||
@@ -25,21 +25,20 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import os
|
||||
import io
|
||||
from collections import defaultdict, namedtuple, OrderedDict
|
||||
import logging
|
||||
import fnmatch
|
||||
import inspect
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from collections import OrderedDict, defaultdict, namedtuple
|
||||
|
||||
import pkg_resources
|
||||
import pkginfo
|
||||
|
||||
from past.builtins import unicode
|
||||
|
||||
from octoprint.util import to_unicode, sv, time_this
|
||||
from octoprint.util.version import is_python_compatible, get_python_version_string
|
||||
from octoprint.util import sv, time_this, to_unicode
|
||||
from octoprint.util.version import get_python_version_string, is_python_compatible
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
@@ -911,9 +910,9 @@ class PluginManager(object):
|
||||
self._detect_python_environment()
|
||||
|
||||
def _detect_python_environment(self):
|
||||
import sys
|
||||
from distutils.command.install import install as cmd_install
|
||||
from distutils.dist import Distribution
|
||||
import sys
|
||||
|
||||
cmd = cmd_install(Distribution())
|
||||
cmd.finalize_options()
|
||||
|
||||
@@ -1554,9 +1554,10 @@ class SettingsPlugin(OctoPrintPlugin):
|
||||
|
||||
:return: the current settings of the plugin, as a dictionary
|
||||
"""
|
||||
from flask_login import current_user
|
||||
import copy
|
||||
|
||||
from flask_login import current_user
|
||||
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
data = copy.deepcopy(self._settings.get_all_data(merged=True))
|
||||
|
||||
@@ -4,16 +4,15 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from octoprint.access import USER_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import Events
|
||||
import time
|
||||
|
||||
import flask
|
||||
from flask_babel import gettext
|
||||
|
||||
import time
|
||||
import octoprint.plugin
|
||||
from octoprint.access import USER_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import Events
|
||||
|
||||
|
||||
class ActionCommandNotificationPlugin(
|
||||
|
||||
@@ -4,15 +4,14 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
import flask
|
||||
from flask_babel import gettext
|
||||
|
||||
from octoprint.server import user_permission
|
||||
import octoprint.plugin
|
||||
from octoprint.access import USER_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import Events
|
||||
|
||||
import flask
|
||||
from flask_babel import gettext
|
||||
from octoprint.server import user_permission
|
||||
|
||||
|
||||
class Prompt(object):
|
||||
|
||||
@@ -6,33 +6,33 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2016 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
import calendar
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import threading
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
PY2 = sys.version_info[0] < 3
|
||||
|
||||
import feedparser
|
||||
import flask
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
import feedparser
|
||||
import flask
|
||||
from flask_babel import gettext
|
||||
|
||||
from octoprint import __version__ as OCTOPRINT_VERSION
|
||||
from octoprint.access import ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server.util.flask import (
|
||||
check_etag,
|
||||
no_firstrun_access,
|
||||
with_revalidation_checking,
|
||||
check_etag,
|
||||
)
|
||||
from octoprint.util import utmify, count, monotonic_time
|
||||
from flask_babel import gettext
|
||||
from octoprint import __version__ as OCTOPRINT_VERSION
|
||||
from octoprint.util import count, monotonic_time, utmify
|
||||
|
||||
|
||||
class AnnouncementPlugin(
|
||||
@@ -278,8 +278,8 @@ class AnnouncementPlugin(
|
||||
@no_firstrun_access
|
||||
@Permissions.PLUGIN_ANNOUNCEMENTS_READ.require(403)
|
||||
def channel_command(self, channel):
|
||||
from octoprint.server.util.flask import get_json_command_from_request
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.server.util.flask import get_json_command_from_request
|
||||
|
||||
valid_commands = {"read": ["until"], "toggle": []}
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import flask
|
||||
import threading
|
||||
import os
|
||||
import yaml
|
||||
import io
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import uuid
|
||||
from collections import defaultdict
|
||||
|
||||
import flask
|
||||
import yaml
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.server.util.flask import restricted_access, no_firstrun_access
|
||||
from octoprint.server import NO_CONTENT, current_user, admin_permission
|
||||
from octoprint.util import atomic_write, monotonic_time, ResettableTimer, generate_api_key
|
||||
|
||||
from octoprint.access import ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server import NO_CONTENT, admin_permission, current_user
|
||||
from octoprint.server.util.flask import no_firstrun_access, restricted_access
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.util import ResettableTimer, atomic_write, generate_api_key, monotonic_time
|
||||
|
||||
CUTOFF_TIME = 10 * 60 # 10min
|
||||
POLL_TIMEOUT = 5 # 5 seconds
|
||||
|
||||
@@ -5,23 +5,22 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from octoprint.settings import default_settings
|
||||
from octoprint.plugin.core import FolderOrigin
|
||||
from octoprint.server import admin_permission, NO_CONTENT
|
||||
from octoprint.server.util.flask import no_firstrun_access
|
||||
from octoprint.events import Events
|
||||
from octoprint.util import is_hidden_path, to_bytes
|
||||
from octoprint.util.version import (
|
||||
get_octoprint_version_string,
|
||||
get_octoprint_version,
|
||||
get_comparable_version,
|
||||
is_octoprint_compatible,
|
||||
)
|
||||
from octoprint.util.platform import is_os_compatible
|
||||
from octoprint.util.pip import LocalPipCaller
|
||||
from octoprint.access import ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import Events
|
||||
from octoprint.plugin.core import FolderOrigin
|
||||
from octoprint.server import NO_CONTENT, admin_permission
|
||||
from octoprint.server.util.flask import no_firstrun_access
|
||||
from octoprint.settings import default_settings
|
||||
from octoprint.util import is_hidden_path, to_bytes
|
||||
from octoprint.util.pip import LocalPipCaller
|
||||
from octoprint.util.platform import is_os_compatible
|
||||
from octoprint.util.version import (
|
||||
get_comparable_version,
|
||||
get_octoprint_version,
|
||||
get_octoprint_version_string,
|
||||
is_octoprint_compatible,
|
||||
)
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
@@ -34,26 +33,25 @@ except ImportError:
|
||||
zlib = None
|
||||
|
||||
|
||||
from flask_babel import gettext
|
||||
|
||||
import io
|
||||
import flask
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import requests
|
||||
import sarge
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
import zipfile
|
||||
import json
|
||||
import sys
|
||||
import traceback
|
||||
import zipfile
|
||||
|
||||
import flask
|
||||
import requests
|
||||
import sarge
|
||||
from flask_babel import gettext
|
||||
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
|
||||
|
||||
UNKNOWN_PLUGINS_FILE = "unknown_plugins_from_restore.json"
|
||||
|
||||
BACKUP_FILE_PREFIX = "octoprint-backup"
|
||||
@@ -428,14 +426,14 @@ class BackupPlugin(
|
||||
##~~ tornado hook
|
||||
|
||||
def route_hook(self, *args, **kwargs):
|
||||
from octoprint.server import app
|
||||
from octoprint.server.util.flask import admin_validator
|
||||
from octoprint.server.util.tornado import (
|
||||
LargeResponseHandler,
|
||||
access_validation_factory,
|
||||
path_validation_factory,
|
||||
)
|
||||
from octoprint.util import is_hidden_path
|
||||
from octoprint.server import app
|
||||
from octoprint.server.util.tornado import access_validation_factory
|
||||
from octoprint.server.util.flask import admin_validator
|
||||
|
||||
return [
|
||||
(
|
||||
|
||||
@@ -4,9 +4,10 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from flask_babel import gettext
|
||||
from .subwizards import Subwizards
|
||||
|
||||
|
||||
|
||||
@@ -4,14 +4,16 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
import sys
|
||||
import inspect
|
||||
import sys
|
||||
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.access import ADMIN_GROUP, USER_GROUP
|
||||
from octoprint.util import to_native_str
|
||||
|
||||
|
||||
# noinspection PyUnresolvedReferences,PyMethodMayBeStatic
|
||||
class ServerCommandsSubwizard(object):
|
||||
def _is_servercommands_wizard_firstrunonly(self):
|
||||
@@ -77,8 +79,9 @@ class AclSubwizard(object):
|
||||
|
||||
@octoprint.plugin.BlueprintPlugin.route("/acl", methods=["POST"])
|
||||
def acl_wizard_api(self):
|
||||
from flask import request, abort
|
||||
from octoprint.server.api import valid_boolean_trues, NO_CONTENT
|
||||
from flask import abort, request
|
||||
|
||||
from octoprint.server.api import NO_CONTENT, valid_boolean_trues
|
||||
|
||||
if (
|
||||
not self._settings.global_get(["server", "firstRun"])
|
||||
|
||||
@@ -11,12 +11,12 @@ The SSDP/UPNP implementations has been largely inspired by https://gist.github.c
|
||||
For a spec see http://www.upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.0.pdf
|
||||
"""
|
||||
|
||||
import flask
|
||||
from flask_babel import gettext
|
||||
|
||||
# noinspection PyCompatibility
|
||||
from builtins import range
|
||||
|
||||
import flask
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.util
|
||||
|
||||
@@ -28,10 +28,10 @@ except ImportError:
|
||||
# python 2: vendored version with some backported fixes
|
||||
import octoprint.vendor.zeroconf as zeroconf
|
||||
|
||||
import time
|
||||
import collections
|
||||
import socket
|
||||
import platform
|
||||
import socket
|
||||
import time
|
||||
|
||||
|
||||
def __plugin_load__():
|
||||
@@ -420,8 +420,8 @@ class DiscoveryPlugin(
|
||||
supplied to the callback instead)
|
||||
"""
|
||||
|
||||
import threading
|
||||
import io
|
||||
import threading
|
||||
|
||||
try:
|
||||
# noinspection PyCompatibility
|
||||
|
||||
@@ -4,18 +4,18 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2019 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
import logging
|
||||
|
||||
from flask import jsonify
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
from octoprint.util.version import (
|
||||
get_octoprint_version_string,
|
||||
is_released_octoprint_version,
|
||||
)
|
||||
|
||||
from flask import jsonify
|
||||
from flask_babel import gettext
|
||||
|
||||
SENTRY_URL_SERVER = (
|
||||
"https://d479a74f172d4ac2b959a9a7d0536a82@o118517.ingest.sentry.io/1373987"
|
||||
)
|
||||
@@ -31,9 +31,10 @@ SETTINGS_DEFAULTS = {
|
||||
"url_coreui": SENTRY_URL_COREUI,
|
||||
}
|
||||
|
||||
import serial
|
||||
import requests.exceptions
|
||||
import errno
|
||||
|
||||
import requests.exceptions
|
||||
import serial
|
||||
import tornado.websocket
|
||||
|
||||
IGNORED_EXCEPTIONS = [
|
||||
@@ -168,6 +169,7 @@ def _enable_errortracking():
|
||||
|
||||
if _is_enabled(enabled, enabled_unreleased):
|
||||
import sentry_sdk
|
||||
|
||||
from octoprint.plugin import plugin_manager
|
||||
|
||||
def _before_send(event, hint):
|
||||
|
||||
@@ -4,10 +4,10 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
|
||||
class GcodeviewerPlugin(
|
||||
octoprint.plugin.AssetPlugin,
|
||||
|
||||
@@ -4,24 +4,22 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.settings import settings
|
||||
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.server.util.flask import redirect_to_tornado, no_firstrun_access
|
||||
from octoprint.access import ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
from flask import request, jsonify, url_for, make_response
|
||||
from flask_babel import gettext
|
||||
|
||||
from werkzeug.utils import secure_filename
|
||||
from werkzeug.exceptions import BadRequest
|
||||
import yaml
|
||||
|
||||
import io
|
||||
import os
|
||||
|
||||
import yaml
|
||||
from flask import jsonify, make_response, request, url_for
|
||||
from flask_babel import gettext
|
||||
from werkzeug.exceptions import BadRequest
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.access import ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.server.util.flask import no_firstrun_access, redirect_to_tornado
|
||||
from octoprint.settings import settings
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
|
||||
@@ -4,20 +4,18 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import flask
|
||||
import io
|
||||
import os
|
||||
|
||||
import flask
|
||||
import sarge
|
||||
|
||||
from flask_babel import gettext
|
||||
from octoprint.util import RepeatedTimer
|
||||
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.access.groups import USER_GROUP
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.events
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.access.groups import USER_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.util import RepeatedTimer
|
||||
from octoprint.util.platform import CLOSE_FDS
|
||||
|
||||
_PROC_DT_MODEL_PATH = "/proc/device-tree/model"
|
||||
|
||||
@@ -5,50 +5,47 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import copy
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import filetype
|
||||
import pkg_resources
|
||||
import requests
|
||||
import sarge
|
||||
from flask import jsonify, make_response
|
||||
from flask_babel import gettext
|
||||
from past.builtins import basestring
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.plugin.core
|
||||
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.server.util.flask import (
|
||||
no_firstrun_access,
|
||||
with_revalidation_checking,
|
||||
check_etag,
|
||||
)
|
||||
from octoprint.access import ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.util import to_bytes, to_native_str, TemporaryDirectory
|
||||
from octoprint.events import Events
|
||||
from octoprint.server.util.flask import (
|
||||
check_etag,
|
||||
no_firstrun_access,
|
||||
with_revalidation_checking,
|
||||
)
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.util import TemporaryDirectory, to_bytes, to_native_str
|
||||
from octoprint.util.net import download_file
|
||||
from octoprint.util.pip import LocalPipCaller
|
||||
from octoprint.util.platform import get_os, is_os_compatible
|
||||
from octoprint.util.version import (
|
||||
get_octoprint_version_string,
|
||||
get_octoprint_version,
|
||||
get_octoprint_version_string,
|
||||
is_octoprint_compatible,
|
||||
is_python_compatible,
|
||||
)
|
||||
from octoprint.util.platform import get_os, is_os_compatible
|
||||
from octoprint.util.net import download_file
|
||||
from octoprint.events import Events
|
||||
|
||||
from flask import jsonify, make_response
|
||||
from flask_babel import gettext
|
||||
|
||||
import io
|
||||
import logging
|
||||
import sarge
|
||||
import sys
|
||||
import requests
|
||||
import re
|
||||
import os
|
||||
import copy
|
||||
import time
|
||||
import threading
|
||||
import tempfile
|
||||
import shutil
|
||||
import filetype
|
||||
import pkg_resources
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
|
||||
@@ -6,39 +6,37 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
import io
|
||||
import copy
|
||||
import flask
|
||||
import hashlib
|
||||
import io
|
||||
import logging
|
||||
import logging.handlers
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import logging
|
||||
import logging.handlers
|
||||
import hashlib
|
||||
import requests
|
||||
|
||||
# noinspection PyCompatibility
|
||||
from concurrent import futures
|
||||
|
||||
from . import version_checks, updaters, exceptions, util, cli
|
||||
|
||||
import flask
|
||||
import requests
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.settings
|
||||
from octoprint.access import ADMIN_GROUP, USER_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server import BRANCH, NO_CONTENT, REVISION, VERSION
|
||||
from octoprint.server.util.flask import (
|
||||
check_etag,
|
||||
no_firstrun_access,
|
||||
with_revalidation_checking,
|
||||
check_etag,
|
||||
)
|
||||
from octoprint.server import VERSION, REVISION, BRANCH, NO_CONTENT
|
||||
from octoprint.access import USER_GROUP, ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.util import dict_merge, to_unicode, get_formatted_size
|
||||
from octoprint.util.version import get_comparable_version, get_python_version_string
|
||||
from octoprint.util import dict_merge, get_formatted_size, to_unicode
|
||||
from octoprint.util.pip import LocalPipCaller
|
||||
import octoprint.settings
|
||||
from octoprint.util.version import get_comparable_version, get_python_version_string
|
||||
|
||||
from . import cli, exceptions, updaters, util, version_checks
|
||||
|
||||
# OctoPi 0.15+
|
||||
MINIMUM_PYTHON = "2.7.9"
|
||||
@@ -318,6 +316,7 @@ class SoftwareUpdatePlugin(
|
||||
def _check_storage(self):
|
||||
import distutils.sysconfig
|
||||
import tempfile
|
||||
|
||||
import psutil
|
||||
|
||||
storage_info = {}
|
||||
@@ -455,8 +454,9 @@ class SoftwareUpdatePlugin(
|
||||
|
||||
def _save_version_cache(self):
|
||||
import yaml
|
||||
from octoprint.util import atomic_write
|
||||
|
||||
from octoprint._version import get_versions
|
||||
from octoprint.util import atomic_write
|
||||
|
||||
octoprint_version = get_versions()["version"]
|
||||
self._version_cache["__version"] = octoprint_version
|
||||
|
||||
@@ -10,8 +10,10 @@ def commands(cli_group, pass_octoprint_ctx, *args, **kwargs):
|
||||
|
||||
click.disable_unicode_literals_warning = True
|
||||
import sys
|
||||
|
||||
import requests.exceptions
|
||||
from octoprint.cli.client import create_client, client_options
|
||||
|
||||
from octoprint.cli.client import client_options, create_client
|
||||
|
||||
@click.command("check")
|
||||
@click.option("--force", is_flag=True, help="Ignore the cache for the update check")
|
||||
|
||||
@@ -9,8 +9,8 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
import errno
|
||||
import sys
|
||||
import traceback
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from past.builtins import unicode
|
||||
|
||||
@@ -223,8 +223,8 @@ def _rescue_changes(git_executable, folder):
|
||||
)
|
||||
if stdout and "".join(stdout).strip():
|
||||
# we got changes in the working tree, maybe from the user, so we'll now rescue those into a patch
|
||||
import time
|
||||
import os
|
||||
import time
|
||||
|
||||
timestamp = time.strftime("%Y%m%d%H%M")
|
||||
patch = os.path.join(folder, "{}-preupdate.patch".format(timestamp))
|
||||
|
||||
@@ -5,4 +5,4 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from . import pip, python_updater, update_script, sleep_a_bit, single_file_plugin
|
||||
from . import pip, python_updater, single_file_plugin, sleep_a_bit, update_script
|
||||
@@ -7,10 +7,12 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
import pkg_resources
|
||||
|
||||
from octoprint.util.pip import PipCaller, UnknownPip
|
||||
from octoprint.util.version import get_comparable_version
|
||||
|
||||
from .. import exceptions
|
||||
|
||||
logger = logging.getLogger("octoprint.plugins.softwareupdate.updaters.pip")
|
||||
|
||||
@@ -4,15 +4,16 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import logging
|
||||
import shutil
|
||||
import os
|
||||
import ast
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import TemporaryDirectory
|
||||
from octoprint.util.net import download_file
|
||||
from octoprint.settings import settings
|
||||
|
||||
from .. import exceptions
|
||||
|
||||
logger = logging.getLogger(
|
||||
|
||||
@@ -5,13 +5,13 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import sys
|
||||
import logging
|
||||
|
||||
from ..exceptions import ConfigurationInvalid, UpdateError, CannotUpdateOffline
|
||||
import sys
|
||||
|
||||
from octoprint.util.commandline import CommandlineCaller, CommandlineError
|
||||
|
||||
from ..exceptions import CannotUpdateOffline, ConfigurationInvalid, UpdateError
|
||||
|
||||
|
||||
def _get_caller(log_cb=None):
|
||||
def _log_call(*lines):
|
||||
|
||||
@@ -6,12 +6,12 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
from .exceptions import ScriptError
|
||||
|
||||
import logging
|
||||
|
||||
from octoprint.util.platform import CLOSE_FDS
|
||||
|
||||
from .exceptions import ScriptError
|
||||
|
||||
|
||||
def execute(command, cwd=None, evaluate_returncode=True, **kwargs):
|
||||
do_async = kwargs.get("do_async", kwargs.get("async", False))
|
||||
|
||||
@@ -6,17 +6,17 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from . import (
|
||||
always_current,
|
||||
bitbucket_commit,
|
||||
commandline,
|
||||
git_commit,
|
||||
github_commit,
|
||||
github_release,
|
||||
bitbucket_commit,
|
||||
python_checker,
|
||||
never_current,
|
||||
always_current,
|
||||
pypi_release,
|
||||
httpheader,
|
||||
jsondata,
|
||||
never_current,
|
||||
pypi_release,
|
||||
python_checker,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import requests
|
||||
import logging
|
||||
import base64
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
BRANCH_HEAD_URL = (
|
||||
"https://api.bitbucket.org/2.0/repositories/{user}/{repo}/commit/{branch}"
|
||||
|
||||
@@ -8,7 +8,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
import logging
|
||||
|
||||
from ..exceptions import ConfigurationInvalid, CannotCheckOffline
|
||||
from ..exceptions import CannotCheckOffline, ConfigurationInvalid
|
||||
from ..util import execute
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
|
||||
import errno
|
||||
import logging
|
||||
import subprocess
|
||||
import sys
|
||||
import logging
|
||||
|
||||
from ..exceptions import ConfigurationInvalid
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import requests
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
BRANCH_HEAD_URL = "https://api.github.com/repos/{user}/{repo}/git/refs/heads/{branch}"
|
||||
|
||||
logger = logging.getLogger(
|
||||
|
||||
@@ -7,9 +7,10 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import requests
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
||||
from octoprint.util import sv
|
||||
from octoprint.util.version import get_comparable_version
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import requests
|
||||
import logging
|
||||
|
||||
from ..exceptions import ConfigurationInvalid, NetworkError, CannotCheckOffline
|
||||
import requests
|
||||
|
||||
from ..exceptions import CannotCheckOffline, ConfigurationInvalid, NetworkError
|
||||
|
||||
logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.etag")
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import requests
|
||||
import logging
|
||||
|
||||
from ..exceptions import ConfigurationInvalid, NetworkError, CannotCheckOffline
|
||||
import requests
|
||||
|
||||
from ..exceptions import CannotCheckOffline, ConfigurationInvalid, NetworkError
|
||||
|
||||
logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.jsondata")
|
||||
|
||||
|
||||
@@ -5,14 +5,15 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2019 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import logging
|
||||
|
||||
import pkg_resources
|
||||
import requests
|
||||
|
||||
from octoprint.util import to_native_str
|
||||
from octoprint.util.version import (
|
||||
is_python_compatible,
|
||||
get_comparable_version,
|
||||
is_prerelease,
|
||||
is_python_compatible,
|
||||
)
|
||||
|
||||
INFO_URL = "https://pypi.org/pypi/{package}/json"
|
||||
|
||||
@@ -5,7 +5,7 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from ..exceptions import ConfigurationInvalid, CannotCheckOffline
|
||||
from ..exceptions import CannotCheckOffline, ConfigurationInvalid
|
||||
|
||||
|
||||
def get_latest(target, check, full_data=False, online=True):
|
||||
|
||||
@@ -4,14 +4,14 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from flask_babel import gettext
|
||||
|
||||
import requests
|
||||
import hashlib
|
||||
import logging
|
||||
|
||||
import requests
|
||||
from flask_babel import gettext
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
try:
|
||||
# noinspection PyCompatibility
|
||||
from urllib.parse import urlencode
|
||||
@@ -21,9 +21,9 @@ except ImportError:
|
||||
# noinspection PyCompatibility
|
||||
import concurrent.futures
|
||||
|
||||
from octoprint.events import Events
|
||||
from octoprint.util import RepeatedTimer, monotonic_time
|
||||
from octoprint.util.version import get_octoprint_version_string
|
||||
from octoprint.events import Events
|
||||
|
||||
TRACKING_URL = "https://tracking.octoprint.org/track/{id}/{event}/"
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ class VirtualPrinterPlugin(
|
||||
return None
|
||||
|
||||
import logging.handlers
|
||||
|
||||
from octoprint.logging.handlers import CleaningTimedRotatingFileHandler
|
||||
|
||||
seriallog_handler = CleaningTimedRotatingFileHandler(
|
||||
|
||||
@@ -5,13 +5,13 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
|
||||
|
||||
import collections
|
||||
import io
|
||||
import time
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import math
|
||||
import collections
|
||||
import time
|
||||
|
||||
try:
|
||||
import queue
|
||||
@@ -24,21 +24,20 @@ except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
# noinspection PyCompatibility
|
||||
from past.builtins import basestring
|
||||
from typing import Any
|
||||
|
||||
from past.builtins import basestring
|
||||
from serial import SerialTimeoutException
|
||||
|
||||
from octoprint.plugin import plugin_manager
|
||||
from octoprint.util import (
|
||||
RepeatedTimer,
|
||||
get_dos_filename,
|
||||
monotonic_time,
|
||||
to_bytes,
|
||||
to_unicode,
|
||||
get_dos_filename,
|
||||
)
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
# noinspection PyBroadException
|
||||
class VirtualPrinter(object):
|
||||
|
||||
@@ -23,9 +23,9 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
import re
|
||||
|
||||
from octoprint.filemanager import FileDestinations
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import deprecated, natural_key
|
||||
from octoprint.filemanager import FileDestinations
|
||||
|
||||
|
||||
@deprecated(
|
||||
|
||||
@@ -147,11 +147,11 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import io
|
||||
import os
|
||||
import copy
|
||||
import re
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
@@ -159,7 +159,7 @@ except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import dict_merge, dict_sanitize, dict_contains_keys, is_hidden_path
|
||||
from octoprint.util import dict_contains_keys, dict_merge, dict_sanitize, is_hidden_path
|
||||
|
||||
|
||||
class SaveError(Exception):
|
||||
@@ -370,7 +370,7 @@ class PrinterProfileManager(object):
|
||||
|
||||
removed = self._remove_from_path(self._get_profile_path(identifier))
|
||||
if removed and trigger_event:
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.events import Events, eventManager
|
||||
|
||||
payload = {"identifier": identifier}
|
||||
eventManager().fire(Events.PRINTER_PROFILE_DELETED, payload=payload)
|
||||
@@ -406,7 +406,7 @@ class PrinterProfileManager(object):
|
||||
if self._current is not None and self._current["id"] == identifier:
|
||||
self.select(identifier)
|
||||
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.events import Events, eventManager
|
||||
|
||||
if trigger_event:
|
||||
payload = {"identifier": identifier}
|
||||
@@ -544,9 +544,10 @@ class PrinterProfileManager(object):
|
||||
"Profile %s already exists and not allowed to overwrite" % profile["id"]
|
||||
)
|
||||
|
||||
from octoprint.util import atomic_write
|
||||
import yaml
|
||||
|
||||
from octoprint.util import atomic_write
|
||||
|
||||
try:
|
||||
with atomic_write(path, mode="wt", max_permissions=0o666) as f:
|
||||
yaml.safe_dump(
|
||||
|
||||
@@ -15,28 +15,26 @@ import os
|
||||
import threading
|
||||
import time
|
||||
|
||||
from frozendict import frozendict
|
||||
from past.builtins import basestring, long
|
||||
|
||||
from frozendict import frozendict
|
||||
|
||||
from octoprint import util as util
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.filemanager import FileDestinations, NoSuchStorage, valid_file_type
|
||||
from octoprint.plugin import plugin_manager, ProgressPlugin
|
||||
from octoprint.plugin import ProgressPlugin, plugin_manager
|
||||
from octoprint.printer import (
|
||||
PrinterInterface,
|
||||
PrinterCallback,
|
||||
UnknownScript,
|
||||
InvalidFileLocation,
|
||||
InvalidFileType,
|
||||
PrinterCallback,
|
||||
PrinterInterface,
|
||||
UnknownScript,
|
||||
)
|
||||
from octoprint.printer.estimation import PrintTimeEstimator
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import comm as comm
|
||||
from octoprint.util import InvariantContainer
|
||||
from octoprint.util import to_unicode
|
||||
from octoprint.util import monotonic_time
|
||||
from octoprint.util import comm as comm
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
from octoprint.util import monotonic_time, to_unicode
|
||||
|
||||
|
||||
class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
@@ -5,56 +5,54 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import uuid
|
||||
from octoprint.vendor.sockjs.tornado import SockJSRouter
|
||||
from flask import (
|
||||
Flask,
|
||||
g,
|
||||
request,
|
||||
session,
|
||||
Blueprint,
|
||||
Request,
|
||||
Response,
|
||||
current_app,
|
||||
make_response,
|
||||
)
|
||||
from flask_login import LoginManager, current_user, session_protected, user_logged_out
|
||||
from octoprint.vendor.flask_principal import (
|
||||
Principal,
|
||||
Permission,
|
||||
RoleNeed,
|
||||
identity_loaded,
|
||||
identity_changed,
|
||||
UserNeed,
|
||||
Identity,
|
||||
AnonymousIdentity,
|
||||
)
|
||||
from flask_babel import Babel, gettext, ngettext
|
||||
from flask_assets import Environment, Bundle
|
||||
from babel import Locale
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.observers.polling import PollingObserver
|
||||
from collections import defaultdict, OrderedDict
|
||||
|
||||
from builtins import bytes, range
|
||||
from past.builtins import basestring, unicode
|
||||
|
||||
import octoprint.util
|
||||
import octoprint.util.net
|
||||
|
||||
from octoprint.server import util
|
||||
from octoprint.util.json import JsonEncoding
|
||||
|
||||
import atexit
|
||||
import base64
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import logging.config
|
||||
import mimetypes
|
||||
import atexit
|
||||
import signal
|
||||
import base64
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
import sys
|
||||
import uuid
|
||||
from builtins import bytes, range
|
||||
from collections import OrderedDict, defaultdict
|
||||
|
||||
from babel import Locale
|
||||
from flask import (
|
||||
Blueprint,
|
||||
Flask,
|
||||
Request,
|
||||
Response,
|
||||
current_app,
|
||||
g,
|
||||
make_response,
|
||||
request,
|
||||
session,
|
||||
)
|
||||
from flask_assets import Bundle, Environment
|
||||
from flask_babel import Babel, gettext, ngettext
|
||||
from flask_login import LoginManager, current_user, session_protected, user_logged_out
|
||||
from past.builtins import basestring, unicode
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.observers.polling import PollingObserver
|
||||
|
||||
import octoprint.util
|
||||
import octoprint.util.net
|
||||
from octoprint.server import util
|
||||
from octoprint.util.json import JsonEncoding
|
||||
from octoprint.vendor.flask_principal import (
|
||||
AnonymousIdentity,
|
||||
Identity,
|
||||
Permission,
|
||||
Principal,
|
||||
RoleNeed,
|
||||
UserNeed,
|
||||
identity_changed,
|
||||
identity_loaded,
|
||||
)
|
||||
from octoprint.vendor.sockjs.tornado import SockJSRouter
|
||||
|
||||
try:
|
||||
import fcntl
|
||||
@@ -91,8 +89,8 @@ connectivityChecker = None
|
||||
|
||||
principals = Principal(app)
|
||||
|
||||
import octoprint.access.permissions as permissions
|
||||
import octoprint.access.groups as groups
|
||||
import octoprint.access.permissions as permissions
|
||||
|
||||
# we set admin_permission to a GroupPermission with the default admin group
|
||||
admin_permission = octoprint.util.variable_deprecated(
|
||||
@@ -106,27 +104,28 @@ user_permission = octoprint.util.variable_deprecated(
|
||||
since="1.4.0",
|
||||
)(groups.GroupPermission(groups.USER_GROUP))
|
||||
|
||||
import octoprint._version
|
||||
import octoprint.access.groups as groups
|
||||
import octoprint.access.users as users
|
||||
import octoprint.events as events
|
||||
import octoprint.filemanager.analysis
|
||||
import octoprint.filemanager.storage
|
||||
import octoprint.plugin
|
||||
import octoprint.slicing
|
||||
import octoprint.timelapse
|
||||
|
||||
# only import further octoprint stuff down here, as it might depend on things defined above to be initialized already
|
||||
from octoprint import __version__, __branch__, __display_version__, __revision__
|
||||
from octoprint import __branch__, __display_version__, __revision__, __version__
|
||||
from octoprint.printer.profile import PrinterProfileManager
|
||||
from octoprint.printer.standard import Printer
|
||||
from octoprint.settings import settings
|
||||
import octoprint.access.users as users
|
||||
import octoprint.access.groups as groups
|
||||
import octoprint.events as events
|
||||
import octoprint.plugin
|
||||
import octoprint.timelapse
|
||||
import octoprint._version
|
||||
import octoprint.filemanager.storage
|
||||
import octoprint.filemanager.analysis
|
||||
import octoprint.slicing
|
||||
from octoprint.server.util import (
|
||||
loginFromApiKeyRequestHandler,
|
||||
corsRequestHandler,
|
||||
corsResponseHandler,
|
||||
loginFromApiKeyRequestHandler,
|
||||
requireLoginRequestHandler,
|
||||
)
|
||||
from octoprint.server.util.flask import PreemptiveCache
|
||||
from octoprint.settings import settings
|
||||
|
||||
VERSION = __version__
|
||||
BRANCH = __branch__
|
||||
@@ -581,9 +580,10 @@ class Server(object):
|
||||
|
||||
components_copy = dict(components)
|
||||
if "printer" in components:
|
||||
import wrapt
|
||||
import functools
|
||||
|
||||
import wrapt
|
||||
|
||||
def tagwrap(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
@@ -1379,11 +1379,11 @@ class Server(object):
|
||||
|
||||
def _setup_app(self, app):
|
||||
from octoprint.server.util.flask import (
|
||||
ReverseProxiedEnvironment,
|
||||
OctoPrintFlaskRequest,
|
||||
OctoPrintFlaskResponse,
|
||||
OctoPrintJsonEncoder,
|
||||
OctoPrintSessionInterface,
|
||||
ReverseProxiedEnvironment,
|
||||
)
|
||||
|
||||
s = settings()
|
||||
@@ -1567,6 +1567,7 @@ class Server(object):
|
||||
|
||||
# configure additional template folders for jinja2
|
||||
import jinja2
|
||||
|
||||
import octoprint.util.jinja
|
||||
|
||||
filesystem_loader = octoprint.util.jinja.FilteredFileSystemLoader(
|
||||
@@ -1613,9 +1614,10 @@ class Server(object):
|
||||
pluginLifecycleManager.add_callback("disabled", template_disabled)
|
||||
|
||||
def _execute_preemptive_flask_caching(self, preemptive_cache):
|
||||
from werkzeug.test import EnvironBuilder
|
||||
import time
|
||||
|
||||
from werkzeug.test import EnvironBuilder
|
||||
|
||||
# we clean up entries from our preemptive cache settings that haven't been
|
||||
# accessed longer than server.preemptiveCache.until days
|
||||
preemptive_cache_timeout = settings().getInt(
|
||||
@@ -1772,8 +1774,8 @@ class Server(object):
|
||||
self._template_searchpaths.remove(folder)
|
||||
|
||||
def _setup_blueprints(self):
|
||||
from octoprint.server.api import api
|
||||
import octoprint.server.views # do not remove or the index view won't be found
|
||||
from octoprint.server.api import api
|
||||
|
||||
blueprints = OrderedDict()
|
||||
blueprints["/api"] = api
|
||||
@@ -1939,8 +1941,8 @@ class Server(object):
|
||||
|
||||
# clean the folder
|
||||
if self._settings.getBoolean(["devel", "webassets", "clean_on_startup"]):
|
||||
import shutil
|
||||
import errno
|
||||
import shutil
|
||||
|
||||
for entry in ("webassets", ".webassets-cache"):
|
||||
path = os.path.join(base_folder, entry)
|
||||
@@ -2117,16 +2119,17 @@ class Server(object):
|
||||
]
|
||||
|
||||
# a couple of custom filters
|
||||
from octoprint.server.util.webassets import (
|
||||
LessImportRewrite,
|
||||
JsDelimiterBundler,
|
||||
SourceMapRewrite,
|
||||
SourceMapRemove,
|
||||
JsPluginBundle,
|
||||
GzipFile,
|
||||
)
|
||||
from webassets.filter import register_filter
|
||||
|
||||
from octoprint.server.util.webassets import (
|
||||
GzipFile,
|
||||
JsDelimiterBundler,
|
||||
JsPluginBundle,
|
||||
LessImportRewrite,
|
||||
SourceMapRemove,
|
||||
SourceMapRewrite,
|
||||
)
|
||||
|
||||
register_filter(LessImportRewrite)
|
||||
register_filter(SourceMapRewrite)
|
||||
register_filter(SourceMapRemove)
|
||||
@@ -2340,13 +2343,13 @@ class Server(object):
|
||||
def _start_intermediary_server(self):
|
||||
try:
|
||||
# noinspection PyCompatibility
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
except ImportError:
|
||||
# noinspection PyCompatibility
|
||||
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
|
||||
|
||||
import threading
|
||||
import socket
|
||||
import threading
|
||||
|
||||
host = self._host
|
||||
port = self._port
|
||||
|
||||
@@ -10,58 +10,57 @@ import logging
|
||||
|
||||
from flask import (
|
||||
Blueprint,
|
||||
request,
|
||||
jsonify,
|
||||
abort,
|
||||
current_app,
|
||||
session,
|
||||
make_response,
|
||||
g,
|
||||
jsonify,
|
||||
make_response,
|
||||
request,
|
||||
session,
|
||||
)
|
||||
from flask_login import login_user, logout_user, current_user
|
||||
from flask_login import current_user, login_user, logout_user
|
||||
from werkzeug.exceptions import HTTPException
|
||||
from octoprint.vendor.flask_principal import Identity, identity_changed, AnonymousIdentity
|
||||
|
||||
import octoprint.access.users
|
||||
import octoprint.util.net as util_net
|
||||
import octoprint.server
|
||||
import octoprint.plugin
|
||||
import octoprint.server
|
||||
import octoprint.util.net as util_net
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.settings import settings as s, valid_boolean_trues
|
||||
from octoprint.server.util import (
|
||||
noCachingExceptGetResponseHandler,
|
||||
loginFromApiKeyRequestHandler,
|
||||
loginFromAuthorizationHeaderRequestHandler,
|
||||
corsRequestHandler,
|
||||
corsResponseHandler,
|
||||
loginFromApiKeyRequestHandler,
|
||||
loginFromAuthorizationHeaderRequestHandler,
|
||||
noCachingExceptGetResponseHandler,
|
||||
)
|
||||
from octoprint.server.util.flask import (
|
||||
no_firstrun_access,
|
||||
get_json_command_from_request,
|
||||
passive_login,
|
||||
get_remote_address,
|
||||
no_firstrun_access,
|
||||
passive_login,
|
||||
)
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import eventManager, Events
|
||||
|
||||
from octoprint.settings import settings as s
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.vendor.flask_principal import AnonymousIdentity, Identity, identity_changed
|
||||
|
||||
# ~~ init api blueprint, including sub modules
|
||||
|
||||
api = Blueprint("api", __name__)
|
||||
|
||||
from . import printer as api_printer
|
||||
from . import job as api_job
|
||||
from . import access as api_access
|
||||
from . import connection as api_connection
|
||||
from . import files as api_files
|
||||
from . import settings as api_settings
|
||||
from . import timelapse as api_timelapse
|
||||
from . import access as api_access
|
||||
from . import users as api_users
|
||||
from . import slicing as api_slicing
|
||||
from . import printer_profiles as api_printer_profiles
|
||||
from . import job as api_job
|
||||
from . import languages as api_languages
|
||||
from . import printer as api_printer
|
||||
from . import printer_profiles as api_printer_profiles
|
||||
from . import settings as api_settings
|
||||
from . import slicing as api_slicing
|
||||
from . import system as api_system
|
||||
|
||||
from . import timelapse as api_timelapse
|
||||
from . import users as api_users
|
||||
|
||||
VERSION = "0.1"
|
||||
|
||||
@@ -409,6 +408,7 @@ def utilTest():
|
||||
|
||||
def _test_path(data):
|
||||
import os
|
||||
|
||||
from octoprint.util.paths import normalize
|
||||
|
||||
path = normalize(data["path"], real=False)
|
||||
@@ -530,6 +530,7 @@ def _test_path(data):
|
||||
|
||||
def _test_url(data):
|
||||
import requests
|
||||
|
||||
from octoprint import util as util
|
||||
|
||||
class StatusCodeRange(object):
|
||||
|
||||
@@ -5,17 +5,16 @@ __author__ = "Marc Hannappel <salandora@gmail.com>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask import request, jsonify, abort, make_response
|
||||
from werkzeug.exceptions import BadRequest
|
||||
from flask import abort, jsonify, make_response, request
|
||||
from flask_login import current_user
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
import octoprint.access.groups as groups
|
||||
import octoprint.access.users as users
|
||||
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server import SUCCESS, groupManager, userManager
|
||||
from octoprint.server.api import api, valid_boolean_trues
|
||||
from octoprint.server.util.flask import no_firstrun_access
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
# ~~ permission api
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask import request, jsonify, make_response
|
||||
from flask import jsonify, make_response, request
|
||||
|
||||
from octoprint.settings import settings
|
||||
from octoprint.server import printer, printerProfileManager, NO_CONTENT
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import no_firstrun_access, get_json_command_from_request
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server import NO_CONTENT, printer, printerProfileManager
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import get_json_command_from_request, no_firstrun_access
|
||||
from octoprint.settings import settings
|
||||
|
||||
|
||||
@api.route("/connection", methods=["GET"])
|
||||
|
||||
@@ -5,40 +5,37 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask import request, jsonify, make_response, url_for
|
||||
|
||||
from octoprint.filemanager.destinations import FileDestinations
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
from octoprint.server import (
|
||||
printer,
|
||||
fileManager,
|
||||
slicingManager,
|
||||
eventManager,
|
||||
NO_CONTENT,
|
||||
current_user,
|
||||
)
|
||||
from octoprint.server.util.flask import (
|
||||
no_firstrun_access,
|
||||
get_json_command_from_request,
|
||||
with_revalidation_checking,
|
||||
)
|
||||
from octoprint.server.api import api
|
||||
from octoprint.events import Events
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
import octoprint.filemanager
|
||||
import octoprint.filemanager.util
|
||||
import octoprint.filemanager.storage
|
||||
import octoprint.slicing
|
||||
|
||||
from octoprint.util import sv, time_this
|
||||
|
||||
import os
|
||||
import psutil
|
||||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
|
||||
import psutil
|
||||
from flask import jsonify, make_response, request, url_for
|
||||
|
||||
import octoprint.filemanager
|
||||
import octoprint.filemanager.storage
|
||||
import octoprint.filemanager.util
|
||||
import octoprint.slicing
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import Events
|
||||
from octoprint.filemanager.destinations import FileDestinations
|
||||
from octoprint.server import (
|
||||
NO_CONTENT,
|
||||
current_user,
|
||||
eventManager,
|
||||
fileManager,
|
||||
printer,
|
||||
slicingManager,
|
||||
)
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import (
|
||||
get_json_command_from_request,
|
||||
no_firstrun_access,
|
||||
with_revalidation_checking,
|
||||
)
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
from octoprint.util import sv, time_this
|
||||
|
||||
# ~~ GCODE file handling
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask import request, make_response, jsonify
|
||||
from flask import jsonify, make_response, request
|
||||
|
||||
from octoprint.server import printer, NO_CONTENT, current_user
|
||||
from octoprint.server.util.flask import no_firstrun_access, get_json_command_from_request
|
||||
from octoprint.server.api import api
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server import NO_CONTENT, current_user, printer
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import get_json_command_from_request, no_firstrun_access
|
||||
|
||||
|
||||
@api.route("/job", methods=["POST"])
|
||||
|
||||
@@ -6,10 +6,10 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import tarfile
|
||||
import zipfile
|
||||
import logging
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
@@ -18,17 +18,14 @@ except ImportError:
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
from flask import request, jsonify, make_response
|
||||
|
||||
from octoprint.settings import settings
|
||||
from flask import jsonify, make_response, request
|
||||
from flask_babel import Locale
|
||||
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.plugin import plugin_manager
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import no_firstrun_access
|
||||
|
||||
from octoprint.plugin import plugin_manager
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
from flask_babel import Locale
|
||||
from octoprint.settings import settings
|
||||
|
||||
|
||||
@api.route("/languages", methods=["GET"])
|
||||
|
||||
@@ -5,20 +5,18 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask import request, jsonify, make_response, Response
|
||||
from werkzeug.exceptions import BadRequest
|
||||
import re
|
||||
|
||||
from past.builtins import long, unicode, basestring
|
||||
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
from octoprint.server import printer, printerProfileManager, NO_CONTENT
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import no_firstrun_access, get_json_command_from_request
|
||||
|
||||
from octoprint.printer import UnknownScript
|
||||
from flask import Response, jsonify, make_response, request
|
||||
from past.builtins import basestring, long, unicode
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.printer import UnknownScript
|
||||
from octoprint.server import NO_CONTENT, printer, printerProfileManager
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import get_json_command_from_request, no_firstrun_access
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
|
||||
# ~~ Printer
|
||||
|
||||
|
||||
@@ -9,18 +9,16 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
import copy
|
||||
|
||||
from flask import jsonify, make_response, request, url_for
|
||||
from past.builtins import basestring
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
from past.builtins import basestring
|
||||
|
||||
from octoprint.server.api import api, NO_CONTENT, valid_boolean_trues
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.printer.profile import CouldNotOverwriteError, InvalidProfileError
|
||||
from octoprint.server import printerProfileManager
|
||||
from octoprint.server.api import NO_CONTENT, api, valid_boolean_trues
|
||||
from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking
|
||||
from octoprint.util import dict_merge
|
||||
|
||||
from octoprint.server import printerProfileManager
|
||||
from octoprint.printer.profile import InvalidProfileError, CouldNotOverwriteError
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
|
||||
def _lastmodified():
|
||||
return printerProfileManager.last_modified
|
||||
|
||||
@@ -7,20 +7,18 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
|
||||
import logging
|
||||
|
||||
from flask import request, jsonify, make_response, abort
|
||||
from flask import abort, jsonify, make_response, request
|
||||
from flask_login import current_user
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
|
||||
from octoprint.server import admin_permission, printer, pluginManager
|
||||
from octoprint.server.api import api, NO_CONTENT
|
||||
from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.util
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.server import admin_permission, pluginManager, printer
|
||||
from octoprint.server.api import NO_CONTENT, api
|
||||
from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
|
||||
# ~~ settings
|
||||
|
||||
|
||||
@@ -5,24 +5,22 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from flask import request, jsonify, make_response, url_for
|
||||
from flask import jsonify, make_response, request, url_for
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
from octoprint.server import slicingManager
|
||||
from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking
|
||||
from octoprint.server.api import api, NO_CONTENT
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
from octoprint.settings import settings as s, valid_boolean_trues
|
||||
|
||||
from octoprint.server import slicingManager
|
||||
from octoprint.server.api import NO_CONTENT, api
|
||||
from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking
|
||||
from octoprint.settings import settings as s
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.slicing import (
|
||||
UnknownSlicer,
|
||||
CouldNotDeleteProfile,
|
||||
SlicerNotConfigured,
|
||||
UnknownProfile,
|
||||
CouldNotDeleteProfile,
|
||||
UnknownSlicer,
|
||||
)
|
||||
|
||||
|
||||
_DATA_FORMAT_VERSION = "v2"
|
||||
|
||||
|
||||
|
||||
@@ -6,21 +6,19 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms
|
||||
|
||||
import collections
|
||||
import logging
|
||||
import sarge
|
||||
import threading
|
||||
|
||||
from flask import request, make_response, jsonify, url_for
|
||||
import psutil
|
||||
import sarge
|
||||
from flask import jsonify, make_response, request, url_for
|
||||
from flask_babel import gettext
|
||||
|
||||
import psutil
|
||||
|
||||
from octoprint.settings import settings as s
|
||||
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import no_firstrun_access, get_remote_address
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.logging import prefix_multilines
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import get_remote_address, no_firstrun_access
|
||||
from octoprint.settings import settings as s
|
||||
from octoprint.util.platform import CLOSE_FDS
|
||||
|
||||
|
||||
|
||||
@@ -5,27 +5,24 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
import logging
|
||||
|
||||
from flask import request, jsonify, url_for, make_response
|
||||
from flask import jsonify, make_response, request, url_for
|
||||
|
||||
import octoprint.timelapse
|
||||
import octoprint.util as util
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
|
||||
from octoprint.server import admin_permission, printer
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.server import NO_CONTENT, admin_permission, printer
|
||||
from octoprint.server.api import api
|
||||
from octoprint.server.util.flask import (
|
||||
redirect_to_tornado,
|
||||
no_firstrun_access,
|
||||
get_json_command_from_request,
|
||||
no_firstrun_access,
|
||||
redirect_to_tornado,
|
||||
with_revalidation_checking,
|
||||
)
|
||||
from octoprint.server.api import api
|
||||
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.settings import settings, valid_boolean_trues
|
||||
|
||||
_DATA_FORMAT_VERSION = "v2"
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from octoprint.server.api import api
|
||||
from flask import redirect, url_for
|
||||
|
||||
from octoprint.server.api import api
|
||||
|
||||
# NOTE: The redirects here should rather be 308 PERMANENT REDIRECT, however RFC7538 doesn't seem to be supported
|
||||
# by all browsers yet. So we stick to 307 TEMPORARY REDIRECT as defined in RFC7231 although it's definitely not a
|
||||
# temporary redirect we have here.
|
||||
|
||||
@@ -10,22 +10,19 @@ import sys
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
from octoprint.settings import settings
|
||||
import octoprint.timelapse
|
||||
import octoprint.server
|
||||
|
||||
from octoprint.util import deprecated, to_unicode
|
||||
from octoprint.plugin import plugin_manager
|
||||
import logging
|
||||
|
||||
import flask as _flask
|
||||
import flask_login
|
||||
import octoprint.vendor.flask_principal as flask_principal
|
||||
import logging
|
||||
|
||||
from . import flask
|
||||
from . import sockjs
|
||||
from . import tornado
|
||||
from . import watchdog
|
||||
import octoprint.server
|
||||
import octoprint.timelapse
|
||||
import octoprint.vendor.flask_principal as flask_principal
|
||||
from octoprint.plugin import plugin_manager
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import deprecated, to_unicode
|
||||
|
||||
from . import flask, sockjs, tornado, watchdog
|
||||
|
||||
|
||||
@deprecated(
|
||||
|
||||
@@ -7,42 +7,38 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import tornado.web
|
||||
import collections
|
||||
import functools
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import uuid
|
||||
|
||||
import flask
|
||||
import flask.json
|
||||
import flask.sessions
|
||||
import flask_login
|
||||
import octoprint.vendor.flask_principal as flask_principal
|
||||
import flask_assets
|
||||
import flask_login
|
||||
import netaddr
|
||||
import tornado.web
|
||||
import webassets.updater
|
||||
import webassets.utils
|
||||
import functools
|
||||
import time
|
||||
import uuid
|
||||
import threading
|
||||
import logging
|
||||
import netaddr
|
||||
import os
|
||||
import io
|
||||
import collections
|
||||
from cachelib import BaseCache
|
||||
from past.builtins import basestring, long
|
||||
from werkzeug.local import LocalProxy
|
||||
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import deprecated
|
||||
import octoprint.server
|
||||
import octoprint.access.users
|
||||
import octoprint.plugin
|
||||
|
||||
from octoprint.util import DefaultOrderedDict
|
||||
import octoprint.server
|
||||
import octoprint.vendor.flask_principal as flask_principal
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import DefaultOrderedDict, deprecated
|
||||
from octoprint.util.json import JsonEncoding
|
||||
from octoprint.util.net import is_lan_address
|
||||
|
||||
from octoprint.events import eventManager, Events
|
||||
|
||||
from werkzeug.local import LocalProxy
|
||||
from cachelib import BaseCache
|
||||
|
||||
from past.builtins import basestring, long
|
||||
|
||||
try:
|
||||
from os import scandir, walk
|
||||
except ImportError:
|
||||
@@ -53,9 +49,10 @@ except ImportError:
|
||||
|
||||
def enable_additional_translations(default_locale="en", additional_folders=None):
|
||||
import os
|
||||
from flask import _request_ctx_stack
|
||||
from babel import support, Locale
|
||||
|
||||
import flask_babel
|
||||
from babel import Locale, support
|
||||
from flask import _request_ctx_stack
|
||||
|
||||
if additional_folders is None:
|
||||
additional_folders = []
|
||||
@@ -186,9 +183,9 @@ def fix_webassets_cache():
|
||||
|
||||
def fixed_set(self, key, data):
|
||||
import os
|
||||
import tempfile
|
||||
import pickle
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
if not os.path.exists(self.directory):
|
||||
error_logger.warning(
|
||||
@@ -209,9 +206,10 @@ def fix_webassets_cache():
|
||||
raise
|
||||
|
||||
def fixed_get(self, key):
|
||||
import os
|
||||
import errno
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from webassets.cache import make_md5
|
||||
|
||||
if not os.path.exists(self.directory):
|
||||
@@ -254,7 +252,7 @@ def fix_webassets_cache():
|
||||
|
||||
|
||||
def fix_webassets_filtertool():
|
||||
from webassets.merge import FilterTool, log, MemoryHunk
|
||||
from webassets.merge import FilterTool, MemoryHunk, log
|
||||
|
||||
error_logger = logging.getLogger(__name__ + ".fix_webassets_filtertool")
|
||||
|
||||
@@ -1050,9 +1048,10 @@ class PreemptiveCache(object):
|
||||
return cache_data.get(root, list())
|
||||
|
||||
def set_all_data(self, data):
|
||||
from octoprint.util import atomic_write
|
||||
import yaml
|
||||
|
||||
from octoprint.util import atomic_write
|
||||
|
||||
with self._lock:
|
||||
try:
|
||||
with atomic_write(self.cachefile, "wt", max_permissions=0o666) as handle:
|
||||
@@ -1468,9 +1467,10 @@ def get_flask_user_from_request(request):
|
||||
:param request: flask request from which to retrieve the current user
|
||||
:return: the user (might be an anonymous user)
|
||||
"""
|
||||
import octoprint.server.util
|
||||
import flask_login
|
||||
|
||||
import octoprint.server.util
|
||||
|
||||
user = None
|
||||
|
||||
apikey = octoprint.server.util.get_api_key(request)
|
||||
|
||||
@@ -5,32 +5,30 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import json
|
||||
import logging
|
||||
import threading
|
||||
import octoprint.vendor.sockjs.tornado
|
||||
import octoprint.vendor.sockjs.tornado.session
|
||||
import octoprint.vendor.sockjs.tornado.proto
|
||||
import octoprint.vendor.sockjs.tornado.util
|
||||
import time
|
||||
|
||||
import octoprint.timelapse
|
||||
import octoprint.server
|
||||
import wrapt
|
||||
|
||||
import octoprint.access.users
|
||||
import octoprint.events
|
||||
import octoprint.plugin
|
||||
import octoprint.access.users
|
||||
|
||||
from octoprint.events import Events
|
||||
from octoprint.settings import settings
|
||||
import octoprint.printer
|
||||
import octoprint.server
|
||||
import octoprint.timelapse
|
||||
import octoprint.vendor.sockjs.tornado
|
||||
import octoprint.vendor.sockjs.tornado.proto
|
||||
import octoprint.vendor.sockjs.tornado.session
|
||||
import octoprint.vendor.sockjs.tornado.util
|
||||
from octoprint.access.groups import GroupChangeListener
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.access.users import LoginStatusListener
|
||||
from octoprint.access.groups import GroupChangeListener
|
||||
from octoprint.events import Events
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util.json import JsonEncoding
|
||||
|
||||
import octoprint.printer
|
||||
|
||||
import wrapt
|
||||
import json
|
||||
|
||||
|
||||
class ThreadSafeSession(octoprint.vendor.sockjs.tornado.session.Session):
|
||||
def __init__(self, conn, server, session_id, expiry=None):
|
||||
|
||||
@@ -6,27 +6,26 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import logging
|
||||
import os
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import tornado
|
||||
import tornado.web
|
||||
import tornado.gen
|
||||
import tornado.escape
|
||||
import tornado.httputil
|
||||
import tornado.httpserver
|
||||
import tornado.httpclient
|
||||
import tornado.gen
|
||||
import tornado.http1connection
|
||||
import tornado.httpclient
|
||||
import tornado.httpserver
|
||||
import tornado.httputil
|
||||
import tornado.iostream
|
||||
import tornado.tcpserver
|
||||
import tornado.util
|
||||
import tornado.web
|
||||
from past.builtins import unicode
|
||||
|
||||
import octoprint.util
|
||||
|
||||
from past.builtins import unicode
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse # py3
|
||||
except ImportError:
|
||||
@@ -41,9 +40,10 @@ def fix_json_encode():
|
||||
serialization of globally registered types like frozendict and others.
|
||||
"""
|
||||
|
||||
from octoprint.util.json import JsonEncoding
|
||||
import json
|
||||
|
||||
from octoprint.util.json import JsonEncoding
|
||||
|
||||
def fixed_json_encode(value):
|
||||
return json.dumps(value, default=JsonEncoding.encode, allow_nan=False).replace(
|
||||
"</", "<\\/"
|
||||
@@ -758,9 +758,10 @@ class WsgiInputContainer(object):
|
||||
:param request: the ``tornado.httpserver.HTTPServerRequest`` to derive the WSGI environment from
|
||||
:param body: an optional body to use as ``wsgi.input`` instead of ``request.body``, can be a string or a stream
|
||||
"""
|
||||
from tornado.wsgi import to_wsgi_str
|
||||
import io
|
||||
|
||||
from tornado.wsgi import to_wsgi_str
|
||||
|
||||
# determine the request_body to supply as wsgi.input
|
||||
if body is not None:
|
||||
if isinstance(body, (bytes, str, unicode)):
|
||||
|
||||
@@ -8,8 +8,9 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
import threading
|
||||
import time
|
||||
|
||||
import watchdog.events
|
||||
|
||||
import octoprint.filemanager
|
||||
@@ -26,9 +27,8 @@ def fix_scandir():
|
||||
|
||||
except ImportError:
|
||||
# not natively available, use backport
|
||||
from scandir import scandir
|
||||
|
||||
import watchdog.utils.dirsnapshot
|
||||
from scandir import scandir
|
||||
|
||||
OriginalDirectorySnapshot = watchdog.utils.dirsnapshot.DirectorySnapshot
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ __author__ = "Gina Häußge <gina@octoprint.org>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import logging
|
||||
import gzip
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -15,11 +15,11 @@ try:
|
||||
except ImportError:
|
||||
import urlparse
|
||||
|
||||
import webassets.filter.cssrewrite.urlpath as urlpath
|
||||
from webassets.bundle import Bundle
|
||||
from webassets.merge import MemoryHunk, BaseHunk
|
||||
from webassets.filter import Filter
|
||||
from webassets.filter.cssrewrite.base import PatternRewriter
|
||||
import webassets.filter.cssrewrite.urlpath as urlpath
|
||||
from webassets.merge import BaseHunk, MemoryHunk
|
||||
|
||||
|
||||
def replace_url(source_url, output_url, url):
|
||||
|
||||
@@ -5,54 +5,50 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import os
|
||||
import base64
|
||||
import datetime
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
||||
from flask import (
|
||||
Response,
|
||||
abort,
|
||||
g,
|
||||
make_response,
|
||||
redirect,
|
||||
render_template,
|
||||
request,
|
||||
send_from_directory,
|
||||
url_for,
|
||||
)
|
||||
from past.builtins import basestring
|
||||
|
||||
from collections import defaultdict
|
||||
from flask import (
|
||||
request,
|
||||
g,
|
||||
url_for,
|
||||
make_response,
|
||||
render_template,
|
||||
send_from_directory,
|
||||
redirect,
|
||||
abort,
|
||||
Response,
|
||||
)
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from octoprint.access.permissions import OctoPrintPermission, Permissions
|
||||
from octoprint.filemanager import full_extension_tree, get_all_extensions
|
||||
from octoprint.server import (
|
||||
BRANCH,
|
||||
DISPLAY_VERSION,
|
||||
LOCALES,
|
||||
NOT_MODIFIED,
|
||||
VERSION,
|
||||
app,
|
||||
userManager,
|
||||
debug,
|
||||
gettext,
|
||||
groupManager,
|
||||
pluginManager,
|
||||
gettext,
|
||||
debug,
|
||||
LOCALES,
|
||||
VERSION,
|
||||
DISPLAY_VERSION,
|
||||
BRANCH,
|
||||
preemptiveCache,
|
||||
NOT_MODIFIED,
|
||||
userManager,
|
||||
)
|
||||
from octoprint.access.permissions import Permissions, OctoPrintPermission
|
||||
from octoprint.settings import settings
|
||||
from octoprint.filemanager import full_extension_tree, get_all_extensions
|
||||
from octoprint.util import to_unicode, to_bytes, sv
|
||||
from octoprint.util import sv, to_bytes, to_unicode
|
||||
from octoprint.util.version import get_python_version_string
|
||||
|
||||
import re
|
||||
import base64
|
||||
|
||||
from . import util
|
||||
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
_templates = {}
|
||||
@@ -1604,8 +1600,8 @@ def _compute_date_for_i18n(locale, domain):
|
||||
|
||||
def _compute_date(files):
|
||||
# Note, we do not expect everything in 'files' to exist.
|
||||
from datetime import datetime
|
||||
import stat
|
||||
from datetime import datetime
|
||||
|
||||
max_timestamp = 0
|
||||
for path in files:
|
||||
@@ -1689,6 +1685,7 @@ def _get_all_translationfiles(locale, domain):
|
||||
|
||||
def _get_translations(locale, domain):
|
||||
from babel.messages.pofile import read_po
|
||||
|
||||
from octoprint.util import dict_merge
|
||||
|
||||
messages = {}
|
||||
|
||||
+15
-14
@@ -23,20 +23,21 @@ __author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import io
|
||||
import sys
|
||||
import os
|
||||
import yaml
|
||||
import yaml.parser
|
||||
import logging
|
||||
import re
|
||||
import uuid
|
||||
import copy
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import uuid
|
||||
|
||||
# noinspection PyCompatibility
|
||||
from builtins import bytes
|
||||
|
||||
import yaml
|
||||
import yaml.parser
|
||||
|
||||
# noinspection PyCompatibility
|
||||
from past.builtins import basestring
|
||||
|
||||
@@ -51,11 +52,11 @@ except ImportError:
|
||||
from collections import KeysView
|
||||
|
||||
from octoprint.util import (
|
||||
atomic_write,
|
||||
is_hidden_path,
|
||||
dict_merge,
|
||||
CaseInsensitiveSet,
|
||||
atomic_write,
|
||||
dict_merge,
|
||||
generate_api_key,
|
||||
is_hidden_path,
|
||||
)
|
||||
|
||||
_APPNAME = "OctoPrint"
|
||||
@@ -688,9 +689,9 @@ class Settings(object):
|
||||
return folder
|
||||
|
||||
def _init_script_templating(self):
|
||||
from jinja2 import Environment, BaseLoader, ChoiceLoader, TemplateNotFound
|
||||
from jinja2.nodes import Include
|
||||
from jinja2 import BaseLoader, ChoiceLoader, Environment, TemplateNotFound
|
||||
from jinja2.ext import Extension
|
||||
from jinja2.nodes import Include
|
||||
|
||||
from octoprint.util.jinja import FilteredFileSystemLoader
|
||||
|
||||
@@ -1585,7 +1586,7 @@ class Settings(object):
|
||||
self._logger.exception("Error while saving config.yaml!")
|
||||
raise
|
||||
else:
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.events import Events, eventManager
|
||||
|
||||
self.load()
|
||||
|
||||
|
||||
@@ -26,21 +26,21 @@ try:
|
||||
except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
import octoprint.plugin
|
||||
import logging
|
||||
|
||||
import octoprint.events
|
||||
import octoprint.plugin
|
||||
import octoprint.util
|
||||
from octoprint.settings import settings
|
||||
|
||||
import logging
|
||||
|
||||
from .exceptions import (
|
||||
UnknownSlicer,
|
||||
SlicerNotConfigured,
|
||||
SlicingCancelled,
|
||||
CouldNotDeleteProfile,
|
||||
ProfileAlreadyExists,
|
||||
ProfileException,
|
||||
CouldNotDeleteProfile,
|
||||
SlicerNotConfigured,
|
||||
SlicingCancelled,
|
||||
UnknownProfile,
|
||||
UnknownSlicer,
|
||||
)
|
||||
|
||||
|
||||
|
||||
+12
-14
@@ -4,38 +4,36 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
|
||||
import datetime
|
||||
import fnmatch
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import fnmatch
|
||||
import datetime
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
try:
|
||||
import queue
|
||||
except ImportError:
|
||||
import Queue as queue
|
||||
|
||||
import collections
|
||||
import re
|
||||
|
||||
import requests
|
||||
import sarge
|
||||
|
||||
import octoprint.plugin
|
||||
import octoprint.util as util
|
||||
|
||||
from octoprint.settings import settings
|
||||
from octoprint.events import eventManager, Events
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.plugin import plugin_manager
|
||||
from octoprint.util import monotonic_time
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
from octoprint.util import sv
|
||||
from octoprint.util import monotonic_time, sv
|
||||
from octoprint.util.commandline import CommandlineCaller
|
||||
|
||||
import sarge
|
||||
import collections
|
||||
|
||||
import re
|
||||
|
||||
try:
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
|
||||
@@ -7,8 +7,8 @@ __copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms
|
||||
|
||||
# Wrapper to the new access.users location
|
||||
|
||||
from octoprint.access.users import User, deprecated
|
||||
from octoprint.access.users import * # noqa: F403 ## possibly used by other modules
|
||||
from octoprint.access.users import User, deprecated
|
||||
|
||||
AccessUser = User
|
||||
|
||||
|
||||
@@ -9,26 +9,26 @@ OctoPrint's source code.
|
||||
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
|
||||
import io
|
||||
import os
|
||||
import traceback
|
||||
import past.builtins
|
||||
import sys
|
||||
import re
|
||||
import tempfile
|
||||
import logging
|
||||
import shutil
|
||||
import threading
|
||||
from functools import wraps
|
||||
import warnings
|
||||
import contextlib
|
||||
import collections
|
||||
import frozendict
|
||||
import contextlib
|
||||
import copy
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
|
||||
import traceback
|
||||
import warnings
|
||||
from functools import wraps
|
||||
from typing import Union
|
||||
|
||||
import frozendict
|
||||
import past.builtins
|
||||
|
||||
try:
|
||||
import queue
|
||||
except ImportError:
|
||||
@@ -37,11 +37,9 @@ except ImportError:
|
||||
# noinspection PyCompatibility
|
||||
from past.builtins import basestring, unicode
|
||||
|
||||
|
||||
from octoprint import UMASK
|
||||
from octoprint.util.net import interface_addresses, address_for_client, server_reachable
|
||||
from octoprint.util.connectivity import ConnectivityChecker
|
||||
|
||||
from octoprint.util.net import address_for_client, interface_addresses, server_reachable
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -1185,8 +1183,8 @@ def atomic_write(
|
||||
|
||||
@contextlib.contextmanager
|
||||
def tempdir(ignore_errors=False, onerror=None, **kwargs):
|
||||
import tempfile
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
dirpath = tempfile.mkdtemp(**kwargs)
|
||||
try:
|
||||
@@ -1349,8 +1347,9 @@ def utmify(link, source=None, medium=None, name=None, term=None, content=None):
|
||||
from collections import OrderedDict
|
||||
|
||||
try:
|
||||
import urlparse
|
||||
from urllib import urlencode
|
||||
|
||||
import urlparse
|
||||
except ImportError:
|
||||
# python 3
|
||||
import urllib.parse as urlparse
|
||||
@@ -1876,8 +1875,8 @@ def time_this(
|
||||
|
||||
def generate_api_key():
|
||||
# noinspection PyCompatibility
|
||||
from builtins import bytes
|
||||
import uuid
|
||||
from builtins import bytes
|
||||
|
||||
return "".join("%02X" % z for z in bytes(uuid.uuid4().bytes))
|
||||
|
||||
|
||||
+24
-26
@@ -10,50 +10,47 @@ The code in this file is based on Cura.util.machineCom from the Cura project fro
|
||||
(https://github.com/daid/Cura).
|
||||
"""
|
||||
|
||||
import os
|
||||
import glob
|
||||
import fnmatch
|
||||
import time
|
||||
import re
|
||||
import threading
|
||||
import contextlib
|
||||
import copy
|
||||
import fnmatch
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
|
||||
try:
|
||||
import queue
|
||||
except ImportError:
|
||||
import Queue as queue
|
||||
from past.builtins import basestring, unicode
|
||||
|
||||
import logging
|
||||
|
||||
import serial
|
||||
|
||||
import wrapt
|
||||
|
||||
import octoprint.plugin
|
||||
|
||||
from collections import deque
|
||||
|
||||
from octoprint.settings import settings, default_settings
|
||||
from octoprint.events import eventManager, Events
|
||||
import serial
|
||||
import wrapt
|
||||
from past.builtins import basestring, unicode
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.events import Events, eventManager
|
||||
from octoprint.filemanager import valid_file_type
|
||||
from octoprint.filemanager.destinations import FileDestinations
|
||||
from octoprint.settings import default_settings, settings
|
||||
from octoprint.util import (
|
||||
get_exception_string,
|
||||
sanitize_ascii,
|
||||
filter_non_ascii,
|
||||
CountedEvent,
|
||||
RepeatedTimer,
|
||||
to_unicode,
|
||||
bom_aware_open,
|
||||
TypedQueue,
|
||||
PrependableQueue,
|
||||
TypeAlreadyInQueue,
|
||||
chunks,
|
||||
RepeatedTimer,
|
||||
ResettableTimer,
|
||||
monotonic_time,
|
||||
TypeAlreadyInQueue,
|
||||
TypedQueue,
|
||||
bom_aware_open,
|
||||
chunks,
|
||||
filter_non_ascii,
|
||||
filter_non_utf8,
|
||||
get_exception_string,
|
||||
monotonic_time,
|
||||
sanitize_ascii,
|
||||
to_unicode,
|
||||
)
|
||||
from octoprint.util.platform import get_os, set_close_exec
|
||||
|
||||
@@ -6347,6 +6344,7 @@ def upload_cli():
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from octoprint.util import Object
|
||||
|
||||
logging.basicConfig(
|
||||
|
||||
@@ -6,18 +6,18 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import sarge
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
|
||||
from . import to_unicode, to_native_str
|
||||
from .platform import get_os
|
||||
|
||||
import sarge
|
||||
from past.builtins import unicode
|
||||
|
||||
from octoprint.util.platform import CLOSE_FDS
|
||||
|
||||
from . import to_native_str, to_unicode
|
||||
from .platform import get_os
|
||||
|
||||
try:
|
||||
import queue
|
||||
except ImportError: # pragma: no cover
|
||||
|
||||
@@ -5,11 +5,11 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import threading
|
||||
import logging
|
||||
import threading
|
||||
import time
|
||||
|
||||
from octoprint.util.net import server_reachable, resolve_host
|
||||
from octoprint.util.net import resolve_host, server_reachable
|
||||
|
||||
|
||||
class ConnectivityChecker(object):
|
||||
|
||||
@@ -7,8 +7,8 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
|
||||
import functools
|
||||
import warnings
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
|
||||
def patch_sarge_async_on_py2():
|
||||
|
||||
@@ -6,13 +6,13 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2013 David Braam, Gina Häußge - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import base64
|
||||
import codecs
|
||||
import io
|
||||
import logging
|
||||
import math
|
||||
import os
|
||||
import io
|
||||
import base64
|
||||
import zlib
|
||||
import logging
|
||||
import codecs
|
||||
|
||||
|
||||
class Vector3D(object):
|
||||
|
||||
@@ -15,14 +15,13 @@ except ImportError:
|
||||
from jinja2 import nodes
|
||||
from jinja2.ext import Extension
|
||||
from jinja2.loaders import (
|
||||
BaseLoader,
|
||||
ChoiceLoader,
|
||||
FileSystemLoader,
|
||||
PrefixLoader,
|
||||
ChoiceLoader,
|
||||
BaseLoader,
|
||||
TemplateNotFound,
|
||||
split_template_path,
|
||||
)
|
||||
|
||||
from webassets import Bundle
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ __copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms
|
||||
|
||||
|
||||
import collections
|
||||
|
||||
import frozendict
|
||||
|
||||
from octoprint.util import to_unicode
|
||||
|
||||
@@ -4,15 +4,15 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import socket
|
||||
import sys
|
||||
import netaddr
|
||||
import logging
|
||||
import threading
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import sys
|
||||
import threading
|
||||
|
||||
import netaddr
|
||||
import netifaces
|
||||
import requests
|
||||
import werkzeug.http
|
||||
@@ -217,6 +217,7 @@ def server_reachable(host, port, timeout=3.05, proto="tcp", source=None):
|
||||
|
||||
def resolve_host(host):
|
||||
import socket
|
||||
|
||||
from octoprint.util import to_unicode
|
||||
|
||||
try:
|
||||
|
||||
@@ -7,18 +7,19 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms
|
||||
|
||||
|
||||
import io
|
||||
import sarge
|
||||
import sys
|
||||
import logging
|
||||
import site
|
||||
import threading
|
||||
import os
|
||||
import site
|
||||
import sys
|
||||
import threading
|
||||
|
||||
import pkg_resources
|
||||
import sarge
|
||||
|
||||
from octoprint.util import to_native_str, to_unicode
|
||||
from octoprint.util.platform import CLOSE_FDS
|
||||
|
||||
from .commandline import CommandlineCaller, clean_ansi
|
||||
from octoprint.util import to_unicode, to_native_str
|
||||
from octoprint.util.platform import CLOSE_FDS
|
||||
|
||||
_cache = {"version": {}, "setup": {}}
|
||||
_cache_mutex = threading.RLock()
|
||||
@@ -537,8 +538,8 @@ class LocalPipCaller(PipCaller):
|
||||
return self.autodetect_pip(), False
|
||||
|
||||
def _check_pip_setup(self, pip_command):
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
from distutils.sysconfig import get_python_lib
|
||||
|
||||
virtual_env = hasattr(sys, "real_prefix")
|
||||
|
||||
@@ -7,9 +7,10 @@ This module provides a bunch of utility methods and helpers for version handling
|
||||
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
|
||||
import pkg_resources
|
||||
import logging
|
||||
|
||||
import pkg_resources
|
||||
|
||||
from octoprint import __version__
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
|
||||
__copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import io
|
||||
import requests
|
||||
import time
|
||||
import json
|
||||
import time
|
||||
|
||||
import requests
|
||||
import websocket
|
||||
|
||||
|
||||
@@ -323,8 +323,8 @@ class Client(object):
|
||||
)
|
||||
|
||||
def create_socket(self, **kwargs):
|
||||
import uuid
|
||||
import random
|
||||
import uuid
|
||||
|
||||
# creates websocket URL for SockJS according to
|
||||
# - http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-37
|
||||
|
||||
@@ -7,12 +7,12 @@ __author__ = u"Gina Häußge <osd@foosel.net>"
|
||||
__license__ = u"GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = u"Copyright (C) 2015 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import glob
|
||||
from distutils.command.clean import clean as _clean
|
||||
|
||||
from setuptools import Command
|
||||
from distutils.command.clean import clean as _clean
|
||||
|
||||
|
||||
def package_data_dirs(source, sub_folders):
|
||||
|
||||
Loaded 100 of 137 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user