text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>me='property_created_by', to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='UrbanizedSector', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('n...
code_fim
hard
{ "lang": "python", "repo": "dmatiasr/django-demo", "path": "/mysite/RentApp/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>description_text_2 = StringVar() e6 = Entry(tab2,textvariable=description_text_2,width=52) e6.grid(row=0,column=1,columnspan=3) manufacturer_text_2 = StringVar() e7 = Entry(tab2,textvariable=manufacturer_text_2, state='disabled') e7.grid(row=1,column=1) quantity_text_2 = StringVar() e8 = Entry(tab2,...
code_fim
hard
{ "lang": "python", "repo": "ThayPedroso/myWarehouse", "path": "/frontend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThayPedroso/myWarehouse path: /frontend.py """ A program that stores materials in a warehouse: Description, Manufacturer, Code Quantity, BarCode User can: View all records Search an entry Add entry Update entry Delete Close """ from tkinter import * from backend import Database from tkinter i...
code_fim
hard
{ "lang": "python", "repo": "ThayPedroso/myWarehouse", "path": "/frontend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>init = tf.keras.initializers.glorot_normal(seed=SEED) encoder_model = tf.keras.Sequential([ tf.keras.layers.Conv2D(filters=32,kernel_size=3,strides=(2,2),activation=tf.nn.relu, padding="same",kernel_initializer=init), tf.keras.layers.MaxPool2D(pool_size=(2, 2)), tf.keras.layers.Conv2D(filters=...
code_fim
hard
{ "lang": "python", "repo": "Rufaim/tensorflow-2-variational-autoencoder", "path": "/train_vae.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rufaim/tensorflow-2-variational-autoencoder path: /train_vae.py import os import tensorflow as tf import numpy as np import matplotlib.pyplot as pyplot from models import Encoder, VariationalAutoEncoder BATCH_SIZE = 32 MNIST_SHAPE = [28, 28, 1] LATENT_DIM = 12 EPOCHS = 25 LEARNING_RATE = 1e-3 ...
code_fim
hard
{ "lang": "python", "repo": "Rufaim/tensorflow-2-variational-autoencoder", "path": "/train_vae.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> prediction = vae.predict(test_portion) fig = pyplot.figure(figsize=(4,4)) for i in range(prediction.shape[0]): pyplot.subplot(4,4,i+1) pyplot.imshow(prediction[i,...,0],cmap="gray") pyplot.axis("off") pyplot.savefig(os.path.join(LOGDIR,f"epoch_{epoch}.png")) pyp...
code_fim
hard
{ "lang": "python", "repo": "Rufaim/tensorflow-2-variational-autoencoder", "path": "/train_vae.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.x == 1: f = f1 else: f = f2 t = time.time() f() print(time.time() - t) if __name__ == '__main__': main()<|fim_prefix|># repo: xkumiyu/python-speed-comp path: /stdin.py import time import argparse def f1(): N = int(input()) [int(input()) for _ i...
code_fim
medium
{ "lang": "python", "repo": "xkumiyu/python-speed-comp", "path": "/stdin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): parser = argparse.ArgumentParser() parser.add_argument('x', type=int) args = parser.parse_args() if args.x == 1: f = f1 else: f = f2 t = time.time() f() print(time.time() - t) if __name__ == '__main__': main()<|fim_prefix|># repo: xkumiy...
code_fim
medium
{ "lang": "python", "repo": "xkumiyu/python-speed-comp", "path": "/stdin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xkumiyu/python-speed-comp path: /stdin.py import time import argparse def f1(): N = int(input()) [int(input()) for _ in range(N)] def f2(): import sys input = sys.stdin.readline <|fim_suffix|> def main(): parser = argparse.ArgumentParser() parser.add_argument('x', typ...
code_fim
easy
{ "lang": "python", "repo": "xkumiyu/python-speed-comp", "path": "/stdin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joshuabhk/tcr-dist path: /analyze_gene_frequencies.py ## look at frequencies and enrichments of genes ## ## what makes this a little tricky is that gene assignments can be ambiguous: sequence reads ## are often too short to uniquely define the gene, especially in mouse V-alpha where there are ## ...
code_fim
hard
{ "lang": "python", "repo": "joshuabhk/tcr-dist", "path": "/analyze_gene_frequencies.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if jsd<best_jsd: #print '******' best_logfile = logfile best_jsd = jsd best_bg_freq = bg_freq best_tcr_freq = tcr_freq else: pass #pri...
code_fim
hard
{ "lang": "python", "repo": "joshuabhk/tcr-dist", "path": "/analyze_gene_frequencies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': vgg = vgg16.VGG16(weights='imagenet', include_top=True) vgg.summary() # load the vgg into the deoxys model deo = Model(vgg) # load an real image img = load_image('../../test_img/cat.jpg') # predict what is in that image preds = deo.predict(img)...
code_fim
hard
{ "lang": "python", "repo": "huynhngoc/deoxys", "path": "/examples/visualization_vgg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huynhngoc/deoxys path: /examples/visualization_vgg.py from deoxys.model import load_model, Model import numpy as np import matplotlib.pyplot as plt from deoxys.utils import is_keras_standalone if is_keras_standalone(): from keras.applications import vgg16 from keras.applications.vgg16 imp...
code_fim
hard
{ "lang": "python", "repo": "huynhngoc/deoxys", "path": "/examples/visualization_vgg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # load an real image img = load_image('../../test_img/cat.jpg') # predict what is in that image preds = deo.predict(img) predicted_class = preds.argmax(axis=1)[0] print("predicted top1 class:", predicted_class) print('Predicted:', decode_predictions(preds, top=1)[0]) # V...
code_fim
hard
{ "lang": "python", "repo": "huynhngoc/deoxys", "path": "/examples/visualization_vgg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> corpus: ProviderBase, title: Optional[str] = None, set_type: SetType = SetType.DEV) -> Dict[str, float]: """ Function evaluates metrics for documents from corpus after processing with passed processo...
code_fim
hard
{ "lang": "python", "repo": "serge-sotnyk/tesufr", "path": "/tesufr/keysum_evaluator/evaluators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: serge-sotnyk/tesufr path: /tesufr/keysum_evaluator/evaluators.py from collections import defaultdict from typing import Dict, Set, List, Sequence, Optional from tqdm.auto import tqdm from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from nltk.tokenize import word_tokenize...
code_fim
hard
{ "lang": "python", "repo": "serge-sotnyk/tesufr", "path": "/tesufr/keysum_evaluator/evaluators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def evaluate_processor_on_corpus(processor: Processor, corpus: ProviderBase, title: Optional[str] = None, set_type: SetType = SetType.DEV) -> Dict[str, float]: """ Function evaluates metrics for doc...
code_fim
hard
{ "lang": "python", "repo": "serge-sotnyk/tesufr", "path": "/tesufr/keysum_evaluator/evaluators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Honglongwu/bioinformatics-scripts path: /cafe_to_dupliphy_input.py #!/usr/bin/env python """ Lets the user convert a cafe input format file to a DupliPHY input format file Requires the CAFE file to be in the format DESCRIPTION\tID\tSpecies1\tSpecies2... etc Creates the new input file and a m...
code_fim
medium
{ "lang": "python", "repo": "Honglongwu/bioinformatics-scripts", "path": "/cafe_to_dupliphy_input.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># assign inputfile and check exists inputfile = args[1] if not os.path.exists(inputfile): print "The filename (%s) you specified does not exist" % inputfile sys.exit() # set output filename and let user know we are converting outputfile = inputfile.split('.')[0] + ".dupliphy" mappingfile = outp...
code_fim
medium
{ "lang": "python", "repo": "Honglongwu/bioinformatics-scripts", "path": "/cafe_to_dupliphy_input.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: riogesulgon/vimiv path: /vimiv/transform.py # vim: ft=python fileencoding=utf-8 sw=4 et sts=4 """Deals with transformations like rotate and flip and deleting files.""" import os from threading import Thread from gi.repository import GObject from vimiv import imageactions from vimiv.exceptions i...
code_fim
hard
{ "lang": "python", "repo": "riogesulgon/vimiv", "path": "/vimiv/transform.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Start thread for rotate and flip.""" # TODO improve this, it is currently not possible to find out what is # being changed and what should still be done if self.threads_running: return if settings["autosave_images"].get_value(): t = Thread...
code_fim
hard
{ "lang": "python", "repo": "riogesulgon/vimiv", "path": "/vimiv/transform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DataEdgeSystems/datalake-etl-pipeline path: /test/aws_test/glue_job.py import sys from pyspark.context import SparkContext # https://github.com/aws-samples/aws-glue-samples/tree/master/examples <|fim_suffix|>def _commit_job(job): job.commit() def _get_glue_args(cli_args): from awsgl...
code_fim
hard
{ "lang": "python", "repo": "DataEdgeSystems/datalake-etl-pipeline", "path": "/test/aws_test/glue_job.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> job.commit() def _get_glue_args(cli_args): from awsglue.utils import getResolvedOptions glue_args = getResolvedOptions(args=cli_args, options=["JOB_NAME", "source", "destination"]) print(glue_args) return glue_args if __name__ == "__main__": run(["source", "destination"])<|fim_...
code_fim
hard
{ "lang": "python", "repo": "DataEdgeSystems/datalake-etl-pipeline", "path": "/test/aws_test/glue_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from awsglue.utils import getResolvedOptions glue_args = getResolvedOptions(args=cli_args, options=["JOB_NAME", "source", "destination"]) print(glue_args) return glue_args if __name__ == "__main__": run(["source", "destination"])<|fim_prefix|># repo: DataEdgeSystems/datalake-etl-pipe...
code_fim
hard
{ "lang": "python", "repo": "DataEdgeSystems/datalake-etl-pipeline", "path": "/test/aws_test/glue_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tonyle9/tensorimage path: /tensorimage/util/convnet_builder.py from tensorimage.train import models architectures = [ ('AlexNet', models.AlexNet), ('RosNet', models.RosNet), ] class ConvNetBuilder: def __init__(self, architecture): self.architecture = architecture def...
code_fim
medium
{ "lang": "python", "repo": "tonyle9/tensorimage", "path": "/tensorimage/util/convnet_builder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for avarchs in architectures: if self.architecture == avarchs[0]: return avarchs[1] def check_exist(architecture): for avarch in architectures: if architecture == avarch[0]: return True else: continue return False<|fim_p...
code_fim
medium
{ "lang": "python", "repo": "tonyle9/tensorimage", "path": "/tensorimage/util/convnet_builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pranavlathigara/Raspberry-Pi-DIY-Projects path: /smart-projects/python-bluezero/bluezero/blinkt.py """ This is a simple API to access the Pimoroni Blinkt device. This is the central API. The peripheral is created with examples/level100/blinkt_ble.py """ from time import sleep import logging try:...
code_fim
hard
{ "lang": "python", "repo": "pranavlathigara/Raspberry-Pi-DIY-Projects", "path": "/smart-projects/python-bluezero/bluezero/blinkt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.blnkt = device.Device(device_path[0]) self.blinkt_srv_path = None self.blinkt_chrc_path = None @property def connected(self): """Indicate whether the remote device is currently connected.""" return self.blnkt.connected def connect(self): ...
code_fim
hard
{ "lang": "python", "repo": "pranavlathigara/Raspberry-Pi-DIY-Projects", "path": "/smart-projects/python-bluezero/bluezero/blinkt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>inspect_file_attrs(file_path).close()<|fim_prefix|># repo: SDRAST/support path: /hdf5_util/examples/inspect_file_attrs_example.py import os import h5py from support.hdf5_util import inspect_file_attrs current_dir = os.path.dirname(os.path.abspath(__file__)) <|fim_middle|>file_path = os.path.join(curr...
code_fim
medium
{ "lang": "python", "repo": "SDRAST/support", "path": "/hdf5_util/examples/inspect_file_attrs_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SDRAST/support path: /hdf5_util/examples/inspect_file_attrs_example.py import os import h5py from support.hdf5_util import inspect_file_attrs current_dir = os.path.dirname(os.path.abspath(__file__)) <|fim_suffix|>inspect_file_attrs(file_path).close()<|fim_middle|>file_path = os.path.join(curr...
code_fim
medium
{ "lang": "python", "repo": "SDRAST/support", "path": "/hdf5_util/examples/inspect_file_attrs_example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>file_path = os.path.join(current_dir, "example.hdf5") with h5py.File(file_path, "w") as f: f.attrs["first_name"] = "dill" f.attrs["last_name"] = "pickle" f.attrs["age"] = 0.1 inspect_file_attrs(file_path).close()<|fim_prefix|># repo: SDRAST/support path: /hdf5_util/examples/inspect_file_attr...
code_fim
easy
{ "lang": "python", "repo": "SDRAST/support", "path": "/hdf5_util/examples/inspect_file_attrs_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: appatsekhar/pytext path: /pytext/models/embeddings/char_embedding.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import List, Optional import torch import torch.nn as nn import torch.nn.functional as F from pytext.config.field_config...
code_fim
hard
{ "lang": "python", "repo": "appatsekhar/pytext", "path": "/pytext/models/embeddings/char_embedding.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Highway(nn.Module): """ A `Highway layer <https://arxiv.org/abs/1505.00387>`. Adopted from the AllenNLP implementation. """ def __init__(self, input_dim: int, num_layers: int = 1): super().__init__() self.input_dim = input_dim self.layers = nn.ModuleList(...
code_fim
hard
{ "lang": "python", "repo": "appatsekhar/pytext", "path": "/pytext/models/embeddings/char_embedding.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return aepe_with_hfem elif add_hfem.lower() == 'edges' and edges is not None: # Reshape into height x width (was batch x height x width x 1 to be fed to the network) # aepe_hfem_edges = lambda * edges_img * epe_img epe_times_edges = tf.multiply(epe, ...
code_fim
hard
{ "lang": "python", "repo": "fperezgamonal/flownet2-tf", "path": "/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fperezgamonal/flownet2-tf path: /src/utils.py t(tf.pow(2, tf.cast(cycle - 1, tf.int32)), tf.float32)) if mode == 'exponential' and not one_cycle: cmom = tf.multiply(tf.pow(gamma, global_step), cmom) return tf.subtract(max_mom, cmom, name=op_name) # Momentum is kep...
code_fim
hard
{ "lang": "python", "repo": "fperezgamonal/flownet2-tf", "path": "/src/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> indices = tf.stack([b, y, x], 3) return tf.gather_nd(img, indices) def tf_warp(img, flow, H, W): # H = 256 # W = 256 x,y = tf.meshgrid(tf.range(W), tf.range(H)) x = tf.expand_dims(x,0) x = tf.expand_dims(x,-1) y = tf.expand_dims(y,0) y = tf.expand_dims(y,-1) ...
code_fim
hard
{ "lang": "python", "repo": "fperezgamonal/flownet2-tf", "path": "/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bndl/bndl path: /bndl/compute/dataset.py 5, 15), (6, 16), (7, 17), (8, 18), (9, 19)] ''' # TODO what if some partition is shorter/longer than another? return self.zip_partitions(other, zip) def zip_partitions(self, other, comb): ''' Zip the partitions...
code_fim
hard
{ "lang": "python", "repo": "bndl/bndl", "path": "/bndl/compute/dataset.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _convert_for_save(self, mode, compression, ext): if mode not in ('t', 'b'): raise ValueError('mode should be t(ext) or b(inary)') data = self # compress if necessary if compression is not None: if mode == 't': data = data.map(...
code_fim
hard
{ "lang": "python", "repo": "bndl/bndl", "path": "/bndl/compute/dataset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def itake(self, num): ''' Take the first num elements from this dataset as iterator. ''' assert self.ctx.running, 'context of dataset is not running' remaining = num sliced = self.map_partitions(partial(take, remaining))._itake_parts() try: ...
code_fim
hard
{ "lang": "python", "repo": "bndl/bndl", "path": "/bndl/compute/dataset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tangermi/nlp path: /src/demo/_tensorflow/linear/linear.py # -*- coding: utf-8 -*- import tensorflow as tf class Linear(tf.keras.Model): def __init__(self): super().__init__() self.dense = tf.keras.layers.Dense( units=1, activation=None, ke...
code_fim
medium
{ "lang": "python", "repo": "tangermi/nlp", "path": "/src/demo/_tensorflow/linear/linear.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': X = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) y = tf.constant([[10.0], [20.0]]) model = Linear() optimizer = tf.keras.optimizers.SGD(learning_rate=0.01) for i in range(100): with tf.GradientTape() as tape: y_pred = model(X) # 调用模型 ...
code_fim
medium
{ "lang": "python", "repo": "tangermi/nlp", "path": "/src/demo/_tensorflow/linear/linear.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> output = self.dense(input) return output if __name__ == '__main__': X = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) y = tf.constant([[10.0], [20.0]]) model = Linear() optimizer = tf.keras.optimizers.SGD(learning_rate=0.01) for i in range(100): with tf.Gra...
code_fim
hard
{ "lang": "python", "repo": "tangermi/nlp", "path": "/src/demo/_tensorflow/linear/linear.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> url = '/admin/webhooks/' response = webhook_admin_client.get(url) assert response.status_code == 200<|fim_prefix|># repo: byceps/byceps path: /tests/integration/blueprints/admin/webhook/test_views.py """ :Copyright: 2014-2023 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for ...
code_fim
easy
{ "lang": "python", "repo": "byceps/byceps", "path": "/tests/integration/blueprints/admin/webhook/test_views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: byceps/byceps path: /tests/integration/blueprints/admin/webhook/test_views.py """ :Copyright: 2014-2023 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ <|fim_suffix|> url = '/admin/webhooks/' response = webhook_admin_client.get(url) assert response.stat...
code_fim
easy
{ "lang": "python", "repo": "byceps/byceps", "path": "/tests/integration/blueprints/admin/webhook/test_views.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: wingify/vwo-python-sdk path: /vwo/api/get_feature_variable_value.py # Copyright 2019-2022 Wingify Software Pvt. Ltd. # # 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 copy of the License at # #...
code_fim
hard
{ "lang": "python", "repo": "wingify/vwo-python-sdk", "path": "/vwo/api/get_feature_variable_value.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not variable: # Log variable not found vwo_instance.logger.log( LogLevelEnum.ERROR, LogMessageEnum.ERROR_MESSAGES.VARIABLE_NOT_FOUND.format( file=FILE, variable_key=variable_key, campaign_key=campaign_key, ...
code_fim
hard
{ "lang": "python", "repo": "wingify/vwo-python-sdk", "path": "/vwo/api/get_feature_variable_value.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = ["extent", "percentile"]<|fim_prefix|># repo: lace/polliwog path: /polliwog/pointcloud/__init__.py """ Functions for working with point clouds (i.e. unstructured sets of 3D points). """ <|fim_middle|>from ._pointcloud_functions import extent, percentile
code_fim
easy
{ "lang": "python", "repo": "lace/polliwog", "path": "/polliwog/pointcloud/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lace/polliwog path: /polliwog/pointcloud/__init__.py """ Functions for working with point clouds (i.e. unstructured sets of 3D points). """ <|fim_suffix|>__all__ = ["extent", "percentile"]<|fim_middle|>from ._pointcloud_functions import extent, percentile
code_fim
easy
{ "lang": "python", "repo": "lace/polliwog", "path": "/polliwog/pointcloud/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: FuckBrains/tw-fb-yt-datacollection path: /get_youtube_data.py import requests, shutil,json,time, codecs, csv,sys import pickle, os from datetime import datetime #Downloads data from YouTube. You may need to run this script several times as the API rate limit is limiting. chans = ['YOUTUBE_ID_OF...
code_fim
hard
{ "lang": "python", "repo": "FuckBrains/tw-fb-yt-datacollection", "path": "/get_youtube_data.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> s=requests.Session() for chan in chans: if not chan.strip() or os.path.isfile('vidlist/%s.p'% chan): continue url = 'https://www.googleapis.com/youtube/v3/search?key=' + API_KEY +'&channelId=' + chan + '&part=snippet,id&order=date&maxResults=50' print(chan) first = datetime....
code_fim
hard
{ "lang": "python", "repo": "FuckBrains/tw-fb-yt-datacollection", "path": "/get_youtube_data.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yaz/yaz path: /yaz/test/test_single_method.py #!/usr/bin/env python3 import yaz class SingleMethod(yaz.Plugin): @yaz.task def talk(self): return "I have very little to say." class Test(yaz.TestCase): <|fim_suffix|> """When only a single plugin with only a single method...
code_fim
medium
{ "lang": "python", "repo": "yaz/yaz", "path": "/yaz/test/test_single_method.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Test(yaz.TestCase): def test_010(self): """When only a single plugin with only a single method is available, then this should be called without needing to specify the plugin or task name""" caller = self.get_caller([SingleMethod]) self.assertEqual("I have very little to ...
code_fim
medium
{ "lang": "python", "repo": "yaz/yaz", "path": "/yaz/test/test_single_method.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Get options options = [] if length > 2: options = sys.argv[2:length] # Invoke the command command.execute(options) #print("Execute the command!") if __name__ == '__main__': main()<|fim_prefix|># repo: thomaspenin/orchid-font-tool path: /...
code_fim
hard
{ "lang": "python", "repo": "thomaspenin/orchid-font-tool", "path": "/orchid", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thomaspenin/orchid-font-tool path: /orchid #!/usr/bin/env python3 # Main entry point for the Orchid Font Tool # Call "./orchid help" for a list of supported commands <|fim_suffix|> # Invoke the command command.execute(options) #print("Execute the command!") if __name__ =...
code_fim
hard
{ "lang": "python", "repo": "thomaspenin/orchid-font-tool", "path": "/orchid", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Acrisel/eventor path: /eventor/concepts/sshcmd_popen.py #!/usr/bin/env python3 # adopted from https://gist.github.com/bortzmeyer/1284249 # Here is the right solution today: <|fim_suffix|> ssh = subprocess.Popen(["ssh", where, command], shell=False, ...
code_fim
hard
{ "lang": "python", "repo": "Acrisel/eventor", "path": "/eventor/concepts/sshcmd_popen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ssh = subprocess.Popen(["ssh", where, command], shell=False, stdin=stdin, stdout=stdout, stderr=stderr,) return ssh if __name__ == '__main__': pcomm = sshcmd("acrisel", "ls -l",) ...
code_fim
hard
{ "lang": "python", "repo": "Acrisel/eventor", "path": "/eventor/concepts/sshcmd_popen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TestingIaCwithNewAccount/aws-advanced path: /lambda/codeCommit.py import boto3 import json from botocore.vendored import requests import logging import os import sys import base64 logger = logging.getLogger() logger.setLevel(logging.INFO) s3_client = boto3.client('s3') s3 = boto3.resource('s3'...
code_fim
hard
{ "lang": "python", "repo": "TestingIaCwithNewAccount/aws-advanced", "path": "/lambda/codeCommit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># # # # # # # # # # # # # # # code to try clone the Repo from CodeCommit and upload to S3 #cloning(bucket) #bucket = os.environ['bucket'] #s3.Bucket(bucket).download_file(filename, '/tmp/error.html') #s3.meta.client.upload_file('/tmp/index.html', bucket, 'index.html') #print(os.pat...
code_fim
hard
{ "lang": "python", "repo": "TestingIaCwithNewAccount/aws-advanced", "path": "/lambda/codeCommit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Create a fake resource res = ResourceBase(manager=manager, interface=interf, resID='DEBUG') res.open = mock.Mock(return_value=True) res.isOpen = mock.Mock(return_value=True) res.close = mock.Mock(return_value=True) # Create a fake driver driver = DriverBase driver.open =...
code_fim
hard
{ "lang": "python", "repo": "caizikun/labtronyx", "path": "/tests/test_drivers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: caizikun/labtronyx path: /tests/test_drivers.py import unittest from nose.tools import * # PEP8 asserts import mock import labtronyx from labtronyx.bases import ResourceBase, DriverBase, InterfaceBase def test_drivers(): manager = labtronyx.InstrumentManager() for driver_uuid, driver...
code_fim
hard
{ "lang": "python", "repo": "caizikun/labtronyx", "path": "/tests/test_drivers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return name.replace('pool','p').replace('norm','n') # offline scripts configuration caffevis_outputs_dir = base_folder + './models/indoor/outputs' layers_to_output_in_offline_scripts = ['conv1', 'conv2', 'conv3', 'conv4', 'conv5', 'fc1', 'fc2', 'fc3', 'prob']<|fim_prefix|># repo: vpulab/MobiNetVideo_...
code_fim
medium
{ "lang": "python", "repo": "vpulab/MobiNetVideo_CNN_Visualization", "path": "/model_settings/settings_indoor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vpulab/MobiNetVideo_CNN_Visualization path: /model_settings/settings_indoor.py # basic network configuration base_folder = '%DVT_ROOT%/' caffevis_deploy_prototxt = base_folder + './models/indoor/alexnet_indoor.prototxt' caffevis_network_weights = base_folder + './models/indoor/alexnet_indoor.caf...
code_fim
medium
{ "lang": "python", "repo": "vpulab/MobiNetVideo_CNN_Visualization", "path": "/model_settings/settings_indoor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msincenselee/vnpy path: /vnpy/gateway/bitmex/bitmex_gateway.py uest): """""" self.rest_api.cancel_order(req) def query_account(self): """""" pass def query_position(self): """""" pass def query_history(self, req: HistoryRequest): ...
code_fim
hard
{ "lang": "python", "repo": "msincenselee/vnpy", "path": "/vnpy/gateway/bitmex/bitmex_gateway.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Record exception if not ConnectionError if not issubclass(exception_type, ConnectionError): self.on_error(exception_type, exception_value, tb, request) def on_send_order(self, data, request): """Websocket will push a new order status""" self.update_rate_l...
code_fim
hard
{ "lang": "python", "repo": "msincenselee/vnpy", "path": "/vnpy/gateway/bitmex/bitmex_gateway.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msincenselee/vnpy path: /vnpy/gateway/bitmex/bitmex_gateway.py pi.stop() self.ws_api.stop() def process_timer_event(self, event: Event): """""" self.rest_api.reset_rate_limit() class BitmexRestApi(RestClient): """ BitMEX REST API """ def __init__(se...
code_fim
hard
{ "lang": "python", "repo": "msincenselee/vnpy", "path": "/vnpy/gateway/bitmex/bitmex_gateway.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Muntaha-Islam0019/HackerRank-Solutions path: /Problem Solving/Algorithms/Sherlock and Array.py #!/bin/python3 import math import os import random import re import sys # # Complete the 'balancedSums' function below. # # The function is expected to return arr STRING. # The function accepts INTEGE...
code_fim
hard
{ "lang": "python", "repo": "Muntaha-Islam0019/HackerRank-Solutions", "path": "/Problem Solving/Algorithms/Sherlock and Array.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> T = int(input().strip()) for T_itr in range(T): n = int(input().strip()) arr = list(map(int, input().rstrip().split())) result = balancedSums(arr) fptr.write(result + '\n') fptr.close()<|fim_prefix|># repo: Muntaha-Islam0019/HackerRank-Solutions path: /Pro...
code_fim
medium
{ "lang": "python", "repo": "Muntaha-Islam0019/HackerRank-Solutions", "path": "/Problem Solving/Algorithms/Sherlock and Array.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: naoki-mizuno/initialpose_publisher path: /nodes/initialpose_publisher.py #!/usr/bin/env python2 import rospy import tf2_ros from geometry_msgs.msg import PoseWithCovarianceStamped from geometry_msgs.msg import PoseStamped import sys if __name__ != '__main__': sys.stderr('This program nee...
code_fim
hard
{ "lang": "python", "repo": "naoki-mizuno/initialpose_publisher", "path": "/nodes/initialpose_publisher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: transform = buf.lookup_transform(map_frame_id, base_frame_id, rospy.Time(0), rospy.Duration(3)) break except t...
code_fim
medium
{ "lang": "python", "repo": "naoki-mizuno/initialpose_publisher", "path": "/nodes/initialpose_publisher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _verify_sudo(): ''' we just check if the user is sudoers ''' sudo('cd .') def _add_postgres9_ppa(): ''' add postgresql 9.x ppa ''' if 'Ubuntu 12.04' not in sudo('cat /etc/issue.net'): sudo('add-apt-repository ppa:pitti/postgresql') def _install_dependencies(): ''' Ensu...
code_fim
hard
{ "lang": "python", "repo": "denimboy/pg_fabrep", "path": "/pg_fabrep/tasks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def parameter_default_values(): if 'postgres_version' not in env: env.postgres_version = '9.1' if 'cluster_name' not in env: env.cluster_name = 'main' if 'cluster_port' not in env: env.cluster_port = 5432 if 'pgmaster_ip' not in env: env.pgmaster_ip = '' ...
code_fim
hard
{ "lang": "python", "repo": "denimboy/pg_fabrep", "path": "/pg_fabrep/tasks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: denimboy/pg_fabrep path: /pg_fabrep/tasks.py ') pg_fabrep_path = dirname(abspath(__file__)) ######################### ## START pg_fabrep tasks ## ######################### @task def setup(): parameter_default_values() # test configuration start if not test_configuration(): ...
code_fim
hard
{ "lang": "python", "repo": "denimboy/pg_fabrep", "path": "/pg_fabrep/tasks.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: frank-bailey/axonius_api_client path: /axonius_api_client/tests/tests_cli/test_cli_serial.py # -*- coding: utf-8 -*- """Test suite for axonius_api_client.tools.""" from __future__ import absolute_import, division, print_function, unicode_literals import pytest from axonius_api_client import cli...
code_fim
hard
{ "lang": "python", "repo": "frank-bailey/axonius_api_client", "path": "/axonius_api_client/tests/tests_cli/test_cli_serial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Pass.""" rows = [{"cnx": [{"id": "1"}]}, {"id": "2"}, {"cnx": {"id": "3"}}] x = cli.serial.collapse_rows(rows=rows, key="cnx") exp = [{"id": "1"}, {"id": "2"}, {"id": "3"}] assert x == exp class TestCliObjToCsv(object): """Pass.""" def test_default(sel...
code_fim
hard
{ "lang": "python", "repo": "frank-bailey/axonius_api_client", "path": "/axonius_api_client/tests/tests_cli/test_cli_serial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_default(self): """Pass.""" ctx = utils.get_mockctx() rows = [{"id": "1"}, {"id": "2"}, {"id": "3"}] this_cmd = "bad wolf check --rows" src_cmds = ["bad wolf get"] keys = ["id"] cli.serial.ensure_keys( ctx=ctx, row...
code_fim
hard
{ "lang": "python", "repo": "frank-bailey/axonius_api_client", "path": "/axonius_api_client/tests/tests_cli/test_cli_serial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hihellobolke/nomadgen path: /examples/redis.py from nomadgen.jobspec.ttypes import * from nomadgen.jobspec.constants import * from nomadgen.util import export_if_last from common.resources import CommonResources from copy import deepcopy job=Job( Name='redis', ID='redis', Datacenters...
code_fim
hard
{ "lang": "python", "repo": "hihellobolke/nomadgen", "path": "/examples/redis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rkt_task.Driver="rkt" rkt_task.Config.image="docker://redis:3.2" rkt_task.Config.port_map=[{'db': '6379-tcp'}] qemu_tg = deepcopy(tg) qemu_task = deepcopy(task) qemu_tg.Name='qemu' qemu_task.Driver="qemu" qemu_task.Config=Config( image_path="osv-redis-memonly-v0.24.qemu.qcow2", accelerator="kvm...
code_fim
hard
{ "lang": "python", "repo": "hihellobolke/nomadgen", "path": "/examples/redis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def is_malformed(self): return True<|fim_prefix|># repo: bobjects/BobStack path: /bobstack/sipmessaging/malformedSIPMessage.py from sipMessage import SIPMessage <|fim_middle|> class MalformedSIPMessage(SIPMessage): @classmethod def new_for_attributes(cls, start_line=Non...
code_fim
hard
{ "lang": "python", "repo": "bobjects/BobStack", "path": "/bobstack/sipmessaging/malformedSIPMessage.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: bobjects/BobStack path: /bobstack/sipmessaging/malformedSIPMessage.py from sipMessage import SIPMessage class MalformedSIPMessage(SIPMessage): <|fim_suffix|> @property def is_malformed(self): return True<|fim_middle|> @classmethod def new_for_attributes(cls, start_line=Non...
code_fim
medium
{ "lang": "python", "repo": "bobjects/BobStack", "path": "/bobstack/sipmessaging/malformedSIPMessage.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: zachwood0s/dnd-inventory path: /sanctum_dnd/commands/help_text.py DICE_FMT = '<dice_fmt>' PLAYER = '<player>' TRAIT = '<trait>' ITEM_ID = '<it<|fim_suffix|>ABILITY = '<players_ability>' EFFECT_ID = '<effect_id>' PLAYERS_EFFECT = '<players_effect>' ANY_ID = '<any_id>' VALUE = '<value>' OBJ_TYPE = ...
code_fim
medium
{ "lang": "python", "repo": "zachwood0s/dnd-inventory", "path": "/sanctum_dnd/commands/help_text.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>layers_effect>' ANY_ID = '<any_id>' VALUE = '<value>' OBJ_TYPE = '<obj_type>'<|fim_prefix|># repo: zachwood0s/dnd-inventory path: /sanctum_dnd/commands/help_text.py DICE_FMT = '<dice_fmt>' PLAYER = '<player>' TRAIT = '<trait>' ITEM_ID = '<it<|fim_middle|>em_id>' PLAYERS_ITEM = '<players_item>' ABILITY_ID...
code_fim
medium
{ "lang": "python", "repo": "zachwood0s/dnd-inventory", "path": "/sanctum_dnd/commands/help_text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangyum/Anaconda path: /pkgs/networkx-1.11-py27_0/lib/python2.7/site-packages/networkx/testing/utils.py import operator from nose.tools import * __all__ = ['assert_nodes_equal', 'assert_edges_equal','assert_graphs_equal'] def assert_nodes_equal(nlist1, nlist2): # Assumes lists are either nod...
code_fim
hard
{ "lang": "python", "repo": "wangyum/Anaconda", "path": "/pkgs/networkx-1.11-py27_0/lib/python2.7/site-packages/networkx/testing/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def assert_graphs_equal(graph1, graph2): if graph1.is_multigraph(): edges1 = graph1.edges(data=True,keys=True) else: edges1 = graph1.edges(data=True) if graph2.is_multigraph(): edges2 = graph2.edges(data=True,keys=True) else: edges2 = graph2.edges(data=True...
code_fim
hard
{ "lang": "python", "repo": "wangyum/Anaconda", "path": "/pkgs/networkx-1.11-py27_0/lib/python2.7/site-packages/networkx/testing/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyaing/KDYSample path: /kYPython/Spider/spider_basic/spider_teiba.py #coding: utf-8 import urllib.request import ssl """ 抓取百度贴吧数据 """ def loadPage(url, fileName): """ 通过url发送请求,获取服务器响应文件 """ request = urllib.request.Request(url) context = ssl._create_unverified_context() response = urllib...
code_fim
medium
{ "lang": "python", "repo": "kyaing/KDYSample", "path": "/kYPython/Spider/spider_basic/spider_teiba.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 将html内容写到本地 """ with open(fileName, 'w') as f: f.write(fileName) def teibaSpider(url, beginPage, endPage): for page in range(beginPage, endPage+1): if beginPage == 0: pn = 0 else: pn = (page - 1) * 50 fileName = "第" + str(page) + "页.html" fullUrl = url + "&pn=" + str(pn) loadPa...
code_fim
medium
{ "lang": "python", "repo": "kyaing/KDYSample", "path": "/kYPython/Spider/spider_basic/spider_teiba.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: getlogbook/logbook path: /tests/test_logger.py import pytest import logbook def test_level_properties(logger): assert logger.level == logbook.NOTSET assert logger.level_name == "NOTSET" logger.level_name = "WARNING" assert logger.level == logbook.WARNING logger.level = logb...
code_fim
medium
{ "lang": "python", "repo": "getlogbook/logbook", "path": "/tests/test_logger.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_disabled_property(): class MyLogger(logbook.Logger): @property def disabled(self): return True logger = MyLogger() with pytest.raises(AttributeError): logger.enable() with pytest.raises(AttributeError): logger.disable()<|fim_prefix|>...
code_fim
hard
{ "lang": "python", "repo": "getlogbook/logbook", "path": "/tests/test_logger.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: StorjOld/upstream path: /tests/test_streamer.py #!/usr/bin/env python # -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2014 Paul Durivage for Storj Labs # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentati...
code_fim
hard
{ "lang": "python", "repo": "StorjOld/upstream", "path": "/tests/test_streamer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @mock.patch('requests.post') def test_upload_sharded_encoded(self, post): with self.assertRaises(NotImplementedError): self.stream._upload_sharded_encoded('http://fake.url', 'fake.path') @mock.patch('requests.post') def test_filestream(self, post): with self.as...
code_fim
hard
{ "lang": "python", "repo": "StorjOld/upstream", "path": "/tests/test_streamer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = "NextIO.vNet" pattern_syntax_error = rb"^ERROR: Invalid command -" pattern_operation_error = rb"^ERROR: " pattern_prompt = rb"^(?P<hostname>\S+)> "<|fim_prefix|># repo: nocproject/noc path: /sa/profiles/NextIO/vNet/profile.py # -----------------------------------------------------...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/sa/profiles/NextIO/vNet/profile.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Profile(BaseProfile): name = "NextIO.vNet" pattern_syntax_error = rb"^ERROR: Invalid command -" pattern_operation_error = rb"^ERROR: " pattern_prompt = rb"^(?P<hostname>\S+)> "<|fim_prefix|># repo: nocproject/noc path: /sa/profiles/NextIO/vNet/profile.py # ------------------------...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/sa/profiles/NextIO/vNet/profile.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nocproject/noc path: /sa/profiles/NextIO/vNet/profile.py # --------------------------------------------------------------------- # Vendor: NextIO # OS: vNet # --------------------------------------------------------------------- # Copyright (C) 2007-2013 The NOC Project # See LICENSE for deta...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/sa/profiles/NextIO/vNet/profile.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ 'bounding_box', 'calculate_origin_offset', 'max_energy_slice', 'sitk_new_blank_image', 'sitk_resample_to_spacing', 'sitk_resample_to_shape', 'sitk_resample_to_image', 'subdirs', 'now', 'LookupConfig' ]<|fim_prefix|># repo: mahdeto/delira path: /delira/utils...
code_fim
medium
{ "lang": "python", "repo": "mahdeto/delira", "path": "/delira/utils/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mahdeto/delira path: /delira/utils/__init__.py from .imageops import bounding_box, calculate_origin_offset, max_energy_slice, \ sitk_new_blank_image, sitk_resample_to_image, sitk_resample_to_shape, \ sitk_resample_to_spacing <|fim_suffix|>from .config import LookupConfig __all__ = [ ...
code_fim
medium
{ "lang": "python", "repo": "mahdeto/delira", "path": "/delira/utils/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for job in as_completed(futures): job.result() r = futures[job] logging.info("Part {} Completed.".format(r)) logging.info('Distances calculated.') t1 = time() logging.info('Time : {}m'.format((t1-t0)/60)) return def calc_distances(self, compactDegree = False): logging.in...
code_fim
hard
{ "lang": "python", "repo": "leoribeiro/struc2vec", "path": "/src/struc2vec.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leoribeiro/struc2vec path: /src/struc2vec.py # -*- coding: utf-8 -*- import numpy as np import random,sys,logging from concurrent.futures import ProcessPoolExecutor, as_completed from multiprocessing import Manager from time import time from collections import deque from utils import * from alg...
code_fim
hard
{ "lang": "python", "repo": "leoribeiro/struc2vec", "path": "/src/struc2vec.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with ProcessPoolExecutor(max_workers = self.workers) as executor: part = 1 for c in chunks: logging.info("Executing part {}...".format(part)) job = executor.submit(calc_distances, part, compactDegree = compactDegree) futures[job] = part part += 1 logging.info("Receiving res...
code_fim
hard
{ "lang": "python", "repo": "leoribeiro/struc2vec", "path": "/src/struc2vec.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gganssle/mixture-density-networks path: /scripts/numba_test.py import numba import numpy as np <|fim_suffix|>%%timeit mully(one,two)<|fim_middle|>one = np.ones((10000,10000)) two = np.ones((10000,10000)) def mully(a,b): np.matmul(a,b) %%timeit mully(one, two) @numba.jit def mully(a,b): ...
code_fim
medium
{ "lang": "python", "repo": "gganssle/mixture-density-networks", "path": "/scripts/numba_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gganssle/mixture-density-networks path: /scripts/numba_test.py import numba import numpy as np one = np.ones((10000,10000)) two = np.ones((10000,10000)) <|fim_suffix|>%%timeit mully(one,two)<|fim_middle|>def mully(a,b): np.matmul(a,b) %%timeit mully(one, two) @numba.jit def mully(a,b): ...
code_fim
medium
{ "lang": "python", "repo": "gganssle/mixture-density-networks", "path": "/scripts/numba_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>%%timeit mully(one, two) @numba.jit def mully(a,b): np.matmul(a,b) %%timeit mully(one,two)<|fim_prefix|># repo: gganssle/mixture-density-networks path: /scripts/numba_test.py import numba import numpy as np one = np.ones((10000,10000)) two = np.ones((10000,10000)) def mully(a,b): <|fim_middle|> ...
code_fim
easy
{ "lang": "python", "repo": "gganssle/mixture-density-networks", "path": "/scripts/numba_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }