Skip to content

Commit

Permalink
strings
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaganKing committed May 15, 2024
1 parent ec8003c commit 94e3d54
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions cupid/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def build(config_path):

# Originally used this code to copy jupyter book HTML to a location to host it online

# if 'publish_location' in control:
# if "publish_location" in control:

# user = os.environ.get('USER')
# user = os.environ.get("USER")
# remote_mach = control["publish_location"]["remote_mach"]
# remote_dir = control["publish_location"]["remote_dir"]
# this seems more complicated than expected...people have mentioned paramiko library?
Expand Down
18 changes: 9 additions & 9 deletions cupid/clear.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python
"""
This script provides functionality to clear the contents of the 'computed_notebooks' folder
at the location specified by the 'run_dir' variable in the CONFIG_PATH.
This script provides functionality to clear the contents of the "computed_notebooks" folder
at the location specified by the "run_dir" variable in the CONFIG_PATH.
The main function `clear()` takes the path to the configuration file as input, reads the config file
to obtain the 'run_dir' variable, and then deletes the contents of the 'computed_notebooks' folder
to obtain the "run_dir" variable, and then deletes the contents of the "computed_notebooks" folder
at that location.
"""
Expand All @@ -18,7 +18,7 @@
def read_config_file(config_path):
"""
Given the file path to the configuration file, this function reads the config file content and
returns the val of the run_dir string with '/computed_notebooks' appended to it
returns the val of the run_dir string with `/computed_notebooks` appended to it
Args:
CONFIG_PATH: str, path to configuration file (default config.yml)
Expand All @@ -31,26 +31,26 @@ def read_config_file(config_path):
run_dir = control["data_sources"].get("run_dir", None)

if run_dir:
# Append '/computed_notebooks' to the run_dir value if it is not empty
# Append `/computed_notebooks` to the run_dir value if it is not empty
full_path = os.path.join(run_dir, "computed_notebooks")
return full_path

# else run_dir is empty/wasn't found in config file so return error
# else run_dir is empty/was not found in config file so return error
raise ValueError("'run_dir' was empty/not found in the config file.")


@click.command()
@click.argument("config_path", default="config.yml")
# Entry point to this script
def clear(config_path):
"""Clears the contents of the 'computed_notebooks' folder at the location
specified by the 'run_dir' variable in the CONFIG_PATH.
"""Clears the contents of the "computed_notebooks" folder at the location
specified by the "run_dir" variable in the CONFIG_PATH.
Args: CONFIG_PATH - The path to the configuration file.
"""

run_dir = read_config_file(config_path)
# Delete the 'computed_notebooks' folder and all the contents inside of it
# Delete the "computed_notebooks" folder and all the contents inside of it
shutil.rmtree(run_dir)
print(f"All contents in {run_dir} have been cleared.")
2 changes: 1 addition & 1 deletion cupid/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_collection(path_to_catalog, **kwargs):
"""Get collection of datasets from intake catalog"""
cat = intake.open_esm_datastore(path_to_catalog)
### note that the json file points to the csv, so the path that the
### yaml file contains doesn't actually get used. this can cause issues
### yaml file contains does not actually get used. this can cause issues

cat_subset = cat.search(**kwargs)

Expand Down
2 changes: 1 addition & 1 deletion cupid/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def create_time_series(
# create copy of var list that can be modified for derivable variables
if diag_var_list == ["process_all"]:
print("generating time series for all variables")
# TODO: this doesn't seem to be working for ocn...
# TODO: this does not seem to be working for ocn...
diag_var_list = hist_file_var_list
for var in diag_var_list:
if var not in hist_file_var_list:
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.

extensions = [
Expand Down Expand Up @@ -85,7 +85,7 @@

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
# source_suffix = [".rst", ".md"]
source_suffix = {
".rst": "restructuredtext",
".ipynb": "myst-nb",
Expand All @@ -106,7 +106,7 @@
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = dict(
# analytics_id='' this is configured in rtfd.io
# analytics_id="" this is configured in rtfd.io
# canonical_url="",
repository_url="https://github.com/NCAR/CUPiD",
repository_branch="main",
Expand Down

0 comments on commit 94e3d54

Please sign in to comment.