Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-199

Clean up schemas in testio.py

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • python
    • None

    Description

      As discussed on the mailing list, it would be nice to leverage Python's expressive string syntax to not perform lots of escaping of Avro schemas defined in code and make the schemas more readable.

      This patch cleans up schemas in testio.py to make them more readable. Note that to get this to pass the tests, I had to implement a new "remove_whitespace()" helper function to replace the current naive approach to replacing whitespace (s.replace(" ", "") is not going to cut it). I also object to the round-trip string conversion test, as noted in the comments to this patch, but I'll save that change for another patch to better separate concerns.

      If this code change is deemed useful, I'll convert the rest of the schemas in the Python code to leverage Python's string formatting. I have a ridiculously naive tool that I used for schema conversion that I threw up at http://github.com/hammer/avro-tools/blob/master/pprint_avsc for those interested.

      Attachments

        1. AVRO-199.patch
          7 kB
          Jeff Hammerbacher
        2. AVRO-199.patch
          7 kB
          Jeff Hammerbacher
        3. AVRO-199.patch
          7 kB
          Jeff Hammerbacher

        Activity

          People

            hammer Jeff Hammerbacher
            hammer Jeff Hammerbacher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: