linecook package¶
Submodules¶
linecook.cli module¶
linecook cli to prepare lines of text for easy consumption.
-
linecook.cli.build_parser()¶
-
linecook.cli.main()¶
-
linecook.cli.print_available_recipes(linecook_config)¶
-
linecook.cli.recipe_not_found_msg(recipe_name)¶
-
linecook.cli.run(args)¶
linecook.parsers module¶
-
linecook.parsers.create_regex_factory(format_string=None, regex_type=None, ignore_case=False)¶ Return a
create_regexfunction that compiles a pattern to a regex.
-
linecook.parsers.resolve_match_pattern(pattern)¶ Return a compiled regex, parsing known regex shorthands.
linecook.patterns module¶
-
linecook.patterns.any_of(*args)¶ Return regex that matches any of the input regex patterns.
The returned value is equivalent to writing:
r'(<arg1>|<arg2>|...)'
-
linecook.patterns.anything= '.*'¶ Pattern matching any text
-
linecook.patterns.bounded_word(string)¶ Return regex that matches the input string as a bounded word.
The returned value is equivalent to writing:
r'\b<string>\b'
-
linecook.patterns.date= '\\b\\d{4}-\\d{2}-\\d{2}\\b'¶ Pattern matching calendar dates in ISO 8601 format (
YYYY-MM-DD)
-
linecook.patterns.day= '\\d{2}'¶ Pattern matching a numeric day
-
linecook.patterns.double_quoted_strings= '(?<!["\\w])"[^"]*"(?!["\\w])'¶ Pattern matching strings surrounded by double-quotes
-
linecook.patterns.exact_match(string)¶ Return regex that matches the input string exactly.
The returned value is equivalent to writing:
r'^<string>$'
-
linecook.patterns.exact_template= '^{}$'¶ Template string to match text exactly (start-to-end)
-
linecook.patterns.first_word= '^\\s*\\w+'¶ Pattern matching first word
-
linecook.patterns.indent= '^\\s*'¶ Pattern matching indent at start of string
-
linecook.patterns.month= '\\d{2}'¶ Pattern matching a numeric month
-
linecook.patterns.num_float= '\\b[+-]?(\\d*[.])?\\d+\\b'¶ Pattern matching floating point number
-
linecook.patterns.num_int= '\\b[+-]?\\d\\b'¶ Pattern matching integers
-
linecook.patterns.number= '(\\b[+-]?\\d\\b|\\b[+-]?(\\d*[.])?\\d+\\b)'¶ Pattern matching integers or floats
-
linecook.patterns.single_quoted_strings= "(?<!['\\w])'[^']*'(?!['\\w])"¶ Pattern matching strings surrounded by single-quotes
-
linecook.patterns.start= '^'¶ Pattern matching start of string
-
linecook.patterns.strings= '((?<![\'\\w])\'[^\']*\'(?![\'\\w])|(?<!["\\w])"[^"]*"(?!["\\w]))'¶ Pattern matching strings surrounded by single- or double-quotes
-
linecook.patterns.time= '\\b(\\d{2}:\\d{2}(:\\d{2})?)\\b'¶ Pattern matching numeric time
-
linecook.patterns.time_ms= '\\b\\d{2}:\\d{2}:\\d{2}(,|.)\\d{3}\\b'¶ Pattern matching numeric time with milliseconds
-
linecook.patterns.whitespace= '\\s*'¶ Pattern matching any whitespace
-
linecook.patterns.word_template= '\\b{}\\b'¶ Template string to match text surrounded by word boundaries
-
linecook.patterns.year= '\\d{4}'¶ Pattern matching a numeric year