How to use chomp method in molecule

Best Python code snippet using molecule_python

chomp.py

Source:chomp.py Github

copy

Full Screen

...10"""11from __future__ import print_function12import re13_have_chomp = {}14def have_chomp(program='homsimpl'):15 """16 Return True if this computer has ``program`` installed.17 The first time it is run, this function caches its result in the18 variable ``_have_chomp`` -- a dictionary indexed by program name19 -- and any subsequent time, it just checks the value of the20 variable.21 This program is used in the routine CHomP.__call__.22 If this computer doesn't have CHomP installed, you may obtain it23 from http://chomp.rutgers.edu/.24 EXAMPLES::25 sage: from sage.interfaces.chomp import have_chomp26 sage: have_chomp() # random -- depends on whether CHomP is installed27 True28 sage: 'homsimpl' in sage.interfaces.chomp._have_chomp29 True30 sage: sage.interfaces.chomp._have_chomp['homsimpl'] == have_chomp()31 True32 """33 global _have_chomp34 if program not in _have_chomp:35 from sage.misc.sage_ostools import have_program36 _have_chomp[program] = have_program(program)37 return _have_chomp[program]38class CHomP:39 r"""40 Interface to the CHomP package.41 :param program: which CHomP program to use42 :type program: string43 :param complex: a simplicial or cubical complex44 :param subcomplex: a subcomplex of ``complex`` or None (the default)45 :param base_ring: ring over which to perform computations -- must be `\ZZ` or `\GF{p}`.46 :type base_ring: ring; optional, default `\ZZ`47 :param generators: if True, also return list of generators48 :type generators: boolean; optional, default False49 :param verbose: if True, print helpful messages as the computation50 progresses51 :type verbose: boolean; optional, default False52 :param extra_opts: options passed directly to ``program``53 :type extra_opts: string54 :return: homology groups as a dictionary indexed by dimension55 The programs ``homsimpl``, ``homcubes``, and ``homchain`` are56 available through this interface. ``homsimpl`` computes the57 relative or absolute homology groups of simplicial complexes.58 ``homcubes`` computes the relative or absolute homology groups of59 cubical complexes. ``homchain`` computes the homology groups of60 chain complexes. For consistency with Sage's other homology61 computations, the answers produced by ``homsimpl`` and62 ``homcubes`` in the absolute case are converted to reduced63 homology.64 Note also that CHomP can only compute over the integers or65 `\GF{p}`. CHomP is fast enough, though, that if you want66 rational information, you should consider using CHomP with integer67 coefficients, or with mod `p` coefficients for a sufficiently68 large `p`, rather than using Sage's built-in homology algorithms.69 See also the documentation for the functions :func:`homchain`,70 :func:`homcubes`, and :func:`homsimpl` for more examples,71 including illustrations of some of the optional parameters.72 EXAMPLES::73 sage: from sage.interfaces.chomp import CHomP74 sage: T = cubical_complexes.Torus()75 sage: CHomP()('homcubes', T) # optional - CHomP76 {0: 0, 1: Z x Z, 2: Z}77 Relative homology of a segment relative to its endpoints::78 sage: edge = simplicial_complexes.Simplex(1)79 sage: ends = edge.n_skeleton(0)80 sage: CHomP()('homsimpl', edge) # optional - CHomP81 {0: 0}82 sage: CHomP()('homsimpl', edge, ends) # optional - CHomP83 {0: 0, 1: Z}84 Homology of a chain complex::85 sage: C = ChainComplex({3: 2 * identity_matrix(ZZ, 2)}, degree=-1)86 sage: CHomP()('homchain', C) # optional - CHomP87 {2: C2 x C2}88 """89 def __repr__(self):90 """91 String representation.92 EXAMPLES::93 sage: from sage.interfaces.chomp import CHomP94 sage: CHomP() # indirect doctest95 CHomP interface96 """97 return "CHomP interface"98 def __call__(self, program, complex, subcomplex=None, **kwds):99 """100 Call a CHomP program to compute the homology of a chain101 complex, simplicial complex, or cubical complex.102 See :class:`CHomP` for full documentation.103 EXAMPLES::104 sage: from sage.interfaces.chomp import CHomP105 sage: T = cubical_complexes.Torus()106 sage: CHomP()('homcubes', T) # indirect doctest, optional - CHomP107 {0: 0, 1: Z x Z, 2: Z}108 """109 from sage.misc.temporary_file import tmp_filename110 from sage.homology.all import CubicalComplex, cubical_complexes111 from sage.homology.all import SimplicialComplex, Simplex112 from sage.homology.chain_complex import HomologyGroup113 from subprocess import Popen, PIPE114 from sage.rings.all import QQ, ZZ115 from sage.modules.all import VectorSpace, vector116 from sage.combinat.free_module import CombinatorialFreeModule117 if not have_chomp(program):118 raise OSError("Program %s not found" % program)119 verbose = kwds.get('verbose', False)120 generators = kwds.get('generators', False)121 extra_opts = kwds.get('extra_opts', '')122 base_ring = kwds.get('base_ring', ZZ)123 if extra_opts:124 extra_opts = extra_opts.split()125 else:126 extra_opts = []127 # type of complex:128 cubical = False129 simplicial = False130 chain = False131 # CHomP seems to have problems with cubical complexes if the...

Full Screen

Full Screen

Chomp_GameListener.py

Source:Chomp_GameListener.py Github

copy

Full Screen

1# Generated from Chomp_Game.g4 by ANTLR 4.7.12from antlr4 import *3if __name__ is not None and "." in __name__:4 from .Chomp_GameParser import Chomp_GameParser5else:6 from Chomp_GameParser import Chomp_GameParser7# This class defines a complete listener for a parse tree produced by Chomp_GameParser.8class Chomp_GameListener(ParseTreeListener):9 # Enter a parse tree produced by Chomp_GameParser#domain.10 def enterDomain(self, ctx:Chomp_GameParser.DomainContext):11 pass12 # Exit a parse tree produced by Chomp_GameParser#domain.13 def exitDomain(self, ctx:Chomp_GameParser.DomainContext):14 pass15 # Enter a parse tree produced by Chomp_GameParser#objectDefine.16 def enterObjectDefine(self, ctx:Chomp_GameParser.ObjectDefineContext):17 pass18 # Exit a parse tree produced by Chomp_GameParser#objectDefine.19 def exitObjectDefine(self, ctx:Chomp_GameParser.ObjectDefineContext):20 pass21 # Enter a parse tree produced by Chomp_GameParser#numericDefine.22 def enterNumericDefine(self, ctx:Chomp_GameParser.NumericDefineContext):23 pass24 # Exit a parse tree produced by Chomp_GameParser#numericDefine.25 def exitNumericDefine(self, ctx:Chomp_GameParser.NumericDefineContext):26 pass27 # Enter a parse tree produced by Chomp_GameParser#numericSymbol.28 def enterNumericSymbol(self, ctx:Chomp_GameParser.NumericSymbolContext):29 pass30 # Exit a parse tree produced by Chomp_GameParser#numericSymbol.31 def exitNumericSymbol(self, ctx:Chomp_GameParser.NumericSymbolContext):32 pass33 # Enter a parse tree produced by Chomp_GameParser#typeDefine.34 def enterTypeDefine(self, ctx:Chomp_GameParser.TypeDefineContext):35 pass36 # Exit a parse tree produced by Chomp_GameParser#typeDefine.37 def exitTypeDefine(self, ctx:Chomp_GameParser.TypeDefineContext):38 pass39 # Enter a parse tree produced by Chomp_GameParser#terconditionDefine.40 def enterTerconditionDefine(self, ctx:Chomp_GameParser.TerconditionDefineContext):41 pass42 # Exit a parse tree produced by Chomp_GameParser#terconditionDefine.43 def exitTerconditionDefine(self, ctx:Chomp_GameParser.TerconditionDefineContext):44 pass45 # Enter a parse tree produced by Chomp_GameParser#predicateDefine.46 def enterPredicateDefine(self, ctx:Chomp_GameParser.PredicateDefineContext):47 pass48 # Exit a parse tree produced by Chomp_GameParser#predicateDefine.49 def exitPredicateDefine(self, ctx:Chomp_GameParser.PredicateDefineContext):50 pass51 # Enter a parse tree produced by Chomp_GameParser#atomFormSkeleton.52 def enterAtomFormSkeleton(self, ctx:Chomp_GameParser.AtomFormSkeletonContext):53 pass54 # Exit a parse tree produced by Chomp_GameParser#atomFormSkeleton.55 def exitAtomFormSkeleton(self, ctx:Chomp_GameParser.AtomFormSkeletonContext):56 pass57 # Enter a parse tree produced by Chomp_GameParser#predicate.58 def enterPredicate(self, ctx:Chomp_GameParser.PredicateContext):59 pass60 # Exit a parse tree produced by Chomp_GameParser#predicate.61 def exitPredicate(self, ctx:Chomp_GameParser.PredicateContext):62 pass63 # Enter a parse tree produced by Chomp_GameParser#typeDeclaration.64 def enterTypeDeclaration(self, ctx:Chomp_GameParser.TypeDeclarationContext):65 pass66 # Exit a parse tree produced by Chomp_GameParser#typeDeclaration.67 def exitTypeDeclaration(self, ctx:Chomp_GameParser.TypeDeclarationContext):68 pass69 # Enter a parse tree produced by Chomp_GameParser#type.70 def enterType(self, ctx:Chomp_GameParser.TypeContext):71 pass72 # Exit a parse tree produced by Chomp_GameParser#type.73 def exitType(self, ctx:Chomp_GameParser.TypeContext):74 pass75 # Enter a parse tree produced by Chomp_GameParser#actionDefine.76 def enterActionDefine(self, ctx:Chomp_GameParser.ActionDefineContext):77 pass78 # Exit a parse tree produced by Chomp_GameParser#actionDefine.79 def exitActionDefine(self, ctx:Chomp_GameParser.ActionDefineContext):80 pass81 # Enter a parse tree produced by Chomp_GameParser#actionSymbol.82 def enterActionSymbol(self, ctx:Chomp_GameParser.ActionSymbolContext):83 pass84 # Exit a parse tree produced by Chomp_GameParser#actionSymbol.85 def exitActionSymbol(self, ctx:Chomp_GameParser.ActionSymbolContext):86 pass87 # Enter a parse tree produced by Chomp_GameParser#emptyOrPreGD.88 def enterEmptyOrPreGD(self, ctx:Chomp_GameParser.EmptyOrPreGDContext):89 pass90 # Exit a parse tree produced by Chomp_GameParser#emptyOrPreGD.91 def exitEmptyOrPreGD(self, ctx:Chomp_GameParser.EmptyOrPreGDContext):92 pass93 # Enter a parse tree produced by Chomp_GameParser#emptyOrEffect.94 def enterEmptyOrEffect(self, ctx:Chomp_GameParser.EmptyOrEffectContext):95 pass96 # Exit a parse tree produced by Chomp_GameParser#emptyOrEffect.97 def exitEmptyOrEffect(self, ctx:Chomp_GameParser.EmptyOrEffectContext):98 pass99 # Enter a parse tree produced by Chomp_GameParser#listName.100 def enterListName(self, ctx:Chomp_GameParser.ListNameContext):101 pass102 # Exit a parse tree produced by Chomp_GameParser#listName.103 def exitListName(self, ctx:Chomp_GameParser.ListNameContext):104 pass105 # Enter a parse tree produced by Chomp_GameParser#listVariable.106 def enterListVariable(self, ctx:Chomp_GameParser.ListVariableContext):107 pass108 # Exit a parse tree produced by Chomp_GameParser#listVariable.109 def exitListVariable(self, ctx:Chomp_GameParser.ListVariableContext):110 pass111 # Enter a parse tree produced by Chomp_GameParser#oneofDefine.112 def enterOneofDefine(self, ctx:Chomp_GameParser.OneofDefineContext):113 pass114 # Exit a parse tree produced by Chomp_GameParser#oneofDefine.115 def exitOneofDefine(self, ctx:Chomp_GameParser.OneofDefineContext):116 pass117 # Enter a parse tree produced by Chomp_GameParser#gd.118 def enterGd(self, ctx:Chomp_GameParser.GdContext):119 pass120 # Exit a parse tree produced by Chomp_GameParser#gd.121 def exitGd(self, ctx:Chomp_GameParser.GdContext):122 pass123 # Enter a parse tree produced by Chomp_GameParser#termAtomForm.124 def enterTermAtomForm(self, ctx:Chomp_GameParser.TermAtomFormContext):125 pass126 # Exit a parse tree produced by Chomp_GameParser#termAtomForm.127 def exitTermAtomForm(self, ctx:Chomp_GameParser.TermAtomFormContext):128 pass129 # Enter a parse tree produced by Chomp_GameParser#termLiteral.130 def enterTermLiteral(self, ctx:Chomp_GameParser.TermLiteralContext):131 pass132 # Exit a parse tree produced by Chomp_GameParser#termLiteral.133 def exitTermLiteral(self, ctx:Chomp_GameParser.TermLiteralContext):134 pass135 # Enter a parse tree produced by Chomp_GameParser#constTerm.136 def enterConstTerm(self, ctx:Chomp_GameParser.ConstTermContext):137 pass138 # Exit a parse tree produced by Chomp_GameParser#constTerm.139 def exitConstTerm(self, ctx:Chomp_GameParser.ConstTermContext):140 pass141 # Enter a parse tree produced by Chomp_GameParser#term.142 def enterTerm(self, ctx:Chomp_GameParser.TermContext):143 pass144 # Exit a parse tree produced by Chomp_GameParser#term.145 def exitTerm(self, ctx:Chomp_GameParser.TermContext):146 pass147 # Enter a parse tree produced by Chomp_GameParser#effect.148 def enterEffect(self, ctx:Chomp_GameParser.EffectContext):149 pass150 # Exit a parse tree produced by Chomp_GameParser#effect.151 def exitEffect(self, ctx:Chomp_GameParser.EffectContext):152 pass153 # Enter a parse tree produced by Chomp_GameParser#assignop.154 def enterAssignop(self, ctx:Chomp_GameParser.AssignopContext):155 pass156 # Exit a parse tree produced by Chomp_GameParser#assignop.157 def exitAssignop(self, ctx:Chomp_GameParser.AssignopContext):158 pass159 # Enter a parse tree produced by Chomp_GameParser#pEffect.160 def enterPEffect(self, ctx:Chomp_GameParser.PEffectContext):161 pass162 # Exit a parse tree produced by Chomp_GameParser#pEffect.163 def exitPEffect(self, ctx:Chomp_GameParser.PEffectContext):164 pass165 # Enter a parse tree produced by Chomp_GameParser#problemName.166 def enterProblemName(self, ctx:Chomp_GameParser.ProblemNameContext):167 pass168 # Exit a parse tree produced by Chomp_GameParser#problemName.169 def exitProblemName(self, ctx:Chomp_GameParser.ProblemNameContext):170 pass171 # Enter a parse tree produced by Chomp_GameParser#domainName.172 def enterDomainName(self, ctx:Chomp_GameParser.DomainNameContext):173 pass174 # Exit a parse tree produced by Chomp_GameParser#domainName.175 def exitDomainName(self, ctx:Chomp_GameParser.DomainNameContext):176 pass177 # Enter a parse tree produced by Chomp_GameParser#agentDefine.178 def enterAgentDefine(self, ctx:Chomp_GameParser.AgentDefineContext):179 pass180 # Exit a parse tree produced by Chomp_GameParser#agentDefine.181 def exitAgentDefine(self, ctx:Chomp_GameParser.AgentDefineContext):182 pass183 # Enter a parse tree produced by Chomp_GameParser#objectDeclaration.184 def enterObjectDeclaration(self, ctx:Chomp_GameParser.ObjectDeclarationContext):185 pass186 # Exit a parse tree produced by Chomp_GameParser#objectDeclaration.187 def exitObjectDeclaration(self, ctx:Chomp_GameParser.ObjectDeclarationContext):188 pass189 # Enter a parse tree produced by Chomp_GameParser#numericSetting.190 def enterNumericSetting(self, ctx:Chomp_GameParser.NumericSettingContext):191 pass192 # Exit a parse tree produced by Chomp_GameParser#numericSetting.193 def exitNumericSetting(self, ctx:Chomp_GameParser.NumericSettingContext):194 pass195 # Enter a parse tree produced by Chomp_GameParser#init.196 def enterInit(self, ctx:Chomp_GameParser.InitContext):197 pass198 # Exit a parse tree produced by Chomp_GameParser#init.199 def exitInit(self, ctx:Chomp_GameParser.InitContext):200 pass201 # Enter a parse tree produced by Chomp_GameParser#constTermAtomForm.202 def enterConstTermAtomForm(self, ctx:Chomp_GameParser.ConstTermAtomFormContext):203 pass204 # Exit a parse tree produced by Chomp_GameParser#constTermAtomForm.205 def exitConstTermAtomForm(self, ctx:Chomp_GameParser.ConstTermAtomFormContext):...

Full Screen

Full Screen

Chomp_GameVisitor.py

Source:Chomp_GameVisitor.py Github

copy

Full Screen

1# Generated from Chomp_Game.g4 by ANTLR 4.7.12from antlr4 import *3if __name__ is not None and "." in __name__:4 from .Chomp_GameParser import Chomp_GameParser5else:6 from Chomp_GameParser import Chomp_GameParser7# This class defines a complete generic visitor for a parse tree produced by Chomp_GameParser.8class Chomp_GameVisitor(ParseTreeVisitor):9 # Visit a parse tree produced by Chomp_GameParser#domain.10 def visitDomain(self, ctx:Chomp_GameParser.DomainContext):11 return self.visitChildren(ctx)12 # Visit a parse tree produced by Chomp_GameParser#objectDefine.13 def visitObjectDefine(self, ctx:Chomp_GameParser.ObjectDefineContext):14 return self.visitChildren(ctx)15 # Visit a parse tree produced by Chomp_GameParser#numericDefine.16 def visitNumericDefine(self, ctx:Chomp_GameParser.NumericDefineContext):17 return self.visitChildren(ctx)18 # Visit a parse tree produced by Chomp_GameParser#numericSymbol.19 def visitNumericSymbol(self, ctx:Chomp_GameParser.NumericSymbolContext):20 return self.visitChildren(ctx)21 # Visit a parse tree produced by Chomp_GameParser#typeDefine.22 def visitTypeDefine(self, ctx:Chomp_GameParser.TypeDefineContext):23 return self.visitChildren(ctx)24 # Visit a parse tree produced by Chomp_GameParser#terconditionDefine.25 def visitTerconditionDefine(self, ctx:Chomp_GameParser.TerconditionDefineContext):26 return self.visitChildren(ctx)27 # Visit a parse tree produced by Chomp_GameParser#predicateDefine.28 def visitPredicateDefine(self, ctx:Chomp_GameParser.PredicateDefineContext):29 return self.visitChildren(ctx)30 # Visit a parse tree produced by Chomp_GameParser#atomFormSkeleton.31 def visitAtomFormSkeleton(self, ctx:Chomp_GameParser.AtomFormSkeletonContext):32 return self.visitChildren(ctx)33 # Visit a parse tree produced by Chomp_GameParser#predicate.34 def visitPredicate(self, ctx:Chomp_GameParser.PredicateContext):35 return self.visitChildren(ctx)36 # Visit a parse tree produced by Chomp_GameParser#typeDeclaration.37 def visitTypeDeclaration(self, ctx:Chomp_GameParser.TypeDeclarationContext):38 return self.visitChildren(ctx)39 # Visit a parse tree produced by Chomp_GameParser#type.40 def visitType(self, ctx:Chomp_GameParser.TypeContext):41 return self.visitChildren(ctx)42 # Visit a parse tree produced by Chomp_GameParser#actionDefine.43 def visitActionDefine(self, ctx:Chomp_GameParser.ActionDefineContext):44 return self.visitChildren(ctx)45 # Visit a parse tree produced by Chomp_GameParser#actionSymbol.46 def visitActionSymbol(self, ctx:Chomp_GameParser.ActionSymbolContext):47 return self.visitChildren(ctx)48 # Visit a parse tree produced by Chomp_GameParser#emptyOrPreGD.49 def visitEmptyOrPreGD(self, ctx:Chomp_GameParser.EmptyOrPreGDContext):50 return self.visitChildren(ctx)51 # Visit a parse tree produced by Chomp_GameParser#emptyOrEffect.52 def visitEmptyOrEffect(self, ctx:Chomp_GameParser.EmptyOrEffectContext):53 return self.visitChildren(ctx)54 # Visit a parse tree produced by Chomp_GameParser#listName.55 def visitListName(self, ctx:Chomp_GameParser.ListNameContext):56 return self.visitChildren(ctx)57 # Visit a parse tree produced by Chomp_GameParser#listVariable.58 def visitListVariable(self, ctx:Chomp_GameParser.ListVariableContext):59 return self.visitChildren(ctx)60 # Visit a parse tree produced by Chomp_GameParser#oneofDefine.61 def visitOneofDefine(self, ctx:Chomp_GameParser.OneofDefineContext):62 return self.visitChildren(ctx)63 # Visit a parse tree produced by Chomp_GameParser#gd.64 def visitGd(self, ctx:Chomp_GameParser.GdContext):65 return self.visitChildren(ctx)66 # Visit a parse tree produced by Chomp_GameParser#termAtomForm.67 def visitTermAtomForm(self, ctx:Chomp_GameParser.TermAtomFormContext):68 return self.visitChildren(ctx)69 # Visit a parse tree produced by Chomp_GameParser#termLiteral.70 def visitTermLiteral(self, ctx:Chomp_GameParser.TermLiteralContext):71 return self.visitChildren(ctx)72 # Visit a parse tree produced by Chomp_GameParser#constTerm.73 def visitConstTerm(self, ctx:Chomp_GameParser.ConstTermContext):74 return self.visitChildren(ctx)75 # Visit a parse tree produced by Chomp_GameParser#term.76 def visitTerm(self, ctx:Chomp_GameParser.TermContext):77 return self.visitChildren(ctx)78 # Visit a parse tree produced by Chomp_GameParser#effect.79 def visitEffect(self, ctx:Chomp_GameParser.EffectContext):80 return self.visitChildren(ctx)81 # Visit a parse tree produced by Chomp_GameParser#assignop.82 def visitAssignop(self, ctx:Chomp_GameParser.AssignopContext):83 return self.visitChildren(ctx)84 # Visit a parse tree produced by Chomp_GameParser#pEffect.85 def visitPEffect(self, ctx:Chomp_GameParser.PEffectContext):86 return self.visitChildren(ctx)87 # Visit a parse tree produced by Chomp_GameParser#problemName.88 def visitProblemName(self, ctx:Chomp_GameParser.ProblemNameContext):89 return self.visitChildren(ctx)90 # Visit a parse tree produced by Chomp_GameParser#domainName.91 def visitDomainName(self, ctx:Chomp_GameParser.DomainNameContext):92 return self.visitChildren(ctx)93 # Visit a parse tree produced by Chomp_GameParser#agentDefine.94 def visitAgentDefine(self, ctx:Chomp_GameParser.AgentDefineContext):95 return self.visitChildren(ctx)96 # Visit a parse tree produced by Chomp_GameParser#objectDeclaration.97 def visitObjectDeclaration(self, ctx:Chomp_GameParser.ObjectDeclarationContext):98 return self.visitChildren(ctx)99 # Visit a parse tree produced by Chomp_GameParser#numericSetting.100 def visitNumericSetting(self, ctx:Chomp_GameParser.NumericSettingContext):101 return self.visitChildren(ctx)102 # Visit a parse tree produced by Chomp_GameParser#init.103 def visitInit(self, ctx:Chomp_GameParser.InitContext):104 return self.visitChildren(ctx)105 # Visit a parse tree produced by Chomp_GameParser#constTermAtomForm.106 def visitConstTermAtomForm(self, ctx:Chomp_GameParser.ConstTermAtomFormContext):107 return self.visitChildren(ctx)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run molecule automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful