Skip to content

Commit 912e92e

Browse files
committed
202
1 parent 44306e8 commit 912e92e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pip install ycleptic
1818
Once installed, the developer has access to the ``Yclept`` class.
1919

2020
## Release History
21-
* 2.0.2
21+
* 2.0.3
2222
* refactored to change `directive` to `attribute` throughout
2323
* 1.9.0
2424
* new `update_user` method

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["hatchling"]
33
build-backend = "hatchling.build"
44
[project]
55
name = "ycleptic"
6-
version = "2.0.2"
6+
version = "2.0.3"
77
authors = [
88
{ name="Cameron F Abrams", email="cfa22@drexel.edu" },
99
]

ycleptic/dictthings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Author: Cameron F. Abrams <cfa22@drexel.edu>
22

33
"""
4-
Utilities for modifying dictionary entries in the directive tree
4+
Utilities for modifying dictionary entries in the Attribute tree
55
"""
66

77
import logging

ycleptic/walkers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def dwalk(D: dict, I: dict):
9393
The user's config dictionary to be processed.
9494
"""
9595
if not 'attributes' in D:
96-
raise ValueError(f'Directive {D["name"]} has no attributes; cannot walk through it.')
96+
raise ValueError(f'Attribute {D["name"]} has no attributes; cannot walk through it.')
9797
# get the name of each config attribute at this level in this block
9898
tld = [x['name'] for x in D['attributes']]
9999
if I == None:
@@ -102,7 +102,7 @@ def dwalk(D: dict, I: dict):
102102
ud = list(I.keys())
103103
for u in ud:
104104
if not u in tld:
105-
raise_clean(ValueError(f'Directive \'{u}\' invalid; expecting one of {tld} under \'{D["name"]}\'.'))
105+
raise_clean(ValueError(f'Attribute \'{u}\' invalid; expecting one of {tld} under \'{D["name"]}\'.'))
106106
# logger.debug(f'dwalk along {tld} for {I}')
107107
# for each attribute name
108108
for d in tld:
@@ -114,7 +114,7 @@ def dwalk(D: dict, I: dict):
114114
# get its type
115115
typ = dx['type']
116116
if typ == 'dict' and (d in I and not type(I[d]) == dict):
117-
raise_clean(ValueError(f'Directive \'{d}\' of \'{D["name"]}\' must be a dict; found {type(I[d])}.'))
117+
raise_clean(ValueError(f'Attribute \'{d}\' of \'{D["name"]}\' must be a dict; found {type(I[d])}.'))
118118
# logger.debug(f' - {d} typ {typ} I {I[d]}
119119
# logger.debug(f'- {d} typ {typ} I {I}')
120120
# if this attribute name does not already have a key in the result
@@ -129,7 +129,7 @@ def dwalk(D: dict, I: dict):
129129
# if it is flagged as required, die since it is not in the read-in
130130
elif 'required' in dx:
131131
if dx['required']:
132-
raise_clean(ValueError(f'Directive \'{d}\' of \'{D["name"]}\' requires a value.'))
132+
raise_clean(ValueError(f'Attribute \'{d}\' of \'{D["name"]}\' requires a value.'))
133133
# if it is a dict
134134
elif typ == 'dict':
135135
# if it is explicitly tagged as not required, do nothing
@@ -159,11 +159,11 @@ def dwalk(D: dict, I: dict):
159159
if not case_sensitive:
160160
# just check the choices that were provided by the user
161161
if not I[d].casefold() in [x.casefold() for x in dx['choices']]:
162-
raise_clean(ValueError(f'Directive \'{d}\' of \'{dx["name"]}\' must be one of {", ".join(dx["choices"])} (case-insensitive); found \'{I[d]}\''))
162+
raise_clean(ValueError(f'Attribute \'{d}\' of \'{dx["name"]}\' must be one of {", ".join(dx["choices"])} (case-insensitive); found \'{I[d]}\''))
163163
else:
164164
# check the choices that were provided by the user
165165
if not I[d] in dx['choices']:
166-
raise_clean(ValueError(f'Directive \'{d}\' of \'{dx["name"]}\' must be one of {", ".join(dx["choices"])}; found \'{I[d]}\''))
166+
raise_clean(ValueError(f'Attribute \'{d}\' of \'{dx["name"]}\' must be one of {", ".join(dx["choices"])}; found \'{I[d]}\''))
167167
elif typ == 'dict':
168168
# process descendants
169169
if 'attributes' in dx:
@@ -179,7 +179,7 @@ def dwalk(D: dict, I: dict):
179179
I[d] = defaults + I[d]
180180
elif typ == 'tuple':
181181
if 'attributes' in dx:
182-
raise_clean(TypeError(f'Directive \'{d}\' of \'{D["name"]}\' cannot have subattributes.'))
182+
raise_clean(TypeError(f'Attribute \'{d}\' of \'{D["name"]}\' cannot have subattributes.'))
183183
I[d] = dx.get('default', ())
184184

185185
def lwalk(D: dict, L: list[dict]):

0 commit comments

Comments
 (0)