Skip to content

Commit

Permalink
flake8 up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
beckynevin committed Jun 11, 2024
1 parent 9bc6271 commit 64a73af
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/move_embargo_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,27 @@


def parse_args():
"""Parses and returns command-line arguments for transferring data between Butler repositories.
"""Parses and returns command-line arguments
for transferring data between Butler repositories.
Extended Summary
----------------
The function sets up an argument parser for transferring data from an embargo Butler repository
to another Butler repository. It defines several arguments and their options, including source
and destination repositories, instrument, embargo time periods, configuration options, and more.
The function sets up an argument parser for transferring
data from an embargo Butler repository to another Butler repository.
It defines several arguments and their options, including source
and destination repositories, instrument, embargo time periods,
configuration options, and more.
Returns
-------
argparse.Namespace: An object containing the parsed command-line arguments.
argparse.Namespace: An object containing the parsed command-line
arguments.
Arguments
---------
fromrepo : `str`
Path to the Butler repository from which data is transferred. Default is '/repo/embargo'.
Path to the Butler repository from which data is transferred.
Default is '/repo/embargo'.
torepo : `str`
Path to the Butler repository to which data is transferred.
instrument : `str`
Expand All @@ -35,7 +40,7 @@ def parse_args():
embargohours : `list` [`float`], optional
Embargo time period in hours.
use_dataquery_config : `bool`, optional
If True, uses the configuration from the config file;
If True, uses the configuration from the config file;
if False, uses provided datasettype and collections lists.
dataquery_config_file : `str`, optional
Path to the configuration file. Default is '/etc/config.yaml'.
Expand All @@ -48,7 +53,8 @@ def parse_args():
move : `bool`, optional
If True, deletes original data after transfer; if False, copies data.
log : `str`, optional
Logging level. Default is 'INFO'. Other options are 'DEBUG' and 'WARNING'.
Logging level. Default is 'INFO'.
Other options are 'DEBUG' and 'WARNING'.
desturiprefix : `str`, optional
Destination URI prefix for raw data ingestion. Default is 'False'.
Expand Down Expand Up @@ -190,8 +196,7 @@ def parse_args():
if namespace.use_dataquery_config:
# define the config file
config_file = namespace.dataquery_config_file
logger.info(
"using the config file, config_file name/path is %s", config_file)
logger.info("using the config file, config_file name/path is %s", config_file)
# read config file
with open(config_file, "r") as f:
config = yaml.safe_load(f)
Expand Down Expand Up @@ -258,8 +263,9 @@ def parse_args():
timespan_pastembargo = Timespan(
now - embargo_period - past_embargo_period, now - embargo_period
)
assert (now - embargo_period) > (now - embargo_period - past_embargo_period), \
"end of embargo happens before start of embargo, this is grabbing not yet released data"
assert (now - embargo_period) > (
now - embargo_period - past_embargo_period
), "end of embargo happens before start of embargo, this is grabbing not yet released data"
elif len(namespace.embargohours) > 1 and len(namespace.nowtime) > 1:
embargo_hours = [float(hours) for hours in namespace.embargohours]
# Calculate embargo_period for each embargo hour
Expand Down

0 comments on commit 64a73af

Please sign in to comment.