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 327 of file Node.py.

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

◆ 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 317 of file Node.py.

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

◆ 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 359 of file Node.py.

359def topnode(flags) :
360 """ Escape hatch in case the user needs to access a node
361 from the top node that has the Same Name, as a node
362 on the local node"""
363 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 344 of file Node.py.

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

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.