Skip to content
Merged
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
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# As of now, flake8 does not natively support configuration via pyproject.toml
# https://github.com/microsoft/vscode-flake8/issues/135
[flake8]
exclude =
.git,
__pycache__,
build,
dist,
docs/source/conf.py
max-line-length = 79
# Ignore some style 'errors' produced while formatting by 'black'
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
extend-ignore = E203
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ setup.cfg
/DistancePrinter/gitarchive.cfg

# test output
actual.res
actual.res
5 changes: 5 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[settings]
# Keep import statement below line_length character limit
line_length = 79
multi_line_output = 3
include_trailing_comma = True
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
default_language_version:
python: python3
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit hooks
autofix_prs: true
autoupdate_branch: "pre-commit-autoupdate"
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: monthly
skip: [no-commit-to-branch]
submodules: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: no-commit-to-branch
name: Prevent Commit to Main Branch
args: ["--branch", "main"]
stages: [pre-commit]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
# prettier - multi formatter for .json, .yml, and .md files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
hooks:
- id: prettier
additional_dependencies:
- "prettier@^3.2.4"
# docformatter - PEP 257 compliant docstring formatter
- repo: https://github.com/s-weigand/docformatter
rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--in-place, --config, ./pyproject.toml]
2 changes: 1 addition & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Xiaohao Yang
Xiaohao Yang
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
recursive-include DistancePrinter *
prune doc
exclude MANIFEST.in
exclude MANIFEST.in
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ To install the DistancePrinter package:

python setup.py install

By default the files are installed in the system directories, which are
usually only writeable by the root. See the usage info "./setup.py install
--help" for options to install as a normal user under a different location.
Note that installation to non-standard directories you may require adjustments
By default the files are installed in the system directories, which are
usually only writeable by the root. See the usage info "./setup.py install
--help" for options to install as a normal user under a different location.
Note that installation to non-standard directories you may require adjustments
to the PATH and PYTHONPATH environment variables.

CONTACTS
Expand Down
4 changes: 1 addition & 3 deletions src/diffpy/distanceprinter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#
##############################################################################

"""
Blank namespace package.
"""
"""Blank namespace package."""

__import__("pkg_resources").declare_namespace(__name__)

Expand Down
5 changes: 2 additions & 3 deletions src/diffpy/distanceprinter/distanceprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
##############################################################################

import sys

import numpy as np

from diffpy.pdffit2 import PdfFit
Expand Down Expand Up @@ -70,9 +71,7 @@ def calDistance(strufile, atomi, atomj, lb, ub, complete):


def formatResults(stru, distlist, complete, all0ddij, **kw):
"""
format the distlist to string
"""
"""Format the distlist to string."""
lines = []
# header
lines.append("# Structure file: %s" % kw["strufile"])
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/distanceprinter/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

"""Definition of __version__, __date__, __gitsha__."""

from pkg_resources import resource_filename
from ConfigParser import RawConfigParser
from pkg_resources import resource_filename

# obtain version information from the version.cfg file
cp = RawConfigParser(dict(version="", date="", commit="", timestamp=0))
Expand Down
6 changes: 3 additions & 3 deletions tests/outputs/expected.res
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Structure file: /home/zthatcher/GitLab/dev/dpx.distanceprinter/tests/test_files/Ni-9008476.cif
#
#
# lattice=Lattice(a=3.52387, b=3.52387, c=3.52387, alpha=90, beta=90, gamma=90)
# 0 Ni 0.000000 0.000000 0.000000 1.0000
# 1 Ni 0.000000 0.500000 0.500000 1.0000
# 2 Ni 0.500000 0.000000 0.500000 1.0000
# 3 Ni 0.500000 0.500000 0.000000 1.0000
#
#
# Inter-atomic distance of (all, all) in (1.00, 10.00) A

Ni.0-Ni.1: 2.491752
Expand Down Expand Up @@ -1527,4 +1527,4 @@ Ni.3-Ni.3: 9.967009
Ni.3-Ni.3: 9.967009
Ni.3-Ni.3: 9.967009
Ni.3-Ni.3: 9.967009
Ni.3-Ni.3: 9.967009
Ni.3-Ni.3: 9.967009