text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: mherrmann/django-404-middleware path: /django_404_middleware/models.py
from django.db.models import Model, TextField, BooleanField, PositiveIntegerField
from django_404_middleware.match import match
class FailedUrl(Model):
<|fim_suffix|> def __str__(self):
return self.pattern
class Ignorable... | code_fim | hard | {
"lang": "python",
"repo": "mherrmann/django-404-middleware",
"path": "/django_404_middleware/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
verbose_name = 'Ignorable 404 Referer'
pattern = TextField(help_text='Referers matching this pattern are ignored.')
exact = BooleanField(
verbose_name='The full referer must match', blank=False, default=True
)
is_re = BooleanField(
verbose_name='Is regular expression', blank=False,... | code_fim | medium | {
"lang": "python",
"repo": "mherrmann/django-404-middleware",
"path": "/django_404_middleware/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdcs/TheWxPythonTutorial path: /MenusAndToolbars/checkmenuitem.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# checkmenuitem.py
import wx, os.path
ID_STAT = 1
ID_TOOL = 2
class CheckMenuItem(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id,... | code_fim | hard | {
"lang": "python",
"repo": "jdcs/TheWxPythonTutorial",
"path": "/MenusAndToolbars/checkmenuitem.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.shst.IsChecked():
self.statusbar.Show()
else:
self.statusbar.Hide()
def ToggleToolBar(self, event):
if self.shtl.IsChecked():
self.toolbar.Show()
else:
self.toolbar.Hide()
if __name__ == '__main__':
app = wx.... | code_fim | hard | {
"lang": "python",
"repo": "jdcs/TheWxPythonTutorial",
"path": "/MenusAndToolbars/checkmenuitem.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># 开启线程
a1.start()
a2.start()
#join用来判定该线程是否执行完,如果未执行完将阻塞主线程,直至完成
a1.join()
print('a1 is quit')
a2.join()
print('a2 is quit')
print ("退出主线程")<|fim_prefix|># repo: code-killerr/python_practise path: /python practise/多线程.py
import threading
import time
from queue import Queue
a = Queue()#定义qu... | code_fim | hard | {
"lang": "python",
"repo": "code-killerr/python_practise",
"path": "/python practise/多线程.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: code-killerr/python_practise path: /python practise/多线程.py
import threading
import time
from queue import Queue
a = Queue()#定义queue
b = 0
lock = threading.Lock()
for i in range(1,20):
a.put(i)
#多线程去除queue的值,造成可以同步的效果
def output(name):
<|fim_suffix|># 开启线程
a1.start()
a2.start()
... | code_fim | hard | {
"lang": "python",
"repo": "code-killerr/python_practise",
"path": "/python practise/多线程.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for item in constituencies:
CONSTITUENCIES.append((item['ons_code'], item['name']))
county = County()
counties = json.loads(county.get_counties())
COUNTIES = []
for item in counties:
COUNTIES.append((item['ons_code'], item['name']))
class ConstituencyForm(Form):
constituency = SelectField... | code_fim | medium | {
"lang": "python",
"repo": "MashSoftware/place-ui",
"path": "/mash_place_ui/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MashSoftware/place-ui path: /mash_place_ui/forms.py
from flask_wtf import Form
from wtforms import SelectField
from wtforms.validators import DataRequired
from mash_place_ui.models import Constituency, County
import json
constituency = Constituency()
constituencies = json.loads(constituency.get_... | code_fim | hard | {
"lang": "python",
"repo": "MashSoftware/place-ui",
"path": "/mash_place_ui/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CountyForm(Form):
county = SelectField('County', choices=COUNTIES, validators=[DataRequired()])<|fim_prefix|># repo: MashSoftware/place-ui path: /mash_place_ui/forms.py
from flask_wtf import Form
from wtforms import SelectField
from wtforms.validators import DataRequired
from mash_place_ui.mode... | code_fim | hard | {
"lang": "python",
"repo": "MashSoftware/place-ui",
"path": "/mash_place_ui/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return str(self.attrs())
class PollResult(object):
"""Wrapper for the results of polling a service.
This should be sublcassed for every subclass of Poller.
"""
def __init__(self, exception):
self.exception = str(exception)
def attrs(self):
attrs = copy.copy(... | code_fim | hard | {
"lang": "python",
"repo": "mcutshaw/ScoringEngine",
"path": "/polling/poller.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mcutshaw/ScoringEngine path: /polling/poller.py
from threading import Thread, Lock
import copy
class PollInput(object):
"""Wrapper for the inputs to a Poller.
This should be subclassed for each subclass of Poller.
Attributes:
server (str, optional): IP address or FQDN of a ... | code_fim | medium | {
"lang": "python",
"repo": "mcutshaw/ScoringEngine",
"path": "/polling/poller.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kasraly/CarND-Advanced-Lane-Lines path: /image_gen.py
import numpy as np
import cv2
import glob
import pickle
import line
from moviepy.editor import VideoFileClip
# loading the camera calibration paramters
cal_dict = pickle.load(open('camera_cal.pkl', 'rb'))
mtx = cal_dict['mtx']
dist = cal_d... | code_fim | hard | {
"lang": "python",
"repo": "kasraly/CarND-Advanced-Lane-Lines",
"path": "/image_gen.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Define conversions in x and y from pixels space to meters
ym_per_pix = 20/500 # meters per pixel in y dimension
xm_per_pix = 3.7/600 # meters per pixel in x dimension
# Fit new polynomials to x,y in world space
left_fit_cr = xm_per_pix*np.divide(left_fit,np.array([ym_per_pix**2,ym_p... | code_fim | hard | {
"lang": "python",
"repo": "kasraly/CarND-Advanced-Lane-Lines",
"path": "/image_gen.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krusli/telegram_manga_reader path: /app.py
import requests, json, csv, random, os, multiprocessing, html, time, os
# URL and auth token for bot requests
token = # enter the API token from BotFather here
url = 'https://api.telegram.org/bot%s/' % token
# Create a `Session` instance to customize ... | code_fim | hard | {
"lang": "python",
"repo": "krusli/telegram_manga_reader",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def main():
# ----- operating variables -----
# get last_update, so bot can request messages after a certain update ID.
try:
with open('last_update.txt', 'r') as f:
last_update = int(f.readline().strip())
except FileNotFoundError:
last_update = 0
... | code_fim | hard | {
"lang": "python",
"repo": "krusli/telegram_manga_reader",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create a multiprocessing Pool
pool = multiprocessing.Pool(processes = 4)
while True:
try:
get_updates = json.loads(requests.get(url + 'getUpdates', \
dict(offset = last_update)).text)
except ConnectionError:
pass
for update in... | code_fim | hard | {
"lang": "python",
"repo": "krusli/telegram_manga_reader",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doityu/Project_Euler path: /PE1...50/pe-31.py
# 何通りあるか計算
def calc(coin_list, p, num):
<|fim_suffix|>coin_li = [200, 100, 50, 20, 10, 5, 2, 1]
num = 200
print(calc(coin_li, 0, num))<|fim_middle|> if(coin_list[p] == 1 or num == 0):
return 1
else:
sum_num = 0
for i i... | code_fim | hard | {
"lang": "python",
"repo": "doityu/Project_Euler",
"path": "/PE1...50/pe-31.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doityu/Project_Euler path: /PE1...50/pe-31.py
# 何通りあるか計算
def calc(coin_list, p, num):
if(coin_list[p] == 1 or num == 0):
return 1
else:
sum_num = 0
for i in range(num // coin_list[p] + 1):
target = num - coin_list[p] * i
sum_num += calc(coin... | code_fim | easy | {
"lang": "python",
"repo": "doityu/Project_Euler",
"path": "/PE1...50/pe-31.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>num = 200
print(calc(coin_li, 0, num))<|fim_prefix|># repo: doityu/Project_Euler path: /PE1...50/pe-31.py
# 何通りあるか計算
def calc(coin_list, p, num):
<|fim_middle|> if(coin_list[p] == 1 or num == 0):
return 1
else:
sum_num = 0
for i in range(num // coin_list[p] + 1):
... | code_fim | hard | {
"lang": "python",
"repo": "doityu/Project_Euler",
"path": "/PE1...50/pe-31.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Simonskiii/Reading-App path: /backGround/apps/user_operations/migrations/0002_auto_20191129_1309.py
# Generated by Django 2.2.4 on 2019-11-29 05:09
import datetime
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('user_operations', '0001_initial'),
]
... | code_fim | medium | {
"lang": "python",
"repo": "Simonskiii/Reading-App",
"path": "/backGround/apps/user_operations/migrations/0002_auto_20191129_1309.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('user_operations', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='userfavaricle',
name='time',
field=models.DateTimeField(default=datetime.datetime.now, null=True, verbose_name='收藏时间'),
),
... | code_fim | medium | {
"lang": "python",
"repo": "Simonskiii/Reading-App",
"path": "/backGround/apps/user_operations/migrations/0002_auto_20191129_1309.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sagagaga4/Most_Common_word_in_given_Url path: /WebScraper.py
import requests
import pandas as pd
from bs4 import BeautifulSoup
import re
from urllib.request import urlopen
from collections import Counter
def ignore_punctuation(common_word):
common_word = common_word.replace('.', ''... | code_fim | medium | {
"lang": "python",
"repo": "sagagaga4/Most_Common_word_in_given_Url",
"path": "/WebScraper.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># break into lines and remove leading and trailing space on each
lines = (line.strip() for line in text.splitlines())
# break multi-headlines into a line each
chunks = (phrase.strip() for line in lines for phrase in line.split(" "))
# drop blank lines
text = '\n'.join(chunk for chunk in chunks if ch... | code_fim | medium | {
"lang": "python",
"repo": "sagagaga4/Most_Common_word_in_given_Url",
"path": "/WebScraper.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Metodos-Numericos-II/biblioteca path: /src/mn2/imagens/filtros.py
from Imagem import *
def convoluir(img, filtro):
"""
Convolui um kernel com uma Imagem L
img: Imagem
filtro: kernel (ndarray). Não reverte-lo antes de passar para a função
retorno: Imagem resultado da convolução
"""
... | code_fim | hard | {
"lang": "python",
"repo": "Metodos-Numericos-II/biblioteca",
"path": "/src/mn2/imagens/filtros.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ], dtype="float64") / 16
if img.modo == "L":
return convoluir(img, kernel)
canais = [
filtrar_canal(img, "R"), filtrar_canal(img, "G"), filtrar_canal(img, "B")
]
for i in range(0, n):
canais = [convoluir(i, kernel) for i in canais]
return reunir_canais(*canais)
def nitidez(im... | code_fim | hard | {
"lang": "python",
"repo": "Metodos-Numericos-II/biblioteca",
"path": "/src/mn2/imagens/filtros.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
odd_count = odd_count+1
print(i)
print("Even number: {}".format(even_count))
print("Odd number: {}".format(odd_count))<|fim_prefix|># repo: piyushjha7/Files path: /even_odd1.py
n= int(input("Enter your number:"))
even_count = 0
odd_count = 0
<|fim_middle|>
for i in range(1,n+1):
if(i%2==... | code_fim | medium | {
"lang": "python",
"repo": "piyushjha7/Files",
"path": "/even_odd1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("Even number: {}".format(even_count))
print("Odd number: {}".format(odd_count))<|fim_prefix|># repo: piyushjha7/Files path: /even_odd1.py
n= int(input("Enter your number:"))
<|fim_middle|>even_count = 0
odd_count = 0
for i in range(1,n+1):
if(i%2==0):
even_count = even_count+1
print(i)
... | code_fim | medium | {
"lang": "python",
"repo": "piyushjha7/Files",
"path": "/even_odd1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: piyushjha7/Files path: /even_odd1.py
n= int(input("Enter your number:"))
<|fim_suffix|>print("Even number: {}".format(even_count))
print("Odd number: {}".format(odd_count))<|fim_middle|>even_count = 0
odd_count = 0
for i in range(1,n+1):
if(i%2==0):
even_count = even_count+1
print(i)
... | code_fim | medium | {
"lang": "python",
"repo": "piyushjha7/Files",
"path": "/even_odd1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@dataclass
class UnderwriterRoleType:
underwriter_type: Optional[UnderwriterRoleTypeUnderwriterType] = field(
default=None,
metadata={
"name": "UnderwriterType",
"type": "Element",
"namespace": "http://generali.com/enterprise-services/core/gbo/enter... | code_fim | medium | {
"lang": "python",
"repo": "tefra/xsdata-samples",
"path": "/generali/models/com/generali/enterprise_services/core/gbo/enterprise/agreement/v1/underwriter_role_type.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tefra/xsdata-samples path: /generali/models/com/generali/enterprise_services/core/gbo/enterprise/agreement/v1/underwriter_role_type.py
from dataclasses import dataclass, field
from typing import Optional
from generali.models.com.generali.enterprise_services.core.gbo.enterprise.agreement.v1.underw... | code_fim | medium | {
"lang": "python",
"repo": "tefra/xsdata-samples",
"path": "/generali/models/com/generali/enterprise_services/core/gbo/enterprise/agreement/v1/underwriter_role_type.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mshahrasbi/MachineLearningProjects path: /Part 6 - Reinforcement Learning/Section 28 - Thompson Sampling/ts.py
# Thompson Sampling (TS)
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# importing the dataset
dataset = pd.read_csv('Ads_CTR_Optimi... | code_fim | medium | {
"lang": "python",
"repo": "mshahrasbi/MachineLearningProjects",
"path": "/Part 6 - Reinforcement Learning/Section 28 - Thompson Sampling/ts.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for n in range(0, N):
ad = 0
max_random = 0
for i in range(0, d):
random_beta = random.betavariate(numbers_of_rewards_1[i] + 1, numbers_of_rewards_0[i]+ 1)
if random_beta > max_random:
max_random = random_beta
ad = i
ads_selected.app... | code_fim | hard | {
"lang": "python",
"repo": "mshahrasbi/MachineLearningProjects",
"path": "/Part 6 - Reinforcement Learning/Section 28 - Thompson Sampling/ts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> tp2 = tp.clone()
c2 = Context({'name':'Ansa'})
elem2 = tp2.bind_ctx(c2)
assert elem2.text == "Hello Ansa"
assert elem.text == "Hello Jonathan"
assert tp._dirty_self is False
text_elem = MockElement('#text')
text_elem.text = "Hello"
tp = _compile(text_elem)
c = Cont... | code_fim | hard | {
"lang": "python",
"repo": "jonathanverner/circular",
"path": "/tests/circular/template/tag/test_text.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jonathanverner/circular path: /tests/circular/template/tag/test_text.py
from tests.brython.browser.html import MockElement
from src.circular.template.context import Context
from src.circular.template.tags import TextPlugin
from src.circular.template.tpl import _compile
<|fim_suffix|> text_e... | code_fim | medium | {
"lang": "python",
"repo": "jonathanverner/circular",
"path": "/tests/circular/template/tag/test_text.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> text_elem = MockElement('#text')
text_elem.text = "Hello"
tp = _compile(text_elem)
c = Context({})
elem = tp.bind_ctx(c)
assert elem.text == "Hello"
c.name = "Jonathan"
assert tp.update() is None
assert elem.text == "Hello"<|fim_prefix|># repo: jonathanverner/circular ... | code_fim | medium | {
"lang": "python",
"repo": "jonathanverner/circular",
"path": "/tests/circular/template/tag/test_text.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>model.load_weights(bst_model_path)
bst_val_score=min(hist.history['val_loss'])
preds = model.predict([test_data_1, test_data_2],batch_size=4096, verbose=1)
preds += model.predict([test_data_2, test_data_1], batch_size=4096, verbose=1)
preds /= 2.0
print(bst_val_score)
out_df = pd.DataFrame({"test_... | code_fim | hard | {
"lang": "python",
"repo": "ddegraw/DS",
"path": "/BDSiamese_LSTM_attention_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ddegraw/DS path: /BDSiamese_LSTM_attention_model.py
import numpy as np
#np.random.seed(1337)
#from keras.utils.np_utils import to_categorical
from keras.layers import Dense, Input, merge, LSTM, Dropout, Bidirectional, Embedding, Lambda, Flatten, Reshape
#from keras.layers import Conv1D, M... | code_fim | hard | {
"lang": "python",
"repo": "ddegraw/DS",
"path": "/BDSiamese_LSTM_attention_model.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>hist = model.fit([data_1,data_2], labels, validation_data=([data_1_val, data_2_val], labels_val, weight_val), nb_epoch=100, batch_size=256, shuffle=True ,class_weight=class_weight, callbacks=[early_stopping, model_checkpoint])
model.load_weights(bst_model_path)
bst_val_score=min(hist.history['val_lo... | code_fim | hard | {
"lang": "python",
"repo": "ddegraw/DS",
"path": "/BDSiamese_LSTM_attention_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>et_wind()['deg'])
print(w.get_temperature())
print(w.get_humidity())<|fim_prefix|># repo: Angela-de/lab path: /web api/api key.py
import pyowm
location=input("what is your location?")
owm = pyowm<|fim_middle|>.OWM('09a3954d276243deded1d4d4e3280a28')
observation = owm.weather_at_place(location)
w = obse... | code_fim | medium | {
"lang": "python",
"repo": "Angela-de/lab",
"path": "/web api/api key.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Angela-de/lab path: /web api/api key.py
import pyowm
location=input("what is your location?")
owm = pyowm<|fim_suffix|>t_place(location)
w = observation.get_weather()
print(w)
print(w.get_wind()['deg'])
print(w.get_temperature())
print(w.get_humidity())<|fim_middle|>.OWM('09a3954d276243deded1... | code_fim | medium | {
"lang": "python",
"repo": "Angela-de/lab",
"path": "/web api/api key.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cribstone/Transit-Board-Hotel path: /config/config.py
#!/usr/bin/python
# Instructions: run this script and then paste the output into CouchDB
# You may have to save the _rev value.
try:
import json
except:
import simplejson as json
output = dict()
output['title'] = 'Transit Board(tm) ... | code_fim | hard | {
"lang": "python",
"repo": "Cribstone/Transit-Board-Hotel",
"path": "/config/config.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> div.find('td.tbdhdestsdrop ul li span.tbdhdestid').each(function () {
dests.push($(this).text());
});
div.find('input.tbdhdestinationinp').val(dests.join(','));
};
// prepopulate the selected list
var dests = [];
$.each(trApp.current_appliance.public.application.o... | code_fim | hard | {
"lang": "python",
"repo": "Cribstone/Transit-Board-Hotel",
"path": "/config/config.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>f6 = open('/report/check203.txt', 'r+')
for line in f6:
sumT = line.strip().split(" ")
if (sumT[0] == "Wed" or sumT[0] == "Mon" or sumT[0] == "Thu" or sumT[0] == "Fri" or sumT[0] == "Tue") and sumT[5] == "2017":
cur.execute("INSERT INTO month (SERVER,A,B,C,D,E)VALUES ('203.152.... | code_fim | hard | {
"lang": "python",
"repo": "itsareds/Report-216-",
"path": "/rBackup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itsareds/Report-216- path: /rBackup.py
#!/usr/local/bin/python
#-*- coding: utf-8 -*-
import MySQLdb as mdb
con = mdb.connect("172.16.1.212", "root", "camel","report" , use_unicode=True, charset="UTF8")
cur = con.cursor()
#cur.execute("UPDATE month set A = 'itsared'")
#cur.execute("INSERT INTO mo... | code_fim | hard | {
"lang": "python",
"repo": "itsareds/Report-216-",
"path": "/rBackup.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pitroldev/uerj-algoritmos-computacionais path: /Trabalhos/Trabalho_4.py
"""
UERJ - 13/10/2020
Trabalho 4 de Algoritimos Computacionais
Escreva um programa que leia o nome de uma pessoa e
imprima esse nome sem espaços iniciais e finais, com
apenas um espaço entre as partes que compõem o nome,
... | code_fim | medium | {
"lang": "python",
"repo": "pitroldev/uerj-algoritmos-computacionais",
"path": "/Trabalhos/Trabalho_4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
name = input(str("Digite um nome: "))
print(parseName(name))
main()<|fim_prefix|># repo: pitroldev/uerj-algoritmos-computacionais path: /Trabalhos/Trabalho_4.py
"""
UERJ - 13/10/2020
Trabalho 4 de Algoritimos Computacionais
Escreva um programa que leia o nome de uma pessoa e
imp... | code_fim | hard | {
"lang": "python",
"repo": "pitroldev/uerj-algoritmos-computacionais",
"path": "/Trabalhos/Trabalho_4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dorelo/machine-learning path: /grid_models.py
import pandas as pd
from numpy import mean, std
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import (ExtraTreesClassifier, RandomForestClassifier,
AdaBoostClassifier, GradientBoostingClassifier)
... | code_fim | hard | {
"lang": "python",
"repo": "dorelo/machine-learning",
"path": "/grid_models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
Read in data
'''
complete_data = pd.read_csv('full_data_with_confidence.csv')
complete_data.set_index('ID')
print complete_data.shape
# print complete_data
'''
Remove low confidence
'''
# fixed = complete_data.loc[complete_data['confidence'] == 1.00]
# print fixed
'''
Impute missing values
'''
print ... | code_fim | hard | {
"lang": "python",
"repo": "dorelo/machine-learning",
"path": "/grid_models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmvieira/algs path: /src/heap/max_heapify.py
import math
class MaxHeapify(object):
def __init__(self, array):
self.array = array
def build(self):
<|fim_suffix|> if largest != i:
temp = array[largest]
array[largest] = array[i]
array[... | code_fim | hard | {
"lang": "python",
"repo": "dmvieira/algs",
"path": "/src/heap/max_heapify.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if n > right and array[right] > array[largest]:
largest = right
if largest != i:
temp = array[largest]
array[largest] = array[i]
array[i] = temp
self.max(array, largest, n)
return array<|fim_prefix|># repo: dmviei... | code_fim | hard | {
"lang": "python",
"repo": "dmvieira/algs",
"path": "/src/heap/max_heapify.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if n > left and array[left] > array[largest]:
largest = left
if n > right and array[right] > array[largest]:
largest = right
if largest != i:
temp = array[largest]
array[largest] = array[i]
array[i] = temp
... | code_fim | hard | {
"lang": "python",
"repo": "dmvieira/algs",
"path": "/src/heap/max_heapify.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ddormer/bdm path: /bdm/resource.py
import json
from decimal import Decimal
from base64 import b64decode
from twisted.internet.defer import maybeDeferred, gatherResults
from twisted.internet import reactor
from twisted.internet.threads import deferToThreadPool
from twisted.web import http
from tw... | code_fim | hard | {
"lang": "python",
"repo": "ddormer/bdm",
"path": "/bdm/resource.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = request.postpath[0]
if name == u'steamid':
if len(request.postpath[1]) <= 1 or request.postpath[1] is None:
raise Exception("No SteamID provided.")
return self.steamID(request.postpath[1])
if name == u'recent':
try:
... | code_fim | hard | {
"lang": "python",
"repo": "ddormer/bdm",
"path": "/bdm/resource.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> continue
#process our interesting line
print line<|fim_prefix|># repo: juraj80/Python-Data-Stuctures path: /07/skipline.py
fhandle=open('mbox-short.txt')
for line in fhandle:
line=line.rstrip()
#skip uninteresting lines
if no<|fim_middle|>t line.startswith('From:') # if not 'From:' in line:
| code_fim | easy | {
"lang": "python",
"repo": "juraj80/Python-Data-Stuctures",
"path": "/07/skipline.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juraj80/Python-Data-Stuctures path: /07/skipline.py
fhandle=open('mbox-short.txt')
for line in fhandle:
<|fim_suffix|>t line.startswith('From:') # if not 'From:' in line:
continue
#process our interesting line
print line<|fim_middle|> line=line.rstrip()
#skip uninteresting lines
if no | code_fim | easy | {
"lang": "python",
"repo": "juraj80/Python-Data-Stuctures",
"path": "/07/skipline.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Erfanafshar/cloud-computing-project path: /files/main.py
from http.server import HTTPServer, SimpleHTTPRequestHandler
import json
host_name = "0.0.0.0"
server_port = 8080
MAX_NUM = 1000 * 1000 * 1000 * 1.0
MIN_NUM = 1000 * 1000 * 1000 * -1.0
class Server(SimpleHTTPRequestHandler):
def do_... | code_fim | hard | {
"lang": "python",
"repo": "Erfanafshar/cloud-computing-project",
"path": "/files/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> response_text = {"finished": "ok"}
self.send_response(200)
self.send_header('Content-type', 'application/json')
self.end_headers()
self.wfile.write(str(response_text).encode('utf-8'))
if __name__ == "__main__":
webServer = HTTPServer((host_name, server_port), ... | code_fim | hard | {
"lang": "python",
"repo": "Erfanafshar/cloud-computing-project",
"path": "/files/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> inFnames = glob.glob(join(inDir, "log", "*.log"))
print("Parsing %d logfiles and writing to %s" % (len(inFnames), outFname))
for inFname in inFnames:
cellId = basename(inFname).split(".")[0].split("_")[0]
# [quant] processed 1,836,518 reads, 636,766 reads pseudoaligned
... | code_fim | hard | {
"lang": "python",
"repo": "ifiddes/kent",
"path": "/src/hg/cirm/cdw/wrangle/kallistoToMatrix/kallistoToMatrix",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ifiddes/kent path: /src/hg/cirm/cdw/wrangle/kallistoToMatrix/kallistoToMatrix
#!/usr/bin/env python2.7
# a converter for kallisto output files
# parses ~800 cells in 1-2 minutes
# and merges everything into a single matrix that can be read with one line in R
# also outputs a binary hash files th... | code_fim | hard | {
"lang": "python",
"repo": "ifiddes/kent",
"path": "/src/hg/cirm/cdw/wrangle/kallistoToMatrix/kallistoToMatrix",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrjazz/freemind-tools-python path: /shell.py
as_tree(node, level):
# for key in node.keys():
# if key == '@TEXT':
# print(level * ' ' + node[key])
def display_nodes(nodes:list, level=0):
if type(nodes) is freemind.FreeMindNode:
print(level * ... | code_fim | hard | {
"lang": "python",
"repo": "mrjazz/freemind-tools-python",
"path": "/shell.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def fn_list(nodes, level):
if not nodes:
return
for n in nodes:
process_node(n, level)
fn_list(n, level+1)
if parts is None:
pass
else:
for part in parts.split(';'):
nodes... | code_fim | hard | {
"lang": "python",
"repo": "mrjazz/freemind-tools-python",
"path": "/shell.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrjazz/freemind-tools-python path: /shell.py
nd.FreeMindNode:
print(level * ' ' + nodes.get_title())
if nodes.has_content():
content = nodes.get_content()
l = level + 1
print(l * ' ' + '---')
delim = l *... | code_fim | hard | {
"lang": "python",
"repo": "mrjazz/freemind-tools-python",
"path": "/shell.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> direccion = models.CharField(max_length=250, null=False, blank=False , verbose_name="Dirección")
correo1 = models.EmailField(null=False, blank=False, verbose_name="Correo 1")
correo2 = models.EmailField(null=False, blank=False, verbose_name="Correo 2")
telefono1 = models.CharField(null=Fal... | code_fim | medium | {
"lang": "python",
"repo": "sanjoseflowers/version1",
"path": "/base/pagina_web/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sanjoseflowers/version1 path: /base/pagina_web/models.py
from django.db import models
from base.pagina_web.choices import disponible
# Create your models here.
class Acerca(models.Model):
titulo = models.CharField(null=False, blank=False, max_length=150, verbose_name='Titulo')
descripcio... | code_fim | hard | {
"lang": "python",
"repo": "sanjoseflowers/version1",
"path": "/base/pagina_web/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Contacto(models.Model):
direccion = models.CharField(max_length=250, null=False, blank=False , verbose_name="Dirección")
correo1 = models.EmailField(null=False, blank=False, verbose_name="Correo 1")
correo2 = models.EmailField(null=False, blank=False, verbose_name="Correo 2")
telefon... | code_fim | hard | {
"lang": "python",
"repo": "sanjoseflowers/version1",
"path": "/base/pagina_web/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: latinos/PlotsConfigurations path: /Configurations/WW/FullRunII/Full2016_v7/leadlepPT/TheoUnc/nuisances.py
# nuisances
# name of samples here must match keys in samples.py
from LatinoAnalysis.Tools.commonTools import getSampleFiles, getBaseW, addSampleWeight
def nanoGetSampleFiles(inputDir, Sam... | code_fim | hard | {
"lang": "python",
"repo": "latinos/PlotsConfigurations",
"path": "/Configurations/WW/FullRunII/Full2016_v7/leadlepPT/TheoUnc/nuisances.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># PDF
pdf_variations = ["LHEPdfWeight[%d]" %i for i in range(100)] # Float_t LHE pdf variation weights (w_var / w_nominal) for LHA IDs 260001 - 260100
nuisances['pdf_WW'] = {
'name' : 'pdf_WW_2016',
'kind' : 'weight_rms',
'type' : 'shape',
'samples' : {
'WW' : pdf_variations,
},
}
... | code_fim | hard | {
"lang": "python",
"repo": "latinos/PlotsConfigurations",
"path": "/Configurations/WW/FullRunII/Full2016_v7/leadlepPT/TheoUnc/nuisances.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YanshuoH/2dBLab-SoundResearch path: /utils/utils.py
import os
from typing import List
import numpy
from aubio import notes, source, pitch, tempo
from midiutil import MIDIFile
from midiutil.MidiFile import TICKSPERQUARTERNOTE, NoteOn
from pydub import AudioSegment
from model.channel import chann... | code_fim | hard | {
"lang": "python",
"repo": "YanshuoH/2dBLab-SoundResearch",
"path": "/utils/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_emphasis_start_times(group_result_with_log_density: List[dict], length: float, coefficient: int = 0.8,
threshold: int = 1):
"""
:param group_result_with_log_density compute_density_from_pitch_result function result
:param coefficient compares to the max log... | code_fim | hard | {
"lang": "python",
"repo": "YanshuoH/2dBLab-SoundResearch",
"path": "/utils/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
]
operations = [
migrations.CreateModel(
name='Topic',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('heading', models.CharField(max_length=1... | code_fim | medium | {
"lang": "python",
"repo": "bhadrinath95/numpy",
"path": "/PyDev/NumPy/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhadrinath95/numpy path: /PyDev/NumPy/migrations/0001_initial.py
# Generated by Django 3.0.8 on 2020-07-04 06:30
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
<|fim_suffix|> operations = [
migrations.CreateModel(
... | code_fim | medium | {
"lang": "python",
"repo": "bhadrinath95/numpy",
"path": "/PyDev/NumPy/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Topic',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('heading', models.CharField(max_length=120)),
('create... | code_fim | medium | {
"lang": "python",
"repo": "bhadrinath95/numpy",
"path": "/PyDev/NumPy/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>nt(b[i]) in aDic:
print("1")
else:
print("0")<|fim_prefix|># repo: kwangminini/Algorhitm path: /BAEKJOON/1920.py
testCase=int(input())
a=input().split(" ")
test=int(input())
b=input().split(" ")
aDic={}
bDic={}
for i in range(len(a)):
aDic<|fim_middle|>[int(a[i])]=a[i]
for i in r... | code_fim | medium | {
"lang": "python",
"repo": "kwangminini/Algorhitm",
"path": "/BAEKJOON/1920.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kwangminini/Algorhitm path: /BAEKJOON/1920.py
testCase=int(input())
a=input().split(" ")
test=int(input())
b=in<|fim_suffix|>nt(b[i]) in aDic:
print("1")
else:
print("0")<|fim_middle|>put().split(" ")
aDic={}
bDic={}
for i in range(len(a)):
aDic[int(a[i])]=a[i]
for i in r... | code_fim | medium | {
"lang": "python",
"repo": "kwangminini/Algorhitm",
"path": "/BAEKJOON/1920.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(tt):
ll=msgpack.unpackb(tmp)
print "msgpack loads:"+str(time.time()-a1)
a1=time.time()
for i in range(tt):
tmp=z1.pack(s)
print "mypack dumps:"+str(time.time()-a1)
a1=time.time()
for i in range(tt):
ll=mypack.unpackb(tmp)
print "mypack loads:"+str(time.time()-a1)<|fim_prefix|># ... | code_fim | medium | {
"lang": "python",
"repo": "isnowfy/simplerpc",
"path": "/pack-source/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isnowfy/simplerpc path: /pack-source/test.py
import mypack
import msgpack
import time
#s={123:(23,"werf",{12:"aaa"},(12,"weqe"))}
#s="asd21dasas"
z1=mypack.Packer()
z2=msgpack.Packer()
s=[<|fim_suffix|>for i in range(tt):
ll=msgpack.unpackb(tmp)
print "msgpack loads:"+str(time.time()-a1)
a1=... | code_fim | medium | {
"lang": "python",
"repo": "isnowfy/simplerpc",
"path": "/pack-source/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: siyuqtt/independent path: /util.py
__author__ = 'siyuqiu'
import numpy as np
from scipy.stats import norm
from tweetsManager import textManager
from random import shuffle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import svm
from sklearn.linear_model import SGDClassi... | code_fim | hard | {
"lang": "python",
"repo": "siyuqtt/independent",
"path": "/util.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> vector1 = self.text_to_vector(text1)
vector2 = self.text_to_vector(text2)
return self.get_cosine(vector1, vector2)
def groupExcatWordscore(self, candi):
scores = defaultdict(list)
l = len(candi)
ret = []
total = []
for i in xrange(l):
... | code_fim | hard | {
"lang": "python",
"repo": "siyuqtt/independent",
"path": "/util.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> FACTORY_FOR = Steel
carbon = 0.1
manganese = 0
nickel = 0
chromium = 0
molybdenum = 0
vanadium = 0
silicon = 0<|fim_prefix|># repo: kswiat/steel_hardenability path: /metal/factories.py
import factory
from metal.models import Steel
<|fim_middle|>class SteelFactory(factor... | code_fim | easy | {
"lang": "python",
"repo": "kswiat/steel_hardenability",
"path": "/metal/factories.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kswiat/steel_hardenability path: /metal/factories.py
import factory
from metal.models import Steel
<|fim_suffix|> FACTORY_FOR = Steel
carbon = 0.1
manganese = 0
nickel = 0
chromium = 0
molybdenum = 0
vanadium = 0
silicon = 0<|fim_middle|>
class SteelFactory(factor... | code_fim | easy | {
"lang": "python",
"repo": "kswiat/steel_hardenability",
"path": "/metal/factories.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> carbon = 0.1
manganese = 0
nickel = 0
chromium = 0
molybdenum = 0
vanadium = 0
silicon = 0<|fim_prefix|># repo: kswiat/steel_hardenability path: /metal/factories.py
import factory
from metal.models import Steel
<|fim_middle|>class SteelFactory(factory.django.DjangoModelFacto... | code_fim | medium | {
"lang": "python",
"repo": "kswiat/steel_hardenability",
"path": "/metal/factories.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AaronGao95/MNA path: / demo/biology/urls.py
"""demo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a UR... | code_fim | hard | {
"lang": "python",
"repo": "AaronGao95/MNA",
"path": "/ demo/biology/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> url(r'^decomp/results/(?P<file_id>.{32})$(?i)', views.decomposition, name='decomp_results'),
url(r'^decomp/visualisation/(?P<file_id>.{32})$(?i)', views.visualisation, name='decomp_visualisation'),
url(r'^decomp/visualisation/download/(?P<img_id>.{34,})$(?i)', views.vis_download, name='visualisat... | code_fim | hard | {
"lang": "python",
"repo": "AaronGao95/MNA",
"path": "/ demo/biology/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ance, name="guidance"),
url(r'^decomp/upload/$(?i)', views.decomp_upload, name="decomp_upload"),
url(r'^decomp/scripts/$(?i)', views.decomp_scripts, name="decomp_scripts"),
url(r'^download_scripts/(?P<os>.{1})/$(?i)', views.download_scripts, name='download_scripts'),
url(r'^ajax_uplaod/$(?... | code_fim | hard | {
"lang": "python",
"repo": "AaronGao95/MNA",
"path": "/ demo/biology/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shadow-Assassin/CPGNN path: /baselines/mixhop/mixhop_trainer.py
# Standard imports.
import collections
import json
import os
import pickle
# Third-party imports.
from absl import app
from absl import flags
import numpy
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorfl... | code_fim | hard | {
"lang": "python",
"repo": "Shadow-Assassin/CPGNN",
"path": "/baselines/mixhop/mixhop_trainer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if j != len(layer_dims) - 1:
if FLAGS._batch_normalization:
model.add_layer('tf.contrib.layers', 'batch_norm')
model.add_layer('tf.nn', FLAGS.nonlinearity)
#
model.add_layer('mixhop_model', 'psum_output_layer', dataset.ally.shape[1],
use_softmax=FLAGS._psum_o... | code_fim | hard | {
"lang": "python",
"repo": "Shadow-Assassin/CPGNN",
"path": "/baselines/mixhop/mixhop_trainer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> feed_dict = {y: dataset.ally[train_indices]}
dataset.populate_feed_dict(feed_dict)
LAST_STEP = collections.Counter()
accuracy_monitor = AccuracyMonitor(sess, FLAGS.early_stop_steps)
# Step function makes a single update, prints accuracies, and invokes
# accuracy_monitor to keep track of test ... | code_fim | hard | {
"lang": "python",
"repo": "Shadow-Assassin/CPGNN",
"path": "/baselines/mixhop/mixhop_trainer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OpenGridMap/transnet path: /app/CimWriterUnitTest.py
import unittest
from CIM14.ENTSOE.Equipment.Wires import PowerTransformer, TransformerWinding
from CimWriter import CimWriter
class CimWriterUnitTest(unittest.TestCase):
<|fim_suffix|> transformer = PowerTransformer([tw1, tw2, tw3])
... | code_fim | hard | {
"lang": "python",
"repo": "OpenGridMap/transnet",
"path": "/app/CimWriterUnitTest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> transformer = PowerTransformer([tw1, tw2, tw3])
self.assertEqual(110000, CimWriter.determine_load_voltage(transformer))
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: OpenGridMap/transnet path: /app/CimWriterUnitTest.py
import unittest
from CIM14.ENTSOE.Equi... | code_fim | hard | {
"lang": "python",
"repo": "OpenGridMap/transnet",
"path": "/app/CimWriterUnitTest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># 평점 데이터 불러오기
ratings_df = pd.read_csv(RATING_DATA_PATH, index_col='user_id')
# 평점 데이터에 mean normalization을 적용한다
for row in ratings_df.values:
row -= np.nanmean(row)
# 목표 변수
R = ratings_df.values
Theta, X = initialize(R, 5) # 행렬 초기화(임의 행렬 생성)
Theta, X, costs = gradient_descent(R, Th... | code_fim | hard | {
"lang": "python",
"repo": "hatssww/hatssww_Python",
"path": "/행렬 인수분해.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hatssww/hatssww_Python path: /행렬 인수분해.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# numpy에서 임의성 도구들의 결과가 일정하게 나오도록 설정
np.random.seed(5)
# 데이터 파일 경로 정의
RATING_DATA_PATH = './data/ratings.csv'
# numpy 출력 옵션 설정
np.set_printoptions(precision=2) # 소수점 둘째 자리까지만 출력
np.s... | code_fim | hard | {
"lang": "python",
"repo": "hatssww/hatssww_Python",
"path": "/행렬 인수분해.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_user, num_items = R.shape # 유저 데이터 개수와 영화 개수를 변수에 저장
num_features = len(X) # 속성 개수
costs = []
for _ in range(iteration):
prediction = predict(Theta, X) # 예측값
error = prediction - R # 오차
costs.append(cost(prediction, R)) # 손실값 저장
... | code_fim | hard | {
"lang": "python",
"repo": "hatssww/hatssww_Python",
"path": "/행렬 인수분해.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tsushiy/competitive-programming-submissions path: /AtCoder/ABC/ABC101-150/abc141/abc141d.py
n, m = list(map(int, input().split()))
a = list(map(int, <|fim_suffix|>t = -heappop(a)
t //= 2
heappush(a, -t)
print(-sum(a))<|fim_middle|>input().split()))
a = [-a[i] for i in range(n)]
a.sort()
from ... | code_fim | medium | {
"lang": "python",
"repo": "tsushiy/competitive-programming-submissions",
"path": "/AtCoder/ABC/ABC101-150/abc141/abc141d.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t = -heappop(a)
t //= 2
heappush(a, -t)
print(-sum(a))<|fim_prefix|># repo: tsushiy/competitive-programming-submissions path: /AtCoder/ABC/ABC101-150/abc141/abc141d.py
n, m = list(map(int, input().split()))
a = list(map(int, <|fim_middle|>input().split()))
a = [-a[i] for i in range(n)]
a.sort()
from ... | code_fim | medium | {
"lang": "python",
"repo": "tsushiy/competitive-programming-submissions",
"path": "/AtCoder/ABC/ABC101-150/abc141/abc141d.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from heapq import heappush, heappop
for i in range(m):
t = -heappop(a)
t //= 2
heappush(a, -t)
print(-sum(a))<|fim_prefix|># repo: tsushiy/competitive-programming-submissions path: /AtCoder/ABC/ABC101-150/abc141/abc141d.py
n, m = list(map(int, input().split()))
a = list(map(int, <|fim_middle|>input... | code_fim | easy | {
"lang": "python",
"repo": "tsushiy/competitive-programming-submissions",
"path": "/AtCoder/ABC/ABC101-150/abc141/abc141d.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itsRamos/test path: /helloworld.py
"""Practicing range
range(start, stop, step)
"""
<|fim_suffix|>if __name__ == "__main__":
main()<|fim_middle|>def main():
x=range(1 , 101, 10)
for n in x:
print(n)
| code_fim | medium | {
"lang": "python",
"repo": "itsRamos/test",
"path": "/helloworld.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> x=range(1 , 101, 10)
for n in x:
print(n)
if __name__ == "__main__":
main()<|fim_prefix|># repo: itsRamos/test path: /helloworld.py
"""Practicing range
<|fim_middle|>range(start, stop, step)
"""
def main():
| code_fim | easy | {
"lang": "python",
"repo": "itsRamos/test",
"path": "/helloworld.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kragen/pyconar-talk path: /reloj.py
#!/usr/bin/python
from pygame import *
init()
pantalla = display.set_mode((0, 0), FULLSCREEN)
ww, hh = pantalla.get_size()
imagen = image.load('trashcan_empty.png')
clic = mixer.Sound('menu_click.wav')
<|fim_suffix|> pantalla.fill(0)
pantalla.blit(imag... | code_fim | hard | {
"lang": "python",
"repo": "kragen/pyconar-talk",
"path": "/reloj.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pantalla.fill(0)
pantalla.blit(imagen, (xx, yy))
display.flip()<|fim_prefix|># repo: kragen/pyconar-talk path: /reloj.py
#!/usr/bin/python
from pygame import *
init()
pantalla = display.set_mode((0, 0), FULLSCREEN)
ww, hh = pantalla.get_size()
imagen = image.load('trashcan_empty.png')
clic =... | code_fim | hard | {
"lang": "python",
"repo": "kragen/pyconar-talk",
"path": "/reloj.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print(liuhen[i][0],liuhen[i][3],msqlliu[i][1])
url1= "UPDATE jbzw.sg_sp_work_link_info SET END_TIME='"+str(liuhen[i][3])+"', USER_NAME='"+str(liuhen[i][0])+"' WHERE ID='"+str(msqlliu[i][1])+"'"
print(url1)
# mysql.execute(url1)
# conn.commit()
... | code_fim | hard | {
"lang": "python",
"repo": "wccgoog/pass",
"path": "/python/selenium/更新留痕.py",
"mode": "spm",
"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.