text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> settings = {}
for i in range(1, parameters.numRows):
if parameters[i, 'readonly'] == '1' or parameters[i, 'enabled'] == '0':
continue
path = parameters[i, 'path'].val
if path not in settings:
settings[path] = {}
name = parameters[i, 'name'].val
mode = parameters[i, 'mode']
if... | code_fim | hard | {
"lang": "python",
"repo": "optexture/td-components",
"path": "/utils/settings/SettingsExt.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def generarVentana(filas, diccionario):
"""Genera una ventana del juego Flood-It con los colores especificados en el argumento. Debe ser lista de strings.
"""
root = Tk()
canvas = Canvas(root, width = 280, height = 280)
x1, y1, x2, y2 = 0, 0, 20, 20
for fila in filas:
for ... | code_fim | hard | {
"lang": "python",
"repo": "binary-hideout/sistemas-adaptativos",
"path": "/floodit/plantilla-floodit.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: binary-hideout/sistemas-adaptativos path: /floodit/plantilla-floodit.py
from tkinter import Tk, Canvas
from sys import argv
def leerArchivoCL():
"""Leer contenido de un archivo especificado en el segundo argumento de la línea de comandos (CL).
Regresa el contenido como una lista de c... | code_fim | hard | {
"lang": "python",
"repo": "binary-hideout/sistemas-adaptativos",
"path": "/floodit/plantilla-floodit.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Genera una ventana del juego Flood-It con los colores especificados en el argumento. Debe ser lista de strings.
"""
root = Tk()
canvas = Canvas(root, width = 280, height = 280)
x1, y1, x2, y2 = 0, 0, 20, 20
for fila in filas:
for color in fila:
canvas.create... | code_fim | hard | {
"lang": "python",
"repo": "binary-hideout/sistemas-adaptativos",
"path": "/floodit/plantilla-floodit.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> if layer_type == 'reduce' and layer.input[0] in load_constant_outputs:
x = load_constant_outputs[layer.input[0]][0]
shape = load_constant_outputs[layer.input[0]][1]
y, shape = _evaluate_reduce(layer, x, shape)
_replace_with_load_constant(nn_layers, i, y, shape, load_constant_ou... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Machine-Learning-Projects-for-Mobile-Applications",
"path": "/Chapter03/tfcoreml/optimizations/_optimize.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PacktPublishing/Machine-Learning-Projects-for-Mobile-Applications path: /Chapter03/tfcoreml/optimizations/_optimize.py
import numpy as np
from coremltools.proto import NeuralNetwork_pb2 as _NeuralNetwork_pb2
def _evaluate_slice(layer, x, shape):
params = layer.slice
start_index = params.star... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Machine-Learning-Projects-for-Mobile-Applications",
"path": "/Chapter03/tfcoreml/optimizations/_optimize.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elem_cnt = input.size
if np_log_target:
_np_diff = -np.exp(target)
else:
_np_diff = -target
_zero_index = np.where(target > 0, 1, 0)
_np_diff = _np_diff * _zero_index
return {
"np_kldivloss_grad": _np_diff,
... | code_fim | hard | {
"lang": "python",
"repo": "hxfxjun/oneflow",
"path": "/python/oneflow/compatible/single_client/test/ops/test_KLDivloss.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@flow.unittest.skip_unless_1n1d()
class Test_KLDivLoss_1n1d(flow.unittest.TestCase):
def test_kldivloss_cpu(test_case):
arg_dict = _gen_arg_dict(
shape=(3, 3),
log_target=[True],
device_type="cpu",
machine_ids="0:0",
device_counts=1,... | code_fim | hard | {
"lang": "python",
"repo": "hxfxjun/oneflow",
"path": "/python/oneflow/compatible/single_client/test/ops/test_KLDivloss.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hxfxjun/oneflow path: /python/oneflow/compatible/single_client/test/ops/test_KLDivloss.py
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a... | code_fim | hard | {
"lang": "python",
"repo": "hxfxjun/oneflow",
"path": "/python/oneflow/compatible/single_client/test/ops/test_KLDivloss.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # from data.about import bot
return render_template("index.html")<|fim_prefix|># repo: gryffindor-guy/ChatBot-Using-Flask path: /todo_app/main.py
from flask import Flask, request, render_template
app = Flask(__name__)
<|fim_middle|>@app.route("/")
def introduce():
| code_fim | easy | {
"lang": "python",
"repo": "gryffindor-guy/ChatBot-Using-Flask",
"path": "/todo_app/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/")
def introduce():
# from data.about import bot
return render_template("index.html")<|fim_prefix|># repo: gryffindor-guy/ChatBot-Using-Flask path: /todo_app/main.py
from flask import Flask, request, render_template
<|fim_middle|>app = Flask(__name__)
| code_fim | easy | {
"lang": "python",
"repo": "gryffindor-guy/ChatBot-Using-Flask",
"path": "/todo_app/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gryffindor-guy/ChatBot-Using-Flask path: /todo_app/main.py
from flask import Flask, request, render_template
app = Flask(__name__)
<|fim_suffix|> # from data.about import bot
return render_template("index.html")<|fim_middle|>@app.route("/")
def introduce():
| code_fim | easy | {
"lang": "python",
"repo": "gryffindor-guy/ChatBot-Using-Flask",
"path": "/todo_app/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {}
def action_dir(self, dir_path, dir_name):
if dir_name in TARGET_NAME:
prefix_path = os.path.join(dir_path, dir_name) + '/'
for i in range(REPETITION):
ManyFileCreator.create_file(prefix_path, str(i))
self.logger.add_acted(d... | code_fim | medium | {
"lang": "python",
"repo": "YiFanChen99/file-walker-for-windows",
"path": "/Model/Actor/ManyFileCreator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def get_config():
return {}
def action_dir(self, dir_path, dir_name):
if dir_name in TARGET_NAME:
prefix_path = os.path.join(dir_path, dir_name) + '/'
for i in range(REPETITION):
ManyFileCreator.create_file(prefix_path, str... | code_fim | medium | {
"lang": "python",
"repo": "YiFanChen99/file-walker-for-windows",
"path": "/Model/Actor/ManyFileCreator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YiFanChen99/file-walker-for-windows path: /Model/Actor/ManyFileCreator.py
# -*- coding: utf-8 -*-
import os.path
from Model.Actor.Walker import Walker
from ModelUtility.CommonValue import OP
from ModelUtility.Settings import TARGET_NAME, REPETITION
<|fim_suffix|> if dir_name in TARGET_N... | code_fim | hard | {
"lang": "python",
"repo": "YiFanChen99/file-walker-for-windows",
"path": "/Model/Actor/ManyFileCreator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> root_path = args["root_path"]
save_path = args["save_path"]
## 시작하기
## 타코트론2는 기본적으로 22050 sampling rate에서 동작
sampling_rate = 22050
## 개인설정에 따라 특정 소리보다 작은 음성을 삭제하도록 설정
# decibel = 10
## Wav 파일 읽어오기 pcm 또는 다른 확장자도 사용 가능.
file_list = glob.glob(os.path.join(root_path, "... | code_fim | hard | {
"lang": "python",
"repo": "JoungheeKim/kobart-voice-summarization",
"path": "/src/voice/preprocessing/audio_preprocessing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoungheeKim/kobart-voice-summarization path: /src/voice/preprocessing/audio_preprocessing.py
# -*- coding: utf-8 -*-
"""
audio_preprocessing.py
Autor: HyeongwonKang, JeoungheeKim
audio clip resampling and Cropping blanks
예시 : python audio_preprocessing.py -r /data/wings -s resamp_data/wings
"""
... | code_fim | hard | {
"lang": "python",
"repo": "JoungheeKim/kobart-voice-summarization",
"path": "/src/voice/preprocessing/audio_preprocessing.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Wav 파일 읽어오기 pcm 또는 다른 확장자도 사용 가능.
file_list = glob.glob(os.path.join(root_path, "*.wav"))
# file_list = glob.glob(os.path.join(root_path, "*.pcm"))
## 저장할 위치 선택
os.makedirs(save_path, exist_ok=True)
for i, file_path in enumerate(file_list):
printProgressBar(i+1, len(f... | code_fim | hard | {
"lang": "python",
"repo": "JoungheeKim/kobart-voice-summarization",
"path": "/src/voice/preprocessing/audio_preprocessing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bolme/pyvision path: /src/pyvision/beta/videotasks.py
'''
Created on Jan 13, 2012
@author: bolme
'''
import pyvision as pv
from pyvision.face.CascadeDetector import CascadeDetector
from . import vtm
import numpy as np
class ChangeDetectionVT(vtm.VideoTask):
def __init__(self,frame_id):... | code_fim | hard | {
"lang": "python",
"repo": "bolme/pyvision",
"path": "/src/pyvision/beta/videotasks.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def execute(self,frame,detector=None):
if detector == None:
print("Initializing Face Detector.")
detector = CascadeDetector(min_size=(128,128))
faces = detector(frame)
for rect in faces:
frame.annotateRect(rect)
retu... | code_fim | hard | {
"lang": "python",
"repo": "bolme/pyvision",
"path": "/src/pyvision/beta/videotasks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if detector == None:
print("Initializing Face Detector.")
detector = CascadeDetector(min_size=(128,128))
faces = detector(frame)
for rect in faces:
frame.annotateRect(rect)
return [('FACES',self.getFrameId(),faces),("_FA... | code_fim | hard | {
"lang": "python",
"repo": "bolme/pyvision",
"path": "/src/pyvision/beta/videotasks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EvanXwang/Docker path: /Docker_Linebot_basic/venv/lib/python3.8/site-packages/liffpy/api.py
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
... | code_fim | hard | {
"lang": "python",
"repo": "EvanXwang/Docker",
"path": "/Docker_Linebot_basic/venv/lib/python3.8/site-packages/liffpy/api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return:
"""
api_url = 'https://api.line.me/liff/v1/apps'
result = requests.get(api_url, headers={"Authorization": self._headers["Authorization"]})
if result.status_code == 401:
raise ErrorResponse("[401 Error] Certification failed.")
elif result... | code_fim | hard | {
"lang": "python",
"repo": "EvanXwang/Docker",
"path": "/Docker_Linebot_basic/venv/lib/python3.8/site-packages/liffpy/api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wiseman/common_crawl_index path: /commoncrawlindex/prefix.py
# Copyright 2012 Triv.io, Scott Robertson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... | code_fim | hard | {
"lang": "python",
"repo": "wiseman/common_crawl_index",
"path": "/commoncrawlindex/prefix.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def significant(s1, s2):
"""Given two strings s1 and s2 and assuming s2 > s1, returns the
character that make s2 greater.
"""
cl = commonlen(s1, s2)
return s2[:cl + 1]<|fim_prefix|># repo: wiseman/common_crawl_index path: /commoncrawlindex/prefix.py
# Copyright 2012 Triv.io, Scott Robertson
#
#... | code_fim | hard | {
"lang": "python",
"repo": "wiseman/common_crawl_index",
"path": "/commoncrawlindex/prefix.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return u('{msg} | at line(pos) "{line}"').format(msg=self.msg, line=self.line)
class ParserNotFound(PlimError):
def __init__(self, lineno, line):
super(ParserNotFound, self).__init__()
self.lineno = lineno
self.line = line
def __unicode__(self):
return u(... | code_fim | hard | {
"lang": "python",
"repo": "spollard/Plim",
"path": "/plim/errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spollard/Plim path: /plim/errors.py
# -*- coding: utf-8 -*-
from .util import u
class PlimError(Exception):
def __str__(self):
return self.__unicode__().encode('utf-8')
<|fim_suffix|> super(ParserNotFound, self).__init__()
self.lineno = lineno
self.line = li... | code_fim | hard | {
"lang": "python",
"repo": "spollard/Plim",
"path": "/plim/errors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(PlimSyntaxError, self).__init__()
self.msg = msg
self.line = line
def __unicode__(self):
return u('{msg} | at line(pos) "{line}"').format(msg=self.msg, line=self.line)
class ParserNotFound(PlimError):
def __init__(self, lineno, line):
super(ParserNo... | code_fim | medium | {
"lang": "python",
"repo": "spollard/Plim",
"path": "/plim/errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param sprint_number: a number of the sprint to search
"""
self.jira = JiraApp(sprint_number, **kwargs)
self.slack = SlackApp(channel_id=kwargs.get('channel_id'))
async def run(self) -> None:
"""Gather data from Jira and post it to slack."""
pull_reques... | code_fim | medium | {
"lang": "python",
"repo": "itsdkey/workreporter",
"path": "/reporter/bridge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itsdkey/workreporter path: /reporter/bridge.py
from .apps import JiraApp, SlackApp
class Bridge:
"""Class for representing a bridge between Jira and Slack."""
def __init__(self, sprint_number: int = None, **kwargs):
<|fim_suffix|> async def run(self) -> None:
"""Gather data ... | code_fim | hard | {
"lang": "python",
"repo": "itsdkey/workreporter",
"path": "/reporter/bridge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Recommender
st.subheader("Recommender Engine")
with st.expander("Read more"):
st.write(
"There are several ways to improve and increase the robustness of the current recommender."
)
st.write(
"First improvement involves adding more input query ... | code_fim | hard | {
"lang": "python",
"repo": "TinaABB/projectpensive",
"path": "/demo/next_steps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TinaABB/projectpensive path: /demo/next_steps.py
import streamlit as st
def next_steps():
st.header("Next Steps")
st.write(
"This section outlines further work for Project Pensive."
)
# Civility
st.subheader("Civility")
with st.expander("Read more"):
st.... | code_fim | hard | {
"lang": "python",
"repo": "TinaABB/projectpensive",
"path": "/demo/next_steps.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sanjayatb/taxi-booking-system path: /test/test_taxi_manager.py
import unittest
from super_taxi.core.taxi_manager import taxi_manager,taxi_register
from super_taxi.model.taxis import Taxi
class TaxiRegisterTestCase(unittest.TestCase):
def test_register_taxi(self):
taxi_register.reset... | code_fim | hard | {
"lang": "python",
"repo": "sanjayatb/taxi-booking-system",
"path": "/test/test_taxi_manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_registered_taxi_count(self):
taxi_register.reset()
taxi_register.register(Taxi())
taxi_register.register(Taxi())
self.assertEqual(2,taxi_register.registered_taxi_count())
class TaxiManagerTestCase(unittest.TestCase):
def test_opt_in(self):
taxi_ma... | code_fim | hard | {
"lang": "python",
"repo": "sanjayatb/taxi-booking-system",
"path": "/test/test_taxi_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Graziellah/Computorv1 path: /computorv1.py
import sys
import Equation
if(len(sys.argv) == 1):
print('il manque un argument')
elif(len(sys.argv) > 3):
print('usage: computorv1 [equation] [-f]')
else:
seeFraction = False
if(len(sys.argv) == 3 and sys.argv[2] != "-f"):
print... | code_fim | hard | {
"lang": "python",
"repo": "Graziellah/Computorv1",
"path": "/computorv1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sys.exit(1)
if "-f" in sys.argv:
seeFraction = True
equa = sys.argv[1]
result = Equation.Equation(equa)
try:
result.split()
except SyntaxError as err:
print( err)
sys.exit(1)
try:
result.calculateDegreValue()
except ValueError as er... | code_fim | hard | {
"lang": "python",
"repo": "Graziellah/Computorv1",
"path": "/computorv1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 5elenay/hyaline path: /hyaline/utils/WrongType.py
def raise_error(variable, name, check) -> None:
if isinstance(check, tuple):
if not type(variable) in check:
<|fim_suffix|> f"Argument '{name}' type must be {check.__name__ if check != None else 'None'}, not {type(... | code_fim | hard | {
"lang": "python",
"repo": "5elenay/hyaline",
"path": "/hyaline/utils/WrongType.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>n check])}, not {type(variable).__name__}.")
else:
if not isinstance(variable, check):
raise TypeError(
f"Argument '{name}' type must be {check.__name__ if check != None else 'None'}, not {type(variable).__name__}.")<|fim_prefix|># repo: 5elenay/hyaline path: /hyal... | code_fim | hard | {
"lang": "python",
"repo": "5elenay/hyaline",
"path": "/hyaline/utils/WrongType.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SDash13/Mini-Projects path: /Project:-High-Rated-Games-on-Google-Playstore/code.py
# --------------
#Importing header files
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
data=pd.read_csv(path)
data.hist(column="Rating")
plt.show()
data=data[data["Rating"]<=5]
data.hist... | code_fim | hard | {
"lang": "python",
"repo": "SDash13/Mini-Projects",
"path": "/Project:-High-Rated-Games-on-Google-Playstore/code.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(data['Genres'].nunique())
data['Genres'] = data['Genres'].apply(split_data)
gr_mean = data.groupby(['Genres'],as_index=False)['Genres','Rating'].mean()
print(gr_mean.describe())
gr_mean = gr_mean.sort_values(by='Rating')
print(gr_mean.iloc[0])
print(gr_mean.iloc[-1])
#Code ends here
# ------... | code_fim | hard | {
"lang": "python",
"repo": "SDash13/Mini-Projects",
"path": "/Project:-High-Rated-Games-on-Google-Playstore/code.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# --------------
#Code starts here
print(data["Price"].value_counts())
data["Price"]=data["Price"].str.replace("$","")
data["Price"]=data["Price"].apply(float)
sns.regplot(x="Price",y="Rating",data=data)
plt.title("Rating vs Price")
#Code ends here
# --------------
#Code starts here
def split_data(... | code_fim | hard | {
"lang": "python",
"repo": "SDash13/Mini-Projects",
"path": "/Project:-High-Rated-Games-on-Google-Playstore/code.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> timeframe:
The timeframe to be analysed with the model.
es_name:
Model name which is used to save the timeseries CSV files in correct folder.
Return
------
demand :class:`~dict`
Dictionary yielding the components data.
loc :class:`~dict`
Dictionar... | code_fim | hard | {
"lang": "python",
"repo": "tZ3ma/tessif-phd",
"path": "/src/tessif/transform/es2es/cllp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tZ3ma/tessif-phd path: /src/tessif/transform/es2es/cllp.py
msg)
if component.timeseries:
flow_params.update(
{
'resource_unit': 'energy_per_cap', # to allow expansion on timeseries components
# ... | code_fim | hard | {
"lang": "python",
"repo": "tZ3ma/tessif-phd",
"path": "/src/tessif/transform/es2es/cllp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tZ3ma/tessif-phd path: /src/tessif/transform/es2es/cllp.py
ls=dict(
name=uid,
# only needed for visualisation in native calliope tools
color=str('#ffcc00'),
parent='storage',
carrier=storage.input,
),
... | code_fim | hard | {
"lang": "python",
"repo": "tZ3ma/tessif-phd",
"path": "/src/tessif/transform/es2es/cllp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = angular_softmax(inputs_features, inputs_weights, labels, 1, 4, 1000., 0.000025, 35., 0.)[0]
with tf.Session() as sess:
print('backprop angular_softmax in cpu:')
print(tf.test.compute_gradient_error(inputs_features, [3, 4], result, [3, 5], delta=0.001, x_init_value=np.a... | code_fim | hard | {
"lang": "python",
"repo": "leejang/deep_metric_learning",
"path": "/self_attention/veri_776/train_n_feature_extraction/03_new_test_model_on_VeRi/tf.extra_losses/test_op.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leejang/deep_metric_learning path: /self_attention/veri_776/train_n_feature_extraction/03_new_test_model_on_VeRi/tf.extra_losses/test_op.py
# MIT License
# Copyright (c) 2018 Changan Wang
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and assoc... | code_fim | hard | {
"lang": "python",
"repo": "leejang/deep_metric_learning",
"path": "/self_attention/veri_776/train_n_feature_extraction/03_new_test_model_on_VeRi/tf.extra_losses/test_op.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@ops.RegisterGradient("AngularSoftmax")
def _angular_softmax_grad(op, grad, _):
'''The gradients for `AngularSoftmax`.
'''
inputs_features = op.inputs[0]
inputs_weights = op.inputs[1]
inputs_labels = op.inputs[2]
cur_lambda = op.outputs[1]
#loss = op.outputs[0]
margin_order = op.get_attr('... | code_fim | hard | {
"lang": "python",
"repo": "leejang/deep_metric_learning",
"path": "/self_attention/veri_776/train_n_feature_extraction/03_new_test_model_on_VeRi/tf.extra_losses/test_op.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thorwolpert/namex path: /solr-feeder/solr_feeder/__init__.py
import os
import flask
import config
import solr_feeder.endpoints
<|fim_suffix|>
# Create the Flask application
def create_application(run_mode=os.getenv('FLASK_ENV', 'production')):
# Create application
application = flask... | code_fim | easy | {
"lang": "python",
"repo": "thorwolpert/namex",
"path": "/solr-feeder/solr_feeder/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Create the Flask application
def create_application(run_mode=os.getenv('FLASK_ENV', 'production')):
# Create application
application = flask.Flask(__name__)
application.config.from_object(config.CONFIGURATION[run_mode])
endpoints.api.init_app(application)
return application<|fim_pr... | code_fim | easy | {
"lang": "python",
"repo": "thorwolpert/namex",
"path": "/solr-feeder/solr_feeder/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create application
application = flask.Flask(__name__)
application.config.from_object(config.CONFIGURATION[run_mode])
endpoints.api.init_app(application)
return application<|fim_prefix|># repo: thorwolpert/namex path: /solr-feeder/solr_feeder/__init__.py
import os
import flask
i... | code_fim | medium | {
"lang": "python",
"repo": "thorwolpert/namex",
"path": "/solr-feeder/solr_feeder/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Paarzivall/Wzorce-Projektowe path: /Zad_Composite/Zad_Composite_Main.py
from Line import Line
from Rectangle import Rectangle
from Text import Text
from Picture import Picture
<|fim_suffix|> picture2 = Picture()
picture2.add(Text())
picture2.add(Line())
picture2.add(Rectangle())
... | code_fim | medium | {
"lang": "python",
"repo": "Paarzivall/Wzorce-Projektowe",
"path": "/Zad_Composite/Zad_Composite_Main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> picture1.add(picture2)
picture1.add(Line())
picture1.draw()<|fim_prefix|># repo: Paarzivall/Wzorce-Projektowe path: /Zad_Composite/Zad_Composite_Main.py
from Line import Line
from Rectangle import Rectangle
from Text import Text
from Picture import Picture
<|fim_middle|>if __name__ == '__m... | code_fim | hard | {
"lang": "python",
"repo": "Paarzivall/Wzorce-Projektowe",
"path": "/Zad_Composite/Zad_Composite_Main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> picture1.add(Line())
picture1.draw()<|fim_prefix|># repo: Paarzivall/Wzorce-Projektowe path: /Zad_Composite/Zad_Composite_Main.py
from Line import Line
from Rectangle import Rectangle
from Text import Text
from Picture import Picture
if __name__ == '__main__':
picture1 = Picture()
pictu... | code_fim | easy | {
"lang": "python",
"repo": "Paarzivall/Wzorce-Projektowe",
"path": "/Zad_Composite/Zad_Composite_Main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
if choosePhyllUse =="Default":
if (leafNumber < ldecr): phyllochron = fixPhyll * pdecr
elif (leafNumber >= ldecr and leafNumber < lincr): phyllochron = fixPhyll
else: phyllochron = fixPhyll * pincr
if choosePhyllUse =="PTQ":
pastMaxAI1 = pastMaxAI
ga... | code_fim | hard | {
"lang": "python",
"repo": "cyrillemidingoyi/SQ_Wheat_Phenology",
"path": "/test/openalea/phyllochron.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cyrillemidingoyi/SQ_Wheat_Phenology path: /test/openalea/phyllochron.py
import numpy as np
from copy import copy
from math import *
def phyllochron(fixPhyll=5.0,
leafNumber=0.0,
lincr=8.0,
ldecr=10.0,
pdecr=0.4,
pin... | code_fim | hard | {
"lang": "python",
"repo": "cyrillemidingoyi/SQ_Wheat_Phenology",
"path": "/test/openalea/phyllochron.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sousavf/rpi-web-streaming path: /web.py
#!/usr/bin/python
# coding: utf-8
import os
import time
from subprocess import call, check_output, PIPE
import sqlite3
from flask import Flask, render_template, url_for, redirect, request, g, jsonify
from flask_wtf.csrf import CsrfProtect
from lxml.html im... | code_fim | hard | {
"lang": "python",
"repo": "sousavf/rpi-web-streaming",
"path": "/web.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/overlay', methods=['GET'])
def overlay():
try:
overlay = query_db('select * from OVERLAY limit 1;', one=True)
if overlay is None:
return 'No such setting'
else:
tree = fromstring(urlopen(overlay[8]).read())
videoId = tree.xpath("... | code_fim | hard | {
"lang": "python",
"repo": "sousavf/rpi-web-streaming",
"path": "/web.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: russellmendonca/RoboticTasks path: /rllab/envs/mujoco/gripperSensor.py
from rllab.envs.base import Step
from rllab.misc.overrides import overrides
from .mujoco_env import MujocoEnv
import numpy as np
from rllab.core.serializable import Serializable
from rllab.misc import logger
from rllab.misc im... | code_fim | hard | {
"lang": "python",
"repo": "russellmendonca/RoboticTasks",
"path": "/rllab/envs/mujoco/gripperSensor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.get_current_obs()
def step(self, action):
action[2] = -action[1]
self.forward_dynamics(action)
next_obs = self.get_current_obs()
import ipdb
ipdb.set_trace()
rightFinger... | code_fim | hard | {
"lang": "python",
"repo": "russellmendonca/RoboticTasks",
"path": "/rllab/envs/mujoco/gripperSensor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>l3.pop()
print('popped l3:',l3)
l4=list(map(lambda n,m,o:n+m+o,l1,l2,l3))
print('l4:',l4)<|fim_prefix|># repo: ps2809/Python-Examples path: /map func.py
l1=[1,2,3,4,5,6,7,8,9,10]
l2=list(map(lambda n:n*n,l1))
print('l2:',l2)
l3=list((map(lamb<|fim_middle|>da n,m:n*m,l1,l2)))#map function can take more th... | code_fim | medium | {
"lang": "python",
"repo": "ps2809/Python-Examples",
"path": "/map func.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ps2809/Python-Examples path: /map func.py
l1=[1,2,3,4,5,6,7,8,9,10]
l2=list(map(lambda n:n*n,l1))
print('l2:',l2)
l3=list((map(lamb<|fim_suffix|>
#if the length of the sequence is not equal then function will perform till same length
l3.pop()
print('popped l3:',l3)
l4=list(map(lambda n,m,o:n+m+o,... | code_fim | medium | {
"lang": "python",
"repo": "ps2809/Python-Examples",
"path": "/map func.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import setuptools
setuptools.setup(
name='patch_alarm',
version='1.0.0',
description='patch alarm manager',
license='Apache-2.0',
packages=['patch_alarm'],
entry_points={}
)<|fim_prefix|># repo: starlingx/update path: /patch-alarm/patch-alarm/setup.py
#!/usr/bin/env python
"""
C... | code_fim | easy | {
"lang": "python",
"repo": "starlingx/update",
"path": "/patch-alarm/patch-alarm/setup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: starlingx/update path: /patch-alarm/patch-alarm/setup.py
#!/usr/bin/env python
"""
Copyright (c) 2014-2019 Wind River Systems, Inc.
<|fim_suffix|>setuptools.setup(
name='patch_alarm',
version='1.0.0',
description='patch alarm manager',
license='Apache-2.0',
packages=['patch_... | code_fim | medium | {
"lang": "python",
"repo": "starlingx/update",
"path": "/patch-alarm/patch-alarm/setup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model.parse_data()
id = model.model_id
code = model.code
version = model.version
model_file_med = config.STL_BASE_URL + "/model/m/%s/%s/%s-%s-%d-surface-med.stl" % (id, code, id, code, version)
model_file_low = config.STL_BASE_URL + "/model/m/%s/%s/%s-%s-%d-surface-low.stl" % (id, ... | code_fim | hard | {
"lang": "python",
"repo": "hidden-beauty/hiddenbeauty-web",
"path": "/hiddenbeauty/hiddenbeauty/views/model.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hidden-beauty/hiddenbeauty-web path: /hiddenbeauty/hiddenbeauty/views/model.py
import base64
import json
import gzip
import os
import random
import requests
import shutil
from subprocess import run, CalledProcessError
import tempfile
import urllib
from zipfile import ZipFile
from PIL import Imag... | code_fim | hard | {
"lang": "python",
"repo": "hidden-beauty/hiddenbeauty-web",
"path": "/hiddenbeauty/hiddenbeauty/views/model.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = self.client.leverage_buy(rate=5000, btc_amount=0.1, dry_run=True)
self.assertEqual(response["success"], True)
def test_leverage_sell(self):
response = self.client.leverage_sell(rate=5000, btc_amount=0.1, dry_run=True)
self.assertEqual(response["success"], Tr... | code_fim | hard | {
"lang": "python",
"repo": "dakimura/coincheck_api",
"path": "/tests/clients/test_order_api_client.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dakimura/coincheck_api path: /tests/clients/test_order_api_client.py
import logging
import unittest
from coincheck_api import settings
from coincheck_api.clients.order_api_client import OrderApiClient
from coincheck_api.exception import CoinCheckApiException
class TestOrderApi(unittest.TestCas... | code_fim | hard | {
"lang": "python",
"repo": "dakimura/coincheck_api",
"path": "/tests/clients/test_order_api_client.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_market_buy(self):
response = self.client.market_buy(jpy_amount=500, dry_run=True)
self.assertEqual(response["success"], True)
def test_market_sell(self):
response = self.client.market_sell(btc_amount=0.005, dry_run=True)
self.assertEqual(response["success"... | code_fim | hard | {
"lang": "python",
"repo": "dakimura/coincheck_api",
"path": "/tests/clients/test_order_api_client.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mfitzp/django-golifescience path: /apps/blog/feeds.py
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
# abl.es
from models import *
class LatestArticlesFeed(Feed):
title = "Latest articles"
link = "/blog/rss/"
description = "Latest art... | code_fim | medium | {
"lang": "python",
"repo": "mfitzp/django-golifescience",
"path": "/apps/blog/feeds.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def item_title(self, item):
return item.title
def item_description(self, item):
return item.content
def item_pubdate(self, item):
return item.created_at<|fim_prefix|># repo: mfitzp/django-golifescience path: /apps/blog/feeds.py
from django.contrib.syndication... | code_fim | hard | {
"lang": "python",
"repo": "mfitzp/django-golifescience",
"path": "/apps/blog/feeds.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danieljf24/cmrf path: /util/im2vec.py
# coding: utf-8
import os
import numpy as np
from basic.common import printStatus
from simpleknn.bigfile import BigFile
DEFAULT_K = 10
DEFAULT_BLOCK_SIZE = 2000
INFO = os.path.basename(__file__)
class Image2Vec:
<|fim_suffix|> assert(len(prob_vec)... | code_fim | hard | {
"lang": "python",
"repo": "danieljf24/cmrf",
"path": "/util/im2vec.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def embedding(self, prob_vec, k=10):
assert(len(prob_vec) == self.nr_of_labels), 'len(prob_vec)=%d, nr_of_labels=%d' % (len(prob_vec), self.nr_of_labels)
top_hits = np.argsort(prob_vec)[::-1][:k]
new_vec = np.array([0.] * self.feat_dim)
Z = 0.
for idx in top_h... | code_fim | hard | {
"lang": "python",
"repo": "danieljf24/cmrf",
"path": "/util/im2vec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kirasdad/Hacathon18_09 path: /src/features/environment.py
from behave import use_fixture
from src.fixtures import login_page
<|fim_suffix|> if tag == "fixture.login_page":
use_fixture(login_page, context)<|fim_middle|>def before_tag(context, tag):
| code_fim | easy | {
"lang": "python",
"repo": "kirasdad/Hacathon18_09",
"path": "/src/features/environment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if tag == "fixture.login_page":
use_fixture(login_page, context)<|fim_prefix|># repo: kirasdad/Hacathon18_09 path: /src/features/environment.py
from behave import use_fixture
from src.fixtures import login_page
<|fim_middle|>
def before_tag(context, tag):
| code_fim | easy | {
"lang": "python",
"repo": "kirasdad/Hacathon18_09",
"path": "/src/features/environment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @convert_kwargs_to_snake_case
def wrapped_func(*_, **kwargs):
assert kwargs == {
"first_parameter": True,
"list_of_items": [
{"first_property": 1, "second_property": 2},
],
}
wrapped_func(
firstParameter=True,
... | code_fim | hard | {
"lang": "python",
"repo": "mirumee/ariadne",
"path": "/tests/test_kwargs_camel_case_conversion.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> wrapped_func(
firstParameter=True,
listOfItems=["firstItem", "secondItem"],
)
@pytest.mark.asyncio
async def test_decorator_converts_kwargs_to_camel_case_for_async_resolver():
@convert_kwargs_to_snake_case
async def wrapped_func(*_, **kwargs):
assert kwargs == {
... | code_fim | hard | {
"lang": "python",
"repo": "mirumee/ariadne",
"path": "/tests/test_kwargs_camel_case_conversion.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mirumee/ariadne path: /tests/test_kwargs_camel_case_conversion.py
import pytest
from ariadne import convert_kwargs_to_snake_case
def test_decorator_converts_kwargs_to_camel_case():
@convert_kwargs_to_snake_case
def wrapped_func(*_, **kwargs):
assert kwargs == {
"fir... | code_fim | hard | {
"lang": "python",
"repo": "mirumee/ariadne",
"path": "/tests/test_kwargs_camel_case_conversion.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rockmenjack/TupleNet path: /src/tests/http_simple_server.py
#!/usr/bin/env python
import sys
import SimpleHTTPServer
import SocketServer
PORT = 9979
if len(sys.argv) > 1:
PORT = int(sys.a<|fim_suffix|>= SocketServer.TCPServer(("", PORT), Handler)
httpd.serve_forever()<|fim_middle|>rgv[1])
Ha... | code_fim | medium | {
"lang": "python",
"repo": "rockmenjack/TupleNet",
"path": "/src/tests/http_simple_server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rgv[1])
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd.serve_forever()<|fim_prefix|># repo: rockmenjack/TupleNet path: /src/tests/http_simple_server.py
#!/usr/bin/env python
import sys
import SimpleHTTPServer
import So<|fim_middle|>cketServer... | code_fim | medium | {
"lang": "python",
"repo": "rockmenjack/TupleNet",
"path": "/src/tests/http_simple_server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bourneagain/pythonBytes path: /lru_cache.py
REMOVED = '<removed-key>'
# @param capacity, an integer
def __init__(self, capacity):
self.capacity = capacity
self.cache = {}
self.pq = []
self.size = 0
self.counter = 0
# @return an integer
def get(self, key):
if key not in se... | code_fim | hard | {
"lang": "python",
"repo": "bourneagain/pythonBytes",
"path": "/lru_cache.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># @param key, an integer
# @param value, an integer
# @return nothing
def set(self, key, value):
if key in self.cache:
self.remove(key)
else:
if self.size < self.capacity:
self.size += 1
else:
while self.pq:
_, k, _ = heapq.heappop(se... | code_fim | hard | {
"lang": "python",
"repo": "bourneagain/pythonBytes",
"path": "/lru_cache.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># On voit que là aussi ça donne PLEIN d'erreurs :
#
# - abandon / abandonne -> abandon·ne
# - action / actionne -> action·ne
# - addition / additionne -> addition·ne
# - affection / affectionne -> affection·... | code_fim | hard | {
"lang": "python",
"repo": "Naereen/notebooks",
"path": "/Ecriture inclusive.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>nouveaux_mots_inclusifs_singuliers = []
nouveaux_mots_inclusifs_pluriels = []
for mot in tqdm(mots):
if mot.endswith("eau") and len(mot) > 3 and mot + "x" in set_mots:
mot_feminin = f"{mot[:-3]}elle"
if mot_feminin in set_mots:
mot_inclusif = f"{mot[:-3]}eau{SEP}elle"
... | code_fim | hard | {
"lang": "python",
"repo": "Naereen/notebooks",
"path": "/Ecriture inclusive.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Naereen/notebooks path: /Ecriture inclusive.py
t présents ?
# In[21]:
nouveaux_mots_inclusifs_singuliers = []
nouveaux_mots_inclusifs_pluriels = []
for mot in tqdm(mots):
if mot.endswith("au") and len(mot) > 2 and mot + "x" in set_mots:
mot_feminin = f"{mot[:-2]}elle"
if m... | code_fim | hard | {
"lang": "python",
"repo": "Naereen/notebooks",
"path": "/Ecriture inclusive.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # only use first few principal components (optional)
if str(sys.argv[2]) == 'NA':
num_components = None
else:
num_components = int(sys.argv[2])
latent_train, latent_test, pca_model = pca(latent_train, latent_test, num_components, cfg.seed)
num_samples = 3
... | code_fim | hard | {
"lang": "python",
"repo": "BoyuanChen/neural-state-variables",
"path": "/analysis/eval_regression.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> phys_vars_list = []
for p_var in phys_all.keys():
if p_var == 'reject':
continue
for t in range(4):
phys_vars_list.append(f'{p_var} (t={t})')
num_data = ids.shape[0]
phys = {p_var:np.zeros(num_data) for p_var in phys_vars_list}
for n in... | code_fim | hard | {
"lang": "python",
"repo": "BoyuanChen/neural-state-variables",
"path": "/analysis/eval_regression.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BoyuanChen/neural-state-variables path: /analysis/eval_regression.py
import os
import sys
import numpy as np
from tqdm import tqdm
import json
import yaml
import pprint
from munch import munchify
from latent_regression import pca, mlp_regress
def load_config(filepath):
with open(filepath, '... | code_fim | hard | {
"lang": "python",
"repo": "BoyuanChen/neural-state-variables",
"path": "/analysis/eval_regression.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: icarus523/qcasDFtest path: /__start_qcas_unittesting_script.py
import subprocess
import getpass
import glob
import os
import hashlib
from datetime import datetime
from test_datafiles import Preferences
os.system('mode con: cols=150 lines=2500')
# input: file to be hashed using sha256(... | code_fim | hard | {
"lang": "python",
"repo": "icarus523/qcasDFtest",
"path": "/__start_qcas_unittesting_script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if my_preferences.will_skip_lengthy_validations():
print("\n ==== QCAS Unit Testing started on: " + str(datetime.now()) + " by: " + getpass.getuser() + " SKIPPING LENGTHY VALIDATIONS! ====\n")
else:
print("\n ==== QCAS Unit Testing started on: " + str(datetime.now()) + " by: " + getpass.getuse... | code_fim | medium | {
"lang": "python",
"repo": "icarus523/qcasDFtest",
"path": "/__start_qcas_unittesting_script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("\nQCAS Unit Testing Configuration: " + my_preferences.toJSON() + "\n")
print("\n ==== QCAS Unit Test script versions: ==== \n")
unit_test_files = glob.glob("test*.py")
for file in unit_test_files:
print("%30s\t%s" % (file, dohash_sha256(file)))
print("\n ==== Starting Unit Tests ====\n")... | code_fim | hard | {
"lang": "python",
"repo": "icarus523/qcasDFtest",
"path": "/__start_qcas_unittesting_script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return app.send_static_file("editor.html")
@app.route('/send', methods=['POST'])
def send_edit():
global site
data = request.get_json()
page = site.pages[data["title"]]
if page.exists:
print(data["title"], ": This page already exists!")
else:
print(data["title"], ... | code_fim | medium | {
"lang": "python",
"repo": "outloudvi/memewriter",
"path": "/app.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: outloudvi/memewriter path: /app.py
import mwclient
from flask import Flask, request, redirect, url_for, jsonify
app = Flask(__name__)
site = mwclient.Site("meme.outv.im", "/")
<|fim_suffix|>@app.route('/send', methods=['POST'])
def send_edit():
global site
data = request.get_json()
... | code_fim | hard | {
"lang": "python",
"repo": "outloudvi/memewriter",
"path": "/app.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
:param sequences_matrix: input of the neural net;
:param Y_train: output of the neural net;
:param num_intermediate_layers: the number of layers in between embedding and dense layers;
:return: the layers of the entire neural net in json format.
'''
... | code_fim | hard | {
"lang": "python",
"repo": "deeplearningforall/autonet",
"path": "/src/Model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deeplearningforall/autonet path: /src/Model.py
from keras.models import Model,load_model
from keras.models import model_from_json
from keras.models import Model,load_model
from keras.layers import Embedding
from keras.layers import Bidirectional
from keras.layers import LSTM, GRU
from keras.layer... | code_fim | hard | {
"lang": "python",
"repo": "deeplearningforall/autonet",
"path": "/src/Model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
:param config: the parameters passed for convolutional layer;
:param prev_layer: the upstream layer of the current layer;
:return: the added max pooling layer.
'''
pooling_layer = MaxPool1D(pool_size=config['pool_size'])(prev_layer)
return poolin... | code_fim | hard | {
"lang": "python",
"repo": "deeplearningforall/autonet",
"path": "/src/Model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zelin2022/rl_ntg path: /agent/myamqp/myamqp.py
import pika
import logging
class MyAmqp:
HEADER_GAME_START = "game start"
HEADER_GAME_MOVE = "move"
HEADER_GAME_END = "game end"
def __init__(self, target_queue, callback_method):
self.connection = None
self.channel ... | code_fim | hard | {
"lang": "python",
"repo": "zelin2022/rl_ntg",
"path": "/agent/myamqp/myamqp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setup(self):
logging.info("MyAmqp setup begin")
self.connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost', blocked_connection_timeout=3.0)) #modify this for wait time
self.channel = self.connection.channel()
result = self.channel... | code_fim | hard | {
"lang": "python",
"repo": "zelin2022/rl_ntg",
"path": "/agent/myamqp/myamqp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Used to change self.matrix (game state) by moving the matrix (game) numbers to given direction (key)
:param key: move (direction) to make
:return:
"""
# Used to check if Logic.[direction] worked
done = None
# Need to check if tuple or not... | code_fim | hard | {
"lang": "python",
"repo": "igorRomy/igor.romy",
"path": "/2048-python-master/AISearchesNoThread.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: igorRomy/igor.romy path: /2048-python-master/AISearchesNoThread.py
import random
from logic import Logic
import constants as c
import copy
from collections import defaultdict
class AISearchGridNoThread:
"""
Used to run AI searches
Every search method in this class will first move t... | code_fim | hard | {
"lang": "python",
"repo": "igorRomy/igor.romy",
"path": "/2048-python-master/AISearchesNoThread.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # All scores achieved at max depth are appended to list
all_scores = []
# See count as amount of nodes...
# The more the depth is expanded the more nodes each depth will have
# EXTRA: each deeper depth has 4 times more nodes than the previous depth
count = 4... | code_fim | hard | {
"lang": "python",
"repo": "igorRomy/igor.romy",
"path": "/2048-python-master/AISearchesNoThread.py",
"mode": "spm",
"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.