Skip to content

Commit 4628779

Browse files
authored
Merge pull request #211 from ToFuProject/devel
Prepare 0.0.48-49
2 parents b49bd24 + 141eb3c commit 4628779

File tree

9 files changed

+419
-67
lines changed

9 files changed

+419
-67
lines changed

datastock/_class2.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,17 +629,20 @@ def connect(self):
629629
v0['handle'].parent(),
630630
)
631631
except Exception as err:
632-
error = err
632+
error = "1\n" + str(err)
633633
elif hasattr(v0['handle'], 'parent'):
634634
try:
635635
v0['handle'].manager.toolbar.__init__(
636636
v0['handle'],
637637
v0['handle'].parent(),
638638
)
639639
except Exception as err:
640-
error = True
640+
if "can't initialize an object twice" in str(err):
641+
pass
642+
else:
643+
error = "2\n" + str(err)
641644
else:
642-
error = True
645+
error = "3"
643646

644647
if error is not False:
645648
import platform
@@ -648,6 +651,7 @@ def connect(self):
648651
lstr0 = [f"\t- {k1}" for k1 in dir(v0['handle'])]
649652
lstr1 = [f"\t- {k1}" for k1 in dir(v0['handle'].manager.toolbar)]
650653
msg = (
654+
"Problem with connect()\n"
651655
f"platform: {platform.platform()}\n"
652656
f"python: {sys.version}\n"
653657
f"backend: {plt.get_backend()}\n"
@@ -657,7 +661,7 @@ def connect(self):
657661
+ "\n".join(lstr1)
658662
)
659663
if error is not True:
660-
msg += '\n' + str(err)
664+
msg += '\n' + str(error)
661665
warnings.warn(msg)
662666

663667
self._dobj['canvas'][k0]['cid'] = {
@@ -1393,4 +1397,4 @@ def on_close(self, event):
13931397

13941398
__all__ = [
13951399
sorted([k0 for k0 in locals() if k0.startswith('DataStock')])[-1]
1396-
]
1400+
]

datastock/_generic_check.py

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,6 @@ def _check_dict_valid_keys(
362362
var[k0] = None
363363
continue
364364

365-
vv = var.get(k0)
366-
367365
# routine to call
368366
if any([ss in v0.keys() for ss in lkarray]):
369367
var[k0] = _check_flat1darray(
@@ -610,7 +608,7 @@ def _check_all_broadcastable(
610608
ndim = lndim[0]
611609

612610
else:
613-
lstr = [f"-t {k0}: {v0}" for k0, v0 in dndim.items()]
611+
lstr = [f"\t- {k0}: {v0}" for k0, v0 in dndim.items()]
614612
msg = (
615613
"Some keyword args have non-compatible dimensions:\n"
616614
+ "\n".join(lstr)
@@ -675,48 +673,6 @@ def _check_all_broadcastable(
675673
# Utilities for plotting
676674
# #############################################################################
677675

678-
# DEPRECATED
679-
# def _check_inplace(coll=None, keys=None):
680-
# """ Check key to data and inplace """
681-
682-
# # -----------------------------
683-
# # keys of data to be extracted
684-
# # ----------------------------
685-
686-
# if isinstance(keys, str):
687-
# keys = [keys]
688-
# keys = _check_var_iter(
689-
# keys, 'keys',
690-
# default=None,
691-
# types=list,
692-
# types_iter=str,
693-
# allowed=list(coll.ddata.keys()),
694-
# )
695-
696-
# # ----------------------
697-
# # extract sub-collection
698-
# # ----------------------
699-
700-
# lk0 = list(keys)
701-
# for key in keys:
702-
703-
# # Include all data matching any single ref
704-
# for rr in coll._ddata[key]['ref']:
705-
# for k0, v0 in coll._ddata.items():
706-
# if v0['ref'] == (rr,):
707-
# if k0 not in lk0:
708-
# lk0.append(k0)
709-
710-
# # include all data matching all refs
711-
# for k0, v0 in coll._ddata.items():
712-
# if v0['ref'] == coll._ddata[key]['ref']:
713-
# if k0 not in lk0:
714-
# lk0.append(k0)
715-
716-
# coll2 = coll.extract(lk0)
717-
718-
# return keys, coll2
719-
720676

721677
def _check_dax(dax=None, main=None):
722678

@@ -844,7 +800,7 @@ def _check_lim(lim):
844800
if len(dfail) > 0:
845801
lstr = [f"\t- lim[{ii}]: {vv}" for ii, vv in dfail.items()]
846802
msg = (
847-
"The following non-conformities in lim have been identified:\n"*
803+
"The following non-conformities in lim have been identified:\n"
848804
+ "\n".join(lstr)
849805
)
850806
raise Exception(msg)
@@ -900,7 +856,6 @@ def _apply_lim(lim=None, data=None, logic=None):
900856
return ind
901857

902858

903-
904859
def _apply_dlim(dlim=None, logic_intervals=None, logic=None, ddata=None):
905860

906861
# ------------
@@ -960,6 +915,7 @@ def _apply_dlim(dlim=None, logic_intervals=None, logic=None, ddata=None):
960915
lstr = [f"\t- {k0}: {v0}" for k0, v0 in dfail.items()]
961916
msg = (
962917
"The following keys have non-compatible shapes:\n"
918+
+ "\n".join(lstr)
963919
)
964920
raise Exception(msg)
965921

@@ -1021,11 +977,6 @@ def _apply_dlim(dlim=None, logic_intervals=None, logic=None, ddata=None):
1021977

1022978
def _check_cmap_vminvmax(data=None, cmap=None, vmin=None, vmax=None):
1023979
# cmap
1024-
c0 = (
1025-
cmap is None
1026-
or vmin is None
1027-
or vmax is None
1028-
)
1029980
if cmap is None or vmin is None or vmax is None:
1030981
nanmax = np.nanmax(data)
1031982
nanmin = np.nanmin(data)

datastock/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Do not edit, pipeline versioning governed by git tags!
2-
__version__ = '0.0.47'
2+
__version__ = '0.0.49'

pyproject.toml

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,64 @@
1+
[project]
2+
name = "datastock"
3+
license = {file = "LICENSE"}
4+
dynamic = ["version"]
5+
description = "Generic handler for multiple heterogenous numpy arrays and subclasses"
6+
readme = "README.md"
7+
requires-python = ">=3.6"
8+
authors = [
9+
{name = "Didier VEZINET", email = "[email protected]"},
10+
]
11+
maintainers = [
12+
{name = "Didier VEZINET", email = "[email protected]"},
13+
]
14+
keywords = ["data", "analysis", "interactive", "heterogeneous arrays", "numpy", "Collection"]
15+
classifiers = [
16+
# How mature is this project? Common values are
17+
# 3 - Alpha
18+
# 4 - Beta
19+
# 5 - Production/Stable
20+
"Development Status :: 5 - Production/Stable",
21+
22+
# Indicate who your project is intended for
23+
"Intended Audience :: Science/Research",
24+
25+
# Specify the Python versions you support here.
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.6",
28+
"Programming Language :: Python :: 3.7",
29+
"Programming Language :: Python :: 3.8",
30+
"Programming Language :: Python :: 3.9",
31+
"Programming Language :: Python :: 3.10",
32+
"Programming Language :: Python :: 3.11",
33+
]
34+
dependencies = [
35+
"numpy",
36+
"scipy",
37+
"matplotlib",
38+
"astropy",
39+
]
40+
41+
142
[build-system]
2-
requires = ["setuptools>=40.8.0",
3-
"wheel",
4-
]
43+
requires = [
44+
"setuptools>=40.8.0, <64",
45+
"wheel",
46+
"Cython>=0.26",
47+
"numpy",
48+
]
49+
50+
[dependency-groups]
51+
dev = [
52+
"pytest",
53+
]
54+
55+
[project.optional-dependencies]
56+
linting = [
57+
'ruff'
58+
]
59+
formatting = [
60+
'ruff'
61+
]
62+
63+
[project.entry-points."datastock"]
64+
datastock = "scripts.main:main"

scripts/__init__.py

Whitespace-only changes.

scripts/_bash_version.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env python
2+
3+
# Built-in
4+
import os
5+
6+
7+
###################################################
8+
###################################################
9+
# DEFAULTS
10+
###################################################
11+
12+
13+
_PATH_HERE = os.path.dirname(__file__)
14+
15+
16+
###################################################
17+
###################################################
18+
# function
19+
###################################################
20+
21+
22+
def main(
23+
verb=None,
24+
envvar=None,
25+
path=None,
26+
warn=None,
27+
force=None,
28+
ddef=None,
29+
):
30+
""" Print version """
31+
32+
# --------------
33+
# Check inputs
34+
# --------------
35+
36+
kwd = locals()
37+
for k0 in set(ddef.keys()).intersection(kwd.keys()):
38+
if kwd[k0] is None:
39+
kwd[k0] = ddef[k0]
40+
verb, path = kwd['verb'], kwd['path']
41+
42+
# verb, warn, force
43+
dbool = {'verb': verb}
44+
for k0, v0 in dbool.items():
45+
if v0 is None:
46+
dbool[k0] = ddef[k0]
47+
if not isinstance(dbool[k0], bool):
48+
msg = (
49+
f"Arg '{k0}' must be a bool\n"
50+
f"\t- provided: {dbool[k0]}\n"
51+
)
52+
raise Exception(msg)
53+
54+
# --------------
55+
# Fetch version from git tags, and write to version.py
56+
# Also, when git is not available (PyPi package), use stored version.py
57+
58+
pfe = os.path.join(path, 'version.py')
59+
if not os.path.isfile(pfe):
60+
msg = (
61+
"It seems your current install has no version.py:\n"
62+
f"\t- looked for: {pfe}"
63+
)
64+
raise Exception(msg)
65+
66+
# --------------
67+
# Read file
68+
69+
with open(pfe, 'r') as fh:
70+
version = fh.read().strip().split("=")[-1].replace("'", '')
71+
version = version.lower().replace('v', '').replace(' ', '')
72+
73+
# --------------
74+
# Outputs
75+
76+
if dbool['verb'] is True:
77+
print(version)

0 commit comments

Comments
 (0)