Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions CTDopts/CTDopts.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import argparse
from itertools import chain
import collections
import collections.abc
import logging
from itertools import chain
from xml.etree.ElementTree import Element, SubElement, tostring, parse
from xml.dom.minidom import parseString
import warnings


# dummy classes for input-file and output-file CTD types.

Expand Down Expand Up @@ -224,7 +225,7 @@ def _translate_ctd_to_param(attribs):
else:
# there is nothing we can split with... so we will assume that this is a restriction of one possible
# value... anyway, the user should be warned about it
warnings.warn(
logging.warning(
"Restriction [%s] of a single value found for parameter [%s]. \n"
"Restrictions should be comma separated value lists or colon separated values to "
"indicate numeric ranges (e.g., 'true,false', '0:14', '1:', ':2.8')\n"
Expand Down Expand Up @@ -1247,7 +1248,7 @@ def validate_args(
enforce_type
): # but raise a warning or exception depending on enforcement level
if enforce_type == 1:
warnings.warn(
logging.warning(
"Argument %s is of wrong type. Expected %s, got: %s"
% (":".join(lineage), TYPE_TO_CTDTYPE[param.type], arg)
)
Expand All @@ -1260,7 +1261,7 @@ def validate_args(
and not param.restrictions.check(validated_value)
):
if enforce_restrictions == 1:
warnings.warn(
logging.warning(
"Argument restrictions for %s violated. Restriction: %s. Value: %s"
% (
":".join(lineage),
Expand All @@ -1279,7 +1280,7 @@ def validate_args(
if not enforce_required:
continue # this argument will be missing from the dict as required fields have no default value
elif enforce_required == 1:
warnings.warn(
logging.warning(
"Required argument %s missing" % ":".join(lineage),
UserWarning,
)
Expand Down