csvpath 0.0.467__tar.gz → 0.0.469__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {csvpath-0.0.467 → csvpath-0.0.469}/PKG-INFO +1 -1
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/csvpath.py +6 -1
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/tally.py +5 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/function_factory.py +6 -1
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/print/table.py +51 -1
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/metaphone.py +1 -1
- csvpath-0.0.469/csvpath/matching/functions/strings/num.py +28 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/validation.py +5 -1
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/reference.py +33 -4
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/util/print_parser.py +4 -3
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/scanning/scanner.py +10 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/pyproject.toml +1 -1
- {csvpath-0.0.467 → csvpath-0.0.469}/LICENSE +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/README.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/config/config.ini +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/__init__.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/csvpaths.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/managers/__init__.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/managers/csvpath_result.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/managers/csvpaths_manager.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/managers/files_manager.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/managers/results_manager.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/__init__.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/__init__.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/all.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/andf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/any.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/between.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/empty.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/exists.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/inf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/no.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/notf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/orf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/boolean/yes.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/count.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/count_headers.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/count_lines.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/count_scans.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/every.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/has_matches.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/increment.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/counting/total_lines.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/dates/datef.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/dates/now.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/function.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/function_focus.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/collect.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/empty_stack.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/end.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/header_name.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/header_names_mismatch.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/headers.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/mismatch.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/replace.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/reset_headers.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/lines/advance.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/lines/after_blank.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/lines/dups.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/lines/first.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/lines/first_line.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/lines/last.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/lines/stop.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/above.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/add.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/divide.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/equals.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/mod.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/multiply.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/round.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/subtract.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/math/sum.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/misc/importf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/misc/intf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/misc/nonef.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/misc/random.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/print/jinjaf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/print/print_line.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/print/print_queue.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/print/printf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/stats/correlate.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/stats/minf.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/stats/percent.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/stats/percent_unique.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/stats/stdev.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/concat.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/length.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/lower.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/regex.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/starts_with.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/strip.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/substring.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/strings/upper.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/testing/debug.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/validity/fail.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/validity/failed.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/variables/get.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/variables/pushpop.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/variables/put.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/variables/track.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/variables/variables.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/lark_parser.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/lark_transformer.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/matcher.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/__init__.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/equality.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/expression.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/header.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/matchable.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/qualified.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/term.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/productions/variable.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/util/exceptions.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/util/expression_encoder.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/util/expression_utility.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/util/lark_print_parser.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/scanning/__init__.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/scanning/exceptions.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/scanning/parser.out +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/scanning/parsetab.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/scanning/scanning_lexer.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/config.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/config_exception.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/error.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/exceptions.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/last_line_stats.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/line_monitor.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/log_utility.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/metadata_parser.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/csvpath/util/printer.py +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/asbool.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/assignment.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/config.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/examples.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/files.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/above.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/advance.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/after_blank.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/all.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/andor.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/any.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/average.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/between.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/collect.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/correlate.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/count.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/count_headers.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/date.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/empty.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/empty_stack.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/end.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/every.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/fail.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/first.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/get.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/has_dups.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/header.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/header_name.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/header_names_mismatch.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/implementing_functions.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/import.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/in.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/increment.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/jinja.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/last.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/line_number.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/max.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/metaphone.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/mismatch.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/no.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/not.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/now.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/percent_unique.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/pop.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/print.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/print_line.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/print_queue.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/regex.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/replace.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/reset_headers.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/stdev.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/stop.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/string_functions.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/subtract.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/sum.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/tally.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/total_lines.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/track.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/variables.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions/variables_and_headers.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/functions.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/grammar.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/headers.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/images/logo-wordmark-white-on-black-trimmed-padded.png +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/images/logo-wordmark-white-trimmed.png +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/paths.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/qualifiers.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/references.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/terms.md +0 -0
- {csvpath-0.0.467 → csvpath-0.0.469}/docs/variables.md +0 -0
|
@@ -633,6 +633,10 @@ class CsvPath(CsvPathPublic, ErrorCollector): # pylint: disable=R0902, R0904
|
|
|
633
633
|
raise MatchException(msg)
|
|
634
634
|
yield line
|
|
635
635
|
if self.stopped:
|
|
636
|
+
self.logger.info(
|
|
637
|
+
"CsvPath has been stopped at line %s",
|
|
638
|
+
self.line_monitor.physical_line_number,
|
|
639
|
+
)
|
|
636
640
|
break
|
|
637
641
|
self.finalize()
|
|
638
642
|
# moving to finalize
|
|
@@ -673,7 +677,8 @@ class CsvPath(CsvPathPublic, ErrorCollector): # pylint: disable=R0902, R0904
|
|
|
673
677
|
# this method can run multiple times w/np, but that
|
|
674
678
|
# shouldn't happen anyway.
|
|
675
679
|
self._freeze_path = True
|
|
676
|
-
self.matcher
|
|
680
|
+
if self.matcher:
|
|
681
|
+
self.matcher.clear_caches()
|
|
677
682
|
|
|
678
683
|
def track_line(self, line) -> None:
|
|
679
684
|
"""csvpaths needs to handle some of the iteration logic, and we don't want
|
|
@@ -36,6 +36,11 @@ class Tally(ValueProducer):
|
|
|
36
36
|
name = self.first_non_term_qualifier("tally")
|
|
37
37
|
else:
|
|
38
38
|
name = f"""{self.first_non_term_qualifier("tally")}_{name}"""
|
|
39
|
+
if f"{value}".strip() == "":
|
|
40
|
+
self.matcher.csvpath.logger.warn(
|
|
41
|
+
"Cannot store an empty tracking value in %s. >>%s<<", name, value
|
|
42
|
+
)
|
|
43
|
+
return
|
|
39
44
|
count = self.matcher.get_variable(name, tracking=value)
|
|
40
45
|
if count is None:
|
|
41
46
|
count = 0
|
|
@@ -11,6 +11,7 @@ from .strings.strip import Strip
|
|
|
11
11
|
from .strings.length import Length, MinMaxLength
|
|
12
12
|
from .strings.regex import Regex
|
|
13
13
|
from .strings.concat import Concat
|
|
14
|
+
from .strings.num import Num
|
|
14
15
|
from .strings.metaphone import Metaphone
|
|
15
16
|
from .counting.count import Count
|
|
16
17
|
from .counting.has_matches import HasMatches
|
|
@@ -56,7 +57,7 @@ from .stats.percent_unique import PercentUnique
|
|
|
56
57
|
from .stats.stdev import Stdev
|
|
57
58
|
from .stats.correlate import Correlate
|
|
58
59
|
from .print.printf import Print
|
|
59
|
-
from .print.table import HeaderTable, RowTable, VarTable
|
|
60
|
+
from .print.table import HeaderTable, RowTable, VarTable, RunTable
|
|
60
61
|
from .print.print_line import PrintLine
|
|
61
62
|
from .print.jinjaf import Jinjaf
|
|
62
63
|
from .print.print_queue import PrintQueue
|
|
@@ -355,8 +356,12 @@ class FunctionFactory:
|
|
|
355
356
|
f = RowTable(matcher, name, child)
|
|
356
357
|
elif name == "var_table":
|
|
357
358
|
f = VarTable(matcher, name, child)
|
|
359
|
+
elif name == "run_table":
|
|
360
|
+
f = RunTable(matcher, name, child)
|
|
358
361
|
elif name == "empty_stack":
|
|
359
362
|
f = EmptyStack(matcher, name, child)
|
|
363
|
+
elif name == "num":
|
|
364
|
+
f = Num(matcher, name, child)
|
|
360
365
|
|
|
361
366
|
else:
|
|
362
367
|
if (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# pylint: disable=C0114
|
|
2
2
|
import textwrap
|
|
3
3
|
from tabulate import tabulate
|
|
4
|
+
from csvpath.matching.util.print_parser import PrintParser
|
|
4
5
|
from ..function_focus import SideEffect
|
|
5
6
|
|
|
6
7
|
|
|
@@ -51,7 +52,6 @@ class RowTable(SideEffect):
|
|
|
51
52
|
j = v2
|
|
52
53
|
headers = []
|
|
53
54
|
row = None
|
|
54
|
-
print(f"tables.i: {i}, {j}")
|
|
55
55
|
if i == j:
|
|
56
56
|
headers.append(self.matcher.csvpath.headers[i])
|
|
57
57
|
row = [[self.matcher.line[i]]]
|
|
@@ -131,3 +131,53 @@ class VarTable(SideEffect):
|
|
|
131
131
|
self.matcher.csvpath.print(
|
|
132
132
|
tabulate(rows, headers=headers, tablefmt="simple_grid")
|
|
133
133
|
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class RunTable(SideEffect):
|
|
137
|
+
"""prints a table of runtime data and any metadata available"""
|
|
138
|
+
|
|
139
|
+
def check_valid(self) -> None:
|
|
140
|
+
self.validate_zero_args()
|
|
141
|
+
super().check_valid()
|
|
142
|
+
|
|
143
|
+
def _produce_value(self, skip=None) -> None:
|
|
144
|
+
self.value = self.matches(skip=skip)
|
|
145
|
+
|
|
146
|
+
def _decide_match(self, skip=None) -> None:
|
|
147
|
+
self.print_all()
|
|
148
|
+
self.match = self.default_match()
|
|
149
|
+
|
|
150
|
+
def print_all(self):
|
|
151
|
+
headers = ["Key", "Value"]
|
|
152
|
+
# do the metadata first, if any
|
|
153
|
+
rows = []
|
|
154
|
+
for k, v in self.matcher.csvpath.metadata.items():
|
|
155
|
+
headers.append(k)
|
|
156
|
+
v = str(v)
|
|
157
|
+
if len(v) > 50:
|
|
158
|
+
v = textwrap.fill(v, width=50)
|
|
159
|
+
rows.append([k, v])
|
|
160
|
+
|
|
161
|
+
if len(rows) > 0:
|
|
162
|
+
self.matcher.csvpath.print("Metadata")
|
|
163
|
+
self.matcher.csvpath.print(
|
|
164
|
+
tabulate(rows, headers=headers, tablefmt="simple_grid")
|
|
165
|
+
)
|
|
166
|
+
# there will definitely be runtime data, but just from this csvpath.
|
|
167
|
+
# it would be possible to get more, but not sure this would be the
|
|
168
|
+
# right way/place to do it.
|
|
169
|
+
parser = PrintParser()
|
|
170
|
+
table = {}
|
|
171
|
+
parser._get_runtime_data_from_local(self.matcher.csvpath, table)
|
|
172
|
+
rows = []
|
|
173
|
+
for k, v in table.items():
|
|
174
|
+
headers.append(k)
|
|
175
|
+
v = str(v)
|
|
176
|
+
if len(v) > 50:
|
|
177
|
+
v = textwrap.fill(v, width=50)
|
|
178
|
+
rows.append([k, v])
|
|
179
|
+
|
|
180
|
+
self.matcher.csvpath.print("Runtime data")
|
|
181
|
+
self.matcher.csvpath.print(
|
|
182
|
+
tabulate(rows, headers=headers, tablefmt="simple_grid")
|
|
183
|
+
)
|
|
@@ -10,7 +10,7 @@ class Metaphone(ValueProducer):
|
|
|
10
10
|
first arg and expects a reference in the second arg. the
|
|
11
11
|
reference must point to a lookup variable. the lookup variable
|
|
12
12
|
must be in the form: Dict[metaphone,canonical]. the most
|
|
13
|
-
likely way of creating that variable today is to use
|
|
13
|
+
likely way of creating that variable today is to use track(),
|
|
14
14
|
passing something like: tally(metaphone(#header), #header)"""
|
|
15
15
|
|
|
16
16
|
def check_valid(self) -> None:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# pylint: disable=C0114
|
|
2
|
+
from csvpath.matching.productions import Term, Variable, Header
|
|
3
|
+
from csvpath.matching.util.expression_utility import ExpressionUtility
|
|
4
|
+
from ..function_focus import ValueProducer
|
|
5
|
+
from ..function import Function
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Num(ValueProducer):
|
|
9
|
+
"""parses a string to a number, if possible"""
|
|
10
|
+
|
|
11
|
+
def check_valid(self) -> None:
|
|
12
|
+
self.validate_one_arg(types=[Term, Variable, Header, Function])
|
|
13
|
+
super().check_valid()
|
|
14
|
+
|
|
15
|
+
def _produce_value(self, skip=None) -> None:
|
|
16
|
+
value = self.children[0].to_value(skip=skip)
|
|
17
|
+
if value is None:
|
|
18
|
+
self.value = 0
|
|
19
|
+
elif isinstance(value, int):
|
|
20
|
+
self.value = value
|
|
21
|
+
elif isinstance(value, float):
|
|
22
|
+
self.value = value
|
|
23
|
+
else:
|
|
24
|
+
self.value = ExpressionUtility.to_float(value)
|
|
25
|
+
|
|
26
|
+
def _decide_match(self, skip=None) -> None:
|
|
27
|
+
self.to_value(skip=skip)
|
|
28
|
+
self.match = self._noop_match()
|
|
@@ -104,7 +104,9 @@ class Validation(Matchable):
|
|
|
104
104
|
raise ChildrenException(f"{self.name}()'s argument must be {first_arg}")
|
|
105
105
|
else:
|
|
106
106
|
if not self.children[0].op == ",":
|
|
107
|
-
raise ChildrenException(
|
|
107
|
+
raise ChildrenException(
|
|
108
|
+
f"{self.name}'s children opperation is incorrect"
|
|
109
|
+
)
|
|
108
110
|
if not self._class_match(self.children[0].left, first_arg):
|
|
109
111
|
raise ChildrenException(
|
|
110
112
|
f"{self.name}()'s first argument must be {first_arg}"
|
|
@@ -113,6 +115,8 @@ class Validation(Matchable):
|
|
|
113
115
|
raise ChildrenException(
|
|
114
116
|
f"{self.name}()'s second argument must be {second_arg}"
|
|
115
117
|
)
|
|
118
|
+
if len(self.children[0].children) > 2:
|
|
119
|
+
raise ChildrenException(f"{self.name} can have at most 2 args")
|
|
116
120
|
|
|
117
121
|
def validate_one_arg(self, types=None) -> None: # pylint: disable=C0116
|
|
118
122
|
if types is None:
|
|
@@ -24,7 +24,7 @@ class Reference(Matchable):
|
|
|
24
24
|
) # pragma: no cover
|
|
25
25
|
#
|
|
26
26
|
# references are in the form:
|
|
27
|
-
# $
|
|
27
|
+
# $path.(csvpath|metadata|variable|header).name[.tracking_name/index]
|
|
28
28
|
#
|
|
29
29
|
# results are always the most recent unless we pull specific results for a
|
|
30
30
|
# header ref using a tracking value against an "id" or "name" metadata
|
|
@@ -102,6 +102,28 @@ class Reference(Matchable):
|
|
|
102
102
|
self._cache_vars = self.value
|
|
103
103
|
return self.value
|
|
104
104
|
|
|
105
|
+
def data_type(self):
|
|
106
|
+
ref = self._get_reference()
|
|
107
|
+
return ref["var_or_header"]
|
|
108
|
+
|
|
109
|
+
def is_header(self):
|
|
110
|
+
return self.data_type() == "headers"
|
|
111
|
+
|
|
112
|
+
def is_variable(self):
|
|
113
|
+
return self.data_type() != "headers"
|
|
114
|
+
|
|
115
|
+
def data_name(self):
|
|
116
|
+
"""this is the name of the datum being referred to. however, it
|
|
117
|
+
is not the tracking value. that is on the "tracking" key in the ref."""
|
|
118
|
+
ref = self._get_reference()
|
|
119
|
+
return ref["name"]
|
|
120
|
+
|
|
121
|
+
def tracking_name(self):
|
|
122
|
+
"""this is the name of the tracking value."""
|
|
123
|
+
ref = self._get_reference()
|
|
124
|
+
return ref["tracking"]
|
|
125
|
+
|
|
126
|
+
""""
|
|
105
127
|
def _get_results(self):
|
|
106
128
|
cs = self.matcher.csvpath.csvpaths
|
|
107
129
|
if cs is None:
|
|
@@ -122,7 +144,6 @@ class Reference(Matchable):
|
|
|
122
144
|
#
|
|
123
145
|
results_list = cs.results_manager.get_named_results(ref["paths_name"])
|
|
124
146
|
if results_list and len(results_list) > 0:
|
|
125
|
-
# if self.ref["paths_name"] is None:
|
|
126
147
|
results = results_list[0]
|
|
127
148
|
# else:
|
|
128
149
|
# for r in results_list:
|
|
@@ -144,6 +165,7 @@ class Reference(Matchable):
|
|
|
144
165
|
#
|
|
145
166
|
raise MatchException("Results cannot be None for reference %s", self)
|
|
146
167
|
return results
|
|
168
|
+
"""
|
|
147
169
|
|
|
148
170
|
def _get_reference(self) -> Dict[str, str]:
|
|
149
171
|
if self.ref is None:
|
|
@@ -197,6 +219,11 @@ class Reference(Matchable):
|
|
|
197
219
|
return ret
|
|
198
220
|
|
|
199
221
|
def _header_value(self) -> Any:
|
|
222
|
+
ref = self._get_reference()
|
|
223
|
+
r = self.get_results()
|
|
224
|
+
return self._get_value_from_results(ref, r)
|
|
225
|
+
|
|
226
|
+
def get_results(self) -> Any:
|
|
200
227
|
ref = self._get_reference()
|
|
201
228
|
name = ref["paths_name"]
|
|
202
229
|
rm = self.matcher.csvpath.csvpaths.results_manager
|
|
@@ -207,7 +234,8 @@ class Reference(Matchable):
|
|
|
207
234
|
#
|
|
208
235
|
if rm.get_number_of_results(name) == 1:
|
|
209
236
|
rs = rm.get_named_results(name)
|
|
210
|
-
|
|
237
|
+
return rs[0]
|
|
238
|
+
# ret = self._get_value_from_results(ref, rs[0])
|
|
211
239
|
elif ref["tracking"]:
|
|
212
240
|
#
|
|
213
241
|
# find the specific path if we have a tracking value.
|
|
@@ -223,7 +251,8 @@ class Reference(Matchable):
|
|
|
223
251
|
ref["tracking"],
|
|
224
252
|
self,
|
|
225
253
|
)
|
|
226
|
-
ret = self._get_value_from_results(ref, r)
|
|
254
|
+
# ret = self._get_value_from_results(ref, r)
|
|
255
|
+
return r
|
|
227
256
|
else:
|
|
228
257
|
#
|
|
229
258
|
# are we really going to aggregate all the values from all the
|
|
@@ -274,7 +274,8 @@ class PrintParser:
|
|
|
274
274
|
_id = "csvpath" if "name" not in csvpath.metadata else csvpath.metadata["name"]
|
|
275
275
|
if _id.strip() == "":
|
|
276
276
|
_id = "csvpath"
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
runtime["identity"] = csvpath.identity
|
|
278
|
+
if "valid" not in runtime:
|
|
279
|
+
runtime["valid"] = {}
|
|
280
|
+
runtime["valid"][csvpath.identity] = csvpath.is_valid
|
|
280
281
|
runtime["stopped"] = csvpath.stopped
|
|
@@ -53,6 +53,16 @@ class Scanner: # pylint: disable=R0902
|
|
|
53
53
|
to_line = self.to_line if to_line == -1 else to_line
|
|
54
54
|
all_lines = self.all_lines if all_lines is None else all_lines
|
|
55
55
|
these = self.these if these is None else these
|
|
56
|
+
#
|
|
57
|
+
# what if from is > to? shouldn't be but we originally wanted
|
|
58
|
+
# to support that, way back, so we can do this swap.
|
|
59
|
+
#
|
|
60
|
+
if from_line and to_line and from_line > to_line:
|
|
61
|
+
_ = from_line
|
|
62
|
+
from_line = to_line
|
|
63
|
+
to_line = _
|
|
64
|
+
|
|
65
|
+
# end exp
|
|
56
66
|
if all_lines:
|
|
57
67
|
return (
|
|
58
68
|
line == self.csvpath.line_monitor.physical_end_line_number
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{csvpath-0.0.467 → csvpath-0.0.469}/csvpath/matching/functions/headers/header_names_mismatch.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{csvpath-0.0.467 → csvpath-0.0.469}/docs/images/logo-wordmark-white-on-black-trimmed-padded.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|