Uploaded image for project: 'Atlas'
  1. Atlas
  2. ATLAS-4658

base_client.py implementation is a bit messy

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1.0
    • 3.0.0, 2.4.0
    • atlas-intg
    • None

    Description

      atlas_client/client/base_client.py looks a bit messy:

      https://github.com/apache/atlas/blob/c1daaa44c3833be31c006753a2cf2f6f2e476cdc/intg/src/main/python/apache_atlas/client/base_client.py#L79-L120

      1. There is no need to make conditions with mapping between HTTPMethod enum values and corresponding requests.Session methods - there is a requests.Session.request method which accepts HTTP method as argument
      2. There is no need to use elif in conditions if previous clauses are ended with return or raise statements
      3. There is not need to use logger.isEnabledFor(logging.DEBUG) before calling logger.debug, this is already done in .debug method itself
      4. Use logging, not print
      5. {{logging.exception}} already shows full exception traceback, no need to explicitly show add it into a logging message

       

      I've creates pull request with a fix for all these items:

      https://github.com/apache/atlas/pull/158/files

      Attachments

        Activity

          People

            dolfinus Maxim Martynov
            dolfinus Maxim Martynov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h