Skip to content

SOF-7915: export physical constants via python interface#46

Open
pranabdas wants to merge 21 commits into
mainfrom
feat/SOF-7915
Open

SOF-7915: export physical constants via python interface#46
pranabdas wants to merge 21 commits into
mainfrom
feat/SOF-7915

Conversation

@pranabdas

Copy link
Copy Markdown
Member

No description provided.

Comment thread src/py/mat3ra/utils/string.py Outdated
return re.sub(r"[!#].*$", "", text, flags=re.MULTILINE)

# Default (shell): Removes lines starting with # (except shebang)
return re.sub(r"^(\s+)?#(?!!).*$", "", text, flags=re.MULTILINE)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we remove inline comments as well?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't # not a comment mark in Fortran?

Googling gives: # shows up in Fortran files mainly from the C preprocessor (#include, #ifdef, etc.) -- probably should not be deleted

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are right. Thank you, Seth.

Comment thread src/py/mat3ra/utils/string.py Outdated
return re.sub(r"#.*$", "", text, flags=re.MULTILINE)
return re.sub(r"#(?!!).*$", "", text, flags=re.MULTILINE)
patterns = {
"espresso": r"[!#].*$", # ! or # comments

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utils should not know about espresso

remove espresso comments by chaining fortran and python comments
) -> Any:
"""
Executes a regex search using a configuration schema block.
The schema is based on the regex repo:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be defined inside the regex repo then

return python_flags


def regex_search(content: str, pattern: Union[str, re.Pattern], flags: int = 0, find_all: bool = False) -> Any:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should have a test for it

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.

3 participants