Skip to content

Commit

Permalink
manually lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-rifai committed Feb 8, 2022
1 parent 44bb79d commit 5a4690d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
9 changes: 4 additions & 5 deletions clinica/engine/prov_model.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from abc import ABC, abstractmethod
from typing import List, Union
from xml.dom.minidom import Element
from attr import define, field

import attr
import cattr
from typing import Union, List
from abc import ABC, abstractmethod

from attr import define, field
from matplotlib.style import context


# Define PROV abstract concepts


Expand Down
4 changes: 2 additions & 2 deletions clinica/engine/prov_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Optional, List
from pathlib import Path
from typing import List, Optional

from .prov_model import *

Expand All @@ -12,8 +12,8 @@ def get_files_list(self, pipeline_fullname: str, dict_field="input_to") -> List[
return list of 'Path's to the files used in the pipeline
"""
from clinica.utils.inputs import clinica_file_reader
import clinica.utils.input_files as cif
from clinica.utils.inputs import clinica_file_reader

dict_field_options = ["input_to", "output_from"]
if dict_field not in dict_field_options:
Expand Down
13 changes: 7 additions & 6 deletions clinica/engine/provenance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import functools
from os import read

from pathlib import Path
from typing import List

Expand Down Expand Up @@ -56,7 +55,7 @@ def get_history_record(paths_files: List[Path]) -> ProvRecord:
a ProvRecord for the associated files in path_files
"""

from .prov_utils import read_prov_jsonld, get_path_prov
from .prov_utils import get_path_prov, read_prov_jsonld

prov_record = ProvRecord({}, [])

Expand Down Expand Up @@ -127,13 +126,14 @@ def extend_prov(prov_main: dict, prov_new: dict) -> dict:


def get_agent() -> ProvAgent:
import clinica
from clinica import __name__, __version__

from .prov_utils import generate_agent_id

new_agent = ProvAgent(uid=generate_agent_id())

new_agent.attributes["version"] = clinica.__version__
new_agent.attributes["label"] = clinica.__name__
new_agent.attributes["version"] = __version__
new_agent.attributes["label"] = __name__

return new_agent

Expand All @@ -144,13 +144,14 @@ def get_activity(self, agent: Identifier, entities: List[ProvEntity]) -> ProvAct
ProvActivity from related entities and associated agent
"""
import sys

from .prov_utils import generate_activity_id

new_activity = ProvActivity(uid=generate_activity_id(self.fullname))

new_activity.attributes["parameters"] = self.parameters
new_activity.attributes["label"] = self.fullname
new_activity.attributes["command"] = (sys.argv[1:],)
new_activity.attributes["command"] = sys.argv[1:]
new_activity.attributes["used"] = [str(x.uid) for x in entities]
new_activity.attributes["wasAssociatedWith"] = str(agent.uid)

Expand Down
1 change: 1 addition & 0 deletions clinica/pipelines/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import click
from nipype.pipeline.engine import Workflow

import clinica.engine.provenance as prov


Expand Down

0 comments on commit 5a4690d

Please sign in to comment.