text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>while (cap.isOpened()):
cnt += 1
ret, frame = cap.read()
cv2.imwrite("frame{}.jpg".format(cnt), frame)
if cv2.waitKey(20) == 27 or 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()<|fim_prefix|># repo: ssddawei/badminton_shuttle_in_out path: /video2snaps.py
import cv2... | code_fim | medium | {
"lang": "python",
"repo": "ssddawei/badminton_shuttle_in_out",
"path": "/video2snaps.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def overstriding_audio():
os.system('mpg321 overstriding2.mp3')<|fim_prefix|># repo: bearkent/running_with_python path: /Audio.py
import os
import pyttsx3
engine = pyttsx3.init()
def speed_audio(speed):
global engine
engine.say("speed is {0}.".format(speed))
engine.runAndWait()
def hee... | code_fim | hard | {
"lang": "python",
"repo": "bearkent/running_with_python",
"path": "/Audio.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bearkent/running_with_python path: /Audio.py
import os
import pyttsx3
engine = pyttsx3.init()
def speed_audio(speed):
global engine
engine.say("speed is {0}.".format(speed))
engine.runAndWait()
def heel_strike_audio():
os.system('mpg321 heel_striking.mp3')
def increase_tilt_au... | code_fim | medium | {
"lang": "python",
"repo": "bearkent/running_with_python",
"path": "/Audio.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def cadence_audio():
os.system('mpg321 cadence.mp3')
def overstriding_audio():
os.system('mpg321 overstriding2.mp3')<|fim_prefix|># repo: bearkent/running_with_python path: /Audio.py
import os
import pyttsx3
engine = pyttsx3.init()
def speed_audio(speed):
global engine
engine.say("spee... | code_fim | hard | {
"lang": "python",
"repo": "bearkent/running_with_python",
"path": "/Audio.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ld([('heading', wagtail.blocks.StructBlock([('heading', wagtail.blocks.ChoiceBlock(choices=[('h1', 'H1'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4'), ('h5', 'H5'), ('h6', 'H6')], label='Header Size')), ('text', wagtail.blocks.CharBlock(label='Text', max_length=50))])), ('rich_text', brueckio.pages.blocks.Ri... | code_fim | hard | {
"lang": "python",
"repo": "bruecksen/brueckio",
"path": "/brueckio/pages/migrations/0007_auto_20200128_1102.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bruecksen/brueckio path: /brueckio/pages/migrations/0007_auto_20200128_1102.py
# Generated by Django 2.2.9 on 2020-01-28 11:02
import brueckio.pages.blocks
from django.db import migrations
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
class Migration(migrations.Migra... | code_fim | hard | {
"lang": "python",
"repo": "bruecksen/brueckio",
"path": "/brueckio/pages/migrations/0007_auto_20200128_1102.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> avg = moving_average(np.ones(10),4)
assert np.any(np.isnan(avg))
assert np.allclose(avg[3],1.0)
return<|fim_prefix|># repo: gassmoeller/2018-AGU-workshop path: /data_analysis/test_moving_avg.py
import numpy as np
from .data_analysis import moving_average
<|fim_middle|>def test_moving_av... | code_fim | easy | {
"lang": "python",
"repo": "gassmoeller/2018-AGU-workshop",
"path": "/data_analysis/test_moving_avg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gassmoeller/2018-AGU-workshop path: /data_analysis/test_moving_avg.py
import numpy as np
from .data_analysis import moving_average
<|fim_suffix|> avg = moving_average(np.ones(10),4)
assert np.any(np.isnan(avg))
assert np.allclose(avg[3],1.0)
return<|fim_middle|>def test_moving_av... | code_fim | easy | {
"lang": "python",
"repo": "gassmoeller/2018-AGU-workshop",
"path": "/data_analysis/test_moving_avg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#/<title>を指定することで、index.htmlのtitle=content.titleを指定して、
@app.route("/<title>", methods=["GET"])
def show_content(title):
"""
:param title:modelに対するクエリ文字列
:return:
"""
# wikicontentテーブルから、titleでフィルタ(where指定して取得) firstは1行だけ取得するの意味。
# all()だと、結果を複数リスト形式で取得する。
content = WikiContent.... | code_fim | hard | {
"lang": "python",
"repo": "yukke12/python_study",
"path": "/flask_test/src/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yukke12/python_study path: /flask_test/src/app.py
# -*- coding: utf-8 -*-
"""
Using SQLAlchemy and Flask get db record.(GET)
"""
from flask import Flask, render_template, abort
from flaski.models import WikiContent
<|fim_suffix|>#/<title>を指定することで、index.htmlのtitle=content.titleを指定して、
@app.route... | code_fim | hard | {
"lang": "python",
"repo": "yukke12/python_study",
"path": "/flask_test/src/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>BuyItemFormSet = inlineformset_factory(Buy, BuyItem, BuyItemForm,
fields=['item', 'buy_amount', 'force_end'],
max_num=1000, extra=1
)<|fim_prefix|># repo: zwolf21/StockAdmin1.11 path: /StockAdmin/buy/forms.py
from django import forms
from django.forms import inlineformset_factory
from .models import B... | code_fim | hard | {
"lang": "python",
"repo": "zwolf21/StockAdmin1.11",
"path": "/StockAdmin/buy/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def clean_buy_amount(self):
buy_amount = self.cleaned_data['buy_amount']
if buy_amount <1:
raise forms.ValidationError('1 이상의 값이 필요합니다.')
pass
return buy_amount
BuyItemFormSet = inlineformset_factory(Buy, BuyItem, BuyItemForm,
fields=['item', 'buy_amount', 'force_end'],
max_num=1000, extr... | code_fim | medium | {
"lang": "python",
"repo": "zwolf21/StockAdmin1.11",
"path": "/StockAdmin/buy/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zwolf21/StockAdmin1.11 path: /StockAdmin/buy/forms.py
from django import forms
from django.forms import inlineformset_factory
from .models import Buy, BuyItem, BuyStock
class BuyItemForm(forms.ModelForm):
class Meta:
model = BuyItem
fields = 'item', 'buy_amount', 'force_end',
<|fim_suff... | code_fim | hard | {
"lang": "python",
"repo": "zwolf21/StockAdmin1.11",
"path": "/StockAdmin/buy/forms.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Uses the phonenumbers library to try and parse the phone number and
check for it's validity. """
try:
z = phonenumbers.parse(value, None)
except phonenumbers.NumberParseException:
raise forms.ValidationError("Enter a valid phone number.")
if not phonenumbers.is_val... | code_fim | medium | {
"lang": "python",
"repo": "Govexec/django-formulaic",
"path": "/formulaic/validators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
z = phonenumbers.parse(value, None)
except phonenumbers.NumberParseException:
raise forms.ValidationError("Enter a valid phone number.")
if not phonenumbers.is_valid_number(z):
raise forms.ValidationError("Enter a valid phone number.")<|fim_prefix|># repo: Govexec... | code_fim | medium | {
"lang": "python",
"repo": "Govexec/django-formulaic",
"path": "/formulaic/validators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Govexec/django-formulaic path: /formulaic/validators.py
from bs4 import BeautifulSoup
from django import forms
import phonenumbers
def validate_mixed_content(value):
"""
Validate content to avoid mixed content warnings
"""
targets = (
{"tag": "img", "attr": "src"},
... | code_fim | medium | {
"lang": "python",
"repo": "Govexec/django-formulaic",
"path": "/formulaic/validators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#%% Learning history
# Number of steps required to reach the goal
hist = pd.read_csv('hist.csv')
hist = hist.rolling(25).mean()
plt.plot(hist['steps'])
plt.show()
#%%<|fim_prefix|># repo: krzysztofarendt/qlearning path: /summary.py
#%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as... | code_fim | hard | {
"lang": "python",
"repo": "krzysztofarendt/qlearning",
"path": "/summary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krzysztofarendt/qlearning path: /summary.py
#%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from agent import Agent
#%% Q-table
# Plot max Q for each position
q = np.load('qtables/agent1.npy')
q = np.max(q, axis=2)
fig, ax = plt.subplots(1, 1)
sn... | code_fim | hard | {
"lang": "python",
"repo": "krzysztofarendt/qlearning",
"path": "/summary.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#%% Position heat map
# Plot number of times each tile was visited
bhist = np.load('board_hist.npy')
fig, ax = plt.subplots(1, 1)
sns.heatmap(np.flip(bhist, 1).transpose(), annot=True)
ax.set_title(f'sum={bhist.sum()}')
plt.show()
#%% Learning history
# Number of steps required to reach the goal
hist = p... | code_fim | hard | {
"lang": "python",
"repo": "krzysztofarendt/qlearning",
"path": "/summary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = translator.translate(str(s), src='en', dest='ur')
print(x.text)<|fim_prefix|># repo: javaid100/Speech-Recognition path: /Commands for Translator.py
# =============== For Translator ================================
<|fim_middle|>from googletrans import Translator
sentence = str(input("The secte... | code_fim | hard | {
"lang": "python",
"repo": "javaid100/Speech-Recognition",
"path": "/Commands for Translator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: javaid100/Speech-Recognition path: /Commands for Translator.py
# =============== For Translator ================================
from googletrans import Translator
<|fim_suffix|>tr_sen = translator.translate(sentence, src='ur', dest='en')
s = tr_sen
print(tr_sen.text)
x = translator.tr... | code_fim | medium | {
"lang": "python",
"repo": "javaid100/Speech-Recognition",
"path": "/Commands for Translator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>sheet.title = '蔡徐坤篮球'
sheet.cell(row=1, column=1, value='名称')
sheet.cell(row=1, column=2, value='地址')
sheet.cell(row=1, column=3, value='描述')
sheet.cell(row=1, column=4, value='观看次数')
sheet.cell(row=1, column=5, value='弹幕数')
sheet.cell(row=1, column=6, value='发布时间')
workbook.save('蔡徐坤篮球.xlsx')<|fim_pref... | code_fim | easy | {
"lang": "python",
"repo": "sunxiao9202/LearnPython",
"path": "/com/learn/python/excel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>sheet.cell(row=1, column=1, value='名称')
sheet.cell(row=1, column=2, value='地址')
sheet.cell(row=1, column=3, value='描述')
sheet.cell(row=1, column=4, value='观看次数')
sheet.cell(row=1, column=5, value='弹幕数')
sheet.cell(row=1, column=6, value='发布时间')
workbook.save('蔡徐坤篮球.xlsx')<|fim_prefix|># repo: sunxiao9202... | code_fim | easy | {
"lang": "python",
"repo": "sunxiao9202/LearnPython",
"path": "/com/learn/python/excel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunxiao9202/LearnPython path: /com/learn/python/excel.py
import openpyxl
workbook = openpyxl.Workbook()
<|fim_suffix|>sheet.cell(row=1, column=1, value='名称')
sheet.cell(row=1, column=2, value='地址')
sheet.cell(row=1, column=3, value='描述')
sheet.cell(row=1, column=4, value='观看次数')
sheet.cell(row=... | code_fim | easy | {
"lang": "python",
"repo": "sunxiao9202/LearnPython",
"path": "/com/learn/python/excel.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> h=1e-4
grad = np.zeros_like(x)
it = np.nditer(x, flags=['multi_index'])
while not it.finished:
idx = it.multi_index
tmp_val = x[idx]
x[idx] = tmp_val + h
fxh1 = f(x)
x[idx] = tmp_val - h
fxh2 = f(x)
grad[idx] = (fxh1 - fxh2) / (2*h)
... | code_fim | medium | {
"lang": "python",
"repo": "foryou7242/smart_study",
"path": "/deep_learning/foryou7242/chapter4/numerical_diff.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: foryou7242/smart_study path: /deep_learning/foryou7242/chapter4/numerical_diff.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 4 17:37:19 2018
@author: son
"""
import numpy as np
import matplotlib.pylab as plt
<|fim_suffix|> h=1e-4
grad = np.zeros_like(x)
i... | code_fim | medium | {
"lang": "python",
"repo": "foryou7242/smart_study",
"path": "/deep_learning/foryou7242/chapter4/numerical_diff.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
number_features=None,
n_estimators=10,
max_depth=None,
percent_features=0.5,
threshold=-np.inf,
n_jobs=-1,
random_seed=0,
**kwargs
):
parameters = {
"number_features": number_features,
"n_esti... | code_fim | medium | {
"lang": "python",
"repo": "nsood-ai/evalml",
"path": "/evalml/pipelines/components/transformers/feature_selection/rf_classifier_feature_selector.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>focus = 0
while True:
if is_sweeping:
i = (i+1) % max_focus
if i == 0:
is_sweeping = False
is_fine_tuning = True
ft_measurements = []
ft_wb_i = 0
measurements = np.array(measurements)
measurements = measurements[(... | code_fim | hard | {
"lang": "python",
"repo": "half-potato/liquidlens",
"path": "/calibrate_focus.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ft_wb_i = 0
ft_measurements = []
focus = 0
while True:
if is_sweeping:
i = (i+1) % max_focus
if i == 0:
is_sweeping = False
is_fine_tuning = True
ft_measurements = []
ft_wb_i = 0
measurements = np.array(measurements)
... | code_fim | hard | {
"lang": "python",
"repo": "half-potato/liquidlens",
"path": "/calibrate_focus.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: half-potato/liquidlens path: /calibrate_focus.py
import cv2
from scipy import ndimage
import os, sys
import numpy as np
dev = int(sys.argv[1])
cap = cv2.VideoCapture(dev)
print(cap.isOpened())
os.system("v4l2-ctl -d %i -c focus_auto=0" % dev)
i = 0
max_focus = 255
step_size = 1
fine_tuning_iter... | code_fim | hard | {
"lang": "python",
"repo": "half-potato/liquidlens",
"path": "/calibrate_focus.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
# start the Native App authentication process
tokens = do_native_app_authentication(CLIENT_ID, REDIRECT_URI)
transfer_token = tokens["transfer.api.globus.org"]["access_token"]
authorizer = AccessTokenAuthorizer(access_token=transfer_token)
transfer = TransferClient(autho... | code_fim | hard | {
"lang": "python",
"repo": "globus/native-app-examples",
"path": "/example_local_server.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: globus/native-app-examples path: /example_local_server.py
#!/usr/bin/env python
import webbrowser
from globus_sdk import AccessTokenAuthorizer, NativeAppAuthClient, TransferClient
from utils import is_remote_session, start_local_server
CLIENT_ID = "1b0dc9d3-0a2b-4000-8bd6-90fb6a79be86"
REDIRE... | code_fim | medium | {
"lang": "python",
"repo": "globus/native-app-examples",
"path": "/example_local_server.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> server.shutdown()
# return a set of tokens, organized by resource server name
return token_response.by_resource_server
def main():
# start the Native App authentication process
tokens = do_native_app_authentication(CLIENT_ID, REDIRECT_URI)
transfer_token = tokens["transfer.api.... | code_fim | hard | {
"lang": "python",
"repo": "globus/native-app-examples",
"path": "/example_local_server.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> for xvar in xvar_names:
y=xvar
x=xvar_names.copy()
x.remove(xvar)
formula = "{} ~ {} + 1".format(y, ' + '.join(x))
rsq=smf.ols(formula, data=x_vars).fit().rsquared
if rsq==1: vif=np.inf
else: vif=round(1/(1-rsq),10)
x_var_col.append(x... | code_fim | hard | {
"lang": "python",
"repo": "sarbadal/linear-regression",
"path": "/vif_lreg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sarbadal/linear-regression path: /vif_lreg.py
import statsmodels.formula.api as smf
import pandas as pd
import numpy as np
def vif_cal(data, y):
""" Code for VIF Calculation. Writing a function to calculate the VIF values """
x_vars=data.drop([y], axis=1)
xvar_names=x_vars.colum... | code_fim | hard | {
"lang": "python",
"repo": "sarbadal/linear-regression",
"path": "/vif_lreg.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> str_len = str_gap + 2 + 7 + 3 + 6 - len(' VIF Summary END ')
star_str = '*'*int(str_len/2)
str_to_print = ''.join((star_str,' VIF Summary END ',star_str))
print(str_to_print)
vif_df = pd.DataFrame({'x_variable': x_var_col, 'vif': vif_list})
vif_df = vif_df[['x_variable', 'vif']]
... | code_fim | hard | {
"lang": "python",
"repo": "sarbadal/linear-regression",
"path": "/vif_lreg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JustMeliyu/training path: /come_on_fisrt/services/public.py
def class_to_dict(obj):
dic = {}
dic.update(obj.__dict__)
if "_sa_instance_state" in<|fim_suffix|> del dic['_sa_instance_state']
return dic<|fim_middle|> dic:
print dic['_sa_instance_state']
| code_fim | easy | {
"lang": "python",
"repo": "JustMeliyu/training",
"path": "/come_on_fisrt/services/public.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> del dic['_sa_instance_state']
return dic<|fim_prefix|># repo: JustMeliyu/training path: /come_on_fisrt/services/public.py
def class_to_dict(obj):
dic = {}
dic.up<|fim_middle|>date(obj.__dict__)
if "_sa_instance_state" in dic:
print dic['_sa_instance_state']
| code_fim | medium | {
"lang": "python",
"repo": "JustMeliyu/training",
"path": "/come_on_fisrt/services/public.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'butter'))
# Output: I love butter and bread<|fim_prefix|># repo: cherryff911/Python path: /output formatting.py
print('I love {0} and {1}'.format('bread','b<|fim_middle|>utter'))
# Output: I love bread and butter
print('I love {1} and {0}'.format('bread', | code_fim | medium | {
"lang": "python",
"repo": "cherryff911/Python",
"path": "/output formatting.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cherryff911/Python path: /output formatting.py
print('I love {0} and {1}'.format('bread','b<|fim_suffix|>
print('I love {1} and {0}'.format('bread','butter'))
# Output: I love butter and bread<|fim_middle|>utter'))
# Output: I love bread and butter
| code_fim | easy | {
"lang": "python",
"repo": "cherryff911/Python",
"path": "/output formatting.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cherryff911/Python path: /output formatting.py
print('I love {0} and {1}'.format('bread','butter'))
# Output: I love bread and butter
<|fim_suffix|>'butter'))
# Output: I love butter and bread<|fim_middle|>
print('I love {1} and {0}'.format('bread', | code_fim | easy | {
"lang": "python",
"repo": "cherryff911/Python",
"path": "/output formatting.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shinomi-lab/diffusion_tools path: /difftools/trial.py
from typing import Tuple, Dict
import difftools.maximization as dm
import difftools.algebra as da
import numpy as np
from joblib import Parallel, delayed
from numba import njit
from numba.pycc import CC
cc = CC("trial")
@cc.export("trial... | code_fim | hard | {
"lang": "python",
"repo": "shinomi-lab/diffusion_tools",
"path": "/difftools/trial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
The dictionary as:
- `sw-ims`: a list of the social welfare by an IM opt seed set under the IC model
- `sw-swms`: a list of the near maximums of social welfare for each utility distribution samples
- `im-seed`: an opt-seed by influence maximization
- `... | code_fim | hard | {
"lang": "python",
"repo": "shinomi-lab/diffusion_tools",
"path": "/difftools/trial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> serialized_data.save()
cache.set(address, serialized_data.data, 60)
return Response(serialized_data.data, status=status.HTTP_200_OK)
else:
return Response(serialized_data.errors, status=st... | code_fim | hard | {
"lang": "python",
"repo": "fisayoadegun/ipfinder",
"path": "/api/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fisayoadegun/ipfinder path: /api/views.py
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from django.core.cache import cache
from api.serializers import IPAddressSerializer, IPAddressGetSerializer
from api.models impor... | code_fim | hard | {
"lang": "python",
"repo": "fisayoadegun/ipfinder",
"path": "/api/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Andersen98/DisappTrks path: /LimitSetting/test/amsbLimitConfigBkgds_2016DEFGH.py
#!/usr/bin/env python
# Bkgd configuration file for limit-setting produced with makeANTables.py
backgrounds = {
'Fake2016DEFGH' : {
'N' : '1634',
'alpha' : '0.000558720822988',
},
'Elec2... | code_fim | hard | {
"lang": "python",
"repo": "Andersen98/DisappTrks",
"path": "/LimitSetting/test/amsbLimitConfigBkgds_2016DEFGH.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'Fake2016DEFGH_syst' : { # error on fake track rate assumption
'value' : str (1.0 + 8.58441294376118 / 100.0),
'background' : 'Fake2016DEFGH',
},
'Elec2016DEFGH_energy' : { # error on energy assumption
'value' : str (1.0 + 11.7113892531 / 100.0),
'background' ... | code_fim | hard | {
"lang": "python",
"repo": "Andersen98/DisappTrks",
"path": "/LimitSetting/test/amsbLimitConfigBkgds_2016DEFGH.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> c.execute(insertQuery, (self.equipement_id,self.ins_numero_install,self.nature_libelle,self.ins_nom))<|fim_prefix|># repo: Angui226/PaysDuSport path: /src/equipement_class.py
"""
Class Equipement
"""
class Equipement:
def __init__(self,obj):
"""
Create an objet Equipement
... | code_fim | hard | {
"lang": "python",
"repo": "Angui226/PaysDuSport",
"path": "/src/equipement_class.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Angui226/PaysDuSport path: /src/equipement_class.py
"""
Class Equipement
"""
class Equipement:
def __init__(self,obj):
"""
Create an objet Equipement
nature_libelle > nature of the equipement
ins_nom > name of the equipement
ins_numero_install > foreign... | code_fim | hard | {
"lang": "python",
"repo": "Angui226/PaysDuSport",
"path": "/src/equipement_class.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> types_all = WorkSheet.objects.filter(time__gte=start_date, time__lte=end_date)
t1 = types_all.filter(sheet_type=1).count()
t2 = types_all.filter(sheet_type=2).count()
t3 = types_all.filter(sheet_type=3).count()
t4 = types_all.filter(sheet_type=4).count()
t5 ... | code_fim | hard | {
"lang": "python",
"repo": "littlezhanzhan/ticket",
"path": "/count/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: selectstarofficial/AI-Detection path: /main.py
from detection_api import Detector
from detection_api.utils.parse_config import *
from detection_api.utils.utils import *
import cv2
import os
import os.path as osp
import numpy as np
from PIL import Image
from settings import Settings
import utils
f... | code_fim | hard | {
"lang": "python",
"repo": "selectstarofficial/AI-Detection",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> boxXML = Element.Element('box')
boxXML.set('label', b.label)
boxXML.set('xtl', str(xmin))
boxXML.set('ytl', str(ymin))
boxXML.set('xbr', str(xmax))
boxXML.set('ybr', str(ymax))
... | code_fim | hard | {
"lang": "python",
"repo": "selectstarofficial/AI-Detection",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @commands.group(description="Options related commands")
async def options(self, ctx):
"""Command to change Talos guild options. All of these only effect the current guild. Check """\
"""`^help options list` for a list of available options, and what they do."""
if ctx.in... | code_fim | hard | {
"lang": "python",
"repo": "CraftSpider/TalosBot",
"path": "/discord_talos/cogs/admin_commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CraftSpider/TalosBot path: /discord_talos/cogs/admin_commands.py
ctx.guild.members
)
if member_object is not None:
member = member_object.id
elif member.isnumeric():
member = int(member)
admin = list(filter(lambda x: x.user_id == membe... | code_fim | hard | {
"lang": "python",
"repo": "CraftSpider/TalosBot",
"path": "/discord_talos/cogs/admin_commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CraftSpider/TalosBot path: /discord_talos/cogs/admin_commands.py
ELS:
if name is None and level != "guild":
await ctx.send("You need to include both a name and either 'allow' or 'forbid'")
return
old_name = name
if level == "use... | code_fim | hard | {
"lang": "python",
"repo": "CraftSpider/TalosBot",
"path": "/discord_talos/cogs/admin_commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print ("\n欢迎使用天气通~\n如需帮助请输入 h / help")
while True:
instruction = input("\n请输入城市名或其他关键词:\n> ")
if instruction in d:
print (d[instruction])
his += '\n' + instruction + ' ' + d[instruction]
elif instruction == 'help' or instruction == 'h':
print (hel)
elif in... | code_fim | medium | {
"lang": "python",
"repo": "AIHackerTest/LazyCatTF_Py101-004",
"path": "/Chap1/project/weather_1.1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
instruction = input("\n请输入城市名或其他关键词:\n> ")
if instruction in d:
print (d[instruction])
his += '\n' + instruction + ' ' + d[instruction]
elif instruction == 'help' or instruction == 'h':
print (hel)
elif instruction == 'history':
print (hi... | code_fim | hard | {
"lang": "python",
"repo": "AIHackerTest/LazyCatTF_Py101-004",
"path": "/Chap1/project/weather_1.1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AIHackerTest/LazyCatTF_Py101-004 path: /Chap1/project/weather_1.1.py
from sys import *
script, weather_info = argv
d = {}
with open(weather_info, 'r', encoding = 'utf-8') as f:
for line in f.readlines():
l = line.strip().split(',')
d[l[0]] = l[1]
# line = f.readlin... | code_fim | hard | {
"lang": "python",
"repo": "AIHackerTest/LazyCatTF_Py101-004",
"path": "/Chap1/project/weather_1.1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wbkifun/my_stuff path: /code_examples.bak/PyCUDA/vecadd.py
#!/usr/bin/env python
import numpy as np
import numpy.linalg as la
import pycuda.driver as cuda
import pycuda.autoinit
<|fim_suffix|>
# allocate arrays with initialize
nx = 1000;
a = np.random.randn(nx).astype(np.float32)
b = np.random.... | code_fim | hard | {
"lang": "python",
"repo": "wbkifun/my_stuff",
"path": "/code_examples.bak/PyCUDA/vecadd.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# allocate arrays with initialize
nx = 1000;
a = np.random.randn(nx).astype(np.float32)
b = np.random.randn(nx).astype(np.float32)
c = np.zeros(nx, 'f')
c2 = np.zeros_like(c)
# allocate device arrays with memcpy
a_gpu = cuda.to_device(a)
b_gpu = cuda.to_device(b)
c_gpu = cuda.mem_alloc(c.nbytes)
# exec... | code_fim | hard | {
"lang": "python",
"repo": "wbkifun/my_stuff",
"path": "/code_examples.bak/PyCUDA/vecadd.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def parse_row(row):
year = row['ANHO']
from_date_str = '{} {}'.format(row['FECHA_INIPREC'], year)
to_date_str = '{} {}'.format(row['FECHA_FINPREC'], year)
from_date = to_date_object(from_date_str)
to_date = to_date_object(to_date_str)
zones = parse_zones(row)
return {
'... | code_fim | hard | {
"lang": "python",
"repo": "j-burgos/gasolinasv-data",
"path": "/import.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> central = {
'name': 'central',
'prices': get_zone_prices(row, 'ZCE'),
}
western = {
'name': 'western',
'prices': get_zone_prices(row, 'ZOC'),
}
eastern = {
'name': 'eastern',
'prices': get_zone_prices(row, 'ZOR'),
}
return [
... | code_fim | hard | {
"lang": "python",
"repo": "j-burgos/gasolinasv-data",
"path": "/import.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-burgos/gasolinasv-data path: /import.py
#!/usr/bin/env python
from datetime import datetime
import csv
import json
month_mapping = {
'ene': 'Jan',
'feb': 'Feb',
'mar': 'Mar',
'abr': 'Apr',
'may': 'May',
'jun': 'Jun',
'jul': 'Jul',
'ago': 'Aug',
'sep': 'Sep... | code_fim | hard | {
"lang": "python",
"repo": "j-burgos/gasolinasv-data",
"path": "/import.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return utils.get_dtypes(data_name, dtypes_file_path, base_path=base_path)
# load datasets
def get_raw_dataset(data_name: str, base_path: str = '') -> pd.DataFrame:
assert data_name in Datasets.list_all()
urls_by_year: dict = urls_map[data_name]
df_acc = None
for year in urls_by_year... | code_fim | medium | {
"lang": "python",
"repo": "thomas-marquis/datascience-securite-routiere",
"path": "/lib/data/accidents/loaders.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enmorse/PythonCrashCourse2ndEdition.3-9.DinnerGuests.py path: /Main.py
# Make a list that includes at least three people you
# would like to invite to dinner.
# Then use your list to print a message to each person,
# inviting them to dinner.
idol_guest_list = ["arnold schwarzenegger", "babe rut... | code_fim | hard | {
"lang": "python",
"repo": "enmorse/PythonCrashCourse2ndEdition.3-9.DinnerGuests.py",
"path": "/Main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Use del to remove the last two items from your list,
# so that you have an empty list. Print your list to make
# sure you actually have an empty list at the end of
# your program.
del idol_guest_list[0]
print(idol_guest_list)
del idol_guest_list[0]
print(idol_guest_list)
# Working with one of the p... | code_fim | hard | {
"lang": "python",
"repo": "enmorse/PythonCrashCourse2ndEdition.3-9.DinnerGuests.py",
"path": "/Main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(invitation5)
print(invitation6)
print(invitation7)
print(invitation8)
print(invitation9)
print(invitation10)
# You just found out that your new dinner table won't
# arrive in time for the dinner, and you have space for
# only two guests.
# Start with your program from Exercise 3 - 6.
# Add a new ... | code_fim | hard | {
"lang": "python",
"repo": "enmorse/PythonCrashCourse2ndEdition.3-9.DinnerGuests.py",
"path": "/Main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vivekjoshi-96/Interview_questions path: /HashedInP1.py
"""" A ride in an Amusement park starts at the ground level. it moves either up or down.
Write a program to count the number of sinks. A raise is defined as a move above ground from start position
followed by any string of moves up or down un... | code_fim | medium | {
"lang": "python",
"repo": "vivekjoshi-96/Interview_questions",
"path": "/HashedInP1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> moves = 'HLLHHHHLLLLLHHHHHHLLLLLLLLHHHHLLHH'
curr_pos = 0
sinks = 0
for letter in moves:
if letter == 'H':
curr_pos += 1
elif letter == 'L':
curr_pos -= 1
if curr_pos == -1:
sinks += 1
else:
print("Inva... | code_fim | medium | {
"lang": "python",
"repo": "vivekjoshi-96/Interview_questions",
"path": "/HashedInP1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # MT_subtypeMatching__
self.obj42196.MT_subtypeMatching__.setValue(('True', 0))
self.obj42196.MT_subtypeMatching__.config = 0
# MT_pre__classtype
self.obj42196.MT_pre__classtype.setValue('\n#===============================================================================\n# This code i... | code_fim | hard | {
"lang": "python",
"repo": "levilucio/SyVOLT",
"path": "/UMLRT2Kiltera_MM/Properties/Multiplicity/models/ConditionSet1orMoreConditionBranchPart1_Complete_MDL.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # MT_pre__classtype
self.obj42196.MT_pre__classtype.setValue('\n#===============================================================================\n# This code is executed when evaluating if a node shall be matched by this rule.\n# You can access the value of the current node\'s attribute value by: ... | code_fim | hard | {
"lang": "python",
"repo": "levilucio/SyVOLT",
"path": "/UMLRT2Kiltera_MM/Properties/Multiplicity/models/ConditionSet1orMoreConditionBranchPart1_Complete_MDL.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: levilucio/SyVOLT path: /UMLRT2Kiltera_MM/Properties/Multiplicity/models/ConditionSet1orMoreConditionBranchPart1_Complete_MDL.py
"""
__ConditionSet1orMoreConditionBranchPart1_Complete_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modi... | code_fim | hard | {
"lang": "python",
"repo": "levilucio/SyVOLT",
"path": "/UMLRT2Kiltera_MM/Properties/Multiplicity/models/ConditionSet1orMoreConditionBranchPart1_Complete_MDL.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax2.set_xticklabels(ax2.get_xticks(), fontProperties)
ax2.set_yticklabels(ax2.get_yticks(), fontProperties)
ax3.set_xticklabels(ax3.get_xticks(), fontProperties)
ax3.set_yticklabels(ax3.get_yticks(), fontProperties)
ax1.plot(offsetFAST,FAST4,'o... | code_fim | hard | {
"lang": "python",
"repo": "byuflowlab/waked-loads",
"path": "/make_plots/yy_plotREVISED.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax1.set_xticks((-3.,-2.,-1.,0.,1.,2.,3.))
ax1.set_xticklabels(('-3','-2','-1','0','1','2','3'))
ax2.set_xticks((-3.,-2.,-1.,0.,1.,2.,3.))
ax2.set_xticklabels(('-3','-2','-1','0','1','2','3'))
ax3.set_xticks((-3.,-2.,-1.,0.,1.,2.,3.))
... | code_fim | hard | {
"lang": "python",
"repo": "byuflowlab/waked-loads",
"path": "/make_plots/yy_plotREVISED.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: byuflowlab/waked-loads path: /make_plots/yy_plotREVISED.py
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
"""TI = 0.11"""
# #FAST
# FAST4 = np.array([1.35137908, 1.71541373, 1.98567876, 1.3984026 , 0.94911793,
# ... | code_fim | hard | {
"lang": "python",
"repo": "byuflowlab/waked-loads",
"path": "/make_plots/yy_plotREVISED.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MurrayCode/CodeAcademyMLCourseWork path: /K-MeansClustering/KMC7.py
import codecademylib3_seaborn
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.cluster import KMeans
# From sklearn.cluster, import KMeans class
iris = datasets.load_iris()
<|fim_suffix|># Use KMeans() ... | code_fim | easy | {
"lang": "python",
"repo": "MurrayCode/CodeAcademyMLCourseWork",
"path": "/K-MeansClustering/KMC7.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Use KMeans() to create a model that finds 3 clusters
model = KMeans(n_clusters = 3)
# Use .fit() to fit the model to samples
model.fit(samples)
# Use .predict() to determine the labels of samples
print(model.predict(samples))<|fim_prefix|># repo: MurrayCode/CodeAcademyMLCourseWork path: /K-MeansCluste... | code_fim | easy | {
"lang": "python",
"repo": "MurrayCode/CodeAcademyMLCourseWork",
"path": "/K-MeansClustering/KMC7.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>""" file = open("input1","w")
readfile.writelines(readfile)
file.close() """<|fim_prefix|># repo: sebastianvarona/Cursos path: /Python/I:O/po.py
file = open("input1","r")
i = int(input('Digit the number of the line that you want to change: '))-1
text = input('Write the text you want to append: ')
list_... | code_fim | easy | {
"lang": "python",
"repo": "sebastianvarona/Cursos",
"path": "/Python/I:O/po.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>readfile.writelines(readfile)
file.close() """<|fim_prefix|># repo: sebastianvarona/Cursos path: /Python/I:O/po.py
file = open("input1","r")
i = int(input('Digit the number of the line that you want to change: '))-1
text = input('Write the text you want to append: ')
list_of_lines = []
for line in file:... | code_fim | easy | {
"lang": "python",
"repo": "sebastianvarona/Cursos",
"path": "/Python/I:O/po.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebastianvarona/Cursos path: /Python/I:O/po.py
file = open("input1","r")
i = int(input('Digit the number of the line that you want to change: '))-1
text = input('Write the text you want to append: ')
list_of_lines = []
for line in file:
counter = 1
element = str(counter)+'. '+ line.strip... | code_fim | easy | {
"lang": "python",
"repo": "sebastianvarona/Cursos",
"path": "/Python/I:O/po.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def mod_filterbank(signal, fs, modf):
"""Implementation of the EPSM-filterbank.
Parameters
----------
signal : ndarray
Temporal envelope of a signal
fs : int
Sampling frequency of the signal.
modf : array_like
List of the center frequencies of the modulatio... | code_fim | hard | {
"lang": "python",
"repo": "Maksymdelta/pambox",
"path": "/pambox/central.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
if not m:
m = self.m
else:
self.m = m
if sigma_s:
errfc = lambda p, snr, data: self._snrenv_to_pc(snrenv,
p[0],
... | code_fim | hard | {
"lang": "python",
"repo": "Maksymdelta/pambox",
"path": "/pambox/central.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Maksymdelta/pambox path: /pambox/central.py
# -*- coding: utf-8 -*-
"""
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy import pi
try:
_ = np.use_fastnumpy
from numpy.fft import fft, ifft, rfft, irfft
except AttributeError:
from sci... | code_fim | hard | {
"lang": "python",
"repo": "Maksymdelta/pambox",
"path": "/pambox/central.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># ### max,min,argmax,argmin
#
# These are useful methods for finding max or min values. Or to find their index locations using argmin or argmax
# argmax and argmin return the index of the max and min vals
print(ranarr)
print(ranarr.max())
print(ranarr.argmax())
print(ranarr.min())
print(ranarr.argmin())
... | code_fim | hard | {
"lang": "python",
"repo": "antichown/udemy_courses",
"path": "/data_science_py/5_numpy/np_arrays.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># ### randint
# Return random integers from `low` (inclusive) to `high` (exclusive).
print(np.random.randint(1,100))
# will give 10 integers
print(np.random.randint(1,100,10))
# ## Array Attributes and Methods
#
# Let's discuss some useful attributes and methods or an array:
arr = np.arange(25)
ranarr =... | code_fim | hard | {
"lang": "python",
"repo": "antichown/udemy_courses",
"path": "/data_science_py/5_numpy/np_arrays.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antichown/udemy_courses path: /data_science_py/5_numpy/np_arrays.py
#!/usr/bin/env python
# coding: utf-8
# ___
#
# <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
# ___
# # NumPy
#
# NumPy (or Numpy) is a Linear Algebra Library for Python, the reason it is s... | code_fim | hard | {
"lang": "python",
"repo": "antichown/udemy_courses",
"path": "/data_science_py/5_numpy/np_arrays.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>py = Pytrack()
l76 = L76GNSS(py, timeout=0)
# Temperature sensor
ow = OneWire(Pin('P9'))
temp = DS18X20(ow)
ds = DeepSleep()
while True:
# Get coordinates. Timeout in case of no coverage
coord = l76.coordinates()
# Get temperature
tmp = temp.read_temp_async()
temp.start_convertion()
print(str... | code_fim | medium | {
"lang": "python",
"repo": "vbe0/trackandfind_lopy",
"path": "/mainthomas.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vbe0/trackandfind_lopy path: /mainthomas.py
from startiot import Startiot
from L76GNSS import L76GNSS
from pytrack import Pytrack
import pycom
import time
from machine import Pin
from lib.onewire import DS18X20
from lib.onewire import OneWire
from lib.deepsleep import DeepSleep
pycom.heartbeat(Fa... | code_fim | hard | {
"lang": "python",
"repo": "vbe0/trackandfind_lopy",
"path": "/mainthomas.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pycom.rgbled(0x000000)
#iot.send(str(py.read_battery_voltage()) + " " + str(coord) + " " + str(tmp))
py.go_to_sleep(2)
print("Waking up...")<|fim_prefix|># repo: vbe0/trackandfind_lopy path: /mainthomas.py
from startiot import Startiot
from L76GNSS import L76GNSS
from pytrack import Pytrack
import py... | code_fim | hard | {
"lang": "python",
"repo": "vbe0/trackandfind_lopy",
"path": "/mainthomas.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: programlamaogretimi/Metin-Tabanli-Programlama-Etkinlik02 path: /bilgiislemseldusunme-ikiKatliEv-oruntu.py
from etkinlik import *
for i in range(2):
for j in range(4):
#kare çizimi
ciz(50) #50 birim kenar çiz
solaDon() #sol yöne dön
#bir sonraki katın çizilmeye ... | code_fim | medium | {
"lang": "python",
"repo": "programlamaogretimi/Metin-Tabanli-Programlama-Etkinlik02",
"path": "/bilgiislemseldusunme-ikiKatliEv-oruntu.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paqito/wordslearn path: /wordslearn/migrations_oldOne/0001_initial.py
# Generated by Django 3.0.4 on 2020-05-10 20:42
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMod... | code_fim | hard | {
"lang": "python",
"repo": "paqito/wordslearn",
"path": "/wordslearn/migrations_oldOne/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>d(choices=[('noun', 'Noun'), ('verb', 'Verb'), ('adjective', 'Adjective'), ('adverb', 'Adverb'), ('other', 'Other')], help_text='Select type of word', max_length=30)),
('wordsEng', models.ManyToManyField(to='wordslearn.WordEng')),
],
options={
'order... | code_fim | hard | {
"lang": "python",
"repo": "paqito/wordslearn",
"path": "/wordslearn/migrations_oldOne/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.rename(best_model, best_model.replace(".h5", "_best.h5"))
print("train done. best epoch: %d, best: f1: %f, model path: %s" % (best_epoch, best_f1, best_model))
file.write("train done. best epoch: %d, best: f1: %f, model path: %s\n" % (best_epoch, best_f1, best_model))
CallBack.on_train_... | code_fim | hard | {
"lang": "python",
"repo": "18855482286/AMANet",
"path": "/src/tax_task.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 18855482286/AMANet path: /src/tax_task.py
#!/usr/bin/env python
# encoding: utf-8
import os
import time
import argparse
import sys
sys.path.append('..')
sys.path.append('.')
import tensorflow as tf
from sklearn.utils import shuffle
from keras.callbacks import TensorBoard
from keras.models impo... | code_fim | hard | {
"lang": "python",
"repo": "18855482286/AMANet",
"path": "/src/tax_task.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# evaluate
def model_eval(model, dataset, config, type="eval"):
eval_real_output = []
eval_pred_output_prob = []
eval_pred_output = []
data_size = len(dataset)
outputs = [model.get_layer('output').output]
layer_model = Model(inputs=model.input, outputs=outputs)
print("#######... | code_fim | hard | {
"lang": "python",
"repo": "18855482286/AMANet",
"path": "/src/tax_task.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Versiani-R/Financial-System path: /modules/database.py
class Database():
def __init__(self, database_name):
# name needs to have '.txt' at the end
self.database_name = database_name
# appends a new data to the database
def write(self, data):
file = open(sel... | code_fim | hard | {
"lang": "python",
"repo": "Versiani-R/Financial-System",
"path": "/modules/database.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
'total': total,
'painted_total': painted_total,
'profits': profits,
'debts': debts
}
# TODO: Instead of raising an exception, think of another method to show case the error
... | code_fim | hard | {
"lang": "python",
"repo": "Versiani-R/Financial-System",
"path": "/modules/database.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> create_results_table(axs[0, 0], team, fixtures, team_color, other_team_color, neutral_color, unknown_color)
create_league_table(axs[0, 1], this_season, team, team_color, neutral_color, args.venue, args.half)
title = '{} {}: {}'.format(league.country, league.name, team.name)
... | code_fim | hard | {
"lang": "python",
"repo": "abetts155/Projects",
"path": "/Betting/show_form.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abetts155/Projects path: /Betting/show_form.py
from argparse import ArgumentParser, Namespace
from cli.cli import (add_database_option,
add_logging_options,
set_logging_options,
add_team_option,
add_league_option,... | code_fim | hard | {
"lang": "python",
"repo": "abetts155/Projects",
"path": "/Betting/show_form.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> title = 'League table'
if half:
title = '{} ({} half)'.format(title, half.name)
ax.set_title(title, fontstyle='italic')
ax.axis('off')
def main(args: Namespace):
set_matplotlib_defaults()
load_teams(args.database)
league = league_register[get_unique_league(args)]
... | code_fim | hard | {
"lang": "python",
"repo": "abetts155/Projects",
"path": "/Betting/show_form.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.