Skip to content

Commit 0dbbd94

Browse files
committed
qa
1 parent 83770f6 commit 0dbbd94

10 files changed

+55
-320
lines changed

.github/workflows/check-and-publish.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,33 @@ on:
1111
types: [created]
1212

1313
jobs:
14+
quality:
15+
name: Code QA
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- run: pip install black flake8 isort
20+
- run: black --version
21+
- run: isort --check --profile=black .
22+
- run: black --check .
23+
- run: flake8 .
24+
1425
checks:
1526
strategy:
1627
fail-fast: false
1728
matrix:
1829
platform: [windows-latest, ubuntu-latest, macos-latest]
1930
python-version: ["3.6", "3.7", "3.8", "3.9"]
2031
method: ["conda", "ecmwflibs"]
21-
exclude:
22-
- platform: windows-latest
23-
method: conda
24-
- platform: macos-latest
25-
method: conda
32+
# exclude:
33+
# - platform: windows-latest
34+
# method: conda
35+
# - platform: macos-latest
36+
# method: conda
2637

2738
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} (${{ matrix.method }})
2839
runs-on: ${{ matrix.platform }}
40+
needs: quality
2941

3042
steps:
3143
- uses: actions/checkout@v2

Magics/Magics.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010
import ctypes
1111
import ctypes.util
1212
import json
13-
import os
1413
import sys
1514

1615
import numpy as np
1716
from numpy.ctypeslib import ndpointer
1817

19-
20-
2118
try:
2219
import ecmwflibs as findlibs
2320
except ImportError:
@@ -37,7 +34,7 @@ class FILE(ctypes.Structure):
3734

3835
FILE_p = ctypes.POINTER(FILE)
3936

40-
######################## String conversions ##########################
37+
####################################################################
4138

4239

4340
def _string_to_char(x):
@@ -77,14 +74,18 @@ def wrapped(*args):
7774
return wrapped
7875

7976

77+
def _noop(x):
78+
return x
79+
80+
8081
if sys.version_info[0] > 2:
8182
convert_strings = _convert_strings
8283
char_to_string = _char_to_string
8384
string_to_char = _string_to_char
8485
else:
85-
convert_strings = lambda x: x
86-
char_to_string = lambda x: x
87-
string_to_char = lambda x: x
86+
convert_strings = _noop
87+
char_to_string = _noop
88+
string_to_char = _noop
8889

8990

9091
####################################################################
@@ -473,9 +474,9 @@ def eps():
473474

474475

475476
####################################################################
476-
###
477-
### Please note: these two functions changed compared to the previous SWIG based Python interface
478-
###
477+
#
478+
# Please note: these two functions changed compared to the previous SWIG based Python interface
479+
#
479480

480481
py_metgraph = dll.py_metgraph
481482
py_metgraph.restype = c_char_p
@@ -496,9 +497,9 @@ def epsinput():
496497

497498

498499
####################################################################
499-
###
500-
### Please note: this function was called mmetbufr to the previous SWIG based Python interface
501-
###
500+
#
501+
# Please note: this function was called mmetbufr to the previous SWIG based Python interface
502+
#
502503

503504
py_metbufr = dll.py_metbufr
504505
py_metbufr.restype = c_char_p
@@ -733,9 +734,7 @@ def set1r(name, data):
733734

734735
@checked_return_code
735736
def set1c(name, data):
736-
new_data = []
737-
for s in data:
738-
new_data.append(string_to_char(s))
737+
new_data = [string_to_char(s) for s in data]
739738
name = string_to_char(name)
740739
data_p = (c_char_p * (len(new_data)))(*new_data)
741740
return py_set1c(ctypes.c_char_p(name), data_p, len(new_data))

Magics/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import absolute_import
22

3-
from .Magics import *
3+
from .Magics import * # noqa
44

55
__version__ = "1.5.6"

Magics/binary.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def text(self):
9797
r = self.readDouble()
9898
g = self.readDouble()
9999
b = self.readDouble()
100-
s = self.readDouble()
100+
s = self.readDouble() # noqa
101101
m = self.readInt()
102102
texts.append(self.readString(m))
103103

@@ -240,7 +240,7 @@ def circle(self):
240240
x = self.projectX(self.readDouble())
241241
y = self.projectX(self.readDouble())
242242
r = self.readDouble()
243-
cs = self.readInt()
243+
cs = self.readInt() # noqa
244244
return
245245
self.ax.add_patch(
246246
Circle(

0 commit comments

Comments
 (0)