Giter Site home page Giter Site logo

Comments (2)

ntfrgl avatar ntfrgl commented on August 25, 2024

Thank you for this cleanup!

Most of these issues have accumulated over the past few years, during which testing and linting were apparently not used in development even locally. An exception is utils.navigator, which I had excluded from the cleanup before the initial public release. The configuration update in 911fb11 unfortunately missed moving the ignore pattern from pytest-flake8 to flake8, but I have now removed it entirely in aa56ad1.

Regarding your questions:

  1. Note that the default threshold is 5, and I had originally raised it to 12, which was a compromise between refactoring effort and linting benefit. Further raising this value to 16 would effectively switch off the warning. I would rather suggest grouping related arguments into dictionaries, e.g., in this case by the parent classes they are passed to.

  2. This sort of encoding choice is contextual. In principle, you could have an explicit return None or some other representation of failure along the exception-handling branch, but note that the underlying cause for the linter warning here is that the exception is not being re-raised. In this specific case I agree with the SO answer you linked, to the extent that it argues against internally "wrapping" the exception with print statements --- The print statement in the catch clause is currently not only failing to add any useful information beyond what would already be contained in the exception, but by successfully returning an invalid object (None) it requires explicit downstream failure detection.

  3. All of these class inheritance issues arise from a lack of precision in the abstractions encoded by the classes.

    • I agree with your suggestions about the cases 1-3, with the addition of checks ensuring that the "optional" argument filename_grid is present and that the argument (lat_grid,lon_grid) ~ space_grid, which should be treated uniformly across all relevant classes, has the correct shape.
    • For the cases 4-6, I would similarly make the newly added argument(s) optional, but asserting their presence in the method body, and realigning the treatment of dimension_names in ClimateData.Load() with that in Data.Load().

Please also make sure to update the tests and tutorials accordingly.

from pyunicorn.

fkuehlein avatar fkuehlein commented on August 25, 2024

Thank you for the advice and for updating the flake8 configuration!

I'll take care of those remaining fixes as soon as possible, hopefully later this week.

from pyunicorn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.