Skip to content

Commit

Permalink
style: black enforces single newline before imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Midnighter committed Feb 18, 2024
1 parent 914e328 commit ca9b5bd
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 37 deletions.
1 change: 0 additions & 1 deletion src/cobra/core/configuration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide a global configuration object."""


import logging
import pathlib
import types
Expand Down
1 change: 0 additions & 1 deletion src/cobra/core/species.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Define the Species class, used as a base for Gene and Metabolite."""


from copy import deepcopy
from typing import TYPE_CHECKING, FrozenSet, Optional

Expand Down
1 change: 1 addition & 0 deletions src/cobra/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for shared exceptions in the Cobra package."""

import optlang.interface


Expand Down
1 change: 0 additions & 1 deletion src/cobra/flux_analysis/gapfilling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide the base class and utility function for gap filling."""


import logging
from typing import TYPE_CHECKING, Dict, List, Optional, Union

Expand Down
1 change: 0 additions & 1 deletion src/cobra/flux_analysis/loopless.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide functions to remove thermodynamically infeasible loops."""


from typing import TYPE_CHECKING, Dict, Optional, Union

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion src/cobra/flux_analysis/variability.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide variability based methods such as flux variability or gene essentiality."""


import logging
from typing import TYPE_CHECKING, List, Optional, Set, Tuple, Union
from warnings import warn
Expand Down
1 change: 0 additions & 1 deletion src/cobra/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide functions for loading and saving metabolic models."""


from cobra.io.dict import model_from_dict, model_to_dict
from cobra.io.json import from_json, load_json_model, save_json_model, to_json
from cobra.io.mat import load_matlab_model, save_matlab_model
Expand Down
3 changes: 2 additions & 1 deletion src/cobra/io/json.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide functions for I/O in JSON format."""

from pathlib import Path
from typing import IO, TYPE_CHECKING, Any, Union

Expand Down Expand Up @@ -72,7 +73,7 @@ def save_json_model(
filename: Union[str, Path, IO],
sort: bool = False,
pretty: bool = False,
**kwargs: Any
**kwargs: Any,
) -> None:
"""Write the cobra model to a file in JSON format.
Expand Down
30 changes: 18 additions & 12 deletions src/cobra/io/mat.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,23 @@ def _cell_to_str_list(
"""
if str_prefix and pattern_split:
return [
[
str_prefix + str_found if str_prefix not in str_found else str_found
for str_found in pattern_split.findall(str(each_cell[0][0]))
]
if np.size(each_cell[0])
else empty_value
(
[
str_prefix + str_found if str_prefix not in str_found else str_found
for str_found in pattern_split.findall(str(each_cell[0][0]))
]
if np.size(each_cell[0])
else empty_value
)
for each_cell in m_cell
]
elif pattern_split:
return [
pattern_split.findall(str(each_cell[0][0]))
if np.size(each_cell[0])
else empty_value
(
pattern_split.findall(str(each_cell[0][0]))
if np.size(each_cell[0])
else empty_value
)
for each_cell in m_cell
]
else:
Expand Down Expand Up @@ -481,9 +485,11 @@ def mat_parse_notes(
# things like PMC or OMIM, but those are placed as string in notes.
_notes = _cell_to_str_list(mat_struct[caseunfold[mat_key]][0, 0])
notes[name] = [
_pubmed_re.sub("", x).strip()
if x and len(_pubmed_re.sub("", x).strip())
else None
(
_pubmed_re.sub("", x).strip()
if x and len(_pubmed_re.sub("", x).strip())
else None
)
for x in _notes
]
elif mat_key == "rxnConfidenceScores".casefold():
Expand Down
6 changes: 3 additions & 3 deletions src/cobra/io/sbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,9 @@ def _sbml_to_model(
{
"familyName": c.getFamilyName() if c.isSetFamilyName() else None,
"givenName": c.getGivenName() if c.isSetGivenName() else None,
"organisation": c.getOrganisation()
if c.isSetOrganisation()
else None,
"organisation": (
c.getOrganisation() if c.isSetOrganisation() else None
),
"email": c.getEmail() if c.isSetEmail() else None,
}
)
Expand Down
1 change: 0 additions & 1 deletion src/cobra/io/web/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide functionality to access remote model repositories."""


from .abstract_model_repository import AbstractModelRepository
from .bigg_models_repository import BiGGModels
from .biomodels_repository import BioModels
Expand Down
1 change: 0 additions & 1 deletion src/cobra/io/web/abstract_model_repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide an abstract base class that describes a remote model repository."""


from abc import ABC, abstractmethod
from typing import Union

Expand Down
1 change: 0 additions & 1 deletion src/cobra/io/web/bigg_models_repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide a concrete implementation of the BioModels repository interface."""


from io import BytesIO

import httpx
Expand Down
1 change: 0 additions & 1 deletion src/cobra/io/web/biomodels_repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide functions for loading metabolic models over the wire."""


import gzip
from io import BytesIO
from typing import List
Expand Down
1 change: 0 additions & 1 deletion src/cobra/io/web/cobrapy_repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide functions for loading metabolic models from local package data."""


import importlib_resources

import cobra.data
Expand Down
1 change: 0 additions & 1 deletion src/cobra/io/web/load.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide a function ``load_model`` to access remote model repositories."""


import gzip
import logging
from typing import TYPE_CHECKING, Iterable
Expand Down
1 change: 1 addition & 0 deletions src/cobra/manipulation/delete.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide functions for pruning reactions, metabolites and genes."""

import logging
from ast import And, BoolOp, Name, NodeTransformer
from functools import partial
Expand Down
2 changes: 1 addition & 1 deletion src/cobra/sampling/achr.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(
thinning: int = 100,
nproj: Optional[int] = None,
seed: Optional[int] = None,
**kwargs
**kwargs,
) -> None:
"""Initialize a new ACHRSampler."""
super().__init__(model, thinning, nproj=nproj, seed=seed, **kwargs)
Expand Down
3 changes: 1 addition & 2 deletions src/cobra/sampling/optgp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide the OptGP sampler class and helper functions."""


from typing import TYPE_CHECKING, Dict, Optional, Tuple

import numpy as np
Expand Down Expand Up @@ -110,7 +109,7 @@ def __init__(
processes: Optional[int] = None,
nproj: Optional[int] = None,
seed: Optional[int] = None,
**kwargs
**kwargs,
) -> None:
"""Initialize a new OptGPSampler."""
super().__init__(model, thinning, nproj=nproj, seed=seed, *kwargs)
Expand Down
1 change: 0 additions & 1 deletion src/cobra/summary/metabolite_summary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide the metabolite summary class."""


import logging
from operator import attrgetter
from textwrap import shorten
Expand Down
1 change: 0 additions & 1 deletion src/cobra/summary/model_summary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide the model summary class."""


import logging
from operator import attrgetter
from typing import TYPE_CHECKING, Dict, List, Optional, Union
Expand Down
1 change: 0 additions & 1 deletion src/cobra/summary/reaction_summary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide the reaction summary class."""


import logging
from textwrap import dedent, shorten
from typing import TYPE_CHECKING, Optional, Union
Expand Down
1 change: 0 additions & 1 deletion src/cobra/summary/summary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide the abstract base summary class."""


import logging
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Optional, Union
Expand Down
3 changes: 1 addition & 2 deletions src/cobra/util/process_pool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Provide a process pool with enhanced performance on Windows."""


import multiprocessing
import os
import pickle
Expand Down Expand Up @@ -30,7 +29,7 @@ def __init__(
initializer: Optional[Callable] = None,
initargs: Tuple = (),
maxtasksperchild: Optional[int] = None,
**kwargs
**kwargs,
) -> None:
"""
Initialize a process pool.
Expand Down

0 comments on commit ca9b5bd

Please sign in to comment.