text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> for testcase in testcases: assert testcase.get('name') in [key[0] for key in _ERROR_MAP.keys()] assert len(testcase.findall('error')) > 0 for error in testcase.findall('error'): assert error.get('message') in [key[1] for key in _ERROR_MAP.keys()] assert ...
code_fim
hard
{ "lang": "python", "repo": "colcon/colcon-sanitizer-reports", "path": "/test/test_xml_output_generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with importlib.resources.path("gufe.tests.data", "181l.cif") as filename: protein_comp = get_molecule(str(filename)) assert isinstance(protein_comp, ProteinComponent) assert isinstance(protein_comp.to_rdkit(), Chem.Mol)<|fim_prefix|># repo: OpenFreeEnergy/openfe path: /openfe...
code_fim
hard
{ "lang": "python", "repo": "OpenFreeEnergy/openfe", "path": "/openfecli/tests/parameters/test_protein.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenFreeEnergy/openfe path: /openfecli/tests/parameters/test_protein.py import importlib from importlib import resources from rdkit import Chem from gufe import ProteinComponent from openfecli.parameters.protein import get_molecule <|fim_suffix|> with importlib.resources.path("gufe.tests.dat...
code_fim
medium
{ "lang": "python", "repo": "OpenFreeEnergy/openfe", "path": "/openfecli/tests/parameters/test_protein.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" This is the deprecated legacy high-level interface. Everything here is canonically located at the root of the package. New code should import directly from there, e.g. "from h5py import File". """ from __future__ import absolute_import from ._hl import filters from ._hl.base import ...
code_fim
medium
{ "lang": "python", "repo": "ryfeus/lambda-packs", "path": "/HDF4_H5_NETCDF/source2.7/h5py/highlevel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryfeus/lambda-packs path: /HDF4_H5_NETCDF/source2.7/h5py/highlevel.py # This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms...
code_fim
medium
{ "lang": "python", "repo": "ryfeus/lambda-packs", "path": "/HDF4_H5_NETCDF/source2.7/h5py/highlevel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from ._hl import filters from ._hl.base import is_hdf5, HLObject from ._hl.files import File from ._hl.group import Group, SoftLink, ExternalLink, HardLink from ._hl.dataset import Dataset from ._hl.datatype import Datatype from ._hl.attrs import AttributeManager<|fim_prefix|># repo: ryfeus/lambda-packs ...
code_fim
medium
{ "lang": "python", "repo": "ryfeus/lambda-packs", "path": "/HDF4_H5_NETCDF/source2.7/h5py/highlevel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BPYap/voc path: /tests/structures/test_docstrings.py from ..utils import TranspileTestCase class DocstringTests(TranspileTestCase): def test_method_docstring(self): <|fim_suffix|> def test_naked_string(self): self.assertCodeExecution(""" def test(): x ...
code_fim
hard
{ "lang": "python", "repo": "BPYap/voc", "path": "/tests/structures/test_docstrings.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.assertCodeExecution(""" def test(): x = 3 "This is a naked string" return x print(test()) print(test.__doc__) """)<|fim_prefix|># repo: BPYap/voc path: /tests/structures/test_docstrings.py from ....
code_fim
hard
{ "lang": "python", "repo": "BPYap/voc", "path": "/tests/structures/test_docstrings.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> x = 3 "This is a naked string" return x print(test()) print(test.__doc__) """)<|fim_prefix|># repo: BPYap/voc path: /tests/structures/test_docstrings.py from ..utils import TranspileTestCase class DocstringTests(Transp...
code_fim
hard
{ "lang": "python", "repo": "BPYap/voc", "path": "/tests/structures/test_docstrings.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Abhinav1004/Network_Programming path: /one_to_one/client.py #client code from socket import * s=socket(AF_INET,SOCK_STREAM) <|fim_suffix|>s.connect((host,port)) text=input('Enter the text') while text!='q': s.send(text.encode('utf-8')) data=s.recv(1024) print('The data received is %s'%str(da...
code_fim
easy
{ "lang": "python", "repo": "Abhinav1004/Network_Programming", "path": "/one_to_one/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>s.connect((host,port)) text=input('Enter the text') while text!='q': s.send(text.encode('utf-8')) data=s.recv(1024) print('The data received is %s'%str(data.decode('utf-8'))) text=input('Enter the text') s.close()<|fim_prefix|># repo: Abhinav1004/Network_Programming path: /one_to_one/client.py #clien...
code_fim
easy
{ "lang": "python", "repo": "Abhinav1004/Network_Programming", "path": "/one_to_one/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fengshunli/devops path: /release/project/urls.py from django.conf.urls import url <|fim_suffix|>urlpatterns = [ url(r'^$', views.index, name="release/project/index"), url(r'^add$', views.add, name="release/project/add"), url(r'^add_project$', views.add_project, name="release/project/...
code_fim
easy
{ "lang": "python", "repo": "fengshunli/devops", "path": "/release/project/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ url(r'^$', views.index, name="release/project/index"), url(r'^add$', views.add, name="release/project/add"), url(r'^add_project$', views.add_project, name="release/project/add_project"), ]<|fim_prefix|># repo: fengshunli/devops path: /release/project/urls.py from django.conf.u...
code_fim
easy
{ "lang": "python", "repo": "fengshunli/devops", "path": "/release/project/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: afree2004/craftassist path: /python/craftassist/ttad/ttad_transformer_model/train_model.py import argparse import functools import json import logging import logging.handlers import os import pickle from os.path import isfile from os.path import join as pjoin from glob import glob from tqdm impo...
code_fim
hard
{ "lang": "python", "repo": "afree2004/craftassist", "path": "/python/craftassist/ttad/ttad_transformer_model/train_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # make data sampler train_sampler = SequentialSampler(dataset) model_collate_fn = functools.partial(caip_collate, tokenizer=tokenizer) train_dataloader = DataLoader( dataset, sampler=train_sampler, batch_size=args.batch_size, collate_fn=model_collate_fn ) epoch_iterator = t...
code_fim
hard
{ "lang": "python", "repo": "afree2004/craftassist", "path": "/python/craftassist/ttad/ttad_transformer_model/train_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.sqspolicy def test_sqs_policy(queue, remediated): """ Actual testing function. :param queue: queue details :param remediated: :return: nothing, raises AssertionError if actual test result is not matched with expected """ expected = True if remediated else find_ru...
code_fim
hard
{ "lang": "python", "repo": "kurmiashish/hammer", "path": "/tests/test_sqs-policy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kurmiashish/hammer path: /tests/test_sqs-policy.py import pytest from . import mock_sqs from library.aws.sqs import SQSPolicyChecker from library.aws.utility import Account region = "us-west-1" queues = { "Queue": { "Description": "Queue without policy", "CheckShouldPass":...
code_fim
hard
{ "lang": "python", "repo": "kurmiashish/hammer", "path": "/tests/test_sqs-policy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: anuraagbaishya/uiautomator path: /uiautomator/not_found_handler.py import collections class NotFoundHandler(object): <|fim_suffix|> def __init__(self): self.__handlers = collections.defaultdict(lambda: {'on': True, 'handlers': []}) def __get__(self, instance, type): retu...
code_fim
medium
{ "lang": "python", "repo": "anuraagbaishya/uiautomator", "path": "/uiautomator/not_found_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.__handlers = collections.defaultdict(lambda: {'on': True, 'handlers': []}) def __get__(self, instance, type): return self.__handlers[instance.adb.device_serial()]<|fim_prefix|># repo: anuraagbaishya/uiautomator path: /uiautomator/not_found_handler.py impo...
code_fim
medium
{ "lang": "python", "repo": "anuraagbaishya/uiautomator", "path": "/uiautomator/not_found_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.__handlers[instance.adb.device_serial()]<|fim_prefix|># repo: anuraagbaishya/uiautomator path: /uiautomator/not_found_handler.py import collections class NotFoundHandler(object): <|fim_middle|> ''' Handler for UI Object Not Found exception. It's a replacement of UiAutoma...
code_fim
hard
{ "lang": "python", "repo": "anuraagbaishya/uiautomator", "path": "/uiautomator/not_found_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Auxiliary function for getting the quota from a project ID. Used on requests by waterbutler and the user (from browser).""" node = AbstractNode.load(pid) max_quota, used_quota = quota.get_quota_info( node.creator, quota.get_project_storage_type(node) ) return { '...
code_fim
medium
{ "lang": "python", "repo": "RCOSDP/RDM-osf.io", "path": "/website/project/views/quota.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RCOSDP/RDM-osf.io path: /website/project/views/quota.py from framework.auth.decorators import must_be_signed from osf.models import AbstractNode from website.project.decorators import must_be_contributor_or_public from website.util import quota from api.base import settings as api_settings <|fim...
code_fim
hard
{ "lang": "python", "repo": "RCOSDP/RDM-osf.io", "path": "/website/project/views/quota.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>dqn = DQNInference(env=env, model=model, input_shape=input_shape, observation_preprocessors=[grayscale], frame_buffer_size=4, warmup_actions=4) dqn.play_round(sleep=50)<|fim_prefix|># repo: LukeWood/sota-dqn p...
code_fim
medium
{ "lang": "python", "repo": "LukeWood/sota-dqn", "path": "/examples/cnn/inference.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LukeWood/sota-dqn path: /examples/cnn/inference.py import gym from constants import persistence_file from sota_dqn import DQNInference from preprocessing import grayscale import tensorflow as tf env = gym.make("MsPacman-v0") input_shape = env.observation_space.shape[:-1] <|fim_suffix|>dqn = DQ...
code_fim
medium
{ "lang": "python", "repo": "LukeWood/sota-dqn", "path": "/examples/cnn/inference.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: intel/test-framework-and-suites-for-android path: /acs/acs/UseCase/Misc/EXEC.py er: Apache-2.0 """ import platform import os.path import re import subprocess import tempfile import time import shlex import sys import json from acs.UseCase.UseCaseBase import UseCaseBase from acs.UtilitiesFWK.Ut...
code_fim
hard
{ "lang": "python", "repo": "intel/test-framework-and-suites-for-android", "path": "/acs/acs/UseCase/Misc/EXEC.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # In that condition, isdigit is called on string elif isinstance(expected_result, int) or\ ((isinstance(expected_result, str) or isinstance(expected_result, unicode)) and expected_result.isdigit()): ...
code_fim
hard
{ "lang": "python", "repo": "intel/test-framework-and-suites-for-android", "path": "/acs/acs/UseCase/Misc/EXEC.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if "[MY_PATH]" in command: command = command.replace("[MY_PATH]", os.path.dirname( os.path.abspath( self._tc_parameters.get_file_path())) ...
code_fim
hard
{ "lang": "python", "repo": "intel/test-framework-and-suites-for-android", "path": "/acs/acs/UseCase/Misc/EXEC.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: willettk/ancientlives path: /python/separate.py # from the dictionary of the number of users for each fragment flist = [] with open("sortedFragments.txt","r") as ff: next(ff) for line in ff: l = line.strip() v = l.split(",") flist.append(v) # form a data st...
code_fim
medium
{ "lang": "python", "repo": "willettk/ancientlives", "path": "/python/separate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fhandle.append(open(fn,'w')) for f in flist: frag = int(f[0]) userCount = int(f[2]) try: ii = glist[userCount-1] fhandle[ii].write('%i\n' % frag) except: print 'bad ', frag, userCount for fh in fhandle: fh.close()<|fim_prefix|># repo: willettk/ancie...
code_fim
hard
{ "lang": "python", "repo": "willettk/ancientlives", "path": "/python/separate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for f in flist: frag = int(f[0]) userCount = int(f[2]) try: ii = glist[userCount-1] fhandle[ii].write('%i\n' % frag) except: print 'bad ', frag, userCount for fh in fhandle: fh.close()<|fim_prefix|># repo: willettk/ancientlives path: /python/separate.py...
code_fim
hard
{ "lang": "python", "repo": "willettk/ancientlives", "path": "/python/separate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for root, dirs, files in os.walk(train_dir, topdown=True): for name in files: if not name[-3:]=='jpg': continue ID = name.split('_') src_dir = os.path.join(train_dir , name) dst_dir = os.path.join(trai...
code_fim
hard
{ "lang": "python", "repo": "chunibyo-wly/SmartCities", "path": "/model/attribute/datafolder/reid_dataset/pytorch_prepare.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chunibyo-wly/SmartCities path: /model/attribute/datafolder/reid_dataset/pytorch_prepare.py import os from shutil import copyfile def pytorch_prepare(data_dir, dataset_name): dataset_dir = os.path.join(data_dir, dataset_name) if not os.path.isdir(dataset_dir): print('please chang...
code_fim
hard
{ "lang": "python", "repo": "chunibyo-wly/SmartCities", "path": "/model/attribute/datafolder/reid_dataset/pytorch_prepare.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 6. install ReDroid app p = subprocess.Popen(["adb", "-s", emulator_id, "install", "-r", "-g", os.path.join(redroid_path, REDROID_APK_PATH)]) def parse_args(): """ parse command line input """ parser = argparse.ArgumentParser(description="Launch a defau...
code_fim
hard
{ "lang": "python", "repo": "xianlimei/ReDroid", "path": "/default_workflow/default_workflow.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xianlimei/ReDroid path: /default_workflow/default_workflow.py import json import os import argparse import shutil import subprocess # common default items CONFIG_TIMEOUT = 600 CONFIG_INTERVAL = 10 CONFIG_SLEEP_INTERVAL = 3 # trace_collector_config.json default items TRACE_COLLECTOR_CONFIG_DROID...
code_fim
hard
{ "lang": "python", "repo": "xianlimei/ReDroid", "path": "/default_workflow/default_workflow.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pamyuu/SO-Pose path: /core/gdrn_selfocc_modeling/tools/utils.py import numpy as np import math import torch from transforms3d.axangles import axangle2mat from transforms3d.quaternions import axangle2quat, mat2quat, qmult, quat2mat from .pose_utils import quat2mat_torch from detectron2.layers impo...
code_fim
hard
{ "lang": "python", "repo": "Pamyuu/SO-Pose", "path": "/core/gdrn_selfocc_modeling/tools/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return torch.stack((w, x, y, z), dim=2) def allocentric_to_egocentric_torch(translation, q_allo, eps=1e-4): """Given an allocentric (object-centric) pose, compute new camera-centric pose Since we do detection on the image plane and our kernels are 2D-translationally invariant, we need to...
code_fim
hard
{ "lang": "python", "repo": "Pamyuu/SO-Pose", "path": "/core/gdrn_selfocc_modeling/tools/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: frederik14/tabletennis_dashboard path: /server/src/entities.py import pickle import os class GameSet: def __init__(self, home_score = 0, out_score = 0): self.home = home_score self.out = out_score class Game(): total_games = 0 def __init__(self, home_player, out_play...
code_fim
hard
{ "lang": "python", "repo": "frederik14/tabletennis_dashboard", "path": "/server/src/entities.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name self.rank = rank self.wins = 0 self.losses = 0 class Players: def __init__(self): self.list = [] self.sets = set() def add_player(self, name): if name in self.sets: return 'Player already exists.' ...
code_fim
hard
{ "lang": "python", "repo": "frederik14/tabletennis_dashboard", "path": "/server/src/entities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Throughout this sub-package, "PW" stands for piecewise. """<|fim_prefix|># repo: NGoetz/zunis path: /zunis_lib/zunis/models/flows/coupling_cells/piecewise_coupling/__init__.py """Piecewise coupling cells Coupling cells whose transform f is defined as the primitive of a function g such that * f(0) = 0 * f...
code_fim
medium
{ "lang": "python", "repo": "NGoetz/zunis", "path": "/zunis_lib/zunis/models/flows/coupling_cells/piecewise_coupling/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NGoetz/zunis path: /zunis_lib/zunis/models/flows/coupling_cells/piecewise_coupling/__init__.py """Piecewise coupling cells Coupling cells whose transform f is defined as the primitive of a function g such that * f(0) = 0 * f(1) = 1 * g(y,t^N) > 0 * g is a piecewise-simple function <|fim_suffix|>...
code_fim
medium
{ "lang": "python", "repo": "NGoetz/zunis", "path": "/zunis_lib/zunis/models/flows/coupling_cells/piecewise_coupling/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Feriority/lrrbot path: /eris/channel_reaper.py import asyncio import datetime import pytz import discord from common.config import config from common import utils import logging log = logging.getLogger('eris.channel_reaper') class ChannelReaper: def __init__(self, eris, signals): <|fim_suffi...
code_fim
hard
{ "lang": "python", "repo": "Feriority/lrrbot", "path": "/eris/channel_reaper.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def schedule_reap_channels(self): asyncio.ensure_future(self.reap_channels(), loop=self.eris.loop).add_done_callback(utils.check_exception) self.eris.loop.call_later(60, self.schedule_reap_channels) def schedule_timer(self, eris): if not self.timer_scheduled: self.timer_scheduled = True sel...
code_fim
hard
{ "lang": "python", "repo": "Feriority/lrrbot", "path": "/eris/channel_reaper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindspore-ai/models path: /research/cv/EfficientDet_d0/src/efficientnet/model.py # Copyright 2021 Huawei Technologies Co., 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 Lice...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/EfficientDet_d0/src/efficientnet/model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ MBConv Block forward """ x = inputs if self._block_args["expand_ratio"] != 1: x = self._expand_conv(inputs) x = self._bn0(x) x = self._swish(x) x = self._depthwise_conv(x) x = self._bn1(x) x = self._swish(x) ...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/cv/EfficientDet_d0/src/efficientnet/model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ramseyboy/tabletop-scanner path: /tabletopscanner/__init__.py from flask import Flask app = Flask(__name__) from flask_mongoalchemy import MongoAlchemy <|fim_suffix|>import tabletopscanner.views<|fim_middle|>app.config['MONGOALCHEMY_DATABASE'] = 'library' db = MongoAlchemy(app)
code_fim
medium
{ "lang": "python", "repo": "ramseyboy/tabletop-scanner", "path": "/tabletopscanner/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>import tabletopscanner.views<|fim_prefix|># repo: ramseyboy/tabletop-scanner path: /tabletopscanner/__init__.py from flask import Flask app = Flask(__name__) from flask_mongoalchemy import MongoAlchemy <|fim_middle|>app.config['MONGOALCHEMY_DATABASE'] = 'library' db = MongoAlchemy(app)
code_fim
medium
{ "lang": "python", "repo": "ramseyboy/tabletop-scanner", "path": "/tabletopscanner/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print(liste[0],"",liste[1],"",liste[2]) print(liste[3],"",liste[4],"",liste[5]) print(liste[6],"",liste[7],"",liste[8]) if x_win() == True: print("1. OYUNCU KAZANDI") time.sleep(5) break elif o_win() == True: p...
code_fim
hard
{ "lang": "python", "repo": "HaktanBilginTR/Programlarim", "path": "/Programlar/Python Uygulamaları/Tic Tac Toe XOX.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HaktanBilginTR/Programlarim path: /Programlar/Python Uygulamaları/Tic Tac Toe XOX.py import time print("---------------------------------") print("Tic Tac Toe/XOX Oyununa Hoşgeldin\n1. Oyuncu = X\n2. Oyuncu = O") print("---------------------------------") liste = [] def x_win(): i...
code_fim
hard
{ "lang": "python", "repo": "HaktanBilginTR/Programlarim", "path": "/Programlar/Python Uygulamaları/Tic Tac Toe XOX.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> elif o_win() == True: print("2. OYUNCU KAZANDI") time.sleep(5) break elif berabere() == True: print("BERABERE") time.sleep(5) break giris2 = int(input("2. Oyuncu :")) if x_win() == True: print("1. OYUNCU KAZANDI") t...
code_fim
hard
{ "lang": "python", "repo": "HaktanBilginTR/Programlarim", "path": "/Programlar/Python Uygulamaları/Tic Tac Toe XOX.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_dense_matrix(self): A = np.array([[1, 2, 3, 4, 0, 5, 0, 7], [0, 8, 7, 0, 1, 5, 9, 0], [1, 0, 0, 0, 0, 1, 2, 3]]) test_vectors = ([-1.98931144, -1.56363389, -0.84115584, 2.2864762, 5....
code_fim
hard
{ "lang": "python", "repo": "mgreminger/trust-constr", "path": "/tests/test_projections.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_dense_matrix(self): A = np.array([[1, 2, 3, 4, 0, 5, 0, 7], [0, 8, 7, 0, 1, 5, 9, 0], [1, 0, 0, 0, 0, 1, 2, 3]]) test_vectors = ([-1.98931144, -1.56363389, -0.84115584, 2.2864762, 5.5...
code_fim
hard
{ "lang": "python", "repo": "mgreminger/trust-constr", "path": "/tests/test_projections.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mgreminger/trust-constr path: /tests/test_projections.py import numpy as np from trust_constr._trustregion_constr.projections \ import projections, orthogonality from numpy.testing import (TestCase, assert_array_almost_equal, assert_equal, assert_allclose) availabl...
code_fim
hard
{ "lang": "python", "repo": "mgreminger/trust-constr", "path": "/tests/test_projections.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def dfs(self, board, i, j): if board[i - 1][j] == 'O' and i - 1 == 0: return if board[i][j - 1] == 'O' and j - 1 == 0: return if board[i + 1][j] == 'O' and i + 1 == len(board) - 1: return if board[i][j + 1] == 'O' and j + 1 == len(boa...
code_fim
hard
{ "lang": "python", "repo": "cozyo/algo-learn", "path": "/python/disjointset/leetcode/surrounded_regions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cozyo/algo-learn path: /python/disjointset/leetcode/surrounded_regions.py from typing import List # 被围绕的区域 class Solution: # 深度优先搜索 def solve(self, board: List[List[str]]) -> None: <|fim_suffix|> if board[i - 1][j] == 'O' and i - 1 == 0: return if board[i][j...
code_fim
hard
{ "lang": "python", "repo": "cozyo/algo-learn", "path": "/python/disjointset/leetcode/surrounded_regions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if board[i - 1][j] == 'O' and i - 1 == 0: return if board[i][j - 1] == 'O' and j - 1 == 0: return if board[i + 1][j] == 'O' and i + 1 == len(board) - 1: return if board[i][j + 1] == 'O' and j + 1 == len(board[i]) - 1: return<|...
code_fim
hard
{ "lang": "python", "repo": "cozyo/algo-learn", "path": "/python/disjointset/leetcode/surrounded_regions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: onap/dcaegen2-platform-cli path: /dcae-cli/dcae_cli/util/__init__.py # ============LICENSE_START======================================================= # org.onap.dcae # ================================================================================ # Copyright (c) 2017 AT&T Intellectual Propert...
code_fim
hard
{ "lang": "python", "repo": "onap/dcaegen2-platform-cli", "path": "/dcae-cli/dcae_cli/util/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def write_pref(pref, path): '''Writes a preference json file to disk''' makedirs(os.path.dirname(path), exist_ok=True) with open(path, 'w') as file: json.dump(pref, file) def reraise_with_msg(e, msg=None, cls=None, as_dcae=False): '''Reraises exception e with an additional messa...
code_fim
hard
{ "lang": "python", "repo": "onap/dcaegen2-platform-cli", "path": "/dcae-cli/dcae_cli/util/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def fetch_file_from_web(server_url, path, transform_func=json.loads): """Fetch file from a web server The default behavior is to transform the response to a json. """ artifact_url = "{0}/{1}".format(server_url, path) r = requests.get(artifact_url) r.raise_for_status() if trans...
code_fim
hard
{ "lang": "python", "repo": "onap/dcaegen2-platform-cli", "path": "/dcae-cli/dcae_cli/util/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @abc.abstractmethod def client_streaming_signature(self, method: ProtoServiceMethod, prefix: str) -> str: """Returns the signature of this client streaming method.""" def client_streaming_stub( # pylint: disable=no-self-use self, unused_...
code_fim
hard
{ "lang": "python", "repo": "waelbarakat/pigweed", "path": "/pw_rpc/py/pw_rpc/codegen.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> _generate_deprecated_aliases(gen, [ cast(ProtoService, n) for n in proto_package if n.type() == ProtoNode.Type.SERVICE ]) if file_namespace: gen.line('} // namespace ' + file_namespace) gen.line() gen.line('// Specialize MethodInfo for each RPC to provide met...
code_fim
hard
{ "lang": "python", "repo": "waelbarakat/pigweed", "path": "/pw_rpc/py/pw_rpc/codegen.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: waelbarakat/pigweed path: /pw_rpc/py/pw_rpc/codegen.py k and send a response as ' 'appropriate for your application') STUB_READER_WRITER_TODO = ( '// TODO: Set the client stream callback and send responses as ' 'appropriate for your application') class CodeGenerator(abc.ABC): ""...
code_fim
hard
{ "lang": "python", "repo": "waelbarakat/pigweed", "path": "/pw_rpc/py/pw_rpc/codegen.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_point_2(self): cs = point_to_names(lon=5.983333, lat=50.883333) self.assertEqual(cs, ['France', 'Germany', 'Netherlands']) def test_point_3(self): cs = point_to_names(lon=-171.714086, lat=-75.185789) self.assertEqual(cs, ['Antarctica']) def test_point...
code_fim
hard
{ "lang": "python", "repo": "ykamo001/country-bounding-boxes", "path": "/country_bounding_boxes/tests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ykamo001/country-bounding-boxes path: /country_bounding_boxes/tests.py from unittest import TestCase from country_bounding_boxes import ( country_subunits_containing_point as by_point, country_subunits_by_iso_code as by_code, ) def code_to_names(code): bc = by_code(code) print(...
code_fim
hard
{ "lang": "python", "repo": "ykamo001/country-bounding-boxes", "path": "/country_bounding_boxes/tests.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(frontRowCount): # randomly pick front row enemies tempEnemyIndex = randint(0,len(frontRowPossibilities)-1) frontRow.append(Enemy(frontRowPossibilities[tempEnemyIndex],i)) for i in range(backRowCount): # randomly pick back row enemies tempE...
code_fim
hard
{ "lang": "python", "repo": "FireElementalNE/AI-Final-Project", "path": "/src/game.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: FireElementalNE/AI-Final-Project path: /src/game.py import sys,time,functions,getpass # Imports from random import randint from config import * from player import Player from enemies import * from states import States # runs the game def runGame(): playerClasses = ['Fighter', 'Thief'] # poss...
code_fim
hard
{ "lang": "python", "repo": "FireElementalNE/AI-Final-Project", "path": "/src/game.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: guminov/pycameresp path: /modules/main.py # Distributed under MIT License # Copyright (c) 2021 Remi BERTHOLET import sys try: import uasyncio except: sys.path.append("lib") sys.path.append("simul") sys.path.append("sample") import uasyncio import machine from tools.battery import Battery from ...
code_fim
hard
{ "lang": "python", "repo": "guminov/pycameresp", "path": "/modules/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # The html pages only loaded when the connection of http server is done # This reduces memory consumption if the server is not used # pylint: disable=unused-import # pylint: disable=redefined-outer-name import webpage from server.httpserver import HttpServer try: # Welcome page (can be suppresse...
code_fim
medium
{ "lang": "python", "repo": "guminov/pycameresp", "path": "/modules/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> d1 = Y - Y_hat d2 = Y - Y.mean() R2 = 1 - d1.dot(d1) / d2.dot(d2) print("The R^2 is: ", R2) return R2 if __name__ == '__main__': # We first load and visualise the data: X = [] Y = [] for line in open('../large_files/data_1d.csv'): x, y = line.split(',') ...
code_fim
medium
{ "lang": "python", "repo": "AndreiRoibu/LinearRegression", "path": "/one_dimensional_linear_regression/one_dimensional_linear_regression_solution.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndreiRoibu/LinearRegression path: /one_dimensional_linear_regression/one_dimensional_linear_regression_solution.py import numpy as np import matplotlib.pyplot as plt def LR_1D_calculator(X,Y, xlabel=None, ylabel=None): # We now solve the equation y = aX + b X_mean = X.mean() X_sum =...
code_fim
medium
{ "lang": "python", "repo": "AndreiRoibu/LinearRegression", "path": "/one_dimensional_linear_regression/one_dimensional_linear_regression_solution.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def post(self): defined = [] for v in self.application.parameters: if v.type is bool: inp = v.with_value(self.get_argument(v.name, default='off') == 'on') else: inp = v.with_value(v.type(self.get_argument(v.name))) def...
code_fim
medium
{ "lang": "python", "repo": "takluyver/nbparameterise", "path": "/examples/webapp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: takluyver/nbparameterise path: /examples/webapp.py #!/usr/bin/env python3 """Present an HTML form for the parameters of a notebook, and run it on submission. To use this example, run:: python3 webapp.py "Stock display.ipynb" The form fields are not hardcoded here; they are built from the n...
code_fim
medium
{ "lang": "python", "repo": "takluyver/nbparameterise", "path": "/examples/webapp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nb = replace_definitions(self.application.nb, defined) nb = execute(nb, cwd=os.path.dirname(self.application.path)) output, _ = HTMLExporter().from_notebook_node(nb) self.write(output) class NbparameteriseApplication(tornado.web.Application): def __init__(self, path):...
code_fim
hard
{ "lang": "python", "repo": "takluyver/nbparameterise", "path": "/examples/webapp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> action_id, x, y = action_idx adjusted_x = x - self.multi_output_ranges[1] adjusted_y = y - self.multi_output_ranges[2] gridwidth = self.map_size_x / self.x_gridsize gridheight = self.map_size_y / self.y_gridsize xtarget = int((adjusted_x * gridwidth) + ra...
code_fim
hard
{ "lang": "python", "repo": "UFRN-URNAI/urnai-tools", "path": "/urnai/agents/actions/mo_spatial_terran_wrapper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: UFRN-URNAI/urnai-tools path: /urnai/agents/actions/mo_spatial_terran_wrapper.py FROM:""" # BUILD COMMAND CENTER if named_action == sc2_wrapper.ACTION_BUILD_COMMAND_CENTER: actions = build_structure_raw_pt_spatial(obs, units.Terran.CommandCenter, ...
code_fim
hard
{ "lang": "python", "repo": "UFRN-URNAI/urnai-tools", "path": "/urnai/agents/actions/mo_spatial_terran_wrapper.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # TRAIN CYCLONE if named_action == sc2_wrapper.ACTION_TRAIN_CYCLONE: return train_unit(obs, sc2._TRAIN_CYCLONE, units.Terran.Factory) # TRAIN WIDOWMINE if named_action == sc2_wrapper.ACTION_TRAIN_WIDOWMINE: return train_unit(obs, sc2._TRAIN_WIDOWMIN...
code_fim
hard
{ "lang": "python", "repo": "UFRN-URNAI/urnai-tools", "path": "/urnai/agents/actions/mo_spatial_terran_wrapper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thakur-amrita/Cardea path: /cardea/fhir/Basic.py from .fhirbase import fhirbase class Basic(fhirbase): """ Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclu...
code_fim
hard
{ "lang": "python", "repo": "thakur-amrita/Cardea", "path": "/cardea/fhir/Basic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> {'parent_entity': 'CodeableConcept', 'parent_variable': 'object_id', 'child_entity': 'Basic', 'child_variable': 'code'}, {'parent_entity': 'Reference', 'parent_variable': 'identifier', 'child_entity': 'Basic', ...
code_fim
hard
{ "lang": "python", "repo": "thakur-amrita/Cardea", "path": "/cardea/fhir/Basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_relationships(self): return [ {'parent_entity': 'Reference', 'parent_variable': 'identifier', 'child_entity': 'Basic', 'child_variable': 'author'}, {'parent_entity': 'CodeableConcept', 'parent_variable': 'obj...
code_fim
hard
{ "lang": "python", "repo": "thakur-amrita/Cardea", "path": "/cardea/fhir/Basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def extract_description(html_doc): try: soup = BeautifulSoup(html_doc, 'html.parser') description = soup.find(attrs={"name":re.compile('description',re.IGNORECASE)})['content'] except: description = None return description def extract_corpus(html...
code_fim
hard
{ "lang": "python", "repo": "NanZhang715/web_classification", "path": "/model/utils/feature_parse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @return: DataFrame ''' #web_df = read_snapshot(file_list) #if web_df.empty: # return None #print('{} rows in DataFrame'.format(web_df.shape[0])) # Extract features web_df['title'] = web_df['unicode'].map(lambda s :extract_title(str(s))) web_df['keywords'] = ...
code_fim
hard
{ "lang": "python", "repo": "NanZhang715/web_classification", "path": "/model/utils/feature_parse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NanZhang715/web_classification path: /model/utils/feature_parse.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 21 11:24:34 2019 @author: nzhang """ import pandas as pd #import modin.pandas as pd import codecs import re from bs4 import BeautifulSoup import multiproces...
code_fim
hard
{ "lang": "python", "repo": "NanZhang715/web_classification", "path": "/model/utils/feature_parse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>toothOBEXSessionOpenTransportConnection": ( b"i^{OpaqueOBEXSessionRef=}^?^v", "", { "arguments": { 1: { "callable": { "retval": {"type": b"v"}, "arguments": { ...
code_fim
hard
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-IOBluetooth/Lib/IOBluetooth/_metadata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-IOBluetooth/Lib/IOBluetooth/_metadata.py ronousConnectionPacketType2EV3Omit@64$kBluetoothSynchronousConnectionPacketType2EV5Omit@256$kBluetoothSynchronousConnectionPacketType3EV3Omit@128$kBluetoothSynchronousConnectionPacketType3EV5Omit@512$kBluetooth...
code_fim
hard
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-IOBluetooth/Lib/IOBluetooth/_metadata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-IOBluetooth/Lib/IOBluetooth/_metadata.py jectRef": objc.createOpaquePointerType( "IOBluetoothObjectRef", b"^{OpaqueIOBluetoothObjectRef=}" ), "OBEXSessionRef": objc.createOpaquePointerType( "OBEXSessionRef", b"^...
code_fim
hard
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-IOBluetooth/Lib/IOBluetooth/_metadata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hquu/WayFinder path: /py_src/Mysql/dumpJson.py import mysql.connector import json import re from math import sin, cos, sqrt, atan2, radians import sys # Adding the path of self-def Library sys.path.append("C:/Users/A02wxy/Documents/GitHub/WayFinder/Direction/Library/script/") from featureCollecti...
code_fim
medium
{ "lang": "python", "repo": "hquu/WayFinder", "path": "/py_src/Mysql/dumpJson.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(0, len(geoSource)): floor = "sf_" + str(i + 1) + "f" # initiating features from geoJson Data floorData = geoSource[i] floorFeatures = floorData["features"] features = [] for feature in floorFeatures: Afeature = Feature(feature...
code_fim
hard
{ "lang": "python", "repo": "hquu/WayFinder", "path": "/py_src/Mysql/dumpJson.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # checking if table exists sql_checkTable = "SHOW TABLES LIKE %s" mycursor.execute(sql_checkTable, (floor, )) result = mycursor.fetchone() if result == None: sql_create = "CREATE TABLE " + floor + "(type VARCHAR(255), id VARCHAR(255), name VARCHAR(255), ...
code_fim
hard
{ "lang": "python", "repo": "hquu/WayFinder", "path": "/py_src/Mysql/dumpJson.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> weather_data = get_weather(args.query, args.date, args.type) print_weather_details(weather_data) if __name__ == "__main__": main()<|fim_prefix|># repo: vinodshetty94/web_forecast path: /weather_reporter/cli.py import argparse from .utils import * from datetime import datetime def main(): # create...
code_fim
hard
{ "lang": "python", "repo": "vinodshetty94/web_forecast", "path": "/weather_reporter/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument("-t", "--type", type=str, nargs=1, metavar="type", default="tenday", help="type available [hourbyhour, 5day, tenday, monthly, today, weekend") # parse the arguments from standard input args = parser.parse_args() weather_data = get_weather(args.query, args.date, args.typ...
code_fim
hard
{ "lang": "python", "repo": "vinodshetty94/web_forecast", "path": "/weather_reporter/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vinodshetty94/web_forecast path: /weather_reporter/cli.py import argparse from .utils import * from datetime import datetime def main(): # create argument parser object parser = argparse.ArgumentParser(description = "Weather Reporter") <|fim_suffix|> parser.add_argument("-t", "--type"...
code_fim
hard
{ "lang": "python", "repo": "vinodshetty94/web_forecast", "path": "/weather_reporter/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: laobadao/TF_VS_Caffe path: /np_processor/processor/np_utils/post_processing_builder.py """Builder function for post processing operations.""" import functools import numpy as np from ..np_utils import post_processing, ops from platformx.plat_tensorflow.tools.processor import model_config import c...
code_fim
hard
{ "lang": "python", "repo": "laobadao/TF_VS_Caffe", "path": "/np_processor/processor/np_utils/post_processing_builder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return score_converter_fn def _build_score_converter(score_converter, logit_scale): """Builds score converter based on the config. Builds one of [tf.identity, tf.sigmoid, tf.softmax] score converters based on the config. Args: score_converter_config: post_processing_pb2.PostP...
code_fim
hard
{ "lang": "python", "repo": "laobadao/TF_VS_Caffe", "path": "/np_processor/processor/np_utils/post_processing_builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: City-of-Helsinki/tunnistamo path: /tunnistamo/endpoints.py from django.conf import settings from django.utils.module_loading import import_string from jwkest.jwt import JWT from oidc_provider.lib.endpoints.authorize import AuthorizeEndpoint from oidc_provider.lib.endpoints.introspection import To...
code_fim
hard
{ "lang": "python", "repo": "City-of-Helsinki/tunnistamo", "path": "/tunnistamo/endpoints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def create_token(self, user, client, scope): token = super().create_token(user, client, scope) tunnistamo_session = self._get_tunnistamo_session() if tunnistamo_session: token.save() tunnistamo_session.add_element(token) _create_userloginentry_...
code_fim
hard
{ "lang": "python", "repo": "City-of-Helsinki/tunnistamo", "path": "/tunnistamo/endpoints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def request(self, url): ##这个函数获取网页的response 然后返回 headers = { 'User-Agent': "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"} # content.encoding需要和BeautifulSoup的'utf-8'一致,否则乱码 content = requests.get(url, hea...
code_fim
hard
{ "lang": "python", "repo": "hnlaomie/python-tools", "path": "/util/spider/get_ml_links.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hnlaomie/python-tools path: /util/spider/get_ml_links.py from bs4 import BeautifulSoup import os, requests class MLWeb(): def print_links(self, url: str) : html = self.request(url) item_list = BeautifulSoup(html.text, 'lxml').find_all('a') for item in item_list: ...
code_fim
hard
{ "lang": "python", "repo": "hnlaomie/python-tools", "path": "/util/spider/get_ml_links.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def upgrade(): op.get_bind().execute(""" create view cases_current (datenbestand, idbundesland, bundesland, landkreis, objectid, meldedatum, gender, agegroup, casetype, id, idlandkreis) as SELECT cases.datenbestand, cases.idbundesland, cases.bundesland, ...
code_fim
medium
{ "lang": "python", "repo": "pmaisel/coronavis", "path": "/Backend/migrations/alembic/versions/b84312f6532e_create_cases_current_view.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmaisel/coronavis path: /Backend/migrations/alembic/versions/b84312f6532e_create_cases_current_view.py """create cases_current view Revision ID: b84312f6532e Revises: 00a7bf4dae6c Create Date: 2020-11-26 14:43:32.346113 """ from alembic import op import sqlalchemy as sa <|fim_suffix|> op.ge...
code_fim
medium
{ "lang": "python", "repo": "pmaisel/coronavis", "path": "/Backend/migrations/alembic/versions/b84312f6532e_create_cases_current_view.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, fpath, dup): """ Receives path to keywords file and DUP flag. """ self.DUP = dup if not os.path.exists(fpath): raise FileNotFoundError(ENOENT, os.strerror(ENOENT), fpath) self.fpath = fpath<|fim_prefix|># repo: myegorov/schmerlin ...
code_fim
easy
{ "lang": "python", "repo": "myegorov/schmerlin", "path": "/autoload/parsers/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: myegorov/schmerlin path: /autoload/parsers/parser.py import os from errno import ENOENT class Parser: <|fim_suffix|> """ Receives path to keywords file and DUP flag. """ self.DUP = dup if not os.path.exists(fpath): raise FileNotFoundError(ENOENT, os.str...
code_fim
easy
{ "lang": "python", "repo": "myegorov/schmerlin", "path": "/autoload/parsers/parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }