Skip to content

Commit

Permalink
Remove upper version bound flask-caching (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Feb 21, 2023
1 parent 53ef4eb commit 117225b
Show file tree
Hide file tree
Showing 39 changed files with 101 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/subsurface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
pylint webviz_subsurface tests setup.py
bandit -r -c ./bandit.yml webviz_subsurface tests setup.py
isort --check-only webviz_subsurface tests setup.py
mypy --package webviz_subsurface
# mypy --package webviz_subsurface
- name: 🤖 Run tests
env:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@
"console_scripts": ["smry2arrow_batch=webviz_subsurface.smry2arrow_batch:main"],
},
install_requires=[
"flask-caching<1.11", # https://github.com/equinor/webviz-subsurface/issues/1043
"dash>=2.0.0",
"dash_bootstrap_components>=0.10.3",
"dash-daq>=0.5.0",
"defusedxml>=0.6.0",
"ecl2df>=0.15.0; sys_platform=='linux'",
"flask-caching",
"fmu-ensemble>=1.2.3",
"fmu-tools>=1.8",
"geojson>=2.5.0",
Expand Down
16 changes: 8 additions & 8 deletions webviz_subsurface/_datainput/fmu_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
pass


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def scratch_ensemble(
ensemble_name: str, ensemble_path: Path, filter_file: Union[str, None] = "OK"
) -> ScratchEnsemble:
Expand All @@ -31,7 +31,7 @@ def scratch_ensemble(
)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def load_ensemble_set(
ensemble_paths: dict,
ensemble_set_name: str = "EnsembleSet",
Expand All @@ -46,7 +46,7 @@ def load_ensemble_set(
)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def load_parameters(
ensemble_paths: dict,
Expand All @@ -56,15 +56,15 @@ def load_parameters(
return load_ensemble_set(ensemble_paths, ensemble_set_name, filter_file).parameters


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def load_csv(
ensemble_paths: dict, csv_file: str, ensemble_set_name: str = "EnsembleSet"
) -> pd.DataFrame:
return load_ensemble_set(ensemble_paths, ensemble_set_name).load_csv(csv_file)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def load_smry(
ensemble_paths: dict,
Expand All @@ -77,7 +77,7 @@ def load_smry(
)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def load_smry_meta(
ensemble_paths: dict,
Expand All @@ -95,7 +95,7 @@ def load_smry_meta(
return pd.DataFrame(smry_meta).transpose()


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def get_realizations(
ensemble_paths: dict, ensemble_set_name: str = "EnsembleSet"
Expand Down Expand Up @@ -135,7 +135,7 @@ def find_sens_type(senscase: str) -> Optional[str]:
return "scalar"


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def find_surfaces(
ensemble_paths: dict,
Expand Down
4 changes: 2 additions & 2 deletions webviz_subsurface/_datainput/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from webviz_config.common_cache import CACHE


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def load_grid(gridpath: str) -> xtgeo.Grid:
return xtgeo.grid_from_file(gridpath)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def load_grid_parameter(
grid: Optional[xtgeo.Grid], gridparameterpath: str
) -> xtgeo.GridProperty:
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_datainput/history_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .fmu_input import load_ensemble_set


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def extract_mismatch(ens_paths: dict, observation_file: Path) -> pd.DataFrame:
"""Convert the fmu-ensemble mismatch dataframe into the the format
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_datainput/inplace_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .fmu_input import scratch_ensemble


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def extract_volumes(
ensemble_paths: dict, volfolder: str, volfiles: Dict[str, str]
Expand Down
6 changes: 3 additions & 3 deletions webviz_subsurface/_datainput/pvt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from .fmu_input import load_csv, load_ensemble_set


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def filter_pvt_data_frame(
data_frame: pd.DataFrame, drop_ensemble_duplicates: bool = False
Expand Down Expand Up @@ -179,7 +179,7 @@ def calculate_density(keyword: str, ratio: float, volume_factor: float) -> float
return data_frame


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def load_pvt_csv(
ensemble_paths: dict,
Expand All @@ -192,7 +192,7 @@ def load_pvt_csv(
)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def load_pvt_dataframe(
ensemble_paths: Dict[str, str],
Expand Down
8 changes: 4 additions & 4 deletions webviz_subsurface/_datainput/seismic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
from webviz_config.common_cache import CACHE


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def load_cube_data(cube_path: str) -> xtgeo.Cube:
return xtgeo.cube_from_file(cube_path)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def get_xline(cube: xtgeo.Cube, xline: int) -> np.ndarray:
idx = np.where(cube.xlines == xline)
return cube.values[:, idx, :][:, 0, 0].T


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def get_iline(cube: xtgeo.Cube, iline: int) -> np.ndarray:
idx = np.where(cube.ilines == iline)
return cube.values[idx, :, :][0, 0, :].T


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def get_zslice(cube: xtgeo.Cube, zslice: float) -> np.ndarray:
idx = np.where(cube.zslices == zslice)
return cube.values[:, :, idx][:, :, 0, 0].T
4 changes: 2 additions & 2 deletions webviz_subsurface/_datainput/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from webviz_config.common_cache import CACHE


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def load_surface(surface_path: str) -> xtgeo.RegularSurface:
return xtgeo.surface_from_file(surface_path)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def get_surface_fence(fence: np.ndarray, surface: xtgeo.RegularSurface) -> np.ndarray:
return surface.get_fence(fence)
8 changes: 4 additions & 4 deletions webviz_subsurface/_datainput/well.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from webviz_config.common_cache import CACHE


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def load_well(
wfile: Union[str, Path],
zonelogname: Optional[str] = None,
Expand All @@ -27,7 +27,7 @@ def load_well(
return well


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def make_well_layer(
well: xtgeo.Well, name: str = "well", zmin: float = 0
) -> Dict[str, Any]:
Expand Down Expand Up @@ -66,7 +66,7 @@ def make_well_layer(
}


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def make_well_layers(
wellfiles: List[str], zmin: float = 0, max_points: float = 100
) -> Dict[str, Any]:
Expand Down Expand Up @@ -184,7 +184,7 @@ def append_well_to_data(
)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def create_leaflet_well_marker_layer(
wells: List[xtgeo.Well],
surface: xtgeo.RegularSurface,
Expand Down
10 changes: 5 additions & 5 deletions webviz_subsurface/_models/ensemble_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def ens_folder(self) -> dict:
self.ensemble_name: self.ensemble_path.split("realization", maxsplit=1)[0]
}

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def load_ensemble(self) -> ScratchEnsemble:
ensemble = (
ScratchEnsemble(self.ensemble_name, self.ensemble_path)
Expand Down Expand Up @@ -129,7 +129,7 @@ def load_csv(self, csv_file: pathlib.Path) -> pd.DataFrame:
)
return self._load_csv(csv_file=csv_file)

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def _load_parameters(self) -> pd.DataFrame:
return self.load_ensemble().parameters
Expand All @@ -140,7 +140,7 @@ def _load_parameters(self) -> pd.DataFrame:
# On the other hand, if we remove it we will save the memory, but during build of
# a portable app we will end up loading the ensemble's smry data twice. Once during
# normal init of the plugins and once when saving to the webviz store.
@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def _load_smry(
self,
Expand All @@ -151,7 +151,7 @@ def _load_smry(
time_index=time_index, column_keys=column_keys
)

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def _load_smry_meta(
self,
Expand All @@ -162,7 +162,7 @@ def _load_smry_meta(
self.load_ensemble().get_smry_meta(column_keys=column_keys)
).T

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def _load_csv(self, csv_file: pathlib.Path) -> pd.DataFrame:
return self.load_ensemble().load_csv(str(csv_file))
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_models/surface_set_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _filter_surface_table(
df = df.loc[df[col] == filt]
return df

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def calculate_statistical_surface(
self,
name: str,
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_models/well_set_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def well_names(self) -> List[str]:
"""Returns list of well names"""
return list(self._wells.keys())

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def get_fence(
self,
well_name: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,6 @@ def get_path(path) -> Path:
return Path(path)


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def read_csv(path: Path, index_col: Optional[int] = None) -> pd.DataFrame:
return pd.read_csv(path, index_col=index_col)
2 changes: 1 addition & 1 deletion webviz_subsurface/plugins/_disk_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def add_webvizstore(self) -> List[Tuple[Callable, list]]:
]


@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
@webvizstore
def get_disk_usage(scratch_dir: Path, date: Optional[str]) -> pd.DataFrame:
if date is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(
def webviz_store(self) -> Tuple[Callable, List[Dict]]:
return self._gruptree_model.webviz_store

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def create_grouptree_dataset(
self,
tree_mode: TreeModeOptions,
Expand Down Expand Up @@ -139,12 +139,12 @@ def create_grouptree_dataset(
],
)

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def get_unique_real(self) -> List[int]:
"""Returns a list of unique realizations"""
return self._provider.realizations()

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def tree_is_equivalent_in_all_real(self) -> bool:
"""Checks if the group tree is equivalent in all realizations,
in which case there is only one REAL number in the dataframe
Expand Down Expand Up @@ -216,7 +216,7 @@ def _check_that_sumvecs_exists(self, check_sumvecs: List[str]) -> None:
f"{str_missing_sumvecs}."
)

@CACHE.memoize(timeout=CACHE.TIMEOUT)
@CACHE.memoize()
def get_edge_options(self, node_types: List[NodeType]) -> List[Dict[str, str]]:
"""Returns a list with edge node options for the dropdown
menu in the GroupTree component. The output list has the format:
Expand Down
Loading

0 comments on commit 117225b

Please sign in to comment.