From 16b2f260089b2574e2df1cc96ae8b4d86a2081d9 Mon Sep 17 00:00:00 2001 From: vporta Date: Tue, 22 Sep 2020 15:58:13 -0400 Subject: [PATCH] upgrade isort v5.5.2 --- .isort.cfg | 18 ++++++++++++++---- .pre-commit-config.yaml | 9 +++++++-- noxfile.py | 1 + plugins/.isort.cfg | 16 ++++++++++++---- requirements/dev.txt | 2 +- tools/.isort.cfg | 17 +++++++++++++++++ tools/configen/configen/config.py | 3 +-- tools/configen/configen/configen.py | 2 +- tools/configen/configen/samples/my_module.py | 2 ++ tools/configen/example/my_app.py | 9 ++++----- tools/configen/setup.py | 1 - tools/release/release.py | 7 +++---- 12 files changed, 63 insertions(+), 24 deletions(-) create mode 100644 tools/.isort.cfg diff --git a/.isort.cfg b/.isort.cfg index b888302c85f..55f05a3ff9a 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,15 +1,25 @@ [settings] multi_line_output=3 -include_trailing_comma=True +include_trailing_comma=true force_grid_wrap=0 use_parentheses=True line_length=88 -ensure_newline_before_comments=True -known_third_party=omegaconf,ray,pytest,typing_extensions -known_first_party=hydra +ensure_newline_before_comments=true +known_libs=pkg_resources,setuptools +sections= + FUTURE + STDLIB + LIBS + THIRDPARTY + FIRSTPARTY + LOCALFOLDER +default_section=THIRDPARTY +known_first_party=hydra,hydra_app skip= plugins + ,tools ,.nox ,hydra/grammar/gen ,tools/configen/example/gen ,tools/configen/tests/test_modules/expected + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20bbd1488ea..4661047076f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,13 @@ repos: - - repo: https://github.com/timothycrosley/isort - rev: 'c54b3dd' + - repo: https://github.com/pycqa/isort + rev: 5.5.2 hooks: - id: isort + files: 'hydra/.*' + - id: isort + files: 'plugins/.*' + - id: isort + files: 'tools/.*' - repo: https://github.com/psf/black rev: 20.8b1 diff --git a/noxfile.py b/noxfile.py index 44ca4095ad7..3f25f423ca9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -217,6 +217,7 @@ def lint(session): ".git", "website", "plugins", + "tools", ".nox", "hydra/grammar/gen", "tools/configen/example/gen", diff --git a/plugins/.isort.cfg b/plugins/.isort.cfg index af0b213ff46..1715c70a309 100644 --- a/plugins/.isort.cfg +++ b/plugins/.isort.cfg @@ -1,9 +1,17 @@ [settings] multi_line_output=3 -include_trailing_comma=True +include_trailing_comma=true force_grid_wrap=0 -use_parentheses=True +use_parentheses=true line_length=88 -ensure_newline_before_comments=True -known_third_party=hydra,omegaconf +ensure_newline_before_comments=true +float_to_top=true +sections= + FUTURE + STDLIB + THIRDPARTY + FIRSTPARTY + LOCALFOLDER +default_section=THIRDPARTY known_first_party=hydra_plugins + diff --git a/requirements/dev.txt b/requirements/dev.txt index b6811d83e73..db682b70b57 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,7 +4,7 @@ black==20.8b1 coverage flake8 flake8-copyright -isort@git+git://github.com/timothycrosley/isort.git@c54b3dd#egg=isort +isort==5.5.2 mypy nox packaging diff --git a/tools/.isort.cfg b/tools/.isort.cfg new file mode 100644 index 00000000000..db517e0e183 --- /dev/null +++ b/tools/.isort.cfg @@ -0,0 +1,17 @@ +[settings] +multi_line_output=3 +include_trailing_comma=true +force_grid_wrap=0 +use_parentheses=true +line_length=88 +ensure_newline_before_comments=true +float_to_top=true +sections= + FUTURE + STDLIB + THIRDPARTY + FIRSTPARTY + LOCALFOLDER +default_section=THIRDPARTY +known_first_party=tools + diff --git a/tools/configen/configen/config.py b/tools/configen/configen/config.py index efa303b5013..b828ea65d3e 100644 --- a/tools/configen/configen/config.py +++ b/tools/configen/configen/config.py @@ -2,9 +2,8 @@ from dataclasses import dataclass from typing import List, Optional -from omegaconf import MISSING - from hydra.core.config_store import ConfigStore +from omegaconf import MISSING @dataclass diff --git a/tools/configen/configen/configen.py b/tools/configen/configen/configen.py index 0b16a719625..517463c328c 100644 --- a/tools/configen/configen/configen.py +++ b/tools/configen/configen/configen.py @@ -7,6 +7,7 @@ from pathlib import Path from typing import Any, Dict, List, Optional, Set, Type +import hydra from jinja2 import Environment, PackageLoader, Template from omegaconf import OmegaConf, ValidationError from omegaconf._utils import ( @@ -19,7 +20,6 @@ is_structured_config, ) -import hydra from configen.config import Config, ConfigenConf, ModuleConf from configen.utils import ( collect_imports, diff --git a/tools/configen/configen/samples/my_module.py b/tools/configen/configen/samples/my_module.py index 36a4462b0b2..c40c0fb015b 100644 --- a/tools/configen/configen/samples/my_module.py +++ b/tools/configen/configen/samples/my_module.py @@ -1,4 +1,6 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved + + class User: def __init__(self, age: int, name: str): self.age = age diff --git a/tools/configen/example/my_app.py b/tools/configen/example/my_app.py index 8b590de2e51..b308ced96a4 100644 --- a/tools/configen/example/my_app.py +++ b/tools/configen/example/my_app.py @@ -1,14 +1,13 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -from omegaconf import DictConfig - import hydra -# Underlying objects -from configen.samples.my_module import Admin, User - # Generated config dataclasses from example.config.configen.samples.my_module import AdminConf, UserConf from hydra.core.config_store import ConfigStore +from omegaconf import DictConfig + +# Underlying objects +from configen.samples.my_module import Admin, User ConfigStore.instance().store( name="config", diff --git a/tools/configen/setup.py b/tools/configen/setup.py index 3bc0fdc151b..c7670d3fbff 100644 --- a/tools/configen/setup.py +++ b/tools/configen/setup.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved - from setuptools import find_packages, setup setup( diff --git a/tools/release/release.py b/tools/release/release.py index ab2097ce4ae..6a0b338825c 100644 --- a/tools/release/release.py +++ b/tools/release/release.py @@ -9,13 +9,12 @@ from pathlib import Path from typing import List, Tuple -import requests -from omegaconf import MISSING, DictConfig, OmegaConf -from packaging.version import Version, parse - import hydra +import requests from hydra.core.config_store import ConfigStore from hydra.test_utils.test_utils import find_parent_dir_containing, get_run_output +from omegaconf import MISSING, DictConfig, OmegaConf +from packaging.version import Version, parse log = logging.getLogger(__name__) HYDRA_ROOT = find_parent_dir_containing(target="ATTRIBUTION")