text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> vel = (position[n_steps-1,:] - position[begin_step,:])**2
results_vel[i][2] = np.sqrt(np.sum(vel))/((n_steps-begin_step)*timestep)
#! Energy
joint_vel = data["joints"][begin_step:,:,1]
joint_tor = data["joints"][begin_step:,:,3]
en... | code_fim | hard | {
"lang": "python",
"repo": "Maxime00/Salamander_controller",
"path": "/Lab9/Webots/controllers/pythonController/exercise_9c.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> norm = []
for i in range(x.size):
norm += [1.0/(sd*np.sqrt(2*np.pi))*np.exp(-(x[i] - media)**2/(2*sd**2))]
return np.array(norm)
media1 = 0
media2 = -2
std1 = 0.5
std2 = 1
x = np.linspace(-20, 20, 500)
y_real = norm(x, media1, std1) + norm(x, media2, std2)
#########################... | code_fim | medium | {
"lang": "python",
"repo": "Gonen09/swastronomia",
"path": "/ConsoleApplication2/AstroSW(Python)/TwoGaussianFit.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = np.linspace(-20, 20, 500)
y_real = norm(x, media1, std1) + norm(x, media2, std2)
######################################
# Solving
m, dm, sd1, sd2 = [5, 10, 1, 1]
p = [m, dm, sd1, sd2] # Initial guesses for leastsq
y_init = norm(x,m,sd1) + norm(x, m + dm, sd2) # For final comparison plot
def res(p, ... | code_fim | hard | {
"lang": "python",
"repo": "Gonen09/swastronomia",
"path": "/ConsoleApplication2/AstroSW(Python)/TwoGaussianFit.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gonen09/swastronomia path: /ConsoleApplication2/AstroSW(Python)/TwoGaussianFit.py
import matplotlib.pyplot as pt
import numpy as np
from scipy.optimize import leastsq
####################################
# Setting up test data
def norm(x, media, sd):
<|fim_suffix|> return error
plsq = least... | code_fim | hard | {
"lang": "python",
"repo": "Gonen09/swastronomia",
"path": "/ConsoleApplication2/AstroSW(Python)/TwoGaussianFit.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>arr = []
sub = []
n = int(input())
while n > 0:
arr.append(n)
n-=1
while len(arr) + len(sub) > 1:
while len(arr) > 1:
arr.pop()
sub.append(arr.pop())
arr = sub[::-1] + arr
sub = []
print(arr[0])<|fim_prefix|># repo: Donsworkout/boj_algorithm_python path: /simulation/bo... | code_fim | easy | {
"lang": "python",
"repo": "Donsworkout/boj_algorithm_python",
"path": "/simulation/boj_2164.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Donsworkout/boj_algorithm_python path: /simulation/boj_2164.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 17 22:28:30 2019
<|fim_suffix|>arr = []
sub = []
n = int(input())
while n > 0:
arr.append(n)
n-=1
while len(arr) + len(sub) > 1:
while len(arr) > 1:
... | code_fim | easy | {
"lang": "python",
"repo": "Donsworkout/boj_algorithm_python",
"path": "/simulation/boj_2164.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in num:
div = 0
while i > 0:
if i % 2 == 0:
i //= 2
div += 1
else:
i -= 1
plus_cnt += 1
div_max = max(div_max, div)
print(plus_cnt + div_max)<|fim_prefix|># repo: CodeTest-StudyGroup/Code-Test-Study path: /JongHo/BOJ/12931.... | code_fim | easy | {
"lang": "python",
"repo": "CodeTest-StudyGroup/Code-Test-Study",
"path": "/JongHo/BOJ/12931.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CodeTest-StudyGroup/Code-Test-Study path: /JongHo/BOJ/12931.py
n = int(input())
num = list(map(int, input().split()))
<|fim_suffix|>for i in num:
div = 0
while i > 0:
if i % 2 == 0:
i //= 2
div += 1
else:
i -= 1
plus_cnt +=... | code_fim | easy | {
"lang": "python",
"repo": "CodeTest-StudyGroup/Code-Test-Study",
"path": "/JongHo/BOJ/12931.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tanishq-aggarwal/microsoft-teams-meeting-attender path: /page_detect.py
from wrapper import SeleniumWrapper
from selenium.webdriver.common.by import By
class PageDetector:
<|fim_suffix|>
def detect(self):
if self.selenium.wait_for_presence(locator=(By.ID, "teams-app-bar"), timeout=... | code_fim | medium | {
"lang": "python",
"repo": "tanishq-aggarwal/microsoft-teams-meeting-attender",
"path": "/page_detect.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def detect(self):
if self.selenium.wait_for_presence(locator=(By.ID, "teams-app-bar"), timeout=30):
if self.selenium.wait_for_presence(locator=(By.ID, "download-desktop-page"), timeout=3):
return "promo-page"
return "main-app-page"
elif self.sel... | code_fim | medium | {
"lang": "python",
"repo": "tanishq-aggarwal/microsoft-teams-meeting-attender",
"path": "/page_detect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> TqdmTypeError, TqdmWarning as TqdmWarning, tqdm as tqdm, trange as trange
def tqdm_notebook(*args, **kwargs): ...
def tnrange(*args, **kwargs): ...<|fim_prefix|># repo: jdferreira/mypy-test path: /stubs/tqdm/__init__.pyi
from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSync... | code_fim | medium | {
"lang": "python",
"repo": "jdferreira/mypy-test",
"path": "/stubs/tqdm/__init__.pyi",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>arning, TqdmExperimentalWarning as TqdmExperimentalWarning, TqdmKeyError as TqdmKeyError, TqdmMonitorWarning as TqdmMonitorWarning, TqdmTypeError as TqdmTypeError, TqdmWarning as TqdmWarning, tqdm as tqdm, trange as trange
def tqdm_notebook(*args, **kwargs): ...
def tnrange(*args, **kwargs): ...<|fim_pre... | code_fim | medium | {
"lang": "python",
"repo": "jdferreira/mypy-test",
"path": "/stubs/tqdm/__init__.pyi",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdferreira/mypy-test path: /stubs/tqdm/__init__.pyi
from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSynchronisationWarning
from ._tqdm_pandas import tqdm_pandas as tqdm_pandas
from .cli import main as main
from .gui import tqdm as tqdm_gui, trange as tgrange
from .st... | code_fim | medium | {
"lang": "python",
"repo": "jdferreira/mypy-test",
"path": "/stubs/tqdm/__init__.pyi",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Subangani/TSA-with-SelfTraining path: /src/xgboostTune.py
import numpy as np
import xgboost as xgb
from sklearn.grid_search import GridSearchCV #Performing grid search
import generateVector
from sklearn.model_selection import GroupKFold
from sklearn import preprocessing as pr
positiveFile="../... | code_fim | hard | {
"lang": "python",
"repo": "Subangani/TSA-with-SelfTraining",
"path": "/src/xgboostTune.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> global X_model, Y_model, gkf
param_grid = {
#'max_depth': [5, 6, 7],
#'learning_rate': [0.1, 0.15, 0.2, 0.3],
#'min_child_weight':[1,3,5,7],
# 'gamma':[i/10.0 for i in range(0,5)],
'subsample': [i / 10.0 for i in range(6, 10)],
'colsample_bytree': ... | code_fim | hard | {
"lang": "python",
"repo": "Subangani/TSA-with-SelfTraining",
"path": "/src/xgboostTune.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> entrypoint_name = 'NGramHash'
settings = {}
if hash_bits is not None:
settings['HashBits'] = try_set(
obj=hash_bits,
none_acceptable=True,
is_of_type=numbers.Real)
if ngram_length is not None:
settings['NgramLength'] = try_set(
... | code_fim | hard | {
"lang": "python",
"repo": "zyw400/NimbusML-1",
"path": "/src/python/nimbusml/internal/entrypoints/_ngramextractor_ngramhash.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hash_bits is not None:
settings['HashBits'] = try_set(
obj=hash_bits,
none_acceptable=True,
is_of_type=numbers.Real)
if ngram_length is not None:
settings['NgramLength'] = try_set(
obj=ngram_length,
none_acceptable=True... | code_fim | hard | {
"lang": "python",
"repo": "zyw400/NimbusML-1",
"path": "/src/python/nimbusml/internal/entrypoints/_ngramextractor_ngramhash.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zyw400/NimbusML-1 path: /src/python/nimbusml/internal/entrypoints/_ngramextractor_ngramhash.py
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
NGramHash
"""
import numbers
from ..utils.entrypoints import Component
from ..utils.utils import try_set
def n_gram_hash(
... | code_fim | hard | {
"lang": "python",
"repo": "zyw400/NimbusML-1",
"path": "/src/python/nimbusml/internal/entrypoints/_ngramextractor_ngramhash.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
print sumbelow(1000)
n = 1000<|fim_prefix|># repo: WCC-Seminar/Comparative path: /ProjectEuler-1/projecteuler1-set.py
#!/usr/bin/python
def sumbelow(n):
multiples_of_3 = set(range(0,n,3))
multiples_of_5 = set(range(0,n,5))
return sum(multiples_of_3.union(mu... | code_fim | medium | {
"lang": "python",
"repo": "WCC-Seminar/Comparative",
"path": "/ProjectEuler-1/projecteuler1-set.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WCC-Seminar/Comparative path: /ProjectEuler-1/projecteuler1-set.py
#!/usr/bin/python
def sumbelow(n):
multiples_of_3 = set(range(0,n,3))
multiples_of_5 = set(range(0,n,5))
return sum(multiples_of_3.union(multiples_of_5))
<|fim_suffix|>if __name__ == '__main__':
print sumbelow(10... | code_fim | medium | {
"lang": "python",
"repo": "WCC-Seminar/Comparative",
"path": "/ProjectEuler-1/projecteuler1-set.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suxxxoi/recipe_fork path: /recipe_fork/recipe/migrations/0007_recipe_portions.py
# Generated by Django 3.0.8 on 2020-08-11 13:43
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AddField(
model_name='recipe',
name='portions',
... | code_fim | medium | {
"lang": "python",
"repo": "suxxxoi/recipe_fork",
"path": "/recipe_fork/recipe/migrations/0007_recipe_portions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('recipe', '0006_recipe_description'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='portions',
field=models.FloatField(default=1),
),
]<|fim_prefix|># ... | code_fim | easy | {
"lang": "python",
"repo": "suxxxoi/recipe_fork",
"path": "/recipe_fork/recipe/migrations/0007_recipe_portions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: christospliakos/Getting-Started-with-Tensorflow-2-Coursera path: /Week 4 - Saving and Loading Models/Loading Pre trained models/Loading pre-trained Keras models.py
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.preprocessing import image
from tensorflow.keras.ap... | code_fim | medium | {
"lang": "python",
"repo": "christospliakos/Getting-Started-with-Tensorflow-2-Coursera",
"path": "/Week 4 - Saving and Loading Models/Loading Pre trained models/Loading pre-trained Keras models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>img_input = image.load_img('my_picture.jpg', target_size=(224, 224))
img_input = image.img_to_array(img_input)
img_input = preprocess_input(img_input[np.newaxis, ...])
preds = model.predict(img_input)
decoded_predictions = decode_predictions(preds, top=10)[0]
print(decoded_predictions)<|fim_prefix|># re... | code_fim | medium | {
"lang": "python",
"repo": "christospliakos/Getting-Started-with-Tensorflow-2-Coursera",
"path": "/Week 4 - Saving and Loading Models/Loading Pre trained models/Loading pre-trained Keras models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thirzavanlaar/nns_python path: /averaged_figures.py
#!/usr/bin/python
# Find minimal distances between clouds in one bin, average these per bin
# Compute geometric and arithmetical mean between all clouds per bin
from netCDF4 import Dataset as NetCDFFile
from matplotlib import pyplot as plt
imp... | code_fim | hard | {
"lang": "python",
"repo": "thirzavanlaar/nns_python",
"path": "/averaged_figures.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.figure(figsize=(10,8))
plt.xlabel('log(l) [m]')
plt.ylabel('log(N*(l)) [m-1]')
plt.scatter(sizelog,hnlog)
plt.scatter(sizelog[0:10],logfit[0:10])
plt.savefig('Figures/CSD.pdf')
plt.figure(figsize=(10,8))
plt.xlabel('Cloud size')
plt.ylabel('Ratio distance/size')
plt.axis([0, 5500, 0, 0.02])
ax = plt... | code_fim | hard | {
"lang": "python",
"repo": "thirzavanlaar/nns_python",
"path": "/averaged_figures.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: poketsc/algorithm-python path: /210623_programmers_2.py
# 문제 설명
# 길이가 같은 두 1차원 정수 배열 a, b가 매개변수로 주어집니다. a와 b의 내적을 return 하도록 solution 함수를 완성해주세요.
# 이때, a와 b의 내적은 a[0]*b[0] + a[1]*b[1] + ... + a[n-1]*b[n-1] 입니다. (n은 a, b의 길이)
<|fim_suffix|>def solution2(a, b):
answer = [a[i] * b[i] for i in ... | code_fim | hard | {
"lang": "python",
"repo": "poketsc/algorithm-python",
"path": "/210623_programmers_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return sum(map(lambda x,y: x * y , a, b))
# zip 사용
def solution4(a, b):
answer = 0
for i,j in zip(a,b):
answer += i * j
return answer
# zip + 리스트 컨프리헨션 사용
def solution5(a, b):
answer = sum([i * j for i,j in zip(a,b)])
return answer<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "poketsc/algorithm-python",
"path": "/210623_programmers_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for dag_model in dag_models:
self._mailbox.send_message(DagExecutableEvent(dag_model.dag_id).to_event())
class ParsingStatRetrieveThread(StoppableThread):
def __init__(self, dag_file_processor_agent, *args, **kwargs):
super(ParsingStatRetrieveThread, self).__init__(*args,... | code_fim | hard | {
"lang": "python",
"repo": "bgeng777/flink-ai-extended",
"path": "/flink-ai-flow/lib/airflow/airflow/contrib/jobs/dag_trigger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dag_directory: str,
max_runs: int,
dag_ids: Optional[List[str]],
pickle_dags: bool,
mailbox: Mailbox,
refresh_dag_dir_interval=1,
notification_service_uri=None):
"""
:para... | code_fim | hard | {
"lang": "python",
"repo": "bgeng777/flink-ai-extended",
"path": "/flink-ai-flow/lib/airflow/airflow/contrib/jobs/dag_trigger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgeng777/flink-ai-extended path: /flink-ai-flow/lib/airflow/airflow/contrib/jobs/dag_trigger.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright... | code_fim | hard | {
"lang": "python",
"repo": "bgeng777/flink-ai-extended",
"path": "/flink-ai-flow/lib/airflow/airflow/contrib/jobs/dag_trigger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Kategori',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nama_kategori', models.CharField(max_length=30)),
('desk... | code_fim | hard | {
"lang": "python",
"repo": "benewib/hebel-stone",
"path": "/stones/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
]
operations = [
migrations.CreateModel(
name='Kategori',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nama_kategori', models.CharField(max_length=... | code_fim | hard | {
"lang": "python",
"repo": "benewib/hebel-stone",
"path": "/stones/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benewib/hebel-stone path: /stones/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-08-03 02:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_s... | code_fim | hard | {
"lang": "python",
"repo": "benewib/hebel-stone",
"path": "/stones/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>w)
if now == m:
cnt += 1
print(cnt)<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p02791/s421948942.py
n = int(input())
p = [220000] + list(map(int, <|fim_middle|>input().split()))
cnt = 0
m = 220000
for i in range(1, n+1):
now = p[i]
m = min(m, no | code_fim | medium | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p02791/s421948942.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p02791/s421948942.py
n = int(input())
p = [220000] + list(map(int, <|fim_suffix|>range(1, n+1):
now = p[i]
m = min(m, now)
if now == m:
cnt += 1
print(cnt)<|fim_middle|>input().split()))
cnt = 0
m = 220000
for i in | code_fim | easy | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p02791/s421948942.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fengjinhai/pageCrawer path: /lib/timer.py
#!/usr/bin/env python
#coding=UTF8
'''
@author: devin
@time: 2013-11-23
@desc:
timer
'''
import threading
import time
class Timer(threading.Thread):
<|fim_suffix|> def run(self):
while not self.is_stop.is_set():
... | code_fim | hard | {
"lang": "python",
"repo": "fengjinhai/pageCrawer",
"path": "/lib/timer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CountDownTimer(Timer):
'''
一共执行指定次数
'''
def __init__(self, seconds, total_times, fun, **args):
'''
total_times为总共执行的次数
其它参数同Timer
'''
self.total_times = total_times
Timer.__init__(self, seconds, fun, args)
def run(s... | code_fim | medium | {
"lang": "python",
"repo": "fengjinhai/pageCrawer",
"path": "/lib/timer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dwz1011/spider path: /web_spider/iteration_spider.py
# -*- coding:utf-8 -*-
from common import *
import itertools
def iteration_spider():
<|fim_suffix|>if __name__ == '__main__':
iteration_spider()<|fim_middle|> max_errors = 5
num_errors = 0
for page in itertools.count(1):
url = 'http://ex... | code_fim | hard | {
"lang": "python",
"repo": "dwz1011/spider",
"path": "/web_spider/iteration_spider.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
iteration_spider()<|fim_prefix|># repo: dwz1011/spider path: /web_spider/iteration_spider.py
# -*- coding:utf-8 -*-
from common import *
import itertools
<|fim_middle|>def iteration_spider():
max_errors = 5
num_errors = 0
for page in itertools.count(1):
url = 'http://e... | code_fim | hard | {
"lang": "python",
"repo": "dwz1011/spider",
"path": "/web_spider/iteration_spider.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Galvayra/DMP path: /encoding.py
# -*- coding: utf-8 -*-
import sys
from os import path
try:
import DMP
except ImportError:
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from DMP.modeling.vectorMaker import VectorMaker
from DMP.modeling.variables import KEY_TOTAL, ... | code_fim | hard | {
"lang": "python",
"repo": "Galvayra/DMP",
"path": "/encoding.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> vectorMaker.encoding()
vectorMaker.show_vector_info()
vectorMaker.build_tf_records()
vectorMaker.build_pillow_img()
vectorMaker.dump()<|fim_prefix|># repo: Galvayra/DMP path: /encoding.py
# -*- coding: utf-8 -*-
import sys
from os import path
try:
import DMP
except ImportError:
... | code_fim | hard | {
"lang": "python",
"repo": "Galvayra/DMP",
"path": "/encoding.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> "log_": [
{
"file_name": ".gitignore",
"line_number": 1,
"strings": "a",
"line1": "",
"line2": "# Created by https://www.gitignore.io/api/git,python,django,pycharm+all",
"line3": "## ... | code_fim | hard | {
"lang": "python",
"repo": "roharon/GitDefender",
"path": "/backend/app/views/swagger_collection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>GET_BRANCH_STATUS_200 = ResponseCollection(
message = "HTTP_200_OK",
data = dict(branches=[
'master',
'develop',
'feature/get_repo'
])
)
GET_REPO_STATUS_200 = ResponseCollection(
message = "HTTP_200_OK",
data = {
"repositories": [
{
"name": ... | code_fim | hard | {
"lang": "python",
"repo": "roharon/GitDefender",
"path": "/backend/app/views/swagger_collection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roharon/GitDefender path: /backend/app/views/swagger_collection.py
import pprint
class ErrorResponseCollection(object):
def __init__(self, status, message, param = "message"):
self.status = status
self.message = message
self.param = param
def as_md(self):... | code_fim | hard | {
"lang": "python",
"repo": "roharon/GitDefender",
"path": "/backend/app/views/swagger_collection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dacl010811/cursopython2021 path: /Unidad9/Rectangulo.py
class Rectangulo():
def __init__(self, base, altura):
self.base = base
self.altura = altura
<|fim_suffix|>#Primera instancia de rectangulo
rectangulo_1 = Rectangulo(base, altura)
area_rectangulo = rectangulo_1.calcular... | code_fim | medium | {
"lang": "python",
"repo": "dacl010811/cursopython2021",
"path": "/Unidad9/Rectangulo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Primera instancia de rectangulo
rectangulo_1 = Rectangulo(base, altura)
area_rectangulo = rectangulo_1.calcular_area()
print(f"El area del rectangulo de {base} * {altura} = {area_rectangulo}")<|fim_prefix|># repo: dacl010811/cursopython2021 path: /Unidad9/Rectangulo.py
class Rectangulo():
def __in... | code_fim | medium | {
"lang": "python",
"repo": "dacl010811/cursopython2021",
"path": "/Unidad9/Rectangulo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.base * self.altura
base = float(input("Ingrese la base del rectangulo: \n"))
altura = float(input("Ingrese la altura del rectangulo: \n"))
#Primera instancia de rectangulo
rectangulo_1 = Rectangulo(base, altura)
area_rectangulo = rectangulo_1.calcular_area()
print(f"El area del rec... | code_fim | easy | {
"lang": "python",
"repo": "dacl010811/cursopython2021",
"path": "/Unidad9/Rectangulo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> show_titles : bool
Displays a title above each 1-D histogram showing the 0.5 quantile
with the upper and lower errors supplied by the quantiles argument.
title_quantiles : iterable
A list of 3 fractional quantiles to show as the the upper and lower
errors. If `None... | code_fim | hard | {
"lang": "python",
"repo": "dfm/corner.py",
"path": "/src/corner/corner.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> title_kwargs : dict
Any extra keyword arguments to send to the `set_title` command.
range : iterable (ndim,)
A list where each element is either a length 2 tuple containing
lower and upper bounds or a float in range (0., 1.)
giving the fraction of samples to includ... | code_fim | hard | {
"lang": "python",
"repo": "dfm/corner.py",
"path": "/src/corner/corner.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: legoktm/legoktm path: /icstalker/iclib/growl.py
#!/usr/bin/python
#
# Script written by Legoktm, 2011
# Released into the Public Domain on November, 16, 2011
# This product comes with no warranty of any sort.
# Enjoy!
#
from commands import getoutput
def notify(string, program=False):
<|fim_suffi... | code_fim | medium | {
"lang": "python",
"repo": "legoktm/legoktm",
"path": "/icstalker/iclib/growl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #THIS IS THE OLD METHOD. YOU SHOULD ONLY USE THIS IF YOU DO NOT HAVE growlnotify INSTALLED.
print"""]9;%s
""" %string<|fim_prefix|># repo: legoktm/legoktm path: /icstalker/iclib/growl.py
#!/usr/bin/python
#
# Script written by Legoktm, 2011
# Released into the Public Domain on November, 16, 2011
# Th... | code_fim | medium | {
"lang": "python",
"repo": "legoktm/legoktm",
"path": "/icstalker/iclib/growl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if textView != None:
dateFormat = time.strftime("%Y.%m.%d")
textView.insertText_(dateFormat)<|fim_prefix|># repo: bomberstudios/voodoopad-gtd path: /Insert Date.py
# -*- coding: utf-8 -*-
'''
:Title
Insert Date
:Planguage
Python
:Requires
VoodooPad 3.5+
<|fim_middle|>:Description
... | code_fim | hard | {
"lang": "python",
"repo": "bomberstudios/voodoopad-gtd",
"path": "/Insert Date.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bomberstudios/voodoopad-gtd path: /Insert Date.py
# -*- coding: utf-8 -*-
'''
:Title
Insert Date
:Planguage
Python
<|fim_suffix|>def main(windowController, *args, **kwargs):
textView = windowController.textView()
document = windowController.document()
if textView != None:
... | code_fim | hard | {
"lang": "python",
"repo": "bomberstudios/voodoopad-gtd",
"path": "/Insert Date.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif isinstance(x, dict) and all(isinstance(x[i], dict) for i in list(x.keys())):
rows = rowKeys(x)
cols = colKeys(x)
if len(rows) < 1 or len(cols) < 1:
raise PFARuntimeException("too few rows/cols", self.errcodeBase + 0, self.name, pos)
... | code_fim | hard | {
"lang": "python",
"repo": "animator/titus2",
"path": "/titus/lib/la.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: animator/titus2 path: /titus/lib/la.py
return np().matrix(x, dtype=np().double)
def arrayToRowVector(x):
return np().matrix(x, dtype=np().double).T
def rowVectorToArray(x):
return x.T.tolist()[0]
def matrixToArrays(x):
return x.tolist()
def mapsToMatrix(x, rows, cols):
re... | code_fim | hard | {
"lang": "python",
"repo": "animator/titus2",
"path": "/titus/lib/la.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: animator/titus2 path: /titus/lib/la.py
raise PFARuntimeException("misaligned matrices", self.errcodeBase + 0, self.name, pos)
return [xi - yi for xi, yi in zip(x, y)]
elif isinstance(x, dict) and all(isinstance(x[i], dict) for i in list(x.keys())) and \
... | code_fim | hard | {
"lang": "python",
"repo": "animator/titus2",
"path": "/titus/lib/la.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samMeow/googleCodeJam path: /2022/Qround/dice.py
import sys
def solution(input):
k = 1
for v in sorted(input):
if v >= k:
k += 1
return k - 1
testcase = sys.stdin.readline()
for i in range(int(testcase)):
sys.stdin.readline()
line1 = sys.st<|fim_suffix|>i... | code_fim | medium | {
"lang": "python",
"repo": "samMeow/googleCodeJam",
"path": "/2022/Qround/dice.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>in line1.split(' ') ],
[ int(x) for x in line2.split(' ') ],
)
print("Case #{}: {}".format(i+1, ans))<|fim_prefix|># repo: samMeow/googleCodeJam path: /2022/Qround/dice.py
import sys
def solution(input):
k = 1
for v in sorted(input):
if v >= k:
k += 1
ret<... | code_fim | hard | {
"lang": "python",
"repo": "samMeow/googleCodeJam",
"path": "/2022/Qround/dice.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> robot.turn(-0.5)
return "ok"
@app.route("/kick")
def do_kick():
robot.kick()
return "ok"
@app.route("/catch")
def do_catch():
robot.catch()
return "ok"
if __name__ == "__main__":
app.debug = True
app.run(port=5001)<|fim_prefix|># repo: R2ZER0/SDP-2015-TeamG path... | code_fim | hard | {
"lang": "python",
"repo": "R2ZER0/SDP-2015-TeamG",
"path": "/ControlApp/controlapp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: R2ZER0/SDP-2015-TeamG path: /ControlApp/controlapp.py
#!/usr/bin/env python
import serial
from action import Action
import math
comm = serial.Serial("/dev/ttyACM3", 115200, timeout=1)
#comm = None
robot = Action(comm)
from flask import Flask
from flask import send_from_directory
import os
sta... | code_fim | hard | {
"lang": "python",
"repo": "R2ZER0/SDP-2015-TeamG",
"path": "/ControlApp/controlapp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>k2 >= k:
print(" Yes, the scene can be set.")
else:
print(" Sorry, but the scene can't be set.")<|fim_prefix|># repo: swyatik/Python-core-07-Vovk path: /Task 3/4_hall_scene.py
'''Чи можна в квадратному залі площею S помістити круглу сцену радіусом R так,
щоб від стіни до сцени був прохі... | code_fim | hard | {
"lang": "python",
"repo": "swyatik/Python-core-07-Vovk",
"path": "/Task 3/4_hall_scene.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swyatik/Python-core-07-Vovk path: /Task 3/4_hall_scene.py
'''Чи можна в квадратному залі площею S помістити круглу сцену радіусом R так,
щоб від стіни до сцени був прохі<|fim_suffix|>ut your radius of scene (R): '))
k = int(input('Input your width of passage (K): '))
k2 = sqrt(s) / 2 - r
if k... | code_fim | medium | {
"lang": "python",
"repo": "swyatik/Python-core-07-Vovk",
"path": "/Task 3/4_hall_scene.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xidaodi/pythonlearn path: /day6_bilibili_多线程同步_互斥锁.py
'''
这部分理解参考:
https://www.bilibili.com/video/BV1QA411H7tK?from=search&seid=17305042509580602672
图文代码地址: https://blog.csdn.net/qq_30758629/article/details/112527763
'''
import threading
import time
<|fim_suffix|>def func():
global data... | code_fim | medium | {
"lang": "python",
"repo": "xidaodi/pythonlearn",
"path": "/day6_bilibili_多线程同步_互斥锁.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def func():
global data
print("%s is acquire lock..\n" %threading.current_thread().getName())
if lock.acquire():
print("%s get lock "%threading.current_thread().getName())
data+=1
time.sleep(2)
print("%s release lock "%threading.current_thread().getName())
... | code_fim | medium | {
"lang": "python",
"repo": "xidaodi/pythonlearn",
"path": "/day6_bilibili_多线程同步_互斥锁.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beproject2019/traffic-analysis path: /maps_extract.py
from selenium import webdriver
from time import sleep
import os.path
import time
import datetime
driver =webdriver.Chrome(executable_path=r'C:/Users/Pathak/Downloads/chromedriver_win32/chromedriver.exe')
counter=0
while True :
<|fi... | code_fim | hard | {
"lang": "python",
"repo": "beproject2019/traffic-analysis",
"path": "/maps_extract.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ft=df+gh+'.png'
final=os.path.join(start,ft)
driver.get_screenshot_as_file(final)
counter+=1
sleep(20)
driver.quit()<|fim_prefix|># repo: beproject2019/traffic-analysis path: /maps_extract.py
from selenium import webdriver
from time import sleep
import os.path
import time
import datet... | code_fim | hard | {
"lang": "python",
"repo": "beproject2019/traffic-analysis",
"path": "/maps_extract.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MIXISAMA/MIS-backend path: /plan/serializers.py
from rest_framework import serializers
from plan.models import RoughRequirement, DetailedRequirement
from plan.models import OfferingCourse, FieldOfStudy, IndicatorFactor
from plan.models import BasisTemplate
class SimpleOfferingCourseSerializer(se... | code_fim | hard | {
"lang": "python",
"repo": "MIXISAMA/MIS-backend",
"path": "/plan/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = IndicatorFactor
fields = '__all__'
class BasisTemplateSerializer(serializers.ModelSerializer):
class Meta:
model = BasisTemplate
fields = '__all__'
class ReadIndicatorFactorSerializer(serializers.ModelSerializer):
offering_course = SimpleOfferingCourseSeri... | code_fim | hard | {
"lang": "python",
"repo": "MIXISAMA/MIS-backend",
"path": "/plan/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class IndicatorFactorSerializer(serializers.ModelSerializer):
class Meta:
model = IndicatorFactor
fields = '__all__'
class BasisTemplateSerializer(serializers.ModelSerializer):
class Meta:
model = BasisTemplate
fields = '__all__'
class ReadIndicatorFactorSerialize... | code_fim | hard | {
"lang": "python",
"repo": "MIXISAMA/MIS-backend",
"path": "/plan/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # File %disoccupazione
with open('static/notUpdating/taxDisocc.csv', newline='') as f: #Qui si può cambiare il nome del file se necessario, basta che sia in formato csv corretto
reader = csv.reader(f)
data = list(reader)[1:]
lavoro = {
'Vicenza': [],
... | code_fim | hard | {
"lang": "python",
"repo": "dihvicenza/unistats",
"path": "/application.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@application.route("/doUpdate")
def updateData():
#File iscritti per ateneo
#I dati vengono inseriti in un dizionario come array, il formato è più sotto
with open('static/notUpdating/iscrittiAteneo.csv', newline='') as f: #Qui si può cambiare il nome del file se necessario, basta che sia i... | code_fim | hard | {
"lang": "python",
"repo": "dihvicenza/unistats",
"path": "/application.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dihvicenza/unistats path: /application.py
from flask import Flask, render_template, jsonify, request, make_response #BSD License
import requests #Apache 2.0
#StdLibs
import json
from os import path
import csv
###################################################
#Programmato da Alex Pr... | code_fim | hard | {
"lang": "python",
"repo": "dihvicenza/unistats",
"path": "/application.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for m in ma:
mn = m.split(".")
b = bin(int(''.join(mn)))
le = b.find("0")
ri = b.rfind("1")
if le > ri:
l[5] += 1
for o in l:
print(str(o),end=" ")<|fim_prefix|># repo: milolou/pyscript path: /ipcheck.py
n = 1
ip = []
ma = []
l = [0, 0, 0, 0, 0, 0, 0] # a, b, c, d, e, wpm... | code_fim | hard | {
"lang": "python",
"repo": "milolou/pyscript",
"path": "/ipcheck.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: milolou/pyscript path: /ipcheck.py
n = 1
ip = []
ma = []
l = [0, 0, 0, 0, 0, 0, 0] # a, b, c, d, e, wpm, pr
while n != 0:
a = input().strip().split("~")
n = len(a)
if n == 1:
break
ip.append(a[0])
ma.append(a[1])
<|fim_suffix|>for m in ma:
mn = m.split(".")
b ... | code_fim | hard | {
"lang": "python",
"repo": "milolou/pyscript",
"path": "/ipcheck.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roytje88/TrelloDash path: /runDash.py
e)
tmpdatesdict = {}
now = datetime.now().date()
numdays = 365
numdayshistory = 183
for x in range (0, numdays):
tmpdatesdict[str(now + timedelta(days = x))] = {}
for x in range (0,numdayshistory):
tmpdatesdict[str(now... | code_fim | hard | {
"lang": "python",
"repo": "roytje88/TrelloDash",
"path": "/runDash.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roytje88/TrelloDash path: /runDash.py
style=globals['styles']['divgraphs'],
children=[
dcc.Markdown('''In dit tabblad worden de kaarten in GANTT charts weergegeven. Kies in ... | code_fim | hard | {
"lang": "python",
"repo": "roytje88/TrelloDash",
"path": "/runDash.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
graphdata = {'nietingepland': bars, 'nietingeplandepics': epicbars, 'gaugefig': gaugefig}
columntypes = {}
for key, value in kaarten[next(iter(kaarten))].items():
if 'datum' in key or key == 'Aangemaakt':
columntypes[key] = 'datetime'
elif type(value) == int... | code_fim | hard | {
"lang": "python",
"repo": "roytje88/TrelloDash",
"path": "/runDash.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashwinjoseph95/Spoken-Keyword-Spotting path: /src/parameters.py
NUM_CLASSES = 31
AUDIO_SR = 16000
AUDIO_LENGTH = 16000
LIBROSA_AUDIO_LENGTH = 22050
EPOCHS = 25
categories = {
'stop': 0,
'nine': 1,
'off': 2,
'four': 3,
'right': 4,
'eight': 5,
'one': 6,
'bird': 7,... | code_fim | hard | {
"lang": "python",
"repo": "ashwinjoseph95/Spoken-Keyword-Spotting",
"path": "/src/parameters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Marvin model
INPUT_SHAPE = (99, 40)
TARGET_SHAPE = (99, 40, 1)
PARSE_PARAMS = (0.025, 0.01, 40)
filters = [16, 32, 64, 128, 256]
DROPOUT = 0.25
KERNEL_SIZE = (3, 3)
POOL_SIZE = (2, 2)
DENSE_1 = 512
DENSE_2 = 256
BATCH_SIZE = 128
PATIENCE = 5
LEARNING_RATE = 0.001<|fim_prefix|># repo: ashwinjoseph95/Sp... | code_fim | hard | {
"lang": "python",
"repo": "ashwinjoseph95/Spoken-Keyword-Spotting",
"path": "/src/parameters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='article',
name='estArchive',
field=models.BooleanField(default=False, verbose_name="Archiver l'article"),
),
migrations.AlterField(
model_name='projet',
name='estArchiv... | code_fim | medium | {
"lang": "python",
"repo": "eloigrau/permacat",
"path": "/blog/migrations/0015_auto_20190410_1304.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eloigrau/permacat path: /blog/migrations/0015_auto_20190410_1304.py
# Generated by Django 2.1.3 on 2019-04-10 11:04
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('blog', '0014_auto_20190409_1917'),
]
operations = [
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "eloigrau/permacat",
"path": "/blog/migrations/0015_auto_20190410_1304.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.probs = tf.nn.softmax(logits)
self.values = tf.layers.dense(inputs=self.hidden, units=1)[:, 0]<|fim_prefix|># repo: saschaschramm/Pong path: /models/ppo/policies.py
import tensorflow as tf
class PolicyFullyConnected:
def __init__(self, observation_space, action_space, b... | code_fim | hard | {
"lang": "python",
"repo": "saschaschramm/Pong",
"path": "/models/ppo/policies.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saschaschramm/Pong path: /models/ppo/policies.py
import tensorflow as tf
class PolicyFullyConnected:
def __init__(self, observation_space, action_space, batch_size, reuse):
<|fim_suffix|> self.hidden = tf.layers.dense(inputs=reshaped_observations,
... | code_fim | hard | {
"lang": "python",
"repo": "saschaschramm/Pong",
"path": "/models/ppo/policies.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> instance = BinlogStatus(raw_binlog_status)
assert instance.get_latest_backup() == BinlogCopy(
host='master1',
name='mysqlbin005.bin',
created_at=100504
)<|fim_prefix|># repo: ardabeyazoglu/twindb-mysql-backup path: /tests/unit/status/binlog_status/test_get_latest_backu... | code_fim | easy | {
"lang": "python",
"repo": "ardabeyazoglu/twindb-mysql-backup",
"path": "/tests/unit/status/binlog_status/test_get_latest_backup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ardabeyazoglu/twindb-mysql-backup path: /tests/unit/status/binlog_status/test_get_latest_backup.py
from twindb_backup.copy.binlog_copy import BinlogCopy
from twindb_backup.status.binlog_status import BinlogStatus
<|fim_suffix|> instance = BinlogStatus(raw_binlog_status)
assert instance.ge... | code_fim | easy | {
"lang": "python",
"repo": "ardabeyazoglu/twindb-mysql-backup",
"path": "/tests/unit/status/binlog_status/test_get_latest_backup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peterjunlin/PythonTest path: /practices/math_calculation.py
import math
def math_builtins():
assert abs(-123) == 123
assert abs(-123.456) == 123.456
assert abs(2+3j) == math.sqrt(2**2 + 3**2)
assert divmod(5, 2) == (2, 1)
assert max(1, 2, 3, 4) == 4
assert min(1, 2, 3, ... | code_fim | hard | {
"lang": "python",
"repo": "peterjunlin/PythonTest",
"path": "/practices/math_calculation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert round(123.65, 1) == 123.7
assert round(-123.65, 1) == -123.7
lst = [1, 2, 3]
assert sum(lst) == 6
def math_module_constants():
assert math.pi == 3.141592653589793
assert math.tau == 6.283185307179586
assert math.e == 2.718281828459045
x = float('NaN')
assert ... | code_fim | medium | {
"lang": "python",
"repo": "peterjunlin/PythonTest",
"path": "/practices/math_calculation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = float('NaN')
assert math.isnan(x)
x = float('inf')
assert math.isinf(x)
x = math.inf
assert math.isinf(x)
x = -math.inf
assert math.isinf(x)
def math_module():
x = -1.23
assert math.fabs(x) == 1.23
if __name__ == "__main__":
math_builtins()
math_mod... | code_fim | medium | {
"lang": "python",
"repo": "peterjunlin/PythonTest",
"path": "/practices/math_calculation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@view_config(route_name='auto',
request_method='GET',
renderer='json')
def auto_by_id(request: Request):
cid = request.matchdict.get('cid')
cid = int(cid)
if cid is not None:
car = Repository.car_by_cid(cid)
if not car:
msg = f"The car wi... | code_fim | hard | {
"lang": "python",
"repo": "turing4ever/restful-services-in-pyramid",
"path": "/src/first_service/part2_svc1_final_first_auto_service/svc1_first_auto_service/api/auto_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DrewTChrist/pylabeler path: /pylabeler/ui/about.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/about.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit thi... | code_fim | medium | {
"lang": "python",
"repo": "DrewTChrist/pylabeler",
"path": "/pylabeler/ui/about.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _translate = QtCore.QCoreApplication.translate
aboutDialog.setWindowTitle(_translate("aboutDialog", "About"))
self.label.setText(_translate("aboutDialog", "About"))
self.label_2.setText(_translate("aboutDialog", "Author: Andrew Christiansen"))
self.label_3.setText(_... | code_fim | hard | {
"lang": "python",
"repo": "DrewTChrist/pylabeler",
"path": "/pylabeler/ui/about.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QuarKUS7/advent-of-code-2019 path: /day6.py
if __name__== '__main__':
with open('./input/day6', 'r') as f:
orbit_input = [l.strip().split(")") for l in f.readlines()]
planets = [planet[0] for planet in orbit_input]
planets1 = [planet[1] for planet in orbit_input]
planets... | code_fim | medium | {
"lang": "python",
"repo": "QuarKUS7/advent-of-code-2019",
"path": "/day6.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if planet == 'COM':
return 0
next_p = system[planet]
return 1 + compute_orbits(next_p, system)
num_orb = 0
for planet in planets:
num_orb = num_orb + compute_orbits(planet, system)
print(num_orb)<|fim_prefix|># repo: QuarKUS7/advent-of-code-2019 p... | code_fim | medium | {
"lang": "python",
"repo": "QuarKUS7/advent-of-code-2019",
"path": "/day6.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thienma1258/IT2003.CH1502 path: /core/cli.py
from mininet.cli import CLI
from mininet.term import makeTerms
from mininet.util import irange
from log import log
from utils import (UITextStyle, display)
from dijkstra import (get_routing_decision, get_route_cost)
# Check if route directly connec... | code_fim | hard | {
"lang": "python",
"repo": "thienma1258/IT2003.CH1502",
"path": "/core/cli.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Show the complete shortest path from one switch to every other switch
# paths
def do_paths(self, line):
# Algorithm input
switches = self.mn.topo.switches()
weights = [('s'+str(i[0]), 's'+str(i[1]), i[2])
for i in self.mn.topo._slinks]
# L... | code_fim | hard | {
"lang": "python",
"repo": "thienma1258/IT2003.CH1502",
"path": "/core/cli.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def showAll(*keys):
for key in keys:
display.message('%s\t%s\t%s' % (key.name, key.IP(), key.MAC()))
# For each node
display.subsection('Controllers')
for c in self.mn.controllers:
showIP(locals[c.name])
display.subsection('Sw... | code_fim | hard | {
"lang": "python",
"repo": "thienma1258/IT2003.CH1502",
"path": "/core/cli.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vikibeta/django_web path: /blog/models.py
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
# Create your models here.
class Article(models.Model):
title = models.CharField(max_length=200)
author = models.CharField(max_length=100, d... | code_fim | hard | {
"lang": "python",
"repo": "Vikibeta/django_web",
"path": "/blog/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.title
class ZhihuSubject(models.Model):
title = models.CharField(max_length=200)
url = models.CharField(max_length=100)
zhihu_type = models.IntegerField()
def __unicode__(self):
return self.title
class ZhihuQuestion(models.Model):
subject = models.ForeignK... | code_fim | hard | {
"lang": "python",
"repo": "Vikibeta/django_web",
"path": "/blog/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.title
class ZhihuQuestion(models.Model):
subject = models.ForeignKey(ZhihuSubject, related_name='subject_question')
answer_url = models.CharField(max_length=200)
author = models.CharField(max_length=100)
author_url = models.CharField(max_length=200,null=True)
title... | code_fim | hard | {
"lang": "python",
"repo": "Vikibeta/django_web",
"path": "/blog/models.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.