Skip to content

Comments

Markush V2#58

Open
TimurGimadiev wants to merge 3 commits intochython:masterfrom
TimurGimadiev:markush
Open

Markush V2#58
TimurGimadiev wants to merge 3 commits intochython:masterfrom
TimurGimadiev:markush

Conversation

@TimurGimadiev
Copy link
Member

Markush container for chython V2

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

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