Skip to content

Commit

Permalink
Remove deprecated functions from ResdataFile
Browse files Browse the repository at this point in the history
These functions have thrown NotImplementedError for a long
time so it should now be considered removing undefined
behavior in terms of semver.
  • Loading branch information
eivindjahren committed Apr 23, 2024
1 parent e1dcc55 commit 7474217
Showing 1 changed file with 1 addition and 57 deletions.
58 changes: 1 addition & 57 deletions python/resdata/resfile/rd_file.py
Expand Up @@ -24,11 +24,10 @@
import ctypes
import datetime
import re
import types

from cwrap import BaseCClass
from resdata import FileMode, FileType, ResdataPrototype
from resdata.resfile import ResdataFileView, ResdataKW
from resdata.resfile import ResdataKW
from resdata.util.util import CTime, monkey_the_camel


Expand Down Expand Up @@ -85,12 +84,6 @@ def get_filetype(filename):

return (file_type, report_step, fmt_file)

@classmethod
def restart_block(cls, filename, dtime=None, report_step=None):
raise NotImplementedError(
"The restart_block implementation has been removed - open file normally and use ResdataFileView."
)

@classmethod
def contains_report_step(cls, filename, report_step):
"""
Expand Down Expand Up @@ -258,55 +251,6 @@ def restart_view(
seqnum_index, report_step, sim_time, sim_days
)

def select_block(self, kw, kw_index):
raise NotImplementedError(
"The select_block implementation has been removed - use ResdataFileView"
)

def select_global(self):
raise NotImplementedError(
"The select_global implementation has been removed - use ResdataFileView"
)

def select_restart_section(self, index=None, report_step=None, sim_time=None):
raise NotImplementedError(
"The select_restart_section implementation has been removed - use ResdataFileView"
)
"""
Will select a restart section as the active section.
You must specify a report step with the @report_step argument,
a true time with the @sim_time argument or a plain index to
select restart block. If none of arguments are given exception
TypeError will be raised. If present the @sim_time argument
should be a datetime instance.
If the restart section you ask for can not be found the method
will raise a ValueError exeception. To protect against this
you can query first with the has_report_step(),
has_sim_time() or num_report_steps() methods.
This method should be used when you have already loaded the
complete file; if you only want to load a section from the
file you can use the classmethod restart_block().
The method will return 'self' which can be used to aid
readability.
"""

def select_last_restart(self):
raise NotImplementedError(
"The select_restart_section implementation has been removed - use ResdataFileView"
)
"""
Will select the last SEQNUM block in restart file.
Works by searching for the last SEQNUM keyword; the SEQNUM
Keywords are only present in unified restart files. If this
is a non-unified restart file (or not a restart file at all),
the method will do nothing and return False.
"""

def __getitem__(self, index):
"""
Implements [] operator; index can be integer or key.
Expand Down

0 comments on commit 7474217

Please sign in to comment.