Skip to content

Commit

Permalink
Lazify all()
Browse files Browse the repository at this point in the history
  • Loading branch information
eumiro committed Aug 6, 2023
1 parent 72a95b0 commit ea9c398
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ def _irrad_for_celltemp(total_irrad, effective_irradiance):
"""
if isinstance(total_irrad, tuple):
if all(['poa_global' in df for df in total_irrad]):
if all('poa_global' in df for df in total_irrad):
return _tuple_from_dfs(total_irrad, 'poa_global')
else:
return effective_irradiance
Expand Down
10 changes: 4 additions & 6 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,20 +1295,18 @@ def dc_ohms_from_percent(self):
"""

# get relevent Vmp and Imp parameters from CEC parameters
if all([elem in self.module_parameters
for elem in ['V_mp_ref', 'I_mp_ref']]):
if all(elem in self.module_parameters
for elem in ['V_mp_ref', 'I_mp_ref']):
vmp_ref = self.module_parameters['V_mp_ref']
imp_ref = self.module_parameters['I_mp_ref']

# get relevant Vmp and Imp parameters from SAPM parameters
elif all([elem in self.module_parameters
for elem in ['Vmpo', 'Impo']]):
elif all(elem in self.module_parameters for elem in ['Vmpo', 'Impo']):
vmp_ref = self.module_parameters['Vmpo']
imp_ref = self.module_parameters['Impo']

# get relevant Vmp and Imp parameters if they are PVsyst-like
elif all([elem in self.module_parameters
for elem in ['Vmpp', 'Impp']]):
elif all(elem in self.module_parameters for elem in ['Vmpp', 'Impp']):
vmp_ref = self.module_parameters['Vmpp']
imp_ref = self.module_parameters['Impp']

Expand Down
4 changes: 2 additions & 2 deletions pvlib/tests/iotools/test_pvgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def test_get_pvgis_tmy_error():
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
def test_get_pvgis_map_variables(pvgis_tmy_mapped_columns):
actual, _, _, _ = get_pvgis_tmy(45, 8, map_variables=True)
assert all([c in pvgis_tmy_mapped_columns for c in actual.columns])
assert all(c in pvgis_tmy_mapped_columns for c in actual.columns)


@pytest.mark.remote_data
Expand All @@ -519,7 +519,7 @@ def test_read_pvgis_horizon_invalid_coords():
def test_read_pvgis_tmy_map_variables(pvgis_tmy_mapped_columns):
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2016.json'
actual, _, _, _ = read_pvgis_tmy(fn, map_variables=True)
assert all([c in pvgis_tmy_mapped_columns for c in actual.columns])
assert all(c in pvgis_tmy_mapped_columns for c in actual.columns)


def test_read_pvgis_tmy_json(expected, month_year_expected, inputs_expected,
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/iotools/test_srml.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_get_srml_minute():
expected_index = pd.date_range(start='2018-01-01', end='2018-01-31 23:59',
freq='1min', tz='Etc/GMT+8')
assert_index_equal(data_get.index, expected_index)
assert all([c in data_get.columns for c in data_read.columns])
assert all(c in data_get.columns for c in data_read.columns)
# Check that all indices in example file are present in remote file
assert data_read.index.isin(data_get.index).all()
assert meta['station'] == 'EU'
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2018,5 +2018,5 @@ def test_ModelChainResult___repr__(sapm_dc_snl_ac_system, location, weather):
mcres = mc.results.__repr__()
mc_attrs = dir(mc.results)
mc_attrs = [a for a in mc_attrs if not a.startswith('_')]
assert all([a in mcres for a in mc_attrs])
assert all(a in mcres for a in mc_attrs)

Check failure on line 2022 in pvlib/tests/test_modelchain.py

View workflow job for this annotation

GitHub Actions / flake8-linter

W293 blank line contains whitespace

Check failure on line 2022 in pvlib/tests/test_modelchain.py

View workflow job for this annotation

GitHub Actions / flake8-linter

W292 no newline at end of file

0 comments on commit ea9c398

Please sign in to comment.