Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Markush V2#58

Open
TimurGimadiev wants to merge 3 commits into
chython:masterchython/chython:masterfrom
TimurGimadiev:markushTimurGimadiev/chython:markushCopy head branch name to clipboard
Open

Markush V2#58
TimurGimadiev wants to merge 3 commits into
chython:masterchython/chython:masterfrom
TimurGimadiev:markushTimurGimadiev/chython:markushCopy head branch name to clipboard

Conversation

@TimurGimadiev
Copy link
Copy Markdown
Member

Markush container for chython V2

@TimurGimadiev TimurGimadiev changed the title Markush Markush V2 May 5, 2025

class MarkushContainer:
__slots__ = (
"__meta",
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.

use single under

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.

no need of memory optimizations. drop slots.

from collections import defaultdict
from itertools import product
from typing import Dict, Iterable, Optional

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.

keep imports as a single block

from typing import Dict, Iterable, Optional

from .molecule import Bond, MoleculeContainer

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.

2 lines


from .molecule import Bond, MoleculeContainer

var_atoms = ["X", "Y", "Z"]
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.

use single quotes unless you can't avoid double

)

def __init__(self, substituents: Optional[list["MoleculeContainer"]] = None):
super().__init__()
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.

no need for super

self.__initial_mol = None

@staticmethod
def connect_w_bond(first: MoleculeContainer, other: MoleculeContainer, variables=var_groups):
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.

docstring explaining method usage is required

return first

@staticmethod
def connect_no_bond(first: MoleculeContainer, other: MoleculeContainer, variables=var_atoms):
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.

same here

out.append((token_type, {'element': token}))
elif token_type == 5:
out.append(_atom_parse(token))
if (_match := markush_re.fullmatch(token)) is None:
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.

change to is not None. hard to follow.


@property
def isotopes_distribution(self):
return {n: 0. for n in range(1, 100)}
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.

why not empty dict?

return 0

@property
def group_number(self):
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.

is it working? and why is needed?

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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.