Skip to content

Commit

Permalink
Auto-corrections for
Browse files Browse the repository at this point in the history
  - Trailing witespace
  - No neline at end of file
  - Some Ruff linting
  • Loading branch information
ukmo-ccbunney committed Nov 15, 2024
1 parent 0a10cab commit 7fc50ed
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$
ref-names: $Format:%D$
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Submitting changes

1. Push your branch to your fork of cf-units.
1. Submit your pull request.
1. Note that all authors on pull requests will automatically be asked to sign the
1. Note that all authors on pull requests will automatically be asked to sign the
[SciTools Contributor Licence Agreement](https://cla-assistant.io/SciTools/)
(CLA), if they have not already done so.
(CLA), if they have not already done so.
1. Chillax!

If in doubt, please post in the
[cf-units Discussions space](https://github.com/SciTools/cf-units/discussions)
[cf-units Discussions space](https://github.com/SciTools/cf-units/discussions)
and we'll be happy to help you.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ assignees: ''
## How to Reproduce
Steps to reproduce the behaviour:

1.
2.
3.
1.
2.
3.

## Expected Behaviour
<!-- A clear and concise description of what you expected to happen -->

## Environment
## Environment
- OS & Version: [e.g., Ubuntu 20.04 LTS]
- cf-units Version: [e.g., From the command line run `python -c "import cf_units; print(cf_units.__version__)"`]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- name: "Building sdist"
shell: bash
run: |
pipx run build --sdist
pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ recursive-include requirements *
recursive-include docs *
prune docs/build

exclude cf_units/etc/site.cfg
exclude cf_units/etc/site.cfg
1 change: 0 additions & 1 deletion cf_units/_udunits2.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,3 @@ cdef extern from "udunits2.h":
double* cv_convert_doubles(cv_converter* converter, double* const in_, size_t count, double* out)

void cv_free(cv_converter* conv)

Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.11.1
4.11.1
2 changes: 1 addition & 1 deletion cf_units/_udunits2_parser/udunits2Lexer.g4.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ SHIFT_OP:
UNICODE_EXPONENT:
// One or more ISO-8859-9 encoded exponent characters
('⁻' | '⁺' | '¹' | '²' | '³' | '⁴' | '⁵' | '⁶' | '⁷' | '⁸' | '⁹' | '⁰')+
;
;

RAISE :
( '^'
Expand Down
2 changes: 1 addition & 1 deletion cf_units/_udunits2_parser/udunits2Parser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ power:
basic_spec:
ID
| '(' shift_spec ')'
// Log not yet implemented, but it is supported in UDUNITS2.
// Log not yet implemented, but it is supported in UDUNITS2.
// | LOGREF product_spec ')'
| number
;
Expand Down
4 changes: 1 addition & 3 deletions cf_units/tests/integration/test__Unit_num2date.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,7 @@ def test_fractional_second_360_day(self):

def test_pydatetime_wrong_calendar(self):
unit = cf_units.Unit("days since 1970-01-01", calendar="360_day")
with pytest.raises(
ValueError, match="illegal calendar or reference date"
):
with pytest.raises(ValueError, match="illegal calendar or reference date"):
unit.num2date(
1,
only_use_cftime_datetimes=False,
Expand Down
4 changes: 1 addition & 3 deletions cf_units/tests/integration/test_num2date.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

class Test:
def test_num2date_wrong_calendar(self):
with pytest.raises(
ValueError, match="illegal calendar or reference date"
):
with pytest.raises(ValueError, match="illegal calendar or reference date"):
num2date(
1,
"days since 1970-01-01",
Expand Down
4 changes: 1 addition & 3 deletions cf_units/tests/integration/test_num2pydate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ def test_num2pydate_simple(self):
assert isinstance(result, datetime.datetime)

def test_num2pydate_wrong_calendar(self):
with pytest.raises(
ValueError, match="illegal calendar or reference date"
):
with pytest.raises(ValueError, match="illegal calendar or reference date"):
num2pydate(1, "days since 1970-01-01", calendar="360_day")
16 changes: 4 additions & 12 deletions cf_units/tests/unit/unit/test_Unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ class Test_convert__result_ctype:

def setup_method(self):
self.initial_dtype = np.float32
self.degs_array = np.array(
[356.7, 356.8, 356.9], dtype=self.initial_dtype
)
self.degs_array = np.array([356.7, 356.8, 356.9], dtype=self.initial_dtype)
self.deg = cf_units.Unit("degrees")
self.rad = cf_units.Unit("radians")

Expand Down Expand Up @@ -254,25 +252,19 @@ def setup_method(self):
)

def test_no_type_conversion(self):
result = self.deg.convert(
self.degs_array, self.rad, ctype=cf_units.FLOAT32
)
result = self.deg.convert(self.degs_array, self.rad, ctype=cf_units.FLOAT32)
np.testing.assert_array_almost_equal(self.rads_array, result)

def test_type_conversion(self):
result = self.deg.convert(
self.degs_array, self.rad, ctype=cf_units.FLOAT64
)
result = self.deg.convert(self.degs_array, self.rad, ctype=cf_units.FLOAT64)
np.testing.assert_array_almost_equal(self.rads_array, result)


class Test_is_long_time_interval:
@staticmethod
def test_deprecated():
unit = Unit("seconds since epoch")
with pytest.warns(
DeprecationWarning, match="This method is no longer needed"
):
with pytest.warns(DeprecationWarning, match="This method is no longer needed"):
_ = unit.is_long_time_interval()

def test_short_time_interval(self):
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ coverage:
status:
project:
default:
target: auto
target: auto
threshold: 0.5% # coverage can drop by up to <threshold>% while still posting success
patch: off

0 comments on commit 7fc50ed

Please sign in to comment.