Skip to content

Commit b8ad09b

Browse files
committed
delete unused functions and fix style
1 parent 4e53c48 commit b8ad09b

File tree

13 files changed

+55
-122
lines changed

13 files changed

+55
-122
lines changed

.azure-pipelines/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
- script: |
3636
pytest -vs -n auto --cov pydra --cov-config .coveragerc --cov-report xml:cov.xml --doctest-modules pydra
3737
displayName: 'Pytest tests'
38-
38+

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Like this:
2424
```
2525
<code>
2626
```
27-
-->
27+
-->

.github/ISSUE_TEMPLATE/question.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Include the following:
1212
------------------------
1313
What are you trying to accomplish?
1414
What have you tried?
15-
-->
15+
-->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
- [ ] All tests passing
1313
- [ ] I have added tests to cover my changes
1414
- [ ] I have updated documentation (if necessary)
15-
- [ ] My code follows the code style of this project
16-
(we are using `black`: you can `pip install pre-commit`,
17-
run `pre-commit install` in the `pydra` directory
15+
- [ ] My code follows the code style of this project
16+
(we are using `black`: you can `pip install pre-commit`,
17+
run `pre-commit install` in the `pydra` directory
1818
and `black` will be run automatically with each commit)
1919

2020
## Acknowledgment
21-
- [ ] I acknowledge that this contribution will be available under the Apache 2 license.
21+
- [ ] I acknowledge that this contribution will be available under the Apache 2 license.

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ matrix:
5757
allow_failures:
5858
- python: 3.7
5959
env: INSTALL_DEPENDS="pip==10.0.1 setuptools==30.3.0"
60-
- os: windows
6160

6261

6362
before_install:

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include versioneer.py
22
include pydra/_version.py
3-
include pydra/schema/context.jsonld
3+
include pydra/schema/context.jsonld

docs/conf.py

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@
1313
import sys
1414
from pathlib import Path
1515
from packaging.version import Version
16+
1617
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
17-
sys.path.insert(1, str(Path(__file__).parent / 'sphinxext'))
18+
sys.path.insert(1, str(Path(__file__).parent / "sphinxext"))
1819
from pydra import __version__
1920
from github_link import make_linkcode_resolve
2021

2122

2223
# -- Project information -----------------------------------------------------
2324

24-
project = 'Pydra: A simple dataflow engine with scalable semantics'
25-
copyright = '2019 - 2020, The Nipype Developers team'
26-
author = 'The Nipype Developers team'
25+
project = "Pydra: A simple dataflow engine with scalable semantics"
26+
copyright = "2019 - 2020, The Nipype Developers team"
27+
author = "The Nipype Developers team"
2728

2829
# The full version, including alpha/beta/rc tags
2930
release = __version__
@@ -36,75 +37,66 @@
3637
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3738
# ones.
3839
extensions = [
39-
'sphinx.ext.autodoc',
40-
'sphinx.ext.doctest',
41-
'sphinx.ext.intersphinx',
42-
'sphinx.ext.coverage',
43-
'sphinx.ext.mathjax',
44-
'sphinx.ext.ifconfig',
45-
'sphinx.ext.linkcode',
46-
'sphinx.ext.githubpages',
47-
'sphinxcontrib.apidoc',
48-
'sphinxcontrib.napoleon'
40+
"sphinx.ext.autodoc",
41+
"sphinx.ext.doctest",
42+
"sphinx.ext.intersphinx",
43+
"sphinx.ext.coverage",
44+
"sphinx.ext.mathjax",
45+
"sphinx.ext.ifconfig",
46+
"sphinx.ext.linkcode",
47+
"sphinx.ext.githubpages",
48+
"sphinxcontrib.apidoc",
49+
"sphinxcontrib.napoleon",
4950
]
5051

5152
# Add any paths that contain templates here, relative to this directory.
52-
templates_path = ['_templates']
53+
templates_path = ["_templates"]
5354

5455
# List of patterns, relative to source directory, that match files and
5556
# directories to ignore when looking for source files.
5657
# This pattern also affects html_static_path and html_extra_path.
57-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'api/pydra.rst']
58+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "api/pydra.rst"]
5859

5960

6061
# -- Options for HTML output -------------------------------------------------
6162

6263
# The theme to use for HTML and HTML Help pages. See the documentation for
6364
# a list of builtin themes.
6465
#
65-
html_theme = 'sphinx_rtd_theme'
66+
html_theme = "sphinx_rtd_theme"
6667

6768
# Add any paths that contain custom static files (such as style sheets) here,
6869
# relative to this directory. They are copied after the builtin static files,
6970
# so a file named "default.css" will overwrite the builtin "default.css".
70-
html_static_path = ['_static']
71+
html_static_path = ["_static"]
7172

7273
# -- Options for extensions ---------------------------------------------------
7374

7475
# Autodoc
75-
autodoc_mock_imports = [
76-
'cloudpickle',
77-
'matplotlib',
78-
'numpy',
79-
'psutil',
80-
]
81-
apidoc_module_dir = '../pydra'
82-
apidoc_output_dir = 'api'
83-
apidoc_excluded_paths = ['conftest.py', '*/tests/*', 'tests/*', 'data/*']
76+
autodoc_mock_imports = ["cloudpickle", "matplotlib", "numpy", "psutil"]
77+
apidoc_module_dir = "../pydra"
78+
apidoc_output_dir = "api"
79+
apidoc_excluded_paths = ["conftest.py", "*/tests/*", "tests/*", "data/*"]
8480
apidoc_separate_modules = True
85-
apidoc_extra_args = ['--module-first', '-d 1', '-T']
81+
apidoc_extra_args = ["--module-first", "-d 1", "-T"]
8682

8783
# Napoleon
8884
# Accept custom section names to be parsed for numpy-style docstrings
8985
# of parameters.
9086
# Requires pinning sphinxcontrib-napoleon to a specific commit while
9187
# https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
9288
napoleon_use_param = False
93-
napoleon_custom_sections = [
94-
('Inputs', 'Parameters'),
95-
('Outputs', 'Parameters'),
96-
]
89+
napoleon_custom_sections = [("Inputs", "Parameters"), ("Outputs", "Parameters")]
9790

9891
# Intersphinx
99-
intersphinx_mapping = {
100-
'https://docs.python.org/': None,
101-
}
92+
intersphinx_mapping = {"https://docs.python.org/": None}
10293

10394
# Linkcode
10495
# The following is used by sphinx.ext.linkcode to provide links to github
10596
linkcode_resolve = make_linkcode_resolve(
106-
'pydra', 'https://github.com/nipype/pydra/blob/{revision}/'
107-
'{package}/{path}#L{lineno}')
97+
"pydra",
98+
"https://github.com/nipype/pydra/blob/{revision}/" "{package}/{path}#L{lineno}",
99+
)
108100

109101
# Sphinx-versioning
110102
scv_show_banner = True

docs/sphinxext/github_link.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
import sys
1010
from functools import partial
1111

12-
REVISION_CMD = 'git rev-parse --short HEAD'
12+
REVISION_CMD = "git rev-parse --short HEAD"
1313

1414

1515
def _get_git_revision():
1616
try:
1717
revision = subprocess.check_output(REVISION_CMD.split()).strip()
1818
except (subprocess.CalledProcessError, OSError):
19-
print('Failed to execute git to get revision')
19+
print("Failed to execute git to get revision")
2020
return None
21-
return revision.decode('utf-8')
21+
return revision.decode("utf-8")
2222

2323

2424
def _linkcode_resolve(domain, info, package, url_fmt, revision):
@@ -38,18 +38,18 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
3838

3939
if revision is None:
4040
return
41-
if domain not in ('py', 'pyx'):
41+
if domain not in ("py", "pyx"):
4242
return
43-
if not info.get('module') or not info.get('fullname'):
43+
if not info.get("module") or not info.get("fullname"):
4444
return
4545

46-
class_name = info['fullname'].split('.')[0]
46+
class_name = info["fullname"].split(".")[0]
4747
if type(class_name) != str:
4848
# Python 2 only
49-
class_name = class_name.encode('utf-8')
50-
module = __import__(info['module'], fromlist=[class_name])
49+
class_name = class_name.encode("utf-8")
50+
module = __import__(info["module"], fromlist=[class_name])
5151
try:
52-
obj = attrgetter(info['fullname'])(module)
52+
obj = attrgetter(info["fullname"])(module)
5353
except AttributeError:
5454
return
5555

@@ -65,14 +65,12 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
6565
if not fn:
6666
return
6767

68-
fn = os.path.relpath(fn,
69-
start=os.path.dirname(__import__(package).__file__))
68+
fn = os.path.relpath(fn, start=os.path.dirname(__import__(package).__file__))
7069
try:
7170
lineno = inspect.getsourcelines(obj)[1]
7271
except Exception:
73-
lineno = ''
74-
return url_fmt.format(revision=revision, package=package,
75-
path=fn, lineno=lineno)
72+
lineno = ""
73+
return url_fmt.format(revision=revision, package=package, path=fn, lineno=lineno)
7674

7775

7876
def make_linkcode_resolve(package, url_fmt):
@@ -87,5 +85,6 @@ def make_linkcode_resolve(package, url_fmt):
8785
'{path}#L{lineno}')
8886
"""
8987
revision = _get_git_revision()
90-
return partial(_linkcode_resolve, revision=revision, package=package,
91-
url_fmt=url_fmt)
88+
return partial(
89+
_linkcode_resolve, revision=revision, package=package, url_fmt=url_fmt
90+
)

pydra/engine/helpers_file.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -66,49 +66,6 @@ def split_filename(fname):
6666
return pth, fname, ext
6767

6868

69-
def fname_presuffix(fname, prefix="", suffix="", newpath=None, use_ext=True):
70-
"""
71-
Manipulate path and name of input filename.
72-
73-
Parameters
74-
----------
75-
fname : :obj:`str`
76-
A filename (may or may not include path)
77-
prefix : :obj:`str`
78-
Characters to prepend to the filename
79-
suffix : :obj:`str`
80-
Characters to append to the filename
81-
newpath : :obj:`str`
82-
Path to replace the path of the input fname
83-
use_ext : :obj:`bool`
84-
If True (default), appends the extension of the original file
85-
to the output name.
86-
87-
Return
88-
------
89-
path : :obj:`str`
90-
Absolute path of the modified filename
91-
92-
Examples
93-
--------
94-
>>> import pytest, sys
95-
>>> if sys.platform.startswith('win'): pytest.skip()
96-
>>> from pydra.engine.helpers_file import fname_presuffix
97-
>>> fname = 'foo.nii.gz'
98-
>>> fname_presuffix(fname,'pre','post','/tmp')
99-
'/tmp/prefoopost.nii.gz'
100-
101-
"""
102-
pth, fname, ext = split_filename(fname)
103-
if not use_ext:
104-
ext = ""
105-
106-
# No need for isdefined: bool(Undefined) evaluates to False
107-
if newpath:
108-
pth = op.abspath(newpath)
109-
return str(Path(pth) / (prefix + fname + suffix + ext))
110-
111-
11269
def hash_file(afile, chunk_len=8192, crypto=sha256, raise_notfound=True):
11370
"""Compute hash of a file using 'crypto' module."""
11471
from .specs import LazyField

pydra/engine/tests/test_helpers_file.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import os, sys
1+
import os
22
import time
33
import warnings
44
import pytest
55
from pathlib import Path
66

77
from ..helpers_file import (
88
split_filename,
9-
fname_presuffix,
109
copyfile,
1110
copyfiles,
1211
on_cifs,
@@ -38,18 +37,6 @@ def test_split_filename(filename, split):
3837
assert res == split
3938

4039

41-
@pytest.mark.skipif(sys.platform.startswith("win"), reason="windows drive not known in advance",)
42-
def test_fname_presuffix():
43-
fname = "foo.nii"
44-
pth = fname_presuffix(fname, "pre_", "_post", "/tmp")
45-
assert pth == str(Path("/tmp/pre_foo_post.nii"))
46-
fname += ".gz"
47-
pth = fname_presuffix(fname, "pre_", "_post", "/tmp")
48-
assert pth == str(Path("/tmp/pre_foo_post.nii.gz"))
49-
pth = fname_presuffix(fname, "pre_", "_post", "/tmp", use_ext=False)
50-
assert pth == str(Path("/tmp/pre_foo_post"))
51-
52-
5340
@pytest.fixture()
5441
def _temp_analyze_files(tmpdir):
5542
"""Generate temporary analyze file pair."""

0 commit comments

Comments
 (0)