MCPcopy Index your code
hub / github.com/STIXProject/python-stix / attr_name

Function attr_name

stix/utils/__init__.py:182–204  ·  view source on GitHub ↗

Converts `name` into the form expected for python-stix and python-cybox properties. This is used when attempting to access the property getter/setter via the __dict__ instance var entries. Example: >>> attr_name("id") 'id_' >>> attr_name("Title") 'ti

(name)

Source from the content-addressed store, hash-verified

180
181
182def attr_name(name):
183 """Converts `name` into the form expected for python-stix and
184 python-cybox properties.
185
186 This is used when attempting to access the property getter/setter via
187 the __dict__ instance var entries.
188
189 Example:
190 >>> attr_name("id")
191 'id_'
192 >>> attr_name("Title")
193 'title
194
195 """
196 name = name.lower()
197
198 if name.startswith("_"):
199 name = name[1:]
200
201 if name in CONFLICTING_NAMES:
202 name += "_"
203
204 return name
205
206
207def key_name(name):

Callers 3

key_nameFunction · 0.85
iter_varsFunction · 0.85
yield_and_descendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected