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

Unpin flake8 #646

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions esmvalcore/preprocessor/_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def zonal_statistics(cube, operator):
cube.data = cube.core_data().astype(np.float32, casting='same_kind')
return cube
else:
msg = (f"Zonal statistics on irregular grids not yet implemnted")
msg = ("Zonal statistics on irregular grids not yet implemnted")
raise ValueError(msg)


Expand Down Expand Up @@ -152,7 +152,7 @@ def meridional_statistics(cube, operator):
cube.data = cube.core_data().astype(np.float32, casting='same_kind')
return cube
else:
msg = (f"Meridional statistics on irregular grids not yet implemnted")
msg = ("Meridional statistics on irregular grids not yet implemented")
raise ValueError(msg)


Expand Down
3 changes: 2 additions & 1 deletion esmvalcore/preprocessor/_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def synda_search(variable):
result = subprocess.check_output(cmd, shell=True, universal_newlines=True)
logger.debug('Result:\n%s', result.strip())

files = [l.split()[-1] for l in result.split('\n') if l.startswith('new')]
files = [line.split()[-1] for line in result.split('\n')
if line.startswith('new')]
if variable.get('frequency', '') != 'fx':
files = select_files(files, variable['start_year'],
variable['end_year'])
Expand Down
14 changes: 7 additions & 7 deletions esmvalcore/preprocessor/_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def mask_landsea(cube, fx_variables, mask_out, always_use_ne_mask=False):
"Applying land-sea mask from Natural Earth"
" shapefile: \n%s", shapefiles[mask_out])
else:
msg = (f"Use of shapefiles with irregular grids not "
f"yet implemented, land-sea mask not applied.")
msg = ("Use of shapefiles with irregular grids not "
"yet implemented, land-sea mask not applied.")
raise ValueError(msg)
else:
if cube.coord('longitude').points.ndim < 2:
Expand All @@ -174,8 +174,8 @@ def mask_landsea(cube, fx_variables, mask_out, always_use_ne_mask=False):
"Applying land-sea mask from Natural Earth"
" shapefile: \n%s", shapefiles[mask_out])
else:
msg = (f"Use of shapefiles with irregular grids not "
f"yet implemented, land-sea mask not applied.")
msg = ("Use of shapefiles with irregular grids not "
"yet implemented, land-sea mask not applied.")
raise ValueError(msg)

return cube
Expand Down Expand Up @@ -331,9 +331,9 @@ def _mask_with_shp(cube, shapefilename, region_indices=None):
cube.coord(axis='Y').points)
# 2D irregular grids; spit an error for now
else:
msg = (f"No fx-files found (sftlf or sftof)!"
f"2D grids are suboptimally masked with "
f"Natural Earth masks. Exiting.")
msg = ("No fx-files found (sftlf or sftof)!"
"2D grids are suboptimally masked with "
"Natural Earth masks. Exiting.")
raise ValueError(msg)

# Wrap around longitude coordinate to match data
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
# Test dependencies
# Execute 'python setup.py test' to run tests
'test': [
'flake8<3.8.0',
'pytest>=3.9',
'pytest-cov',
'pytest-env',
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/cmor/_fixes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def create_hybrid_pressure_file_with_ap(dataset, short_name):
@pytest.fixture
def cl_file_with_a(tmp_path):
"""Create netcdf file for ``cl`` with ``a`` coordinate."""
nc_path = os.path.join(tmp_path, f'cl_a.nc')
nc_path = os.path.join(tmp_path, 'cl_a.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_pressure_file_with_a(dataset, 'cl')
dataset.close()
Expand All @@ -108,7 +108,7 @@ def cl_file_with_a(tmp_path):
@pytest.fixture
def cl_file_with_ap(tmp_path):
"""Create netcdf file for ``cl`` with ``ap`` coordinate."""
nc_path = os.path.join(tmp_path, f'cl_ap.nc')
nc_path = os.path.join(tmp_path, 'cl_ap.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_pressure_file_with_ap(dataset, 'cl')
dataset.close()
Expand All @@ -118,7 +118,7 @@ def cl_file_with_ap(tmp_path):
@pytest.fixture
def cli_file_with_a(tmp_path):
"""Create netcdf file for ``cli`` with ``a`` coordinate."""
nc_path = os.path.join(tmp_path, f'cli_a.nc')
nc_path = os.path.join(tmp_path, 'cli_a.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_pressure_file_with_a(dataset, 'cli')
dataset.close()
Expand All @@ -128,7 +128,7 @@ def cli_file_with_a(tmp_path):
@pytest.fixture
def cli_file_with_ap(tmp_path):
"""Create netcdf file for ``cli`` with ``ap`` coordinate."""
nc_path = os.path.join(tmp_path, f'cli_ap.nc')
nc_path = os.path.join(tmp_path, 'cli_ap.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_pressure_file_with_ap(dataset, 'cli')
dataset.close()
Expand All @@ -138,7 +138,7 @@ def cli_file_with_ap(tmp_path):
@pytest.fixture
def clw_file_with_a(tmp_path):
"""Create netcdf file for ``clw`` with ``a`` coordinate."""
nc_path = os.path.join(tmp_path, f'clw_a.nc')
nc_path = os.path.join(tmp_path, 'clw_a.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_pressure_file_with_a(dataset, 'clw')
dataset.close()
Expand All @@ -148,7 +148,7 @@ def clw_file_with_a(tmp_path):
@pytest.fixture
def clw_file_with_ap(tmp_path):
"""Create netcdf file for ``clw`` with ``ap`` coordinate."""
nc_path = os.path.join(tmp_path, f'clw_ap.nc')
nc_path = os.path.join(tmp_path, 'clw_ap.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_pressure_file_with_ap(dataset, 'clw')
dataset.close()
Expand Down Expand Up @@ -301,7 +301,7 @@ def create_hybrid_height_file(dataset, short_name):
@pytest.fixture
def cl_file_with_height(tmp_path):
"""Create netcdf file for ``cl`` with hybrid height coordinate."""
nc_path = os.path.join(tmp_path, f'cl_hybrid_height.nc')
nc_path = os.path.join(tmp_path, 'cl_hybrid_height.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_height_file(dataset, 'cl')
dataset.close()
Expand All @@ -311,7 +311,7 @@ def cl_file_with_height(tmp_path):
@pytest.fixture
def cli_file_with_height(tmp_path):
"""Create netcdf file for ``cli`` with hybrid height coordinate."""
nc_path = os.path.join(tmp_path, f'cli_hybrid_height.nc')
nc_path = os.path.join(tmp_path, 'cli_hybrid_height.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_height_file(dataset, 'cli')
dataset.close()
Expand All @@ -321,7 +321,7 @@ def cli_file_with_height(tmp_path):
@pytest.fixture
def clw_file_with_height(tmp_path):
"""Create netcdf file for ``clw`` with hybrid height coordinate."""
nc_path = os.path.join(tmp_path, f'clw_hybrid_height.nc')
nc_path = os.path.join(tmp_path, 'clw_hybrid_height.nc')
dataset = Dataset(nc_path, mode='w')
create_hybrid_height_file(dataset, 'clw')
dataset.close()
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/preprocessor/_derive/test_sispeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def get_cube(name, lat=((0.5, 1.5), (2.5, 3.5)), lon=((0.5, 1.5), (2.5, 3.5))):
cube.add_aux_coord(AuxCoord(lon, 'longitude', bounds=lon_bounds), (1, 2))
return cube


@mock.patch(
'esmvalcore.preprocessor._regrid.esmpy_regrid', autospec=True)
def test_sispeed_calculation(mock_regrid):
Expand All @@ -34,6 +35,7 @@ def test_sispeed_calculation(mock_regrid):
)
assert mock_regrid.call_count == 0


@mock.patch(
'esmvalcore.preprocessor._regrid.esmpy_regrid', autospec=True)
def test_sispeed_calculation_coord_differ(mock_regrid):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ def test_extract_shape_raises(tmp_path, patched_datafinder, config_user,
shapefile.parent.mkdir(parents=True, exist_ok=True)
shapefile.touch()

content = dedent(f"""
content = dedent("""
preprocessors:
test:
extract_shape:
Expand Down