本文整理汇总了Python中pymongo.connection.Connection.find方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.find方法的具体用法?Python Connection.find怎么用?Python Connection.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymongo.connection.Connection
的用法示例。
在下文中一共展示了Connection.find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from pymongo.connection import Connection [as 别名]
# 或者: from pymongo.connection.Connection import find [as 别名]
# for F in li[0:1]:
count += 1
print "%d of %d: %s" % (count, tot, F)
degree, weight, A, B, hodge, gal2, gal3, gal5, gal7 = F
Astr = '.'.join([str(x) for x in A])
Bstr = '.'.join([str(x) for x in B])
label = "A%s_B%s" % (Astr, Bstr)
data = {
'label': label,
'degree': degree,
'weight': weight,
'A': A,
'B': B,
'hodge': hodge,
'gal2': gal2,
'gal3': gal3,
'gal5': gal5,
'gal7': gal7
}
is_new = True
for field in hgm.find({'label': label}):
is_new = False
break
if is_new:
print "new family"
hgm.save(data)
else:
print "Have this one"
示例2: coeff_to_poly
# 需要导入模块: from pymongo.connection import Connection [as 别名]
# 或者: from pymongo.connection.Connection import find [as 别名]
pol = coeff_to_poly(coeffs)
K = NumberField(pol, 'a')
D = str(D)
data = {
'degree': d,
'disc_abs_key': dstr,
'disc_sign': s,
'ramps': ramps,
'coeffs': makels(coeffs),
'signature': makels(sig)
}
index = 1
is_new = True
holdfield = ''
for field in fields.find({'degree': d,
'signature': data['signature'],
'disc_abs_key': dstr}):
index += 1
if field['coeffs'] == data['coeffs']:
holdfield = field
is_new = False
break
if is_new:
print "new field"
label = base_label(d, sig[0], absD, index)
info = {'label': label}
try:
cltime = time.time()
h, clg, uk, reg = getclgroup(K)
cltimeend = time.time()
示例3: abs
# 需要导入模块: from pymongo.connection import Connection [as 别名]
# 或者: from pymongo.connection.Connection import find [as 别名]
t = time.time()
d, sig, D, coeffs, h, cyc, GG = F
absD = abs(D)
data = {
"degree": d,
"signature": sig,
"discriminant": D,
"coefficients": coeffs,
"class_number": h,
"class_group": cyc,
"galois_group": GG,
}
index = 1
is_new = True
for field in fields.find({"degree": d, "signature": sig, "discriminant": D}):
index += 1
if field["coefficients"] == coeffs:
is_new = False
break
if is_new:
print "new field"
label = base_label(d, sig[0], absD, index)
info = {"label": label}
info.update(data)
print "entering %s into database" % info
fields.save(info)
else:
print "field already in database"
if time.time() - t > 5:
示例4:
# 需要导入模块: from pymongo.connection import Connection [as 别名]
# 或者: from pymongo.connection.Connection import find [as 别名]
't': t,
'u': u,
'unram': unram,
'eisen': eisen,
'rf': rf,
'hw': hw,
'gms': gms,
'aut': aut,
'galT': galT
}
index = 1
is_new = True
holdfield = {}
for field in fields.find({'p': p,
'n': n,
'c': c}):
index += 1
if field['coeffs'] == coeffs:
is_new = False
holdfield = field
break
if is_new:
print "new field"
label = base_label(p, n, c, index)
info = {'label': label}
info.update(data)
print "entering %s into database" % info
fields.save(info)
else: