text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> """
dups = {}
for num in nums:
if num in dups:
return num
dups[num] = 1
return -1<|fim_prefix|># repo: AmrMKayid/KayAlgo path: /leetcode/287-find-the-duplicate-number.py
class Solution:
def findDuplicate(self, nums):
"""<|fim_middle|>
:type nums: List[int]... | code_fim | easy | {
"lang": "python",
"repo": "AmrMKayid/KayAlgo",
"path": "/leetcode/287-find-the-duplicate-number.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AmrMKayid/KayAlgo path: /leetcode/287-find-the-duplicate-number.py
class Solution:
def findDuplicate(self, nums):
"""<|fim_suffix|> """
dups = {}
for num in nums:
if num in dups:
return num
dups[num] = 1
return -1<|fim_middle|>
:type nums: List[int]... | code_fim | easy | {
"lang": "python",
"repo": "AmrMKayid/KayAlgo",
"path": "/leetcode/287-find-the-duplicate-number.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># never prompt for anything
assumeyes=1
# if yum is dead/busy, try again later
retries=1
timeout=5
# but support caching
http_caching=all
# refresh metadata every time we are run
metadata_expire=0
# all I really need is primary.xml.gz
mdpolicy=group:primary
# define our one repo
[%(reponame)s]
name=R... | code_fim | hard | {
"lang": "python",
"repo": "bpluly/crichton",
"path": "/crichtonweb/cli/crichtoncli/commands/indexyumrepo.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bpluly/crichton path: /crichtonweb/cli/crichtoncli/commands/indexyumrepo.py
# Crichton, Admirable Source Configuration Management
# Copyright 2012 British Broadcasting Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | code_fim | hard | {
"lang": "python",
"repo": "bpluly/crichton",
"path": "/crichtonweb/cli/crichtoncli/commands/indexyumrepo.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nookasaitriveni/SUMMIT-blood-samples path: /summit_blood_samples/blood_sample/views.py
for x in range(4)]
days.reverse()
return day, days
class DownloadBloodSampleView(LoginRequiredMixin, View):
template_name = 'download-blood-sample.html'
download_blood... | code_fim | hard | {
"lang": "python",
"repo": "nookasaitriveni/SUMMIT-blood-samples",
"path": "/summit_blood_samples/blood_sample/views.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render(request, self.receipt_confirm_template, {
"total_records": total_records,
"record_found_cnt": record_found_cnt,
"mismatch_site_found_cnt": mismatch_site_found_cnt,
"mismatch_blood_draw_found_cnt": mismatch_blood_draw_found_cnt,
... | code_fim | hard | {
"lang": "python",
"repo": "nookasaitriveni/SUMMIT-blood-samples",
"path": "/summit_blood_samples/blood_sample/views.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nookasaitriveni/SUMMIT-blood-samples path: /summit_blood_samples/blood_sample/views.py
SampleId=record['Sample ID'],
TissueSubType=record['Tissue sub-type'],
ReceivedDateTime=record['Received DateTime'],
Volume=record['Volume... | code_fim | hard | {
"lang": "python",
"repo": "nookasaitriveni/SUMMIT-blood-samples",
"path": "/summit_blood_samples/blood_sample/views.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scamargo/big-scary path: /backend/hackathon_ubi/project/main_proj/api/routes.py
from flask import jsonify, request, Response
import json
from flask_cors import cross_origin
from . import api_app
from .models import SurveyDatas
from project import db
import requests
import logging
logger = loggin... | code_fim | hard | {
"lang": "python",
"repo": "scamargo/big-scary",
"path": "/backend/hackathon_ubi/project/main_proj/api/routes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield json.dumps({
"UBI": convert_to_digits(prev_release.amount),
"Gender": prev_release.gender,
"Ethnicity": prev_release.ethnicity,
"Intent": prev_release.intent,
"COL": convert_to_digits(prev_release.cost)
... | code_fim | hard | {
"lang": "python",
"repo": "scamargo/big-scary",
"path": "/backend/hackathon_ubi/project/main_proj/api/routes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('interface', '0008_auto_20160530_1805'),
]
operations = [
migrations.RunPython(migrate_results),
]<|fim_prefix|># repo: gmichel-csaa/linty path: /interface/migrations/0009_auto_20160530_1805.py
# -*- coding: utf-8... | code_fim | hard | {
"lang": "python",
"repo": "gmichel-csaa/linty",
"path": "/interface/migrations/0009_auto_20160530_1805.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gmichel-csaa/linty path: /interface/migrations/0009_auto_20160530_1805.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-31 01:05
from __future__ import unicode_literals
from django.db import migrations
<|fim_suffix|> operations = [
migrations.RunPython(migrate_result... | code_fim | hard | {
"lang": "python",
"repo": "gmichel-csaa/linty",
"path": "/interface/migrations/0009_auto_20160530_1805.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def migrate_results(apps, schema_editor):
Build = apps.get_model('interface', 'Build')
Result = apps.get_model('interface', 'Result')
for build in Build.objects.all():
Result.objects.create(
build=build,
linter='PEP8',
output=build.result_old
... | code_fim | medium | {
"lang": "python",
"repo": "gmichel-csaa/linty",
"path": "/interface/migrations/0009_auto_20160530_1805.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TanmDL/black-box-ripper path: /generators/cifar_progan/generator.py
from torch import nn
import torch
from .eqalized_layers import *
class Generator(nn.Module):
def __init__(self, ngpu = 1):
super(Generator, self).__init__()
self.block_1 = nn.Sequential(
EqualLin... | code_fim | hard | {
"lang": "python",
"repo": "TanmDL/black-box-ripper",
"path": "/generators/cifar_progan/generator.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def generate_7(self, samples):
old_output = self.block_3(self.block_2(self.block_1(samples)))
output = self.block_4_to_rgb(self.block_4(old_output))
return output
def generate_8(self, samples, alpha):
old_output = self.block_4(self.block_3(self.block_2(self.block_... | code_fim | hard | {
"lang": "python",
"repo": "TanmDL/black-box-ripper",
"path": "/generators/cifar_progan/generator.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> from .router import Router
# from .server import Server
# from .misc import Method, Mime, StatusCode, BadRequest, InternalServerError
def hello():
return "hello"<|fim_prefix|># repo: ikanago/hey_bbs path: /backend/libbbs/__init__.py
# from .body import Body
# from .cors import CorsMiddleware
# fro... | code_fim | medium | {
"lang": "python",
"repo": "ikanago/hey_bbs",
"path": "/backend/libbbs/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ikanago/hey_bbs path: /backend/libbbs/__init__.py
# from .body import Body
# from .cors import CorsMiddleware
# from .middleware impor<|fim_suffix|> Mime, StatusCode, BadRequest, InternalServerError
def hello():
return "hello"<|fim_middle|>t Middleware, Next
# from .request import Request
#... | code_fim | medium | {
"lang": "python",
"repo": "ikanago/hey_bbs",
"path": "/backend/libbbs/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> signer.verify_job_asset(signature=signature, job_id="job1", user_id="john", filename="res.tiff", expires=expires)
time.sleep(1.1)
with pytest.raises(ResultLinkExpiredException):
signer.verify_job_asset(
signature=signature, job_id="job1", user_id="john", filename="res.tiff"... | code_fim | hard | {
"lang": "python",
"repo": "Open-EO/openeo-python-driver",
"path": "/tests/test_urlsigning.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Open-EO/openeo-python-driver path: /tests/test_urlsigning.py
import time
import pytest
from openeo_driver.errors import CredentialsInvalidException, ResultLinkExpiredException
from openeo_driver.urlsigning import UrlSigner
@pytest.mark.parametrize("expiration", [None, 10])
def test_signer_bas... | code_fim | medium | {
"lang": "python",
"repo": "Open-EO/openeo-python-driver",
"path": "/tests/test_urlsigning.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(CredentialsInvalidException):
signer.verify_job_asset(
signature=signature[:-1], job_id="job1", user_id="john", filename="res.tiff", expires=expires
)
with pytest.raises(CredentialsInvalidException):
signer.verify_job_asset(
signat... | code_fim | hard | {
"lang": "python",
"repo": "Open-EO/openeo-python-driver",
"path": "/tests/test_urlsigning.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ext_modules = [
Extension(
'pycocotools._mask',
sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],
include_dirs = [np.get_include(), '../common'],
extra_compile_args=extra_compile_args,
)
]
readme = open('README.rst', 'r')
README_TEXT = readme.read()
readme.... | code_fim | hard | {
"lang": "python",
"repo": "zmic/cocoapi",
"path": "/PythonAPI/setup.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zmic/cocoapi path: /PythonAPI/setup.py
from setuptools import setup, Extension
import numpy as np
import shutil
import distutils.ccompiler
# To compile and install locally run "python setup.py build_ext --inplace"
# To install library to Python site-packages run "python setup.py build_ext instal... | code_fim | hard | {
"lang": "python",
"repo": "zmic/cocoapi",
"path": "/PythonAPI/setup.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Update a work"""
raise Error(NOTALLOWED)
@json_response
@api_response
@check_token
def DELETE(self, name):
"""Delete a work"""
raise Error(NOTALLOWED)<|fim_prefix|># repo: baconwaffles/identifier_translation_service path: /src/titlesctrl.py
import re
im... | code_fim | hard | {
"lang": "python",
"repo": "baconwaffles/identifier_translation_service",
"path": "/src/titlesctrl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baconwaffles/identifier_translation_service path: /src/titlesctrl.py
import re
import web
import urllib
from api import *
from errors import *
from models import Work, WorkType, Identifier, UriScheme
logger = logging.getLogger(__name__)
class TitlesController(object):
"""Handles title relat... | code_fim | hard | {
"lang": "python",
"repo": "baconwaffles/identifier_translation_service",
"path": "/src/titlesctrl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webknjaz/python3-qrcode path: /qrcode/image/base.py
class BaseImage(object):
def __init__(self, border, width, box_size):
<|fim_suffix|> def drawrect(self, row, col):
raise NotImplementedError("BaseImage.drawrect")
def save(self, stream, kind=None):
raise NotImplemente... | code_fim | medium | {
"lang": "python",
"repo": "webknjaz/python3-qrcode",
"path": "/qrcode/image/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError("BaseImage.save")<|fim_prefix|># repo: webknjaz/python3-qrcode path: /qrcode/image/base.py
class BaseImage(object):
def __init__(self, border, width, box_size):
self.kind = None
self.border = border
self.width = width
self.box_size = b... | code_fim | medium | {
"lang": "python",
"repo": "webknjaz/python3-qrcode",
"path": "/qrcode/image/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>test_data_matrix = Featurizer(TEST_DATA_FILE_NAME, test=True).featurize()
test_batch_size = test_data_matrix.shape[0]
# This should return the probabilities.
predictions = learned_model.predict(test_data_matrix, batch_size=test_batch_size)
predictions_file = open('saved_files/model_probabilities.pkl', 'w... | code_fim | medium | {
"lang": "python",
"repo": "SVAI/MutRackers",
"path": "/model/train_and_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># This should return the probabilities.
predictions = learned_model.predict(test_data_matrix, batch_size=test_batch_size)
predictions_file = open('saved_files/model_probabilities.pkl', 'wb')
pickle.dump(predictions, predictions_file)<|fim_prefix|># repo: SVAI/MutRackers path: /model/train_and_test.py
fro... | code_fim | hard | {
"lang": "python",
"repo": "SVAI/MutRackers",
"path": "/model/train_and_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SVAI/MutRackers path: /model/train_and_test.py
from learner import MutationLearner
from featurize import Featurizer
import pickle
<|fim_suffix|># Trains the learner.
train_learner = MutationLearner(TRAIN_DATA_FILE_NAME)
learned_model = train_learner.train()
test_data_matrix = Featurizer(TEST_D... | code_fim | hard | {
"lang": "python",
"repo": "SVAI/MutRackers",
"path": "/model/train_and_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>w, h = 400, 300
bunch = GGBunch()
bunch.add_plot(p1, 0, 0, w, h)
bunch.add_plot(p2, w, 0, w, h)
bunch<|fim_prefix|># repo: Tryweirder/lets-plot-docs path: /docs/_downloads/0c9a20cb0c88082cd7333beed1f2d23a/plot__fixed_coordinates.py
"""
Fixed Coordinates
=================
Cartesian coordinates... | code_fim | hard | {
"lang": "python",
"repo": "Tryweirder/lets-plot-docs",
"path": "/docs/_downloads/0c9a20cb0c88082cd7333beed1f2d23a/plot__fixed_coordinates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tryweirder/lets-plot-docs path: /docs/_downloads/0c9a20cb0c88082cd7333beed1f2d23a/plot__fixed_coordinates.py
"""
Fixed Coordinates
=================
Cartesian coordinates with fixed aspect ratio between ``x`` and ``y``
units.
<|fim_suffix|>df = pd.read_csv('https://raw.githubuserco... | code_fim | hard | {
"lang": "python",
"repo": "Tryweirder/lets-plot-docs",
"path": "/docs/_downloads/0c9a20cb0c88082cd7333beed1f2d23a/plot__fixed_coordinates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from lets_plot import *
LetsPlot.setup_html()
# %%
df = pd.read_csv('https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv')
# %%
p = ggplot(df, aes('cty', 'hwy')) + geom_point()
p1 = p + ggtitle('Default')
p2 = p + coord_fixed() + ggtitle('With Fixed Coordinates')
... | code_fim | hard | {
"lang": "python",
"repo": "Tryweirder/lets-plot-docs",
"path": "/docs/_downloads/0c9a20cb0c88082cd7333beed1f2d23a/plot__fixed_coordinates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onepercentclub/onepercentclub-site path: /apps/recurring_donations/tests/test_commands.py
from decimal import Decimal
from apps.recurring_donations.models import MonthlyOrder
from apps.recurring_donations.tests.model_factory import MonthlyDonorFactory, MonthlyDonorProjectFactory
from bluebottle.b... | code_fim | hard | {
"lang": "python",
"repo": "onepercentclub/onepercentclub-site",
"path": "/apps/recurring_donations/tests/test_commands.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_prepare(self):
# Create a monthly donor with a preferred project
monthly_donor1 = MonthlyDonorFactory(user=self.user1, amount=25)
monthly_donor1_project = MonthlyDonorProjectFactory(donor=monthly_donor1, project=self.projects[0])
# Create a monthly donor witho... | code_fim | hard | {
"lang": "python",
"repo": "onepercentclub/onepercentclub-site",
"path": "/apps/recurring_donations/tests/test_commands.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Should have one donation
self.assertEqual(monthly_order.donations.count(), 1)
# Donation should have amount 25 and go to first project
self.assertEqual(monthly_order.donations.all()[0].amount, Decimal('25'))
self.assertEqual(monthly_order.donations.all()[0].projec... | code_fim | hard | {
"lang": "python",
"repo": "onepercentclub/onepercentclub-site",
"path": "/apps/recurring_donations/tests/test_commands.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HEPData/hepdata_lib path: /tests/test_helpers.py
#!/usr/bin/env python
"""Test helpers."""
from unittest import TestCase
import numpy as np
from hepdata_lib.helpers import relative_round
from hepdata_lib.helpers import get_number_precision
from hepdata_lib.helpers import get_value_precision_wrt... | code_fim | hard | {
"lang": "python",
"repo": "HEPData/hepdata_lib",
"path": "/tests/test_helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Test format is
# (container, key_for_values, key_for_uncertanties, significant_digits)
# uncertainty has a single value
cont = {"val": [1.23456, 1234.56, 0.0012345, 0.123],
"unc": [0.00123, 1.23, 0.012, 0.12],
"val_round": [1.2346, 1234.6, ... | code_fim | hard | {
"lang": "python",
"repo": "HEPData/hepdata_lib",
"path": "/tests/test_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ferald89/deicaphone path: /smanager/services/models/comments.py
"""Comments model."""
# Django
from django.db import models
# Utilities
from smanager.utils.models import SManageModel
class Comment(SManageModel):
<|fim_suffix|> made_in = models.ForeignKey(
"services.Service"... | code_fim | hard | {
"lang": "python",
"repo": "Ferald89/deicaphone",
"path": "/smanager/services/models/comments.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> made_by = models.ForeignKey(
"users.User",
on_delete=models.SET_NULL,
null=True
)
made_in = models.ForeignKey(
"services.Service",
on_delete=models.SET_NULL,
null=True
)
is_act... | code_fim | medium | {
"lang": "python",
"repo": "Ferald89/deicaphone",
"path": "/smanager/services/models/comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> made_in = models.ForeignKey(
"services.Service",
on_delete=models.SET_NULL,
null=True
)
is_active = models.BooleanField(
'Es Activo',
default=True,
help_text='used fot disabiling when the service w... | code_fim | hard | {
"lang": "python",
"repo": "Ferald89/deicaphone",
"path": "/smanager/services/models/comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: buriedms/awesome-DeepLearning path: /competition/半监督目标定位比赛第一名模型/code/models.py
from backcbone.Res2Net import Res2Net200_vd_26w_4s_ssld
from backcbone.ResNeXt import ResNeXt101_32x16d_wsl
from backcbone.SwinTransformer import SwinTransformer_large_patch4_window12_384
from Decoder.ACFFNet import AC... | code_fim | medium | {
"lang": "python",
"repo": "buriedms/awesome-DeepLearning",
"path": "/competition/半监督目标定位比赛第一名模型/code/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def Res2NetandFMFNet():
return FMFModel(backbone=Res2Net200_vd_26w_4s_ssld(pretrained=False))
def ResNeXtandACFFNet():
return ACFFModel(backbone=ResNeXt101_32x16d_wsl(pretrained=False))
def SwinTandACFFNet():
return ACFFViTModel(backbone=SwinTransformer_large_patch4_window12_384(pretrained... | code_fim | medium | {
"lang": "python",
"repo": "buriedms/awesome-DeepLearning",
"path": "/competition/半监督目标定位比赛第一名模型/code/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ACFFViTModel(backbone=SwinTransformer_large_patch4_window12_384(pretrained=False))<|fim_prefix|># repo: buriedms/awesome-DeepLearning path: /competition/半监督目标定位比赛第一名模型/code/models.py
from backcbone.Res2Net import Res2Net200_vd_26w_4s_ssld
from backcbone.ResNeXt import ResNeXt101_32x16d_wsl
fro... | code_fim | medium | {
"lang": "python",
"repo": "buriedms/awesome-DeepLearning",
"path": "/competition/半监督目标定位比赛第一名模型/code/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Dataframes com os resultados da redução de dimensionalidade
ComponentesTreino = pd.DataFrame(pcaDF_treino)
ComponentesTeste = pd.DataFrame(pcaDF_teste)
# Modelo de regressão logística
modelo = LogisticRegression()
# Criação do pipeline
pipe = Pipeline([('pca', pca), ('RegLog', modelo)])
# Treinamento... | code_fim | hard | {
"lang": "python",
"repo": "CarlosCarvalho1981/PipePython",
"path": "/Desafio-Cap06.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CarlosCarvalho1981/PipePython path: /Desafio-Cap06.py
# Modelo preditivo de classificaçãp para prever o valor de uma variável binária (true ou false) a partir de dados numéricos
# Exercício desenvolvido no curso Formação Cientista de Dados (https://www.datascienceacademy.com.br/pages/formacao-cie... | code_fim | medium | {
"lang": "python",
"repo": "CarlosCarvalho1981/PipePython",
"path": "/Desafio-Cap06.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MobleyLab/SMIRNOFF_paper_code path: /selected_molecules/nc_to_pdb.py
#!/bin env python
# Convert NetCDF files for cases output here to PDB format for easier visualization across different viewers
<|fim_suffix|> # Align trajectory to frame 0 and write to PDB for viewing
traj.super... | code_fim | hard | {
"lang": "python",
"repo": "MobleyLab/SMIRNOFF_paper_code",
"path": "/selected_molecules/nc_to_pdb.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Loop over trajectories and convert
for ttype in ['', '_gaff', '_gaff2']:
for tprefix in traj_prefixes:
molname = os.path.basename(tprefix)
# Load relevant NetCDF trajectory
trajfile = 'trajectories/%s%s.nc' % (molname,ttype)
# We require a topology file which has the ... | code_fim | hard | {
"lang": "python",
"repo": "MobleyLab/SMIRNOFF_paper_code",
"path": "/selected_molecules/nc_to_pdb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sycz00/iGibson path: /igibson/object_states/on_top.py
import pybullet as p
from IPython import embed
import igibson
from igibson.object_states.adjacency import VerticalAdjacency
from igibson.object_states.memoization import PositionalValidationMemoizedObjectStateMixin
from igibson.object_states.... | code_fim | hard | {
"lang": "python",
"repo": "sycz00/iGibson",
"path": "/igibson/object_states/on_top.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_value(self, other, use_ray_casting_method=False):
del use_ray_casting_method
# Touching is the less costly of our conditions.
# Check it first.
if not self.obj.states[Touching].get_value(other):
return False
# Then check vertical adjacency... | code_fim | hard | {
"lang": "python",
"repo": "sycz00/iGibson",
"path": "/igibson/object_states/on_top.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skarzi/django-test-migrations path: /tests/unit/test_mixins.py
import pytest
from test_migrations import mixins
class MigrationTestEmpty(mixins.MigrationTestMixin):
pass
class MigrationTestWithMigrateFrom(mixins.MigrationTestMixin):
migrate_from = '0001_initial'
class MigrationTest... | code_fim | hard | {
"lang": "python",
"repo": "skarzi/django-test-migrations",
"path": "/tests/unit/test_mixins.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
mocker,
app_name,
expected_app_name,
):
app_config_getter_mock = mocker.patch(
'test_migrations.mixins.django_apps.get_containing_app_config',
)
app_config_getter_mock.return_value.name = app_name
instanc... | code_fim | hard | {
"lang": "python",
"repo": "skarzi/django-test-migrations",
"path": "/tests/unit/test_mixins.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_del_client_from_group(app, db):
with pytest.allure.step('If do not find group,add him'):
if len(db.get_group_list())==0:
app.group.create(Group(name="test"))
with pytest.allure.step('If do not find client,add him'):
if len(db.get_client_list())==0:
... | code_fim | hard | {
"lang": "python",
"repo": "dariabramenkova/python_training",
"path": "/test/test_client_in_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dariabramenkova/python_training path: /test/test_client_in_group.py
from model.client import Client
from model.group import Group
from random import randrange
import random
from fixture.orm import ORMFixture
import pytest
orm=ORMFixture(host="localhost", name="addressbook", user="root", password... | code_fim | medium | {
"lang": "python",
"repo": "dariabramenkova/python_training",
"path": "/test/test_client_in_group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ihave13digits/PyxelPy path: /classes.py
from pygame import sprite, Surface, Rect
from var import DISPLAY_SIZE, CELL_SIZE, COLOR_BG
from cursors import *
BG = list(COLOR_BG)
class Cell(sprite.Sprite):
def __init__(self, x, y, r=BG[0], g=BG[1], b=BG[2], a=BG[3]):
sprite.Sprite.__ini... | code_fim | hard | {
"lang": "python",
"repo": "ihave13digits/PyxelPy",
"path": "/classes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> import pygame as pg
from os import path, chdir
sprite.Sprite.__init__(self)
self.posx = x
self.posy = y
r = path.dirname(__file__)
chdir(path.join(r, 'data'))
self.img = pg.image.load(path.join('res', img))
chdir(r)
self.imag... | code_fim | hard | {
"lang": "python",
"repo": "ihave13digits/PyxelPy",
"path": "/classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imsplitbit/flask_user_group path: /tests/test_users.py
import app
import unittest
import json
from copy import deepcopy
from app import db
class UserTestCase(unittest.TestCase):
def setUp(self):
app.app.config['TESTING'] = True
self.test_group1_groupid = 'admins'
sel... | code_fim | hard | {
"lang": "python",
"repo": "imsplitbit/flask_user_group",
"path": "/tests/test_users.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Delete one of those groups
resp = self.app.delete('/groups/{}'.format(self.test_group1_groupid))
assert resp.status_code == 200
# Verify that the group is gone
resp = self.app.get('/groups/{}'.format(self.test_group1_groupid))
assert resp.status_code == 4... | code_fim | hard | {
"lang": "python",
"repo": "imsplitbit/flask_user_group",
"path": "/tests/test_users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Finally list the group
resp = self.app.get('/groups/{}'.format(self.test_group2_groupid))
assert resp.status_code == 200
data = json.loads(resp.data)
assert self.test_user1_userid in data
assert self.test_user2_userid in data
def test_list_group_404(... | code_fim | hard | {
"lang": "python",
"repo": "imsplitbit/flask_user_group",
"path": "/tests/test_users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SilverLinings89/Hallmarks-Search-Engine path: /Classifier/DataLoaders/prepare_dataset.py
import sys
id_start_at = 52
id_end_at = 84
filenames = ['1901-1950', '1951-1970', '1971-1980', '1981-1990', '1991-1995', '1996-2000', '2001-2005', '2006-2008', '2009-2010', '2011', '2012', '2013', '2014', '2... | code_fim | hard | {
"lang": "python",
"repo": "SilverLinings89/Hallmarks-Search-Engine",
"path": "/Classifier/DataLoaders/prepare_dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def readall():
counter =0
with open(BasePath + "CancerArticlesClean.dat", 'w') as of:
for item in filenames:
with open(titleset(item)) as f:
for line in f:
if "#nf#" not in line:... | code_fim | hard | {
"lang": "python",
"repo": "SilverLinings89/Hallmarks-Search-Engine",
"path": "/Classifier/DataLoaders/prepare_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pguridi/sandboxed-game-engine path: /turnboxed/__init__.py
import os
import sys
if 'PYPY_PATH' not in os.environ.keys():
PYPY_PATH = '/opt/pypy-4.0.0-src'
else:
PYPY_PATH = os.environ['PYPY_SOURCE_PATH']
<|fim_suffix|>from . import basebot
current_dir = os.path.split(basebot.__file__)[... | code_fim | medium | {
"lang": "python",
"repo": "pguridi/sandboxed-game-engine",
"path": "/turnboxed/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import pypy
LIB_ROOT = os.path.dirname(os.path.dirname(pypy.__file__))
from . import basebot
current_dir = os.path.split(basebot.__file__)[0]
BASE_BOT_FILE = os.path.abspath(os.path.join(current_dir, "basebot.py"))
GAME_BOT_DIR = os.environ.get('GAME_BOT_DIR', current_dir)
GAME_BOT_FILE = os.path.abspat... | code_fim | medium | {
"lang": "python",
"repo": "pguridi/sandboxed-game-engine",
"path": "/turnboxed/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>DEBUG = False
import pypy
LIB_ROOT = os.path.dirname(os.path.dirname(pypy.__file__))
from . import basebot
current_dir = os.path.split(basebot.__file__)[0]
BASE_BOT_FILE = os.path.abspath(os.path.join(current_dir, "basebot.py"))
GAME_BOT_DIR = os.environ.get('GAME_BOT_DIR', current_dir)
GAME_BOT_FILE =... | code_fim | medium | {
"lang": "python",
"repo": "pguridi/sandboxed-game-engine",
"path": "/turnboxed/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>time.sleep(8)
print(' [*] Waiting for message. To exit press CTRL+C')
for t in threading.enumerate():
print "Thread[%s] is %s" % (t.name, t.is_alive())
master.close()
print(' [*] Exit!')
signal.pause()
# master.retain()<|fim_prefix|># repo: opflow/opflow-python path: /examples/fibonacci_rpc_master... | code_fim | hard | {
"lang": "python",
"repo": "opflow/opflow-python",
"path": "/examples/fibonacci_rpc_master.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print 'SIGTERM/SIGINT'
master.close()
sys.exit(0)
signal.signal(signal.SIGINT, signal_term_handler)
signal.signal(signal.SIGTERM, signal_term_handler)
message = json.dumps({ 'number': 25 })
print(" [x] Sent %r" % (message))
req = master.request('fibonacci', message, {
'timeout': 10
});
ti... | code_fim | hard | {
"lang": "python",
"repo": "opflow/opflow-python",
"path": "/examples/fibonacci_rpc_master.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opflow/opflow-python path: /examples/fibonacci_rpc_master.py
#!/usr/bin/env python
import json
import os
import sys
import time
import signal
import threading
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/..')
... | code_fim | hard | {
"lang": "python",
"repo": "opflow/opflow-python",
"path": "/examples/fibonacci_rpc_master.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fountain111/bequeather path: /bequeather/action/command.py
from .base import BaseAction
import os, subprocess, logging, json
logging.basicConfig(level = logging.INFO)
logger = logging.getLogger(__name__)
class ShellCommand(BaseAction):
<|fim_suffix|> """
logger.debug("Executing shell comman... | code_fim | medium | {
"lang": "python",
"repo": "fountain111/bequeather",
"path": "/bequeather/action/command.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #if isinstance(kwargs, list):
#parse args
process = subprocess.Popen([command] + kwargs, env = os.environ.copy(), stdout = subprocess.PIPE, stderr = subprocess.PIPE)
try:
out, err = process.communicate(timeout = 10)
except subprocess.TimeoutExpired:
process.kill()
out, err = process.co... | code_fim | hard | {
"lang": "python",
"repo": "fountain111/bequeather",
"path": "/bequeather/action/command.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wild-trip/CyberDAS-API path: /alembic/versions/20210907_aff6badb8f87.py
"""
Убраны часовые пояса
Revision ID: aff6badb8f87
Revises: 22d32aac74f7
Create Date: 2021-09-07 01:05:37.881411
"""
from alembic import op
import sqlalchemy as sa
<|fim_suffix|>def downgrade():
op.alter_column('sessi... | code_fim | hard | {
"lang": "python",
"repo": "wild-trip/CyberDAS-API",
"path": "/alembic/versions/20210907_aff6badb8f87.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def upgrade():
op.alter_column('sessions', 'expires', type_=sa.DateTime(timezone = False), postgresql_using='expires::timestamp')
op.alter_column('sessions', 'created_at', type_=sa.DateTime(timezone = False), postgresql_using='created_at::timestamp')
op.alter_column('users', 'created_at', type... | code_fim | medium | {
"lang": "python",
"repo": "wild-trip/CyberDAS-API",
"path": "/alembic/versions/20210907_aff6badb8f87.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mincrmatt12/parseit path: /parseit/parseit.py
import re
import collections
# simple parser
# tokens are re.Regexes in a dict
# rules are lists of:
# strings: UPPERCASE means tokens, lower_case means rules
# lists : grouping of strings, last string in list is specifier:
# ? op... | code_fim | hard | {
"lang": "python",
"repo": "mincrmatt12/parseit",
"path": "/parseit/parseit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def consume_bare_rulesegment(input_str, rulesegment, tokens, at, rules, token_types):
result = None
head = tokens[at]
if rulesegment.isupper():
if head[0] == rulesegment:
result = head
at += 1
else:
throw_parse_error(input_str, head[2],
... | code_fim | hard | {
"lang": "python",
"repo": "mincrmatt12/parseit",
"path": "/parseit/parseit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fre-sch/redscript-docgen path: /redscript_docgen/parser/grammar.py
from parsimonious import Grammar
ws = r"""
_ = comment / line_comment / ~"\s*"
ws = ~"\s+"
le = ~"(\r\n|\r|\n)"
comment_start = "/*"
comment_end = "*/"
c... | code_fim | hard | {
"lang": "python",
"repo": "fre-sch/redscript-docgen",
"path": "/redscript_docgen/parser/grammar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>symbols = r"""
lbrace = "{"
rbrace = "}"
lparen = "("
rparen = ")"
listsep = _ "," _
typesep = _ ":" _
gt = ">"
lt = "<"
equal = "="
"""
annotation = r"""
annotationlis... | code_fim | hard | {
"lang": "python",
"repo": "fre-sch/redscript-docgen",
"path": "/redscript_docgen/parser/grammar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> func_sig = annotationlist qualifierlist "func" _ func_name _ parameters _ func_return_type
func_name = ident?
func_return_type = "->" _ type
func_body_start = lbrace
func_body_end = rbrace
func_body_content = func_body / (!func_body_start !func_body_end ~"."... | code_fim | hard | {
"lang": "python",
"repo": "fre-sch/redscript-docgen",
"path": "/redscript_docgen/parser/grammar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiujiujiu0313/jingziqi path: /board.py
class Board(object):
def __init__(self):
self.board_data=[" "]*9
self.movable_list=list(range(9))
def show_board(self,show_index=False):
for i in (0,3,6):
print(" | |")
if show_index:
... | code_fim | hard | {
"lang": "python",
"repo": "jiujiujiu0313/jingziqi",
"path": "/board.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__=='__main__':
board=Board()
# print(board.board_data)
# print(board.movable_list)
# print("---显示棋盘---"+"-"*50)
# board.show_board(True)
# print("-"*50)
# board.show_board()
# print("---测试落子"+"-"*50)
# board.move_down(0,"x")
# board.show_board()
... | code_fim | hard | {
"lang": "python",
"repo": "jiujiujiu0313/jingziqi",
"path": "/board.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e='dataset factors'),
# Tag related
url(r'^tag/$', views.dataset_tags, name='dataset tag list'),
url(r'^tag/(?P<tag_name>.+)/$', views.dataset_filter_by_tag,
name='dataset filtered by tag'),
url(r'^search/4-biogps/$', views.dataset_search_4_biogps,
name='dataset search for ... | code_fim | hard | {
"lang": "python",
"repo": "SuLab/biogps_dataset",
"path": "/dataset/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SuLab/biogps_dataset path: /dataset/urls.py
from django.conf.urls import patterns, url
from dataset import views
urlpatterns = patterns(
'',
url(r'^$', views.dataset_list, name='dataset list'),
url(r'^meta/(?P<ds_id>.+)/$', views.dataset_info,
name='dataset meta'),
url(r... | code_fim | hard | {
"lang": "python",
"repo": "SuLab/biogps_dataset",
"path": "/dataset/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrew962/Python path: /Archivos/__init__.py
sal = True
while sal:
nombre = input("Nombre: ")
notafinal = int(input("Nota final: "))
if 91 <= notafinal <= 100:
print(nombre+ ", sacaste una A " + str(notafinal) + ":D")
<|fim_suffix|>notafinal < 0:
print("No... | code_fim | hard | {
"lang": "python",
"repo": "andrew962/Python",
"path": "/Archivos/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"N":
sal = False
print("Hasta luego")
elif opc == "S":
sal = True
else:
sal = True
print("No colocaste algo valido, pero te mantendre en el ciclo")<|fim_prefix|># repo: andrew962/Python path: /Archivos/__init__.py
sal = True
while sal:
nombre =... | code_fim | hard | {
"lang": "python",
"repo": "andrew962/Python",
"path": "/Archivos/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>notafinal < 0:
print("Nota final invalida")
else:
print("Sacaste una F "+ str(notafinal) + "!")
opc = input("Deceas continuar (S/N) -->").upper()
if opc == "N":
sal = False
print("Hasta luego")
elif opc == "S":
sal = True
el... | code_fim | hard | {
"lang": "python",
"repo": "andrew962/Python",
"path": "/Archivos/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewhead/Search-Task-Logger path: /searchlogger/searchlogger/models.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.db import models
from django.contrib.auth.models import User
<|fim_suffix|>
class LocationEvent(models.Mode... | code_fim | medium | {
"lang": "python",
"repo": "andrewhead/Search-Task-Logger",
"path": "/searchlogger/searchlogger/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = models.ForeignKey(User, on_delete=models.DO_NOTHING)
visit_date = models.DateTimeField(db_index=True)
log_date = models.DateTimeField(db_index=True, auto_now_add=True)
tab_id = models.CharField(max_length=128, default='null')
tab_index = models.IntegerField()
title = models.... | code_fim | medium | {
"lang": "python",
"repo": "andrewhead/Search-Task-Logger",
"path": "/searchlogger/searchlogger/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: f0cal/core2 path: /src/f0cal/core/state.py
import os
import io
import sys
import types
import functools
import distutils.spawn
import logging
import shlex
import subprocess
import configparser
import plugnparse
from .helpers import Jinja2Renderer
HERE = os.path.dirname(__file__)
LOG = logging.... | code_fim | hard | {
"lang": "python",
"repo": "f0cal/core2",
"path": "/src/f0cal/core/state.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plugin_funcs = self.scanner.query("sets=='ini'")
for plugin_name, ini_func in plugin_funcs.items():
config_dict = self.config[plugin_name]
ini_func(**config_dict)
@staticmethod
def subprocess_run(exe_str, *args, **dargs):
LOG.debug(f"{exe_str} {args... | code_fim | hard | {
"lang": "python",
"repo": "f0cal/core2",
"path": "/src/f0cal/core/state.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkbeh/pydrommer path: /src/extra/exceptions.py
# -*- coding: utf-8 -*-
class ArgValueTypeDefinerExc(Exception):
def __init__(self, error_msg=''):
Exception.__init__(self, f'{error_msg}')
class IncorrectHosts(ArgValueTypeDefinerExc):
def __init__(self, hosts):
super()._... | code_fim | medium | {
"lang": "python",
"repo": "mkbeh/pydrommer",
"path": "/src/extra/exceptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, hosts):
super().__init__(error_msg=f'Incorrect hosts {hosts}.')
class BlocksCalculatorExc(Exception):
def __init__(self, error_msg=''):
Exception.__init__(self, f'{error_msg}')
class InvalidPortsRange(BlocksCalculatorExc):
def __init__(self, ports_range):... | code_fim | medium | {
"lang": "python",
"repo": "mkbeh/pydrommer",
"path": "/src/extra/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Biocodings/mhcflurry path: /test/test_class1_neural_network.py
import numpy
import pandas
numpy.random.seed(0)
from mhcflurry import Class1NeuralNetwork
from nose.tools import eq_
from numpy import testing
<|fim_suffix|>def test_class1_affinity_predictor_a0205_training_accuracy():
# Memori... | code_fim | medium | {
"lang": "python",
"repo": "Biocodings/mhcflurry",
"path": "/test/test_class1_neural_network.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = pandas.read_csv(
get_path(
"data_curated", "curated_training_data.csv.bz2"))
df = df.ix[
df.allele == allele
]
df = df.ix[
df.peptide.str.len() == 9
]
df = df.ix[
df.measurement_type == "quantitative"
]
df = df.ix[
df... | code_fim | medium | {
"lang": "python",
"repo": "Biocodings/mhcflurry",
"path": "/test/test_class1_neural_network.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> predictor = Class1NeuralNetwork(**hyperparameters)
predictor.fit(df.peptide.values, df.measurement_value.values)
ic50_pred = predictor.predict(df.peptide.values)
ic50_true = df.measurement_value.values
eq_(len(ic50_pred), len(ic50_true))
testing.assert_allclose(
numpy.log(i... | code_fim | hard | {
"lang": "python",
"repo": "Biocodings/mhcflurry",
"path": "/test/test_class1_neural_network.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rt actual == ans, \
'failed test: input = {}; expected = {}; actual = {}'.format(
t, ans, actual)<|fim_prefix|># repo: pterodragon/programming path: /Python/leetcode/Triangle/test_solution.py
import solution
import nose
def test():
tests = [
[[[-10]], -10],
... | code_fim | hard | {
"lang": "python",
"repo": "pterodragon/programming",
"path": "/Python/leetcode/Triangle/test_solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pterodragon/programming path: /Python/leetcode/Triangle/test_solution.py
import solution
import nose
def test():
tests = [
[[[-10]], -10],
[[[-10], [1, 2]], -9],
[<|fim_suffix|>rt actual == ans, \
'failed test: input = {}; expected = {}; actual = {}'... | code_fim | hard | {
"lang": "python",
"repo": "pterodragon/programming",
"path": "/Python/leetcode/Triangle/test_solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MilesWangSeven/keil_utilitis path: /AdvancedRelease/AdvancedRelease.py
import sys
import os
from hashlib import md5, sha1
from zlib import crc32
import os
import time
import shutil
def get_filename_modifyTime(filename):
time.ctime(os.stat(filename).st_mtime)
time.ctime(os.stat(filename).... | code_fim | hard | {
"lang": "python",
"repo": "MilesWangSeven/keil_utilitis",
"path": "/AdvancedRelease/AdvancedRelease.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sha1Obj = sha1()
with open(filename, 'rb') as f:
sha1Obj.update(f.read())
return sha1Obj.hexdigest()
def getCrc32(filename):
with open(filename, 'rb') as f:
return crc32(f.read()) & 0xffffffff
def get_filePath_Name_Ext(filename):
(filepath,tempfilename) = os.path.spli... | code_fim | hard | {
"lang": "python",
"repo": "MilesWangSeven/keil_utilitis",
"path": "/AdvancedRelease/AdvancedRelease.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Image no: ')
print(ind)
image_np = misc.imread(image_path, mode='RGB')
file_name = ntpath.basename(image_path)
height_pix, width_pix, _ = image_np.shape
print(image_np.shape)
detect_struct = imageDetection()
detect_str... | code_fim | hard | {
"lang": "python",
"repo": "yh578/models",
"path": "/research/object_detection/ssdmodel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yh578/models path: /research/object_detection/ssdmodel.py
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
from scipy import misc
import ntpath
from PIL import Image
from object_detection.calculate_iou_final import imageDetection
imp... | code_fim | hard | {
"lang": "python",
"repo": "yh578/models",
"path": "/research/object_detection/ssdmodel.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>for p in palavras:
print(f'\nNa palavra {p.upper()} temos ', end = '')
for letra in p:
if letra.lower() in 'aeiou':
print(letra, end = ' ')<|fim_prefix|># repo: bruceewmesmo/python-mundo-03 path: /ex077.py
# EXERCICIO 077 - CONTANDO VOGAIS EM TUPLAS
<|fim_middle|>palavras = ... | code_fim | medium | {
"lang": "python",
"repo": "bruceewmesmo/python-mundo-03",
"path": "/ex077.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bruceewmesmo/python-mundo-03 path: /ex077.py
# EXERCICIO 077 - CONTANDO VOGAIS EM TUPLAS
<|fim_suffix|>for p in palavras:
print(f'\nNa palavra {p.upper()} temos ', end = '')
for letra in p:
if letra.lower() in 'aeiou':
print(letra, end = ' ')<|fim_middle|>palavras = ... | code_fim | medium | {
"lang": "python",
"repo": "bruceewmesmo/python-mundo-03",
"path": "/ex077.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> scHZjLUh1 = base64.decodestring(scHZjLUh1)
key=b'nyloner'
lenth= len(key)
schlenth=len(scHZjLUh1)
code=''
for i in range(schlenth):
coeFYlqUm2 = i % lenth
code+= chr(scHZjLUh1[i] ^ key[coeFYlqUm2])
#print(code)
... | code_fim | hard | {
"lang": "python",
"repo": "hook923/IPProxyTool",
"path": "/ipproxytool/spiders/proxy/nyloner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hook923/IPProxyTool path: /ipproxytool/spiders/proxy/nyloner.py
# -*- coding: utf-8 -*-
from .basespider import BaseSpider
from scrapy.selector import Selector
from ...items import IpProxyItem
import json
import re
from datetime import datetime
import time
import hashlib
import base64
... | code_fim | hard | {
"lang": "python",
"repo": "hook923/IPProxyTool",
"path": "/ipproxytool/spiders/proxy/nyloner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.