<s> """<STR_LIT>""" <EOL> from __future__ import unicode_literals <EOL> from __future__ import print_function <EOL> from builtins import str <EOL> import uuid <EOL> import os <EOL> import sys <EOL> import shutil <EOL> import six <EOL> from synapseclient import Entity , Project , Folder , File , Evaluation <EOL> import synapseclient <EOL> import synapseclient . utils as utils <EOL> def setup_module ( module ) : <EOL> print ( "<STR_LIT>" , sys . version ) <EOL> syn = synapseclient . Synapse ( debug = True , skip_checks = True ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT:U+0020>" + syn . repoEndpoint ) <EOL> print ( "<STR_LIT:U+0020>" + syn . authEndpoint ) <EOL> print ( "<STR_LIT:U+0020>" + syn . fileHandleEndpoint ) <EOL> print ( "<STR_LIT:U+0020>" + syn . portalEndpoint + "<STR_LIT:\n>" ) <EOL> syn . login ( ) <EOL> module . syn = syn <EOL> module . _to_cleanup = [ ] <EOL> project = syn . store ( Project ( name = str ( uuid . uuid4 ( ) ) ) ) <EOL> schedule_for_cleanup ( project ) <EOL> module . project = project <EOL> def teardown_module ( module ) : <EOL> cleanup ( module . _to_cleanup ) <EOL> def schedule_for_cleanup ( item ) : <EOL> """<STR_LIT>""" <EOL> globals ( ) [ '<STR_LIT>' ] . append ( item ) <EOL> def cleanup ( items ) : <EOL> """<STR_LIT>""" <EOL> for item in reversed ( items ) : <EOL> if isinstance ( item , Entity ) or utils . is_synapse_id ( item ) or hasattr ( item , '<STR_LIT>' ) : <EOL> try : <EOL> syn . delete ( item ) <EOL> except Exception as ex : <EOL> if hasattr ( ex , '<STR_LIT>' ) and ex . response . status_code in [ <NUM_LIT> , <NUM_LIT> ] : <EOL> pass <EOL> else : <EOL> print ( "<STR_LIT>" + str ( ex ) ) <EOL> elif isinstance ( item , six . string_types ) : <EOL> if os . path . exists ( item ) : <EOL> try : <EOL> if os . path . isdir ( item ) : <EOL> shutil . rmtree ( item ) <EOL> else : <EOL> os . remove ( item ) <EOL> except Exception as ex : <EOL> print ( ex ) <EOL> else : <EOL> sys . stderr . write ( '<STR_LIT>' % str ( item ) ) </s>
