mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-08 10:34:06 +00:00
Add pyupgrade tool
This commit is contained in:
@@ -3,6 +3,13 @@ ci:
|
||||
skip: [hadolint-docker]
|
||||
|
||||
repos:
|
||||
# Autoupdate: Python code
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.24.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py39-plus]
|
||||
|
||||
# Autoformat: Python code
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.7b0
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# docker-stacks documentation build configuration file, created by
|
||||
# sphinx-quickstart on Fri Dec 29 20:32:10 2017.
|
||||
|
@@ -5,7 +5,6 @@ import argparse
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
from typing import List
|
||||
from .docker_runner import DockerRunner
|
||||
from .get_taggers_and_manifests import get_taggers_and_manifests
|
||||
from .git_helper import GitHelper
|
||||
@@ -23,7 +22,7 @@ def append_build_history_line(
|
||||
short_image_name: str,
|
||||
owner: str,
|
||||
wiki_path: str,
|
||||
all_tags: List[str],
|
||||
all_tags: list[str],
|
||||
) -> None:
|
||||
logger.info("Appending build history line")
|
||||
|
||||
@@ -43,7 +42,7 @@ def append_build_history_line(
|
||||
build_history_line = "|".join([date_column, image_column, links_column]) + "|"
|
||||
|
||||
home_wiki_file = os.path.join(wiki_path, "Home.md")
|
||||
with open(home_wiki_file, "r") as f:
|
||||
with open(home_wiki_file) as f:
|
||||
file = f.read()
|
||||
TABLE_BEGINNING = "|-|-|-|\n"
|
||||
file = file.replace(TABLE_BEGINNING, TABLE_BEGINNING + build_history_line + "\n")
|
||||
@@ -55,7 +54,7 @@ def create_manifest_file(
|
||||
short_image_name: str,
|
||||
owner: str,
|
||||
wiki_path: str,
|
||||
manifests: List[ManifestInterface],
|
||||
manifests: list[ManifestInterface],
|
||||
container,
|
||||
) -> None:
|
||||
manifest_names = [manifest.__name__ for manifest in manifests]
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
from typing import List, Tuple
|
||||
from .images_hierarchy import ALL_IMAGES
|
||||
from .manifests import ManifestInterface
|
||||
from .taggers import TaggerInterface
|
||||
@@ -8,9 +7,9 @@ from .taggers import TaggerInterface
|
||||
|
||||
def get_taggers_and_manifests(
|
||||
short_image_name: str,
|
||||
) -> Tuple[List[TaggerInterface], List[ManifestInterface]]:
|
||||
taggers: List[TaggerInterface] = []
|
||||
manifests: List[ManifestInterface] = []
|
||||
) -> tuple[list[TaggerInterface], list[ManifestInterface]]:
|
||||
taggers: list[TaggerInterface] = []
|
||||
manifests: list[ManifestInterface] = []
|
||||
while short_image_name is not None:
|
||||
image_description = ALL_IMAGES[short_image_name]
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional, List
|
||||
from typing import Optional
|
||||
from .taggers import (
|
||||
TaggerInterface,
|
||||
SHATagger,
|
||||
@@ -31,8 +31,8 @@ from .manifests import (
|
||||
@dataclass
|
||||
class ImageDescription:
|
||||
parent_image: Optional[str]
|
||||
taggers: List[TaggerInterface] = field(default_factory=list)
|
||||
manifests: List[ManifestInterface] = field(default_factory=list)
|
||||
taggers: list[TaggerInterface] = field(default_factory=list)
|
||||
manifests: list[ManifestInterface] = field(default_factory=list)
|
||||
|
||||
|
||||
ALL_IMAGES = {
|
||||
|
Reference in New Issue
Block a user