Skip to content
Snippets Groups Projects
Commit 674d7e14 authored by Manon Blanco's avatar Manon Blanco
Browse files

Comply with ruff's PTH rule

parent d13301eb
No related branches found
No related tags found
1 merge request!32Comply with ruff's PTH rule
Pipeline #143894 passed
import logging
import os
from csv import reader
from pathlib import Path
from typing import List
......@@ -343,14 +342,14 @@ def run(annotation: Path, prediction: Path, threshold: int, verbose: bool) -> di
return scores
def run_multiple(file_csv, folder, threshold, verbose):
def run_multiple(file_csv: Path, folder: Path, threshold: int, verbose: bool):
"""Run the program for multiple files (correlation indicated in the csv file)"""
# Read the csv in a list
with open(file_csv) as read_obj:
with file_csv.open() as read_obj:
csv_reader = reader(read_obj)
list_cor = list(csv_reader)
if os.path.isdir(folder):
if folder.is_dir():
list_bio_file = list(folder.rglob("*.bio"))
count = 0
......@@ -362,10 +361,10 @@ def run_multiple(file_csv, folder, threshold, verbose):
predict = None
for file in list_bio_file:
if row[0] == os.path.basename(file):
if row[0] == file.name:
annot = file
for file in list_bio_file:
if row[1] == os.path.basename(file):
if row[1] == file.name:
predict = file
if annot and predict:
......
......@@ -33,4 +33,6 @@ select = [
"Q",
# flake8-unused-arguments
"ARG",
# flake8-use-pathlib
"PTH",
]
......@@ -27,7 +27,7 @@ def parse_requirements():
setup(
name="nerval",
version=open("VERSION").read(),
version=Path("VERSION").read_text(),
description="Tool to evaluate NER on noisy text.",
author="Teklia",
author_email="contact@teklia.com",
......
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