Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced NotImplementedError with NotImplemented #5544

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

fazledyn-or
Copy link
Contributor

This PR is made against #5521

🚀 Pull Request

Description

  • This PR replaces the usage of NotImplementedError with NotImplemented

More Info

In file: coords.py, class: CellMethod, there is a special method add that raises a NotImplementedError. If a special method supporting a binary operation is not implemented it should return NotImplemented. On the other hand, NotImplementedError should be raised from abstract methods inside user defined base classes to indicate that derived classes should override those methods. iCR suggested that the special method add should return NotImplemented instead of raising an exception.

An example of how NotImplemented helps the interpreter support a binary operation is here.


CLA Requirements

This section is only relevant if your project requires contributors to sign a Contributor License Agreement (CLA) for external contributions.

All contributed commits are already automatically signed off.

The meaning of a signoff depends on the project, but it typically certifies that committer has the rights to submit this work under the same license and agrees to a Developer Certificate of Origin (see https://developercertificate.org/ for more information).
- Git Commit SignOff documentation

Sponsorship and Support

This work is done by the security researchers from OpenRefactory and is supported by the Open Source Security Foundation (OpenSSF): Project Alpha-Omega. Alpha-Omega is a project partnering with open source software project maintainers to systematically find new, as-yet-undiscovered vulnerabilities in open source code - and get them fixed – to improve global software supply chain security.

The bug is found by running the Intelligent Code Repair (iCR) tool by OpenRefactory and then manually triaging the results.


Consult Iris pull request check list

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (0b569cd) 89.41% compared to head (e998948) 89.41%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5544   +/-   ##
=======================================
  Coverage   89.41%   89.41%           
=======================================
  Files          89       89           
  Lines       22539    22539           
  Branches     5387     5387           
=======================================
  Hits        20154    20154           
  Misses       1639     1639           
  Partials      746      746           
Files Coverage Δ
lib/iris/coords.py 93.24% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@trexfeathers trexfeathers left a comment

Choose a reason for hiding this comment

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

Thanks for your diligence, @fazledyn-or!

Copy link
Contributor

@trexfeathers trexfeathers left a comment

Choose a reason for hiding this comment

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

Almost forgot: please could you add a contribution to latest.rst? We love to celebrate contributions from the community.

💼 Internal
===========
#. `@trexfeathers`_ and `@ESadek-MO`_ (reviewer) performed a suite of fixes and
improvements for benchmarking, primarily to get
:ref:`on demand pull request benchmarking <on_demand_pr_benchmark>`
working properly. (Main pull request: :pull:`5437`, more detail:
:pull:`5430`, :pull:`5431`, :pull:`5432`, :pull:`5434`, :pull:`5436`)
#. `@trexfeathers`_ set a number of memory benchmarks to be on-demand, as they
were vulnerable to false positives in CI runs. (:pull:`5481`)
#. `@acchamber`_ and `@ESadek-MO`_ resolved several deprecation to reduce
number of warnings raised during tests.
(:pull:`5493`, :pull:`5511`)
#. `@trexfeathers`_ replaced all uses of the ``logging.WARNING`` level, in
favour of using Python warnings, following team agreement. (:pull:`5488`)
#. `@trexfeathers`_ adapted benchmarking to work with ASV ``>=v0.6`` by no
longer using the ``--strict`` argument. (:pull:`5496`)

@fazledyn-or
Copy link
Contributor Author

Sorry for the force push. I had committed some unwanted changes. Please look at the latest commit and suggest.

Thanks

@trexfeathers
Copy link
Contributor

Ooops, that failure is because we need your name in this section to get the link to work:

.. comment
Whatsnew author names (@github name) in alphabetical order. Note that,
core dev names are automatically included by the common_links.inc:
.. _@scottrobinson02: https://github.com/scottrobinson02
.. _@acchamber: https://github.com/acchamber

@trexfeathers trexfeathers merged commit 447a892 into SciTools:main Oct 17, 2023
17 checks passed
tkknight added a commit to tkknight/iris that referenced this pull request Oct 26, 2023
* upstream/main:
  moved latest warning banner logic to conf.py (SciTools#5508)
  updated layout of top navbar (SciTools#5505)
  Oblique and Rotated Mercator (SciTools#5548)
  [pre-commit.ci] pre-commit autoupdate (SciTools#5549)
  [pre-commit.ci] pre-commit autoupdate (SciTools#5527)
  Bump scitools/workflows from 2023.09.1 to 2023.10.0 (SciTools#5540)
  nep29 drop table schedule numpy>1.21 (SciTools#5525)
  Updated environment lockfiles (SciTools#5545)
  Replaced `NotImplementedError` with `NotImplemented` (SciTools#5544)
  Gallery: show colour bar stealing space from multiple axes (SciTools#5537)
  Updated environment lockfiles (SciTools#5524)
  Set some memory benchmarks to on-demand to reduce noise. (SciTools#5481)
  updating docs and stale comment (SciTools#5522)
  Ensure removal of release candidate from What's New title. (SciTools#5526)
  Updated environment lockfiles (SciTools#5513)
  Docs page on filtering warnings (SciTools#5509)
  Replaced pkg_resources version parser with packager version parser. (SciTools#5511)
  Categorise warnings (SciTools#5498)
  Updated all np.product calls to np.prod (SciTools#5493)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants