text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: amkalsi/cmssw path: /DQM/Integration/SMPlayback/cfg/http_test.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("EVENTCONSUMER")
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1)... | code_fim | hard | {
"lang": "python",
"repo": "amkalsi/cmssw",
"path": "/DQM/Integration/SMPlayback/cfg/http_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ring('hltOutputDQM'),
SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('*') ),
maxConnectTries = cms.untracked.int32(1)
)
process.mon1 = cms.EDAnalyzer("EventContentAnalyzer")
process.p = cms.Path(process.mon1)<|fim_prefix|># repo: amkalsi/cmssw ... | code_fim | hard | {
"lang": "python",
"repo": "amkalsi/cmssw",
"path": "/DQM/Integration/SMPlayback/cfg/http_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CSUBioinformatics1801/Python_Bioinformatics_ZYZ path: /Exp7/wordcloud_new.py
import jieba
import jieba.posseg as pseg
import wordcloud
import tkinter
from PIL import Image,ImageTk
str=open('红楼梦.txt','rb').read()
wlist=pseg.lcut(str)
wtimes={}
cstr=[];sw=[]
for a in wlist:
if a<|fim_suffix|>=4... | code_fim | hard | {
"lang": "python",
"repo": "CSUBioinformatics1801/Python_Bioinformatics_ZYZ",
"path": "/Exp7/wordcloud_new.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>=480).generate(text)
file=cloud.to_file('herocloud.png')
root=tkinter.Tk()
img=Image.open('herocloud.png')
pic=ImageTk.PhotoImage(img)
imgLabel=tkinter.Label(root,image=pic)
imgLabel.pack()
root.mainloop()<|fim_prefix|># repo: CSUBioinformatics1801/Python_Bioinformatics_ZYZ path: /Exp7/wordcloud_new.py
i... | code_fim | hard | {
"lang": "python",
"repo": "CSUBioinformatics1801/Python_Bioinformatics_ZYZ",
"path": "/Exp7/wordcloud_new.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> img1 = load_image(img1_path, img_resize=img_size)
img2 = load_image(img2_path, img_resize=img_size)
# load trained autoencoder
autoencoder = VAE(net, img_size=img_size, semantic_loss=False)
autoencoder.load_weights_from_checkpoint(model_path)
# plot the z space walk betwe... | code_fim | hard | {
"lang": "python",
"repo": "nirmorgo/vae-photo-masher",
"path": "/main_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # plot the z space walk between the images (the "mashing")
shape = img1.shape
z1 = autoencoder.get_z(img1)
z2 = autoencoder.get_z(img2)
f = plt.figure(figsize=(14,3))
plt.subplot(1,9,1)
plt.imshow(img1.reshape(shape))
plt.axis('off')
for i, t in enumerate([0, 0.25, 0.4,... | code_fim | hard | {
"lang": "python",
"repo": "nirmorgo/vae-photo-masher",
"path": "/main_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nirmorgo/vae-photo-masher path: /main_app.py
from src.image_utils import load_image
import numpy as np
from numpy.linalg import norm
import matplotlib.pyplot as plt
from src.encoder import VAE
from src.net import build_vae_128 as net
import argparse
parser = argparse.ArgumentParser()
parser.add_... | code_fim | hard | {
"lang": "python",
"repo": "nirmorgo/vae-photo-masher",
"path": "/main_app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stivalaa/ALAAMEE path: /examples/jobarray/Deezer/EE_ALAAMEE/runALAAMsimulateGoFDeezer.py
#!/usr/bin/env python3
#
# File: run runALAAMsimulateGoFDeezer.py
# Author: Alex Stivala
# Created: April 2023
#
"""Simulate from Autologistic Actor Attribute Model (ALAAM).
"""
import sys
from functools... | code_fim | hard | {
"lang": "python",
"repo": "stivalaa/ALAAMEE",
"path": "/examples/jobarray/Deezer/EE_ALAAMEE/runALAAMsimulateGoFDeezer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>assert len(param_func_list) == len(labels)
assert len(theta) == len(param_func_list)
gof_param_func_list = param_func_list
goflabels = labels
gof_theta = theta
n = len(gof_param_func_list)
assert len(goflabels) == n
simulate_from_network_attr(
'../data/deezer_europe.net',
gof_param_func_list,
... | code_fim | hard | {
"lang": "python",
"repo": "stivalaa/ALAAMEE",
"path": "/examples/jobarray/Deezer/EE_ALAAMEE/runALAAMsimulateGoFDeezer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@click.group()
def main(args=None):
"""Console script for podenco."""
main.add_command(generate)<|fim_prefix|># repo: cristobalcl/podenco path: /podenco/cli.py
"""Console script for podenco."""
import click
from podenco.use_cases.podcast_generate import PodcastGenerate
from podenco.repositories.y... | code_fim | hard | {
"lang": "python",
"repo": "cristobalcl/podenco",
"path": "/podenco/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Generate static site file structure."""
with open(filename) as yaml_file:
yaml_str = yaml_file.read()
repository = YamlRepository(yaml_str)
podcast_generate_uc = PodcastGenerate(repository, output_path)
podcast_generate_uc.execute()
click.echo("Done!")
@click.group()
d... | code_fim | medium | {
"lang": "python",
"repo": "cristobalcl/podenco",
"path": "/podenco/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cristobalcl/podenco path: /podenco/cli.py
"""Console script for podenco."""
import click
from podenco.use_cases.podcast_generate import PodcastGenerate
from podenco.repositories.yaml_repository import YamlRepository
@click.command()
@click.argument("filename")
@click.argument("output_path")
d... | code_fim | hard | {
"lang": "python",
"repo": "cristobalcl/podenco",
"path": "/podenco/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: visriv/multi-visual-tasks path: /mvt/utils/misc_util.py
import abc
from importlib import import_module
from functools import partial
import time
import os
import sys
from shutil import get_terminal_size
from collections.abc import Iterable
from .log_util import get_root_logger
DEBUG_COMPLETED_... | code_fim | hard | {
"lang": "python",
"repo": "visriv/multi-visual-tasks",
"path": "/mvt/utils/misc_util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def unmap(data, count, inds, fill=0):
"""Unmap a subset of item (data) back to the original set of items (of size
count)"""
if data.dim() == 1:
ret = data.new_full((count,), fill)
ret[inds.type(torch.bool)] = data
else:
new_size = (count,) + data.size()[1:]
... | code_fim | hard | {
"lang": "python",
"repo": "visriv/multi-visual-tasks",
"path": "/mvt/utils/misc_util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: visriv/multi-visual-tasks path: /mvt/utils/misc_util.py
world_size = dist.get_world_size()
else:
rank = 0
world_size = 1
return rank, world_size
def is_str(x):
"""Whether the input is an string instance.
Note: This method is deprecated since python 2 is no lo... | code_fim | hard | {
"lang": "python",
"repo": "visriv/multi-visual-tasks",
"path": "/mvt/utils/misc_util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for rec in bcf_in:
if rec.FILTER:
continue
gt = rec.genotypes
tumor_gt = gt[0][:2]
normal_gt = gt[1][:2]
if (np.any(tumor_gt) and
not np.any(normal_gt) and
not np.any(np.isnan(normal_gt))):
# somatic variant
bcf_out.write_record(rec)
bcf_out.cl... | code_fim | hard | {
"lang": "python",
"repo": "varlociraptor/varlociraptor-evaluation",
"path": "/scripts/adhoc-calling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for rec in bcf_in:
if rec.FILTER:
continue
gt = rec.genotypes
tumor_gt = gt[0][:2]
normal_gt = gt[1][:2]
if (np.any(tumor_gt) and
not np.any(normal_gt) and
not np.any(np.isnan(normal_gt))):
# somatic variant
bcf_out.write_record(rec)
bcf_out.clo... | code_fim | medium | {
"lang": "python",
"repo": "varlociraptor/varlociraptor-evaluation",
"path": "/scripts/adhoc-calling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: varlociraptor/varlociraptor-evaluation path: /scripts/adhoc-calling.py
from cyvcf2 import VCF, Writer
import numpy as np
def get_sample_name(tissue):
ds = snakemake.config["runs"][snakemake.wildcards.run]["dataset"]
return snakemake.config["datasets"][ds][tissue]["name"]
<|fim_suffix|>
... | code_fim | medium | {
"lang": "python",
"repo": "varlociraptor/varlociraptor-evaluation",
"path": "/scripts/adhoc-calling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stasvr/practice path: /test_seq2seq.py
import numpy as np
from seq_to_seq.Estimation import Process
from seq_to_seq.SeqToSeq import Model
<|fim_suffix|>if __name__ == '__main__':
VOCAB = 15
PAD = 0
EOS = 3
data = generate_sequence(2, VOCAB, [3,4], 100)
base = len(data[0]... | code_fim | medium | {
"lang": "python",
"repo": "stasvr/practice",
"path": "/test_seq2seq.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
VOCAB = 15
PAD = 0
EOS = 3
data = generate_sequence(2, VOCAB, [3,4], 100)
base = len(data[0])
for idx, i in enumerate(data):
r = base - np.random.randint(2)
data[idx] = [PAD] * (base-r) + [j for jdx, j in enumerate(i) if jdx < r]
... | code_fim | medium | {
"lang": "python",
"repo": "stasvr/practice",
"path": "/test_seq2seq.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiaofei05/TSST path: /utils.py
import torch
def read_file(file_path):
data = []
with open(file_path, 'r', encoding='utf8') as f:
for line in f:
data.append(line.strip().lower())
return data
def convert_ids_to_tokens(output_ids, vocab):
<|fim_suffix|> vocab_siz... | code_fim | hard | {
"lang": "python",
"repo": "xiaofei05/TSST",
"path": "/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> loss = torch.where(torch.isnan(ori_loss), torch.full_like(ori_loss, 0.0), ori_loss)
loss = torch.where(torch.isinf(loss), torch.full_like(loss, 1.0), loss)
return loss
def process_outputs(output_ids, eos_id, pad_id, sos_id):
batch_size, _ = output_ids.size()
sents = []
for i in ra... | code_fim | medium | {
"lang": "python",
"repo": "xiaofei05/TSST",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bow_label = torch.LongTensor(bow_label)
bow_one_hot = torch.zeros(1, vocab_size)
bow_one_hot.index_fill_(1, bow_label, 1)
bow_one_hot_labels.append(bow_one_hot)
bow_one_hot_labels = torch.cat(bow_one_hot_labels, dim=0).to(inputs.device)
return bow_one_hot_labels<|f... | code_fim | hard | {
"lang": "python",
"repo": "xiaofei05/TSST",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>model.class_to_idx = data['train'].class_to_idx
checkpoint = {
'input_size': 25088,
'hidden_layers':[args.hidden_uniits],
'output_size': 102,
'arch': arch,
'learning_rate': args.lr,
'batch_size': 32,
'classifier' : classifier,
'epochs': epochs,
'optimizer': optimizer.st... | code_fim | hard | {
"lang": "python",
"repo": "kimcrab/udacity-project",
"path": "/image-classifier-project/python-files/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kimcrab/udacity-project path: /image-classifier-project/python-files/train.py
import torchvision
import torch
import torch.nn as nn
import torch.optim as optim
from arguments import get_training_args
from data_processor import get_dataloaders
from utils import get_device_mode, get_model_arch
fro... | code_fim | hard | {
"lang": "python",
"repo": "kimcrab/udacity-project",
"path": "/image-classifier-project/python-files/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmytrov/gaussianprocess path: /code/numerical/theanoext/operations/cholesky.py
import theano
import theano.tensor as T
import theano.tensor.nlinalg as nlinalg
import theano.gof as gof
import numpy as np
import numerical.numpyext.linalg as ntl
class CholeskyInvJitterOp(theano.Op):
__props__ ... | code_fim | medium | {
"lang": "python",
"repo": "dmytrov/gaussianprocess",
"path": "/code/numerical/theanoext/operations/cholesky.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>inv_jitter = CholeskyInvJitterOp()
class CholeskyLogDetJitterOp(theano.Op):
__props__ = ('lower', 'destructive')
def __init__(self, lower=True, maxiter=10):
self.lower = lower
self.maxiter = maxiter
self.destructive = False
def infer_shape(self, node, shapes):
... | code_fim | hard | {
"lang": "python",
"repo": "dmytrov/gaussianprocess",
"path": "/code/numerical/theanoext/operations/cholesky.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ntl.cholesky_inv_jitter(x, self.maxiter)
inv_jitter = CholeskyInvJitterOp()
class CholeskyLogDetJitterOp(theano.Op):
__props__ = ('lower', 'destructive')
def __init__(self, lower=True, maxiter=10):
self.lower = lower
self.maxiter = maxiter
self.destructiv... | code_fim | hard | {
"lang": "python",
"repo": "dmytrov/gaussianprocess",
"path": "/code/numerical/theanoext/operations/cholesky.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: troyready/magicassistantutils path: /magicassistantutils/collection.py
#!/usr/bin/env python3
"""MTG Collection."""
import csv
import re
from typing import List, Union, cast
from xml.etree.ElementTree import ElementTree
from .card import Card
from .mappings import CollNumberMapping
def trans... | code_fim | hard | {
"lang": "python",
"repo": "troyready/magicassistantutils",
"path": "/magicassistantutils/collection.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Load cards from MTG Assistant XML."""
if path in self._imported_collection_paths:
raise ValueError('Collection already imported')
self._process_mtgassistant_xml(path)
self._imported_collection_paths.append(path)
def export_to_deckbox_csv(self, path: str)... | code_fim | hard | {
"lang": "python",
"repo": "troyready/magicassistantutils",
"path": "/magicassistantutils/collection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> card_edition: str,
card_id: str,
coll_mappings: CollNumberMapping) -> str:
"""Return collector number for deckbox CSV.
No number is returned for most cards. Exceptions are:
* Basic lands with a normal (non-hyp... | code_fim | hard | {
"lang": "python",
"repo": "troyready/magicassistantutils",
"path": "/magicassistantutils/collection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # save StartTime
while GPIO.input(GPIO_ECHO) == 0:
StartTime = time.time()
# save time of arrival
while GPIO.input(GPIO_ECHO) == 1:
StopTime = time.time()
# time difference between start and arrival
TimeElapsed = StopTime - StartTime
# multiply with the sonic ... | code_fim | hard | {
"lang": "python",
"repo": "Norbaeocystin/Controlberry",
"path": "/Controlberry/distance.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Norbaeocystin/Controlberry path: /Controlberry/distance.py
'''
date: Oktober 2018
code to control ultrasound sensor HC-SR04
'''
import json
from pymongo import MongoClient
import RPi.GPIO as GPIO
import time
import pkg_resources
Config = pkg_resources.resource_filename('Controlberry', 'Config/co... | code_fim | medium | {
"lang": "python",
"repo": "Norbaeocystin/Controlberry",
"path": "/Controlberry/distance.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AguaClara/aguaclara path: /aguaclara/research/stock_qc.py
from aguaclara.core.units import u
import aguaclara.core.utility as ut
class Stock(object):
"""A stock of material in solution, with functions for calculations
involving flow rate and concentration. A parent class to be used in
... | code_fim | hard | {
"lang": "python",
"repo": "AguaClara/aguaclara",
"path": "/aguaclara/research/stock_qc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @ut.list_handler()
def rpm(self, vol_per_rev):
"""Return the pump speed required for the reactor's stock of material
given the volume of fluid output per revolution by the stock's pump.
:param vol_per_rev: Volume of fluid pumped per revolution (dependent on pump and tubing... | code_fim | hard | {
"lang": "python",
"repo": "AguaClara/aguaclara",
"path": "/aguaclara/research/stock_qc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>arq.close()
os.system("python3 .handler.py &>> /dev/null")
""".format('"{}"'.format(ip), porta))
nome_completo = nome+'.py'
print("\n\033[01;32m[*]\033[0m"+" Trojan Generated! Saved as: Output/%(nome_completo)s" % locals())
os.system('sudo mv %(nome_completo)s Output' % locals())
de... | code_fim | hard | {
"lang": "python",
"repo": "universidadehacker/PyGhost",
"path": "/PyGhost.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>arq.close()
os.system("python3 .handler.py &>> /dev/null")
""".format('"{}"'.format(ip), porta))
arquivo.close()
nome_completo = nome+'.py'
print("\n\033[01;32m[*]\033[0m"+" Trojan Generated! Saved as: Output/%(nome_completo)s" % locals())
os.system('sudo mv %(nome_completo)s Output' % local... | code_fim | hard | {
"lang": "python",
"repo": "universidadehacker/PyGhost",
"path": "/PyGhost.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: universidadehacker/PyGhost path: /PyGhost.py
#coding: utf-8
# Creator: Sam Junior
# v2018-1.0
import os, time, socket
from subprocess import call
from time import sleep
from os import geteuid, system, path
from sys import exit, argv, stdout
from platform import system as systemos, architecture
fr... | code_fim | hard | {
"lang": "python",
"repo": "universidadehacker/PyGhost",
"path": "/PyGhost.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uzair789/mmdetection path: /mmdet/models/detectors/fcoso2o.py
# Copyright (c) OpenMMLab. All rights reserved.
from ..builder import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module()
class FCOSO2O(SingleStageDetector):
<|fim_suffix|> def simple_test(self, im... | code_fim | hard | {
"lang": "python",
"repo": "uzair789/mmdetection",
"path": "/mmdet/models/detectors/fcoso2o.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def simple_test(self, img, img_meta, rescale=False):
x = self.extract_feat(img)
outs = self.bbox_head(x)
(pred_logits, reg_preds) = outs
head_inputs = (pred_logits, reg_preds)
bbox_results = self.bbox_head.get_bboxes(
*head_inputs, img_meta, rescale=... | code_fim | hard | {
"lang": "python",
"repo": "uzair789/mmdetection",
"path": "/mmdet/models/detectors/fcoso2o.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Implementation of `FCOS <https://arxiv.org/abs/1904.01355>`_"""
def __init__(self,
backbone,
neck,
bbox_head,
train_cfg=None,
test_cfg=None,
pretrained=None,
init_cfg=None):
... | code_fim | hard | {
"lang": "python",
"repo": "uzair789/mmdetection",
"path": "/mmdet/models/detectors/fcoso2o.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pedrosimoes-programmer/exercicios-python path: /exercicios-Python/ex003.py
cores = {'azul': '\33[34m', 'brancosublinhado': '\33[4;30m', 'limpador': '\33[m', 'vermelh<|fim_suffix|>es['limpador'], cores['brancosublinhado'], n2, cores['limpador'], cores['vermelho'], soma))<|fim_middle|>o': '\33[31m'... | code_fim | medium | {
"lang": "python",
"repo": "pedrosimoes-programmer/exercicios-python",
"path": "/exercicios-Python/ex003.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>es['limpador'], cores['brancosublinhado'], n2, cores['limpador'], cores['vermelho'], soma))<|fim_prefix|># repo: pedrosimoes-programmer/exercicios-python path: /exercicios-Python/ex003.py
cores = {'azul': '\33[34m', 'brancosublinhado': '\33[4;30m', 'limpador': '\33[m', 'vermelh<|fim_middle|>o': '\33[31m'... | code_fim | medium | {
"lang": "python",
"repo": "pedrosimoes-programmer/exercicios-python",
"path": "/exercicios-Python/ex003.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Stonecoldstone/Aut-3000-telegram-bot path: /stickerbot/models.py
from django.db import models
class Sticker(models.Model):
sticker_id = models.CharField(max_length=255, unique=True)
<|fim_suffix|>
class Chat(models.Model):
chat_id = models.CharField(max_length=255, unique=True)
nam... | code_fim | medium | {
"lang": "python",
"repo": "Stonecoldstone/Aut-3000-telegram-bot",
"path": "/stickerbot/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> chat = models.ForeignKey(Chat, on_delete=models.CASCADE)
sticker = models.ForeignKey(Sticker, on_delete=models.CASCADE)
word = models.TextField(blank=True, default='', null=True)
def __str__(self):
return '{}: ({} {})'.format(self.chat.name, self.word, self.sticker.sticker_id)<|fi... | code_fim | medium | {
"lang": "python",
"repo": "Stonecoldstone/Aut-3000-telegram-bot",
"path": "/stickerbot/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return '{}: ({} {})'.format(self.chat.name, self.word, self.sticker.sticker_id)<|fim_prefix|># repo: Stonecoldstone/Aut-3000-telegram-bot path: /stickerbot/models.py
from django.db import models
class Sticker(models.Model):
sticker_id = models.CharField(max_length=255... | code_fim | hard | {
"lang": "python",
"repo": "Stonecoldstone/Aut-3000-telegram-bot",
"path": "/stickerbot/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """PlatProductListVoPagingResponse unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testPlatProductListVoPagingResponse(self):
"""Test PlatProductListVoPagingResponse"""
# FIXME: construct object with mandatory attributes with example... | code_fim | hard | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/test/test_plat_product_list_vo_paging_response.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baidu/baiduads-sdk path: /python/baiduads-sdk-auto/test/test_plat_product_list_vo_paging_response.py
"""
dev2 api schema
'dev2.baidu.com' api schema # noqa: E501
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
<|fim_suffix|> def setUp(self):
pa... | code_fim | hard | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/test/test_plat_product_list_vo_paging_response.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>import baiduads
from baiduads.platproduct.model.plat_product_list_vo import PlatProductListVo
globals()['PlatProductListVo'] = PlatProductListVo
from baiduads.platproduct.model.plat_product_list_vo_paging_response import PlatProductListVoPagingResponse
class TestPlatProductListVoPagingResponse(unittest.... | code_fim | medium | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/test/test_plat_product_list_vo_paging_response.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Returns a new 2d array with only those rows from the input table whos
value in column col are within the specified limits or equal to them.
The ordering is preserved.
"""
if limits==():
return Table
low = limits[0]
high = limits[1]
idxlower = set(np.where(Ta... | code_fim | hard | {
"lang": "python",
"repo": "jwerdec/beamerlib",
"path": "/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jwerdec/beamerlib path: /helper.py
"""
Requirements:
Python v2.7 or later (not compatible with Python 3)
numpy, matplotlib, scipy
Tested with:
Linux Mint 14 Cinnamon 64bit
python 2.7.3
numpy 1.6.2
matplotlib 1.2.1
scipy 0.10.1
Version History:
"""
import numpy as np
... | code_fim | hard | {
"lang": "python",
"repo": "jwerdec/beamerlib",
"path": "/helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> curved_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax
ax1.patch.zorder=0.9
return ax1, curved_ax
if __name__ == '__main__':
import matplotlib.pylab as plt
from numpy import linspace, cos, radians
angles = linspace(-45, 45, 20)
signal = cos(radians(ang... | code_fim | hard | {
"lang": "python",
"repo": "jwerdec/beamerlib",
"path": "/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> digammaBoth = digamma(eta1+eta0)
ElogV = digamma(eta1) - digammaBoth
Elog1mV = digamma(eta0) - digammaBoth
ElogPi = ElogV.copy()
ElogPi[:, 1:] += np.cumsum(Elog1mV[:, :-1], axis=1)
LP['DocTopicCount_gt'] = DocTopicCount_gt
LP['eta1'] = eta1
LP['eta0'] = eta0
LP['ElogV'... | code_fim | hard | {
"lang": "python",
"repo": "bnpy/bnpy",
"path": "/tests/zzz_deprecated_unmaintained/allocmodel/topics/HDP-point-estimation/HDPSB.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bnpy/bnpy path: /tests/zzz_deprecated_unmaintained/allocmodel/topics/HDP-point-estimation/HDPSB.py
'''
HDPSB.py
Bayesian nonparametric admixture model via the Hierarchical Dirichlet Process.
Uses a direct construction that maintains K active components.
Attributes
-------
K : # of components
gam... | code_fim | hard | {
"lang": "python",
"repo": "bnpy/bnpy",
"path": "/tests/zzz_deprecated_unmaintained/allocmodel/topics/HDP-point-estimation/HDPSB.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: firedrakeproject/slepc path: /src/binding/slepc4py/demo/ex12.py
# Tests use of setArbitrarySelection()
import sys, slepc4py
slepc4py.init(sys.argv)
from petsc4py import PETSc
from slepc4py import SLEPc
import numpy
opts = PETSc.Options()
n = opts.getInt('n', 30)
<|fim_suffix|># Solve eigenpro... | code_fim | hard | {
"lang": "python",
"repo": "firedrakeproject/slepc",
"path": "/src/binding/slepc4py/demo/ex12.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return abs(xr.dot(sxr))
E.setArbitrarySelection(myArbitrarySel,sxr)
E.setWhichEigenpairs(SLEPc.EPS.Which.LARGEST_MAGNITUDE)
E.solve()
E.errorView(viewer=vw)
vw.popFormat()
else:
Print( "No eigenpairs converged" )<|fim_prefix|># repo: firedrakeproject/slepc path: /src/bindi... | code_fim | hard | {
"lang": "python",
"repo": "firedrakeproject/slepc",
"path": "/src/binding/slepc4py/demo/ex12.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rik89/Publicidad_Web path: /source/strikeamatch.py
def _get_character_pairs(text):
"""Returns a defaultdict(int) of adjacent character pair counts.
>>> _get_character_pairs('Test IS')
{'IS': 1, 'TE': 1, 'ES': 1, 'ST': 1}
>>> _get_character_pairs('Test 123')
{'23': 1, '12... | code_fim | hard | {
"lang": "python",
"repo": "Rik89/Publicidad_Web",
"path": "/source/strikeamatch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Determinar la intersección contando las sustracciones que hacemos de ambos
for pair, smaller_pair_count in smaller_dict.items():
if pair in larger_dict and larger_dict[pair] > 0:
if smaller_pair_count < larger_dict[pair]:
intersection_count += smaller_pai... | code_fim | hard | {
"lang": "python",
"repo": "Rik89/Publicidad_Web",
"path": "/source/strikeamatch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: poornivasu/mobilesecproject path: /python-client-master/test/functional/android/programgenerator_weather.py
#!/usr/bin/python
import re
import collections
#import outputprogram
import os
import subprocess
#import popen
fileNameIntent = "intent_weather.conf"
fileNameMappings = "mappings_weather.... | code_fim | hard | {
"lang": "python",
"repo": "poornivasu/mobilesecproject",
"path": "/python-client-master/test/functional/android/programgenerator_weather.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__== "__main__":
intentsRet = digestIntents()
if (intentsRet != 0):
print ("Error reading Intents file\n")
mappingsRet = digestMappings()
if (mappingsRet != 0):
print ("Error reading Intents file\n")
# Opening the ouputfile to write the code
fOut... | code_fim | hard | {
"lang": "python",
"repo": "poornivasu/mobilesecproject",
"path": "/python-client-master/test/functional/android/programgenerator_weather.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # for i in self.collection.find():
# print(i)
cursor = self.collection.find({'levelname' : 'INFO',
'msg.rand' : random_str,
'msg.address' : '340 N 12th St'})
self.assertE... | code_fim | hard | {
"lang": "python",
"repo": "jdrumgoole/pymongo_logging",
"path": "/tests/test_handler.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdrumgoole/pymongo_logging path: /tests/test_handler.py
# -*- coding: utf-8 *-*
import logging
import unittest
import random
import string
from pymongo_logging import MongoHandler
import pymongo
class TestRootLoggerHandler(unittest.TestCase):
"""
Test Handler attached to RootLogger
... | code_fim | hard | {
"lang": "python",
"repo": "jdrumgoole/pymongo_logging",
"path": "/tests/test_handler.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(cursor.count(), 1, "Expected query to return 1 "
"message; it returned %d" % cursor.count())
self.assertEqual(cursor[0]['msg']['address'], '340 N 12th St')
cursor = self.collection.find({'levelname': 'INFO',
'msg.... | code_fim | hard | {
"lang": "python",
"repo": "jdrumgoole/pymongo_logging",
"path": "/tests/test_handler.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Volume factor
pk_smooth /= p["alpha"] ** 3
if smooth:
propagator = np.ones(len(kprime))
else:
# Compute the propagator
C = np.exp(-0.5 * kprime**2 * p["sigma_nl"] ** 2)
propagator = 1.0 + spl... | code_fim | hard | {
"lang": "python",
"repo": "Samreay/Barry",
"path": "/barry/models/bao_power_Beutler2017.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Samreay/Barry path: /barry/models/bao_power_Beutler2017.py
import numpy as np
from barry.models.bao_power import PowerSpectrumFit
from scipy.interpolate import splev, splrep
class PowerBeutler2017(PowerSpectrumFit):
"""P(k) model inspired from Beutler 2017.
See https://ui.adsabs.harvar... | code_fim | hard | {
"lang": "python",
"repo": "Samreay/Barry",
"path": "/barry/models/bao_power_Beutler2017.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AoiKuiyuyou/AoikFileTypeAsso path: /src/aoikfiletypeasso/dep/aoikexcutil.py
# coding: utf-8
from __future__ import absolute_import
import sys
import traceback
#/
__version__ = '0.1'
#/
IS_PY2 = sys.version_info[0] == 2
#/ define |exec_| and |raise_| that are 2*3 compatible.
##
## Modified from... | code_fim | medium | {
"lang": "python",
"repo": "AoiKuiyuyou/AoikFileTypeAsso",
"path": "/src/aoikfiletypeasso/dep/aoikexcutil.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if tb is not None and exc.__traceback__ is not tb:
raise exc.with_traceback(tb)
else:
raise exc
## ---END
#/
def get_traceback_stxt():
"""
Result is (bytes) str type on Python 2 and (unicode) str type on Python 3.
"""
#/
exc_cls, exc_obj, tb_obj... | code_fim | medium | {
"lang": "python",
"repo": "AoiKuiyuyou/AoikFileTypeAsso",
"path": "/src/aoikfiletypeasso/dep/aoikexcutil.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :context:
:args:
:kwargs:
**usage**::
{% bootstrap_messages FIXTHIS %}
**example**::
{% bootstrap_messages FIXTHIS %}
"""
return get_template('bootstrap3/messages.html').render(context)
@register.inclusion_tag('bootstrap3/pagination.html')
def... | code_fim | hard | {
"lang": "python",
"repo": "Wizmann/DjangoSimditor",
"path": "/bootstrap3/templatetags/bootstrap3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> **Parameters**:
:page:
:kwargs:
**usage**::
{% bootstrap_pagination FIXTHIS %}
**example**::
{% bootstrap_pagination FIXTHIS %}
"""
pagination_kwargs = kwargs.copy()
pagination_kwargs['page'] = page
return get_pagination_context(**paginatio... | code_fim | hard | {
"lang": "python",
"repo": "Wizmann/DjangoSimditor",
"path": "/bootstrap3/templatetags/bootstrap3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Wizmann/DjangoSimditor path: /bootstrap3/templatetags/bootstrap3.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from math import floor
from django import template
from django.template.loader import get_template
from ..bootstrap import css_url, javascript_url, jque... | code_fim | hard | {
"lang": "python",
"repo": "Wizmann/DjangoSimditor",
"path": "/bootstrap3/templatetags/bootstrap3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lowks/simuvex path: /simuvex/plugins/solver.py
#!/usr/bin/env python
from .plugin import SimStatePlugin
from ..s_action_object import ast_stripping_op as _actual_ast_stripping_op
import sys
import functools
import logging
l = logging.getLogger('simuvex.plugins.solver')
#pylint:disable=unidioma... | code_fim | hard | {
"lang": "python",
"repo": "lowks/simuvex",
"path": "/simuvex/plugins/solver.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if type(e) in (int, str, float, bool, long, claripy.bv.BVV):
return False
return e.symbolic
def single_valued(self, e):
if self.state.mode == 'static':
if type(e) in (int, str, float, bool, long, claripy.bv.BVV):
return True
... | code_fim | hard | {
"lang": "python",
"repo": "lowks/simuvex",
"path": "/simuvex/plugins/solver.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rosocz/BehavioralCloning path: /model.py
# coding: utf-8
# In[3]:
import csv
import cv2
import numpy as np
import sklearn
import scipy
lines = []
with open('./data/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
lines.append(line)
def generato... | code_fim | hard | {
"lang": "python",
"repo": "rosocz/BehavioralCloning",
"path": "/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield sklearn.utils.shuffle(X_train, y_train)
def get_image(path):
filename = path.split('/')[-1]
current_path = './data/IMG/' + filename
image = cv2.imread(current_path)
image = scipy.misc.imresize(image, (80,160))
image = image[35:70, :]
return cv2.cvtColor(image, cv... | code_fim | hard | {
"lang": "python",
"repo": "rosocz/BehavioralCloning",
"path": "/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from keras.models import Sequential
from keras.layers import Flatten, Dense, Dropout, Conv2D, Lambda, Cropping2D, Activation, Reshape
from keras.layers.pooling import MaxPooling2D
from keras.optimizers import Adam
height = 35
width = 160
top_remove = 25
bottom_remove = 10
model = Sequential()
model.add... | code_fim | hard | {
"lang": "python",
"repo": "rosocz/BehavioralCloning",
"path": "/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for task_type, desc in product(task_types, task_types.values()):
# success when task type matches description
if task_types[task_type] is desc:
SubmitTask(
task_type=task_type,
start_time=0,
descrip... | code_fim | hard | {
"lang": "python",
"repo": "matiasbavera/romi-dashboard",
"path": "/packages/api-server/api_server/models/test_tasks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matiasbavera/romi-dashboard path: /packages/api-server/api_server/models/test_tasks.py
import unittest
from itertools import product
from pydantic import ValidationError
from rmf_task_msgs.msg import TaskType as RmfTaskType
from .tasks import SubmitTask
class TestSubmitTaskModel(unittest.Test... | code_fim | hard | {
"lang": "python",
"repo": "matiasbavera/romi-dashboard",
"path": "/packages/api-server/api_server/models/test_tasks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_validate_task_description(self):
clean_desc = {"cleaning_zone": "test_zone"}
loop_desc = {
"num_loops": 1,
"start_name": "start",
"finish_name": "finish",
}
delivery_desc = {
"pickup_place_name": "pickup_place",
... | code_fim | hard | {
"lang": "python",
"repo": "matiasbavera/romi-dashboard",
"path": "/packages/api-server/api_server/models/test_tasks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hillt03/Four path: /four/bot/cogs/misc.py
import asyncio
import discord
from discord.ext import commands
import random
class Misc(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(help="Gives a pong")
async def ping(self, ctx):
await ctx.se... | code_fim | hard | {
"lang": "python",
"repo": "hillt03/Four",
"path": "/four/bot/cogs/misc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @commands.command(help="Selects a random value from passed in arguments", aliases=['r'])
async def random(self, ctx, *args):
await ctx.send(random.choice(args))
def setup(bot):
bot.add_cog(Misc(bot))<|fim_prefix|># repo: hillt03/Four path: /four/bot/cogs/misc.py
import asyn... | code_fim | medium | {
"lang": "python",
"repo": "hillt03/Four",
"path": "/four/bot/cogs/misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
"""
Potential violation through implicit consent.
@return: exit code, 0 for success
"""
argv = None
cargs = docopt(__doc__, argv=argv)
logger = setupLogger(".", logging.INFO)
logger.info("Running method 07: Implicit Consent")
# Verify that database exists... | code_fim | hard | {
"lang": "python",
"repo": "dibollinger/CookieBlock-Violation-Detection",
"path": "/method7_implicit_consent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dibollinger/CookieBlock-Violation-Detection path: /method7_implicit_consent.py
# Copyright (C) 2021-2022 Dino Bollinger, ETH Zürich, Information Security Group
# Released under the MIT License
"""
Using a database of cookies specifically collected such that no consent is ever given, check which o... | code_fim | hard | {
"lang": "python",
"repo": "dibollinger/CookieBlock-Violation-Detection",
"path": "/method7_implicit_consent.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> },
)
register(
id='RoboLearn-WalkmanReaching-v0',
entry_point='robolearn_envs.pybullet:WalkmanReachingEnv',
kwargs={
'links_names': None,
'goal_poses': None,
'active_joints': 'RA',
'control_mode': 'joint_torque',
'fixed_base': None,
'is_rende... | code_fim | hard | {
"lang": "python",
"repo": "domingoesteban/robolearn_envs",
"path": "/robolearn_envs/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> },
)
register(
id='RoboLearn-CentauroObstacle-v0',
entry_point='robolearn_envs.pybullet:CentauroObstacleEnv',
kwargs={
'is_render': False,
'active_joints': 'RA',
'control_mode': 'joint_tasktorque',
'sim_timestep': 0.001,
'frame_skip': 1,
'obs... | code_fim | hard | {
"lang": "python",
"repo": "domingoesteban/robolearn_envs",
"path": "/robolearn_envs/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: domingoesteban/robolearn_envs path: /robolearn_envs/__init__.py
from gym.envs.registration import register
# TEMPLATE:
# register(
# id='RoboLearn-CentauroEnv-v0',
# entry_point='robolearn_envs.pybullet:CentauroEnv',
# # tags={'wrapper_config.TimeLimit.max_episode_steps': 1000},
# ... | code_fim | hard | {
"lang": "python",
"repo": "domingoesteban/robolearn_envs",
"path": "/robolearn_envs/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: solvice/solvice-routing-client path: /clients/python/SolviceRoutingClient/models/order.py
/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from SolviceRoutingClient.models.order_date_windows import OrderDateWindows # noqa: F401,E501
from SolviceRoutingClient.models.ord... | code_fim | hard | {
"lang": "python",
"repo": "solvice/solvice-routing-client",
"path": "/clients/python/SolviceRoutingClient/models/order.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Location of an order; should be in location list. # noqa: E501
:return: The location of this Order. # noqa: E501
:rtype: str
"""
return self._location
@location.setter
def location(self, location):
"""Sets the location of this Order.
Loc... | code_fim | hard | {
"lang": "python",
"repo": "solvice/solvice-routing-client",
"path": "/clients/python/SolviceRoutingClient/models/order.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: solvice/solvice-routing-client path: /clients/python/SolviceRoutingClient/models/order.py
:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the ... | code_fim | hard | {
"lang": "python",
"repo": "solvice/solvice-routing-client",
"path": "/clients/python/SolviceRoutingClient/models/order.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: victordomingos/telescope-planner path: /telescope_planner/tmp/_test_angles.py
#!/usr/bin/env python3
from pyongc.ongc import listObjects
from skyfield.api import load, Topos
from skyfield.units import Angle as SF_Angle
from types import SimpleNamespace
DEFAULT_LOCATION = SimpleNamespace(**{
... | code_fim | hard | {
"lang": "python",
"repo": "victordomingos/telescope-planner",
"path": "/telescope_planner/tmp/_test_angles.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
planets = load('de421.bsp')
earth = planets['earth']
here = earth + Topos(latitude=DEFAULT_LOCATION.latitude,
longitude=DEFAULT_LOCATION.longitude,
elevation_m=DEFAULT_LOCATION.altitude)
selection = get_dso_list()
ts = load.timescale()
moment = ts.now()
min_ra,... | code_fim | hard | {
"lang": "python",
"repo": "victordomingos/telescope-planner",
"path": "/telescope_planner/tmp/_test_angles.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-telemetry/opentelemetry-python path: /opentelemetry-sdk/tests/error_handler/test_error_handler.py
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a co... | code_fim | hard | {
"lang": "python",
"repo": "open-telemetry/opentelemetry-python",
"path": "/opentelemetry-sdk/tests/error_handler/test_error_handler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> _handle = Mock()
class AssertionErrorHandler(ErrorHandler, AssertionError):
# pylint: disable=arguments-differ
_handle = Mock()
mock_entry_point_zero_division_error_handler = Mock()
mock_entry_point_zero_division_error_handler.configure_mock(
... | code_fim | hard | {
"lang": "python",
"repo": "open-telemetry/opentelemetry-python",
"path": "/opentelemetry-sdk/tests/error_handler/test_error_handler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nabla-c0d3/trust_stores_observatory path: /trust_stores_observatory/store_fetcher/root_records_validator.py
import logging
from typing import List, Set
from trust_stores_observatory.certificates_repository import RootCertificatesRepository, CertificateNotFoundError
from trust_stores_observatory.... | code_fim | hard | {
"lang": "python",
"repo": "nabla-c0d3/trust_stores_observatory",
"path": "/trust_stores_observatory/store_fetcher/root_records_validator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # For each (subj_name, fingerprint) try to find the corresponding certificate in the supplied cert repo
for scraped_record in scraped_records:
try:
cert = certs_repo.lookup_certificate_with_fingerprint(
scraped_record.fingerprint, scraped_rec... | code_fim | hard | {
"lang": "python",
"repo": "nabla-c0d3/trust_stores_observatory",
"path": "/trust_stores_observatory/store_fetcher/root_records_validator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hayhan/loganalyzer path: /analyzer/utils/data_helper.py
# Licensed under the MIT License - see LICENSE.txt
""" Utils to handle anything that are data/log related """
import os
import sys
from analyzer.config import GlobalConfig as GC
__all__ = [
"ANALYZER_DATA",
"RAW_DATA",
"COOKED_... | code_fim | hard | {
"lang": "python",
"repo": "hayhan/loganalyzer",
"path": "/analyzer/utils/data_helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Overwrite version of read config file """
GC.read()
if os.path.exists(CONFIG_OVERWRITE):
cls.overwrite(CONFIG_OVERWRITE)
@classmethod
def overwrite(cls, config_file_overwrite: str):
""" Update im-momory conf with the overwrite config file. """
... | code_fim | hard | {
"lang": "python",
"repo": "hayhan/loganalyzer",
"path": "/analyzer/utils/data_helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
hosts = self.getHostnames(args)
(address, gateway, netmask, interface, syncnow) = self.fillParams([
('address', None, True),
('gateway', None, True),
('netmask', '255.255.255.255'),
('interface', None),
('syncnow', None),
])
syncnow = self.str2bool(syncnow)
#
# determin... | code_fim | hard | {
"lang": "python",
"repo": "circls/stacki",
"path": "/common/src/stack/command/stack/commands/add/host/route/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: circls/stacki path: /common/src/stack/command/stack/commands/add/host/route/__init__.py
# @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 -... | code_fim | hard | {
"lang": "python",
"repo": "circls/stacki",
"path": "/common/src/stack/command/stack/commands/add/host/route/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> <param type='string' name='address'>
Host or network address
</param>
<param type='string' name='gateway'>
Network or device gateway
</param>
<param type='string' name='interface'>
The interface to send the bits over. Useful if
you want to tag a packet.
</param>
<param type='string' name='... | code_fim | hard | {
"lang": "python",
"repo": "circls/stacki",
"path": "/common/src/stack/command/stack/commands/add/host/route/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.level0
@pytest.mark.platform_x86_gpu_training
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard
def test_list_append_grad():
"""
Feature: test sequence getitem grad op
Description: setitem operation on tuple type
Expe... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/tests/st/ops/dynamic_sequence/test_dynamic_list_append.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.