Skip to content

Commit

Permalink
Pre-commit: Add isort (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
sphuber committed Mar 17, 2023
1 parent 0ec8664 commit f3cd111
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ repos:
'--fail-on-change',
]

- repo: https://github.com/pycqa/isort
rev: '5.12.0'
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.31.0
hooks:
Expand Down
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html

from reentry import manager

manager.scan()

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

import os
# 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.
#
import pathlib
import os
import sys

sys.path.insert(0, os.path.abspath('../../'))

# Symlink the examples directory to be in this working directory
Expand Down
3 changes: 2 additions & 1 deletion examples/calculations/example_grid_gpaw_relax.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
from aiida import engine, orm
from aiida.orm import load_code
from ase.build import bulk
from aiida import orm, engine


def runner():

Expand Down
5 changes: 1 addition & 4 deletions examples/calculations/example_pw_gpaw_relax.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
"""Example script of how to perform a relax GPAW calculation on crystalline silicon using AiiDA."""
from aiida import common
from aiida import engine
from aiida import orm
from aiida import plugins
from aiida import common, engine, orm, plugins
from ase.build import bulk

# Change the following value to the ``Code`` that you have configured
Expand Down
5 changes: 1 addition & 4 deletions examples/calculations/example_pw_gpaw_scf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
"""Example script of how to perform an SCF GPAW calculation on crystalline silicon using AiiDA."""
from aiida import common
from aiida import engine
from aiida import orm
from aiida import plugins
from aiida import common, engine, orm, plugins
from ase.build import bulk

# Change the following value to the ``Code`` that you have configured
Expand Down
3 changes: 2 additions & 1 deletion examples/workflows/example_base_gpaw.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-


from aiida import engine, orm
from aiida.orm import load_code
from ase.build import bulk
from aiida import orm, engine


def runner():

Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ exclude = [
line-length = 120
fail-on-change = true

[tool.isort]
force_sort_within_sections = true
include_trailing_comma = true
line_length = 120
multi_line_output = 3

[tool.pytest.ini_options]
filterwarnings = [
'ignore:Creating AiiDA configuration folder.*:UserWarning'
Expand Down
5 changes: 1 addition & 4 deletions src/aiida_ase/calculations/ase.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
"""`CalcJob` implementation that can be used to wrap around the ASE calculators."""
from aiida import common
from aiida import engine
from aiida import orm
from aiida import plugins
from aiida import common, engine, orm, plugins

Dict = plugins.DataFactory('dict')
StructureData = plugins.DataFactory('structure')
Expand Down
5 changes: 2 additions & 3 deletions src/aiida_ase/parsers/ase.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
"""Parser implementation for the ``AseCalculation``."""
import json
import numpy

from aiida import parsers
from aiida import plugins
from aiida import parsers, plugins
from ase.io import read
import numpy

Dict = plugins.DataFactory('dict')
ArrayData = plugins.DataFactory('array')
Expand Down
5 changes: 2 additions & 3 deletions src/aiida_ase/parsers/gpaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"""Parser implementation for the ``AseCalculation``."""
import json
import math
import numpy

from aiida import parsers
from aiida import plugins
from aiida import parsers, plugins
from ase.io import read
import numpy

Dict = plugins.DataFactory('dict')
ArrayData = plugins.DataFactory('array')
Expand Down
4 changes: 2 additions & 2 deletions src/aiida_ase/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"""Workchain to run a GPAW calculation with automated error handling and restarts."""

from aiida import orm
from aiida.engine import while_, BaseRestartWorkChain, process_handler, ProcessHandlerReport
from aiida.plugins import CalculationFactory
from aiida.common import AttributeDict, exceptions
from aiida.engine import BaseRestartWorkChain, ProcessHandlerReport, process_handler, while_
from aiida.plugins import CalculationFactory

AseCalculation = CalculationFactory('ase.ase') # pylint: disable=invalid-name

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import collections
import re

import pytest

from aiida import orm
import pytest

pytest_plugins = ['aiida.manage.tests.pytest_fixtures'] # pylint: disable=invalid-name

Expand Down Expand Up @@ -96,6 +95,7 @@ def _generate_calc_job_node(entry_point_name, computer, test_name=None, inputs=N
"""
# pylint: disable=too-many-locals
import os

from aiida.common import LinkType
from aiida.plugins.entry_point import format_entry_point_string

Expand Down

0 comments on commit f3cd111

Please sign in to comment.