diff --git a/.codacy.yml b/.codacy.yml index 887131e0944..4e4c9b0a90f 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -3,10 +3,5 @@ exclude_paths: - 'doc/joss-paper/**' - 'etc/**' - 'lib/cylc/tests/**' - - 'lib/isodatetime/**' - - 'lib/jinja2/**' - - 'lib/markupsafe/**' - - 'lib/parsec/tests/**' - - 'licences/**' - 'tests/**' diff --git a/.travis/shellchecker b/.travis/shellchecker index adda5378a16..d06191b842b 100755 --- a/.travis/shellchecker +++ b/.travis/shellchecker @@ -76,12 +76,12 @@ default () { # run a strict check on all "functional" scripts main '.' \ --exclude 'tests/' \ - --exclude 'lib/parsec/tests' \ + --exclude 'lib/cylc/tests/parsec' \ --exclude 'etc/dev-bin/live-graph-movie.sh' \ -- -e SC1090 # run a lenient check on all test scripts - main 'tests' 'lib/parsec/tests' -- -S error -e SC1090 + main 'tests' 'lib/cylc/tests/parsec' -- -S error -e SC1090 } if [[ $# -gt 0 ]]; then diff --git a/bin/cylc-broadcast b/bin/cylc-broadcast index f13e45b8289..31d3728434e 100755 --- a/bin/cylc-broadcast +++ b/bin/cylc-broadcast @@ -91,7 +91,7 @@ from cylc.network.client import SuiteRuntimeClient from cylc.option_parsers import CylcOptionParser as COP from cylc.print_tree import print_tree from cylc.task_id import TaskID -from parsec.config import ParsecConfig +from cylc.parsec.config import ParsecConfig REC_ITEM = re.compile(r'^\[([^\]]*)\](.*)$') diff --git a/bin/cylc-edit b/bin/cylc-edit index 67bf3fcffee..36de51a1c17 100755 --- a/bin/cylc-edit +++ b/bin/cylc-edit @@ -67,7 +67,7 @@ from subprocess import call from shutil import copy -from parsec.include import inline, \ +from cylc.parsec.include import inline, \ split_file, backup, backups, newfiles, cleanup, modtimes diff --git a/bin/cylc-monitor b/bin/cylc-monitor index 7428fffec46..61c5210bf3a 100755 --- a/bin/cylc-monitor +++ b/bin/cylc-monitor @@ -32,7 +32,7 @@ import os import re from time import sleep, time -from parsec.OrderedDict import OrderedDict +from cylc.parsec.OrderedDict import OrderedDict from cylc.exceptions import ClientError from cylc.option_parsers import CylcOptionParser as COP diff --git a/bin/cylc-search b/bin/cylc-search index a18c080c49e..3e85416044c 100755 --- a/bin/cylc-search +++ b/bin/cylc-search @@ -42,7 +42,7 @@ from collections import deque from cylc.option_parsers import CylcOptionParser as COP from cylc.suite_srv_files_mgr import SuiteSrvFilesManager from cylc.terminal import cli_function -from parsec.include import inline +from cylc.parsec.include import inline def section_level(heading): diff --git a/bin/cylc-view b/bin/cylc-view index a67485d2923..d07f0592aac 100755 --- a/bin/cylc-view +++ b/bin/cylc-view @@ -45,7 +45,7 @@ from cylc.option_parsers import CylcOptionParser as COP from cylc.suite_srv_files_mgr import SuiteSrvFilesManager from cylc.templatevars import load_template_vars from cylc.terminal import cli_function -from parsec.fileparse import read_and_proc +from cylc.parsec.fileparse import read_and_proc def parse_args(): diff --git a/lib/cylc/__init__.py b/lib/cylc/__init__.py index 8738591660f..5df7176334e 100644 --- a/lib/cylc/__init__.py +++ b/lib/cylc/__init__.py @@ -19,7 +19,7 @@ import os import sys -from parsec import LOG +from cylc.parsec import LOG def environ_init(): diff --git a/lib/cylc/batch_sys_manager.py b/lib/cylc/batch_sys_manager.py index 9e681a5bd65..ec898e9938d 100644 --- a/lib/cylc/batch_sys_manager.py +++ b/lib/cylc/batch_sys_manager.py @@ -124,7 +124,7 @@ JOB_LOG_STATUS) from cylc.task_outputs import TASK_OUTPUT_SUCCEEDED from cylc.wallclock import get_current_time_string -from parsec.OrderedDict import OrderedDict +from cylc.parsec.OrderedDict import OrderedDict class JobPollContext(object): diff --git a/lib/cylc/cfgspec/globalcfg.py b/lib/cylc/cfgspec/globalcfg.py index 80a2ac580cc..37489120fe4 100644 --- a/lib/cylc/cfgspec/globalcfg.py +++ b/lib/cylc/cfgspec/globalcfg.py @@ -23,9 +23,9 @@ import shutil from tempfile import mkdtemp -from parsec.config import ParsecConfig -from parsec.exceptions import ParsecError -from parsec.upgrade import upgrader +from cylc.parsec.config import ParsecConfig +from cylc.parsec.exceptions import ParsecError +from cylc.parsec.upgrade import upgrader from cylc import LOG from cylc.cfgvalidate import ( diff --git a/lib/cylc/cfgspec/suite.py b/lib/cylc/cfgspec/suite.py index 7015b95a263..ea84951ed9e 100644 --- a/lib/cylc/cfgspec/suite.py +++ b/lib/cylc/cfgspec/suite.py @@ -19,8 +19,8 @@ from isodatetime.data import Calendar -from parsec.upgrade import upgrader -from parsec.config import ParsecConfig +from cylc.parsec.upgrade import upgrader +from cylc.parsec.config import ParsecConfig from cylc.cfgvalidate import ( cylc_config_validate, CylcConfigValidator as VDR, DurationFloat) diff --git a/lib/cylc/cfgvalidate.py b/lib/cylc/cfgvalidate.py index c103f41689a..f60f383a561 100644 --- a/lib/cylc/cfgvalidate.py +++ b/lib/cylc/cfgvalidate.py @@ -25,7 +25,7 @@ from isodatetime.data import Calendar, Duration, TimePoint from isodatetime.dumpers import TimePointDumper from isodatetime.parsers import DurationParser, TimePointParser -from parsec.validate import ParsecValidator, IllegalValueError +from cylc.parsec.validate import ParsecValidator, IllegalValueError from cylc.subprocctx import SubFuncContext diff --git a/lib/cylc/config.py b/lib/cylc/config.py index bce74a403ad..4a9ed35a9c4 100644 --- a/lib/cylc/config.py +++ b/lib/cylc/config.py @@ -37,8 +37,8 @@ from isodatetime.data import Calendar from isodatetime.parsers import DurationParser -from parsec.OrderedDict import OrderedDictWithDefaults -from parsec.util import replicate +from cylc.parsec.OrderedDict import OrderedDictWithDefaults +from cylc.parsec.util import replicate from cylc import LOG from cylc.c3mro import C3 diff --git a/lib/cylc/cycling/iso8601.py b/lib/cylc/cycling/iso8601.py index 5334603c4a9..6a03adfd636 100755 --- a/lib/cylc/cycling/iso8601.py +++ b/lib/cylc/cycling/iso8601.py @@ -32,7 +32,7 @@ SequenceDegenerateError, PointParsingError, IntervalParsingError ) from cylc.wallclock import get_current_time_string -from parsec.validate import IllegalValueError +from cylc.parsec.validate import IllegalValueError CYCLER_TYPE_ISO8601 = "iso8601" CYCLER_TYPE_SORT_KEY_ISO8601 = "b" diff --git a/lib/cylc/param_expand.py b/lib/cylc/param_expand.py index 8f5cb1a3bcd..c846e5f2a85 100755 --- a/lib/cylc/param_expand.py +++ b/lib/cylc/param_expand.py @@ -62,7 +62,7 @@ def expand(template, params, results, values=None): from cylc.exceptions import ParamExpandError from cylc.task_id import TaskID -from parsec.OrderedDict import OrderedDictWithDefaults +from cylc.parsec.OrderedDict import OrderedDictWithDefaults # To split runtime heading name lists. REC_NAMES = re.compile(r'(?:[^,<]|<[^>]*>)+') diff --git a/lib/parsec/OrderedDict.py b/lib/cylc/parsec/OrderedDict.py similarity index 100% rename from lib/parsec/OrderedDict.py rename to lib/cylc/parsec/OrderedDict.py diff --git a/lib/parsec/README.md b/lib/cylc/parsec/README.md similarity index 100% rename from lib/parsec/README.md rename to lib/cylc/parsec/README.md diff --git a/lib/parsec/__init__.py b/lib/cylc/parsec/__init__.py similarity index 100% rename from lib/parsec/__init__.py rename to lib/cylc/parsec/__init__.py diff --git a/lib/parsec/config.py b/lib/cylc/parsec/config.py similarity index 95% rename from lib/parsec/config.py rename to lib/cylc/parsec/config.py index f89fe890611..8e17c8a9f14 100755 --- a/lib/parsec/config.py +++ b/lib/cylc/parsec/config.py @@ -17,13 +17,13 @@ # along with this program. If not, see . import re -from parsec.exceptions import ( +from cylc.parsec.exceptions import ( ParsecError, ItemNotFoundError, NotSingleItemError) -from parsec.fileparse import parse -from parsec.util import printcfg -from parsec.validate import parsec_validate -from parsec.OrderedDict import OrderedDictWithDefaults -from parsec.util import itemstr, m_override, replicate, un_many +from cylc.parsec.fileparse import parse +from cylc.parsec.util import printcfg +from cylc.parsec.validate import parsec_validate +from cylc.parsec.OrderedDict import OrderedDictWithDefaults +from cylc.parsec.util import itemstr, m_override, replicate, un_many class ParsecConfig(object): diff --git a/lib/parsec/empysupport.py b/lib/cylc/parsec/empysupport.py similarity index 97% rename from lib/parsec/empysupport.py rename to lib/cylc/parsec/empysupport.py index 221d7c45c7c..8988fb5a681 100644 --- a/lib/parsec/empysupport.py +++ b/lib/cylc/parsec/empysupport.py @@ -24,7 +24,7 @@ import em import os -from parsec.exceptions import EmPyError +from cylc.parsec.exceptions import EmPyError def empyprocess(flines, dir_, template_vars=None): diff --git a/lib/parsec/example/cfgspec.py b/lib/cylc/parsec/example/cfgspec.py similarity index 96% rename from lib/parsec/example/cfgspec.py rename to lib/cylc/parsec/example/cfgspec.py index 18f445b501c..721ae850ba9 100644 --- a/lib/parsec/example/cfgspec.py +++ b/lib/cylc/parsec/example/cfgspec.py @@ -17,7 +17,7 @@ # along with this program. If not, see . """Legal items and validators for the parsec test config file.""" -from parsec.validate import ParsecValidator as vdr +from cylc.parsec.validate import ParsecValidator as vdr SPEC = { diff --git a/lib/parsec/example/site.rc b/lib/cylc/parsec/example/site.rc similarity index 100% rename from lib/parsec/example/site.rc rename to lib/cylc/parsec/example/site.rc diff --git a/lib/parsec/example/test.py b/lib/cylc/parsec/example/test.py similarity index 94% rename from lib/parsec/example/test.py rename to lib/cylc/parsec/example/test.py index c2c0731c878..2e8a42e87d7 100755 --- a/lib/parsec/example/test.py +++ b/lib/cylc/parsec/example/test.py @@ -20,8 +20,8 @@ import os import sys -from cfgspec import SPEC -from parsec.config import ParsecConfig +from cylc.cfgspec.globalcfg import SPEC +from cylc.parsec.config import ParsecConfig import cylc.flags # parse: diff --git a/lib/parsec/example/user.rc b/lib/cylc/parsec/example/user.rc similarity index 100% rename from lib/parsec/example/user.rc rename to lib/cylc/parsec/example/user.rc diff --git a/lib/parsec/exceptions.py b/lib/cylc/parsec/exceptions.py similarity index 99% rename from lib/parsec/exceptions.py rename to lib/cylc/parsec/exceptions.py index 738f5ba67ce..1619649b30c 100644 --- a/lib/parsec/exceptions.py +++ b/lib/cylc/parsec/exceptions.py @@ -20,7 +20,7 @@ import os import textwrap -from parsec.util import itemstr +from cylc.parsec.util import itemstr TRACEBACK_WRAPPER = textwrap.TextWrapper() diff --git a/lib/parsec/fileparse.py b/lib/cylc/parsec/fileparse.py similarity index 96% rename from lib/parsec/fileparse.py rename to lib/cylc/parsec/fileparse.py index f7ec8b1b7ea..247955fa71d 100644 --- a/lib/parsec/fileparse.py +++ b/lib/cylc/parsec/fileparse.py @@ -36,11 +36,11 @@ import sys import re -from parsec import LOG -from parsec.exceptions import ParsecError, FileParseError -from parsec.OrderedDict import OrderedDictWithDefaults -from parsec.include import inline -from parsec.util import itemstr +from cylc.parsec import LOG +from cylc.parsec.exceptions import ParsecError, FileParseError +from cylc.parsec.OrderedDict import OrderedDictWithDefaults +from cylc.parsec.include import inline +from cylc.parsec.util import itemstr # heading/sections can contain commas (namespace name lists) and any @@ -246,7 +246,7 @@ def read_and_proc(fpath, template_vars=None, viewcfg=None, asedit=False): if flines and re.match(r'^#![Ee]m[Pp]y\s*', flines[0]): LOG.debug('Processing with EmPy') try: - from parsec.empysupport import empyprocess + from cylc.parsec.empysupport import empyprocess except (ImportError, ModuleNotFoundError): raise ParsecError('EmPy Python package must be installed ' 'to process file: ' + fpath) @@ -257,7 +257,7 @@ def read_and_proc(fpath, template_vars=None, viewcfg=None, asedit=False): if flines and re.match(r'^#![jJ]inja2\s*', flines[0]): LOG.debug('Processing with Jinja2') try: - from parsec.jinja2support import jinja2process + from cylc.parsec.jinja2support import jinja2process except (ImportError, ModuleNotFoundError): raise ParsecError('Jinja2 Python package must be installed ' 'to process file: ' + fpath) diff --git a/lib/parsec/include.py b/lib/cylc/parsec/include.py similarity index 98% rename from lib/parsec/include.py rename to lib/cylc/parsec/include.py index b5df15b5871..f562fd0f714 100644 --- a/lib/parsec/include.py +++ b/lib/cylc/parsec/include.py @@ -22,7 +22,7 @@ import sys from shutil import copy as shcopy -from parsec.exceptions import ParsecError, IncludeFileNotFoundError +from cylc.parsec.exceptions import ParsecError, IncludeFileNotFoundError done = [] diff --git a/lib/parsec/jinja2support.py b/lib/cylc/parsec/jinja2support.py similarity index 99% rename from lib/parsec/jinja2support.py rename to lib/cylc/parsec/jinja2support.py index e2336b71dbe..14d7089860d 100644 --- a/lib/parsec/jinja2support.py +++ b/lib/cylc/parsec/jinja2support.py @@ -35,8 +35,8 @@ TemplateNotFound, TemplateSyntaxError) -from parsec import LOG -from parsec.exceptions import Jinja2Error +from cylc.parsec import LOG +from cylc.parsec.exceptions import Jinja2Error TRACEBACK_LINENO = re.compile(r'(\s+)?File "