Remove attribute-style accesses to (Geo)DataFrames columns and xarray Datasets variables and attributes by luseverin · Pull Request #939 · CLIMADA-project/climada_python

@luseverin

@luseverin

I did my best to replace all instances of attribute-style accesses with the recommended keyword-style accesses. Please let me know if you spot some instances that I missed!

What I still need to do is to update tests (as I assume this needs to be done as well).

@luseverin

chahank

import os
import sys

class DataFrameAttributeVisitor(ast.NodeVisitor):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the goal of this class?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it got mistakenly commited, I will remove it. It was a script to try to automatically find out occurences of attribute-style accesses but it was not working out well..

@luseverin

spjuhel

@spjuhel

Great job!

I looked around with different regexps based on yours:

  • There are some "exp.gdf.value" in util/lines_polys_handler.py (in docstrings mainly)
  • entity/measure/base.py:492
  • engine/unsequa/unc_output.py:1028

I did not find others (except for tests, but you said you still haven't done these yet)

@luseverin

Ok so I removed the few instances that I missed + the ones in the tests. Everything should be covered now. However I now have some tests failing with some weird errors e.g. AttributeError: module 'importlib_metadata' has no attribute 'entry_points' . I am not sure how this relates to my changes. When I did the make unit_test and make integ_test everything was passing.. Any idea where this might come from?

spjuhel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good job! You can merge as soon as we understand why the test are failing on Jenkins.

@emanuel-schmid any idea?

@emanuel-schmid

@emanuel-schmid

awesome! many thanks!

(the importlib_metadata error was most likely just about some incompatible conda package)