text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>].values():
p+=m
if p>sp:
sp=p
x=t
return x<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_340/ch165_2020_06_20_23_48_12_067262.py
def mais_populoso(dic):
p=0
sp=0
<|fim_middle|>for t,i in dic.items():
for ... | code_fim | easy | {
"lang": "python",
"repo": "gabriellaec/desoft-analise-exercicios",
"path": "/backup/user_340/ch165_2020_06_20_23_48_12_067262.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
import json
def morning_news():
news_api = 'http://api.tianapi.com/bulletin/index?key=7d407997897033ce7f6e86a51e3284d2'
response = requests.get(news_api)
print(dict(response.json()))
news_list = dict(response.json())
news = ''
m = 1
news_q=''
for i in news_list['newslist']... | code_fim | hard | {
"lang": "python",
"repo": "xinchenxy/ncov2019-",
"path": "/wechat_virus/virus-weixinbot-master/daily_news.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> init = {'city': locale} if locale.endswith('City') else {'county': locale}
return {
**init,
'locale': locale,
'official': official,
'address': ', '.join(address),
'emails': list(set(emails)),
'phones': [phone],
'faxes': [fax],
'url': url,
}
def main():
# Actually... | code_fim | hard | {
"lang": "python",
"repo": "kevanloy/elections-officials",
"path": "/states/nevada/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
while True:
iter_.peek_till('a')
email = iter_.__next__()
href = email['href']
if href.startswith('mailto:'):
if href[7:]:
emails += [href[7:]]
else:
emails += [email.text]
else:
url = href
except IndexError:
pass
... | code_fim | hard | {
"lang": "python",
"repo": "kevanloy/elections-officials",
"path": "/states/nevada/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoogleJump/AdvisorAnimals path: /code.py
def helloWorld():
print "We are in DEMO land!"
<|fim_suffix|>print "[done, for real]"<|fim_middle|>for i in range(10):
helloWorld()
print listBuilder()
def listBuilder():
b = []
for x in range(5):
b.append(10 * x)
return b
| code_fim | medium | {
"lang": "python",
"repo": "GoogleJump/AdvisorAnimals",
"path": "/code.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.debug("Checking whether graph '{}' is already in the triple store...".format(ihash))
query = GraphStore.ASK_IF_GRAPH_IS_ALREADY_STORED.format(ihash)
sparql_query = SPARQLWrapper(
self._get_sparql_endpoint_for_query(),
self._get_sparql_endpoint_for_u... | code_fim | hard | {
"lang": "python",
"repo": "MakoLab/graphchain-indy-plugin",
"path": "/plenum/server/plugin/graphchain/stardog_graph_store.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> query = GraphStore.ASK_IF_GRAPH_IS_ALREADY_STORED.format(ihash)
sparql_query = SPARQLWrapper(
self._get_sparql_endpoint_for_query(),
self._get_sparql_endpoint_for_update())
sparql_query.setQuery(query)
sparql_query.method = 'POST'
sparql_qu... | code_fim | hard | {
"lang": "python",
"repo": "MakoLab/graphchain-indy-plugin",
"path": "/plenum/server/plugin/graphchain/stardog_graph_store.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>model.eval()
with torch.no_grad():
preds = list(model(prices[:50,None,None])[:,0])
for i in range(len(prices)-50):
preds.append(model.forward_step(preds[-1][None,...])[0])
print(preds)
print(prices[1:])
plt.plot(np.arange(len(prices)-1),prices[1:])
plt.plot(np.arange(len(preds)), preds)
plt.show(... | code_fim | medium | {
"lang": "python",
"repo": "michaelyhuang23/Stock-Prediction",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Package details
setup(
name='sent2vec',
version='0.1.0',
author='',
author_email='',
url='',
description='A Python interface for sent2vec library',
license='BSD 3-Clause License',
packages=['sent2vec'],
ext_modules = extensions,
install_requires=[],
classifiers= []
)<|fim_prefix|>#... | code_fim | hard | {
"lang": "python",
"repo": "fonzo14/sent2vec.py",
"path": "/setup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f.write('# ' + fullName + "\n")
f.write('## Description\n')
f.write('TBD\n')
f.write('\n')
f.write('## Usage\n')
argumentsText = (", ".join(arguments))
argumentsText = argumentsText.replace('`', '')
f.write('> `' + fullName + '(' + argumentsText + ')`\n\n')
f.write('Regular event: you can subsc... | code_fim | hard | {
"lang": "python",
"repo": "HoneyTheYellowBear123/Civilization-VI-Modding-Knowledge-Base",
"path": "/.data-generation/Events.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> title = scrapy.Field()
developments = scrapy.Field()
body = scrapy.Field()
date = scrapy.Field()
class GoogleArticleItem(scrapy.Item):
title = scrapy.Field()
date = scrapy.Field()
snippet = scrapy.Field()
source = scrapy.Field()<|fim_prefix|># repo: mzw4/MorningAssistant ... | code_fim | easy | {
"lang": "python",
"repo": "mzw4/MorningAssistant",
"path": "/news_crawler/news_crawler/items.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_data(self):
return self.data
def __getattr__(self, item):
"""
添加魔术方法
:param item:
:return:
"""
# 获取操作类型 set
operation = item[0:3]
# 获取被操作的属性 set_xxxx 获取xxxx
field = item[4:]
if operation == 'set' and f... | code_fim | medium | {
"lang": "python",
"repo": "mlzboy/bot-sdk-python",
"path": "/dueros/card/BaseCard.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> name='Receipt_c',
fields=[
('receipt_id', models.AutoField(max_length=200, primary_key=True, serialize=False)),
('receipt_patient', models.CharField(max_length=200)),
('receipt_cost', models.CharField(max_length=200)),
('re... | code_fim | hard | {
"lang": "python",
"repo": "wsarvesh/ProjectsGit",
"path": "/Projects/hospital_management/DHOPD/migrations/0016_patient_c_receipt_c.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return types
def input_tsq_row_count():
tsq_row_count = 0
while True:
tsq_row_count_input = input('Number of TSQ rows (int) > ')
try:
tsq_row_count = int(tsq_row_count_input)
break
except Exception as e:
print('int only!')
return... | code_fim | hard | {
"lang": "python",
"repo": "umich-dbgroup/duoquest",
"path": "/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method=='POST':
json_data = request.body
stream = io.BytesIO(json_data)
pythondata = JSONParser().parse(stream)
serializer = StudentSerializer(data=pythondata)
if serializer.is_valid():
serializer.save()
res = {'msg':'data inse... | code_fim | hard | {
"lang": "python",
"repo": "kunalnag/Django-REST-framework",
"path": "/DsfPro1/api1/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> last_position = 0
for num in nums:
if num != val:
nums[last_position] = num
last_position += 1
return last_position
"""
Complexity: Time : O(n) | Space: O(1)
"""<|fim_prefix|># repo: aroranubhav/DailyBit path: /RemoveElement.py
""... | code_fim | medium | {
"lang": "python",
"repo": "aroranubhav/DailyBit",
"path": "/RemoveElement.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return True
def CheckButton( self, sender ):
if self.w.searchForCorner.get() == self.w.replaceWithCorner.get():
self.w.runButton.enable(onOff=False)
else:
self.w.runButton.enable(onOff=True)
def getAllCorners(self):
thisFont = Glyphs.font
corners = [g.name for g in thisFont.glyphs i... | code_fim | hard | {
"lang": "python",
"repo": "NaN-xyz/Glyphs-Scripts",
"path": "/Components/Find and Replace Corner Components at Certain Angles.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> field = [StructField("Sale", IntegerType(), True),
StructField("SalesAmount", FloatType(), True),
StructField("ConversionDelay", FloatType(), True),
StructField("ClickTimestamp", StringType(), True),
StructField("NumClicksPerWeek", FloatType(), True)... | code_fim | hard | {
"lang": "python",
"repo": "liside/Kingpin",
"path": "/groupml/process_data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_files = len(all_partitions)
if val_frac * num_files < 1:
df = pd.concat([pd.read_csv(f, header=None) for f in glob.glob(path + "*.csv")], ignore_index=True)
num_examples = df.shape[0]
val_examples = int(num_examples * val_frac)
val = df[:... | code_fim | hard | {
"lang": "python",
"repo": "liside/Kingpin",
"path": "/groupml/process_data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
Set_Ticker()
Actual_Value()
#Setting Date
Set_Date()
#Gap of 1 month in time
#n = int(input("Enter the No. of Years in Months:"))
start_date += datetime.timedelta(weeks=-100)
#Creat a DataFrame
Data_frame_Create()
#Create Features - X
Add_Features_x()
#Forecast
Forcast_Valu... | code_fim | hard | {
"lang": "python",
"repo": "rajatsharma369007/Stock-Forecast",
"path": "/Implementation/div_proj_2 - Modified.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Label - y
Add_Features_y()
#Split Training and Testing Data
Setup_Validate_data()
#Set Model for ML
Set_Model()
#Accuracy of Test Data
get_Accuracy()
#Predict Next Values
Prediction()
print (stockTicker.partition('.')[0])
##print ("Start Date:" + str(start_date))
print ("Accurac... | code_fim | hard | {
"lang": "python",
"repo": "rajatsharma369007/Stock-Forecast",
"path": "/Implementation/div_proj_2 - Modified.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>And the type is class decimal.Decimal
# When dealing with money use this method
from decimal import *
a = Decimal('.10') # it will conver from string
b = Decimal('.30')
x = a + a + a - b
print("x is {}" .format(x))
print(type(x))<|fim_prefix|># repo: gitlearn212/My-Python-Lab path: /Python/linkedincourse... | code_fim | hard | {
"lang": "python",
"repo": "gitlearn212/My-Python-Lab",
"path": "/Python/linkedincourse/types2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
print('Please provide the filepaths of the messages and categories '\
'datasets as the first and second argument respectively, as '\
'well as the filepath of the database to save the cleaned data '\
'to as the third argument. \n\nExample: python ... | code_fim | hard | {
"lang": "python",
"repo": "Abhijeetv007/Disaster_Pipeline_Project",
"path": "/data/data/process_data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Function Description
Complete the function in the editor below. It must return either or .
abbreviation has the following parameter(s):
a: the string to modify
b: the string to match
Input Format
The first line contains a single integer , the number of queries.
Each of the next pairs of lines is a... | code_fim | hard | {
"lang": "python",
"repo": "vitthalpadwal/Python_Program",
"path": "/hackerrank/preparation_kit/dynamic_programming/abbrevation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># a for loop
@micropython.viper
def viper_for(a:int, b:int) -> int:
total = 0
for x in range(a, b):
total += x
return total
print(viper_for(10, 10000))
# accessing a global
@micropython.viper
def viper_access_global():
global gl
gl = 1
return gl
print(viper_... | code_fim | hard | {
"lang": "python",
"repo": "jiapei100/Stereo",
"path": "/micropython/tests/micropython/viper_misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> total = 0
for x in range(a, b):
total += x
return total
print(viper_for(10, 10000))
# accessing a global
@micropython.viper
def viper_access_global():
global gl
gl = 1
return gl
print(viper_access_global(), gl)
# calling print with object and int types
@mic... | code_fim | hard | {
"lang": "python",
"repo": "jiapei100/Stereo",
"path": "/micropython/tests/micropython/viper_misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vedraiyani/skutil path: /skutil/h2o/split.py
nally:
warnings.filters.pop(0)
params[key] = value
return '%s(%s)' % (class_name, _pprint(params, offset=len(class_name)))
def check_cv(cv=3):
"""Checks the ``cv`` parameter to determine
whether it's a valid int or H2... | code_fim | hard | {
"lang": "python",
"repo": "vedraiyani/skutil",
"path": "/skutil/h2o/split.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vedraiyani/skutil path: /skutil/h2o/split.py
:
"""Splits an H2OFrame into random train and test subsets
Parameters
----------
frame : H2OFrame
The h2o frame to split
test_size : float, int, or None (default=None)
If float, should be between 0.0 and 1.0 and r... | code_fim | hard | {
"lang": "python",
"repo": "vedraiyani/skutil",
"path": "/skutil/h2o/split.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class H2OBaseShuffleSplit(six.with_metaclass(ABCMeta)):
"""Base class for H2OShuffleSplit and H2OStratifiedShuffleSplit. This
is used for ``h2o_train_test_split`` in strategic train/test splits of
H2OFrames. Implementing subclasses should override ``_iter_indices``.
Parameters
-------... | code_fim | hard | {
"lang": "python",
"repo": "vedraiyani/skutil",
"path": "/skutil/h2o/split.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DataProcessor:
def __init__(self, data_path = None, train_csv = None, val_csv = None, reg = False,
tr_name = 'train', val_name = 'val', test_name = 'test', extension = None, setup_data = True):
print('+------------------------------------+')
prin... | code_fim | hard | {
"lang": "python",
"repo": "fzaidi2014/dreamai",
"path": "/data_processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fzaidi2014/dreamai path: /data_processing.py
th,train_csv,
val_csv,reg,tr_name,val_name,test_name,extension)
self.obj = False
self.multi_label = False
if setup_dat... | code_fim | hard | {
"lang": "python",
"repo": "fzaidi2014/dreamai",
"path": "/data_processing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not bal_tfms:
bal_tfms = { self.tr_name: [transforms.RandomHorizontalFlip()],
self.val_name: None,
self.test_name: None
}
else:
bal_tfms = {self.tr_name: bal_tfm... | code_fim | hard | {
"lang": "python",
"repo": "fzaidi2014/dreamai",
"path": "/data_processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> totalListing = 0
totalSold = 0
form = SearchBosta()
data = {
'totalListing': totalListing,
'totalSold': totalSold,
'countListing': 0,
'countSold': 0,
'form': form
}
if request.method == 'POST':
form = SearchBosta(request.POST)
if form.is_valid():
q = form.cleaned_data['search_query'].enc... | code_fim | hard | {
"lang": "python",
"repo": "osaatcioglu/booliwood",
"path": "/main/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> maxPrice = forms.IntegerField()
livingArea = forms.IntegerField()
room = forms.IntegerField()
class BostaIdForm(forms.Form):
bostaId = forms.IntegerField()
class SearchBosta(forms.Form):
search_query = forms.CharField()
def show(request):
if request.method == 'POST':
form = Bosta... | code_fim | hard | {
"lang": "python",
"repo": "osaatcioglu/booliwood",
"path": "/main/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> rospy.Timer(rospy.Duration(2), my_callback)
rospy.spin()<|fim_prefix|># repo: lnnx2006/DJI_robomaster path: /open_fire/scripts/callback.py
#!/usr/bin/python
"""
Created on Aug 1 2014
<|fim_middle|>"""
import rospy
def my_callback(event):
print 'Timer called at ' + str(event.current_real)
... | code_fim | medium | {
"lang": "python",
"repo": "lnnx2006/DJI_robomaster",
"path": "/open_fire/scripts/callback.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__== "__main__":
display = floatlayoutApp()
display.run()<|fim_prefix|># repo: SUTD-IEEE/workshop-resources path: /SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
<|fim_middle|>
class LayoutWindow(FloatLayout)... | code_fim | medium | {
"lang": "python",
"repo": "SUTD-IEEE/workshop-resources",
"path": "/SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return LayoutWindow()
if __name__== "__main__":
display = floatlayoutApp()
display.run()<|fim_prefix|># repo: SUTD-IEEE/workshop-resources path: /SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
class LayoutWi... | code_fim | easy | {
"lang": "python",
"repo": "SUTD-IEEE/workshop-resources",
"path": "/SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_verbs(self, tokens):
verbs = []
for word, pos in tokens:
if pos == "VB":
nouns.push(word)
def get_adjectives(self, tokens):
nouns = []
for word, pos in tokens:
if pos == "NN":
nouns.push(word)
def get_nouns(self, tokens):
nouns = []
for word, pos in tokens:
if pos... | code_fim | medium | {
"lang": "python",
"repo": "vijaypandiyan/ChatBot",
"path": "/app/nlp_utility.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
model = tf.keras.models.load_model("64x3-CNN.model")
prediction = model.predict([prepare('dog.jpg')]) # REMEMBER YOU'RE PASSING A LIST OF THINGS YOU WISH TO PREDICT
print(prediction)
print(prediction[0][0])
print(CATEGORIES[int(prediction[0][0])])
#We can also test our cat example:
prediction = mode... | code_fim | hard | {
"lang": "python",
"repo": "Ramstein/PadIN",
"path": "/Classifying dogs vs cats with our own data images.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''
alpha. Also referred to as the learning rate or step size. The proportion that weights are updated (e.g. 0.001). Larger values (e.g. 0.3) results in faster initial learning before the rate is updated. Smaller values (e.g. 1.0E-5) slow learning right down during training
beta1. The exponential decay ... | code_fim | hard | {
"lang": "python",
"repo": "Ramstein/PadIN",
"path": "/Classifying dogs vs cats with our own data images.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lixiaofeng1993/UIAutomation path: /page/page_zaojiao.py
path', '//*[contains(@text, "版本查看")]') # 版本查看按钮
def click_version_btn(self):
self.click(self.version_btn_loc)
experience_version_btn_loc = ('xpath', '//*[contains(@text, "6.0.09")]') # 体验版
def clicks_experience_versi... | code_fim | hard | {
"lang": "python",
"repo": "lixiaofeng1993/UIAutomation",
"path": "/page/page_zaojiao.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lixiaofeng1993/UIAutomation path: /page/page_zaojiao.py
tains(@text, "包妈优选")]') # 包妈优选
def element_small_name(self):
return self.find_element(self.small_name_loc)
def click_small_name(self):
self.click(self.small_name_loc)
switching_applet_btn_loc = ('xpath', '//*[... | code_fim | hard | {
"lang": "python",
"repo": "lixiaofeng1993/UIAutomation",
"path": "/page/page_zaojiao.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> my_record_btn_loc = ('xpath', '//*[contains(@text, "成长记录")]') # 成长记录
def click_my_record_btn(self):
self.click(self.my_record_btn_loc)
my_record_class_btn_loc = ('xpath', '//*[contains(@text, "#")]') # # 测试英语课程组
def elements_my_record_class_btn(self):
return self.find_... | code_fim | hard | {
"lang": "python",
"repo": "lixiaofeng1993/UIAutomation",
"path": "/page/page_zaojiao.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def create_property_collector(vim, collector=None):
if not collector:
collector = vim.service_content.propertyCollector
return vim.CreatePropertyCollector(collector)
def destroy_property_collector(vim, collector):
if collector:
return vim.DestroyPropertyCollector(collector)
... | code_fim | hard | {
"lang": "python",
"repo": "Mirantis/vmware-dvs",
"path": "/networking_vsphere/utils/vim_util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> oppos = math.fabs(y - self.y)
adjac = math.fabs(x - self.x)
hypot = math.hypot(oppos,adjac)
sin = oppos/hypot
radians = math.asin(sin)
angle = radians * (180/3.14)
if x > self.x:
if y > self.y:
angle -=... | code_fim | hard | {
"lang": "python",
"repo": "heros1sport/ALLmyPythonCodes",
"path": "/Ludum Dare 2000.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #######dataset path
#datadir = sys.argv[1]
datadir = ''
pathDataset1 = datadir+'humanData.txt'
#pathDataset2 = datadir+'/audioData.txt'
dataset1 = loadData(pathDataset1)
#dataset2 = loadData(pathDataset2)
#Q4
kneeFinding(dataset1,range(1,7))
#Q5
clusters = km... | code_fim | hard | {
"lang": "python",
"repo": "CabbageUVa/Machine-Learning-course-project",
"path": "/Neural Network & Image classification & Audio Clustering/clustering.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>jpg_files = glob.glob(src_jpg_dir + '*.jpg')
cnt = 0
for jpg_file in jpg_files:
basename = os.path.basename(jpg_file)
if int(basename[:-4]) % 10 == 0:
cnt += 1
dirname = os.path.dirname(jpg_file)
dirs = dirname.split('/')
new_fname = dirs[-2] + '_' + basen... | code_fim | medium | {
"lang": "python",
"repo": "hfujikawa/Keras_test",
"path": "/jpg2rename_bmp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Starting engine")
def stop(self):
print("Stopping engine")
@abstractmethod
def drive(self):
pass
class Car(Vehicle):
def __init__(self, canClimbMountains, speed, year):
Vehicle.__init__(self, speed, year)
self.canClimbMountains = canClimbM... | code_fim | hard | {
"lang": "python",
"repo": "pavanpandya/Python",
"path": "/Advance Python - Object Oriented Programming/05_Encapsulation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.__wall = wallDynamic
# In the above example, wall is a private variable.
# Once a variable is declared as private, the only way to access those variables is through name mangling.
# In the name mangling process, an identifier with two leading underscores and one trailing underscore is
# text... | code_fim | hard | {
"lang": "python",
"repo": "pavanpandya/Python",
"path": "/Advance Python - Object Oriented Programming/05_Encapsulation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># data = {'username':'admin','password':'123456'}
# # json方式传递数据
# http1.postjson('http://47.101.197.102:8080/music/api/login',data=data)
# http1.savejson('result','id')
# http1.get('http://47.101.197.102:8080/music/api/user','{id}')
# http1.addheader('Content-type','multipart/form-data')
http1.upload('... | code_fim | medium | {
"lang": "python",
"repo": "kirina001/musicPytest",
"path": "/test/testMusic.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WONDER-project/GSAS-II-WONDER-WIN path: /GSAS-II-WONDER/GSASIIfpaGUI.py
in_idx,peakObj = doFPAcalc(
NISTpk,ttArr,simParms['plotpos'],simParms['calcwid'],
simParms['step'])
except Exception as err:
msg = "Error computing convolution, revise input... | code_fim | hard | {
"lang": "python",
"repo": "WONDER-project/GSAS-II-WONDER-WIN",
"path": "/GSAS-II-WONDER/GSASIIfpaGUI.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WONDER-project/GSAS-II-WONDER-WIN path: /GSAS-II-WONDER/GSASIIfpaGUI.py
,text in itemList:
prmSizer.Add(wx.StaticText(FPdlg,wx.ID_ANY,lbl),1,wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL,1)
if lbl not in parmDict: parmDict[lbl] = defVal
ctrl = G2G.ValidatedTxtCtrl(FPdlg,parmDict... | code_fim | hard | {
"lang": "python",
"repo": "WONDER-project/GSAS-II-WONDER-WIN",
"path": "/GSAS-II-WONDER/GSASIIfpaGUI.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def draw_house_door(dna):
cur_dict = {}
if 'roomList' in dna:
cur_dict = dna
elif 'request' in dna and 'feedback' not in dna:
cur_dict = json.loads(dna['request'])
elif 'feedback' in dna:
cur_dict = json.loads(dna['feedback'])
... | code_fim | hard | {
"lang": "python",
"repo": "yinzanxia/dna_info_process",
"path": "/DrawShape.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(12):
mp = monthlyPaymentRate * rb
rb=rb-mp
rb=rb+rb*monthlyir
print('remaining balance: ',round(rb,2))<|fim_prefix|># repo: ziweiwu/MIT-introduction-in-computer-science path: /week2/problem-1.py
balance=42
annualInterestRate=0.20
monthlyPaymentRate=0.04
<|fim_middle|>month... | code_fim | easy | {
"lang": "python",
"repo": "ziweiwu/MIT-introduction-in-computer-science",
"path": "/week2/problem-1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class InvoiceViewSet(ModelViewSet):
queryset = Invoice.objects.all()
serializer_class = InvoiceSerializer
filter_backends = [filters.SearchFilter]
search_fields = ['address__contact__name']
permission_classes = (IsAuthenticated,)<|fim_prefix|># repo: junaidikhlaq/django-api-details pa... | code_fim | hard | {
"lang": "python",
"repo": "junaidikhlaq/django-api-details",
"path": "/apis/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>args = vars(ap.parse_args())
print()
print()
print()
print('==========================================================================')
print(' ATENTION ')
print()
print(' ATENTION ... | code_fim | hard | {
"lang": "python",
"repo": "grantrosse/PyImageRoi",
"path": "/source/ExportPascal2txt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import time
import datetime as dt
from subprocess import call
from pidcmes_lib import Pidcmes # class for 'pidcmes' procedures
pidcmes = Pidcmes() # initialize pidcmese class
u_bat_min = 3.7 # minumum battery voltage
n_moy = 20 # averaging to reduce glitches
stop_run = False # to control the e... | code_fim | hard | {
"lang": "python",
"repo": "josmet52/amod",
"path": "/pidcmes_bbu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from subprocess import call
from pidcmes_lib import Pidcmes # class for 'pidcmes' procedures
pidcmes = Pidcmes() # initialize pidcmese class
u_bat_min = 3.7 # minumum battery voltage
n_moy = 20 # averaging to reduce glitches
stop_run = False # to control the execution (run/stop)
u_avg = pidcme... | code_fim | hard | {
"lang": "python",
"repo": "josmet52/amod",
"path": "/pidcmes_bbu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def move(self):
"""
Move the documentation from it's generated place to its final home.
This needs to understand both a single server dev environment,
as well as a multi-server environment.
"""
raise NotImplementedError
@property
def changed(se... | code_fim | hard | {
"lang": "python",
"repo": "thomaspurchas/readthedocs.org",
"path": "/readthedocs/doc_builder/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>0',
'00000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111000000000000000000000000000000000',
'00000000000000000000000000000000000000000000000000000000000000000000000000000001111111111100000000000000000000000000000000000000',
'0000000000000000000000000000000000000... | code_fim | hard | {
"lang": "python",
"repo": "GamerNoTitle/Beepers-and-OLED",
"path": "/bamap/ba0563.pngMap.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def write(self):
file = open(self.getSongName(), "w+")
file.write(self.getLyric())
file.close()<|fim_prefix|># repo: huyan0/lyricbreak path: /Song.py
import json
import jieba
import util
from pypinyin import pinyin, Style
class Song:
def __init__(self, songName, artistNam... | code_fim | hard | {
"lang": "python",
"repo": "huyan0/lyricbreak",
"path": "/Song.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.artistName
def getLyric(self):
return self.lyric
def getName(self):
return util.sanitizeName(self.artistName)+"-"+ util.sanitizeName(self.songName)
def storeToFileSystem(self, filename, append):
file = open(filename, ("w+","a+")[append],encoding="ut... | code_fim | hard | {
"lang": "python",
"repo": "huyan0/lyricbreak",
"path": "/Song.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return DBService(self.core).getNextFields("Communities", self.parameters["start"], self.parameters["offset"])<|fim_prefix|># repo: signeus/API-Web path: /modules/services/dbservices/community/get_communities_by_offset_service.py
# -*- coding: utf-8 -*-
from services.interfaces.i_service import IS... | code_fim | easy | {
"lang": "python",
"repo": "signeus/API-Web",
"path": "/modules/services/dbservices/community/get_communities_by_offset_service.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_suffix|> #if charge >= 0:
# atom_X_cif = ('A' + str(atomtype) + ' ' + str(x) + ' ' +
# str(y) + ' ' + str(z) + ' ' +
# str(charge) + '\n')
#cif_file.write(atom_X_cif)
#for i in range(100):
# atom_X_mixing = ('A' + str(i) + ' ... | code_fim | hard | {
"lang": "python",
"repo": "akaija/pseudo-mat",
"path": "/HTSOHM/bin/mat17.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CSVMerchantFeedTest(TestCase):
def test_csv_empty(self):
feed = CSVMerchantFeed([])
output = feed.get_content()
self.assertEquals(output, CSV_HEADINGS)
def test_csv(self):
feed = CSVMerchantFeed([AttrNameFakeModel()])
output = feed.get_content()
... | code_fim | hard | {
"lang": "python",
"repo": "willv/django-google-product-feeder",
"path": "/google_product_feeder/tests.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>else:
print("没有发生错误")
finally:
print("程序执行完毕,不知道是否发生了异常")<|fim_prefix|># repo: bwz3891923/LearningLog path: /Python 第八周作业/20171029 4.4.3.3.py
try:
alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
idx=eval(input("请输入一个整数"))
print(alp[idx])
<|fim_middle|>except NameError:
print("输入错误,请输... | code_fim | medium | {
"lang": "python",
"repo": "bwz3891923/LearningLog",
"path": "/Python 第八周作业/20171029 4.4.3.3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> maxDataLength = int(maxAudioLength * rate)
padding = []
if data.shape[0] > maxDataLength:
raise ValueError("Max audio length breached")
else:
paddingDataLength = maxDataLength - data.shape[0]
padding = [0 for i in range(paddingDataLength)]
# data is stereo soun... | code_fim | hard | {
"lang": "python",
"repo": "vpurush/speech-reco-partial-dataset",
"path": "/audio_loader/load_single.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == "POST":
json_data = request.get_data().decode('utf-8')
_data = json.loads(json_data)
orderNo = _data['orderNo']
name = _data['name']
idcard = _data['idcard']
mobile = _data['mobile']
json1 = json.dumps({'name': name, '... | code_fim | medium | {
"lang": "python",
"repo": "Ojmin/fengkong",
"path": "/disanfang/third_party/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route('/', methods=['POST'])
def hello_world():
if request.method == "POST":
json_data = request.get_data().decode('utf-8')
_data = json.loads(json_data)
orderNo = _data['orderNo']
name = _data['name']
idcard = _data['idcard']
mobile = _da... | code_fim | medium | {
"lang": "python",
"repo": "Ojmin/fengkong",
"path": "/disanfang/third_party/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># admin.site.register(Usuario,UsuarioAdmin)
# admin.site.register(Lote,LoteAdmin)
# admin.site.register(Fornecedor,FornecedorAdmin)
# admin.site.register(Cliente,ClienteAdmin)
# admin.site.register(Medicamento,MedicamentoAdmin)
# admin.site.register(Medicamento_Entrada,Medicamento_EntradaAdmin)
# admin.si... | code_fim | hard | {
"lang": "python",
"repo": "Francislley/farmacia01",
"path": "/controle/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class BannerAdmin(admin.ModelAdmin):
pass
class CaricaturaAdmin(admin.ModelAdmin):
pass
class VideoAdmin(admin.ModelAdmin):
pass
class TypePostAdmin(admin.ModelAdmin):
pass
class PostAdmin(admin.ModelAdmin):
class Media:
js = ('admin/js/tiny_mce/tiny_mce.js',
... | code_fim | medium | {
"lang": "python",
"repo": "Jhyrus/score",
"path": "/finish/wall/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class VideoAdmin(admin.ModelAdmin):
pass
class TypePostAdmin(admin.ModelAdmin):
pass
class PostAdmin(admin.ModelAdmin):
class Media:
js = ('admin/js/tiny_mce/tiny_mce.js',
'admin/js/tiny_mce/basic_config.js',)
class PhraseAdmin(admin.ModelAdmin):
pass... | code_fim | medium | {
"lang": "python",
"repo": "Jhyrus/score",
"path": "/finish/wall/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> item_type = ItemType.HEALING_WAND
register_custom_effect_item(
item_type=item_type,
item_level=4,
ui_icon_sprite=UiIconSprite.ITEM_HEALING_WAND,
sprite=Sprite.ITEM_HEALING_WAND,
image_file_path="resources/graphics/item_healing_wand.png",
item_equipme... | code_fim | hard | {
"lang": "python",
"repo": "JonathanMurray/python-2d-game",
"path": "/pythongame/game_data/items/item_healing_wand.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def register_healing_wand_item():
item_type = ItemType.HEALING_WAND
register_custom_effect_item(
item_type=item_type,
item_level=4,
ui_icon_sprite=UiIconSprite.ITEM_HEALING_WAND,
sprite=Sprite.ITEM_HEALING_WAND,
image_file_path="resources/graphics/item_heali... | code_fim | hard | {
"lang": "python",
"repo": "JonathanMurray/python-2d-game",
"path": "/pythongame/game_data/items/item_healing_wand.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> n = len(w)
dp = [False] * (V + 1)
dp[0] = True # 只有0件物品能达到0价值
for i in range(n):
num, total = 1, p[i]
while total > 0:
if num > total:
num = total
group_w = w[i] * num
for j in range(V, group_w - 1, -1):
... | code_fim | hard | {
"lang": "python",
"repo": "my-xh/KnapsackProblem",
"path": "/3-多重背包问题/划分.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(611, 289)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.s... | code_fim | hard | {
"lang": "python",
"repo": "tmwbook/small-projects",
"path": "/MultipleMovieTimer/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmwbook/small-projects path: /MultipleMovieTimer/main.py
formattedTime += "00:"
elif minutes >= 60:
newMinutes = minutes
if minutes % 60 == 0:
newMinutes = 0
while newMinutes > 60:
newMinutes -= 60
if len(st... | code_fim | hard | {
"lang": "python",
"repo": "tmwbook/small-projects",
"path": "/MultipleMovieTimer/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmwbook/small-projects path: /MultipleMovieTimer/main.py
timer3Time = timerTime
self.index_finished.emit(timer3Time, self.textBrowser)
elif timerNumber == 4:
timer4Time = timerTime
self.index_finished.emit(timer4Time, self.textBrows... | code_fim | hard | {
"lang": "python",
"repo": "tmwbook/small-projects",
"path": "/MultipleMovieTimer/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>:
if k in s:
s.remove(k)
k += num
print("Primes:", end = " ")
for num in sorted(s):
print(num, end = " ")<|fim_prefix|># repo: jasminecronin/code-step-by-step path: /Python/Sieve.py
N = int(input("Max value N? "))
s = set()
for i in range(2, N + 1):
<|fim_middle|> s.add... | code_fim | medium | {
"lang": "python",
"repo": "jasminecronin/code-step-by-step",
"path": "/Python/Sieve.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Display the selected data i the table.
:param graphPoints: Data that is currently displayed
:return: Table
"""
points_selected = []
if graphPoints is not None:
print(graphPoints)
for p... | code_fim | hard | {
"lang": "python",
"repo": "shossains/Interactive-Data-Visualization",
"path": "/src/main/python/oop/Components/Table.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_data(self, df):
"""
Loads in possible parameters for the x and y-axis in dropdown from the data.
:param dummy: dummy html property
:return: Possible options for dropdown x-axis.
"""
self.df = df<|fim_prefix|># repo: shossains/Interactive-Data-Vis... | code_fim | hard | {
"lang": "python",
"repo": "shossains/Interactive-Data-Visualization",
"path": "/src/main/python/oop/Components/Table.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print('h_n2:', h_n.size())
# final_hidden_state: [1, batch_size, hidden_size]
logtis = self.proj(h_n)
# print('logtis:', logtis.size())
# final_output: [batch_size, num_classes]
return logtis<|fim_prefix|># repo: lcaamtb/text_classification_pytorch path... | code_fim | hard | {
"lang": "python",
"repo": "lcaamtb/text_classification_pytorch",
"path": "/models/model_rnn_torch.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Probability of copying p(z=1) batch
copy = F.sigmoid(self.linear_copy(hidden))
# Probibility of not copying: p_{word}(w) * (1 - p(z))
out_prob = torch.mul(prob, 1 - copy.expand_as(prob))
mul_attn = torch.mul(attn, copy.expand_as(attn))
return out_prob, m... | code_fim | hard | {
"lang": "python",
"repo": "ixaxaar/OpenNMT-memnets",
"path": "/onmt/modules/CopyGenerator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> v, mid = prob[0].data.max(0)
print("Initial:", self.tgt_dict.getLabel(mid[0], "FAIL"), v[0])
print("COPY %3f" % copy.data[0][0])
_, ids = attn[0].cpu().data.sort(0, descending=True)
for j in ids[:10].tolist():
src_idx = src[0, j].data[0]
prin... | code_fim | hard | {
"lang": "python",
"repo": "ixaxaar/OpenNMT-memnets",
"path": "/onmt/modules/CopyGenerator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_cells_TCR = np.arange(1, num_cells + 1)[:,np.newaxis]
#Step 1 Poisson
p1 = stats.poisson.pmf(num_cells_TCR, mu_cells)
#Get rid of 0 probability cell counts
num_cells_TCR = num_cells_TCR[p1 >0]
p1 = p1[p1 >0]
#Step 2 Negbin
mu_reads = self.pcmodel.predict_mean(num_cells_TCR/num_cel... | code_fim | hard | {
"lang": "python",
"repo": "GabrielBalabanResearch/TCRpower",
"path": "/tcrpower/powercalc.py",
"mode": "spm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> opt_f = partial(self.pcmodel.predict_detection_probability, num_reads = num_reads)
opt_res = optimize.root_scalar(lambda freq: opt_f(freq) - conf_level,
method = "brentq",
bracket = [1.0e-16, 1])
return opt_res.root
def get_limit_of_detection_nreads(self, tcr_freq, conf_lev... | code_fim | hard | {
"lang": "python",
"repo": "GabrielBalabanResearch/TCRpower",
"path": "/tcrpower/powercalc.py",
"mode": "spm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if depth > 1:
return self.uid
for key, value in attrs.items():
if key not in include_keys:
continue
if not isinstance(value, property):
continue
value = getattr(self, key)
if isinstance(value, Enum... | code_fim | hard | {
"lang": "python",
"repo": "silencezhao90/gree-server",
"path": "/models/v1/model_base.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for key, value in attrs.items():
if key not in include_keys:
continue
if not isinstance(value, property):
continue
value = getattr(self, key)
if isinstance(value, Enum):
return_dict[key] = value.value
... | code_fim | hard | {
"lang": "python",
"repo": "silencezhao90/gree-server",
"path": "/models/v1/model_base.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>.
scaler : SciPy scaler to apply to X.
"""
self.classifier = classifier
self.scaler = scaler
self.color_space = color_space
self.orient = orient
self.pix_per_cell = pix_per_cell
self.cell_per_block = cell_per_block
self.spatial_s... | code_fim | medium | {
"lang": "python",
"repo": "thatkahunaguy/p5-Vehicle-Detection",
"path": "/Classifier.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = "MultiSpeakerBRIR"
version = "0.3"
def __init__(self):
super().__init__()
self.default_objects["Receiver"]["count"] = 2
#self.default_data["IR"] = 1
self.conditions["must have 2 Receivers"] = lambda name, fixed, variances, count: name != "Receiver" or c... | code_fim | medium | {
"lang": "python",
"repo": "mberz/python-sofa",
"path": "/src/sofa/conventions/MultiSpeakerBRIR.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>class MultiSpeakerBRIR(SimpleFreeFieldHRIR):
name = "MultiSpeakerBRIR"
version = "0.3"
def __init__(self):
super().__init__()
self.default_objects["Receiver"]["count"] = 2
#self.default_data["IR"] = 1
self.conditions["must have 2 Receivers"] = lambda name, fix... | code_fim | medium | {
"lang": "python",
"repo": "mberz/python-sofa",
"path": "/src/sofa/conventions/MultiSpeakerBRIR.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> fs.put(LOCAL_OUTPUT_DIR, GCS_OUTPUT_DIR, recursive=True)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--gcs_bucket",
type=str,
help=(
"The name of the gcs bucket that will contain the saved models, "
"chec... | code_fim | hard | {
"lang": "python",
"repo": "richford/hbn-pod2-qc",
"path": "/docker/dl-integrated-gradients-gcp/ig/ig/integrated_gradients.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anudeepdaggupati/hello-world- path: /b.py
import random
a=input("enter 'r' to roll the dice and 'q' to quit")
while True:
if (a=="r"):
print<|fim_suffix|>)
exit()
else:
print("give either 'r' or 'q'")<|fim_middle|>(random.randint(1,6))
elif(a=="q"):
print("bye!" | code_fim | easy | {
"lang": "python",
"repo": "anudeepdaggupati/hello-world-",
"path": "/b.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(random.randint(1,6))
elif(a=="q"):
print("bye!")
exit()
else:
print("give either 'r' or 'q'")<|fim_prefix|># repo: anudeepdaggupati/hello-world- path: /b.py
import random
a=input("enter 'r' to roll the dice <|fim_middle|>and 'q' to quit")
while True:
if (a=="r"):
print | code_fim | easy | {
"lang": "python",
"repo": "anudeepdaggupati/hello-world-",
"path": "/b.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
df = pd.concat({'num_missing_values':df.isnull().sum(), 'pct_missing_values':df.isnull().mean().round(4)}, axis=1)
)
return df<|fim_prefix|># repo: CaraFJ/Utility path: /missing_value_count_and_percent.py
def missing_value_count_and_percent(df):
"""
Return the number and percent o... | code_fim | medium | {
"lang": "python",
"repo": "CaraFJ/Utility",
"path": "/missing_value_count_and_percent.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(skipList) > 0:
mode = mode | TFileMerger.kSkipListed
if (len(acceptList) > 0):
print("Accept list is being ignored!!!")
for skipObject in skipList:
merger.AddObjectNames(skipObject)
elif len(acceptList) > 0:
mode = mode | ... | code_fim | hard | {
"lang": "python",
"repo": "aiola/alice-yale-hfjet",
"path": "/merging/MergeFiles.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def MergeFilesHadd(output, fileList, n=20):
cmd = ["hadd", "-n", str(n), output]
cmd.extend(fileList)
subprocess.call(cmd)<|fim_prefix|># repo: aiola/alice-yale-hfjet path: /merging/MergeFiles.py
#!/usr/bin/env python
from ROOT import TFileMerger
import subprocess
def MergeFiles(output... | code_fim | hard | {
"lang": "python",
"repo": "aiola/alice-yale-hfjet",
"path": "/merging/MergeFiles.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> failed = False
test_marker: rd.ActionDescription = self.find_action("sm_5_0")
action = test_marker.next
self.controller.SetFrameEvent(action.eventId, False)
failed = not self.test_debug_pixel(200, 200, "sm_5_0") or failed
test_marker: rd.ActionDescription ... | code_fim | hard | {
"lang": "python",
"repo": "baldurk/renderdoc",
"path": "/util/test/tests/D3D12/D3D12_Resource_Mapping_Zoo.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
name_of_selected_count = self.lst_counts.get(int(self.lst_counts.curselection()[0]))
except IndexError:
return
os.remove(join("data", name_of_selected_count))
for i in range(self.lst_counts.size()):
if self.lst_counts.get(i) == nam... | code_fim | hard | {
"lang": "python",
"repo": "SimonMaracine/Counter",
"path": "/src/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def save_to_file(self, name: str) -> bool:
try:
with open(join("data", name), "w") as file:
file.write(str(self.var_count.get()))
return True
except FileNotFoundError:
os.mkdir("data")
messagebox.showerror("Save Error"... | code_fim | hard | {
"lang": "python",
"repo": "SimonMaracine/Counter",
"path": "/src/main.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.