adding a new @classmethod to an existing class
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 15/100
Direção de pesquisa
Primeiro, verifique se esta solicitação pertence ao python-guide: o payload tem como alvo opencadd.structure.core.Structure, e não um arquivo do guia. Se estiver no escopo, leia Structure.from_pdbid e os entry points nomeados de mmtf/MMCIFParser; o trabalho estará concluído quando houver uma forma definida e testada de construir objetos Structure a partir de arquivos CIF locais.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
I have a python programming issue which I have not solved.
In python3, using 'from opencadd.structure.core import Structure'
defines the class Structure. The section of the Structure code that I need to modify is
@classmethod
@redo.retriable(attempts=10, sleeptime=2)
def from_pdbid(cls, pdbid):
import mmtf
return cls(mmtf.fetch(pdbid))
where I would like to include
# New method for CIF files
@classmethod
def from_cif(cls, filepath: str):
"""
Create a Structure object from a local CIF file.
"""
parser = MMCIFParser()
structure_data = parser.get_structure("cif_file", filepath)
# ... (processing to build Volkamer Structure object)
return cls(atoms, residues, bonds)
This will skip trying to execute mmtf.fetch (which will timeout because pdb is no longer available for mmtf.fetch).
Instead using Structure.from_cif will avoid this issue and retrieve the file.
So far, I have not been able to do this successfully. Many blogs offer suggestions about adding a classmethod,
but I have failed and am asking for help from python exports.
Thanks in advance,
David
Fortran, R, Matlab, C, AWK, Perl, no Python
- Linguagem predominante
- Batchfile
- Estrelas
- 29.8k
- Forks
- 5.9k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de realpython/python-guide
-
Page 404 error Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 65/100
realpython/python-guide#1104 · 2 comentários ·
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 62/100
realpython/python-guide#327 ·
-
PyZMQ improvements Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
realpython/python-guide#326 · 5 comentários ·
-
@alex Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 10/100
realpython/python-guide#1194 ·
-
Development Team SAP Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 10/100
realpython/python-guide#1192 ·
Todas as issues de realpython/python-guide
Issues semelhantes
-
[FEATURE]: Bump gitlab-ai-provider to 6.15.1 on v2 (Fable 5.1, GPT-6 Astra, workflow reconnect fix) Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
registrystack/registry-stack#1239 ·
-
bug priority:normal ready-for-dev
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
OpenHands/extensions#626 · 1 comentário ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
avniproject/avni-client#2135 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100