Skip to content

Commit

Permalink
Merge pull request #1440 from mathbunnyru/asalikhov/pyupgrade
Browse files Browse the repository at this point in the history
Add pyupgrade tool
  • Loading branch information
mathbunnyru committed Aug 24, 2021
2 parents d782e78 + ec9b7e9 commit 66c0904
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
7 changes: 3 additions & 4 deletions tagging/create_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
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
Expand All @@ -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")

Expand All @@ -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")
Expand All @@ -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]
Expand Down
7 changes: 3 additions & 4 deletions tagging/get_taggers_and_manifests.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# 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


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]

Expand Down
6 changes: 3 additions & 3 deletions tagging/images_hierarchy.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -31,8 +31,8 @@
@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 = {
Expand Down

0 comments on commit 66c0904

Please sign in to comment.