Skip to content

Commit

Permalink
Replace which imports from monty to shutil
Browse files Browse the repository at this point in the history
  • Loading branch information
rashatwi committed Mar 17, 2024
1 parent ba76742 commit 7938619
Show file tree
Hide file tree
Showing 25 changed files with 36 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pymatgen/analysis/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from collections import defaultdict, namedtuple
from itertools import combinations
from operator import itemgetter
from shutil import which

import networkx as nx
import networkx.algorithms.isomorphism as iso
import numpy as np
from monty.json import MSONable
from monty.os.path import which
from networkx.drawing.nx_agraph import write_dot
from networkx.readwrite import json_graph
from scipy.spatial import KDTree
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/magnetism/tests/test_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import unittest

from monty.os.path import which
from shutil import which

from pymatgen.analysis.magnetism import *
from pymatgen.core import Element, Lattice, Species, Structure
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/tests/test_local_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import unittest
import warnings
from math import pi
from shutil import which

import numpy as np
import pytest
from monty.os.path import which

from pymatgen.core.periodic_table import Element
from pymatgen.core.lattice import Lattice
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/command_line/bader_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
import subprocess
import warnings

from shutil import which

import numpy as np
from monty.dev import requires
from monty.io import zopen
from monty.os.path import which
from monty.tempfile import ScratchDir

from pymatgen.io.cube import Cube
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/critic2_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
import subprocess
import warnings
from enum import Enum
from shutil import which

import numpy as np
from monty.dev import requires
from monty.json import MSONable
from monty.os.path import which
from monty.serialization import loadfn
from monty.tempfile import ScratchDir
from scipy.spatial import KDTree
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/enumlib_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
import re
import subprocess
from threading import Timer
from shutil import which

import numpy as np
from monty.dev import requires
from monty.fractions import lcm
from monty.os.path import which
from monty.tempfile import ScratchDir

from pymatgen.core.periodic_table import DummySpecies
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/mcsqs_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import os
import tempfile
import warnings
from shutil import which
from pathlib import Path
from subprocess import Popen, TimeoutExpired
from collections import namedtuple
from typing import Dict, List, Optional, Union

from monty.dev import requires
from monty.os.path import which

from pymatgen.core.structure import Structure

Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/tests/test_critic2_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from monty.os.path import which
from shutil import which

from pymatgen.command_line.critic2_caller import *
from pymatgen.core.structure import Structure
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/tests/test_enumlib_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
import warnings

from monty.os.path import which
from shutil import which

from pymatgen.core.periodic_table import Element
from pymatgen.core.structure import Structure
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/tests/test_gulp_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
import unittest

from monty.os.path import which
from shutil import which

from pymatgen.analysis.bond_valence import BVAnalyzer
from pymatgen.command_line.gulp_caller import (
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/command_line/tests/test_mcsqs_caller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import unittest

from monty.os.path import which
from shutil import which

from monty.serialization import loadfn

from pymatgen.core.structure import Structure
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/command_line/tests/test_vampire_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
import unittest
import warnings

from shutil import which

import pandas as pd
from monty.os.path import which

import pymatgen.command_line.vampire_caller as vampirecaller
from pymatgen.core.structure import Structure
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/command_line/vampire_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
import logging
import subprocess

from shutil import which

import pandas as pd
from monty.dev import requires
from monty.json import MSONable
from monty.os.path import which

from pymatgen.analysis.magnetism.heisenberg import HeisenbergMapper

Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/tests/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import unittest
import warnings
from pathlib import Path
from shutil import which

import pytest # type: ignore
import numpy as np
from monty.os.path import which

from pymatgen.core.composition import Composition
from pymatgen.core.lattice import Lattice
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/electronic_structure/boltztrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
import tempfile
import time

from shutil import which

import numpy as np
from monty.dev import requires
from monty.json import MSONable, jsanitize
from monty.os import cd
from monty.os.path import which
from scipy import constants
from scipy.spatial import distance

Expand Down
3 changes: 2 additions & 1 deletion pymatgen/electronic_structure/tests/test_boltztrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import unittest
import warnings

from monty.os.path import which
from shutil import which

from monty.serialization import loadfn

from pymatgen.electronic_structure.bandstructure import BandStructure
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/electronic_structure/tests/test_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import unittest
import warnings
from io import open
from shutil import which

import scipy
from monty.os.path import which

from pymatgen.core.structure import Structure
from pymatgen.electronic_structure.bandstructure import BandStructureSymmLine
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/ext/cod.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
import re
import subprocess

from shutil import which

import requests
from monty.dev import requires
from monty.os.path import which

from pymatgen.core.composition import Composition
from pymatgen.core.structure import Structure
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/ext/tests/test_cod.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import requests

from monty.os.path import which
from shutil import which

from pymatgen.ext.cod import COD

Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/ambertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class does not work properly.
import tempfile
import numpy as np
import parmed as pmd
from shutil import which
from collections import namedtuple, OrderedDict

from monty.dev import requires
from monty.os.path import which
from monty.tempfile import ScratchDir

from pymatgen.core.structure import Molecule
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/lammps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import tempfile
from io import open
from subprocess import PIPE, Popen
from shutil import which

import numpy as np

Expand All @@ -19,7 +20,6 @@
except ImportError:
pb = None

from monty.os.path import which
from monty.tempfile import ScratchDir

from pymatgen.core.structure import Molecule
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/io/qchem/tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import os
import unittest

from monty.os.path import which
from shutil import which

from monty.serialization import dumpfn, loadfn

from pymatgen.core.structure import Molecule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import unittest
import warnings

from shutil import which

import numpy as np
from monty.os.path import which
from monty.serialization import loadfn

from pymatgen.core.lattice import Lattice
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/transformations/tests/test_site_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

import unittest

from shutil import which

import numpy as np
from monty.os.path import which

from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure, Molecule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import unittest
import warnings

from shutil import which

from monty.json import MontyDecoder
from monty.os.path import which

from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element
Expand Down

0 comments on commit 7938619

Please sign in to comment.