-
Notifications
You must be signed in to change notification settings - Fork 0
Python class
Flav20 edited this page Nov 8, 2024
·
6 revisions
If we translate the rust into python, we'll have:
class WithEOL:
# head: Read the n first lines
# if n > (numbers of lines in the file) => return the whole file
def head(path: str, n: int, \
remove_empty_string: bool = False, \
regex_keep: list = [] \
regex_pass: list = [] \
restrict: bool = True):
...
# between: Read the lines [n1, n2]
# if n1 > n2 => return an empty list
# if n1 > (numbers of lines in the file) => return an empty list
def between(path: str, n1: int, n2: int \
remove_empty_string: bool = False, \
regex_keep: list = [] \
regex_pass: list = [] \
restrict: bool = True):
...
# tail: Read the n last lines
# if n > (numbers of lines in the file) => return the whole file
def tail(path: str, n: int, \
remove_empty_string: bool = False, \
regex_keep: list = [] \
regex_pass: list = [] \
restrict: bool = True):
...
# parse: Read the whole file
def parse(path: str, \
remove_empty_string: bool = False \
regex_keep: list = [] \
regex_pass: list = []):
...
# Count the number of lines
def count_lines(path: str \
remove_empty_string: bool = False, \
regex_keep: list = [] \
regex_pass: list = []):
...