Skip to content
Snippets Groups Projects
Unverified Commit 2208cb99 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

remove satella

parent 9309ab88
No related branches found
No related tags found
No related merge requests found
Pipeline #61307 failed with stage
in 2 minutes and 38 seconds
include LICENSE
include README.md
include CONTRIBUTORS.md
include snakehouse/templates/*.mako
include requirements.txt
import typing as tp
import warnings
from satella.files import read_lines, find_files
from .satella import read_lines, find_files
def find_pyx(directory_path: str) -> tp.List[str]:
......
......@@ -67,6 +67,23 @@ def find_files(path: str, wildcard: str = r'(.*)',
if re.match(wildcard, fn_path):
yield _cond_join(prefix_with, filename)
def read_lines(path: str, delete_empty_lines: bool = True,
encoding: str = 'utf-8') -> tp.List[str]:
"""
Read lines from a particular file, removing end-of-line characters and optionally
empty lines. Additionally whitespaces (and end-of-line characters) will be removed
from both ends of each line.
:param path: path of file to read
:param delete_empty_lines: set to False if empty lines are not to be removed
:param encoding: encoding to read the file with
:return: each line as a separate entry
"""
with codecs.open(path, 'r', encoding) as f_in:
lines = [line.strip() for line in f_in.readlines()]
if delete_empty_lines:
lines = [line for line in lines if line]
return lines
def split(path: str) -> tp.List[str]:
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment