Run pre-commit tools: isort, requirements-txt-fixer

This commit is contained in:
Ayaz Salikhov
2022-03-16 14:48:23 +02:00
parent 25add573f9
commit 2f201a4b81
29 changed files with 72 additions and 69 deletions

View File

@@ -19,6 +19,13 @@ repos:
- id: pyupgrade
args: [--py39-plus]
# Automatically sort python imports
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: [--profile, black]
# Autoformat: Python code
- repo: https://github.com/psf/black
rev: 22.1.0
@@ -53,9 +60,11 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: end-of-file-fixer
- id: requirements-txt-fixer
args: [requirements-dev.txt, requirements-docs.txt]
- id: trailing-whitespace
# Lint: Dockerfile
- repo: https://github.com/hadolint/hadolint.git
@@ -108,12 +117,13 @@ repos:
- id: nbstripout
# nbQA provides tools from the Python ecosystem like
# pyupgrade, black, and flake8, adjusted for notebooks.
# pyupgrade, isort, black, and flake8, adjusted for notebooks.
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.3.1
hooks:
- id: nbqa-pyupgrade
args: [--py39-plus]
- id: nbqa-isort
- id: nbqa-black
args: [--target-version=py39]
- id: nbqa-flake8

View File

@@ -1,11 +1,11 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# mypy: ignore-errors
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import stat
import subprocess
from jupyter_core.paths import jupyter_data_dir
c = get_config() # noqa: F821
c.ServerApp.ip = "0.0.0.0"

View File

@@ -5,13 +5,14 @@ import argparse
import datetime
import logging
import os
from docker.models.containers import Container
from .docker_runner import DockerRunner
from .get_taggers_and_manifests import get_taggers_and_manifests
from .git_helper import GitHelper
from .manifests import ManifestHeader, ManifestInterface
LOGGER = logging.getLogger(__name__)

View File

@@ -1,11 +1,11 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from typing import Optional
import logging
from types import TracebackType
from typing import Optional
import docker
from docker.models.containers import Container
import logging
LOGGER = logging.getLogger(__name__)

View File

@@ -1,6 +1,7 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from typing import Optional
from .images_hierarchy import ALL_IMAGES
from .manifests import ManifestInterface
from .taggers import TaggerInterface

View File

@@ -2,29 +2,30 @@
# Distributed under the terms of the Modified BSD License.
from dataclasses import dataclass, field
from typing import Optional
from .manifests import (
AptPackagesManifest,
CondaEnvironmentManifest,
JuliaPackagesManifest,
ManifestInterface,
RPackagesManifest,
SparkInfoManifest,
)
from .taggers import (
TaggerInterface,
SHATagger,
DateTagger,
UbuntuVersionTagger,
PythonVersionTagger,
JupyterNotebookVersionTagger,
JupyterLabVersionTagger,
JupyterHubVersionTagger,
RVersionTagger,
TensorflowVersionTagger,
JuliaVersionTagger,
SparkVersionTagger,
HadoopVersionTagger,
JavaVersionTagger,
)
from .manifests import (
ManifestInterface,
CondaEnvironmentManifest,
AptPackagesManifest,
RPackagesManifest,
JuliaPackagesManifest,
SparkInfoManifest,
JuliaVersionTagger,
JupyterHubVersionTagger,
JupyterLabVersionTagger,
JupyterNotebookVersionTagger,
PythonVersionTagger,
RVersionTagger,
SHATagger,
SparkVersionTagger,
TaggerInterface,
TensorflowVersionTagger,
UbuntuVersionTagger,
)

View File

@@ -1,7 +1,8 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from plumbum.cmd import docker
from docker.models.containers import Container
from plumbum.cmd import docker
from .docker_runner import DockerRunner
from .git_helper import GitHelper

View File

@@ -3,12 +3,13 @@
# Distributed under the terms of the Modified BSD License.
import argparse
import logging
from plumbum.cmd import docker
from .docker_runner import DockerRunner
from .get_taggers_and_manifests import get_taggers_and_manifests
from .github_set_env import github_set_env
LOGGER = logging.getLogger(__name__)

View File

@@ -1,9 +1,11 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from datetime import datetime
from docker.models.containers import Container
from .git_helper import GitHelper
from .docker_runner import DockerRunner
from .git_helper import GitHelper
def _get_program_version(container: Container, program: str) -> str:

View File

@@ -2,10 +2,9 @@
# Distributed under the terms of the Modified BSD License.
import logging
import pytest # type: ignore
from pathlib import Path
import pytest # type: ignore
from conftest import TrackedContainer
LOGGER = logging.getLogger(__name__)

View File

@@ -1,12 +1,11 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import logging
import pathlib
import time
import logging
import pytest # type: ignore
import requests
from conftest import TrackedContainer, find_free_port
LOGGER = logging.getLogger(__name__)

View File

@@ -5,7 +5,6 @@ import logging
import pytest # type: ignore
from conftest import TrackedContainer
from package_helper import CondaPackageHelper
LOGGER = logging.getLogger(__name__)

View File

@@ -2,8 +2,8 @@
# Distributed under the terms of the Modified BSD License.
import logging
import pytest # type: ignore
import pytest # type: ignore
from conftest import TrackedContainer
LOGGER = logging.getLogger(__name__)

View File

@@ -35,11 +35,10 @@ Example:
"""
import logging
from typing import Callable, Iterable
import pytest # type: ignore
from conftest import TrackedContainer
from typing import Callable, Iterable
from package_helper import CondaPackageHelper
LOGGER = logging.getLogger(__name__)

View File

@@ -2,9 +2,8 @@
# Distributed under the terms of the Modified BSD License.
import logging
from packaging import version # type: ignore
from conftest import TrackedContainer
from packaging import version # type: ignore
LOGGER = logging.getLogger(__name__)

View File

@@ -2,11 +2,11 @@
# Distributed under the terms of the Modified BSD License.
import logging
import time
from typing import Optional
import pytest # type: ignore
import requests
import time
from conftest import TrackedContainer, find_free_port
LOGGER = logging.getLogger(__name__)

View File

@@ -1,19 +1,17 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from contextlib import closing
import os
import logging
import os
import socket
from contextlib import closing
from typing import Any, Optional
import docker
from docker.models.containers import Container
import pytest # type: ignore
import requests
from urllib3.util.retry import Retry
from docker.models.containers import Container
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
LOGGER = logging.getLogger(__name__)

View File

@@ -27,7 +27,7 @@
},
"outputs": [],
"source": [
"from sympy import init_printing, symbols, sin, diff, integrate"
"from sympy import diff, init_printing, integrate, sin, symbols"
]
},
{

View File

@@ -2,10 +2,9 @@
# Distributed under the terms of the Modified BSD License.
import logging
import pytest # type: ignore
from pathlib import Path
import pytest # type: ignore
from conftest import TrackedContainer
LOGGER = logging.getLogger(__name__)

View File

@@ -22,17 +22,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import json
import logging
import re
from collections import defaultdict
from itertools import chain
import logging
import json
from typing import Any, Optional
from docker.models.containers import Container
from tabulate import tabulate
from conftest import TrackedContainer
from docker.models.containers import Container
from tabulate import tabulate
LOGGER = logging.getLogger(__name__)

View File

@@ -4,7 +4,6 @@ import logging
from conftest import TrackedContainer
LOGGER = logging.getLogger(__name__)

View File

@@ -5,10 +5,8 @@ import argparse
import logging
import plumbum
from plumbum.cmd import pytest
from images_hierarchy import get_test_dirs
from plumbum.cmd import pytest
LOGGER = logging.getLogger(__name__)

View File

@@ -1,4 +1,4 @@
from setuptools import setup
from Cython.Build import cythonize
from setuptools import setup
setup(ext_modules=cythonize("helloworld.pyx"))

View File

@@ -1,11 +1,12 @@
# Matplotlit: Create a simple plot example.
# Refs: https://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/simple_plot.html
import os
# Optional test with [Matplotlib Jupyter Integration](https://github.com/matplotlib/ipympl)
# %matplotlib widget
import matplotlib.pyplot as plt
import numpy as np
import os
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)

View File

@@ -1,7 +1,8 @@
# Matplotlit: Test tex fonts
import os
import matplotlib
import matplotlib.pyplot as plt
import os
matplotlib.rcParams["pgf.texsystem"] = "pdflatex"
matplotlib.rcParams.update(

View File

@@ -3,7 +3,6 @@
import logging
import pytest # type: ignore
from conftest import TrackedContainer
LOGGER = logging.getLogger(__name__)

View File

@@ -2,10 +2,9 @@
# Distributed under the terms of the Modified BSD License.
import logging
import pytest # type: ignore
from pathlib import Path
import pytest # type: ignore
from conftest import TrackedContainer
LOGGER = logging.getLogger(__name__)

View File

@@ -4,6 +4,5 @@
import numpy as np
import pandas as pd
np.random.seed(0)
print(pd.Series(np.random.randint(0, 7, size=10)).sum())

View File

@@ -2,6 +2,5 @@
# Distributed under the terms of the Modified BSD License.
import tensorflow as tf
print(tf.constant("Hello, TensorFlow"))
print(tf.reduce_sum(tf.random.normal([1000, 1000])))