adding a new @classmethod to an existing class
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 15/100
Direzione di ricerca
Verifica innanzitutto se questa richiesta rientra in python-guide: il payload è rivolto a opencadd.structure.core.Structure anziché a un file della guida. Se rientra nell’ambito, leggi Structure.from_pdbid e gli entry point mmtf/MMCIFParser indicati; il lavoro è completo quando esiste un modo definito e testato per costruire oggetti Structure da file CIF locali.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Batchfile
- Stelle
- 29.8k
- Fork
- 5.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di realpython/python-guide
-
Page 404 error Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
realpython/python-guide#1104 · 2 commenti ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
realpython/python-guide#327 ·
-
PyZMQ improvements Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
realpython/python-guide#326 · 5 commenti ·
-
@alex Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
realpython/python-guide#1194 ·
-
Development Team SAP Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
realpython/python-guide#1192 ·
Tutte le issue di realpython/python-guide
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
connectrpc/connect-py#342 ·
-
01 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
plone/cookieplone-templates#471 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
notch8/utk_knapsack#148 ·
-
helsemelding-json-schema json-schema-core
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100