body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
8a655791799b4fddaedc980287faba153a8dcc96d95554aff1849cae36133f0e | @bp.route('/readyz')
def readyz():
'Status check to verify the service is ready to respond.'
return (jsonify({'message': 'api is ready'}), 200) | Status check to verify the service is ready to respond. | mhr_api/src/mhr_api/resources/v1/ops.py | readyz | cameron-freshworks/ppr | 0 | python | @bp.route('/readyz')
def readyz():
return (jsonify({'message': 'api is ready'}), 200) | @bp.route('/readyz')
def readyz():
return (jsonify({'message': 'api is ready'}), 200)<|docstring|>Status check to verify the service is ready to respond.<|endoftext|> |
9a9964cdcf902d79ccfbcd5d48286c7ca5041ac9d2aab0c0feb9cff93c75335f | def remove(self, key: str) -> None:
'Safely remove an arbitrary key from telemetry metadata'
self._values.pop(key, None) | Safely remove an arbitrary key from telemetry metadata | servo/telemetry.py | remove | opsani/servox | 4 | python | def remove(self, key: str) -> None:
self._values.pop(key, None) | def remove(self, key: str) -> None:
self._values.pop(key, None)<|docstring|>Safely remove an arbitrary key from telemetry metadata<|endoftext|> |
3ef7bb3f01ccd5e6ecd2306ba8dfaa1edfe3d31ebac0fede234210900b62aebc | def sort_string(self, string: str) -> None:
'\n Test:\n "cat"\n "act"\n tca\n\n index cl c pi pc\n 1 0 \'a\' 0 \'c\'\n -1\n 2 2 \'t\' 1 \'c\'\n 0 \'a\'\n\n Quicksort - nlog... | Test:
"cat"
"act"
tca
index cl c pi pc
1 0 'a' 0 'c'
-1
2 2 't' 1 'c'
0 'a'
Quicksort - nlog n -->
Pros:
- unstability is fine
- in place
Cons:
- right idea of a pivot, --> risking quadratic runtoime
Selection and Bubble
T... | array_str_problems/is_unique.py | sort_string | UPstartDeveloper/Problem_Solving_Practice | 0 | python | def sort_string(self, string: str) -> None:
'\n Test:\n "cat"\n "act"\n tca\n\n index cl c pi pc\n 1 0 \'a\' 0 \'c\'\n -1\n 2 2 \'t\' 1 \'c\'\n 0 \'a\'\n\n Quicksort - nlog... | def sort_string(self, string: str) -> None:
'\n Test:\n "cat"\n "act"\n tca\n\n index cl c pi pc\n 1 0 \'a\' 0 \'c\'\n -1\n 2 2 \'t\' 1 \'c\'\n 0 \'a\'\n\n Quicksort - nlog... |
816d725df754742c342fa50295a8420711752eabbc767d1716c1c62208323452 | def is_unique(self, string: str) -> bool:
'\n Time: O(n^2)\n Space: O(1)\n '
for index in range(len(string)):
char = string[index]
for previous in range((index - 1), (- 1), (- 1)):
if (char == string[previous]):
return False
return True | Time: O(n^2)
Space: O(1) | array_str_problems/is_unique.py | is_unique | UPstartDeveloper/Problem_Solving_Practice | 0 | python | def is_unique(self, string: str) -> bool:
'\n Time: O(n^2)\n Space: O(1)\n '
for index in range(len(string)):
char = string[index]
for previous in range((index - 1), (- 1), (- 1)):
if (char == string[previous]):
return False
return True | def is_unique(self, string: str) -> bool:
'\n Time: O(n^2)\n Space: O(1)\n '
for index in range(len(string)):
char = string[index]
for previous in range((index - 1), (- 1), (- 1)):
if (char == string[previous]):
return False
return True<|docst... |
60f5d97e3c073fd5df1d859ab623d5d0b07fdfd2180d18313659beffa4073a33 | def l2norm(X, dim, eps=1e-08):
'\n L2-normalize columns of X\n '
norm = (torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps)
X = torch.div(X, norm)
return X | L2-normalize columns of X | models/nafs.py | l2norm | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def l2norm(X, dim, eps=1e-08):
'\n \n '
norm = (torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps)
X = torch.div(X, norm)
return X | def l2norm(X, dim, eps=1e-08):
'\n \n '
norm = (torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps)
X = torch.div(X, norm)
return X<|docstring|>L2-normalize columns of X<|endoftext|> |
973e2648cc063b224d76ebcbc2373c61c29e91ab1547b84928d72db0d0262576 | def compute_similarity(x1, x2, dim=1, eps=1e-08):
'\n Returns cosine similarity between x1 and x2, computed along dim.\n '
w12 = torch.sum((x1 * x2), dim)
w1 = torch.norm(x1, 2, dim)
w2 = torch.norm(x2, 2, dim)
return (w12 / (w1 * w2).clamp(min=eps)).squeeze() | Returns cosine similarity between x1 and x2, computed along dim. | models/nafs.py | compute_similarity | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def compute_similarity(x1, x2, dim=1, eps=1e-08):
'\n \n '
w12 = torch.sum((x1 * x2), dim)
w1 = torch.norm(x1, 2, dim)
w2 = torch.norm(x2, 2, dim)
return (w12 / (w1 * w2).clamp(min=eps)).squeeze() | def compute_similarity(x1, x2, dim=1, eps=1e-08):
'\n \n '
w12 = torch.sum((x1 * x2), dim)
w1 = torch.norm(x1, 2, dim)
w2 = torch.norm(x2, 2, dim)
return (w12 / (w1 * w2).clamp(min=eps)).squeeze()<|docstring|>Returns cosine similarity between x1 and x2, computed along dim.<|endoftext|> |
b0641da6fd6b8f16f23d040ff487fca0095ef6608c4a9fd9921d10223c96d41b | def func_attention_MxN(local_img_query, txt_i_key_expand, txt_i_value_expand, eps=1e-08):
'\n query: (batch, queryL, d)\n context: (batch, sourceL, d)\n '
(batch_size, queryL, sourceL) = (txt_i_key_expand.size(0), local_img_query.size(1), txt_i_key_expand.size(1))
local_img_query_norm = l2norm(loca... | query: (batch, queryL, d)
context: (batch, sourceL, d) | models/nafs.py | func_attention_MxN | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def func_attention_MxN(local_img_query, txt_i_key_expand, txt_i_value_expand, eps=1e-08):
'\n query: (batch, queryL, d)\n context: (batch, sourceL, d)\n '
(batch_size, queryL, sourceL) = (txt_i_key_expand.size(0), local_img_query.size(1), txt_i_key_expand.size(1))
local_img_query_norm = l2norm(loca... | def func_attention_MxN(local_img_query, txt_i_key_expand, txt_i_value_expand, eps=1e-08):
'\n query: (batch, queryL, d)\n context: (batch, sourceL, d)\n '
(batch_size, queryL, sourceL) = (txt_i_key_expand.size(0), local_img_query.size(1), txt_i_key_expand.size(1))
local_img_query_norm = l2norm(loca... |
2cd4eaaf583c78d25ef4d4b9dbd73afd391ac48aef82e26210fe801ad846c8e3 | def focal_equal(attn, batch_size, queryL, sourceL):
'\n consider the confidence g(x) for each fragment as equal\n sigma_{j} (xi - xj) = sigma_{j} xi - sigma_{j} xj\n attn: (batch, queryL, sourceL)\n '
funcF = ((attn * sourceL) - torch.sum(attn, dim=(- 1), keepdim=True))
fattn = torch.where((func... | consider the confidence g(x) for each fragment as equal
sigma_{j} (xi - xj) = sigma_{j} xi - sigma_{j} xj
attn: (batch, queryL, sourceL) | models/nafs.py | focal_equal | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def focal_equal(attn, batch_size, queryL, sourceL):
'\n consider the confidence g(x) for each fragment as equal\n sigma_{j} (xi - xj) = sigma_{j} xi - sigma_{j} xj\n attn: (batch, queryL, sourceL)\n '
funcF = ((attn * sourceL) - torch.sum(attn, dim=(- 1), keepdim=True))
fattn = torch.where((func... | def focal_equal(attn, batch_size, queryL, sourceL):
'\n consider the confidence g(x) for each fragment as equal\n sigma_{j} (xi - xj) = sigma_{j} xi - sigma_{j} xj\n attn: (batch, queryL, sourceL)\n '
funcF = ((attn * sourceL) - torch.sum(attn, dim=(- 1), keepdim=True))
fattn = torch.where((func... |
e59be8cd01f000216770f08a326c4e10f62fd95c17071d7a293cb3448e0eff29 | def focal_prob(attn, batch_size, queryL, sourceL):
'\n consider the confidence g(x) for each fragment as the sqrt\n of their similarity probability to the query fragment\n sigma_{j} (xi - xj)gj = sigma_{j} xi*gj - sigma_{j} xj*gj\n attn: (batch, queryL, sourceL)\n '
xi = attn.unsqueeze((- 1)).con... | consider the confidence g(x) for each fragment as the sqrt
of their similarity probability to the query fragment
sigma_{j} (xi - xj)gj = sigma_{j} xi*gj - sigma_{j} xj*gj
attn: (batch, queryL, sourceL) | models/nafs.py | focal_prob | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def focal_prob(attn, batch_size, queryL, sourceL):
'\n consider the confidence g(x) for each fragment as the sqrt\n of their similarity probability to the query fragment\n sigma_{j} (xi - xj)gj = sigma_{j} xi*gj - sigma_{j} xj*gj\n attn: (batch, queryL, sourceL)\n '
xi = attn.unsqueeze((- 1)).con... | def focal_prob(attn, batch_size, queryL, sourceL):
'\n consider the confidence g(x) for each fragment as the sqrt\n of their similarity probability to the query fragment\n sigma_{j} (xi - xj)gj = sigma_{j} xi*gj - sigma_{j} xj*gj\n attn: (batch, queryL, sourceL)\n '
xi = attn.unsqueeze((- 1)).con... |
0f20e175353547fc029c2ba0e0125666c875d6baf054b84358d51202429713cc | def compute_weiTexts(local_img_query, local_img_value, local_text_key, local_text_value, text_length):
'\n Compute weighted text embeddings\n :param image_embeddings: Tensor with dtype torch.float32, [n_img, n_region, d]\n :param text_embeddings: Tensor with dtype torch.float32, [n_txt, n_word, d]\n :pa... | Compute weighted text embeddings
:param image_embeddings: Tensor with dtype torch.float32, [n_img, n_region, d]
:param text_embeddings: Tensor with dtype torch.float32, [n_txt, n_word, d]
:param text_length: list, contain length of each sentence, [batch_size]
:param labels: Tensor with dtype torch.int32, [batch_size]
:... | models/nafs.py | compute_weiTexts | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def compute_weiTexts(local_img_query, local_img_value, local_text_key, local_text_value, text_length):
'\n Compute weighted text embeddings\n :param image_embeddings: Tensor with dtype torch.float32, [n_img, n_region, d]\n :param text_embeddings: Tensor with dtype torch.float32, [n_txt, n_word, d]\n :pa... | def compute_weiTexts(local_img_query, local_img_value, local_text_key, local_text_value, text_length):
'\n Compute weighted text embeddings\n :param image_embeddings: Tensor with dtype torch.float32, [n_img, n_region, d]\n :param text_embeddings: Tensor with dtype torch.float32, [n_txt, n_word, d]\n :pa... |
71f2fbcd4cd295bc6b6eb12eb3cfc67a6d30b386244cf2e755ed7930852149ba | def conv3x3(in_planes, out_planes, stride=1):
'3x3 convolution with padding'
'Imported from https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py L26 - L29'
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) | 3x3 convolution with padding | models/nafs.py | conv3x3 | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def conv3x3(in_planes, out_planes, stride=1):
'Imported from https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py L26 - L29'
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) | def conv3x3(in_planes, out_planes, stride=1):
'Imported from https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py L26 - L29'
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)<|docstring|>3x3 convolution with padding<|endoftext|> |
b6482a1d9025898a7cbb0490806609df8637e5f600fc4193cba38bdbf2c332ae | def conv1x1(in_planes, out_planes, stride=1):
'1x1 convolution'
'Imported from https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py L32 - L34'
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | 1x1 convolution | models/nafs.py | conv1x1 | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def conv1x1(in_planes, out_planes, stride=1):
'Imported from https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py L32 - L34'
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | def conv1x1(in_planes, out_planes, stride=1):
'Imported from https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py L32 - L34'
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)<|docstring|>1x1 convolution<|endoftext|> |
ae9e824bf713ae8aa049bb58a12f1c7bea50ba2af7ffa04453759d8285a2fd39 | def get_index_pair_list(self, x, permu):
'\n Split feature map according to height dimension.\n :param x: Tensor with dtype torch.float32, [batchsize, num_channels, height, width]\n :param permu: List with integers, e.g. [0, 1, 2]\n \n :return: List of pairs [(start1, end1), (star... | Split feature map according to height dimension.
:param x: Tensor with dtype torch.float32, [batchsize, num_channels, height, width]
:param permu: List with integers, e.g. [0, 1, 2]
:return: List of pairs [(start1, end1), (start2, end2)...] | models/nafs.py | get_index_pair_list | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def get_index_pair_list(self, x, permu):
'\n Split feature map according to height dimension.\n :param x: Tensor with dtype torch.float32, [batchsize, num_channels, height, width]\n :param permu: List with integers, e.g. [0, 1, 2]\n \n :return: List of pairs [(start1, end1), (star... | def get_index_pair_list(self, x, permu):
'\n Split feature map according to height dimension.\n :param x: Tensor with dtype torch.float32, [batchsize, num_channels, height, width]\n :param permu: List with integers, e.g. [0, 1, 2]\n \n :return: List of pairs [(start1, end1), (star... |
488de074bd08745a129f8ca33840ec20eaf9ca85386371661b9b73441a93e717 | def height_shuffle(self, x, permu):
'\n Shuffle the feature map according to height dimension.\n '
(batchsize, num_channels, height, width) = x.data.size()
result = torch.zeros(batchsize, num_channels, height, width).cuda()
number_slice = len(permu)
height_per_slice = (height // number... | Shuffle the feature map according to height dimension. | models/nafs.py | height_shuffle | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def height_shuffle(self, x, permu):
'\n \n '
(batchsize, num_channels, height, width) = x.data.size()
result = torch.zeros(batchsize, num_channels, height, width).cuda()
number_slice = len(permu)
height_per_slice = (height // number_slice)
index_pair_list = [((height_per_slice * i)... | def height_shuffle(self, x, permu):
'\n \n '
(batchsize, num_channels, height, width) = x.data.size()
result = torch.zeros(batchsize, num_channels, height, width).cuda()
number_slice = len(permu)
height_per_slice = (height // number_slice)
index_pair_list = [((height_per_slice * i)... |
8d5c7b4017039b3c2a76237f46a59f1e6a1e85d2171fe523deff7f85db3ad45a | def recover_shuffle(self, x, permu):
'\n Recover the feature map to the original order.\n '
dic = {}
recover_permu = []
for i in range(len(permu)):
dic[permu[i]] = i
all_key = list(dic.keys())
all_key.sort()
for i in range(len(all_key)):
recover_permu.append(dic... | Recover the feature map to the original order. | models/nafs.py | recover_shuffle | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def recover_shuffle(self, x, permu):
'\n \n '
dic = {}
recover_permu = []
for i in range(len(permu)):
dic[permu[i]] = i
all_key = list(dic.keys())
all_key.sort()
for i in range(len(all_key)):
recover_permu.append(dic[all_key[i]])
return self.height_shuffle(x... | def recover_shuffle(self, x, permu):
'\n \n '
dic = {}
recover_permu = []
for i in range(len(permu)):
dic[permu[i]] = i
all_key = list(dic.keys())
all_key.sort()
for i in range(len(all_key)):
recover_permu.append(dic[all_key[i]])
return self.height_shuffle(x... |
437e61eeddff389833df4570443e425d3e73e0fa221bc1ced6676abcec29cf6e | def compute_cmpc_loss(self, image_embeddings, text_embeddings, labels):
'\n Cross-Modal Projection Classfication loss(CMPC)\n :param image_embeddings: Tensor with dtype torch.float32\n :param text_embeddings: Tensor with dtype torch.float32\n :param labels: Tensor with dtype torch.int32\... | Cross-Modal Projection Classfication loss(CMPC)
:param image_embeddings: Tensor with dtype torch.float32
:param text_embeddings: Tensor with dtype torch.float32
:param labels: Tensor with dtype torch.int32
:return: | models/nafs.py | compute_cmpc_loss | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def compute_cmpc_loss(self, image_embeddings, text_embeddings, labels):
'\n Cross-Modal Projection Classfication loss(CMPC)\n :param image_embeddings: Tensor with dtype torch.float32\n :param text_embeddings: Tensor with dtype torch.float32\n :param labels: Tensor with dtype torch.int32\... | def compute_cmpc_loss(self, image_embeddings, text_embeddings, labels):
'\n Cross-Modal Projection Classfication loss(CMPC)\n :param image_embeddings: Tensor with dtype torch.float32\n :param text_embeddings: Tensor with dtype torch.float32\n :param labels: Tensor with dtype torch.int32\... |
fdced31a79afef6404ceeefa5db87de1c8116ac23b3f1e780200c0e1b302bded | def compute_cmpm_loss(self, image_embeddings, text_embeddings, labels):
'\n Cross-Modal Projection Matching Loss(CMPM)\n :param image_embeddings: Tensor with dtype torch.float32\n :param text_embeddings: Tensor with dtype torch.float32\n :param labels: Tensor with dtype torch.int32\n ... | Cross-Modal Projection Matching Loss(CMPM)
:param image_embeddings: Tensor with dtype torch.float32
:param text_embeddings: Tensor with dtype torch.float32
:param labels: Tensor with dtype torch.int32
:return:
i2t_loss: cmpm loss for image projected to text
t2i_loss: cmpm loss for text projected to image
po... | models/nafs.py | compute_cmpm_loss | TencentYoutuResearch/PersonReID-YouReID | 29 | python | def compute_cmpm_loss(self, image_embeddings, text_embeddings, labels):
'\n Cross-Modal Projection Matching Loss(CMPM)\n :param image_embeddings: Tensor with dtype torch.float32\n :param text_embeddings: Tensor with dtype torch.float32\n :param labels: Tensor with dtype torch.int32\n ... | def compute_cmpm_loss(self, image_embeddings, text_embeddings, labels):
'\n Cross-Modal Projection Matching Loss(CMPM)\n :param image_embeddings: Tensor with dtype torch.float32\n :param text_embeddings: Tensor with dtype torch.float32\n :param labels: Tensor with dtype torch.int32\n ... |
34993951c26366c7b2d046b26e618e5d6fe8af92cd3b707e244db14f29b7c150 | def Signature(*args, **kwargs):
"\n ``@Signature`` is a decorator to implement the function-argument annotations in Python-2.7,\n as needed by the ``@Function`` decorator.\n This is only needed when you have not yet migrated to Python 3.x.\n\n Note: Although this is aimed at enabling ``@Function`` synta... | ``@Signature`` is a decorator to implement the function-argument annotations in Python-2.7,
as needed by the ``@Function`` decorator.
This is only needed when you have not yet migrated to Python 3.x.
Note: Although this is aimed at enabling ``@Function`` syntax with type annotations
in Python 2.7, ``@Signature`` is in... | bindings/python/cntk/layers/typing.py | Signature | Wootai/CNTK | 0 | python | def Signature(*args, **kwargs):
"\n ``@Signature`` is a decorator to implement the function-argument annotations in Python-2.7,\n as needed by the ``@Function`` decorator.\n This is only needed when you have not yet migrated to Python 3.x.\n\n Note: Although this is aimed at enabling ``@Function`` synta... | def Signature(*args, **kwargs):
"\n ``@Signature`` is a decorator to implement the function-argument annotations in Python-2.7,\n as needed by the ``@Function`` decorator.\n This is only needed when you have not yet migrated to Python 3.x.\n\n Note: Although this is aimed at enabling ``@Function`` synta... |
3156dc69e9e56e3ae8a7cc41d905dc9e147e7bd156a7fa2d058216bce8ae10dc | def worker(base):
'\n Process one project by calling set of commands.\n '
x = Commands(base)
logger.debug(((str(os.getpid()) + ' ') + str(x)))
x.run()
base.fill(x.retcodes, x.outputs, x.failed)
return base | Process one project by calling set of commands. | Resources/Code/open-grok/opengrok-1.1-rc41/tools/src/main/python/sync.py | worker | briancabbott/xtrax | 2 | python | def worker(base):
'\n \n '
x = Commands(base)
logger.debug(((str(os.getpid()) + ' ') + str(x)))
x.run()
base.fill(x.retcodes, x.outputs, x.failed)
return base | def worker(base):
'\n \n '
x = Commands(base)
logger.debug(((str(os.getpid()) + ' ') + str(x)))
x.run()
base.fill(x.retcodes, x.outputs, x.failed)
return base<|docstring|>Process one project by calling set of commands.<|endoftext|> |
e2fdcd951ce79121ced815f4780e5fe283890666c7d408a570f4871afac251a0 | def target_function(s: str):
'Generate a training data point.'
return [s.replace(' ', '\n'), (len(s) - s.count(' '))] | Generate a training data point. | examples/software_synthesis/replace_space_with_newline.py | target_function | nbro/pyshgp | 51 | python | def target_function(s: str):
return [s.replace(' ', '\n'), (len(s) - s.count(' '))] | def target_function(s: str):
return [s.replace(' ', '\n'), (len(s) - s.count(' '))]<|docstring|>Generate a training data point.<|endoftext|> |
d7bf5de42a7fefda38a55146177bbce6b3ce433f164acdbbafeeb7a3fe852072 | def synthetic_input():
'Generate a string to use as input to a trining data point.'
size = (randint(0, 19) + 2)
s = ''
for ndx in range(size):
if (random() < 0.2):
s += ' '
else:
s += choice(_possible_chars)
return s | Generate a string to use as input to a trining data point. | examples/software_synthesis/replace_space_with_newline.py | synthetic_input | nbro/pyshgp | 51 | python | def synthetic_input():
size = (randint(0, 19) + 2)
s =
for ndx in range(size):
if (random() < 0.2):
s += ' '
else:
s += choice(_possible_chars)
return s | def synthetic_input():
size = (randint(0, 19) + 2)
s =
for ndx in range(size):
if (random() < 0.2):
s += ' '
else:
s += choice(_possible_chars)
return s<|docstring|>Generate a string to use as input to a trining data point.<|endoftext|> |
e10ef32d87721461a79b64e9f59f4112610544249c6fbc80e8b1503d4e4f7a32 | def random_char():
'Return a random character.'
return Char(choice(_possible_chars)) | Return a random character. | examples/software_synthesis/replace_space_with_newline.py | random_char | nbro/pyshgp | 51 | python | def random_char():
return Char(choice(_possible_chars)) | def random_char():
return Char(choice(_possible_chars))<|docstring|>Return a random character.<|endoftext|> |
1e3a6e989ddf78dd238978a9097bf883ff28e7bea71b4c0426adf26505886e45 | def enumerate_assignments(max_context_number):
'\n enumerate all possible assignments of contexts to clusters for a fixed\n number of contexts. Has the hard assumption that the first context belongs\n to cluster #1, to remove redundant assignments that differ in labeling.\n\n :param max_context_numb... | enumerate all possible assignments of contexts to clusters for a fixed
number of contexts. Has the hard assumption that the first context belongs
to cluster #1, to remove redundant assignments that differ in labeling.
:param max_context_number: int
:return: list of lists, each a function that takes in a context ... | ClusteringModel/dpvi.py | enumerate_assignments | nicktfranklin/StructuredBandits | 8 | python | def enumerate_assignments(max_context_number):
'\n enumerate all possible assignments of contexts to clusters for a fixed\n number of contexts. Has the hard assumption that the first context belongs\n to cluster #1, to remove redundant assignments that differ in labeling.\n\n :param max_context_numb... | def enumerate_assignments(max_context_number):
'\n enumerate all possible assignments of contexts to clusters for a fixed\n number of contexts. Has the hard assumption that the first context belongs\n to cluster #1, to remove redundant assignments that differ in labeling.\n\n :param max_context_numb... |
bdad88e241feed98866f53f0ac49dc119411d1fe442ed29e16e466df47e8ecca | def count_hypothesis_space(n_contexts):
'\n Determine the number of unique hypotheses in the clustering space\n '
return len(enumerate_assignments(n_contexts)) | Determine the number of unique hypotheses in the clustering space | ClusteringModel/dpvi.py | count_hypothesis_space | nicktfranklin/StructuredBandits | 8 | python | def count_hypothesis_space(n_contexts):
'\n \n '
return len(enumerate_assignments(n_contexts)) | def count_hypothesis_space(n_contexts):
'\n \n '
return len(enumerate_assignments(n_contexts))<|docstring|>Determine the number of unique hypotheses in the clustering space<|endoftext|> |
39ff8000ea9bdefa363ec20d70141058ff10c08fd2c9c68c11b59fecf9a4bd8d | def __init__(self, k, n_arms=8, mu_init=0.0, var_init=1.0, alpha=1.0, cluster_class=NoiseCluster, kernel=None):
'\n Parameters\n ----------\n\n k: int\n number of particles\n\n mu_init: float (default 0.0)\n prior for mu\n\n var_init: float (default 1.0... | Parameters
----------
k: int
number of particles
mu_init: float (default 0.0)
prior for mu
var_init: float (default 1.0)
initial value of sigma
alpha: float (default 1.0)
concentration parameter for the CRP | ClusteringModel/dpvi.py | __init__ | nicktfranklin/StructuredBandits | 8 | python | def __init__(self, k, n_arms=8, mu_init=0.0, var_init=1.0, alpha=1.0, cluster_class=NoiseCluster, kernel=None):
'\n Parameters\n ----------\n\n k: int\n number of particles\n\n mu_init: float (default 0.0)\n prior for mu\n\n var_init: float (default 1.0... | def __init__(self, k, n_arms=8, mu_init=0.0, var_init=1.0, alpha=1.0, cluster_class=NoiseCluster, kernel=None):
'\n Parameters\n ----------\n\n k: int\n number of particles\n\n mu_init: float (default 0.0)\n prior for mu\n\n var_init: float (default 1.0... |
f39da8dcd16be0a7ed4fb62e36bd7a31418c1062a660833fb7eb797b93f62361 | def _get_var_prior(self, block, arm):
" this is a special case function that returns the prior probability\n of each cluster and it's variance for the "
pass | this is a special case function that returns the prior probability
of each cluster and it's variance for the | ClusteringModel/dpvi.py | _get_var_prior | nicktfranklin/StructuredBandits | 8 | python | def _get_var_prior(self, block, arm):
" this is a special case function that returns the prior probability\n of each cluster and it's variance for the "
pass | def _get_var_prior(self, block, arm):
" this is a special case function that returns the prior probability\n of each cluster and it's variance for the "
pass<|docstring|>this is a special case function that returns the prior probability
of each cluster and it's variance for the<|endoftext|> |
f333f2bea4077b7fb06dd44c53e91312391d593c1c83049d735f748b9c5ed237 | def helper_force_authenticate(request, user):
'\n In addition to calling `force_authenticate`, set\n the organisation as it would happen in the middleware\n '
force_authenticate(request, user=user)
request.organisation = user.staffprofile.organisation | In addition to calling `force_authenticate`, set
the organisation as it would happen in the middleware | app/organisation/tests.py | helper_force_authenticate | DOSSIER-dev/DOSSIER-Sources | 7 | python | def helper_force_authenticate(request, user):
'\n In addition to calling `force_authenticate`, set\n the organisation as it would happen in the middleware\n '
force_authenticate(request, user=user)
request.organisation = user.staffprofile.organisation | def helper_force_authenticate(request, user):
'\n In addition to calling `force_authenticate`, set\n the organisation as it would happen in the middleware\n '
force_authenticate(request, user=user)
request.organisation = user.staffprofile.organisation<|docstring|>In addition to calling `force_authe... |
3c4e6f2e9a9b890580e1863b5e5d46ed6138eae24cac050abb35cad75e9264fb | def test_unique_username(self):
'\n Test that unique usernames are enforced at the api level, BUT an\n update of a user must be possible keeping the same username\n '
factory = APIRequestFactory()
request = factory.post('/staffer/', {'isActive': True, 'isManager': False, 'user': {'usern... | Test that unique usernames are enforced at the api level, BUT an
update of a user must be possible keeping the same username | app/organisation/tests.py | test_unique_username | DOSSIER-dev/DOSSIER-Sources | 7 | python | def test_unique_username(self):
'\n Test that unique usernames are enforced at the api level, BUT an\n update of a user must be possible keeping the same username\n '
factory = APIRequestFactory()
request = factory.post('/staffer/', {'isActive': True, 'isManager': False, 'user': {'usern... | def test_unique_username(self):
'\n Test that unique usernames are enforced at the api level, BUT an\n update of a user must be possible keeping the same username\n '
factory = APIRequestFactory()
request = factory.post('/staffer/', {'isActive': True, 'isManager': False, 'user': {'usern... |
87ab883d5ea16f53daafe9d368972109a08ddfa561aa4767772d523aba1596c9 | def __init__(self, value: Union[(List[T], tuple, range, 'Array')]) -> None:
'\n Array class for the apysc library.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Initial array value.\n\n References\n ----------\n - Array document\n... | Array class for the apysc library.
Parameters
----------
value : list or tuple or range or Array
Initial array value.
References
----------
- Array document
- https://simon-ritchie.github.io/apysc/array.html
- Array class comparison interfaces document
- https://simon-ritchie.github.io/apysc/array_compari... | apysc/_type/array.py | __init__ | simon-ritchie/apysc | 16 | python | def __init__(self, value: Union[(List[T], tuple, range, 'Array')]) -> None:
'\n Array class for the apysc library.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Initial array value.\n\n References\n ----------\n - Array document\n... | def __init__(self, value: Union[(List[T], tuple, range, 'Array')]) -> None:
'\n Array class for the apysc library.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Initial array value.\n\n References\n ----------\n - Array document\n... |
85d692c1ce8e108acdd4388568e906e48cb7ff5faa1e7d4bf18ced6f034102ea | def _convert_range_to_list(self, *, value: Any) -> Union[(List[Any], tuple, 'Array')]:
'\n Convert argument value to list that if specified\n value is range type.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Target value.\n\n Returns\n ... | Convert argument value to list that if specified
value is range type.
Parameters
----------
value : list or tuple or range or Array
Target value.
Returns
-------
value : list or tuple or Array
Converted value. | apysc/_type/array.py | _convert_range_to_list | simon-ritchie/apysc | 16 | python | def _convert_range_to_list(self, *, value: Any) -> Union[(List[Any], tuple, 'Array')]:
'\n Convert argument value to list that if specified\n value is range type.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Target value.\n\n Returns\n ... | def _convert_range_to_list(self, *, value: Any) -> Union[(List[Any], tuple, 'Array')]:
'\n Convert argument value to list that if specified\n value is range type.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Target value.\n\n Returns\n ... |
8fd17662a575d75892facf839f72fb384d480380552754ef3547debf06c12a67 | def _append_constructor_expression(self) -> None:
'\n Append constructor expression.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_constructor_expression, locals_=locals(), module_name=__name__, class_=Array):
from apysc._type import value_util
expression: str... | Append constructor expression. | apysc/_type/array.py | _append_constructor_expression | simon-ritchie/apysc | 16 | python | def _append_constructor_expression(self) -> None:
'\n \n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_constructor_expression, locals_=locals(), module_name=__name__, class_=Array):
from apysc._type import value_util
expression: str = f'var {self.variable_name} ... | def _append_constructor_expression(self) -> None:
'\n \n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_constructor_expression, locals_=locals(), module_name=__name__, class_=Array):
from apysc._type import value_util
expression: str = f'var {self.variable_name} ... |
b497c72909468f7f953dcc4d5f78bb837fa8379bea94347ad392da0e865f2c49 | def _get_list_value(self, *, value: Union[(List[Any], tuple, 'Array')]) -> List[Any]:
'\n Get a list value from specified list, tuple, or Array value.\n\n Parameters\n ----------\n value : list or tuple or Array\n Specified list, tuple, or Array value.\n\n Returns\n ... | Get a list value from specified list, tuple, or Array value.
Parameters
----------
value : list or tuple or Array
Specified list, tuple, or Array value.
Returns
-------
list_val : list
Converted list value. | apysc/_type/array.py | _get_list_value | simon-ritchie/apysc | 16 | python | def _get_list_value(self, *, value: Union[(List[Any], tuple, 'Array')]) -> List[Any]:
'\n Get a list value from specified list, tuple, or Array value.\n\n Parameters\n ----------\n value : list or tuple or Array\n Specified list, tuple, or Array value.\n\n Returns\n ... | def _get_list_value(self, *, value: Union[(List[Any], tuple, 'Array')]) -> List[Any]:
'\n Get a list value from specified list, tuple, or Array value.\n\n Parameters\n ----------\n value : list or tuple or Array\n Specified list, tuple, or Array value.\n\n Returns\n ... |
c16774ddb8da3f564893e782c2aa6ff9d864ce88c550bee966f2f8a9e7af4759 | def _validate_acceptable_value_type(self, *, value: Union[(List[Any], tuple, range, 'Array')]) -> None:
"\n Validate that specified value is acceptable type or not.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Iterable value to check.\n\n Rais... | Validate that specified value is acceptable type or not.
Parameters
----------
value : list or tuple or range or Array
Iterable value to check.
Raises
------
ValueError
If specified value's type is not list, tuple, or Array. | apysc/_type/array.py | _validate_acceptable_value_type | simon-ritchie/apysc | 16 | python | def _validate_acceptable_value_type(self, *, value: Union[(List[Any], tuple, range, 'Array')]) -> None:
"\n Validate that specified value is acceptable type or not.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Iterable value to check.\n\n Rais... | def _validate_acceptable_value_type(self, *, value: Union[(List[Any], tuple, range, 'Array')]) -> None:
"\n Validate that specified value is acceptable type or not.\n\n Parameters\n ----------\n value : list or tuple or range or Array\n Iterable value to check.\n\n Rais... |
1828ca587f32942e6ded0bc477bcc1e37f4351fb6a36786c4e8c7f8e613a913f | @property
def value(self) -> Union[(List[Any], tuple, 'Array')]:
'\n Get a current array value.\n\n Returns\n -------\n value : list\n Current array value.\n\n References\n ----------\n - apysc basic data classes common value interface\n - https... | Get a current array value.
Returns
-------
value : list
Current array value.
References
----------
- apysc basic data classes common value interface
- https://bit.ly/3Be1aij
Examples
--------
>>> import apysc as ap
>>> arr: ap.Array = ap.Array([1, 2, 3])
>>> arr.value = [4, 5, 6]
>>> arr.value
[4, 5, 6] | apysc/_type/array.py | value | simon-ritchie/apysc | 16 | python | @property
def value(self) -> Union[(List[Any], tuple, 'Array')]:
'\n Get a current array value.\n\n Returns\n -------\n value : list\n Current array value.\n\n References\n ----------\n - apysc basic data classes common value interface\n - https... | @property
def value(self) -> Union[(List[Any], tuple, 'Array')]:
'\n Get a current array value.\n\n Returns\n -------\n value : list\n Current array value.\n\n References\n ----------\n - apysc basic data classes common value interface\n - https... |
28c8cb8250d1026c8d45381acb3f4219660498e7e7d3d4d59fe3089b5a5a3124 | @value.setter
def value(self, value: Union[(List[Any], tuple, 'Array')]) -> None:
'\n Set array value.\n\n Parameters\n ----------\n value : list or tuple or Array\n Iterable value (list, tuple, or Array) to set.\n\n References\n ----------\n apysc basic d... | Set array value.
Parameters
----------
value : list or tuple or Array
Iterable value (list, tuple, or Array) to set.
References
----------
apysc basic data classes common value interface
https://bit.ly/3Be1aij | apysc/_type/array.py | value | simon-ritchie/apysc | 16 | python | @value.setter
def value(self, value: Union[(List[Any], tuple, 'Array')]) -> None:
'\n Set array value.\n\n Parameters\n ----------\n value : list or tuple or Array\n Iterable value (list, tuple, or Array) to set.\n\n References\n ----------\n apysc basic d... | @value.setter
def value(self, value: Union[(List[Any], tuple, 'Array')]) -> None:
'\n Set array value.\n\n Parameters\n ----------\n value : list or tuple or Array\n Iterable value (list, tuple, or Array) to set.\n\n References\n ----------\n apysc basic d... |
e1f0fb252076526cdafd77e386e3e9c65f272fb3557db8b2182091f59b3ab032 | def _append_value_setter_expression(self, *, value: Union[(List[Any], tuple, 'Array')]) -> None:
"\n Append value's setter expression.\n\n Parameters\n ----------\n value : list or tuple or Array\n Iterable value (list, tuple, or Array) to set.\n "
import apysc as a... | Append value's setter expression.
Parameters
----------
value : list or tuple or Array
Iterable value (list, tuple, or Array) to set. | apysc/_type/array.py | _append_value_setter_expression | simon-ritchie/apysc | 16 | python | def _append_value_setter_expression(self, *, value: Union[(List[Any], tuple, 'Array')]) -> None:
"\n Append value's setter expression.\n\n Parameters\n ----------\n value : list or tuple or Array\n Iterable value (list, tuple, or Array) to set.\n "
import apysc as a... | def _append_value_setter_expression(self, *, value: Union[(List[Any], tuple, 'Array')]) -> None:
"\n Append value's setter expression.\n\n Parameters\n ----------\n value : list or tuple or Array\n Iterable value (list, tuple, or Array) to set.\n "
import apysc as a... |
65cec69070a3b147f8716971b9b7de691aed3a21afa6f08d86f4f0c0548cfef0 | def append(self, value: T) -> None:
'\n Add any value to the end of this array.\n This behaves same as push method.\n\n Parameters\n ----------\n value : *\n Any value to append.\n\n References\n ----------\n - Array class append and push interfaces... | Add any value to the end of this array.
This behaves same as push method.
Parameters
----------
value : *
Any value to append.
References
----------
- Array class append and push interfaces document
- https://simon-ritchie.github.io/apysc/array_append_and_push.html
Examples
--------
>>> import apysc as ap
>>... | apysc/_type/array.py | append | simon-ritchie/apysc | 16 | python | def append(self, value: T) -> None:
'\n Add any value to the end of this array.\n This behaves same as push method.\n\n Parameters\n ----------\n value : *\n Any value to append.\n\n References\n ----------\n - Array class append and push interfaces... | def append(self, value: T) -> None:
'\n Add any value to the end of this array.\n This behaves same as push method.\n\n Parameters\n ----------\n value : *\n Any value to append.\n\n References\n ----------\n - Array class append and push interfaces... |
c1cfa417f687b42b0e4433618fffee955545e508c4cb1daefc3d1d0c81e9a296 | def push(self, value: T) -> None:
'\n Add any value to the end of this array.\n This behaves same as append method.\n\n Parameters\n ----------\n value : *\n Any value to append.\n\n References\n ----------\n - Array class append and push interfaces... | Add any value to the end of this array.
This behaves same as append method.
Parameters
----------
value : *
Any value to append.
References
----------
- Array class append and push interfaces document
- https://simon-ritchie.github.io/apysc/array_append_and_push.html
Examples
--------
>>> import apysc as ap
... | apysc/_type/array.py | push | simon-ritchie/apysc | 16 | python | def push(self, value: T) -> None:
'\n Add any value to the end of this array.\n This behaves same as append method.\n\n Parameters\n ----------\n value : *\n Any value to append.\n\n References\n ----------\n - Array class append and push interfaces... | def push(self, value: T) -> None:
'\n Add any value to the end of this array.\n This behaves same as append method.\n\n Parameters\n ----------\n value : *\n Any value to append.\n\n References\n ----------\n - Array class append and push interfaces... |
8cd17358659156cb8449b3d2c90b88462e848426fee24e4d16419695f6310d79 | def _append_push_and_append_expression(self, *, value: T) -> None:
'\n Append push and append method expression.\n\n Parameters\n ----------\n value : *\n Any value to append.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_push_and_append_expres... | Append push and append method expression.
Parameters
----------
value : *
Any value to append. | apysc/_type/array.py | _append_push_and_append_expression | simon-ritchie/apysc | 16 | python | def _append_push_and_append_expression(self, *, value: T) -> None:
'\n Append push and append method expression.\n\n Parameters\n ----------\n value : *\n Any value to append.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_push_and_append_expres... | def _append_push_and_append_expression(self, *, value: T) -> None:
'\n Append push and append method expression.\n\n Parameters\n ----------\n value : *\n Any value to append.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_push_and_append_expres... |
621de9050b0e0fa3300f46f3ca1e7085450d84c14dce128f25188071a85d30d4 | def extend(self, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
"\n Concatenate argument array to this one. Argument array's\n values will positioned after this array's values.\n This method is similar to concat method, but there is a\n difference in whether the same variable will... | Concatenate argument array to this one. Argument array's
values will positioned after this array's values.
This method is similar to concat method, but there is a
difference in whether the same variable will be
updated (extend) or returned as a different variable (concat).
Parameters
----------
other_arr : list or tup... | apysc/_type/array.py | extend | simon-ritchie/apysc | 16 | python | def extend(self, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
"\n Concatenate argument array to this one. Argument array's\n values will positioned after this array's values.\n This method is similar to concat method, but there is a\n difference in whether the same variable will... | def extend(self, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
"\n Concatenate argument array to this one. Argument array's\n values will positioned after this array's values.\n This method is similar to concat method, but there is a\n difference in whether the same variable will... |
c534c0e7fce3873d2f5c85d41c08a28f96610d51189755779c6f4ebe45c3c3fc | def _append_extend_expression(self, *, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
'\n Append extend method expression.\n\n Parameters\n ----------\n other_arr : list or tuple or Array\n Other array-like value to concatenate.\n '
import apysc as ap
wit... | Append extend method expression.
Parameters
----------
other_arr : list or tuple or Array
Other array-like value to concatenate. | apysc/_type/array.py | _append_extend_expression | simon-ritchie/apysc | 16 | python | def _append_extend_expression(self, *, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
'\n Append extend method expression.\n\n Parameters\n ----------\n other_arr : list or tuple or Array\n Other array-like value to concatenate.\n '
import apysc as ap
wit... | def _append_extend_expression(self, *, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
'\n Append extend method expression.\n\n Parameters\n ----------\n other_arr : list or tuple or Array\n Other array-like value to concatenate.\n '
import apysc as ap
wit... |
e7a0d452f02a87894df7c307228ca3f5985a95ae02952b6f1ca91e81357b44d0 | def concat(self, other_arr: Union[(List[T], tuple, 'Array')]) -> 'Array':
"\n Concatenate arugment array to this one. Argument array's\n values will positioned after this array's values.\n This method is similar to extend method, but there is a\n difference in whether the same variable w... | Concatenate arugment array to this one. Argument array's
values will positioned after this array's values.
This method is similar to extend method, but there is a
difference in whether the same variable will be
updated (extend) or returned as a different variable (concat).
Parameters
----------
other_arr : list or tup... | apysc/_type/array.py | concat | simon-ritchie/apysc | 16 | python | def concat(self, other_arr: Union[(List[T], tuple, 'Array')]) -> 'Array':
"\n Concatenate arugment array to this one. Argument array's\n values will positioned after this array's values.\n This method is similar to extend method, but there is a\n difference in whether the same variable w... | def concat(self, other_arr: Union[(List[T], tuple, 'Array')]) -> 'Array':
"\n Concatenate arugment array to this one. Argument array's\n values will positioned after this array's values.\n This method is similar to extend method, but there is a\n difference in whether the same variable w... |
38abeb100602f3692ec03b197c62f4d17b0f99c77d614e0381fc5aed77b2b0c4 | def _append_concat_expression(self, *, concatenated: VariableNameInterface, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
'\n Append concat method expression.\n\n Parameters\n ----------\n concatenated : Array\n Concatenated array value.\n other_arr : list or tu... | Append concat method expression.
Parameters
----------
concatenated : Array
Concatenated array value.
other_arr : list or tuple or Array
Other array-like value to concatenate. | apysc/_type/array.py | _append_concat_expression | simon-ritchie/apysc | 16 | python | def _append_concat_expression(self, *, concatenated: VariableNameInterface, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
'\n Append concat method expression.\n\n Parameters\n ----------\n concatenated : Array\n Concatenated array value.\n other_arr : list or tu... | def _append_concat_expression(self, *, concatenated: VariableNameInterface, other_arr: Union[(List[T], tuple, 'Array')]) -> None:
'\n Append concat method expression.\n\n Parameters\n ----------\n concatenated : Array\n Concatenated array value.\n other_arr : list or tu... |
e101f423203bc79139b96512ca2637c9b81a38e5f19504f0f6d283a98d8ded96 | def insert(self, index: Union[(int, Int)], value: T) -> None:
'\n Insert value to this array at a specified index.\n This behaves same as insert_at method.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any v... | Insert value to this array at a specified index.
This behaves same as insert_at method.
Parameters
----------
index : int or Int
Index to append value to.
value : *
Any value to append.
References
----------
- Array class insert and insert_at interfaces document
- https://bit.ly/3G9LBtQ
Examples
--------... | apysc/_type/array.py | insert | simon-ritchie/apysc | 16 | python | def insert(self, index: Union[(int, Int)], value: T) -> None:
'\n Insert value to this array at a specified index.\n This behaves same as insert_at method.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any v... | def insert(self, index: Union[(int, Int)], value: T) -> None:
'\n Insert value to this array at a specified index.\n This behaves same as insert_at method.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any v... |
0077cac3ad4c8a0fdf222459a1fdd97dc65df93ff7f4f8b5bd0d642da7bcbb36 | def insert_at(self, index: Union[(int, Int)], value: T) -> None:
'\n Insert value to this array at a specified index.\n This behaves same as insert method.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any v... | Insert value to this array at a specified index.
This behaves same as insert method.
Parameters
----------
index : int or Int
Index to append value to.
value : *
Any value to append.
References
----------
- Array class insert and insert_at interfaces document
- https://bit.ly/3G9LBtQ
Examples
--------
>>... | apysc/_type/array.py | insert_at | simon-ritchie/apysc | 16 | python | def insert_at(self, index: Union[(int, Int)], value: T) -> None:
'\n Insert value to this array at a specified index.\n This behaves same as insert method.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any v... | def insert_at(self, index: Union[(int, Int)], value: T) -> None:
'\n Insert value to this array at a specified index.\n This behaves same as insert method.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any v... |
d763e748ae76221b80facedbd9de35786fe7ac660033645b218010342c389069 | def _append_insert_expression(self, *, index: Union[(int, Int)], value: T) -> None:
'\n Append insert method expression.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any value to append.\n '
import apys... | Append insert method expression.
Parameters
----------
index : int or Int
Index to append value to.
value : *
Any value to append. | apysc/_type/array.py | _append_insert_expression | simon-ritchie/apysc | 16 | python | def _append_insert_expression(self, *, index: Union[(int, Int)], value: T) -> None:
'\n Append insert method expression.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any value to append.\n '
import apys... | def _append_insert_expression(self, *, index: Union[(int, Int)], value: T) -> None:
'\n Append insert method expression.\n\n Parameters\n ----------\n index : int or Int\n Index to append value to.\n value : *\n Any value to append.\n '
import apys... |
b0fd9e9fde4efb55c147bba72d6bf13511c4c2e7eb163209db37885e3665e6f1 | def pop(self) -> T:
"\n Remove this array's last value and return it.\n\n Returns\n -------\n value : *\n Removed value.\n\n References\n ----------\n - Array class pop interface document\n - https://simon-ritchie.github.io/apysc/array_pop.html\... | Remove this array's last value and return it.
Returns
-------
value : *
Removed value.
References
----------
- Array class pop interface document
- https://simon-ritchie.github.io/apysc/array_pop.html
Examples
--------
>>> import apysc as ap
>>> arr: ap.Array = ap.Array([1, 2, 3])
>>> popped_val: int = arr.p... | apysc/_type/array.py | pop | simon-ritchie/apysc | 16 | python | def pop(self) -> T:
"\n Remove this array's last value and return it.\n\n Returns\n -------\n value : *\n Removed value.\n\n References\n ----------\n - Array class pop interface document\n - https://simon-ritchie.github.io/apysc/array_pop.html\... | def pop(self) -> T:
"\n Remove this array's last value and return it.\n\n Returns\n -------\n value : *\n Removed value.\n\n References\n ----------\n - Array class pop interface document\n - https://simon-ritchie.github.io/apysc/array_pop.html\... |
c64859a7d7e38c81983971a8f23deabe931f2c7dae00d719696b0fc4fc10b8de | def _append_pop_expression(self, *, value: T) -> None:
'\n Append pop method expression.\n\n Parameters\n ----------\n value : *\n Removed value.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_pop_expression, locals_=locals(), module_name=__name... | Append pop method expression.
Parameters
----------
value : *
Removed value. | apysc/_type/array.py | _append_pop_expression | simon-ritchie/apysc | 16 | python | def _append_pop_expression(self, *, value: T) -> None:
'\n Append pop method expression.\n\n Parameters\n ----------\n value : *\n Removed value.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_pop_expression, locals_=locals(), module_name=__name... | def _append_pop_expression(self, *, value: T) -> None:
'\n Append pop method expression.\n\n Parameters\n ----------\n value : *\n Removed value.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_pop_expression, locals_=locals(), module_name=__name... |
0e01d07779710bc3cdf225b5c5296556dc091fe68ef7124e9e866866ec43cb2a | def remove(self, value: T) -> None:
'\n Remove specified value from this array.\n\n Parameters\n ----------\n value : Any\n Value to remove.\n\n References\n ----------\n - Array class remove and remove_at interfaces document\n - https://bit.ly/... | Remove specified value from this array.
Parameters
----------
value : Any
Value to remove.
References
----------
- Array class remove and remove_at interfaces document
- https://bit.ly/3zDO6Cl
Examples
--------
>>> import apysc as ap
>>> arr: ap.Array = ap.Array([1, 3, 5])
>>> arr.remove(3)
>>> arr
Array([1,... | apysc/_type/array.py | remove | simon-ritchie/apysc | 16 | python | def remove(self, value: T) -> None:
'\n Remove specified value from this array.\n\n Parameters\n ----------\n value : Any\n Value to remove.\n\n References\n ----------\n - Array class remove and remove_at interfaces document\n - https://bit.ly/... | def remove(self, value: T) -> None:
'\n Remove specified value from this array.\n\n Parameters\n ----------\n value : Any\n Value to remove.\n\n References\n ----------\n - Array class remove and remove_at interfaces document\n - https://bit.ly/... |
1d61729a5f0e9391d8d0a868caadc202f886a36e8cf20cd209d838ff5a30415e | def _append_remove_expression(self, *, value: T) -> None:
'\n Append remove method expression.\n\n Parameters\n ----------\n value : Any\n Value to remove.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_remove_expression, locals_=locals(), modul... | Append remove method expression.
Parameters
----------
value : Any
Value to remove. | apysc/_type/array.py | _append_remove_expression | simon-ritchie/apysc | 16 | python | def _append_remove_expression(self, *, value: T) -> None:
'\n Append remove method expression.\n\n Parameters\n ----------\n value : Any\n Value to remove.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_remove_expression, locals_=locals(), modul... | def _append_remove_expression(self, *, value: T) -> None:
'\n Append remove method expression.\n\n Parameters\n ----------\n value : Any\n Value to remove.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_remove_expression, locals_=locals(), modul... |
0ec127df0e87f1589d4b8aa8ca900ffa936476920472084711218a2955df3706 | def remove_at(self, index: Union[(int, Int)]) -> None:
'\n Remove specified index value from this array.\n\n Parameters\n ----------\n index : int or Int\n Index to remove value.\n\n References\n ----------\n - Array class remove and remove_at interfaces d... | Remove specified index value from this array.
Parameters
----------
index : int or Int
Index to remove value.
References
----------
- Array class remove and remove_at interfaces document
- https://bit.ly/3zDO6Cl
Examples
--------
>>> import apysc as ap
>>> arr: ap.Array = ap.Array([1, 2, 3])
>>> arr.remove_a... | apysc/_type/array.py | remove_at | simon-ritchie/apysc | 16 | python | def remove_at(self, index: Union[(int, Int)]) -> None:
'\n Remove specified index value from this array.\n\n Parameters\n ----------\n index : int or Int\n Index to remove value.\n\n References\n ----------\n - Array class remove and remove_at interfaces d... | def remove_at(self, index: Union[(int, Int)]) -> None:
'\n Remove specified index value from this array.\n\n Parameters\n ----------\n index : int or Int\n Index to remove value.\n\n References\n ----------\n - Array class remove and remove_at interfaces d... |
acd2e44bcc221bb2900d814f1e89f7b823375629849cc55498a82f2b904ae9f6 | def _append_remove_at_expression(self, *, index: Union[(int, Int)]) -> None:
'\n Append remove_at method expression.\n\n Parameters\n ----------\n index : int or Int\n Index to remove value.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_remove_... | Append remove_at method expression.
Parameters
----------
index : int or Int
Index to remove value. | apysc/_type/array.py | _append_remove_at_expression | simon-ritchie/apysc | 16 | python | def _append_remove_at_expression(self, *, index: Union[(int, Int)]) -> None:
'\n Append remove_at method expression.\n\n Parameters\n ----------\n index : int or Int\n Index to remove value.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_remove_... | def _append_remove_at_expression(self, *, index: Union[(int, Int)]) -> None:
'\n Append remove_at method expression.\n\n Parameters\n ----------\n index : int or Int\n Index to remove value.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_remove_... |
d9c3ffdbedcc360049c8b3741812c037e601cb0bd05fd5546e54b2be7a38488a | def reverse(self) -> None:
'\n Reverse this array in place.\n\n References\n ----------\n - Array class reverse interface document\n - https://simon-ritchie.github.io/apysc/array_reverse.html\n\n Examples\n --------\n >>> import apysc as ap\n >>> ar... | Reverse this array in place.
References
----------
- Array class reverse interface document
- https://simon-ritchie.github.io/apysc/array_reverse.html
Examples
--------
>>> import apysc as ap
>>> arr: ap.Array = ap.Array([1, 2, 3])
>>> arr.reverse()
>>> arr
Array([3, 2, 1]) | apysc/_type/array.py | reverse | simon-ritchie/apysc | 16 | python | def reverse(self) -> None:
'\n Reverse this array in place.\n\n References\n ----------\n - Array class reverse interface document\n - https://simon-ritchie.github.io/apysc/array_reverse.html\n\n Examples\n --------\n >>> import apysc as ap\n >>> ar... | def reverse(self) -> None:
'\n Reverse this array in place.\n\n References\n ----------\n - Array class reverse interface document\n - https://simon-ritchie.github.io/apysc/array_reverse.html\n\n Examples\n --------\n >>> import apysc as ap\n >>> ar... |
d9492865d710613a2d3c7c6e54c25ad3693a18b11b7cdce2f9e2de6bfb9e0857 | def _append_reverse_expression(self) -> None:
'\n Append reverse method expression.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_reverse_expression, locals_=locals(), module_name=__name__, class_=Array):
expression: str = f'{self.variable_name}.reverse();'
ap... | Append reverse method expression. | apysc/_type/array.py | _append_reverse_expression | simon-ritchie/apysc | 16 | python | def _append_reverse_expression(self) -> None:
'\n \n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_reverse_expression, locals_=locals(), module_name=__name__, class_=Array):
expression: str = f'{self.variable_name}.reverse();'
ap.append_js_expression(expression=... | def _append_reverse_expression(self) -> None:
'\n \n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_reverse_expression, locals_=locals(), module_name=__name__, class_=Array):
expression: str = f'{self.variable_name}.reverse();'
ap.append_js_expression(expression=... |
46fee2cc7e9b51ff5d4237dc489250d466093bb38082dc754bb770631e0b9ee9 | def sort(self, *, ascending: bool=True) -> None:
'\n Sort this array in place.\n\n Parameters\n ----------\n ascending : bool, default True\n Sort by ascending or not. If False is specified,\n values will be descending.\n\n References\n ----------\n ... | Sort this array in place.
Parameters
----------
ascending : bool, default True
Sort by ascending or not. If False is specified,
values will be descending.
References
----------
- Array class sort interface document
- https://simon-ritchie.github.io/apysc/array_sort.html
Examples
--------
>>> import apysc... | apysc/_type/array.py | sort | simon-ritchie/apysc | 16 | python | def sort(self, *, ascending: bool=True) -> None:
'\n Sort this array in place.\n\n Parameters\n ----------\n ascending : bool, default True\n Sort by ascending or not. If False is specified,\n values will be descending.\n\n References\n ----------\n ... | def sort(self, *, ascending: bool=True) -> None:
'\n Sort this array in place.\n\n Parameters\n ----------\n ascending : bool, default True\n Sort by ascending or not. If False is specified,\n values will be descending.\n\n References\n ----------\n ... |
14600cafa973bb9c1fea288f13985faf2b3890bec36b32bed46282210b6d5d40 | def _append_sort_expression(self) -> None:
'\n Append sort method expression.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_sort_expression, locals_=locals(), module_name=__name__, class_=Array):
expression: str = f'{self.variable_name}.sort();'
ap.append_js_e... | Append sort method expression. | apysc/_type/array.py | _append_sort_expression | simon-ritchie/apysc | 16 | python | def _append_sort_expression(self) -> None:
'\n \n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_sort_expression, locals_=locals(), module_name=__name__, class_=Array):
expression: str = f'{self.variable_name}.sort();'
ap.append_js_expression(expression=expressio... | def _append_sort_expression(self) -> None:
'\n \n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_sort_expression, locals_=locals(), module_name=__name__, class_=Array):
expression: str = f'{self.variable_name}.sort();'
ap.append_js_expression(expression=expressio... |
40bdbdcf9688ec54d807460ea0084644de3f902510a16de70e7b8032292baff1 | def slice(self, *, start: Optional[Union[(int, Int)]]=None, end: Optional[Union[(int, Int)]]=None) -> 'Array':
'\n Slice this array by specified start and end indexes.\n\n Parameters\n ----------\n start : int or Int or None, default None\n Slicing start index.\n end : ... | Slice this array by specified start and end indexes.
Parameters
----------
start : int or Int or None, default None
Slicing start index.
end : int or Int or None, default None
Slicing end index (this index will not be including).
Returns
-------
sliced_arr : Array
Sliced array.
References
----------
- Ar... | apysc/_type/array.py | slice | simon-ritchie/apysc | 16 | python | def slice(self, *, start: Optional[Union[(int, Int)]]=None, end: Optional[Union[(int, Int)]]=None) -> 'Array':
'\n Slice this array by specified start and end indexes.\n\n Parameters\n ----------\n start : int or Int or None, default None\n Slicing start index.\n end : ... | def slice(self, *, start: Optional[Union[(int, Int)]]=None, end: Optional[Union[(int, Int)]]=None) -> 'Array':
'\n Slice this array by specified start and end indexes.\n\n Parameters\n ----------\n start : int or Int or None, default None\n Slicing start index.\n end : ... |
aa88234ce74b2c77c80b76e13069429f79d1657dc4e9423b8a2ed402da045480 | def _append_slice_expression(self, *, sliced_arr: VariableNameInterface, start: Optional[Union[(int, Int)]], end: Optional[Union[(int, Int)]]) -> None:
'\n Append slice method expression.\n\n Parameters\n ----------\n sliced_arr : Array\n Sliced array.\n start : int or ... | Append slice method expression.
Parameters
----------
sliced_arr : Array
Sliced array.
start : int or Int or None
Slicing start index.
end : int or Int or None
Slicing end index. | apysc/_type/array.py | _append_slice_expression | simon-ritchie/apysc | 16 | python | def _append_slice_expression(self, *, sliced_arr: VariableNameInterface, start: Optional[Union[(int, Int)]], end: Optional[Union[(int, Int)]]) -> None:
'\n Append slice method expression.\n\n Parameters\n ----------\n sliced_arr : Array\n Sliced array.\n start : int or ... | def _append_slice_expression(self, *, sliced_arr: VariableNameInterface, start: Optional[Union[(int, Int)]], end: Optional[Union[(int, Int)]]) -> None:
'\n Append slice method expression.\n\n Parameters\n ----------\n sliced_arr : Array\n Sliced array.\n start : int or ... |
bad3649734137dddf6dccf74f95d8156184d68beabb5b37ddae211985d5da692 | def __getitem__(self, index: Union[(int, Int)]) -> T:
"\n Get a specified index single value.\n\n Parameters\n ----------\n index : int or Int\n Array's index to get value. Currently not supported tuple\n value (e.g., slicing).\n\n Returns\n -------\n ... | Get a specified index single value.
Parameters
----------
index : int or Int
Array's index to get value. Currently not supported tuple
value (e.g., slicing).
Returns
-------
value : *
Specified index's value.
Raises
------
ValueError
If specified index type is not int and Int. | apysc/_type/array.py | __getitem__ | simon-ritchie/apysc | 16 | python | def __getitem__(self, index: Union[(int, Int)]) -> T:
"\n Get a specified index single value.\n\n Parameters\n ----------\n index : int or Int\n Array's index to get value. Currently not supported tuple\n value (e.g., slicing).\n\n Returns\n -------\n ... | def __getitem__(self, index: Union[(int, Int)]) -> T:
"\n Get a specified index single value.\n\n Parameters\n ----------\n index : int or Int\n Array's index to get value. Currently not supported tuple\n value (e.g., slicing).\n\n Returns\n -------\n ... |
1bf7c2138d5d0f701384ea6b2d623e5162da655499e0596d6601b4c5e1c6a26f | def _get_builtin_int_from_index(self, *, index: Union[(int, Int)]) -> int:
"\n Get Python builtin integer from index value.\n\n Parameters\n ----------\n index : int or Int\n Specified array's index.\n\n Returns\n -------\n builtin_int_index : int\n ... | Get Python builtin integer from index value.
Parameters
----------
index : int or Int
Specified array's index.
Returns
-------
builtin_int_index : int
Python builtin integer index value. | apysc/_type/array.py | _get_builtin_int_from_index | simon-ritchie/apysc | 16 | python | def _get_builtin_int_from_index(self, *, index: Union[(int, Int)]) -> int:
"\n Get Python builtin integer from index value.\n\n Parameters\n ----------\n index : int or Int\n Specified array's index.\n\n Returns\n -------\n builtin_int_index : int\n ... | def _get_builtin_int_from_index(self, *, index: Union[(int, Int)]) -> int:
"\n Get Python builtin integer from index value.\n\n Parameters\n ----------\n index : int or Int\n Specified array's index.\n\n Returns\n -------\n builtin_int_index : int\n ... |
5ebbb7a00c2918a2357526d49ec3c92d636584d5cdd04393dfc3e99a89357f4b | def _validate_index_type_is_int(self, *, index: Union[(int, Int)]) -> None:
'\n Validate whether index value type is int (or Int) or not.\n\n Parameters\n ----------\n index : int or Int\n Index value to check.\n\n Raises\n ------\n ValueError\n ... | Validate whether index value type is int (or Int) or not.
Parameters
----------
index : int or Int
Index value to check.
Raises
------
ValueError
If index type is not int or Int type. | apysc/_type/array.py | _validate_index_type_is_int | simon-ritchie/apysc | 16 | python | def _validate_index_type_is_int(self, *, index: Union[(int, Int)]) -> None:
'\n Validate whether index value type is int (or Int) or not.\n\n Parameters\n ----------\n index : int or Int\n Index value to check.\n\n Raises\n ------\n ValueError\n ... | def _validate_index_type_is_int(self, *, index: Union[(int, Int)]) -> None:
'\n Validate whether index value type is int (or Int) or not.\n\n Parameters\n ----------\n index : int or Int\n Index value to check.\n\n Raises\n ------\n ValueError\n ... |
98db2444a0eb3d82ac30b7230567c6a87fe4f5df8dbd1f1d370cb7011bdc1b8a | def _append_getitem_expression(self, *, index: Union[(int, Int)], value: T) -> None:
"\n Append __getitem__ expression.\n\n Parameters\n ----------\n index : int or Int\n Array's index to get value.\n value : *\n Specified index's value.\n "
import... | Append __getitem__ expression.
Parameters
----------
index : int or Int
Array's index to get value.
value : *
Specified index's value. | apysc/_type/array.py | _append_getitem_expression | simon-ritchie/apysc | 16 | python | def _append_getitem_expression(self, *, index: Union[(int, Int)], value: T) -> None:
"\n Append __getitem__ expression.\n\n Parameters\n ----------\n index : int or Int\n Array's index to get value.\n value : *\n Specified index's value.\n "
import... | def _append_getitem_expression(self, *, index: Union[(int, Int)], value: T) -> None:
"\n Append __getitem__ expression.\n\n Parameters\n ----------\n index : int or Int\n Array's index to get value.\n value : *\n Specified index's value.\n "
import... |
692fa3ff75d62cd645ee4cbd08246cde095e178b53f9a847cf2ac4fe777ea8d1 | def __setitem__(self, index: Union[(int, Int)], value: T) -> None:
"\n Set value to a specified index.\n\n Parameters\n ----------\n index : int or Int\n Array's index to set value. Currently not supported tuple\n value (e.g., slicing).\n value : *\n ... | Set value to a specified index.
Parameters
----------
index : int or Int
Array's index to set value. Currently not supported tuple
value (e.g., slicing).
value : *
Any value to set.
Raises
------
ValueError
If specified index type is not int and Int. | apysc/_type/array.py | __setitem__ | simon-ritchie/apysc | 16 | python | def __setitem__(self, index: Union[(int, Int)], value: T) -> None:
"\n Set value to a specified index.\n\n Parameters\n ----------\n index : int or Int\n Array's index to set value. Currently not supported tuple\n value (e.g., slicing).\n value : *\n ... | def __setitem__(self, index: Union[(int, Int)], value: T) -> None:
"\n Set value to a specified index.\n\n Parameters\n ----------\n index : int or Int\n Array's index to set value. Currently not supported tuple\n value (e.g., slicing).\n value : *\n ... |
e3478eb441b4ead0cf6f7574cc499b8474e6baeb5a340432f2942553c47a45f5 | def _append_setitem_expression(self, *, index: Union[(int, Int)], value: T) -> None:
"\n Append __setitem__ method expression.\n\n Parameters\n ----------\n index : int or Int\n Array's index to set value. Currently not supported tuple\n value (e.g., slicing).\n ... | Append __setitem__ method expression.
Parameters
----------
index : int or Int
Array's index to set value. Currently not supported tuple
value (e.g., slicing).
value : *
Any value to set. | apysc/_type/array.py | _append_setitem_expression | simon-ritchie/apysc | 16 | python | def _append_setitem_expression(self, *, index: Union[(int, Int)], value: T) -> None:
"\n Append __setitem__ method expression.\n\n Parameters\n ----------\n index : int or Int\n Array's index to set value. Currently not supported tuple\n value (e.g., slicing).\n ... | def _append_setitem_expression(self, *, index: Union[(int, Int)], value: T) -> None:
"\n Append __setitem__ method expression.\n\n Parameters\n ----------\n index : int or Int\n Array's index to set value. Currently not supported tuple\n value (e.g., slicing).\n ... |
95320aff7233a77f603cefe30fffc7831727921412de714d07e664aeb7f86bd7 | def __delitem__(self, index: Union[(int, Int)]) -> None:
"\n Delete specified index value from this array.\n\n Parameters\n ----------\n index : int or Int\n Array's index to delete. Currently not supported tuple\n value (e.g., slicing).\n\n Raises\n -... | Delete specified index value from this array.
Parameters
----------
index : int or Int
Array's index to delete. Currently not supported tuple
value (e.g., slicing).
Raises
------
ValueError
If specified index type is not int and Int. | apysc/_type/array.py | __delitem__ | simon-ritchie/apysc | 16 | python | def __delitem__(self, index: Union[(int, Int)]) -> None:
"\n Delete specified index value from this array.\n\n Parameters\n ----------\n index : int or Int\n Array's index to delete. Currently not supported tuple\n value (e.g., slicing).\n\n Raises\n -... | def __delitem__(self, index: Union[(int, Int)]) -> None:
"\n Delete specified index value from this array.\n\n Parameters\n ----------\n index : int or Int\n Array's index to delete. Currently not supported tuple\n value (e.g., slicing).\n\n Raises\n -... |
6b1e45d3da1c229c9702cf24b075cf64591f8edc52d3b555f8899bad2390e048 | @property
def length(self) -> Int:
"\n Get length of this array.\n\n Returns\n -------\n length : Int\n This array's length.\n\n References\n ----------\n - Array class length interface document\n - https://simon-ritchie.github.io/apysc/array_le... | Get length of this array.
Returns
-------
length : Int
This array's length.
References
----------
- Array class length interface document
- https://simon-ritchie.github.io/apysc/array_length.html
Examples
--------
>>> import apysc as ap
>>> arr: ap.Array = ap.Array([1, 2, 3])
>>> arr.length
Int(3) | apysc/_type/array.py | length | simon-ritchie/apysc | 16 | python | @property
def length(self) -> Int:
"\n Get length of this array.\n\n Returns\n -------\n length : Int\n This array's length.\n\n References\n ----------\n - Array class length interface document\n - https://simon-ritchie.github.io/apysc/array_le... | @property
def length(self) -> Int:
"\n Get length of this array.\n\n Returns\n -------\n length : Int\n This array's length.\n\n References\n ----------\n - Array class length interface document\n - https://simon-ritchie.github.io/apysc/array_le... |
e854a428c8253c9338dc2f4db790dfd32af9767843299b8383c7e74ca4536c14 | def _append_length_expression(self, *, length: Int) -> None:
'\n Append length method expression.\n\n Parameters\n ----------\n length : Int\n Created length Int variable.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_length_expression, locals_... | Append length method expression.
Parameters
----------
length : Int
Created length Int variable. | apysc/_type/array.py | _append_length_expression | simon-ritchie/apysc | 16 | python | def _append_length_expression(self, *, length: Int) -> None:
'\n Append length method expression.\n\n Parameters\n ----------\n length : Int\n Created length Int variable.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_length_expression, locals_... | def _append_length_expression(self, *, length: Int) -> None:
'\n Append length method expression.\n\n Parameters\n ----------\n length : Int\n Created length Int variable.\n '
import apysc as ap
with ap.DebugInfo(callable_=self._append_length_expression, locals_... |
fc3209e61f5768b3180f7fa211f601601f5f90e0c05bab6569e3c423da6f0c2f | def __len__(self) -> None:
"\n This method is disabled and can't use from Array instance.\n "
raise Exception("Array instance can't apply len function. Please use length property instead.") | This method is disabled and can't use from Array instance. | apysc/_type/array.py | __len__ | simon-ritchie/apysc | 16 | python | def __len__(self) -> None:
"\n \n "
raise Exception("Array instance can't apply len function. Please use length property instead.") | def __len__(self) -> None:
"\n \n "
raise Exception("Array instance can't apply len function. Please use length property instead.")<|docstring|>This method is disabled and can't use from Array instance.<|endoftext|> |
8bd38c404f933e74ce1d73654a8fedf39b92f4b7d627d784a0690d9e62d6f47b | def join(self, sep: Union[(str, String)]) -> String:
"\n Join this array values with specified separator string.\n\n Parameters\n ----------\n sep : str or String\n Separator string.\n\n Returns\n -------\n joined : String\n Joined string.\n\n ... | Join this array values with specified separator string.
Parameters
----------
sep : str or String
Separator string.
Returns
-------
joined : String
Joined string.
References
----------
- Array class join interface document
- https://simon-ritchie.github.io/apysc/array_join.html
Examples
--------
>>> imp... | apysc/_type/array.py | join | simon-ritchie/apysc | 16 | python | def join(self, sep: Union[(str, String)]) -> String:
"\n Join this array values with specified separator string.\n\n Parameters\n ----------\n sep : str or String\n Separator string.\n\n Returns\n -------\n joined : String\n Joined string.\n\n ... | def join(self, sep: Union[(str, String)]) -> String:
"\n Join this array values with specified separator string.\n\n Parameters\n ----------\n sep : str or String\n Separator string.\n\n Returns\n -------\n joined : String\n Joined string.\n\n ... |
2b2e1e013d8c73b08f2ca0d326661e7f72862b1c4d37798230fd12c411b08e5c | def _append_join_expression(self, *, joined: String, sep: Union[(str, String)]) -> None:
'\n Append join method expression.\n\n Parameters\n ----------\n joined : String\n Joined string.\n sep : str or String\n Separator string.\n '
import apysc as... | Append join method expression.
Parameters
----------
joined : String
Joined string.
sep : str or String
Separator string. | apysc/_type/array.py | _append_join_expression | simon-ritchie/apysc | 16 | python | def _append_join_expression(self, *, joined: String, sep: Union[(str, String)]) -> None:
'\n Append join method expression.\n\n Parameters\n ----------\n joined : String\n Joined string.\n sep : str or String\n Separator string.\n '
import apysc as... | def _append_join_expression(self, *, joined: String, sep: Union[(str, String)]) -> None:
'\n Append join method expression.\n\n Parameters\n ----------\n joined : String\n Joined string.\n sep : str or String\n Separator string.\n '
import apysc as... |
3dddd1f13c57c954db461dc43b932715cbfb996a7e024051b6966518ca383747 | def __str__(self) -> str:
'\n String conversion method.\n\n Returns\n -------\n string : str\n Converted value string.\n '
if (not hasattr(self, '_value')):
return '[]'
return str(self._value) | String conversion method.
Returns
-------
string : str
Converted value string. | apysc/_type/array.py | __str__ | simon-ritchie/apysc | 16 | python | def __str__(self) -> str:
'\n String conversion method.\n\n Returns\n -------\n string : str\n Converted value string.\n '
if (not hasattr(self, '_value')):
return '[]'
return str(self._value) | def __str__(self) -> str:
'\n String conversion method.\n\n Returns\n -------\n string : str\n Converted value string.\n '
if (not hasattr(self, '_value')):
return '[]'
return str(self._value)<|docstring|>String conversion method.
Returns
-------
string... |
e8ab82942ca89db0cbc773cc1463e073acb72d32c8261a2c0dc6af1aab031d7d | def __repr__(self) -> str:
'\n Get a representation string of this instance.\n\n Returns\n -------\n repr_str : str\n Representation string of this instance.\n '
if (not hasattr(self, '_value')):
repr_str: str = 'Array([])'
else:
repr_str = f'Arr... | Get a representation string of this instance.
Returns
-------
repr_str : str
Representation string of this instance. | apysc/_type/array.py | __repr__ | simon-ritchie/apysc | 16 | python | def __repr__(self) -> str:
'\n Get a representation string of this instance.\n\n Returns\n -------\n repr_str : str\n Representation string of this instance.\n '
if (not hasattr(self, '_value')):
repr_str: str = 'Array([])'
else:
repr_str = f'Arr... | def __repr__(self) -> str:
'\n Get a representation string of this instance.\n\n Returns\n -------\n repr_str : str\n Representation string of this instance.\n '
if (not hasattr(self, '_value')):
repr_str: str = 'Array([])'
else:
repr_str = f'Arr... |
aed6aa4fc410773833be4fc9ca6684173bbe0084127ce4176af42e3bb9a6b21e | def index_of(self, value: T) -> Int:
"\n Search specified value's index and return it.\n\n Parameters\n ----------\n value : *\n Any value to search.\n\n Returns\n -------\n index : Int\n Found position of index. If value is not contains,\n ... | Search specified value's index and return it.
Parameters
----------
value : *
Any value to search.
Returns
-------
index : Int
Found position of index. If value is not contains,
-1 will be returned.
References
----------
- Array class index_of interface document
- https://simon-ritchie.github.io/apys... | apysc/_type/array.py | index_of | simon-ritchie/apysc | 16 | python | def index_of(self, value: T) -> Int:
"\n Search specified value's index and return it.\n\n Parameters\n ----------\n value : *\n Any value to search.\n\n Returns\n -------\n index : Int\n Found position of index. If value is not contains,\n ... | def index_of(self, value: T) -> Int:
"\n Search specified value's index and return it.\n\n Parameters\n ----------\n value : *\n Any value to search.\n\n Returns\n -------\n index : Int\n Found position of index. If value is not contains,\n ... |
857b1bb9ed8c7297c6eefd578717b0219b8b2c79db7b1248dd8f06865c4b8cdc | def _append_index_of_expression(self, *, index: Int, value: T) -> None:
'\n Append index_of method expression.\n\n Parameters\n ----------\n index : Int\n Found position of index. If value is not contains,\n -1 will be set.\n value : *\n Any value ... | Append index_of method expression.
Parameters
----------
index : Int
Found position of index. If value is not contains,
-1 will be set.
value : *
Any value to search. | apysc/_type/array.py | _append_index_of_expression | simon-ritchie/apysc | 16 | python | def _append_index_of_expression(self, *, index: Int, value: T) -> None:
'\n Append index_of method expression.\n\n Parameters\n ----------\n index : Int\n Found position of index. If value is not contains,\n -1 will be set.\n value : *\n Any value ... | def _append_index_of_expression(self, *, index: Int, value: T) -> None:
'\n Append index_of method expression.\n\n Parameters\n ----------\n index : Int\n Found position of index. If value is not contains,\n -1 will be set.\n value : *\n Any value ... |
7ea36e656157dbf97925317e0157af529d09cce6a4270b02ad396b0ab4a0a5c7 | def __eq__(self, other: Any) -> Any:
'\n Equal comparison method.\n\n Parameters\n ----------\n other : *\n Other value to compare. list or Array types are acceptable.\n\n Returns\n -------\n result : Boolean\n Comparison result.\n '
... | Equal comparison method.
Parameters
----------
other : *
Other value to compare. list or Array types are acceptable.
Returns
-------
result : Boolean
Comparison result. | apysc/_type/array.py | __eq__ | simon-ritchie/apysc | 16 | python | def __eq__(self, other: Any) -> Any:
'\n Equal comparison method.\n\n Parameters\n ----------\n other : *\n Other value to compare. list or Array types are acceptable.\n\n Returns\n -------\n result : Boolean\n Comparison result.\n '
... | def __eq__(self, other: Any) -> Any:
'\n Equal comparison method.\n\n Parameters\n ----------\n other : *\n Other value to compare. list or Array types are acceptable.\n\n Returns\n -------\n result : Boolean\n Comparison result.\n '
... |
9dad4f485d2e78e673f81c64288684560dc08ee94e97972f70a1405df2e18097 | def _convert_other_val_to_array(self, *, other: Any) -> Any:
"\n If comparison's other value is list value, then convert it to\n Array instance.\n\n Parameters\n ----------\n other : *\n Other value to compare.\n\n Returns\n -------\n converted_val ... | If comparison's other value is list value, then convert it to
Array instance.
Parameters
----------
other : *
Other value to compare.
Returns
-------
converted_val : *
Converted value. If other value is list, then this will
be Array type. Otherwise this will be returned directly
(not to be converted). | apysc/_type/array.py | _convert_other_val_to_array | simon-ritchie/apysc | 16 | python | def _convert_other_val_to_array(self, *, other: Any) -> Any:
"\n If comparison's other value is list value, then convert it to\n Array instance.\n\n Parameters\n ----------\n other : *\n Other value to compare.\n\n Returns\n -------\n converted_val ... | def _convert_other_val_to_array(self, *, other: Any) -> Any:
"\n If comparison's other value is list value, then convert it to\n Array instance.\n\n Parameters\n ----------\n other : *\n Other value to compare.\n\n Returns\n -------\n converted_val ... |
fa08a277914900c39b07f04c096fba6901a49f3f21bc6cbbdf304dc7b73816ad | def _append_eq_expression(self, *, result: Boolean, other: VariableNameInterface) -> None:
'\n Append an __eq__ expression.\n\n Parameters\n ----------\n result : Boolean\n Result boolean value.\n other : Array\n Array other value to compare.\n '
i... | Append an __eq__ expression.
Parameters
----------
result : Boolean
Result boolean value.
other : Array
Array other value to compare. | apysc/_type/array.py | _append_eq_expression | simon-ritchie/apysc | 16 | python | def _append_eq_expression(self, *, result: Boolean, other: VariableNameInterface) -> None:
'\n Append an __eq__ expression.\n\n Parameters\n ----------\n result : Boolean\n Result boolean value.\n other : Array\n Array other value to compare.\n '
i... | def _append_eq_expression(self, *, result: Boolean, other: VariableNameInterface) -> None:
'\n Append an __eq__ expression.\n\n Parameters\n ----------\n result : Boolean\n Result boolean value.\n other : Array\n Array other value to compare.\n '
i... |
94ec59720e6a186d6dfaba290db4829d36699cb35b7bcbaacbc510f7810a6c96 | def __ne__(self, other: Any) -> Any:
'\n Not equal comparison method.\n\n Parameters\n ----------\n other : *\n Other value to compare. list or Array types are acceptable.\n\n Returns\n -------\n result : Boolean\n Comparison result.\n '
... | Not equal comparison method.
Parameters
----------
other : *
Other value to compare. list or Array types are acceptable.
Returns
-------
result : Boolean
Comparison result. | apysc/_type/array.py | __ne__ | simon-ritchie/apysc | 16 | python | def __ne__(self, other: Any) -> Any:
'\n Not equal comparison method.\n\n Parameters\n ----------\n other : *\n Other value to compare. list or Array types are acceptable.\n\n Returns\n -------\n result : Boolean\n Comparison result.\n '
... | def __ne__(self, other: Any) -> Any:
'\n Not equal comparison method.\n\n Parameters\n ----------\n other : *\n Other value to compare. list or Array types are acceptable.\n\n Returns\n -------\n result : Boolean\n Comparison result.\n '
... |
8d0e0dbab63ee1de3b5fcb2cec805cc89d282d2c3749aec6d37912c54cec68df | def _append_ne_expression(self, *, result: Boolean, other: VariableNameInterface) -> None:
'\n Append a __ne__ expression.\n\n Parameters\n ----------\n result : Boolean\n Result boolean value.\n other : Array\n Array other value to compare.\n '
im... | Append a __ne__ expression.
Parameters
----------
result : Boolean
Result boolean value.
other : Array
Array other value to compare. | apysc/_type/array.py | _append_ne_expression | simon-ritchie/apysc | 16 | python | def _append_ne_expression(self, *, result: Boolean, other: VariableNameInterface) -> None:
'\n Append a __ne__ expression.\n\n Parameters\n ----------\n result : Boolean\n Result boolean value.\n other : Array\n Array other value to compare.\n '
im... | def _append_ne_expression(self, *, result: Boolean, other: VariableNameInterface) -> None:
'\n Append a __ne__ expression.\n\n Parameters\n ----------\n result : Boolean\n Result boolean value.\n other : Array\n Array other value to compare.\n '
im... |
e1ec15f8895cf77f0c63e859f9618841d12f7a1d352bc75c4116c2c1955044d8 | def __bool__(self) -> bool:
'\n Get a boolean value whether this array is empty or not.\n\n Returns\n -------\n result : bool\n If this array is empty, True will be returned.\n '
return bool(self._value) | Get a boolean value whether this array is empty or not.
Returns
-------
result : bool
If this array is empty, True will be returned. | apysc/_type/array.py | __bool__ | simon-ritchie/apysc | 16 | python | def __bool__(self) -> bool:
'\n Get a boolean value whether this array is empty or not.\n\n Returns\n -------\n result : bool\n If this array is empty, True will be returned.\n '
return bool(self._value) | def __bool__(self) -> bool:
'\n Get a boolean value whether this array is empty or not.\n\n Returns\n -------\n result : bool\n If this array is empty, True will be returned.\n '
return bool(self._value)<|docstring|>Get a boolean value whether this array is empty or... |
d949d07c59392d7d1d8bf4dc1d0beddb39518ad3c08b7a2be9e8aecea37a98eb | def _make_snapshot(self, *, snapshot_name: str) -> None:
"\n Make values' snapshot.\n\n Parameters\n ----------\n snapshot_name : str\n Target snapshot name.\n "
self._set_single_snapshot_val_to_dict(dict_name='_value_snapshots', value=[*self._value], snapshot_name=... | Make values' snapshot.
Parameters
----------
snapshot_name : str
Target snapshot name. | apysc/_type/array.py | _make_snapshot | simon-ritchie/apysc | 16 | python | def _make_snapshot(self, *, snapshot_name: str) -> None:
"\n Make values' snapshot.\n\n Parameters\n ----------\n snapshot_name : str\n Target snapshot name.\n "
self._set_single_snapshot_val_to_dict(dict_name='_value_snapshots', value=[*self._value], snapshot_name=... | def _make_snapshot(self, *, snapshot_name: str) -> None:
"\n Make values' snapshot.\n\n Parameters\n ----------\n snapshot_name : str\n Target snapshot name.\n "
self._set_single_snapshot_val_to_dict(dict_name='_value_snapshots', value=[*self._value], snapshot_name=... |
044a3b3c2d9e7042cb03f83391420f5f5741fe2e8e614ea1397fa964fdcc6253 | def _revert(self, *, snapshot_name: str) -> None:
'\n Revert values if snapshot exists.\n\n Parameters\n ----------\n snapshot_name : str\n Target snapshot name.\n '
if (not self._snapshot_exists(snapshot_name=snapshot_name)):
return
self._value = self._... | Revert values if snapshot exists.
Parameters
----------
snapshot_name : str
Target snapshot name. | apysc/_type/array.py | _revert | simon-ritchie/apysc | 16 | python | def _revert(self, *, snapshot_name: str) -> None:
'\n Revert values if snapshot exists.\n\n Parameters\n ----------\n snapshot_name : str\n Target snapshot name.\n '
if (not self._snapshot_exists(snapshot_name=snapshot_name)):
return
self._value = self._... | def _revert(self, *, snapshot_name: str) -> None:
'\n Revert values if snapshot exists.\n\n Parameters\n ----------\n snapshot_name : str\n Target snapshot name.\n '
if (not self._snapshot_exists(snapshot_name=snapshot_name)):
return
self._value = self._... |
7d440573dbebfac3b861a12d6b54227b81a0548931fe2c57a16830878c7decfb | def test_process_match(self):
'\n Tests the process method for a matching email.\n '
mock_doc_id = 1
email = {'Message-ID': 'abc', 'Subject': 'This is a Critical Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=1)
mailchute.munger.process = Mock(return... | Tests the process method for a matching email. | Incident-Response/Tools/cyphon/cyphon/sifter/mailsifter/mailchutes/tests/test_models.py | test_process_match | sn0b4ll/Incident-Playbook | 1 | python | def test_process_match(self):
'\n \n '
mock_doc_id = 1
email = {'Message-ID': 'abc', 'Subject': 'This is a Critical Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=1)
mailchute.munger.process = Mock(return_value=mock_doc_id)
doc_id = mailchute.pro... | def test_process_match(self):
'\n \n '
mock_doc_id = 1
email = {'Message-ID': 'abc', 'Subject': 'This is a Critical Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=1)
mailchute.munger.process = Mock(return_value=mock_doc_id)
doc_id = mailchute.pro... |
35402a7bacc5f3660bc7abdb4fd4dd5806cdb995a675d099929bc0013048a5e4 | def test_process_nonmatch(self):
'\n Tests the process method for a nonmatching email.\n '
email = {'Message-ID': 'abc', 'Subject': 'This is an Urgent Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=1)
mailchute.munger.process = Mock(return_value=None)
... | Tests the process method for a nonmatching email. | Incident-Response/Tools/cyphon/cyphon/sifter/mailsifter/mailchutes/tests/test_models.py | test_process_nonmatch | sn0b4ll/Incident-Playbook | 1 | python | def test_process_nonmatch(self):
'\n \n '
email = {'Message-ID': 'abc', 'Subject': 'This is an Urgent Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=1)
mailchute.munger.process = Mock(return_value=None)
doc_id = mailchute.process(doc_obj)
self.as... | def test_process_nonmatch(self):
'\n \n '
email = {'Message-ID': 'abc', 'Subject': 'This is an Urgent Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=1)
mailchute.munger.process = Mock(return_value=None)
doc_id = mailchute.process(doc_obj)
self.as... |
be30c1ff09303df1ae2671ceee9db01af73a6aacf9b96fdf604d3f370fdf8b43 | def test_process_no_sieve(self):
'\n Tests the process method for a chute with no sieve.\n '
mock_doc_id = 1
email = {'Message-ID': 'abc', 'Subject': 'This is an Urgent Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=3)
mailchute.enabled = True
ma... | Tests the process method for a chute with no sieve. | Incident-Response/Tools/cyphon/cyphon/sifter/mailsifter/mailchutes/tests/test_models.py | test_process_no_sieve | sn0b4ll/Incident-Playbook | 1 | python | def test_process_no_sieve(self):
'\n \n '
mock_doc_id = 1
email = {'Message-ID': 'abc', 'Subject': 'This is an Urgent Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=3)
mailchute.enabled = True
mailchute.munger.process = Mock(return_value=mock_doc... | def test_process_no_sieve(self):
'\n \n '
mock_doc_id = 1
email = {'Message-ID': 'abc', 'Subject': 'This is an Urgent Alert'}
doc_obj = DocumentObj(data=email)
mailchute = MailChute.objects.get(pk=3)
mailchute.enabled = True
mailchute.munger.process = Mock(return_value=mock_doc... |
e20ff89af2648436bc7e697eebe914b4c62c3c80486bd5ce861adf785e6b73bc | def test_match_with_default(self):
'\n Tests the process_email receiver for an email that matches an\n existing MailChute.\n '
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'critical alert'
mock_config = {'DEFAULT_MUNGER': 'default_mail', 'DEFAULT_MUNGER_ENABLED': True}
with ... | Tests the process_email receiver for an email that matches an
existing MailChute. | Incident-Response/Tools/cyphon/cyphon/sifter/mailsifter/mailchutes/tests/test_models.py | test_match_with_default | sn0b4ll/Incident-Playbook | 1 | python | def test_match_with_default(self):
'\n Tests the process_email receiver for an email that matches an\n existing MailChute.\n '
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'critical alert'
mock_config = {'DEFAULT_MUNGER': 'default_mail', 'DEFAULT_MUNGER_ENABLED': True}
with ... | def test_match_with_default(self):
'\n Tests the process_email receiver for an email that matches an\n existing MailChute.\n '
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'critical alert'
mock_config = {'DEFAULT_MUNGER': 'default_mail', 'DEFAULT_MUNGER_ENABLED': True}
with ... |
9fc5b534919a26c12bd7c442e19cfdb7c998f0f9bb1b8f146ba7672c127e57b0 | def test_no_match_without_default(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailMunger is not enabled.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to see here'
mock_config = {'DEFAULT_MUNGER':... | Tests the process_email receiver for an email that doesn't match
an existing MailChute when a default MailMunger is not enabled. | Incident-Response/Tools/cyphon/cyphon/sifter/mailsifter/mailchutes/tests/test_models.py | test_no_match_without_default | sn0b4ll/Incident-Playbook | 1 | python | def test_no_match_without_default(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailMunger is not enabled.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to see here'
mock_config = {'DEFAULT_MUNGER':... | def test_no_match_without_default(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailMunger is not enabled.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to see here'
mock_config = {'DEFAULT_MUNGER':... |
628ecafe090a1cb6b08fa6e7f898de8b2800dcaab05633c32e42846af7e99bde | def test_no_match_with_default(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailMunger is enabled.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to see here'
mock_config = {'DEFAULT_MUNGER': 'defau... | Tests the process_email receiver for an email that doesn't match
an existing MailChute when a default MailMunger is enabled. | Incident-Response/Tools/cyphon/cyphon/sifter/mailsifter/mailchutes/tests/test_models.py | test_no_match_with_default | sn0b4ll/Incident-Playbook | 1 | python | def test_no_match_with_default(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailMunger is enabled.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to see here'
mock_config = {'DEFAULT_MUNGER': 'defau... | def test_no_match_with_default(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailMunger is enabled.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to see here'
mock_config = {'DEFAULT_MUNGER': 'defau... |
1b200908ca17697afccd2bd9c5e914cf08fbdf6a779ac4246bb2b7bbb7576e00 | def test_no_match_missing_munger(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailChute is enabled but\n the defaul MailMunger can't be found.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to se... | Tests the process_email receiver for an email that doesn't match
an existing MailChute when a default MailChute is enabled but
the defaul MailMunger can't be found. | Incident-Response/Tools/cyphon/cyphon/sifter/mailsifter/mailchutes/tests/test_models.py | test_no_match_missing_munger | sn0b4ll/Incident-Playbook | 1 | python | def test_no_match_missing_munger(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailChute is enabled but\n the defaul MailMunger can't be found.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to se... | def test_no_match_missing_munger(self):
"\n Tests the process_email receiver for an email that doesn't match\n an existing MailChute when a default MailChute is enabled but\n the defaul MailMunger can't be found.\n "
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'nothing to se... |
658bf221afadb81ef0ac14116cb0069922985d1af190ee4c7d91e18bd79dbb21 | def parse_arguments(parser: Any=None, ci_values: List[str]=None) -> Any:
"\n Standard argparse wrapper for interpreting command line arguments.\n\n Args:\n parser: if there's an existing parser, provide it, else, this will\n create a new one.\n ci_values: use for testing purposes only.\n ... | Standard argparse wrapper for interpreting command line arguments.
Args:
parser: if there's an existing parser, provide it, else, this will
create a new one.
ci_values: use for testing purposes only. | edgePy/data_import/mongodb/mongo_import.py | parse_arguments | r-bioinformatics/edgePy | 79 | python | def parse_arguments(parser: Any=None, ci_values: List[str]=None) -> Any:
"\n Standard argparse wrapper for interpreting command line arguments.\n\n Args:\n parser: if there's an existing parser, provide it, else, this will\n create a new one.\n ci_values: use for testing purposes only.\n ... | def parse_arguments(parser: Any=None, ci_values: List[str]=None) -> Any:
"\n Standard argparse wrapper for interpreting command line arguments.\n\n Args:\n parser: if there's an existing parser, provide it, else, this will\n create a new one.\n ci_values: use for testing purposes only.\n ... |
693e4d7f39cfddc8ef19c6b88db0f8fe9e5452296a7b5bb78c5e8b86581406c0 | def translate_gene_list(self, database: str) -> None:
'\n If there was a list of genes provided, convert them to ENSG symbols.\n\n Args:\n database: name of the database\n\n '
if self.input_gene_file:
input_genes = get_genelist_from_file(self.input_gene_file)
(ens... | If there was a list of genes provided, convert them to ENSG symbols.
Args:
database: name of the database | edgePy/data_import/mongodb/mongo_import.py | translate_gene_list | r-bioinformatics/edgePy | 79 | python | def translate_gene_list(self, database: str) -> None:
'\n If there was a list of genes provided, convert them to ENSG symbols.\n\n Args:\n database: name of the database\n\n '
if self.input_gene_file:
input_genes = get_genelist_from_file(self.input_gene_file)
(ens... | def translate_gene_list(self, database: str) -> None:
'\n If there was a list of genes provided, convert them to ENSG symbols.\n\n Args:\n database: name of the database\n\n '
if self.input_gene_file:
input_genes = get_genelist_from_file(self.input_gene_file)
(ens... |
6ef126c986ef2213871fadb25485e45170de1d612cb2ede5ee78b2d08b6046c9 | def get_data_from_mongo(self, database: str, rpkm_flag: bool=False) -> Tuple[(List[str], Dict[(Hashable, Any)], List[str], Dict[(Hashable, Any)])]:
'\n Run the queries to get the samples, from mongo, and then use that data to retrieve\n the counts.\n\n Args:\n database: name of the d... | Run the queries to get the samples, from mongo, and then use that data to retrieve
the counts.
Args:
database: name of the database to retrieve data from.
rpkm_flag: takes the rpkm values from the mongodb, instead of the raw counts
Returns:
the list of samples, the data itself,
the gene list and the c... | edgePy/data_import/mongodb/mongo_import.py | get_data_from_mongo | r-bioinformatics/edgePy | 79 | python | def get_data_from_mongo(self, database: str, rpkm_flag: bool=False) -> Tuple[(List[str], Dict[(Hashable, Any)], List[str], Dict[(Hashable, Any)])]:
'\n Run the queries to get the samples, from mongo, and then use that data to retrieve\n the counts.\n\n Args:\n database: name of the d... | def get_data_from_mongo(self, database: str, rpkm_flag: bool=False) -> Tuple[(List[str], Dict[(Hashable, Any)], List[str], Dict[(Hashable, Any)])]:
'\n Run the queries to get the samples, from mongo, and then use that data to retrieve\n the counts.\n\n Args:\n database: name of the d... |
0fe1259603a9a23db385de48a7d8ce3bcf3bddf2613253f61d7cfbd52fb5796e | def __sub__(self, widget):
'\n\t\tRemove subwindow and unassigned it from widget\n\t\t:param widget:\n\t\t:return:\n\t\t'
widget.close()
self += widget
self.removeSubWindow(widget.subwindow)
del widget.subwindow
logger.debug('Widget sub window removed. MDI area sub windows: %s', self.subWindowLi... | Remove subwindow and unassigned it from widget
:param widget:
:return: | pyforms/gui/Controls/ControlMdiArea.py | __sub__ | Jess3Jane/pyforms | 0 | python | def __sub__(self, widget):
'\n\t\tRemove subwindow and unassigned it from widget\n\t\t:param widget:\n\t\t:return:\n\t\t'
widget.close()
self += widget
self.removeSubWindow(widget.subwindow)
del widget.subwindow
logger.debug('Widget sub window removed. MDI area sub windows: %s', self.subWindowLi... | def __sub__(self, widget):
'\n\t\tRemove subwindow and unassigned it from widget\n\t\t:param widget:\n\t\t:return:\n\t\t'
widget.close()
self += widget
self.removeSubWindow(widget.subwindow)
del widget.subwindow
logger.debug('Widget sub window removed. MDI area sub windows: %s', self.subWindowLi... |
4f2b57c0c2981f20180175e25918f6f9fa364d59dbf5c218bd9df58d2cf35529 | def __add__(self, widget):
'\n\t\tShow widget on mdi area.\n\n\t\tIf widget does not have a subwindow assigned, create a new subwindow without enabling the WA_DeleteOnClose event.\n\t\tThis will allow subwindow to be hidden instead of destroyed. Otherwise, the closeEvent.accept() will cause\n\t\tthe "Internal c++ O... | Show widget on mdi area.
If widget does not have a subwindow assigned, create a new subwindow without enabling the WA_DeleteOnClose event.
This will allow subwindow to be hidden instead of destroyed. Otherwise, the closeEvent.accept() will cause
the "Internal c++ Object Already Deleted" problem.
If widget already has... | pyforms/gui/Controls/ControlMdiArea.py | __add__ | Jess3Jane/pyforms | 0 | python | def __add__(self, widget):
'\n\t\tShow widget on mdi area.\n\n\t\tIf widget does not have a subwindow assigned, create a new subwindow without enabling the WA_DeleteOnClose event.\n\t\tThis will allow subwindow to be hidden instead of destroyed. Otherwise, the closeEvent.accept() will cause\n\t\tthe "Internal c++ O... | def __add__(self, widget):
'\n\t\tShow widget on mdi area.\n\n\t\tIf widget does not have a subwindow assigned, create a new subwindow without enabling the WA_DeleteOnClose event.\n\t\tThis will allow subwindow to be hidden instead of destroyed. Otherwise, the closeEvent.accept() will cause\n\t\tthe "Internal c++ O... |
3d725d36cc3b27082f37685692929099b14b59714d6239d9b90737c41fc7961d | def _subWindowClosed(self, closeEvent):
"\n\t\tPerform actions when subwindow is closed.\n\t\tIn this case, we don't want subwindow to be removed nor destroyed in order to reutilize later.\n\t\tThe closeEvent.accept() will just hide the subwindow.\n\t\t:param closeEvent:\n\t\t:return:\n\t\t"
try:
window... | Perform actions when subwindow is closed.
In this case, we don't want subwindow to be removed nor destroyed in order to reutilize later.
The closeEvent.accept() will just hide the subwindow.
:param closeEvent:
:return: | pyforms/gui/Controls/ControlMdiArea.py | _subWindowClosed | Jess3Jane/pyforms | 0 | python | def _subWindowClosed(self, closeEvent):
"\n\t\tPerform actions when subwindow is closed.\n\t\tIn this case, we don't want subwindow to be removed nor destroyed in order to reutilize later.\n\t\tThe closeEvent.accept() will just hide the subwindow.\n\t\t:param closeEvent:\n\t\t:return:\n\t\t"
try:
window... | def _subWindowClosed(self, closeEvent):
"\n\t\tPerform actions when subwindow is closed.\n\t\tIn this case, we don't want subwindow to be removed nor destroyed in order to reutilize later.\n\t\tThe closeEvent.accept() will just hide the subwindow.\n\t\t:param closeEvent:\n\t\t:return:\n\t\t"
try:
window... |
a113a64c67eabf955b5dbeaf638689a03aa2ec93f8876f53bc364c1ec31a28f1 | def wrap(func: _Callable, *, delay: bool=None, strict: StrictModeT=STRICT_MODE) -> _Callable:
'Wrap a callable to automatically enforce type-coercion.\n\n Parameters\n ----------\n func\n The callable for which you wish to ensure type-safety\n delay\n Delay annotation resolution until the ... | Wrap a callable to automatically enforce type-coercion.
Parameters
----------
func
The callable for which you wish to ensure type-safety
delay
Delay annotation resolution until the first call
strict
Turn on "validator mode": e.g. validate incoming data rather than coerce.
See Also
--------
:py:func:`inspe... | typic/api.py | wrap | wyfo/typical | 157 | python | def wrap(func: _Callable, *, delay: bool=None, strict: StrictModeT=STRICT_MODE) -> _Callable:
'Wrap a callable to automatically enforce type-coercion.\n\n Parameters\n ----------\n func\n The callable for which you wish to ensure type-safety\n delay\n Delay annotation resolution until the ... | def wrap(func: _Callable, *, delay: bool=None, strict: StrictModeT=STRICT_MODE) -> _Callable:
'Wrap a callable to automatically enforce type-coercion.\n\n Parameters\n ----------\n func\n The callable for which you wish to ensure type-safety\n delay\n Delay annotation resolution until the ... |
b1655950c3e45f0c9a1946d396dffb128dcacfe4f6b53d68cf09c0779ec2482e | def wrap_cls(klass: Type[ObjectT], *, delay: bool=False, strict: StrictModeT=STRICT_MODE, jsonschema: bool=True, serde: SerdeFlags=SerdeFlags(), always: bool=None) -> Type[WrappedObjectT[ObjectT]]:
'Wrap a class to automatically enforce type-coercion on init.\n\n Notes\n -----\n While `Coercer.wrap` will w... | Wrap a class to automatically enforce type-coercion on init.
Notes
-----
While `Coercer.wrap` will work with classes alone, it changes the signature of the
object to a function, there-by breaking inheritance. This follows a similar pattern to
:func:`dataclasses.dataclasses`, which executes the function when wrapped, p... | typic/api.py | wrap_cls | wyfo/typical | 157 | python | def wrap_cls(klass: Type[ObjectT], *, delay: bool=False, strict: StrictModeT=STRICT_MODE, jsonschema: bool=True, serde: SerdeFlags=SerdeFlags(), always: bool=None) -> Type[WrappedObjectT[ObjectT]]:
'Wrap a class to automatically enforce type-coercion on init.\n\n Notes\n -----\n While `Coercer.wrap` will w... | def wrap_cls(klass: Type[ObjectT], *, delay: bool=False, strict: StrictModeT=STRICT_MODE, jsonschema: bool=True, serde: SerdeFlags=SerdeFlags(), always: bool=None) -> Type[WrappedObjectT[ObjectT]]:
'Wrap a class to automatically enforce type-coercion on init.\n\n Notes\n -----\n While `Coercer.wrap` will w... |
721d3ee29e38b8eff9ec97b16da0f3c4163bc6068a57d4de3f78348e1e003d22 | def typed(_cls_or_callable=None, *, delay: bool=False, strict: bool=None, always: bool=None):
'A convenience function which automatically selects the correct wrapper.\n\n Parameters\n ----------\n delay\n Optionally delay annotation resolution until first call.\n strict\n Turn on "validato... | A convenience function which automatically selects the correct wrapper.
Parameters
----------
delay
Optionally delay annotation resolution until first call.
strict
Turn on "validator mode": e.g. validate incoming data rather than coerce.
always
Whether classes should always coerce values on their attribute... | typic/api.py | typed | wyfo/typical | 157 | python | def typed(_cls_or_callable=None, *, delay: bool=False, strict: bool=None, always: bool=None):
'A convenience function which automatically selects the correct wrapper.\n\n Parameters\n ----------\n delay\n Optionally delay annotation resolution until first call.\n strict\n Turn on "validato... | def typed(_cls_or_callable=None, *, delay: bool=False, strict: bool=None, always: bool=None):
'A convenience function which automatically selects the correct wrapper.\n\n Parameters\n ----------\n delay\n Optionally delay annotation resolution until first call.\n strict\n Turn on "validato... |
e135311b8c0eb8f8a0187a405ac756145494886d4be306331b7c1f2317708c6f | def resolve():
'Resolve any delayed annotations.\n\n If this is not called, annotations will be resolved on first call\n of the wrapped class or callable.\n\n Examples\n --------\n >>> import typic\n >>>\n >>> @typic.klass(delay=True)\n ... class Duck:\n ... color: str\n ...\n >... | Resolve any delayed annotations.
If this is not called, annotations will be resolved on first call
of the wrapped class or callable.
Examples
--------
>>> import typic
>>>
>>> @typic.klass(delay=True)
... class Duck:
... color: str
...
>>> typic.resolve() | typic/api.py | resolve | wyfo/typical | 157 | python | def resolve():
'Resolve any delayed annotations.\n\n If this is not called, annotations will be resolved on first call\n of the wrapped class or callable.\n\n Examples\n --------\n >>> import typic\n >>>\n >>> @typic.klass(delay=True)\n ... class Duck:\n ... color: str\n ...\n >... | def resolve():
'Resolve any delayed annotations.\n\n If this is not called, annotations will be resolved on first call\n of the wrapped class or callable.\n\n Examples\n --------\n >>> import typic\n >>>\n >>> @typic.klass(delay=True)\n ... class Duck:\n ... color: str\n ...\n >... |
e6cde6310148ff726b984352a96a91d2c95922766bf9b0674e515a6f1f00e8bb | def constrained(_klass=None, *, values: Union[(Type, Tuple[(Type, ...)])]=None, **constraints):
'A wrapper to indicate a \'constrained\' type.\n\n Parameters\n ----------\n values\n For container-types, you can pass in other constraints for the values to be\n validated against. Can be a singl... | A wrapper to indicate a 'constrained' type.
Parameters
----------
values
For container-types, you can pass in other constraints for the values to be
validated against. Can be a single constraint for all values or a tuple of
constraints to choose from.
**constraints
The restrictions to apply to values ... | typic/api.py | constrained | wyfo/typical | 157 | python | def constrained(_klass=None, *, values: Union[(Type, Tuple[(Type, ...)])]=None, **constraints):
'A wrapper to indicate a \'constrained\' type.\n\n Parameters\n ----------\n values\n For container-types, you can pass in other constraints for the values to be\n validated against. Can be a singl... | def constrained(_klass=None, *, values: Union[(Type, Tuple[(Type, ...)])]=None, **constraints):
'A wrapper to indicate a \'constrained\' type.\n\n Parameters\n ----------\n values\n For container-types, you can pass in other constraints for the values to be\n validated against. Can be a singl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.