a_frame/utils/action_providers/GitAction.py
def format_results(results):
        """
        detects string format (xml || json) and formats appropriately

        :param results: string from urlopen
        :return: formatted string output
        """
        # use pretty_print if we have an xml document returned
        if results.startswith("<?xml"):
            print "Found XML results - using pretty_print"
            print results
            xml = etree.fromstring(results)
            return etree.tostring(xml, pretty_print=True)

        # is the result valid json?
        try:
            json_string = json.loads(results)
            print "Found JSON results"
            return json.dumps(json_string, indent=4)
        except ValueError:
            # this isn't xml or json, so just return it!
            print "Unknown results!"
            return results

        detects string format (xml || json) and formats appropriately

        :param results: string from urlopen
        :return: formatted string output
        
detects string format (xml || json) and formats appropriately
detects string format ( xml || json ) and formats appropriately
def format_results(results):
        if results.startswith("<?xml"):
            print "Found XML results - using pretty_print"
            print results
            xml = etree.fromstring(results)
            return etree.tostring(xml, pretty_print=True)
        try:
            json_string = json.loads(results)
            print "Found JSON results"
            return json.dumps(json_string, indent=4)
        except ValueError:
            print "Unknown results!"
            return results
def format_results ( results ) : if results . startswith ( "<?xml" ) : print "Found XML results - using pretty_print" print results xml = etree . fromstring ( results ) return etree . tostring ( xml , pretty_print = True ) try : json_string = json . loads ( results ) print "Found JSON results" return json . dumps ( json_string , indent = 4 ) except ValueError : print "Unknown results!" return results
detects string format (xml || json) and formats appropriately
detects string format ( xml || json ) and formats appropriately
"""
        detects string format (xml || json) and formats appropriately

        :param results: string from urlopen
        :return: formatted string output
        """ # use pretty_print if we have an xml document returned # is the result valid json? # this isn't xml or json, so just return it!
formatted string output
formatted string output
results
string from urlopen
string from urlopen