text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: vaindante/sylogent path: /logger.py
import json
import logging
import os
import sys
from io import StringIO
import pytest
from allure.constants import AttachmentType
from utils.tools import close_popups
_beautiful_json = dict(indent=2, ensure_ascii=False, sort_keys=True)
# LOGGING console ###... | code_fim | hard | {
"lang": "python",
"repo": "vaindante/sylogent",
"path": "/logger.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def attach_png(name, message):
pytest.allure.attach(name, message, type=AttachmentType.PNG)
def attach_selenium_screenshot(self, attach_name, selenium_driver):
if selenium_driver:
try:
close_popups(selenium_driver)
self... | code_fim | hard | {
"lang": "python",
"repo": "vaindante/sylogent",
"path": "/logger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> file_handler = logging.FileHandler(filename=file_name, mode=mode)
file_handler.setFormatter(log_formatter)
file_handler.setLevel(os.getenv('LOGGING_LEVEL_TO_CONSOLE', 'WARN'))
self.addHandler(file_handler)
def setup_logging():
# Logging setup
logger = CustomLogger... | code_fim | hard | {
"lang": "python",
"repo": "vaindante/sylogent",
"path": "/logger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pvij/back-propagation-algo-implementation path: /ffnn_backprop_stochastic_gradient.py
import time
import numpy as np
import matplotlib.pyplot as plt
class stochasticGradient :
def __init__( self , kwargs ) :
self.inputVectors = kwargs["inputVectors"]
self... | code_fim | hard | {
"lang": "python",
"repo": "pvij/back-propagation-algo-implementation",
"path": "/ffnn_backprop_stochastic_gradient.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># CREATING LINEARLY SEPARABLE DATA
def runForLinearlySeparableData() :
args = {}
noOfDataPts = 80
shuffledIndices = np.random.permutation( noOfDataPts )
args["inputVectors"] = (np.concatenate((np.random.normal(loc=10, size=[40, 2]), np.random.normal(loc=20, size=[40, 2]... | code_fim | hard | {
"lang": "python",
"repo": "pvij/back-propagation-algo-implementation",
"path": "/ffnn_backprop_stochastic_gradient.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vivianna1/learning path: /translation.py
import urllib.request
import urllib.parse
import json
content = input("请输入需要翻译的内容:")
<|fim_suffix|>data = {}
data['action'] = 'FY_BY_CLICKBUTTION'
data['bv'] = '1ca13a5465c2ab126e616ee8d6720cc3'
data['client'] = 'fanyideskweb'
data['doctype'] = 'json'
da... | code_fim | medium | {
"lang": "python",
"repo": "vivianna1/learning",
"path": "/translation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>target = json.loads(html)
print("翻译结果:%s" % (target['translateResult'][0][0]['tgt']))<|fim_prefix|># repo: vivianna1/learning path: /translation.py
import urllib.request
import urllib.parse
import json
content = input("请输入需要翻译的内容:")
url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=... | code_fim | medium | {
"lang": "python",
"repo": "vivianna1/learning",
"path": "/translation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>response = urllib.request.urlopen(url,data)
html = response.read().decode('utf-8')
target = json.loads(html)
print("翻译结果:%s" % (target['translateResult'][0][0]['tgt']))<|fim_prefix|># repo: vivianna1/learning path: /translation.py
import urllib.request
import urllib.parse
import json
content = input("请... | code_fim | hard | {
"lang": "python",
"repo": "vivianna1/learning",
"path": "/translation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return df
def remove_invalid_rows_df(df : pd.DataFrame):
return df[df['name'].apply(lambda x: set(x).issubset(ALLOWED_CHARS))]
df = pd.DataFrame(columns=['count', 'name'])
f = open("fbnames.txt", "r")
count = 0
save_every = 2000
for line in f:
count += 1
split = line.split()
df = d... | code_fim | hard | {
"lang": "python",
"repo": "DexiongYung/Data-Script",
"path": "/DataUtils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for file in files:
f = open(f"namesbystate\{file}", "r")
count = 0
for line in f:
count += 1
split = line.split(",")
df = df.append({"count":int(split[4]),"name":split[3]}, ignore_index=True)
if save_every % count == 0:
df = df.groupby(['name']).sum(... | code_fim | hard | {
"lang": "python",
"repo": "DexiongYung/Data-Script",
"path": "/DataUtils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DexiongYung/Data-Script path: /DataUtils.py
import pandas as pd
import glob
import string
import os
ALLOWED_CHARS = string.ascii_letters + "-,. \"()'"
def concat_all_data(path : str = 'Data/*.csv', save_path : str = 'Data/final.csv'):
csvs = glob.glob(path)
li = []
for csv in cs... | code_fim | medium | {
"lang": "python",
"repo": "DexiongYung/Data-Script",
"path": "/DataUtils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlJohri/nusocialgraph path: /find_usernames.py
from models import Session, FacebookUser, FacebookPage, FacebookGroup
from lib import get_scraper, save_user, save_page
<|fim_suffix|>for user in session.query(FacebookUser).filter(FacebookUser.data=="todo").filter("username ~ '^\d+$'").all():
user... | code_fim | medium | {
"lang": "python",
"repo": "AlJohri/nusocialgraph",
"path": "/find_usernames.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for user in session.query(FacebookUser).filter(FacebookUser.data=="todo").filter("username ~ '^\d+$'").all():
user.username = scraper.get_username_api(str(user.uid)) or str(user.uid)
print user.uid, user.username
session.commit()<|fim_prefix|># repo: AlJohri/nusocialgraph path: /find_usernames.py
from... | code_fim | medium | {
"lang": "python",
"repo": "AlJohri/nusocialgraph",
"path": "/find_usernames.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if os.path.isdir(resource_fs_path):
# Process the request as a directory.
# ===================================
if not resource_uri_path.endswith('/'):
# redirect directory requests to trailing slash
new_location = '%s/' % resource_uri_path
... | code_fim | hard | {
"lang": "python",
"repo": "chadwhitacre/public",
"path": "/httpy/tags/0.4/site-packages/httpy/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self): pass
def write(self,*outputs): pass
def writeln(self,*outputs): pass
def __call__(self,*outputs): pass
def dump(self): pass
def pdump(self): pass
class outputer:
"""
This is an initial implementation of an outputer class that acts
like print but add... | code_fim | hard | {
"lang": "python",
"repo": "chadwhitacre/public",
"path": "/httpy/tags/0.4/site-packages/httpy/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chadwhitacre/public path: /httpy/tags/0.4/site-packages/httpy/utils.py
"""This is a collection of utilities for httpy and httpy applications.
"""
import cgi
import linecache
import mimetypes
import os
import stat
import sys
from Cookie import SimpleCookie
from StringIO import StringIO
from urlli... | code_fim | hard | {
"lang": "python",
"repo": "chadwhitacre/public",
"path": "/httpy/tags/0.4/site-packages/httpy/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>py.figure(1)
py.plot(t, T_o, 'o', mec='b', mew=2, mfc='none', markevery=5, label='Ts_ana')
py.plot(t, T_r, 's', mec='g', mew=2, mfc='none', markevery=5, label='Tc_ana')
py.plot(t, T[:, -1], 'r-', lw=2, label='Ts_num')
py.plot(t, T[:, 0], 'b-', lw=2, label='Tc_num')
py.axhline(Tinf, c='k', ls='--')
py.ylim... | code_fim | hard | {
"lang": "python",
"repo": "wigging/low-order-particle",
"path": "/sphere-ana-num.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rho = Gb*1000 # density, kg/m^3
alpha = k/(rho*cp) # thermal diffusivity biomass, m^2/s
Bi = (h*ro)/k # Biot number, (-)
Fo = (alpha * t) / (ro**2) # Fourier number, (-)
# surface temperature where ro for outer surface, b=2 for sphere
... | code_fim | hard | {
"lang": "python",
"repo": "wigging/low-order-particle",
"path": "/sphere-ana-num.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wigging/low-order-particle path: /sphere-ana-num.py
"""
Compare 1-D analytical sphere solution to 1-D numerical and 3-D Comsol solutions
for transient heat conduction in solid sphere with constant k and Cp.
Assumptions:
Convection boundary condition at surface.
Symmetry about the center of the s... | code_fim | hard | {
"lang": "python",
"repo": "wigging/low-order-particle",
"path": "/sphere-ana-num.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cluster[new_cluster] = (min_i,min_j)
cluster_num[new_cluster] = 0
cluster_elements = 2
if min_i in cluster_num.keys():
cluster_num[new_cluster] += cluster_num[min_i]
cluster_elements -= 1
if min_j in cluster_num.keys():
cluster_num[new_cluster] += cluster_num[min_j]
cluster... | code_fim | hard | {
"lang": "python",
"repo": "CorneCorne/UPGMA",
"path": "/UPGMA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CorneCorne/UPGMA path: /UPGMA.py
# coding: UTF-8
from PIL import ImageFont,Image,ImageDraw
def min_element(table_d,ignoring_index = None):
min_i,min_j,min_e = 0,0,max(table_d.values())
for key in table_d.keys():
# ignore if i in key or j in key
if ignoring_index is not None:
... | code_fim | hard | {
"lang": "python",
"repo": "CorneCorne/UPGMA",
"path": "/UPGMA.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#原数据由于尺寸不一,多数是高清图片,训练时resize会很耗时,因此先resize到一个小尺寸保存起来。
# Image.thumbnail()可以起到过滤的作用,如果hw在范围内就不会resize,超过就会按比例放缩。
#处理前数据集大小为114G,处理后为86G。在 Tesla V100 32GB*2 硬件环境下,训练Baseline,处理前训练时间一个epoch约为2400s(40min),
# 处理后一个epoch约1400s(23min),极大缩小了训练时间,精度应该没有什么影响,调小判别尺寸应该还能更快,毕竟训练数据尺寸是224x224。<|fim_prefix|># repo: ghj-... | code_fim | hard | {
"lang": "python",
"repo": "ghj-hey/ACCV-2020-WebFG-solution",
"path": "/data/Pre_data.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ghj-hey/ACCV-2020-WebFG-solution path: /data/Pre_data.py
import os
from PIL import Image
import cv2
import shutil
root = './train'
save_path = './thumbnail'
for r, d, files in os.walk(root):
if files != []:
for i in files:
fp = os.path.join(r, i)
label = i.spl... | code_fim | hard | {
"lang": "python",
"repo": "ghj-hey/ACCV-2020-WebFG-solution",
"path": "/data/Pre_data.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if title_content is None:
continue
title_anchor = title_content.find('a')
title_link = title_anchor.get("href")
title = title_anchor.string
date = row.find('td', {"class": "table_data table_data_date"})
sponsor = row.find('td', {"class": "table... | code_fim | medium | {
"lang": "python",
"repo": "gromande/sans-webcast-links",
"path": "/generate.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gromande/sans-webcast-links path: /generate.py
from urllib.request import urlopen
from bs4 import BeautifulSoup
import json
def get_webcasts(year):
url = "https://www.sans.org/webcasts/archive/" + str(year)
page = urlopen(url)
soup = BeautifulSoup(page, 'html.parser')
table = sou... | code_fim | hard | {
"lang": "python",
"repo": "gromande/sans-webcast-links",
"path": "/generate.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> date = row.find('td', {"class": "table_data table_data_date"})
sponsor = row.find('td', {"class": "table_data table_data_sponsor"})
speaker = row.find('td', {"class": "table_data table_data_speaker"})
webcast = {"title": title, "date": date.string, "sponsor": sponsor.strin... | code_fim | hard | {
"lang": "python",
"repo": "gromande/sans-webcast-links",
"path": "/generate.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kmunve/varsomdata path: /varsomdata/setvariables.py
#! /usr/bin/python
# -*- coding: utf-8<|fim_suffix|>9f0-30bd-495b-a54c-bf5addc81a8a'
app = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'<|fim_middle|> -*-
__author__ = 'raek'
web = '910d5 | code_fim | easy | {
"lang": "python",
"repo": "kmunve/varsomdata",
"path": "/varsomdata/setvariables.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kmunve/varsomdata path: /varsomdata/setvariables.py
#! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'raek'
web = '910d5<|fim_suffix|> '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'<|fim_middle|>9f0-30bd-495b-a54c-bf5addc81a8a'
app = | code_fim | easy | {
"lang": "python",
"repo": "kmunve/varsomdata",
"path": "/varsomdata/setvariables.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'<|fim_prefix|># repo: kmunve/varsomdata path: /varsomdata/setvariables.py
#! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'raek'
web = '910d5<|fim_middle|>9f0-30bd-495b-a54c-bf5addc81a8a'
app = | code_fim | easy | {
"lang": "python",
"repo": "kmunve/varsomdata",
"path": "/varsomdata/setvariables.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 更新
c += 1
prev_acc_cnt += t
prev_acc_cnt %= MOD
rest += t
rest %= MOD
# print(i, t, prev_acc_cnt, factr)
total = fact[M] * fact_inv[M - N]
total %= MOD
ans = total * (total - rest)
ans %= MOD
print(ans)<|fim_prefix|># repo: shikixyx/AtCoder path: /ABC/172/172_E.py
impor... | code_fim | hard | {
"lang": "python",
"repo": "shikixyx/AtCoder",
"path": "/ABC/172/172_E.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shikixyx/AtCoder path: /ABC/172/172_E.py
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, M = map(int, input().split())
<|fim_suffix|> # 入れ替える
factr *= c
factr %... | code_fim | hard | {
"lang": "python",
"repo": "shikixyx/AtCoder",
"path": "/ABC/172/172_E.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lociblack/dwifh_csv_VC path: /dwifh_sales.py
import csv
from matplotlib import pyplot as plt
from datetime import datetime
file_one = 'data/dwifh_all_sales.csv'
file_two = 'data/dwifh_bc_sales.csv'
# create code to automatically build a dictionary for each album?
with open(file_one) as fo:
... | code_fim | medium | {
"lang": "python",
"repo": "lociblack/dwifh_csv_VC",
"path": "/dwifh_sales.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.style.use('seaborn')
fig, ax = plt.subplots()
ax.plot(album['period of sales'], album['dd_income_data'], c='red')
ax.plot(album['period of sales'], album['cd_income_data'], c = 'blue')
plt.title('{} Sales - All Time'.format(album['title']))
plt.xlabel('', fontsize=16)
fig.autofmt_xdate()
plt.ylabel('... | code_fim | hard | {
"lang": "python",
"repo": "lociblack/dwifh_csv_VC",
"path": "/dwifh_sales.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vidtsin/extra-addons-v9 path: /management/models/priority_customer.py
from openerp import models, fields, api, _
<|fim_suffix|> is_priority = fields.Boolean("Is Priority Partner:?")
registration_date = fields.Date("Registration Date:")
liability_card_number = fields.Char("Liability Ca... | code_fim | medium | {
"lang": "python",
"repo": "vidtsin/extra-addons-v9",
"path": "/management/models/priority_customer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_inherit = 'res.partner'
is_priority = fields.Boolean("Is Priority Partner:?")
registration_date = fields.Date("Registration Date:")
liability_card_number = fields.Char("Liability Card Number:")<|fim_prefix|># repo: vidtsin/extra-addons-v9 path: /management/models/priority_customer.py
f... | code_fim | easy | {
"lang": "python",
"repo": "vidtsin/extra-addons-v9",
"path": "/management/models/priority_customer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Osedro/MC920-Processamento-de-imagens path: /Trabalho-2/jarvis_judice_ninke.py
import cv2 as cv
import numpy as np
import sys
from meio_tom_lib import *
imgname = sys.argv[1]
imgpath = "img/" + imgname
<|fim_suffix|> print("")
cv.imwrite('resultados/jarvis_judice_ninke/jarvis_judice_ni... | code_fim | hard | {
"lang": "python",
"repo": "Osedro/MC920-Processamento-de-imagens",
"path": "/Trabalho-2/jarvis_judice_ninke.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> cv.imwrite('resultados/jarvis_judice_ninke/jarvis_judice_ninke_1-'+imgname,newimg1)
cv.imwrite('resultados/jarvis_judice_ninke/jarvis_judice_ninke_2-'+imgname,newimg2)
print("Resultados salvos em:")
print('resultados/jarvis_judice_ninke/jarvis_judice_ninke_1-'+imgname)
print('resultad... | code_fim | medium | {
"lang": "python",
"repo": "Osedro/MC920-Processamento-de-imagens",
"path": "/Trabalho-2/jarvis_judice_ninke.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> newimg1 = jarvis_judice_ninke_1(img)*255
newimg2 = jarvis_judice_ninke_2(img)*255
cv.imshow("Imagem original",img)
cv.imshow("Jarvis, Judice e Ninke metodo 1",newimg1)
cv.imshow("Jarvis, Judice e Ninke metodo 2",newimg2)
print("")
cv.imwrite('resultados/jarvis_judice_ninke/j... | code_fim | medium | {
"lang": "python",
"repo": "Osedro/MC920-Processamento-de-imagens",
"path": "/Trabalho-2/jarvis_judice_ninke.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ls.OneToOneField(related_name='is_branch_officer_of', default=None, to='auth.Group'),
preserve_default=False,
),
migrations.AddField(
model_name='c4cjob',
name='offer',
field=models.BooleanField(default=False),
preserve_default=Tr... | code_fim | hard | {
"lang": "python",
"repo": "madetaille/care4care",
"path": "/c4c_app/migrations/0007_auto_20141127_0941.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: madetaille/care4care path: /c4c_app/migrations/0007_auto_20141127_0941.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('c4c_app', ... | code_fim | hard | {
"lang": "python",
"repo": "madetaille/care4care",
"path": "/c4c_app/migrations/0007_auto_20141127_0941.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>verbose_name_plural': 'C4C Users'},
),
migrations.RemoveField(
model_name='c4cbranch',
name='officers',
),
migrations.AddField(
model_name='c4cbranch',
name='group',
field=models.OneToOneField(related_name='in_bran... | code_fim | hard | {
"lang": "python",
"repo": "madetaille/care4care",
"path": "/c4c_app/migrations/0007_auto_20141127_0941.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cfaessler/python_st7565_driver path: /test/test_display.py
import unittest
from display import Display
class TestDisplay(unittest.TestCase):
<|fim_suffix|> def test_set_pixels(self):
self.display.clear_buffer()
self.display.set_pixel(0, 1, 1)
self.assertEqual(self.dis... | code_fim | medium | {
"lang": "python",
"repo": "cfaessler/python_st7565_driver",
"path": "/test/test_display.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.display.set_pixel(3, 2, 0)
self.assertEqual(self.display.get_pixel(3, 2), 0, "pixel was not set")<|fim_prefix|># repo: cfaessler/python_st7565_driver path: /test/test_display.py
import unittest
from display import Display
class TestDisplay(unittest.TestCase):
def setUp(self):
... | code_fim | hard | {
"lang": "python",
"repo": "cfaessler/python_st7565_driver",
"path": "/test/test_display.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhoi/absa-tests path: /abhoi/lstm.py
s import itemfreq
from sklearn.model_selection import StratifiedKFold
from keras_utils.keras_utils import *
from keras.utils.np_utils import to_categorical
from keras.layers import Input, Embedding, Dense, GlobalAveragePooling1D, Flatten
from keras.l... | code_fim | hard | {
"lang": "python",
"repo": "abhoi/absa-tests",
"path": "/abhoi/lstm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> In this case, an aspect sentence would be of the form :
[0 0 ... 32506 66049 5968 0 0 ...]
Here 32506 = "Apple", 66049 = "Macbook" 5968 = "Pro" (say)
"""
NUM_CLASSES = 3 # 0 = neg, 1 = neutral, 2 = pos
MAX_SENTENCE_LENGTH = 60
MAX_NUM_WORDS = 20000 # thi... | code_fim | hard | {
"lang": "python",
"repo": "abhoi/absa-tests",
"path": "/abhoi/lstm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhoi/absa-tests path: /abhoi/lstm.py
ort itemfreq
from sklearn.model_selection import StratifiedKFold
from keras_utils.keras_utils import *
from keras.utils.np_utils import to_categorical
from keras.layers import Input, Embedding, Dense, GlobalAveragePooling1D, Flatten
from keras.layers... | code_fim | hard | {
"lang": "python",
"repo": "abhoi/absa-tests",
"path": "/abhoi/lstm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DavidBasarab/CrowPi path: /Learning.py
#!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
ledPin = 4
pinOn = False
<|fim_suffix|>
while True:
print_pin_status(ledPin)
key = input("Action, press q to quit: ")
print(key)
if key == ' ':
print("space pushe... | code_fim | hard | {
"lang": "python",
"repo": "DavidBasarab/CrowPi",
"path": "/Learning.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if pinOn:
print("turning led off")
GPIO.output(ledPin, GPIO.LOW)
pinOn = False
else:
print("turning led on")
GPIO.output(ledPin, GPIO.HIGH)
pinOn = True
if key == 'q':
print("Quiting. . .")
break<|... | code_fim | medium | {
"lang": "python",
"repo": "DavidBasarab/CrowPi",
"path": "/Learning.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> full = datetime(2007, 1, 15, 3, 4, 5, 123456)
rounded = datetime(2007, 1, 15, 3, 4, 5, 123000)
cursor.execute("create table t1(dt datetime)")
cursor.execute("insert into t1 values (?)", full)
result = cursor.execute("select dt from t1").fetchone()[0]
assert isinstance(result, ... | code_fim | hard | {
"lang": "python",
"repo": "gordthompson/pyodbc",
"path": "/tests/sqlserver_test.py",
"mode": "spm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gordthompson/pyodbc path: /tests/sqlserver_test.py
t)
def test_no_fetch(cursor: pyodbc.Cursor):
# Issue 89 with FreeTDS: Multiple selects (or catalog functions that issue selects) without
# fetches seem to confuse the driver.
cursor.execute('select 1')
cursor.execute('select 1')... | code_fim | hard | {
"lang": "python",
"repo": "gordthompson/pyodbc",
"path": "/tests/sqlserver_test.py",
"mode": "psm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gordthompson/pyodbc path: /tests/sqlserver_test.py
ursor.execute("drop procedure pyodbctest")
cursor.commit()
except:
pass
cursor.execute("create table t1(s varchar(10))")
cursor.execute("insert into t1 values(?)", "testing")
cursor.execute("""
... | code_fim | hard | {
"lang": "python",
"repo": "gordthompson/pyodbc",
"path": "/tests/sqlserver_test.py",
"mode": "psm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wanglc1992/baixue path: /pythonProject3.7/pythonProject3.7/TestCase/Test_GetQualificationInfo.py
import requests
import unittest
import time
from common import HTMLTestReport
class Get(unittest.TestCase):
TMPTOKEN = ''
TOKEN = ''
def setUp(self):
pass
# 获取临时token,opterT... | code_fim | medium | {
"lang": "python",
"repo": "wanglc1992/baixue",
"path": "/pythonProject3.7/pythonProject3.7/TestCase/Test_GetQualificationInfo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = 'https://jdapi.jd100.com/coursemgr/v1/getQualificationInfo'
para = {'opterToken': Get.TOKEN}
r = requests.get(url=url, params=para)
assert r.json()['data'][2]['teacher_name'] == '测试勿扰老师'
assert r.json()['data'][2]['certificate_url'] == 'https://jdspace.jd100.c... | code_fim | hard | {
"lang": "python",
"repo": "wanglc1992/baixue",
"path": "/pythonProject3.7/pythonProject3.7/TestCase/Test_GetQualificationInfo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tecnica-de-programacion/testing path: /main.py
class Formater():
def clean_number (posible_number):
sanitize_number = posible_number.replace(' ', '')
number_of_dots = sanitize_number.count('.')
if number_of_dots > 1:
return None
<|fim_suffix|>anitize_numb... | code_fim | hard | {
"lang": "python",
"repo": "tecnica-de-programacion/testing",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>return None
if number_of_dots == 0:
sanitize_number = sanitize_number.replace(',', '')
try:
return int(sanitize_number)
except Exception:
return None<|fim_prefix|># repo: tecnica-de-programacion/testing path: /main.py
class Forma... | code_fim | hard | {
"lang": "python",
"repo": "tecnica-de-programacion/testing",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>anitize_number.replace(',', '')
else:
return None
finally:
try:
return float(sanitize_number)
except Exception:
return None
if number_of_dots == 0:
sanitize_number = sanitize... | code_fim | hard | {
"lang": "python",
"repo": "tecnica-de-programacion/testing",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> or (subject=='电子信息工程' and college=='是') or (age<28 and subject=='计算机'):
print('恭喜您被录取!')
else:
print('抱歉,您未达到面试要求')<|fim_prefix|># repo: Dongtengwen/7-15-practice path: /28.py
age=int(input('请输入您的年龄:'))
subject=input('请输入您的专业:')
college=i<|fim_middle|>nput('请输入您是否毕业于重点大学:(是/不是)')
if (subject=='电... | code_fim | medium | {
"lang": "python",
"repo": "Dongtengwen/7-15-practice",
"path": "/28.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dongtengwen/7-15-practice path: /28.py
age=int(input('请输入您的年龄:'))
subject=input('请输入您的专业:')
college=i<|fim_suffix|>t=='计算机'):
print('恭喜您被录取!')
else:
print('抱歉,您未达到面试要求')<|fim_middle|>nput('请输入您是否毕业于重点大学:(是/不是)')
if (subject=='电子信息工程' and age>25) or (subject=='电子信息工程' and college=='是') or ... | code_fim | medium | {
"lang": "python",
"repo": "Dongtengwen/7-15-practice",
"path": "/28.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JimLynx/fundpin path: /projects/migrations/0005_auto_20210422_0846.py
# Generated by Django 3.1.6 on 2021-04-22 07:46
<|fim_suffix|> dependencies = [
('projects', '0004_project_is_featured'),
]
operations = [
migrations.AlterField(
model_name='project',
... | code_fim | medium | {
"lang": "python",
"repo": "JimLynx/fundpin",
"path": "/projects/migrations/0005_auto_20210422_0846.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('projects', '0004_project_is_featured'),
]
operations = [
migrations.AlterField(
model_name='project',
name='pin_id',
field=models.CharField(max_length=20, null=True, unique=True),
),
]<|fim_prefix|># repo: Jim... | code_fim | medium | {
"lang": "python",
"repo": "JimLynx/fundpin",
"path": "/projects/migrations/0005_auto_20210422_0846.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: runtheops/terrestrial path: /terrestrial/api/common.py
import logging
import terrestrial.config as config
logger = logging.getLogger(f'{__name__}.common')
def health():
return 'OK', 200
<|fim_suffix|> """
Verifies Token from Authorization header
"""
if config.API_TOKEN is ... | code_fim | easy | {
"lang": "python",
"repo": "runtheops/terrestrial",
"path": "/terrestrial/api/common.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def verify_token(token):
"""
Verifies Token from Authorization header
"""
if config.API_TOKEN is None:
logger.error(
'API token is not configured, auth will fail!')
return token == config.API_TOKEN<|fim_prefix|># repo: runtheops/terrestrial path: /terrestrial/api/c... | code_fim | medium | {
"lang": "python",
"repo": "runtheops/terrestrial",
"path": "/terrestrial/api/common.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yinflight/-V path: /自适应巡航V1.0/local_planner/scripts/Obstacle_avoidance_plannner/path_planning.py
r.msg import Motor_Feedback
from GNSS_driver.msg import GNSS_CAN
import sys
# 参数
MAX_SPEED = 30.0 # 最大速度 [m/s]
MAX_ACCEL = 50.0 # 最大加速度 [m/ss]
MAX_CURVATURE = 30.0 # 最大曲率 [1/m]
MAX_ROAD_WIDTH = 1... | code_fim | hard | {
"lang": "python",
"repo": "yinflight/-V",
"path": "/自适应巡航V1.0/local_planner/scripts/Obstacle_avoidance_plannner/path_planning.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def FeedbackCallbackGPSIMU(self, msg):
self.CurrGPS_lat = msg.latitude
self.CurrGPS_lon = msg.longitude
self.ImuYaw = (90-msg.course_angle)*np.pi/180
#print(self.CurrGPS_lat,self.CurrGPS_lon,self.ImuYaw)
def FeedbackCallbackObs(self, msg):
glob... | code_fim | hard | {
"lang": "python",
"repo": "yinflight/-V",
"path": "/自适应巡航V1.0/local_planner/scripts/Obstacle_avoidance_plannner/path_planning.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stangelandcl/hardhat path: /hardhat/recipes/c_ares.py
from .base import GnuRecipe
class CAresRecipe(GnuRecipe):
<|fim_suffix|> super(CAresRecipe, self).__init__(*args, **kwargs)
self.sha256 = '45d3c1fd29263ceec2afc8ff9cd06d5f' \
'8f889636eb4e80ce3cc7f0eaf7aa... | code_fim | easy | {
"lang": "python",
"repo": "stangelandcl/hardhat",
"path": "/hardhat/recipes/c_ares.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(CAresRecipe, self).__init__(*args, **kwargs)
self.sha256 = '45d3c1fd29263ceec2afc8ff9cd06d5f' \
'8f889636eb4e80ce3cc7f0eaf7aadc6e'
self.name = 'c-ares'
self.version = '1.14.0'
self.url = 'https://c-ares.haxx.se/download/$name-$version.tar... | code_fim | easy | {
"lang": "python",
"repo": "stangelandcl/hardhat",
"path": "/hardhat/recipes/c_ares.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> horizontalCuts.sort()
verticalCuts.sort()
horizontalCuts.append(h)
verticalCuts.append(w)
hbreadth= 0
prev=0
for h in horizontalCuts:
height= h-prev
hbreadth= max(height, hbreadth)
prev= h
prev=0
v... | code_fim | medium | {
"lang": "python",
"repo": "Shivani161992/Leetcode_Practise",
"path": "/Matrices/MaximumAreaPieceOfCake.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shivani161992/Leetcode_Practise path: /Matrices/MaximumAreaPieceOfCake.py
from typing import List
h = 5
w = 4
horizontalCuts = [3]
verticalCuts = [3]
class Solution:
<|fim_suffix|> horizontalCuts.sort()
verticalCuts.sort()
horizontalCuts.append(h)
verticalCuts.appen... | code_fim | medium | {
"lang": "python",
"repo": "Shivani161992/Leetcode_Practise",
"path": "/Matrices/MaximumAreaPieceOfCake.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rk19016/LeetCode_Py path: /easy/883projectionArea.py
class Solution:
def projectionArea(self, grid):
"""
:type grid: <|fim_suffix|> res+=1
for k in zip(*grid):
res+=max(k)
return res<|fim_middle|>List[List[int]]
:rtype: int
"""... | code_fim | hard | {
"lang": "python",
"repo": "rk19016/LeetCode_Py",
"path": "/easy/883projectionArea.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
res+=max(i)
for j in i:
if j:
res+=1
for k in zip(*grid):
res+=max(k)
return res<|fim_prefix|># repo: rk19016/LeetCode_Py path: /easy/883projectionArea.py
class Solution:
def projectionArea(self, grid):
"... | code_fim | hard | {
"lang": "python",
"repo": "rk19016/LeetCode_Py",
"path": "/easy/883projectionArea.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plugins = {
"physical_line": [check_is_with_singleton],
"logical_line": [],
"ast": []
}<|fim_prefix|># repo: bewils/Dinodon path: /dinodon-plugin.py
import re
IS_WITH_SINGLETON_REGEX = re.compile("(!=|==)\s*(True|False|None)")
def check_is_with_singleton(physical_line, line_number):
mat... | code_fim | medium | {
"lang": "python",
"repo": "bewils/Dinodon",
"path": "/dinodon-plugin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bewils/Dinodon path: /dinodon-plugin.py
import re
IS_WITH_SINGLETON_REGEX = re.compile("(!=|==)\s*(True|False|None)")
def check_is_with_singleton(physical_line, line_number):
<|fim_suffix|>plugins = {
"physical_line": [check_is_with_singleton],
"logical_line": [],
"ast": []
}<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "bewils/Dinodon",
"path": "/dinodon-plugin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = np.asmatrix(self.data[0])
if self.option == 2:
self.data[:, 2] = np.log(data[:, 2])
self.data[:, 3] = np.log(data[:, 3])
elif self.option == 3:
for j in range(self.data.shape[1]):
self.data[:, j] -= np.mean(self.data[:, j])... | code_fim | hard | {
"lang": "python",
"repo": "navyaannam/MLProjects",
"path": "/ML/hw5/src/kmeans.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: navyaannam/MLProjects path: /ML/hw5/src/kmeans.py
import numpy as np
import math
class KMeans(object):
def __init__(self, data, option):
self.data = data
self.membership = None
self.centroids = None
self.option = option
self.temp_data = None
def... | code_fim | hard | {
"lang": "python",
"repo": "navyaannam/MLProjects",
"path": "/ML/hw5/src/kmeans.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class MainCentralWidget(QWidget):
def __init__(self):
super().__init__()
tab_bar = self.getTabBar(('录制', '运行'))
tab_page = self.getTabPage()
tab_bar.currentRowChanged.connect(tab_page.setCurrentIndex)
hbox = QHBoxLayout(spacing=0)
hbox.setContentsMargins... | code_fim | hard | {
"lang": "python",
"repo": "Anesck/AutoMouse",
"path": "/mainUI.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Anesck/AutoMouse path: /mainUI.py
import sys
from collections import namedtuple
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, \
QHBoxLayout, QStackedWidget, QListWidget, QListWidgetItem
from PyQt5.QtCore import Qt, QSize
from runWidget import RunWidget
from recordWidget... | code_fim | hard | {
"lang": "python",
"repo": "Anesck/AutoMouse",
"path": "/mainUI.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
super().__init__()
tab_bar = self.getTabBar(('录制', '运行'))
tab_page = self.getTabPage()
tab_bar.currentRowChanged.connect(tab_page.setCurrentIndex)
hbox = QHBoxLayout(spacing=0)
hbox.setContentsMargins(0, 0, 0, 0)
hbox.addWidge... | code_fim | hard | {
"lang": "python",
"repo": "Anesck/AutoMouse",
"path": "/mainUI.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>O(n) runtime
n + n / 2 + n / 4 + n / 8 + n / 16 + ... = n (1 + 1/2 + 1/4 + 1/8 + ...)
= 2n on average
worst case is 0(n^2) like quick sort if you pick the worst each
time
'''
import random
def select(arr, k):
n = len(arr)
if not 0 <= k < n:
raise ValueError('not valid index in array')
if n <= 1:
... | code_fim | hard | {
"lang": "python",
"repo": "petrosdawit/interview-practice",
"path": "/cs16 review/selection.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petrosdawit/interview-practice path: /cs16 review/selection.py
'''
selection review
very similar to quicksort in terms of set up.
no need to sort to find kth element in a list
but instead can be done in o(n)
quick sort can be o(nlogn) if we choose median
instead of pivot
<|fim_suffix|> n = len(a... | code_fim | hard | {
"lang": "python",
"repo": "petrosdawit/interview-practice",
"path": "/cs16 review/selection.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>n + n / 2 + n / 4 + n / 8 + n / 16 + ... = n (1 + 1/2 + 1/4 + 1/8 + ...)
= 2n on average
worst case is 0(n^2) like quick sort if you pick the worst each
time
'''
import random
def select(arr, k):
n = len(arr)
if not 0 <= k < n:
raise ValueError('not valid index in array')
if n <= 1:
return arr[0]
... | code_fim | hard | {
"lang": "python",
"repo": "petrosdawit/interview-practice",
"path": "/cs16 review/selection.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silasbrack/sota-neural-translation path: /evaluation/test_transformer.py
import sys
sys.path.append("./")
from torchtext.datasets import Multi30k
from torchtext.data import Field
from torchtext import data
import pickle
import models.transformer as h
import torch
from datasets import load_dataset... | code_fim | hard | {
"lang": "python",
"repo": "silasbrack/sota-neural-translation",
"path": "/evaluation/test_transformer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
SRC = Field(tokenize = "spacy",
tokenizer_language="de_core_news_sm",
init_token = '<sos>',
eos_token = '<eos>',
lower = True)
TRG = Field(tokenize = "spacy",
tokenizer_language="en_core_web_sm",
init_token = '<sos>',
eo... | code_fim | hard | {
"lang": "python",
"repo": "silasbrack/sota-neural-translation",
"path": "/evaluation/test_transformer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gayhub-blackerie/uWSGI path: /uWSGI_PathTraversal.py
#coding=utf-8
import requests,sys
result_url=[]
def main():
counts=open(sys.argv[1]).readlines()
for line in open(sys.argv[1]):
line=line.strip("\n")
url=line
try:
#url="http://s6000.sgcc.c... | code_fim | hard | {
"lang": "python",
"repo": "gayhub-blackerie/uWSGI",
"path": "/uWSGI_PathTraversal.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>n result_url:
print(i)
file_200.write(i+"\n")
if __name__ == '__main__':
file_200=open("result_uWSGI_file.txt","w")
main()
file_200.flush()
file_200.close()<|fim_prefix|># repo: gayhub-blackerie/uWSGI path: /uWSGI_PathTraversal.py
#coding=utf-8
import req... | code_fim | hard | {
"lang": "python",
"repo": "gayhub-blackerie/uWSGI",
"path": "/uWSGI_PathTraversal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Elliyos/ProjectWhirligig path: /Jared/corner detect test.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 18 13:39:05 2017
@author: jaredhaeme15
"""
import cv2
import numpy as np
from collections import deque
import imutils
import misc_image_tools
<|fim_suffix|>while(1):
succes... | code_fim | medium | {
"lang": "python",
"repo": "Elliyos/ProjectWhirligig",
"path": "/Jared/corner detect test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while(1):
successFlag, frame = cap.read()
if not successFlag:
cv2.waitKey(0)
break
lower_hsv_thresholdcr = np.array([0,250,250])
upper_hsv_thresholdcr = np.array([10,255,255])
gray = np.float32(cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY))
dst = cv2.cornerHarris... | code_fim | medium | {
"lang": "python",
"repo": "Elliyos/ProjectWhirligig",
"path": "/Jared/corner detect test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Madhushree10/Mypy path: /Bandname.py
#1. Create a greeting for your program.
print("Welcome to the Band Name Generator")
#2. Ask the user for the city that they grew up in.
city = input("Which city did you grew up in?\n")
<|fim_suffix|>#4. Combine the name of their city and pet and show them t... | code_fim | medium | {
"lang": "python",
"repo": "Madhushree10/Mypy",
"path": "/Bandname.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#5. Make sure the input cursor shows on a new line:
print("Your band name could be ", Band_name)<|fim_prefix|># repo: Madhushree10/Mypy path: /Bandname.py
#1. Create a greeting for your program.
print("Welcome to the Band Name Generator")
<|fim_middle|>#2. Ask the user for the city that they grew up in... | code_fim | hard | {
"lang": "python",
"repo": "Madhushree10/Mypy",
"path": "/Bandname.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Crypto-Dimo/textbook_ex path: /parrot.py
prompt = "Enter a message and I will repeat it to you: "
message = " "
while message != 'quit':
message = input(prompt)
if message != 'quit':
print(message)
# using the 'flag' variable
prompt = "Enter a message and I will repeat it to y... | code_fim | medium | {
"lang": "python",
"repo": "Crypto-Dimo/textbook_ex",
"path": "/parrot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>prompt = "Enter a message and I will repeat it to you: "
# active is the variable used in this case as flag
active = True
while active:
message = input(prompt)
if message == 'quit':
active = False
else:
print(message)<|fim_prefix|># repo: Crypto-Dimo/textbook_ex path: ... | code_fim | medium | {
"lang": "python",
"repo": "Crypto-Dimo/textbook_ex",
"path": "/parrot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while active:
message = input(prompt)
if message == 'quit':
active = False
else:
print(message)<|fim_prefix|># repo: Crypto-Dimo/textbook_ex path: /parrot.py
prompt = "Enter a message and I will repeat it to you: "
message = " "
while message != 'quit':
message = in... | code_fim | medium | {
"lang": "python",
"repo": "Crypto-Dimo/textbook_ex",
"path": "/parrot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ignore_test_train_with_empty_data(self):
"""
test train with empty train data
:return:
"""
test_config = "tests/data/test_config/test_config.json"
config = AnnotatorConfig(test_config)
trainer = Trainer(config)
assert len(trainer.pip... | code_fim | hard | {
"lang": "python",
"repo": "deepwel/Chinese-Annotator",
"path": "/tests/taskcenter/test_trainer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deepwel/Chinese-Annotator path: /tests/taskcenter/test_trainer.py
# -*- coding: utf-8 -*-
import json
import os
import io
import shutil
import pytest
from chi_annotator.algo_factory.common import TrainingData
from chi_annotator.task_center.config import AnnotatorConfig
from chi_annotator.task_c... | code_fim | hard | {
"lang": "python",
"repo": "deepwel/Chinese-Annotator",
"path": "/tests/taskcenter/test_trainer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TitaniteChunk/mupeg path: /dataset/old_version_paper/casiab/generateArtificialVideosOne_CasiaB.py
import cv2
import os
import numpy as np
import sys
from os.path import expanduser
np.random.seed(0)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(descriptio... | code_fim | hard | {
"lang": "python",
"repo": "TitaniteChunk/mupeg",
"path": "/dataset/old_version_paper/casiab/generateArtificialVideosOne_CasiaB.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if dataset == 'casiab':
datasetdir = script_path + "/casiab/" if datasetdir is None else datasetdir
siltdir = script_path + "/casiab_silhouettes/" if siltdir is None else siltdir
idsdir = script_path + "casiab_ids.txt" if idsdir is None else idsdir
outputdir = script_pa... | code_fim | hard | {
"lang": "python",
"repo": "TitaniteChunk/mupeg",
"path": "/dataset/old_version_paper/casiab/generateArtificialVideosOne_CasiaB.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^$', CommentListAPIView.as_view(), name='list'),
url(r'^(?P<pk>\d+)/$', CommentDetailAPIView, name='detail'),
]<|fim_prefix|># repo: Aayush567/blog_api path: /comments/api/urls.py
from django.conf.urls import url
from django.contrib import admin
<|fim_middle|>from comments.... | code_fim | medium | {
"lang": "python",
"repo": "Aayush567/blog_api",
"path": "/comments/api/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aayush567/blog_api path: /comments/api/urls.py
from django.conf.urls import url
from django.contrib import admin
<|fim_suffix|>urlpatterns = [
url(r'^$', CommentListAPIView.as_view(), name='list'),
url(r'^(?P<pk>\d+)/$', CommentDetailAPIView, name='detail'),
]<|fim_middle|>from comments.... | code_fim | medium | {
"lang": "python",
"repo": "Aayush567/blog_api",
"path": "/comments/api/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> count += lights[k][j]
if count % 2 != P[k]:
flag = False
break
if flag:
answer_count += 1
print(answer_count)<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03031/s422875134.py
N, M = map(int, input().split()) # Nはスイッチの数、Mは電球の数
li... | code_fim | medium | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03031/s422875134.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03031/s422875134.py
N, M = map(int, input().split()) # Nはスイッチの数、Mは電球の数
lights = [[0] * N for _ in range(M)]
for i in range(M):
temp = list(map(int, input().split())) # 0番目はスイッチの個数、1<|fim_suffix|> count += lights[k][j]
if count % ... | code_fim | hard | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03031/s422875134.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blarking94/Python path: /PySpark/spark-sql.py
from pyspark.sql import SQLContext, Row
from pyspark import SparkContext, SparkConf
from pyspark.sql.functions import col
import collections
<|fim_suffix|>def mapper(line):
fields = line.split(",")
return Row(ID = int(fields[0]), name = fields[1].... | code_fim | medium | {
"lang": "python",
"repo": "blarking94/Python",
"path": "/PySpark/spark-sql.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.