Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 28, 2023
1 parent 6c290a2 commit 1b60bfd
Show file tree
Hide file tree
Showing 228 changed files with 1,718 additions and 3,368 deletions.
8 changes: 2 additions & 6 deletions backend/dp_backend.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
"""A PEP-517 backend to find TensorFlow."""
from typing import (
List,
)
from typing import List

from find_tensorflow import (
find_tensorflow,
)
from find_tensorflow import find_tensorflow

# TODO: switch to scikit_build_core after it is available
from setuptools import build_meta as _orig
Expand Down
32 changes: 10 additions & 22 deletions backend/find_tensorflow.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
import os
import site
from importlib.machinery import (
FileFinder,
)
from importlib.util import (
find_spec,
)
from pathlib import (
Path,
)
from sysconfig import (
get_path,
)
from typing import (
List,
Optional,
Tuple,
Union,
)

from packaging.specifiers import (
SpecifierSet,
)
from importlib.machinery import FileFinder
from importlib.util import find_spec
from pathlib import Path
from sysconfig import get_path
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union

from packaging.specifiers import SpecifierSet


def find_tensorflow() -> Tuple[Optional[str], List[str]]:
Expand Down
8 changes: 2 additions & 6 deletions data/json/json2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

import argparse
import json
from pathlib import (
Path,
)
from warnings import (
warn,
)
from pathlib import Path
from warnings import warn

import yaml

Expand Down
36 changes: 12 additions & 24 deletions deepmd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
"""Root of the deepmd package, exposes all public classes and submodules."""

try:
from importlib import (
metadata,
)
from importlib import metadata
except ImportError: # for Python<3.8
import importlib_metadata as metadata

import deepmd.utils.network as network

from . import (
cluster,
descriptor,
fit,
loss,
nvnmd,
utils,
)
from .env import (
set_mkl,
)
from .infer import (
DeepEval,
DeepPotential,
)
from .infer.data_modifier import (
DipoleChargeModifier,
)
from . import cluster
from . import descriptor
from . import fit
from . import loss
from . import nvnmd
from . import utils
from .env import set_mkl
from .infer import DeepEval
from .infer import DeepPotential
from .infer.data_modifier import DipoleChargeModifier

set_mkl()

try:
from ._version import version as __version__
except ImportError:
from .__about__ import (
__version__,
)
from .__about__ import __version__

# load third-party plugins
try:
Expand Down
4 changes: 1 addition & 3 deletions deepmd/__main__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Package dp entry point."""

from .entrypoints.main import (
main,
)
from .entrypoints.main import main

if __name__ == "__main__":
main()
36 changes: 13 additions & 23 deletions deepmd/calculator.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
"""ASE calculator interface module."""

from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Dict,
List,
Optional,
Union,
)

from ase.calculators.calculator import (
Calculator,
PropertyNotImplementedError,
all_changes,
)

from deepmd import (
DeepPotential,
)
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Dict
from typing import List
from typing import Optional
from typing import Union

from ase.calculators.calculator import Calculator
from ase.calculators.calculator import PropertyNotImplementedError
from ase.calculators.calculator import all_changes

from deepmd import DeepPotential

if TYPE_CHECKING:
from ase import (
Atoms,
)
from ase import Atoms

__all__ = ["DP"]

Expand Down
8 changes: 3 additions & 5 deletions deepmd/cluster/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"""Module that reads node resources, auto detects if running local or on SLURM."""

import os
from typing import (
List,
Optional,
Tuple,
)
from typing import List
from typing import Optional
from typing import Tuple

from .local import get_resource as get_local_res
from .slurm import get_resource as get_slurm_res
Expand Down
14 changes: 5 additions & 9 deletions deepmd/cluster/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
import socket
import subprocess as sp
import sys
from typing import (
List,
Optional,
Tuple,
)

from deepmd.env import (
tf,
)
from typing import List
from typing import Optional
from typing import Tuple

from deepmd.env import tf

__all__ = ["get_gpus", "get_resource"]

Expand Down
12 changes: 4 additions & 8 deletions deepmd/cluster/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@
"""

import os
from typing import (
List,
Optional,
Tuple,
)
from typing import List
from typing import Optional
from typing import Tuple

import hostlist

from deepmd.cluster import (
local,
)
from deepmd.cluster import local

__all__ = ["get_resource"]

Expand Down
42 changes: 11 additions & 31 deletions deepmd/descriptor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
from .descriptor import (
Descriptor,
)
from .hybrid import (
DescrptHybrid,
)
from .loc_frame import (
DescrptLocFrame,
)
from .se_a import (
DescrptSeA,
)
from .se_a_ebd import (
DescrptSeAEbd,
)
from .se_a_ef import (
DescrptSeAEf,
DescrptSeAEfLower,
)
from .se_a_mask import (
DescrptSeAMask,
)
from .se_atten import (
DescrptSeAtten,
)
from .se_r import (
DescrptSeR,
)
from .se_t import (
DescrptSeT,
)
from .descriptor import Descriptor
from .hybrid import DescrptHybrid
from .loc_frame import DescrptLocFrame
from .se_a import DescrptSeA
from .se_a_ebd import DescrptSeAEbd
from .se_a_ef import DescrptSeAEf
from .se_a_ef import DescrptSeAEfLower
from .se_a_mask import DescrptSeAMask
from .se_atten import DescrptSeAtten
from .se_r import DescrptSeR
from .se_t import DescrptSeT

__all__ = [
"Descriptor",
Expand Down
30 changes: 11 additions & 19 deletions deepmd/descriptor/descriptor.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
from abc import (
abstractmethod,
)
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
)
from abc import abstractmethod
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple

import numpy as np

from deepmd.env import (
GLOBAL_TF_FLOAT_PRECISION,
tf,
)
from deepmd.utils import (
Plugin,
PluginVariant,
)
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import tf
from deepmd.utils import Plugin
from deepmd.utils import PluginVariant


class Descriptor(PluginVariant):
Expand Down
22 changes: 7 additions & 15 deletions deepmd/descriptor/hybrid.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
from typing import (
List,
Optional,
Tuple,
)
from typing import List
from typing import Optional
from typing import Tuple

import numpy as np

from deepmd.env import (
GLOBAL_TF_FLOAT_PRECISION,
tf,
)
from deepmd.utils.spin import (
Spin,
)
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import tf
from deepmd.utils.spin import Spin

# from deepmd.descriptor import DescrptLocFrame
# from deepmd.descriptor import DescrptSeA
# from deepmd.descriptor import DescrptSeT
# from deepmd.descriptor import DescrptSeAEbd
# from deepmd.descriptor import DescrptSeAEf
# from deepmd.descriptor import DescrptSeR
from .descriptor import (
Descriptor,
)
from .descriptor import Descriptor


@Descriptor.register("hybrid")
Expand Down
32 changes: 11 additions & 21 deletions deepmd/descriptor/loc_frame.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
from typing import (
List,
Optional,
Tuple,
)
from typing import List
from typing import Optional
from typing import Tuple

import numpy as np

from deepmd.env import (
GLOBAL_NP_FLOAT_PRECISION,
GLOBAL_TF_FLOAT_PRECISION,
default_tf_session_config,
op_module,
tf,
)
from deepmd.utils.graph import (
get_tensor_by_name_from_graph,
)
from deepmd.utils.sess import (
run_sess,
)
from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
from deepmd.env import GLOBAL_TF_FLOAT_PRECISION
from deepmd.env import default_tf_session_config
from deepmd.env import op_module
from deepmd.env import tf
from deepmd.utils.graph import get_tensor_by_name_from_graph
from deepmd.utils.sess import run_sess

from .descriptor import (
Descriptor,
)
from .descriptor import Descriptor


@Descriptor.register("loc_frame")
Expand Down
Loading

0 comments on commit 1b60bfd

Please sign in to comment.