ATLAS Offline Software
Loading...
Searching...
No Matches
python.Node Namespace Reference

Classes

class  Node

Functions

 notDefined (flags, name)
 decode_flags (flags, domain=None)
 update_flags (flags, node, domain="")
 topnode (flags)

Variables

int _UNLOCKED = 0
int _LOCKED = 1
int _LOCKED_FOREVER = 2

Function Documentation

◆ decode_flags()

decode_flags ( flags,
domain = None )
 take an egregious  flags list and convert to a lovely tree
    or, if it is a lovely tree already, just  hand it back 

Definition at line 326 of file Node.py.

326def decode_flags( flags, domain=None ) :
327 """ take an egregious flags list and convert to a lovely tree
328 or, if it is a lovely tree already, just hand it back
329 """
330
331 if isinstance( flags, Node ) : return flags
332
333 root = Node("root")
334
335 for tag, value in flags._flagdict.items():
336 root.addFlag( tag, value, flags )
337
338 return root
339
340
341
342

◆ notDefined()

notDefined ( flags,
name )
 check whether the flags have an actual item with this name
    NB using hasFlag(name) is really dengerous, as that seems to 
       actually evaluate any actual functions ? shouldn't 
       something like that be called testFlag() ? 

Definition at line 316 of file Node.py.

316def notDefined(flags, name):
317 """ check whether the flags have an actual item with this name
318 NB using hasFlag(name) is really dengerous, as that seems to
319 actually evaluate any actual functions ? shouldn't
320 something like that be called testFlag() ?
321 """
322 return name not in flags._flagdict
323
324
325

◆ topnode()

topnode ( flags)
Escape hatch in case the user needs to access a node 
   from the top node that has the Same Name, as a node 
   on the local node

Definition at line 358 of file Node.py.

358def topnode(flags) :
359 """ Escape hatch in case the user needs to access a node
360 from the top node that has the Same Name, as a node
361 on the local node"""
362 return flags._rootnode()

◆ update_flags()

update_flags ( flags,
node,
domain = "" )
take a lovely tree and convert to an egregious flags list, 
   only adding items that are not in the original flags list 

Definition at line 343 of file Node.py.

343def update_flags( flags, node, domain="" ) :
344 """ take a lovely tree and convert to an egregious flags list,
345 only adding items that are not in the original flags list """
346
347 for key, value in node.__dict__.items():
348 if key in {"_name","_children","_lockstate", "_flags", "_root" } : continue
349 name = f"{domain}.{key}"
350 if notDefined(flags,name) : flags.addFlag( name, value )
351
352 for n in node.nodes() :
353 if domain=="" : update_flags( flags, n, f"{n.name()}" )
354 else: update_flags( flags, n, f"{domain}.{n.name()}" )
355
356
357

Variable Documentation

◆ _LOCKED

int python.Node._LOCKED = 1
protected

Definition at line 49 of file Node.py.

◆ _LOCKED_FOREVER

int python.Node._LOCKED_FOREVER = 2
protected

Definition at line 50 of file Node.py.

◆ _UNLOCKED

int python.Node._UNLOCKED = 0
protected

Definition at line 48 of file Node.py.