Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/io sbml #1182

Merged
merged 6 commits into from
Mar 21, 2022
Merged

Refactor/io sbml #1182

merged 6 commits into from
Mar 21, 2022

Conversation

akaviaLab
Copy link
Contributor

  • description of feature/fix
    Updated sbml.py and test_sbml.py to Python 3.6+ including removing future, f-strings, typing. I also made the typing comments in sbml.py to typing annotations.

@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2022

Codecov Report

Merging #1182 (1b0eca1) into devel (7d95a4a) will increase coverage by 0.00%.
The diff coverage is 88.88%.

❗ Current head 1b0eca1 differs from pull request most recent head 2914f57. Consider uploading reports for the commit 2914f57 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##            devel    #1182   +/-   ##
=======================================
  Coverage   83.90%   83.91%           
=======================================
  Files          65       65           
  Lines        5363     5365    +2     
  Branches     1241     1241           
=======================================
+ Hits         4500     4502    +2     
  Misses        553      553           
  Partials      310      310           
Impacted Files Coverage Δ
src/cobra/io/sbml.py 80.11% <88.67%> (ø)
src/cobra/core/gene.py 79.50% <100.00%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d95a4a...2914f57. Read the comment docs.

@akaviaLab
Copy link
Contributor Author

One question, possibly for @cdiener - Why do we have clip(), and not use something like replace(sid, prefix, 1) or regex?

Copy link
Member

@cdiener cdiener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a typo.

src/cobra/io/sbml.py Show resolved Hide resolved
src/cobra/test/test_io/test_sbml.py Outdated Show resolved Hide resolved
@akaviaLab
Copy link
Contributor Author

Fixed typo. Still wondering why we use the function _clip(sid: str, prefix: str) -> str: and not something like replace(sid, prefix, 1). Mostly curious.

@cdiener
Copy link
Member

cdiener commented Mar 14, 2022

Fixed typo. Still wondering why we use the function _clip(sid: str, prefix: str) -> str: and not something like replace(sid, prefix, 1). Mostly curious.

Because, str.replace replaces anywhere in the string but we only want to replace at the beginning of the string here. And str.lstrip only works with single characters.

src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
src/cobra/io/sbml.py Outdated Show resolved Hide resolved
model using read_function in IOTrail.
This can be used to compare the original model, test model and the written and
reread model.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second parameter.

Copy link
Member

@synchon synchon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments. Thank you for the work!

@synchon
Copy link
Member

synchon commented Mar 16, 2022

Although a lot a documentation comments, but it is just to help us move faster to enabling flake8 check. A general comment: please try to maintain the nummpydoc documentation conventions.

You have also put a lot of type annotations on variables in the module scope, not really sure if we are doing that. Maybe others can vote for the decision.

@akaviaLab
Copy link
Contributor Author

Although a lot a documentation comments, but it is just to help us move faster to enabling flake8 check. A general comment: please try to maintain the nummpydoc documentation conventions.

You have also put a lot of type annotations on variables in the module scope, not really sure if we are doing that. Maybe others can vote for the decision.

Originally, there were a lot of type annotation comments in this file. Annotation comments are Python 2 compliant, so I updated them to Python 3.

@synchon
Copy link
Member

synchon commented Mar 17, 2022

Although a lot a documentation comments, but it is just to help us move faster to enabling flake8 check. A general comment: please try to maintain the nummpydoc documentation conventions.
You have also put a lot of type annotations on variables in the module scope, not really sure if we are doing that. Maybe others can vote for the decision.

Originally, there were a lot of type annotation comments in this file. Annotation comments are Python 2 compliant, so I updated them to Python 3.

Yeah I understood why you did those but I don't know if we want those converted now, so left it open for suggestions.

@synchon
Copy link
Member

synchon commented Mar 18, 2022

@akaviaLab Let's keep the variable type annotation for now. If needed, we can remove it the future.

@synchon
Copy link
Member

synchon commented Mar 18, 2022

I'm okay with the changes. @cdiener If it's okay with you as well, we can merge the PR.

Copy link
Member

@cdiener cdiener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cdiener cdiener merged commit 1beff24 into opencobra:devel Mar 21, 2022
@akaviaLab akaviaLab deleted the refactor/io_sbml branch April 25, 2022 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants