uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
57d23e10c0c1fc293bb523f5 | train | function | def encrypt(data,key, mode):
encobj = DES.new(key,mode)
return(encobj.encrypt(data))
| def encrypt(data,key, mode):
| encobj = DES.new(key,mode)
return(encobj.encrypt(data))
| from Crypto.Cipher import DES
import hashlib
import sys
import binascii
key = '12345678'
plaintext = 'AAAABBBBCCCC'
def encrypt(data,key, mode):
| 39 | 64 | 23 | 7 | 32 | neilpelow/Security-Labs | padding.py | Python | encrypt | encrypt | 9 | 11 | 9 | 9 | 1a511a6270eda31f6f9986fc77dc630b8b89fee6 | bigcode/the-stack | train |
ce9555b948588c4a45d95dbc | train | function | def decrypt(ciphertext,key, mode):
encobj = DES.new(key,mode)
return(encobj.decrypt(ciphertext))
| def decrypt(ciphertext,key, mode):
| encobj = DES.new(key,mode)
return(encobj.decrypt(ciphertext))
| from Crypto.Cipher import DES
import hashlib
import sys
import binascii
key = '12345678'
plaintext = 'AAAABBBBCCCC'
def encrypt(data,key, mode):
encobj = DES.new(key,mode)
return(encobj.encrypt(data))
def decrypt(ciphertext,key, mode):
| 63 | 64 | 25 | 8 | 55 | neilpelow/Security-Labs | padding.py | Python | decrypt | decrypt | 13 | 15 | 13 | 13 | 27dd5f0229303cf16cc9fdd441f8f4babe2116bf | bigcode/the-stack | train |
9624b9852aadec4d3f1bc7b8 | train | function | def enabled():
return ('--remote_debug-host' in sys.argv and
'--remote_debug-port' in sys.argv)
| def enabled():
| return ('--remote_debug-host' in sys.argv and
'--remote_debug-port' in sys.argv)
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(markmc): this is imported before monkey patching in nova.cmd
# so we avoid extra imports here
import sys
def enabled():
| 64 | 64 | 26 | 3 | 60 | ebalduf/nova-backports | nova/debugger.py | Python | enabled | enabled | 24 | 26 | 24 | 24 | ded62592be14c96ffd8caf9598e372226c7a5659 | bigcode/the-stack | train |
4e97a62103eb9a15c0b700a7 | train | function | def init():
import nova.conf
CONF = nova.conf.CONF
# NOTE(markmc): gracefully handle the CLI options not being registered
if 'remote_debug' not in CONF:
return
if not (CONF.remote_debug.host and CONF.remote_debug.port):
return
import logging
from nova.i18n import _LW
L... | def init():
| import nova.conf
CONF = nova.conf.CONF
# NOTE(markmc): gracefully handle the CLI options not being registered
if 'remote_debug' not in CONF:
return
if not (CONF.remote_debug.host and CONF.remote_debug.port):
return
import logging
from nova.i18n import _LW
LOG = logging... | specific language governing permissions and limitations
# under the License.
# NOTE(markmc): this is imported before monkey patching in nova.cmd
# so we avoid extra imports here
import sys
def enabled():
return ('--remote_debug-host' in sys.argv and
'--remote_debug-port' in sys.argv)
def init():... | 69 | 69 | 230 | 3 | 66 | ebalduf/nova-backports | nova/debugger.py | Python | init | init | 29 | 60 | 29 | 29 | 27d5dd031aff6f8930bd879dc19ba1c1ea7ad5c3 | bigcode/the-stack | train |
3f19feda8dcd70ea636a6e77 | train | function | def init_distributed(args, world_size, rank, group_name):
assert torch.cuda.is_available(), "Distributed mode requires CUDA."
print("Initializing Distributed")
# Set cuda device so everything is done on the right GPU.
torch.cuda.set_device(rank % torch.cuda.device_count())
# Initialize distributed... | def init_distributed(args, world_size, rank, group_name):
| assert torch.cuda.is_available(), "Distributed mode requires CUDA."
print("Initializing Distributed")
# Set cuda device so everything is done on the right GPU.
torch.cuda.set_device(rank % torch.cuda.device_count())
# Initialize distributed communication
dist.init_process_group(
backen... | =str, default='')
return parser
def reduce_tensor(tensor, num_gpus):
rt = tensor.clone()
dist.all_reduce(rt, op=dist.reduce_op.SUM)
rt /= num_gpus
return rt
def init_distributed(args, world_size, rank, group_name):
| 64 | 64 | 107 | 14 | 49 | Sala7efelninja/Tacotron | train.py | Python | init_distributed | init_distributed | 169 | 181 | 169 | 169 | b7e5fdca7b87e77c1d1de6034f7225022a0d290b | bigcode/the-stack | train |
88c3250797c6b2fa20e91254 | train | function | def load_checkpoint(model, optimizer, epoch, config, amp_run, filepath):
checkpoint = torch.load(filepath, map_location='cpu')
epoch[0] = checkpoint['epoch']+1
torch.cuda.set_rng_state_all(checkpoint['cuda_rng_state_all'])
torch.random.set_rng_state(checkpoint['random_rng_state'])
config = checkpo... | def load_checkpoint(model, optimizer, epoch, config, amp_run, filepath):
| checkpoint = torch.load(filepath, map_location='cpu')
epoch[0] = checkpoint['epoch']+1
torch.cuda.set_rng_state_all(checkpoint['cuda_rng_state_all'])
torch.random.set_rng_state(checkpoint['random_rng_state'])
config = checkpoint['config']
model.load_state_dict(checkpoint['state_dict'])
opti... | _state(),
'config': config,
'state_dict': model.state_dict(),
'optimizer': optimizer.state_dict()}
if amp_run:
checkpoint['amp'] = amp.state_dict()
torch.save(checkpoint, filepath)
def load_checkpoint(model, optimizer, epoch, config, amp_run, filepa... | 64 | 64 | 112 | 16 | 48 | Sala7efelninja/Tacotron | train.py | Python | load_checkpoint | load_checkpoint | 199 | 211 | 199 | 200 | 64a530edc82a5a5dc4075b058fa8608657084687 | bigcode/the-stack | train |
e22de091d14c98d598732e18 | train | function | def save_checkpoint(model, optimizer, epoch, config, amp_run, filepath):
print("Saving model and optimizer state at epoch {} to {}".format(
epoch, filepath))
checkpoint = {'epoch': epoch,
'cuda_rng_state_all': torch.cuda.get_rng_state_all(),
'random_rng_state': torch.... | def save_checkpoint(model, optimizer, epoch, config, amp_run, filepath):
| print("Saving model and optimizer state at epoch {} to {}".format(
epoch, filepath))
checkpoint = {'epoch': epoch,
'cuda_rng_state_all': torch.cuda.get_rng_state_all(),
'random_rng_state': torch.random.get_rng_state(),
'config': config,
... | # Initialize distributed communication
dist.init_process_group(
backend=args.dist_backend, init_method=args.dist_url,
world_size=world_size, rank=rank, group_name=group_name)
print("Done initializing distributed")
def save_checkpoint(model, optimizer, epoch, config, amp_run, filepath):
| 64 | 64 | 116 | 16 | 48 | Sala7efelninja/Tacotron | train.py | Python | save_checkpoint | save_checkpoint | 184 | 196 | 184 | 184 | beaa2439bf3ff31ae6a0ccec14184b35945cbe82 | bigcode/the-stack | train |
dd4fda2a86b4c7f1ff471ac7 | train | function | def reduce_tensor(tensor, num_gpus):
rt = tensor.clone()
dist.all_reduce(rt, op=dist.reduce_op.SUM)
rt /= num_gpus
return rt
| def reduce_tensor(tensor, num_gpus):
| rt = tensor.clone()
dist.all_reduce(rt, op=dist.reduce_op.SUM)
rt /= num_gpus
return rt
| _argument('--dist-backend', default='nccl', type=str, choices={'nccl'},
help='Distributed run backend')
benchmark = parser.add_argument_group('benchmark')
benchmark.add_argument('--bench-class', type=str, default='')
return parser
def reduce_tensor(tensor, num_gpus):
| 64 | 64 | 41 | 10 | 53 | Sala7efelninja/Tacotron | train.py | Python | reduce_tensor | reduce_tensor | 162 | 166 | 162 | 162 | 3c11ba921a4ed3fac65fb6f192318bdae3bb4a48 | bigcode/the-stack | train |
b379447034267b44179f0ccb | train | function | def main():
parser = argparse.ArgumentParser(description='PyTorch Tacotron 2 Training')
parser = parse_args(parser)
args, _ = parser.parse_known_args()
if 'LOCAL_RANK' in os.environ and 'WORLD_SIZE' in os.environ:
local_rank = int(os.environ['LOCAL_RANK'])
world_size = int(os.environ['... | def main():
| parser = argparse.ArgumentParser(description='PyTorch Tacotron 2 Training')
parser = parse_args(parser)
args, _ = parser.parse_known_args()
if 'LOCAL_RANK' in os.environ and 'WORLD_SIZE' in os.environ:
local_rank = int(os.environ['LOCAL_RANK'])
world_size = int(os.environ['WORLD_SIZE'])... | 1)
DLLogger.log(step=(epoch,), data={'val_loss': val_loss})
DLLogger.log(step=(epoch,), data={'val_items_per_sec':
(val_items_per_sec/num_iters if num_iters > 0 else 0.0)})
return val_loss
def adjust_learning_rate(iteration, epoch, optimizer, learning... | 256 | 256 | 1,628 | 3 | 252 | Sala7efelninja/Tacotron | train.py | Python | main | main | 294 | 499 | 294 | 295 | 7a1d952e1088c35b4717b257dc37b22dcf066551 | bigcode/the-stack | train |
7ba690e22148ba92272766a9 | train | function | def validate(model, criterion, valset, epoch, batch_iter, batch_size,
world_size, collate_fn, distributed_run, rank, batch_to_gpu):
"""Handles all the validation scoring and printing"""
with evaluating(model), torch.no_grad():
val_sampler = DistributedSampler(valset) if distributed_run else... | def validate(model, criterion, valset, epoch, batch_iter, batch_size,
world_size, collate_fn, distributed_run, rank, batch_to_gpu):
| """Handles all the validation scoring and printing"""
with evaluating(model), torch.no_grad():
val_sampler = DistributedSampler(valset) if distributed_run else None
val_loader = DataLoader(valset, num_workers=1, shuffle=False,
sampler=val_sampler,
... | amp'])
# adapted from: https://discuss.pytorch.org/t/opinion-eval-should-be-a-context-manager/18998/3
# Following snippet is licensed under MIT license
@contextmanager
def evaluating(model):
'''Temporarily switch to evaluation mode.'''
istrain = model.training
try:
model.eval()
yield model... | 122 | 122 | 407 | 34 | 88 | Sala7efelninja/Tacotron | train.py | Python | validate | validate | 228 | 271 | 228 | 229 | 5c59090c02bc7ec1c0b38a28fba6c64f5eb4a60c | bigcode/the-stack | train |
efec5ddbbbdeaff06464b267 | train | function | def parse_args(parser):
"""
Parse commandline arguments.
"""
parser.add_argument('-o', '--output', type=str, required=True,
help='Directory to save checkpoints')
parser.add_argument('-d', '--dataset-path', type=str,
default='./', help='Path to dataset... | def parse_args(parser):
| """
Parse commandline arguments.
"""
parser.add_argument('-o', '--output', type=str, required=True,
help='Directory to save checkpoints')
parser.add_argument('-d', '--dataset-path', type=str,
default='./', help='Path to dataset')
parser.add_argume... | DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE O... | 256 | 256 | 1,130 | 5 | 251 | Sala7efelninja/Tacotron | train.py | Python | parse_args | parse_args | 58 | 159 | 58 | 58 | 5121cc4abe386465234d51577fbffa4e6a3bc299 | bigcode/the-stack | train |
c1f4c593d01bb282f8c214e5 | train | function | @contextmanager
def evaluating(model):
'''Temporarily switch to evaluation mode.'''
istrain = model.training
try:
model.eval()
yield model
finally:
if istrain:
model.train()
| @contextmanager
def evaluating(model):
| '''Temporarily switch to evaluation mode.'''
istrain = model.training
try:
model.eval()
yield model
finally:
if istrain:
model.train()
| point['optimizer'])
if amp_run:
amp.load_state_dict(checkpoint['amp'])
# adapted from: https://discuss.pytorch.org/t/opinion-eval-should-be-a-context-manager/18998/3
# Following snippet is licensed under MIT license
@contextmanager
def evaluating(model):
| 64 | 64 | 49 | 8 | 55 | Sala7efelninja/Tacotron | train.py | Python | evaluating | evaluating | 216 | 225 | 216 | 217 | dc802733651e36c12c8ac128e3262ef99b74f947 | bigcode/the-stack | train |
c2ec914110a4decd7cab1b5e | train | function | def adjust_learning_rate(iteration, epoch, optimizer, learning_rate,
anneal_steps, anneal_factor, rank):
p = 0
if anneal_steps is not None:
for i, a_step in enumerate(anneal_steps):
if epoch >= int(a_step):
p = p+1
if anneal_factor == 0.3:
... | def adjust_learning_rate(iteration, epoch, optimizer, learning_rate,
anneal_steps, anneal_factor, rank):
| p = 0
if anneal_steps is not None:
for i, a_step in enumerate(anneal_steps):
if epoch >= int(a_step):
p = p+1
if anneal_factor == 0.3:
lr = learning_rate*((0.1 ** (p//2))*(1.0 if p % 2 == 0 else 0.3))
else:
lr = learning_rate*(anneal_factor ** p)
... | .log(step=(epoch,), data={'val_items_per_sec':
(val_items_per_sec/num_iters if num_iters > 0 else 0.0)})
return val_loss
def adjust_learning_rate(iteration, epoch, optimizer, learning_rate,
anneal_steps, anneal_factor, rank):
| 64 | 64 | 192 | 25 | 38 | Sala7efelninja/Tacotron | train.py | Python | adjust_learning_rate | adjust_learning_rate | 273 | 291 | 273 | 275 | 90404fa08ae5c08b10321935f2ea99d7f3573784 | bigcode/the-stack | train |
c15ddbe4c40ea191e588dbd0 | train | class | class OffsetValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="offset", parent_name="carpet.aaxis.title", **kwargs
):
super(OffsetValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwar... | class OffsetValidator(_plotly_utils.basevalidators.NumberValidator):
| def __init__(
self, plotly_name="offset", parent_name="carpet.aaxis.title", **kwargs
):
super(OffsetValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "calc"),
role=kwargs.pop("role", "inf... | import _plotly_utils.basevalidators
class OffsetValidator(_plotly_utils.basevalidators.NumberValidator):
| 20 | 64 | 96 | 12 | 7 | acrucetta/Chicago_COVI_WebApp | env/lib/python3.8/site-packages/plotly/validators/carpet/aaxis/title/_offset.py | Python | OffsetValidator | OffsetValidator | 4 | 14 | 4 | 4 | 3ed91590b02300e19c3dbdb0d8ae0d6c074837f4 | bigcode/the-stack | train |
162ddac22115ef6be190c32b | train | class | class Hosts(base.ManagerWithFind):
"""Manage :class:`Host` resources."""
resource_class = Host
def _list(self, url, response_key):
resp, body = self.api.client.get(url)
if not body:
raise Exception("Call to " + url + " did not return a body.")
return [self.resource_class... | class Hosts(base.ManagerWithFind):
| """Manage :class:`Host` resources."""
resource_class = Host
def _list(self, url, response_key):
resp, body = self.api.client.get(url)
if not body:
raise Exception("Call to " + url + " did not return a body.")
return [self.resource_class(self, res) for res in body[respons... | , WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from troveclient import base
from troveclient import common
class Host(base.Resource):
"""A Hosts is an opaque instance used... | 97 | 97 | 326 | 7 | 89 | hrnciar/python-troveclient | troveclient/v1/hosts.py | Python | Hosts | Hosts | 27 | 72 | 27 | 27 | 5962b3bc41577aa23dca0cafd377aa9797fa94b2 | bigcode/the-stack | train |
8e54d778c515f0e51cd11ae0 | train | class | class Host(base.Resource):
"""A Hosts is an opaque instance used to store Host instances."""
def __repr__(self):
return "<Host: %s>" % self.name
| class Host(base.Resource):
| """A Hosts is an opaque instance used to store Host instances."""
def __repr__(self):
return "<Host: %s>" % self.name
| on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from troveclient import base
from troveclient import common
class Host(base.Resource):
| 64 | 64 | 38 | 5 | 58 | hrnciar/python-troveclient | troveclient/v1/hosts.py | Python | Host | Host | 21 | 24 | 21 | 21 | 4dfa386657be054f485ce2a268acaba90f831079 | bigcode/the-stack | train |
0b802ee01454a782dfe94aeb | train | class | class MPIEventLoop(SingletonABC):
"""Forward messages between the messages queue and MPI nodes"""
def __init__(self):
self.client = PlasmaClient(DEFAULT_PLASMA_SOCKET_PATH)
self.mpi_messenger = MPIMessenger()
self.mqp_messenger = MQPMessenger(self.client)
self.tasks = []
... | class MPIEventLoop(SingletonABC):
| """Forward messages between the messages queue and MPI nodes"""
def __init__(self):
self.client = PlasmaClient(DEFAULT_PLASMA_SOCKET_PATH)
self.mpi_messenger = MPIMessenger()
self.mqp_messenger = MQPMessenger(self.client)
self.tasks = []
self.started = False
@run_in... | _PLASMA_SOCKET_PATH
from oremda.messengers import MPIMessenger, MQPMessenger
from oremda.plasma_client import PlasmaClient
from oremda.utils.asyncio import run_in_executor
from oremda.utils.singleton import SingletonABC
class MPIEventLoop(SingletonABC):
| 64 | 64 | 211 | 9 | 54 | OpenChemistry/oremda | oremda/event_loops/mpi/event_loop.py | Python | MPIEventLoop | MPIEventLoop | 10 | 42 | 10 | 10 | bfaf6aeb884ad4a3a5febbe05504b982506e9cb0 | bigcode/the-stack | train |
9f045fd79cfc26a85da3e70d | train | function | def custom_precision(labels: np.array, predictions: np.array, exp_path: str, exp_name: str):
"""
Calculate custom precision value.
Parameters
----------
exp_name : str
experiment name
exp_path : str
path to experiment folder
labels : np.array
predictions : np.array
... | def custom_precision(labels: np.array, predictions: np.array, exp_path: str, exp_name: str):
| """
Calculate custom precision value.
Parameters
----------
exp_name : str
experiment name
exp_path : str
path to experiment folder
labels : np.array
predictions : np.array
Returns
-------
float:
average precision
"""
label_list = []
for ... | or type(prediction) == np.float64 else prediction
if pred in label:
confusion_matrix[pred][pred] += 1
else:
if len(label) != 1:
label = random.sample(label, 1)
confusion_matrix[label[0]][pred] += 1
return confusion_matrix
def custom_precision(la... | 93 | 93 | 311 | 23 | 69 | RvonGlahn/orkg_data | classifier/metrics.py | Python | custom_precision | custom_precision | 39 | 81 | 39 | 39 | 798e4f456383016059dcf52baa21c8ba5abece37 | bigcode/the-stack | train |
a860fbc4673f74df20d408b0 | train | function | def _confusion_matrix(labels: np.array, predictions: np.array, num_labels: int) -> np.array:
"""
Calculat Confusion Matrix for Single Multilabel Classification
Parameters
----------
labels : np.array
predictions : np.array
num_labels : int
Returns
-------
np.array:
Confu... | def _confusion_matrix(labels: np.array, predictions: np.array, num_labels: int) -> np.array:
| """
Calculat Confusion Matrix for Single Multilabel Classification
Parameters
----------
labels : np.array
predictions : np.array
num_labels : int
Returns
-------
np.array:
Confusion Matrix
"""
# https://www.researchgate.net/figure/Confusion-matrix-for-multi-clas... | import json
import numpy as np
import os
import random
FILE_PATH = os.path.dirname(__file__)
def _confusion_matrix(labels: np.array, predictions: np.array, num_labels: int) -> np.array:
| 47 | 67 | 224 | 24 | 23 | RvonGlahn/orkg_data | classifier/metrics.py | Python | _confusion_matrix | _confusion_matrix | 9 | 36 | 9 | 9 | 7b8ece3aa8ee1a7d0f36ad6b21f7d01d5510c60d | bigcode/the-stack | train |
6b17098448380ae03395d73b | train | function | def custom_recall(labels: np.array, predictions: np.array):
"""
Calculate custom precision value.
Parameters
----------
labels : np.array
predictions : np.array
Returns
-------
float:
average precision
"""
label_list = []
for label in labels:
for lab in ... | def custom_recall(labels: np.array, predictions: np.array):
| """
Calculate custom precision value.
Parameters
----------
labels : np.array
predictions : np.array
Returns
-------
float:
average precision
"""
label_list = []
for label in labels:
for lab in label:
label_list.append(lab)
num_labels = l... | :
file_name = 'result_precison_single' + exp_name + '.json'
with open(os.path.join(exp_path, file_name), "w") as fp:
json.dump(precisions, fp)
return np.mean(precisions)
def custom_recall(labels: np.array, predictions: np.array):
| 67 | 67 | 225 | 14 | 53 | RvonGlahn/orkg_data | classifier/metrics.py | Python | custom_recall | custom_recall | 84 | 117 | 84 | 84 | 6c383c52b5d004d23b260b9185ee9ed15f3f29a0 | bigcode/the-stack | train |
db6537020efcf5c9d553b39f | train | function | def custom_f1(labels: np.array, predictions: np.array) -> float:
recall = custom_recall(labels, predictions)
precision = custom_precision(labels, predictions, '', '')
return 2*(recall * precision) / (recall + precision)
| def custom_f1(labels: np.array, predictions: np.array) -> float:
| recall = custom_recall(labels, predictions)
precision = custom_precision(labels, predictions, '', '')
return 2*(recall * precision) / (recall + precision)
| ]
if (true_positive + false_negative) != 0:
recalls.append(true_positive / (true_positive + false_negative))
else:
print('Recall:', label)
continue
return np.mean(recalls)
def custom_f1(labels: np.array, predictions: np.array) -> float:
| 64 | 64 | 56 | 17 | 47 | RvonGlahn/orkg_data | classifier/metrics.py | Python | custom_f1 | custom_f1 | 120 | 124 | 120 | 120 | aef91b1d4ebcefc3c75a3a6ba47873811fc9b7e2 | bigcode/the-stack | train |
f727bf158b7a40ec694168b5 | train | class | class Query(
UserQuery,
tracks.schema.Query,
graphene.ObjectType
):
pass
| class Query(
UserQuery,
tracks.schema.Query,
graphene.ObjectType
):
| pass
| import graphene
import graphql_jwt
import tracks.schema
from app.registration.schema import Mutation as AuthMutation
from app.registration.schema import Query as UserQuery
class Query(
UserQuery,
tracks.schema.Query,
graphene.ObjectType
):
| 50 | 64 | 21 | 18 | 31 | Ifegwu/music-app-api | app/app/schema.py | Python | Query | Query | 8 | 13 | 8 | 12 | ca60cf4e4eb66bad4d94a2c4b059590e4a17cd28 | bigcode/the-stack | train |
11b837c109c59df27a3c29b7 | train | class | class Mutation(
# users.schema.Mutation,
AuthMutation,
tracks.schema.Mutation,
graphene.ObjectType
):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
revoke_token = graphql_jwt.Revoke.Field()
| class Mutation(
# users.schema.Mutation,
AuthMutation,
tracks.schema.Mutation,
graphene.ObjectType
):
| token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
revoke_token = graphql_jwt.Revoke.Field()
| .schema import Mutation as AuthMutation
from app.registration.schema import Query as UserQuery
class Query(
UserQuery,
tracks.schema.Query,
graphene.ObjectType
):
pass
class Mutation(
# users.schema.Mutation,
AuthMutation,
tracks.schema.Mutation,
graphene.ObjectType
):
| 64 | 64 | 71 | 26 | 37 | Ifegwu/music-app-api | app/app/schema.py | Python | Mutation | Mutation | 15 | 24 | 15 | 20 | 388018bc8970303fd4077ead055913b197ee7dc4 | bigcode/the-stack | train |
4a4e919fb1403e87b3eadd86 | train | class | class ImplStorageApi():
def __init__(self, config, store):
self.config = config
self.store = store
# COMMAND
def import_workspace(self, input_file, new_workspace, job_prefix, overwrite, show_output=True):
if not job_prefix:
errors.combo_error("job prefix cannot be blank"... | class ImplStorageApi():
| def __init__(self, config, store):
self.config = config
self.store = store
# COMMAND
def import_workspace(self, input_file, new_workspace, job_prefix, overwrite, show_output=True):
if not job_prefix:
errors.combo_error("job prefix cannot be blank")
with tempfile... | outer method is flagged with a "# COMMAND" command preceeding it. Since most
commands display command output, these methods should include a "show_output" parameter to allow API callers
to supress all console output produced by the command code.
'''
import os
import sys
import time
import json
import psutil
import fn... | 256 | 256 | 4,417 | 5 | 250 | microsoft/ExperimentTools | xtlib/impl_storage_api.py | Python | ImplStorageApi | ImplStorageApi | 48 | 536 | 48 | 48 | a519f8a4adfc27d3f72682aeadf766eb394885e9 | bigcode/the-stack | train |
cd2cd69821ec3a824536862b | train | function | def prelu(A, w):
"""
brief Computes prelu value of a tensor.
\f[
out = max(0, A) + min(0, wA)
\f]
Args:
inputs akg.tvm.Tensor of type float16, float32
Returns:
akg.tvm.Tensor of same type and shape as inputs
"""
# num_parameters=1, init=0.25
shape1 = [x.value ... | def prelu(A, w):
| """
brief Computes prelu value of a tensor.
\f[
out = max(0, A) + min(0, wA)
\f]
Args:
inputs akg.tvm.Tensor of type float16, float32
Returns:
akg.tvm.Tensor of same type and shape as inputs
"""
# num_parameters=1, init=0.25
shape1 = [x.value for x in A.shape]... |
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
... | 122 | 122 | 407 | 7 | 114 | KnowingNothing/akg-test | tests/common/test_op/prelu.py | Python | prelu | prelu | 23 | 58 | 23 | 23 | 7cd724008199ea2db5c251632ec7fd15734c749b | bigcode/the-stack | train |
6715c05e3646889c094f8ecf | train | function | def demo():
from nltk.classify.util import names_demo, binary_names_demo_features
classifier = names_demo(f, #DecisionTreeClassifier.train,
binary_names_demo_features)
print(classifier.pp(depth=7))
print(classifier.pseudocode(depth=7))
| def demo():
| from nltk.classify.util import names_demo, binary_names_demo_features
classifier = names_demo(f, #DecisionTreeClassifier.train,
binary_names_demo_features)
print(classifier.pp(depth=7))
print(classifier.pseudocode(depth=7))
| 20} err={:6.4f}'.format \
(len(labeled_featuresets), descr, best_error)))
return best_stump
##//////////////////////////////////////////////////////
## Demo
##//////////////////////////////////////////////////////
def f(x):
return DecisionTreeClassifier.train(x, binary=True, verbose=Tr... | 64 | 64 | 57 | 3 | 61 | DrDub/nltk | nltk/classify/decisiontree.py | Python | demo | demo | 286 | 291 | 286 | 286 | 0d8d05adee34e9203987d4bab4e10389a7f006f6 | bigcode/the-stack | train |
311e780b280bb0d586c2fdc4 | train | class | @python_2_unicode_compatible
class DecisionTreeClassifier(ClassifierI):
def __init__(self, label, feature_name=None, decisions=None, default=None):
"""
:param label: The most likely label for tokens that reach
this node in the decision tree. If this decision tree
has no chil... | @python_2_unicode_compatible
class DecisionTreeClassifier(ClassifierI):
| def __init__(self, label, feature_name=None, decisions=None, default=None):
"""
:param label: The most likely label for tokens that reach
this node in the decision tree. If this decision tree
has no children, then this label will be assigned to
any token that rea... | # Natural Language Toolkit: Decision Tree Classifiers
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A classifier model that decides which label to assign to a token on
the basis of a tree structure, where bra... | 172 | 256 | 2,401 | 16 | 155 | DrDub/nltk | nltk/classify/decisiontree.py | Python | DecisionTreeClassifier | DecisionTreeClassifier | 21 | 277 | 21 | 22 | 732c24f6988797d5855ab925f107ab497ee6059e | bigcode/the-stack | train |
f0c1b0a24c82227e565ec65e | train | function | def f(x):
return DecisionTreeClassifier.train(x, binary=True, verbose=True)
| def f(x):
| return DecisionTreeClassifier.train(x, binary=True, verbose=True)
| if verbose:
print(('best stump for {:6d} toks uses {:20} err={:6.4f}'.format \
(len(labeled_featuresets), descr, best_error)))
return best_stump
##//////////////////////////////////////////////////////
## Demo
##//////////////////////////////////////////////////////
def ... | 64 | 64 | 18 | 4 | 60 | DrDub/nltk | nltk/classify/decisiontree.py | Python | f | f | 283 | 284 | 283 | 283 | e380e5fc04d1eda1c15fc28843b20ca20a8c23a2 | bigcode/the-stack | train |
a927bb458eee3b428f3386fa | train | class | class SMBServerUnitTests(unittest.TestCase):
"""Unit tests for the SMBServer
"""
def test_normalize_path(self):
"""Test file path normalization.
"""
self.assertEqual(normalize_path("filepath"), "filepath")
self.assertEqual(normalize_path("filepath\\"), "filepath")
se... | class SMBServerUnitTests(unittest.TestCase):
| """Unit tests for the SMBServer
"""
def test_normalize_path(self):
"""Test file path normalization.
"""
self.assertEqual(normalize_path("filepath"), "filepath")
self.assertEqual(normalize_path("filepath\\"), "filepath")
self.assertEqual(normalize_path("filepath\\\\")... | [ ] smb2QueryDirectory
# [ ] smb2ChangeNotify
# [ ] smb2Echo
# [ ] smb2TreeDisconnect
# [ ] smb2Logoff
# [ ] smb2Ioctl
# [ ] smb2Lock
# [ ] smb2Cancel
#
import unittest
from time import sleep
from os.path import exists, join
from os import mkdir, rmdir, r... | 186 | 186 | 622 | 9 | 176 | kamnsv/impacket | tests/SMB_RPC/test_smbserver.py | Python | SMBServerUnitTests | SMBServerUnitTests | 88 | 139 | 88 | 88 | 4d0dd3fcc2a98cdd353dbebb321674ca0463a55a | bigcode/the-stack | train |
d41c8c47bd05efd0ef91daea | train | class | class SimpleSMBServer2FuncTests(SimpleSMBServerFuncTests):
server_smb2_support = True
# When listing files in a share, SMB2 response doesn't include "." and ".."
share_list = [SimpleSMBServerFuncTests.share_file,
SimpleSMBServerFuncTests.share_directory,
SimpleSMBServer... | class SimpleSMBServer2FuncTests(SimpleSMBServerFuncTests):
| server_smb2_support = True
# When listing files in a share, SMB2 response doesn't include "." and ".."
share_list = [SimpleSMBServerFuncTests.share_file,
SimpleSMBServerFuncTests.share_directory,
SimpleSMBServerFuncTests.unicode_share_file]
def test_smbserver_delete... | EndOfFile"], len(self.share_new_content))
self.assertEqual(directory_info["Directory"], 1)
# Now close everything
client.closeFile(tree_id, directory_id)
client.disconnectTree(tree_id)
client.close()
class SimpleSMBServer2FuncTestsClientFallBack(SimpleSMBServerFuncTests):
... | 103 | 103 | 346 | 15 | 87 | kamnsv/impacket | tests/SMB_RPC/test_smbserver.py | Python | SimpleSMBServer2FuncTests | SimpleSMBServer2FuncTests | 649 | 687 | 649 | 650 | a83df5b7ddbae5350f815c670ed9fa0837930711 | bigcode/the-stack | train |
8f7769dde00b022925ff13c4 | train | class | class SimpleSMBServer2FuncTestsClientFallBack(SimpleSMBServerFuncTests):
server_smb2_support = True
client_preferred_dialect = SMB_DIALECT
| class SimpleSMBServer2FuncTestsClientFallBack(SimpleSMBServerFuncTests):
| server_smb2_support = True
client_preferred_dialect = SMB_DIALECT
| "], len(self.share_new_content))
self.assertEqual(directory_info["Directory"], 1)
# Now close everything
client.closeFile(tree_id, directory_id)
client.disconnectTree(tree_id)
client.close()
class SimpleSMBServer2FuncTestsClientFallBack(SimpleSMBServerFuncTests):
| 64 | 64 | 39 | 18 | 46 | kamnsv/impacket | tests/SMB_RPC/test_smbserver.py | Python | SimpleSMBServer2FuncTestsClientFallBack | SimpleSMBServer2FuncTestsClientFallBack | 643 | 646 | 643 | 644 | 58973f1a54dfd5a1999ae20d5df9d98c2dbfecc6 | bigcode/the-stack | train |
43e0d41ce0b5a19b0a5859c5 | train | class | class SimpleSMBServerFuncTests(unittest.TestCase):
"""Pseudo functional tests for the SimpleSMBServer.
These are pseudo functional as we're using our own SMBConnection classes. For a complete functional test
we should (and can) use for example Samba's smbclient or similar.
"""
server = None
ser... | class SimpleSMBServerFuncTests(unittest.TestCase):
| """Pseudo functional tests for the SimpleSMBServer.
These are pseudo functional as we're using our own SMBConnection classes. For a complete functional test
we should (and can) use for example Samba's smbclient or similar.
"""
server = None
server_smb2_support = False
client_preferred_diale... | ail_path"
self.assertTrue(isInFileJail(jail_path, "filename"))
self.assertTrue(isInFileJail(jail_path, "./filename"))
self.assertTrue(isInFileJail(jail_path, "../jail_path/filename"))
self.assertFalse(isInFileJail(jail_path, "/filename"))
self.assertFalse(isInFileJail(jail_path,... | 255 | 256 | 4,253 | 11 | 244 | kamnsv/impacket | tests/SMB_RPC/test_smbserver.py | Python | SimpleSMBServerFuncTests | SimpleSMBServerFuncTests | 142 | 640 | 142 | 142 | 0fed3caeb6fb1d536df7648c002cca3e7171cbdb | bigcode/the-stack | train |
b1a4f32ffff5b29b44aa8a63 | train | function | def get_fake_zk(nodename, timeout=30.0):
_fake_zk_instance = KazooClient(hosts=cluster.get_instance_ip(nodename) + ":9181", timeout=timeout)
_fake_zk_instance.start()
return _fake_zk_instance
| def get_fake_zk(nodename, timeout=30.0):
| _fake_zk_instance = KazooClient(hosts=cluster.get_instance_ip(nodename) + ":9181", timeout=timeout)
_fake_zk_instance.start()
return _fake_zk_instance
| _keeper3.xml'], stay_alive=True)
from kazoo.client import KazooClient, KazooState
@pytest.fixture(scope="module")
def started_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def get_fake_zk(nodename, timeout=30.0):
| 64 | 64 | 61 | 15 | 49 | pdv-ru/ClickHouse | tests/integration/test_keeper_snapshots_multinode/test.py | Python | get_fake_zk | get_fake_zk | 26 | 29 | 26 | 26 | a4dc03b0bbb7de6303c8d91129bec0bece75381b | bigcode/the-stack | train |
e97e8ebbf292506c09099ca1 | train | function | def stop_zk(zk):
try:
if zk:
zk.stop()
zk.close()
except:
pass
| def stop_zk(zk):
| try:
if zk:
zk.stop()
zk.close()
except:
pass
| k(nodename, timeout=30.0):
_fake_zk_instance = KazooClient(hosts=cluster.get_instance_ip(nodename) + ":9181", timeout=timeout)
_fake_zk_instance.start()
return _fake_zk_instance
def stop_zk(zk):
| 64 | 64 | 28 | 7 | 56 | pdv-ru/ClickHouse | tests/integration/test_keeper_snapshots_multinode/test.py | Python | stop_zk | stop_zk | 31 | 37 | 31 | 31 | 92a90fe1dde8345032d15e556959bc87db53d7f5 | bigcode/the-stack | train |
0c673c4c45d056cdd7048e5a | train | function | @pytest.fixture(scope="module")
def started_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
| @pytest.fixture(scope="module")
def started_cluster():
| try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
| node2', main_configs=['configs/enable_keeper2.xml'], stay_alive=True)
node3 = cluster.add_instance('node3', main_configs=['configs/enable_keeper3.xml'], stay_alive=True)
from kazoo.client import KazooClient, KazooState
@pytest.fixture(scope="module")
def started_cluster():
| 64 | 64 | 28 | 10 | 53 | pdv-ru/ClickHouse | tests/integration/test_keeper_snapshots_multinode/test.py | Python | started_cluster | started_cluster | 16 | 24 | 16 | 17 | 89ccc93edd3bea84bf1ddfdc0585e719a507e3db | bigcode/the-stack | train |
3b375d699a04767b327b0dca | train | function | def test_restart_multinode(started_cluster):
try:
node1_zk = node2_zk = node3_zk = None
node1_zk = get_fake_zk("node1")
node2_zk = get_fake_zk("node2")
node3_zk = get_fake_zk("node3")
for i in range(100):
node1_zk.create("/test_read_write_multinode_node" + str(i... | def test_restart_multinode(started_cluster):
| try:
node1_zk = node2_zk = node3_zk = None
node1_zk = get_fake_zk("node1")
node2_zk = get_fake_zk("node2")
node3_zk = get_fake_zk("node3")
for i in range(100):
node1_zk.create("/test_read_write_multinode_node" + str(i), ("somedata" + str(i)).encode())
f... | enable_keeper1.xml'], stay_alive=True)
node2 = cluster.add_instance('node2', main_configs=['configs/enable_keeper2.xml'], stay_alive=True)
node3 = cluster.add_instance('node3', main_configs=['configs/enable_keeper3.xml'], stay_alive=True)
from kazoo.client import KazooClient, KazooState
@pytest.fixture(scope="module"... | 196 | 196 | 654 | 9 | 186 | pdv-ru/ClickHouse | tests/integration/test_keeper_snapshots_multinode/test.py | Python | test_restart_multinode | test_restart_multinode | 39 | 91 | 39 | 39 | d1560eef6af0729d1bf707febfb8f8314f3f7c1b | bigcode/the-stack | train |
4804aa208a62474cdd2ea298 | train | function | def container_ip(container_name: str) -> str:
"""Returns the ip of the given container"""
return cmd.docker("inspect", "-f", "{{range .NetworkSettings.Networks}}"
"{{.IPAddress}}{{end}}", container_name).rstrip()
| def container_ip(container_name: str) -> str:
| """Returns the ip of the given container"""
return cmd.docker("inspect", "-f", "{{range .NetworkSettings.Networks}}"
"{{.IPAddress}}{{end}}", container_name).rstrip()
|
# limitations under the License.
import subprocess
import sys
from contextlib import redirect_stderr
import plumbum
from plumbum import cmd
SCION_DC_FILE = "gen/scion-dc.yml"
DC_PROJECT = "scion"
def container_ip(container_name: str) -> str:
| 64 | 64 | 54 | 11 | 53 | sciontime/scion | acceptance/common/tools.py | Python | container_ip | container_ip | 26 | 29 | 26 | 26 | e478c987555d53db0c1c9aeb9c2cc2a2fb32cca9 | bigcode/the-stack | train |
87f87d5f6aed8074a4a5ba7c | train | class | class DC(object):
def __init__(self,
project: str = DC_PROJECT,
compose_file: str = SCION_DC_FILE):
self.project = project
self.compose_file = compose_file
def __call__(self, *args, **kwargs) -> str:
"""Runs docker compose with the given arguments"""
... | class DC(object):
| def __init__(self,
project: str = DC_PROJECT,
compose_file: str = SCION_DC_FILE):
self.project = project
self.compose_file = compose_file
def __call__(self, *args, **kwargs) -> str:
"""Runs docker compose with the given arguments"""
with redirec... | c.yml"
DC_PROJECT = "scion"
def container_ip(container_name: str) -> str:
"""Returns the ip of the given container"""
return cmd.docker("inspect", "-f", "{{range .NetworkSettings.Networks}}"
"{{.IPAddress}}{{end}}", container_name).rstrip()
class DC(object):
| 68 | 68 | 228 | 4 | 64 | sciontime/scion | acceptance/common/tools.py | Python | DC | DC | 32 | 54 | 32 | 33 | 2c23a41bbe76376713e3b721132367be3c7f821c | bigcode/the-stack | train |
709eee6fff42bfe1e6caf2c6 | train | function | @click.command(context_settings=dict(help_option_names=['-h', '--help']))
@click.option('-s', '--start-block', default=0, show_default=True, type=int, help='Start block')
@click.option('-e', '--end-block', required=True, type=int, help='End block')
@click.option('-b', '--batch-size', default=5, show_default=True, type=... | @click.command(context_settings=dict(help_option_names=['-h', '--help']))
@click.option('-s', '--start-block', default=0, show_default=True, type=int, help='Start block')
@click.option('-e', '--end-block', required=True, type=int, help='End block')
@click.option('-b', '--batch-size', default=5, show_default=True, type=... | """Exports traces from parity node."""
if chain == 'classic' and daofork_traces == True:
raise ValueError(
'Classic chain does not include daofork traces. Disable daofork traces with --no-daofork-traces option.')
job = ExportTracesJob(
start_block=start_block,
end_block=e... | @click.command(context_settings=dict(help_option_names=['-h', '--help']))
@click.option('-s', '--start-block', default=0, show_default=True, type=int, help='Start block')
@click.option('-e', '--end-block', required=True, type=int, help='End block')
@click.option('-b', '--batch-size', default=5, show_default=True, type=... | 364 | 154 | 516 | 364 | 0 | XWorldGames/bsc-etl | bscetl/cli/export_traces.py | Python | export_traces | export_traces | 37 | 66 | 37 | 51 | 9265ece0607ea0635d34c2b48ed9eadf3e16cb31 | bigcode/the-stack | train |
0d91771dc8d53abb72f07575 | train | function | def act(diff, oc_map):
cluster = diff['cluster']
user = diff['user']
action = diff['action']
if action == "del_user":
oc_map.get(cluster).delete_user(user)
else:
raise Exception("invalid action: {}".format(action))
| def act(diff, oc_map):
| cluster = diff['cluster']
user = diff['user']
action = diff['action']
if action == "del_user":
oc_map.get(cluster).delete_user(user)
else:
raise Exception("invalid action: {}".format(action))
| if f_user != s_user:
continue
found = True
break
if not found:
result.append({
"action": action,
"cluster": f_user['cluster'],
"user": f_user['user']
})
return result
def act(diff, oc_map):
| 64 | 64 | 60 | 7 | 56 | bwplotka/qontract-reconcile | reconcile/openshift_users.py | Python | act | act | 88 | 96 | 88 | 88 | 265a8c126f0da7de2ab5ab81d4084b3bae0c1997 | bigcode/the-stack | train |
ba42a324a6b48614459300d4 | train | function | def calculate_diff(current_state, desired_state):
diff = []
users_to_del = \
subtract_states(current_state, desired_state,
"del_user")
diff.extend(users_to_del)
return diff
| def calculate_diff(current_state, desired_state):
| diff = []
users_to_del = \
subtract_states(current_state, desired_state,
"del_user")
diff.extend(users_to_del)
return diff
| .fetch_desired_state(oc_map)
flat_groups_desired_state = \
[{'cluster': s['cluster'], 'user': s['user']}
for s in groups_desired_state]
desired_state.extend(flat_groups_desired_state)
return desired_state
def calculate_diff(current_state, desired_state):
| 64 | 64 | 44 | 9 | 54 | bwplotka/qontract-reconcile | reconcile/openshift_users.py | Python | calculate_diff | calculate_diff | 58 | 65 | 58 | 58 | 54d86f3c2196dfe8767c8edf66f6c952a757ae90 | bigcode/the-stack | train |
d4231cac30602caa181f3271 | train | function | def fetch_desired_state(oc_map):
desired_state = []
flat_rolebindings_desired_state = \
openshift_rolebindings.fetch_desired_state(ri=None, oc_map=oc_map)
desired_state.extend(flat_rolebindings_desired_state)
groups_desired_state = openshift_groups.fetch_desired_state(oc_map)
flat_groups_de... | def fetch_desired_state(oc_map):
| desired_state = []
flat_rolebindings_desired_state = \
openshift_rolebindings.fetch_desired_state(ri=None, oc_map=oc_map)
desired_state.extend(flat_rolebindings_desired_state)
groups_desired_state = openshift_groups.fetch_desired_state(oc_map)
flat_groups_desired_state = \
[{'cluste... | thread_pool_size=thread_pool_size)
results = threaded.run(get_cluster_users, oc_map.clusters(),
thread_pool_size, oc_map=oc_map)
current_state = list(itertools.chain.from_iterable(results))
return oc_map, current_state
def fetch_desired_state(oc_map):
| 64 | 64 | 117 | 9 | 54 | bwplotka/qontract-reconcile | reconcile/openshift_users.py | Python | fetch_desired_state | fetch_desired_state | 43 | 55 | 43 | 43 | 48a133b6b978affa2e14cfe87d478908efbf5493 | bigcode/the-stack | train |
14f4b32669661573cda319d8 | train | function | @defer
def run(dry_run, thread_pool_size=10, internal=None,
use_jump_host=True, defer=None):
oc_map, current_state = \
fetch_current_state(thread_pool_size, internal, use_jump_host)
defer(lambda: oc_map.cleanup())
desired_state = fetch_desired_state(oc_map)
diffs = calculate_diff(curren... | @defer
def run(dry_run, thread_pool_size=10, internal=None,
use_jump_host=True, defer=None):
| oc_map, current_state = \
fetch_current_state(thread_pool_size, internal, use_jump_host)
defer(lambda: oc_map.cleanup())
desired_state = fetch_desired_state(oc_map)
diffs = calculate_diff(current_state, desired_state)
for diff in diffs:
logging.info(list(diff.values()))
if... | diff['action']
if action == "del_user":
oc_map.get(cluster).delete_user(user)
else:
raise Exception("invalid action: {}".format(action))
@defer
def run(dry_run, thread_pool_size=10, internal=None,
use_jump_host=True, defer=None):
| 64 | 64 | 109 | 28 | 36 | bwplotka/qontract-reconcile | reconcile/openshift_users.py | Python | run | run | 99 | 113 | 99 | 101 | e3020d4922b59c86069abfef3f499c833832f1e1 | bigcode/the-stack | train |
dcbb30f3ceb59e77f7ed77a3 | train | function | def subtract_states(from_state, subtract_state, action):
result = []
for f_user in from_state:
found = False
for s_user in subtract_state:
if f_user != s_user:
continue
found = True
break
if not found:
result.append({
... | def subtract_states(from_state, subtract_state, action):
| result = []
for f_user in from_state:
found = False
for s_user in subtract_state:
if f_user != s_user:
continue
found = True
break
if not found:
result.append({
"action": action,
"cluster": f... | _desired_state)
return desired_state
def calculate_diff(current_state, desired_state):
diff = []
users_to_del = \
subtract_states(current_state, desired_state,
"del_user")
diff.extend(users_to_del)
return diff
def subtract_states(from_state, subtract_state, action... | 64 | 64 | 94 | 11 | 52 | bwplotka/qontract-reconcile | reconcile/openshift_users.py | Python | subtract_states | subtract_states | 68 | 85 | 68 | 68 | f418a960ac15e9cda0287b28a8f738cfd26e7f42 | bigcode/the-stack | train |
7c6329237a23f3df04b616ef | train | function | def get_cluster_users(cluster, oc_map):
oc = oc_map.get(cluster)
if not oc:
logging.log(level=oc.log_level, msg=oc.message)
return []
users = [u['metadata']['name'] for u in oc.get_users()
if u.get('identities', None) is not None
and len(u['identities']) == 1
... | def get_cluster_users(cluster, oc_map):
| oc = oc_map.get(cluster)
if not oc:
logging.log(level=oc.log_level, msg=oc.message)
return []
users = [u['metadata']['name'] for u in oc.get_users()
if u.get('identities', None) is not None
and len(u['identities']) == 1
and u['identities'][0].startswith... | reconcile.openshift_groups as openshift_groups
import reconcile.openshift_rolebindings as openshift_rolebindings
import reconcile.queries as queries
from reconcile.utils.oc import OC_Map
from reconcile.utils.defer import defer
QONTRACT_INTEGRATION = 'openshift-users'
def get_cluster_users(cluster, oc_map):
| 64 | 64 | 132 | 9 | 55 | bwplotka/qontract-reconcile | reconcile/openshift_users.py | Python | get_cluster_users | get_cluster_users | 16 | 27 | 16 | 16 | 68547b0592b74070793c243d6059bd635cbd84ad | bigcode/the-stack | train |
879da2bea680ac3d66208ed3 | train | function | def fetch_current_state(thread_pool_size, internal, use_jump_host):
clusters = queries.get_clusters(minimal=True)
settings = queries.get_app_interface_settings()
oc_map = OC_Map(clusters=clusters, integration=QONTRACT_INTEGRATION,
settings=settings, internal=internal,
... | def fetch_current_state(thread_pool_size, internal, use_jump_host):
| clusters = queries.get_clusters(minimal=True)
settings = queries.get_app_interface_settings()
oc_map = OC_Map(clusters=clusters, integration=QONTRACT_INTEGRATION,
settings=settings, internal=internal,
use_jump_host=use_jump_host,
thread_pool_size=t... | and u['identities'][0].startswith('github')
and not u['metadata'].get('labels', {}).get('admin', '')]
return [{"cluster": cluster, "user": user} for user in users or []]
def fetch_current_state(thread_pool_size, internal, use_jump_host):
| 64 | 64 | 125 | 14 | 50 | bwplotka/qontract-reconcile | reconcile/openshift_users.py | Python | fetch_current_state | fetch_current_state | 30 | 40 | 30 | 30 | 3bcf2912e182d71b5f7973ff24a04d0d583a090f | bigcode/the-stack | train |
aa4ed48987edf2aae01a57ca | train | class | class Filter(Base):
"""An alert filter that operates on a Stream. A Filter is associated
with exactly one Group, and a Group may have multiple operational Filters.
"""
# TODO: Track filter ownership and allow owners to update, delete filters
create = (
read
) = (
update
) = ... | class Filter(Base):
| """An alert filter that operates on a Stream. A Filter is associated
with exactly one Group, and a Group may have multiple operational Filters.
"""
# TODO: Track filter ownership and allow owners to update, delete filters
create = (
read
) = (
update
) = delete = accessible_... | __all__ = ['Filter']
import sqlalchemy as sa
from sqlalchemy.orm import relationship
from baselayer.app.models import Base, AccessibleIfRelatedRowsAreAccessible
from .group import accessible_by_group_members
class Filter(Base):
| 47 | 94 | 316 | 4 | 42 | bparazin/skyportal | skyportal/models/filter.py | Python | Filter | Filter | 11 | 57 | 11 | 11 | 23eeb1dc8668346ae71fcac8b3a60e61988fc3ab | bigcode/the-stack | train |
709bb0d3ae3a7ae22a4f4255 | train | function | def clear_db(Session):
drop_tables = u'''select 'drop table "' || tablename || '" cascade;'
from pg_tables where schemaname = 'public' '''
c = Session.connection()
results = c.execute(drop_tables)
for result in results:
c.execute(result[0])
drop_functions_sql = u'''
... | def clear_db(Session):
| drop_tables = u'''select 'drop table "' || tablename || '" cascade;'
from pg_tables where schemaname = 'public' '''
c = Session.connection()
results = c.execute(drop_tables)
for result in results:
c.execute(result[0])
drop_functions_sql = u'''
SELECT 'drop functi... | kan.lib.cli as cli
import ckan.plugins as p
from ckan.tests.helpers import FunctionalTestBase
import ckanext.datastore.backend.postgres as db
def extract(d, keys):
return dict((k, d[k]) for k in keys if k in d)
def clear_db(Session):
| 64 | 64 | 172 | 5 | 59 | fossabot/ckan | ckanext/datastore/tests/helpers.py | Python | clear_db | clear_db | 17 | 36 | 17 | 17 | 4c8264684187a5c030c1bc2e4f7a33d0accc0966 | bigcode/the-stack | train |
d72304f9b5e05f508847328c | train | class | class DatastoreFunctionalTestBase(FunctionalTestBase):
_load_plugins = (u'datastore', )
@classmethod
def setup_class(cls):
engine = db.get_write_engine()
rebuild_all_dbs(orm.scoped_session(orm.sessionmaker(bind=engine)))
super(DatastoreFunctionalTestBase, cls).setup_class()
| class DatastoreFunctionalTestBase(FunctionalTestBase):
| _load_plugins = (u'datastore', )
@classmethod
def setup_class(cls):
engine = db.get_write_engine()
rebuild_all_dbs(orm.scoped_session(orm.sessionmaker(bind=engine)))
super(DatastoreFunctionalTestBase, cls).setup_class()
| for resource in resources:
resource = p.toolkit.get_action('resource_show')(
context, {'id': resource.id})
resource['url_type'] = 'datastore'
p.toolkit.get_action('resource_update')(context, resource)
class DatastoreFunctionalTestBase(FunctionalTestBase):
| 64 | 64 | 73 | 11 | 53 | fossabot/ckan | ckanext/datastore/tests/helpers.py | Python | DatastoreFunctionalTestBase | DatastoreFunctionalTestBase | 62 | 69 | 62 | 62 | 0e8590a79c547775268a4b0e195f11089950cc5a | bigcode/the-stack | train |
01120a14ab0ebd9c62e538ef | train | function | def extract(d, keys):
return dict((k, d[k]) for k in keys if k in d)
| def extract(d, keys):
| return dict((k, d[k]) for k in keys if k in d)
| # encoding: utf-8
from sqlalchemy import orm
import ckan.model as model
import ckan.lib.cli as cli
import ckan.plugins as p
from ckan.tests.helpers import FunctionalTestBase
import ckanext.datastore.backend.postgres as db
def extract(d, keys):
| 62 | 64 | 24 | 6 | 55 | fossabot/ckan | ckanext/datastore/tests/helpers.py | Python | extract | extract | 13 | 14 | 13 | 13 | e758e911edaf1499e1046d71378d1e4eaedc09c6 | bigcode/the-stack | train |
da1d87962effade7309ae20e | train | function | def rebuild_all_dbs(Session):
''' If the tests are running on the same db, we have to make sure that
the ckan tables are recrated.
'''
db_read_url_parts = cli.parse_db_config('ckan.datastore.write_url')
db_ckan_url_parts = cli.parse_db_config('sqlalchemy.url')
same_db = db_read_url_parts['db_nam... | def rebuild_all_dbs(Session):
| ''' If the tests are running on the same db, we have to make sure that
the ckan tables are recrated.
'''
db_read_url_parts = cli.parse_db_config('ckan.datastore.write_url')
db_ckan_url_parts = cli.parse_db_config('sqlalchemy.url')
same_db = db_read_url_parts['db_name'] == db_ckan_url_parts['db_n... | spname = 'public' AND proname != 'populate_full_text_trigger'
'''
drop_functions = u''.join(r[0] for r in c.execute(drop_functions_sql))
if drop_functions:
c.execute(drop_functions)
Session.commit()
Session.remove()
def rebuild_all_dbs(Session):
| 64 | 64 | 121 | 7 | 57 | fossabot/ckan | ckanext/datastore/tests/helpers.py | Python | rebuild_all_dbs | rebuild_all_dbs | 39 | 50 | 39 | 39 | fd3582bc74495e5acd83350e1537f09238b5abc2 | bigcode/the-stack | train |
c68b652e3dcb7ecc457add99 | train | function | def set_url_type(resources, user):
context = {'user': user.name}
for resource in resources:
resource = p.toolkit.get_action('resource_show')(
context, {'id': resource.id})
resource['url_type'] = 'datastore'
p.toolkit.get_action('resource_update')(context, resource)
| def set_url_type(resources, user):
| context = {'user': user.name}
for resource in resources:
resource = p.toolkit.get_action('resource_show')(
context, {'id': resource.id})
resource['url_type'] = 'datastore'
p.toolkit.get_action('resource_update')(context, resource)
| _config('sqlalchemy.url')
same_db = db_read_url_parts['db_name'] == db_ckan_url_parts['db_name']
if same_db:
model.repo.tables_created_and_initialised = False
clear_db(Session)
model.repo.rebuild_db()
def set_url_type(resources, user):
| 64 | 64 | 70 | 8 | 56 | fossabot/ckan | ckanext/datastore/tests/helpers.py | Python | set_url_type | set_url_type | 53 | 59 | 53 | 53 | 15e0ae4c4da913bc915a277318b53210e08b5254 | bigcode/the-stack | train |
c43271a80753ef6faad0f81c | train | class | class TestAltmarketsAPIUserStreamDataSource(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
cls.ev_loop = asyncio.get_event_loop()
cls.base_asset = "COINALPHA"
cls.quote_asset = "HBOT"
cls.trading_pair = f"{cls.base_asset}-{cls.quote_ass... | class TestAltmarketsAPIUserStreamDataSource(unittest.TestCase):
@classmethod
| def setUpClass(cls) -> None:
super().setUpClass()
cls.ev_loop = asyncio.get_event_loop()
cls.base_asset = "COINALPHA"
cls.quote_asset = "HBOT"
cls.trading_pair = f"{cls.base_asset}-{cls.quote_asset}"
def setUp(self) -> None:
super().setUp()
self.mocking_a... | import asyncio
import json
import time
import unittest
from typing import Dict, Awaitable
from unittest.mock import patch, AsyncMock
import numpy as np
from hummingbot.connector.exchange.altmarkets.altmarkets_api_user_stream_data_source import AltmarketsAPIUserStreamDataSource
from hummingbot.connector.exchange.altma... | 137 | 256 | 1,081 | 17 | 119 | pecuniafinance/hummingbot | test/hummingbot/connector/exchange/altmarkets/test_altmarkets_api_user_stream_data_source.py | Python | TestAltmarketsAPIUserStreamDataSource | TestAltmarketsAPIUserStreamDataSource | 17 | 142 | 17 | 18 | 94bd547e4951625cef50d86e54a6e6a5be7c22a7 | bigcode/the-stack | train |
6549cd58aa67f897462907aa | train | function | def get_command(audio_file, ends_with_m4a):
if ends_with_m4a:
convert_to_wav(audio_file)
params = {"language": "en-IN"}
headers = {
"Content-Type": "audio/wav",
"Ocp-Apim-Subscription-Key": _voice_key,
}
response = requests.post(
"https://"
+ _region
+... | def get_command(audio_file, ends_with_m4a):
| if ends_with_m4a:
convert_to_wav(audio_file)
params = {"language": "en-IN"}
headers = {
"Content-Type": "audio/wav",
"Ocp-Apim-Subscription-Key": _voice_key,
}
response = requests.post(
"https://"
+ _region
+ ".stt.speech.microsoft.com/speech/recogniti... | texts.append(line["text"])
print(texts)
return {"texts": texts}
def convert_to_wav(audio_file):
sound = AudioSegment.from_file(audio_file, "m4a")
sound.export(audio_file, format="wav")
def get_command(audio_file, ends_with_m4a):
| 64 | 64 | 197 | 12 | 52 | kad99kev/Guidiant-API | api/azure.py | Python | get_command | get_command | 69 | 91 | 69 | 69 | dd4efac3cf9751f27ddf3da3520f753e9dd79119 | bigcode/the-stack | train |
6ee14b2d0680497ce4b75e39 | train | function | def describe_image(binary_image):
params = {"maxCandidates": "1", "language": "en"}
headers = {
"Content-Type": "application/octet-stream",
"Ocp-Apim-Subscription-Key": _vision_key,
}
response = requests.post(
"https://" + _region + ".api.cognitive.microsoft.com/vision/v3.1/descr... | def describe_image(binary_image):
| params = {"maxCandidates": "1", "language": "en"}
headers = {
"Content-Type": "application/octet-stream",
"Ocp-Apim-Subscription-Key": _vision_key,
}
response = requests.post(
"https://" + _region + ".api.cognitive.microsoft.com/vision/v3.1/describe",
data=binary_image,
... | import Path
from pydub import AudioSegment
_env_path = Path(".") / ".env"
load_dotenv(dotenv_path=_env_path)
_region = os.getenv("ACCOUNT_REGION")
_vision_key = os.getenv("VISION_KEY")
_voice_key = os.getenv("VOICE_KEY")
def describe_image(binary_image):
| 64 | 64 | 115 | 6 | 58 | kad99kev/Guidiant-API | api/azure.py | Python | describe_image | describe_image | 18 | 32 | 18 | 18 | a1b1b9e57c8b1ca311b5501dbc532a206b6b63b3 | bigcode/the-stack | train |
466d3bfed36d1c65ac2a1dbe | train | function | def convert_to_wav(audio_file):
sound = AudioSegment.from_file(audio_file, "m4a")
sound.export(audio_file, format="wav")
| def convert_to_wav(audio_file):
| sound = AudioSegment.from_file(audio_file, "m4a")
sound.export(audio_file, format="wav")
| _response["status"] == "succeeded":
received_result = True
texts = []
for line in read_response["analyzeResult"]["readResults"][0]["lines"]:
texts.append(line["text"])
print(texts)
return {"texts": texts}
def convert_to_wav(audio_file):
| 64 | 64 | 33 | 8 | 56 | kad99kev/Guidiant-API | api/azure.py | Python | convert_to_wav | convert_to_wav | 64 | 66 | 64 | 64 | db36c6269342efccecf159c2b930e61c129015a6 | bigcode/the-stack | train |
141ed9fa612c2a6825fdf8b8 | train | function | def read_image(binary_image):
params = {"language": "en"}
headers = {
"Content-Type": "application/octet-stream",
"Ocp-Apim-Subscription-Key": _vision_key,
}
response = requests.post(
"https://" + _region + ".api.cognitive.microsoft.com/vision/v3.1/read/analyze",
data=bin... | def read_image(binary_image):
| params = {"language": "en"}
headers = {
"Content-Type": "application/octet-stream",
"Ocp-Apim-Subscription-Key": _vision_key,
}
response = requests.post(
"https://" + _region + ".api.cognitive.microsoft.com/vision/v3.1/read/analyze",
data=binary_image,
params=para... | .post(
"https://" + _region + ".api.cognitive.microsoft.com/vision/v3.1/describe",
data=binary_image,
params=params,
headers=headers,
)
response_data = response.json()
print(response_data)
return response_data
def read_image(binary_image):
| 64 | 64 | 211 | 6 | 57 | kad99kev/Guidiant-API | api/azure.py | Python | read_image | read_image | 35 | 61 | 35 | 35 | 0d207a4638a643865fa7d5e47185a27f3dcb00e5 | bigcode/the-stack | train |
bddd59a7f7c0f44c7313a128 | train | class | class SearchSyringeCollection(models.Model):
count = models.SmallIntegerField()
town = models.ForeignKey(Town, related_name='+', on_delete=DO_NOTHING)
performed_on = models.DateField()
month = models.SmallIntegerField()
year = models.SmallIntegerField()
grouping_constant = models.SmallIntegerFie... | class SearchSyringeCollection(models.Model):
| count = models.SmallIntegerField()
town = models.ForeignKey(Town, related_name='+', on_delete=DO_NOTHING)
performed_on = models.DateField()
month = models.SmallIntegerField()
year = models.SmallIntegerField()
grouping_constant = models.SmallIntegerField() # Is always 1.
class Meta:
... | ()
year = models.SmallIntegerField()
is_client = models.BooleanField(default=False)
is_anonymous = models.BooleanField(default=False)
grouping_constant = models.SmallIntegerField() # Is always 1.
class Meta:
managed = False
class SearchSyringeCollection(models.Model):
| 64 | 64 | 86 | 9 | 54 | fragaria/BorIS | boris/reporting/models.py | Python | SearchSyringeCollection | SearchSyringeCollection | 49 | 58 | 49 | 49 | d67d4cf2b163c824d0c90e8aa2dec4068e94c085 | bigcode/the-stack | train |
bad854f088e085235566b4b1 | train | class | class SearchService(models.Model):
service = models.ForeignKey(Service, related_name='+', on_delete=DO_NOTHING)
person = models.ForeignKey(Person, related_name='+', on_delete=DO_NOTHING)
encounter = models.ForeignKey(Encounter, related_name='+', on_delete=DO_NOTHING)
content_type_model = models.CharFiel... | class SearchService(models.Model):
| service = models.ForeignKey(Service, related_name='+', on_delete=DO_NOTHING)
person = models.ForeignKey(Person, related_name='+', on_delete=DO_NOTHING)
encounter = models.ForeignKey(Encounter, related_name='+', on_delete=DO_NOTHING)
content_type_model = models.CharField(max_length=255)
town = models... | month = models.SmallIntegerField()
year = models.SmallIntegerField()
# "grouping_constant" is used in aggregations where grand totals are needed.
grouping_constant = models.SmallIntegerField() # Is always 1.
class Meta:
managed = False
class SearchService(models.Model):
| 64 | 64 | 167 | 6 | 57 | fragaria/BorIS | boris/reporting/models.py | Python | SearchService | SearchService | 32 | 46 | 32 | 32 | 5e92284806d9cc9131cfd123da251ce54dc4a594 | bigcode/the-stack | train |
cdc921fe76982c2d12b0081a | train | class | class SearchEncounter(models.Model):
"""
An augmented model corresponding to a database view.
"""
person = models.ForeignKey(Person, related_name='+', on_delete=DO_NOTHING)
town = models.ForeignKey(Town, related_name='+', on_delete=DO_NOTHING)
is_client = models.BooleanField(default=None)
is... | class SearchEncounter(models.Model):
| """
An augmented model corresponding to a database view.
"""
person = models.ForeignKey(Person, related_name='+', on_delete=DO_NOTHING)
town = models.ForeignKey(Town, related_name='+', on_delete=DO_NOTHING)
is_client = models.BooleanField(default=None)
is_anonymous = models.BooleanField(defa... | from django.db import models
from boris.clients.models import Person, Town
from boris.services.models.core import Service, Encounter
DO_NOTHING = models.DO_NOTHING
class SearchEncounter(models.Model):
| 42 | 64 | 203 | 6 | 35 | fragaria/BorIS | boris/reporting/models.py | Python | SearchEncounter | SearchEncounter | 9 | 29 | 9 | 9 | d40deb0caa1517eb60d93bea208b13254ff0edb8 | bigcode/the-stack | train |
5f75c3034044c246681af99f | train | class | class RawTransactionsTest(BlemflarkTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3
def setup_network(self, split=False):
super().setup_network()
connect_nodes_bi(self.nodes,0,2)
def run_test(self):
#prepare some coins for... | class RawTransactionsTest(BlemflarkTestFramework):
| def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 3
def setup_network(self, split=False):
super().setup_network()
connect_nodes_bi(self.nodes,0,2)
def run_test(self):
#prepare some coins for multiple *rawtransaction commands
self.nod... | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the rawtranscation RPCs.
Test the following RPCs:
- createrawtransaction
- signrawtransacti... | 140 | 256 | 2,848 | 11 | 129 | GalacticFederation/blemflark | test/functional/rawtransactions.py | Python | RawTransactionsTest | RawTransactionsTest | 19 | 221 | 19 | 19 | 65ad287afbde4441987b4aa71498ae7fd6c7bd0b | bigcode/the-stack | train |
49341f66be8616ace13ab391 | train | class | class Solution:
def xorQueries(self, arr: List[int], queries: List[List[int]]) -> List[int]:
cum_arr = [0]
for i in range(len(arr)):
cum_arr.append(cum_arr[i]^arr[i])
# print(cum_arr)
output = []
for l,r in queries:
output.append(cum_arr[r+1]^cum_ar... | class Solution:
| def xorQueries(self, arr: List[int], queries: List[List[int]]) -> List[int]:
cum_arr = [0]
for i in range(len(arr)):
cum_arr.append(cum_arr[i]^arr[i])
# print(cum_arr)
output = []
for l,r in queries:
output.append(cum_arr[r+1]^cum_arr[l])
r... | # LC Contest 170
# Time: O(n+m), n=len(arr), m= len(queries)
# Space: O(n), O(1) excluding output
class Solution:
| 39 | 64 | 87 | 3 | 35 | cmattey/leetcode_problems | Python/lc_1310_xor_queries_subarray.py | Python | Solution | Solution | 5 | 18 | 5 | 5 | ab46fde75ac4a7194967f313863a2bba8f954302 | bigcode/the-stack | train |
2395da3a18369752c0ad577e | train | class | class OperationsConfig(AppConfig):
name = 'apps.operations'
verbose_name = '用户操作'
| class OperationsConfig(AppConfig):
| name = 'apps.operations'
verbose_name = '用户操作'
| from django.apps import AppConfig
class OperationsConfig(AppConfig):
| 13 | 64 | 21 | 6 | 6 | WeiSanJin/MxOnline | apps/operations/apps.py | Python | OperationsConfig | OperationsConfig | 4 | 6 | 4 | 4 | e017374b0849b11ef2476d6e7c104766da3e5308 | bigcode/the-stack | train |
e79f03fab6a006f5116f424b | train | class | @add_standard_options(StandardTtkOptionsTests)
class SeparatorTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'cursor', 'orient', 'style', 'takefocus',
# 'state'?
)
default_orient = 'horizontal'
def create(self, **kwargs):
return ttk.Separator(self.root, **kwar... | @add_standard_options(StandardTtkOptionsTests)
class SeparatorTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'cursor', 'orient', 'style', 'takefocus',
# 'state'?
)
default_orient = 'horizontal'
def create(self, **kwargs):
return ttk.Separator(self.root, **kwargs)
| Equal(self.tv.tag_has('tag1'), (item1,))
self.assertEqual(self.tv.tag_has('tag2'), (item2,))
self.assertEqual(self.tv.tag_has('tag3'), ())
@add_standard_options(StandardTtkOptionsTests)
class SeparatorTest(AbstractWidgetTest, unittest.TestCase):
| 63 | 64 | 77 | 21 | 42 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | SeparatorTest | SeparatorTest | 1,841 | 1,850 | 1,841 | 1,842 | 12815c63c45afff2578d1663c39ae6a9f04ae3bf | bigcode/the-stack | train |
721cd0a6475523597c5cde61 | train | class | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class EntryTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'background', 'class', 'cursor',
'exportselection', 'font', 'foreground',
'invalidcommand', 'justify',
'show', 'state', 'style', 'takefocus', 'textvari... | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class EntryTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'background', 'class', 'cursor',
'exportselection', 'font', 'foreground',
'invalidcommand', 'justify',
'show', 'state', 'style', 'takefocus', 'textvariable',
'validate', 'validatecommand', 'width', 'xscrollcommand',
)
def setUp(self):
super().setU... | self.create()
self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string')
def test_invoke(self):
success = []
def cb_test():
success.append(1)
return "cb test called"
cbtn = ttk.Checkbutton(self.root, command=cb_test)
# the variable automatically ... | 255 | 256 | 983 | 25 | 230 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | EntryTest | EntryTest | 278 | 411 | 278 | 279 | 56850f3791edcf389c63a472459dc3419df6d0e7 | bigcode/the-stack | train |
11cce26f88ce8e516ea3b83a | train | class | @add_standard_options(StandardTtkOptionsTests)
class ButtonTest(AbstractLabelTest, unittest.TestCase):
OPTIONS = (
'class', 'command', 'compound', 'cursor', 'default',
'image', 'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'width',
)
def crea... | @add_standard_options(StandardTtkOptionsTests)
class ButtonTest(AbstractLabelTest, unittest.TestCase):
| OPTIONS = (
'class', 'command', 'compound', 'cursor', 'default',
'image', 'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'width',
)
def create(self, **kwargs):
return ttk.Button(self.root, **kwargs)
def test_default(self):
... | )
def test_font(self):
widget = self.create()
self.checkParam(widget, 'font',
'-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*')
@add_standard_options(StandardTtkOptionsTests)
class ButtonTest(AbstractLabelTest, unittest.TestCase):
| 64 | 64 | 161 | 21 | 43 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | ButtonTest | ButtonTest | 206 | 226 | 206 | 207 | 3774fb725aab35537798818a5de7a84cb46b0805 | bigcode/the-stack | train |
20f5f196061c7ef3fb57972f | train | class | @add_standard_options(StandardTtkOptionsTests)
class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'columns', 'cursor', 'displaycolumns',
'height', 'padding', 'selectmode', 'show',
'style', 'takefocus', 'xscrollcommand', 'yscrollcommand',
)
def setUp(self... | @add_standard_options(StandardTtkOptionsTests)
class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'columns', 'cursor', 'displaycolumns',
'height', 'padding', 'selectmode', 'show',
'style', 'takefocus', 'xscrollcommand', 'yscrollcommand',
)
def setUp(self):
super().setUp()
self.tv = self.create(padding=0)
def create(self, **kwargs):
... | Equal(self.spin['values'],
('1', '', '2') if self.wantobjects else
'1 {} 2')
# testing values with spaces
self.spin['values'] = ['a b', 'a\tb', 'a\nb']
self.assertEqual(self.spin['values'],
('a b', 'a\tb', 'a\nb') if sel... | 256 | 256 | 5,248 | 22 | 234 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | TreeviewTest | TreeviewTest | 1,287 | 1,838 | 1,287 | 1,288 | 885bd5d015f2f709239778f5ac9d6e9794ff7be1 | bigcode/the-stack | train |
ef41be36a46e4cba429200b9 | train | class | @add_standard_options(StandardTtkOptionsTests)
class FrameTest(AbstractToplevelTest, unittest.TestCase):
OPTIONS = (
'borderwidth', 'class', 'cursor', 'height',
'padding', 'relief', 'style', 'takefocus',
'width',
)
def create(self, **kwargs):
return ttk.Frame(self.root, **kw... | @add_standard_options(StandardTtkOptionsTests)
class FrameTest(AbstractToplevelTest, unittest.TestCase):
| OPTIONS = (
'borderwidth', 'class', 'cursor', 'height',
'padding', 'relief', 'style', 'takefocus',
'width',
)
def create(self, **kwargs):
return ttk.Frame(self.root, **kwargs)
| .state(['active', '!disabled'])
self.assertEqual(self.widget.state(), ('active', ))
class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
_conv_pixels = noconv
@add_standard_options(StandardTtkOptionsTests)
class FrameTest(AbstractToplevelTest, unittest.TestCase):
| 64 | 64 | 79 | 22 | 41 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | FrameTest | FrameTest | 118 | 127 | 118 | 119 | 4c168b1540ff754412b2a7ce36c2c57597466e64 | bigcode/the-stack | train |
1261a65378ffb76cb487c66c | train | class | class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
OPTIONS = (
'class', 'compound', 'cursor', 'direction',
'image', 'menu', 'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'width',
)
def create(self, **kwargs):
return ttk.Menub... | class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
| OPTIONS = (
'class', 'compound', 'cursor', 'direction',
'image', 'menu', 'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'width',
)
def create(self, **kwargs):
return ttk.Menubutton(self.root, **kwargs)
def test_direction(self):
... | (conv(cbtn2['value']), myvar.get())
self.assertEqual(myvar.get(),
conv(cbtn.tk.globalgetvar(cbtn['variable'])))
self.assertEqual(str(cbtn['variable']), str(cbtn2['variable']))
class MenubuttonTest(AbstractLabelTest, unittest.TestCase):
| 63 | 64 | 167 | 13 | 50 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | MenubuttonTest | MenubuttonTest | 726 | 746 | 726 | 726 | 7661d78f3633047053e19a8603fff1502c06920e | bigcode/the-stack | train |
c93d1ac55fe08dbe639bf15d | train | class | class WidgetTest(AbstractTkTest, unittest.TestCase):
"""Tests methods available in every ttk widget."""
def setUp(self):
super().setUp()
self.widget = ttk.Button(self.root, width=0, text="Text")
self.widget.pack()
def test_identify(self):
self.widget.update()
self.... | class WidgetTest(AbstractTkTest, unittest.TestCase):
| """Tests methods available in every ttk widget."""
def setUp(self):
super().setUp()
self.widget = ttk.Button(self.root, width=0, text="Text")
self.widget.pack()
def test_identify(self):
self.widget.update()
self.assertEqual(self.widget.identify(
int(sel... | ', ('5p', '6p', '7p', '8p'))
self.checkParam(widget, 'padding', (), expected='')
def test_style(self):
widget = self.create()
self.assertEqual(widget['style'], '')
errmsg = 'Layout Foo not found'
if hasattr(self, 'default_orient'):
errmsg = ('Layout %s.Foo not fo... | 153 | 153 | 511 | 11 | 141 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | WidgetTest | WidgetTest | 56 | 111 | 56 | 56 | 75236ba40ccccfa4ce2fab4b10418049b6dda836 | bigcode/the-stack | train |
159c75aa18b4d304f5a4a29f | train | class | @add_standard_options(StandardTtkOptionsTests)
class SizegripTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'cursor', 'style', 'takefocus',
# 'state'?
)
def create(self, **kwargs):
return ttk.Sizegrip(self.root, **kwargs)
| @add_standard_options(StandardTtkOptionsTests)
class SizegripTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'cursor', 'style', 'takefocus',
# 'state'?
)
def create(self, **kwargs):
return ttk.Sizegrip(self.root, **kwargs)
| style', 'takefocus',
# 'state'?
)
default_orient = 'horizontal'
def create(self, **kwargs):
return ttk.Separator(self.root, **kwargs)
@add_standard_options(StandardTtkOptionsTests)
class SizegripTest(AbstractWidgetTest, unittest.TestCase):
| 64 | 64 | 69 | 23 | 41 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | SizegripTest | SizegripTest | 1,853 | 1,861 | 1,853 | 1,854 | afb149606a1fe53b950e90a7354f47ee5944d984 | bigcode/the-stack | train |
0c3d81b283484b90d01192d6 | train | class | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class ComboboxTest(EntryTest, unittest.TestCase):
OPTIONS = (
'background', 'class', 'cursor', 'exportselection',
'font', 'foreground', 'height', 'invalidcommand',
'justify', 'postcommand', 'show', 'state', 'style',
'ta... | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class ComboboxTest(EntryTest, unittest.TestCase):
| OPTIONS = (
'background', 'class', 'cursor', 'exportselection',
'font', 'foreground', 'height', 'invalidcommand',
'justify', 'postcommand', 'show', 'state', 'style',
'takefocus', 'textvariable',
'validate', 'validatecommand', 'values',
'width', 'xscrollcommand',
)... | = 'key'
self.entry['validatecommand'] = self.entry.register(validate), '%S'
self.entry.insert('end', 1)
self.entry.insert('end', 'a')
self.assertEqual(validation, [False, True])
self.assertEqual(self.entry.get(), 'a')
def test_revalidation(self):
def validate(cont... | 255 | 256 | 1,046 | 26 | 229 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | ComboboxTest | ComboboxTest | 414 | 537 | 414 | 415 | f5a3f67f1ed7a3dd9453375e78e0207678a94255 | bigcode/the-stack | train |
46dcf70fba04e6ddb0886259 | train | class | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class NotebookTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'cursor', 'height', 'padding', 'style', 'takefocus', 'width',
)
def setUp(self):
super().setUp()
self.nb = self.create(padding=0)
... | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class NotebookTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'cursor', 'height', 'padding', 'style', 'takefocus', 'width',
)
def setUp(self):
super().setUp()
self.nb = self.create(padding=0)
self.child1 = ttk.Label(self.root)
self.child2 = ttk.Label(self.root)
self.nb.add(self.child1, text='a')
... | '2i')
def test_maximum(self):
widget = self.create()
self.checkFloatParam(widget, 'maximum', 150.2, 77.7, 0, -10, conv=False)
def test_mode(self):
widget = self.create()
self.checkEnumParam(widget, 'mode', 'determinate', 'indeterminate')
def test_phase(self):
# XX... | 256 | 256 | 1,853 | 25 | 231 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | NotebookTest | NotebookTest | 904 | 1,110 | 904 | 905 | ea95877efe81c13e4615f99ee6b1ded0e8f4e83a | bigcode/the-stack | train |
b8f928190c01743eaf4b9cdf | train | class | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'cursor', 'height',
'orient', 'style', 'takefocus', 'width',
)
def setUp(self):
super().setUp()
self.paned = self.create()
... | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'cursor', 'height',
'orient', 'style', 'takefocus', 'width',
)
def setUp(self):
super().setUp()
self.paned = self.create()
def create(self, **kwargs):
return ttk.PanedWindow(self.root, **kwargs)
def test_orient(self):
widget = s... | ('a b', 'a\tb', 'a\nb') if self.wantobjects else
'{a b} {a\tb} {a\nb}')
# testing values with special characters
self.combo['values'] = [r'a\tb', '"a"', '} {']
self.assertEqual(self.combo['values'],
(r'a\tb', '"a"', '} {') if self.wantobjects e... | 256 | 256 | 1,275 | 27 | 229 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | PanedWindowTest | PanedWindowTest | 540 | 671 | 540 | 541 | fa8901fed029d5c29714441b7fed48f2c2bf6ecf | bigcode/the-stack | train |
236041cebc84c5493564c505 | train | class | @add_standard_options(StandardTtkOptionsTests)
class CheckbuttonTest(AbstractLabelTest, unittest.TestCase):
OPTIONS = (
'class', 'command', 'compound', 'cursor',
'image',
'offvalue', 'onvalue',
'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underli... | @add_standard_options(StandardTtkOptionsTests)
class CheckbuttonTest(AbstractLabelTest, unittest.TestCase):
| OPTIONS = (
'class', 'command', 'compound', 'cursor',
'image',
'offvalue', 'onvalue',
'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'variable', 'width',
)
def create(self, **kwargs):
return ttk.Checkbutton(self.root, *... | ', 'width',
)
def create(self, **kwargs):
return ttk.Button(self.root, **kwargs)
def test_default(self):
widget = self.create()
self.checkEnumParam(widget, 'default', 'normal', 'active', 'disabled')
def test_invoke(self):
success = []
btn = ttk.Button(self.root... | 114 | 114 | 381 | 22 | 92 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | CheckbuttonTest | CheckbuttonTest | 229 | 275 | 229 | 230 | 69b17c0de22225e2ca503fbc1b2f44104f1d3fb9 | bigcode/the-stack | train |
136e7728cf900ad7e18a1d7d | train | class | @add_standard_options(StandardTtkOptionsTests)
class RadiobuttonTest(AbstractLabelTest, unittest.TestCase):
OPTIONS = (
'class', 'command', 'compound', 'cursor',
'image',
'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'value', 'variable', 'widt... | @add_standard_options(StandardTtkOptionsTests)
class RadiobuttonTest(AbstractLabelTest, unittest.TestCase):
| OPTIONS = (
'class', 'command', 'compound', 'cursor',
'image',
'padding', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'value', 'variable', 'width',
)
def create(self, **kwargs):
return ttk.Radiobutton(self.root, **kwargs)
def test... | 2)
self.assertRaises(tkinter.TclError, self.paned.sashpos, 1)
self.paned.pack(expand=True, fill='both')
curr_pos = self.paned.sashpos(0)
self.paned.sashpos(0, 1000)
self.assertNotEqual(curr_pos, self.paned.sashpos(0))
self.assertIsInstance(self.paned.sashpos(0), int)
@a... | 118 | 118 | 396 | 22 | 96 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | RadiobuttonTest | RadiobuttonTest | 674 | 723 | 674 | 675 | 3e9d248607d82103ecc30e0a2a61b65ca6d9a8bf | bigcode/the-stack | train |
26c18f1902d0c449df6071cc | train | class | class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
def test_frame(self):
self._test_widget(ttk.Frame)
def test_label(self):
self._test_widget(ttk.Label)
| class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
| def test_frame(self):
self._test_widget(ttk.Frame)
def test_label(self):
self._test_widget(ttk.Label)
| , unittest.TestCase):
OPTIONS = (
'class', 'cursor', 'style', 'takefocus',
# 'state'?
)
def create(self, **kwargs):
return ttk.Sizegrip(self.root, **kwargs)
class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
| 64 | 64 | 43 | 13 | 51 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | DefaultRootTest | DefaultRootTest | 1,864 | 1,870 | 1,864 | 1,865 | ad4ce5f3a1fcc96409547182e6b5d301c67dde71 | bigcode/the-stack | train |
190e7d8b5451efc5a1e6c514 | train | class | class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
_conv_pixels = noconv
| class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTests):
| _conv_pixels = noconv
| change its state
self.assertEqual(currstate, self.widget.state())
# ensuring that passing None as state doesn't modify current state
self.widget.state(['active', '!disabled'])
self.assertEqual(self.widget.state(), ('active', ))
class AbstractToplevelTest(AbstractWidgetTest, PixelSizeTe... | 63 | 64 | 22 | 13 | 50 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | AbstractToplevelTest | AbstractToplevelTest | 114 | 115 | 114 | 114 | c0729072afe4f98113d4b03b2832fef2826da254 | bigcode/the-stack | train |
9b8b327b31316d4304c5360a | train | class | @add_standard_options(StandardTtkOptionsTests)
class ScaleTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'command', 'cursor', 'from', 'length',
'orient', 'style', 'takefocus', 'to', 'value', 'variable',
)
_conv_pixels = noconv
default_orient = 'horizontal'
def set... | @add_standard_options(StandardTtkOptionsTests)
class ScaleTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'command', 'cursor', 'from', 'length',
'orient', 'style', 'takefocus', 'to', 'value', 'variable',
)
_conv_pixels = noconv
default_orient = 'horizontal'
def setUp(self):
super().setUp()
self.scale = self.create()
self.scale.pack()
... | ), '')
self.assertLessEqual(len(success), 1)
self.assertEqual(conv(cbtn2['value']), myvar.get())
self.assertEqual(myvar.get(),
conv(cbtn.tk.globalgetvar(cbtn['variable'])))
self.assertEqual(str(cbtn['variable']), str(cbtn2['variable']))
class MenubuttonTest(AbstractLabelTe... | 256 | 256 | 881 | 21 | 235 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | ScaleTest | ScaleTest | 749 | 853 | 749 | 750 | 9d5f0d7ca7c5f2522a74e1a83517bf8c58c52bdc | bigcode/the-stack | train |
7d70d618dbd0eb84e80fbc2f | train | class | @add_standard_options(StandardTtkOptionsTests)
class ProgressbarTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'cursor', 'orient', 'length',
'mode', 'maximum', 'phase',
'style', 'takefocus', 'value', 'variable',
)
_conv_pixels = noconv
default_orient = 'horizon... | @add_standard_options(StandardTtkOptionsTests)
class ProgressbarTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'cursor', 'orient', 'length',
'mode', 'maximum', 'phase',
'style', 'takefocus', 'value', 'variable',
)
_conv_pixels = noconv
default_orient = 'horizontal'
def create(self, **kwargs):
return ttk.Progressbar(self.root, **kwargs)
def test_lengt... | to the current range
self.assertEqual(conv(self.scale.get(0, 0)), min)
self.assertEqual(conv(self.scale.get(self.scale.winfo_width(), 0)), max)
self.assertRaises(tkinter.TclError, self.scale.set, None)
@add_standard_options(StandardTtkOptionsTests)
class ProgressbarTest(AbstractWidgetTest, uni... | 79 | 79 | 264 | 22 | 57 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | ProgressbarTest | ProgressbarTest | 856 | 888 | 856 | 857 | 1880c008dc31965bc73b44adc58d256eaa2bbd2f | bigcode/the-stack | train |
57c40bf9e25e0bde7420a8e4 | train | class | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class SpinboxTest(EntryTest, unittest.TestCase):
OPTIONS = (
'background', 'class', 'command', 'cursor', 'exportselection',
'font', 'foreground', 'format', 'from', 'increment',
'invalidcommand', 'justify', 'show', 'state', 'st... | @add_standard_options(IntegerSizeTests, StandardTtkOptionsTests)
class SpinboxTest(EntryTest, unittest.TestCase):
| OPTIONS = (
'background', 'class', 'command', 'cursor', 'exportselection',
'font', 'foreground', 'format', 'from', 'increment',
'invalidcommand', 'justify', 'show', 'state', 'style',
'takefocus', 'textvariable', 'to', 'validate', 'validatecommand',
'values', 'width', 'wrap',... | ()
self.nb.select(0)
self.assertEqual(self.nb.identify(5, 5), 'focus')
simulate_mouse_click(self.nb, 5, 5)
self.nb.focus_force()
self.nb.event_generate('<Control-Tab>')
self.assertEqual(self.nb.select(), str(self.child2))
self.nb.focus_force()
self.nb.ev... | 256 | 256 | 1,456 | 26 | 230 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | SpinboxTest | SpinboxTest | 1,112 | 1,284 | 1,112 | 1,113 | f6e6e328cbeb86d755d84ffba57afe8a68ea54e1 | bigcode/the-stack | train |
f26ea10a52ea1bfc06e1053e | train | class | class StandardTtkOptionsTests(StandardOptionsTests):
def test_class(self):
widget = self.create()
self.assertEqual(widget['class'], '')
errmsg='attempt to change read-only option'
if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
errmsg='Attempt to change read-only option'
... | class StandardTtkOptionsTests(StandardOptionsTests):
| def test_class(self):
widget = self.create()
self.assertEqual(widget['class'], '')
errmsg='attempt to change read-only option'
if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
errmsg='Attempt to change read-only option'
self.checkInvalidParam(widget, 'class', 'Foo',... | import unittest
import tkinter
from tkinter import ttk, TclError
from test.support import requires
import sys
from tkinter.test.test_ttk.test_functions import MockTclObj
from tkinter.test.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
simulate_mouse_click, AbstractDef... | 118 | 119 | 397 | 10 | 108 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | StandardTtkOptionsTests | StandardTtkOptionsTests | 17 | 53 | 17 | 18 | d460ec6dfc0d0038a0d27e0a6f1e4170d7ae004f | bigcode/the-stack | train |
3c0faed04320cdb0dfc9d6ee | train | class | @add_standard_options(StandardTtkOptionsTests)
class LabelFrameTest(AbstractToplevelTest, unittest.TestCase):
OPTIONS = (
'borderwidth', 'class', 'cursor', 'height',
'labelanchor', 'labelwidget',
'padding', 'relief', 'style', 'takefocus',
'text', 'underline', 'width',
)
def ... | @add_standard_options(StandardTtkOptionsTests)
class LabelFrameTest(AbstractToplevelTest, unittest.TestCase):
| OPTIONS = (
'borderwidth', 'class', 'cursor', 'height',
'labelanchor', 'labelwidget',
'padding', 'relief', 'style', 'takefocus',
'text', 'underline', 'width',
)
def create(self, **kwargs):
return ttk.LabelFrame(self.root, **kwargs)
def test_labelanchor(self):
... | ', 'cursor', 'height',
'padding', 'relief', 'style', 'takefocus',
'width',
)
def create(self, **kwargs):
return ttk.Frame(self.root, **kwargs)
@add_standard_options(StandardTtkOptionsTests)
class LabelFrameTest(AbstractToplevelTest, unittest.TestCase):
| 69 | 69 | 230 | 23 | 46 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | LabelFrameTest | LabelFrameTest | 130 | 153 | 130 | 131 | 6a8a234fa9ca0e92c007401355d06da1f7ba3c95 | bigcode/the-stack | train |
00c4df76ad7691ba2b28b850 | train | class | class AbstractLabelTest(AbstractWidgetTest):
def checkImageParam(self, widget, name):
image = tkinter.PhotoImage(master=self.root, name='image1')
image2 = tkinter.PhotoImage(master=self.root, name='image2')
self.checkParam(widget, name, image, expected=('image1',))
self.checkParam(w... | class AbstractLabelTest(AbstractWidgetTest):
| def checkImageParam(self, widget, name):
image = tkinter.PhotoImage(master=self.root, name='image1')
image2 = tkinter.PhotoImage(master=self.root, name='image2')
self.checkParam(widget, name, image, expected=('image1',))
self.checkParam(widget, name, 'image1', expected=('image1',))
... | 'wn', 'ws',
errmsg='Bad label anchor specification {}')
self.checkInvalidParam(widget, 'labelanchor', 'center')
def test_labelwidget(self):
widget = self.create()
label = ttk.Label(self.root, text='Mupp', name='foo')
self.checkParam(widget, 'labelwidget', label, exp... | 87 | 87 | 292 | 8 | 79 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | AbstractLabelTest | AbstractLabelTest | 156 | 183 | 156 | 157 | 122b29d777e6b438f4ac0fdac237c594123855d1 | bigcode/the-stack | train |
5ba1c02cbc491ce6ce5fb022 | train | class | @unittest.skipIf(sys.platform == 'darwin',
'ttk.Scrollbar is special on MacOSX')
@add_standard_options(StandardTtkOptionsTests)
class ScrollbarTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'command', 'cursor', 'orient', 'style', 'takefocus',
)
default_orient = 'v... | @unittest.skipIf(sys.platform == 'darwin',
'ttk.Scrollbar is special on MacOSX')
@add_standard_options(StandardTtkOptionsTests)
class ScrollbarTest(AbstractWidgetTest, unittest.TestCase):
| OPTIONS = (
'class', 'command', 'cursor', 'orient', 'style', 'takefocus',
)
default_orient = 'vertical'
def create(self, **kwargs):
return ttk.Scrollbar(self.root, **kwargs)
| 2, 77.7, 0, -10,
conv=False)
@unittest.skipIf(sys.platform == 'darwin',
'ttk.Scrollbar is special on MacOSX')
@add_standard_options(StandardTtkOptionsTests)
class ScrollbarTest(AbstractWidgetTest, unittest.TestCase):
| 64 | 64 | 100 | 47 | 17 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | ScrollbarTest | ScrollbarTest | 891 | 901 | 891 | 894 | dee6ffee204ebd7d7c57a65280f6d5502d43ad51 | bigcode/the-stack | train |
e7b775c48e33416b767041c6 | train | class | @add_standard_options(StandardTtkOptionsTests)
class LabelTest(AbstractLabelTest, unittest.TestCase):
OPTIONS = (
'anchor', 'background', 'borderwidth',
'class', 'compound', 'cursor', 'font', 'foreground',
'image', 'justify', 'padding', 'relief', 'state', 'style',
'takefocus', 'text'... | @add_standard_options(StandardTtkOptionsTests)
class LabelTest(AbstractLabelTest, unittest.TestCase):
| OPTIONS = (
'anchor', 'background', 'borderwidth',
'class', 'compound', 'cursor', 'font', 'foreground',
'image', 'justify', 'padding', 'relief', 'state', 'style',
'takefocus', 'text', 'textvariable',
'underline', 'width', 'wraplength',
)
_conv_pixels = noconv
def... | , 'state', 'active', 'disabled', 'normal')
def test_width(self):
widget = self.create()
self.checkParams(widget, 'width', 402, -402, 0)
@add_standard_options(StandardTtkOptionsTests)
class LabelTest(AbstractLabelTest, unittest.TestCase):
| 64 | 64 | 166 | 21 | 43 | Kshitijkrishnadas/haribol | Lib/tkinter/test/test_ttk/test_widgets.py | Python | LabelTest | LabelTest | 186 | 203 | 186 | 187 | 0f2f4cd5ca08b4eff785a30234806172e802d6e4 | bigcode/the-stack | train |
6b6a7434ccf4995d53e42ef7 | train | function | def Fibonacci(n):
n1 = 0
n2 = 1
c = 0
ans = []
if n == 1:
ans = n1
else:
while c < n:
ans.append(n1)
nth = n1 + n2
n1 = n2
n2 = nth
c += 1
print(f"fibonacci sequence upto {n} terms ", end=': ')
for a in ans:
... | def Fibonacci(n):
| n1 = 0
n2 = 1
c = 0
ans = []
if n == 1:
ans = n1
else:
while c < n:
ans.append(n1)
nth = n1 + n2
n1 = n2
n2 = nth
c += 1
print(f"fibonacci sequence upto {n} terms ", end=': ')
for a in ans:
print(a, end =... | ########################## Code By - ORASHAR ###########################
########################## Fibonacci Sequence ###########################
def Fibonacci(n):
| 25 | 64 | 115 | 4 | 21 | man21/IOSD-UIETKUK-HacktoberFest-Meetup-2019 | Beginner/fibonacciSequence.py | Python | Fibonacci | Fibonacci | 4 | 20 | 4 | 4 | 46497f8fd91ff2d748ecc2bda66189f35bfd0038 | bigcode/the-stack | train |
fec78db6725aa8858b54ec4b | train | class | class AddTrackToPlayQueue_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and ... | class AddTrackToPlayQueue_result(object):
| """
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddTrackToPlayQueue_args)
Ad... | 168 | 168 | 561 | 9 | 159 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToPlayQueue_result | AddTrackToPlayQueue_result | 4,212 | 4,279 | 4,212 | 4,212 | 9c6f4dc4e7b54fd118dce542304e7c9456c1d5c2 | bigcode/the-stack | train |
69dc337a66b8ade764c4b65b | train | class | class GetTrackByLibraryId_args(object):
"""
Attributes:
- idLibrary
"""
def __init__(self, idLibrary=None,):
self.idLibrary = idLibrary
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is... | class GetTrackByLibraryId_args(object):
| """
Attributes:
- idLibrary
"""
def __init__(self, idLibrary=None,):
self.idLibrary = idLibrary
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decod... | _result.thrift_spec = (
(0, TType.LIST, 'success', (TType.STRUCT, [SpotifakeManagement.ttypes.Track, None], False), None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErr... | 130 | 130 | 434 | 9 | 121 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByLibraryId_args | GetTrackByLibraryId_args | 2,345 | 2,399 | 2,345 | 2,345 | d0f23c96d06668674352d25a996565c69b4421fb | bigcode/the-stack | train |
140e4f560f1d0b5f773f6627 | train | class | class Client(Iface):
def __init__(self, iprot, oprot=None):
self._iprot = self._oprot = iprot
if oprot is not None:
self._oprot = oprot
self._seqid = 0
def GetTrackByTitle(self, title):
"""
Get Track by Title
@param title
The Track Title ... | class Client(Iface):
| def __init__(self, iprot, oprot=None):
self._iprot = self._oprot = iprot
if oprot is not None:
self._oprot = oprot
self._seqid = 0
def GetTrackByTitle(self, title):
"""
Get Track by Title
@param title
The Track Title to be obtained
... | Queue Id which a track will be deleted.
@param trackNumber
The Track number which will be deleted
@return Id
The Track Id of the Track deleted.
Parameters:
- idPlayQueu
- trackNumber
"""
pass
def GenerateRadioStation(self, idGen... | 256 | 256 | 6,596 | 5 | 250 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | Client | Client | 387 | 1,292 | 387 | 387 | ea4904037f70428e36524a71fa2023bd6b62ebe6 | bigcode/the-stack | train |
a678ca5e9abe3b026a633f2f | train | class | class GetTrackByAlbumId_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE ... | class GetTrackByAlbumId_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | TrackByAlbumId_args')
if self.idAlbum is not None:
oprot.writeFieldBegin('idAlbum', TType.I16, 1)
oprot.writeI16(self.idAlbum)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
... | 233 | 233 | 778 | 9 | 224 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByAlbumId_result | GetTrackByAlbumId_result | 2,091 | 2,178 | 2,091 | 2,091 | fa1083dc237af44fffe9d92dca571feba5a1a6f9 | bigcode/the-stack | train |
2b7de4046b9d135a8f59a513 | train | class | class DeletePlayQueueTrack_args(object):
"""
Attributes:
- idPlayQueu
- trackNumber
"""
def __init__(self, idPlayQueu=None, trackNumber=None,):
self.idPlayQueu = idPlayQueu
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None a... | class DeletePlayQueueTrack_args(object):
| """
Attributes:
- idPlayQueu
- trackNumber
"""
def __init__(self, idPlayQueu=None, trackNumber=None,):
self.idPlayQueu = idPlayQueu
self.trackNumber = trackNumber
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CRe... | ()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddTrackToPlayQueue_result)
AddTrackToPlayQueue_res... | 164 | 164 | 547 | 8 | 156 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeletePlayQueueTrack_args | DeletePlayQueueTrack_args | 4,287 | 4,352 | 4,287 | 4,287 | d4c58ad586ff7910864adc4025c3739f6d82a90b | bigcode/the-stack | train |
eaa2b36b3a8be85e781ea0de | train | class | class AddTrackToPlayQueue_args(object):
"""
Attributes:
- idPlayQueu
- newTrack
"""
def __init__(self, idPlayQueu=None, newTrack=None,):
self.idPlayQueu = idPlayQueu
self.newTrack = newTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance... | class AddTrackToPlayQueue_args(object):
| """
Attributes:
- idPlayQueu
- newTrack
"""
def __init__(self, idPlayQueu=None, newTrack=None,):
self.idPlayQueu = idPlayQueu
self.newTrack = newTrack
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransp... | eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(DeletePlaylistTrack_result)
DeletePlaylistTrack_result.thrift_spec = (
(0, TType.I16, 'success', None, None, ), # 0
(1, TTy... | 167 | 167 | 557 | 9 | 158 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToPlayQueue_args | AddTrackToPlayQueue_args | 4,137 | 4,203 | 4,137 | 4,137 | bad6ed47754f5e09f8cd375ab0f48ccb10d1f277 | bigcode/the-stack | train |
20a28ce62ece0931c140220e | train | class | class DeletePlaylistTrack_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystem... | class DeletePlaylistTrack_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq_... | 206 | 206 | 688 | 7 | 199 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeletePlaylistTrack_result | DeletePlaylistTrack_result | 4,050 | 4,128 | 4,050 | 4,050 | 04add31d1e47268b5c47f6fc80072b4239e1ddb6 | bigcode/the-stack | train |
88c4dcd6467b3f0cfcc44f5a | train | class | class AddTrackToAlbum_args(object):
"""
Attributes:
- idAlbum
- newTrack
- idContentCreator
"""
def __init__(self, idAlbum=None, newTrack=None, idContentCreator=None,):
self.idAlbum = idAlbum
self.newTrack = newTrack
self.idContentCreator = idContentCreator
... | class AddTrackToAlbum_args(object):
| """
Attributes:
- idAlbum
- newTrack
- idContentCreator
"""
def __init__(self, idAlbum=None, newTrack=None, idContentCreator=None,):
self.idAlbum = idAlbum
self.newTrack = newTrack
self.idContentCreator = idContentCreator
def read(self, iprot):
if i... | join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetTrackByLibraryId_result)
GetTrackByLibraryId_result.thrift_spec = (
(0, TType.LIST, 'success', (TType.STR... | 193 | 193 | 646 | 8 | 185 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | AddTrackToAlbum_args | AddTrackToAlbum_args | 2,503 | 2,580 | 2,503 | 2,503 | 2b49c678b419dd7826d016d3146ac85c04ca218a | bigcode/the-stack | train |
c1fb0ccb3bdb95e3d11b2677 | train | class | class GetTrackByAlbumId_args(object):
"""
Attributes:
- idAlbum
"""
def __init__(self, idAlbum=None,):
self.idAlbum = idAlbum
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:... | class GetTrackByAlbumId_args(object):
| """
Attributes:
- idAlbum
"""
def __init__(self, idAlbum=None,):
self.idAlbum = idAlbum
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, ... | ByTitle_result)
GetTrackByTitle_result.thrift_spec = (
(0, TType.STRUCT, 'success', [SpotifakeManagement.ttypes.Track, None], None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.t... | 130 | 130 | 434 | 9 | 121 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByAlbumId_args | GetTrackByAlbumId_args | 2,029 | 2,083 | 2,029 | 2,029 | 86ebf3b1d19d3d6af0b686afab410e02d2dc3823 | bigcode/the-stack | train |
dbe2cabe442a025548a2f1cd | train | class | class GenerateRadioStation_args(object):
"""
Attributes:
- idGender
"""
def __init__(self, idGender=None,):
self.idGender = idGender
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is no... | class GenerateRadioStation_args(object):
| """
Attributes:
- idGender
"""
def __init__(self, idGender=None,):
self.idGender = idGender
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(se... | self == other)
all_structs.append(DeletePlayQueueTrack_result)
DeletePlayQueueTrack_result.thrift_spec = (
(0, TType.I16, 'success', None, None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [Spotifak... | 129 | 129 | 430 | 7 | 122 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GenerateRadioStation_args | GenerateRadioStation_args | 4,448 | 4,502 | 4,448 | 4,448 | 5866ab714c5cc494b0a70ec0c72b1e7baa3bcb60 | bigcode/the-stack | train |
f704527c738a04a83eb8cd8a | train | class | class DeleteLibraryTrack_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE... | class DeleteLibraryTrack_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq_... | 206 | 206 | 688 | 7 | 199 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeleteLibraryTrack_result | DeleteLibraryTrack_result | 3,741 | 3,819 | 3,741 | 3,741 | 35bf5059cbc81276b7d152fff8d8ff3789d09171 | bigcode/the-stack | train |
cb5f540495eea587aadf8f4c | train | class | class DeletePlayQueueTrack_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSyste... | class DeletePlayQueueTrack_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | End()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
... | 207 | 207 | 690 | 8 | 199 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | DeletePlayQueueTrack_result | DeletePlayQueueTrack_result | 4,361 | 4,439 | 4,361 | 4,361 | a1e3d24f9b41eceee7a93dd94dd664c776a9d666 | bigcode/the-stack | train |
84f884cd9d5b8378d36c8ae7 | train | class | class GetTrackByTitle_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = ... | class GetTrackByTitle_result(object):
| """
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, ipro... | (self.title.encode('utf-8') if sys.version_info[0] == 2 else self.title)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items... | 209 | 209 | 697 | 8 | 201 | BrunoLujan/Spotifake-DESER | Thrift/gen-py/SpotifakeServices/TrackService.py | Python | GetTrackByTitle_result | GetTrackByTitle_result | 1,941 | 2,020 | 1,941 | 1,941 | 7c3251d813d9aa2e6cb24c756b990a7512b70fb6 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.