Skip to content

Commit d9cb8e6

Browse files
committed
Fix cf contexts
1 parent 44c64c7 commit d9cb8e6

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

doc/uses.cf.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ It has two intents:
2525
The module offers capabilities for the user to extend and specialize
2626
default behaviors for user's special datasets.
2727

28-
:mod:`xoa` makes available **ready-to-use configurations** for decoding and encoding a few **standard dataset types**.
28+
:mod:`xoa` provides **ready-to-use configurations** for decoding and encoding a few **standard dataset types**.
2929
Look at :ref:`appendix.cf.specialized`.
3030

3131

@@ -37,10 +37,10 @@ Look at :ref:`appendix.cf.specialized`.
3737
- The current module is also designed for data variables an dimensions, not only
3838
coordinates.
3939
- It searches for items not only using standard_names but also
40-
specialized names. It means that **it works even of datasets are not well formatted**.
40+
specialized names. It means that **it works even with datasets that are not well formatted**.
4141
- It is not only available as accessors, but also as independant
42-
objects that can be configured for each type of dataset or in
43-
contexts by the user.
42+
specification objects that can be configured by the user
43+
for each type of dataset.
4444

4545

4646

xoa/cf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3435,7 +3435,7 @@ def __enter__(self):
34353435

34363436
def __exit__(self, exc_type, exc_value, traceback):
34373437
if self.old_specs is None:
3438-
del self.cf_cache["current"]
3438+
self.cf_cache["current"] = None
34393439
else:
34403440
self.cf_cache["current"] = self.old_specs
34413441

@@ -3457,7 +3457,7 @@ def reset_cache(disk=True, memory=False):
34573457
os.remove(USER_CF_CACHE_FILE)
34583458

34593459
if memory:
3460-
cf_cache = _get_cfgm_()
3460+
cf_cache = _get_cache_()
34613461
cf_cache["loaded_dicts"].clear()
34623462
cf_cache["current"] = None
34633463
cf_cache["default"] = None
@@ -3650,7 +3650,7 @@ def get_cf_specs(name=None, cache="rw"):
36503650
# Not named => current or default specs
36513651
if name == "current":
36523652
cf_cache = _get_cache_()
3653-
if cf_cache["current"] is None:
3653+
if cf_cache.get("current") is None:
36543654
cf_cache["current"] = get_default_cf_specs()
36553655
cfspecs = cf_cache["current"]
36563656
else:
@@ -3839,7 +3839,7 @@ def infer_cf_specs(ds, named=False, from_attrs=True, from_score=False):
38393839
if best_score != -1:
38403840
return best_cfspecs
38413841

3842-
# Fallback to default specs
3842+
# Fallback to current specs
38433843
cfspecs = get_cf_specs("current")
38443844
if named and not cfspecs.name:
38453845
return

0 commit comments

Comments
 (0)