text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> description = self.node.inspect()
assert 'error' in description
@test.docker_required
def test_activate_node(self):
feedback = self.node.activate()
assert 'error' not in feedback
assert 'Id' in feedback
assert 'name' in feedback
@test.docker_re... | code_fim | hard | {
"lang": "python",
"repo": "hivetech/hivy",
"path": "/tests/test_node.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data['Carinfo'].append({
'Timestamp': datetime.now().strftime("%H:%M:%S"),
'Car': a,
'Bike': b,
'Sensor': c
})
#save data json file by date
file = datetime.now().strftime("%Y-%m-%d")
with open('{}.txt'.forma... | code_fim | hard | {
"lang": "python",
"repo": "matutd/FYP",
"path": "/application.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matutd/FYP path: /application.py
#Import Flask module and create web server
#render_template allows for html files to be searched in the template folder
from flask import Flask, render_template, request
from datetime import datetime
import json
app = Flask(__name__) #__na... | code_fim | hard | {
"lang": "python",
"repo": "matutd/FYP",
"path": "/application.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_knock.py
#calss header
class _KNOCK():
def __init__(self,):
self.name = "KNOCK"
self.definitions = [u'to repeatedly hit something, producing a noise: ', u'If an engine is knocking, it is producing a repeated high sound either because the fuel ... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/verbs/_knock.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ButtonCal = tk.Button(
MainWindow,
text="reset",
command=lambda: dss.reset_counters_in_list(origin_champs_counters_to_buy),
)
ButtonCal.grid(row=DOWNSIDE, column=6)
ButtonCal = tk.Button(
MainWindow,
text="update classes",
command=lambda: dss.update_classes_and_origins(
or... | code_fim | hard | {
"lang": "python",
"repo": "Beta-Wooper/TFT-DSS",
"path": "/TFTDSS.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Beta-Wooper/TFT-DSS path: /TFTDSS.py
on_to_buy_info[29])
GwenToBuy = Champion(*champion_to_buy_info[30])
JaxToBuy = Champion(*champion_to_buy_info[31])
NautilusToBuy = Champion(*champion_to_buy_info[32])
ApheliosToBuy = Champion(*champion_to_buy_info[33])
DianaToBuy = Champion(*champion_to_buy_in... | code_fim | hard | {
"lang": "python",
"repo": "Beta-Wooper/TFT-DSS",
"path": "/TFTDSS.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Beta-Wooper/TFT-DSS path: /TFTDSS.py
w_window,
text="show_nonzero_counters_from_ocr()",
command=lambda: dss.show_nonzero_counters_from_ocr(
tk_window=MainWindow,
origin_champs_counters_=origin_champs_counters,
origin_champs_counters_to_buy_=orig... | code_fim | hard | {
"lang": "python",
"repo": "Beta-Wooper/TFT-DSS",
"path": "/TFTDSS.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/topic/show/<int:post_id>")
def topic_show(post_id):
post_to_show = post_store.get_by_id(post_id)
title = post_to_show.title
content = post_to_show.content
return render_template("topic_show.html", title=title, content=content)
@app.route("/topic/delete/<int:post_id>")
def to... | code_fim | hard | {
"lang": "python",
"repo": "BeYonas/forums-flask",
"path": "/app/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/topic/edit/<int:post_id>", methods=["GET", "POST"])
def topic_edit(post_id):
post_to_edit = post_store.get_by_id(post_id)
if request.method == "POST":
post_to_edit.title = request.form["title"]
post_to_edit.content = request.form["content"]
return redirect(url_... | code_fim | hard | {
"lang": "python",
"repo": "BeYonas/forums-flask",
"path": "/app/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BeYonas/forums-flask path: /app/views.py
from flask import render_template, request, redirect, url_for
from app import app, post_store, models
@app.route("/")
@app.route("/index")
def home():
return render_template("index.html", posts=enumerate(post_store.get_all()))
@app.route("/topic/ad... | code_fim | hard | {
"lang": "python",
"repo": "BeYonas/forums-flask",
"path": "/app/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(pl)
os.environ["PATH"] += os.pathsep + os.pathsep.join(pl)<|fim_prefix|># repo: LinHuanli/bug-free-invention path: /skdecide/builders/discrete_optimization/rcpsp/__init__.py
import fnmatch
import os
import sys
<|fim_middle|>pl = []
for p in sys.path:
for dirpath, dirs, files in os.walk(p):
... | code_fim | medium | {
"lang": "python",
"repo": "LinHuanli/bug-free-invention",
"path": "/skdecide/builders/discrete_optimization/rcpsp/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LinHuanli/bug-free-invention path: /skdecide/builders/discrete_optimization/rcpsp/__init__.py
import fnmatch
import os
import sys
<|fim_suffix|>print(pl)
os.environ["PATH"] += os.pathsep + os.pathsep.join(pl)<|fim_middle|>pl = []
for p in sys.path:
for dirpath, dirs, files in os.walk(p):
... | code_fim | medium | {
"lang": "python",
"repo": "LinHuanli/bug-free-invention",
"path": "/skdecide/builders/discrete_optimization/rcpsp/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 24aitor/NicePrinter path: /src/NicePrinter/niceprinter.py
# coding=utf-8
import os
class Color:
underline = '\033[4m'
darkcyan = '\033[36m'
purple = '\033[95m'
yellow = '\033[93m'
green = '\033[92m'
cyan = '\033[96m'
blue = '\033[94m'
bold ... | code_fim | hard | {
"lang": "python",
"repo": "24aitor/NicePrinter",
"path": "/src/NicePrinter/niceprinter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def table(array, vsym = '|', hsym = '=', centered = False, boldHead = True):
sizes = []
export = ''
[sizes.append(0) for x in array[0]]
for subarray in array:
for index, value in enumerate(subarray):
if ((len(value) - colorsChars(value)) > sizes[index]):
... | code_fim | hard | {
"lang": "python",
"repo": "24aitor/NicePrinter",
"path": "/src/NicePrinter/niceprinter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.relsease()
cv2.destroyAllWindows()<|fim_prefix|># repo: juxiangwu/image-processing path: /python-code/opencv-learning/basics/features/ORBvideo.py
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
orb = cv2.ORB_create(500)
<|fim_middle|>... | code_fim | hard | {
"lang": "python",
"repo": "juxiangwu/image-processing",
"path": "/python-code/opencv-learning/basics/features/ORBvideo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juxiangwu/image-processing path: /python-code/opencv-learning/basics/features/ORBvideo.py
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
orb = cv2.ORB_create(500)
<|fim_suffix|> if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.relsease()
cv2.destroyAllWindows()<|fim_middle|>... | code_fim | hard | {
"lang": "python",
"repo": "juxiangwu/image-processing",
"path": "/python-code/opencv-learning/basics/features/ORBvideo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_content_encoding(content_type=""):
split = content_type.split(";")
if len(split) == 2:
return split[1].split("=")[1]
return "utf-8"
@app.route(
"/", defaults={"root_relative_path": ""}, methods=["GET", "POST", "PUT", "DELETE"]
)
@app.route("/<path:root_relative_path>", m... | code_fim | medium | {
"lang": "python",
"repo": "bjuvensjo/rsimulatorpy",
"path": "/rsimulator_http/http.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bjuvensjo/rsimulatorpy path: /rsimulator_http/http.py
#!/usr/bin/env python3
import logging
import sys
from flask import Flask, abort
from flask import request
import rsimulator_core.core as core
import rsimulator_http.config as cfg
<|fim_suffix|> core_response = core.service(
cfg.R... | code_fim | hard | {
"lang": "python",
"repo": "bjuvensjo/rsimulatorpy",
"path": "/rsimulator_http/http.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>f"{major}_全学教育"].append(news[main_major])
route[f"{major}_not全学教育"] = [news[main_major]]
else:
if main_major == sub_major:
if len(index[sub_major]) == 1:
subj... | code_fim | hard | {
"lang": "python",
"repo": "ynntech/tu-line-covid19",
"path": "/sql_edition/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> news[subject]]
route[f"{major}_not{subject}"] = [news["全学生向け"],
news[major]]
elif len(index[major]) >= 2:
... | code_fim | hard | {
"lang": "python",
"repo": "ynntech/tu-line-covid19",
"path": "/sql_edition/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ynntech/tu-line-covid19 path: /sql_edition/utils.py
else:
route[major] = [news["全学生向け"]]
if major in major_tmp:
route[major].append(news[major])
else:
if len(major_tmp) == 0:... | code_fim | hard | {
"lang": "python",
"repo": "ynntech/tu-line-covid19",
"path": "/sql_edition/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = 0
for line in file:
cl_line = line.strip()
left, right_ = cl_line.split()
right = mapping[right_]
if left == right:
result += 3 + score[left]
elif right == "A" and left == "C":
result += 6 + 1
elif right == "B" and le... | code_fim | medium | {
"lang": "python",
"repo": "andriisoldatenko/fan",
"path": "/aoc22/day_002/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andriisoldatenko/fan path: /aoc22/day_002/main.py
import sys
import heapq
# FILE = sys.stdin
FILE = open("input.txt")
<|fim_suffix|>
def main(file):
result = 0
for line in file:
cl_line = line.strip()
left, right_ = cl_line.split()
right = mapping[right_]
... | code_fim | medium | {
"lang": "python",
"repo": "andriisoldatenko/fan",
"path": "/aoc22/day_002/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import threading
from concurrent.futures import ThreadPoolExecutor
lock = threading.Lock()
def funcao_para_thread():
global df
global lock
lock.acquire()
# adquire as chaves
lock.release()<|fim_prefix|># repo: netlabufjf/Geo-Twitter-Scripts path: /scripts/ler_chaves_pilha.py
imp... | code_fim | hard | {
"lang": "python",
"repo": "netlabufjf/Geo-Twitter-Scripts",
"path": "/scripts/ler_chaves_pilha.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def funcao_para_thread():
global df
global lock
lock.acquire()
# adquire as chaves
lock.release()<|fim_prefix|># repo: netlabufjf/Geo-Twitter-Scripts path: /scripts/ler_chaves_pilha.py
import pandas as pd
import os
# dir_base = os.path.abspath(os.path.dirname(__file__))
dir_base =... | code_fim | hard | {
"lang": "python",
"repo": "netlabufjf/Geo-Twitter-Scripts",
"path": "/scripts/ler_chaves_pilha.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netlabufjf/Geo-Twitter-Scripts path: /scripts/ler_chaves_pilha.py
import pandas as pd
import os
# dir_base = os.path.abspath(os.path.dirname(__file__))
dir_base = os.path.abspath(os.getcwd())
df = pd.read_csv("{}/scripts/keys_twitter.csv".format(dir_base))
consumer_key_list = df.consumer_key.to... | code_fim | medium | {
"lang": "python",
"repo": "netlabufjf/Geo-Twitter-Scripts",
"path": "/scripts/ler_chaves_pilha.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timson/crow path: /crow_security/__init__.py
__all__ = [
'Error',
'LoginError',
<|fim_suffix|> ResponseError,
CrowWsError,
Session
)<|fim_middle|>'ResponseError',
'Session'
]
from .crow import ( # NOQA
Error,
CrowLoginError,
| code_fim | medium | {
"lang": "python",
"repo": "timson/crow",
"path": "/crow_security/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>port ( # NOQA
Error,
CrowLoginError,
ResponseError,
CrowWsError,
Session
)<|fim_prefix|># repo: timson/crow path: /crow_security/__init__.py
__all__ = [
'Error',
'LoginError',
<|fim_middle|>'ResponseError',
'Session'
]
from .crow im | code_fim | easy | {
"lang": "python",
"repo": "timson/crow",
"path": "/crow_security/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ResponseError,
CrowWsError,
Session
)<|fim_prefix|># repo: timson/crow path: /crow_security/__init__.py
__all__ = [
'Error',
'LoginError',
'ResponseError',
'Session'
]
from .crow im<|fim_middle|>port ( # NOQA
Error,
CrowLoginError,
| code_fim | easy | {
"lang": "python",
"repo": "timson/crow",
"path": "/crow_security/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_create_input_feeder_with_several_precision_info(self):
inputs = {'data': (1, 3, 10, 10), 'const_data': (1, 4)}
input_feeder = InputFeeder(
[{'name': 'const_data', 'type': 'CONST_INPUT', 'value': [[1, 2, 3, 4]], 'precision': 'FP32'}],
inputs, lambda name... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/open_model_zoo",
"path": "/tools/accuracy_checker/tests/test_input_feeder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> input_feeder = InputFeeder([], {'input1': InputInfo_test(shape=(1, 3, 10, 10)), 'input2': InputInfo_test(shape=(1, 3, 10, 10))}, {})
result = input_feeder.fill_non_constant_inputs([
DataRepresentation(np.zeros((10, 10, 3)), identifier='0'),
DataRepresentation(np.zer... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/open_model_zoo",
"path": "/tools/accuracy_checker/tests/test_input_feeder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openvinotoolkit/open_model_zoo path: /tools/accuracy_checker/tests/test_input_feeder.py
assert input_feeder.non_constant_inputs == ['data']
def test_create_input_feeder_config_inputs_contain_only_const_inputs_with_list_value(self):
inputs = {'data': (1, 3, 10, 10), 'const_data':... | code_fim | hard | {
"lang": "python",
"repo": "openvinotoolkit/open_model_zoo",
"path": "/tools/accuracy_checker/tests/test_input_feeder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gnsantos/girard path: /src/girard/series_convergence.py
import numpy as np
def convergence_matrix(spanning_matrix):
grammian_matrix = spanning_matrix.T * spanning_matrix
cm = (-1) * grammian_matrix
np.fill_diagonal(cm, 1)
return cm
<|fim_suffix|> matrix_for_convergence = conv... | code_fim | easy | {
"lang": "python",
"repo": "gnsantos/girard",
"path": "/src/girard/series_convergence.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> matrix_for_convergence = convergence_matrix(spanning_matrix)
convergence_matrix_eigenvalues = np.linalg.eigvals(convergence_matrix)
return min(convergence_matrix_eigenvalues) > 0<|fim_prefix|># repo: gnsantos/girard path: /src/girard/series_convergence.py
import numpy as np
def convergence_m... | code_fim | medium | {
"lang": "python",
"repo": "gnsantos/girard",
"path": "/src/girard/series_convergence.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HuiDBK/python-basic path: /code/day03-Python运算符/02-比较运算符-IPython测验.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author: Hui
# @Desc: { 比较运算符-IPython测验 }
# @Date: 2021/06/05 23:34
<|fim_suffix|># 大于等于、小于等于比较运算符测验
"""
In [51]: # 大于等于
In [52]: a >= b
Out[52]: False
In [53]: # 小于等于
In [54]: a... | code_fim | hard | {
"lang": "python",
"repo": "HuiDBK/python-basic",
"path": "/code/day03-Python运算符/02-比较运算符-IPython测验.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>In [49]: # 小于
In [50]: a < b
Out[50]: True
"""
# 大于等于、小于等于比较运算符测验
"""
In [51]: # 大于等于
In [52]: a >= b
Out[52]: False
In [53]: # 小于等于
In [54]: a <= b
Out[54]: True
"""<|fim_prefix|># repo: HuiDBK/python-basic path: /code/day03-Python运算符/02-比较运算符-IPython测验.py
#!/usr/bin/python3
# -*- coding: utf-8 -*... | code_fim | medium | {
"lang": "python",
"repo": "HuiDBK/python-basic",
"path": "/code/day03-Python运算符/02-比较运算符-IPython测验.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # is something important missing?
indices = (np.s_[10:25, 30:60, 100:103], # full index
np.s_[:], # everything
np.s_[..., 10:25], # ellipsis
np.s_[0, :, 10]) # singletons
for index in indices:
out1 = x[index]
... | code_fim | hard | {
"lang": "python",
"repo": "jhennies/elf",
"path": "/test/test_util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jhennies/elf path: /test/test_util.py
import unittest
import numpy as np
try:
import nifty.tools as nt
except ImportError:
nt = None
class TestUtil(unittest.TestCase):
def test_normalize_index(self):
from elf.util import normalize_index, squeeze_singletons
shape = (... | code_fim | hard | {
"lang": "python",
"repo": "jhennies/elf",
"path": "/test/test_util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from elf.util import downscale_shape
n = 10
max_len = 1024
max_scale = 6
for ndim in (2, 3, 4):
origin = [0] * ndim
for _ in range(n):
shape = tuple(np.random.randint(1, max_len, size=ndim))
scale = tuple(np.ra... | code_fim | hard | {
"lang": "python",
"repo": "jhennies/elf",
"path": "/test/test_util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jilimcaoco/MPProjects path: /KCNQ/docking/scripts/analysis/get_mol2_zinc_id_head.py
import math, sys
import os.path
from math import sqrt
# Written by Trent Balius and Jiankun Lyu
def read_multi_mol2file(filename,molname,text1):
file1 = open(filename,'r')
lines = file1.readlines()
... | code_fim | hard | {
"lang": "python",
"repo": "jilimcaoco/MPProjects",
"path": "/KCNQ/docking/scripts/analysis/get_mol2_zinc_id_head.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> textAll = ""
for molname in lines:
#print "searching " + filename + " for molecule " + molname
#molname = molname.strip('\n').replace("ZINC","NC")
print "searching " + filename + " for molecule " + molname
text1 = read_multi_mol2file(filename,molname,text1)
textA... | code_fim | hard | {
"lang": "python",
"repo": "jilimcaoco/MPProjects",
"path": "/KCNQ/docking/scripts/analysis/get_mol2_zinc_id_head.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ruobing-wang/parsl path: /parsl/executors/workqueue/standaloneserver.py
import logging
import zmq
import os
import pickle
from ipyparallel.serialize import unpack_apply_message, serialize_object
logger = logging.getLogger('StandAloneServer')
def StandAloneServer(data_dir='.',
... | code_fim | hard | {
"lang": "python",
"repo": "ruobing-wang/parsl",
"path": "/parsl/executors/workqueue/standaloneserver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Initialize poll set
poller = zmq.Poller()
poller.register(frontend, zmq.POLLIN)
poller.register(backend, zmq.POLLIN)
while True:
socks = dict(poller.poll())
if socks.get(frontend) == zmq.POLLIN:
message = frontend.recv_multipart()
print('Rec... | code_fim | hard | {
"lang": "python",
"repo": "ruobing-wang/parsl",
"path": "/parsl/executors/workqueue/standaloneserver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxime-filippini/var-iety path: /instruments/option.py
from .instrument import Instrument
from .terms_conditions import TermsConditions
from .term_structure import TermStructure, CurveData
from math import log, sqrt, exp
from datetime import datetime
from scipy.stats import norm
from scipy.opti... | code_fim | hard | {
"lang": "python",
"repo": "maxime-filippini/var-iety",
"path": "/instruments/option.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return abs(self.black_scholes_price(sigma=sigma) - self.premium)
res = minimize(loss, 0.1, tol=1e-9)
return res.x[0]
@staticmethod
def d1(S, K, r, q, T, sigma):
return (log(S/K) + (r-q+0.5*sigma**2)*T)/(sigma*sqrt(T))
@staticmethod
... | code_fim | hard | {
"lang": "python",
"repo": "maxime-filippini/var-iety",
"path": "/instruments/option.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.volatility = volatility
self.premium = premium
self.dividend_yield = dividend_yield
def add_price(self):
if self.option_type == 'european':
self.
def black_scholes_price(self, sigma=None):
if sigma is None:
sigm... | code_fim | hard | {
"lang": "python",
"repo": "maxime-filippini/var-iety",
"path": "/instruments/option.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.notchedit.text() == '':
return None
freqs = self.notchedit.text().split(',')
try:
return [float(freq) for freq in freqs]
except ValueError as e:
show_info('Notch filter value was not correctly read.',
info=st... | code_fim | hard | {
"lang": "python",
"repo": "niteshbhatia008/mnelab",
"path": "/mnelab/dialogs/filterdialog.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def high(self):
high = self.highedit.text()
try:
return float(high) if high else None
except ValueError as e:
show_info('High filter value was not correctly read.',
info=str(e))
return None
@property
... | code_fim | hard | {
"lang": "python",
"repo": "niteshbhatia008/mnelab",
"path": "/mnelab/dialogs/filterdialog.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: niteshbhatia008/mnelab path: /mnelab/dialogs/filterdialog.py
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QGridLayout, QLabel,
QLineEdit, QDialogButtonBox)
from ..utils.information import show_info
class FilterDialog(QDialog):
def __init__(self, parent, is... | code_fim | hard | {
"lang": "python",
"repo": "niteshbhatia008/mnelab",
"path": "/mnelab/dialogs/filterdialog.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yshshadow/Leetcode path: /101-150/115.py
# Given a string S and a string T, count the number of distinct subsequences of S which equals T.
#
# A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the... | code_fim | hard | {
"lang": "python",
"repo": "yshshadow/Leetcode",
"path": "/101-150/115.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ls, lt = len(s), len(t)
if ls < lt:
return 0
dp1 = [0] * (ls + 1)
dp2 = [0] * (ls + 1)
dp1[0] = 1
for i in range(1, lt + 1):
for j in range(1, ls + 1):
dp2[j] = dp2[j - 1]
if s[j - 1] == t[i - 1]:
... | code_fim | hard | {
"lang": "python",
"repo": "yshshadow/Leetcode",
"path": "/101-150/115.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eclipse/steady path: /lang-python/src/test/resources/tiny_py_interpreter/tinypy/AST/stmt.py
import copy
from enum import Enum
from tinypy.AST.ast import Statement, Expression, MemoryContext
from tinypy.AST.expr import AddOp, SubOp, MultOp, DivOp, ModOp, LshiftOp, RshiftOp, BinOp, UnaryOp, Compare... | code_fim | hard | {
"lang": "python",
"repo": "eclipse/steady",
"path": "/lang-python/src/test/resources/tiny_py_interpreter/tinypy/AST/stmt.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class AssignWrapper:
def __init__(self, collection, index):
self.collection = collection
self.index = index
def __init__(self, value, slice, ctx):
super().__init__()
self.value = value
self.slice = slice
self.ctx = ctx
def eval... | code_fim | hard | {
"lang": "python",
"repo": "eclipse/steady",
"path": "/lang-python/src/test/resources/tiny_py_interpreter/tinypy/AST/stmt.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._attr_is_on = True
self._delay_listener = evt.async_call_later(
self.hass, OFF_DELAY, self.off_delay_listener
)
self.async_write_ha_state()
@callback
def off_delay_listener(self, now: datetime) -> None:
"""Switch device ... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/homeassistant/components/ezviz/siren.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/ezviz/siren.py
"""Support for EZVIZ sirens."""
from __future__ import annotations
from collections.abc import Callable
from datetime import datetime, timedelta
from typing import Any
from pyezviz import HTTPError, PyEzvizError, SupportExt
fro... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/homeassistant/components/ezviz/siren.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def extract_procedure_files(spark_session: SparkSession, xml_inputs: List[Dict]):
schema = get_centre_procedure_schema()
printed: bool = False
procedure_df: DataFrame = None
for input_procedures in xml_inputs:
datasource_short_name = input_procedures.get('datasourceShortName')... | code_fim | hard | {
"lang": "python",
"repo": "mrelac-ebi/impc-etl",
"path": "/impc_etl/jobs/extraction/dcc_extractor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def extract_specimen_files(spark_session: SparkSession, xml_inputs: List[Dict]):
schema = get_centre_specimen_schema()
printed: bool = False
specimen_df: DataFrame = None
for input_specimens in xml_inputs:
datasource_short_name = input_specimens.get('datasourceShortName')
... | code_fim | hard | {
"lang": "python",
"repo": "mrelac-ebi/impc-etl",
"path": "/impc_etl/jobs/extraction/dcc_extractor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrelac-ebi/impc-etl path: /impc_etl/jobs/extraction/dcc_extractor.py
"""
DCC loader module
extract_observations:
extract_ontological_observations:
extract_unidimensional_observations:
extract_time_series_observations:
extract_categorical_observations:
extract_samples:
"""
... | code_fim | hard | {
"lang": "python",
"repo": "mrelac-ebi/impc-etl",
"path": "/impc_etl/jobs/extraction/dcc_extractor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>import math
co = float(input('Qual o valor do cateto oposto? '))
ca = float(input('Qual o valor do cateto adjacente? '))
hip = math.hypot(co, ca)
hip2 = math.sqrt(co*co + ca*ca)
print('{:.2f} ou {:.2f}'.format(hip, hip2))<|fim_prefix|># repo: Roberto-Mota/CursoemVideo path: /exercicios/ex017.py
# Desafio... | code_fim | easy | {
"lang": "python",
"repo": "Roberto-Mota/CursoemVideo",
"path": "/exercicios/ex017.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Roberto-Mota/CursoemVideo path: /exercicios/ex017.py
# Desafio 017 -> Faça um progrma que leia o comprimento do cateto oposto e do cateto adjacente
# de um triângulo retângulo, calcule e mostre o comprimento da hipotenusa
# o quadrado da hipotenusa é igual a soma dos quadrados dos... | code_fim | easy | {
"lang": "python",
"repo": "Roberto-Mota/CursoemVideo",
"path": "/exercicios/ex017.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saikrishnarallabandi/compositionality-expts path: /lib/n2nmn/models_shapes/nmn3_modules.py
from __future__ import absolute_import, division, print_function
import numpy as np
import tensorflow as tf
from tensorflow import convert_to_tensor as to_T
from util.cnn import fc_layer as fc, conv_layer... | code_fim | hard | {
"lang": "python",
"repo": "saikrishnarallabandi/compositionality-expts",
"path": "/lib/n2nmn/models_shapes/nmn3_modules.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tf.device('/cpu:0'):
return [tf.nn.conv2d_backprop_input(
tf.shape(op.inputs[0]), op.inputs[1], grad, op.get_attr('strides'),
op.get_attr('padding'), op.get_attr('use_cudnn_on_gpu'),
op.get_attr('data_format')),
tf.nn.conv2d_... | code_fim | hard | {
"lang": "python",
"repo": "saikrishnarallabandi/compositionality-expts",
"path": "/lib/n2nmn/models_shapes/nmn3_modules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hallcode/yt-loader path: /loader/cli.py
import click, csv, re
from .download import download_video
# Dont hate me
import ssl
ssl._create_default_https_context = ssl._create_stdlib_context
@click.command()
@click.argument('csv_path', type=click.Path(exists=True))
def main(csv_path):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "hallcode/yt-loader",
"path": "/loader/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> /b
[0] YouTube URL (or video hash)
[1] output sub-directory
[2] options (see README)
[3] Output filename
"""
with open(csv_path, newline='') as csvFile:
csv_object = csv.reader(csvFile, delimiter=',')
for row in csv_object:
# Get URL
# C... | code_fim | medium | {
"lang": "python",
"repo": "hallcode/yt-loader",
"path": "/loader/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for row in csv_object:
# Get URL
# Check that the URL contains correct domain, otherwise add it
url_regex = r"v=([^&]+)"
youtube_url = "https://youtu.be/"
match = re.search(url_regex, row[0])
if match:
video_r... | code_fim | hard | {
"lang": "python",
"repo": "hallcode/yt-loader",
"path": "/loader/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidwagner/bagnet-patch-defense path: /code/util/layers.py
from keras.layers import Layer
from keras import backend as K
import tensorflow as tf
from util.tensor import*
DEBUG = False
class ApplyStickerLayer(Layer):
def __init__(self, img, size, loc):
"""Save IMG as base image. SIZE... | code_fim | hard | {
"lang": "python",
"repo": "davidwagner/bagnet-patch-defense",
"path": "/code/util/layers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Concat the batch size with the full shape
full_shape_batch = tf.concat([batch_size, self.full_shape], 0)
# Expand sticker to full image
idx = tf.where(tf.not_equal(subimg, 0))
stick_on = tf.SparseTensor(idx, tf.gather_nd(subimg, idx), full_shape_batch)
... | code_fim | hard | {
"lang": "python",
"repo": "davidwagner/bagnet-patch-defense",
"path": "/code/util/layers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sii/siptrackweb path: /siptrackweb/views/config.py
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import Context, loader
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from siptracklib.utils impo... | code_fim | hard | {
"lang": "python",
"repo": "sii/siptrackweb",
"path": "/siptrackweb/views/config.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@helpers.authcheck
def delete(request, oid):
pm = helpers.PageManager(request, 'stweb/generic_form.html')
config = pm.setVar('config', pm.object_store.getOID(oid))
pm.addForm(DeleteForm(), '/config/delete/post/%s/' % (config.oid),
'remove config', message = 'Removing config.')
... | code_fim | hard | {
"lang": "python",
"repo": "sii/siptrackweb",
"path": "/siptrackweb/views/config.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('', views.index, name='index'),
path('list/', views.blog_list, name='list'),
path('tag/<str:name>/', views.tag, name='tag'),
path('category/<str:name>/', views.category, name='category'),
path('detail/<int:pk>/', views.detail, name='detail'),
path('archive/', v... | code_fim | medium | {
"lang": "python",
"repo": "mrpal39/ev_code",
"path": "/awssam/django-blog/src/blog/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrpal39/ev_code path: /awssam/django-blog/src/blog/urls.py
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: urls.py
Description :
Author : JHao
date: 2017/4/13
-------------------------------------------------
Change Ac... | code_fim | medium | {
"lang": "python",
"repo": "mrpal39/ev_code",
"path": "/awssam/django-blog/src/blog/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minlee077/Basic_Crawling path: /BeautifulSoup/PythonCrawler.py
import urllib.request
import bs4
<|fim_suffix|>#Beautiful soup
bsObj = bs4.BeautifulSoup(html,"html.parser")
firstDiseaseBlock = bsObj.find("div",{"class":"info_area"}) #crawling based on tag and class name<|fim_middle|>
# html obje... | code_fim | medium | {
"lang": "python",
"repo": "minlee077/Basic_Crawling",
"path": "/BeautifulSoup/PythonCrawler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Beautiful soup
bsObj = bs4.BeautifulSoup(html,"html.parser")
firstDiseaseBlock = bsObj.find("div",{"class":"info_area"}) #crawling based on tag and class name<|fim_prefix|># repo: minlee077/Basic_Crawling path: /BeautifulSoup/PythonCrawler.py
import urllib.request
import bs4
<|fim_middle|># html obje... | code_fim | medium | {
"lang": "python",
"repo": "minlee077/Basic_Crawling",
"path": "/BeautifulSoup/PythonCrawler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hackademico/malwinx path: /win32apiparser.py
import json
def getFunctionDetail(funcName):
if funcName.endswith("A"):
funcName=funcName.replace(funcName[len(funcName)-1],'')
if funcName.endswith("W"):
funcName=funcName.replace(funcName[len(funcName)-1],'')
funcDetails={}
print (... | code_fim | hard | {
"lang": "python",
"repo": "Hackademico/malwinx",
"path": "/win32apiparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>=jsonData[index]['return_type']
funcDetails['remarks']=jsonData[index]['remarks']
funcDetails['header']=jsonData[index]['header']
return "No Error",funcDetails
except Exception as e:
print (str(e))
return "Error Found:"+str(e),[]<|fim_prefix|># repo: Hackademico/malwinx pa... | code_fim | hard | {
"lang": "python",
"repo": "Hackademico/malwinx",
"path": "/win32apiparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloudmesh-community/fa19-516-155 path: /bkp_cloudmesh-transfer/cloudmesh/transfer/command/transfer.py
from __future__ import print_function
from cloudmesh.shell.command import command
from cloudmesh.shell.command import PluginCommand
#from cloudmesh.transfer.api.manager import Manager
from cloudm... | code_fim | hard | {
"lang": "python",
"repo": "cloudmesh-community/fa19-516-155",
"path": "/bkp_cloudmesh-transfer/cloudmesh/transfer/command/transfer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if arguments.FILE:
print("option a")
#m.list(path_expand(arguments.FILE))
elif arguments.list:
print("option b")
# m.list("just calling list without parameter")
# provider = Provider('local')
Console.error("This is just ... | code_fim | hard | {
"lang": "python",
"repo": "cloudmesh-community/fa19-516-155",
"path": "/bkp_cloudmesh-transfer/cloudmesh/transfer/command/transfer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO
# Run tests
logger.client_addr = cli
params = {}
for i in headers[1:]:
try:
headerField = i[:i.index(':')]
if (headerField == "Accept"):
parseContentType(i[i.index(':') + 2:len(i) - 1])
params[headerField] = ... | code_fim | hard | {
"lang": "python",
"repo": "AnupNair08/mHTTP-Server",
"path": "/src/methods/get.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #415
if ('Content-Encoding' in params.keys() and params['Content-Encoding']
not in entityHeaders['Content-Encoding']):
res = generateResponse(0, 415)
f.close()
logger.generateError(headers[0], res)
return res, ""
... | code_fim | hard | {
"lang": "python",
"repo": "AnupNair08/mHTTP-Server",
"path": "/src/methods/get.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AnupNair08/mHTTP-Server path: /src/methods/get.py
import os
import sys
sys.path.append(os.path.abspath(os.path.join('..')))
from utils import entityHeaders
from response import *
from logger import Logger
import pathlib
from utils.mediaTypes import mediaTypes
import random
import gzip, z... | code_fim | hard | {
"lang": "python",
"repo": "AnupNair08/mHTTP-Server",
"path": "/src/methods/get.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: philips-software/random_forest path: /tests/forest.py
import unittest
from src.tree import Leaf, Branch
from src.forest import train_forest, bootstrap, random_attributes
from tests.example import binary_samples as samples, continuous_samples
from tests.reveal import reveal
from tests.async_test i... | code_fim | hard | {
"lang": "python",
"repo": "philips-software/random_forest",
"path": "/tests/forest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def depth(tree):
if isinstance(tree, Leaf):
return 0
if isinstance(tree, Branch):
return depth(tree.left) + 1
def columns(samples):
return [
[samples[row][column] for row in range(len(samples))]
for column in range(samples.number_of_attributes)
]<|fim_pref... | code_fim | hard | {
"lang": "python",
"repo": "philips-software/random_forest",
"path": "/tests/forest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>nt(word + ' isn\'t a palindrome')
if_palindrome(word)<|fim_prefix|># repo: pexca/PYSEQ path: /mY_python code/palindrome.py
word = 'banana'
def if_palindrome(word):
reverse_word = word[::-1]
if word == reverse_word:
<|fim_middle|> print(word + " is a palindrome")
else:
pri | code_fim | easy | {
"lang": "python",
"repo": "pexca/PYSEQ",
"path": "/mY_python code/palindrome.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pexca/PYSEQ path: /mY_python code/palindrome.py
word = 'banana'
def if_palindrome(word):
reverse_word = word[::-1]
if word == reverse_word:
<|fim_suffix|>nt(word + ' isn\'t a palindrome')
if_palindrome(word)<|fim_middle|> print(word + " is a palindrome")
else:
pri | code_fim | easy | {
"lang": "python",
"repo": "pexca/PYSEQ",
"path": "/mY_python code/palindrome.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jpcxuexi/basicVSR_mge path: /edit/models/common/net.py
import numpy as np
import megengine
import megengine.module as M
import megengine.functional as F
from edit.models.common import ShuffleV2Block, CoordAtt
import math
from . import default_init_weights
class MobileNeXt(M.Module):
def __i... | code_fim | hard | {
"lang": "python",
"repo": "jpcxuexi/basicVSR_mge",
"path": "/edit/models/common/net.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ResBlocks(M.Module):
def __init__(self, channel_num, resblock_num, kernel_size=3, blocktype="resblock"):
super(ResBlocks, self).__init__()
assert blocktype in ("resblock", "shuffleblock", "MobileNeXt")
if blocktype == "resblock":
self.model = M.Sequential(
... | code_fim | hard | {
"lang": "python",
"repo": "jpcxuexi/basicVSR_mge",
"path": "/edit/models/common/net.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> will let you access all the sepal installed python libs which cover the mains geospatial and data analysis tools"
DROPPED = "Your local libs have been droped successfully"<|fim_prefix|># repo: 12rambau/drop-local-libs path: /message.py
DROP_BTN = "Drop your local libs"
EXPLAINATION = "By clicking on the... | code_fim | medium | {
"lang": "python",
"repo": "12rambau/drop-local-libs",
"path": "/message.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 12rambau/drop-local-libs path: /message.py
DROP_BTN = "Drop your local libs"
EXPLAINATION = "By clicking on the `Drop` button, yo<|fim_suffix|>ial and data analysis tools"
DROPPED = "Your local libs have been droped successfully"<|fim_middle|>u will remove from your sepal docker the locally insta... | code_fim | medium | {
"lang": "python",
"repo": "12rambau/drop-local-libs",
"path": "/message.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miltonnery/amazing_movie_trailers path: /entertaintment_center.py
"""Imports"""
import movie_trailers
import media
# Instances creation
# Interestellar Movie:
# movie title, storyline, poster image and movie trailer
interstellar = media.Movie(
"Interstellar",
"A team of explor... | code_fim | hard | {
"lang": "python",
"repo": "miltonnery/amazing_movie_trailers",
"path": "/entertaintment_center.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Capitain America (Civil War) Movie:
# movie title, storyline, poster image and movie trailer
capitain_america = media.Movie(
"Capitain America: Civil War",
"Political interference in the Avengers' activities"
"causes a rift between former allies Captain America and Iron Man.",
"htt... | code_fim | hard | {
"lang": "python",
"repo": "miltonnery/amazing_movie_trailers",
"path": "/entertaintment_center.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheSlimvReal/PSE---LA-meets-ML path: /modules/model/collector_module/generator.py
from modules.model.collector_module.ssget import SSGet
from modules.shared.regularity_calculator import RegularityCalculator
import numpy as np
<|fim_suffix|>
## Creates a matrix with the given size and densit... | code_fim | medium | {
"lang": "python",
"repo": "TheSlimvReal/PSE---LA-meets-ML",
"path": "/modules/model/collector_module/generator.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Creates a matrix with the given size and density
#
# @param size of the matrix
# @param density of the matrix
@staticmethod
def generate(size: int) -> np.ndarray:
generated_matrix = SSGet.get_matrix(size)
while not RegularityCalculator.is_regular(generated_m... | code_fim | medium | {
"lang": "python",
"repo": "TheSlimvReal/PSE---LA-meets-ML",
"path": "/modules/model/collector_module/generator.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> generated_matrix = SSGet.get_matrix(size)
while not RegularityCalculator.is_regular(generated_matrix.todense()):
generated_matrix = SSGet.get_matrix(size)
return generated_matrix<|fim_prefix|># repo: TheSlimvReal/PSE---LA-meets-ML path: /modules/model/collector_module/... | code_fim | medium | {
"lang": "python",
"repo": "TheSlimvReal/PSE---LA-meets-ML",
"path": "/modules/model/collector_module/generator.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matthew-huber/bme590hrm path: /test_loadCSV.py
from fileReader import load_csv
import pytest
@pytest.mark.parametrize("candidate,index,expected", [
('./test_data/test_data1.csv', 0, 0),
('./test_data/test_data1.csv', 9999, 27.775),
('./test_data/test_data1.csv', 3726, 10.35),
('... | code_fim | medium | {
"lang": "python",
"repo": "matthew-huber/bme590hrm",
"path": "/test_loadCSV.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize("candidate,index,expected", [
('./test_data/test_data1.csv', 0, -0.145),
('./test_data/test_data1.csv', 9999, 0.72),
('./test_data/test_data1.csv', 1883, -0.38),
('./test_data/test_data3.csv', 24, -0.26),
('./test_data/test_data31.csv', 28, 0.7),
('./test_... | code_fim | medium | {
"lang": "python",
"repo": "matthew-huber/bme590hrm",
"path": "/test_loadCSV.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize("candidate,index,expected", [
('./test_data/test_data1.csv', 0, -0.145),
('./test_data/test_data1.csv', 9999, 0.72),
('./test_data/test_data1.csv', 1883, -0.38),
('./test_data/test_data3.csv', 24, -0.26),
('./test_data/test_data31.csv', 28, 0.7),
('./test_d... | code_fim | medium | {
"lang": "python",
"repo": "matthew-huber/bme590hrm",
"path": "/test_loadCSV.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> navbar_settings.append(
"settings_dropdown",
{
"item_label": "Toggle Full Width",
"item_type": "Action",
"action": "frappe.ui.toolbar.toggle_full_width()",
"is_standard": 1,
"idx": 6,
},
)
navbar_settings.save()<|fim_prefix|># repo: frappe/frappe path: /frappe/patches/v13_0/add_t... | code_fim | medium | {
"lang": "python",
"repo": "frappe/frappe",
"path": "/frappe/patches/v13_0/add_toggle_width_in_navbar_settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frappe/frappe path: /frappe/patches/v13_0/add_toggle_width_in_navbar_settings.py
import frappe
def execute():
navbar_settings = frappe.get_single("Navbar Settings")
if frappe.db.exists("Navbar Item", {"item_label": "Toggle Full Width"}):
return
<|fim_suffix|> navbar_settings.append(
"se... | code_fim | medium | {
"lang": "python",
"repo": "frappe/frappe",
"path": "/frappe/patches/v13_0/add_toggle_width_in_navbar_settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> set_step(1,0,0,1,delay)
def set_step(a1,a2,b1,b2,delay):
GPIO.output(input1,a1)
GPIO.output(input2,a2)
GPIO.output(input3,b1)
GPIO.output(input4,b2)
time.sleep(delay)
if __name__ == "__main__":
main()<|fim_prefix|># repo: PacktPublishing/Raspberry-P... | code_fim | medium | {
"lang": "python",
"repo": "PacktPublishing/Raspberry-Pi-Zero-Cookbook",
"path": "/Chapter07/movestepper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PacktPublishing/Raspberry-Pi-Zero-Cookbook path: /Chapter07/movestepper.py
#!/usr/bin/env python
# Raspberry Pi Zero Cookbook
# Stepper Motor Control
import RPi.GPIO as GPIO
import time
import argparse
GPIO.setmode(GPIO.BCM)
input1 = 4 #To A1 Coil
input2 = 17 #To A2 Coil
input3 = 24 #To B1 Coil... | code_fim | medium | {
"lang": "python",
"repo": "PacktPublishing/Raspberry-Pi-Zero-Cookbook",
"path": "/Chapter07/movestepper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.