Skip to content

Commit

Permalink
[DATALAD RUNCMD] run isort
Browse files Browse the repository at this point in the history
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "isort docs neurodocker && black docs neurodocker",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
Remi-Gau committed Aug 22, 2023
1 parent 1d0d254 commit 4d291a1
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 66 deletions.
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

# -- Path setup --------------------------------------------------------------

import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
from pathlib import Path
import sys

_here = Path(__file__).parent.absolute()
sys.path.insert(0, str(_here / ".."))
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinxext/github_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
https://github.com/scikit-learn/scikit-learn/blob/master/doc/sphinxext/github_link.py
"""

from operator import attrgetter
import inspect
import subprocess
import os
import subprocess
import sys
from functools import partial
from operator import attrgetter

REVISION_CMD = "git rev-parse --short HEAD"

Expand Down
2 changes: 1 addition & 1 deletion neurodocker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from pathlib import Path

from neurodocker._version import get_versions
from neurodocker import reproenv # noqa: F401
from neurodocker._version import get_versions

__version__ = get_versions()["version"]
del get_versions
Expand Down
3 changes: 1 addition & 2 deletions neurodocker/cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import click

from neurodocker import __version__
from neurodocker.cli.generate import generate
from neurodocker.cli.generate import genfromjson
from neurodocker.cli.generate import generate, genfromjson


@click.group()
Expand Down
20 changes: 12 additions & 8 deletions neurodocker/cli/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
# TODO: add a dedicated class for key=value in the eat-all class.

import json as json_lib
from pathlib import Path
import sys
import typing as ty
from pathlib import Path

import click

from neurodocker.reproenv.renderers import _Renderer
from neurodocker.reproenv.renderers import DockerRenderer
from neurodocker.reproenv.renderers import SingularityRenderer
from neurodocker.reproenv.state import get_template
from neurodocker.reproenv.state import register_template
from neurodocker.reproenv.state import registered_templates
from neurodocker.reproenv.state import registered_templates_items
from neurodocker.reproenv.renderers import (
DockerRenderer,
SingularityRenderer,
_Renderer,
)
from neurodocker.reproenv.state import (
get_template,
register_template,
registered_templates,
registered_templates_items,
)
from neurodocker.reproenv.template import Template
from neurodocker.reproenv.types import allowed_pkg_managers

Expand Down
2 changes: 1 addition & 1 deletion neurodocker/cli/minify/_prune.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Remove all files under a directory but not caught by `reprozip trace`."""

from pathlib import Path
import typing as ty
from pathlib import Path

import yaml

Expand Down
2 changes: 1 addition & 1 deletion neurodocker/cli/minify/tests/test_minify.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

from click.testing import CliRunner
import pytest
from click.testing import CliRunner

from neurodocker.cli.cli import _arm_on_mac
from neurodocker.cli.minify.trace import minify
Expand Down
2 changes: 1 addition & 1 deletion neurodocker/cli/minify/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import io
import logging
from pathlib import Path
import tarfile
import typing as ty
from pathlib import Path

import click

Expand Down
13 changes: 7 additions & 6 deletions neurodocker/cli/tests/test_build_images_with_cli.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from pathlib import Path

from click.testing import CliRunner
import pytest
from click.testing import CliRunner

from neurodocker.cli.cli import generate
from neurodocker.cli.cli import genfromjson
from neurodocker.cli.cli import generate, genfromjson
from neurodocker.reproenv.state import _TemplateRegistry
from neurodocker.reproenv.tests.utils import get_build_and_run_fns
from neurodocker.reproenv.tests.utils import skip_if_no_docker
from neurodocker.reproenv.tests.utils import skip_if_no_singularity
from neurodocker.reproenv.tests.utils import (
get_build_and_run_fns,
skip_if_no_docker,
skip_if_no_singularity,
)

# Test that a template can be rendered
# We need to use `reproenv generate` as the entrypoint here because the generate command
Expand Down
2 changes: 1 addition & 1 deletion neurodocker/cli/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from pathlib import Path

from click.testing import CliRunner
import pytest
from click.testing import CliRunner

from neurodocker.cli.cli import generate
from neurodocker.cli.generate import OptionEatAll
Expand Down
2 changes: 1 addition & 1 deletion neurodocker/reproenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from neurodocker.reproenv.renderers import DockerRenderer # noqa: F401
from neurodocker.reproenv.renderers import SingularityRenderer # noqa: F401
from neurodocker.reproenv.state import get_template # noqa: F401
from neurodocker.reproenv.state import register_template # noqa: F401
from neurodocker.reproenv.state import registered_templates # noqa: F401
from neurodocker.reproenv.state import get_template # noqa: F401
from neurodocker.reproenv.template import Template # noqa: F401
23 changes: 11 additions & 12 deletions neurodocker/reproenv/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@

import jinja2

from neurodocker.reproenv.exceptions import RendererError
from neurodocker.reproenv.exceptions import TemplateError
from neurodocker.reproenv.state import _TemplateRegistry
from neurodocker.reproenv.state import _validate_renderer
from neurodocker.reproenv.template import _BaseInstallationTemplate
from neurodocker.reproenv.template import Template
from neurodocker.reproenv.types import _SingularityHeaderType
from neurodocker.reproenv.types import REPROENV_SPEC_FILE_IN_CONTAINER
from neurodocker.reproenv.types import allowed_pkg_managers
from neurodocker.reproenv.types import allowed_installation_methods
from neurodocker.reproenv.types import installation_methods_type
from neurodocker.reproenv.types import pkg_managers_type
from neurodocker.reproenv.exceptions import RendererError, TemplateError
from neurodocker.reproenv.state import _TemplateRegistry, _validate_renderer
from neurodocker.reproenv.template import Template, _BaseInstallationTemplate
from neurodocker.reproenv.types import (
REPROENV_SPEC_FILE_IN_CONTAINER,
_SingularityHeaderType,
allowed_installation_methods,
allowed_pkg_managers,
installation_methods_type,
pkg_managers_type,
)

# All jinja2 templates are instantiated from this environment object. It is
# configured to dislike undefined attributes. For example, if a template is
Expand Down
10 changes: 6 additions & 4 deletions neurodocker/reproenv/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import copy
import json
import os
from pathlib import Path
import typing as ty
from pathlib import Path

import jsonschema
import yaml
Expand All @@ -16,9 +16,11 @@
except ImportError: # pragma: no cover
from yaml import SafeLoader # type: ignore # pragma: no cover

from neurodocker.reproenv.exceptions import RendererError
from neurodocker.reproenv.exceptions import TemplateError
from neurodocker.reproenv.exceptions import TemplateNotFound
from neurodocker.reproenv.exceptions import (
RendererError,
TemplateError,
TemplateNotFound,
)
from neurodocker.reproenv.types import TemplateType

_schemas_path = Path(__file__).parent / "schemas"
Expand Down
8 changes: 5 additions & 3 deletions neurodocker/reproenv/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

from neurodocker.reproenv.exceptions import TemplateKeywordArgumentError
from neurodocker.reproenv.state import _validate_template
from neurodocker.reproenv.types import _BinariesTemplateType
from neurodocker.reproenv.types import _SourceTemplateType
from neurodocker.reproenv.types import TemplateType
from neurodocker.reproenv.types import (
TemplateType,
_BinariesTemplateType,
_SourceTemplateType,
)


class Template:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# TODO: add more tests for `from_dict` method.

from pathlib import Path
import typing as ty
from pathlib import Path

import pytest

from neurodocker.reproenv.renderers import DockerRenderer
from neurodocker.reproenv.renderers import SingularityRenderer
from neurodocker.reproenv.renderers import DockerRenderer, SingularityRenderer
from neurodocker.reproenv.state import _TemplateRegistry
from neurodocker.reproenv.tests.utils import get_build_and_run_fns
from neurodocker.reproenv.tests.utils import skip_if_no_docker
from neurodocker.reproenv.tests.utils import skip_if_no_singularity
from neurodocker.reproenv.types import installation_methods_type
from neurodocker.reproenv.types import pkg_managers_type
from neurodocker.reproenv.tests.utils import (
get_build_and_run_fns,
skip_if_no_docker,
skip_if_no_singularity,
)
from neurodocker.reproenv.types import installation_methods_type, pkg_managers_type

_template_filepath = Path(__file__).parent / "sample-template-jq.yaml"

Expand Down
11 changes: 6 additions & 5 deletions neurodocker/reproenv/tests/test_build_images_simple.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import pytest

from neurodocker.reproenv.renderers import DockerRenderer
from neurodocker.reproenv.renderers import SingularityRenderer
from neurodocker.reproenv.tests.utils import get_build_and_run_fns
from neurodocker.reproenv.tests.utils import skip_if_no_docker
from neurodocker.reproenv.tests.utils import skip_if_no_singularity
from neurodocker.reproenv.renderers import DockerRenderer, SingularityRenderer
from neurodocker.reproenv.tests.utils import (
get_build_and_run_fns,
skip_if_no_docker,
skip_if_no_singularity,
)


@pytest.mark.parametrize(
Expand Down
8 changes: 5 additions & 3 deletions neurodocker/reproenv/tests/test_renderers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pytest

from neurodocker.reproenv.exceptions import RendererError
from neurodocker.reproenv.renderers import _Renderer
from neurodocker.reproenv.renderers import DockerRenderer
from neurodocker.reproenv.renderers import SingularityRenderer
from neurodocker.reproenv.renderers import (
DockerRenderer,
SingularityRenderer,
_Renderer,
)


def test_renderer():
Expand Down
3 changes: 1 addition & 2 deletions neurodocker/reproenv/tests/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import pytest
import yaml

from neurodocker.reproenv import exceptions
from neurodocker.reproenv import exceptions, types
from neurodocker.reproenv.state import _TemplateRegistry, _validate_template
from neurodocker.reproenv import types


def test_validate_template_invalid_templates():
Expand Down
4 changes: 1 addition & 3 deletions neurodocker/reproenv/tests/test_template.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest

from neurodocker.reproenv import exceptions
from neurodocker.reproenv import template
from neurodocker.reproenv import types
from neurodocker.reproenv import exceptions, template, types


def test_template():
Expand Down
2 changes: 1 addition & 1 deletion neurodocker/reproenv/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import contextlib
import getpass
import os
from pathlib import Path
import subprocess
import typing as ty
import uuid
from pathlib import Path

import pytest

Expand Down

0 comments on commit 4d291a1

Please sign in to comment.