Skip to content

Commit

Permalink
Using ruff@0.4.2 to reformat the code. (#58)
Browse files Browse the repository at this point in the history
Newer versions of ruff demand an empty line between the docstrings module and the first import. This is the only change in a majority of files.
  • Loading branch information
JanNiklasWeder committed Apr 29, 2024
1 parent 0663ec4 commit 5c522f5
Show file tree
Hide file tree
Showing 33 changed files with 38 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/cobramod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
For a list of databases, load variable :obj:`cobramod.available_databases`
"""

from cobramod.core.creation import (
add_metabolites,
add_reactions,
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/core/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:class:`cobra.core.reaction.Reaction`. Dictionaries containing the data of a
given database are used.
"""

from __future__ import annotations

from contextlib import suppress
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/core/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- test_non_zero_flux: Checks that the given reaction in a model is active and
gives a non-zero flux.
"""

from __future__ import annotations

from contextlib import suppress
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/core/genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This module is responsible for the creation of COBRApy Genes from the parsed
data of the specific parsers.
"""

from typing import Any

import cobra.core as cobra_core
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
return the corresponding non-cyclic directed graph.
"""

from __future__ import annotations

from collections import Counter
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/core/pathway.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- solution: Obtain the solution for the specific members.
- visualize: get a :class:`escher.Builder` for that specific Pathway.
"""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/core/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This module is responsible for the short summary in the command
line and for other summaries in different formats.
"""

from __future__ import annotations
from pathlib import Path
from typing import Union, Optional
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
The name of logger variable is `debug_log`
"""

import datetime as dt
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This module creates special errors for CobraMod. Read each error for their
explanation.
"""

from cobramod.debug import debug_log


Expand Down
1 change: 1 addition & 0 deletions src/cobramod/parsing/bigg.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
They change identifiers depending on the model given. BiGG have multiple models
"""

from __future__ import annotations

from contextlib import suppress
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/parsing/biocyc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Reactions: Can have the words "RXN" in the identifier. Enzymes can sometimes
be used instead. The gene information for the reactions is included if found.
"""

from __future__ import annotations

import urllib.parse
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/parsing/db_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
It uses the same structure of using a Singleton for the configuration in
COBRApy
"""

from pathlib import Path
from typing import Optional, Union

Expand Down
1 change: 1 addition & 0 deletions src/cobramod/parsing/kegg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
gene information for reactions is also included if the specie is specified
- Module Pathways: Identifiers that start with the letter M, e.g M00001
"""

from __future__ import annotations

from contextlib import suppress
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/parsing/plantcyc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The main functions to parse Metabolites and Reactions are found in the module
Biocyc
"""

import urllib.parse
import xml.etree.ElementTree as et
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/parsing/solcyc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The main functions to parse Metabolites and Reactions are found in the module
Biocyc
"""

import urllib.parse
import xml.etree.ElementTree as et
from pathlib import Path
Expand Down
9 changes: 6 additions & 3 deletions src/cobramod/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
`file_to_Data_class` or `get_response` that handles the data retrieval or
convertion
"""

from __future__ import annotations

import json
Expand Down Expand Up @@ -196,9 +197,11 @@ def from_json(
)
info_response.raise_for_status()

with path.parents[1].joinpath("database_version").open(
mode="w+"
) as f:
with (
path.parents[1]
.joinpath("database_version")
.open(mode="w+") as f
):
f.write(info_response.text)
version = info_response.json().get("bigg_models_version")

Expand Down
1 change: 1 addition & 0 deletions src/cobramod/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
original model "e_coli_core" from BiGG database, which are also included in
COBRApy.
"""

import pkg_resources
from cobra.io import read_sbml_model

Expand Down
1 change: 1 addition & 0 deletions src/cobramod/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- check_imbalance: Check for unbalanced reactions.
"""

import io
from pathlib import Path
from re import match
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/visualization/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- visualize: Saves Escher visualization as a HTML and return the Escher
Builder.
"""

import fileinput
import math
from collections import UserDict, namedtuple
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/visualization/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
The name of logger variable is `visualization`
"""

import datetime as dt
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/visualization/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Reaction: Represents a reaction. They contain the needed segments for the
visualization of the pathway.
"""

from contextlib import suppress
from collections import UserDict
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions src/cobramod/visualization/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
is lineal and creates the representation in a matrix. In case of cyclic path,
it will cut it.
"""

from itertools import chain
from typing import Dict, List

Expand Down
1 change: 1 addition & 0 deletions tests/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- SimpleFunctions: Creation of objects
- ComplexFunctions: Functions, that uses multiple simple functions.
"""

import unittest
from logging import DEBUG
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- AddingPathways: Functions, that manage the addition of Pathways into the
metabolic models.
"""

import logging
import unittest
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
In this module, the creation of genes for multiple function and their behavior
are checked
"""

import logging
import unittest
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
In this modules, the new algorithm is tested. The TestCase GraphTesting checks
that the behavior of all important functions works as intended
"""

import unittest
from pathlib import Path
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- ShortModel: This should utilize the textbook_biocyc model from cobramod.
- LargeModel: Uses a real GEM
"""

import unittest
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- TestPlantCyc: For PlantCyc
- TestSolcyc: For SolCyc
"""

import unittest
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_pathway.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
new child of :obj:`cobra.core.group.Group` "Pathway". This new class is able
to use Escher for its visualizations.
"""

import unittest
from json import loads
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Unit-test for data retrieval and Data version configuration. It checks that
the files are loaded and saved properly
"""

import logging
import shutil
import tempfile
Expand Down
1 change: 1 addition & 0 deletions tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This modules checks functions responsable for the creation of txt, csv and xlsx
files.
"""

import tempfile
from pathlib import Path
from unittest import TestCase, main
Expand Down
1 change: 1 addition & 0 deletions tests/test_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Check if models are available
"""

import unittest
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- TestItems: Creation and behavior of JSON objects for the Escher-schema
- TestJsonDictionary: Testing the methods inside the JsonDictionary
"""

import unittest
from contextlib import suppress
from pathlib import Path
Expand Down

0 comments on commit 5c522f5

Please sign in to comment.