From 8468013da1e26dcc31912dc0571a9d4c1bc08f86 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Thu, 6 May 2021 14:46:26 +0200 Subject: [PATCH 1/2] Remove references to basestring --- esmvalcore/cmor/_fixes/fix.py | 8 ++++---- esmvalcore/cmor/check.py | 16 ++++++++-------- esmvalcore/cmor/table.py | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/esmvalcore/cmor/_fixes/fix.py b/esmvalcore/cmor/_fixes/fix.py index ba4175813b..4595c3914f 100644 --- a/esmvalcore/cmor/_fixes/fix.py +++ b/esmvalcore/cmor/_fixes/fix.py @@ -15,7 +15,7 @@ def __init__(self, vardef): Parameters ---------- - vardef: basestring + vardef: str CMOR table entry """ @@ -31,14 +31,14 @@ def fix_file(self, filepath, output_dir): Parameters ---------- - filepath: basestring + filepath: str file to fix - output_dir: basestring + output_dir: str path to the folder to store the fixe files, if required Returns ------- - basestring + str Path to the corrected file. It can be different from the original filepath if a fix has been applied, but if not it should be the original filepath diff --git a/esmvalcore/cmor/check.py b/esmvalcore/cmor/check.py index 9fcbb5a62b..2eedaa184e 100644 --- a/esmvalcore/cmor/check.py +++ b/esmvalcore/cmor/check.py @@ -981,13 +981,13 @@ def cmor_check_metadata(cube, ---------- cube: iris.cube.Cube Data cube to check. - cmor_table: basestring + cmor_table: str CMOR definitions to use. mip: Variable's mip. short_name: basestring Variable's short name. - frequency: basestring + frequency: str Data frequency. check_level: CheckLevels Level of strictness of the checks. @@ -1015,13 +1015,13 @@ def cmor_check_data(cube, ---------- cube: iris.cube.Cube Data cube to check. - cmor_table: basestring + cmor_table: str CMOR definitions to use. mip: Variable's mip. - short_name: basestring + short_name:strg Variable's short name - frequency: basestring + frequency: str Data frequency check_level: CheckLevels Level of strictness of the checks. @@ -1045,13 +1045,13 @@ def cmor_check(cube, cmor_table, mip, short_name, frequency, check_level): ---------- cube: iris.cube.Cube Data cube to check. - cmor_table: basestring + cmor_table: str CMOR definitions to use. mip: Variable's mip. - short_name: basestring + short_name:strg Variable's short name. - frequency: basestring + frequency: str Data frequency. check_level: enum.IntEnum Level of strictness of the checks. diff --git a/esmvalcore/cmor/table.py b/esmvalcore/cmor/table.py index 508ba47a8a..23647e9812 100644 --- a/esmvalcore/cmor/table.py +++ b/esmvalcore/cmor/table.py @@ -128,7 +128,7 @@ def get_table(self, table): Parameters ---------- - table: basestring + table: str Table name Returns @@ -144,9 +144,9 @@ def get_variable(self, table_name, short_name, derived=False): Parameters ---------- - table_name: basestring + table_name: str Table name - short_name: basestring + short_name:strg Variable's short name derived: bool, optional Variable is derived. Info retrieval for derived variables always @@ -227,7 +227,7 @@ class CMIP6Info(InfoBase): Parameters ---------- - cmor_tables_path: basestring + cmor_tables_path: str Path to the folder containing the Tables folder with the json files default: object @@ -367,7 +367,7 @@ def get_table(self, table): Parameters ---------- - table: basestring + table: str Table name Returns @@ -618,7 +618,7 @@ class CMIP5Info(InfoBase): ---------- cmor_tables_path: basestring Path to the folder containing the Tables folder with the json files - +str default: object Default table to look variables on if not found @@ -761,7 +761,7 @@ def get_table(self, table): Table name Returns - ------- + -------str TableInfo Return the TableInfo object for the requested table if found, returns None if not @@ -778,7 +778,7 @@ class CMIP3Info(CMIP5Info): Path to the folder containing the Tables folder with the json files default: object - Default table to look variables on if not found + Default table strriables on if not found strict: bool If False, will look for a variable in other tables if it can not be @@ -815,7 +815,7 @@ class CustomInfo(CMIP5Info): Full path to the table or name for the table if it is present in ESMValTool repository """ - def __init__(self, cmor_tables_path=None): + def __init__(self,stres_path=None): cwd = os.path.dirname(os.path.realpath(__file__)) self._cmor_folder = os.path.join(cwd, 'tables', 'custom') self.tables = {} @@ -852,9 +852,9 @@ def get_variable(self, table, short_name, derived=False): Table name short_name: basestring Variable's short name - derived: bool, optional + derivedstrtional Variable is derived. Info retrieval for derived variables always - look on the default tables if variable is not find in the + look on strt tables if variable is not find in the requested table Returns From a10a5d2c20a47befb9a9f3e9a7c9d1ce4f28e355 Mon Sep 17 00:00:00 2001 From: Javier Vegas-Regidor Date: Thu, 6 May 2021 14:54:49 +0200 Subject: [PATCH 2/2] Fix autoreplace errors --- esmvalcore/cmor/check.py | 6 +++--- esmvalcore/cmor/table.py | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/esmvalcore/cmor/check.py b/esmvalcore/cmor/check.py index 2eedaa184e..48a5113d35 100644 --- a/esmvalcore/cmor/check.py +++ b/esmvalcore/cmor/check.py @@ -985,7 +985,7 @@ def cmor_check_metadata(cube, CMOR definitions to use. mip: Variable's mip. - short_name: basestring + short_name: str Variable's short name. frequency: str Data frequency. @@ -1019,7 +1019,7 @@ def cmor_check_data(cube, CMOR definitions to use. mip: Variable's mip. - short_name:strg + short_name: str Variable's short name frequency: str Data frequency @@ -1049,7 +1049,7 @@ def cmor_check(cube, cmor_table, mip, short_name, frequency, check_level): CMOR definitions to use. mip: Variable's mip. - short_name:strg + short_name: str Variable's short name. frequency: str Data frequency. diff --git a/esmvalcore/cmor/table.py b/esmvalcore/cmor/table.py index 23647e9812..4c5bd2e1ff 100644 --- a/esmvalcore/cmor/table.py +++ b/esmvalcore/cmor/table.py @@ -146,7 +146,7 @@ def get_variable(self, table_name, short_name, derived=False): ---------- table_name: str Table name - short_name:strg + short_name: str Variable's short name derived: bool, optional Variable is derived. Info retrieval for derived variables always @@ -616,9 +616,9 @@ class CMIP5Info(InfoBase): Parameters ---------- - cmor_tables_path: basestring + cmor_tables_path: str Path to the folder containing the Tables folder with the json files -str + default: object Default table to look variables on if not found @@ -757,11 +757,11 @@ def get_table(self, table): Parameters ---------- - table: basestring + table: str Table name Returns - -------str + ------- TableInfo Return the TableInfo object for the requested table if found, returns None if not @@ -774,11 +774,11 @@ class CMIP3Info(CMIP5Info): Parameters ---------- - cmor_tables_path: basestring + cmor_tables_path: str Path to the folder containing the Tables folder with the json files default: object - Default table strriables on if not found + Default table to look variables on if not found strict: bool If False, will look for a variable in other tables if it can not be @@ -811,11 +811,11 @@ class CustomInfo(CMIP5Info): Parameters ---------- - cmor_tables_path: basestring or None + cmor_tables_path: str or None Full path to the table or name for the table if it is present in ESMValTool repository """ - def __init__(self,stres_path=None): + def __init__(self, cmor_tables_path=None): cwd = os.path.dirname(os.path.realpath(__file__)) self._cmor_folder = os.path.join(cwd, 'tables', 'custom') self.tables = {} @@ -848,13 +848,13 @@ def get_variable(self, table, short_name, derived=False): Parameters ---------- - table: basestring + table: str Table name - short_name: basestring + short_name: str Variable's short name - derivedstrtional + derived: bool, optional Variable is derived. Info retrieval for derived variables always - look on strt tables if variable is not find in the + look on the default tables if variable is not find in the requested table Returns