input stringlengths 11 7.65k | target stringlengths 22 8.26k |
|---|---|
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def list_instances(
self,
) -> Callable[[appengine.ListInstancesRequest], appengine.ListInstancesResponse]:
r"""Return a callable for the list instances method over gRPC.
Lists the instances of a version.
Tip: To aggregate details about instances over time, see the
`Stackdr... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def get_instance(
self,
) -> Callable[[appengine.GetInstanceRequest], instance.Instance]:
r"""Return a callable for the get instance method over gRPC.
Gets instance information.
Returns:
Callable[[~.GetInstanceRequest],
~.Instance]:
A... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def delete_instance(
self,
) -> Callable[[appengine.DeleteInstanceRequest], operations_pb2.Operation]:
r"""Return a callable for the delete instance method over gRPC.
Stops a running instance.
The instance might be automatically recreated based on the
scaling settings of th... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def debug_instance(
self,
) -> Callable[[appengine.DebugInstanceRequest], operations_pb2.Operation]:
r"""Return a callable for the debug instance method over gRPC.
Enables debugging on a VM instance. This allows you
to use the SSH command to connect to the virtual machine
wh... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def close(self):
self.grpc_channel.close() |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def reset(cls):
cls.info = [
[
"Keyboard Control:",
" auto repeat: on key click percent: 0 LED mask: 00000002",
" XKB indicators:",
" 00: Caps Lock: off 01: Num Lock: on 02: Scroll Lock: off",
"... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def call_process(cls, cmd):
if cls.is_error:
raise subprocess.CalledProcessError(-1, cmd=cmd, output="Couldn't call xset.")
if cmd[1:] == ["q"]:
track = cls.info[cls.index]
output = "\n".join(track)
return output |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def patched_cnli(monkeypatch):
MockCapsNumLockIndicator.reset()
monkeypatch.setattr(
"libqtile.widget.caps_num_lock_indicator.subprocess", MockCapsNumLockIndicator
)
monkeypatch.setattr(
"libqtile.widget.caps_num_lock_indicator.subprocess.CalledProcessError",
subprocess.CalledPro... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_cnli(fake_qtile, patched_cnli, fake_window):
widget = patched_cnli.CapsNumLockIndicator()
fakebar = FakeBar([widget], window=fake_window)
widget._configure(fake_qtile, fakebar)
text = widget.poll()
assert text == "Caps off Num on" |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_cnli_caps_on(fake_qtile, patched_cnli, fake_window):
widget = patched_cnli.CapsNumLockIndicator()
# Simulate Caps on
MockCapsNumLockIndicator.index = 1
fakebar = FakeBar([widget], window=fake_window)
widget._configure(fake_qtile, fakebar)
text = widget.poll()
assert text == "Caps... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def draw_axis(img, charuco_corners, charuco_ids, board):
vecs = np.load("./calib.npz") # I already calibrated the camera
mtx, dist, _, _ = [vecs[i] for i in ('mtx', 'dist', 'rvecs', 'tvecs')]
ret, rvec, tvec = cv2.aruco.estimatePoseCharucoBoard(
charuco_corners, charuco_ids, board, mtx, dist)
i... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def get_image(camera):
ret, img = camera.read()
return img |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def make_grayscale(img):
ret = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
return ret |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def main():
camera = cv2.VideoCapture(0)
img = get_image(camera)
while True:
cv2.imshow('calibration', img)
cv2.waitKey(10)
img = get_image(camera)
gray = make_grayscale(img)
corners, ids, rejected = cv2.aruco.detectMarkers(gray, aruco_dict,
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def process_weight(sym, arg, aux):
for stride in RpnParam.anchor_generate.stride:
add_anchor_to_arg(
sym, arg, aux, RpnParam.anchor_generate.max_side,
stride, RpnParam.anchor_generate.scale,
RpnParam.anchor_generate.ratio) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self):
self.generate = self._generate() |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self):
self.stride = (4, 8, 16, 32, 64)
self.short = (200, 100, 50, 25, 13)
self.long = (334, 167, 84, 42, 21) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def do_register_opts(opts, group=None, ignore_errors=False):
try:
cfg.CONF.register_opts(opts, group=group)
except:
if not ignore_errors:
raise |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def do_register_cli_opts(opt, ignore_errors=False):
# TODO: This function has broken name, it should work with lists :/
if not isinstance(opt, (list, tuple)):
opts = [opt]
else:
opts = opt
try:
cfg.CONF.register_cli_opts(opts)
except:
if not ignore_errors:
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def new_tool_type(request):
if request.method == 'POST':
tform = ToolTypeForm(request.POST, instance=Tool_Type())
if tform.is_valid():
tform.save()
messages.add_message(request,
messages.SUCCESS,
'Tool Type Con... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, "voir", "view")
self.schema = "<cle>"
self.aide_courte = "affiche le détail d'un chemin"
self.aide_longue = \
"Cette commande permet d'obtenir plus d'informations sur " \
"un chem... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def edit_tool_type(request, ttid):
tool_type = Tool_Type.objects.get(pk=ttid)
if request.method == 'POST':
tform = ToolTypeForm(request.POST, instance=tool_type)
if tform.is_valid():
tform.save()
messages.add_message(request,
messages.SUCC... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def ajouter(self):
"""Méthode appelée lors de l'ajout de la commande à l'interpréteur"""
cle = self.noeud.get_masque("cle")
cle.proprietes["regex"] = r"'[a-z0-9_:]{3,}'" |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def make_data(cuda=False):
train_x = torch.linspace(0, 1, 100)
train_y = torch.sin(train_x * (2 * pi))
train_y.add_(torch.randn_like(train_y), alpha=1e-2)
test_x = torch.rand(51)
test_y = torch.sin(test_x * (2 * pi))
if cuda:
train_x = train_x.cuda()
train_y = train_y.cuda()
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self, train_x, train_y, likelihood):
super(GPRegressionModel, self).__init__(train_x, train_y, likelihood)
self.mean_module = ConstantMean(prior=SmoothedBoxPrior(-1e-5, 1e-5))
self.base_covar_module = ScaleKernel(RBFKernel(lengthscale_prior=SmoothedBoxPrior(exp(-5), exp(6), sigma=0.... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def forward(self, x):
mean_x = self.mean_module(x)
covar_x = self.covar_module(x)
return MultivariateNormal(mean_x, covar_x) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def setUp(self):
if os.getenv("UNLOCK_SEED") is None or os.getenv("UNLOCK_SEED").lower() == "false":
self.rng_state = torch.get_rng_state()
torch.manual_seed(0)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(0)
random.seed(0) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def tearDown(self):
if hasattr(self, "rng_state"):
torch.set_rng_state(self.rng_state) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_sgpr_mean_abs_error(self):
# Suppress numerical warnings
warnings.simplefilter("ignore", NumericalWarning)
train_x, train_y, test_x, test_y = make_data()
likelihood = GaussianLikelihood()
gp_model = GPRegressionModel(train_x, train_y, likelihood)
mll = gpytorch.... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_sgpr_fast_pred_var(self):
# Suppress numerical warnings
warnings.simplefilter("ignore", NumericalWarning)
train_x, train_y, test_x, test_y = make_data()
likelihood = GaussianLikelihood()
gp_model = GPRegressionModel(train_x, train_y, likelihood)
mll = gpytorch.m... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_sgpr_mean_abs_error_cuda(self):
# Suppress numerical warnings
warnings.simplefilter("ignore", NumericalWarning)
if not torch.cuda.is_available():
return
with least_used_cuda_device():
train_x, train_y, test_x, test_y = make_data(cuda=True)
li... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_subclass(self):
class X(Structure):
_fields_ = [("a", c_int)]
class Y(X):
_fields_ = [("b", c_int)]
class Z(X):
pass
self.assertEqual(sizeof(X), sizeof(c_int))
self.assertEqual(sizeof(Y), sizeof(c_int)*2)
self.assertEqual(si... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_subclass_delayed(self):
class X(Structure):
pass
self.assertEqual(sizeof(X), 0)
X._fields_ = [("a", c_int)]
class Y(X):
pass
self.assertEqual(sizeof(Y), sizeof(X))
Y._fields_ = [("b", c_int)]
class Z(X):
pass
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_simple_structs(self):
for code, tp in self.formats.items():
class X(Structure):
_fields_ = [("x", c_char),
("y", tp)]
self.assertEqual((sizeof(X), code),
(calcsize("c%c0%c" % (code, code)), code)) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_unions(self):
for code, tp in self.formats.items():
class X(Union):
_fields_ = [("x", c_char),
("y", tp)]
self.assertEqual((sizeof(X), code),
(calcsize("%c" % (code)), code)) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_struct_alignment(self):
class X(Structure):
_fields_ = [("x", c_char * 3)]
self.assertEqual(alignment(X), calcsize("s"))
self.assertEqual(sizeof(X), calcsize("3s"))
class Y(Structure):
_fields_ = [("x", c_char * 3),
("y", c_int)]
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_emtpy(self):
# I had problems with these
#
# Although these are patological cases: Empty Structures!
class X(Structure):
_fields_ = []
class Y(Union):
_fields_ = []
# Is this really the correct alignment, or should it be 0?
self.... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_fields(self):
# test the offset and size attributes of Structure/Unoin fields.
class X(Structure):
_fields_ = [("x", c_int),
("y", c_char)]
self.assertEqual(X.x.offset, 0)
self.assertEqual(X.x.size, sizeof(c_int))
self.assertEqual(X.... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_packed(self):
class X(Structure):
_fields_ = [("a", c_byte),
("b", c_longlong)]
_pack_ = 1
self.assertEqual(sizeof(X), 9)
self.assertEqual(X.b.offset, 1)
class X(Structure):
_fields_ = [("a", c_byte),
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_initializers(self):
class Person(Structure):
_fields_ = [("name", c_char*6),
("age", c_int)]
self.assertRaises(TypeError, Person, 42)
self.assertRaises(ValueError, Person, b"asldkjaslkdjaslkdj")
self.assertRaises(TypeError, Person, "Name", "H... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_conflicting_initializers(self):
class POINT(Structure):
_fields_ = [("x", c_int), ("y", c_int)]
# conflicting positional and keyword args
self.assertRaises(TypeError, POINT, 2, 3, x=4)
self.assertRaises(TypeError, POINT, 2, 3, y=4)
# too many initializers
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_keyword_initializers(self):
class POINT(Structure):
_fields_ = [("x", c_int), ("y", c_int)]
pt = POINT(1, 2)
self.assertEqual((pt.x, pt.y), (1, 2))
pt = POINT(y=2, x=1)
self.assertEqual((pt.x, pt.y), (1, 2)) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_invalid_field_types(self):
class POINT(Structure):
pass
self.assertRaises(TypeError, setattr, POINT, "_fields_", [("x", 1), ("y", 2)]) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def declare_with_name(name):
class S(Structure):
_fields_ = [(name, c_int)] |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_intarray_fields(self):
class SomeInts(Structure):
_fields_ = [("a", c_int * 4)]
# can use tuple to initialize array (but not list!)
self.assertEqual(SomeInts((1, 2)).a[:], [1, 2, 0, 0])
self.assertEqual(SomeInts((1, 2)).a[::], [1, 2, 0, 0])
self.assertEqual(... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_nested_initializers(self):
# test initializing nested structures
class Phone(Structure):
_fields_ = [("areacode", c_char*6),
("number", c_char*12)]
class Person(Structure):
_fields_ = [("name", c_char * 12),
("phon... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_structures_with_wchar(self):
try:
c_wchar
except NameError:
return # no unicode
class PersonW(Structure):
_fields_ = [("name", c_wchar * 12),
("age", c_int)]
p = PersonW("Someone \xe9")
self.assertEqual(p.name... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_init_errors(self):
class Phone(Structure):
_fields_ = [("areacode", c_char*6),
("number", c_char*12)]
class Person(Structure):
_fields_ = [("name", c_char * 12),
("phone", Phone),
("age", c_int)]
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def create_class(length):
class S(Structure):
_fields_ = [('x' * length, c_int)] |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def get_except(self, func, *args):
try:
func(*args)
except Exception as detail:
return detail.__class__, str(detail) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_abstract_class(self):
class X(Structure):
_abstract_ = "something"
# try 'X()'
cls, msg = self.get_except(eval, "X()", locals())
self.assertEqual((cls, msg), (TypeError, "abstract class")) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_methods(self): |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_positional_args(self):
# see also http://bugs.python.org/issue5042
class W(Structure):
_fields_ = [("a", c_int), ("b", c_int)]
class X(W):
_fields_ = [("c", c_int)]
class Y(X):
pass
class Z(Y):
_fields_ = [("d", c_int), ("e... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test(self):
# a Structure with a POINTER field
class S(Structure):
_fields_ = [("array", POINTER(c_int))]
s = S()
# We can assign arrays of the correct type
s.array = (c_int * 3)(1, 2, 3)
items = [s.array[i] for i in range(3)]
self.assertEqual(ite... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_none_to_pointer_fields(self):
class S(Structure):
_fields_ = [("x", c_int),
("p", POINTER(c_int))]
s = S()
s.x = 12345678
s.p = None
self.assertEqual(s.x, 12345678) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_contains_itself(self):
class Recursive(Structure):
pass
try:
Recursive._fields_ = [("next", Recursive)]
except AttributeError as details:
self.assertTrue("Structure or union cannot contain itself" in
str(details))
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_vice_versa(self):
class First(Structure):
pass
class Second(Structure):
pass
First._fields_ = [("second", Second)]
try:
Second._fields_ = [("first", First)]
except AttributeError as details:
self.assertTrue("_fields_ is f... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def config(self):
settings = {
# Use SYSTEMMPI since openfoam-org doesn't have USERMPI
'mplib': 'SYSTEMMPI',
# Add links into bin/, lib/ (eg, for other applications)
'link': False,
}
# OpenFOAM v2.4 and earlier lacks WM_LABEL_OPTION
if sel... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self,title,richtext,text):
self.title=title
self.richtext=richtext
self.text=text |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def setup_run_environment(self, env):
bashrc = self.prefix.etc.bashrc
try:
env.extend(EnvironmentModifications.from_sourcing_file(
bashrc, clean=True
))
except Exception as e:
msg = 'unexpected error when sourcing OpenFOAM bashrc [{0}]'
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self):
self.factory = yui.YUI.widgetFactory()
self.dialog = self.factory.createPopupDialog()
mainvbox = self.factory.createVBox(self.dialog)
frame = self.factory.createFrame(mainvbox,"Test frame")
HBox = self.factory.createHBox(frame)
self.aboutbutton ... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def setup_dependent_build_environment(self, env, dependent_spec):
"""Location of the OpenFOAM project directory.
This is identical to the WM_PROJECT_DIR value, but we avoid that
variable since it would mask the normal OpenFOAM cleanup of
previous versions.
"""
env.set('FO... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def ask_YesOrNo(self, info):
yui.YUI.widgetFactory
mgafactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.externalWidgetFactory("mga"))
dlg = mgafactory.createDialogBox(yui.YMGAMessageBox.B_TWO)
dlg.setTitle(info.title)
dlg.setText(info.text, info.richtext)
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def setup_dependent_run_environment(self, env, dependent_spec):
"""Location of the OpenFOAM project directory.
This is identical to the WM_PROJECT_DIR value, but we avoid that
variable since it would mask the normal OpenFOAM cleanup of
previous versions.
"""
env.set('FOAM... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def aboutDialog(self):
yui.YUI.widgetFactory;
mgafactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.externalWidgetFactory("mga"))
dlg = mgafactory.createAboutDialog("About dialog title example", "1.0.0", "GPLv3",
"Angelo Naselli", "T... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def projectdir(self):
"""Absolute location of project directory: WM_PROJECT_DIR/"""
return self.prefix # <- install directly under prefix |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def handleevent(self):
"""
Event-handler for the 'widgets' demo
"""
while True:
event = self.dialog.waitForEvent()
if event.eventType() == yui.YEvent.CancelEvent:
self.dialog.destroy()
break
if event.widget() == self.clo... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def foam_arch(self):
if not self._foam_arch:
self._foam_arch = OpenfoamOrgArch(self.spec, **self.config)
return self._foam_arch |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def archbin(self):
"""Relative location of architecture-specific executables"""
return join_path('platforms', self.foam_arch, 'bin') |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def archlib(self):
"""Relative location of architecture-specific libraries"""
return join_path('platforms', self.foam_arch, 'lib') |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def rename_source(self):
"""This is fairly horrible.
The github tarfiles have weird names that do not correspond to the
canonical name. We need to rename these, but leave a symlink for
spack to work with.
"""
# Note that this particular OpenFOAM requires absolute director... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def patch(self):
"""Adjust OpenFOAM build for spack.
Where needed, apply filter as an alternative to normal patching."""
self.rename_source()
add_extra_files(self, self.common, self.assets)
# Avoid WM_PROJECT_INST_DIR for ThirdParty, site or jobControl.
# Use openfoam... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def configure(self, spec, prefix):
"""Make adjustments to the OpenFOAM configuration files in their various
locations: etc/bashrc, etc/config.sh/FEATURE and customizations that
don't properly fit get placed in the etc/prefs.sh file (similiarly for
csh).
"""
# Filtering ba... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def build(self, spec, prefix):
"""Build using the OpenFOAM Allwmake script, with a wrapper to source
its environment first.
Only build if the compiler is known to be supported.
"""
self.foam_arch.has_rule(self.stage.source_path)
self.foam_arch.create_rules(self.stage.sour... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def install(self, spec, prefix):
"""Install under the projectdir"""
mkdirp(self.projectdir)
projdir = os.path.basename(self.projectdir)
# Filtering: bashrc, cshrc
edits = {
'WM_PROJECT_INST_DIR': os.path.dirname(self.projectdir),
'WM_PROJECT_DIR': join_pat... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def install_links(self):
"""Add symlinks into bin/, lib/ (eg, for other applications)"""
# Make build log visible - it contains OpenFOAM-specific information
with working_dir(self.projectdir):
os.symlink(
join_path(os.path.relpath(self.install_log_path)),
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def linear_search(lst,size,value):
i = 0
while i < size:
if lst[i] == value:
return i
i = i + 1
return -1 |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def main():
lst = [-31, 0, 1, 2, 2, 4, 65, 83, 99, 782]
size = len(lst)
original_list = ""
value = int(input("\nInput a value to search for: "))
print("\nOriginal Array: ")
for i in lst:
original_list += str(i) + " "
print(original_list)
print("\nLinear Search Big O Notation:\... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def setUp(self):
self.credentials = {
'username': 'testuser',
'password': 'test1234',
'email': 'test@mail.com'}
# Create a test Group
my_group, created = Group.objects.get_or_create(name='test_group')
# Add user to test Group
User.objects.get... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self, *args, **kwargs):
BaseConverter.__init__(self, *args, **kwargs)
self.type_ = "string"
self.regex = '[^(/;)]+' |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_user_login(self):
c = Client()
# User points the browser to the landing page
res = c.post('/', follow=True)
# the user is not logged in
self.assertFalse(res.context['user'].is_authenticated)
# and is redirected to the login page
self.assertRedirects(res,... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self, *args, **kwargs):
FloatConverter.__init__(self, *args, **kwargs)
self.type_ = "float"
self.regex = '-?\\d+(\\.\\d+)?' |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_public_views(client, expectedStatus):
res = client.get('/public/task/{}/map/'.format(task.id))
self.assertTrue(res.status_code == expectedStatus)
res = client.get('/public/task/{}/3d/'.format(task.id))
self.assertTrue(res.status_code == expectedStatus)
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_admin_views(self):
c = Client()
c.login(username='testsuperuser', password='test1234')
settingId = Setting.objects.all()[0].id # During tests, sometimes this is != 1
themeId = Theme.objects.all()[0].id # During tests, sometimes this is != 1
# Can access admin menu item... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self, *args, **kwargs):
PathConverter.__init__(self, *args, **kwargs)
self.type_ = "string" |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_default_group(self):
# It exists
self.assertTrue(Group.objects.filter(name='Default').count() == 1)
# Verify that all new users are assigned to default group
u = User.objects.create_user(username="default_user")
u.refresh_from_db()
self.assertTrue(u.groups.filte... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self, *args, **kwargs):
BaseConverter.__init__(self, *args, **kwargs)
self.type_ = "string" |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def test_projects(self):
# Get a normal user
user = User.objects.get(username="testuser")
self.assertFalse(user.is_superuser)
# Create a new project
p = Project.objects.create(owner=user, name="test")
# Have the proper permissions been set?
self.assertTrue(user.... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def __init__(self, api, name):
super(V1Routing, self).__init__(api, name,
description='Current version of navitia API',
status='current',
index_endpoint='index') |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def looks_like_hash(sha):
return bool(HASH_REGEX.match(sha)) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def _get_unique_constraints(self, table):
"""Retrieve information about existing unique constraints of the table
This feature is needed for _recreate_table() to work properly.
Unfortunately, it's not available in sqlalchemy 0.7.x/0.8.x.
"""
data = table.metadata.bind.execute(
"""SELECT sq... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def get_base_rev_args(rev):
return [rev] |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def _recreate_table(self, table, column=None, delta=None, omit_uniques=None):
"""Recreate the table properly
Unlike the corresponding original method of sqlalchemy-migrate this one
doesn't drop existing unique constraints when creating a new one.
"""
table_name = self.preparer.format_table(table)... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def is_immutable_rev_checkout(self, url, dest):
# type: (str, str) -> bool
_, rev_options = self.get_url_rev_options(hide_url(url))
if not rev_options.rev:
return False
if not self.is_commit_id_equal(dest, rev_options.rev):
# the current commit is different from r... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def _visit_migrate_unique_constraint(self, *p, **k):
"""Drop the given unique constraint
The corresponding original method of sqlalchemy-migrate just
raises NotImplemented error
"""
self.recreate_table(p[0].table, omit_uniques=[p[0].name]) |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def get_git_version(self):
VERSION_PFX = 'git version '
version = self.run_command(
['version'], show_stdout=False, stdout_only=True
)
if version.startswith(VERSION_PFX):
version = version[len(VERSION_PFX):].split()[0]
else:
version = ''
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def patch_migrate():
"""A workaround for SQLite's inability to alter things
SQLite abilities to alter tables are very limited (please read
http://www.sqlite.org/lang_altertable.html for more details).
E. g. one can't drop a column or a constraint in SQLite. The
workaround for this is to recreate th... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def get_current_branch(cls, location):
"""
Return the current branch, or None if HEAD isn't at a branch
(e.g. detached HEAD).
"""
# git-symbolic-ref exits with empty stdout if "HEAD" is a detached
# HEAD rather than a symbolic ref. In addition, the -q causes the
... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def db_sync(engine, abs_path, version=None, init_version=0, sanity_check=True):
"""Upgrade or downgrade a database.
Function runs the upgrade() or downgrade() functions in change scripts.
:param engine: SQLAlchemy engine instance for a given database
:param abs_path: Absolute path to migrate... |
def getall(self):
try:
spec = {'data': {'$exists': 1}}
fields = {'_id': 0}
sort = [('tid', 1)]
cur = self.db.docs.find(spec, fields, sort=sort)
except Exception as e:
raise DatabaseException(e)
return [Document(**row) for row in cur] | def export(self, location, url):
# type: (str, HiddenText) -> None
"""Export the Git repository at the url to the destination location"""
if not location.endswith('/'):
location = location + '/'
with TempDirectory(kind="export") as temp_dir:
self.unpack(temp_dir.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.