Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmcalpine committed Nov 17, 2023
1 parent d00561c commit cc0b02b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 19 deletions.
9 changes: 7 additions & 2 deletions src/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,15 @@
action="store_true",
)
arg_register_dataset.add_argument(
"--schema", default=f"{SCHEMA_VERSION}", help="Which schema to connect to",
"--schema",
default=f"{SCHEMA_VERSION}",
help="Which schema to connect to",
)
arg_register_dataset.add_argument(
"--locale", help="Location where dataset was produced", type=str, default="NERSC",
"--locale",
help="Location where dataset was produced",
type=str,
default="NERSC",
)
arg_register_dataset.add_argument(
"--owner", help="Owner of dataset. Defaults to $USER."
Expand Down
2 changes: 1 addition & 1 deletion src/cli/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def register_dataset(args):
execution_start=args.execution_start,
execution_locale=args.execution_locale,
execution_configuration=args.execution_configuration,
input_datasets=args.input_datasets
input_datasets=args.input_datasets,
)

print(f"Created dataset entry with id {new_id}")
9 changes: 5 additions & 4 deletions src/dataregistry/DataRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ def __init__(
True for more output.
"""
# Establish connection to database
self.db_connection = DbConnection(
config_file, schema=schema, verbose=verbose
)
self.db_connection = DbConnection(config_file, schema=schema, verbose=verbose)

# Create query object
self.Query = Query(self.db_connection)

# Create registrar object
self.Registrar = Registrar(
self.db_connection, owner=owner, owner_type=owner_type, root_dir=root_dir,
self.db_connection,
owner=owner,
owner_type=owner_type,
root_dir=root_dir,
)

# Create query object
Expand Down
1 change: 0 additions & 1 deletion src/dataregistry/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class DataRegistryException(Exception):

class DataRegistryNYI(DataRegistryException):
def __init__(self, feature=""):

msg = f"Feature {feature} not yet implemented"
self.msg = msg
super().__init__(self.msg)
6 changes: 5 additions & 1 deletion src/dataregistry/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ def get_db_versioning(self):
)

def find_datasets(
self, property_names=None, filters=[], verbose=False, return_format="property_dict"
self,
property_names=None,
filters=[],
verbose=False,
return_format="property_dict",
):
"""
Get specified properties for datasets satisfying all filters
Expand Down
6 changes: 5 additions & 1 deletion src/dataregistry/registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

class Registrar:
def __init__(
self, db_connection, owner=None, owner_type=None, root_dir=None,
self,
db_connection,
owner=None,
owner_type=None,
root_dir=None,
):
"""
Class to register new datasets, executions and alias names.
Expand Down
18 changes: 9 additions & 9 deletions src/dataregistry/registrar_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,17 @@ def _name_from_relpath(relative_path):
We use this when the dataset name is not explicitly defined, and we take it
from the final directory if path.
e.g, /root/to/dataset/dir would return "dir"
e.g, /root/to/dataset/dir would return "dir"
Parameters
----------
relative_path : str
Path to dataset (can be relative or absolute)
Parameters
----------
relative_path : str
Path to dataset (can be relative or absolute)
Returns
-------
name : str
Scraped name of dataset
Returns
-------
name : str
Scraped name of dataset
"""

relpath = relative_path
Expand Down

0 comments on commit cc0b02b

Please sign in to comment.