Commit 434133fc authored by Daniel Boeckenhoff's avatar Daniel Boeckenhoff
Browse files

nothing much

parent ad2b38a2
...@@ -11,21 +11,26 @@ Publishing: ...@@ -11,21 +11,26 @@ Publishing:
""" """
from setuptools import setup, find_packages from setuptools import setup, find_packages
execfile('...tfields/__about__.py') exec(open("./tfields/__about__.py").read())
setup( setup(
name='tfields', name=__title__,
version=__version__, version=__version__,
description='numpy + sympy implementation of tensor fields with attached coordinate systems', description=__summary__,
author=__author__, author=__author__,
author_email=__email__, author_email=__email__,
license=__license__, license=__license__,
keywords=__keywords__,
packages=find_packages(), packages=find_packages(),
url=__uri__,
project_urls={
'Documentation': __uri__,
'Source': __uri__,
},
test_require=[ test_require=[
'doctest', 'doctest',
'unittest' 'unittest'
], ],
url='https://gitlab.mpcdf.mpg.de/dboe/tfields',
install_requires=[ install_requires=[
'numpy', 'numpy',
'sympy', 'sympy',
...@@ -62,12 +67,6 @@ setup( ...@@ -62,12 +67,6 @@ setup(
'Programming Language :: Python :: 3.6' 'Programming Language :: Python :: 3.6'
], ],
python_requires='>=2.7', python_requires='>=2.7',
keywords="tensors coordinate system trafo sympy numpy",
project_urls={
'Documentation': 'https://gitlab.mpcdf.mpg.de/dboe/tfields/',
'Source': 'https://gitlab.mpcdf.mpg.de/dboe/tfields/',
# 'Tracker': 'https://github.com/pypa/sampleproject/issues',
}
) )
......
__version__ = '0.1.0.dev8' __all__ = [
"__version__",
"__title__",
"__summary__",
"__keywords__",
"__uri__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]
__version__ = '0.1.0.dev9'
__title__ = 'tfields'
__summary__ = "numpy + sympy implementation of tensor fields with attached coordinate systems"
__keywords__ = "tensors coordinate system trafo sympy numpy"
__uri__ = 'https://gitlab.mpcdf.mpg.de/dboe/tfields'
__author__ = "Daniel Boeckenhoff" __author__ = "Daniel Boeckenhoff"
__email__ = "daniel.boeckenhoff@ipp.mpg.de" __email__ = "daniel.boeckenhoff@ipp.mpg.de"
__license__ = "Apache License, Version 2.0" __license__ = "Apache License, Version 2.0"
......
...@@ -208,8 +208,11 @@ class AbstractNdarray(np.ndarray): ...@@ -208,8 +208,11 @@ class AbstractNdarray(np.ndarray):
... remaining:forwarded to extension specific method ... remaining:forwarded to extension specific method
""" """
# get the extension # get the extension
if isinstance(path, string_types): if isinstance(path, (string_types, pathlib.Path)):
extension = pathlib.Path(path).suffix.lstrip('.') extension = pathlib.Path(path).suffix.lstrip('.')
else:
raise ValueError("Wrong path type {0}".format(type(path)))
path = str(path)
# get the save method # get the save method
try: try:
...@@ -219,8 +222,7 @@ class AbstractNdarray(np.ndarray): ...@@ -219,8 +222,7 @@ class AbstractNdarray(np.ndarray):
raise NotImplementedError("Can not find save method for extension: " raise NotImplementedError("Can not find save method for extension: "
"{extension}.".format(**locals())) "{extension}.".format(**locals()))
# resolve: relative paths, symlinks and ~ path = tfields.lib.in_out.resolve(path)
path = os.path.realpath(os.path.abspath(os.path.expanduser(path)))
return save_method(path, **kwargs) return save_method(path, **kwargs)
@classmethod @classmethod
...@@ -235,10 +237,12 @@ class AbstractNdarray(np.ndarray): ...@@ -235,10 +237,12 @@ class AbstractNdarray(np.ndarray):
extension (str): only needed if path is buffer extension (str): only needed if path is buffer
... remaining:forwarded to extension specific method ... remaining:forwarded to extension specific method
""" """
extension = kwargs.pop('extension', 'npz') if isinstance(path, (string_types, pathlib.Path)):
if isinstance(path, string_types):
path = os.path.realpath(os.path.abspath(os.path.expanduser(path)))
extension = pathlib.Path(path).suffix.lstrip('.') extension = pathlib.Path(path).suffix.lstrip('.')
path = str(path)
path = tfields.lib.in_out.resolve(path)
else:
extension = kwargs.pop('extension', 'npz')
try: try:
load_method = getattr(cls, '_load_{e}'.format(e=extension)) load_method = getattr(cls, '_load_{e}'.format(e=extension))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment