text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: hotheat/LeetCode path: /168. Excel Sheet Column Title/168.py
class Solution:
def convertToTitle(self, n):
"""
:type n: int
:rtype: str
代码错误,跑不出来
"""
number = dict(zip(range(1, 27), [chr(i) for i in range(65, 91)]))
<|fim_suffix|> while T... | code_fim | hard | {
"lang": "python",
"repo": "hotheat/LeetCode",
"path": "/168. Excel Sheet Column Title/168.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hackerhelmut/htmlreport path: /plugin.py
"""
This file contains the main plugin system for texstats
"""
REGISTRY = {}
def register(name):
"""
Register Plugin class
>>> @register('name')
>>> class Foo(Plugin):
"""
def func(cls):
"""
See register
"""
... | code_fim | hard | {
"lang": "python",
"repo": "hackerhelmut/htmlreport",
"path": "/plugin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Define comand line arguments in parser
"""
pass
def configure(self, args):
"""
Store comand line arguments for execution
"""
pass
def execute(self):
"""
Execute Plugin code
"""
pass<|fim_prefix|>#... | code_fim | hard | {
"lang": "python",
"repo": "hackerhelmut/htmlreport",
"path": "/plugin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Slugo74/Bomberman path: /enemy.py
class Enemy:
def __init__(self):
self.actualPos = [651, 50]
self.sprite = None
self.width = 38
self.length = 40
self.hitbox = None
def setHitbox(self, aux):
self.hitbox = aux
def getHitbox(self):
... | code_fim | medium | {
"lang": "python",
"repo": "Slugo74/Bomberman",
"path": "/enemy.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.sprite = image
def getSprite(self):
return self.sprite
def getPostion(self):
return self.actualPos<|fim_prefix|># repo: Slugo74/Bomberman path: /enemy.py
class Enemy:
def __init__(self):
self.actualPos = [651, 50]
self.sprite = None
self.... | code_fim | medium | {
"lang": "python",
"repo": "Slugo74/Bomberman",
"path": "/enemy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'),
),
migrations.AddField(
model_name='category',
name='workspace',
field=models.ForeignKey(to='expenses_app.Workspace'),
),
migrations.AddField(
model_name='billrow',
name='category',
field=models.For... | code_fim | hard | {
"lang": "python",
"repo": "szymonhab/home_expenses",
"path": "/expenses_app/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: szymonhab/home_expenses path: /expenses_app/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(... | code_fim | hard | {
"lang": "python",
"repo": "szymonhab/home_expenses",
"path": "/expenses_app/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"""
------------------------------------------------------
-------------- 1. CONFIGURAÇÃO INICIAL ---------------
1.2 Definição de variáveis do projeto
------------------------------------------------------
"""
# Lendo variáveis de ambiente
load_dotenv(find_dotenv())
# Definindo variáveis de d... | code_fim | hard | {
"lang": "python",
"repo": "ThiagoPanini/filescope",
"path": "/examples/controle_de_diretorio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThiagoPanini/filescope path: /examples/controle_de_diretorio.py
"""
---------------------------------------------------
----- Exemplos de uso - Controle de diretório -----
---------------------------------------------------
Script responsável por consolidar um exemplo de
aplicação associado a cr... | code_fim | hard | {
"lang": "python",
"repo": "ThiagoPanini/filescope",
"path": "/examples/controle_de_diretorio.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Lendo variáveis de ambiente
load_dotenv(find_dotenv())
# Definindo variáveis de diretório
SRC_PATH = os.getenv('SRC_PATH')
DST_PATH = os.getenv('DST_PATH')
"""
------------------------------------------------------
----- 3. GERANDO REPORT DE CONTROLE DE DIRETÓRIO -----
-------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "ThiagoPanini/filescope",
"path": "/examples/controle_de_diretorio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>name':'iron2/reset_password_email.html'},
name='reset_password'),
url(r'^reset_password_done/',password_reset_done,name='password_reset_done'),
url(r'^reset_password_confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/',password_reset_confirm,name='password_reset_confirm'),
url(r'^reset_pas... | code_fim | hard | {
"lang": "python",
"repo": "DragonovAk47/SocialQuery1",
"path": "/iron2/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DragonovAk47/SocialQuery1 path: /iron2/urls.py
from django.conf.urls import url
from django.urls import reverse
from . import views
from iron2.forms import LoginForm
from django.contrib.auth.views import login,logout,password_reset,password_reset_done,password_reset_confirm,password_reset_comple... | code_fim | hard | {
"lang": "python",
"repo": "DragonovAk47/SocialQuery1",
"path": "/iron2/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>e:
print("所有异常我都能捕捉!!",e) # 我们捕捉所有异常
except ZeroDivisionError as e:
print("我处理了第一个异常") # 第一个异常的处理
except IndexError as e:
print("我处理了第二个异常")# 第二个异常的处理<|fim_prefix|># repo: 1877762890/python_all-liuyingyign path: /day13任务及课上代码/代码/day13/demo/exceptiondemo.py
def devide(a,b):
if b ==... | code_fim | medium | {
"lang": "python",
"repo": "1877762890/python_all-liuyingyign",
"path": "/day13任务及课上代码/代码/day13/demo/exceptiondemo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1877762890/python_all-liuyingyign path: /day13任务及课上代码/代码/day13/demo/exceptiondemo.py
def devide(a,b):
if b == 0:
raise IndexError("被除数不能为0!")
else:<|fim_suffix|>e:
print("所有异常我都能捕捉!!",e) # 我们捕捉所有异常
except ZeroDivisionError as e:
print("我处理了第一个异常") # 第一个异常的处理
excep... | code_fim | medium | {
"lang": "python",
"repo": "1877762890/python_all-liuyingyign",
"path": "/day13任务及课上代码/代码/day13/demo/exceptiondemo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for dirs in RouteDirs:
xmlPath = fileDir + '/' + dirs + "/LCMSDistress/"
if os.path.exists(xmlPath) == True:
fulldir = xmlPath
else:
fulldir = 0
if fulldir > 0:
xmlfilepaths = []
os.chdir(fulldir)
for ... | code_fim | hard | {
"lang": "python",
"repo": "ElliottLocke/Digilog_Utilities",
"path": "/RuttingValidation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> RouteDirs = get_immediate_subdirectories(fileDir)
for dirs in RouteDirs:
xmlPath = fileDir + '/' + dirs + "/LCMSDistress/"
if os.path.exists(xmlPath) == True:
fulldir = xmlPath
else:
fulldir = 0
if fulldir > 0:
xmlfilepa... | code_fim | hard | {
"lang": "python",
"repo": "ElliottLocke/Digilog_Utilities",
"path": "/RuttingValidation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ElliottLocke/Digilog_Utilities path: /RuttingValidation.py
'''
Speed Validator
This application is used to validate the crew's speed during their RSP validations. To use the application, the validation runs must be in their own folder.
Created on Oct 9, 2013
@author: Elliott Locke
'''
from Tki... | code_fim | medium | {
"lang": "python",
"repo": "ElliottLocke/Digilog_Utilities",
"path": "/RuttingValidation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
#Feature Scaling
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
X_train = sc_X.fit_transform(X_train)
X_test = sc_X.transform(X_test)
'''<|fim_prefix|># repo: kushwahash/ml_dataprocessing path: /template.py
# A template for data preprocessing to apply ML
# Import the librar... | code_fim | hard | {
"lang": "python",
"repo": "kushwahash/ml_dataprocessing",
"path": "/template.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kushwahash/ml_dataprocessing path: /template.py
# A template for data preprocessing to apply ML
# Import the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
<|fim_suffix|>'''
#Feature Scaling
from sklearn.preprocessing import StandardScaler
sc_X = StandardScale... | code_fim | hard | {
"lang": "python",
"repo": "kushwahash/ml_dataprocessing",
"path": "/template.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''
#Feature Scaling
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
X_train = sc_X.fit_transform(X_train)
X_test = sc_X.transform(X_test)
'''<|fim_prefix|># repo: kushwahash/ml_dataprocessing path: /template.py
# A template for data preprocessing to apply ML
# Import the libra... | code_fim | hard | {
"lang": "python",
"repo": "kushwahash/ml_dataprocessing",
"path": "/template.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bigeast/ProjectEuler path: /(#165)Intersections.py
def gen():
s=290797
while 1:
s=s**2%50515093
yield s%500
def lcm(a,b):
<|fim_suffix|>def main(a):
g=gen()
lines=[]
points=set([])
for x in range(a):
x1=g.next()
y1=g.next()
x2=g.nex... | code_fim | hard | {
"lang": "python",
"repo": "bigeast/ProjectEuler",
"path": "/(#165)Intersections.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> x3=b2*1./n1
y3=n1*1./d1*x+b1
points.add((x3,y3))
print len(points)
main(100)<|fim_prefix|># repo: bigeast/ProjectEuler path: /(#165)Intersections.py
def gen():
s=290797
while 1:
s=s**2%50515093
yield s%500
def lcm(a,b):
<|fim_middle|> r... | code_fim | hard | {
"lang": "python",
"repo": "bigeast/ProjectEuler",
"path": "/(#165)Intersections.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_path():
frozen = "not"
if getattr(sys, "frozen", False):
# we are running in a bundle
frozen = "ever so"
bundle_dir = sys._MEIPASS
else:
# we are running in a normal Python environment
bundle_dir = os.path.dirname(os.path.abspath(__file__))
... | code_fim | medium | {
"lang": "python",
"repo": "Faizee095/Final_Year_Project",
"path": "/project/src/services/support/helper.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Faizee095/Final_Year_Project path: /project/src/services/support/helper.py
from os import system, name
import sys
import os
global_status_main = True
def set_global_main_value(value):
global global_status_main
global_status_main = value
def clear_screen():
<|fim_suffix|>def get_path(... | code_fim | medium | {
"lang": "python",
"repo": "Faizee095/Final_Year_Project",
"path": "/project/src/services/support/helper.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='PersonalInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('mobile', models.CharField(max_length=20)),
('address... | code_fim | hard | {
"lang": "python",
"repo": "dclokendra/portfolio",
"path": "/portfolio/account/migrations/0002_personalinfo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dclokendra/portfolio path: /portfolio/account/migrations/0002_personalinfo.py
# Generated by Django 3.0.2 on 2020-02-18 04:36
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Pers... | code_fim | hard | {
"lang": "python",
"repo": "dclokendra/portfolio",
"path": "/portfolio/account/migrations/0002_personalinfo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abiraja2004/internshipProj path: /AppBackend/RESTAPI/APIapp/migrations/0004_auto_20170726_1911.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-07-26 19:11
from __future__ import unicode_literals
from django.db import migrations
<|fim_suffix|> operations = [
migrations... | code_fim | medium | {
"lang": "python",
"repo": "abiraja2004/internshipProj",
"path": "/AppBackend/RESTAPI/APIapp/migrations/0004_auto_20170726_1911.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='map',
old_name='mapImage',
new_name='mapFilePath',
),
]<|fim_prefix|># repo: abiraja2004/internshipProj path: /AppBackend/RESTAPI/APIapp/migrations/0004_auto_20170726_1911.py
# -*- coding: utf-8... | code_fim | medium | {
"lang": "python",
"repo": "abiraja2004/internshipProj",
"path": "/AppBackend/RESTAPI/APIapp/migrations/0004_auto_20170726_1911.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> M = 10
K = 4
N = 4
X0 = Tensor(
shape=[M, K],
dtype=dtype,
name="X0",
is_input=True,
)
X1 = Tensor(
shape=[],
dtype=dtype,
name="X1",
value=3.0,
)
... | code_fim | hard | {
"lang": "python",
"repo": "facebookincubator/AITemplate",
"path": "/tests/unittest/compiler/test_fused_elementwise_out_of_order.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookincubator/AITemplate path: /tests/unittest/compiler/test_fused_elementwise_out_of_order.py
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... | code_fim | hard | {
"lang": "python",
"repo": "facebookincubator/AITemplate",
"path": "/tests/unittest/compiler/test_fused_elementwise_out_of_order.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> x0_pt = get_random_torch_tensor([M, K], dtype)
x2_pt = get_random_torch_tensor([M, K], dtype)
x3_pt = get_random_torch_tensor([K, N], dtype)
x4_pt = get_random_torch_tensor([K, N], dtype)
r0_pt = x0_pt + 3
r1_pt = nn.functional.linear(r0_pt, x3_pt)
... | code_fim | hard | {
"lang": "python",
"repo": "facebookincubator/AITemplate",
"path": "/tests/unittest/compiler/test_fused_elementwise_out_of_order.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.owning_service.is_initialized():
plm = self.owning_service.get_plm()
plm.monitor(args.num)
ret = ['Monitoring terminated']
else:
ret = ['PLM is not initialized']
return ret<|fim_prefix|># repo: enigmata/h8s-clp path: /servic... | code_fim | hard | {
"lang": "python",
"repo": "enigmata/h8s-clp",
"path": "/services/insteon/commands/monitor_v1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enigmata/h8s-clp path: /services/insteon/commands/monitor_v1.py
from command import Command, CommandInterface
class Monitor(Command):
def __init__(self, owning_service, version):
<|fim_suffix|> def execute(self, args):
if self.owning_service.is_initialized():
plm = sel... | code_fim | hard | {
"lang": "python",
"repo": "enigmata/h8s-clp",
"path": "/services/insteon/commands/monitor_v1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewjcmillar/ras-frontstage path: /tests/app/test_session.py
import time
import unittest
from frontstage import app, redis
from frontstage.common.session import SessionHandler
class TestSession(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
self.app.te... | code_fim | hard | {
"lang": "python",
"repo": "andrewjcmillar/ras-frontstage",
"path": "/tests/app/test_session.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check that the session expiry time has been reset
expires_in = redis.ttl(session_key)
self.assertEqual(expires_in, 3600)
def test_get_encoded_jwt(self):
# Create session and get session key
session = SessionHandler()
session.create_session(encoded_jwt... | code_fim | hard | {
"lang": "python",
"repo": "andrewjcmillar/ras-frontstage",
"path": "/tests/app/test_session.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # load checkpoint
ms.load_param_into_net(net, param_dict)
net.set_train(False)
# define loss, model
if config.dataset == "imagenet2012":
if not config.use_label_smooth:
config.label_smooth_factor = 0.0
loss = CrossEntropySmooth(sparse=True, reduction='mean'... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/models",
"path": "/official/cv/ResNet/golden_stick/pruner/scop/eval.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Charlkie/Nice-Demo path: /server/app/error.py
from flask import jsonify
from werkzeug.http import HTTP_STATUS_CODES
<|fim_suffix|> payload = {'error': HTTP_STATUS_CODES.get(400)}
if message:
payload['message'] = message
response = jsonify(payload)
response.states_code = 400
return response... | code_fim | easy | {
"lang": "python",
"repo": "Charlkie/Nice-Demo",
"path": "/server/app/error.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> payload = {'error': HTTP_STATUS_CODES.get(400)}
if message:
payload['message'] = message
response = jsonify(payload)
response.states_code = 400
return response<|fim_prefix|># repo: Charlkie/Nice-Demo path: /server/app/error.py
from flask import jsonify
from werkzeug.http import HTTP_STATUS_CODES
... | code_fim | easy | {
"lang": "python",
"repo": "Charlkie/Nice-Demo",
"path": "/server/app/error.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> vm.reboot()
def lvirt_parse__args():
parser = argparse.ArgumentParser(description="Pythonic wrapper "
"for libvirt. Author: Ruslan Aliev")
parser.add_argument('--create', dest='xml_file', metavar='VM_NAME',
help='Create VM defi... | code_fim | hard | {
"lang": "python",
"repo": "raliev12/os-training",
"path": "/libvirt_wrapper.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raliev12/os-training path: /libvirt_wrapper.py
import argparse
import libvirt
class LibvirtConn:
def __init__(self):
self.conn = libvirt.open("qemu:///system")
def find_vm_dec(func):
def closure(self, name, *args, **kwargs):
vm = self.conn.lookupByName(name... | code_fim | hard | {
"lang": "python",
"repo": "raliev12/os-training",
"path": "/libvirt_wrapper.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> decoder_input_layer = Input(shape=z_dim, name='decoder_input')
x = Dense(np.prod(shape_before_flattening))(decoder_input_layer)
x = Reshape(shape_before_flattening)(x)
for i in range(num_decoder_layers):
x = Conv2DTranspose(
filters = dec... | code_fim | hard | {
"lang": "python",
"repo": "zelosdev/TensorflowKerasTutorial",
"path": "/common/AE.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zelosdev/TensorflowKerasTutorial path: /common/AE.py
############################
# turning off the warnings #
import warnings
warnings.filterwarnings('ignore')
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow.python.util.deprecation as deprecation
deprecation._PRINT_DEPREC... | code_fim | hard | {
"lang": "python",
"repo": "zelosdev/TensorflowKerasTutorial",
"path": "/common/AE.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krallnyx/Top_10_Movies path: /main.py
import requests
from bs4 import BeautifulSoup
URL = "https://www.afi.com/afis-100-years-100-movies/"
<|fim_suffix|>with open("movies.txt", "w") as file:
[file.write(f"{movie}\n") for movie in all_movies]<|fim_middle|>response = requests.get(URL)
website... | code_fim | medium | {
"lang": "python",
"repo": "krallnyx/Top_10_Movies",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>soup = BeautifulSoup(website_html, "html.parser")
all_movies = [title.getText() for title in soup.find_all("h6", class_="q_title")[:100]]
with open("movies.txt", "w") as file:
[file.write(f"{movie}\n") for movie in all_movies]<|fim_prefix|># repo: krallnyx/Top_10_Movies path: /main.py
import request... | code_fim | easy | {
"lang": "python",
"repo": "krallnyx/Top_10_Movies",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open("movies.txt", "w") as file:
[file.write(f"{movie}\n") for movie in all_movies]<|fim_prefix|># repo: krallnyx/Top_10_Movies path: /main.py
import requests
from bs4 import BeautifulSoup
URL = "https://www.afi.com/afis-100-years-100-movies/"
response = requests.get(URL)
website_html = respon... | code_fim | medium | {
"lang": "python",
"repo": "krallnyx/Top_10_Movies",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> log.info("Writing output files")
for tup in alignments:
locus, aln = tup
if aln.trimmed is not None:
outname = "{}{}".format(
os.path.join(outdir, locus),
get_file_extensions(output_format)[0],
)
with open(outname,... | code_fim | hard | {
"lang": "python",
"repo": "faircloth-lab/phyluce",
"path": "/phyluce/helpers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faircloth-lab/phyluce path: /phyluce/helpers.py
#!/usr/bin/env python
# encoding: utf-8
"""
helpers.py
Created by Brant Faircloth on 15 July 2011.
Copyright 2011 Brant C. Faircloth. All rights reserved.
"""
import os
import re
import sys
import glob
import argparse
import shutil
import configp... | code_fim | hard | {
"lang": "python",
"repo": "faircloth-lab/phyluce",
"path": "/phyluce/helpers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rebearteta/social-ideation path: /ideascale/migrations/0008_auto_20150429_2247.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AlterField(
... | code_fim | hard | {
"lang": "python",
"repo": "rebearteta/social-ideation",
"path": "/ideascale/migrations/0008_auto_20150429_2247.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='comment',
name='comments',
field=models.PositiveIntegerField(null=True),
),
migrations.AlterField(
model_name='comment',
name='negative_votes',
field=models... | code_fim | hard | {
"lang": "python",
"repo": "rebearteta/social-ideation",
"path": "/ideascale/migrations/0008_auto_20150429_2247.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alefbispo/Exercicios-do-curso-de-Python path: /Pyon exercicios/Exercicios/018.py
import math
angulo = float(input('Informe o angulo: '))
seno = math.asin(math<|fim_suffix|>no é: {:.2f}\n e a tangente é: {:.2f}'.format(angulo, seno, cosseno, tangente))<|fim_middle|>.radians(angulo))
cosseno = mat... | code_fim | medium | {
"lang": "python",
"repo": "alefbispo/Exercicios-do-curso-de-Python",
"path": "/Pyon exercicios/Exercicios/018.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>no é: {:.2f}\n e a tangente é: {:.2f}'.format(angulo, seno, cosseno, tangente))<|fim_prefix|># repo: alefbispo/Exercicios-do-curso-de-Python path: /Pyon exercicios/Exercicios/018.py
import math
angulo = float(input('Informe o angulo: '))
seno = math.asin(math.radians(angulo))
cosseno = math.cos(math.rad... | code_fim | medium | {
"lang": "python",
"repo": "alefbispo/Exercicios-do-curso-de-Python",
"path": "/Pyon exercicios/Exercicios/018.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Emilylulu/Problems-conclusion path: /hard/Math/LC-No.829.py
def consecutiveNumbersSum(self, N):
"""
:type N: int
<|fim_suffix|>break
if mx % m == 0:
ans += 1
return ans<|fim_middle|> :rtype: int
"""
ans = 0
for... | code_fim | hard | {
"lang": "python",
"repo": "Emilylulu/Problems-conclusion",
"path": "/hard/Math/LC-No.829.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>break
if mx % m == 0:
ans += 1
return ans<|fim_prefix|># repo: Emilylulu/Problems-conclusion path: /hard/Math/LC-No.829.py
def consecutiveNumbersSum(self, N):
"""
:type N: int
:rtype: int
"""
ans = 0
for m in range(1,... | code_fim | hard | {
"lang": "python",
"repo": "Emilylulu/Problems-conclusion",
"path": "/hard/Math/LC-No.829.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kernel1983/tornado_WeiboMixin path: /auth.py
import time
import random
import string
import urlparse
import urllib
import hashlib
import tornado.web
import tornado.template
import tornado.auth
import tornado.escape
from setting import settings
import functools
from tornado import httpclient
... | code_fim | hard | {
"lang": "python",
"repo": "kernel1983/tornado_WeiboMixin",
"path": "/auth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> WeiboMixin):
@tornado.web.asynchronous
def get(self):
redirect_uri = "%s://%s%s" % (self.request.protocol, self.request.host, self.request.path)
code = self.get_argument("code", None)
if code:
self.get_authenticated_user(redirect_uri, settings... | code_fim | hard | {
"lang": "python",
"repo": "kernel1983/tornado_WeiboMixin",
"path": "/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> redirect_uri = "%s://%s%s" % (self.request.protocol, self.request.host, self.request.path)
code = self.get_argument("code", None)
if code:
self.get_authenticated_user(redirect_uri, settings["WeiboAppKey"], settings["WeiboAppSecret"],
c... | code_fim | hard | {
"lang": "python",
"repo": "kernel1983/tornado_WeiboMixin",
"path": "/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MetaVai/gradient-scaling path: /chainerlp/links/connection/conv2d_bn_activ.py
""" Almost a replicate of Conv2DBNActiv in chainercv.links.connection. """
import chainer
from chainer.functions import relu
from chainer.links import BatchNormalization
from chainer.links import Convolution2D
try:
... | code_fim | hard | {
"lang": "python",
"repo": "MetaVai/gradient-scaling",
"path": "/chainerlp/links/connection/conv2d_bn_activ.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
in_channels,
out_channels,
ksize=None,
stride=1,
pad=0,
dilate=1,
groups=1,
nobias=True,
initialW=None,
initial_bias=None,
activ=relu,
use_bn=True,
bn_kwargs={},
):
super().__i... | code_fim | hard | {
"lang": "python",
"repo": "MetaVai/gradient-scaling",
"path": "/chainerlp/links/connection/conv2d_bn_activ.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JingqiongWang/zhihuspider path: /page_parse/user.py
import json
import re
from lxml import etree
from db.models import User
from logger import crawler
def num_str_to_int(num_str):
if not num_str:
return 0
return int(num_str.replace(",", ""))
def get_detail(user_name, html):
... | code_fim | hard | {
"lang": "python",
"repo": "JingqiongWang/zhihuspider",
"path": "/page_parse/user.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_fans_or_follows(html, user_name):
res = json.loads(html)
user_names = list()
for item in res["data"]:
user_names.append(item.get("url_token"))
is_end = res["paging"]["is_end"]
return user_names, is_end<|fim_prefix|># repo: JingqiongWang/zhihuspider path: /page_parse/... | code_fim | hard | {
"lang": "python",
"repo": "JingqiongWang/zhihuspider",
"path": "/page_parse/user.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: graphcore/examples path: /gnn/ogb_lsc_pcqm4mv2/tensorflow2/argparser.py
ser.add_argument(
"--model.eigv_rand_sign_flip",
default=True,
type=bool,
help="Add random sign flipping to laplacian eigen vectors.",
)
parser.add_argument("--model.edge_prenorm", type... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/examples",
"path": "/gnn/ogb_lsc_pcqm4mv2/tensorflow2/argparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument("--model.use_noisy_nodes", default=False, type=bool, help="Use noisy nodes or not")
parser.add_argument("--model.noisy_nodes_weight", default=1.0, type=float, help="Weight of the noisy nodes loss")
parser.add_argument(
"--model.noisy_nodes_noise_prob", default=0.025... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/examples",
"path": "/gnn/ogb_lsc_pcqm4mv2/tensorflow2/argparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: graphcore/examples path: /gnn/ogb_lsc_pcqm4mv2/tensorflow2/argparser.py
"--model.noisy_node_model",
default="dense",
choices=["dense", "mlp"],
type=str,
help="Use a single dense layer for the noisy node decoder or a multi layer mlp.",
)
parser.add_ar... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/examples",
"path": "/gnn/ogb_lsc_pcqm4mv2/tensorflow2/argparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Split the targets into training/testing sets
dataY_train = dataY[:-numTest]
dataY_test = dataY[-numTest:]
# data training and get results
regr = linear_model.LinearRegression()
regr.fit(dataX_train, dataY_train)
dataY_pred = regr.predict(dataX_test)
print('Coefficients: \n', regr.coef_)
prin... | code_fim | hard | {
"lang": "python",
"repo": "rikumiura/pyCodes",
"path": "/mlPrediction/myMlPrediction_stat_old.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>numShow = 3
fig = plt.figure()
for i in range(numShow):
fIdx = sortedIdx[::-1][i]
ax = fig.add_subplot(1,numShow,i+1)
ax.scatter(dataX_test[:,fIdx], dataY_test, color="#222222", alpha=0.7)
dataIdx = np.argsort(dataX_test[:,fIdx])
x = dataX_test[:,fIdx][dataIdx]
y = dataY_pr... | code_fim | hard | {
"lang": "python",
"repo": "rikumiura/pyCodes",
"path": "/mlPrediction/myMlPrediction_stat_old.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rikumiura/pyCodes path: /mlPrediction/myMlPrediction_stat_old.py
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets, linear_model
from sklearn.metrics import mean_squared_error, r2_score
import glob
import os
import csv
def normData(dataX):
dataX_norm = ... | code_fim | hard | {
"lang": "python",
"repo": "rikumiura/pyCodes",
"path": "/mlPrediction/myMlPrediction_stat_old.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BackupTheBerlios/shekina-svn path: /parsing/examples/idlParse.py
#
# idlparse.py
#
# an example of using the parsing module to be able to process a subset of the CORBA IDL grammar
#
# Copyright (c) 2003, Paul McGuire
#
from pyparsing import Literal, CaselessLiteral, Word, Upcase, OneOrMo... | code_fim | hard | {
"lang": "python",
"repo": "BackupTheBerlios/shekina-svn",
"path": "/parsing/examples/idlParse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> interface QoSAdmin {
stringSeq method1( in string arg1, inout long arg2 );
stringSeqSeq method2( in string arg1, inout long arg2, inout long arg3);
string method3();
};
"""
)
test(
"""
/*
* a block comment *
*/
typedef string[10] ... | code_fim | hard | {
"lang": "python",
"repo": "BackupTheBerlios/shekina-svn",
"path": "/parsing/examples/idlParse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
df["date_compare"] = df["Date"] > datetime(year=2015, month=4, day=1)
df = df.sort_values(by = "Date", ascending = True)
print(df.head())<|fim_prefix|># repo: jennkuo25/Predict-Stock-Market path: /predict.py
import pandas as pd
import numpy as np
from datetime import datetime
<|fim_middle|>
df = pd.rea... | code_fim | medium | {
"lang": "python",
"repo": "jennkuo25/Predict-Stock-Market",
"path": "/predict.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jennkuo25/Predict-Stock-Market path: /predict.py
import pandas as pd
import numpy as np
from datetime import datetime
df = pd.read_csv("sphist.csv")
df["Date"] = pd.to_datetime(df["Date"]<|fim_suffix|>1)
df = df.sort_values(by = "Date", ascending = True)
print(df.head())<|fim_middle|>)
df["date_... | code_fim | medium | {
"lang": "python",
"repo": "jennkuo25/Predict-Stock-Market",
"path": "/predict.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tstanis/2018_advent_of_code path: /day_10.py
import sys
import math
points = []
with open('day_10.txt', 'r') as fp:
for line in fp:
line = line.strip()
parts = line.split("<")
x = int(parts[1].split(',')[0])
y = int(parts[1].split(',')[1].split('>')[0])
... | code_fim | hard | {
"lang": "python",
"repo": "tstanis/2018_advent_of_code",
"path": "/day_10.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def size_of_points(cur_points):
min_x, max_x, min_y, max_y = get_dim(cur_points)
return abs(max_x - min_x) + abs(max_y - min_y)
size_decreasing = True
last_size = math.inf
prev_points = None
seconds = 0
while size_decreasing:
seconds += 1
prev_points = cur_points
cur_points = move_poi... | code_fim | hard | {
"lang": "python",
"repo": "tstanis/2018_advent_of_code",
"path": "/day_10.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>utput_a)
print(output_b)
print(output_c)<|fim_prefix|># repo: ParkHanBin0820/Python path: /format06.py
output_a = "{:15.3f}".format(52.273)
output_b = "{:15.2f}".format(52.273)
outpu<|fim_middle|>t_c = "{:15.1f}".format(52.273)
print(o | code_fim | easy | {
"lang": "python",
"repo": "ParkHanBin0820/Python",
"path": "/format06.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t_c = "{:15.1f}".format(52.273)
print(output_a)
print(output_b)
print(output_c)<|fim_prefix|># repo: ParkHanBin0820/Python path: /format06.py
output_a = "{:15.3f}".format(52.273)
ou<|fim_middle|>tput_b = "{:15.2f}".format(52.273)
outpu | code_fim | easy | {
"lang": "python",
"repo": "ParkHanBin0820/Python",
"path": "/format06.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ParkHanBin0820/Python path: /format06.py
output_a = "{:15.3f}".format(52.273)
ou<|fim_suffix|>utput_a)
print(output_b)
print(output_c)<|fim_middle|>tput_b = "{:15.2f}".format(52.273)
output_c = "{:15.1f}".format(52.273)
print(o | code_fim | medium | {
"lang": "python",
"repo": "ParkHanBin0820/Python",
"path": "/format06.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: panscoding/leetcode path: /3.Sliding Window/maxSubarrayOfSizeK.py
"""
https://leetcode.com/problems/maximum-subarray/
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
Example 1:
<|fim_suffix|> 2. Time ... | code_fim | medium | {
"lang": "python",
"repo": "panscoding/leetcode",
"path": "/3.Sliding Window/maxSubarrayOfSizeK.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def findMaximumSubarrayBruteForce(self, k, nums):
window_max = 0
for i in range(len(nums)-k+1):
window_sum = 0
for j in range(i, i+k):
window_sum += nums[j]
window_max = max(window_sum, window_max)
return window_max
def main(... | code_fim | hard | {
"lang": "python",
"repo": "panscoding/leetcode",
"path": "/3.Sliding Window/maxSubarrayOfSizeK.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
window_start, window_sum, window_max= 0, 0, 0
for i in range(len(nums)):
window_sum += nums[i] #add the next element
# slide the window, we don't need to slide if we have not hit the required window size of K
if i >= k-1:
wind... | code_fim | medium | {
"lang": "python",
"repo": "panscoding/leetcode",
"path": "/3.Sliding Window/maxSubarrayOfSizeK.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'alphabet' in request.GET:
movies = sorted(movies, key=operator.attrgetter('title'))
sorted_bool = True
sorted_by = 'alphabetically by title'
if 'critic_score' in request.GET:
movies = sorted(movies, key=operator.attrgetter('critic_score'))
movies = movie... | code_fim | hard | {
"lang": "python",
"repo": "bjcahill/RottenPotatoes",
"path": "/movies/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bjcahill/RottenPotatoes path: /movies/views.py
from django.shortcuts import *
from django.http import *
from .models import *
from .forms import *
import operator
from django.template.defaultfilters import slugify
from users.models import Usermodel
from movies.models import Review2
def index(r... | code_fim | hard | {
"lang": "python",
"repo": "bjcahill/RottenPotatoes",
"path": "/movies/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if 'search' in request.GET:
search_term = request.GET['search']
movies = movies.filter(title__icontains=search_term)
searched = True
try:
usermodel = Usermodel.objects.get(user_id=request.user.id)
except:
usermodel = None
context = {
'movi... | code_fim | hard | {
"lang": "python",
"repo": "bjcahill/RottenPotatoes",
"path": "/movies/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sanket240/book-store-application path: /books/utils.py
from django.core.mail import EmailMessage
import logging
from user.models import User
from datetime import datetime, timedelta
from psycopg2 import OperationalError
from .models import Order
from rest_framework.exceptions import ValidationErr... | code_fim | hard | {
"lang": "python",
"repo": "sanket240/book-store-application",
"path": "/books/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @shared_task
def send_email(data):
email = EmailMessage(
subject=data['email_subject'], body=data['email_body'], to=[data['to_email']])
email.send()
@shared_task
def send_delivery_email(email):
try:
order = Order.objects.filter(is_delivered=... | code_fim | hard | {
"lang": "python",
"repo": "sanket240/book-store-application",
"path": "/books/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>== [])
print("Alle Tests für {} ok".format(sortfunction.__name__))<|fim_prefix|># repo: wwi20sea-mp/aufgaben path: /sortieren/test.py
def test_sortfunction(sortfunction):
assert(list(sortfunction([3,1,5,2,17,22,42,38])) == [1,2,3,5,17,22,38,42])
assert(list(sortfun<|fim_middle|>ction([1,2,3,4... | code_fim | medium | {
"lang": "python",
"repo": "wwi20sea-mp/aufgaben",
"path": "/sortieren/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wwi20sea-mp/aufgaben path: /sortieren/test.py
def test_sortfunction(sortfunction):
assert(list(sortfunction([3,<|fim_suffix|>== [])
print("Alle Tests für {} ok".format(sortfunction.__name__))<|fim_middle|>1,5,2,17,22,42,38])) == [1,2,3,5,17,22,38,42])
assert(list(sortfunction([1,2,3,4... | code_fim | medium | {
"lang": "python",
"repo": "wwi20sea-mp/aufgaben",
"path": "/sortieren/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: teragonaudio/Lucidity path: /source/lucidity/gui/windows.py
import pygame
import time
import lucidity
from lucidity.app.delegate import MainDelegate
from lucidity.core.arrangement import Sequence
from lucidity.gui.grid import MainGrid
from lucidity.gui.layout import PanelSizer
from lucidity.gui.s... | code_fim | hard | {
"lang": "python",
"repo": "teragonaudio/Lucidity",
"path": "/source/lucidity/gui/windows.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for container in self._containers:
container.onStopMidiMapping()
def getFramesPerSec(self):
totalTime = self.sequence.getTime() - self.sequence.clock.startTime
if totalTime > 0:
return self._framesProcessed / totalTime
else:
return 0... | code_fim | hard | {
"lang": "python",
"repo": "teragonaudio/Lucidity",
"path": "/source/lucidity/gui/windows.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # logger.debug("Up at " + str(eventDict['pos']))
clickPosition = eventDict['pos']
for container in self._containers:
if container.absRect.collidepoint(clickPosition[0], clickPosition[1]):
container.onMouseUp(clickPosition)
def onStartMidiMapping(sel... | code_fim | hard | {
"lang": "python",
"repo": "teragonaudio/Lucidity",
"path": "/source/lucidity/gui/windows.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomtheweber/quantumcomputing path: /my_custom/gate_wrapper.py
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 19:08:35 2020
@author: Hando
"""
from typing import Optional, List, Callable, Union, Dict
from qiskit import QuantumCircuit
from qiskit.aqua import AquaError
from qiskit.circuit.librar... | code_fim | hard | {
"lang": "python",
"repo": "tomtheweber/quantumcomputing",
"path": "/my_custom/gate_wrapper.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for gate in gates:
for inst, qargs, cargs in self.circuit.data:
wrapped_qc.append(inst, qargs, cargs)
if inst.name in ("barrier", "measure"):
continue
els... | code_fim | hard | {
"lang": "python",
"repo": "tomtheweber/quantumcomputing",
"path": "/my_custom/gate_wrapper.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> transformers.utils.logging.set_verbosity_info()
transformers.utils.logging.enable_default_handler()
transformers.utils.logging.enable_explicit_format()
logger.info("Loading models with following conf %s",
{k: v for k, v in conf.items() if k != 'raw_yaml'})
tokenizer =... | code_fim | hard | {
"lang": "python",
"repo": "shivamkrsharma44/contract-nli-bert",
"path": "/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shivamkrsharma44/contract-nli-bert path: /test.py
# Copyright (c) 2021, Hitachi America Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "shivamkrsharma44/contract-nli-bert",
"path": "/test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif guess < random_number:
print("your guess is too low ")
print(f"yay! you have a correct guess {guess}")
guess(10)<|fim_prefix|># repo: shubhampatil871/python_practice path: /Number_guessing_game.py
import random
def guess(x):
# generates a random number which ... | code_fim | medium | {
"lang": "python",
"repo": "shubhampatil871/python_practice",
"path": "/Number_guessing_game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shubhampatil871/python_practice path: /Number_guessing_game.py
import random
def guess(x):
# generates a random number which will be stored in variable random_number
random_number = random.randin<|fim_suffix|> elif guess < random_number:
print("your guess is too l... | code_fim | hard | {
"lang": "python",
"repo": "shubhampatil871/python_practice",
"path": "/Number_guessing_game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KqSMea8/PycharmProjects path: /leetcode/venv/lib/python2.7/site-packages/pyutil/rt_counter/rt_counter_client.py
#!/usr/bin/env python
# coding:utf-8
import logging
from thrift.transport import TSocket, TTransport
from thrift.protocol import TBinaryProtocol
from pyutil.thrift.transport import Sma... | code_fim | hard | {
"lang": "python",
"repo": "KqSMea8/PycharmProjects",
"path": "/leetcode/venv/lib/python2.7/site-packages/pyutil/rt_counter/rt_counter_client.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> write_req = WriteRequest()
write_req.counters = counters
write_req.Base = Base(Caller=self.caller, Addr=get_local_ip())
return write_req
def _call_write(self, counters, func):
try:
req = self._build_write_req(counters)
resp = self._call(f... | code_fim | hard | {
"lang": "python",
"repo": "KqSMea8/PycharmProjects",
"path": "/leetcode/venv/lib/python2.7/site-packages/pyutil/rt_counter/rt_counter_client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Blue-Pix/euler path: /src/1-9/problem_3.py
# -*- coding: utf-8 -*-
''' Problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
<|fim_suffix|>600851475143の最大素因数を求める
'''
if __name__ == '__main__':
divisor = 3
target = 600851475143
while divisor < target:
quotient, remainde... | code_fim | medium | {
"lang": "python",
"repo": "Blue-Pix/euler",
"path": "/src/1-9/problem_3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
divisor = 3
target = 600851475143
while divisor < target:
quotient, remainder = divmod(target, divisor)
if remainder == 0:
print('%d can be divided by %d' % (target, divisor))
target = quotient
else:
divisor... | code_fim | medium | {
"lang": "python",
"repo": "Blue-Pix/euler",
"path": "/src/1-9/problem_3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "tq",
"USER": "tq",
"PASSWORD": "tq",
"HOST": "",
"PORT": "",
},
}<|fim_prefix|># repo: Gaurav1990/TQuora path: /tq/tq/settings/test.py
from base import *
########## TEST SETT... | code_fim | medium | {
"lang": "python",
"repo": "Gaurav1990/TQuora",
"path": "/tq/tq/settings/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gaurav1990/TQuora path: /tq/tq/settings/test.py
from base import *
########## TEST SETTINGS
<|fim_suffix|>DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "tq",
"USER": "tq",
"PASSWORD": "tq",
"HOST": "",
"PORT": "",
... | code_fim | medium | {
"lang": "python",
"repo": "Gaurav1990/TQuora",
"path": "/tq/tq/settings/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.