Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion gufe/chemicalsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# For details, see https://github.com/OpenFreeEnergy/gufe

from collections import abc
from typing import Optional

from .components import Component
from .tokenization import GufeTokenizable
Expand Down
2 changes: 1 addition & 1 deletion gufe/components/smallmoleculecomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _from_sdf_supplier(cls, supp):
pass
else:
# TODO: less generic exception type here
raise RuntimeError(f"SDF contains more than 1 molecule")
raise RuntimeError("SDF contains more than 1 molecule")

return cls(rdkit=mol) # name is obtained automatically

Expand Down
1 change: 0 additions & 1 deletion gufe/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# For details, see https://github.com/OpenFreeEnergy/gufe

from collections.abc import Generator, Iterable
from typing import Optional

import networkx as nx
from typing_extensions import Self # Self is included in typing as of python 3.11
Expand Down
2 changes: 1 addition & 1 deletion gufe/protocols/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import abc
import warnings
from collections.abc import Iterable, Sized
from typing import Any, Optional, Union
from typing import Any

from openff.units import Quantity

Expand Down
7 changes: 1 addition & 6 deletions gufe/protocols/protocoldag.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe

import abc
import os
import shutil
from collections import defaultdict
from collections.abc import Iterable
from copy import copy
from os import PathLike
from pathlib import Path
from typing import Any, Optional, Union
from typing import Any

import networkx as nx

Expand Down
8 changes: 2 additions & 6 deletions gufe/protocols/protocolunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@

import abc
import datetime
import sys
import tempfile
import traceback
import uuid
from collections.abc import Iterable
from copy import copy
from dataclasses import dataclass
from os import PathLike
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Union
from typing import Any

from ..tokenization import TOKENIZABLE_REGISTRY, GufeKey, GufeTokenizable
from ..tokenization import GufeKey, GufeTokenizable
from .errors import ExecutionInterrupt


Expand Down
2 changes: 1 addition & 1 deletion gufe/serialization/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import json
import pathlib
from collections.abc import Callable, Iterable
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from typing import Any
from uuid import UUID

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions gufe/storage/externalresource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import pathlib
from typing import ContextManager, Iterator

from ..errors import MissingExternalResourceError


@dataclasses.dataclass
class Metadata:
Expand Down
3 changes: 1 addition & 2 deletions gufe/storage/externalresource/filestorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import os
import pathlib
import shutil
from typing import ContextManager, Tuple, Union

from ..errors import ChangedExternalResourceError, MissingExternalResourceError
from ..errors import MissingExternalResourceError
from .base import ExternalStorage


Expand Down
3 changes: 1 addition & 2 deletions gufe/storage/externalresource/memorystorage.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe
import io
from typing import ContextManager, Tuple, Union

from ..errors import ChangedExternalResourceError, MissingExternalResourceError
from ..errors import MissingExternalResourceError
from .base import ExternalStorage


Expand Down
3 changes: 2 additions & 1 deletion gufe/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe

import importlib.resources

import importlib

import pooch
import pytest
Expand Down
7 changes: 1 addition & 6 deletions gufe/tests/storage/test_externalresource.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import hashlib
import os
import pathlib
from unittest import mock

import pytest

from gufe.storage.errors import ChangedExternalResourceError, MissingExternalResourceError
from gufe.storage.errors import MissingExternalResourceError
from gufe.storage.externalresource import FileStorage, MemoryStorage

# NOTE: Tests for the abstract base are just part of the tests of its
Expand Down
3 changes: 1 addition & 2 deletions gufe/tests/test_alchemicalnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import networkx as nx
import pytest

from gufe import AlchemicalNetwork, ChemicalSystem, Transformation
from gufe import AlchemicalNetwork

from .test_protocol import DummyProtocol, DummyProtocolResult
from .test_tokenization import GufeTokenizableTestsMixin


Expand Down
2 changes: 0 additions & 2 deletions gufe/tests/test_chemicalsystem.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe

import numpy as np
import pytest

from gufe import ChemicalSystem, Component, SmallMoleculeComponent, SolventComponent
from gufe.components import ProteinComponent

from ..components.explicitmoleculecomponent import ExplicitMoleculeComponent
from .test_tokenization import GufeTokenizableTestsMixin


Expand Down
2 changes: 1 addition & 1 deletion gufe/tests/test_ligand_network.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of gufe and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe
import importlib.resources
import importlib
from collections.abc import Iterable
from typing import NamedTuple

Expand Down
2 changes: 1 addition & 1 deletion gufe/tests/test_ligandatommapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .test_tokenization import GufeTokenizableTestsMixin

try:
import py3Dmol
import py3Dmol # noqa: F401

HAS_PY3DMOL = True
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion gufe/tests/test_mapping_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)

try:
import py3Dmol
import py3Dmol # noqa: F401

HAS_PY3DMOL = True
except ImportError:
Expand Down
3 changes: 1 addition & 2 deletions gufe/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
"""

import json
from typing import Iterable

import numpy as np
import pytest
from openff.units import Quantity, unit

from gufe.settings import SettingsBaseModel
from gufe.settings.models import OpenMMSystemGeneratorFFSettings, Settings, ThermoSettings
from gufe.settings.typing import BoxQuantity, GufeQuantity, NanometerArrayQuantity, NanometerQuantity
from gufe.settings.typing import BoxQuantity, NanometerArrayQuantity


def test_settings_schema():
Expand Down
1 change: 0 additions & 1 deletion gufe/tests/test_proteincomponent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import copy
import io
import os
from unittest import mock
Expand Down
4 changes: 2 additions & 2 deletions gufe/tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pathlib
from collections import defaultdict
from collections.abc import Iterable, Sized
from typing import Any, Dict, List, Optional, Union
from typing import Any

import networkx as nx
import numpy as np
Expand Down Expand Up @@ -580,7 +580,7 @@ def instance(self, vacuum_ligand, solvated_ligand):
some_dict={"a": 2, "b": 12},
)

return SimulationUnit(name=f"simulation", initialization=alpha)
return SimulationUnit(name="simulation", initialization=alpha)

def test_key_stable(self, instance):
# for the DAG system, keys for `ProtocolUnit`s are based on UUIDs,
Expand Down
2 changes: 1 addition & 1 deletion gufe/tests/test_serialization_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from uuid import uuid4

import numpy as np
import openff.units
import openff
import pytest
from numpy import testing as npt
from openff.units import unit
Expand Down
2 changes: 1 addition & 1 deletion gufe/tests/test_serialization_migration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import copy
from typing import Any, Optional, Type
from typing import Any

import pytest
from pydantic import BaseModel
Expand Down
4 changes: 0 additions & 4 deletions gufe/tests/test_smallmoleculecomponent.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe

import importlib
import importlib.resources

try:
import openff.toolkit.topology
Expand All @@ -13,14 +11,12 @@
HAS_OFFTK = True
import json
import logging
import os
from unittest import mock

import pytest
from rdkit import Chem
from rdkit.Chem import AllChem

import gufe
from gufe import SmallMoleculeComponent
from gufe.components.explicitmoleculecomponent import _ensure_ofe_name
from gufe.tokenization import TOKENIZABLE_REGISTRY
Expand Down
3 changes: 0 additions & 3 deletions gufe/tests/test_tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
import io
import json
import logging
from typing import Optional
from unittest import mock

import pytest

from gufe.serialization.msgpack import packb, unpackb
from gufe.tokenization import (
JSON_HANDLER,
TOKENIZABLE_CLASS_REGISTRY,
TOKENIZABLE_REGISTRY,
GufeKey,
GufeTokenizable,
Expand All @@ -21,7 +19,6 @@
gufe_objects_from_shallow_dict,
gufe_to_digraph,
import_qualname,
tokenize,
)


Expand Down
1 change: 0 additions & 1 deletion gufe/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# For details, see https://github.com/OpenFreeEnergy/openfe

import io
import pathlib

import pytest

Expand Down
6 changes: 3 additions & 3 deletions gufe/tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections.abc import Generator
from itertools import chain
from os import PathLike
from typing import Any, BinaryIO, Callable, Dict, List, Optional, TextIO, Tuple, Union
from typing import Any, BinaryIO, Callable, TextIO

import networkx as nx
from typing_extensions import Self
Expand Down Expand Up @@ -712,7 +712,7 @@ def from_json(cls, file: PathLike | TextIO | None = None, content: str | None =
return cls.from_keyed_chain(keyed_chain=deserialized)
except ValueError:
# if the above fails, try to load as the dict representation
warnings.warn(f"keyed-chain deserialization failed; falling back to deserializing dict representation")
warnings.warn("keyed-chain deserialization failed; falling back to deserializing dict representation")
return cls.from_dict(deserialized)

from gufe.utils import ensure_filelike
Expand All @@ -724,7 +724,7 @@ def from_json(cls, file: PathLike | TextIO | None = None, content: str | None =
return cls.from_keyed_chain(keyed_chain=deserialized)
except ValueError:
# if the above fails, try to load as the dict representation
warnings.warn(f"keyed-chain deserialization failed; falling back to deserializing dict representation")
warnings.warn("keyed-chain deserialization failed; falling back to deserializing dict representation")
return cls.from_dict(deserialized)

def to_msgpack(self, file: PathLike | BinaryIO | None = None) -> None | bytes:
Expand Down
1 change: 0 additions & 1 deletion gufe/transformations/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import json
import warnings
from collections.abc import Iterable
from typing import Optional, Union

from ..chemicalsystem import ChemicalSystem
from ..mapping import ComponentMapping
Expand Down
2 changes: 1 addition & 1 deletion gufe/vendor/openff/interchange/_annotations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Vendored from https://github.com/openforcefield/openff-interchange/blob/main/openff/interchange/_annotations.py
import functools
from collections.abc import Callable
from typing import Annotated, Any
from typing import Annotated

import numpy
from annotated_types import Gt
Expand Down
6 changes: 3 additions & 3 deletions gufe/vendor/pdb_file/PdbxContainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def setValue(self, value, attributeName=None, rowIndex=None):

# extend the list if needed -
if ind >= ll:
self._rowList[rowI].extend([None for ii in xrange(2 * ind - ll)])
self._rowList[rowI].extend([None for ii in xrange(2 * ind - ll)]) # noqa: F821, but note that xrange is deprecated
self._rowList[rowI][ind] = value
except IndexError:
self.__lfh.write(
Expand Down Expand Up @@ -543,14 +543,14 @@ def invokeAttributeMethod(self, attributeName, type, method, db):
#
ind = self._attributeNameList.index(attributeName)
if len(self._rowList) == 0:
row = [None for ii in xrange(len(self._attributeNameList) * 2)]
row = [None for ii in xrange(len(self._attributeNameList) * 2)] # noqa: F821, but note that xrange is deprecated
row[ind] = None
self._rowList.append(row)

for row in self._rowList:
ll = len(row)
if ind >= ll:
row.extend([None for ii in xrange(2 * ind - ll)])
row.extend([None for ii in xrange(2 * ind - ll)]) # noqa: F821, but note that xrange is deprecated
row[ind] = None
exec(method.getInline())
self.__currentRowIndex += 1
Expand Down
1 change: 0 additions & 1 deletion gufe/vendor/pdb_file/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
__version__ = "1.0"

import copyreg
import sys
from collections import OrderedDict

from openmm.unit import daltons, is_quantity
Expand Down
2 changes: 1 addition & 1 deletion gufe/visualization/mapping_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..utils import requires_package

if TYPE_CHECKING:
import py3Dmol
pass

# highlight core element changes differently from unique atoms
# RGBA color value needs to be between 0 and 1, so divide by 255
Expand Down
Loading
Loading