<s> '<STR_LIT>' <EOL> from ncclient . xml_ import * <EOL> from ncclient . operations . errors import OperationError , MissingCapabilityError <EOL> def one_of ( * args ) : <EOL> "<STR_LIT>" <EOL> for i , arg in enumerate ( args ) : <EOL> if arg is not None : <EOL> for argh in args [ i + <NUM_LIT:1> : ] : <EOL> if argh is not None : <EOL> raise OperationError ( "<STR_LIT>" ) <EOL> else : <EOL> return <EOL> raise OperationError ( "<STR_LIT>" ) <EOL> def datastore_or_url ( wha , loc , capcheck = None ) : <EOL> node = new_ele ( wha ) <EOL> if "<STR_LIT>" in loc : <EOL> if capcheck is not None : <EOL> capcheck ( "<STR_LIT>" ) <EOL> sub_ele ( node , "<STR_LIT:url>" ) . text = loc <EOL> else : <EOL> sub_ele ( node , loc ) <EOL> return node <EOL> def build_filter ( spec , capcheck = None ) : <EOL> type = None <EOL> if isinstance ( spec , tuple ) : <EOL> type , criteria = spec <EOL> rep = new_ele ( "<STR_LIT>" , type = type ) <EOL> if type == "<STR_LIT>" : <EOL> rep . attrib [ "<STR_LIT>" ] = criteria <EOL> elif type == "<STR_LIT>" : <EOL> rep . append ( to_ele ( criteria ) ) <EOL> else : <EOL> raise OperationError ( "<STR_LIT>" ) <EOL> else : <EOL> rep = validated_element ( spec , ( "<STR_LIT>" , qualify ( "<STR_LIT>" ) ) ) <EOL> if type == "<STR_LIT>" and capcheck is not None : <EOL> capcheck ( "<STR_LIT>" ) <EOL> return rep </s>
