text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: KaichenZhang/sentiment-analysis path: /main.py #!flask/bin/python import json import zipfile from urllib.request import urlopen from zipfile import ZipFile import shutil from flask import Flask, jsonify, render_template, flash, make_response, session, send_from_directory import os from flask impo...
code_fim
hard
{ "lang": "python", "repo": "KaichenZhang/sentiment-analysis", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> zip_ref.extractall(uuid_path) zip_ref.close() extracted_file_pos = "" extracted_file_neg = "" for each_filename in extracted: if pos_file(each_filename): extracted_file_pos = each_filename if not pos_file(each_filename): ...
code_fim
hard
{ "lang": "python", "repo": "KaichenZhang/sentiment-analysis", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bes-dev/vqvae_dwt_distiller.pytorch path: /train.py import argparse import os import torch import pytorch_lightning as pl import pytorch_lightning.loggers as pl_loggers from core.utils import load_cfg, load_weights from core.distiller import Distiller def build_logger(cfg): return getattr(pl...
code_fim
hard
{ "lang": "python", "repo": "bes-dev/vqvae_dwt_distiller.pytorch", "path": "/train.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": parser = argparse.ArgumentParser() # pipeline configure parser.add_argument("--gpus", type=int, default=0, help="number of available GPUs") parser.add_argument('--distributed-backend', type=str, default="ddp", choices=('dp', 'ddp', 'ddp2'), ...
code_fim
hard
{ "lang": "python", "repo": "bes-dev/vqvae_dwt_distiller.pytorch", "path": "/train.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: leocov-dev/lct-legacy path: /lct/src/lcTextureTools/lcTextureTools.py import os import pymel.core as pm import lct.src.core.lcColor as lcColor import lct.src.core.lcConfiguration as lcConfiguration import lct.src.core.lcPath as lcPath import lct.src.core.lcPrefs as lcPrefs import lct.src.core.l...
code_fim
hard
{ "lang": "python", "repo": "leocov-dev/lct-legacy", "path": "/lct/src/lcTextureTools/lcTextureTools.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def lcTxT_repath_selected(*args, **kwargs): ''' ''' textures = pm.ls(sl=True) textures = lcTexture.Texture.filterForTextures(textures) if textures: newPath = pm.textField(prefix + '_textField_new_path', query=True, text=True) if newPath: lcTexture.Texture.repath...
code_fim
hard
{ "lang": "python", "repo": "leocov-dev/lct-legacy", "path": "/lct/src/lcTextureTools/lcTextureTools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def lcTxT_repath_selected(*args, **kwargs): ''' ''' textures = pm.ls(sl=True) textures = lcTexture.Texture.filterForTextures(textures) if textures: newPath = pm.textField(prefix + '_textField_new_path', query=True, text=True) if newPath: lcTexture.Texture.repat...
code_fim
hard
{ "lang": "python", "repo": "leocov-dev/lct-legacy", "path": "/lct/src/lcTextureTools/lcTextureTools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from PIL import Image #use PIL to processs img import os import numpy as np #import cv2 #import when use opencv to process img if __name__ == "__main__" : #PIL image1 = Image.open('image1.png') image2 = Image.open('image2.png') #reduce size and grayscale image1=np.array(image1.r...
code_fim
medium
{ "lang": "python", "repo": "hizb-resume/LTD-local-track-to-detect-for-VID", "path": "/projects/adnet/mains/del_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hizb-resume/LTD-local-track-to-detect-for-VID path: /projects/adnet/mains/del_test.py import torch import torchvision from utils.my_util import aHash,Hamming_distance # print(torch.cuda.is_available()) # # a = torch.Tensor(5,3) # a=a.cuda() # print(a) # layers=[1,2,3,4,5,6,7,8,9] <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "hizb-resume/LTD-local-track-to-detect-for-VID", "path": "/projects/adnet/mains/del_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>a and c > b: maior = c cprint('''O maior número é o {} O menor número é o {}'''.format(maior, menor), 'green')<|fim_prefix|># repo: guilhermebaos/Curso-em-Video-Python path: /1_Python/Exercícios/Ex033_Maior_e_Menor.py from termcolor import colored, cprint a = float(input(colored('Escreve um número: '...
code_fim
hard
{ "lang": "python", "repo": "guilhermebaos/Curso-em-Video-Python", "path": "/1_Python/Exercícios/Ex033_Maior_e_Menor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: guilhermebaos/Curso-em-Video-Python path: /1_Python/Exercícios/Ex033_Maior_e_Menor.py from termcolor import colored, cprint a = float(input(colored('Escreve um número: ', 'blue'))) b = float(input(colored('Escreve outro número: ', 'blue'))) c = float(input(colored('E agora mais um: ', 'blue'))) m...
code_fim
medium
{ "lang": "python", "repo": "guilhermebaos/Curso-em-Video-Python", "path": "/1_Python/Exercícios/Ex033_Maior_e_Menor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a and b < c: menor = b if c < a and c < b: menor = c maior = a if b > c and b > a: maior = b if c > a and c > b: maior = c cprint('''O maior número é o {} O menor número é o {}'''.format(maior, menor), 'green')<|fim_prefix|># repo: guilhermebaos/Curso-em-Video-Python path: /1_Python/Exer...
code_fim
medium
{ "lang": "python", "repo": "guilhermebaos/Curso-em-Video-Python", "path": "/1_Python/Exercícios/Ex033_Maior_e_Menor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.__previous_job = None self.__current_job = None @staticmethod def _validate(response): if not response.ok: raise ServiceError('HTTP error', response.status_code) result = json.loads(response.text) if 'response' not in result: r...
code_fim
hard
{ "lang": "python", "repo": "routevo/routevo-python-sdk", "path": "/routevo/service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: routevo/routevo-python-sdk path: /routevo/service.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2017 Routevo # # You may use, distribute and modify this code under the # terms of the MIT license. # # You should have received a copy of the MIT license with # this file. If not, ...
code_fim
hard
{ "lang": "python", "repo": "routevo/routevo-python-sdk", "path": "/routevo/service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /script/hassfest/metadata.py """Package metadata validation.""" import tomllib from homeassistant.const import REQUIRED_PYTHON_VER, __version__ from .model import Config, Integration <|fim_suffix|> """Validate project metadata keys.""" metadata_path = config.r...
code_fim
medium
{ "lang": "python", "repo": "home-assistant/core", "path": "/script/hassfest/metadata.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: if data["project"]["version"] != __version__: config.add_error( "metadata", f"'project.version' value does not match '{__version__}'" ) except KeyError: config.add_error("metadata", "No 'metadata.version' key found!") required_py_ve...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/script/hassfest/metadata.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>.click() page_actions.wait_for_text_visible(driver, "42", "output", "id") js_utils.highlight_with_js(driver, "#output", 6, "") finally: driver.quit()<|fim_prefix|># repo: Rotbot9k/SeleniumBase path: /examples/raw_browser_launcher.py """ This script can be run with pure "python". (pytest ...
code_fim
medium
{ "lang": "python", "repo": "Rotbot9k/SeleniumBase", "path": "/examples/raw_browser_launcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rotbot9k/SeleniumBase path: /examples/raw_browser_launcher.py """ This script can be run with pure "python". (pytest not needed). "get_driver()" is from [seleniumbase/core/browser_launcher.py]. """ from seleniumbase import <|fim_suffix|>seleniumbase.io/apps/calculator") page_actions.wait...
code_fim
medium
{ "lang": "python", "repo": "Rotbot9k/SeleniumBase", "path": "/examples/raw_browser_launcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>seleniumbase.io/apps/calculator") page_actions.wait_for_element_visible(driver, "4", "id").click() page_actions.wait_for_element_visible(driver, "2", "id").click() page_actions.wait_for_text_visible(driver, "42", "output", "id") js_utils.highlight_with_js(driver, "#output", 6, "") fin...
code_fim
medium
{ "lang": "python", "repo": "Rotbot9k/SeleniumBase", "path": "/examples/raw_browser_launcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_output_error(cmd, **kwargs): """Return the exit status, stdout, stderr of a command""" if not isinstance(cmd, list): cmd = [cmd] logging.debug("Running: %s", ' '.join(map(quote, cmd))) try: result = Popen(cmd, stdout=PIPE, stderr=PIPE, **kwargs) except OSError ...
code_fim
hard
{ "lang": "python", "repo": "zeromq/pyzmq", "path": "/buildutils/misc.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_compiler(compiler, **compiler_attrs): """get and customize a compiler""" cc = copy.deepcopy(compiler) for name, val in compiler_attrs.items(): setattr(cc, name, val) return cc def get_output_error(cmd, **kwargs): """Return the exit status, stdout, stderr of a comma...
code_fim
hard
{ "lang": "python", "repo": "zeromq/pyzmq", "path": "/buildutils/misc.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zeromq/pyzmq path: /buildutils/misc.py """misc build utility functions""" # Copyright (c) PyZMQ Developers # Distributed under the terms of the Modified BSD License. import copy import logging import os import sys from pprint import pprint from shlex import quote from subprocess import PIPE, Po...
code_fim
hard
{ "lang": "python", "repo": "zeromq/pyzmq", "path": "/buildutils/misc.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hagleitn/Openstack-Devstack2 path: /devstack/distros/oneiric.py # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # Copyright (C) 2012 New Dream Network, LLC (DreamHost) All Rights Reserved. # # Licensed under the Apache License, Version 2...
code_fim
medium
{ "lang": "python", "repo": "hagleitn/Openstack-Devstack2", "path": "/devstack/distros/oneiric.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if name == 'rabbitmq-server': #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878597 #https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/878600 LOG.debug("Handling special install of %s." % (name)) #this seems to be a temp...
code_fim
hard
{ "lang": "python", "repo": "hagleitn/Openstack-Devstack2", "path": "/devstack/distros/oneiric.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> DB_NAME = AuthenticationBackends.FACEBOOK<|fim_prefix|># repo: glosoftgroup/glosoftgroup-django-pos path: /saleor/registration/backends/facebook.py from social_core.backends.facebook import FacebookOAuth2 from . import BaseBackend from ...site import AuthenticationBackends <|fim_middle|>clas...
code_fim
easy
{ "lang": "python", "repo": "glosoftgroup/glosoftgroup-django-pos", "path": "/saleor/registration/backends/facebook.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: glosoftgroup/glosoftgroup-django-pos path: /saleor/registration/backends/facebook.py from social_core.backends.facebook import FacebookOAuth2 from . import BaseBackend from ...site import AuthenticationBackends <|fim_suffix|> DB_NAME = AuthenticationBackends.FACEBOOK<|fim_middle|>clas...
code_fim
easy
{ "lang": "python", "repo": "glosoftgroup/glosoftgroup-django-pos", "path": "/saleor/registration/backends/facebook.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> log.debug('Query.__init__') self.view = view self.statements = statements or [] def filter(self, statement: Statement) -> 'Query': log.debug('Query.filter') return Query(self.view, self.statements + [statement]) def fetch(self) -> Iterable[Model]: ...
code_fim
medium
{ "lang": "python", "repo": "ndenny/dictabase", "path": "/dictabase/query.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ndenny/dictabase path: /dictabase/query.py import logging from typing import Optional, Iterable from . import View from . import Model from . import Statement <|fim_suffix|> def __init__(self, view: View, statements: Optional[Iterable[Statement]] = None): log.debug('Query.__init__') ...
code_fim
medium
{ "lang": "python", "repo": "ndenny/dictabase", "path": "/dictabase/query.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kbaseapps/SetAPI path: /lib/SetAPI/util.py """ This module contains some utility functions for the SetAPI. """ import os import re from installed_clients.DataFileUtilClient import DataFileUtil <|fim_suffix|> def dfu_get_obj_data(obj_ref): dfu = DataFileUtil(os.environ['SDK_CALLBACK_URL']) ...
code_fim
hard
{ "lang": "python", "repo": "kbaseapps/SetAPI", "path": "/lib/SetAPI/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dfu = DataFileUtil(os.environ['SDK_CALLBACK_URL']) obj_data = dfu.get_objects( {"object_refs": [obj_ref]})['data'][0]['data'] return obj_data<|fim_prefix|># repo: kbaseapps/SetAPI path: /lib/SetAPI/util.py """ This module contains some utility functions for the SetAPI. """ import os ...
code_fim
hard
{ "lang": "python", "repo": "kbaseapps/SetAPI", "path": "/lib/SetAPI/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> keep_files=False, multiple_delim=False, dst_folder='./raw_data'): """ Performs a hievpy search and loads results into a pandas dataframe given the file records Input ----- Required - api_token: HIEv API token/key - base_url: Base URL o...
code_fim
hard
{ "lang": "python", "repo": "gdevine/hievpy", "path": "/build/lib/hievpy/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gdevine/hievpy path: /build/lib/hievpy/__init__.py import urllib.request import urllib.parse import json import pandas as pd import requests import io import tqdm from pathlib import Path import os import shutil from hievpy.utils import * # ------------------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "gdevine/hievpy", "path": "/build/lib/hievpy/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hochthom/chord_progression path: /sample_lstm.py '''Example script to generate text from Nietzsche's writings. At least 20 epochs are required before the generated text starts sounding coherent. It is recommended to run this script on GPU, as recurrent networks are quite computationally intensi...
code_fim
hard
{ "lang": "python", "repo": "hochthom/chord_progression", "path": "/sample_lstm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in xrange(48): if len(gen_seq) % 5 == 0: gen_seq.append('|') x[0,:-1,:] = x[0,1:,:] x[0,-1,:] = 0 x[0,-1,-1] = 1 preds = model.predict(x, verbose=0)[0] ...
code_fim
hard
{ "lang": "python", "repo": "hochthom/chord_progression", "path": "/sample_lstm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_two_sums_not_found(self): test = two_sums(nums=self.nums, target=self.wrong_target) self.assertNotEqual(test, '[0, 1]') self.assertEqual(test, 'No two sum solution') def test_two_sums_brute_force(self): self.assertEqual(two_sums_brute_force( nu...
code_fim
medium
{ "lang": "python", "repo": "christopher-burke/python-scripts", "path": "/tests/test_two_sums_unittest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: christopher-burke/python-scripts path: /tests/test_two_sums_unittest.py import unittest from two_sum import two_sums, two_sums_brute_force class TestTwoSums(unittest.TestCase): <|fim_suffix|> def test_two_sums_brute_force(self): self.assertEqual(two_sums_brute_force( num...
code_fim
hard
{ "lang": "python", "repo": "christopher-burke/python-scripts", "path": "/tests/test_two_sums_unittest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test = two_sums(nums=self.nums, target=self.wrong_target) self.assertNotEqual(test, '[0, 1]') self.assertEqual(test, 'No two sum solution') def test_two_sums_brute_force(self): self.assertEqual(two_sums_brute_force( nums=self.nums, target=self.target), '[0,...
code_fim
medium
{ "lang": "python", "repo": "christopher-burke/python-scripts", "path": "/tests/test_two_sums_unittest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datalad/datalad-metalad path: /datalad_metalad/extractors/metalad_example_dataset.py # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 et: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPY...
code_fim
hard
{ "lang": "python", "repo": "datalad/datalad-metalad", "path": "/datalad_metalad/extractors/metalad_example_dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "0.0.1" def get_data_output_category(self) -> DataOutputCategory: return DataOutputCategory.IMMEDIATE def get_required_content(self) -> bool: return True def extract(self, _=None) -> ExtractorResult: return ExtractorResult( extractor_versio...
code_fim
medium
{ "lang": "python", "repo": "datalad/datalad-metalad", "path": "/datalad_metalad/extractors/metalad_example_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(Adam, self).__init__(module, lr) # TODO Initialize the attributes # of Adam optimizer. ... self.beta = [0.99,0.999] self.eps = 1e-7 # End of todo def _update_weight(self, tensor): # TODO Update the weight of # tensor in A...
code_fim
hard
{ "lang": "python", "repo": "yvr1037/hello-dian.ai", "path": "/lab1/nn/optim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yvr1037/hello-dian.ai path: /lab1/nn/optim.py from .tensor import Tensor from .modules import Module # 几类优化器的实现 class Optim(object): def __init__(self, module, lr): self.module = module self.lr = lr def step(self): self._step_module(self.module) def _step_m...
code_fim
hard
{ "lang": "python", "repo": "yvr1037/hello-dian.ai", "path": "/lab1/nn/optim.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openprocurement/openregistry.concierge path: /openregistry/concierge/basic/tests/main.py import os import pytest ROOT = '/'.join(os.path.dirname(__file__).split('/')[:-3]) COVER_PACKAGE = '.'.join(__package__.split('.')[:-1]) <|fim_suffix|> source = [ROOT, '--cov={}'.format(COVER_PACKAGE)] ...
code_fim
easy
{ "lang": "python", "repo": "openprocurement/openregistry.concierge", "path": "/openregistry/concierge/basic/tests/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> source = [ROOT, '--cov={}'.format(COVER_PACKAGE)] for arg in args: source.append(arg) pytest.main(source)<|fim_prefix|># repo: openprocurement/openregistry.concierge path: /openregistry/concierge/basic/tests/main.py import os import pytest ROOT = '/'.join(os.path.dirname(__file__).sp...
code_fim
easy
{ "lang": "python", "repo": "openprocurement/openregistry.concierge", "path": "/openregistry/concierge/basic/tests/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def create_graph(predicted_ids, parent_ids, scores, vocab=None): def get_node_name(pred): return vocab[pred] if vocab else str(pred) seq_length = predicted_ids.shape[0] graph = nx.DiGraph() for level in range(seq_length): names = [get_node_name(pred) for pred in predicted_...
code_fim
hard
{ "lang": "python", "repo": "dbpedia/neural-rdf-verbalizer", "path": "/src/tools/generate_beam_viz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for idx in range(len(beam_data["predicted_ids"])): predicted_ids = beam_data["predicted_ids"][idx] parent_ids = beam_data["beam_parent_ids"][idx] scores = beam_data["scores"][idx] graph = create_graph( predicted_ids=predicted_ids, parent_ids=par...
code_fim
hard
{ "lang": "python", "repo": "dbpedia/neural-rdf-verbalizer", "path": "/src/tools/generate_beam_viz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbpedia/neural-rdf-verbalizer path: /src/tools/generate_beam_viz.py #! /usr/bin/env python # Copyright 2017 Google Inc. # # 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": "dbpedia/neural-rdf-verbalizer", "path": "/src/tools/generate_beam_viz.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FedML-AI/FedML path: /python/fedml/model/cv/darts/visualize.py import sys from graphviz import Digraph def plot(genotype, filename): g = Digraph( format="pdf", edge_attr=dict(fontsize="20", fontname="times"), node_attr=dict( style="filled", s...
code_fim
hard
{ "lang": "python", "repo": "FedML-AI/FedML", "path": "/python/fedml/model/cv/darts/visualize.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(steps): g.node(str(i), fillcolor="lightblue") for i in range(steps): for k in [2 * i, 2 * i + 1]: op, j = genotype[k] if j == 0: u = "c_{k-2}" elif j == 1: u = "c_{k-1}" else: ...
code_fim
medium
{ "lang": "python", "repo": "FedML-AI/FedML", "path": "/python/fedml/model/cv/darts/visualize.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> genotype_name = sys.argv[1] try: print(genotype_name) # genotype = MY_ARCT4 genotype = eval("genotypes.{}".format(genotype_name)) except AttributeError: print("{} is not specified in genotypes.py".format(genotype_name)) sys.exit(1) plot(genotype.nor...
code_fim
hard
{ "lang": "python", "repo": "FedML-AI/FedML", "path": "/python/fedml/model/cv/darts/visualize.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PanDAWMS/panda-harvester path: /pandaharvester/harvesterpreparator/analysis_aux_preparator.py import os import shutil try: import subprocess32 as subprocess except Exception: import subprocess import requests import requests.exceptions from pandaharvester.harvestercore.plugin_base impor...
code_fim
hard
{ "lang": "python", "repo": "PanDAWMS/panda-harvester", "path": "/pandaharvester/harvesterpreparator/analysis_aux_preparator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # resolve input file paths def resolve_input_paths(self, jobspec): pathInfo = dict() for tmpFileSpec in jobspec.inFiles: url = tmpFileSpec.lfn accPath = self.make_local_access_path(tmpFileSpec.scope, tmpFileSpec.lfn) pathInfo[tmpFileSpec.lfn] = {...
code_fim
hard
{ "lang": "python", "repo": "PanDAWMS/panda-harvester", "path": "/pandaharvester/harvesterpreparator/analysis_aux_preparator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :return: A list of unittest.TestCase classes """ # If we are in a source folder and these tests aren't installed as a # package, we want to load asn1crypto from this source folder tests_dir = os.path.dirname(os.path.abspath(__file__)) asn1crypto = None if os.path.base...
code_fim
hard
{ "lang": "python", "repo": "ossdev07/asn1crypto", "path": "/tests/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ossdev07/asn1crypto path: /tests/__init__.py # coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import imp import os import unittest __version__ = '1.2.0' __version_info__ = (1, 2, 0) def _import_from(mod, path, mod_dir=None): """ Impor...
code_fim
hard
{ "lang": "python", "repo": "ossdev07/asn1crypto", "path": "/tests/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: novopl/restible-appengine path: /src/restible_appengine/resource.py # -*- coding: utf-8 -*- # Copyright 2018-2019 Mateusz Klos # # 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 Lice...
code_fim
hard
{ "lang": "python", "repo": "novopl/restible-appengine", "path": "/src/restible_appengine/resource.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return item def update_item(self, request, params, payload): item = self.item_for_request(request) if item is None: return None payload.pop('id', None) restible.util.update_from_values(item, payload) item.put() return item de...
code_fim
hard
{ "lang": "python", "repo": "novopl/restible-appengine", "path": "/src/restible_appengine/resource.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fib1, fib2 = 1, 2 while fib1 < maxnumber: yield fib1 fib1, fib2 = fib2, fib1 + fib2 print(sum(f for f in fibs(4000000) if f % 2 == 0))<|fim_prefix|># repo: mazayus/ProjectEuler path: /problem002.py #!/usr/bin/env python3 <|fim_middle|>def fibs(maxnumber):
code_fim
easy
{ "lang": "python", "repo": "mazayus/ProjectEuler", "path": "/problem002.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mazayus/ProjectEuler path: /problem002.py #!/usr/bin/env python3 <|fim_suffix|>print(sum(f for f in fibs(4000000) if f % 2 == 0))<|fim_middle|>def fibs(maxnumber): fib1, fib2 = 1, 2 while fib1 < maxnumber: yield fib1 fib1, fib2 = fib2, fib1 + fib2
code_fim
medium
{ "lang": "python", "repo": "mazayus/ProjectEuler", "path": "/problem002.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CTPUG/mdx_staticfiles path: /mdx_staticfiles.py import re from django.templatetags.static import static from markdown.extensions import Extension from markdown.postprocessors import Postprocessor assetRE = re.compile(r'{% static (\'|"|&quot;)(.*?)(\1) %}') class DjangoStaticAssetsProcessor(P...
code_fim
medium
{ "lang": "python", "repo": "CTPUG/mdx_staticfiles", "path": "/mdx_staticfiles.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> class StaticfilesExtension(Extension): def extendMarkdown(self, md, md_globals=None): md.postprocessors.register( DjangoStaticAssetsProcessor(md), 'staticfiles', 20) def makeExtension(**kwargs): return StaticfilesExtension(**kwargs)<|fim_prefix|># repo: CTPUG/mdx_staticfiles...
code_fim
medium
{ "lang": "python", "repo": "CTPUG/mdx_staticfiles", "path": "/mdx_staticfiles.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> def ceil(x): """Return the ceiling of x as a float, but fudge it by epsilon""" # if x is within MACHINE_EPS of an integer, return that integer if abs(x - round(x)) < MACHINE_EPS: return round(x) # otherwise, return the ceiling of x return math.ceil(x) def floor(x): """Re...
code_fim
medium
{ "lang": "python", "repo": "OMG-ICFP-FTW/icfp2021", "path": "/aray/aray/util.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: OMG-ICFP-FTW/icfp2021 path: /aray/aray/util.py #!/usr/bin/env python3 # util.py - utility functions import math from .types import Point MACHINE_EPS = 1e-9 def dist(a: Point, b: Point): """Return the squared distance between two points""" return (a.x - b.x) ** 2 + (a.y - b.y) ** 2 <...
code_fim
hard
{ "lang": "python", "repo": "OMG-ICFP-FTW/icfp2021", "path": "/aray/aray/util.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if res[0] == 'Process Order Finish Item': finish_dict[res[1]] = [res[2],res[3]] process_order_lst = [] if process_dict: process_orders = frappe.get_list('Process Order', filters=process_dict, fields=('name')) for p in process_ord...
code_fim
hard
{ "lang": "python", "repo": "resourcefactor/mjt", "path": "/mjt/mjt/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: resourcefactor/mjt path: /mjt/mjt/util.py import frappe from frappe import _ from frappe.desk.reportview import get_match_cond, get_filters_cond from frappe.model.mapper import get_mapped_doc import json from frappe import _ @frappe.whitelist() @frappe.validate_and_sanitize_search_inputs def ge...
code_fim
hard
{ "lang": "python", "repo": "resourcefactor/mjt", "path": "/mjt/mjt/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fields = [ "name", "confirmed", "datetime", "email", "phone", "comments", "deprel_comments", ] readonly_fields = ("name", "email", "phone", "comments") list_display = ( "name", "confirmed", "email", "d...
code_fim
medium
{ "lang": "python", "repo": "erictang000/hknweb", "path": "/hknweb/tours/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: erictang000/hknweb path: /hknweb/tours/admin.py from django.contrib import admin from .models import DepTour <|fim_suffix|> fields = [ "name", "confirmed", "datetime", "email", "phone", "comments", "deprel_comments", ] readonly_...
code_fim
medium
{ "lang": "python", "repo": "erictang000/hknweb", "path": "/hknweb/tours/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> instance = main_class() self.assertEqual(instance.value, date(2007,12, 18)) with self.assertRaises(TraitError): instance.value = 0.2 instance.value = date(2008,12, 18) self.assertEqual(instance.value, date(2008,12, 18)) def test_bounded_python(sel...
code_fim
hard
{ "lang": "python", "repo": "enthought/enaml", "path": "/enaml/tests/util/test_bounded.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: enthought/enaml path: /enaml/tests/util/test_bounded.py #------------------------------------------------------------------------------ # Copyright (c) 2011, Enthought, Inc. # All rights reserved. #------------------------------------------------------------------------------ import unittest fr...
code_fim
hard
{ "lang": "python", "repo": "enthought/enaml", "path": "/enaml/tests/util/test_bounded.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Test dynamic initialization. """ value = self.traits_instance.value self.assertAlmostEqual(value, 0.2) def test_assigment(self): """ Test assigment. """ instance = self.traits_instance instance.value = 0.7 self.assertAlmostEqual(instance.val...
code_fim
hard
{ "lang": "python", "repo": "enthought/enaml", "path": "/enaml/tests/util/test_bounded.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: imclab/harvest-scheduler path: /scheduler/prep_data.py import numpy as np import json import math import sqlite3 def from_random(stands, mgmts, timeperiods, numvars): # consistently generate a random set np.random.seed(42) # 4D: stands, mgmts, time periods, variables stand_data ...
code_fim
hard
{ "lang": "python", "repo": "imclab/harvest-scheduler", "path": "/scheduler/prep_data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> sql = """ SELECT * FROM fvsaggregate WHERE var = '%(var)s' AND rx = %(rx)d AND cond = %(cond)d AND site = %(site)d AND climate = '%(climate)s' AND "offset" = %(offset)d ...
code_fim
hard
{ "lang": "python", "repo": "imclab/harvest-scheduler", "path": "/scheduler/prep_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> conn = sqlite3.connect(db) conn.row_factory = sqlite3.Row cursor = conn.cursor() # Check cache if cache: try: stand_data = np.load('cache.array.npy') axis_map = json.loads(open('cache.axis_map').read()) valid_mgmts = json.loads(...
code_fim
hard
{ "lang": "python", "repo": "imclab/harvest-scheduler", "path": "/scheduler/prep_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> buttondivide = toga.Button('÷',on_press=partial(self.enterdata,number='/')) calculate = toga.Button('CALCULATE',on_press=self.calculate) calculate.style.width = 300 calculate.style.padding_top = 30 #adding box1.add(self.input_text) box2.add(button7...
code_fim
hard
{ "lang": "python", "repo": "abirshandilya07/Python-Calculator-Android-App", "path": "/calculator/src/calculator/app.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> main_box.style.update(direction=COLUMN) self.main_window = toga.MainWindow(title=self.formal_name) self.main_window.content = main_box self.main_window.show() def enterdata(self,widget,number): if (number == "C"): self.input_text.value = "" ...
code_fim
hard
{ "lang": "python", "repo": "abirshandilya07/Python-Calculator-Android-App", "path": "/calculator/src/calculator/app.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: abirshandilya07/Python-Calculator-Android-App path: /calculator/src/calculator/app.py """ A basic calculator beeware application """ import toga from toga.style import Pack from toga.style.pack import COLUMN, ROW from functools import partial class Calculator(toga.App): def startup(self): ...
code_fim
hard
{ "lang": "python", "repo": "abirshandilya07/Python-Calculator-Android-App", "path": "/calculator/src/calculator/app.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> args = parser.parse_args() use_cuda = args.gpu >= 0 and torch.cuda.is_available() if use_cuda: cudnn.benchmark = True device = torch.device(f"cuda:{args.gpu}" if use_cuda else "cpu") print(f"using device {device}") mean = np.loadtxt("../data/mean.txt") sigma = np.load...
code_fim
hard
{ "lang": "python", "repo": "TaizoAyase/video_classification", "path": "/training/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> val_data_loader = torch.utils.data.DataLoader( val_dataset, batch_size=args.batch_size, shuffle=True, **kwargs ) model = models.__dict__[args.arch]() model.to(device) optimizer = torch.optim.SGD( model.parameters(), args.lr, momentum=args.momentum, ...
code_fim
hard
{ "lang": "python", "repo": "TaizoAyase/video_classification", "path": "/training/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TaizoAyase/video_classification path: /training/main.py import argparse import json from pathlib import Path import numpy as np import pytorch_pfn_extras as ppe import pytorch_pfn_extras.training.extensions as extensions import torch import torch.backends.cudnn as cudnn import torch.nn as nn imp...
code_fim
hard
{ "lang": "python", "repo": "TaizoAyase/video_classification", "path": "/training/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Set up the fake file system""" self.setUpPyfakefs() class DynamicImportPatchTest(TestPyfakefsUnittestBase): def __init__(self, methodName="runTest"): super(DynamicImportPatchTest, self).__init__(methodName) def test_os_patch(self): import os os.mkdir(...
code_fim
medium
{ "lang": "python", "repo": "davidlbaird/pyfakefs-1", "path": "/pyfakefs/tests/dynamic_patch_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> file_path = "test.txt" path = pathlib.Path(file_path) with path.open("w") as f: f.write("test") self.assertTrue(self.fs.exists(file_path)) file_object = self.fs.get_object(file_path) self.assertEqual("test", file_object.contents) if __name__ =...
code_fim
hard
{ "lang": "python", "repo": "davidlbaird/pyfakefs-1", "path": "/pyfakefs/tests/dynamic_patch_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidlbaird/pyfakefs-1 path: /pyfakefs/tests/dynamic_patch_test.py # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # #...
code_fim
hard
{ "lang": "python", "repo": "davidlbaird/pyfakefs-1", "path": "/pyfakefs/tests/dynamic_patch_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: whysqwhw/catapult path: /dashboard/sandwich_verification/cabe_grpc/service_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: service.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.prot...
code_fim
hard
{ "lang": "python", "repo": "whysqwhw/catapult", "path": "/dashboard/sandwich_verification/cabe_grpc/service_pb2.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rservice.proto\x12\ncabe.proto\x1a\x0e\x61nalysis.proto\x1a\nspec.proto\"b\n\x12GetAnalysisRequest\x12\x17\n\x0fpinpoint_job_id\x18\x01 \x01(\t\x12\x33\n\x0f\x65xperiment_spec\x18\x02 \x01(\x0b\x32\x1a.cabe.proto.ExperimentSpec\"\x80\x01\n\x13...
code_fim
medium
{ "lang": "python", "repo": "whysqwhw/catapult", "path": "/dashboard/sandwich_verification/cabe_grpc/service_pb2.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>m % 2 == 0 else "O" for num in range(1,4)] for num in range(1,4)] =}')<|fim_prefix|># repo: norbertosanchezdichi/TIL path: /Python3/Lists/nested_comprehension.py nested_list = [list(range(1,4)), list(range(4,7)), list(range(8,10))] print(f'{nested_list =}') print(f'{[[single_list for single_list in n<|fi...
code_fim
medium
{ "lang": "python", "repo": "norbertosanchezdichi/TIL", "path": "/Python3/Lists/nested_comprehension.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ested_list] for single_list in nested_list] =}') print(f'{[["X" if num % 2 == 0 else "O" for num in range(1,4)] for num in range(1,4)] =}')<|fim_prefix|># repo: norbertosanchezdichi/TIL path: /Python3/Lists/nested_comprehension.py nested_list = [list(range(1,4)), list(range(4,7)), list(range(8,10))]<|fi...
code_fim
medium
{ "lang": "python", "repo": "norbertosanchezdichi/TIL", "path": "/Python3/Lists/nested_comprehension.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: norbertosanchezdichi/TIL path: /Python3/Lists/nested_comprehension.py nested_list = [list(range(1,4)), list(range(4,7)), list(range(8,10))]<|fim_suffix|>m % 2 == 0 else "O" for num in range(1,4)] for num in range(1,4)] =}')<|fim_middle|> print(f'{nested_list =}') print(f'{[[single_list for single...
code_fim
medium
{ "lang": "python", "repo": "norbertosanchezdichi/TIL", "path": "/Python3/Lists/nested_comprehension.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition path: /Chapter13/adhoc/sync_bench.py #!/usr/bin/env python3 import time import timeit import gym import ptan import os import sys sys.path.append(os.getcwd()) from lib import common import torch import torch.nn as nn # Result...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition", "path": "/Chapter13/adhoc/sync_bench.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return ptan.common.wrappers.wrap_dqn(gym.make("PongNoFrameskip-v4")) def new_sync(tgt_net, src_net): assert isinstance(tgt_net, nn.Module) assert isinstance(src_net, nn.Module) for tgt, src in zip(tgt_net.parameters(), src_net.parameters()): tgt.data.copy_(src.data, broadcast=Fal...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Deep-Reinforcement-Learning-Hands-On-Second-Edition", "path": "/Chapter13/adhoc/sync_bench.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: erdos-project/pylot path: /pylot/simulation/perfect_lane_detector_operator.py import os from collections import deque import PIL.Image as Image import erdos from erdos import Message, ReadStream, Timestamp, WriteStream import numpy as np from pylot.perception.messages import LanesMessage cl...
code_fim
hard
{ "lang": "python", "repo": "erdos-project/pylot", "path": "/pylot/simulation/perfect_lane_detector_operator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: pose_msg: Contains the current location of the ego vehicle. """ self._logger.debug('@{}: received watermark'.format(timestamp)) if timestamp.is_top: return bgr_msg = self._bgr_msgs.popleft() pose_msg = self._pose_msgs.popleft() ...
code_fim
hard
{ "lang": "python", "repo": "erdos-project/pylot", "path": "/pylot/simulation/perfect_lane_detector_operator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> protocol=eventlet.wsgi.HttpProtocol, backlog=128, use_ssl=False, max_url_len=None): """Initialize, but do not start, a WSGI server. :param name: Pretty name for logging. :param app: The WSGI application to serve. :param host: I...
code_fim
hard
{ "lang": "python", "repo": "fajoy/openstack-hello", "path": "/hello/hello/wsgi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :param name: Name of the application to load. :returns: Paste URLMap object wrapping the requested application. """ LOG.debug(_("Loading app %(name)s from %(path)s") % {'name': name, 'path': self.config_path}) return deploy.loadapp("config:%s" ...
code_fim
hard
{ "lang": "python", "repo": "fajoy/openstack-hello", "path": "/hello/hello/wsgi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fajoy/openstack-hello path: /hello/hello/wsgi.py import os from paste import deploy from oslo.config import cfg from openstack.common import excutils from openstack.common.gettextutils import _ from openstack.common import log as logging import webob import eventlet import eventlet.wsgi import g...
code_fim
hard
{ "lang": "python", "repo": "fajoy/openstack-hello", "path": "/hello/hello/wsgi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_sketch_preserves_vector_norm(self): n_errors = 0 n_sketch_rows = int(np.ceil(2. / (0.01 * 0.5**2))) true_norm = np.linalg.norm(self.x) for seed in self.seeds: sketch = clarkson_woodruff_transform( self.x, n_sketch_rows, seed=seed, ...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/scipy/py3/scipy/linalg/tests/test_sketches.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/scipy/py3/scipy/linalg/tests/test_sketches.py """Tests for _sketches.py.""" import numpy as np from numpy.testing import assert_, assert_equal from scipy.linalg import clarkson_woodruff_transform from scipy.linalg._sketches import cwt_matrix from scipy.spa...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/scipy/py3/scipy/linalg/tests/test_sketches.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def do_POST(self): parsed_path = urlparse(self.path) print( "Headers are ",self.headers) print( "Parsed path is",parsed_path.path) content_len = int(self.headers.get('content-length', 0)) print( "Content len is", content_len) print( "body is: ", self.rfi...
code_fim
medium
{ "lang": "python", "repo": "Seekatar/GpioPlayground", "path": "/UsbReadWrite/HttpServerDumper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.send_response(200) self.end_headers() self.wfile.write('{"result":"ok"}'.encode()) return if __name__ == '__main__': server = socketserver.TCPServer(('', 8081), GetHandler) print ('Starting server, use <Ctrl-C> to stop') server.serve_forever()<|fim_pr...
code_fim
hard
{ "lang": "python", "repo": "Seekatar/GpioPlayground", "path": "/UsbReadWrite/HttpServerDumper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Seekatar/GpioPlayground path: /UsbReadWrite/HttpServerDumper.py import http.server import socketserver import webbrowser as web from urllib.parse import urlparse import serial import time alertMsg = bytearray([2,0,0,0]) path = "C:\\code\\GpioPlayground\\UsbReadWrite\\" # need trailing slash cla...
code_fim
medium
{ "lang": "python", "repo": "Seekatar/GpioPlayground", "path": "/UsbReadWrite/HttpServerDumper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#inputfilename = "D:/results/invprop_bad_mcmnf_revised/InverseProportionBad_average_0.txt" #outputfilename = "D:/results/invprop_bad_mcmnf_revised/InverseProportionBad_estimate_statistics_single_0.pdf" #inputfilename = "D:/results/logreg-zero_mcmnf_revised/LogisticModelZero_average_0.txt" #outputfilenam...
code_fim
medium
{ "lang": "python", "repo": "horribleheffalump/MinimaxResearch", "path": "/CMNFvsUT/OutputScripts/estimate_statistics_single.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: horribleheffalump/MinimaxResearch path: /CMNFvsUT/OutputScripts/estimate_statistics_single.py import matplotlib import matplotlib.pyplot as plt from matplotlib import gridspec import numpy as np matplotlib.rc('text', usetex = True) import pylab import sys import os import pandas as pd inputfilen...
code_fim
hard
{ "lang": "python", "repo": "horribleheffalump/MinimaxResearch", "path": "/CMNFvsUT/OutputScripts/estimate_statistics_single.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def spin(): polyData = vtk.vtkPolyData() reader.GetPointCloud(polyData) frame_id = reader.GetFrameId() sec = reader.GetSec() nsec = reader.GetNsec() message = str(polyData.GetNumberOfPoints()) + " points, " message += frame_id + ", " + str(sec) + "." + str(nsec) print(messa...
code_fim
medium
{ "lang": "python", "repo": "ori-drs/director", "path": "/src/python/demos/demoPointCloud.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }