mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -3,6 +3,7 @@ Utilities for working with the apt package manager
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from tljh import utils
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
Wrap conda commandline program
|
||||
"""
|
||||
import contextlib
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import json
|
||||
import hashlib
|
||||
import contextlib
|
||||
import logging
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
|
||||
@@ -13,18 +13,17 @@ tljh-config show firstlevel.second_level
|
||||
"""
|
||||
|
||||
import argparse
|
||||
from collections.abc import Sequence, Mapping
|
||||
from copy import deepcopy
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
from collections.abc import Mapping, Sequence
|
||||
from copy import deepcopy
|
||||
|
||||
import requests
|
||||
|
||||
from .yaml import yaml
|
||||
|
||||
|
||||
INSTALL_PREFIX = os.environ.get("TLJH_INSTALL_PREFIX", "/opt/tljh")
|
||||
HUB_ENV_PREFIX = os.path.join(INSTALL_PREFIX, "hub")
|
||||
USER_ENV_PREFIX = os.path.join(INSTALL_PREFIX, "user")
|
||||
|
||||
@@ -12,7 +12,6 @@ def tljh_extra_user_conda_packages():
|
||||
"""
|
||||
Return list of extra conda packages to install in user environment.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
@@ -20,7 +19,6 @@ def tljh_extra_user_pip_packages():
|
||||
"""
|
||||
Return list of extra pip packages to install in user environment.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
@@ -28,7 +26,6 @@ def tljh_extra_hub_pip_packages():
|
||||
"""
|
||||
Return list of extra pip packages to install in the hub environment.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
@@ -38,7 +35,6 @@ def tljh_extra_apt_packages():
|
||||
|
||||
These will be installed before additional pip or conda packages.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
@@ -49,7 +45,6 @@ def tljh_custom_jupyterhub_config(c):
|
||||
Anything you can put in `jupyterhub_config.py` can
|
||||
be here.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
@@ -62,7 +57,6 @@ def tljh_config_post_install(config):
|
||||
be the serialized contents of config, so try to not
|
||||
overwrite anything the user might have explicitly set.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
@@ -73,7 +67,6 @@ def tljh_post_install():
|
||||
|
||||
This can be arbitrary Python code.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@hookspec
|
||||
@@ -82,4 +75,3 @@ def tljh_new_user_create(username):
|
||||
Script to be executed after a new user has been added.
|
||||
This can be arbitrary Python code.
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -17,15 +17,7 @@ import pluggy
|
||||
import requests
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
|
||||
from tljh import (
|
||||
apt,
|
||||
conda,
|
||||
hooks,
|
||||
migrator,
|
||||
systemd,
|
||||
traefik,
|
||||
user,
|
||||
)
|
||||
from tljh import apt, conda, hooks, migrator, systemd, traefik, user
|
||||
|
||||
from .config import (
|
||||
CONFIG_DIR,
|
||||
@@ -518,7 +510,6 @@ def main():
|
||||
print("Progress page server stopped successfully.")
|
||||
except Exception as e:
|
||||
logger.error(f"Couldn't stop the progress page server. Exception was {e}.")
|
||||
pass
|
||||
|
||||
ensure_jupyterhub_service(HUB_ENV_PREFIX)
|
||||
ensure_jupyterhub_running()
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
JupyterHub config for the littlest jupyterhub.
|
||||
"""
|
||||
|
||||
from glob import glob
|
||||
import os
|
||||
from glob import glob
|
||||
|
||||
from jupyterhub_traefik_proxy import TraefikTomlProxy
|
||||
|
||||
from tljh import configurer
|
||||
from tljh.config import INSTALL_PREFIX, USER_ENV_PREFIX, CONFIG_DIR
|
||||
from tljh.utils import get_plugin_manager
|
||||
from tljh.config import CONFIG_DIR, INSTALL_PREFIX, USER_ENV_PREFIX
|
||||
from tljh.user_creating_spawner import UserCreatingSpawner
|
||||
from jupyterhub_traefik_proxy import TraefikTomlProxy
|
||||
from tljh.utils import get_plugin_manager
|
||||
|
||||
c.JupyterHub.spawner_class = UserCreatingSpawner
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Setup tljh logging"""
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
|
||||
from .config import INSTALL_PREFIX
|
||||
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
"""Migration utilities for upgrading tljh"""
|
||||
|
||||
import os
|
||||
from datetime import date
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from datetime import date
|
||||
|
||||
from tljh.config import (
|
||||
CONFIG_DIR,
|
||||
CONFIG_FILE,
|
||||
INSTALL_PREFIX,
|
||||
)
|
||||
|
||||
from tljh.config import CONFIG_DIR, CONFIG_FILE, INSTALL_PREFIX
|
||||
|
||||
logger = logging.getLogger("tljh")
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ Wraps systemctl to install, uninstall, start & stop systemd services.
|
||||
|
||||
If we use a debian package instead, we can get rid of all this code.
|
||||
"""
|
||||
import subprocess
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
def reload_daemon():
|
||||
|
||||
@@ -3,14 +3,15 @@ import hashlib
|
||||
import os
|
||||
from glob import glob
|
||||
|
||||
from jinja2 import Template
|
||||
from passlib.apache import HtpasswdFile
|
||||
import backoff
|
||||
import requests
|
||||
import toml
|
||||
from jinja2 import Template
|
||||
from passlib.apache import HtpasswdFile
|
||||
|
||||
from tljh.configurer import _merge_dictionaries, load_config
|
||||
|
||||
from .config import CONFIG_DIR
|
||||
from tljh.configurer import load_config, _merge_dictionaries
|
||||
|
||||
# traefik 2.7.x is not supported yet, use v1.7.x for now
|
||||
# see: https://github.com/jupyterhub/traefik-proxy/issues/97
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from tljh.normalize import generate_system_username
|
||||
from tljh import user
|
||||
from tljh import configurer
|
||||
from systemdspawner import SystemdSpawner
|
||||
from traitlets import Dict, Unicode, List
|
||||
from jupyterhub_configurator.mixins import ConfiguratorSpawnerMixin
|
||||
from systemdspawner import SystemdSpawner
|
||||
from traitlets import Dict, List, Unicode
|
||||
|
||||
from tljh import configurer, user
|
||||
from tljh.normalize import generate_system_username
|
||||
|
||||
|
||||
class CustomSpawner(SystemdSpawner):
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
ensures the same yaml settings for reading/writing
|
||||
throughout tljh
|
||||
"""
|
||||
from ruamel.yaml.composer import Composer
|
||||
from ruamel.yaml import YAML
|
||||
from ruamel.yaml.composer import Composer
|
||||
|
||||
|
||||
class _NoEmptyFlowComposer(Composer):
|
||||
|
||||
Reference in New Issue
Block a user