body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
b82f5e25fe9ecc840bd88299238224711923d224fc3bbeb422a0427a802e2e74 | def fig_full_test_accuracy(outfile=None, cm=None, return_cm=False, acc_file=None):
' Test accuracy figure for the full test suite (including replication)\n No heuristics\n '
from spit.training import print_test_accuracy
from spit.images import KastImages
from spit import io as spit_io
import j... | Test accuracy figure for the full test suite (including replication)
No heuristics | papers/First/Figures/py/spectype_figs.py | fig_full_test_accuracy | PYPIT/spit | 2 | python | def fig_full_test_accuracy(outfile=None, cm=None, return_cm=False, acc_file=None):
' Test accuracy figure for the full test suite (including replication)\n No heuristics\n '
from spit.training import print_test_accuracy
from spit.images import KastImages
from spit import io as spit_io
import j... | def fig_full_test_accuracy(outfile=None, cm=None, return_cm=False, acc_file=None):
' Test accuracy figure for the full test suite (including replication)\n No heuristics\n '
from spit.training import print_test_accuracy
from spit.images import KastImages
from spit import io as spit_io
import j... |
9da52db8d4ae219e1c7e1977a73782b9f01c1880dcfffad185e55e2f708486a9 | def set_fontsize(ax, fsz):
'\n Generate a Table of columns and so on\n Restrict to those systems where flg_clm > 0\n\n Parameters\n ----------\n ax : Matplotlib ax class\n fsz : float\n Font size\n '
for item in (([ax.title, ax.xaxis.label, ax.yaxis.label] + ax.get_xticklabels()) + ax.... | Generate a Table of columns and so on
Restrict to those systems where flg_clm > 0
Parameters
----------
ax : Matplotlib ax class
fsz : float
Font size | papers/First/Figures/py/spectype_figs.py | set_fontsize | PYPIT/spit | 2 | python | def set_fontsize(ax, fsz):
'\n Generate a Table of columns and so on\n Restrict to those systems where flg_clm > 0\n\n Parameters\n ----------\n ax : Matplotlib ax class\n fsz : float\n Font size\n '
for item in (([ax.title, ax.xaxis.label, ax.yaxis.label] + ax.get_xticklabels()) + ax.... | def set_fontsize(ax, fsz):
'\n Generate a Table of columns and so on\n Restrict to those systems where flg_clm > 0\n\n Parameters\n ----------\n ax : Matplotlib ax class\n fsz : float\n Font size\n '
for item in (([ax.title, ax.xaxis.label, ax.yaxis.label] + ax.get_xticklabels()) + ax.... |
48ed228e5a8575fc2d0db1d42fb8e8ab01d52dd2e40ba0dcc13f43ce23fb8d91 | def testEmpty(self):
'\n\t\tFlatten nothing.\n\t\t'
eq_(list(box.flatten([])), []) | Flatten nothing. | spacq/tool/tests/test_box.py | testEmpty | zachparrott/SpanishAcquisitionIQC | 1 | python | def testEmpty(self):
'\n\t\t\n\t\t'
eq_(list(box.flatten([])), []) | def testEmpty(self):
'\n\t\t\n\t\t'
eq_(list(box.flatten([])), [])<|docstring|>Flatten nothing.<|endoftext|> |
1d56fcf0aba9ff3ef447d3aaa942078502987cd6b689bfc164855f7c7a6df4ae | def testSingle(self):
'\n\t\tFlatten one thing.\n\t\t'
eq_(list(box.flatten([(1, 2, 3, 4, 5, 6, 7)])), [1, 2, 3, 4, 5, 6, 7]) | Flatten one thing. | spacq/tool/tests/test_box.py | testSingle | zachparrott/SpanishAcquisitionIQC | 1 | python | def testSingle(self):
'\n\t\t\n\t\t'
eq_(list(box.flatten([(1, 2, 3, 4, 5, 6, 7)])), [1, 2, 3, 4, 5, 6, 7]) | def testSingle(self):
'\n\t\t\n\t\t'
eq_(list(box.flatten([(1, 2, 3, 4, 5, 6, 7)])), [1, 2, 3, 4, 5, 6, 7])<|docstring|>Flatten one thing.<|endoftext|> |
8436f4c56ddb2768d58080ccad962f0bf83d74daf37d917b0d0e6dcb623b57b1 | def testMany(self):
'\n\t\tFlatten all the things.\n\t\t'
eq_(list(box.flatten([(1, 2, 3), [4, 5, 6], {7: 8}])), [1, 2, 3, 4, 5, 6, 7]) | Flatten all the things. | spacq/tool/tests/test_box.py | testMany | zachparrott/SpanishAcquisitionIQC | 1 | python | def testMany(self):
'\n\t\t\n\t\t'
eq_(list(box.flatten([(1, 2, 3), [4, 5, 6], {7: 8}])), [1, 2, 3, 4, 5, 6, 7]) | def testMany(self):
'\n\t\t\n\t\t'
eq_(list(box.flatten([(1, 2, 3), [4, 5, 6], {7: 8}])), [1, 2, 3, 4, 5, 6, 7])<|docstring|>Flatten all the things.<|endoftext|> |
011596056f690a2ed2c70c7deb2d1eb143223a37caa40f77967741d9da2ef360 | def testEmpty(self):
'\n\t\tSift nothing.\n\t\t'
eq_(box.sift([], object), []) | Sift nothing. | spacq/tool/tests/test_box.py | testEmpty | zachparrott/SpanishAcquisitionIQC | 1 | python | def testEmpty(self):
'\n\t\t\n\t\t'
eq_(box.sift([], object), []) | def testEmpty(self):
'\n\t\t\n\t\t'
eq_(box.sift([], object), [])<|docstring|>Sift nothing.<|endoftext|> |
8ab96e692624bdfb1df8506cf175d1a4e34212af549a97b24a54ae180f949778 | def testAllSame(self):
'\n\t\tEither keep all or remove all.\n\t\t'
items = [object() for _ in xrange(5)]
eq_(box.sift(items, object), items)
eq_(box.sift(items, Exception), []) | Either keep all or remove all. | spacq/tool/tests/test_box.py | testAllSame | zachparrott/SpanishAcquisitionIQC | 1 | python | def testAllSame(self):
'\n\t\t\n\t\t'
items = [object() for _ in xrange(5)]
eq_(box.sift(items, object), items)
eq_(box.sift(items, Exception), []) | def testAllSame(self):
'\n\t\t\n\t\t'
items = [object() for _ in xrange(5)]
eq_(box.sift(items, object), items)
eq_(box.sift(items, Exception), [])<|docstring|>Either keep all or remove all.<|endoftext|> |
96e0112823ac1f240d98fbc4e814659875d2355911013a3d18838aba6aac0ad9 | def testVaried(self):
'\n\t\tAll sorts of objects.\n\t\t'
items = [ValueError(), TypeError(), KeyError(), 5]
eq_(box.sift(items, object), items)
eq_(box.sift(items, int), [items[3]])
eq_(box.sift(items, Exception), items[0:3])
eq_(box.sift(items, ValueError), [items[0]]) | All sorts of objects. | spacq/tool/tests/test_box.py | testVaried | zachparrott/SpanishAcquisitionIQC | 1 | python | def testVaried(self):
'\n\t\t\n\t\t'
items = [ValueError(), TypeError(), KeyError(), 5]
eq_(box.sift(items, object), items)
eq_(box.sift(items, int), [items[3]])
eq_(box.sift(items, Exception), items[0:3])
eq_(box.sift(items, ValueError), [items[0]]) | def testVaried(self):
'\n\t\t\n\t\t'
items = [ValueError(), TypeError(), KeyError(), 5]
eq_(box.sift(items, object), items)
eq_(box.sift(items, int), [items[3]])
eq_(box.sift(items, Exception), items[0:3])
eq_(box.sift(items, ValueError), [items[0]])<|docstring|>All sorts of objects.<|endoftext|... |
9b0720f9fe9d85eb359bd6e5257cf8a58762a703dce7c7428fe037a783d6174c | def testSimple(self):
'\n\t\tNo interpolation required.\n\t\t'
x = ([1, 2, 3, 4] * 3)
y = repeat([5, 6, 7], 4)
z = linspace(0, (- 11), 12)
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
assert_array_equal(result, z.reshape(3, 4))
eq_(x_bounds, (1, 4))
eq_(y_bounds,... | No interpolation required. | spacq/tool/tests/test_box.py | testSimple | zachparrott/SpanishAcquisitionIQC | 1 | python | def testSimple(self):
'\n\t\t\n\t\t'
x = ([1, 2, 3, 4] * 3)
y = repeat([5, 6, 7], 4)
z = linspace(0, (- 11), 12)
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
assert_array_equal(result, z.reshape(3, 4))
eq_(x_bounds, (1, 4))
eq_(y_bounds, (5, 7))
eq_(z_bounds,... | def testSimple(self):
'\n\t\t\n\t\t'
x = ([1, 2, 3, 4] * 3)
y = repeat([5, 6, 7], 4)
z = linspace(0, (- 11), 12)
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
assert_array_equal(result, z.reshape(3, 4))
eq_(x_bounds, (1, 4))
eq_(y_bounds, (5, 7))
eq_(z_bounds,... |
e92939fbbb4663ec919b78c4230eb3fbeebcb85b2b39193e103491a42561581b | def testInterpolated(self):
'\n\t\tSome interpolation required.\n\t\t'
x = [0, 0, 0.25, 1, 1]
y = [0, 1, 0, 0, 1]
z = [1, 2, 1.5, 3, 4]
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
expected = [[1, 2, 3], [2, 3, 4]]
assert_array_almost_equal(result, expected)
eq_(... | Some interpolation required. | spacq/tool/tests/test_box.py | testInterpolated | zachparrott/SpanishAcquisitionIQC | 1 | python | def testInterpolated(self):
'\n\t\t\n\t\t'
x = [0, 0, 0.25, 1, 1]
y = [0, 1, 0, 0, 1]
z = [1, 2, 1.5, 3, 4]
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
expected = [[1, 2, 3], [2, 3, 4]]
assert_array_almost_equal(result, expected)
eq_(x_bounds, (0, 1))
eq_(y_... | def testInterpolated(self):
'\n\t\t\n\t\t'
x = [0, 0, 0.25, 1, 1]
y = [0, 1, 0, 0, 1]
z = [1, 2, 1.5, 3, 4]
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
expected = [[1, 2, 3], [2, 3, 4]]
assert_array_almost_equal(result, expected)
eq_(x_bounds, (0, 1))
eq_(y_... |
45cc7a6b777efbd730b98b74902c4b7aa94d6f3d18eafb26244371b4979b29cd | def testBigDataSet(self):
'\n\t\tOne hundred thousand evenly-spaced data points.\n\t\t'
x = (range(1000) * 100)
y = repeat(range(100), 1000)
z = arange(0, 100000)
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
assert_array_equal(result, z.reshape(100, 1000))
eq_(x_boun... | One hundred thousand evenly-spaced data points. | spacq/tool/tests/test_box.py | testBigDataSet | zachparrott/SpanishAcquisitionIQC | 1 | python | def testBigDataSet(self):
'\n\t\t\n\t\t'
x = (range(1000) * 100)
y = repeat(range(100), 1000)
z = arange(0, 100000)
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
assert_array_equal(result, z.reshape(100, 1000))
eq_(x_bounds, (0, 999))
eq_(y_bounds, (0, 99))
eq... | def testBigDataSet(self):
'\n\t\t\n\t\t'
x = (range(1000) * 100)
y = repeat(range(100), 1000)
z = arange(0, 100000)
(result, x_bounds, y_bounds, z_bounds) = box.triples_to_mesh(x, y, z)
assert_array_equal(result, z.reshape(100, 1000))
eq_(x_bounds, (0, 999))
eq_(y_bounds, (0, 99))
eq... |
a421d810453a335a06bb01704571514f48839fdb6a2fc791279b6cee0114b6b8 | def testEmpty(self):
'\n\t\tA useless object.\n\t\t'
e = box.Enum()
try:
e.anything
except AttributeError:
pass
else:
assert False, 'Expected AttributeError.'
eq_(len(e), 0) | A useless object. | spacq/tool/tests/test_box.py | testEmpty | zachparrott/SpanishAcquisitionIQC | 1 | python | def testEmpty(self):
'\n\t\t\n\t\t'
e = box.Enum()
try:
e.anything
except AttributeError:
pass
else:
assert False, 'Expected AttributeError.'
eq_(len(e), 0) | def testEmpty(self):
'\n\t\t\n\t\t'
e = box.Enum()
try:
e.anything
except AttributeError:
pass
else:
assert False, 'Expected AttributeError.'
eq_(len(e), 0)<|docstring|>A useless object.<|endoftext|> |
0d235d6285cce0879d28a6bede67cb3523407f772dc3383e7faf2cf71a155cce | def testNotEmpty(self):
'\n\t\tA regular enum.\n\t\t'
values = ['cow', 'moon', 'dish', 'spoon']
e = box.Enum(values)
eq_(len(e), len(values))
for v in values:
eq_(getattr(e, v), v)
(e.cow, e.moon, e.dish, e.spoon)
try:
e.diddle
except AttributeError:
pass
else... | A regular enum. | spacq/tool/tests/test_box.py | testNotEmpty | zachparrott/SpanishAcquisitionIQC | 1 | python | def testNotEmpty(self):
'\n\t\t\n\t\t'
values = ['cow', 'moon', 'dish', 'spoon']
e = box.Enum(values)
eq_(len(e), len(values))
for v in values:
eq_(getattr(e, v), v)
(e.cow, e.moon, e.dish, e.spoon)
try:
e.diddle
except AttributeError:
pass
else:
asser... | def testNotEmpty(self):
'\n\t\t\n\t\t'
values = ['cow', 'moon', 'dish', 'spoon']
e = box.Enum(values)
eq_(len(e), len(values))
for v in values:
eq_(getattr(e, v), v)
(e.cow, e.moon, e.dish, e.spoon)
try:
e.diddle
except AttributeError:
pass
else:
asser... |
1ca7077c89d5748efc57679583d57759985c897f4511cd28ef0593ffb52653a8 | def testDuplicates(self):
'\n\t\tCheck uniqueness and equality testing.\n\t\t'
e = box.Enum(((['a'] * 100) + (['b'] * 50)))
f = box.Enum(['b', 'a'])
eq_(e, f) | Check uniqueness and equality testing. | spacq/tool/tests/test_box.py | testDuplicates | zachparrott/SpanishAcquisitionIQC | 1 | python | def testDuplicates(self):
'\n\t\t\n\t\t'
e = box.Enum(((['a'] * 100) + (['b'] * 50)))
f = box.Enum(['b', 'a'])
eq_(e, f) | def testDuplicates(self):
'\n\t\t\n\t\t'
e = box.Enum(((['a'] * 100) + (['b'] * 50)))
f = box.Enum(['b', 'a'])
eq_(e, f)<|docstring|>Check uniqueness and equality testing.<|endoftext|> |
2afa4e34135be3ef37b833505b38a19787d16f786e681985d34d5d08ca9c86f7 | def testSimple(self):
'\n\t\tRun through some valid cases.\n\t\t'
data = []
def msg_added(name, value):
data.append((name, value))
def msg_removed(name):
data.append((name,))
p = pub.Publisher()
p.subscribe(msg_added, 'test.added')
p.subscribe(msg_removed, 'test.removed')
... | Run through some valid cases. | spacq/tool/tests/test_box.py | testSimple | zachparrott/SpanishAcquisitionIQC | 1 | python | def testSimple(self):
'\n\t\t\n\t\t'
data = []
def msg_added(name, value):
data.append((name, value))
def msg_removed(name):
data.append((name,))
p = pub.Publisher()
p.subscribe(msg_added, 'test.added')
p.subscribe(msg_removed, 'test.removed')
pd = box.PubDict(RLock(), ... | def testSimple(self):
'\n\t\t\n\t\t'
data = []
def msg_added(name, value):
data.append((name, value))
def msg_removed(name):
data.append((name,))
p = pub.Publisher()
p.subscribe(msg_added, 'test.added')
p.subscribe(msg_removed, 'test.removed')
pd = box.PubDict(RLock(), ... |
17a0a4f1e45d1ba8cfedaebe66adebb1b8c382ce501b4db3b52048cf5f50944b | def testLocked(self):
'\n\t\tAttempt a compound operation.\n\t\t'
pd = box.PubDict(RLock(), pub.Publisher().sendMessage, 'test')
pd['a'] = 'abc'
with pd.lock:
del pd['a']
pd['a'] = 'def'
expected = {'a': 'def'}
eq_(pd, expected) | Attempt a compound operation. | spacq/tool/tests/test_box.py | testLocked | zachparrott/SpanishAcquisitionIQC | 1 | python | def testLocked(self):
'\n\t\t\n\t\t'
pd = box.PubDict(RLock(), pub.Publisher().sendMessage, 'test')
pd['a'] = 'abc'
with pd.lock:
del pd['a']
pd['a'] = 'def'
expected = {'a': 'def'}
eq_(pd, expected) | def testLocked(self):
'\n\t\t\n\t\t'
pd = box.PubDict(RLock(), pub.Publisher().sendMessage, 'test')
pd['a'] = 'abc'
with pd.lock:
del pd['a']
pd['a'] = 'def'
expected = {'a': 'def'}
eq_(pd, expected)<|docstring|>Attempt a compound operation.<|endoftext|> |
7953c51ebeef8dd25fe3bda3dfb0c2b8911fecbce2c2b65cad1972ca3765a8fc | def testInvalid(self):
'\n\t\tTry some bad scenarios.\n\t\t'
pd = box.PubDict(RLock(), pub.Publisher().sendMessage, 'test')
try:
pd['a'] = None
except ValueError:
pass
else:
assert False, 'Expected ValueError.'
pd['a'] = 'abc'
try:
pd['a'] = 'def'
except K... | Try some bad scenarios. | spacq/tool/tests/test_box.py | testInvalid | zachparrott/SpanishAcquisitionIQC | 1 | python | def testInvalid(self):
'\n\t\t\n\t\t'
pd = box.PubDict(RLock(), pub.Publisher().sendMessage, 'test')
try:
pd['a'] = None
except ValueError:
pass
else:
assert False, 'Expected ValueError.'
pd['a'] = 'abc'
try:
pd['a'] = 'def'
except KeyError:
pass
... | def testInvalid(self):
'\n\t\t\n\t\t'
pd = box.PubDict(RLock(), pub.Publisher().sendMessage, 'test')
try:
pd['a'] = None
except ValueError:
pass
else:
assert False, 'Expected ValueError.'
pd['a'] = 'abc'
try:
pd['a'] = 'def'
except KeyError:
pass
... |
c7a8948dfb740e5d72aba2a9279ca2abbef7b731f787bd6bb050c60d5bf0a916 | def testSynchronization(self):
'\n\t\tEnsure that synchronized methods are called in the correct order.\n\t\t'
num_threads = 4
times = 4
values = 5
obj = SynchronizedTest.SynchronizedObject()
thrs = []
for _ in xrange(num_threads):
thrs.append(SynchronizedTest.SynchronizedThread(obj,... | Ensure that synchronized methods are called in the correct order. | spacq/tool/tests/test_box.py | testSynchronization | zachparrott/SpanishAcquisitionIQC | 1 | python | def testSynchronization(self):
'\n\t\t\n\t\t'
num_threads = 4
times = 4
values = 5
obj = SynchronizedTest.SynchronizedObject()
thrs = []
for _ in xrange(num_threads):
thrs.append(SynchronizedTest.SynchronizedThread(obj, times, values))
for thr in thrs:
thr.start()
for... | def testSynchronization(self):
'\n\t\t\n\t\t'
num_threads = 4
times = 4
values = 5
obj = SynchronizedTest.SynchronizedObject()
thrs = []
for _ in xrange(num_threads):
thrs.append(SynchronizedTest.SynchronizedThread(obj, times, values))
for thr in thrs:
thr.start()
for... |
339610259dae459bc96895db10064adeaa28e3d88cb82448780639405c6d35ae | def testWith(self):
'\n\t\tUse Without in with.\n\t\t'
with box.Without():
with box.Without() as w:
assert (w is None) | Use Without in with. | spacq/tool/tests/test_box.py | testWith | zachparrott/SpanishAcquisitionIQC | 1 | python | def testWith(self):
'\n\t\t\n\t\t'
with box.Without():
with box.Without() as w:
assert (w is None) | def testWith(self):
'\n\t\t\n\t\t'
with box.Without():
with box.Without() as w:
assert (w is None)<|docstring|>Use Without in with.<|endoftext|> |
c316c3aab715dc24e176a0058dba4d9e8a25a6d6ab662fb6acdd8184d99b99e5 | def testException(self):
'\n\t\tEnsure that exceptions are passed through.\n\t\t'
try:
with box.Without():
raise IndexError
except IndexError:
pass
else:
assert False, 'Expected IndexError.' | Ensure that exceptions are passed through. | spacq/tool/tests/test_box.py | testException | zachparrott/SpanishAcquisitionIQC | 1 | python | def testException(self):
'\n\t\t\n\t\t'
try:
with box.Without():
raise IndexError
except IndexError:
pass
else:
assert False, 'Expected IndexError.' | def testException(self):
'\n\t\t\n\t\t'
try:
with box.Without():
raise IndexError
except IndexError:
pass
else:
assert False, 'Expected IndexError.'<|docstring|>Ensure that exceptions are passed through.<|endoftext|> |
b49b7458ce11b1ea81b6d6e40bfbcd2b5ed06fb6dc3d15e12776317143d926c6 | def hessian_denoise(initial: np.ndarray, iters=50, mu=150, sigma: float=1, lamda=1):
'Hessian (Split-Bregman) SIM denoise algorithm.\n\n May be applied to images images reconstructed with Wiener method to further\n reduce noise.\n\n Adapted from MATLAB code published in Huang et al 2018 [1]_.\n See supp... | Hessian (Split-Bregman) SIM denoise algorithm.
May be applied to images images reconstructed with Wiener method to further
reduce noise.
Adapted from MATLAB code published in Huang et al 2018 [1]_.
See supplementary information (fig 7) for details on the paramaeters.
Parameters
----------
initial : np.ndarray
in... | pycudasirecon/_hessian.py | hessian_denoise | tlambert03/pycudasirecon | 2 | python | def hessian_denoise(initial: np.ndarray, iters=50, mu=150, sigma: float=1, lamda=1):
'Hessian (Split-Bregman) SIM denoise algorithm.\n\n May be applied to images images reconstructed with Wiener method to further\n reduce noise.\n\n Adapted from MATLAB code published in Huang et al 2018 [1]_.\n See supp... | def hessian_denoise(initial: np.ndarray, iters=50, mu=150, sigma: float=1, lamda=1):
'Hessian (Split-Bregman) SIM denoise algorithm.\n\n May be applied to images images reconstructed with Wiener method to further\n reduce noise.\n\n Adapted from MATLAB code published in Huang et al 2018 [1]_.\n See supp... |
85b114f9a451612390b863370c04702fdad2c4f9d3fd655941492bca5be178d1 | @dsl.component(base_image=BASE_IMAGE_NAME)
def convert_csv_to_parquet_op(output_datasets: Output[Dataset], train_paths: list, valid_paths: list, output_path: str, columns: list, cols_dtype: dict, sep: str, gpus: str, shuffle: Optional[str]=None, recursive: Optional[bool]=False):
"\n Component to convert CSV file... | Component to convert CSV file(s) to Parquet format using NVTabular.
output_datasets: Output[Dataset]
Output metadata with references to the converted CSVs in GCS.
Usage:
output_datasets.metadata['train']
.example: '/gcs/my_bucket/folders/train'
output_datasets.metadata['valid']
... | src/archive/kfp_components/kfp_components.py | convert_csv_to_parquet_op | mengdong/merlin-on-vertex | 0 | python | @dsl.component(base_image=BASE_IMAGE_NAME)
def convert_csv_to_parquet_op(output_datasets: Output[Dataset], train_paths: list, valid_paths: list, output_path: str, columns: list, cols_dtype: dict, sep: str, gpus: str, shuffle: Optional[str]=None, recursive: Optional[bool]=False):
"\n Component to convert CSV file... | @dsl.component(base_image=BASE_IMAGE_NAME)
def convert_csv_to_parquet_op(output_datasets: Output[Dataset], train_paths: list, valid_paths: list, output_path: str, columns: list, cols_dtype: dict, sep: str, gpus: str, shuffle: Optional[str]=None, recursive: Optional[bool]=False):
"\n Component to convert CSV file... |
cbf1d4c0ce02cc4e40985aa06ed613a7f062cd7d99b22f904c1deeb955c56c50 | @dsl.component(base_image=BASE_IMAGE_NAME)
def fit_dataset_op(datasets: Input[Dataset], fitted_workflow: Output[Artifact], workflow_path: str, gpus: str, split_name: Optional[str]='train', protocol: Optional[str]='tcp', device_limit_frac: Optional[float]=0.8, device_pool_frac: Optional[float]=0.9, part_mem_frac: Option... | Component to generate statistics from the dataset.
datasets: Input[Dataset]
Input metadata with references to the train and valid converted
datasets in GCS.
Usage:
full_path_train = datasets.metadata.get('train')
.example: '/gcs/my_bucket/folders/converted/train'
full_path_valid... | src/archive/kfp_components/kfp_components.py | fit_dataset_op | mengdong/merlin-on-vertex | 0 | python | @dsl.component(base_image=BASE_IMAGE_NAME)
def fit_dataset_op(datasets: Input[Dataset], fitted_workflow: Output[Artifact], workflow_path: str, gpus: str, split_name: Optional[str]='train', protocol: Optional[str]='tcp', device_limit_frac: Optional[float]=0.8, device_pool_frac: Optional[float]=0.9, part_mem_frac: Option... | @dsl.component(base_image=BASE_IMAGE_NAME)
def fit_dataset_op(datasets: Input[Dataset], fitted_workflow: Output[Artifact], workflow_path: str, gpus: str, split_name: Optional[str]='train', protocol: Optional[str]='tcp', device_limit_frac: Optional[float]=0.8, device_pool_frac: Optional[float]=0.9, part_mem_frac: Option... |
b963b3e4582968ad464863fc4f2ec9614e5651727abb6393a8d2e87228d96f7e | @dsl.component(base_image=BASE_IMAGE_NAME)
def transform_dataset_op(fitted_workflow: Input[Artifact], transformed_dataset: Output[Dataset], output_transformed: str, gpus: str, split_name: str='train', shuffle: str=None, protocol: str='tcp', device_limit_frac: float=0.8, device_pool_frac: float=0.9, part_mem_frac: float... | Component to transform a dataset according to the workflow specifications.
fitted_workflow: Input[Artifact]
Input metadata with the path to the fitted_workflow and the
location of the converted datasets in GCS (train and validation).
Usage:
fitted_workflow.metadata['datasets']['train']
... | src/archive/kfp_components/kfp_components.py | transform_dataset_op | mengdong/merlin-on-vertex | 0 | python | @dsl.component(base_image=BASE_IMAGE_NAME)
def transform_dataset_op(fitted_workflow: Input[Artifact], transformed_dataset: Output[Dataset], output_transformed: str, gpus: str, split_name: str='train', shuffle: str=None, protocol: str='tcp', device_limit_frac: float=0.8, device_pool_frac: float=0.9, part_mem_frac: float... | @dsl.component(base_image=BASE_IMAGE_NAME)
def transform_dataset_op(fitted_workflow: Input[Artifact], transformed_dataset: Output[Dataset], output_transformed: str, gpus: str, split_name: str='train', shuffle: str=None, protocol: str='tcp', device_limit_frac: float=0.8, device_pool_frac: float=0.9, part_mem_frac: float... |
df11812f1163b1ccadafae94158f539a3671b20697a9618ef628c2fe1aa4b12e | @dsl.component(base_image=BASE_IMAGE_NAME)
def export_parquet_from_bq_op(output_datasets: Output[Dataset], output_path: str, bq_project: str, bq_dataset_id: str, bq_table_train: str, bq_table_valid: str, location: str):
"\n Component to export PARQUET files from a bigquery table.\n\n output_datasets: dict\n ... | Component to export PARQUET files from a bigquery table.
output_datasets: dict
Output metadata with the GCS path for the exported datasets.
Usage:
output_datasets.metadata['train']
.example: '/gcs/bucket_name/subfolder/train/'
output_path: str
Path to write the exported parquet files. N... | src/archive/kfp_components/kfp_components.py | export_parquet_from_bq_op | mengdong/merlin-on-vertex | 0 | python | @dsl.component(base_image=BASE_IMAGE_NAME)
def export_parquet_from_bq_op(output_datasets: Output[Dataset], output_path: str, bq_project: str, bq_dataset_id: str, bq_table_train: str, bq_table_valid: str, location: str):
"\n Component to export PARQUET files from a bigquery table.\n\n output_datasets: dict\n ... | @dsl.component(base_image=BASE_IMAGE_NAME)
def export_parquet_from_bq_op(output_datasets: Output[Dataset], output_path: str, bq_project: str, bq_dataset_id: str, bq_table_train: str, bq_table_valid: str, location: str):
"\n Component to export PARQUET files from a bigquery table.\n\n output_datasets: dict\n ... |
7683abd802f2c162abb538837e7976e7c5a8dc6c21d05466a4ba84ba42873519 | @dsl.component(base_image=BASE_IMAGE_NAME)
def import_parquet_to_bq_op(transformed_dataset: Input[Dataset], output_bq_table: Output[Dataset], bq_project: str, bq_dataset_id: str, bq_dest_table_id: str):
"\n Component to load PARQUET files to a Bigquery table.\n\n transformed_dataset: dict\n Input metad... | Component to load PARQUET files to a Bigquery table.
transformed_dataset: dict
Input metadata. Stores the path in GCS
for the datasets.
Usage:
train_path = output_dataset['train']
# returns: bucket_name/subfolder/subfolder/
bq_project: str
GCP project id
Format:
'my_project'... | src/archive/kfp_components/kfp_components.py | import_parquet_to_bq_op | mengdong/merlin-on-vertex | 0 | python | @dsl.component(base_image=BASE_IMAGE_NAME)
def import_parquet_to_bq_op(transformed_dataset: Input[Dataset], output_bq_table: Output[Dataset], bq_project: str, bq_dataset_id: str, bq_dest_table_id: str):
"\n Component to load PARQUET files to a Bigquery table.\n\n transformed_dataset: dict\n Input metad... | @dsl.component(base_image=BASE_IMAGE_NAME)
def import_parquet_to_bq_op(transformed_dataset: Input[Dataset], output_bq_table: Output[Dataset], bq_project: str, bq_dataset_id: str, bq_dest_table_id: str):
"\n Component to load PARQUET files to a Bigquery table.\n\n transformed_dataset: dict\n Input metad... |
beff59b71f8e77a389d6c22a7a4e69115510fa9420fcb5475d69d13f06d8db26 | @dsl.component(base_image=BASE_IMAGE_NAME)
def load_bq_to_feature_store_op(output_bq_table: Input[Dataset], feature_store_path: Output[Artifact], cols_dtype: dict):
"\n Component to create a feature store and load the data from Bigquery.\n\n output_bq_table: Input[Artifact]\n Input metadata with refere... | Component to create a feature store and load the data from Bigquery.
output_bq_table: Input[Artifact]
Input metadata with references to the project ID, dataset ID and
table ID where BQ table was imported.
Usage:
output_bq_table.metadata['bq_project']
.example: 'my_project'
outp... | src/archive/kfp_components/kfp_components.py | load_bq_to_feature_store_op | mengdong/merlin-on-vertex | 0 | python | @dsl.component(base_image=BASE_IMAGE_NAME)
def load_bq_to_feature_store_op(output_bq_table: Input[Dataset], feature_store_path: Output[Artifact], cols_dtype: dict):
"\n Component to create a feature store and load the data from Bigquery.\n\n output_bq_table: Input[Artifact]\n Input metadata with refere... | @dsl.component(base_image=BASE_IMAGE_NAME)
def load_bq_to_feature_store_op(output_bq_table: Input[Dataset], feature_store_path: Output[Artifact], cols_dtype: dict):
"\n Component to create a feature store and load the data from Bigquery.\n\n output_bq_table: Input[Artifact]\n Input metadata with refere... |
c0e2b31cdcf02d84f1a2da6f5e47e34a69f9130808d74d3a5e5787ea1196cedf | def __init__(self, create_time=None, access=None, secret=None, status=None, user_id=None, description=None):
'CreateCredentialResult - a model defined in huaweicloud sdk'
self._create_time = None
self._access = None
self._secret = None
self._status = None
self._user_id = None
self._descripti... | CreateCredentialResult - a model defined in huaweicloud sdk | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | __init__ | Adek06/huaweicloud-sdk-python-v3 | 1 | python | def __init__(self, create_time=None, access=None, secret=None, status=None, user_id=None, description=None):
self._create_time = None
self._access = None
self._secret = None
self._status = None
self._user_id = None
self._description = None
self.discriminator = None
self.create_time ... | def __init__(self, create_time=None, access=None, secret=None, status=None, user_id=None, description=None):
self._create_time = None
self._access = None
self._secret = None
self._status = None
self._user_id = None
self._description = None
self.discriminator = None
self.create_time ... |
6a51aea53092e8c0811f72d4a0886c9e18cf9f797aa549500acbda247ce83307 | @property
def create_time(self):
'Gets the create_time of this CreateCredentialResult.\n\n 创建访问密钥时间。\n\n :return: The create_time of this CreateCredentialResult.\n :rtype: str\n '
return self._create_time | Gets the create_time of this CreateCredentialResult.
创建访问密钥时间。
:return: The create_time of this CreateCredentialResult.
:rtype: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | create_time | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @property
def create_time(self):
'Gets the create_time of this CreateCredentialResult.\n\n 创建访问密钥时间。\n\n :return: The create_time of this CreateCredentialResult.\n :rtype: str\n '
return self._create_time | @property
def create_time(self):
'Gets the create_time of this CreateCredentialResult.\n\n 创建访问密钥时间。\n\n :return: The create_time of this CreateCredentialResult.\n :rtype: str\n '
return self._create_time<|docstring|>Gets the create_time of this CreateCredentialResult.
创建访问密钥时间。
:r... |
75fa80ec15fc527e3e33f87d5a2c6a5356ef9b9a525a951e6b05bb1d3ce8de5a | @create_time.setter
def create_time(self, create_time):
'Sets the create_time of this CreateCredentialResult.\n\n 创建访问密钥时间。\n\n :param create_time: The create_time of this CreateCredentialResult.\n :type: str\n '
self._create_time = create_time | Sets the create_time of this CreateCredentialResult.
创建访问密钥时间。
:param create_time: The create_time of this CreateCredentialResult.
:type: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | create_time | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @create_time.setter
def create_time(self, create_time):
'Sets the create_time of this CreateCredentialResult.\n\n 创建访问密钥时间。\n\n :param create_time: The create_time of this CreateCredentialResult.\n :type: str\n '
self._create_time = create_time | @create_time.setter
def create_time(self, create_time):
'Sets the create_time of this CreateCredentialResult.\n\n 创建访问密钥时间。\n\n :param create_time: The create_time of this CreateCredentialResult.\n :type: str\n '
self._create_time = create_time<|docstring|>Sets the create_time of thi... |
c54932360786b0b5d68e596ea4ec84d7d9d5e03a1bcdf4b291736876bcc99e6c | @property
def access(self):
'Gets the access of this CreateCredentialResult.\n\n 创建的AK。\n\n :return: The access of this CreateCredentialResult.\n :rtype: str\n '
return self._access | Gets the access of this CreateCredentialResult.
创建的AK。
:return: The access of this CreateCredentialResult.
:rtype: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | access | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @property
def access(self):
'Gets the access of this CreateCredentialResult.\n\n 创建的AK。\n\n :return: The access of this CreateCredentialResult.\n :rtype: str\n '
return self._access | @property
def access(self):
'Gets the access of this CreateCredentialResult.\n\n 创建的AK。\n\n :return: The access of this CreateCredentialResult.\n :rtype: str\n '
return self._access<|docstring|>Gets the access of this CreateCredentialResult.
创建的AK。
:return: The access of this Creat... |
3678d0f3ba6f7f52990b2629e823d74a3172187f5cd8d2875cfd60f7022980ba | @access.setter
def access(self, access):
'Sets the access of this CreateCredentialResult.\n\n 创建的AK。\n\n :param access: The access of this CreateCredentialResult.\n :type: str\n '
self._access = access | Sets the access of this CreateCredentialResult.
创建的AK。
:param access: The access of this CreateCredentialResult.
:type: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | access | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @access.setter
def access(self, access):
'Sets the access of this CreateCredentialResult.\n\n 创建的AK。\n\n :param access: The access of this CreateCredentialResult.\n :type: str\n '
self._access = access | @access.setter
def access(self, access):
'Sets the access of this CreateCredentialResult.\n\n 创建的AK。\n\n :param access: The access of this CreateCredentialResult.\n :type: str\n '
self._access = access<|docstring|>Sets the access of this CreateCredentialResult.
创建的AK。
:param access... |
ee0c73aa15ef0498bf805d46497b4463166380edf34f97ab657a87f1042a63fb | @property
def secret(self):
'Gets the secret of this CreateCredentialResult.\n\n 创建的SK。\n\n :return: The secret of this CreateCredentialResult.\n :rtype: str\n '
return self._secret | Gets the secret of this CreateCredentialResult.
创建的SK。
:return: The secret of this CreateCredentialResult.
:rtype: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | secret | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @property
def secret(self):
'Gets the secret of this CreateCredentialResult.\n\n 创建的SK。\n\n :return: The secret of this CreateCredentialResult.\n :rtype: str\n '
return self._secret | @property
def secret(self):
'Gets the secret of this CreateCredentialResult.\n\n 创建的SK。\n\n :return: The secret of this CreateCredentialResult.\n :rtype: str\n '
return self._secret<|docstring|>Gets the secret of this CreateCredentialResult.
创建的SK。
:return: The secret of this Creat... |
3b8092cc674ddef3210a10cd37cd698f8ce484bb8d04392f4d662f8583974754 | @secret.setter
def secret(self, secret):
'Sets the secret of this CreateCredentialResult.\n\n 创建的SK。\n\n :param secret: The secret of this CreateCredentialResult.\n :type: str\n '
self._secret = secret | Sets the secret of this CreateCredentialResult.
创建的SK。
:param secret: The secret of this CreateCredentialResult.
:type: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | secret | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @secret.setter
def secret(self, secret):
'Sets the secret of this CreateCredentialResult.\n\n 创建的SK。\n\n :param secret: The secret of this CreateCredentialResult.\n :type: str\n '
self._secret = secret | @secret.setter
def secret(self, secret):
'Sets the secret of this CreateCredentialResult.\n\n 创建的SK。\n\n :param secret: The secret of this CreateCredentialResult.\n :type: str\n '
self._secret = secret<|docstring|>Sets the secret of this CreateCredentialResult.
创建的SK。
:param secret... |
f71c2be5b04c34dbcf5956ea5e3b4f3a7e7192b8c1467e0cdcc233f999e31617 | @property
def status(self):
'Gets the status of this CreateCredentialResult.\n\n 访问密钥状态。\n\n :return: The status of this CreateCredentialResult.\n :rtype: str\n '
return self._status | Gets the status of this CreateCredentialResult.
访问密钥状态。
:return: The status of this CreateCredentialResult.
:rtype: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | status | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @property
def status(self):
'Gets the status of this CreateCredentialResult.\n\n 访问密钥状态。\n\n :return: The status of this CreateCredentialResult.\n :rtype: str\n '
return self._status | @property
def status(self):
'Gets the status of this CreateCredentialResult.\n\n 访问密钥状态。\n\n :return: The status of this CreateCredentialResult.\n :rtype: str\n '
return self._status<|docstring|>Gets the status of this CreateCredentialResult.
访问密钥状态。
:return: The status of this Cre... |
49972c24360b45f913a688e5d18521044956afece706d993f6c52f401b2a160f | @status.setter
def status(self, status):
'Sets the status of this CreateCredentialResult.\n\n 访问密钥状态。\n\n :param status: The status of this CreateCredentialResult.\n :type: str\n '
self._status = status | Sets the status of this CreateCredentialResult.
访问密钥状态。
:param status: The status of this CreateCredentialResult.
:type: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | status | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @status.setter
def status(self, status):
'Sets the status of this CreateCredentialResult.\n\n 访问密钥状态。\n\n :param status: The status of this CreateCredentialResult.\n :type: str\n '
self._status = status | @status.setter
def status(self, status):
'Sets the status of this CreateCredentialResult.\n\n 访问密钥状态。\n\n :param status: The status of this CreateCredentialResult.\n :type: str\n '
self._status = status<|docstring|>Sets the status of this CreateCredentialResult.
访问密钥状态。
:param stat... |
71334470926bded5aaf4058217080e869f6a651618413e07790dbdb0205f80c9 | @property
def user_id(self):
'Gets the user_id of this CreateCredentialResult.\n\n IAM用户ID。\n\n :return: The user_id of this CreateCredentialResult.\n :rtype: str\n '
return self._user_id | Gets the user_id of this CreateCredentialResult.
IAM用户ID。
:return: The user_id of this CreateCredentialResult.
:rtype: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | user_id | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @property
def user_id(self):
'Gets the user_id of this CreateCredentialResult.\n\n IAM用户ID。\n\n :return: The user_id of this CreateCredentialResult.\n :rtype: str\n '
return self._user_id | @property
def user_id(self):
'Gets the user_id of this CreateCredentialResult.\n\n IAM用户ID。\n\n :return: The user_id of this CreateCredentialResult.\n :rtype: str\n '
return self._user_id<|docstring|>Gets the user_id of this CreateCredentialResult.
IAM用户ID。
:return: The user_id of ... |
272953d476b053edddf746ef9ee06b35f0237721900e59ac6844bb6f29548695 | @user_id.setter
def user_id(self, user_id):
'Sets the user_id of this CreateCredentialResult.\n\n IAM用户ID。\n\n :param user_id: The user_id of this CreateCredentialResult.\n :type: str\n '
self._user_id = user_id | Sets the user_id of this CreateCredentialResult.
IAM用户ID。
:param user_id: The user_id of this CreateCredentialResult.
:type: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | user_id | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @user_id.setter
def user_id(self, user_id):
'Sets the user_id of this CreateCredentialResult.\n\n IAM用户ID。\n\n :param user_id: The user_id of this CreateCredentialResult.\n :type: str\n '
self._user_id = user_id | @user_id.setter
def user_id(self, user_id):
'Sets the user_id of this CreateCredentialResult.\n\n IAM用户ID。\n\n :param user_id: The user_id of this CreateCredentialResult.\n :type: str\n '
self._user_id = user_id<|docstring|>Sets the user_id of this CreateCredentialResult.
IAM用户ID。
... |
fd7f1de216c9bd812ff5e2fd578d752a8e8ccf7c5500bb5319c17d8060b4d9d3 | @property
def description(self):
'Gets the description of this CreateCredentialResult.\n\n 访问密钥描述信息。\n\n :return: The description of this CreateCredentialResult.\n :rtype: str\n '
return self._description | Gets the description of this CreateCredentialResult.
访问密钥描述信息。
:return: The description of this CreateCredentialResult.
:rtype: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | description | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @property
def description(self):
'Gets the description of this CreateCredentialResult.\n\n 访问密钥描述信息。\n\n :return: The description of this CreateCredentialResult.\n :rtype: str\n '
return self._description | @property
def description(self):
'Gets the description of this CreateCredentialResult.\n\n 访问密钥描述信息。\n\n :return: The description of this CreateCredentialResult.\n :rtype: str\n '
return self._description<|docstring|>Gets the description of this CreateCredentialResult.
访问密钥描述信息。
:r... |
0c04ea76224c6047335ad096963d67c28f2a5b9f7e2fe0589dd6d7b28b13f9c0 | @description.setter
def description(self, description):
'Sets the description of this CreateCredentialResult.\n\n 访问密钥描述信息。\n\n :param description: The description of this CreateCredentialResult.\n :type: str\n '
self._description = description | Sets the description of this CreateCredentialResult.
访问密钥描述信息。
:param description: The description of this CreateCredentialResult.
:type: str | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | description | Adek06/huaweicloud-sdk-python-v3 | 1 | python | @description.setter
def description(self, description):
'Sets the description of this CreateCredentialResult.\n\n 访问密钥描述信息。\n\n :param description: The description of this CreateCredentialResult.\n :type: str\n '
self._description = description | @description.setter
def description(self, description):
'Sets the description of this CreateCredentialResult.\n\n 访问密钥描述信息。\n\n :param description: The description of this CreateCredentialResult.\n :type: str\n '
self._description = description<|docstring|>Sets the description of thi... |
23795442a46e2cd10dec98fded44ed9172a29971e98983a30ad89baa6c9c0a03 | def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | Returns the model properties as a dict | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | to_dict | Adek06/huaweicloud-sdk-python-v3 | 1 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99 | def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | Returns the string representation of the model | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | to_str | Adek06/huaweicloud-sdk-python-v3 | 1 | python | def to_str(self):
return pprint.pformat(self.to_dict()) | def to_str(self):
return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|> |
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703 | def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | For `print` and `pprint` | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | __repr__ | Adek06/huaweicloud-sdk-python-v3 | 1 | python | def __repr__(self):
return self.to_str() | def __repr__(self):
return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|> |
7c6321e4cbae4c96ff6cd4a6be48c3eaf49897e057a0cfa0aec3b345d41197ce | def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, CreateCredentialResult)):
return False
return (self.__dict__ == other.__dict__) | Returns true if both objects are equal | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | __eq__ | Adek06/huaweicloud-sdk-python-v3 | 1 | python | def __eq__(self, other):
if (not isinstance(other, CreateCredentialResult)):
return False
return (self.__dict__ == other.__dict__) | def __eq__(self, other):
if (not isinstance(other, CreateCredentialResult)):
return False
return (self.__dict__ == other.__dict__)<|docstring|>Returns true if both objects are equal<|endoftext|> |
43dc6740163eb9fc1161d09cb2208a64c7ad0cc8d9c8637ac3264522d3ec7e42 | def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | Returns true if both objects are not equal | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/create_credential_result.py | __ne__ | Adek06/huaweicloud-sdk-python-v3 | 1 | python | def __ne__(self, other):
return (not (self == other)) | def __ne__(self, other):
return (not (self == other))<|docstring|>Returns true if both objects are not equal<|endoftext|> |
76b19251e449ee311ac12d92c3f9077c800975649493d100e14eff0f5cbe4c98 | def __getitem__(self, index):
'\n Args:\n index (int): Index\n\n Returns:\n tuple: (sample, target) where target is class_index of the target class.\n '
(path, target) = self.imgs[index]
sample = self.loader(path)
if (self.transform is not None):
sample... | Args:
index (int): Index
Returns:
tuple: (sample, target) where target is class_index of the target class. | fedml_api/data_preprocessing/cinic10/datasets.py | __getitem__ | rahim-r/FedML | 1,120 | python | def __getitem__(self, index):
'\n Args:\n index (int): Index\n\n Returns:\n tuple: (sample, target) where target is class_index of the target class.\n '
(path, target) = self.imgs[index]
sample = self.loader(path)
if (self.transform is not None):
sample... | def __getitem__(self, index):
'\n Args:\n index (int): Index\n\n Returns:\n tuple: (sample, target) where target is class_index of the target class.\n '
(path, target) = self.imgs[index]
sample = self.loader(path)
if (self.transform is not None):
sample... |
8041ee17dadddcb753e7d96a5b19c5e44e9505097d0407a5eebeee0d3d07f654 | @pytest.mark.parametrize('diff_order', (1, 2, 3, 4, 5))
def test_difference_matrix(diff_order):
'Tests all covered differential matrices.'
diff_matrix = _algorithm_setup.difference_matrix(10, diff_order).toarray()
numpy_diff = np.diff(np.eye(10), diff_order).T
assert_array_equal(diff_matrix, numpy_diff) | Tests all covered differential matrices. | tests/test_algorithm_setup.py | test_difference_matrix | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('diff_order', (1, 2, 3, 4, 5))
def test_difference_matrix(diff_order):
diff_matrix = _algorithm_setup.difference_matrix(10, diff_order).toarray()
numpy_diff = np.diff(np.eye(10), diff_order).T
assert_array_equal(diff_matrix, numpy_diff) | @pytest.mark.parametrize('diff_order', (1, 2, 3, 4, 5))
def test_difference_matrix(diff_order):
diff_matrix = _algorithm_setup.difference_matrix(10, diff_order).toarray()
numpy_diff = np.diff(np.eye(10), diff_order).T
assert_array_equal(diff_matrix, numpy_diff)<|docstring|>Tests all covered differentia... |
4180d58d81f4abce23f310ba5f9a3d1c17dd97fed76575a800cec10b18c8c657 | def test_difference_matrix_order2():
'\n Tests the 2nd order differential matrix against the actual representation.\n\n The 2nd order differential matrix is most commonly used,\n so double-check that it is correct.\n '
diff_matrix = _algorithm_setup.difference_matrix(8, 2).toarray()
actual_matri... | Tests the 2nd order differential matrix against the actual representation.
The 2nd order differential matrix is most commonly used,
so double-check that it is correct. | tests/test_algorithm_setup.py | test_difference_matrix_order2 | abdelq/pybaselines | 0 | python | def test_difference_matrix_order2():
'\n Tests the 2nd order differential matrix against the actual representation.\n\n The 2nd order differential matrix is most commonly used,\n so double-check that it is correct.\n '
diff_matrix = _algorithm_setup.difference_matrix(8, 2).toarray()
actual_matri... | def test_difference_matrix_order2():
'\n Tests the 2nd order differential matrix against the actual representation.\n\n The 2nd order differential matrix is most commonly used,\n so double-check that it is correct.\n '
diff_matrix = _algorithm_setup.difference_matrix(8, 2).toarray()
actual_matri... |
73ee1078e886018ff904dc0027339f1915ae3f9a5a02b4c455b492ee55695e6a | def test_difference_matrix_fail():
'Ensures differential matrix fails for non-covered order.'
with pytest.raises(ValueError):
_algorithm_setup.difference_matrix(10, diff_order=10) | Ensures differential matrix fails for non-covered order. | tests/test_algorithm_setup.py | test_difference_matrix_fail | abdelq/pybaselines | 0 | python | def test_difference_matrix_fail():
with pytest.raises(ValueError):
_algorithm_setup.difference_matrix(10, diff_order=10) | def test_difference_matrix_fail():
with pytest.raises(ValueError):
_algorithm_setup.difference_matrix(10, diff_order=10)<|docstring|>Ensures differential matrix fails for non-covered order.<|endoftext|> |
90d868146080ec3d9baea1780ded8344966f98eee1544868148413bd20ed431f | @pytest.fixture
def small_data():
'A small array of data for testing.'
return np.arange(10) | A small array of data for testing. | tests/test_algorithm_setup.py | small_data | abdelq/pybaselines | 0 | python | @pytest.fixture
def small_data():
return np.arange(10) | @pytest.fixture
def small_data():
return np.arange(10)<|docstring|>A small array of data for testing.<|endoftext|> |
f2fe86b951d80e392423d2b9dac7cec3aaee01c3e4343998325e23610fda3730 | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_whittacker_y_array(small_data, array_enum):
'Ensures output y is always a numpy array.'
if (array_enum == 1):
small_data = small_data.tolist()
(y, *_) = _algorithm_setup._setup_whittaker(small_data, 1)
assert isinstance(y, np.ndarray) | Ensures output y is always a numpy array. | tests/test_algorithm_setup.py | test_setup_whittacker_y_array | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_whittacker_y_array(small_data, array_enum):
if (array_enum == 1):
small_data = small_data.tolist()
(y, *_) = _algorithm_setup._setup_whittaker(small_data, 1)
assert isinstance(y, np.ndarray) | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_whittacker_y_array(small_data, array_enum):
if (array_enum == 1):
small_data = small_data.tolist()
(y, *_) = _algorithm_setup._setup_whittaker(small_data, 1)
assert isinstance(y, np.ndarray)<|docstring|>Ensures output y is always a n... |
721cb2c97c1a37cc878f28deb23c613ddd33bd73c3e58facbd11a5e9dece00e0 | @pytest.mark.parametrize('diff_order', (1, 2))
@pytest.mark.parametrize('lam', (1, 20))
def test_setup_whittacker_diff_matrix(small_data, lam, diff_order):
'Ensures output difference matrix is lam * diff_matrix.T * diff_matrix.'
(_, diff_matrix, *_) = _algorithm_setup._setup_whittaker(small_data, lam, diff_orde... | Ensures output difference matrix is lam * diff_matrix.T * diff_matrix. | tests/test_algorithm_setup.py | test_setup_whittacker_diff_matrix | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('diff_order', (1, 2))
@pytest.mark.parametrize('lam', (1, 20))
def test_setup_whittacker_diff_matrix(small_data, lam, diff_order):
(_, diff_matrix, *_) = _algorithm_setup._setup_whittaker(small_data, lam, diff_order)
numpy_diff = np.diff(np.eye(small_data.shape[0]), diff_order).T
... | @pytest.mark.parametrize('diff_order', (1, 2))
@pytest.mark.parametrize('lam', (1, 20))
def test_setup_whittacker_diff_matrix(small_data, lam, diff_order):
(_, diff_matrix, *_) = _algorithm_setup._setup_whittaker(small_data, lam, diff_order)
numpy_diff = np.diff(np.eye(small_data.shape[0]), diff_order).T
... |
43298dfd9d60a151efad92809678a82dcaf6b384b34357dff17e2fa6df9d3ed1 | @pytest.mark.parametrize('weight_enum', (0, 1, 2, 3))
def test_setup_whittacker_weights(small_data, weight_enum):
'Ensures output weight matrix and array are correct.'
if (weight_enum == 0):
weights = None
desired_weights = np.ones_like(small_data)
elif (weight_enum == 1):
weights = ... | Ensures output weight matrix and array are correct. | tests/test_algorithm_setup.py | test_setup_whittacker_weights | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('weight_enum', (0, 1, 2, 3))
def test_setup_whittacker_weights(small_data, weight_enum):
if (weight_enum == 0):
weights = None
desired_weights = np.ones_like(small_data)
elif (weight_enum == 1):
weights = np.ones_like(small_data)
desired_weights = we... | @pytest.mark.parametrize('weight_enum', (0, 1, 2, 3))
def test_setup_whittacker_weights(small_data, weight_enum):
if (weight_enum == 0):
weights = None
desired_weights = np.ones_like(small_data)
elif (weight_enum == 1):
weights = np.ones_like(small_data)
desired_weights = we... |
f932e22dba6ded0ae1befa05a7878486afab0278b111cd29b68fd49be7f36a60 | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_polynomial_output_array(small_data, array_enum):
'Ensures output y and x are always numpy arrays and that x is scaled to [-1, 1].'
if (array_enum == 1):
small_data = small_data.tolist()
x_data = small_data.copy()
(y, x, *_) = _algorit... | Ensures output y and x are always numpy arrays and that x is scaled to [-1, 1]. | tests/test_algorithm_setup.py | test_setup_polynomial_output_array | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_polynomial_output_array(small_data, array_enum):
if (array_enum == 1):
small_data = small_data.tolist()
x_data = small_data.copy()
(y, x, *_) = _algorithm_setup._setup_polynomial(small_data, x_data)
assert isinstance(y, np.ndarra... | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_polynomial_output_array(small_data, array_enum):
if (array_enum == 1):
small_data = small_data.tolist()
x_data = small_data.copy()
(y, x, *_) = _algorithm_setup._setup_polynomial(small_data, x_data)
assert isinstance(y, np.ndarra... |
373e7e08cf59a5a35b5accef219fa56162586c3b3b7979058355cac66e11a1ee | def test_setup_polynomial_no_x(small_data):
'Ensures an x array is created if None is input.'
(y, x, *_) = _algorithm_setup._setup_polynomial(small_data)
assert isinstance(x, np.ndarray)
assert_array_equal(x, np.linspace((- 1), 1, y.shape[0])) | Ensures an x array is created if None is input. | tests/test_algorithm_setup.py | test_setup_polynomial_no_x | abdelq/pybaselines | 0 | python | def test_setup_polynomial_no_x(small_data):
(y, x, *_) = _algorithm_setup._setup_polynomial(small_data)
assert isinstance(x, np.ndarray)
assert_array_equal(x, np.linspace((- 1), 1, y.shape[0])) | def test_setup_polynomial_no_x(small_data):
(y, x, *_) = _algorithm_setup._setup_polynomial(small_data)
assert isinstance(x, np.ndarray)
assert_array_equal(x, np.linspace((- 1), 1, y.shape[0]))<|docstring|>Ensures an x array is created if None is input.<|endoftext|> |
741860d43c510d93e2e376572dd48a7e2d400108ad701066da82eb7412cea6d6 | @pytest.mark.parametrize('weight_enum', (0, 1, 2, 3))
def test_setup_polynomial_weights(small_data, weight_enum):
'Ensures output weight array is correctly handled.'
if (weight_enum == 0):
weights = None
desired_weights = np.ones_like(small_data)
elif (weight_enum == 1):
weights = np... | Ensures output weight array is correctly handled. | tests/test_algorithm_setup.py | test_setup_polynomial_weights | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('weight_enum', (0, 1, 2, 3))
def test_setup_polynomial_weights(small_data, weight_enum):
if (weight_enum == 0):
weights = None
desired_weights = np.ones_like(small_data)
elif (weight_enum == 1):
weights = np.ones_like(small_data)
desired_weights = we... | @pytest.mark.parametrize('weight_enum', (0, 1, 2, 3))
def test_setup_polynomial_weights(small_data, weight_enum):
if (weight_enum == 0):
weights = None
desired_weights = np.ones_like(small_data)
elif (weight_enum == 1):
weights = np.ones_like(small_data)
desired_weights = we... |
c03b18f29b840975e652bc75879985e771983584b0a27360f6c02a6b25e04863 | def test_setup_polynomial_domain(small_data):
'Ensures output domain array is correct.'
x = np.linspace((- 5), 20, len(small_data))
(*_, original_domain) = _algorithm_setup._setup_polynomial(small_data, x)
assert_array_equal(original_domain, np.array([(- 5), 20])) | Ensures output domain array is correct. | tests/test_algorithm_setup.py | test_setup_polynomial_domain | abdelq/pybaselines | 0 | python | def test_setup_polynomial_domain(small_data):
x = np.linspace((- 5), 20, len(small_data))
(*_, original_domain) = _algorithm_setup._setup_polynomial(small_data, x)
assert_array_equal(original_domain, np.array([(- 5), 20])) | def test_setup_polynomial_domain(small_data):
x = np.linspace((- 5), 20, len(small_data))
(*_, original_domain) = _algorithm_setup._setup_polynomial(small_data, x)
assert_array_equal(original_domain, np.array([(- 5), 20]))<|docstring|>Ensures output domain array is correct.<|endoftext|> |
b11dc24d54f49f27e8f90020615eee0b7581e4461c99ba8baf3e756e5168d862 | @pytest.mark.parametrize('vander_enum', (0, 1, 2, 3))
def test_setup_polynomial_vandermonde(small_data, vander_enum):
'Ensures that the Vandermonde matrix and the pseudo-inverse matrix are correct.'
if (vander_enum == 0):
weights = None
poly_order = 2
elif (vander_enum == 1):
weights... | Ensures that the Vandermonde matrix and the pseudo-inverse matrix are correct. | tests/test_algorithm_setup.py | test_setup_polynomial_vandermonde | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('vander_enum', (0, 1, 2, 3))
def test_setup_polynomial_vandermonde(small_data, vander_enum):
if (vander_enum == 0):
weights = None
poly_order = 2
elif (vander_enum == 1):
weights = np.ones_like(small_data)
poly_order = 4
elif (vander_enum == 2):
... | @pytest.mark.parametrize('vander_enum', (0, 1, 2, 3))
def test_setup_polynomial_vandermonde(small_data, vander_enum):
if (vander_enum == 0):
weights = None
poly_order = 2
elif (vander_enum == 1):
weights = np.ones_like(small_data)
poly_order = 4
elif (vander_enum == 2):
... |
218fec69bf5ea3f3d42addb5c0ed53fb1b301ae2ea4b81b5d92ec209d786ee9f | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_window_y_array(small_data, array_enum):
'Ensures output y is always a numpy array.'
if (array_enum == 1):
small_data = small_data.tolist()
y = _algorithm_setup._setup_window(small_data, 1)
assert isinstance(y, np.ndarray) | Ensures output y is always a numpy array. | tests/test_algorithm_setup.py | test_setup_window_y_array | abdelq/pybaselines | 0 | python | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_window_y_array(small_data, array_enum):
if (array_enum == 1):
small_data = small_data.tolist()
y = _algorithm_setup._setup_window(small_data, 1)
assert isinstance(y, np.ndarray) | @pytest.mark.parametrize('array_enum', (0, 1))
def test_setup_window_y_array(small_data, array_enum):
if (array_enum == 1):
small_data = small_data.tolist()
y = _algorithm_setup._setup_window(small_data, 1)
assert isinstance(y, np.ndarray)<|docstring|>Ensures output y is always a numpy array.<|... |
1af685574294d838d7a676d6ae6d14393cfc4bfc118ba1753773c3b20ece606d | def test_setup_window_shape(small_data):
'Ensures output y is correctly padded.'
pad_length = 4
y = _algorithm_setup._setup_window(small_data, pad_length, mode='edge')
assert (y.shape[0] == (small_data.shape[0] + (2 * pad_length))) | Ensures output y is correctly padded. | tests/test_algorithm_setup.py | test_setup_window_shape | abdelq/pybaselines | 0 | python | def test_setup_window_shape(small_data):
pad_length = 4
y = _algorithm_setup._setup_window(small_data, pad_length, mode='edge')
assert (y.shape[0] == (small_data.shape[0] + (2 * pad_length))) | def test_setup_window_shape(small_data):
pad_length = 4
y = _algorithm_setup._setup_window(small_data, pad_length, mode='edge')
assert (y.shape[0] == (small_data.shape[0] + (2 * pad_length)))<|docstring|>Ensures output y is correctly padded.<|endoftext|> |
f0c03c9c9dbcbccd1b6bc4cef845dc78e8503d1f6dab4bb6d802df472e9b5c4b | def test_blink(self):
'Turn red LED on for 500ms (non-blocking).'
self.red_led.blink(duration=500)
time.sleep(0.5) | Turn red LED on for 500ms (non-blocking). | examples/01-basic/02-led-stimulus/test_led.py | test_blink | fragmuffin/upytester | 4 | python | def test_blink(self):
self.red_led.blink(duration=500)
time.sleep(0.5) | def test_blink(self):
self.red_led.blink(duration=500)
time.sleep(0.5)<|docstring|>Turn red LED on for 500ms (non-blocking).<|endoftext|> |
68d1b9280df1fb7ae31204f74154d8c8eda78f03aa35c3e56fb2da497d60d386 | def test_led_set(self):
'Turn green LED on for 500ms (blocking).'
self.green_led.on()
time.sleep(0.5)
self.green_led.off() | Turn green LED on for 500ms (blocking). | examples/01-basic/02-led-stimulus/test_led.py | test_led_set | fragmuffin/upytester | 4 | python | def test_led_set(self):
self.green_led.on()
time.sleep(0.5)
self.green_led.off() | def test_led_set(self):
self.green_led.on()
time.sleep(0.5)
self.green_led.off()<|docstring|>Turn green LED on for 500ms (blocking).<|endoftext|> |
121a30677200b7bf649e9511e146bb77b928f6050227a0297e53c8e0baca1dc9 | def test_family_name_notnull(self):
'This is a regression test against #1682\n (https://github.com/carpentries/amy/issues/1682).\n\n The error was: family name was allowed to be null, which caused 500 errors\n when trying to save person without the family name.\n The actual error happene... | This is a regression test against #1682
(https://github.com/carpentries/amy/issues/1682).
The error was: family name was allowed to be null, which caused 500 errors
when trying to save person without the family name.
The actual error happened in the name normalization (util.normalize_name). | amy/workshops/tests/test_person.py | test_family_name_notnull | swcarpentry/amy | 53 | python | def test_family_name_notnull(self):
'This is a regression test against #1682\n (https://github.com/carpentries/amy/issues/1682).\n\n The error was: family name was allowed to be null, which caused 500 errors\n when trying to save person without the family name.\n The actual error happene... | def test_family_name_notnull(self):
'This is a regression test against #1682\n (https://github.com/carpentries/amy/issues/1682).\n\n The error was: family name was allowed to be null, which caused 500 errors\n when trying to save person without the family name.\n The actual error happene... |
5eeaa36b15b481678a0a97afdab6c24e093305a97001c395fe4fb37e565b42c5 | def test_login_with_email(self):
"Make sure we can login with user's email too, not only with the\n username."
self.client.logout()
email = 'example@example.com'
user = authenticate(username=email, password='admin')
self.assertEqual(user, self.admin) | Make sure we can login with user's email too, not only with the
username. | amy/workshops/tests/test_person.py | test_login_with_email | swcarpentry/amy | 53 | python | def test_login_with_email(self):
"Make sure we can login with user's email too, not only with the\n username."
self.client.logout()
email = 'example@example.com'
user = authenticate(username=email, password='admin')
self.assertEqual(user, self.admin) | def test_login_with_email(self):
"Make sure we can login with user's email too, not only with the\n username."
self.client.logout()
email = 'example@example.com'
user = authenticate(username=email, password='admin')
self.assertEqual(user, self.admin)<|docstring|>Make sure we can login with us... |
1a04f18fc26bdc34a60e391af4cb74e2d415ba34dfe47488e5330d62d8093ce0 | def test_1185_regression(self):
"Ensure that admins without superuser privileges,\n but with 'change_person' permission can edit other people.\n\n Regression test against\n https://github.com/swcarpentry/amy/issues/1185."
manager = Person.objects.create_user(username='manager', personal='Ma... | Ensure that admins without superuser privileges,
but with 'change_person' permission can edit other people.
Regression test against
https://github.com/swcarpentry/amy/issues/1185. | amy/workshops/tests/test_person.py | test_1185_regression | swcarpentry/amy | 53 | python | def test_1185_regression(self):
"Ensure that admins without superuser privileges,\n but with 'change_person' permission can edit other people.\n\n Regression test against\n https://github.com/swcarpentry/amy/issues/1185."
manager = Person.objects.create_user(username='manager', personal='Ma... | def test_1185_regression(self):
"Ensure that admins without superuser privileges,\n but with 'change_person' permission can edit other people.\n\n Regression test against\n https://github.com/swcarpentry/amy/issues/1185."
manager = Person.objects.create_user(username='manager', personal='Ma... |
385ab735c532ea86b3b3503b8c5454aa38df3023b40cf4ba7bb5c3b70e565599 | def test_person_award_badge(self):
'Ensure that we can add an award from `person_edit` view'
url = reverse('person_edit', args=[self.spiderman.pk])
person_edit = self.app.get(url, user='admin')
award_form = person_edit.forms[2]
award_form['award-badge'] = self.swc_instructor.pk
self.assertEqual(... | Ensure that we can add an award from `person_edit` view | amy/workshops/tests/test_person.py | test_person_award_badge | swcarpentry/amy | 53 | python | def test_person_award_badge(self):
url = reverse('person_edit', args=[self.spiderman.pk])
person_edit = self.app.get(url, user='admin')
award_form = person_edit.forms[2]
award_form['award-badge'] = self.swc_instructor.pk
self.assertEqual(self.spiderman.award_set.count(), 0)
self.assertRedir... | def test_person_award_badge(self):
url = reverse('person_edit', args=[self.spiderman.pk])
person_edit = self.app.get(url, user='admin')
award_form = person_edit.forms[2]
award_form['award-badge'] = self.swc_instructor.pk
self.assertEqual(self.spiderman.award_set.count(), 0)
self.assertRedir... |
e8cc69371d7628370d1018e2871402d11b710d58d73b9f522e6efcb51d2cc661 | def test_person_failed_training_warning(self):
'\n Ensure that the form warns the admin if the person\n has a failed training, and an award or task is added\n '
warning_popup = 'return confirm("Warning: Trainee failed previous training(s). Are you sure you want to continue?");'
url = re... | Ensure that the form warns the admin if the person
has a failed training, and an award or task is added | amy/workshops/tests/test_person.py | test_person_failed_training_warning | swcarpentry/amy | 53 | python | def test_person_failed_training_warning(self):
'\n Ensure that the form warns the admin if the person\n has a failed training, and an award or task is added\n '
warning_popup = 'return confirm("Warning: Trainee failed previous training(s). Are you sure you want to continue?");'
url = re... | def test_person_failed_training_warning(self):
'\n Ensure that the form warns the admin if the person\n has a failed training, and an award or task is added\n '
warning_popup = 'return confirm("Warning: Trainee failed previous training(s). Are you sure you want to continue?");'
url = re... |
8bf03674e8927ee9300d017ae3bb447a9fc5f9f638c1216afc14921183d30984 | def test_person_add_task(self):
'Ensure that we can add a task from `person_edit` view'
self._setUpEvents()
role = Role.objects.create(name='test_role')
url = reverse('person_edit', args=[self.spiderman.pk])
person_edit = self.app.get(url, user='admin')
task_form = person_edit.forms[3]
task_... | Ensure that we can add a task from `person_edit` view | amy/workshops/tests/test_person.py | test_person_add_task | swcarpentry/amy | 53 | python | def test_person_add_task(self):
self._setUpEvents()
role = Role.objects.create(name='test_role')
url = reverse('person_edit', args=[self.spiderman.pk])
person_edit = self.app.get(url, user='admin')
task_form = person_edit.forms[3]
task_form['task-event'].force_value(Event.objects.first().pk... | def test_person_add_task(self):
self._setUpEvents()
role = Role.objects.create(name='test_role')
url = reverse('person_edit', args=[self.spiderman.pk])
person_edit = self.app.get(url, user='admin')
task_form = person_edit.forms[3]
task_form['task-event'].force_value(Event.objects.first().pk... |
fb05391e6498227b10fddfd0641cd5c7aea914870188273be5d6ee1712912f66 | def test_edit_person_permissions(self):
'Make sure we can set up user permissions correctly.'
assert (not self.hermione.is_superuser)
assert (self.hermione.user_permissions.count() == 0)
assert (self.hermione.groups.count() == 0)
user_permissions = Permission.objects.filter(content_type__app_label='... | Make sure we can set up user permissions correctly. | amy/workshops/tests/test_person.py | test_edit_person_permissions | swcarpentry/amy | 53 | python | def test_edit_person_permissions(self):
assert (not self.hermione.is_superuser)
assert (self.hermione.user_permissions.count() == 0)
assert (self.hermione.groups.count() == 0)
user_permissions = Permission.objects.filter(content_type__app_label='admin')
user_permissions_ids = user_permissions.v... | def test_edit_person_permissions(self):
assert (not self.hermione.is_superuser)
assert (self.hermione.user_permissions.count() == 0)
assert (self.hermione.groups.count() == 0)
user_permissions = Permission.objects.filter(content_type__app_label='admin')
user_permissions_ids = user_permissions.v... |
eff87521a015421d9e727b0bab41f1ff67ecc7be9d48efe9dc0ffff77fb2688b | def test_delete_person(self):
'Make sure deleted person is longer accessible.\n\n Additionally check on_delete behavior for Task, Qualification, and\n Award.'
role = Role.objects.create(name='instructor')
event = Event.objects.create(slug='test-event', host=self.org_alpha)
people = [self.h... | Make sure deleted person is longer accessible.
Additionally check on_delete behavior for Task, Qualification, and
Award. | amy/workshops/tests/test_person.py | test_delete_person | swcarpentry/amy | 53 | python | def test_delete_person(self):
'Make sure deleted person is longer accessible.\n\n Additionally check on_delete behavior for Task, Qualification, and\n Award.'
role = Role.objects.create(name='instructor')
event = Event.objects.create(slug='test-event', host=self.org_alpha)
people = [self.h... | def test_delete_person(self):
'Make sure deleted person is longer accessible.\n\n Additionally check on_delete behavior for Task, Qualification, and\n Award.'
role = Role.objects.create(name='instructor')
event = Event.objects.create(slug='test-event', host=self.org_alpha)
people = [self.h... |
6e00d49aeb0addbf20a5071444719b60201cb328c3b88c4df67fe4defe918da8 | def test_editing_qualifications(self):
'Make sure we can edit user lessons without any issues.'
assert (set(self.hermione.lessons.all()) == {self.git, self.sql})
url = reverse('person_edit', args=[self.hermione.pk])
data = PersonForm(instance=self.hermione).initial
data['lessons'] = [self.git.pk]
... | Make sure we can edit user lessons without any issues. | amy/workshops/tests/test_person.py | test_editing_qualifications | swcarpentry/amy | 53 | python | def test_editing_qualifications(self):
assert (set(self.hermione.lessons.all()) == {self.git, self.sql})
url = reverse('person_edit', args=[self.hermione.pk])
data = PersonForm(instance=self.hermione).initial
data['lessons'] = [self.git.pk]
response = self.client.post(url, data)
assert (res... | def test_editing_qualifications(self):
assert (set(self.hermione.lessons.all()) == {self.git, self.sql})
url = reverse('person_edit', args=[self.hermione.pk])
data = PersonForm(instance=self.hermione).initial
data['lessons'] = [self.git.pk]
response = self.client.post(url, data)
assert (res... |
61f3d4bcd1cc4e966075e4c14992b1b82309d50efb1d9898a0bfe8e4da9e0be0 | def test_person_add_lessons(self):
"Check if it's still possible to add lessons via PersonCreate\n view."
data = {'username': 'test', 'personal': 'Test', 'family': 'Test', 'gender': 'U', 'lessons': [1, 2]}
rv = self.client.post(reverse('person_add'), data)
assert (rv.status_code == 302)
data ... | Check if it's still possible to add lessons via PersonCreate
view. | amy/workshops/tests/test_person.py | test_person_add_lessons | swcarpentry/amy | 53 | python | def test_person_add_lessons(self):
"Check if it's still possible to add lessons via PersonCreate\n view."
data = {'username': 'test', 'personal': 'Test', 'family': 'Test', 'gender': 'U', 'lessons': [1, 2]}
rv = self.client.post(reverse('person_add'), data)
assert (rv.status_code == 302)
data ... | def test_person_add_lessons(self):
"Check if it's still possible to add lessons via PersonCreate\n view."
data = {'username': 'test', 'personal': 'Test', 'family': 'Test', 'gender': 'U', 'lessons': [1, 2]}
rv = self.client.post(reverse('person_add'), data)
assert (rv.status_code == 302)
data ... |
5e6d9a9f5135504c802e7a769681739eb0b58da1d9cb4bfd6ebd44aedeced9b0 | def test_person_success_message(self):
'Since PersonCreate view simulates SuccessMessageMixin, check if it\n does it correctly.'
data = {'username': 'test', 'personal': 'Test', 'family': 'Test', 'gender': 'U', 'lessons': [1, 2]}
rv = self.client.post(reverse('person_add'), data, follow=True)
asse... | Since PersonCreate view simulates SuccessMessageMixin, check if it
does it correctly. | amy/workshops/tests/test_person.py | test_person_success_message | swcarpentry/amy | 53 | python | def test_person_success_message(self):
'Since PersonCreate view simulates SuccessMessageMixin, check if it\n does it correctly.'
data = {'username': 'test', 'personal': 'Test', 'family': 'Test', 'gender': 'U', 'lessons': [1, 2]}
rv = self.client.post(reverse('person_add'), data, follow=True)
asse... | def test_person_success_message(self):
'Since PersonCreate view simulates SuccessMessageMixin, check if it\n does it correctly.'
data = {'username': 'test', 'personal': 'Test', 'family': 'Test', 'gender': 'U', 'lessons': [1, 2]}
rv = self.client.post(reverse('person_add'), data, follow=True)
asse... |
cd30528e5243e84e33e947dcad7067f211bfcb142799657a3c235802d4d54fd4 | def test_person_username_validation(self):
"Ensure username doesn't allow for non-ASCII characters."
invalid_usernames = ['Zażółć gęślą jaźń', 'chrząszcz']
for username in invalid_usernames:
with self.subTest(username=username):
person = Person.objects.create(personal='Testing', family='... | Ensure username doesn't allow for non-ASCII characters. | amy/workshops/tests/test_person.py | test_person_username_validation | swcarpentry/amy | 53 | python | def test_person_username_validation(self):
invalid_usernames = ['Zażółć gęślą jaźń', 'chrząszcz']
for username in invalid_usernames:
with self.subTest(username=username):
person = Person.objects.create(personal='Testing', family='Testing', username=username)
with self.assert... | def test_person_username_validation(self):
invalid_usernames = ['Zażółć gęślą jaźń', 'chrząszcz']
for username in invalid_usernames:
with self.subTest(username=username):
person = Person.objects.create(personal='Testing', family='Testing', username=username)
with self.assert... |
9028ab0b17baf786340278bd3d60dcf3c42991362952aa442f6adb851b31fb69 | def test_new_person_auto_username(self):
"Ensure after adding a new person, they're automatically assigned\n a unique username."
url = reverse('person_add')
data = {'personal': 'Albert', 'family': 'Einstein', 'gender': 'U'}
self.client.post(url, data)
Person.objects.get(personal='Albert', fam... | Ensure after adding a new person, they're automatically assigned
a unique username. | amy/workshops/tests/test_person.py | test_new_person_auto_username | swcarpentry/amy | 53 | python | def test_new_person_auto_username(self):
"Ensure after adding a new person, they're automatically assigned\n a unique username."
url = reverse('person_add')
data = {'personal': 'Albert', 'family': 'Einstein', 'gender': 'U'}
self.client.post(url, data)
Person.objects.get(personal='Albert', fam... | def test_new_person_auto_username(self):
"Ensure after adding a new person, they're automatically assigned\n a unique username."
url = reverse('person_add')
data = {'personal': 'Albert', 'family': 'Einstein', 'gender': 'U'}
self.client.post(url, data)
Person.objects.get(personal='Albert', fam... |
c08dbc99468df93f1bdf73894cdcf9376dba508150f4f6c1dec5b53d6a16c11c | def test_person_email_auto_lowercase(self):
"Make sure PersonForm/PersonCreateForm lowercases user's email."
data = {'personal': 'Marie', 'family': 'Skłodowska-Curie', 'gender': 'F', 'email': 'example@example.com'}
url = reverse('person_add')
self.client.post(url, data)
person = Person.objects.get(u... | Make sure PersonForm/PersonCreateForm lowercases user's email. | amy/workshops/tests/test_person.py | test_person_email_auto_lowercase | swcarpentry/amy | 53 | python | def test_person_email_auto_lowercase(self):
data = {'personal': 'Marie', 'family': 'Skłodowska-Curie', 'gender': 'F', 'email': 'example@example.com'}
url = reverse('person_add')
self.client.post(url, data)
person = Person.objects.get(username='skodowska-curie_marie')
self.assertEqual(person.ema... | def test_person_email_auto_lowercase(self):
data = {'personal': 'Marie', 'family': 'Skłodowska-Curie', 'gender': 'F', 'email': 'example@example.com'}
url = reverse('person_add')
self.client.post(url, data)
person = Person.objects.get(username='skodowska-curie_marie')
self.assertEqual(person.ema... |
cd8c2b75dffd660e8e1cb189d7cb7dbf50aecb3b8e912d3a535078667d556c0d | def test_edit_permission_of_person_without_email(self):
'\n Creating a person without email id and then changing\n the permissions for that person.\n '
p = Person.objects.create(personal='P1', family='P1')
response = self.client.get(reverse('person_details', args=[str(p.id)]))
asser... | Creating a person without email id and then changing
the permissions for that person. | amy/workshops/tests/test_person.py | test_edit_permission_of_person_without_email | swcarpentry/amy | 53 | python | def test_edit_permission_of_person_without_email(self):
'\n Creating a person without email id and then changing\n the permissions for that person.\n '
p = Person.objects.create(personal='P1', family='P1')
response = self.client.get(reverse('person_details', args=[str(p.id)]))
asser... | def test_edit_permission_of_person_without_email(self):
'\n Creating a person without email id and then changing\n the permissions for that person.\n '
p = Person.objects.create(personal='P1', family='P1')
response = self.client.get(reverse('person_details', args=[str(p.id)]))
asser... |
5da242882b96dbacffee2bf82e18a25a637f46218fc4aced2a2474e9b3d6e408 | def test_awarding_instructor_badge_workflow(self):
'Test that you can click "SWC" and "DC" labels in "eligible"\n column in trainees list view. When you click them, you\'re moved to\n the view where you can edit person\'s awards. "Award" and "event"\n field should be prefilled in. Also test if ... | Test that you can click "SWC" and "DC" labels in "eligible"
column in trainees list view. When you click them, you're moved to
the view where you can edit person's awards. "Award" and "event"
field should be prefilled in. Also test if you're moved back to
trainees view after adding the badge. | amy/workshops/tests/test_person.py | test_awarding_instructor_badge_workflow | swcarpentry/amy | 53 | python | def test_awarding_instructor_badge_workflow(self):
'Test that you can click "SWC" and "DC" labels in "eligible"\n column in trainees list view. When you click them, you\'re moved to\n the view where you can edit person\'s awards. "Award" and "event"\n field should be prefilled in. Also test if ... | def test_awarding_instructor_badge_workflow(self):
'Test that you can click "SWC" and "DC" labels in "eligible"\n column in trainees list view. When you click them, you\'re moved to\n the view where you can edit person\'s awards. "Award" and "event"\n field should be prefilled in. Also test if ... |
8d55492e2bc5371e2ca294e8fb0506d0b9fc79419d191ef2b413b4d77440dbea | def test_person_github_username_validation(self):
"Ensure GitHub username doesn't allow for spaces or commas."
invalid_usernames = ['Harry James Potter', 'Harry, Hermione, Ron']
for (key, username) in enumerate(invalid_usernames):
with self.subTest(username=username):
person = Person.obj... | Ensure GitHub username doesn't allow for spaces or commas. | amy/workshops/tests/test_person.py | test_person_github_username_validation | swcarpentry/amy | 53 | python | def test_person_github_username_validation(self):
invalid_usernames = ['Harry James Potter', 'Harry, Hermione, Ron']
for (key, username) in enumerate(invalid_usernames):
with self.subTest(username=username):
person = Person.objects.create(personal='Testing', family='Testing', username='... | def test_person_github_username_validation(self):
invalid_usernames = ['Harry James Potter', 'Harry, Hermione, Ron']
for (key, username) in enumerate(invalid_usernames):
with self.subTest(username=username):
person = Person.objects.create(personal='Testing', family='Testing', username='... |
b89a266bbb226a9c8cc931f6171518c7263b792ef9953891ae2e5d9df350ceba | def test_creating_person_with_no_comment(self):
'Ensure that no comment is added when PersonCreateForm without comment\n content is saved.'
self.assertEqual(Comment.objects.count(), 0)
data = {'username': 'curie_marie', 'personal': 'Marie', 'family': 'Curie', 'gender': 'F', 'email': 'example@example.... | Ensure that no comment is added when PersonCreateForm without comment
content is saved. | amy/workshops/tests/test_person.py | test_creating_person_with_no_comment | swcarpentry/amy | 53 | python | def test_creating_person_with_no_comment(self):
'Ensure that no comment is added when PersonCreateForm without comment\n content is saved.'
self.assertEqual(Comment.objects.count(), 0)
data = {'username': 'curie_marie', 'personal': 'Marie', 'family': 'Curie', 'gender': 'F', 'email': 'example@example.... | def test_creating_person_with_no_comment(self):
'Ensure that no comment is added when PersonCreateForm without comment\n content is saved.'
self.assertEqual(Comment.objects.count(), 0)
data = {'username': 'curie_marie', 'personal': 'Marie', 'family': 'Curie', 'gender': 'F', 'email': 'example@example.... |
5c07eecd6f82fe070c073b03320ef220e5648e34efb3bda7afa01252cf80aad8 | def test_creating_person_with_comment(self):
'Ensure that a comment is added when PersonCreateForm with comment\n content is saved.'
self.assertEqual(Comment.objects.count(), 0)
data = {'username': 'curie_marie', 'personal': 'Marie', 'family': 'Curie', 'gender': 'F', 'email': 'example@example.com', '... | Ensure that a comment is added when PersonCreateForm with comment
content is saved. | amy/workshops/tests/test_person.py | test_creating_person_with_comment | swcarpentry/amy | 53 | python | def test_creating_person_with_comment(self):
'Ensure that a comment is added when PersonCreateForm with comment\n content is saved.'
self.assertEqual(Comment.objects.count(), 0)
data = {'username': 'curie_marie', 'personal': 'Marie', 'family': 'Curie', 'gender': 'F', 'email': 'example@example.com', '... | def test_creating_person_with_comment(self):
'Ensure that a comment is added when PersonCreateForm with comment\n content is saved.'
self.assertEqual(Comment.objects.count(), 0)
data = {'username': 'curie_marie', 'personal': 'Marie', 'family': 'Curie', 'gender': 'F', 'email': 'example@example.com', '... |
01a56e0ea33f94c04c4374539ef56cee7806a31a48da397b11a86e70aa7a92a6 | def test_form_invalid_values(self):
'Make sure only a few fields accept third option ("combine").'
hidden = {'person_a': self.person_a.pk, 'person_b': self.person_b.pk}
failing = {'id': 'combine', 'username': 'combine', 'personal': 'combine', 'middle': 'combine', 'family': 'combine', 'email': 'combine', 'se... | Make sure only a few fields accept third option ("combine"). | amy/workshops/tests/test_person.py | test_form_invalid_values | swcarpentry/amy | 53 | python | def test_form_invalid_values(self):
hidden = {'person_a': self.person_a.pk, 'person_b': self.person_b.pk}
failing = {'id': 'combine', 'username': 'combine', 'personal': 'combine', 'middle': 'combine', 'family': 'combine', 'email': 'combine', 'secondary_email': 'combine', 'gender': 'combine', 'gender_other'... | def test_form_invalid_values(self):
hidden = {'person_a': self.person_a.pk, 'person_b': self.person_b.pk}
failing = {'id': 'combine', 'username': 'combine', 'personal': 'combine', 'middle': 'combine', 'family': 'combine', 'email': 'combine', 'secondary_email': 'combine', 'gender': 'combine', 'gender_other'... |
412b7d083a4b678c556001851cd4dde1b34ba11e5f352c88bbfb7527595d3057 | def test_merging_base_person(self):
"Merging: ensure the base person is selected based on ID form\n field.\n\n If ID field has a value of 'obj_b', then person B is base event and it\n won't be removed from the database after the merge. Person A, on the\n other hand, will."
rv = self.... | Merging: ensure the base person is selected based on ID form
field.
If ID field has a value of 'obj_b', then person B is base event and it
won't be removed from the database after the merge. Person A, on the
other hand, will. | amy/workshops/tests/test_person.py | test_merging_base_person | swcarpentry/amy | 53 | python | def test_merging_base_person(self):
"Merging: ensure the base person is selected based on ID form\n field.\n\n If ID field has a value of 'obj_b', then person B is base event and it\n won't be removed from the database after the merge. Person A, on the\n other hand, will."
rv = self.... | def test_merging_base_person(self):
"Merging: ensure the base person is selected based on ID form\n field.\n\n If ID field has a value of 'obj_b', then person B is base event and it\n won't be removed from the database after the merge. Person A, on the\n other hand, will."
rv = self.... |
aa1054c96a67e65513949f525d0f373682067559878e7769ea1483fef438fe6d | def test_merging_basic_attributes(self):
'Merging: ensure basic (non-relationships) attributes are properly\n saved.'
assertions = {'id': self.person_b.id, 'username': self.person_a.username, 'personal': self.person_b.personal, 'middle': self.person_a.middle, 'family': self.person_a.family, 'email': self... | Merging: ensure basic (non-relationships) attributes are properly
saved. | amy/workshops/tests/test_person.py | test_merging_basic_attributes | swcarpentry/amy | 53 | python | def test_merging_basic_attributes(self):
'Merging: ensure basic (non-relationships) attributes are properly\n saved.'
assertions = {'id': self.person_b.id, 'username': self.person_a.username, 'personal': self.person_b.personal, 'middle': self.person_a.middle, 'family': self.person_a.family, 'email': self... | def test_merging_basic_attributes(self):
'Merging: ensure basic (non-relationships) attributes are properly\n saved.'
assertions = {'id': self.person_b.id, 'username': self.person_a.username, 'personal': self.person_b.personal, 'middle': self.person_a.middle, 'family': self.person_a.family, 'email': self... |
b405d1324821c3de88b14316b675019abe9b1841cdcdfc1f61a0ef66c9da37fd | def test_merging_relational_attributes(self):
'Merging: ensure M2M-related fields are properly saved/combined.'
assertions = {'badges': set(Badge.objects.filter(name='swc-instructor')), 'lessons': {self.sql}, 'domains': {KnowledgeDomain.objects.first(), KnowledgeDomain.objects.last()}, 'languages': {Language.ob... | Merging: ensure M2M-related fields are properly saved/combined. | amy/workshops/tests/test_person.py | test_merging_relational_attributes | swcarpentry/amy | 53 | python | def test_merging_relational_attributes(self):
assertions = {'badges': set(Badge.objects.filter(name='swc-instructor')), 'lessons': {self.sql}, 'domains': {KnowledgeDomain.objects.first(), KnowledgeDomain.objects.last()}, 'languages': {Language.objects.first(), Language.objects.last()}, 'task_set': set(Task.obj... | def test_merging_relational_attributes(self):
assertions = {'badges': set(Badge.objects.filter(name='swc-instructor')), 'lessons': {self.sql}, 'domains': {KnowledgeDomain.objects.first(), KnowledgeDomain.objects.last()}, 'languages': {Language.objects.first(), Language.objects.last()}, 'task_set': set(Task.obj... |
6ede70b3da14224c8aceda5580cf8288574247ff4f1d46f1c5b4a2a38b1c2820 | def test_merging_m2m_attributes(self):
"Merging: ensure M2M-related fields are properly saved/combined.\n This is a regression test; we have to ensure that M2M objects aren't\n removed from the database."
assertions = {'badges': set(Badge.objects.filter(name='swc-instructor')), 'lessons': {self.sq... | Merging: ensure M2M-related fields are properly saved/combined.
This is a regression test; we have to ensure that M2M objects aren't
removed from the database. | amy/workshops/tests/test_person.py | test_merging_m2m_attributes | swcarpentry/amy | 53 | python | def test_merging_m2m_attributes(self):
"Merging: ensure M2M-related fields are properly saved/combined.\n This is a regression test; we have to ensure that M2M objects aren't\n removed from the database."
assertions = {'badges': set(Badge.objects.filter(name='swc-instructor')), 'lessons': {self.sq... | def test_merging_m2m_attributes(self):
"Merging: ensure M2M-related fields are properly saved/combined.\n This is a regression test; we have to ensure that M2M objects aren't\n removed from the database."
assertions = {'badges': set(Badge.objects.filter(name='swc-instructor')), 'lessons': {self.sq... |
c094f48ef80836b50d87b971633da9e477e5063078d3859cb1021f0598d6a3c7 | def test_merging_m2m_with_similar_attributes(self):
"Regression test: merging people with the same M2M objects, e.g. when\n both people have task 'learner' in event 'ABCD', would result in unique\n constraint violation and cause IntegrityError."
self.person_b.task_set.create(event=Event.objects.ge... | Regression test: merging people with the same M2M objects, e.g. when
both people have task 'learner' in event 'ABCD', would result in unique
constraint violation and cause IntegrityError. | amy/workshops/tests/test_person.py | test_merging_m2m_with_similar_attributes | swcarpentry/amy | 53 | python | def test_merging_m2m_with_similar_attributes(self):
"Regression test: merging people with the same M2M objects, e.g. when\n both people have task 'learner' in event 'ABCD', would result in unique\n constraint violation and cause IntegrityError."
self.person_b.task_set.create(event=Event.objects.ge... | def test_merging_m2m_with_similar_attributes(self):
"Regression test: merging people with the same M2M objects, e.g. when\n both people have task 'learner' in event 'ABCD', would result in unique\n constraint violation and cause IntegrityError."
self.person_b.task_set.create(event=Event.objects.ge... |
28d56b7387f595a19807e7532891a5629921d4d3e682cff161dda1345c670c61 | def test_merging_comments_strategy1(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 1 (combine).'
self.strategy['comments'] = 'combine'
comments = [self.ca_2, self.cb_2]
rv = self.client.post(self.url, data=self.strategy)
... | Ensure comments regarding persons are correctly merged using
`merge_objects`.
This test uses strategy 1 (combine). | amy/workshops/tests/test_person.py | test_merging_comments_strategy1 | swcarpentry/amy | 53 | python | def test_merging_comments_strategy1(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 1 (combine).'
self.strategy['comments'] = 'combine'
comments = [self.ca_2, self.cb_2]
rv = self.client.post(self.url, data=self.strategy)
... | def test_merging_comments_strategy1(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 1 (combine).'
self.strategy['comments'] = 'combine'
comments = [self.ca_2, self.cb_2]
rv = self.client.post(self.url, data=self.strategy)
... |
b6a8075562bd3b7512e9cf5af23d31340e0cf56ba453695f63dc4326ebe686a5 | def test_merging_comments_strategy2(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 2 (object a).'
self.strategy['comments'] = 'obj_a'
comments = [self.ca_2]
rv = self.client.post(self.url, data=self.strategy)
self.asser... | Ensure comments regarding persons are correctly merged using
`merge_objects`.
This test uses strategy 2 (object a). | amy/workshops/tests/test_person.py | test_merging_comments_strategy2 | swcarpentry/amy | 53 | python | def test_merging_comments_strategy2(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 2 (object a).'
self.strategy['comments'] = 'obj_a'
comments = [self.ca_2]
rv = self.client.post(self.url, data=self.strategy)
self.asser... | def test_merging_comments_strategy2(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 2 (object a).'
self.strategy['comments'] = 'obj_a'
comments = [self.ca_2]
rv = self.client.post(self.url, data=self.strategy)
self.asser... |
473f50378aae0c0e84d37c6b25e5e430b8136e580c29e4985a458ebd2d89ed8f | def test_merging_comments_strategy3(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 3 (object b).'
self.strategy['comments'] = 'obj_b'
comments = [self.cb_2]
rv = self.client.post(self.url, data=self.strategy)
self.asser... | Ensure comments regarding persons are correctly merged using
`merge_objects`.
This test uses strategy 3 (object b). | amy/workshops/tests/test_person.py | test_merging_comments_strategy3 | swcarpentry/amy | 53 | python | def test_merging_comments_strategy3(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 3 (object b).'
self.strategy['comments'] = 'obj_b'
comments = [self.cb_2]
rv = self.client.post(self.url, data=self.strategy)
self.asser... | def test_merging_comments_strategy3(self):
'Ensure comments regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 3 (object b).'
self.strategy['comments'] = 'obj_b'
comments = [self.cb_2]
rv = self.client.post(self.url, data=self.strategy)
self.asser... |
6dde259530a2952510d7ec9b56069d8956267f226e90ffd74c3db0709b4d1da3 | def test_merging_consents_combine(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 1 (combine).'
self.strategy['consent_set'] = 'combine'
expected_consents = list(Consent.objects.filter(person__in=[self.person_a, self.person_b]))... | Ensure consents regarding persons are correctly merged using
`merge_objects`.
This test uses strategy 1 (combine). | amy/workshops/tests/test_person.py | test_merging_consents_combine | swcarpentry/amy | 53 | python | def test_merging_consents_combine(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 1 (combine).'
self.strategy['consent_set'] = 'combine'
expected_consents = list(Consent.objects.filter(person__in=[self.person_a, self.person_b]))... | def test_merging_consents_combine(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 1 (combine).'
self.strategy['consent_set'] = 'combine'
expected_consents = list(Consent.objects.filter(person__in=[self.person_a, self.person_b]))... |
06b7f620633b59c333ca63649923e7cb2d2356af0fe0b3bdec28cd8a1ca811a1 | def test_merging_consents_obj_a(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 2 (object a).'
self.strategy['consent_set'] = 'obj_a'
expected_consents = list(Consent.objects.filter(person=self.person_a))
rv = self.client.po... | Ensure consents regarding persons are correctly merged using
`merge_objects`.
This test uses strategy 2 (object a). | amy/workshops/tests/test_person.py | test_merging_consents_obj_a | swcarpentry/amy | 53 | python | def test_merging_consents_obj_a(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 2 (object a).'
self.strategy['consent_set'] = 'obj_a'
expected_consents = list(Consent.objects.filter(person=self.person_a))
rv = self.client.po... | def test_merging_consents_obj_a(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 2 (object a).'
self.strategy['consent_set'] = 'obj_a'
expected_consents = list(Consent.objects.filter(person=self.person_a))
rv = self.client.po... |
f97ab71beceb386b6cd7e4f262198a999071deaeed79d3f557bdb0f541922899 | def test_merging_consents_obj_b(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 3 (object b).'
self.strategy['consent_set'] = 'obj_b'
expected_consents = list(Consent.objects.filter(person=self.person_b))
rv = self.client.po... | Ensure consents regarding persons are correctly merged using
`merge_objects`.
This test uses strategy 3 (object b). | amy/workshops/tests/test_person.py | test_merging_consents_obj_b | swcarpentry/amy | 53 | python | def test_merging_consents_obj_b(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 3 (object b).'
self.strategy['consent_set'] = 'obj_b'
expected_consents = list(Consent.objects.filter(person=self.person_b))
rv = self.client.po... | def test_merging_consents_obj_b(self):
'Ensure consents regarding persons are correctly merged using\n `merge_objects`.\n This test uses strategy 3 (object b).'
self.strategy['consent_set'] = 'obj_b'
expected_consents = list(Consent.objects.filter(person=self.person_b))
rv = self.client.po... |
21eac9b6d15574e1b02d92ea3e9dbef44170d1d20117b16dc102dc37b50192a4 | def test_errors_are_not_hidden(self):
"Test that errors occuring in synchronize_usersocialauth are not\n hidden, that is you're not redirected to any other view. Regression\n for #890."
self._setUpUsersAndLogin()
with patch.object(Person, 'synchronize_usersocialauth', side_effect=NotImplemente... | Test that errors occuring in synchronize_usersocialauth are not
hidden, that is you're not redirected to any other view. Regression
for #890. | amy/workshops/tests/test_person.py | test_errors_are_not_hidden | swcarpentry/amy | 53 | python | def test_errors_are_not_hidden(self):
"Test that errors occuring in synchronize_usersocialauth are not\n hidden, that is you're not redirected to any other view. Regression\n for #890."
self._setUpUsersAndLogin()
with patch.object(Person, 'synchronize_usersocialauth', side_effect=NotImplemente... | def test_errors_are_not_hidden(self):
"Test that errors occuring in synchronize_usersocialauth are not\n hidden, that is you're not redirected to any other view. Regression\n for #890."
self._setUpUsersAndLogin()
with patch.object(Person, 'synchronize_usersocialauth', side_effect=NotImplemente... |
f4368df8d46ebfbe8040aff1712cdf0de1f18869c3351ea946ed229cd92c92da | def assert_person_archive(self, person: Person) -> None:
'\n Calls the Person Archive endpoint and asserts that the\n given Person has been archived.\n '
awards = person.award_set.all()
qualifications = person.qualification_set.all()
tasks = person.task_set.all()
domains = perso... | Calls the Person Archive endpoint and asserts that the
given Person has been archived. | amy/workshops/tests/test_person.py | assert_person_archive | swcarpentry/amy | 53 | python | def assert_person_archive(self, person: Person) -> None:
'\n Calls the Person Archive endpoint and asserts that the\n given Person has been archived.\n '
awards = person.award_set.all()
qualifications = person.qualification_set.all()
tasks = person.task_set.all()
domains = perso... | def assert_person_archive(self, person: Person) -> None:
'\n Calls the Person Archive endpoint and asserts that the\n given Person has been archived.\n '
awards = person.award_set.all()
qualifications = person.qualification_set.all()
tasks = person.task_set.all()
domains = perso... |
434a40365c15d0581817decaab0a51a0f5e75fc561df8c6cbeb4b0066efe9787 | def _assert_personal_info_removed(self, archived_profile: Person) -> None:
'\n Used after calling person.archive()\n Asserts that all personal data about the user has been removed.\n '
self.assertIsNone(archived_profile.email)
self.assertEqual(archived_profile.secondary_email, '')
s... | Used after calling person.archive()
Asserts that all personal data about the user has been removed. | amy/workshops/tests/test_person.py | _assert_personal_info_removed | swcarpentry/amy | 53 | python | def _assert_personal_info_removed(self, archived_profile: Person) -> None:
'\n Used after calling person.archive()\n Asserts that all personal data about the user has been removed.\n '
self.assertIsNone(archived_profile.email)
self.assertEqual(archived_profile.secondary_email, )
sel... | def _assert_personal_info_removed(self, archived_profile: Person) -> None:
'\n Used after calling person.archive()\n Asserts that all personal data about the user has been removed.\n '
self.assertIsNone(archived_profile.email)
self.assertEqual(archived_profile.secondary_email, )
sel... |
410b0945898e93bb1a99a39292c4a35145c09daa8cbb263ac519b26ea89b4569 | def test_archive_by_super_user(self):
'\n Superusers should be able to archive any user.\n '
self.assertTrue(self.client.login(username=self.admin.username, password='admin'))
self.assert_person_archive(self.harry)
self.assert_person_archive(self.ron)
self.assert_person_archive(self.he... | Superusers should be able to archive any user. | amy/workshops/tests/test_person.py | test_archive_by_super_user | swcarpentry/amy | 53 | python | def test_archive_by_super_user(self):
'\n \n '
self.assertTrue(self.client.login(username=self.admin.username, password='admin'))
self.assert_person_archive(self.harry)
self.assert_person_archive(self.ron)
self.assert_person_archive(self.hermione)
self.assert_person_archive(self.us... | def test_archive_by_super_user(self):
'\n \n '
self.assertTrue(self.client.login(username=self.admin.username, password='admin'))
self.assert_person_archive(self.harry)
self.assert_person_archive(self.ron)
self.assert_person_archive(self.hermione)
self.assert_person_archive(self.us... |
b8f6e34a59f34d826017dc4b28a2c55e7591f1610e62d9ef57867ce20c6eaeee | def test_archive_by_non_admin(self):
'\n Non-Admin users should be able to archive their own profiles.\n '
assert (not self.user.is_superuser)
self.assertTrue(self.client.login(username=self.user.username, password='pass'))
self.assert_cannot_archive(self.ron)
self.assert_cannot_archiv... | Non-Admin users should be able to archive their own profiles. | amy/workshops/tests/test_person.py | test_archive_by_non_admin | swcarpentry/amy | 53 | python | def test_archive_by_non_admin(self):
'\n \n '
assert (not self.user.is_superuser)
self.assertTrue(self.client.login(username=self.user.username, password='pass'))
self.assert_cannot_archive(self.ron)
self.assert_cannot_archive(self.hermione)
self.assert_cannot_archive(self.harry)
... | def test_archive_by_non_admin(self):
'\n \n '
assert (not self.user.is_superuser)
self.assertTrue(self.client.login(username=self.user.username, password='pass'))
self.assert_cannot_archive(self.ron)
self.assert_cannot_archive(self.hermione)
self.assert_cannot_archive(self.harry)
... |
115ef8084f469d0d69a985e2c5c10f9d5ea2d6cc7003fbcaaeba4a2ccd4994fb | @classmethod
@abstractmethod
async def will_trigger(cls, app: FastAPI, scheduler_data: SchedulerData) -> bool:
'\n When returning True the event will trigger and the action\n code will be executed\n ' | When returning True the event will trigger and the action
code will be executed | services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/abc.py | will_trigger | colinRawlings/osparc-simcore | 25 | python | @classmethod
@abstractmethod
async def will_trigger(cls, app: FastAPI, scheduler_data: SchedulerData) -> bool:
'\n When returning True the event will trigger and the action\n code will be executed\n ' | @classmethod
@abstractmethod
async def will_trigger(cls, app: FastAPI, scheduler_data: SchedulerData) -> bool:
'\n When returning True the event will trigger and the action\n code will be executed\n '<|docstring|>When returning True the event will trigger and the action
code will be executed<|e... |
7e7aab1131bc4e3a7e50fb122dad0a3d367749ba541c4f8a4c68f43c650c817c | @classmethod
@abstractmethod
async def action(cls, app: FastAPI, scheduler_data: SchedulerData) -> None:
'\n User defined code for this specific event.\n All updates to the status(SchedulerData) should be applied to the current variable\n ' | User defined code for this specific event.
All updates to the status(SchedulerData) should be applied to the current variable | services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/abc.py | action | colinRawlings/osparc-simcore | 25 | python | @classmethod
@abstractmethod
async def action(cls, app: FastAPI, scheduler_data: SchedulerData) -> None:
'\n User defined code for this specific event.\n All updates to the status(SchedulerData) should be applied to the current variable\n ' | @classmethod
@abstractmethod
async def action(cls, app: FastAPI, scheduler_data: SchedulerData) -> None:
'\n User defined code for this specific event.\n All updates to the status(SchedulerData) should be applied to the current variable\n '<|docstring|>User defined code for this specific event.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.