示例#1
0
def validate_label(label):
    parts = label.split(".")
    if len(parts) != 3:
        raise ValueError(
            "it must be of the form g.q.iso, with g a dimension and q a prime power"
        )
    g, q, iso = parts
    try:
        g = int(g)
    except ValueError:
        raise ValueError(
            "it must be of the form g.q.iso, where g is an integer")
    try:
        q = Integer(q)
        if not q.is_prime_power():
            raise ValueError
    except ValueError:
        raise ValueError(
            "it must be of the form g.q.iso, where g is a prime power")
    coeffs = iso.split("_")
    if len(coeffs) != g:
        raise ValueError(
            "the final part must be of the form c1_c2_..._cg, with g=%s components"
            % (g))
    if not all(c.isalpha() and c == c.lower() for c in coeffs):
        raise ValueError(
            "the final part must be of the form c1_c2_..._cg, with each ci consisting of lower case letters"
        )
示例#2
0
def validate_label(label):
    parts = label.split('.')
    if len(parts) != 3:
        raise ValueError("it must be of the form g.q.iso, with g a dimension and q a prime power")
    g, q, iso = parts
    try:
        g = int(g)
    except ValueError:
        raise ValueError("it must be of the form g.q.iso, where g is an integer")
    try:
        q = Integer(q)
        if not q.is_prime_power(): raise ValueError
    except ValueError:
        raise ValueError("it must be of the form g.q.iso, where g is a prime power")
    coeffs = iso.split("_")
    if len(coeffs) != g:
        raise ValueError("the final part must be of the form c1_c2_..._cg, with g=%s components"%(g))
    if not all(c.isalpha() and c==c.lower() for c in coeffs):
        raise ValueError("the final part must be of the form c1_c2_..._cg, with each ci consisting of lower case letters")
示例#3
0
 def r(self):
     q = Integer(self.q)
     _, r = q.is_prime_power(get_data=True)
     return r
示例#4
0
 def p(self):
     q = Integer(self.q)
     p, _ = q.is_prime_power(get_data=True)
     return p
示例#5
0
 def r(self):
     q = Integer(self.q)
     _, r = q.is_prime_power(get_data=True)
     return r
示例#6
0
 def p(self):
     q = Integer(self.q)
     p, _ = q.is_prime_power(get_data=True)
     return p