Skip to content

Commit

Permalink
mostly black v20 formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Aug 31, 2020
1 parent fecb6d9 commit 0c1930b
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 64 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/QCSchema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ jobs:
make qcschema
ls -l qcschema
#cp -p qcschema/* ../qcsk/qcschema_json/
cp -p qcschema/* ../qcsk/qcschema/
cp -p qcschema/* ../qcsk/qcschema/data/vdev/
mv ../qcsk/qcschema/data/vdev/QCSchema.schema ../qcsk/qcschema/dev/
# Note: `qcschema_json` is a folder in the py2json branch containing plain JSON files of the schema,
# rather than the python module of the current repo
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ cpu_data:
.PHONY: qcschema
qcschema:
mkdir -p qcschema
python -c "exec(\"import pathlib, qcelemental\nfor md in qcelemental.models.qcschema_models():\n\tmfile = (pathlib.Path('qcschema') / md.__name__).with_suffix('.schema')\n\twith open(mfile, 'w') as fp:\n\t\tfp.write(md.schema_json(indent=4))\")"
python -c "exec(\"import pathlib, qcelemental\nfor md in qcelemental.models.qcschema_models():\n\tmfile = (pathlib.Path('qcschema') / md.__name__).with_suffix('.schema')\n\twith open(mfile, 'w') as fp:\n\t\tfp.write(md.schema_json(indent=None))\")"
python -c "exec(\"import json, pathlib, pydantic, qcelemental\nwith open((pathlib.Path('qcschema') / 'QCSchema').with_suffix('.schema'), 'w') as fp:\n\tjson.dump(pydantic.schema.schema(qcelemental.models.qcschema_models(), title='QCSchema'), fp, indent=4)\")"

.PHONY: clean
Expand Down
6 changes: 2 additions & 4 deletions qcelemental/info/cpu_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@


class VendorEnum(str, Enum):
"""Allowed processor vendors, used for validation.
"""
"""Allowed processor vendors, used for validation."""

amd = "amd"
intel = "intel"
Expand All @@ -24,8 +23,7 @@ class VendorEnum(str, Enum):


class InstructionSetEnum(int, Enum):
"""Allowed instruction sets for CPUs in an ordinal enum.
"""
"""Allowed instruction sets for CPUs in an ordinal enum."""

none = 0
sse = 1
Expand Down
12 changes: 3 additions & 9 deletions qcelemental/models/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@ class AlignmentMill(ProtoModel):
"""

shift: Optional[Array[float]] = Field( # type: ignore
None, description="Translation array (3,) for coordinates."
)
rotation: Optional[Array[float]] = Field( # type: ignore
None, description="Rotation array (3, 3) for coordinates."
)
atommap: Optional[Array[int]] = Field( # type: ignore
None, description="Atom exchange map (nat,) for coordinates."
)
shift: Optional[Array[float]] = Field(None, description="Translation array (3,) for coordinates.") # type: ignore
rotation: Optional[Array[float]] = Field(None, description="Rotation array (3, 3) for coordinates.") # type: ignore
atommap: Optional[Array[int]] = Field(None, description="Atom exchange map (nat,) for coordinates.") # type: ignore
mirror: bool = Field(False, description="Do mirror invert coordinates?")

class Config:
Expand Down
3 changes: 1 addition & 2 deletions qcelemental/models/common_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class Config(ProtoModel.Config):


class DriverEnum(str, Enum):
"""Allowed computation driver values.
"""
"""Allowed computation driver values."""

energy = "energy"
gradient = "gradient"
Expand Down
5 changes: 3 additions & 2 deletions qcelemental/models/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ class WavefunctionProtocolEnum(str, Enum):

class ErrorCorrectionProtocol(ProtoModel):
"""Configuration for how QCEngine handles error correction
WARNING: These protocols are currently experimental and only supported by NWChem tasks
"""

Expand Down Expand Up @@ -452,7 +452,8 @@ class AtomicInput(ProtoModel):
)

extras: Dict[str, Any] = Field(
{}, description="Extra fields not part of the schema. Used for schema development and scratch space.",
{},
description="Extra fields not part of the schema. Used for schema development and scratch space.",
)

provenance: Provenance = Field(
Expand Down
3 changes: 1 addition & 2 deletions qcelemental/physical_constants/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ def get(self, physical_constant: str, return_tuple: bool = False) -> Union[float
# me 'electron mass' = 9.10938215E-31 # Electron rest mass (in kg)

def Quantity(self, data: str) -> "quantity._Quantity":
"""Returns a Pint Quantity.
"""
"""Returns a Pint Quantity."""

return self.ureg.Quantity(data)

Expand Down
3 changes: 1 addition & 2 deletions qcelemental/physical_constants/ureg.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ def build_units_registry(context):
# Add contexts

def _find_nist_unit(unit):
"""Converts pint datatypes to NIST datatypes
"""
"""Converts pint datatypes to NIST datatypes"""
for value in unit.to_tuple()[1]:
if value[1] < 1:
continue
Expand Down
12 changes: 3 additions & 9 deletions qcelemental/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@


def _handle_return(passfail: bool, label: str, message: str, return_message: bool, quiet: bool = False):
"""Function to print a '*label*...PASSED' line to log.
"""
"""Function to print a '*label*...PASSED' line to log."""

if not quiet:
if passfail:
Expand All @@ -28,8 +27,7 @@ def _handle_return(passfail: bool, label: str, message: str, return_message: boo


def tnm() -> str:
"""Returns the name of the calling function, usually name of test case.
"""
"""Returns the name of the calling function, usually name of test case."""

return sys._getframe().f_back.f_code.co_name

Expand Down Expand Up @@ -480,11 +478,7 @@ def compare_molrecs(
return_message: bool = False,
return_handler: Callable = None,
) -> bool:
"""Function to compare Molecule dictionaries. Prints
# :py:func:`util.success` when elements of `computed` match elements of
# `expected` to `tol` number of digits (for float arrays).
"""
"""Function to compare Molecule dictionaries."""
# Need to manipulate the dictionaries a bit, so hold values
xptd = copy.deepcopy(expected)
cptd = copy.deepcopy(computed)
Expand Down
64 changes: 32 additions & 32 deletions qcelemental/util/gph_uno_bipartite.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def _formDirected(g, match):
Returns
-------
networkx.DiGraph
Directed graph, with edges in `match` pointing from set-0
(bipartite attribute==0) to set-1 (bipartite attrbiute==1), and
the other edges in `g` but not in `match` pointing from set-1 to
set-0.
Directed graph, with edges in `match` pointing from set-0
(bipartite attribute==0) to set-1 (bipartite attrbiute==1), and
the other edges in `g` but not in `match` pointing from set-1 to
set-0.
"""
import networkx as nx
Expand Down Expand Up @@ -127,8 +127,8 @@ def _enumMaximumMatchingIter(g, match, all_matches, add_e=None):
match :
List of edges forming one maximum matching of `g`.
all_matches :
List, each is a list of edges forming a maximum matching of `g`.
Newly found matchings will be appended into this list.
List, each is a list of edges forming a maximum matching of `g`.
Newly found matchings will be appended into this list.
add_e : tuple, optional
Edge used to form subproblems. If not `None`, will be added to each
newly found matchings.
Expand Down Expand Up @@ -335,32 +335,32 @@ def _enumMaximumMatching2(g):

def _enumMaximumMatchingIter2(adj, matchadj, all_matches, n1, add_e=None, check_cycle=True):
"""Recurively search maximum matchings.
Similar to _enumMaximumMatching but implemented using adjacency matrix
of graph for a slight speed boost.
Parameters
----------
# g :
# Undirected bipartite graph. Nodes are separated by their
# 'bipartite' attribute.
# match :
# List of edges forming one maximum matching of `g`.
# all_matches :
# List, each is a list of edges forming a maximum matching of `g`.
# Newly found matchings will be appended into this list.
add_e : tuple, optional
Edge used to form subproblems. If not `None`, will be added to each
newly found matchings.
Returns
-------
list
Updated list of all maximum matchings.
Author
------
guangzhi XU (xugzhi1987@gmail.com; guangzhi.xu@outlook.com)
Update time: 2017-05-21 20:09:06.
Similar to _enumMaximumMatching but implemented using adjacency matrix
of graph for a slight speed boost.
Parameters
----------
# g :
# Undirected bipartite graph. Nodes are separated by their
# 'bipartite' attribute.
# match :
# List of edges forming one maximum matching of `g`.
# all_matches :
# List, each is a list of edges forming a maximum matching of `g`.
# Newly found matchings will be appended into this list.
add_e : tuple, optional
Edge used to form subproblems. If not `None`, will be added to each
newly found matchings.
Returns
-------
list
Updated list of all maximum matchings.
Author
------
guangzhi XU (xugzhi1987@gmail.com; guangzhi.xu@outlook.com)
Update time: 2017-05-21 20:09:06.
"""
import networkx as nx
Expand Down

0 comments on commit 0c1930b

Please sign in to comment.