uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
c48abede28c5d17dd9d2f053
train
function
def get_data(afile, file_type=None, streaming=None, **keywords): """Get data from an excel file source :param afile: a file name, a file stream or actual content :param sheet_name: the name of the sheet to be loaded :param sheet_index: the index of the sheet to be loaded :param file_type: used only...
def get_data(afile, file_type=None, streaming=None, **keywords):
"""Get data from an excel file source :param afile: a file name, a file stream or actual content :param sheet_name: the name of the sheet to be loaded :param sheet_index: the index of the sheet to be loaded :param file_type: used only when filename is not a physial file name :param streaming: t...
:param ignore_infinity: defaults to True :param keywords: any other library specific parameters :returns: an ordered dictionary """ data, reader = _get_data( afile, file_type=file_type, streaming=True, **keywords) return data, reader def get_data(afile, file_type=None, streaming=None, *...
79
79
265
16
62
Lwz1966/QQ-Groups-Spider
vendor/pyexcel_io/io.py
Python
get_data
get_data
43
66
43
43
fc5a878645c1b6a37a189ab41ba8082a14dba872
bigcode/the-stack
train
04097f2185ba0602e3c15481
train
class
class BasicBlock(nn.Module): expansion = 1 def __init__(self, dims, inplanes, planes, stride=1, downsample=None, groups=1, base_width=64, dilation=1, normalization = 'BatchNorm', activation = nn.ReLU()): super(BasicBlock, self).__init__() if groups != 1 or base_width != 64: ...
class BasicBlock(nn.Module):
expansion = 1 def __init__(self, dims, inplanes, planes, stride=1, downsample=None, groups=1, base_width=64, dilation=1, normalization = 'BatchNorm', activation = nn.ReLU()): super(BasicBlock, self).__init__() if groups != 1 or base_width != 64: raise ValueError('Ba...
normalization, activation = activation) def conv1x1(dims, in_planes, out_planes, stride=1, normalization = 'BatchNorm', activation = False): """1x1 convolution""" return BasicConv(dims, in_planes, out_planes, kernel_size = 1, stride = stride, bias = False, normalization = normaliza...
86
86
287
6
80
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
BasicBlock
BasicBlock
32
65
32
32
5507a6feb65c8f52449b495f54094ba336701f48
bigcode/the-stack
train
dc893748097ae52f5f876b63
train
class
class Bottleneck(nn.Module): # Bottleneck in torchvision places the stride for downsampling at 3x3 convolution(self.conv2) # while original implementation places the stride at the first 1x1 convolution(self.conv1) # according to "Deep residual learning for image recognition"https://arxiv.org/abs/1512.03385....
class Bottleneck(nn.Module): # Bottleneck in torchvision places the stride for downsampling at 3x3 convolution(self.conv2) # while original implementation places the stride at the first 1x1 convolution(self.conv1) # according to "Deep residual learning for image recognition"https://arxiv.org/abs/1512.03385....
expansion = 4 def __init__(self, dims, inplanes, planes, stride=1, downsample=None, groups=1, base_width=64, dilation=1, normalization = 'BatchNorm', activation = nn.ReLU()): super(Bottleneck, self).__init__() self.dims = dims width = int(planes * (base_width / 64.)) * ...
class Bottleneck(nn.Module): # Bottleneck in torchvision places the stride for downsampling at 3x3 convolution(self.conv2) # while original implementation places the stride at the first 1x1 convolution(self.conv1) # according to "Deep residual learning for image recognition"https://arxiv.org/abs/1512.03385....
121
122
409
121
0
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
Bottleneck
Bottleneck
67
107
67
73
aa8463dda05ef4bab2a6fe290355c4eeb8354fcf
bigcode/the-stack
train
769e589a5df7ccd2fc78404b
train
function
def ResNet34(dims, **kwargs): return _ResNet(dims, BasicBlock, [3, 4, 6, 3], **kwargs)
def ResNet34(dims, **kwargs):
return _ResNet(dims, BasicBlock, [3, 4, 6, 3], **kwargs)
model = ResNet(dims, block, layers, **kwargs) return model def ResNet18(dims, **kwargs): return _ResNet(dims, BasicBlock, [2, 2, 2, 2], **kwargs) def ResNet34(dims, **kwargs):
64
64
36
10
54
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
ResNet34
ResNet34
213
214
213
213
469bb3f4d2d461e8681e6ea17033e7a5a9fa0ef8
bigcode/the-stack
train
ac4fd6bc6ebe0590553678d7
train
function
def _ResNet(dims, block, layers, **kwargs): model = ResNet(dims, block, layers, **kwargs) return model
def _ResNet(dims, block, layers, **kwargs):
model = ResNet(dims, block, layers, **kwargs) return model
= self.layer4(x) x = self.avgpool(x) x = torch.flatten(x, 1) x = self.fc(x) return x def forward(self, x): return self._forward_impl(x) def _ResNet(dims, block, layers, **kwargs):
64
64
33
14
50
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
_ResNet
_ResNet
206
208
206
206
62d56c00033b55f492570a8e40afc88747674fc3
bigcode/the-stack
train
f5574fc53899b5e453163d7b
train
function
def ResNet101(dims, **kwargs): return _ResNet(dims, Bottleneck, [3, 4, 23, 3], **kwargs)
def ResNet101(dims, **kwargs):
return _ResNet(dims, Bottleneck, [3, 4, 23, 3], **kwargs)
BasicBlock, [3, 4, 6, 3], **kwargs) def ResNet50(dims, **kwargs): return _ResNet(dims, Bottleneck, [3, 4, 6, 3], **kwargs) def ResNet101(dims, **kwargs):
64
64
36
10
54
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
ResNet101
ResNet101
219
220
219
219
71ddfeba74ad888b085a50ff5b9e0df0437f13f1
bigcode/the-stack
train
6c513edb84e6355957408917
train
function
def conv3x3(dims, in_planes, out_planes, stride=1, groups=1, dilation=1, normalization = 'BatchNorm', activation = False): """3x3 convolution with padding""" return BasicConv(dims, in_planes, out_planes, kernel_size = 3, stride = stride, padding = dilation, groups = groups, ...
def conv3x3(dims, in_planes, out_planes, stride=1, groups=1, dilation=1, normalization = 'BatchNorm', activation = False):
"""3x3 convolution with padding""" return BasicConv(dims, in_planes, out_planes, kernel_size = 3, stride = stride, padding = dilation, groups = groups, bias = False, dilation = dilation, normalization = normalization, activation = activation)
and Pattern Recognition, 2016 # Available from: https://arxiv.org/abs/1512.03385 def conv3x3(dims, in_planes, out_planes, stride=1, groups=1, dilation=1, normalization = 'BatchNorm', activation = False):
64
64
99
38
25
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
conv3x3
conv3x3
17
23
17
18
e191ef4611e0a795f17b894149af358ab3cada27
bigcode/the-stack
train
60bb2f5dad8fabc884c695e0
train
function
def ResNet152(dims, **kwargs): return _ResNet(dims, Bottleneck, [3, 8, 36, 3], **kwargs)
def ResNet152(dims, **kwargs):
return _ResNet(dims, Bottleneck, [3, 8, 36, 3], **kwargs)
Bottleneck, [3, 4, 6, 3], **kwargs) def ResNet101(dims, **kwargs): return _ResNet(dims, Bottleneck, [3, 4, 23, 3], **kwargs) def ResNet152(dims, **kwargs):
64
64
36
10
54
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
ResNet152
ResNet152
222
223
222
222
af6c6c7d5ba05f517db171a53b1b944aee75c938
bigcode/the-stack
train
4407b7ab82c6cef6d2e84114
train
function
def ResNet50(dims, **kwargs): return _ResNet(dims, Bottleneck, [3, 4, 6, 3], **kwargs)
def ResNet50(dims, **kwargs):
return _ResNet(dims, Bottleneck, [3, 4, 6, 3], **kwargs)
BasicBlock, [2, 2, 2, 2], **kwargs) def ResNet34(dims, **kwargs): return _ResNet(dims, BasicBlock, [3, 4, 6, 3], **kwargs) def ResNet50(dims, **kwargs):
64
64
36
10
54
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
ResNet50
ResNet50
216
217
216
216
2176ee4f826703fe4707368689c392c1254eaa78
bigcode/the-stack
train
b3ed2fa734fcd39e08bc1b5c
train
function
def ResNet18(dims, **kwargs): return _ResNet(dims, BasicBlock, [2, 2, 2, 2], **kwargs)
def ResNet18(dims, **kwargs):
return _ResNet(dims, BasicBlock, [2, 2, 2, 2], **kwargs)
(x) return x def forward(self, x): return self._forward_impl(x) def _ResNet(dims, block, layers, **kwargs): model = ResNet(dims, block, layers, **kwargs) return model def ResNet18(dims, **kwargs):
64
64
36
10
53
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
ResNet18
ResNet18
210
211
210
210
ae40ae05892a3f325fdf33042ef70d8d7a620023
bigcode/the-stack
train
085e1fd0d42293a87c2fd4c0
train
class
class ResNet(nn.Module): def __init__(self, dims, block, layers, img_channels = 3, res_channels = 64, num_classes=1000, zero_init_residual=False, groups=1, width_per_group=64, replace_stride_with_dilation=None, normalization = 'BatchNorm', activation = nn.ReLU()): super(ResNet, self).__init...
class ResNet(nn.Module):
def __init__(self, dims, block, layers, img_channels = 3, res_channels = 64, num_classes=1000, zero_init_residual=False, groups=1, width_per_group=64, replace_stride_with_dilation=None, normalization = 'BatchNorm', activation = nn.ReLU()): super(ResNet, self).__init__() self.di...
dilation=1, normalization = 'BatchNorm', activation = nn.ReLU()): super(Bottleneck, self).__init__() self.dims = dims width = int(planes * (base_width / 64.)) * groups # Both self.conv2 and self.downsample layers downsample the input when stride != 1 self.conv1 = conv1x1(self.di...
256
256
1,073
6
249
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
ResNet
ResNet
109
204
109
109
fd868b551aa74404ce3c0f8b62e9aa4d013ddcc3
bigcode/the-stack
train
b926ac159da348c1d2050453
train
function
def conv1x1(dims, in_planes, out_planes, stride=1, normalization = 'BatchNorm', activation = False): """1x1 convolution""" return BasicConv(dims, in_planes, out_planes, kernel_size = 1, stride = stride, bias = False, normalization = normalization, activation = activa...
def conv1x1(dims, in_planes, out_planes, stride=1, normalization = 'BatchNorm', activation = False):
"""1x1 convolution""" return BasicConv(dims, in_planes, out_planes, kernel_size = 1, stride = stride, bias = False, normalization = normalization, activation = activation)
3, stride = stride, padding = dilation, groups = groups, bias = False, dilation = dilation, normalization = normalization, activation = activation) def conv1x1(dims, in_planes, out_planes, stride=1, normalization = 'BatchNorm', activation = False...
64
64
74
29
35
conor-horgan/spectrai
spectrai/networks/nets/resnet.py
Python
conv1x1
conv1x1
25
30
25
26
823682d0f4d6793cfae99b95b039895af8187f2a
bigcode/the-stack
train
9a67e22fa6a13e5352b82673
train
function
def list_followers(usr, token, page): _Headers = HEADERS _Headers["Authorization"] = "token {0}".format(token) resp = requests.get( url="https://api.github.com/users/{0}/followers?page={1}".format(usr, page), headers=_Headers) if resp.status_code == 200: followers = resp.json() ...
def list_followers(usr, token, page):
_Headers = HEADERS _Headers["Authorization"] = "token {0}".format(token) resp = requests.get( url="https://api.github.com/users/{0}/followers?page={1}".format(usr, page), headers=_Headers) if resp.status_code == 200: followers = resp.json() with open("./output/followers_p{0:02d}...
# -*- coding: utf-8 -*- import argparse import requests import tqdm import ujson as json import yaml from utils import CustomLogger from utils import HEADERS def list_followers(usr, token, page):
49
64
155
11
37
amazingchow/github-openapi
list_followers.py
Python
list_followers
list_followers
12
24
12
12
b82b3bffeedaa3fedd76466dd16497505cbad310
bigcode/the-stack
train
6ebf8488662b045bf50761bc
train
function
def _get_cscript_path(): """Return the full path to cscript.exe or None.""" for dir in os.environ.get("PATH", "").split(os.pathsep): cscript_path = os.path.join(dir, "cscript.exe") if os.path.exists(cscript_path): return cscript_path
def _get_cscript_path():
"""Return the full path to cscript.exe or None.""" for dir in os.environ.get("PATH", "").split(os.pathsep): cscript_path = os.path.join(dir, "cscript.exe") if os.path.exists(cscript_path): return cscript_path
already be finished pass winsound.PlaySound(None, winsound.SND_PURGE) else: # Issue 8367: PlaySound(None, winsound.SND_PURGE) # does not raise on systems without a sound card. pass def _get_cscript_path():
64
64
66
7
56
ystk/debian-python2.6
Lib/test/test_winsound.py
Python
_get_cscript_path
_get_cscript_path
231
236
231
231
bdaeaba946319744b439d531f904182c48e40ebb
bigcode/the-stack
train
61d0f2b6f1ef78a0c35006a1
train
function
def _have_soundcard(): """Return True iff this computer has a soundcard.""" global __have_soundcard_cache if __have_soundcard_cache is None: cscript_path = _get_cscript_path() if cscript_path is None: # Could not find cscript.exe to run our VBScript helper. Default # ...
def _have_soundcard():
"""Return True iff this computer has a soundcard.""" global __have_soundcard_cache if __have_soundcard_cache is None: cscript_path = _get_cscript_path() if cscript_path is None: # Could not find cscript.exe to run our VBScript helper. Default # to True: most computers...
.exe or None.""" for dir in os.environ.get("PATH", "").split(os.pathsep): cscript_path = os.path.join(dir, "cscript.exe") if os.path.exists(cscript_path): return cscript_path __have_soundcard_cache = None def _have_soundcard():
64
64
152
6
57
ystk/debian-python2.6
Lib/test/test_winsound.py
Python
_have_soundcard
_have_soundcard
239
254
239
239
e4304eb6484dceee69bba1cc06b81944a9a274d9
bigcode/the-stack
train
af5c5995a4a133daa7c6eaee
train
class
class PlaySoundTest(unittest.TestCase): def test_errors(self): self.assertRaises(TypeError, winsound.PlaySound) self.assertRaises(TypeError, winsound.PlaySound, "bad", "bad") self.assertRaises( RuntimeError, winsound.PlaySound, "none", winsound.SND_ASYNC ...
class PlaySoundTest(unittest.TestCase):
def test_errors(self): self.assertRaises(TypeError, winsound.PlaySound) self.assertRaises(TypeError, winsound.PlaySound, "bad", "bad") self.assertRaises( RuntimeError, winsound.PlaySound, "none", winsound.SND_ASYNC | winsound.SND_MEMORY ) def ...
so currently if these # tests fail we're ignoring them # # XXX the right fix for this is to define something like # _have_enabled_beep_driver() and use that instead of the # try/except below try: winsound.Beep(*args) except RuntimeError: p...
256
256
1,011
8
248
ystk/debian-python2.6
Lib/test/test_winsound.py
Python
PlaySoundTest
PlaySoundTest
95
228
95
96
65e6755043ad441d02b5ddb329406acd2ce25255
bigcode/the-stack
train
af2fbf69a0fc5e6ea7274254
train
class
class MessageBeepTest(unittest.TestCase): def tearDown(self): time.sleep(0.5) def test_default(self): self.assertRaises(TypeError, winsound.MessageBeep, "bad") self.assertRaises(TypeError, winsound.MessageBeep, 42, 42) winsound.MessageBeep() def test_ok(self): wins...
class MessageBeepTest(unittest.TestCase):
def tearDown(self): time.sleep(0.5) def test_default(self): self.assertRaises(TypeError, winsound.MessageBeep, "bad") self.assertRaises(TypeError, winsound.MessageBeep, 42, 42) winsound.MessageBeep() def test_ok(self): winsound.MessageBeep(winsound.MB_OK) def t...
# XXX the right fix for this is to define something like # _have_enabled_beep_driver() and use that instead of the # try/except below try: winsound.Beep(*args) except RuntimeError: pass class MessageBeepTest(unittest.TestCase):
64
64
177
9
54
ystk/debian-python2.6
Lib/test/test_winsound.py
Python
MessageBeepTest
MessageBeepTest
69
92
69
70
84a90c961ca37b2af7100d81445a84b2bc106470
bigcode/the-stack
train
45a1dbbd9afb7ca986a0e897
train
function
def has_sound(sound): """Find out if a particular event is configured with a default sound""" try: # Ask the mixer API for the number of devices it knows about. # When there are no devices, PlaySound will fail. if ctypes.windll.winmm.mixerGetNumDevs() is 0: return False ...
def has_sound(sound):
"""Find out if a particular event is configured with a default sound""" try: # Ask the mixer API for the number of devices it knows about. # When there are no devices, PlaySound will fail. if ctypes.windll.winmm.mixerGetNumDevs() is 0: return False key = _winreg.Open...
# Ridiculously simple test of the winsound module for Windows. import unittest from test import test_support import time import os import subprocess import ctypes winsound = test_support.import_module('winsound') import _winreg def has_sound(sound):
55
64
154
5
49
ystk/debian-python2.6
Lib/test/test_winsound.py
Python
has_sound
has_sound
14
30
14
14
f7bdbbb179f9e9270f192976e2cd6887dd4d5521
bigcode/the-stack
train
b7f7b29d8a56e8659fc7293e
train
function
def test_main(): test_support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest)
def test_main():
test_support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest)
check_script = os.path.join(os.path.dirname(__file__), "check_soundcard.vbs") p = subprocess.Popen([cscript_path, check_script], stdout=subprocess.PIPE) __have_soundcard_cache = not p.wait() return __have_soundcard_cache def ...
64
64
23
4
59
ystk/debian-python2.6
Lib/test/test_winsound.py
Python
test_main
test_main
257
258
257
257
f0ea74bb50dd66441ba8808580cc72b372fea744
bigcode/the-stack
train
4e73ffdbab4557231fbc530c
train
class
class BeepTest(unittest.TestCase): # As with PlaySoundTest, incorporate the _have_soundcard() check # into our test methods. If there's no audio device present, # winsound.Beep returns 0 and GetLastError() returns 127, which # is: ERROR_PROC_NOT_FOUND ("The specified procedure could not # be found"...
class BeepTest(unittest.TestCase): # As with PlaySoundTest, incorporate the _have_soundcard() check # into our test methods. If there's no audio device present, # winsound.Beep returns 0 and GetLastError() returns 127, which # is: ERROR_PROC_NOT_FOUND ("The specified procedure could not # be found"...
def test_errors(self): self.assertRaises(TypeError, winsound.Beep) self.assertRaises(ValueError, winsound.Beep, 36, 75) self.assertRaises(ValueError, winsound.Beep, 32768, 75) def test_extremes(self): self._beep(37, 75) self._beep(32767, 75) def test_increasingfrequ...
class BeepTest(unittest.TestCase): # As with PlaySoundTest, incorporate the _have_soundcard() check # into our test methods. If there's no audio device present, # winsound.Beep returns 0 and GetLastError() returns 127, which # is: ERROR_PROC_NOT_FOUND ("The specified procedure could not # be found"...
118
112
375
118
0
ystk/debian-python2.6
Lib/test/test_winsound.py
Python
BeepTest
BeepTest
32
67
32
40
8ba3beaaeae31d66d5d765c616e85e118d272910
bigcode/the-stack
train
50a7a0efd6541be2502c80ff
train
function
def validate_sampleReceiptDate( sampleReceiptDate, sampleCollectionDate, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.sampleReceiptDate.label" ), ): if sampleReceiptDate: try: datetime.datetime.strptime(sampleReceiptDate, "%Y-%m-%d") except ValueErr...
def validate_sampleReceiptDate( sampleReceiptDate, sampleCollectionDate, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.sampleReceiptDate.label" ), ):
if sampleReceiptDate: try: datetime.datetime.strptime(sampleReceiptDate, "%Y-%m-%d") except ValueError: return ( False, validation.invalid_date_format(field_label, include_error_prefix=True), ) if sampleCollectionDate: ...
Error: return ( False, validation.invalid_date_format(field_label, include_error_prefix=True), ) return True, None def validate_sampleReceiptDate( sampleReceiptDate, sampleCollectionDate, field_label=ugettext_lazy( "samplesets.samplesetite...
68
68
229
39
28
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleReceiptDate
validate_sampleReceiptDate
769
804
769
775
29f07c88f1713c564915470e71bf6272f0caba6f
bigcode/the-stack
train
e7498f02bef4db2b2c12b7ab
train
function
def validate_inconsistent_ampliseq_HD_category( samplesetitems, pending_sampleSetItem_list, sampleset=None, isAmpliseqHD=False ): isValid = True errorMessage = [] categoryDict = {} no_of_partitionKey = None if ( sampleset and "amps_hd_on_chef_v1" in sampleset.libraryPrepType.lower() ...
def validate_inconsistent_ampliseq_HD_category( samplesetitems, pending_sampleSetItem_list, sampleset=None, isAmpliseqHD=False ):
isValid = True errorMessage = [] categoryDict = {} no_of_partitionKey = None if ( sampleset and "amps_hd_on_chef_v1" in sampleset.libraryPrepType.lower() ) or isAmpliseqHD: if not samplesetitems: samplesetitems = pending_sampleSetItem_list try: sam...
If User select "Ampliseq HD on chef" -> - validate for 4 samples in each Chef assay group i.e 4 samples in group1 and 4 samples in group2 - make sure each assay group belongs to one category(nuc. type + pool type + sample source ) respectively - If validation is successfull, tube position and...
201
201
671
34
167
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_inconsistent_ampliseq_HD_category
validate_inconsistent_ampliseq_HD_category
296
372
296
298
9c279b12344573fef851842d0899ebe58e63ea01
bigcode/the-stack
train
a7bfd285ee8df8cbff63bfc0
train
function
def validate_sampleSets_for_planning(sampleSets): """ Validate multiple sampleSets are compatible to create a Plan from """ errors = [] items = SampleSetItem.objects.filter(sampleSet__in=sampleSets) if not items: errors.append( validation.invalid_required_at_least_one_child( ...
def validate_sampleSets_for_planning(sampleSets):
""" Validate multiple sampleSets are compatible to create a Plan from """ errors = [] items = SampleSetItem.objects.filter(sampleSet__in=sampleSets) if not items: errors.append( validation.invalid_required_at_least_one_child( _SampleSet.verbose_name, _Sample.verbose_n...
set(allPcrPlates) if len(pcrPlate_mistmatch) and len(barcodeKit_mistmatch): print(pcrPlate_mistmatch) print(barcodeKit_mistmatch) isValid = False errorMessage = validation.format( ugettext_lazy( "samplesets.samplesetitem.messages.validate.barcodekit.note...
130
130
435
10
119
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleSets_for_planning
validate_sampleSets_for_planning
1,505
1,550
1,505
1,505
1531e8d971556a065d386f1e1582e265dcaf1c15
bigcode/the-stack
train
840bba92dfa82a83769856dd
train
function
def validate_pcrPlateRow(pcrPlateRow, field_label="PCR Plate Position"): """ validate PCR plate row case-insensitively with leading/trailing blanks in the input ignored """ isValid = True errors = [] input = "" if pcrPlateRow: input = pcrPlateRow.strip().upper() validValues ...
def validate_pcrPlateRow(pcrPlateRow, field_label="PCR Plate Position"):
""" validate PCR plate row case-insensitively with leading/trailing blanks in the input ignored """ isValid = True errors = [] input = "" if pcrPlateRow: input = pcrPlateRow.strip().upper() validValues = [v[0] for v in SampleSetItem.ALLOWED_AMPLISEQ_PCR_PLATE_ROWS_V1] ...
errorMessage = validation.invalid_length_error( field_label, MAX_LENGTH_SAMPLE_NAME, sampleName.strip(), include_error_prefix=True, ) return isValid, errorMessage return True, None def validate_pcrPlateRow(pcrPlateRow, field_label="PCR Plate P...
64
64
143
18
45
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_pcrPlateRow
validate_pcrPlateRow
1,265
1,280
1,265
1,265
837f54f49e427c09f5e197423d77656ed373bce5
bigcode/the-stack
train
eb7ba4c6995b08237c2443aa
train
function
def _validate_SampleAnnotation_CV(cvValue, cvAnnotationType, field_label): if not cvValue: return True, None, cvValue cvs = SampleAnnotation_CV.objects.filter( annotationType=cvAnnotationType, isActive=True ) cvsMatching = cvs.filter(value__iexact=cvValue) isValid = False if cv...
def _validate_SampleAnnotation_CV(cvValue, cvAnnotationType, field_label):
if not cvValue: return True, None, cvValue cvs = SampleAnnotation_CV.objects.filter( annotationType=cvAnnotationType, isActive=True ) cvsMatching = cvs.filter(value__iexact=cvValue) isValid = False if cvsMatching.count() == 0: choices = cvs.order_by("value").values_list...
): errorMessage = validation.invalid_length_error( field_label, MAX_LENGTH_SAMPLE_DESCRIPTION, sampleDescription.strip(), include_error_prefix=True, ) return False, errorMessage return True, None def _validate_Samp...
64
64
146
18
45
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
_validate_SampleAnnotation_CV
_validate_SampleAnnotation_CV
629
649
629
629
9cd94327021e14b62f78d13628b4fa61bc89e81e
bigcode/the-stack
train
5bc4101386bc8c0e1d8eaa77
train
function
def validate_user_chef_barcodeKit(samplesetitems, chef_barcodeKit, allPcrPlates): all_TS_barcodeKit = [] userPcrPlates = [] isValid = True errorMessage = "" for item in samplesetitems: barcodeKit_TS = item.dnabarcode.name if item.dnabarcode else None userPcrPlate = item.pcrPlateRow ...
def validate_user_chef_barcodeKit(samplesetitems, chef_barcodeKit, allPcrPlates):
all_TS_barcodeKit = [] userPcrPlates = [] isValid = True errorMessage = "" for item in samplesetitems: barcodeKit_TS = item.dnabarcode.name if item.dnabarcode else None userPcrPlate = item.pcrPlateRow all_TS_barcodeKit.append(barcodeKit_TS) userPcrPlates.append(userP...
Kit, barcode, sampleSet.id, allPcrPlates=allPcrPlates, pcrPlateRow=row, ) if not isValid: return isValid, errors isValid = True return isValid, None def validate_user_chef_barcodeKit(samp...
81
81
272
23
57
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_user_chef_barcodeKit
validate_user_chef_barcodeKit
1,477
1,502
1,477
1,477
59c2276703734ff6431724d62d68de02252e984a
bigcode/the-stack
train
81c5145163373cefa2951f21
train
function
def validate_pcrPlateCol(pcrPlateCol, field_label="PCR Plate Position"): """ validate PCR plate row case-insensitively with leading/trailing blanks in the input ignored """ isValid = True errors = [] input = "" if pcrPlateCol: input = pcrPlateCol.strip().upper() validValues ...
def validate_pcrPlateCol(pcrPlateCol, field_label="PCR Plate Position"):
""" validate PCR plate row case-insensitively with leading/trailing blanks in the input ignored """ isValid = True errors = [] input = "" if pcrPlateCol: input = pcrPlateCol.strip().upper() validValues = [ v[0] for v in SampleSetItem.ALLOWED_AMPLISEQ_PCR_PLATE_CO...
_PLATE_ROWS_V1] if not validation.is_valid_keyword(input, validValues): errors.append(validation.invalid_keyword_error(field_label, validValues)) isValid = False return isValid, errors, input def validate_pcrPlateCol(pcrPlateCol, field_label="PCR Plate Position"):
64
64
146
18
45
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_pcrPlateCol
validate_pcrPlateCol
1,283
1,300
1,283
1,283
20cf9b9aba57026aa8e2d8543a06babaad438e15
bigcode/the-stack
train
ccf23241a841a07755ef9c20
train
function
def validate_samplesetStatus(samplesetStatus, field_label="Status"): """ validate samplesetStatus with leading/trailing blanks in the input ignored """ isValid = True errors = [] inputData = "" if samplesetStatus: inputData = samplesetStatus.strip().lower() validValues = [v[...
def validate_samplesetStatus(samplesetStatus, field_label="Status"):
""" validate samplesetStatus with leading/trailing blanks in the input ignored """ isValid = True errors = [] inputData = "" if samplesetStatus: inputData = samplesetStatus.strip().lower() validValues = [v[0] for v in SampleSet.ALLOWED_SAMPLESET_STATUS] if not valida...
_PCR_PLATE_COLUMNS_V1 ] if not validation.is_valid_keyword(input, validValues): errors.append(validation.invalid_keyword_error(field_label, validValues)) isValid = False return isValid, errors, input def validate_samplesetStatus(samplesetStatus, field_label="Status"):
64
64
157
14
49
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_samplesetStatus
validate_samplesetStatus
1,303
1,321
1,303
1,303
6b354dec9e953ca071ba508dfb6fc22404f235cd
bigcode/the-stack
train
7d30abcee2b3b123866341be
train
function
def validate_sampleGroup( sampleGroup, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.relationshipGroup.label" ), ): if sampleGroup and not sampleGroup.isdigit(): return False, validation.invalid_uint(field_label, include_error_prefix=True) return True, None
def validate_sampleGroup( sampleGroup, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.relationshipGroup.label" ), ):
if sampleGroup and not sampleGroup.isdigit(): return False, validation.invalid_uint(field_label, include_error_prefix=True) return True, None
.samplesetitem.fields.relationshipRole.label"), ): return _validate_SampleAnnotation_CV( sampleGroupType, "relationshipRole", field_label ) def validate_sampleGroup( sampleGroup, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.relationshipGroup.label" ), ):
64
64
63
31
33
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleGroup
validate_sampleGroup
688
697
688
693
b9c3d79d1353465ab4eb98a9ed8bd3351b4638a6
bigcode/the-stack
train
7cd8252a9292835afbd7e74d
train
function
def validate_sampleSource(sampleSource, field_label="Sample Source"): return _validate_SampleAnnotation_CV(sampleSource, "sampleSource", field_label)
def validate_sampleSource(sampleSource, field_label="Sample Source"):
return _validate_SampleAnnotation_CV(sampleSource, "sampleSource", field_label)
_list("value", flat=True) return ( False, validation.invalid_choice( field_label, cvValue, choices, include_error_prefix=True ), cvValue, ) return True, None, cvsMatching[0] def validate_sampleSource(sampleSource, field_label="Sample S...
64
64
32
13
51
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleSource
validate_sampleSource
652
653
652
652
134592a3ff3ddd295def9194e1799f5a4f3ff78d
bigcode/the-stack
train
6f70e64a6ba87c0a16a0f9a8
train
function
def validate_sampleSet(queryDict, isNew=False, sampleset_label=_SampleSet.verbose_name): """ validate the sampleSet input. returns a boolean isValid and a text string for error message, None if input passes validation Note: Input length will not be validated since maxLength has been specified in the for...
def validate_sampleSet(queryDict, isNew=False, sampleset_label=_SampleSet.verbose_name):
""" validate the sampleSet input. returns a boolean isValid and a text string for error message, None if input passes validation Note: Input length will not be validated since maxLength has been specified in the form. """ logger.debug("sample_validator.validate_sampleset() queryDict=%s" % (quer...
_field("cellNum").max_length SC_DATE_FORMAT = "YYYY/MM/DD" ASHD_SAMPLESET_ITEM_LIMIT = 8 VALID_LIB_TYPES = ["amps_on_chef_v1", "amps_hd_on_chef_v1"] # some validations are applicable only for these types def validate_sampleSet(queryDict, isNew=False, sampleset_label=_SampleSet.verbose_name):
78
78
260
20
57
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleSet
validate_sampleSet
67
97
67
67
e1b8404a88149c020684489e2c7d4c0b71ca29f2
bigcode/the-stack
train
f8ef2b06d0bbf8f263648b9b
train
function
def validate_controlType(controlType, field_label="Control Type"): errors, controlType = validate_sampleControlType(controlType, field_label) if errors: return False, errors[0], "" else: return True, "", controlType
def validate_controlType(controlType, field_label="Control Type"):
errors, controlType = validate_sampleControlType(controlType, field_label) if errors: return False, errors[0], "" else: return True, "", controlType
(%s)' % (barcode, sample, setname, barcodes[barcode][0], barcodes[barcode][1]) errors.append(msg) else: barcodes[barcode] = (sample, setname) return errors def validate_controlType(controlType, field_label="Control Type"):
64
64
53
13
50
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_controlType
validate_controlType
1,553
1,558
1,553
1,553
633583776ec626e441a1ceeb219cc696af352d00
bigcode/the-stack
train
73c9586a3cc5e1372aca47ac
train
function
def _validate_textValue_mandatory(value, displayedTerm): if not validation.has_value(value): return ( False, validation.required_error(displayedTerm, include_error_prefix=True), ) return True, None
def _validate_textValue_mandatory(value, displayedTerm):
if not validation.has_value(value): return ( False, validation.required_error(displayedTerm, include_error_prefix=True), ) return True, None
ryoId, field_label=ugettext_lazy("samplesets.samplesetitem.fields.embryoId.label"), ): return _validate_optional_text( sampleEmbryoId, MAX_LENGTH_SAMPLE_EMBRYO_ID, field_label ) def _validate_textValue_mandatory(value, displayedTerm):
64
64
48
13
51
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
_validate_textValue_mandatory
_validate_textValue_mandatory
842
849
842
842
48b95bcc938727b2d3558149f385f0e93be45aec
bigcode/the-stack
train
1e653ca4d3002cb00dd8f601
train
function
def validate_barcoding_samplesetitems( samplesetitems, barcodeKit, barcode, samplesetitem_id, allPcrPlates=None, pcrPlateRow=None, ): """ 1) validate only one barcodeKit is used for all barcode items, no barcode seletion is ok 2) validate barcode selected for current SampleSe...
def validate_barcoding_samplesetitems( samplesetitems, barcodeKit, barcode, samplesetitem_id, allPcrPlates=None, pcrPlateRow=None, ):
""" 1) validate only one barcodeKit is used for all barcode items, no barcode seletion is ok 2) validate barcode selected for current SampleSetItem (given by samplesetitem_id) is unique or None 3) special logic when this function is used by Chef validation (pcrPlateRow is specified) ...
_samplesetGroupType( sampleGroupTypeName, field_label="sampleGroupTypeName" ) if not isValid: return isValid, errorMessage if validation.has_value(additionalCycles): isValid, errorMessage, cvValue = validate_additionalCycles( additionalCycles, field_labe...
186
186
623
43
142
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_barcoding_samplesetitems
validate_barcoding_samplesetitems
221
283
221
228
578f04c02e80e8f9d0b32f5d61e889f752acbb1a
bigcode/the-stack
train
975e02ec4981f8ebc6e3eaa4
train
function
def validate_libPrepType( libPrepType, field_label="Library Prep Type" ): # TODO: Dead code? """ validate libPrepType with leading/trailing blanks in the input ignored """ isValid = True errors = [] inputData = "" if libPrepType: inputData = libPrepType.strip() validVal...
def validate_libPrepType( libPrepType, field_label="Library Prep Type" ): # TODO: Dead code?
""" validate libPrepType with leading/trailing blanks in the input ignored """ isValid = True errors = [] inputData = "" if libPrepType: inputData = libPrepType.strip() validValues = [v[0] for v in SampleSet.ALLOWED_LIBRARY_PREP_TYPES] if not validation.is_valid_keyw...
("are ,", ":") isValid = False return isValid, errors, samplesetStatus isValid = True return isValid, None, None def validate_libPrepType( libPrepType, field_label="Library Prep Type" ): # TODO: Dead code?
64
64
168
26
37
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_libPrepType
validate_libPrepType
1,324
1,344
1,324
1,326
d272c72c2d54dd8c8b53ef7699316ac6d1b81568
bigcode/the-stack
train
dd29c2f08c250598de31548a
train
function
def validate_sampleGroupType( sampleGroupType, field_label=ugettext_lazy("samplesets.samplesetitem.fields.relationshipRole.label"), ): return _validate_SampleAnnotation_CV( sampleGroupType, "relationshipRole", field_label )
def validate_sampleGroupType( sampleGroupType, field_label=ugettext_lazy("samplesets.samplesetitem.fields.relationshipRole.label"), ):
return _validate_SampleAnnotation_CV( sampleGroupType, "relationshipRole", field_label )
field_label=ugettext_lazy("samplesets.samplesetitem.fields.gender.label"), ): return _validate_SampleAnnotation_CV(sampleGender, "gender", field_label) def validate_sampleGroupType( sampleGroupType, field_label=ugettext_lazy("samplesets.samplesetitem.fields.relationshipRole.label"), ):
64
64
53
29
35
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleGroupType
validate_sampleGroupType
679
685
679
682
a127eda43b26eb3b3148c8d519b873d23fc117c1
bigcode/the-stack
train
a872b1e893120db4e2389322
train
function
def validate_sampleExternalId( sampleExternalId, field_label=_Sample.externalId.verbose_name ): isValid = False isValid, errorMessage = _validate_textValue(sampleExternalId, field_label) if not isValid: return False, errorMessage if not validation.is_valid_length( sampleExternalId....
def validate_sampleExternalId( sampleExternalId, field_label=_Sample.externalId.verbose_name ):
isValid = False isValid, errorMessage = _validate_textValue(sampleExternalId, field_label) if not isValid: return False, errorMessage if not validation.is_valid_length( sampleExternalId.strip(), MAX_LENGTH_SAMPLE_EXTERNAL_ID ): errorMessage = validation.invalid_length_error...
.invalid_length_error( field_label, MAX_LENGTH_SAMPLE_DISPLAYED_NAME, sampleDisplayedName.strip(), include_error_prefix=True, ) return False, errorMessage return True, None def validate_sampleExternalId( sampleExternalId, field_label=_Sample.exter...
64
64
127
21
42
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleExternalId
validate_sampleExternalId
583
603
583
585
5b808a9bcfb79ccbef10bd766132c5e92c659363
bigcode/the-stack
train
5c27afecba9dd0afd56caaa8
train
function
def validate_panelPoolType(panelPoolType, field_label="Panel Pool Type"): return _validate_SampleAnnotation_CV(panelPoolType, "panelPoolType", field_label)
def validate_panelPoolType(panelPoolType, field_label="Panel Pool Type"):
return _validate_SampleAnnotation_CV(panelPoolType, "panelPoolType", field_label)
cvValue, ) return True, None, cvsMatching[0] def validate_sampleSource(sampleSource, field_label="Sample Source"): return _validate_SampleAnnotation_CV(sampleSource, "sampleSource", field_label) def validate_panelPoolType(panelPoolType, field_label="Panel Pool Type"):
64
64
37
16
48
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_panelPoolType
validate_panelPoolType
656
657
656
656
75eee6bf9c3d4a2bf75d9960ad38becdbca44e15
bigcode/the-stack
train
6eb9fc3fcc296e101f8b60b5
train
function
def validate_sampleCellNum( sampleCellNum, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cellNum.label"), ): return _validate_optional_text( sampleCellNum, MAX_LENGTH_SAMPLE_CELL_NUM, field_label )
def validate_sampleCellNum( sampleCellNum, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cellNum.label"), ):
return _validate_optional_text( sampleCellNum, MAX_LENGTH_SAMPLE_CELL_NUM, field_label )
.biopsyDays.label"), ): isValid, errorMessage = _validate_uintandzeroValue(sampleBiopsyDays, field_label) return isValid, errorMessage def validate_sampleCellNum( sampleCellNum, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cellNum.label"), ):
64
64
52
29
34
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleCellNum
validate_sampleCellNum
815
821
815
818
4a53390d2c87aa4dd7df48e9fe7b98b2e0888fc6
bigcode/the-stack
train
0d41671357f4b5c0cf12a403
train
function
def _validate_intValue(value, displayedTerm): if value and not RepresentsUnsignedInt(value): return ( False, validation.invalid_uint(displayedTerm, include_error_prefix=True), ) # "Error, " + displayedTerm + ERROR_MSG_INVALID_DATATYPE return True, None
def _validate_intValue(value, displayedTerm):
if value and not RepresentsUnsignedInt(value): return ( False, validation.invalid_uint(displayedTerm, include_error_prefix=True), ) # "Error, " + displayedTerm + ERROR_MSG_INVALID_DATATYPE return True, None
, field_label ) def _validate_textValue_mandatory(value, displayedTerm): if not validation.has_value(value): return ( False, validation.required_error(displayedTerm, include_error_prefix=True), ) return True, None def _validate_intValue(value, displayedTerm):
64
64
63
10
53
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
_validate_intValue
_validate_intValue
852
858
852
852
378957dc056618fb9e363d6fa98708091bb47018
bigcode/the-stack
train
c80e7ff3e284147b14e4e8eb
train
function
def validate_sampleBarcodeMapping(queryDict, sampleSet): """ validate sampleBarcodeMapping input sent via API - BarcodeKit, Barcode - SampleRow, SampleColumn """ isValid = False errordict = {} pcrplateBarcodeQueryDict = queryDict.get("sampleBarcodeMapping", None) # Input JSO...
def validate_sampleBarcodeMapping(queryDict, sampleSet):
""" validate sampleBarcodeMapping input sent via API - BarcodeKit, Barcode - SampleRow, SampleColumn """ isValid = False errordict = {} pcrplateBarcodeQueryDict = queryDict.get("sampleBarcodeMapping", None) # Input JSON object from Chef to Update allBarcodeKits = [ ...
LOWED_SAMPLESET_STATUS] if not validation.is_valid_keyword(inputData, validValues): errors.append(validation.invalid_keyword_error(field_label, validValues)) errors = "".join(errors).replace("are ,", ":") isValid = False return isValid, errors, samplesetStatus ...
256
256
1,080
11
244
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleBarcodeMapping
validate_sampleBarcodeMapping
1,347
1,474
1,347
1,347
872eb38cc342d004afc415ab00b7b0837e4a887e
bigcode/the-stack
train
53f395c37d88b66cd4364c67
train
function
def validate_pcrPlate_position_samplesetitems( samplesetitems, pcrPlateRow, samplesetitem_id, sampleset=None ): """ 1) validate pcrPlateRow position selected for sampleSetItem is unique 2) for Ampliseq on Chef pcrPlateRow value is required If validating with a dict of samplesetitems, "p...
def validate_pcrPlate_position_samplesetitems( samplesetitems, pcrPlateRow, samplesetitem_id, sampleset=None ):
""" 1) validate pcrPlateRow position selected for sampleSetItem is unique 2) for Ampliseq on Chef pcrPlateRow value is required If validating with a dict of samplesetitems, "pending_id" key must contain a unique id number. """ for item in samplesetitems: if ( sam...
Chef sample" ) isValid = False if categoryDict: for partitionKey, groups in categoryDict.items(): for key, value in groups.items(): if len(value) > 4: errorMessage.append( "Error, Only 4 ...
126
126
423
30
95
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_pcrPlate_position_samplesetitems
validate_pcrPlate_position_samplesetitems
375
420
375
377
1c0a67c34292db1b825559a18c5af57740ffb315
bigcode/the-stack
train
8bf417e07b99494dd22fd1f4
train
function
def validate_cancerType( cancerType, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cancerType.label"), ): return _validate_SampleAnnotation_CV(cancerType, "cancerType", field_label)
def validate_cancerType( cancerType, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cancerType.label"), ):
return _validate_SampleAnnotation_CV(cancerType, "cancerType", field_label)
), ): if sampleGroup and not sampleGroup.isdigit(): return False, validation.invalid_uint(field_label, include_error_prefix=True) return True, None def validate_cancerType( cancerType, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cancerType.label"), ):
64
64
50
29
34
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_cancerType
validate_cancerType
700
704
700
703
757076df873a5c3eb971d982f8666b150a29abe3
bigcode/the-stack
train
f41b7a8d0994ba2226b51670
train
function
def validate_sampleCoupleId( sampleCoupleId, field_label=ugettext_lazy("samplesets.samplesetitem.fields.coupleId.label"), ): return _validate_optional_text( sampleCoupleId, MAX_LENGTH_SAMPLE_COUPLE_ID, field_label )
def validate_sampleCoupleId( sampleCoupleId, field_label=ugettext_lazy("samplesets.samplesetitem.fields.coupleId.label"), ):
return _validate_optional_text( sampleCoupleId, MAX_LENGTH_SAMPLE_COUPLE_ID, field_label )
.samplesetitem.fields.cellNum.label"), ): return _validate_optional_text( sampleCellNum, MAX_LENGTH_SAMPLE_CELL_NUM, field_label ) def validate_sampleCoupleId( sampleCoupleId, field_label=ugettext_lazy("samplesets.samplesetitem.fields.coupleId.label"), ):
64
64
58
32
32
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleCoupleId
validate_sampleCoupleId
824
830
824
827
23e4c5593422215b4a1692f5feced4cd50be28b7
bigcode/the-stack
train
7f963a8713e6d74ea991fae9
train
function
def validate_additionalCycles(additionalCycles, field_label="Additional Cycles"): return _validate_SampleAnnotation_CV( additionalCycles, "additionalCycles", field_label )
def validate_additionalCycles(additionalCycles, field_label="Additional Cycles"):
return _validate_SampleAnnotation_CV( additionalCycles, "additionalCycles", field_label )
V(sampleSource, "sampleSource", field_label) def validate_panelPoolType(panelPoolType, field_label="Panel Pool Type"): return _validate_SampleAnnotation_CV(panelPoolType, "panelPoolType", field_label) def validate_additionalCycles(additionalCycles, field_label="Additional Cycles"):
64
64
39
16
48
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_additionalCycles
validate_additionalCycles
660
663
660
660
ea0580c44bfce3acf6693bded4b06095534f1e1a
bigcode/the-stack
train
24c49b794a7292de9486442c
train
function
def validate_sampleDisplayedName( sampleDisplayedName, field_label=_Sample.displayedName.verbose_name ): isValid, errorMessage = _validate_textValue_mandatory( sampleDisplayedName, field_label ) if not isValid: return False, errorMessage isValid, errorMessage = _validate_textValue(...
def validate_sampleDisplayedName( sampleDisplayedName, field_label=_Sample.displayedName.verbose_name ):
isValid, errorMessage = _validate_textValue_mandatory( sampleDisplayedName, field_label ) if not isValid: return False, errorMessage isValid, errorMessage = _validate_textValue(sampleDisplayedName, field_label) if not isValid: return False, errorMessage isValid, error...
errorMessage = validate_sampleReceiptDate( sampleReceiptDate, sampleCollectionDate ) if not isValid: errors.append(errorMessage) return len(errors) == 0, errors def validate_sampleDisplayedName( sampleDisplayedName, field_label=_Sample.displayedName.verbose_name ):
64
64
200
22
41
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleDisplayedName
validate_sampleDisplayedName
547
580
547
549
3f3f222c5dd3f18dab8b135a18d1bc54098f5ff3
bigcode/the-stack
train
307c750cbd045ff1384dd3e8
train
function
def validate_libraryPrepKitName(libraryPrepKitName, field_label="Library Prep Kit"): errors, _ = validate_optional_kit_name( libraryPrepKitName, ["LibraryPrepKit"], field_label ) return errors
def validate_libraryPrepKitName(libraryPrepKitName, field_label="Library Prep Kit"):
errors, _ = validate_optional_kit_name( libraryPrepKitName, ["LibraryPrepKit"], field_label ) return errors
_label="Control Type"): errors, controlType = validate_sampleControlType(controlType, field_label) if errors: return False, errors[0], "" else: return True, "", controlType def validate_libraryPrepKitName(libraryPrepKitName, field_label="Library Prep Kit"):
64
64
50
19
44
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_libraryPrepKitName
validate_libraryPrepKitName
1,561
1,565
1,561
1,561
7eb8fffaf3556e4ddc269d0621654211d840b84f
bigcode/the-stack
train
dce4b787965f48d23755a98a
train
function
def validate_sampleGender( sampleGender, field_label=ugettext_lazy("samplesets.samplesetitem.fields.gender.label"), ): return _validate_SampleAnnotation_CV(sampleGender, "gender", field_label)
def validate_sampleGender( sampleGender, field_label=ugettext_lazy("samplesets.samplesetitem.fields.gender.label"), ):
return _validate_SampleAnnotation_CV(sampleGender, "gender", field_label)
ingProtocols(cyclingProtocols, field_label="Cycling Protocols"): return _validate_SampleAnnotation_CV( cyclingProtocols, "cyclingProtocols", field_label ) def validate_sampleGender( sampleGender, field_label=ugettext_lazy("samplesets.samplesetitem.fields.gender.label"), ):
64
64
44
26
38
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleGender
validate_sampleGender
672
676
672
675
22462da18a84dcebca72a4a2c4f89bfb6a349fa3
bigcode/the-stack
train
86e93017699229c1fcff2af2
train
function
def validate_sampleCollectionDate( sampleCollectionDate, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.sampleCollectionDate.label" ), ): if sampleCollectionDate: try: datetime.datetime.strptime(sampleCollectionDate, "%Y-%m-%d") except ValueError: ...
def validate_sampleCollectionDate( sampleCollectionDate, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.sampleCollectionDate.label" ), ):
if sampleCollectionDate: try: datetime.datetime.strptime(sampleCollectionDate, "%Y-%m-%d") except ValueError: return ( False, validation.invalid_date_format(field_label, include_error_prefix=True), ) return True, None
else: return ( False, validation.invalid_uint(field_label, include_error_prefix=True), ) return True, None def validate_sampleCollectionDate( sampleCollectionDate, field_label=ugettext_lazy( "samplesets.samplesetitem.fields.sampleColl...
64
64
90
34
29
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleCollectionDate
validate_sampleCollectionDate
751
766
751
756
f1ca7926dfa5f2978cf3972fef9c0da075b45e02
bigcode/the-stack
train
076df06080b0ca4400441437
train
function
def validate_sampleSet_values( sampleSetName, sampleSetDesc, pcrPlateSerialNum, isNew=False, sampleGroupTypeName=None, additionalCycles=None, cyclingProtocols=None, ): """ validate the sampleSet input. returns a boolean isValid and a text string for error message, None if input p...
def validate_sampleSet_values( sampleSetName, sampleSetDesc, pcrPlateSerialNum, isNew=False, sampleGroupTypeName=None, additionalCycles=None, cyclingProtocols=None, ):
""" validate the sampleSet input. returns a boolean isValid and a text string for error message, None if input passes validation Note: Input length willl not be validated since maxLength has been specified in the form. """ if not validation.has_value(sampleSetName): return ( ...
. """ logger.debug("sample_validator.validate_sampleset() queryDict=%s" % (queryDict)) if not queryDict: return ( False, validation.invalid_no_data(sampleset_label, include_error_prefix=True), ) sampleSetName = queryDict.get("sampleSetName", "").strip() sam...
239
239
799
46
193
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleSet_values
validate_sampleSet_values
100
218
100
108
1739d429be797e7f4db83be9e8c4844313d85dd3
bigcode/the-stack
train
b66a83402d4b1c903eec1ec3
train
function
def _validate_textValue_leadingChars(value, displayedTerm): if value and not validation.is_valid_leading_chars(value): return ( False, validation.invalid_leading_chars(displayedTerm, include_error_prefix=True), ) return True, None
def _validate_textValue_leadingChars(value, displayedTerm):
if value and not validation.is_valid_leading_chars(value): return ( False, validation.invalid_leading_chars(displayedTerm, include_error_prefix=True), ) return True, None
None def _validate_textValue(value, displayedTerm): if value and not validation.is_valid_chars(value): return ( False, validation.invalid_chars_error(displayedTerm, include_error_prefix=True), ) return True, None def _validate_textValue_leadingChars(value, displayedTer...
64
64
55
13
50
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
_validate_textValue_leadingChars
_validate_textValue_leadingChars
879
886
879
879
fb83e178ecdd0b89cc98e41390c9d8dcef034e76
bigcode/the-stack
train
09e9811b58c75047213df75f
train
function
def validate_cellularityPct( cellularityPct, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cellularityPct.label"), ): """ check if input is a positive integer between 0 and 100 inclusively. """ if cellularityPct: if RepresentsInt(cellularityPct): value = int(cel...
def validate_cellularityPct( cellularityPct, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cellularityPct.label"), ):
""" check if input is a positive integer between 0 and 100 inclusively. """ if cellularityPct: if RepresentsInt(cellularityPct): value = int(cellularityPct) if value < 0: return ( False, validation.invalid_min_value...
Strains(mouseStrains, field_label="Mouse Strains"): return _validate_SampleAnnotation_CV(mouseStrains, "mouseStrains", field_label) def validate_cellularityPct( cellularityPct, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cellularityPct.label"), ):
64
64
181
30
34
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_cellularityPct
validate_cellularityPct
715
748
715
718
ad78e80c12385537dab833e9ff5ab3d2c1d4e742
bigcode/the-stack
train
c76712d19ee62ad03a369a49
train
function
def validate_sampleStatus(sampleStatus, field_label=_Sample.status.verbose_name): allowed_status_list = [s[0] for s in Sample.ALLOWED_STATUS] if not validation.is_valid_choice(sampleStatus, allowed_status_list): return ( False, validation.invalid_choice(field_label, sampleStatus...
def validate_sampleStatus(sampleStatus, field_label=_Sample.status.verbose_name):
allowed_status_list = [s[0] for s in Sample.ALLOWED_STATUS] if not validation.is_valid_choice(sampleStatus, allowed_status_list): return ( False, validation.invalid_choice(field_label, sampleStatus, allowed_status_list), ) return True, None
and sampleName != tmpSampleDisplayedName: return ( False, "Sample name should match sample displayed name, with spaces allowed in the displayedName", ) # TODO: i18n return True, None def validate_sampleStatus(sampleStatus, field_label=_Sample.status.verbose_name):
64
64
75
15
48
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleStatus
validate_sampleStatus
1,226
1,235
1,226
1,226
395c418aa102ea630101328279e4f37a1a884767
bigcode/the-stack
train
61913eed8aa99e4dbead2e1e
train
function
def validate_mouseStrains(mouseStrains, field_label="Mouse Strains"): return _validate_SampleAnnotation_CV(mouseStrains, "mouseStrains", field_label)
def validate_mouseStrains(mouseStrains, field_label="Mouse Strains"):
return _validate_SampleAnnotation_CV(mouseStrains, "mouseStrains", field_label)
_validate_SampleAnnotation_CV(cancerType, "cancerType", field_label) def validate_population(population, field_label="Population"): return _validate_SampleAnnotation_CV(population, "population", field_label) def validate_mouseStrains(mouseStrains, field_label="Mouse Strains"):
64
64
37
16
48
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_mouseStrains
validate_mouseStrains
711
712
711
711
b61d5dce56a71c8cad9d79dac7ff9a8af5943104
bigcode/the-stack
train
cfe0ddd170ac3b0607ebdab4
train
function
def _validate_textValue(value, displayedTerm): if value and not validation.is_valid_chars(value): return ( False, validation.invalid_chars_error(displayedTerm, include_error_prefix=True), ) return True, None
def _validate_textValue(value, displayedTerm):
if value and not validation.is_valid_chars(value): return ( False, validation.invalid_chars_error(displayedTerm, include_error_prefix=True), ) return True, None
and not RepresentsUnsignedIntOrZero(value): return ( False, validation.invalid_uint_n_zero(displayedTerm, include_error_prefix=True), ) # "Error, " + displayedTerm + ERROR_MSG_INVALID_DATATYPE return True, None def _validate_textValue(value, displayedTerm):
64
64
49
10
53
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
_validate_textValue
_validate_textValue
870
876
870
870
e7aa0993573c48f7c2b14ad5970c4f5759565b1b
bigcode/the-stack
train
7f6ce006448a6b2f64589a70
train
function
def validate_sampleset_items_limit(pending_samplesetitems, sampleSet): ss_object = SampleSet.objects.get(pk=int(sampleSet[0])) # sample set items limit only apply to Ampliseq HD on chef if ss_object.libraryPrepType not in VALID_LIB_TYPES: return True, None available_samples_in_ss = len(ss_objec...
def validate_sampleset_items_limit(pending_samplesetitems, sampleSet):
ss_object = SampleSet.objects.get(pk=int(sampleSet[0])) # sample set items limit only apply to Ampliseq HD on chef if ss_object.libraryPrepType not in VALID_LIB_TYPES: return True, None available_samples_in_ss = len(ss_object.samples.all()) pending_samples_to_add = len(pending_samplesetitem...
groupTypeValues: return ( False, validation.invalid_choice( field_label, groupType, groupTypeValues, include_error_prefix=True ), ) return True, None # Validation check for max samples limit def validate_sampleset_items_...
64
64
173
15
48
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleset_items_limit
validate_sampleset_items_limit
1,585
1,601
1,585
1,585
1e704c1995b38f834d5cecbc0ed8aaa38ce80718
bigcode/the-stack
train
6f5bc911c988dad2e2f12ff1
train
function
def validate_sample_data(queryDict, samplesetitem_label=_SampleSetItem.verbose_name): """ validate Sample attributes return a list containing error messages """ errors = [] if not queryDict: return ( False, validation.invalid_no_data(samplesetitem_label, include_...
def validate_sample_data(queryDict, samplesetitem_label=_SampleSetItem.verbose_name):
""" validate Sample attributes return a list containing error messages """ errors = [] if not queryDict: return ( False, validation.invalid_no_data(samplesetitem_label, include_error_prefix=True), ) # "Error, No sample data to validate." sampleName ...
if input == "fusions": input = "rna" if not validation.is_valid_choice(input, VALID_NUCLEOTIDE_TYPES): return ( False, validation.invalid_choice( field_label, nucleotideType, VALID_NUCLEOTIDE_TYPES ), i...
89
89
297
18
70
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sample_data
validate_sample_data
1,168
1,211
1,168
1,168
6d65079267204018ca1d7406f2256384aeab3d69
bigcode/the-stack
train
36b031942d6013d0537d49bd
train
function
def validate_sample_for_sampleSet( queryDict, samplesetitem_label=_SampleSetItem.verbose_name ): """ basic validation of sample attributes for sample set item creation/update return a boolean isValid and a list of text error messages """ errors = [] if not queryDict: return ( ...
def validate_sample_for_sampleSet( queryDict, samplesetitem_label=_SampleSetItem.verbose_name ):
""" basic validation of sample attributes for sample set item creation/update return a boolean isValid and a list of text error messages """ errors = [] if not queryDict: return ( False, [ validation.invalid_no_data( sampleseti...
Type: pcrPlateRow1 = item.get("pcrPlateRow", "") id1 = item.get("pending_id") else: pcrPlateRow1 = item.pcrPlateRow id1 = item.pk # skip self if id1 and samplesetitem_id and int(id1) == int(samplesetitem_id): continue # ensure...
240
240
803
23
216
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sample_for_sampleSet
validate_sample_for_sampleSet
423
544
423
425
ff08921f4d86dcc257185ccad1da5a8157b058dc
bigcode/the-stack
train
84fb2e5f8000e7210fcb1946
train
function
def _validate_uintandzeroValue(value, displayedTerm): if value and not RepresentsUnsignedIntOrZero(value): return ( False, validation.invalid_uint_n_zero(displayedTerm, include_error_prefix=True), ) # "Error, " + displayedTerm + ERROR_MSG_INVALID_DATATYPE return True, No...
def _validate_uintandzeroValue(value, displayedTerm):
if value and not RepresentsUnsignedIntOrZero(value): return ( False, validation.invalid_uint_n_zero(displayedTerm, include_error_prefix=True), ) # "Error, " + displayedTerm + ERROR_MSG_INVALID_DATATYPE return True, None
if value and not RepresentsUnsignedInt(value): return ( False, validation.invalid_uint(displayedTerm, include_error_prefix=True), ) # "Error, " + displayedTerm + ERROR_MSG_INVALID_DATATYPE return True, None def _validate_uintandzeroValue(value, displayedTerm):
64
64
69
12
51
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
_validate_uintandzeroValue
_validate_uintandzeroValue
861
867
861
861
77d3403a86218621408d4117003f7a535ef565a6
bigcode/the-stack
train
dbb90d2892ef5470db44d4e7
train
function
def validate_sampleEmbryoId( sampleEmbryoId, field_label=ugettext_lazy("samplesets.samplesetitem.fields.embryoId.label"), ): return _validate_optional_text( sampleEmbryoId, MAX_LENGTH_SAMPLE_EMBRYO_ID, field_label )
def validate_sampleEmbryoId( sampleEmbryoId, field_label=ugettext_lazy("samplesets.samplesetitem.fields.embryoId.label"), ):
return _validate_optional_text( sampleEmbryoId, MAX_LENGTH_SAMPLE_EMBRYO_ID, field_label )
.label"), ): return _validate_optional_text( sampleCoupleId, MAX_LENGTH_SAMPLE_COUPLE_ID, field_label ) def validate_sampleEmbryoId( sampleEmbryoId, field_label=ugettext_lazy("samplesets.samplesetitem.fields.embryoId.label"), ):
64
64
62
35
29
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleEmbryoId
validate_sampleEmbryoId
833
839
833
836
4cadfe4417217d293179963167056c89a3f04f2a
bigcode/the-stack
train
1ca4c2fb6b09ddf841556b7c
train
function
def validate_barcodekit_and_id_str( barcodeKit, barcode_id_str, barcodeKit_label="Barcode Set", barcode_id_str_label="Barcode", ): item = "" errorMessage = "" # Trim off barcode and barcode kit leading and trailing spaces and update the log file if exists if (len(barcodeKit) - len(barco...
def validate_barcodekit_and_id_str( barcodeKit, barcode_id_str, barcodeKit_label="Barcode Set", barcode_id_str_label="Barcode", ):
item = "" errorMessage = "" # Trim off barcode and barcode kit leading and trailing spaces and update the log file if exists if (len(barcodeKit) - len(barcodeKit.lstrip())) or ( len(barcodeKit) - len(barcodeKit.rstrip()) ): logger.warning( "The BarcodeKitName(%s) contain...
include_error_prefix=True ), ) if not validation.is_valid_length( attributeName.strip(), MAX_LENGTH_SAMPLE_ATTRIBUTE_DISPLAYED_NAME ): errorMessage = validation.invalid_length_error( attribute_name_label, MAX_LENGTH_SAMPLE_ATTRIBUTE_DISPLAYED_NAME, ...
214
214
715
35
178
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_barcodekit_and_id_str
validate_barcodekit_and_id_str
1,052
1,140
1,052
1,057
823b90ef35d70bf73b1201d91f89e5ece0ba5f30
bigcode/the-stack
train
8c610f7c2c555b4b3594272e
train
function
def validate_sampleDescription( sampleDescription, field_label=_Sample.description.verbose_name ): isValid = False if validation.has_value(sampleDescription): isValid, errorMessage = _validate_textValue(sampleDescription, field_label) if not isValid: return False, errorMessage ...
def validate_sampleDescription( sampleDescription, field_label=_Sample.description.verbose_name ):
isValid = False if validation.has_value(sampleDescription): isValid, errorMessage = _validate_textValue(sampleDescription, field_label) if not isValid: return False, errorMessage if not validation.is_valid_length( sampleDescription.strip(), MAX_LENGTH_SAMPLE_DESC...
errorMessage = validation.invalid_length_error( field_label, MAX_LENGTH_SAMPLE_EXTERNAL_ID, sampleExternalId.strip(), include_error_prefix=True, ) return False, errorMessage return True, None def validate_sampleDescription( sampleDescription, fie...
64
64
127
18
45
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleDescription
validate_sampleDescription
606
626
606
608
a45d5b13f20d90a4bde1678766a11301fbd69a44
bigcode/the-stack
train
3d2f40b6b8ebcfae2a9b2759
train
function
def validate_sampleAttribute( attribute, value, sampleattribute_label=_SampleAttribute.verbose_name ): """ validate the sample attribute value for the attribute of interest return a boolean isValid and a text string for error message, None if input passes validation Note: Input length will not be va...
def validate_sampleAttribute( attribute, value, sampleattribute_label=_SampleAttribute.verbose_name ):
""" validate the sample attribute value for the attribute of interest return a boolean isValid and a text string for error message, None if input passes validation Note: Input length will not be validated since maxLength has been specified in the form. """ isValid = False if not attribute: ...
_optional_text(value, maxLength, displayedTerm): isValid, errorMessage = _validate_textValue(value.strip(), displayedTerm) if not isValid: return False, errorMessage if not validation.is_valid_length(value.strip(), maxLength): errorMessage = validation.invalid_length_error( disp...
112
112
375
20
91
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleAttribute
validate_sampleAttribute
903
965
903
905
ec305dab52d2f40976ca5f1ac01e6122ab588c32
bigcode/the-stack
train
6e80b7b35d65a6c1615eb25a
train
function
def validate_nucleotideType(nucleotideType, field_label="Sample Nucleotide Type"): """ validate nucleotide type case-insensitively with leading/trailing blanks in the input ignored """ VALID_NUCLEOTIDE_TYPES = [Nuc[0] for Nuc in SampleSetItem.ALLOWED_NUCLEOTIDE_TYPES] error = "" input = "" ...
def validate_nucleotideType(nucleotideType, field_label="Sample Nucleotide Type"):
""" validate nucleotide type case-insensitively with leading/trailing blanks in the input ignored """ VALID_NUCLEOTIDE_TYPES = [Nuc[0] for Nuc in SampleSetItem.ALLOWED_NUCLEOTIDE_TYPES] error = "" input = "" if nucleotideType: input = nucleotideType.strip().lower() if input ...
, "barcodeSetLabel": barcodeKit_label, "barcodeLabel": barcode_id_str_label, }, include_error_prefix=True, ), "barcodeKit", ) return True, errorMessage, item def validate_nucleotideType(nucleotideType, field_lab...
64
64
165
17
46
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_nucleotideType
validate_nucleotideType
1,143
1,165
1,143
1,143
0a69882d3a9a43b0c438465d5a61279301690a26
bigcode/the-stack
train
5e5584f7e38828b36eae4f1f
train
function
def validate_population(population, field_label="Population"): return _validate_SampleAnnotation_CV(population, "population", field_label)
def validate_population(population, field_label="Population"):
return _validate_SampleAnnotation_CV(population, "population", field_label)
, None def validate_cancerType( cancerType, field_label=ugettext_lazy("samplesets.samplesetitem.fields.cancerType.label"), ): return _validate_SampleAnnotation_CV(cancerType, "cancerType", field_label) def validate_population(population, field_label="Population"):
64
64
29
11
53
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_population
validate_population
707
708
707
707
ce63fd43b522c9277cc84e1b60d11ccca4520878
bigcode/the-stack
train
9c2e7c2dfd15ad36715e1d33
train
function
def validate_for_same_sampleName_displayedName(sampleDisplayedName, sampleName): # Verify the sample name and displayed name are similar (allow spaces) tmpSampleDisplayedName = "_".join(sampleDisplayedName.split()) if sampleName != sampleDisplayedName and sampleName != tmpSampleDisplayedName: return...
def validate_for_same_sampleName_displayedName(sampleDisplayedName, sampleName): # Verify the sample name and displayed name are similar (allow spaces)
tmpSampleDisplayedName = "_".join(sampleDisplayedName.split()) if sampleName != sampleDisplayedName and sampleName != tmpSampleDisplayedName: return ( False, "Sample name should match sample displayed name, with spaces allowed in the displayedName", ) # TODO: i18n r...
_same_sampleName_displayedName( sampleDisplayedName, sampleName ) if not isValid: errors.append(errorMessage) return errors def validate_for_same_sampleName_displayedName(sampleDisplayedName, sampleName): # Verify the sample name and displayed name are similar (allow spaces)
64
64
102
31
32
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_for_same_sampleName_displayedName
validate_for_same_sampleName_displayedName
1,214
1,223
1,214
1,215
857268293d59467ba4194f3f5ff5ce95348ef69f
bigcode/the-stack
train
fef1595f7e5a24c07d6e718d
train
function
def validate_cyclingProtocols(cyclingProtocols, field_label="Cycling Protocols"): return _validate_SampleAnnotation_CV( cyclingProtocols, "cyclingProtocols", field_label )
def validate_cyclingProtocols(cyclingProtocols, field_label="Cycling Protocols"):
return _validate_SampleAnnotation_CV( cyclingProtocols, "cyclingProtocols", field_label )
PoolType", field_label) def validate_additionalCycles(additionalCycles, field_label="Additional Cycles"): return _validate_SampleAnnotation_CV( additionalCycles, "additionalCycles", field_label ) def validate_cyclingProtocols(cyclingProtocols, field_label="Cycling Protocols"):
64
64
42
19
45
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_cyclingProtocols
validate_cyclingProtocols
666
669
666
666
edebd3de70dfd4f393cbccfa1fae31898425720a
bigcode/the-stack
train
31ec2a12cf0ccda1d6c0810b
train
function
def validate_samplesetGroupType(groupType, field_label="Group Type"): if groupType: groupTypeValues = SampleGroupType_CV.objects.values_list( "displayedName", flat=True ) if groupType not in groupTypeValues: return ( False, validation.i...
def validate_samplesetGroupType(groupType, field_label="Group Type"):
if groupType: groupTypeValues = SampleGroupType_CV.objects.values_list( "displayedName", flat=True ) if groupType not in groupTypeValues: return ( False, validation.invalid_choice( field_label, groupType, groupTypeVa...
validate_libraryPrepKitName(libraryPrepKitName, field_label="Library Prep Kit"): errors, _ = validate_optional_kit_name( libraryPrepKitName, ["LibraryPrepKit"], field_label ) return errors def validate_samplesetGroupType(groupType, field_label="Group Type"):
64
64
92
15
48
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_samplesetGroupType
validate_samplesetGroupType
1,568
1,581
1,568
1,568
8d44b9545577dd5f28baaa44008e24cd6ef18d61
bigcode/the-stack
train
9ae010633cf61c9cd7288dee
train
function
def validate_sampleAttribute_mandatory_for_no_value( attribute, sampleattribute_label=_SampleAttribute.verbose_name ): if not attribute: return ( False, validation.invalid_no_data( sampleattribute_label, include_error_prefix=True ), ) # "Error...
def validate_sampleAttribute_mandatory_for_no_value( attribute, sampleattribute_label=_SampleAttribute.verbose_name ):
if not attribute: return ( False, validation.invalid_no_data( sampleattribute_label, include_error_prefix=True ), ) # "Error, No sample attribute to validate." if attribute.isMandatory: return ( False, validati...
, MAX_LENGTH_SAMPLE_ATTRIBUTE_VALUE, aValue, include_error_prefix=True, ) return False, errorMessage isValid = True return isValid, None def validate_sampleAttribute_mandatory_for_no_value( attribute, sampleattribute_label=_SampleAttri...
64
64
121
24
39
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleAttribute_mandatory_for_no_value
validate_sampleAttribute_mandatory_for_no_value
968
987
968
970
3cf9b5bd9e75f4edd11e9f58c62d5f1a67281c88
bigcode/the-stack
train
08c943456fd4accfe7a70aba
train
function
def validate_sampleBiopsyDays( sampleBiopsyDays, field_label=ugettext_lazy("samplesets.samplesetitem.fields.biopsyDays.label"), ): isValid, errorMessage = _validate_uintandzeroValue(sampleBiopsyDays, field_label) return isValid, errorMessage
def validate_sampleBiopsyDays( sampleBiopsyDays, field_label=ugettext_lazy("samplesets.samplesetitem.fields.biopsyDays.label"), ):
isValid, errorMessage = _validate_uintandzeroValue(sampleBiopsyDays, field_label) return isValid, errorMessage
return ( False, validation.invalid_receipt_date( field_label, include_error_prefix=True ), ) return True, None def validate_sampleBiopsyDays( sampleBiopsyDays, field_label=ugettext_lazy("samp...
64
64
61
32
31
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleBiopsyDays
validate_sampleBiopsyDays
807
812
807
810
80b666961cbf0ae86faf601e537938b47e91c924
bigcode/the-stack
train
6c1e7122da0bd1ea235eff9d
train
function
def validate_sampleAttribute_definition( attributeName, attributeDescription, attribute_name_label=ugettext_lazy( "samplesets.sampleattributes.fields.displayedName.label" ), attribute_description_label=ugettext_lazy( "samplesets.sampleattributes.fields.description.label" ), ): ...
def validate_sampleAttribute_definition( attributeName, attributeDescription, attribute_name_label=ugettext_lazy( "samplesets.sampleattributes.fields.displayedName.label" ), attribute_description_label=ugettext_lazy( "samplesets.sampleattributes.fields.description.label" ), ):
""" validate the sample attribute definition return a boolean isValid and a text string for error message, None if input passes validation Note: Input length will not be validated since maxLength has been specified in the form. """ if not validation.has_value(attributeName): return ( ...
False, validation.required_error( attribute.displayedName, include_error_prefix=True ), ) # "Error, " + attribute.displayedName + " value is required." return True, None def validate_sampleAttribute_definition( attributeName, attributeDescription...
103
103
344
57
45
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleAttribute_definition
validate_sampleAttribute_definition
990
1,049
990
999
ca00aa81ac490093bc0cdc460305b11652eb22c9
bigcode/the-stack
train
e8361b047d81dab0fc74e42e
train
function
def _validate_optional_text(value, maxLength, displayedTerm): isValid, errorMessage = _validate_textValue(value.strip(), displayedTerm) if not isValid: return False, errorMessage if not validation.is_valid_length(value.strip(), maxLength): errorMessage = validation.invalid_length_error( ...
def _validate_optional_text(value, maxLength, displayedTerm):
isValid, errorMessage = _validate_textValue(value.strip(), displayedTerm) if not isValid: return False, errorMessage if not validation.is_valid_length(value.strip(), maxLength): errorMessage = validation.invalid_length_error( displayedTerm, maxLength, value.strip(), include_erro...
Value_leadingChars(value, displayedTerm): if value and not validation.is_valid_leading_chars(value): return ( False, validation.invalid_leading_chars(displayedTerm, include_error_prefix=True), ) return True, None def _validate_optional_text(value, maxLength, displayedTer...
64
64
95
13
50
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
_validate_optional_text
_validate_optional_text
889
900
889
889
e0f3be6492defd0e552d659b17462b5c9bd0af37
bigcode/the-stack
train
a175faf088947cdfdd618e09
train
function
def validate_sampleName(sampleName, field_label=_Sample.displayedName.verbose_name): isValid, errorMessage = _validate_textValue_mandatory(sampleName, field_label) if not isValid: return isValid, errorMessage isValid, errorMessage = _validate_textValue(sampleName, field_label) if not isValid:...
def validate_sampleName(sampleName, field_label=_Sample.displayedName.verbose_name):
isValid, errorMessage = _validate_textValue_mandatory(sampleName, field_label) if not isValid: return isValid, errorMessage isValid, errorMessage = _validate_textValue(sampleName, field_label) if not isValid: return isValid, errorMessage isValid, errorMessage = _validate_textValue...
Sample.ALLOWED_STATUS] if not validation.is_valid_choice(sampleStatus, allowed_status_list): return ( False, validation.invalid_choice(field_label, sampleStatus, allowed_status_list), ) return True, None def validate_sampleName(sampleName, field_label=_Sample.displayed...
64
64
178
17
46
konradotto/TS
dbReports/iondb/rundb/sample/sample_validator.py
Python
validate_sampleName
validate_sampleName
1,238
1,262
1,238
1,239
da422b502c22ec3f0af3846a87d49c64e9cb34b4
bigcode/the-stack
train
56f88f6d7d858102d4117ea6
train
class
class TaskStats(_BaseEvergreenObject): """Representation of an Evergreen task stats object.""" test_file = evg_attrib("test_file") task_name = evg_attrib("task_name") variant = evg_attrib("variant") distro = evg_attrib("distro") evg_date_attrib("date") num_pass = evg_attrib("num_pass") ...
class TaskStats(_BaseEvergreenObject):
"""Representation of an Evergreen task stats object.""" test_file = evg_attrib("test_file") task_name = evg_attrib("task_name") variant = evg_attrib("variant") distro = evg_attrib("distro") evg_date_attrib("date") num_pass = evg_attrib("num_pass") num_fail = evg_attrib("num_fail") a...
, json: Dict[str, Any], api: "EvergreenApi") -> None: """ Create an instance of a test stats object. :param json: json version of object. """ super(TestStats, self).__init__(json, api) class TaskStats(_BaseEvergreenObject):
64
64
172
9
55
threebee/evergreen.py
src/evergreen/stats.py
Python
TaskStats
TaskStats
35
53
35
35
bfc992bf281814dd493de9464e4157c39f5a4c29
bigcode/the-stack
train
00992dc97cbe548317ca06ec
train
class
class TestStats(_BaseEvergreenObject): """Representation of an Evergreen test stats object.""" test_file = evg_attrib("test_file") task_name = evg_attrib("task_name") test_name = evg_attrib("test_name") variant = evg_attrib("variant") distro = evg_attrib("distro") evg_date_attrib("date") ...
class TestStats(_BaseEvergreenObject):
"""Representation of an Evergreen test stats object.""" test_file = evg_attrib("test_file") task_name = evg_attrib("task_name") test_name = evg_attrib("test_name") variant = evg_attrib("variant") distro = evg_attrib("distro") evg_date_attrib("date") num_pass = evg_attrib("num_pass") ...
evergreen.""" from __future__ import absolute_import from typing import TYPE_CHECKING, Any, Dict from evergreen.base import _BaseEvergreenObject, evg_attrib, evg_date_attrib if TYPE_CHECKING: from evergreen.api import EvergreenApi class TestStats(_BaseEvergreenObject):
64
64
184
9
54
threebee/evergreen.py
src/evergreen/stats.py
Python
TestStats
TestStats
13
32
13
13
2945cc553d31dec8e24fef2f08ac387adf51e80d
bigcode/the-stack
train
cc706a53a1301abcecd5131d
train
function
def normalize_network_id(network_id): return network_id.split('/')[0]
def normalize_network_id(network_id):
return network_id.split('/')[0]
import click def normalize_network_id(network_id):
10
64
16
7
2
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
normalize_network_id
normalize_network_id
3
4
3
3
2a21b76b53102c4ea92be41151fdf2d3a6f788e9
bigcode/the-stack
train
1b72d7474aa48cca01bf177c
train
function
@click.option('--filter-tag') @click.option('--filter-json') @click.option('--delete', is_flag=True) @click.option('--force', is_flag=True) @floating_ip.command("list") @click.pass_obj def cmd_list(cloudscale, filter_tag, filter_json, delete, force): cloudscale.cmd_list( filter_tag=filter_tag, filte...
@click.option('--filter-tag') @click.option('--filter-json') @click.option('--delete', is_flag=True) @click.option('--force', is_flag=True) @floating_ip.command("list") @click.pass_obj def cmd_list(cloudscale, filter_tag, filter_json, delete, force):
cloudscale.cmd_list( filter_tag=filter_tag, filter_json=filter_json, delete=delete, force=force, )
_uuid_name = "network" @click.option('--filter-tag') @click.option('--filter-json') @click.option('--delete', is_flag=True) @click.option('--force', is_flag=True) @floating_ip.command("list") @click.pass_obj def cmd_list(cloudscale, filter_tag, filter_json, delete, force):
64
64
90
58
6
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
cmd_list
cmd_list
22
34
22
28
8113430feae773823ac1baedfcee8930a0310b4c
bigcode/the-stack
train
77ae2c88aa23499d7ca47f94
train
function
@click.argument('network-id', required=True) @click.option('--server-uuid', '--server', required=True) @floating_ip.command("assign") @click.pass_obj def cmd_assign(cloudscale, network_id, server_uuid): cloudscale.cmd_update( uuid=network_id, server_uuid=server_uuid, )
@click.argument('network-id', required=True) @click.option('--server-uuid', '--server', required=True) @floating_ip.command("assign") @click.pass_obj def cmd_assign(cloudscale, network_id, server_uuid):
cloudscale.cmd_update( uuid=network_id, server_uuid=server_uuid, )
_tags, server_uuid=server_uuid, reverse_ptr=reverse_ptr, ) @click.argument('network-id', required=True) @click.option('--server-uuid', '--server', required=True) @floating_ip.command("assign") @click.pass_obj def cmd_assign(cloudscale, network_id, server_uuid):
64
64
67
46
18
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
cmd_assign
cmd_assign
88
96
88
92
3bec91ccd805de6f244ba75f70a019976e5ea8be
bigcode/the-stack
train
38c9a3b1eda33b938629e9cf
train
function
@click.option('--ip-version', type=int, default=4, show_default=True) @click.option('--server-uuid', '--server') @click.option('--prefix-length', type=int) @click.option('--reverse-ptr') @click.option('--type', 'scope', type=click.Choice(['regional', 'global']), default='regional', show_default=True) @click.option('--r...
@click.option('--ip-version', type=int, default=4, show_default=True) @click.option('--server-uuid', '--server') @click.option('--prefix-length', type=int) @click.option('--reverse-ptr') @click.option('--type', 'scope', type=click.Choice(['regional', 'global']), default='regional', show_default=True) @click.option('--r...
if not prefix_length: if ip_version == 6: prefix_length = 128 else: prefix_length = 32 cloudscale.cmd_create( ip_version=ip_version, server_uuid=server_uuid, prefix_length=prefix_length, reverse_ptr=reverse_ptr, scope=scope, ...
@click.option('--ip-version', type=int, default=4, show_default=True) @click.option('--server-uuid', '--server') @click.option('--prefix-length', type=int) @click.option('--reverse-ptr') @click.option('--type', 'scope', type=click.Choice(['regional', 'global']), default='regional', show_default=True) @click.option('--r...
122
64
204
122
0
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
cmd_create
cmd_create
44
68
44
53
822f087b907b01e5c67c027439211bbf3c268c5a
bigcode/the-stack
train
a2e0f293eab57cb82aec6b16
train
function
@click.argument('network-id', required=True) @click.option('--server-uuid', '--server') @click.option('--reverse-ptr') @click.option('--tag', 'tags', multiple=True) @click.option('--clear-tag', 'clear_tags', multiple=True) @click.option('--clear-all-tags', is_flag=True) @floating_ip.command("update") @click.pass_obj de...
@click.argument('network-id', required=True) @click.option('--server-uuid', '--server') @click.option('--reverse-ptr') @click.option('--tag', 'tags', multiple=True) @click.option('--clear-tag', 'clear_tags', multiple=True) @click.option('--clear-all-tags', is_flag=True) @floating_ip.command("update") @click.pass_obj de...
cloudscale.cmd_update( uuid=normalize_network_id(network_id), tags=tags, clear_tags=clear_tags, clear_all_tags=clear_all_tags, server_uuid=server_uuid, reverse_ptr=reverse_ptr, )
@click.argument('network-id', required=True) @click.option('--server-uuid', '--server') @click.option('--reverse-ptr') @click.option('--tag', 'tags', multiple=True) @click.option('--clear-tag', 'clear_tags', multiple=True) @click.option('--clear-all-tags', is_flag=True) @floating_ip.command("update") @click.pass_obj de...
97
64
149
97
0
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
cmd_update
cmd_update
70
86
70
78
b3bde38fa7657ea3b6fd11ae3ea57c6ad12f40e6
bigcode/the-stack
train
5a3773e91c478da28f97b60c
train
function
@click.group() @click.pass_context def floating_ip(ctx): ctx.obj.cloud_resource_name = "floating_ip" ctx.obj.headers = [ 'network', 'ip_version', 'server', 'reverse_ptr', 'type', 'region', 'tags', ] ctx.obj.resource_name_key = None ctx.obj.reso...
@click.group() @click.pass_context def floating_ip(ctx):
ctx.obj.cloud_resource_name = "floating_ip" ctx.obj.headers = [ 'network', 'ip_version', 'server', 'reverse_ptr', 'type', 'region', 'tags', ] ctx.obj.resource_name_key = None ctx.obj.resource_uuid_name = "network"
import click def normalize_network_id(network_id): return network_id.split('/')[0] @click.group() @click.pass_context def floating_ip(ctx):
31
64
80
12
19
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
floating_ip
floating_ip
6
20
6
8
3a029e40d2a743b26c7b6fd148ab25b60f6a4acf
bigcode/the-stack
train
3bef9addc18b3a6151e340ef
train
function
@click.argument('network-id', required=True) @click.option('--force', is_flag=True) @floating_ip.command("delete") @click.pass_obj def cmd_delete(cloudscale, network_id, force): cloudscale.cmd_delete( uuid=normalize_network_id(network_id), force=force, )
@click.argument('network-id', required=True) @click.option('--force', is_flag=True) @floating_ip.command("delete") @click.pass_obj def cmd_delete(cloudscale, network_id, force):
cloudscale.cmd_delete( uuid=normalize_network_id(network_id), force=force, )
_uuid): cloudscale.cmd_update( uuid=network_id, server_uuid=server_uuid, ) @click.argument('network-id', required=True) @click.option('--force', is_flag=True) @floating_ip.command("delete") @click.pass_obj def cmd_delete(cloudscale, network_id, force):
64
64
63
41
23
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
cmd_delete
cmd_delete
98
106
98
102
76ba2f70541eafdf0040560e68944aa33a8cf601
bigcode/the-stack
train
8c1824370fee88e8cdb2af0d
train
function
@click.argument('network-id', required=True) @floating_ip.command("show") @click.pass_obj def cmd_show(cloudscale, network_id): cloudscale.cmd_show( uuid=normalize_network_id(network_id), )
@click.argument('network-id', required=True) @floating_ip.command("show") @click.pass_obj def cmd_show(cloudscale, network_id):
cloudscale.cmd_show( uuid=normalize_network_id(network_id), )
force): cloudscale.cmd_list( filter_tag=filter_tag, filter_json=filter_json, delete=delete, force=force, ) @click.argument('network-id', required=True) @floating_ip.command("show") @click.pass_obj def cmd_show(cloudscale, network_id):
64
64
47
30
34
cloudscale-ch/cloudscale-cli
cloudscale_cli/commands/floating_ip.py
Python
cmd_show
cmd_show
36
42
36
39
1c31a3268a293bfff3291b176e31675ea6145afa
bigcode/the-stack
train
9af7acd77677de851dae90ed
train
class
class ResultTypes(Enum): UNKNOWN = 'unknown' SUCCESS = 'success' ERROR = 'error' NO_RESULT = 'no_result' THRESHOLD = 'threshold'
class ResultTypes(Enum):
UNKNOWN = 'unknown' SUCCESS = 'success' ERROR = 'error' NO_RESULT = 'no_result' THRESHOLD = 'threshold'
from enum import Enum from reliabilly.settings import Constants class ResultTypes(Enum):
18
64
39
5
12
corpseware/reliabilly
reliabilly/components/services/__init__.py
Python
ResultTypes
ResultTypes
5
10
5
5
dbe4466bd104665959927b19627f04b0017d711c
bigcode/the-stack
train
25b19eabb3360e254f42946a
train
class
class QueryResult: # pylint: disable=too-few-public-methods value: float result: ResultTypes message: str def __init__(self, value=None, result=ResultTypes.UNKNOWN, message=Constants.EMPTY): self.value = value self.result = result self.message = message def __str__(self): ...
class QueryResult: # pylint: disable=too-few-public-methods
value: float result: ResultTypes message: str def __init__(self, value=None, result=ResultTypes.UNKNOWN, message=Constants.EMPTY): self.value = value self.result = result self.message = message def __str__(self): return f'Result Value: {self.value}, Result: {self.re...
from reliabilly.settings import Constants class ResultTypes(Enum): UNKNOWN = 'unknown' SUCCESS = 'success' ERROR = 'error' NO_RESULT = 'no_result' THRESHOLD = 'threshold' class QueryResult: # pylint: disable=too-few-public-methods
64
64
103
17
47
corpseware/reliabilly
reliabilly/components/services/__init__.py
Python
QueryResult
QueryResult
13
24
13
13
1afc26f0ab9b1e87db5d608a343788054d6a88f8
bigcode/the-stack
train
fb223d2192f876e54e75ddb2
train
class
class AECoronaRoundCornersTemplate(BaseTemplate): def __init__(self, nodeName): BaseTemplate.__init__(self,nodeName) log.debug("AECoronaRoundCornersTemplate") self.thisNode = None self.node = pm.PyNode(self.nodeName) pm.mel.AEswatchDisplay(nodeName) self.beginScrollLa...
class AECoronaRoundCornersTemplate(BaseTemplate):
def __init__(self, nodeName): BaseTemplate.__init__(self,nodeName) log.debug("AECoronaRoundCornersTemplate") self.thisNode = None self.node = pm.PyNode(self.nodeName) pm.mel.AEswatchDisplay(nodeName) self.beginScrollLayout() self.buildBody(nodeName) al...
=None, **kwargs): pm.ui.AETemplate.addControl(self, control, label=label, **kwargs) def beginLayout(self, name, collapse=True): pm.ui.AETemplate.beginLayout(self, name, collapse=collapse) class AECoronaRoundCornersTemplate(BaseTemplate):
63
64
212
11
52
haggi/OpenMaya
src/mayaToCorona/mtco_devmodule/scripts/Corona/AETemplate/AECoronaRoundCornersTemplate.py
Python
AECoronaRoundCornersTemplate
AECoronaRoundCornersTemplate
15
38
15
15
5fc4760abfa53cff37874f88c53c896b5b384922
bigcode/the-stack
train
a2860214579254547d0bd3f6
train
class
class BaseTemplate(pm.ui.AETemplate): def addControl(self, control, label=None, **kwargs): pm.ui.AETemplate.addControl(self, control, label=label, **kwargs) def beginLayout(self, name, collapse=True): pm.ui.AETemplate.beginLayout(self, name, collapse=collapse)
class BaseTemplate(pm.ui.AETemplate):
def addControl(self, control, label=None, **kwargs): pm.ui.AETemplate.addControl(self, control, label=label, **kwargs) def beginLayout(self, name, collapse=True): pm.ui.AETemplate.beginLayout(self, name, collapse=collapse)
import pymel.core as pm import logging log = logging.getLogger("ui") class BaseTemplate(pm.ui.AETemplate):
28
64
71
10
18
haggi/OpenMaya
src/mayaToCorona/mtco_devmodule/scripts/Corona/AETemplate/AECoronaRoundCornersTemplate.py
Python
BaseTemplate
BaseTemplate
6
12
6
7
c847f706509c0a890525b764bbd1ea322bcdb94b
bigcode/the-stack
train
793790df6ba4e5b94dbe5e3f
train
function
def setup(app): # Hook to allow for automatic generation of API docs # before doc deployment begins. app.connect('builder-inited', generate_apidocs)
def setup(app): # Hook to allow for automatic generation of API docs # before doc deployment begins.
app.connect('builder-inited', generate_apidocs)
oc_command_path, '--force', '--separate'] + ['-o', output_path, module_path] + [os.path.join(root_dir_abs, pattern) for pattern in exclude_patterns]) def setup(app): # Hook to allow for automatic generation of API docs # before doc deployment begins.
64
64
36
23
41
UCL/scikit-surgery-evaluation
doc/conf.py
Python
setup
setup
75
78
75
77
299e1eff9df82ac6448c7940253f4db20634a263
bigcode/the-stack
train
fb1c9ca08fad417db8878cc5
train
function
def generate_apidocs(*args): """Generate API docs automatically by trawling the available modules""" global working_dir, module_path output_path = working_dir apidoc_command_path = 'sphinx-apidoc' if hasattr(sys, 'real_prefix'): # called from a virtualenv apidoc_command_path = os.path.join...
def generate_apidocs(*args):
"""Generate API docs automatically by trawling the available modules""" global working_dir, module_path output_path = working_dir apidoc_command_path = 'sphinx-apidoc' if hasattr(sys, 'real_prefix'): # called from a virtualenv apidoc_command_path = os.path.join(sys.prefix, 'bin', 'sphinx-a...
static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". static_folder = 'static' html_static_path = [static_folder] def generate_apidocs(*args):
64
64
156
8
56
UCL/scikit-surgery-evaluation
doc/conf.py
Python
generate_apidocs
generate_apidocs
60
72
60
60
5f0502408e243caf39bf73e6f7b45e54421700a0
bigcode/the-stack
train
babf17fbd307162e1cfb1650
train
class
class Geometry(object): """ This class is an azimuthal integrator based on P. Boesecke's geometry and histogram algorithm by Manolo S. del Rio and V.A Sole Detector is assumed to be corrected from "raster orientation" effect. It is not addressed here but rather in the Detector object or at read tim...
class Geometry(object):
""" This class is an azimuthal integrator based on P. Boesecke's geometry and histogram algorithm by Manolo S. del Rio and V.A Sole Detector is assumed to be corrected from "raster orientation" effect. It is not addressed here but rather in the Detector object or at read time. Considering there...
""" from __future__ import division, print_function __author__ = "Jerome Kieffer" __contact__ = "Jerome.Kieffer@ESRF.eu" __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" __date__ = "11/01/2018" __status__ = "production" __docformat__ = 'restructuredtext' import logging ...
255
256
20,883
4
251
vallsv/pyFAI
pyFAI/geometry.py
Python
Geometry
Geometry
77
2,109
77
77
a9fd50d60f4ef06d4211cec6e18a6346bad1b132
bigcode/the-stack
train
1cc1affdd4da79d3950a0d8f
train
class
class Led_Controller(object): ON = 1 OFF = 0 PINS = [2, 3, 4, 5, 6, 7, 8, 9] ARDUINO_PORT = 'com3' BLINK_TIME = 0.2 def __init__(self): # self.__ser = serial.Serial('COM3', 9800, timeout=1) self.__board = pyfirmata.Arduino(Led_Controller.ARDUINO_PORT) def turn_on(self, ...
class Led_Controller(object):
ON = 1 OFF = 0 PINS = [2, 3, 4, 5, 6, 7, 8, 9] ARDUINO_PORT = 'com3' BLINK_TIME = 0.2 def __init__(self): # self.__ser = serial.Serial('COM3', 9800, timeout=1) self.__board = pyfirmata.Arduino(Led_Controller.ARDUINO_PORT) def turn_on(self, light): # self.__se...
import pyfirmata import time from protocol import data_to_raw from finding_file import find class Led_Controller(object):
26
108
361
5
20
Savioor/sprint2
led_controller.py
Python
Led_Controller
Led_Controller
7
49
7
7
642aaebbaccc85168a33e64f775e25c50f5ab1fb
bigcode/the-stack
train
c702b7683a07691bbdfbcef6
train
class
@alf.configurable class DynamicActionRepeatAgent(OffPolicyAlgorithm): """Create an agent which learns a variable action repetition duration. At each decision step, the agent outputs both the action to repeat and the number of steps to repeat. These two quantities together constitute the action of the ag...
@alf.configurable class DynamicActionRepeatAgent(OffPolicyAlgorithm):
"""Create an agent which learns a variable action repetition duration. At each decision step, the agent outputs both the action to repeat and the number of steps to repeat. These two quantities together constitute the action of the agent. We use SAC with mixed action type for training. The core ide...
http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing pe...
256
256
2,838
15
241
hnyu/alf
alf/algorithms/dynamic_action_repeat_agent.py
Python
DynamicActionRepeatAgent
DynamicActionRepeatAgent
37
356
37
38
ea67e1f47ce02e9edd61132e176ce2e7e5ff1191
bigcode/the-stack
train
4f8d20024005e4fb28c9f7fc
train
class
class ProfileModelTestCase(TestCase): def setUp(self): self.user_john = User(username='john123',email='john@gmail.com', password='abcdef') self.profile_two = Profile(profile_photo='/path/image.png',user=self.user_john, bio='I am here to get validation.Jokes',phone_number='0712345678') ...
class ProfileModelTestCase(TestCase):
def setUp(self): self.user_john = User(username='john123',email='john@gmail.com', password='abcdef') self.profile_two = Profile(profile_photo='/path/image.png',user=self.user_john, bio='I am here to get validation.Jokes',phone_number='0712345678') def test_save_profile(self): ...
_one.update_project('GithubSearchAPI') self.assertTrue(self.project_one.project_title=='GithubSearchAPI') def test_delete_project(self): self.user_one.save() self.profile_one.save_profile() self.project_one.save_project() self.project_one.delete_project() project...
83
83
279
8
75
arondasamuel123/AwwwardsClone
awards/tests.py
Python
ProfileModelTestCase
ProfileModelTestCase
56
87
56
56
f064d0e92cf3ac497ceda28121c6f976ec588eb4
bigcode/the-stack
train
f0e9585bfce041d354cae345
train
class
class ReviewModelTestCase(TestCase): def setUp(self): self.user_jane = User(username='jane123', email='jane123@gmail.com',password='qwerty@420') self.profile_jane = Profile(profile_photo='/image/png',user=self.user_jane, bio='this is my bio',phone_number='0791019910') self.project_three = P...
class ReviewModelTestCase(TestCase):
def setUp(self): self.user_jane = User(username='jane123', email='jane123@gmail.com',password='qwerty@420') self.profile_jane = Profile(profile_photo='/image/png',user=self.user_jane, bio='this is my bio',phone_number='0791019910') self.project_three = Project(project_title='Design Website'...
') def test_get_prof_id(self): self.user_john.save() self.profile_two.save_profile() self.profile_two.get_prof_id(self.profile_two.id) profiles = Profile.objects.all() self.assertTrue(len(profiles) > 0) class ReviewModelTestCase(TestCase):
63
64
196
8
55
arondasamuel123/AwwwardsClone
awards/tests.py
Python
ReviewModelTestCase
ReviewModelTestCase
90
103
90
90
e05d21ae6873bc2ec1611c16de4f67a1a6ffd28a
bigcode/the-stack
train
cb5987b1029a82dcb7090706
train
class
class ProjectModelTestCase(TestCase): ''' Test Class for Project Model ''' def setUp(self): self.user_one = User(username='arondasamuel123', email='arondasamuel123@gmail.com', password='123456') self.profile_one = Profile(profile_photo='path/image.png',user=self.user_one, bio="I am great...
class ProjectModelTestCase(TestCase):
''' Test Class for Project Model ''' def setUp(self): self.user_one = User(username='arondasamuel123', email='arondasamuel123@gmail.com', password='123456') self.profile_one = Profile(profile_photo='path/image.png',user=self.user_one, bio="I am great developer",phone_number='0791019910')...
from django.test import TestCase from .models import Project,Profile,Review from django.contrib.auth.models import User class ProjectModelTestCase(TestCase):
33
116
388
8
24
arondasamuel123/AwwwardsClone
awards/tests.py
Python
ProjectModelTestCase
ProjectModelTestCase
6
53
6
6
b4d05bf8d5f2c83a20d9fe8379c88a8216c02795
bigcode/the-stack
train
f247f953907e9915994220dc
train
function
def yo(): return 'yo'
def yo():
return 'yo'
' password = 'Neo4j' APIHost = "localhost" APIPort = 5000 APIConnectionType = "http" APIURL = APIConnectionType + "://" + APIHost + ":" + str(APIPort) APIBaseURL = "/patronus/v1/" def yo():
63
64
8
3
60
benjaminturnbull/Patronus
config/graph_config.py
Python
yo
yo
17
18
17
17
e7426f925c9f7545274f862e63a17a92cf281688
bigcode/the-stack
train
fe803df06ae08e3fff133cb3
train
function
def polarity_not_expr(expression, value): pols = polarity_expr(expression.term, rev_pol(value)) return pols
def polarity_not_expr(expression, value):
pols = polarity_expr(expression.term, rev_pol(value)) return pols
pols = left + right return pols def polarity_imp_expr(expression, value): left = polarity_expr(expression.first, rev_pol(value)) right = polarity_expr(expression.second, value) pols = left + right return pols def polarity_not_expr(expression, value):
64
64
26
8
55
verypluming/SyGNS
scripts/nltk2pol.py
Python
polarity_not_expr
polarity_not_expr
71
73
71
71
6cf089fe3f94a6acebd9b9fc5b0f9980ae984473
bigcode/the-stack
train
9bc1ad0ca68584c1c607d833
train
function
def polarity_application_expr(expression, value): fun, args = expression.uncurry() res = [(str(fun), value)] return res
def polarity_application_expr(expression, value):
fun, args = expression.uncurry() res = [(str(fun), value)] return res
_expr(expression, value) elif isinstance(expression, ExistsExpression): pols = polarity_exists_expr(expression, value) elif isinstance(expression, AllExpression): pols = polarity_all_expr(expression, value) else: pols = [] return pols def polarity_application_expr(expression, val...
64
64
31
8
55
verypluming/SyGNS
scripts/nltk2pol.py
Python
polarity_application_expr
polarity_application_expr
44
47
44
44
9387c257c7a8ce9ca6a7d616cf839dc92474e032
bigcode/the-stack
train
4f2c90103e3d83165f59d978
train
function
def polarity_expr(expression, value): if isinstance(expression, ApplicationExpression): pols = polarity_application_expr(expression, value) elif isinstance(expression, AndExpression): pols = polarity_and_expr(expression, value) elif isinstance(expression, OrExpression): pols = polari...
def polarity_expr(expression, value):
if isinstance(expression, ApplicationExpression): pols = polarity_application_expr(expression, value) elif isinstance(expression, AndExpression): pols = polarity_and_expr(expression, value) elif isinstance(expression, OrExpression): pols = polarity_or_expr(expression, value) elif...
AllExpression def rev_pol(value): if value == 0: out = 1 else: out = 0 return out def calculate_polarity(expression): pols = polarity_expr(expression, 1) return pols def polarity_expr(expression, value):
64
64
154
7
56
verypluming/SyGNS
scripts/nltk2pol.py
Python
polarity_expr
polarity_expr
24
41
24
24
45daef5cbcdef4d8e69d16f20e50669eea5be363
bigcode/the-stack
train
d6ce5266b725876490fdcd19
train
function
def polarity_exists_expr(expression, value): pols = polarity_expr(expression.term, value) return pols
def polarity_exists_expr(expression, value):
pols = polarity_expr(expression.term, value) return pols
(expression.first, rev_pol(value)) right = polarity_expr(expression.second, value) pols = left + right return pols def polarity_not_expr(expression, value): pols = polarity_expr(expression.term, rev_pol(value)) return pols def polarity_exists_expr(expression, value):
64
64
24
8
55
verypluming/SyGNS
scripts/nltk2pol.py
Python
polarity_exists_expr
polarity_exists_expr
76
78
76
76
e6b88533eed3640da7ef594e1702ebc4d58a87d4
bigcode/the-stack
train